XMLOutputFactory REUSE_INSTANCE property defaults to true
Joe Wang
huizhe.wang at oracle.com
Fri Jul 15 01:31:20 UTC 2022
On 7/14/22 4:07 PM, Bernd Eckenfels wrote:
> The XMLOutputFactoryImpl does not allow to share the writer instances:
>
> https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLOutputFactoryImpl.java#L167
Sounds like a bug.
>
> So this is initialized and set to false:
>
> https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.xml/share/classes/com/sun/xml/internal/stream/XMLOutputFactoryImpl.java#L62
>
> However when you query the property from the PropertyManager it’s
> default seems to be true:
>
> https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/PropertyManager.java#L154
>
> Should this be aligned to Boolean.FALSE? Or maybe complete remove the
> shared instance code?
Agree, needs to be aligned.
>
> I also wonder is it expected to instantiate the Impl directly: there
> is no programmatic api way to request the default impl unless you
> define global config or system property (and this also required the
> impl class name so you can as well create a instance reflectively).
To get the default impl directly, use XMLOutputFactory::newDefaultFactory().
Best,
Joe
>
> Gruss
> Bernd
> --
> http://bernd.eckenfels.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20220714/04a830d7/attachment.htm>
More information about the core-libs-dev
mailing list