geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r752494 - /geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java
Date Wed, 11 Mar 2009 16:12:24 GMT
Author: gawor
Date: Wed Mar 11 16:12:23 2009
New Revision: 752494

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

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

Modified: geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java?rev=752494&r1=752493&r2=752494&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java
(original)
+++ geronimo/server/branches/2.1/plugins/clustering/geronimo-farm/src/main/java/org/apache/geronimo/farm/deployment/ZipDirectoryPackager.java
Wed Mar 11 16:12:23 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('\\', '/');
+    }
 
 }



Mime
View raw message