RFR: 8322027: One XMLStreamException constructor fails to initialize cause

Joe Wang joehw at openjdk.org
Wed Dec 13 21:24:39 UTC 2023


On Wed, 13 Dec 2023 20:06:03 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:

> One of the three `XMLStreamException` constructors that takes a `Throwable` fails to pass it to the superclass constructor.
> 
> This simple patch fixes that omission.
> 
> It's worth considering if there is any code out there that is working around this problem already by invoking `initCause()` manually. If so, that code would start throwing an `IllegalStateException` after this change.
> 
> So a more conservative fix would be to just add another constructor taking the same arguments in a different order. But then again that's not much better than just saying "always use initCause() with the broken constructor", i.e., don't change anything.
> 
> Hmm.

Looks good to me. Thanks.

test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionCauseTest.java line 38:

> 36:  * @test
> 37:  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
> 38:  * @run testng/othervm -DrunSecMngr=true -Djava.security.manager=allow stream.XMLStreamExceptionTest.ExceptionCauseTest

We no longer add this run in new tests as the Security Manager has been deprecated (https://openjdk.org/jeps/411).

-------------

Marked as reviewed by joehw (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17090#pullrequestreview-1780507743
PR Review Comment: https://git.openjdk.org/jdk/pull/17090#discussion_r1425895822


More information about the core-libs-dev mailing list