1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java Fri Feb 14 10:53:55 2014 +0100 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java Fri Feb 14 11:13:45 2014 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -215,20 +215,28 @@ 1.11 } 1.12 } 1.13 1.14 - static final TransformerFactory transformerFactory = newTransformerFactory(); 1.15 + static final ContextClassloaderLocal<TransformerFactory> transformerFactory = new ContextClassloaderLocal<TransformerFactory>() { 1.16 + @Override 1.17 + protected TransformerFactory initialValue() throws Exception { 1.18 + return TransformerFactory.newInstance(); 1.19 + } 1.20 + }; 1.21 1.22 - static final SAXParserFactory saxParserFactory = newSAXParserFactory(true); 1.23 - 1.24 - static { 1.25 - saxParserFactory.setNamespaceAware(true); 1.26 - } 1.27 + static final ContextClassloaderLocal<SAXParserFactory> saxParserFactory = new ContextClassloaderLocal<SAXParserFactory>() { 1.28 + @Override 1.29 + protected SAXParserFactory initialValue() throws Exception { 1.30 + SAXParserFactory factory = SAXParserFactory.newInstance(); 1.31 + factory.setNamespaceAware(true); 1.32 + return factory; 1.33 + } 1.34 + }; 1.35 1.36 /** 1.37 * Creates a new identity transformer. 1.38 */ 1.39 public static Transformer newTransformer() { 1.40 try { 1.41 - return transformerFactory.newTransformer(); 1.42 + return transformerFactory.get().newTransformer(); 1.43 } catch (TransformerConfigurationException tex) { 1.44 throw new IllegalStateException("Unable to create a JAXP transformer"); 1.45 } 1.46 @@ -243,9 +251,9 @@ 1.47 // work around a bug in JAXP in JDK6u4 and earlier where the namespace processing 1.48 // is not turned on by default 1.49 StreamSource ssrc = (StreamSource) src; 1.50 - TransformerHandler th = ((SAXTransformerFactory) transformerFactory).newTransformerHandler(); 1.51 + TransformerHandler th = ((SAXTransformerFactory) transformerFactory.get()).newTransformerHandler(); 1.52 th.setResult(result); 1.53 - XMLReader reader = saxParserFactory.newSAXParser().getXMLReader(); 1.54 + XMLReader reader = saxParserFactory.get().newSAXParser().getXMLReader(); 1.55 reader.setContentHandler(th); 1.56 reader.setProperty(LEXICAL_HANDLER_PROPERTY, th); 1.57 reader.parse(toInputSource(ssrc));