Re: [mule-scm] [mule][24646] branches/mule-3.3.x/core/src: MULE-6335: MEL fails to concatenate strings

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [mule-scm] [mule][24646] branches/mule-3.3.x/core/src: MULE-6335: MEL fails to concatenate strings

Daniel Feist
Are there any other characters we should handle like this?


On Jul 23, 2012, at 8:25 AM, [hidden email] wrote:

[mule][24646] branches/mule-3.3.x/core/src: MULE-6335: MEL fails to concatenate strings
Revision
24646
Author
svacas
Date
2012-07-23 06:25:09 -0500 (Mon, 23 Jul 2012)

Log Message

MULE-6335: MEL fails to concatenate strings

Modified Paths

  • <a href="x-msg://43/#branchesmule33xcoresrcmainjavaorgmuleutilTemplateParserjava">branches/mule-3.3.x/core/src/main/java/org/mule/util/TemplateParser.java
  • <a href="x-msg://43/#branchesmule33xcoresrctestjavaorgmuleelmvelMVELExpressionLanguageTestCasejava">branches/mule-3.3.x/core/src/test/java/org/mule/el/mvel/MVELExpressionLanguageTestCase.java
  • <a href="x-msg://43/#branchesmule33xcoresrctestjavaorgmuleutilTemplateParserTestCasejava">branches/mule-3.3.x/core/src/test/java/org/mule/util/TemplateParserTestCase.java

Diff

Modified: branches/mule-3.3.x/core/src/main/java/org/mule/util/TemplateParser.java (24645 => 24646)


--- branches/mule-3.3.x/core/src/main/java/org/mule/util/TemplateParser.java	2012-07-20 19:21:08 UTC (rev 24645)
+++ branches/mule-3.3.x/core/src/main/java/org/mule/util/TemplateParser.java	2012-07-23 11:25:09 UTC (rev 24646)
@@ -280,6 +280,7 @@
                     case '*':
                     case '?':
                     case '|':
+                    case '+':
                         buffer.append("\\");
                         //$FALL-THROUGH$ to append original character
                     default:

Modified: branches/mule-3.3.x/core/src/test/java/org/mule/el/mvel/MVELExpressionLanguageTestCase.java (24645 => 24646)


--- branches/mule-3.3.x/core/src/test/java/org/mule/el/mvel/MVELExpressionLanguageTestCase.java	2012-07-20 19:21:08 UTC (rev 24645)
+++ branches/mule-3.3.x/core/src/test/java/org/mule/el/mvel/MVELExpressionLanguageTestCase.java	2012-07-23 11:25:09 UTC (rev 24646)
@@ -88,6 +88,7 @@
         // Literals
         assertEquals("hi", evaluate("'hi'"));
         assertEquals(4, evaluate("2*2"));
+        assertEquals("hiho", evaluate("'hi'+'ho'"));
 
         // Static context
         assertEquals(Calendar.getInstance().getTimeZone(), evaluate("server.timeZone"));

Modified: branches/mule-3.3.x/core/src/test/java/org/mule/util/TemplateParserTestCase.java (24645 => 24646)


--- branches/mule-3.3.x/core/src/test/java/org/mule/util/TemplateParserTestCase.java	2012-07-20 19:21:08 UTC (rev 24645)
+++ branches/mule-3.3.x/core/src/test/java/org/mule/util/TemplateParserTestCase.java	2012-07-23 11:25:09 UTC (rev 24646)
@@ -206,6 +206,25 @@
     }
 
     @Test
