This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 3f9f920 CAMEL-12136: Fix potential ClassCastException when using
camel-saxon in SAXSource mode with xpath and having logging namespaces enabled.
3f9f920 is described below
commit 3f9f920c3d9458416d3ed98785ae8d5b6ee01a66
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Jan 12 14:47:12 2018 +0100
CAMEL-12136: Fix potential ClassCastException when using camel-saxon in
SAXSource mode with xpath and having logging namespaces enabled.
---
.../main/java/org/apache/camel/builder/xml/XPathBuilder.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git
a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
index 0f7f0d7..70b2abd 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/xml/XPathBuilder.java
@@ -28,6 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import javax.xml.namespace.QName;
import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
@@ -881,6 +882,15 @@ public class XPathBuilder extends ServiceSupport
implements CamelContextAware, E
} else if (document instanceof DOMSource) {
DOMSource source = (DOMSource) document;
answer = (NodeList) xpathExpression.evaluate(source.getNode(),
XPathConstants.NODESET);
+ } else if (document instanceof SAXSource) {
+ SAXSource source = (SAXSource) document;
+ // since its a SAXSource it me not return an NodeList
+ Object result =
xpathExpression.evaluate(source.getInputSource(), XPathConstants.NODESET);
+ if (result instanceof NodeList) {
+ answer = (NodeList) result;
+ } else {
+ answer = null;
+ }
} else {
answer = (NodeList) xpathExpression.evaluate(document,
XPathConstants.NODESET);
}
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].