jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1773013 - in /jackrabbit/commons/filevault/trunk/vault-core/src: main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
Date Wed, 07 Dec 2016 05:57:33 GMT
Author: tripod
Date: Wed Dec  7 05:57:32 2016
New Revision: 1773013

URL: http://svn.apache.org/viewvc?rev=1773013&view=rev
Log:
JCRVLT-143 JcrPackage.extractSubpackages() aborts if subpackage already exists

Modified:
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
    jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java?rev=1773013&r1=1773012&r2=1773013&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageImpl.java
Wed Dec  7 05:57:32 2016
@@ -533,7 +533,13 @@ public class JcrPackageImpl implements J
             InputStream ins = null;
             try {
                 ins = in.getByteStream();
-                JcrPackageImpl subPackage = (JcrPackageImpl) mgr.upload(ins, false, true);
+                JcrPackageImpl subPackage;
+                try {
+                    subPackage = (JcrPackageImpl) mgr.upload(ins, true, true);
+                } catch (RepositoryException e1) {
+                    log.error("Package {}: Error while extracting subpackage {}: {}", pId,
in.getSystemId());
+                    continue;
+                }
 
                 // add dependency to this package
                 Dependency[] oldDeps = subPackage.getDefinition().getDependencies();

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java?rev=1773013&r1=1773012&r2=1773013&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestSubPackages.java
Wed Dec  7 05:57:32 2016
@@ -349,6 +349,31 @@ public class TestSubPackages extends Int
     }
 
     /**
+     * Test if subpackage extraction works twice
+     */
+    @Test
+    public void testPackageExtractTwice() throws IOException, RepositoryException, PackageException
{
+        JcrPackage pack = packMgr.upload(getStream("testpackages/subtest.zip"), false);
+        assertNotNull(pack);
+
+        // install
+        ImportOptions opts = getDefaultOptions();
+        PackageId[] ids = pack.extractSubpackages(opts);
+        PackageId pid = ids[0];
+        JcrPackage subPackage = packMgr.open(pid);
+        subPackage.install(opts);
+        assertTrue("Package is installed", subPackage.isInstalled());
+
+        ids = pack.extractSubpackages(opts);
+        assertEquals("Package Id", ids[0].toString(), "my_packages:sub_a");
+        assertEquals("Package Id", ids[1].toString(), "my_packages:sub_b");
+
+        subPackage = packMgr.open(pid);
+        subPackage.install(opts);
+        assertTrue("Package is still installed", subPackage.isInstalled());
+    }
+
+    /**
      * Test if extracted sub-packages have their parent package as dependency, even if not
specified in their properties.
      */
     @Test



Mime
View raw message