harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spark Shen" <smallsmallor...@gmail.com>
Subject Re: [launcher] Uncaught exceptions not printed on J9 VME
Date Sun, 14 Oct 2007 05:12:33 GMT

I have long suffered from this issue. And I think I was a little lazy not to
report this. :-)

Another issue about the stack trace being printed for uncaught exceptions
is the trace is not linked with source code.
Although it can report line numbers where the exception occurs.
For example, on RI the trace is
java.lang.RuntimeException <http://Source_of_RuntimeException>: hello
 at Test.main(Test.java:6 <http://sixth_line_of_Test.java>)

While on Harmony classlib with the J9 VME, the trace is plain text:
java.lang.RuntimeException: hello
 at Test.main(Test.java:6)

To link the source code with the trace will make the stacke trace more

2007/10/13, Oliver Deakin <oliver.deakin@googlemail.com>:
> Hi all,
> A little while back there was a thread called "[drlvm] Should the
> launcher print uncaught exceptions?" [1] where we discussed the fact
> that running a test case like [2] did not print a stack trace with the
> Harmony launcher. As part of this discussion, HARMONY-1819 was raised
> and the line "(*jvm)->DetachCurrentThread(jvm)" was added to the
> launcher main.c in repo revision r464443.
> HARMONY-3713 was later raised pointing out that calling
> DetachCurrentThread() to detach the main thread was contrary to the spec
> [3], and the line was removed from main.c. However, I have just noticed
> that if you run [2] on the current J9 VME (and, in fact, on the RI with
> a simple launcher) you do not get any stack trace printed, and I imagine
> this has been the case since the commit of HARMONY-3713.
> The RI has a bug [4], contrary to the spec [3], which requires
> DetachCurrentThread() to be called by the invoking launcher if you wish
> to see the stack trace of an uncaught exception. It appears that J9 has
> matched this bug, probably so no unexpected trace is printed in
> launchers programmed against the RI.
> So currently running Harmony classlib with the J9 VME will not result in
> any stack trace being printed for uncaught exceptions, which makes
> debugging issues where that occurs more troublesome. Id like to propose
> that the DetachCurrentThread() line be readded to main.c (i.e. the
> opposite of the patch for HARMONY-3713), perhaps with a comment to show
> that this is to match the behaviour of the RI rather than the spec.
> Any objections?
> Regards,
> Oliver
> [1]
> http://mail-archives.apache.org/mod_mbox/harmony-dev/200609.mbox/%3ce29119980609210001o59b2f252s85e4b8d451a80ff6@mail.gmail.com%3e
> [2]
> public class HelloWorld {
>    public static void main(String[] args) {
>        throw new RuntimeException("hello");
>    }
> }
> [3]
> http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/invocation.html#wp16553
> [4] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4992454
> --
> Oliver Deakin
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Spark Shen
China Software Development Lab, IBM

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message