You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by am...@apache.org on 2008/12/23 18:01:35 UTC

svn commit: r729037 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java

Author: amilas
Date: Tue Dec 23 09:01:34 2008
New Revision: 729037

URL: http://svn.apache.org/viewvc?rev=729037&view=rev
Log:
Added an null check with gives an exception if there are no files

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java?rev=729037&r1=729036&r2=729037&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java Tue Dec 23 09:01:34 2008
@@ -188,36 +188,39 @@
 
         // Find all the files that do not have a lock by
         // checking if the lock file exists.
-        for (File tmpFile : tmpFiles) {
-            // Create a file to represent the lock and test.
-            File lockFile = new File(tmpFile.getParent(), tmpFile.getName() + ".lck");
-            if (!lockFile.exists()) {
-                // Delete the contents of the directory since
-                // it is no longer locked.
-                Logger.getLogger("default").log(Level.FINE,
-                                                "TempFileManager::deleting old temp directory " +
-                                                tmpFile);
+        if (tmpFiles != null) {
+            for (File tmpFile : tmpFiles) {
+                // Create a file to represent the lock and test.
+                File lockFile = new File(tmpFile.getParent(), tmpFile.getName() + ".lck");
+                if (!lockFile.exists()) {
+                    // Delete the contents of the directory since
+                    // it is no longer locked.
+                    Logger.getLogger("default").log(Level.FINE,
+                            "TempFileManager::deleting old temp directory " +
+                                    tmpFile);
 
-                try {
-                    recursiveDelete(tmpFile);
-                }
-                catch (IOException ex) {
-                    // You log at a fine level since not being able to delete
-                    // the temp directory should not stop the application
-                    // from performing correctly. However, if the application
-                    // generates a lot of temp files, this could become
-                    // a disk space problem and the level should be raised.
-                    Logger.getLogger("default").log(Level.INFO,
-                                                    "TempFileManager::unable to delete " +
-                                                    tmpFile.getAbsolutePath());
+                    try {
+                        recursiveDelete(tmpFile);
+                    }
+                    catch (IOException ex) {
+                        // You log at a fine level since not being able to delete
+                        // the temp directory should not stop the application
+                        // from performing correctly. However, if the application
+                        // generates a lot of temp files, this could become
+                        // a disk space problem and the level should be raised.
+                        Logger.getLogger("default").log(Level.INFO,
+                                "TempFileManager::unable to delete " +
+                                        tmpFile.getAbsolutePath());
 
-                    // Print the exception.
-                    ByteArrayOutputStream ostream = new ByteArrayOutputStream();
-                    ex.printStackTrace(new PrintStream(ostream));
+                        // Print the exception.
+                        ByteArrayOutputStream ostream = new ByteArrayOutputStream();
+                        ex.printStackTrace(new PrintStream(ostream));
 
-                    Logger.getLogger("default").log(Level.FINE, ostream.toString());
+                        Logger.getLogger("default").log(Level.FINE, ostream.toString());
+                    }
                 }
             }
         }
+
     }
 }