commit | 09ba037aa4845fce49ac6b4b73f9452854432d2f | [log] [tgz] |
---|---|---|
author | Guillaume Nodet <gnodet@apache.org> | Tue Oct 26 07:02:02 2010 +0000 |
committer | Guillaume Nodet <gnodet@apache.org> | Tue Oct 26 07:02:02 2010 +0000 |
tree | d6bb0d1cb7cddf2a48075e4cc0e97ae7fdef3d32 | |
parent | 7510d3f8751d9b967dff3abd01eb60b5531a443f [diff] |
[FELIX-2318] Possible NPE for jars with null Manifest git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1027387 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/BundleTransformer.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/BundleTransformer.java index 563d895..f269dea 100644 --- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/BundleTransformer.java +++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/BundleTransformer.java
@@ -49,7 +49,7 @@ } jar = new JarFile(artifact); Manifest m = jar.getManifest(); - if (m.getMainAttributes().getValue(new Attributes.Name("Bundle-SymbolicName")) != null) + if (m != null && m.getMainAttributes().getValue(new Attributes.Name("Bundle-SymbolicName")) != null) { return true; }
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java index b455d82..a7e3620 100644 --- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java +++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/DirectoryWatcher.java
@@ -921,6 +921,11 @@ is.mark(256 * 1024); JarInputStream jar = new JarInputStream(is); Manifest m = jar.getManifest(); + if( m == null ) { + throw new BundleException( + "The bundle " + bundleLocation + " does not have a META-INF/MANIFEST.MF! "+ + "Make sure, META-INF and MANIFEST.MF are the first 2 entries in your JAR!"); + } String sn = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME); String vStr = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION); Version v = vStr == null ? Version.emptyVersion : Version.parseVersion(vStr);