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

Georgiy Rakov georgiy.rakov at oracle.com
Fri Jun 24 10:25:12 UTC 2016


Hi Daniel,

please see my replies embedded below.

On 23.06.2016 19:07, Daniel Fuchs wrote:
> Hi,
>
> Here is the new webrev:
>
> http://cr.openjdk.java.net/~dfuchs/webrev_8150173/webrev.03/
>
> On 23/06/16 14:55, Daniel Fuchs wrote:
>>> if I understand correctly JAXBContextWithSubclassedFactory is supposed
>>> to capture the idea of Test9 but it doesn't.
> [...]
>> Oh - I see, I missed that - I was chasing down an other avenue.
>> I will add the test.
>
> Added NonFactoryBase class and Factory2 in
> JAXBContextWithSubclassedFactory
Thank you.
>
>>> BTW the approach with Factory1 and Factory2 used in
>>> JAXBContextWithLegacyFactory seems be useful in
>>> JAXBContextWithSubclassedFactory and JAXBContextWithAbstractFactory 
>>> too.
>>
>> I'll see what I can do.
>
> I have reconsidered the code in these 3 tests WRT to your comment
> above.
>
> JAXBContextWithSubclassedFactory:
>
> I am not sure I see what adding a Factory3 that redefines
> createContext would bring. I think it is enough to check
> that the context was created using an instance of the expected
> factory class - and we already test that with Factory (now renamed
> Factory1).
>
> JAXBContextWithAbstractFactory:
>
> Here too - if the factory had not been called we would
> have got a different instance of JAXBcontext.
> The fact that ctxt == tmp proves that we have taken the
> right path - and I think it's good that we take a slightly
> different path than we have in the other tests.
After some thoughts I agree, redefining createContext would just check 
that reflection deals with methods overriding properly.

BTW if a factory is an instance of JAXBContextFactory it would seem more 
natural to invoke createContext by first casting instantiated provider 
to JAXBContextFactory and then invoking its createContext method in a 
regular way rather than through reflection; now it's always invoked 
through reflection.

Thank you, Georgiy.
>
> best regards,
>
> -- daniel



More information about the core-libs-dev mailing list