[RFC][icedtea-web] Launch errors are not being printed to terminal.

Danesh Dadachanji ddadacha at redhat.com
Mon Mar 12 07:59:12 PDT 2012


On 11/03/12 12:01 AM, Omair Majid wrote:
> On 03/09/2012 12:16 PM, Danesh Dadachanji wrote:
>> If javaws is run with -headless and a launch error occurs, no message is
>> printed and javaws exits.
>
> By no message do you mean nothing at all (or is a single line message
> printed without an exception stack trace)?
>

Unfortunately nothing at all. I would not have noticed this if it 
printed something. =) The method printMessage() setup that one-liner 
that needed to be printed but never actually did the printing. :/

Don't think I mentioned this in the original email but the reason behind 
-headless or -verbose printing a stack trace is to make it similar to 
when neither are passed. In this case, javaws prints the dialog with a 
stack trace so in order to make -headless act similarly, Jiri and I 
concluded it would be best to print the entire stacktrace if just 
-headless was passed (regardless of -verbose).

>> An exception is only shown if -verbose is
>> passed too. This patch fixes it so that if -headless OR -verbose is
>> used, the error and stacktrace are shown.
>>
>> Furthermore, when javaws -verbose is used (_without_ -headless), the
>> stacktrace is printed to stderr too. This will come in handy once GUI
>> testing for applets is available.
>
> I am not sure how. Applets don't use GuiLaunchHandler.
>

Commenting on this to my reply to Jiri's email.

>> diff --git a/netx/net/sourceforge/jnlp/DefaultLaunchHandler.java b/netx/net/sourceforge/jnlp/DefaultLaunchHandler.java
>> --- a/netx/net/sourceforge/jnlp/DefaultLaunchHandler.java
>> +++ b/netx/net/sourceforge/jnlp/DefaultLaunchHandler.java
>> @@ -101,6 +94,17 @@ public class DefaultLaunchHandler implem
>>               result.append(causes[i].getMessage());
>>               result.append(")");
>>           }
>> +
>> +        System.err.println(result);
>> +
>> +        // When isHeadless() is false, the message dialog would display the full
>> +        // stacktrace. To be consistent, display it when isHeadless() as well.
>> +        if (JNLPRuntime.isDebug() || JNLPRuntime.isHeadless()) {
>
> This if statement looks redundant. DefaultLaunchHandler is only used as
> the LaunchHandler in headless mode.

I thought so too until I checked where printMessage() was called from. 
See launchWarning in GuiLaunchHandler[1], it explicitly calls 
DefaultLaunchHandler.printMessage(). I didn't look into why it was doing 
that so if you think that's a bug, I can look into it further.

Thanks for the comments!

Cheers,
Danesh

[1] 
http://icedtea.classpath.org/hg/icedtea-web/file/tip/netx/net/sourceforge/jnlp/GuiLaunchHandler.java#l144



More information about the distro-pkg-dev mailing list