camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject git commit: CAMEL-6940: xml tokenizer not handling innner self-closed elements
Date Tue, 12 Nov 2013 10:11:04 GMT
Updated Branches:
  refs/heads/camel-2.12.x 797399877 -> 12fc496fb


CAMEL-6940: xml tokenizer not handling innner self-closed elements


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/12fc496f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/12fc496f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/12fc496f

Branch: refs/heads/camel-2.12.x
Commit: 12fc496fb7a9df4dd68ab514f800ce767de7fe43
Parents: 7973998
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Tue Nov 12 10:50:18 2013 +0100
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Tue Nov 12 11:10:13 2013 +0100

----------------------------------------------------------------------
 .../apache/camel/support/TokenXMLExpressionIterator.java  |  2 +-
 .../camel/language/tokenizer/TokenizeLanguageTest.java    | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/12fc496f/camel-core/src/main/java/org/apache/camel/support/TokenXMLExpressionIterator.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/support/TokenXMLExpressionIterator.java
b/camel-core/src/main/java/org/apache/camel/support/TokenXMLExpressionIterator.java
index 938b1d6..3048c64 100644
--- a/camel-core/src/main/java/org/apache/camel/support/TokenXMLExpressionIterator.java
+++ b/camel-core/src/main/java/org/apache/camel/support/TokenXMLExpressionIterator.java
@@ -47,7 +47,7 @@ import org.apache.camel.util.ObjectHelper;
 public class TokenXMLExpressionIterator extends ExpressionAdapter {
     private static final Pattern NAMESPACE_PATTERN = Pattern.compile("xmlns(:\\w+|)\\s*=\\s*('[^']+'|\"[^\"]+\")");
     private static final String SCAN_TOKEN_NS_PREFIX_REGEX = "([^:<>]{1,15}?:|)";
-    private static final String SCAN_BLOCK_TOKEN_REGEX_TEMPLATE = "<{0}(\\s+[^/]*)?/>|<{0}(\\s+[^>]*)?>(?:(?!(</{0}\\s*>)).)*</{0}\\s*>";
+    private static final String SCAN_BLOCK_TOKEN_REGEX_TEMPLATE = "<{0}(\\s+[^/^>]*)?/>|<{0}(\\s+[^>]*)?>(?:(?!(</{0}\\s*>)).)*</{0}\\s*>";
     private static final String SCAN_PARENT_TOKEN_REGEX_TEMPLATE = "<{0}(\\s+[^>]*\\s*)?>";
     
     protected final String tagToken;

http://git-wip-us.apache.org/repos/asf/camel/blob/12fc496f/camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeLanguageTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeLanguageTest.java
b/camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeLanguageTest.java
index bfc3bfa..1860436 100644
--- a/camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeLanguageTest.java
+++ b/camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeLanguageTest.java
@@ -64,6 +64,16 @@ public class TokenizeLanguageTest extends ContextTestSupport {
         assertMockEndpointsSatisfied();
     }
 
+    public void testSendMixedClosingTagInsideMessageToTokenize() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived(
+            "<child name='child1'><grandchild name='grandchild1'/> <grandchild
name='grandchild2'/></child>", "<child name='child2'><grandchild name='grandchild1'></grandchild><grandchild
name='grandchild2'></grandchild></child>");
+
+        template.sendBody("direct:start",
+            "<parent><child name='child1'><grandchild name='grandchild1'/>
<grandchild name='grandchild2'/></child><child name='child2'><grandchild
name='grandchild1'></grandchild><grandchild name='grandchild2'></grandchild></child></parent>");
+
+        assertMockEndpointsSatisfied();
+    }
+
     public void testSendNamespacedChildMessageToTokenize() throws Exception {
         getMockEndpoint("mock:result").expectedBodiesReceived(
             "<c:child xmlns:c='urn:c' some_attr='a' anotherAttr='a'></c:child>",
"<c:child xmlns:c='urn:c' some_attr='b' anotherAttr='b' />");


Mime
View raw message