From 98c5de8949ab566fe3bca0b34c755aa2068fc972 Mon Sep 17 00:00:00 2001 From: "Travis CI (pmd-bot)" Date: Sat, 8 Dec 2018 19:37:25 +0000 Subject: [PATCH] Update documentation TRAVIS_JOB_NUMBER=3177.1 TRAVIS_COMMIT_RANGE=c9bdcf6ef6e9...16c7017aa923 --- docs/pages/pmd/rules/java/performance.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/pages/pmd/rules/java/performance.md b/docs/pages/pmd/rules/java/performance.md index 80ca0ca67f..adb891150c 100644 --- a/docs/pages/pmd/rules/java/performance.md +++ b/docs/pages/pmd/rules/java/performance.md @@ -121,15 +121,23 @@ public class Test { **Minimum Language Version:** Java 1.7 -The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage collection pauses. See [JDK-8080225](https://bugs.openjdk.java.net/browse/JDK-8080225) for details. +The FileInputStream and FileOutputStream classes contains a finalizer method which will cause garbage +collection pauses. +See [JDK-8080225](https://bugs.openjdk.java.net/browse/JDK-8080225) for details. -The FileReader and FileWriter constructors instantiate FileInputStream and FileOutputStream, again causing garbage collection issues while finalizer methods are called. +The FileReader and FileWriter constructors instantiate FileInputStream and FileOutputStream, +again causing garbage collection issues while finalizer methods are called. * Use `Files.newInputStream(Paths.get(fileName))` instead of `new FileInputStream(fileName)`. * Use `Files.newOutputStream(Paths.get(fileName))` instead of `new FileOutputStream(fileName)`. * Use `Files.newBufferedReader(Paths.get(fileName))` instead of `new FileReader(fileName)`. * Use `Files.newBufferedWriter(Paths.get(fileName))` instead of `new FileWriter(fileName)`. +Please note, that the `java.nio` API does not throw a `FileNotFoundException` anymore, instead +it throws a `NoSuchFileException`. If your code dealt explicitly with a `FileNotFoundException`, +then this needs to be adjusted. Both exceptions are subclasses of `IOException`, so catching +that one covers both. + **This rule is defined by the following XPath expression:** ``` xpath //PrimaryPrefix/AllocationExpression/ClassOrInterfaceType[