/hg/icedtea-web: Partial revert of 7933143a1286
aazores at icedtea.classpath.org
aazores at icedtea.classpath.org
Tue Feb 11 06:20:48 PST 2014
changeset 5909bfb3675f in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=5909bfb3675f
author: Andrew Azores <aazores at redhat.com>
date: Tue Feb 11 09:20:36 2014 -0500
Partial revert of 7933143a1286
Previous patch caused some unit test regressions - enabling codebase
this early in the classloader initialization doesn't always work
Partial revert of 7933143a1286, refactoring to move
codebase-loading-enabling logic out of Launcher and into JNLPClassLoader.
* netx/net/sourceforge/jnlp/Launcher.java: (createApplet,
createAppletObject): handle enableCodebase again
* netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (enableCodebase):
re-added, codebase enabling logic moved back out into Launcher
diffstat:
ChangeLog | 9 +++
netx/net/sourceforge/jnlp/Launcher.java | 16 ++++-
netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java | 53 +++++------------
3 files changed, 39 insertions(+), 39 deletions(-)
diffs (164 lines):
diff -r 1e0507976663 -r 5909bfb3675f ChangeLog
--- a/ChangeLog Wed Feb 05 13:55:28 2014 +0100
+++ b/ChangeLog Tue Feb 11 09:20:36 2014 -0500
@@ -1,3 +1,12 @@
+2014-02-11 Andrew Azores <aazores at redhat.com>
+
+ Partial revert of 7933143a1286, refactoring to move
+ codebase-loading-enabling logic out of Launcher and into JNLPClassLoader.
+ * netx/net/sourceforge/jnlp/Launcher.java: (createApplet,
+ createAppletObject): handle enableCodebase again
+ * netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java: (enableCodebase):
+ re-added, codebase enabling logic moved back out into Launcher
+
2014-02-05 Jiri Vanek <jvanek at redhat.com>
Added salt to plugin-java pipes' directory (fixing RH1010958)
diff -r 1e0507976663 -r 5909bfb3675f netx/net/sourceforge/jnlp/Launcher.java
--- a/netx/net/sourceforge/jnlp/Launcher.java Wed Feb 05 13:55:28 2014 +0100
+++ b/netx/net/sourceforge/jnlp/Launcher.java Tue Feb 11 09:20:36 2014 -0500
@@ -696,7 +696,13 @@
protected AppletInstance createApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
AppletInstance appletInstance = null;
try {
- JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy, enableCodeBase);
+ JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
+
+ if (enableCodeBase) {
+ loader.enableCodeBase();
+ } else if (file.getResources().getJARs().length == 0) {
+ throw new ClassNotFoundException("Can't do a codebase look up and there are no jars. Failing sooner rather than later");
+ }
ThreadGroup group = Thread.currentThread().getThreadGroup();
@@ -737,7 +743,13 @@
*/
protected Applet createAppletObject(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
try {
- JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy, enableCodeBase);
+ JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
+
+ if (enableCodeBase) {
+ loader.enableCodeBase();
+ } else if (file.getResources().getJARs().length == 0) {
+ throw new ClassNotFoundException("Can't do a codebase look up and there are no jars. Failing sooner rather than later");
+ }
String appletName = file.getApplet().getMainClass();
Class<?> appletClass = loader.loadClass(appletName);
diff -r 1e0507976663 -r 5909bfb3675f netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Wed Feb 05 13:55:28 2014 +0100
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPClassLoader.java Tue Feb 11 09:20:36 2014 -0500
@@ -227,7 +227,7 @@
* @param file the JNLP file
*/
protected JNLPClassLoader(JNLPFile file, UpdatePolicy policy) throws LaunchException {
- this(file, policy, null, false);
+ this(file, policy, null);
}
/**
@@ -237,7 +237,7 @@
* @param policy the UpdatePolicy for this class loader
* @param mainName name of the application's main class
*/
- protected JNLPClassLoader(JNLPFile file, UpdatePolicy policy, String mainName, boolean enableCodeBase) throws LaunchException {
+ protected JNLPClassLoader(JNLPFile file, UpdatePolicy policy, String mainName) throws LaunchException {
super(new URL[0], JNLPClassLoader.class.getClassLoader());
OutputController.getLogger().log("New classloader: " + file.getFileLocation());
@@ -263,13 +263,6 @@
jcv = new JarCertVerifier(verifier);
- if (enableCodeBase) {
- addToCodeBaseLoader(file.getCodeBase());
- } else if (file.getResources().getJARs().length == 0) {
- throw new LaunchException(
- new ClassNotFoundException("Can't do a codebase lookup and there are no jars. Failing sooner rather than later"));
- }
-
// initialize extensions
initializeExtensions();
@@ -390,12 +383,11 @@
* @param file the file to load classes for
* @param policy the update policy to use when downloading resources
* @param mainName Overrides the main class name of the application
- * @param enableCodeBase if codebase lookups are allowed
*/
- private static JNLPClassLoader createInstance(JNLPFile file, UpdatePolicy policy, String mainName, boolean enableCodeBase) throws LaunchException {
+ private static JNLPClassLoader createInstance(JNLPFile file, UpdatePolicy policy, String mainName) throws LaunchException {
String uniqueKey = file.getUniqueKey();
JNLPClassLoader baseLoader = uniqueKeyToLoader.get(uniqueKey);
- JNLPClassLoader loader = new JNLPClassLoader(file, policy, mainName, enableCodeBase);
+ JNLPClassLoader loader = new JNLPClassLoader(file, policy, mainName);
// If security level is 'high' or greater, we must check if the user allows unsigned applets
// when the JNLPClassLoader is created. We do so here, because doing so in the constructor
@@ -441,32 +433,9 @@
*
* @param file the file to load classes for
* @param policy the update policy to use when downloading resources
- * @param enableCodeBase if codebase lookups are allowed
- */
- public static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy, boolean enableCodeBase) throws LaunchException {
- return getInstance(file, policy, null, enableCodeBase);
- }
-
- /**
- * Returns a JNLP classloader for the specified JNLP file.
- *
- * @param file the file to load classes for
- * @param policy the update policy to use when downloading resources
* @param mainName Overrides the main class name of the application
*/
public static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy, String mainName) throws LaunchException {
- return getInstance(file, policy, mainName, false);
- }
-
- /**
- * Returns a JNLP classloader for the specified JNLP file.
- *
- * @param file the file to load classes for
- * @param policy the update policy to use when downloading resources
- * @param mainName Overrides the main class name of the application
- * @param enableCodeBase if lookups are allowed
- */
- public static JNLPClassLoader getInstance(JNLPFile file, UpdatePolicy policy, String mainName, boolean enableCodeBase) throws LaunchException {
JNLPClassLoader baseLoader = null;
JNLPClassLoader loader = null;
String uniqueKey = file.getUniqueKey();
@@ -480,12 +449,12 @@
(file.isApplication() &&
!baseLoader.getJNLPFile().getFileLocation().equals(file.getFileLocation()))) {
- loader = createInstance(file, policy, mainName, enableCodeBase);
+ loader = createInstance(file, policy, mainName);
} else {
// if key is same and locations match, this is the loader we want
if (!file.isApplication()) {
// If this is an applet, we do need to consider its loader
- loader = new JNLPClassLoader(file, policy, mainName, enableCodeBase);
+ loader = new JNLPClassLoader(file, policy, mainName);
if (baseLoader != null)
baseLoader.merge(loader);
@@ -1150,6 +1119,16 @@
}
/**
+ * Add applet's codebase URL. This allows compatibility with
+ * applets that load resources from their codebase instead of
+ * through JARs, but can slow down resource loading. Resources
+ * loaded from the codebase are not cached.
+ */
+ public void enableCodeBase() {
+ addToCodeBaseLoader(file.getCodeBase());
+ }
+
+ /**
* Sets the JNLP app this group is for; can only be called once.
*/
public void setApplication(ApplicationInstance app) {
More information about the distro-pkg-dev
mailing list