Repository: karaf Updated Branches: refs/heads/karaf-3.0.x 830251463 -> 0581f0786
[KARAF-448] Make scanning for MANIFEST.MF in jar consistent between osgi:install and feature:install Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/0581f078 Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/0581f078 Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/0581f078 Branch: refs/heads/karaf-3.0.x Commit: 0581f0786340960a4f28dccc25fb6660ea620a18 Parents: 8302514 Author: Guillaume Nodet <gno...@gmail.com> Authored: Wed May 21 00:28:08 2014 +0200 Committer: Guillaume Nodet <gno...@gmail.com> Committed: Wed May 21 00:28:08 2014 +0200 ---------------------------------------------------------------------- .../apache/karaf/features/internal/BundleManager.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/0581f078/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java ---------------------------------------------------------------------- diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java b/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java index cd744f0..1eb0d06 100644 --- a/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java +++ b/features/core/src/main/java/org/apache/karaf/features/internal/BundleManager.java @@ -37,6 +37,7 @@ import java.util.Map; import java.util.Set; import java.util.jar.JarInputStream; import java.util.jar.Manifest; +import java.util.zip.ZipEntry; import org.apache.felix.utils.manifest.Clause; import org.apache.felix.utils.manifest.Parser; @@ -61,6 +62,8 @@ import org.osgi.util.tracker.ServiceTracker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static java.util.jar.JarFile.MANIFEST_NAME; + public class BundleManager { private static final Logger LOGGER = LoggerFactory.getLogger(BundleManager.class); @@ -96,7 +99,16 @@ public class BundleManager { JarInputStream jar = new JarInputStream(is); Manifest m = jar.getManifest(); if (m == null) { - throw new BundleException("Manifest not present in the first entry of the zip " + bundleLocation); + ZipEntry entry; + while ((entry = jar.getNextEntry()) != null) { + if (MANIFEST_NAME.equals(entry.getName())) { + m = new Manifest(jar); + break; + } + } + if (m == null) { + throw new BundleException("Manifest not present in the zip " + bundleLocation); + } } String sn = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME); if (sn == null) {