aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2013-11-27 14:11:13 +0100
committerJiri Vanek <[email protected]>2013-11-27 14:11:13 +0100
commit59233334144dca83fb017795d54d99636cccee81 (patch)
treea28c68f6af5745527ecd66e3620a440764ca2115 /netx/net/sourceforge/jnlp
parentb8da03fd7a7aac183acebf7ccd26196ccafca9bc (diff)
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. * /tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java: added test for npe from getManifestAttribute * tests/test-extensions/net/sourceforge/jnlp/util/FileTestUtils.java: (createJarWithContents) enhanced to be able to create jar without manifest.
Diffstat (limited to 'netx/net/sourceforge/jnlp')
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
index 3be3623..324bbc6 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
@@ -900,8 +900,12 @@ public class JNLPClassLoader extends URLClassLoader {
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 {