You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2020/03/27 06:47:41 UTC

[sling-org-apache-sling-feature-io] branch master updated: SLING-9261 : Do not compress feature archive at all

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-io.git


The following commit(s) were added to refs/heads/master by this push:
     new d47a404  SLING-9261 : Do not compress feature archive at all
d47a404 is described below

commit d47a404006a973a384d00622fab38a9062054741
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Mar 27 07:47:25 2020 +0100

    SLING-9261 : Do not compress feature archive at all
---
 .../org/apache/sling/feature/io/archive/ArchiveWriter.java  | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/io/archive/ArchiveWriter.java b/src/main/java/org/apache/sling/feature/io/archive/ArchiveWriter.java
index e9de733..a4d6e29 100644
--- a/src/main/java/org/apache/sling/feature/io/archive/ArchiveWriter.java
+++ b/src/main/java/org/apache/sling/feature/io/archive/ArchiveWriter.java
@@ -57,9 +57,10 @@ public class ArchiveWriter {
 
     /**
      * Create a feature model archive. The output stream will not be closed by this
-     * method. The caller must call {@link JarOutputStream#close()} or
-     * {@link JarOutputStream#finish()} on the return output stream. The caller can
-     * add additional files through the return stream.
+     * method. The caller must call {@link JarOutputStream#close()}
+     * on the return output stream. The caller can
+     * add additional files through the return stream. However, the files
+     * should not be compressed (which is the default for the output stream).
      *
      * A feature model can be in different states: it might be a partial feature
      * model, a complete feature model or an assembled feature model. This method
@@ -89,8 +90,8 @@ public class ArchiveWriter {
         // create archive
         final JarOutputStream jos = new JarOutputStream(out, manifest);
 
-        // write models first with compression enabled
-        jos.setLevel(Deflater.BEST_COMPRESSION);
+        // write everything without compression
+        jos.setLevel(Deflater.NO_COMPRESSION);
         for (final Feature feature : features) {
             final JarEntry entry = new JarEntry(feature.getId().toMvnPath());
             jos.putNextEntry(entry);
@@ -100,8 +101,6 @@ public class ArchiveWriter {
             jos.closeEntry();
         }
 
-        // write artifacts with compression disabled
-        jos.setLevel(Deflater.NO_COMPRESSION);
         final byte[] buffer = new byte[1024*1024*256];
 
         final Set<ArtifactId> artifacts = new HashSet<>();