tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1297576 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
Date Tue, 06 Mar 2012 17:02:43 GMT
Author: rmannibucau
Date: Tue Mar  6 17:02:43 2012
New Revision: 1297576

URL: http://svn.apache.org/viewvc?rev=1297576&view=rev
Log:
trying to recover if the app doesn't have write permissions on tmp folder

Modified:
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java?rev=1297576&r1=1297575&r2=1297576&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
(original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/assembler/DeployerEjb.java
Tue Mar  6 17:02:43 2012
@@ -66,12 +66,25 @@ public class DeployerEjb implements Depl
     static {
         String uniqueName = "OpenEJB-" + new BigInteger(128, new SecureRandom()).toString(Character.MAX_RADIX);
         String tempDir = System.getProperty("java.io.tmpdir");
+        File unique = null;
         try {
-            uniqueFile = new File(tempDir, uniqueName).getCanonicalFile();
-            uniqueFile.createNewFile();
+            unique = new File(tempDir, uniqueName).getCanonicalFile();
+            unique.createNewFile();
         } catch (IOException e) {
-            throw new OpenEJBRuntimeException(e);
+            // same trying in work directory
+            unique = new File(SystemInstance.get().getHome().getDirectory(), "work");
+            if (unique.exists()) {
+                try {
+                    unique = new File(unique, uniqueName).getCanonicalFile();
+                    unique.createNewFile();
+                } catch (IOException e1) {
+                    throw new OpenEJBRuntimeException(e);
+                }
+            } else {
+                throw new OpenEJBRuntimeException("can't create unique file, please set java.io.tmpdir
to a writable folder or create work folder", e);
+            }
         }
+        uniqueFile = unique;
         uniqueFile.deleteOnExit();
     }
 



Mime
View raw message