Move TransformerFactory to the constructor
@@ -41,15 +41,6 @@ import org.apache.cxf.staxutils.StaxUtils;
* Creates an XMLStreamReader from the InputStream on the Message.
*/
public abstract class AbstractXSLTInterceptor extends AbstractPhaseInterceptor<Message> {
- private static final TransformerFactory TRANSFORM_FACTORY = TransformerFactory.newInstance();
-
- static {
- try {
- TRANSFORM_FACTORY.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
- } catch (javax.xml.transform.TransformerConfigurationException ex) {
- //
- }
- }
private String contextPropertyName;
private final Templates xsltTemplate;
@@ -69,7 +60,15 @@ public abstract class AbstractXSLTInterceptor extends AbstractPhaseInterceptor<M
throw new IllegalArgumentException("Cannot load XSLT from path: " + xsltPath);
}
Document doc = StaxUtils.read(xsltStream);
- xsltTemplate = TRANSFORM_FACTORY.newTemplates(new DOMSource(doc));
+
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ try {
+ transformerFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ } catch (javax.xml.transform.TransformerConfigurationException ex) {
+ //
+ }
+
+ xsltTemplate = transformerFactory.newTemplates(new DOMSource(doc));
} catch (TransformerConfigurationException e) {
throw new IllegalArgumentException(
String.format("Cannot create XSLT template from path: %s",
