ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 20272] New: - JXPath fails w/ exception if expression returns no results
Date Tue, 27 May 2003 20:00:19 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20272>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20272

JXPath fails w/ exception if expression returns no results

           Summary: JXPath fails w/ exception if expression returns no
                    results
           Product: Ant
           Version: 1.6Alpha (nightly)
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: ajack@trysybase.com


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.name]/code[@type='java/plain']/@dir}"/>

If no <code element exists I get an unhelpful exception (below) -- without any 
context whatsoever. Maybe a fix is along the lines of  

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

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

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

before the call to:

            result += iter.next();

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


   java.util.NoSuchElementException
        at org.apache.commons.jxpath.ri.EvalContext.next(EvalContext.java:177)
        at org.apache.commons.jxpath.ri.compiler.Expression$ValueIterator.next
(Expression.java:175)
        at 
org.apache.tools.ant.taskdefs.optional.JXPath$JXPathPropertyHelper.getPropertyHo
ok(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:289)
        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>

Mime
View raw message