[jboss-svn-commits] JBoss Common SVN: r3832 - in shrinkwrap/trunk/impl-base/src: test/java/org/jboss/shrinkwrap/impl/base/exporter and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Dec 4 21:20:53 EST 2009


Author: ALRubinger
Date: 2009-12-04 21:20:53 -0500 (Fri, 04 Dec 2009)
New Revision: 3832

Modified:
   shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportDelegate.java
   shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java
Log:
[SHRINKWRAP-96] DO not explicitly write the root context during Zip export (and test)

Modified: shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportDelegate.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportDelegate.java	2009-12-04 20:22:54 UTC (rev 3831)
+++ shrinkwrap/trunk/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExportDelegate.java	2009-12-05 02:20:53 UTC (rev 3832)
@@ -135,8 +135,15 @@
       final Path parent = getParent(path);
       if (parent != null && !this.pathsExported.contains(parent))
       {
-         // Process the parent without any asset (it's a directory)
-         this.processAsset(parent, null);
+         // If this is not the root
+         // SHRINKWRAP-96
+         final Path grandParent = getParent(parent);
+         final boolean isRoot = grandParent == null;
+         if (!isRoot)
+         {
+            // Process the parent without any asset (it's a directory)
+            this.processAsset(parent, null);
+         }
       }
       // Mark if we're writing a directory
       final boolean isDirectory = asset == null;

Modified: shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java
===================================================================
--- shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java	2009-12-04 20:22:54 UTC (rev 3831)
+++ shrinkwrap/trunk/impl-base/src/test/java/org/jboss/shrinkwrap/impl/base/exporter/ZipExporterTestCase.java	2009-12-05 02:20:53 UTC (rev 3832)
@@ -90,6 +90,11 @@
       // Validate all paths were written
       // SHRINKWRAP-94
       getEntryFromZip(expectedZip, NESTED_PATH);
+      
+      // Ensure we don't write the root PAth
+      // SHRINKWRAP-96
+      ZipEntry rootEntry = expectedZip.getEntry("/");
+      Assert.assertNull("ZIP should not have explicit root path written (SHRINKWRAP-96)", rootEntry);
    }
 
    /**



More information about the jboss-svn-commits mailing list