You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Adam Jack <aj...@TrySybase.com> on 2003/05/27 20:05:10 UTC

JXPathPropertyHelper -- error messages/bug?

I am working with centipede which is a heavy user of this property helper.
It has entries like this:

  <property name="project.src.dir"

value="${jxpath:/references/module.xml/root/module/project[@name=$project.na
me]/code[@type='java/plain']/@dir}"/>

If no <code element exists I get an unhelpful exception (below) -- without
any context whatsoever. Is this a bug (i.e. the code ought check
iter.hasNext before calling iter.next) -- and/or could the code at least
annotate the exception with (1) property name (2) property 'expression'.

Thanks in advance.

regards

Adam

------------------------------------------------------------


   java.util.NoSuchElementException
        at
org.apache.commons.jxpath.ri.EvalContext.next(EvalContext.java:177)
        at
org.apache.commons.jxpath.ri.compiler.Expression$ValueIterator.next(Expressi
on.java:175)
        at
org.apache.tools.ant.taskdefs.optional.JXPath$JXPathPropertyHelper.getProper
tyHook(JXPath
.java:136)
        at
org.apache.tools.ant.PropertyHelper.getPropertyHook(PropertyHelper.java:197)
        at
org.apache.tools.ant.PropertyHelper.getProperty(PropertyHelper.java:443)
        at
org.apache.tools.ant.PropertyHelper.replaceProperties(PropertyHelper.java:28
9)
        at org.apache.tools.ant.Project.replaceProperties(Project.java:486)
        at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.
java:310)
        at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.
java:266)
        at
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:143)
        at org.apache.tools.ant.Task.perform(Task.java:347)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:122)
        at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:120)
        at org.apache.tools.ant.Main.runBuild(Main.java:597)
        at org.apache.tools.ant.Main.start(Main.java:197)
        at org.apache.tools.ant.Main.main(Main.java:235)
F:\data\CommonsVersion\smoke-test>

--
<http://www.try.sybase.com>
Experience Sybase Technology ...


RE: JXPathPropertyHelper -- error messages/bug?

Posted by Adam Jack <aj...@TrySybase.com>.
Actually, maybe a fix is along the lines of

	if ((null==iter)||(!iter.hasNext())

org.apache.tools.ant.taskdefs.optional.JXPath.java line 132:

            if(iter==null){
                return "null";
            }

before the call to:

            result += iter.next();

regards

Adam
-----Original Message-----
From: Adam Jack [mailto:ajack@trysybase.com]
Sent: Tuesday, May 27, 2003 12:05 PM
To: user@ant.apache.org
Subject: JXPathPropertyHelper -- error messages/bug?


I am working with centipede which is a heavy user of this property helper.
It has entries like this:

  <property name="project.src.dir"

value="${jxpath:/references/module.xml/root/module/project[@name=$project.na
me]/code[@type='java/plain']/@dir}"/>

If no <code element exists I get an unhelpful exception (below) -- without
any context whatsoever. Is this a bug (i.e. the code ought check
iter.hasNext before calling iter.next) -- and/or could the code at least
annotate the exception with (1) property name (2) property 'expression'.

Thanks in advance.

regards

Adam

------------------------------------------------------------


   java.util.NoSuchElementException
        at
org.apache.commons.jxpath.ri.EvalContext.next(EvalContext.java:177)
        at
org.apache.commons.jxpath.ri.compiler.Expression$ValueIterator.next(Expressi
on.java:175)
        at
org.apache.tools.ant.taskdefs.optional.JXPath$JXPathPropertyHelper.getProper
tyHook(JXPath
.java:136)
        at
org.apache.tools.ant.PropertyHelper.getPropertyHook(PropertyHelper.java:197)
        at
org.apache.tools.ant.PropertyHelper.getProperty(PropertyHelper.java:443)
        at
org.apache.tools.ant.PropertyHelper.replaceProperties(PropertyHelper.java:28
9)
        at org.apache.tools.ant.Project.replaceProperties(Project.java:486)
        at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.
java:310)
        at
org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.
java:266)
        at
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:143)
        at org.apache.tools.ant.Task.perform(Task.java:347)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:122)
        at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:120)
        at org.apache.tools.ant.Main.runBuild(Main.java:597)
        at org.apache.tools.ant.Main.start(Main.java:197)
        at org.apache.tools.ant.Main.main(Main.java:235)
F:\data\CommonsVersion\smoke-test>

--
<http://www.try.sybase.com>
Experience Sybase Technology ...


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