Message: The following issue has been re-assigned.
Assignee: Michael Glavassevich (mailto:[EMAIL PROTECTED]) --------------------------------------------------------------------- View the issue: http://issues.apache.org/jira/browse/XERCESJ-892 Here is an overview of the issue: --------------------------------------------------------------------- Key: XERCESJ-892 Summary: NodeList.item(-1) does not return null Type: Bug Status: Open Project: Xerces2-J Components: DOM Versions: 2.6.0 Assignee: Michael Glavassevich Reporter: Christian Roth Created: Wed, 18 Feb 2004 12:45 AM Updated: Wed, 19 May 2004 7:25 AM Environment: Operating System: All Platform: All Description: Calling nl.item(-1) on a NodeList nl does not return null (as required by the spec for an invalid index) sometimes. >From the source, it looks like the code will indeed not return null for a NodeList of >length >= 1, when the "long way" in ParentNode.java, #789, is used: else { // long way n = firstChild; for (i = 0; i < index && n != null; i++) { n = n.nextSibling; } } n is initialized with firstChild, which probably is not null for a NodeList of size >= 1. Though the following loop never runs, n keeps the value of firstChild until method exit for the return value, even though the passed index is -1. This way, the first child node is returned instead of the expected value, null. (Please note that the above is only a quick-glance-observation and I might be wrong on the real cause for NodeList.item(-1) (or any negative value, for that matter), not returning null in all cases as expected.) Kind regards, Christian. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
