/hg/release/icedtea-web-1.4: Added null check when getting manif...

jvanek at icedtea.classpath.org jvanek at icedtea.classpath.org
Wed Nov 27 05:14:40 PST 2013


changeset 461eb0b77b53 in /hg/release/icedtea-web-1.4
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.4?cmd=changeset;node=461eb0b77b53
author: Jiri Vanek <jvanek at redhat.com>
date: Wed Nov 27 14:14:14 2013 +0100

	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.


diffstat:

 ChangeLog                                              |  5 +++++
 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java |  8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 719431dbd56c -r 461eb0b77b53 ChangeLog
--- 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 at redhat.com>
+
+	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (getManifestAttribute)
+	added check for null manifest to prevent npe.
+
 2013-11-13  Andrew Azores  <aazores at redhat.com>
 
 	* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: add
diff -r 719431dbd56c -r 461eb0b77b53 netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
--- 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 {


More information about the distro-pkg-dev mailing list