jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1680359 - in /jackrabbit/commons/filevault/trunk/vault-core/src: main/java/org/apache/jackrabbit/vault/packaging/impl/ test/java/org/apache/jackrabbit/vault/packaging/integration/
Date Tue, 19 May 2015 18:01:02 GMT
Author: tripod
Date: Tue May 19 18:01:01 2015
New Revision: 1680359

URL: http://svn.apache.org/r1680359
Log:
JCRVLT-92 Package rewrap broken for packages smaller than 1mb since introduction of memory
archive

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/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java
    jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.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=1680359&r1=1680358&r2=1680359&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
Tue May 19 18:01:01 2015
@@ -41,6 +41,7 @@ import org.apache.jackrabbit.vault.fs.ap
 import org.apache.jackrabbit.vault.fs.io.AccessControlHandling;
 import org.apache.jackrabbit.vault.fs.io.ImportOptions;
 import org.apache.jackrabbit.vault.fs.io.MemoryArchive;
+import org.apache.jackrabbit.vault.fs.io.ZipArchive;
 import org.apache.jackrabbit.vault.packaging.CyclicDependencyException;
 import org.apache.jackrabbit.vault.packaging.DependencyUtil;
 import org.apache.jackrabbit.vault.packaging.ExportOptions;
@@ -318,6 +319,27 @@ public class JcrPackageImpl implements J
      * {@inheritDoc}
      */
     public VaultPackage getPackage() throws RepositoryException, IOException {
+        return getPackage(false);
+    }
+
+    /**
+     * Creates a new package by creating the appropriate archive.
+     *
+     * This is basically a workaround to ensure that 'rewrap' has a zip file to work on.
+     * Ideally rewrap should not realy on the archive format.
+     *
+     * @param forceFileArchive if {@code true} a file archive is enforced
+     * @return the package
+     *
+     * @throws RepositoryException
+     * @throws IOException
+     */
+    protected VaultPackage getPackage(boolean forceFileArchive) throws RepositoryException,
IOException {
+        if (forceFileArchive && pack != null && !(pack.getArchive() instanceof
ZipArchive)) {
+            pack.close();
+            pack = null;
+        }
+
         if (pack == null) {
             long size = -1;
             try {
@@ -325,7 +347,7 @@ public class JcrPackageImpl implements J
             } catch (RepositoryException e) {
                 // ignore
             }
-            if (size >= 0 && size < 1024*1024) {
+            if (!forceFileArchive && size >= 0 && size < 1024*1024)
{
                 MemoryArchive archive = new MemoryArchive(false);
                 InputStream in = getData().getStream();
                 try {

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java?rev=1680359&r1=1680358&r2=1680359&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/JcrPackageManagerImpl.java
Tue May 19 18:01:01 2015
@@ -524,7 +524,7 @@ public class JcrPackageManagerImpl exten
      */
     public void rewrap(JcrPackage pack, ProgressTrackerListener listener)
             throws PackageException, RepositoryException, IOException {
-        VaultPackage src = pack.getPackage();
+        VaultPackage src = ((JcrPackageImpl) pack).getPackage(true);
 
         Calendar now = Calendar.getInstance();
         pack.verifyId(true, false);

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java?rev=1680359&r1=1680358&r2=1680359&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/packaging/integration/TestPackageInstall.java
Tue May 19 18:01:01 2015
@@ -60,10 +60,9 @@ public class TestPackageInstall extends
     }
 
     /**
-     * Installs a package that contains and checks if everything is correct.
+     * Test if rewrap of a small package works
      */
     @Test
-    @Ignore("JCRVLT-92")
     public void testRewrap() throws RepositoryException, IOException, PackageException {
         JcrPackage pack = packMgr.upload(getStream("testpackages/tmp.zip"), false);
         assertNotNull(pack);



Mime
View raw message