You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Sebastian <no...@gmx.net> on 2008/02/09 20:51:00 UTC

[JEXL] Creating map in JEXL 1.1 fails

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


Re: [JEXL] Creating map in JEXL 1.1 fails

Posted by Dion Gillard <di...@trongus.com>.
Does an assignment help,

e.g. "x = ...."

On 2/10/08, Sebastian <no...@gmx.net> wrote:
> 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
>
>


-- 
dIon Gillard
Rule #131 of Acquisition: Information is Profit.

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


Re: [JEXL] Creating map in JEXL 1.1 fails

Posted by Rahul Akolkar <ra...@gmail.com>.
On 2/12/08, Sebastian <no...@gmx.net> wrote:
> Hi Rahul,
>
> thanks for your answer. I downloaded the latest nightly build and it
> works now. It is a bit unfortune that the website shows the API of a not
> yet released version and the download section
> (http://commons.apache.org/jexl/downloads.html) only lists the stable
> releases with a smaller set of functionality.
>
<snip/>

Yes, it is, as I mentioned below.

I will try to amend that (but it won't be for a couple of weeks
atleast, since I'm traveling).

-Rahul



> Regards,
> Seb
>
> Rahul Akolkar wrote:
> > On 2/9/08, Sebastian <no...@gmx.net> wrote:
> >> 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.
> >>
> > <snip/>
> >
> > That bit of functionality was added after the 1.1 release (the docs
> > are for 1.1.1-SNAPSHOT -- unfortunately, I'm not sure if we have
> > retained the 1.1 docs anywhere on the site) i.e. you'll have to build
> > the trunk to try out the above.
> >
> > -Rahul
> >
> >
> >> Thanks in advance,
> >> Seb
> >>

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


Re: [JEXL] Creating map in JEXL 1.1 fails

Posted by Sebastian <no...@gmx.net>.
Hi Rahul,

thanks for your answer. I downloaded the latest nightly build and it 
works now. It is a bit unfortune that the website shows the API of a not 
yet released version and the download section 
(http://commons.apache.org/jexl/downloads.html) only lists the stable 
releases with a smaller set of functionality.

Regards,
Seb

Rahul Akolkar wrote:
> On 2/9/08, Sebastian <no...@gmx.net> wrote:
>> 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.
>>
> <snip/>
> 
> That bit of functionality was added after the 1.1 release (the docs
> are for 1.1.1-SNAPSHOT -- unfortunately, I'm not sure if we have
> retained the 1.1 docs anywhere on the site) i.e. you'll have to build
> the trunk to try out the above.
> 
> -Rahul
> 
> 
>> 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


Re: [JEXL] Creating map in JEXL 1.1 fails

Posted by Rahul Akolkar <ra...@gmail.com>.
On 2/9/08, Sebastian <no...@gmx.net> wrote:
> 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.
>
<snip/>

That bit of functionality was added after the 1.1 release (the docs
are for 1.1.1-SNAPSHOT -- unfortunately, I'm not sure if we have
retained the 1.1 docs anywhere on the site) i.e. you'll have to build
the trunk to try out the above.

-Rahul


> 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