aboutsummaryrefslogtreecommitdiffstats
path: root/netx
diff options
context:
space:
mode:
authorDanesh Dadachanji <[email protected]>2012-02-13 11:30:23 -0500
committerDanesh Dadachanji <[email protected]>2012-02-13 11:30:23 -0500
commitdb3c99a7469ba6b42f659920ce861a5fb74c0105 (patch)
tree05b898ef62c98678f99986220a093bd64c0a4c65 /netx
parentcb09f782e2d6c3f92f5f1d5b870a19b6ecbb8f24 (diff)
Fix regression in broken AppletTest.
Diffstat (limited to 'netx')
-rw-r--r--netx/net/sourceforge/jnlp/Launcher.java7
-rw-r--r--netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java14
2 files changed, 21 insertions, 0 deletions
diff --git a/netx/net/sourceforge/jnlp/Launcher.java b/netx/net/sourceforge/jnlp/Launcher.java
index c1eda82..15b1e56 100644
--- a/netx/net/sourceforge/jnlp/Launcher.java
+++ b/netx/net/sourceforge/jnlp/Launcher.java
@@ -708,6 +708,9 @@ public class Launcher {
ThreadGroup group = Thread.currentThread().getThreadGroup();
+ // appletInstance is needed by ServiceManager when looking up
+ // services. This could potentially be done in applet constructor
+ // so initialize appletInstance before creating applet.
AppletInstance appletInstance;
if (cont == null)
appletInstance = new AppletInstance(file, group, loader, null);
@@ -716,10 +719,14 @@ public class Launcher {
loader.setApplication(appletInstance);
+ // Initialize applet now that ServiceManager has access to its
+ // appletInstance.
String appletName = file.getApplet().getMainClass();
Class appletClass = loader.loadClass(appletName);
Applet applet = (Applet) appletClass.newInstance();
+ // Finish setting up appletInstance.
appletInstance.setApplet(applet);
+ appletInstance.getAppletEnvironment().setApplet(applet);
setContextClassLoaderForAllThreads(appletInstance.getThreadGroup(), appletInstance.getClassLoader());
diff --git a/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java b/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java
index 993bf50..321e18e 100644
--- a/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java
+++ b/netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java
@@ -207,6 +207,20 @@ public class AppletEnvironment implements AppletContext, AppletStub {
}
/**
+ * Set the applet of this environment; can only be called once.
+ */
+ public void setApplet(Applet applet) {
+ if (this.applet != null) {
+ if (JNLPRuntime.isDebug()) {
+ Exception ex = new IllegalStateException("Applet can only be set once.");
+ ex.printStackTrace();
+ }
+ return;
+ }
+ this.applet = applet;
+ }
+
+ /**
* Returns an enumeration that contains only the applet
* from the JNLP file.
*/