Fix subystem manifest reading
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1628970 13f79535-47bb-0310-9956-ffa450edef68
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.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 @@
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