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

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

commit 187acd0a91f17cb6230fcbc624b3f88b3c9b1538
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Thu Oct 2 13:46:02 2014 +0000

    Fix subystem manifest reading
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/installer/factories/subsystems@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
"[email protected]" <[email protected]>.

Reply via email to