changeset 773:461eb0b77b53

Added null check when getting manifest attributes for case of jar without manifest * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (getManifestAttribute) added check fo null manifest to prevent npe.
author Jiri Vanek <jvanek@redhat.com>
date Wed, 27 Nov 2013 14:14:14 +0100
parents 719431dbd56c
children 35f4d27451fd
files ChangeLog netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Nov 14 10:56:29 2013 +0100
+++ b/ChangeLog	Wed Nov 27 14:14:14 2013 +0100
@@ -1,3 +1,8 @@
+2013-11-26  Jiri Vanek  <jvanek@redhat.com>
+
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (getManifestAttribute)
+	added check for null manifest to prevent npe.
+
 2013-11-13  Andrew Azores  <aazores@redhat.com>
 
 	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: add
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Thu Nov 14 10:56:29 2013 +0100
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java	Wed Nov 27 14:14:14 2013 +0100
@@ -927,8 +927,12 @@
             JarFile mainJar = null;
             try {
                 mainJar = new JarFile(f);
-                attributeValue = mainJar.getManifest().
-                        getMainAttributes().getValue(attribute);
+                Manifest manifest = mainJar.getManifest();
+                if (manifest == null || manifest.getMainAttributes() == null){
+                    //yes, jars without manifest exists
+                    return null;
+                }
+                attributeValue = manifest.getMainAttributes().getValue(attribute);
             } catch (IOException ioe) {
                 attributeValue = null;
             } finally {