You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/10/18 23:27:07 UTC

[sling-org-apache-sling-installer-factory-subsystems] 05/15: Fix subystem manifest reading

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

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-subsystems.git

commit 30d06c9834b5e457839409ab807b8ae809f56e7b
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Oct 2 13:46:02 2014 +0000

    Fix subystem manifest reading
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1628970 13f79535-47bb-0310-9956-ffa450edef68
---
 .../subsystems/impl/SubsystemInstaller.java        | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java
index 2b4b3c5..ea47728 100644
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java
+++ b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java
@@ -23,8 +23,9 @@ import java.io.InputStream;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
 
 import org.apache.sling.installer.api.InstallableResource;
 import org.apache.sling.installer.api.tasks.ChangeStateTask;
@@ -229,17 +230,18 @@ public class SubsystemInstaller
         Manifest result = null;
 
         if ( ins != null ) {
-            JarInputStream jis = null;
+            ZipInputStream jis = null;
             try {
-                jis = new JarInputStream(ins);
-                result = jis.getManifest();
-
-                // SLING-2288 : if this is a jar file, but the manifest is not the first entry
-                //              log a warning
-                if ( rsrc.getURL().endsWith(".jar") && result == null ) {
-                    logger.warn("Resource {} does not have the manifest as its first entry in the archive. If this is " +
-                                "a subsystem, make sure to put the manifest first in the jar file.", rsrc.getURL());
+                jis = new ZipInputStream(ins);
+
+                ZipEntry entry;
+
+                while ( (entry = jis.getNextEntry()) != null ) {
+                    if (entry.getName().equals("OSGI-INF/SUBSYSTEM.MF") ) {
+                        result = new Manifest(jis);
+                    }
                 }
+
             } finally {
 
                 // close the jar stream or the input stream, if the jar

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.