Mercurial > hg > release > icedtea6-1.7
changeset 1949:32f3cb4b987b
Partially commit mwong's changeset 98c88b32cdb4 to handle cases where location
URLs could be null.
author | Deepak Bhole <dbhole@redhat.com> |
---|---|
date | Wed, 21 Jul 2010 16:46:23 -0400 |
parents | f4e596f8a417 |
children | 36fc1b3ae030 |
files | ChangeLog rt/net/sourceforge/jnlp/JNLPFile.java rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java |
diffstat | 3 files changed, 42 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jul 21 20:32:53 2010 +0100 +++ b/ChangeLog Wed Jul 21 16:46:23 2010 -0400 @@ -1,3 +1,10 @@ +2010-07-21 Deepak Bhole <dbhole@redhat.com> + + * rt/net/sourceforge/jnlp/JNLPFile.java: Use location as sourceLocation if + parser.getFileLocation() returns null. + * rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: Use main jar's + location as codebase if codebase is not supplied. + 2010-07-21 Andrew John Hughes <ahughes@redhat.com> Backport documentation patches to avoid documentation
--- a/rt/net/sourceforge/jnlp/JNLPFile.java Wed Jul 21 20:32:53 2010 +0100 +++ b/rt/net/sourceforge/jnlp/JNLPFile.java Wed Jul 21 16:46:23 2010 -0400 @@ -559,8 +559,7 @@ specVersion = parser.getSpecVersion(); fileVersion = parser.getFileVersion(); codeBase = parser.getCodeBase(); - sourceLocation = parser.getFileLocation(); - + sourceLocation = parser.getFileLocation() != null ? parser.getFileLocation() : location; info = parser.getInfo(root); resources = parser.getResources(root, false); // false == not a j2se/java resources section launchType = parser.getLauncher(root);
--- a/rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Wed Jul 21 20:32:53 2010 +0100 +++ b/rt/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Wed Jul 21 16:46:23 2010 -0400 @@ -168,22 +168,33 @@ } private void setSecurity() throws LaunchException { - /** - * When we're trying to load an applet, file.getSecurity() will return - * null since there is no jnlp file to specify permissions. We - * determine security settings here, after trying to verify jars. - */ - if (file instanceof PluginBridge) { - if (signing == true) { - this.security = new SecurityDesc(file, - SecurityDesc.ALL_PERMISSIONS, - file.getCodeBase().getHost()); - } else { - this.security = new SecurityDesc(file, - SecurityDesc.SANDBOX_PERMISSIONS, - file.getCodeBase().getHost()); - } - } else { //regular jnlp file + + URL codebase = null; + + if (file.getCodeBase() != null) { + codebase = file.getCodeBase(); + } else { + //Fixme: codebase should be the codebase of the Main Jar not + //the location. Although, it still works in the current state. + codebase = file.getResources().getMainJAR().getLocation(); + } + + /** + * When we're trying to load an applet, file.getSecurity() will return + * null since there is no jnlp file to specify permissions. We + * determine security settings here, after trying to verify jars. + */ + if (file instanceof PluginBridge) { + if (signing == true) { + this.security = new SecurityDesc(file, + SecurityDesc.ALL_PERMISSIONS, + codebase.getHost()); + } else { + this.security = new SecurityDesc(file, + SecurityDesc.SANDBOX_PERMISSIONS, + codebase.getHost()); + } + } else { //regular jnlp file /* * Various combinations of the jars being signed and <security> tags being @@ -202,13 +213,13 @@ throw new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LUnsignedJarWithSecurity"), R("LUnsignedJarWithSecurityInfo")); } else if (signing == true) { - this.security = file.getSecurity(); - } else { - this.security = new SecurityDesc(file, - SecurityDesc.SANDBOX_PERMISSIONS, - file.getCodeBase().getHost()); - } - } + this.security = file.getSecurity(); + } else { + this.security = new SecurityDesc(file, + SecurityDesc.SANDBOX_PERMISSIONS, + codebase.getHost()); + } + } } /**