ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgl...@apache.org
Subject svn commit: r1294345 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
Date Mon, 27 Feb 2012 21:43:30 GMT
Author: jglick
Date: Mon Feb 27 21:43:29 2012
New Revision: 1294345

URL: http://svn.apache.org/viewvc?rev=1294345&view=rev
Log:
#52740: safer stream closing.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java?rev=1294345&r1=1294344&r2=1294345&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java Mon Feb 27 21:43:29
2012
@@ -1708,31 +1708,34 @@ public class Javadoc extends Task {
         }
 
         File tmpList = null;
-        BufferedWriter srcListWriter = null;
-
+        FileWriter wr = null;
         try {
             /**
              * Write sourcefiles and package names to a temporary file
              * if requested.
              */
+            BufferedWriter srcListWriter = null;
             if (useExternalFile) {
                 tmpList = FILE_UTILS.createTempFile("javadoc", "", null, true, true);
                 toExecute.createArgument()
                     .setValue("@" + tmpList.getAbsolutePath());
-                srcListWriter = new BufferedWriter(
-                    new FileWriter(tmpList.getAbsolutePath(),
-                                   true));
+                wr = new FileWriter(tmpList.getAbsolutePath(), true);
+                srcListWriter = new BufferedWriter(wr);
             }
 
             doSourceAndPackageNames(
                 toExecute, packagesToDoc, sourceFilesToDoc,
                 useExternalFile, tmpList, srcListWriter);
+
+            if (useExternalFile) {
+                srcListWriter.flush();
+            }
         } catch (IOException e) {
             tmpList.delete();
             throw new BuildException("Error creating temporary file",
                                      e, getLocation());
         } finally {
-            FileUtils.close(srcListWriter);
+            FileUtils.close(wr);
         }
 
         if (packageList != null) {



Mime
View raw message