aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'netx/net/sourceforge/jnlp/runtime')
-rw-r--r--netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java3
-rw-r--r--netx/net/sourceforge/jnlp/runtime/AppletAudioClip.java7
-rw-r--r--netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java36
-rw-r--r--netx/net/sourceforge/jnlp/runtime/AppletInstance.java6
-rw-r--r--netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java47
-rw-r--r--netx/net/sourceforge/jnlp/runtime/Boot.java119
-rw-r--r--netx/net/sourceforge/jnlp/runtime/Boot13.java12
-rw-r--r--netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java14
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java393
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java30
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java50
-rw-r--r--netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java264
12 files changed, 467 insertions, 514 deletions
diff --git a/netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java b/netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java
index 84ee28f..5287975 100644
--- a/netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java
+++ b/netx/net/sourceforge/jnlp/runtime/AppThreadGroup.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import java.awt.*;
@@ -30,7 +29,6 @@ public class AppThreadGroup extends ThreadGroup {
/** the app */
private ApplicationInstance app = null;
-
/**
* Creates new JavaAppThreadGroup
*
@@ -64,5 +62,4 @@ public class AppThreadGroup extends ThreadGroup {
super.uncaughtException(t, e);
}
-
}
diff --git a/netx/net/sourceforge/jnlp/runtime/AppletAudioClip.java b/netx/net/sourceforge/jnlp/runtime/AppletAudioClip.java
index 3b62e0d..ea6bbc2 100644
--- a/netx/net/sourceforge/jnlp/runtime/AppletAudioClip.java
+++ b/netx/net/sourceforge/jnlp/runtime/AppletAudioClip.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import java.net.*;
@@ -35,7 +34,6 @@ public class AppletAudioClip implements AudioClip {
/** the clip */
private Clip clip;
-
/**
* Creates new AudioClip. If the clip cannot be opened no
* exception is thrown, instead the methods of the AudioClip
@@ -49,9 +47,8 @@ public class AppletAudioClip implements AudioClip {
clip = (Clip) AudioSystem.getLine(new Line.Info(Clip.class));
clip.open(stream);
- }
- catch (Exception ex) {
- System.err.println("Error loading sound:"+location.toString());
+ } catch (Exception ex) {
+ System.err.println("Error loading sound:" + location.toString());
clip = null;
}
}
diff --git a/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java b/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java
index 65032fe..f55c95d 100644
--- a/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java
+++ b/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import java.applet.*;
@@ -65,7 +64,6 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/** whether the applet has been destroyed */
private boolean destroyed = false;
-
/**
* Create a new applet environment for the applet specified by
* the JNLP file.
@@ -151,7 +149,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
AppletDesc appletDesc = file.getApplet();
if (cont instanceof AppletStub)
- applet.setStub((AppletStub)cont);
+ applet.setStub((AppletStub) cont);
else
applet.setStub(this);
@@ -171,26 +169,25 @@ public class AppletEnvironment implements AppletContext, AppletStub {
try {
SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- // do first because some applets need to be displayed before
- // starting (they use Component.getImage or something)
- cont.setVisible(true);
-
- applet.init();
- applet.start();
-
- cont.invalidate(); // this should force the applet to
- cont.validate(); // the correct size and to repaint
- cont.repaint();
- }
+ public void run() {
+ // do first because some applets need to be displayed before
+ // starting (they use Component.getImage or something)
+ cont.setVisible(true);
+
+ applet.init();
+ applet.start();
+
+ cont.invalidate(); // this should force the applet to
+ cont.validate(); // the correct size and to repaint
+ cont.repaint();
+ }
});
} catch (InterruptedException ie) {
} catch (InvocationTargetException ite) {
}
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
if (JNLPRuntime.isDebug())
ex.printStackTrace();
@@ -220,7 +217,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
public Enumeration<Applet> getApplets() {
checkDestroyed();
- return Collections.enumeration( Arrays.asList(new Applet[] { applet }) );
+ return Collections.enumeration(Arrays.asList(new Applet[] { applet }));
}
/**
@@ -293,7 +290,7 @@ public class AppletEnvironment implements AppletContext, AppletStub {
/**
* Required for JRE1.4, but not implemented yet.
*/
- public Iterator<String> getStreamKeys() {
+ public Iterator<String> getStreamKeys() {
checkDestroyed();
return null;
@@ -350,5 +347,4 @@ public class AppletEnvironment implements AppletContext, AppletStub {
return true;
}
-
}
diff --git a/netx/net/sourceforge/jnlp/runtime/AppletInstance.java b/netx/net/sourceforge/jnlp/runtime/AppletInstance.java
index 51bc801..a7fbce1 100644
--- a/netx/net/sourceforge/jnlp/runtime/AppletInstance.java
+++ b/netx/net/sourceforge/jnlp/runtime/AppletInstance.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import java.applet.*;
@@ -29,7 +28,6 @@ import java.lang.ref.*;
import net.sourceforge.jnlp.*;
-
/**
* Represents a launched application instance created from a JNLP
* file. This class does not control the operation of the applet,
@@ -49,7 +47,6 @@ public class AppletInstance extends ApplicationInstance {
/** the applet environment */
private AppletEnvironment environment;
-
/**
* Create a New Task based on the Specified URL
*/
@@ -124,8 +121,7 @@ public class AppletInstance extends ApplicationInstance {
try {
applet.stop();
applet.destroy();
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
if (JNLPRuntime.isDebug())
ex.printStackTrace();
}
diff --git a/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java b/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java
index 99b576d..f86eb39 100644
--- a/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java
+++ b/netx/net/sourceforge/jnlp/runtime/ApplicationInstance.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import java.awt.Window;
@@ -54,7 +53,6 @@ public class ApplicationInstance {
// todo: should attempt to unload the environment variables
// installed by the application.
-
/** the file */
private JNLPFile file;
@@ -83,8 +81,8 @@ public class ApplicationInstance {
/** list of application listeners */
private EventListenerList listeners = new EventListenerList();
- /** whether or not this application is signed */
- private boolean isSigned = false;
+ /** whether or not this application is signed */
+ private boolean isSigned = false;
/**
* Create an application instance for the file. This should be done in the
@@ -119,11 +117,11 @@ public class ApplicationInstance {
Object list[] = listeners.getListenerList();
ApplicationEvent event = null;
- for (int i=list.length-1; i>0; i-=2) { // last to first required
+ for (int i = list.length - 1; i > 0; i -= 2) { // last to first required
if (event == null)
event = new ApplicationEvent(this);
- ((ApplicationListener)list[i]).applicationDestroyed(event);
+ ((ApplicationListener) list[i]).applicationDestroyed(event);
}
}
@@ -174,7 +172,7 @@ public class ApplicationInstance {
*/
private boolean shouldCreateShortcut(ShortcutDesc sd) {
String currentSetting = JNLPRuntime.getConfiguration()
- .getProperty(DeploymentConfiguration.KEY_CREATE_DESKTOP_SHORTCUT);
+ .getProperty(DeploymentConfiguration.KEY_CREATE_DESKTOP_SHORTCUT);
boolean createShortcut = false;
/*
@@ -221,7 +219,7 @@ public class ApplicationInstance {
void installEnvironment() {
final PropertyDesc props[] = file.getResources().getProperties();
- CodeSource cs = new CodeSource((URL) null, (java.security.cert.Certificate [])null);
+ CodeSource cs = new CodeSource((URL) null, (java.security.cert.Certificate[]) null);
JNLPClassLoader loader = (JNLPClassLoader) this.loader;
SecurityDesc s = loader.getSecurity();
@@ -229,11 +227,11 @@ public class ApplicationInstance {
ProtectionDomain pd = new ProtectionDomain(cs, s.getPermissions(), null, null);
// Add to hashmap
- AccessControlContext acc = new AccessControlContext(new ProtectionDomain[] {pd});
+ AccessControlContext acc = new AccessControlContext(new ProtectionDomain[] { pd });
PrivilegedAction<Object> installProps = new PrivilegedAction<Object>() {
public Object run() {
- for (int i=0; i < props.length; i++) {
+ for (int i = 0; i < props.length; i++) {
System.setProperty(props[i].getKey(), props[i].getValue());
}
@@ -274,7 +272,7 @@ public class ApplicationInstance {
try {
// destroy resources
- for (int i=0; i < weakWindows.size(); i++) {
+ for (int i = 0; i < weakWindows.size(); i++) {
Window w = weakWindows.get(i);
if (w != null)
w.dispose();
@@ -282,12 +280,12 @@ public class ApplicationInstance {
weakWindows.clear();
- // interrupt threads
- Thread threads[] = new Thread[ group.activeCount() * 2 ];
+ // interrupt threads
+ Thread threads[] = new Thread[group.activeCount() * 2];
int nthreads = group.enumerate(threads);
- for (int i=0; i < nthreads; i++) {
+ for (int i = 0; i < nthreads; i++) {
if (JNLPRuntime.isDebug())
- System.out.println("Interrupt thread: "+threads[i]);
+ System.out.println("Interrupt thread: " + threads[i]);
threads[i].interrupt();
}
@@ -295,17 +293,16 @@ public class ApplicationInstance {
// then stop
Thread.currentThread().yield();
nthreads = group.enumerate(threads);
- for (int i=0; i < nthreads; i++) {
+ for (int i = 0; i < nthreads; i++) {
if (JNLPRuntime.isDebug())
- System.out.println("Stop thread: "+threads[i]);
+ System.out.println("Stop thread: " + threads[i]);
threads[i].stop();
}
// then destroy - except Thread.destroy() not implemented in jdk
- }
- finally {
+ } finally {
stopped = true;
fireDestroyed();
}
@@ -344,12 +341,12 @@ public class ApplicationInstance {
weakWindows.trimToSize();
}
- /**
- * Returns whether or not this jar is signed.
- */
- public boolean isSigned() {
- return isSigned;
- }
+ /**
+ * Returns whether or not this jar is signed.
+ */
+ public boolean isSigned() {
+ return isSigned;
+ }
public AppContext getAppContext() {
return appContext;
diff --git a/netx/net/sourceforge/jnlp/runtime/Boot.java b/netx/net/sourceforge/jnlp/runtime/Boot.java
index c4939b7..b075e65 100644
--- a/netx/net/sourceforge/jnlp/runtime/Boot.java
+++ b/netx/net/sourceforge/jnlp/runtime/Boot.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import static net.sourceforge.jnlp.runtime.Translator.R;
@@ -63,62 +62,60 @@ public final class Boot implements PrivilegedAction<Void> {
/** the text to display before launching the about link */
private static final String aboutMessage = ""
- + "netx v"+version+" - (C)2001-2003 Jon A. Maxwell ([email protected])\n"
- + "\n"
- + R("BLaunchAbout");
+ + "netx v" + version + " - (C)2001-2003 Jon A. Maxwell ([email protected])\n"
+ + "\n"
+ + R("BLaunchAbout");
private static final String miniLicense = "\n"
- + " netx - an open-source JNLP client.\n"
- + " Copyright (C) 2001-2003 Jon A. Maxwell (JAM)\n"
- + "\n"
- + " // This library is free software; you can redistribute it and/or\n"
- + " modify it under the terms of the GNU Lesser General Public\n"
- + " License as published by the Free Software Foundation; either\n"
- + " version 2.1 of the License, or (at your option) any later version.\n"
- + "\n"
- + " This library is distributed in the hope that it will be useful,\n"
- + " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
- + " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
- + " Lesser General Public License for more details.\n"
- + "\n"
- + " You should have received a copy of the GNU Lesser General Public\n"
- + " License along with this library; if not, write to the Free Software\n"
- + " Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"
- + "\n";
+ + " netx - an open-source JNLP client.\n"
+ + " Copyright (C) 2001-2003 Jon A. Maxwell (JAM)\n"
+ + "\n"
+ + " // This library is free software; you can redistribute it and/or\n"
+ + " modify it under the terms of the GNU Lesser General Public\n"
+ + " License as published by the Free Software Foundation; either\n"
+ + " version 2.1 of the License, or (at your option) any later version.\n"
+ + "\n"
+ + " This library is distributed in the hope that it will be useful,\n"
+ + " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ + " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
+ + " Lesser General Public License for more details.\n"
+ + "\n"
+ + " You should have received a copy of the GNU Lesser General Public\n"
+ + " License along with this library; if not, write to the Free Software\n"
+ + " Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"
+ + "\n";
private static final String helpMessage = "\n"
- + "Usage: " + R("BOUsage")+"\n"
- + " " + R("BOUsage2")+"\n"
- + "\n"
- + "control-options:"+"\n"
- + " -about "+R("BOAbout")+"\n"
- + " -viewer "+R("BOViewer")+"\n"
- + "\n"
- + "run-options:"+"\n"
- + " -arg arg "+R("BOArg")+"\n"
- + " -param name=value "+R("BOParam")+"\n"
- + " -property name=value "+R("BOProperty")+"\n"
- + " -update seconds "+R("BOUpdate")+"\n"
- + " -license "+R("BOLicense")+"\n"
- + " -verbose "+R("BOVerbose")+"\n"
- + " -nosecurity "+R("BONosecurity")+"\n"
- + " -noupdate "+R("BONoupdate")+"\n"
- + " -headless "+R("BOHeadless")+"\n"
- + " -strict "+R("BOStrict")+"\n"
- + " -Xnofork "+R("BXnofork")+"\n"
- + " -Xclearcache "+R("BXclearcache")+"\n"
- + " -help "+R("BOHelp")+"\n";
+ + "Usage: " + R("BOUsage") + "\n"
+ + " " + R("BOUsage2") + "\n"
+ + "\n"
+ + "control-options:" + "\n"
+ + " -about " + R("BOAbout") + "\n"
+ + " -viewer " + R("BOViewer") + "\n"
+ + "\n"
+ + "run-options:" + "\n"
+ + " -arg arg " + R("BOArg") + "\n"
+ + " -param name=value " + R("BOParam") + "\n"
+ + " -property name=value " + R("BOProperty") + "\n"
+ + " -update seconds " + R("BOUpdate") + "\n"
+ + " -license " + R("BOLicense") + "\n"
+ + " -verbose " + R("BOVerbose") + "\n"
+ + " -nosecurity " + R("BONosecurity") + "\n"
+ + " -noupdate " + R("BONoupdate") + "\n"
+ + " -headless " + R("BOHeadless") + "\n"
+ + " -strict " + R("BOStrict") + "\n"
+ + " -Xnofork " + R("BXnofork") + "\n"
+ + " -Xclearcache " + R("BXclearcache") + "\n"
+ + " -help " + R("BOHelp") + "\n";
/** the JNLP file to open to display the network-based about window */
private static final String NETX_ABOUT_FILE = System.getProperty("java.home") + File.separator + "lib"
+ File.separator + "about.jnlp";
-
private static final String doubleArgs = "-basedir -jnlp -arg -param -property -update";
private static String args[]; // avoid the hot potato
-
/**
* Launch the JNLP file specified by the command-line arguments.
*/
@@ -155,13 +152,12 @@ public final class Boot implements PrivilegedAction<Void> {
if (null != getOption("-update")) {
int value = Integer.parseInt(getOption("-update"));
- JNLPRuntime.setDefaultUpdatePolicy(new UpdatePolicy(value*1000l));
+ JNLPRuntime.setDefaultUpdatePolicy(new UpdatePolicy(value * 1000l));
}
if (null != getOption("-headless"))
JNLPRuntime.setHeadless(true);
-
if (null != getOption("-noupdate"))
JNLPRuntime.setDefaultUpdatePolicy(UpdatePolicy.NEVER);
@@ -198,11 +194,9 @@ public final class Boot implements PrivilegedAction<Void> {
try {
new Launcher().launch(getFile());
- }
- catch (LaunchException ex) {
+ } catch (LaunchException ex) {
// default handler prints this
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
if (JNLPRuntime.isDebug())
ex.printStackTrace();
@@ -213,7 +207,7 @@ public final class Boot implements PrivilegedAction<Void> {
}
private static void fatalError(String message) {
- System.err.println("netx: "+message);
+ System.err.println("netx: " + message);
System.exit(1);
}
@@ -252,7 +246,7 @@ public final class Boot implements PrivilegedAction<Void> {
}
if (JNLPRuntime.isDebug())
- System.out.println(R("BFileLoc")+": "+location);
+ System.out.println(R("BFileLoc") + ": " + location);
URL url = null;
@@ -306,14 +300,14 @@ public final class Boot implements PrivilegedAction<Void> {
String props[] = getOptions("-property");
ResourcesDesc resources = file.getResources();
- for (int i=0; i < props.length; i++) {
+ for (int i = 0; i < props.length; i++) {
// allows empty property, not sure about validity of that.
int equals = props[i].indexOf("=");
if (equals == -1)
fatalError(R("BBadProp", props[i]));
String key = props[i].substring(0, equals);
- String value = props[i].substring(equals+1, props[i].length());
+ String value = props[i].substring(equals + 1, props[i].length());
resources.addResource(new PropertyDesc(key, value));
}
@@ -327,14 +321,14 @@ public final class Boot implements PrivilegedAction<Void> {
String params[] = getOptions("-param");
AppletDesc applet = file.getApplet();
- for (int i=0; i < params.length; i++) {
+ for (int i = 0; i < params.length; i++) {
// allows empty param, not sure about validity of that.
int equals = params[i].indexOf("=");
if (equals == -1)
fatalError(R("BBadParam", params[i]));
String name = params[i].substring(0, equals);
- String value = params[i].substring(equals+1, params[i].length());
+ String value = params[i].substring(equals + 1, params[i].length());
applet.addParameter(name, value);
}
@@ -345,10 +339,10 @@ public final class Boot implements PrivilegedAction<Void> {
* actually an application (not installer).
*/
private static void addArguments(JNLPFile file) {
- String args[] = getOptions("-arg"); // FYI args also global variable
+ String args[] = getOptions("-arg"); // FYI args also global variable
ApplicationDesc app = file.getApplication();
- for (int i=0; i < args.length; i++) {
+ for (int i = 0; i < args.length; i++) {
app.addArgument(args[i]);
}
}
@@ -401,20 +395,19 @@ public final class Boot implements PrivilegedAction<Void> {
private static String[] getOptions(String option) {
List<String> result = new ArrayList<String>();
- for (int i=0; i < args.length; i++) {
+ for (int i = 0; i < args.length; i++) {
if (option.equals(args[i])) {
if (-1 == doubleArgs.indexOf(option))
result.add(option);
- else
- if (i+1 < args.length)
- result.add(args[i+1]);
+ else if (i + 1 < args.length)
+ result.add(args[i + 1]);
}
if (args[i].startsWith("-") && -1 != doubleArgs.indexOf(args[i]))
i++;
}
- return result.toArray( new String[result.size()] );
+ return result.toArray(new String[result.size()]);
}
}
diff --git a/netx/net/sourceforge/jnlp/runtime/Boot13.java b/netx/net/sourceforge/jnlp/runtime/Boot13.java
index 1b5aaa3..a573a1b 100644
--- a/netx/net/sourceforge/jnlp/runtime/Boot13.java
+++ b/netx/net/sourceforge/jnlp/runtime/Boot13.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import java.lang.reflect.*;
@@ -50,7 +49,7 @@ public class Boot13 extends URLClassLoader {
protected PermissionCollection getPermissions(CodeSource source) {
Permissions result = new Permissions();
- result.add( new AllPermission() );
+ result.add(new AllPermission());
return result;
}
@@ -66,8 +65,7 @@ public class Boot13 extends URLClassLoader {
// but the wrong permissions.
try {
return findClass(name);
- }
- catch (ClassNotFoundException ex) {
+ } catch (ClassNotFoundException ex) {
}
return getParent().loadClass(name);
@@ -89,14 +87,14 @@ public class Boot13 extends URLClassLoader {
System.exit(1);
}
- Boot13 b = new Boot13(new URL[] {cs});
+ Boot13 b = new Boot13(new URL[] { cs });
Thread.currentThread().setContextClassLoader(b); // try to prevent getting the non-policy version of classes
Class<?> c = b.loadClass("net.sourceforge.jnlp.runtime.Boot");
- Method main = c.getDeclaredMethod("main", new Class<?>[] {String[].class} );
+ Method main = c.getDeclaredMethod("main", new Class<?>[] { String[].class });
- main.invoke(null, new Object[] { args } );
+ main.invoke(null, new Object[] { args });
}
}
diff --git a/netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java b/netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java
index 2a4c963..662730f 100644
--- a/netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java
+++ b/netx/net/sourceforge/jnlp/runtime/DeploymentConfiguration.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import java.awt.AWTPermission;
@@ -215,7 +214,7 @@ public final class DeploymentConfiguration {
private Map<String, ConfigValue> unchangeableConfiguration;
public DeploymentConfiguration() {
- currentConfiguration = new HashMap<String,ConfigValue>();
+ currentConfiguration = new HashMap<String, ConfigValue>();
unchangeableConfiguration = new HashMap<String, ConfigValue>();
}
@@ -372,10 +371,10 @@ public final class DeploymentConfiguration {
{ KEY_USER_TRUSTED_CA_CERTS, USER_SECURITY + File.separator + "trusted.cacerts" },
{ KEY_USER_TRUSTED_JSSE_CA_CERTS, USER_SECURITY + File.separator + "trusted.jssecacerts" },
{ KEY_USER_TRUSTED_CERTS, USER_SECURITY + File.separator + "trusted.certs" },
- { KEY_USER_TRUSTED_JSSE_CERTS, USER_SECURITY + File.separator + "trusted.jssecerts"},
+ { KEY_USER_TRUSTED_JSSE_CERTS, USER_SECURITY + File.separator + "trusted.jssecerts" },
{ KEY_USER_TRUSTED_CLIENT_CERTS, USER_SECURITY + File.separator + "trusted.clientcerts" },
{ "deployment.system.security.policy", null },
- { KEY_SYSTEM_TRUSTED_CA_CERTS , SYSTEM_SECURITY + File.separator + "cacerts" },
+ { KEY_SYSTEM_TRUSTED_CA_CERTS, SYSTEM_SECURITY + File.separator + "cacerts" },
{ KEY_SYSTEM_TRUSTED_JSSE_CA_CERTS, SYSTEM_SECURITY + File.separator + "jssecacerts" },
{ KEY_SYSTEM_TRUSTED_CERTS, SYSTEM_SECURITY + File.separator + "trusted.certs" },
{ KEY_SYSTEM_TRUSTED_JSSE_CERTS, SYSTEM_SECURITY + File.separator + "trusted.jssecerts" },
@@ -417,7 +416,7 @@ public final class DeploymentConfiguration {
/* JNLP association */
{ "deployment.javaws.associations", String.valueOf(JNLP_ASSOCIATION_ASK_USER) },
/* desktop integration */
- { KEY_CREATE_DESKTOP_SHORTCUT, ShortcutDesc.CREATE_ASK_USER_IF_HINTED},
+ { KEY_CREATE_DESKTOP_SHORTCUT, ShortcutDesc.CREATE_ASK_USER_IF_HINTED },
/* jre selection */
{ "deployment.javaws.installURL", null },
/* jre management */
@@ -500,7 +499,7 @@ public final class DeploymentConfiguration {
+ systemPropertiesFile);
}
ConfigValue mandatory = systemConfiguration.get("deployment.system.config.mandatory");
- systemPropertiesMandatory = Boolean.valueOf(mandatory == null? null: mandatory.get());
+ systemPropertiesMandatory = Boolean.valueOf(mandatory == null ? null : mandatory.get());
return true;
} else {
if (JNLPRuntime.isDebug()) {
@@ -548,7 +547,6 @@ public final class DeploymentConfiguration {
}
}
-
/**
* Saves all properties that are not part of default or system properties
*
@@ -659,7 +657,7 @@ public final class DeploymentConfiguration {
* @param srcMap the source for reading key value pairs
*/
private void mergeMaps(Map<String, ConfigValue> finalMap, Map<String, ConfigValue> srcMap) {
- for (String key: srcMap.keySet()) {
+ for (String key : srcMap.keySet()) {
ConfigValue configValue = finalMap.get(key);
if (configValue == null) {
configValue = srcMap.get(key);
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
index aac70d0..3ac5014 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
@@ -1,4 +1,3 @@
-
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -14,7 +13,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import static net.sourceforge.jnlp.runtime.Translator.R;
@@ -81,8 +79,8 @@ public class JNLPClassLoader extends URLClassLoader {
// resources in an extension.
/** map from JNLPFile url to shared classloader */
- private static Map<String,JNLPClassLoader> urlToLoader =
- new HashMap<String,JNLPClassLoader>(); // never garbage collected!
+ private static Map<String, JNLPClassLoader> urlToLoader =
+ new HashMap<String, JNLPClassLoader>(); // never garbage collected!
/** the directory for native code */
private File nativeDir = null; // if set, some native code exists
@@ -145,7 +143,7 @@ public class JNLPClassLoader extends URLClassLoader {
/** Map of specific codesources to securitydesc */
private HashMap<URL, SecurityDesc> jarLocationSecurityMap =
- new HashMap<URL, SecurityDesc>();
+ new HashMap<URL, SecurityDesc>();
/**
* Create a new JNLPClassLoader from the specified file.
@@ -156,7 +154,7 @@ public class JNLPClassLoader extends URLClassLoader {
super(new URL[0], JNLPClassLoader.class.getClassLoader());
if (JNLPRuntime.isDebug())
- System.out.println("New classloader: "+file.getFileLocation());
+ System.out.println("New classloader: " + file.getFileLocation());
this.file = file;
this.updatePolicy = policy;
@@ -229,12 +227,12 @@ public class JNLPClassLoader extends URLClassLoader {
if (file instanceof PluginBridge) {
if (signing == true) {
this.security = new SecurityDesc(file,
- SecurityDesc.ALL_PERMISSIONS,
- codebase.getHost());
+ SecurityDesc.ALL_PERMISSIONS,
+ codebase.getHost());
} else {
this.security = new SecurityDesc(file,
- SecurityDesc.SANDBOX_PERMISSIONS,
- codebase.getHost());
+ SecurityDesc.SANDBOX_PERMISSIONS,
+ codebase.getHost());
}
} else { //regular jnlp file
@@ -252,8 +250,7 @@ public class JNLPClassLoader extends URLClassLoader {
*/
if (!file.getSecurity().getSecurityType().equals(SecurityDesc.SANDBOX_PERMISSIONS) && !signing) {
throw new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LUnsignedJarWithSecurity"), R("LUnsignedJarWithSecurityInfo"));
- }
- else if (signing == true) {
+ } else if (signing == true) {
this.security = file.getSecurity();
} else {
this.security = new SecurityDesc(file,
@@ -277,41 +274,41 @@ public class JNLPClassLoader extends URLClassLoader {
if (uniqueKey != null)
baseLoader = urlToLoader.get(uniqueKey);
- try {
+ try {
- // If base loader is null, or the baseloader's file and this
- // file is different, initialize a new loader
- if (baseLoader == null ||
+ // If base loader is null, or the baseloader's file and this
+ // file is different, initialize a new loader
+ if (baseLoader == null ||
!baseLoader.getJNLPFile().getFileLocation().equals(file.getFileLocation())) {
- loader = new JNLPClassLoader(file, policy);
+ loader = new JNLPClassLoader(file, policy);
- // New loader init may have caused extentions to create a
- // loader for this unique key. Check.
- JNLPClassLoader extLoader = urlToLoader.get(uniqueKey);
+ // New loader init may have caused extentions to create a
+ // loader for this unique key. Check.
+ JNLPClassLoader extLoader = urlToLoader.get(uniqueKey);
- if (extLoader != null && extLoader != loader) {
- if (loader.signing && !extLoader.signing)
- if (!SecurityWarning.showNotAllSignedWarningDialog(file))
- throw new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LSignedAppJarUsingUnsignedJar"), R("LSignedAppJarUsingUnsignedJarInfo"));
+ if (extLoader != null && extLoader != loader) {
+ if (loader.signing && !extLoader.signing)
+ if (!SecurityWarning.showNotAllSignedWarningDialog(file))
+ throw new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LSignedAppJarUsingUnsignedJar"), R("LSignedAppJarUsingUnsignedJarInfo"));
- loader.merge(extLoader);
- }
+ loader.merge(extLoader);
+ }
// loader is now current + ext. But we also need to think of
// the baseLoader
- if (baseLoader != null && baseLoader != loader) {
- loader.merge(baseLoader);
+ if (baseLoader != null && baseLoader != loader) {
+ loader.merge(baseLoader);
}
- } else {
- // if key is same and locations match, this is the loader we want
- loader = baseLoader;
- }
+ } else {
+ // if key is same and locations match, this is the loader we want
+ loader = baseLoader;
+ }
- } catch (LaunchException e) {
- throw e;
- }
+ } catch (LaunchException e) {
+ throw e;
+ }
// loaders are mapped to a unique key. Only extensions and parent
// share a key, so it is safe to always share based on it
@@ -348,18 +345,17 @@ public class JNLPClassLoader extends URLClassLoader {
loaderList.add(this);
- //if (ext != null) {
- for (int i=0; i < ext.length; i++) {
- try {
- String uniqueKey = this.getJNLPFile().getUniqueKey();
- JNLPClassLoader loader = getInstance(ext[i].getLocation(), uniqueKey, ext[i].getVersion(), updatePolicy);
- loaderList.add(loader);
- }
- catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- //}
+ //if (ext != null) {
+ for (int i = 0; i < ext.length; i++) {
+ try {
+ String uniqueKey = this.getJNLPFile().getUniqueKey();
+ JNLPClassLoader loader = getInstance(ext[i].getLocation(), uniqueKey, ext[i].getVersion(), updatePolicy);
+ loaderList.add(loader);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ //}
loaders = loaderList.toArray(new JNLPClassLoader[loaderList.size()]);
}
@@ -371,15 +367,15 @@ public class JNLPClassLoader extends URLClassLoader {
resourcePermissions = new ArrayList<Permission>();
JARDesc jars[] = resources.getJARs();
- for (int i=0; i < jars.length; i++) {
+ for (int i = 0; i < jars.length; i++) {
Permission p = CacheUtil.getReadPermission(jars[i].getLocation(),
jars[i].getVersion());
if (JNLPRuntime.isDebug()) {
if (p == null)
- System.out.println("Unable to add permission for " + jars[i].getLocation());
+ System.out.println("Unable to add permission for " + jars[i].getLocation());
else
- System.out.println("Permission added: " + p.toString());
+ System.out.println("Permission added: " + p.toString());
}
if (p != null)
resourcePermissions.add(p);
@@ -392,17 +388,17 @@ public class JNLPClassLoader extends URLClassLoader {
*/
void initializeResources() throws LaunchException {
JARDesc jars[] = resources.getJARs();
- if (jars == null || jars.length == 0)
- return;
- /*
- if (jars == null || jars.length == 0) {
- throw new LaunchException(null, null, R("LSFatal"),
- R("LCInit"), R("LFatalVerification"), "No jars!");
- }
- */
+ if (jars == null || jars.length == 0)
+ return;
+ /*
+ if (jars == null || jars.length == 0) {
+ throw new LaunchException(null, null, R("LSFatal"),
+ R("LCInit"), R("LFatalVerification"), "No jars!");
+ }
+ */
List<JARDesc> initialJars = new ArrayList<JARDesc>();
- for (int i=0; i < jars.length; i++) {
+ for (int i = 0; i < jars.length; i++) {
available.add(jars[i]);
@@ -418,94 +414,93 @@ public class JNLPClassLoader extends URLClassLoader {
if (strict)
fillInPartJars(initialJars); // add in each initial part's lazy jars
- if (JNLPRuntime.isVerifying()) {
+ if (JNLPRuntime.isVerifying()) {
- JarSigner js;
- waitForJars(initialJars); //download the jars first.
+ JarSigner js;
+ waitForJars(initialJars); //download the jars first.
- try {
- js = verifyJars(initialJars);
- } catch (Exception e) {
- //we caught an Exception from the JarSigner class.
- //Note: one of these exceptions could be from not being able
- //to read the cacerts or trusted.certs files.
- e.printStackTrace();
- throw new LaunchException(null, null, R("LSFatal"),
+ try {
+ js = verifyJars(initialJars);
+ } catch (Exception e) {
+ //we caught an Exception from the JarSigner class.
+ //Note: one of these exceptions could be from not being able
+ //to read the cacerts or trusted.certs files.
+ e.printStackTrace();
+ throw new LaunchException(null, null, R("LSFatal"),
R("LCInit"), R("LFatalVerification"), R("LFatalVerificationInfo"));
- }
+ }
- //Case when at least one jar has some signing
- if (js.anyJarsSigned()){
- signing = true;
+ //Case when at least one jar has some signing
+ if (js.anyJarsSigned()) {
+ signing = true;
- if (!js.allJarsSigned() &&
+ if (!js.allJarsSigned() &&
!SecurityWarning.showNotAllSignedWarningDialog(file))
- throw new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LSignedAppJarUsingUnsignedJar"), R("LSignedAppJarUsingUnsignedJarInfo"));
+ throw new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LSignedAppJarUsingUnsignedJar"), R("LSignedAppJarUsingUnsignedJarInfo"));
+
+ //user does not trust this publisher
+ if (!js.getAlreadyTrustPublisher()) {
+ checkTrustWithUser(js);
+ } else {
+ /**
+ * If the user trusts this publisher (i.e. the publisher's certificate
+ * is in the user's trusted.certs file), we do not show any dialogs.
+ */
+ }
+ } else {
+ signing = false;
+ //otherwise this jar is simply unsigned -- make sure to ask
+ //for permission on certain actions
+ }
+ }
- //user does not trust this publisher
- if (!js.getAlreadyTrustPublisher()) {
- checkTrustWithUser(js);
- } else {
- /**
- * If the user trusts this publisher (i.e. the publisher's certificate
- * is in the user's trusted.certs file), we do not show any dialogs.
- */
- }
- } else {
+ for (JARDesc jarDesc : file.getResources().getJARs()) {
+ try {
+ File cachedFile = tracker.getCacheFile(jarDesc.getLocation());
- signing = false;
- //otherwise this jar is simply unsigned -- make sure to ask
- //for permission on certain actions
- }
+ if (cachedFile == null) {
+ System.err.println("JAR " + jarDesc.getLocation() + " not found. Continuing.");
+ continue; // JAR not found. Keep going.
}
- for (JARDesc jarDesc: file.getResources().getJARs()) {
- try {
- File cachedFile = tracker.getCacheFile(jarDesc.getLocation());
-
- if (cachedFile == null) {
- System.err.println("JAR " + jarDesc.getLocation() + " not found. Continuing.");
- continue; // JAR not found. Keep going.
- }
-
- // TODO: Should be toURI().toURL()
- URL location = cachedFile.toURL();
- SecurityDesc jarSecurity = file.getSecurity();
+ // TODO: Should be toURI().toURL()
+ URL location = cachedFile.toURL();
+ SecurityDesc jarSecurity = file.getSecurity();
- if (file instanceof PluginBridge) {
+ if (file instanceof PluginBridge) {
- URL codebase = null;
+ 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();
- }
+ 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();
+ }
- jarSecurity = new SecurityDesc(file,
+ jarSecurity = new SecurityDesc(file,
SecurityDesc.ALL_PERMISSIONS,
codebase.getHost());
- }
-
- jarLocationSecurityMap.put(location, jarSecurity);
- } catch (MalformedURLException mfe) {
- System.err.println(mfe.getMessage());
- }
}
+ jarLocationSecurityMap.put(location, jarSecurity);
+ } catch (MalformedURLException mfe) {
+ System.err.println(mfe.getMessage());
+ }
+ }
+
activateJars(initialJars);
}
private void checkTrustWithUser(JarSigner js) throws LaunchException {
if (!js.getRootInCacerts()) { //root cert is not in cacerts
boolean b = SecurityWarning.showCertWarningDialog(
- AccessType.UNVERIFIED, file, js);
+ AccessType.UNVERIFIED, file, js);
if (!b)
throw new LaunchException(null, null, R("LSFatal"),
- R("LCLaunching"), R("LNotVerified"), "");
+ R("LCLaunching"), R("LNotVerified"), "");
} else if (js.getRootInCacerts()) { //root cert is in cacerts
boolean b = false;
if (js.noSigningIssues())
@@ -516,7 +511,7 @@ public class JNLPClassLoader extends URLClassLoader {
AccessType.SIGNING_ERROR, file, js);
if (!b)
throw new LaunchException(null, null, R("LSFatal"),
- R("LCLaunching"), R("LCancelOnUserRequest"), "");
+ R("LCLaunching"), R("LCancelOnUserRequest"), "");
}
}
@@ -527,7 +522,7 @@ public class JNLPClassLoader extends URLClassLoader {
* loaded from the codebase are not cached.
*/
public void enableCodeBase() {
- addURL( file.getCodeBase() ); // nothing happens if called more that once?
+ addURL(file.getCodeBase()); // nothing happens if called more that once?
}
/**
@@ -569,7 +564,7 @@ public class JNLPClassLoader extends URLClassLoader {
// access w/o security dialog once we actually check certificates.
// copy security permissions from SecurityDesc element
- if (security != null) {
+ if (security != null) {
// Security desc. is used only to track security settings for the
// application. However, an application may comprise of multiple
// jars, and as such, security must be evaluated on a per jar basis.
@@ -582,8 +577,7 @@ public class JNLPClassLoader extends URLClassLoader {
// 2. ALL or J2EE permissions must be requested (note: plugin requests ALL automatically)
if (cs.getCodeSigners() != null &&
(getCodeSourceSecurity(cs.getLocation()).getSecurityType().equals(SecurityDesc.ALL_PERMISSIONS) ||
- getCodeSourceSecurity(cs.getLocation()).getSecurityType().equals(SecurityDesc.J2EE_PERMISSIONS))
- ) {
+ getCodeSourceSecurity(cs.getLocation()).getSecurityType().equals(SecurityDesc.J2EE_PERMISSIONS))) {
permissions = getCodeSourceSecurity(cs.getLocation()).getPermissions();
}
@@ -594,12 +588,12 @@ public class JNLPClassLoader extends URLClassLoader {
}
// add in permission to read the cached JAR files
- for (int i=0; i < resourcePermissions.size(); i++)
+ for (int i = 0; i < resourcePermissions.size(); i++)
result.add(resourcePermissions.get(i));
// add in the permissions that the user granted.
- for (int i=0; i < runtimePermissions.size(); i++)
- result.add(runtimePermissions.get(i));
+ for (int i = 0; i < runtimePermissions.size(); i++)
+ result.add(runtimePermissions.get(i));
return result;
}
@@ -614,10 +608,10 @@ public class JNLPClassLoader extends URLClassLoader {
* in the same part).
*/
protected void fillInPartJars(List<JARDesc> jars) {
- for (int i=0; i < jars.size(); i++) {
+ for (int i = 0; i < jars.size(); i++) {
String part = jars.get(i).getPart();
- for (int a=0; a < available.size(); a++) {
+ for (int a = 0; a < available.size(); a++) {
JARDesc jar = available.get(a);
if (part != null && part.equals(jar.getPart()))
@@ -642,7 +636,7 @@ public class JNLPClassLoader extends URLClassLoader {
// transfer the Jars
waitForJars(jars);
- for (int i=0; i < jars.size(); i++) {
+ for (int i = 0; i < jars.size(); i++) {
JARDesc jar = jars.get(i);
available.remove(jar);
@@ -725,13 +719,13 @@ public class JNLPClassLoader extends URLClassLoader {
}
jarSecurity = new SecurityDesc(file,
- SecurityDesc.ALL_PERMISSIONS,
- codebase.getHost());
+ SecurityDesc.ALL_PERMISSIONS,
+ codebase.getHost());
}
jarLocationSecurityMap.put(fileURL, jarSecurity);
- } catch (MalformedURLException mfue) {
+ } catch (MalformedURLException mfue) {
if (JNLPRuntime.isDebug())
System.err.println("Unable to add extracted nested jar to classpath");
@@ -756,7 +750,7 @@ public class JNLPClassLoader extends URLClassLoader {
}
if (JNLPRuntime.isDebug())
- System.err.println("Activate jar: "+location);
+ System.err.println("Activate jar: " + location);
}
catch (Exception ex) {
if (JNLPRuntime.isDebug())
@@ -781,7 +775,7 @@ public class JNLPClassLoader extends URLClassLoader {
*/
protected void activateNative(JARDesc jar) {
if (JNLPRuntime.isDebug())
- System.out.println("Activate native: "+jar.getLocation());
+ System.out.println("Activate native: " + jar.getLocation());
File localFile = tracker.getCacheFile(jar.getLocation());
if (localFile == null)
@@ -803,10 +797,10 @@ public class JNLPClassLoader extends URLClassLoader {
String name = new File(e.getName()).getName();
boolean isLibrary = false;
- for (String suffix: librarySuffixes) {
+ for (String suffix : librarySuffixes) {
if (name.endsWith(suffix)) {
- isLibrary = true;
- break;
+ isLibrary = true;
+ break;
}
}
if (!isLibrary) {
@@ -824,8 +818,7 @@ public class JNLPClassLoader extends URLClassLoader {
new FileOutputStream(outFile));
}
- }
- catch (IOException ex) {
+ } catch (IOException ex) {
if (JNLPRuntime.isDebug())
ex.printStackTrace();
}
@@ -879,7 +872,7 @@ public class JNLPClassLoader extends URLClassLoader {
protected String findLibrary(String lib) {
String syslib = System.mapLibraryName(lib);
- for (File dir: getNativeDirectories()) {
+ for (File dir : getNativeDirectories()) {
File target = new File(dir, syslib);
if (target.exists())
return target.toString();
@@ -896,7 +889,7 @@ public class JNLPClassLoader extends URLClassLoader {
* Try to find the library path from another peer classloader.
*/
protected String findLibraryExt(String lib) {
- for (int i=0; i < loaders.length; i++) {
+ for (int i = 0; i < loaders.length; i++) {
String result = null;
if (loaders[i] != this)
@@ -918,7 +911,7 @@ public class JNLPClassLoader extends URLClassLoader {
private void waitForJars(List jars) {
URL urls[] = new URL[jars.size()];
- for (int i=0; i < jars.size(); i++) {
+ for (int i = 0; i < jars.size(); i++) {
JARDesc jar = (JARDesc) jars.get(i);
urls[i] = jar.getLocation();
@@ -932,18 +925,18 @@ public class JNLPClassLoader extends URLClassLoader {
*
* @param jars the jars to be verified.
*/
- private JarSigner verifyJars(List<JARDesc> jars) throws Exception {
+ private JarSigner verifyJars(List<JARDesc> jars) throws Exception {
- js = new JarSigner();
- js.verifyJars(jars, tracker);
- return js;
- }
+ js = new JarSigner();
+ js.verifyJars(jars, tracker);
+ return js;
+ }
/**
* Find the loaded class in this loader or any of its extension loaders.
*/
protected Class findLoadedClassAll(String name) {
- for (int i=0; i < loaders.length; i++) {
+ for (int i = 0; i < loaders.length; i++) {
Class result = null;
if (loaders[i] == this)
@@ -975,8 +968,8 @@ public class JNLPClassLoader extends URLClassLoader {
parent = ClassLoader.getSystemClassLoader();
return parent.loadClass(name);
+ } catch (ClassNotFoundException ex) {
}
- catch (ClassNotFoundException ex) { }
}
// filter out 'bad' package names like java, javax
@@ -992,13 +985,13 @@ public class JNLPClassLoader extends URLClassLoader {
// Currently this loads jars directly from the site. We cannot cache it because this
// call is initiated from within the applet, which does not have disk read/write permissions
- for (JarIndex index: jarIndexes) {
+ for (JarIndex index : jarIndexes) {
// Non-generic code in sun.misc.JarIndex
@SuppressWarnings("unchecked")
- LinkedList<String> jarList = index.get(name.replace('.', '/'));
+ LinkedList<String> jarList = index.get(name.replace('.', '/'));
if (jarList != null) {
- for (String jarName: jarList) {
+ for (String jarName : jarList) {
JARDesc desc;
try {
desc = new JARDesc(new URL(file.getCodeBase(), jarName),
@@ -1012,7 +1005,7 @@ public class JNLPClassLoader extends URLClassLoader {
tracker.addResource(desc.getLocation(),
desc.getVersion(),
JNLPRuntime.getDefaultUpdatePolicy()
- );
+ );
URL remoteURL;
try {
@@ -1047,15 +1040,15 @@ public class JNLPClassLoader extends URLClassLoader {
* Find the class in this loader or any of its extension loaders.
*/
protected Class findClass(String name) throws ClassNotFoundException {
- for (int i=0; i < loaders.length; i++) {
+ for (int i = 0; i < loaders.length; i++) {
try {
if (loaders[i] == this)
return super.findClass(name);
else
return loaders[i].findClass(name);
+ } catch (ClassNotFoundException ex) {
+ } catch (ClassFormatError cfe) {
}
- catch(ClassNotFoundException ex) { }
- catch(ClassFormatError cfe) {}
}
throw new ClassNotFoundException(name);
@@ -1073,8 +1066,7 @@ public class JNLPClassLoader extends URLClassLoader {
// find it
try {
return findClass(name);
- }
- catch(ClassNotFoundException ex) {
+ } catch (ClassNotFoundException ex) {
}
// add resources until found
@@ -1086,8 +1078,7 @@ public class JNLPClassLoader extends URLClassLoader {
try {
return addedTo.findClass(name);
- }
- catch(ClassNotFoundException ex) {
+ } catch (ClassNotFoundException ex) {
}
}
}
@@ -1099,7 +1090,7 @@ public class JNLPClassLoader extends URLClassLoader {
public URL getResource(String name) {
URL result = super.getResource(name);
- for (int i=1; i < loaders.length; i++)
+ for (int i = 1; i < loaders.length; i++)
if (result == null)
result = loaders[i].getResource(name);
@@ -1114,7 +1105,7 @@ public class JNLPClassLoader extends URLClassLoader {
public Enumeration<URL> findResources(String name) throws IOException {
Vector<URL> resources = new Vector<URL>();
- for (int i=0; i < loaders.length; i++) {
+ for (int i = 0; i < loaders.length; i++) {
Enumeration<URL> e;
if (loaders[i] == this)
@@ -1147,7 +1138,7 @@ public class JNLPClassLoader extends URLClassLoader {
// go through available, check tracker for it and all of its
// part brothers being available immediately, add them.
- for (int i=1; i < loaders.length; i++) {
+ for (int i = 1; i < loaders.length; i++) {
loaders[i].addAvailable();
}
}
@@ -1162,7 +1153,7 @@ public class JNLPClassLoader extends URLClassLoader {
*/
protected JNLPClassLoader addNextResource() {
if (available.size() == 0) {
- for (int i=1; i < loaders.length; i++) {
+ for (int i = 1; i < loaders.length; i++) {
JNLPClassLoader result = loaders[i].addNextResource();
if (result != null)
@@ -1207,50 +1198,50 @@ public class JNLPClassLoader extends URLClassLoader {
return file.getFileLocation().toString();
}
- public boolean getSigning() {
- return signing;
- }
+ public boolean getSigning() {
+ return signing;
+ }
- protected SecurityDesc getSecurity() {
- return security;
- }
+ protected SecurityDesc getSecurity() {
+ return security;
+ }
- /**
- * Returns the security descriptor for given code source URL
- *
- * @param source The code source
- * @return The SecurityDescriptor for that source
- */
+ /**
+ * Returns the security descriptor for given code source URL
+ *
+ * @param source The code source
+ * @return The SecurityDescriptor for that source
+ */
- protected SecurityDesc getCodeSourceSecurity(URL source) {
- return jarLocationSecurityMap.get(source);
- }
+ protected SecurityDesc getCodeSourceSecurity(URL source) {
+ return jarLocationSecurityMap.get(source);
+ }
- /**
- * Merges the code source/security descriptor mapping from another loader
- *
- * @param extLoader The loader form which to merge
- * @throws SecurityException if the code is called from an untrusted source
- */
- private void merge(JNLPClassLoader extLoader) {
+ /**
+ * Merges the code source/security descriptor mapping from another loader
+ *
+ * @param extLoader The loader form which to merge
+ * @throws SecurityException if the code is called from an untrusted source
+ */
+ private void merge(JNLPClassLoader extLoader) {
- try {
- System.getSecurityManager().checkPermission(new AllPermission());
- } catch (SecurityException se) {
- throw new SecurityException("JNLPClassLoader() may only be called from trusted sources!");
- }
+ try {
+ System.getSecurityManager().checkPermission(new AllPermission());
+ } catch (SecurityException se) {
+ throw new SecurityException("JNLPClassLoader() may only be called from trusted sources!");
+ }
- // jars
- for (URL u : extLoader.getURLs())
- addURL(u);
+ // jars
+ for (URL u : extLoader.getURLs())
+ addURL(u);
- // native search paths
- for (File nativeDirectory: extLoader.getNativeDirectories())
+ // native search paths
+ for (File nativeDirectory : extLoader.getNativeDirectories())
addNativeDirectory(nativeDirectory);
// security descriptors
- for (URL key: extLoader.jarLocationSecurityMap.keySet()) {
- jarLocationSecurityMap.put(key, extLoader.jarLocationSecurityMap.get(key));
- }
+ for (URL key : extLoader.jarLocationSecurityMap.keySet()) {
+ jarLocationSecurityMap.put(key, extLoader.jarLocationSecurityMap.get(key));
}
+ }
}
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java b/netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java
index d839fbd..62b6967 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPPolicy.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import java.security.*;
@@ -41,7 +40,6 @@ public class JNLPPolicy extends Policy {
/** the previous policy */
private static Policy systemPolicy;
-
protected JNLPPolicy() {
shellSource = JNLPPolicy.class.getProtectionDomain().getCodeSource();
systemSource = Policy.class.getProtectionDomain().getCodeSource();
@@ -59,19 +57,19 @@ public class JNLPPolicy extends Policy {
// if we check the SecurityDesc here then keep in mind that
// code can add properties at runtime to the ResourcesDesc!
if (JNLPRuntime.getApplication() != null) {
- if (JNLPRuntime.getApplication().getClassLoader() instanceof JNLPClassLoader) {
- JNLPClassLoader cl = (JNLPClassLoader) JNLPRuntime.getApplication().getClassLoader();
+ if (JNLPRuntime.getApplication().getClassLoader() instanceof JNLPClassLoader) {
+ JNLPClassLoader cl = (JNLPClassLoader) JNLPRuntime.getApplication().getClassLoader();
- PermissionCollection clPermissions = cl.getPermissions(source);
+ PermissionCollection clPermissions = cl.getPermissions(source);
- // systempolicy permissions need to be accounted for as well
- CodeSource appletCS = new CodeSource(JNLPRuntime.getApplication().getJNLPFile().getSourceLocation(), (java.security.cert.Certificate[]) null);
- Enumeration e = systemPolicy.getPermissions(appletCS).elements();
+ // systempolicy permissions need to be accounted for as well
+ CodeSource appletCS = new CodeSource(JNLPRuntime.getApplication().getJNLPFile().getSourceLocation(), (java.security.cert.Certificate[]) null);
+ Enumeration e = systemPolicy.getPermissions(appletCS).elements();
while (e.hasMoreElements())
clPermissions.add((Permission) e.nextElement());
- return clPermissions;
- }
+ return clPermissions;
+ }
}
// delegate to original Policy object; required to run under WebStart
@@ -91,13 +89,13 @@ public class JNLPPolicy extends Policy {
private Permissions getAllPermissions() {
Permissions result = new Permissions();
- result.add( new AllPermission() );
+ result.add(new AllPermission());
return result;
}
- public boolean implies(ProtectionDomain domain, Permission permission) {
- //Include the permissions that may be added during runtime.
- PermissionCollection pc = getPermissions(domain.getCodeSource());
- return super.implies(domain, permission) || pc.implies(permission);
- }
+ public boolean implies(ProtectionDomain domain, Permission permission) {
+ //Include the permissions that may be added during runtime.
+ PermissionCollection pc = getPermissions(domain.getCodeSource());
+ return super.implies(domain, permission) || pc.implies(permission);
+ }
}
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
index 848a198..1e3a91c 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import java.io.*;
@@ -43,7 +42,6 @@ import net.sourceforge.jnlp.security.VariableX509TrustManager;
import net.sourceforge.jnlp.services.*;
import net.sourceforge.jnlp.util.*;
-
/**
* Configure and access the runtime environment. This class
* stores global jnlp properties such as default download
@@ -98,8 +96,8 @@ public class JNLPRuntime {
/** whether netx is in command-line mode (headless) */
private static boolean headless = false;
- /** whether we'll be checking for jar signing */
- private static boolean verify = true;
+ /** whether we'll be checking for jar signing */
+ private static boolean verify = true;
/** whether the runtime uses security */
private static boolean securityEnabled = true;
@@ -169,7 +167,7 @@ public class JNLPRuntime {
//Setting the system property for javawebstart's version.
//The version stored will be the same as java's version.
System.setProperty("javawebstart.version", "javaws-" +
- System.getProperty("java.version"));
+ System.getProperty("java.version"));
if (headless == false)
checkHeadless();
@@ -333,12 +331,13 @@ public class JNLPRuntime {
return headless;
}
- /**
- * Returns whether we are verifying code signing.
- */
- public static boolean isVerifying() {
- return verify;
- }
+ /**
+ * Returns whether we are verifying code signing.
+ */
+ public static boolean isVerifying() {
+ return verify;
+ }
+
/**
* Sets whether the JNLP client will use any AWT/Swing
* components. In headless mode, client features that use the
@@ -352,13 +351,13 @@ public class JNLPRuntime {
headless = enabled;
}
- /**
- * Sets whether we will verify code signing.
- * @throws IllegalStateException if the runtime was previously initialized
- */
+ /**
+ * Sets whether we will verify code signing.
+ * @throws IllegalStateException if the runtime was previously initialized
+ */
public static void setVerify(boolean enabled) {
- checkInitialized();
- verify = enabled;
+ checkInitialized();
+ verify = enabled;
}
/**
@@ -518,12 +517,11 @@ public class JNLPRuntime {
return null;
else
return result;
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
if (!key.equals("RNoResource"))
- return getMessage("RNoResource", new Object[] {key});
+ return getMessage("RNoResource", new Object[] { key });
else
- return "Missing resource: "+key;
+ return "Missing resource: " + key;
}
}
@@ -578,8 +576,7 @@ public class JNLPRuntime {
try {
if ("true".equalsIgnoreCase(System.getProperty("java.awt.headless")))
headless = true;
- }
- catch (SecurityException ex) {
+ } catch (SecurityException ex) {
}
}
@@ -589,8 +586,7 @@ public class JNLPRuntime {
private static void loadResources() {
try {
resources = ResourceBundle.getBundle("net.sourceforge.jnlp.resources.Messages");
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
throw new IllegalStateException("Missing resource bundle in netx.jar:net/sourceforge/jnlp/resource/Messages.properties");
}
}
@@ -605,14 +601,12 @@ public class JNLPRuntime {
try {
windowIcon = new javax.swing.ImageIcon((new sun.misc.Launcher())
.getClassLoader().getResource("net/sourceforge/jnlp/resources/netx-icon.png")).getImage();
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
if (JNLPRuntime.isDebug())
ex.printStackTrace();
}
}
-
public static void setInitialArgments(List<String> args) {
checkInitialized();
SecurityManager securityManager = System.getSecurityManager();
diff --git a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
index 32a54f8..38a0545 100644
--- a/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPSecurityManager.java
@@ -14,7 +14,6 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
package net.sourceforge.jnlp.runtime;
import static net.sourceforge.jnlp.runtime.Translator.R;
@@ -95,14 +94,14 @@ class JNLPSecurityManager extends AWTSecurityManager {
/** this exception prevents exiting the JVM */
private SecurityException closeAppEx = // making here prevents huge stack traces
- new SecurityException(R("RShutdown"));
+ new SecurityException(R("RShutdown"));
/** weak list of windows created */
private WeakList<Window> weakWindows = new WeakList<Window>();
/** weak list of applications corresponding to window list */
private WeakList<ApplicationInstance> weakApplications =
- new WeakList<ApplicationInstance>();
+ new WeakList<ApplicationInstance>();
/** weak reference to most app who's windows was most recently activated */
private WeakReference activeApplication = null;
@@ -148,7 +147,7 @@ class JNLPSecurityManager extends AWTSecurityManager {
if (exitClass == null)
return true;
- for (int i=0; i < stack.length; i++)
+ for (int i = 0; i < stack.length; i++)
if (stack[i] == exitClass)
return true;
@@ -182,7 +181,7 @@ class JNLPSecurityManager extends AWTSecurityManager {
* call from event dispatch thread).
*/
protected ApplicationInstance getApplication(Window window) {
- for (int i = weakWindows.size(); i-->0;) {
+ for (int i = weakWindows.size(); i-- > 0;) {
Window w = weakWindows.get(i);
if (w == null) {
weakWindows.remove(i);
@@ -201,17 +200,17 @@ class JNLPSecurityManager extends AWTSecurityManager {
*/
protected ApplicationInstance getApplication(Class stack[], int maxDepth) {
if (maxDepth <= 0)
- maxDepth = stack.length;
+ maxDepth = stack.length;
// this needs to be tightened up
- for (int i=0; i < stack.length && i < maxDepth; i++) {
- if (stack[i].getClassLoader() instanceof JNLPClassLoader) {
- JNLPClassLoader loader = (JNLPClassLoader) stack[i].getClassLoader();
+ for (int i = 0; i < stack.length && i < maxDepth; i++) {
+ if (stack[i].getClassLoader() instanceof JNLPClassLoader) {
+ JNLPClassLoader loader = (JNLPClassLoader) stack[i].getClassLoader();
- if (loader != null && loader.getApplication() != null) {
- return loader.getApplication();
- }
+ if (loader != null && loader.getApplication() != null) {
+ return loader.getApplication();
}
+ }
}
return null;
@@ -243,113 +242,112 @@ class JNLPSecurityManager extends AWTSecurityManager {
// System.out.println("Checking permission: " + perm.toString());
if (!JNLPRuntime.isWebstartApplication() &&
- ("setPolicy".equals(name) || "setSecurityManager".equals(name)))
+ ("setPolicy".equals(name) || "setSecurityManager".equals(name)))
throw new SecurityException(R("RCantReplaceSM"));
try {
// deny all permissions to stopped applications
- // The call to getApplication() below might not work if an
- // application hasn't been fully initialized yet.
-// if (JNLPRuntime.isDebug()) {
-// if (!"getClassLoader".equals(name)) {
-// ApplicationInstance app = getApplication();
-// if (app != null && !app.isRunning())
-// throw new SecurityException(R("RDenyStopped"));
-// }
-// }
+ // The call to getApplication() below might not work if an
+ // application hasn't been fully initialized yet.
+ // if (JNLPRuntime.isDebug()) {
+ // if (!"getClassLoader".equals(name)) {
+ // ApplicationInstance app = getApplication();
+ // if (app != null && !app.isRunning())
+ // throw new SecurityException(R("RDenyStopped"));
+ // }
+ // }
+
+ try {
+ super.checkPermission(perm);
+ } catch (SecurityException se) {
+
+ //This section is a special case for dealing with SocketPermissions.
+ if (JNLPRuntime.isDebug())
+ System.err.println("Requesting permission: " + perm.toString());
+
+ //Change this SocketPermission's action to connect and accept
+ //(and resolve). This is to avoid asking for connect permission
+ //on every address resolve.
+ Permission tmpPerm = null;
+ if (perm instanceof SocketPermission) {
+ tmpPerm = new SocketPermission(perm.getName(),
+ SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION);
+
+ // before proceeding, check if we are trying to connect to same origin
+ ApplicationInstance app = getApplication();
+ JNLPFile file = app.getJNLPFile();
+
+ String srcHost = file.getSourceLocation().getAuthority();
+ String destHost = name;
+
+ // host = abc.xyz.com or abc.xyz.com:<port>
+ if (destHost.indexOf(':') >= 0)
+ destHost = destHost.substring(0, destHost.indexOf(':'));
+
+ // host = abc.xyz.com
+ String[] hostComponents = destHost.split("\\.");
+ int length = hostComponents.length;
+ if (length >= 2) {
+
+ // address is in xxx.xxx.xxx format
+ destHost = hostComponents[length - 2] + "." + hostComponents[length - 1];
+
+ // host = xyz.com i.e. origin
+ boolean isDestHostName = false;
+
+ // make sure that it is not an ip address
try {
- super.checkPermission(perm);
- } catch (SecurityException se) {
-
- //This section is a special case for dealing with SocketPermissions.
- if (JNLPRuntime.isDebug())
- System.err.println("Requesting permission: " + perm.toString());
-
- //Change this SocketPermission's action to connect and accept
- //(and resolve). This is to avoid asking for connect permission
- //on every address resolve.
- Permission tmpPerm = null;
- if (perm instanceof SocketPermission) {
- tmpPerm = new SocketPermission(perm.getName(),
- SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION);
+ Integer.parseInt(hostComponents[length - 1]);
+ } catch (NumberFormatException e) {
+ isDestHostName = true;
+ }
- // before proceeding, check if we are trying to connect to same origin
- ApplicationInstance app = getApplication();
- JNLPFile file = app.getJNLPFile();
-
- String srcHost = file.getSourceLocation().getAuthority();
- String destHost = name;
-
- // host = abc.xyz.com or abc.xyz.com:<port>
- if (destHost.indexOf(':') >= 0)
- destHost = destHost.substring(0, destHost.indexOf(':'));
-
- // host = abc.xyz.com
- String[] hostComponents = destHost.split("\\.");
-
- int length = hostComponents.length;
- if (length >= 2) {
-
- // address is in xxx.xxx.xxx format
- destHost = hostComponents[length -2] + "." + hostComponents[length -1];
-
- // host = xyz.com i.e. origin
- boolean isDestHostName = false;
-
- // make sure that it is not an ip address
- try {
- Integer.parseInt(hostComponents[length -1]);
- } catch (NumberFormatException e) {
- isDestHostName = true;
- }
-
- if (isDestHostName) {
- // okay, destination is hostname. Now figure out if it is a subset of origin
- if (srcHost.endsWith(destHost)) {
- addPermission(tmpPerm);
- return;
- }
- }
- }
-
- } else if (perm instanceof SecurityPermission) {
-
- // JCE's initialization requires putProviderProperty permission
- if (perm.equals(new SecurityPermission("putProviderProperty.SunJCE"))) {
- if (inTrustedCallChain("com.sun.crypto.provider.SunJCE", "run")) {
- return;
- }
- }
-
- } else if (perm instanceof RuntimePermission) {
-
- // KeyGenerator's init method requires internal spec access
- if (perm.equals(new SecurityPermission("accessClassInPackage.sun.security.internal.spec"))) {
- if (inTrustedCallChain("javax.crypto.KeyGenerator", "init")) {
- return;
- }
- }
-
- } else {
- tmpPerm = perm;
- }
-
- if (tmpPerm != null) {
- //askPermission will only prompt the user on SocketPermission
- //meaning we're denying all other SecurityExceptions that may arise.
- if (askPermission(tmpPerm)) {
- addPermission(tmpPerm);
- //return quietly.
- } else {
- throw se;
- }
- }
+ if (isDestHostName) {
+ // okay, destination is hostname. Now figure out if it is a subset of origin
+ if (srcHost.endsWith(destHost)) {
+ addPermission(tmpPerm);
+ return;
+ }
}
- }
- catch (SecurityException ex) {
+ }
+
+ } else if (perm instanceof SecurityPermission) {
+
+ // JCE's initialization requires putProviderProperty permission
+ if (perm.equals(new SecurityPermission("putProviderProperty.SunJCE"))) {
+ if (inTrustedCallChain("com.sun.crypto.provider.SunJCE", "run")) {
+ return;
+ }
+ }
+
+ } else if (perm instanceof RuntimePermission) {
+
+ // KeyGenerator's init method requires internal spec access
+ if (perm.equals(new SecurityPermission("accessClassInPackage.sun.security.internal.spec"))) {
+ if (inTrustedCallChain("javax.crypto.KeyGenerator", "init")) {
+ return;
+ }
+ }
+
+ } else {
+ tmpPerm = perm;
+ }
+
+ if (tmpPerm != null) {
+ //askPermission will only prompt the user on SocketPermission
+ //meaning we're denying all other SecurityExceptions that may arise.
+ if (askPermission(tmpPerm)) {
+ addPermission(tmpPerm);
+ //return quietly.
+ } else {
+ throw se;
+ }
+ }
+ }
+ } catch (SecurityException ex) {
if (JNLPRuntime.isDebug()) {
- System.out.println("Denying permission: "+perm);
+ System.out.println("Denying permission: " + perm);
}
throw ex;
}
@@ -365,9 +363,9 @@ class JNLPSecurityManager extends AWTSecurityManager {
*/
private boolean inTrustedCallChain(String className, String methodName) {
- StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+ StackTraceElement[] stack = Thread.currentThread().getStackTrace();
- for (int i=0; i < stack.length; i++) {
+ for (int i = 0; i < stack.length; i++) {
// Everything up to the desired class/method must be trusted
if (!stack[i].getClass().getProtectionDomain().implies(new AllPermission())) {
@@ -375,7 +373,7 @@ class JNLPSecurityManager extends AWTSecurityManager {
}
if (stack[i].getClassName().equals(className) &&
- stack[i].getMethodName().equals(methodName)) {
+ stack[i].getMethodName().equals(methodName)) {
return true;
}
}
@@ -388,14 +386,14 @@ class JNLPSecurityManager extends AWTSecurityManager {
* @param perm the permission to be granted
* @return true if the permission was granted, false otherwise.
*/
- private boolean askPermission(Permission perm) {
+ private boolean askPermission(Permission perm) {
ApplicationInstance app = getApplication();
if (app != null && !app.isSigned()) {
- if (perm instanceof SocketPermission
+ if (perm instanceof SocketPermission
&& ServiceUtil.checkAccess(AccessType.NETWORK, perm.getName())) {
- return true;
- }
+ return true;
+ }
}
return false;
@@ -408,17 +406,17 @@ class JNLPSecurityManager extends AWTSecurityManager {
private void addPermission(Permission perm) {
if (JNLPRuntime.getApplication().getClassLoader() instanceof JNLPClassLoader) {
- JNLPClassLoader cl = (JNLPClassLoader) JNLPRuntime.getApplication().getClassLoader();
- cl.addPermission(perm);
- if (JNLPRuntime.isDebug()) {
- if (cl.getPermissions(null).implies(perm))
- System.err.println("Added permission: " + perm.toString());
- else
- System.err.println("Unable to add permission: " + perm.toString());
- }
+ JNLPClassLoader cl = (JNLPClassLoader) JNLPRuntime.getApplication().getClassLoader();
+ cl.addPermission(perm);
+ if (JNLPRuntime.isDebug()) {
+ if (cl.getPermissions(null).implies(perm))
+ System.err.println("Added permission: " + perm.toString());
+ else
+ System.err.println("Unable to add permission: " + perm.toString());
+ }
} else {
- if (JNLPRuntime.isDebug())
- System.err.println("Unable to add permission: " + perm + ", classloader not JNLP.");
+ if (JNLPRuntime.isDebug())
+ System.err.println("Unable to add permission: " + perm + ", classloader not JNLP.");
}
}
@@ -435,7 +433,7 @@ class JNLPSecurityManager extends AWTSecurityManager {
Window w = (Window) window;
if (JNLPRuntime.isDebug())
- System.err.println("SM: app: "+app.getTitle()+" is adding a window: "+window+" with appContext "+AppContext.getAppContext());
+ System.err.println("SM: app: " + app.getTitle() + " is adding a window: " + window + " with appContext " + AppContext.getAppContext());
weakWindows.add(w); // for mapping window -> app
weakApplications.add(app);
@@ -445,9 +443,9 @@ class JNLPSecurityManager extends AWTSecurityManager {
// change coffee cup to netx for default icon
if (window instanceof Window)
- for (Window w = (Window)window; w != null; w = w.getOwner())
+ for (Window w = (Window) window; w != null; w = w.getOwner())
if (window instanceof Frame)
- ((Frame)window).setIconImage(JNLPRuntime.getWindowIcon());
+ ((Frame) window).setIconImage(JNLPRuntime.getWindowIcon());
// todo: set awt.appletWarning to custom message
// todo: logo on with glass pane on JFrame/JWindow?
@@ -473,9 +471,9 @@ class JNLPSecurityManager extends AWTSecurityManager {
// applets are not allowed to exit, but the plugin main class (primordial loader) is
Class stack[] = getClassContext();
if (!exitAllowed) {
- for (int i=0; i < stack.length; i++)
- if (stack[i].getClassLoader() != null)
- throw new AccessControlException("Applets may not call System.exit()");
+ for (int i = 0; i < stack.length; i++)
+ if (stack[i].getClassLoader() != null)
+ throw new AccessControlException("Applets may not call System.exit()");
}
super.checkExit(status);