changeset 177:d94fc0fb8a53

Implement codebase_lookup=false.
author dlila
date Fri, 25 Mar 2011 14:23:28 -0400
parents 92486f15be36
children 331d5d580cc4
files ChangeLog NEWS netx/net/sourceforge/jnlp/Launcher.java netx/net/sourceforge/jnlp/PluginBridge.java
diffstat 4 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 24 09:34:51 2011 -0400
+++ b/ChangeLog	Fri Mar 25 14:23:28 2011 -0400
@@ -1,3 +1,12 @@
+2011-03-25  Denis Lila <dlila@redhat.com>
+
+	* netx/net/sourceforge/jnlp/PluginBridge.java
+	(codeBaseLookup): new member and getter for it.
+	(PluginBridge): set codeBaseLookup.
+	* netx/net/sourceforge/jnlp/Launcher.java:
+	(createApplet, createAppletObject): call enableCodeBase() if and
+	only if the enableCodeBase argument is true.
+
 2011-03-24  Omair Majid  <omajid@redhat.com>
 
 	* Makefile.am (EXTRA_DIST): Add $(top_srcdir)/tests.
--- a/NEWS	Thu Mar 24 09:34:51 2011 -0400
+++ b/NEWS	Fri Mar 25 14:23:28 2011 -0400
@@ -16,6 +16,7 @@
   - IcedTea-Web now installs to a FHS-compliant location
   - IcedTea-Web can now handle Proxy Auto Config files
   - Binary launchers replaced with simple shell scripts
+  - Can now use codebase_lookup=false with applets.
 * Common Fixes and Improvements
   - PR497: Mercurial revision detection not very reliable
   - PR638: JNLPClassLoader.loadClass(String name) can return null
--- a/netx/net/sourceforge/jnlp/Launcher.java	Thu Mar 24 09:34:51 2011 -0400
+++ b/netx/net/sourceforge/jnlp/Launcher.java	Fri Mar 25 14:23:28 2011 -0400
@@ -563,8 +563,11 @@
         try {
             JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
 
-            if (enableCodeBase || file.getResources().getJARs().length == 0)
+            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");
+            }
 
             AppThreadGroup group = (AppThreadGroup) Thread.currentThread().getThreadGroup();
 
@@ -603,8 +606,11 @@
         try {
             JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
 
-            if (enableCodeBase || file.getResources().getJARs().length == 0)
+            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();
 
@@ -742,7 +748,7 @@
                 if (isPlugin) {
                     // Do not display download indicators if we're using gcjwebplugin.
                     JNLPRuntime.setDefaultDownloadIndicator(null);
-                    application = getApplet(file, true, cont);
+                    application = getApplet(file, ((PluginBridge)file).codeBaseLookup(), cont);
                 } else {
                     if (file.isApplication())
                         application = launchApplication(file);
--- a/netx/net/sourceforge/jnlp/PluginBridge.java	Thu Mar 24 09:34:51 2011 -0400
+++ b/netx/net/sourceforge/jnlp/PluginBridge.java	Fri Mar 25 14:23:28 2011 -0400
@@ -24,7 +24,6 @@
 
 import java.net.URL;
 import java.net.MalformedURLException;
-import java.util.Calendar;
 import java.util.Hashtable;
 import java.util.Locale;
 import java.util.List;
@@ -42,6 +41,7 @@
     Hashtable<String, String> atts;
     private boolean usePack;
     private boolean useVersion;
+    private boolean codeBaseLookup;
 
     public PluginBridge(URL codebase, URL documentBase, String jar, String main,
                         int width, int height, Hashtable<String, String> atts)
@@ -152,6 +152,12 @@
                 }
             }
         }
+        String cbl = atts.get("codebase_lookup");
+        codeBaseLookup = cbl == null || (Boolean.valueOf(cbl));
+    }
+
+    public boolean codeBaseLookup() {
+    	return codeBaseLookup;
     }
 
     /**