7081804: Remove cause field from javax.xml.crypto.NoSuchMechnismException

Sean Mullan sean.mullan at oracle.com
Thu Sep 1 13:13:07 PDT 2011

On 8/31/11 3:26 PM, Sebastian Sickelmann wrote:
> Some discussions went on in this thread as i tried to apply this 
> solution to some other classes.
> These classes has adressed the new chaining support in Throwable quite 
> different.
> In the meanwhile i think it is done best the way it is done in 
> java/lang/{UndeclaredThrowableException|InvocationTargetException|ClassNotFoundException}
> I changed the webrev to mirror this pattern of supporting exception 
> chain from java/lang.
> The solution is far easier to understand and i think it needs no 
> addtional regression-tests.
> The solution to delete the cause field and patch serialisation is far 
> more complex.
> I like the deletion of this field much more like prohibiting initCause. 
> But this change should be mirrored to many Exceptions out there, and 
> would require many discussion.
> Here is the updated webrev:
> http://oss-patches.24.eu/openjdk8/NoSuchMechanismException/7011804_0/

Hmm, the main problem I have with this change is that the printStackTrace
methods will no longer print the stack trace of the cause because it will always
be null. That doesn't seem right to me, as it could be considered an
incompatible change, and it will make it harder to debug issues.

IMO, this is one of those bugs where the impact is minimal, and it just might be
better to let things exist as they are, and perhaps add some comments in the
code to that effect.


> Maybe the title of the bug isn't right anymore.
> @Alan: Can we change it into something like prohibit unintentional 
> initCause() after construction?
> -- Sebastian
>>> @core-libs-dev: I crosspost it to core-libs-dev because the thread started
>>> there. So the interessted parties can move over to security-dev archive[4]
>>> -- Sebastian
>>> [1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-August/007462.html
>>> [2] http://oss-patches.24.eu/openjdk8/NoSuchMechanismException/SeriallizeTest.java
>>> [3] http://oss-patches.24.eu/openjdk8/NoSuchMechanismException/
>>> [4] http://mail.openjdk.java.net/pipermail/security-dev/2011-August/thread.html

More information about the security-dev mailing list