You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/02/07 15:48:25 UTC

[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #3526: #3503 Add xslt.features support

ppalaga commented on a change in pull request #3526:
URL: https://github.com/apache/camel-quarkus/pull/3526#discussion_r800787974



##########
File path: extensions/xslt/runtime/src/main/java/org/apache/camel/quarkus/component/xslt/CamelXsltRecorder.java
##########
@@ -52,16 +59,27 @@ public void addRuntimeUriResolverEntry(RuntimeValue<RuntimeUriResolver.Builder>
 
         private final String packageName;
         private final RuntimeUriResolver uriResolver;
+        private final Map<String, Boolean> features;
 
-        public QuarkusTransformerFactoryConfigurationStrategy(String packageName, RuntimeUriResolver uriResolver) {
+        public QuarkusTransformerFactoryConfigurationStrategy(String packageName, Map<String, Boolean> features,
+                RuntimeUriResolver uriResolver) {
             this.uriResolver = uriResolver;
             this.packageName = packageName;
+            this.features = features;
         }
 
         @Override
         public void configure(TransformerFactory tf, XsltEndpoint endpoint) {
             final String className = uriResolver.getTransletClassName(endpoint.getResourceUri());
 
+            for (Map.Entry<String, Boolean> entry : features.entrySet()) {
+                try {
+                    tf.setFeature(entry.getKey(), entry.getValue());
+                } catch (TransformerException e) {
+                    LOGGER.warn("Unsupported TransformerFactory feature {}", entry.getKey());

Review comment:
       I'd vote for re-throwing if the feature cannot be set
   ```suggestion
                       throw new RuntimeException("Could not set TransformerFactory feature '"+ entry.getKey() +"' = " + entry.getValue(), e);
   ```
   

##########
File path: integration-tests/xml/src/main/resources/application.properties
##########
@@ -24,3 +24,4 @@ quarkus.log.category."org.apache.camel.quarkus.core.deployment".level = INFO
 # Quarkus - Camel
 #
 quarkus.camel.xslt.sources = xslt/classpath-transform.xsl,xslt/html-transform.xsl,xslt/html-to-text.xsl
+quarkus.camel.xslt.features."http\://javax.xml.XMLConstants/feature/secure-processing" = true

Review comment:
       This change is not necessary because `true` is the default, no?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org