jruby/jruby — pull request #135 by kohsuke (2012-04-05 16:33:07+00:00)
Title: Fixed a problem that prevents Ruby backtrace from showing up in Java exception tree

The Throwable class is somewhat broken in that it is really not designed
to enable lazy computation of stack trace elements.

Where this can be seen most clearly is the way nested exceptions are
printed. This is done in ThrowableprintStackTraceAsCause(...) method
that doesn't allow any overriding, and this internally uses
getOurStackTrace(), not getStackTrace().

RaiseException tries to work around this problem by overriding various
printStackTrace and call this.getStackTrace() to lazy compute them, but
because of the above, when RaiseException is nested inside another
exception 'x' and x.printStackTrace() is invoked, it fails to provide
the proper stack trace.

Really the only reliable way to make it work is to eagerly fill in a
stack trace. This change provides that.