Limit the TCCL when instantiating UntrustedXML 00/77300/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 24 Oct 2018 21:12:02 +0000 (23:12 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 26 Oct 2018 10:06:41 +0000 (12:06 +0200)
commit8d12e5e32b06af30393084e2570d31df5d34386f
treee6b7823854be58b1d1ae6653ccdf215efcc24984
parent4945117ffbc8480b1b9ead6ba39000c9be85f50d
Limit the TCCL when instantiating UntrustedXML

JAXP newInstance() methods can end up going through ServiceLoader
with TCCL as its ClassLoader, which means our constants may end up
pointing to a ClassLoader beyond our normal visibility.

This means we can end up picking up a different factory depending
on where we are called from and also can mean the TCCL cannot be
garbage-collected.

Force the TCCL to be the ClassLoader holding UntrustedXML, thus
establishing tight coupling between JAXP implementation discovery
mechanism and UntrustedXML.

JIRA: CONTROLLER-1867
Change-Id: Icacb0e193c7360c73bd07bc5c815bf803ca9ac44
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6fd73a016d19cfb336ab12f6eddfc2d5934fb3fc)
common/util/src/main/java/org/opendaylight/yangtools/util/xml/UntrustedXML.java