You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Gunzenreiner Simon <Si...@winterthur.ch> on 2004/01/28 10:35:23 UTC

[JELLY]: ArrayList size() throws 'Unable to create expression'

I am using a simple jelly script in maven. I want to call the size() method on a ArrayList Object, and get the following exception:
   org.apache.commons.jelly.JellyException: null:-1:-1: <null> Unable to create expression: path_list.size()
        at org.apache.commons.jelly.parser.XMLParser.createSAXException(XMLParser.java:1234)
        .....

This is the script:

<project default="demo" xmlns:j="jelly:core" xmlns:u="jelly:util">
	<goal name="demo">
		<u:tokenize var="path_list" delim="${file.separator}">some\path</u:tokenize>
		<!-- next two lines work, their output is:
		    [echo] Class: 'class java.util.ArrayList'
		    [echo] First element: 'some'
		-->
		<echo message="Class: '${path_list.getClass().getName()}'"/>
		<echo message="First element: '${path_list.get(0)}'"/>
		<!-- results in the execption -->
		<echo message="Path_list.size: '${path_list.size()}'"/>
	</goal>
</project>

What really confuses me is that other methods on that ArrayList (e.g. get(..)) work. Does Jelly have problems with primitive type return values?

Any help to get me started with jelly really appreciated

Thanks,
Simon



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


Re: [JELLY]: ArrayList size() throws 'Unable to create expression'

Posted by Paul Libbrecht <pa...@activemath.org>.
Simon,

Try using the Jexl built-in size(list) instead of list.size() which is  
kind of escaped. size(array) also works.

paul



On 28-Jan-04, at 10:35 Uhr, Gunzenreiner Simon wrote:

> I am using a simple jelly script in maven. I want to call the size()  
> method on a ArrayList Object, and get the following exception:
>    org.apache.commons.jelly.JellyException: null:-1:-1: <null> Unable  
> to create expression: path_list.size()
>         at  
> org.apache.commons.jelly.parser.XMLParser.createSAXException(XMLParser. 
> java:1234)
>         .....
>
> This is the script:
>
> <project default="demo" xmlns:j="jelly:core" xmlns:u="jelly:util">
> 	<goal name="demo">
> 		<u:tokenize var="path_list"  
> delim="${file.separator}">some\path</u:tokenize>
> 		<!-- next two lines work, their output is:
> 		    [echo] Class: 'class java.util.ArrayList'
> 		    [echo] First element: 'some'
> 		-->
> 		<echo message="Class: '${path_list.getClass().getName()}'"/>
> 		<echo message="First element: '${path_list.get(0)}'"/>
> 		<!-- results in the execption -->
> 		<echo message="Path_list.size: '${path_list.size()}'"/>
> 	</goal>
> </project>
>
> What really confuses me is that other methods on that ArrayList (e.g.  
> get(..)) work. Does Jelly have problems with primitive type return  
> values?
>
> Any help to get me started with jelly really appreciated
>
> Thanks,
> Simon
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


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