cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [cxf] branch master updated: Move TransformerFactory to the constructor
Date Tue, 15 May 2018 15:33:56 GMT
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 2508201  Move TransformerFactory to the constructor
2508201 is described below

commit 2508201c48a4946ae6133e5323cba871bb9f9a18
Author: Colm O hEigeartaigh <coheigea@apache.org>
AuthorDate: Tue May 15 16:33:35 2018 +0100

    Move TransformerFactory to the constructor
---
 .../feature/transform/AbstractXSLTInterceptor.java    | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/feature/transform/AbstractXSLTInterceptor.java
b/core/src/main/java/org/apache/cxf/feature/transform/AbstractXSLTInterceptor.java
index a1045b6..429bef8 100644
--- a/core/src/main/java/org/apache/cxf/feature/transform/AbstractXSLTInterceptor.java
+++ b/core/src/main/java/org/apache/cxf/feature/transform/AbstractXSLTInterceptor.java
@@ -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",

-- 
To stop receiving notification emails like this one, please contact
coheigea@apache.org.

Mime
View raw message