commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian <nospam...@gmx.net>
Subject [JEXL] Creating map in JEXL 1.1 fails
Date Sat, 09 Feb 2008 19:51:00 GMT
Hi,
I am trying to use JEXL 1.1 embedded within a J2SE application.

I am trying to create a map in JEXL as described here 
http://commons.apache.org/jexl/reference/syntax.html#Literals

My expression looks something like this:

String myExpression="[\"key1\"=>\"value1\",\"key2\"=>\"value2\"]";

However JEXL throws the exception below when I try to create the 
expression object using:

ExpressionFactory.createExpression(myExpression);

How does my expression need to look like if evaluating the expression 
should return a Map object.

Thanks in advance,
Seb

The exception:
--------------

org.apache.commons.jexl.parser.ParseException: Encountered "[" at line 
1, column 1.
Was expecting one of:
     <INTEGER_LITERAL> ...
     <FLOAT_LITERAL> ...
     "empty" ...
     "(" ...
     "size" ...
     "-" ...
     "~" ...
     "!" ...
     "not" ...
     "null" ...
     "true" ...
     "false" ...
     <IDENTIFIER> ...
     <STRING_LITERAL> ...

	at 
org.apache.commons.jexl.parser.Parser.generateParseException(Parser.java:4176)
	at org.apache.commons.jexl.parser.Parser.jj_consume_token(Parser.java:4043)
	at org.apache.commons.jexl.parser.Parser.Expression(Parser.java:320)
	at org.apache.commons.jexl.parser.Parser.Assignment(Parser.java:362)
	at 
org.apache.commons.jexl.parser.Parser.StatementExpression(Parser.java:1922)
	at org.apache.commons.jexl.parser.Parser.Statement(Parser.java:1841)
	at org.apache.commons.jexl.parser.Parser.JexlScript(Parser.java:73)
	at org.apache.commons.jexl.parser.Parser.parse(Parser.java:32)
	at 
org.apache.commons.jexl.ExpressionFactory.createNewExpression(ExpressionFactory.java:123)
	at 
org.apache.commons.jexl.ExpressionFactory.createExpression(ExpressionFactory.java:101)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message