The ExpressionFactory throws an exception when parsing a block statement
such as:
{ a='b'; c='d'; }
I traced it down to a missing check for ASTBlock in the ExpressionFactory.
The patch is attached although it was generated against a local checkin of
this file in my local svn, hence version numbers are different. The patch is
simple, so I decided to attach it as is, rather than generating it against
the apache-commons svn trunk. To apply this patch, you will need to manually
edit the code and add the two lines added.
- Vishal
Index:
C:/source/trunk/ext-modules/commons-jexl/src/java/org/apache/commons/jexl/Ex
pressionFactory.java
===================================================================
---
C:/source/trunk/ext-modules/commons-jexl/src/java/org/apache/commons/jexl/Ex
pressionFactory.java (revision 9800)
+++
C:/source/trunk/ext-modules/commons-jexl/src/java/org/apache/commons/jexl/Ex
pressionFactory.java (revision 10465)
@@ -18,6 +18,7 @@
import java.io.StringReader;
+import org.apache.commons.jexl.parser.ASTBlock;
import org.apache.commons.jexl.parser.ASTExpressionExpression;
import org.apache.commons.jexl.parser.ASTForeachStatement;
import org.apache.commons.jexl.parser.ASTIfStatement;
@@ -155,6 +156,7 @@
|| node instanceof ASTIfStatement
|| node instanceof ASTWhileStatement
|| node instanceof ASTForeachStatement
+ || node instanceof ASTBlock
) {
return new ExpressionImpl(expression, node);
}