diff options
author | Danesh Dadachanji <[email protected]> | 2012-02-13 11:30:23 -0500 |
---|---|---|
committer | Danesh Dadachanji <[email protected]> | 2012-02-13 11:30:23 -0500 |
commit | db3c99a7469ba6b42f659920ce861a5fb74c0105 (patch) | |
tree | 05b898ef62c98678f99986220a093bd64c0a4c65 /netx | |
parent | cb09f782e2d6c3f92f5f1d5b870a19b6ecbb8f24 (diff) |
Fix regression in broken AppletTest.
Diffstat (limited to 'netx')
-rw-r--r-- | netx/net/sourceforge/jnlp/Launcher.java | 7 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/runtime/AppletEnvironment.java | 14 |
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. */ |