cxf-commits mailing list archives

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

coheigea pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.1.x-fixes by this push:
     new 3e6e11d  Move TransformerFactory to the constructor
3e6e11d is described below

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

    Move TransformerFactory to the constructor
    
    (cherry picked from commit 2508201c48a4946ae6133e5323cba871bb9f9a18)
---
 .../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 562e7b1..e288270 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