You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dale Wyttenbach <wy...@cs.umn.edu> on 2005/06/22 21:43:52 UTC

M1.1-beta-1: StackOverflowError in jelly expression evaluation

Hi,

I tried upgrading from maven 1.0.2 to maven-1.1-beta-1
and immediately started getting StackOverflowError.

To recreate the problem, create a tiny maven project
as follows, and run the default goal:

maven.xml:
<project default="default">

    <goal name="default">
       
<echo>yonder.cert.file=${yonder.cert.file}</echo>
       
<echo>yonder.dirt.file=${yonder.dirt.file}</echo>
    </goal>

</project>

project.properties:
yonder.cert.file.dir=C:
yonder.backend=fqdn.com
yonder.application=strawman

# eval of the following expr yields StackOverflowError
yonder.cert.file=${yonder.cert.file.dir}/${yonder.backend}-${yonder.application}.p12

# following eval works
#yonder.dirt.file=${yonder.cert.file.dir}/${yonder.backend}-${yonder.application}.p12

# StackOverflowError occurs in and around the
following method:
#org.apache.commons.jelly.expression.CompositeExpression#evaluateAsString(JellyContext
context)

If this is a bug, I'm not sure if it belongs to
commons-jelly or maven.  Thanks for any help you can
provide.

Dale


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M1.1-beta-1: StackOverflowError in jelly expression evaluation

Posted by Kenney Westerhof <fo...@neonics.com>.
On Wed, 22 Jun 2005, Dale Wyttenbach wrote:

Hi,

Dots in JEXL expressions normally indicate method accesses (e.g. foo.bar
will result in foo.getBar()). Only when after resolving 'foo'
no 'getBar()' method is found, the Context is searched for a variable
named 'foo.bar'.

Your expression has recursion: the ${yonder.cert.file.dir}
is evaluated as

	${context.getVariable('yonder.cert.file').getDir()}

An equivalent simple case is:

	a=${a.b}FOO

Idem:

	a=${a}FOO

I guess that could be considered design, since you specify recursion
explicitly.

So, don't write expressions in property values that have a prefix
equal to the name of the property being defined!

A workaround here is to use '_' instead of '.'.

Btw, it's even better to do that in most cases,
because something like

	<j:if test="${foo.bar == 'baz'}">

doesn't work. You have to rewrite that as

	<j:set var="foo_bar" value="${foo.bar}"/>
	<j:if test="${foo_bar == 'baz'}">

(check some jelly scripts, they're full of this ;)


-- Kenney


> Hi,
>
> I tried upgrading from maven 1.0.2 to maven-1.1-beta-1
> and immediately started getting StackOverflowError.
>
> To recreate the problem, create a tiny maven project
> as follows, and run the default goal:
>
> maven.xml:
> <project default="default">
>
>     <goal name="default">
>
> <echo>yonder.cert.file=${yonder.cert.file}</echo>
>
> <echo>yonder.dirt.file=${yonder.dirt.file}</echo>
>     </goal>
>
> </project>
>
> project.properties:
> yonder.cert.file.dir=C:
> yonder.backend=fqdn.com
> yonder.application=strawman
>
> # eval of the following expr yields StackOverflowError
> yonder.cert.file=${yonder.cert.file.dir}/${yonder.backend}-${yonder.application}.p12
>
> # following eval works
> #yonder.dirt.file=${yonder.cert.file.dir}/${yonder.backend}-${yonder.application}.p12
>
> # StackOverflowError occurs in and around the
> following method:
> #org.apache.commons.jelly.expression.CompositeExpression#evaluateAsString(JellyContext
> context)
>
> If this is a bug, I'm not sure if it belongs to
> commons-jelly or maven.  Thanks for any help you can
> provide.
>
> Dale
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org