Author: adrianc
Date: Mon Apr 20 20:34:34 2009
New Revision: 766858
URL:
http://svn.apache.org/viewvc?rev=766858&view=revLog:
Fix for UEL expressions where IDs are used for Map keys.
Modified:
ofbiz/branches/release09.04/framework/base/src/org/ofbiz/base/util/string/JuelConnector.java
Modified: ofbiz/branches/release09.04/framework/base/src/org/ofbiz/base/util/string/JuelConnector.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release09.04/framework/base/src/org/ofbiz/base/util/string/JuelConnector.java?rev=766858&r1=766857&r2=766858&view=diff==============================================================================
--- ofbiz/branches/release09.04/framework/base/src/org/ofbiz/base/util/string/JuelConnector.java (original)
+++ ofbiz/branches/release09.04/framework/base/src/org/ofbiz/base/util/string/JuelConnector.java Mon Apr 20 20:34:34 2009
@@ -18,6 +18,11 @@
*******************************************************************************/
package org.ofbiz.base.util.string;
+import static de.odysseus.el.tree.impl.Scanner.Symbol.END_EVAL;
+import static de.odysseus.el.tree.impl.Scanner.Symbol.FLOAT;
+import static de.odysseus.el.tree.impl.Scanner.Symbol.START_EVAL_DEFERRED;
+import static de.odysseus.el.tree.impl.Scanner.Symbol.START_EVAL_DYNAMIC;
+
import javax.el.*;
import de.odysseus.el.misc.LocalMessages;
@@ -116,6 +121,31 @@
public ExtendedParser(Builder context, String input) {
super(context, input);
}
+ protected AstEval eval(boolean required, boolean deferred) throws ScanException, ParseException {
+ AstEval v = null;
+ Symbol start_eval = deferred ? START_EVAL_DEFERRED : START_EVAL_DYNAMIC;
+ if (this.getToken().getSymbol() == start_eval) {
+ consumeToken();
+ AstNode node = expr(true);
+ try {
+ consumeToken(END_EVAL);
+ } catch (ParseException e) {
+ if (this.getToken().getSymbol() == FLOAT && node instanceof AstIdentifier) {
+ // Handle ${someMap.${someId}}
+ String mapKey = this.getToken().getImage().replace(".", "");
+ node = createAstDot(node, mapKey, true);
+ consumeToken();
+ consumeToken(END_EVAL);
+ } else {
+ throw e;
+ }
+ }
+ v = new AstEval(node, deferred);
+ } else if (required) {
+ fail(start_eval);
+ }
+ return v;
+ }
protected AstBracket createAstBracket(AstNode base, AstNode property, boolean lvalue, boolean strict) {
return new ExtendedAstBracket(base, property, lvalue, strict);
}