diff options
author | Jiri Vanek <[email protected]> | 2012-08-27 12:50:29 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2012-08-27 12:50:29 +0200 |
commit | 36f7aeda80f29c9969099feb064985e1920518e9 (patch) | |
tree | adc072b80c019c3d6dcb051870d6e7b452b9726a /netx/net/sourceforge/jnlp/SecurityDesc.java | |
parent | afffc63223a2307b01ec50c6ec4da839a88144f5 (diff) |
Fixed long term failing unit-test, fixed NPE from ClassLoader
* netx/net/sourceforge/jnlp/NullJnlpFileException.java: new class to
distinguish plain NPE from null jnlp file.
* netx/net/sourceforge/jnlp/SecurityDesc.java: (getSandBoxPermissions)
added throw of NullJnlpFileException in case of null jnlp file.
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (findClass)
added Override annotation, add catch of NullJnlpFileException and
re-throw of CNF exception.
* tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java:
(testResourceLoadSuccessCaching) (testResourceLoadFailureCaching)
(testParentClassLoaderIsAskedForClasses) - internal JNLPFile's
(getSecurity) null in SecurityDesc constructorrepalced by this.
(testNullFileSecurityDesc) new test to ensure NPE in null JNLPFile case.
Diffstat (limited to 'netx/net/sourceforge/jnlp/SecurityDesc.java')
-rw-r--r-- | netx/net/sourceforge/jnlp/SecurityDesc.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/netx/net/sourceforge/jnlp/SecurityDesc.java b/netx/net/sourceforge/jnlp/SecurityDesc.java index 197fd3d..927917a 100644 --- a/netx/net/sourceforge/jnlp/SecurityDesc.java +++ b/netx/net/sourceforge/jnlp/SecurityDesc.java @@ -233,10 +233,16 @@ public class SecurityDesc { if (grantAwtPermissions) { permissions.add(new AWTPermission("showWindowWithoutWarningBanner")); } - - if (file.isApplication()) - for (int i = 0; i < jnlpRIAPermissions.length; i++) - permissions.add(jnlpRIAPermissions[i]); + if (JNLPRuntime.isWebstartApplication()) { + if (file == null) { + throw new NullJnlpFileException("Can not return sandbox permissions, file is null"); + } + if (file.isApplication()) { + for (int i = 0; i < jnlpRIAPermissions.length; i++) { + permissions.add(jnlpRIAPermissions[i]); + } + } + } if (downloadHost != null && downloadHost.length() > 0) permissions.add(new SocketPermission(downloadHost, |