I added a test case to org.dom4j.TestXPathBug called testStefan() which demonstrated the bug, then applied this patch and it worked fine. Thanks Stefan.
This is now in CVS and is available in the daily build. James ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 19, 2002 8:42 PM Subject: [dom4j-dev] [ dom4j-Bugs-520143 ] IndexOutOfBoundsException > Bugs item #520143, was opened at 2002-02-19 12:42 > You can respond by visiting: > http://sourceforge.net/tracker/?func=detail&atid=116035&aid=520143&group_id= 16035 > > Category: None > Group: None > Status: Open > Resolution: None > Priority: 5 > Submitted By: Nobody/Anonymous (nobody) > Assigned to: Nobody/Anonymous (nobody) > Summary: IndexOutOfBoundsException > > Initial Comment: > Hi! > > I get a IndexOutOfBoundsException when evaluating a > XPath expression that selects a empty node set. I think > this code snippet in DefaultXPath causes the bug: > > public Object evaluate(Object context) { > try { > setNSContext(context); > List answer = xpath.selectNodes( context ); > if ( answer != null && answer.size() == 0 ) { > Problem ^ > return answer.get(0); > } > return answer; > } > catch (JaxenException e) { > handleJaxenException(e); > return null; > } > } > > > Bye Stefan > > ---------------------------------------------------------------------- > > You can respond by visiting: > http://sourceforge.net/tracker/?func=detail&atid=116035&aid=520143&group_id= 16035 > > _______________________________________________ > dom4j-dev mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dom4j-dev _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev