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

gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 31906889dade CAMEL-24216: Wrap setAttribute in try-catch in 
XsltEndpoint like XsltSaxonEndpoint (#26331)
31906889dade is described below

commit 31906889dadef0e8dbe30d014b36e02abc98cdd9
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Sep 11 15:37:18 2026 +0200

    CAMEL-24216: Wrap setAttribute in try-catch in XsltEndpoint like 
XsltSaxonEndpoint (#26331)
    
    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.
    
    Follow-up to #25165.
---
 .../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