You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ho...@apache.org on 2007/08/15 19:05:17 UTC

svn commit: r566266 - /geronimo/server/branches/2.0.1/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java

Author: hogstrom
Date: Wed Aug 15 10:05:16 2007
New Revision: 566266

URL: http://svn.apache.org/viewvc?view=rev&rev=566266
Log:
GERONIMO-3387 Unable to deploy an ear file (that contains a war file) if web.xml isn't supplied in the war file.  This fix has already been applied to trunk and branches/2.0

Modified:
    geronimo/server/branches/2.0.1/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java

Modified: geronimo/server/branches/2.0.1/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0.1/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java?view=diff&rev=566266&r1=566265&r2=566266
==============================================================================
--- geronimo/server/branches/2.0.1/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java (original)
+++ geronimo/server/branches/2.0.1/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java Wed Aug 15 10:05:16 2007
@@ -70,6 +70,15 @@
         tempFile.deleteOnExit();
         return tempFile;
     }
+    
+    // be careful to clean up the temp file... we tell the vm to delete this on exit
+    // but VMs can't be trusted to acutally delete the file
+    private static File createTempFile(String extension) throws IOException {
+        File tempFile = File.createTempFile("geronimo-deploymentUtil", extension == null? ".tmpdir": extension);
+        tempFile.deleteOnExit();
+        return tempFile;
+    }
+
 
     public static void copyFile(File source, File destination) throws IOException {
         File destinationDir = destination.getParentFile();
@@ -107,7 +116,13 @@
         try {
             in = url.openStream();
 
-            File tempFile = createTempFile();
+            int index = url.getPath().lastIndexOf(".");
+            String extension = null;
+            if (index > 0) {
+                extension = url.getPath().substring(index);
+            }
+            File tempFile = createTempFile(extension);
+
             out = new FileOutputStream(tempFile);
 
             writeAll(in, out);