[
https://issues.apache.org/jira/browse/FELIX-2318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16011661#comment-16011661
]
Andy Wu commented on FELIX-2318:
--------------------------------
I have a question about this , I didn't find the limit of META-INF/MANIFEST.MF
must be the first file in the jar , but java.util.jar.JarInputStream in jdk
seems to make such assumption, but java.util.jar.JarFile can get MANIFEST.MF
even if it is not the first file , so felix could use this class to get
manifest information to avoid NPE. What do you think about this ? please let me
know. thanks.
> Possible NPE for jars with null Manifest
> ----------------------------------------
>
> Key: FELIX-2318
> URL: https://issues.apache.org/jira/browse/FELIX-2318
> Project: Felix
> Issue Type: Bug
> Components: File Install
> Reporter: Sahoo
> Assignee: Guillaume Nodet
> Fix For: fileinstall-3.1.0
>
>
> JarFile.getManifest() can return null, so caller must check return value for
> null-ness to avoid NPE. I see two such occurrences in fileinstall:
> DirectoryWatcher.java:
> private Bundle installOrUpdateBundle(
> String bundleLocation, BufferedInputStream is, long checksum)
> throws IOException, BundleException
> {
> is.mark(256 * 1024);
> JarInputStream jar = new JarInputStream(is);
> Manifest m = jar.getManifest();
> String sn =
> m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
> ...
> BundleTransformer.java:
> Manifest m = jar.getManifest();
> if (m.getMainAttributes().getValue(new
> Attributes.Name("Bundle-SymbolicName")) != null)
> ...
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)