This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3ff27a3740f5611c16a743711ab6ef5beb7d8fbd Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Jun 15 09:20:33 2024 +0200 camel-core: polished --- .../main/java/org/apache/camel/converter/jaxp/XmlConverter.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java index 7fa79cffe93..9e88404a497 100644 --- a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java +++ b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java @@ -965,15 +965,18 @@ public class XmlConverter { } public DocumentBuilderFactory getDocumentBuilderFactory(Exchange exchange) { - DocumentBuilderFactory answer = getDocumentBuilderFactory(); - // Get the DocumentBuilderFactory from the exchange header first + DocumentBuilderFactory answer = null; if (exchange != null) { + // use custom factory is provided on the exchange DocumentBuilderFactory factory = exchange.getProperty(Exchange.DOCUMENT_BUILDER_FACTORY, DocumentBuilderFactory.class); if (factory != null) { answer = factory; } } + if (answer == null) { + answer = getDocumentBuilderFactory(); + } return answer; }