[RFC][plugin]: class in CWD can block applet from loading.

Deepak Bhole dbhole at redhat.com
Tue Mar 29 11:42:14 PDT 2011


* Denis Lila <dlila at redhat.com> [2011-03-29 14:38]:
> Hi.
> 
> This is the fix I came up with for this issue. I just
> start up the jvm with classpath ~/.icedtea so when we do
> "return parent.loadClass(name);" in JNLPClassLoader.loadClass
> the parent doesn't look in the cwd. It still looks into ~/.icedtea
> so if that's the current directory the bug will reappear. I don't
> think that's a problem because there's no reason for the user to
> be in that directory, and even then, there shouldn't be any class
> files in ~/.icedtea.
>

Isn't javaws affected by the problem as well?

Deepak
 
> ChangeLog:
> +2011-03-29  Denis Lila  <dlila at redhat.com>
> +
> +	* plugin/icedteanp/IcedTeaNPPlugin.cc
> +	(plugin_start_appletviewer): Replace hardcoded indices
> +	with a variable; roll up free calls in a loop; fix whitespace;
> +	set classpath to ~/.icedtea.
> 
> The first three changes mentioned above aren't related to this bug,
> but I think they would be nice to have.
> 
> Any comments are much appreciated.
> 
> Thank you,
> Denis.

> diff -r 3bbc4314e02c ChangeLog
> --- a/ChangeLog	Tue Mar 29 10:24:31 2011 -0400
> +++ b/ChangeLog	Tue Mar 29 14:38:20 2011 -0400
> @@ -1,3 +1,10 @@
> +2011-03-29  Denis Lila  <dlila at redhat.com>
> +
> +	* plugin/icedteanp/IcedTeaNPPlugin.cc
> +	(plugin_start_appletviewer): Replace hardcoded indices
> +	with a variable; roll up free calls in a loop; fix whitespace;
> +	set classpath to ~/.icedtea.
> +
>  2011-03-29  Denis Lila <dlila at redhat.com>
>  
>  	* netx/net/sourceforge/jnlp/JNLPFile.java
> diff -r 3bbc4314e02c plugin/icedteanp/IcedTeaNPPlugin.cc
> --- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Tue Mar 29 10:24:31 2011 -0400
> +++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Tue Mar 29 14:38:20 2011 -0400
> @@ -1541,34 +1541,39 @@
>    gchar** command_line;
>    gchar** environment;
>  
> +  int cmd_num = 0;
>    if (plugin_debug)
>    {
> -      command_line = (gchar**) malloc(sizeof(gchar*)*9);
> -      command_line[0] = g_strdup(appletviewer_executable);
> -      command_line[1] = g_strdup(PLUGIN_BOOTCLASSPATH);
> -      command_line[2] = g_strdup("-Xdebug");
> -      command_line[3] = g_strdup("-Xnoagent");
> +      command_line = (gchar**) malloc(sizeof(gchar*)*11);
> +      command_line[cmd_num++] = g_strdup(appletviewer_executable);
> +      command_line[cmd_num++] = g_strdup(PLUGIN_BOOTCLASSPATH);
> +      command_line[cmd_num++] = g_strdup("-classpath");
> +      command_line[cmd_num++] = g_strdup("~/.icedtea");
> +      command_line[cmd_num++] = g_strdup("-Xdebug");
> +      command_line[cmd_num++] = g_strdup("-Xnoagent");
>        if (plugin_debug_suspend)
>        {
> -          command_line[4] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y");
> +          command_line[cmd_num++] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y");
>        } else
>        {
> -          command_line[4] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n");
> +          command_line[cmd_num++] = g_strdup("-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n");
>        }
> -      command_line[5] = g_strdup("sun.applet.PluginMain");
> -      command_line[6] = g_strdup(out_pipe_name);
> -      command_line[7] = g_strdup(in_pipe_name);
> -      command_line[8] = NULL;
> -   } else
> -   {
> -       command_line = (gchar**) malloc(sizeof(gchar*)*6);
> -       command_line[0] = g_strdup(appletviewer_executable);
> -       command_line[1] = g_strdup(PLUGIN_BOOTCLASSPATH);
> -       command_line[2] = g_strdup("sun.applet.PluginMain");
> -       command_line[3] = g_strdup(out_pipe_name);
> -       command_line[4] = g_strdup(in_pipe_name);
> -       command_line[5] = NULL;
> -   }
> +      command_line[cmd_num++] = g_strdup("sun.applet.PluginMain");
> +      command_line[cmd_num++] = g_strdup(out_pipe_name);
> +      command_line[cmd_num++] = g_strdup(in_pipe_name);
> +      command_line[cmd_num] = NULL;
> +  } else
> +  {
> +      command_line = (gchar**) malloc(sizeof(gchar*)*8);
> +      command_line[cmd_num++] = g_strdup(appletviewer_executable);
> +      command_line[cmd_num++] = g_strdup(PLUGIN_BOOTCLASSPATH);
> +      command_line[cmd_num++] = g_strdup("-classpath");
> +      command_line[cmd_num++] = g_strdup("~/.icedtea");
> +      command_line[cmd_num++] = g_strdup("sun.applet.PluginMain");
> +      command_line[cmd_num++] = g_strdup(out_pipe_name);
> +      command_line[cmd_num++] = g_strdup(in_pipe_name);
> +      command_line[cmd_num] = NULL;
> +  }
>  
>    environment = plugin_filter_environment();
>  
> @@ -1590,25 +1595,9 @@
>  
>    g_strfreev (environment);
>  
> -  g_free (command_line[0]);
> -  command_line[0] = NULL;
> -  g_free (command_line[1]);
> -  command_line[1] = NULL;
> -  g_free (command_line[2]);
> -  command_line[2] = NULL;
> -  g_free (command_line[3]);
> -  command_line[3] = NULL;
> -  g_free (command_line[4]);
> -  command_line[4] = NULL;
> -
> -  if (plugin_debug)
> -  {
> -      g_free (command_line[5]);
> -      command_line[5] = NULL;
> -      g_free (command_line[6]);
> -      command_line[6] = NULL;
> -      g_free (command_line[7]);
> -      command_line[7] = NULL;
> +  for (int i = 0; i < cmd_num; i++) {
> +    g_free (command_line[i]);
> +    command_line[i] = NULL;
>    }
>  
>    g_free(command_line);




More information about the distro-pkg-dev mailing list