Code review request for 8012044: Give more information about self-suppression from Throwable.addSuppressed (original) (raw)

Jason Mehrens jason_mehrens at hotmail.com
Sat Apr 13 02:29:32 UTC 2013


Joe, You'll have guard ise.addSuppressed against null. Looks good otherwise.

private static void initCauseNull() { Throwable t1 = new Throwable(); t1.initCause(null); try { t1.initCause(null); } catch(IllegalStateException expect) { } }

Jason

Date: Fri, 12 Apr 2013 12:08:07 -0700 From: joe.darcy at oracle.com To: jason_mehrens at hotmail.com CC: core-libs-dev at openjdk.java.net Subject: Re: Code review request for 8012044: Give more information about self-suppression from Throwable.addSuppressed On 04/12/2013 11:22 AM, Jason Mehrens wrote:

The landmines are the retrofitted exception classes as shown here https://netbeans.org/bugzilla/show_bug.cgi?id=150969 and https://issues.jboss.org/browse/JBREM-552. Really, if the ISE or IAE is thrown it is going to suppress 'this' and 'cause'. It would be nice to see the given 'cause' show up in a log file when tracking down this type of bug. Okay; fair enough. Updated webrev covering initCause too at http://cr.openjdk.java.net/~darcy/8012044.1/ New patch below. (It is a bit of stretch to have this in initiCause by listed as the "cause" of the IllegalStateException; as an alternative, the IllegalStateException could have both this and the cause as suppressed exceptions.) Cheers, -Joe --- old/src/share/classes/java/lang/Throwable.java 2013-04-12 12:03:48.000000000 -0700 +++ new/src/share/classes/java/lang/Throwable.java 2013-04-12 12:03:48.000000000 -0700 @@ -452,10 +452,14 @@



More information about the core-libs-dev mailing list