ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r741505 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java
Date Fri, 06 Feb 2009 10:20:47 GMT
Author: jkf
Date: Fri Feb  6 10:20:47 2009
New Revision: 741505

URL: http://svn.apache.org/viewvc?rev=741505&view=rev
Log:
Removed the own implementation for creating a temporary file, in case deletion of temp file
fails, added it as candidate for deletion on exit.

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

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java?rev=741505&r1=741504&r2=741505&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jikes.java Fri Feb  6 10:20:47 2009
@@ -21,7 +21,6 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.util.Random;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -86,9 +85,8 @@
                 && args.length > MAX_FILES_ON_COMMAND_LINE) {
                 PrintWriter out = null;
                 try {
-                    String tempFileName = "jikes"
-                        + (new Random(System.currentTimeMillis())).nextLong();
-                    tmpFile = new File(tempFileName);
+                    tmpFile = FileUtils.getFileUtils().createTempFile("jikes",
+                            "tmp", null, false, true);
                     out = new PrintWriter(new FileWriter(tmpFile));
                     for (int i = 0; i < args.length; i++) {
                         out.println(args[i]);
@@ -123,7 +121,9 @@
             }
         } finally {
             if (tmpFile != null) {
-                tmpFile.delete();
+                if (!tmpFile.delete()) {
+                    tmpFile.deleteOnExit();
+                }
             }
         }
     }



Mime
View raw message