[RFC]: implement codebase_lookup for applets

Deepak Bhole dbhole at redhat.com
Fri Mar 25 14:22:19 PDT 2011


* Denis Lila <dlila at redhat.com> [2011-03-25 17:13]:
> Hi.
> 
>  
<snip>
> -            if (enableCodeBase || file.getResources().getJARs().length == 0)
> +            if (enableCodeBase)
<snip>
>              JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy);
>  
> -            if (enableCodeBase || file.getResources().getJARs().length == 0)
> +            if (enableCodeBase)

Either the "|| file.getResources().getJARs().length == 0" condition should be
kept, or a proper error should be thrown when codebase_lookup == false
and jar length is 0. I am in favor of the latter.

Without that, if there is no jar and codebase_lookup is false, it will
fail with an NPE when loadClass fails to get the main class.

Cheers,
Deepak

>                  loader.enableCodeBase();
>  
>              String appletName = file.getApplet().getMainClass();
> @@ -742,7 +742,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);
> diff -r 92486f15be36 netx/net/sourceforge/jnlp/PluginBridge.java
> --- 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 13:11:02 2011 -0400
> @@ -42,6 +42,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 +153,12 @@
>                  }
>              }
>          }
> +        String cbl = atts.get("codebase_lookup");
> +        codeBaseLookup = cbl == null || (Boolean.valueOf(cbl));
> +    }
> +
> +    public boolean codeBaseLookup() {
> +    	return codeBaseLookup;
>      }
>  
>      /**




More information about the distro-pkg-dev mailing list