You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2016/06/05 16:49:18 UTC

svn commit: r1746932 - /poi/trunk/src/java/org/apache/poi/util/TempFile.java

Author: kiwiwings
Date: Sun Jun  5 16:49:18 2016
New Revision: 1746932

URL: http://svn.apache.org/viewvc?rev=1746932&view=rev
Log:
try to find out temp file errors on maven build

Modified:
    poi/trunk/src/java/org/apache/poi/util/TempFile.java

Modified: poi/trunk/src/java/org/apache/poi/util/TempFile.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/TempFile.java?rev=1746932&r1=1746931&r2=1746932&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/TempFile.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/TempFile.java Sun Jun  5 16:49:18 2016
@@ -96,20 +96,24 @@ public final class TempFile {
         public File createTempFile(String prefix, String suffix) throws IOException {
             // Identify and create our temp dir, if needed
             if (dir == null) {
-                dir = new File(System.getProperty(JAVA_IO_TMPDIR), "poifiles");
-                if(!dir.exists()) {
-                    if(!dir.mkdirs()) {
-                        throw new IOException("Could not create temporary directory '" + dir + "'");
-                    }
+                String tmpDir = System.getProperty(JAVA_IO_TMPDIR);
+                if (tmpDir == null) {
+                    throw new IOException("Systems temporary directory not defined - set the -D"+JAVA_IO_TMPDIR+" jvm property!");
                 }
+                dir = new File(tmpDir, "poifiles");
             }
 
+             if (!(dir.exists() || dir.mkdirs()) || !dir.isDirectory()) {
+                throw new IOException("Could not create temporary directory '" + dir + "'");
+            }
+            
             // Generate a unique new filename 
             File newFile = File.createTempFile(prefix, suffix, dir);
 
             // Set the delete on exit flag, unless explicitly disabled
-            if (System.getProperty("poi.keep.tmp.files") == null)
+            if (System.getProperty("poi.keep.tmp.files") == null) {
                 newFile.deleteOnExit();
+            }
 
             // All done
             return newFile;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org