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 2014/10/02 15:46:02 UTC

svn commit: r1628970 - /sling/trunk/installer/factories/subsystems/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java

Author: cziegeler
Date: Thu Oct  2 13:46:02 2014
New Revision: 1628970

URL: http://svn.apache.org/r1628970
Log:
Fix subystem manifest reading

Modified:
    sling/trunk/installer/factories/subsystems/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java

Modified: sling/trunk/installer/factories/subsystems/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/subsystems/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java?rev=1628970&r1=1628969&r2=1628970&view=diff
==============================================================================
--- sling/trunk/installer/factories/subsystems/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java (original)
+++ sling/trunk/installer/factories/subsystems/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java Thu Oct  2 13:46:02 2014
@@ -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();
+                jis = new ZipInputStream(ins);
 
-                // 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());
+                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