geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lin...@apache.org
Subject svn commit: r563896 - /geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
Date Wed, 08 Aug 2007 14:25:25 GMT
Author: linsun
Date: Wed Aug  8 07:25:24 2007
New Revision: 563896

URL: http://svn.apache.org/viewvc?view=rev&rev=563896
Log:
merge in rev 563893 from trunk

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

Modified: geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java?view=diff&rev=563896&r1=563895&r2=563896
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
(original)
+++ geronimo/server/branches/2.0/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/util/DeploymentUtil.java
Wed Aug  8 07:25:24 2007
@@ -70,6 +70,14 @@
         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 +115,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);



Mime
View raw message