You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/06/20 16:02:33 UTC

svn commit: r1495007 - /commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/JavadocFixTool.java

Author: sebb
Date: Thu Jun 20 14:02:33 2013
New Revision: 1495007

URL: http://svn.apache.org/r1495007
Log:
More Findbugs fixes

Modified:
    commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/JavadocFixTool.java

Modified: commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/JavadocFixTool.java
URL: http://svn.apache.org/viewvc/commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/JavadocFixTool.java?rev=1495007&r1=1495006&r2=1495007&view=diff
==============================================================================
--- commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/JavadocFixTool.java (original)
+++ commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/JavadocFixTool.java Thu Jun 20 14:02:33 2013
@@ -90,6 +90,8 @@
  * - closed br in replaceStringInFile method. This allows input file to be deleted on Windows
  * - closed br in applyPatch method
  * - make remaining string constants static and final
+ * - close readmeReader (at least if no exception occurs)
+ * - add markers suggested by Findbugs
  */
 
 package org.apache.commons.plugins.javadocfix;
@@ -207,7 +209,7 @@ public class JavadocFixTool {
         try {
             InputStream readmeStream = JavadocFixTool.class.getResourceAsStream("/README");
             if (readmeStream != null) {
-                BufferedReader readmeReader = new BufferedReader(new InputStreamReader(readmeStream));
+                BufferedReader readmeReader = new BufferedReader(new InputStreamReader(readmeStream)); // TODO encoding?
                 StringBuilder readmeBuilder = new StringBuilder();
                 String s;
                 while ((s = readmeReader.readLine()) != null) {
@@ -215,6 +217,7 @@ public class JavadocFixTool {
                     readmeBuilder.append("\n");
                 }
                 readme = readmeBuilder.toString();
+                readmeReader.close();
             }
         } catch (IOException ignore) {} // Ignore exception - readme not initialized
     }
@@ -282,7 +285,7 @@ public class JavadocFixTool {
      */
     public void applyPatch(File file, File currentFolder) throws Exception {
         FileInputStream fis = new FileInputStream(file);
-        BufferedReader br = new BufferedReader(new InputStreamReader(fis));
+        BufferedReader br = new BufferedReader(new InputStreamReader(fis)); // TODO encoding?
         String line;
         String failedString = patchString;
         String[] patch = patchData;
@@ -341,8 +344,8 @@ public class JavadocFixTool {
         temporaryFile.createNewFile(); // TODO check return - what if this fails?
         String line;
         FileInputStream fis = new FileInputStream(origFile);
-        PrintWriter pw = new PrintWriter(temporaryFile);
-        BufferedReader br = new BufferedReader(new InputStreamReader(fis));
+        PrintWriter pw = new PrintWriter(temporaryFile); // TODO encoding?
+        BufferedReader br = new BufferedReader(new InputStreamReader(fis)); // TODO encoding?
         while ((line = br.readLine()) != null) {
             if (line.trim().equals(template)) {
                 for (String s : replacement) {