You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/02/07 10:18:33 UTC
[2/2] git commit: CAMEL-7125 Fixed the issue that tokenizeXml fails
when attributes have a slash in them
CAMEL-7125 Fixed the issue that tokenizeXml fails when attributes have a slash in them
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6641f182
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6641f182
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6641f182
Branch: refs/heads/master
Commit: 6641f182794f2aeb5198ae0f879ae0ef132c6301
Parents: 0dfba40
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Feb 7 17:01:22 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Feb 7 17:18:11 2014 +0800
----------------------------------------------------------------------
.../apache/camel/support/TokenXMLExpressionIterator.java | 2 +-
.../org/apache/camel/processor/SplitTokenizerTest.java | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/6641f182/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 3048c64..ba21a71 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/6641f182/camel-core/src/test/java/org/apache/camel/processor/SplitTokenizerTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/processor/SplitTokenizerTest.java b/camel-core/src/test/java/org/apache/camel/processor/SplitTokenizerTest.java
index c583bc8..cd3e44f 100644
--- a/camel-core/src/test/java/org/apache/camel/processor/SplitTokenizerTest.java
+++ b/camel-core/src/test/java/org/apache/camel/processor/SplitTokenizerTest.java
@@ -71,6 +71,15 @@ public class SplitTokenizerTest extends ContextTestSupport {
assertMockEndpointsSatisfied();
}
+ public void testSplitTokenizerEWithSlash() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:split");
+ String xml = "<persons><person attr='/' /></persons>";
+ mock.expectedBodiesReceived("<person attr='/' />");
+ template.sendBody("direct:e", xml);
+ mock.assertIsSatisfied();
+ assertMockEndpointsSatisfied();
+ }
+
public void testSplitTokenizerF() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:split");
mock.expectedBodiesReceived("<person name=\"Claus\"/>", "<person>James</person>", "<person>Willem</person>");
@@ -113,7 +122,6 @@ public class SplitTokenizerTest extends ContextTestSupport {
// it will call the ObjectHelper.evaluateValuePredicate()
.filter().simple("${body}")
.to("mock:split");
-
}
};