Limit the TCCL when instantiating UntrustedXML 67/77267/4
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:03:31 +0000 (12:03 +0200)
commit6fd73a016d19cfb336ab12f6eddfc2d5934fb3fc
tree12e21c18de4a3fafae13b96b77699ebba789c6f3
parentb971c7a3d422ffb535176d8f684bda0e10dc98c3
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>
common/util/src/main/java/org/opendaylight/yangtools/util/xml/UntrustedXML.java