camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/2] git commit: CAMEL-7125 Fixed the issue that tokenizeXml fails when attributes have a slash in them
Date Fri, 07 Feb 2014 09:27:43 GMT
Updated Branches:
  refs/heads/camel-2.11.x 2e8b16583 -> a52f9b235
  refs/heads/camel-2.12.x 18a6cb180 -> a4020d71c


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/a4020d71
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a4020d71
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a4020d71

Branch: refs/heads/camel-2.12.x
Commit: a4020d71c58032b8eca3a7146b95fb1d30bb447e
Parents: 18a6cb1
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Fri Feb 7 17:01:22 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Fri Feb 7 17:20:04 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/a4020d71/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/a4020d71/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");
-                
               
             }
         };


Mime
View raw message