You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by tj...@apache.org on 2020/08/21 18:15:37 UTC
[felix-atomos] 01/03: Fix NPE when there is no manifest file.
This is an automated email from the ASF dual-hosted git repository.
tjwatson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-atomos.git
commit 8474d2b7456ed10b4c93d3e674aa3fb3cbd5ca3c
Author: Thomas Watson <tj...@us.ibm.com>
AuthorDate: Fri Aug 21 11:39:58 2020 -0500
Fix NPE when there is no manifest file.
---
.../felix/atomos/utils/core/plugins/index/IndexPlugin.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/plugins/index/IndexPlugin.java b/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/plugins/index/IndexPlugin.java
index b6bacbc..67342b2 100644
--- a/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/plugins/index/IndexPlugin.java
+++ b/atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/plugins/index/IndexPlugin.java
@@ -109,12 +109,15 @@ public class IndexPlugin implements JarPlugin<IndexPluginConfig>
IndexInfoImpl info = new IndexInfoImpl();
- Attributes attributes;
try
{
- attributes = jar.getManifest().getMainAttributes();
- info.setBsn(attributes.getValue(Constants.BUNDLE_SYMBOLICNAME));
- info.setVersion(attributes.getValue(Constants.BUNDLE_VERSION));
+ Manifest mf = jar.getManifest();
+ Attributes attributes = mf == null ? null : mf.getMainAttributes();
+ if (attributes != null)
+ {
+ info.setBsn(attributes.getValue(Constants.BUNDLE_SYMBOLICNAME));
+ info.setVersion(attributes.getValue(Constants.BUNDLE_VERSION));
+ }
}
catch (IOException e1)
{