You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/12/30 10:15:20 UTC
[camel] 02/02: CAMEL-12974: XML DSL tree parser should skip
when/otherwise to parse similar like the Java DSL does
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git
commit c9d2bcc1462679b99698ad2c9dc925a9f925ca97
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Dec 30 11:09:48 2018 +0100
CAMEL-12974: XML DSL tree parser should skip when/otherwise to parse similar like the Java DSL does
---
.../org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java
index 23c291b..ca24642 100644
--- a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelXmlTreeParserHelper.java
@@ -75,11 +75,13 @@ public final class CamelXmlTreeParserHelper {
boolean isRoute = "route".equals(name) || "from".equals(name);
// must be an eip model that has either input or output as we only want to track processors (also accept from)
boolean isEip = camelCatalog.findModelNames().contains(name) && (hasInput(name) || hasOutput(name));
+ // skip when/otherwise (as we do this in Java DSL)
+ boolean isWhenOrOtherwise = "when".equals(name) || "otherwise".equals(name);
// only include if its a known Camel model (dont include languages)
if (isRoute || isEip) {
- // skip route as we just keep from
- if (!"route".equals(name)) {
+ // skip route as we just keep from (and also skip when/otherwise)
+ if (!"route".equals(name) && !isWhenOrOtherwise) {
String lineNumber = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER);
String lineNumberEnd = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER_END);
newNode = nodeFactory.newNode(parent, name);