I wrote:
> Rather than the much simpler:
>
> private StackTraceElement[] stackTrace;
>
> public Throwable fillInStackTrace() {
> stackTrace = VMThrowable.fillInStackTrace(this).getStackTrace(this);
> return this;
> }
>
> public StackTraceElement[] getStackTrace() {
> return stackTrace;
> }
>
> ...
> What did I miss?
Well the first thing I missed is that fillInStacktrace can return null so
the above should be:
public Throwable fillInStackTrace() {
VMThrowable vmt = VMThrowable.fillInStackTrace(this);
if (vmt != null)
stackTrace = vmt.getStackTrace(this);
else // could check if already zero length array
stacktrace = new StackTraceElement[0];
return this;
}
I thought it might have to do with making defensive copies but as far as I
can see the original code doesn't achieve that either.
David Holmes
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath