Code review request: 6973831 NPE when printing stack trace of OOME
Mandy Chung
mandy.chung at oracle.com
Wed Aug 11 21:43:14 UTC 2010
On 08/11/10 14:03, Rémi Forax wrote:
> Brian, Mandy,
> It seems this is not the sole thread-safety issue,
> access to fields 'cause' or 'stackTrace' aren't thread safe too and
> detailMessage is not final.
>
I agree that the getCause and setStackTrace method need to be
synchronized. On the other hand, the initCause and setStackTrace
methods are used to override the values initialized in the constructor
and so access to these fields are likely safe in practice. I can fix it
as part of this fix.
The "detailMessage" is not final because the VM in fact preallocates
Throwable object (OOME and ArithmeticException) and then sets the
'detailMessage' field directly (as the constructor is not invoked).
Mandy
More information about the core-libs-dev
mailing list