You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2008/03/18 00:15:47 UTC

svn commit: r638131 - in /geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src: main/java/org/apache/geronimo/system/plugin/ test/java/org/apache/geronimo/system/plugin/ test/resources/copyfiletest/repository/test/jar/ test/resources/copy...

Author: djencks
Date: Mon Mar 17 16:15:45 2008
New Revision: 638131

URL: http://svn.apache.org/viewvc?rev=638131&view=rev
Log:
GERONIMO-3927 Allow plugin installer to unpack non-empty directories and files from packed jars as well as unpacked cars

Added:
    geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/test/resources/copyfiletest/repository/test/jar/
      - copied from r638129, geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/resources/copyfiletest/repository/test/jar/
    geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/test/resources/copyfiletest/repository/test/jar/1.0/
      - copied from r638129, geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/resources/copyfiletest/repository/test/jar/1.0/
    geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/test/resources/copyfiletest/repository/test/jar/1.0/jar-1.0.jar
      - copied unchanged from r638129, geronimo/server/trunk/framework/modules/geronimo-plugin/src/test/resources/copyfiletest/repository/test/jar/1.0/jar-1.0.jar
Modified:
    geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
    geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java

Modified: geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=638131&r1=638130&r2=638131&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java (original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Mon Mar 17 16:15:45 2008
@@ -1218,7 +1218,7 @@
             if (start == -1) {
                 if (sourceFile.length() == 0 || sourceFile.endsWith("/")) {
                     if ("jar".equals(url.getProtocol())) {
-                        start = path.lastIndexOf("!/") + 2;
+                        start = path.lastIndexOf("!/") + 2 + sourceFile.length();
                     } else {
                         start = path.length();
                         //this entry needs nothing done

Modified: geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java?rev=638131&r1=638130&r2=638131&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java (original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-plugin/src/test/java/org/apache/geronimo/system/plugin/CopyFileTest.java Mon Mar 17 16:15:45 2008
@@ -143,6 +143,27 @@
         assertTrue(new File(dir, "emptydir1").exists());
         assertTrue(new File(dir, "emptyfile1").exists());
     }
+    
+    public void testCopyFileFromJar() throws Exception {
+        artifact = new Artifact("test", "jar", "1.0", "jar");
+        testCopyFile();
+    }
+/*  ZipEntry cannot detect an empty directory in a jar
+    public void testCopyEmptyDirFromJar() throws Exception {
+        artifact = new Artifact("test", "jar", "1.0", "jar");
+        testCopyEmptyDir();
+    }
+*/
+/*  ZipEntry cannot detect an empty directory in a jar
+    public void testCopyDirFromJar() throws Exception {
+        artifact = new Artifact("test", "jar", "1.0", "jar");
+        testCopyDir();
+    }
+*/
+    public void testCopyDirsFromJar() throws Exception {
+        artifact = new Artifact("test", "jar", "1.0", "jar");
+        testCopyDirs();
+    }
 
     private File checkCopy(CopyFileType copyFile) throws IOException {
         installer.copyFile(copyFile, artifact);