+    public void muleParserManagesConcatenation()
+    {
+        TemplateParser tp = TemplateParser.createMuleStyleParser();
+
+        final String expectedResult = "'hi'+'world'";
+
+        String result = tp.parse(null, "#['hi'+'world']", new TemplateParser.TemplateCallback()
+        {
+            public Object match(String token)
+            {
+
+                return expectedResult;
+            }
+        });
+
+        assertEquals(expectedResult, result);
+    }
+
+    @Test
     public void muleParserDefaultConfiguration()
     {
         TemplateParser tp = TemplateParser.createMuleStyleParser();

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: [mule-scm] [mule][24646] branches/mule-3.3.x/core/src: MULE-6335: MEL fails to concatenate strings

David Dossot
This post has NOT been accepted by the mailing list yet.
I had issues with . recently so yes all the regex-control chars must be escaped (isn't there an Apache Commons utility for that?).



On Mon, Jul 23, 2012 at 9:31 AM, Daniel Feist [via Mule] <[hidden email]> wrote:
Are there any other characters we should handle like this?


On Jul 23, 2012, at 8:25 AM, [hidden email] wrote:

Revision
24646
Author
svacas
Date
2012-07-23 06:25:09 -0500 (Mon, 23 Jul 2012)

Log Message

MULE-6335: MEL fails to concatenate strings

Modified Paths

  • <a href="x-msg://43/#branchesmule33xcoresrcmainjavaorgmuleutilTemplateParserjava">branches/mule-3.3.x/core/src/main/java/org/mule/util/TemplateParser.java
  • <a href="x-msg://43/#branchesmule33xcoresrctestjavaorgmuleelmvelMVELExpressionLanguageTestCasejava">branches/mule-3.3.x/core/src/test/java/org/mule/el/mvel/MVELExpressionLanguageTestCase.java
  • <a href="x-msg://43/#branchesmule33xcoresrctestjavaorgmuleutilTemplateParserTestCasejava">branches/mule-3.3.x/core/src/test/java/org/mule/util/TemplateParserTestCase.java

Diff

Modified: branches/mule-3.3.x/core/src/main/java/org/mule/util/TemplateParser.java (24645 => 24646)


--- branches/mule-3.3.x/core/src/main/java/org/mule/util/TemplateParser.java	2012-07-20 19:21:08 UTC (rev 24645)
+++ branches/mule-3.3.x/core/src/main/java/org/mule/util/TemplateParser.java	2012-07-23 11:25:09 UTC (rev 24646)
@@ -280,6 +280,7 @@
                     case '*':
                     case '?':
                     case '|':
+                    case '+':
                         buffer.append("\\");
                         //$FALL-THROUGH$ to append original character
                     default:

Modified: branches/mule-3.3.x/core/src/test/java/org/mule/el/mvel/MVELExpressionLanguageTestCase.java (24645 => 24646)


--- branches/mule-3.3.x/core/src/test/java/org/mule/el/mvel/MVELExpressionLanguageTestCase.java	2012-07-20 19:21:08 UTC (rev 24645)
+++ branches/mule-3.3.x/core/src/test/java/org/mule/el/mvel/MVELExpressionLanguageTestCase.java	2012-07-23 11:25:09 UTC (rev 24646)
@@ -88,6 +88,7 @@
         // Literals
         assertEquals("hi", evaluate("'hi'"));
         assertEquals(4, evaluate("2*2"));
+        assertEquals("hiho", evaluate("'hi'+'ho'"));
 
         // Static context
         assertEquals(Calendar.getInstance().getTimeZone(), evaluate("server.timeZone"));

Modified: branches/mule-3.3.x/core/src/test/java/org/mule/util/TemplateParserTestCase.java (24645 => 24646)


--- branches/mule-3.3.x/core/src/test/java/org/mule/util/TemplateParserTestCase.java	2012-07-20 19:21:08 UTC (rev 24645)
+++ branches/mule-3.3.x/core/src/test/java/org/mule/util/TemplateParserTestCase.java	2012-07-23 11:25:09 UTC (rev 24646)
@@ -206,6 +206,25 @@
     }
 
     @Test
+    public void muleParserManagesConcatenation()
+    {
+        TemplateParser tp = TemplateParser.createMuleStyleParser();
+
+        final String expectedResult = "'hi'+'world'";
+
+        String result = tp.parse(null, "#['hi'+'world']", new TemplateParser.TemplateCallback()
+        {
+            public Object match(String token)
+            {
+
+                return expectedResult;
+            }
+        });
+
+        assertEquals(expectedResult, result);
+    }
+
+    @Test
     public void muleParserDefaultConfiguration()
     {
         TemplateParser tp = TemplateParser.createMuleStyleParser();

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email





To start a new topic under Mule - Dev, email [hidden email]
To unsubscribe from Mule - Dev, click here.
NAML