Re: [mule-scm] [mule][25008] branches/mule-3.3.x: MULE-6524: MEL ClassCastException with function

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [mule-scm] [mule][25008] branches/mule-3.3.x: MULE-6524: MEL ClassCastException with function

Pablo Kraan
Factory can be null when the loop finishes on  MVELFunctionAdaptor#call. Does it worth to add a check for that?

Pablo

MVELFunctionAdaptor

On Tue, Nov 13, 2012 at 2:04 PM, <[hidden email]> wrote:
Revision
25008
Author
svacas
Date
2012-11-13 11:04:47 -0600 (Tue, 13 Nov 2012)

Log Message

MULE-6524: MEL ClassCastException with function

Modified Paths

Diff

Modified: branches/mule-3.3.x/core/src/main/java/org/mule/el/mvel/MVELFunctionAdaptor.java (25007 => 25008)


--- branches/mule-3.3.x/core/src/main/java/org/mule/el/mvel/MVELFunctionAdaptor.java	2012-11-13 14:55:02 UTC (rev 25007)
+++ branches/mule-3.3.x/core/src/main/java/org/mule/el/mvel/MVELFunctionAdaptor.java	2012-11-13 17:04:47 UTC (rev 25008)
@@ -16,7 +16,6 @@
 import org.mvel2.ParserContext;
 import org.mvel2.ast.Function;
 import org.mvel2.integration.VariableResolverFactory;
-import org.mvel2.integration.impl.ClassImportResolverFactory;
 
 @SuppressWarnings("serial")
 class MVELFunctionAdaptor extends Function
@@ -32,7 +31,7 @@
     @Override
     public Object call(Object ctx, Object thisValue, VariableResolverFactory factory, Object[] parms)
     {
-        if (factory instanceof ClassImportResolverFactory)
+        while (!(factory instanceof ExpressionLanguageContext) && factory != null)
         {
             factory = factory.getNextFactory();
         }

Modified: branches/mule-3.3.x/tests/functional/src/test/resources/org/mule/test/el/expression-language-config.xml (25007 => 25008)


--- branches/mule-3.3.x/tests/functional/src/test/resources/org/mule/test/el/expression-language-config.xml	2012-11-13 14:55:02 UTC (rev 25007)
+++ branches/mule-3.3.x/tests/functional/src/test/resources/org/mule/test/el/expression-language-config.xml	2012-11-13 17:04:47 UTC (rev 25008)
@@ -17,11 +17,13 @@
                 def hello() {'Hello '+appName+'!'}
                 def appendPayload() {payload+'appended'}
                 def reversePayload() {StringUtils.reverse(payload)}
+                def regexWrap(text) {regex(text)}
             </global-functions>
         </expression-language>
     </configuration>
 
     <flow name="flow">
+        <expression-component>regexWrap('hello')</expression-component>
         <test:assert expression="#[payload == 'foo']" />
         <expression-component>payload='bar';a='1';b=payload+a</expression-component>
         <test:assert expression="#[payload == 'bar']" />

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email