You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by ji...@apache.org on 2004/05/14 18:57:56 UTC
[jira] Updated: (XERCESJ-892) NodeList.item(-1) does not return null
The following issue has been updated:
Updater: Jonathan Au (mailto:jonau@ca.ibm.com)
Date: Fri, 14 May 2004 9:57 AM
Comment:
Ensures null is returned for negative indexes to NodeList.item method.
Changes:
Attachment changed to NodeListItemPatch
---------------------------------------------------------------------
For a full history of the issue, see:
http://issues.apache.org/jira/browse/XERCESJ-892?page=history
---------------------------------------------------------------------
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: Xerces-J Developers Mailing List
Reporter: Christian Roth
Created: Wed, 18 Feb 2004 12:45 AM
Updated: Fri, 14 May 2004 9:57 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: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org