RFR [11] (JAXP): 6857903: SAXException.initCause() does not correctly set Exception

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR [11] (JAXP): 6857903: SAXException.initCause() does not correctly set Exception

Aleks Efimov
Hello,

Please, help to review the fix for jaxp bug that fixes SAXException to
correctly set exception cause with 'setCause' method:
http://cr.openjdk.java.net/~aefimov/6857903/dev/00/
I've tried to keep the fix miminal with respect to serial form of this
API class, i.e. kept private 'exception' field.

The new test case was added to IssueTracker56Test unit test. Testing
showed no related JCK/JTREG failures.

With Best Regards,
Aleksei


Reply | Threaded
Open this post in threaded view
|

Re: RFR [11] (JAXP): 6857903: SAXException.initCause() does not correctly set Exception

roger riggs
Hi Aleksei,

In the case of creating SAXException and then calling initCause() it
looks like
the value returned by getException() and getCause() may differ.
The past behavior and the descriptions of those two methods are the same.
Is the change intentional?

If not, you may need to override initCause() to update the 'exception'
field.

Roger


On 12/21/2017 12:27 PM, Aleks Efimov wrote:

> Hello,
>
> Please, help to review the fix for jaxp bug that fixes SAXException to
> correctly set exception cause with 'setCause' method:
> http://cr.openjdk.java.net/~aefimov/6857903/dev/00/
> I've tried to keep the fix miminal with respect to serial form of this
> API class, i.e. kept private 'exception' field.
>
> The new test case was added to IssueTracker56Test unit test. Testing
> showed no related JCK/JTREG failures.
>
> With Best Regards,
> Aleksei
>
>

Reply | Threaded
Open this post in threaded view
|

Re: RFR [11] (JAXP): 6857903: SAXException.initCause() does not correctly set Exception

Jason Mehrens
In reply to this post by Aleks Efimov
Aleksei,

You have to override all of the constructors to always disable initCause.  Actually a similar issue was covered in:

http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-May/016908.html
http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-June/017594.html 

Pretty much everything was hashed out in those threads.

Here is the final webrev for that:

http://cr.openjdk.java.net/~dmeetry/8009581/webrev.5/jaxp/src/javax/xml/xpath/XPathException.java.udiff.html

That should be a good cookbook for changes and tests required for this issue.  Note that it gets rid of the Exception field and maintains serial compatibility.  
Looking back on that change, I would have changed it so the InvalidClassException added the double cause as suppressed exceptions.

Jason

________________________________________
From: core-libs-dev <[hidden email]> on behalf of Aleks Efimov <[hidden email]>
Sent: Thursday, December 21, 2017 11:27 AM
To: core-libs-dev
Subject: RFR [11] (JAXP): 6857903: SAXException.initCause() does not correctly set Exception

Hello,

Please, help to review the fix for jaxp bug that fixes SAXException to
correctly set exception cause with 'setCause' method:
http://cr.openjdk.java.net/~aefimov/6857903/dev/00/
I've tried to keep the fix miminal with respect to serial form of this
API class, i.e. kept private 'exception' field.

The new test case was added to IssueTracker56Test unit test. Testing
showed no related JCK/JTREG failures.

With Best Regards,
Aleksei