This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.22.x by this push:
     new 6e596a6a46c3 CAMEL-24216: Wrap setAttribute in try-catch in 
XsltEndpoint like XsltSaxonEndpoint (#26335)
6e596a6a46c3 is described below

commit 6e596a6a46c3f258f63b6d7b44c72a7911fe811f
Author: Guillaume Nodet - AI Bot <[email protected]>
AuthorDate: Fri Sep 11 21:32:30 2026 +0200

    CAMEL-24216: Wrap setAttribute in try-catch in XsltEndpoint like 
XsltSaxonEndpoint (#26335)
    
    Backport of #26331 to camel-4.22.x.
    
    When a custom TransformerFactory class is configured via 
transformerFactoryClass,
    it may not support the JDK-specific jdk.xml.xpathTotalOpLimit attribute and
    will throw IllegalArgumentException. Wrap the setAttribute call in a 
try-catch
    (same as done in XsltSaxonEndpoint) to avoid a startup failure in that case.
---
 .../main/java/org/apache/camel/component/xslt/XsltEndpoint.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-xslt/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
 
b/components/camel-xslt/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
index bd7e0c090450..d7dd5b0ec1b8 100644
--- 
a/components/camel-xslt/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
+++ 
b/components/camel-xslt/src/main/java/org/apache/camel/component/xslt/XsltEndpoint.java
@@ -477,8 +477,12 @@ public class XsltEndpoint extends ProcessorEndpoint {
             }
 
             if (effectiveXpathTotalOpLimit > 0) {
-                LOG.debug("Setting jdk.xml.xpathTotalOpLimit={} on 
TransformerFactory", effectiveXpathTotalOpLimit);
-                factory.setAttribute("jdk.xml.xpathTotalOpLimit", 
effectiveXpathTotalOpLimit);
+                try {
+                    LOG.debug("Setting jdk.xml.xpathTotalOpLimit={} on 
TransformerFactory", effectiveXpathTotalOpLimit);
+                    factory.setAttribute("jdk.xml.xpathTotalOpLimit", 
effectiveXpathTotalOpLimit);
+                } catch (IllegalArgumentException e) {
+                    LOG.debug("TransformerFactory does not support 
jdk.xml.xpathTotalOpLimit");
+                }
             }
 
             LOG.debug("Using TransformerFactory {}", factory);

Reply via email to