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=27017>. 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=27017 NodeList.item(-1) does not return null Summary: NodeList.item(-1) does not return null Product: Xerces2-J Version: 2.6.0 Platform: All OS/Version: All Status: NEW Severity: Major Priority: Other Component: DOM AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] 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. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
