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] - JXPath fails w/ exception if expression returns no results
Date Wed, 28 May 2003 11:56:03 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

ajack@trysybase.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |



------- Additional Comments From ajack@trysybase.com  2003-05-28 11:56 -------
JXPATH is correctly (IMHO) returning an iterator that has no contents. 
Debatably it ought return null for no iterator, but I think that is a weak 
argument & an "empty" iterator is quite correct.

ANT code (I pointed to the line) is testing for a null iterator, not testing 
for an empty iterator, before it tries to call "next()". As such, it is causing 
the exception to be thrown.

Please see:

http://java.sun.com/j2se/1.4.1/docs/api/java/util/Iterator.html#next()
http://java.sun.com/j2se/1.4.1/docs/api/java/util/NoSuchElementException.html

This is a plain and simple iterator use bug, and the culprit is the ant code.

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

Also, I do NOT see how this is a duplicate of another 15388. It is related to 
JXPATH, but it is a separate bug IMHO.

Mime
View raw message