Looks good.  I still think last sentence of the Throwable.addSuppressed 
javadocs side steps the counter arguments.

Thanks for working on this,

Jason

----------------------------------------
> Date: Thu, 25 Apr 2013 00:16:05 -0700
> From: joe.da...@oracle.com
> To: david.hol...@oracle.com; alan.bate...@oracle.com
> Subject: Re: REASSERT Code review request for 8012044: Give more information 
> about self-suppression from Throwable.addSuppressed
> CC: core-libs-dev@openjdk.java.net
>
> Hello,
>
> Responding to David's comment and some comments from Alan off-list, here
> is a variant which doesn't use suppressed exceptions in initCause, but
> still passes along some information:
>
> http://cr.openjdk.java.net/~darcy/8012044.4
>
> Patch to Throwable:
>
> --- a/src/share/classes/java/lang/Throwable.java Wed Apr 24 21:27:52
> 2013 +0000
> +++ b/src/share/classes/java/lang/Throwable.java Thu Apr 25 00:15:32
> 2013 -0700
> @@ -453,9 +453,10 @@
> */
> public synchronized Throwable initCause(Throwable cause) {
> if (this.cause != this)
> - throw new IllegalStateException("Can't overwrite cause");
> + throw new IllegalStateException("Can't overwrite cause with " +
> + Objects.toString(cause, "a null"), this);
> if (cause == this)
> - throw new IllegalArgumentException("Self-causation not
> permitted");
> + throw new IllegalArgumentException("Self-causation not
> permitted", this);
> this.cause = cause;
> return this;
> }
> @@ -1039,7 +1040,7 @@
> */
> public final synchronized void addSuppressed(Throwable exception) {
> if (exception == this)
> - throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
> + throw new
> IllegalArgumentException(SELF_SUPPRESSION_MESSAGE, exception);
>
> if (exception == null)
> throw new NullPointerException(NULL_CAUSE_MESSAGE);
>
> Thanks,
>
> -Joe                                    

Reply via email to