RFR: 8150173: JAXBContext.newInstance causes PrivilegedActionException when createContext's declared in absract class extended by discovered JAXB implementation

Mandy Chung mandy.chung at oracle.com
Wed Jun 22 14:35:16 UTC 2016


> On Jun 22, 2016, at 12:06 AM, Daniel Fuchs <daniel.fuchs at oracle.com> wrote:
> 
> Hi Mandy,
> 
> On 21/06/16 20:51, Mandy Chung wrote:
>>> 8150173: JAXBContext.newInstance causes PrivilegedActionException
>>>        when createContext's declared in absract class extended
>>>        by discovered JAXB implementation
>>> https://bugs.openjdk.java.net/browse/JDK-8150173
>>> 
>>> Patch:
>>> http://cr.openjdk.java.net/~dfuchs/webrev_8150173/webrev.00
>> 
>> Thanks for taking this one on.
>> 
>> 234             if (JAXBContextFactory.class.isAssignableFrom(declaringClass)
>> 
>> The spec says that implementation class of JAXBContextFactory must also implement no-arg constructor.
>> 
>> So I think this line is not needed.  Instead instantiateProviderIfNecessary should simply take the implClass parameter (the Method parameter doesn’t seem to be needed).
>> 
> 
> Oh! You're right of course - it's much easier to understand without
> the Method clutter.
> 
>> 245             throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, declaringClass, e), e);
>> 
>> Since you are on this file, it looks to me that it should use e.getCause() instead of e.
> 
> Good catch!
> 
> Here the new version:
> http://cr.openjdk.java.net/~dfuchs/webrev_8150173/webrev.01/
> 

Looks good.

This fix needs to bring back to the upstream project which Alekej will be able to help.

Mandy



More information about the core-libs-dev mailing list