You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2009/03/11 17:12:06 UTC

svn commit: r752493 - /geronimo/server/trunk/plugins/clustering/geronimo-deploy-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java

Author: gawor
Date: Wed Mar 11 16:12:05 2009
New Revision: 752493

URL: http://svn.apache.org/viewvc?rev=752493&view=rev
Log:
Create zip file with proper filenames. Based on patch from Shawn Jiang (GERONIMO-4579)

Modified:
    geronimo/server/trunk/plugins/clustering/geronimo-deploy-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java

Modified: geronimo/server/trunk/plugins/clustering/geronimo-deploy-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-deploy-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java?rev=752493&r1=752492&r2=752493&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/clustering/geronimo-deploy-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java (original)
+++ geronimo/server/trunk/plugins/clustering/geronimo-deploy-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java Wed Mar 11 16:12:05 2009
@@ -56,7 +56,7 @@
         unpack(targetDir, packedConfigurationDir);
         return targetDir;
     }
-    
+     
     public void unpack(File targetDir, File packedConfigurationDir) throws IOException {
         ZipFile zipFile = new ZipFile(packedConfigurationDir);
         Enumeration<? extends ZipEntry> zipEntries = zipFile.entries();
@@ -83,6 +83,7 @@
                 out.close();
             }
         }
+        zipFile.close();
     }
     
     protected void zip(ZipOutputStream zos, File configurationDir, File nestedFile) throws IOException {
@@ -94,7 +95,7 @@
         } else {
             String nestedFilePath = nestedFile.getAbsolutePath();
             String zipEntryName = nestedFilePath.substring(configurationDir.getAbsolutePath().length() + 1, nestedFilePath.length());
-            ZipEntry zipEntry = new ZipEntry(zipEntryName);
+            ZipEntry zipEntry = new ZipEntry(normalizePathOfEntry(zipEntryName));
             zos.putNextEntry(zipEntry);
             
             InputStream in = new FileInputStream(nestedFile);
@@ -110,5 +111,9 @@
             zos.closeEntry();
         }
     }
+    
+    private String normalizePathOfEntry(String entryName){
+        return entryName.replace('\\', '/');
+    }
 
 }