You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2004/05/19 21:16:57 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/dom ParentNode.java AttrImpl.java

mrglavas    2004/05/19 12:16:57

  Modified:    java/src/org/apache/xerces/dom ParentNode.java AttrImpl.java
  Log:
  Fixing Jira Bug #892:
  http://nagoya.apache.org/jira/browse/XERCESJ-892
  
  The DOM spec specifies that null should be returned from
  NodeList.item() if it is not a valid index. The spec defines
  the index as an unsigned int, but clearly negative indicies
  are not valid. Now return null for negative indicies. This
  is fixed thanks to the patch by Jonathan Au.
  
  Revision  Changes    Path
  1.44      +4 -1      xml-xerces/java/src/org/apache/xerces/dom/ParentNode.java
  
  Index: ParentNode.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ParentNode.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- ParentNode.java	2 Mar 2004 21:57:34 -0000	1.43
  +++ ParentNode.java	19 May 2004 19:16:57 -0000	1.44
  @@ -750,6 +750,9 @@
           }
           else {
               // long way
  +            if (index < 0) {
  +                return null;
  +            }
               n = firstChild;
               for (i = 0; i < index && n != null; i++) {
                   n = n.nextSibling;
  
  
  
  1.57      +5 -2      xml-xerces/java/src/org/apache/xerces/dom/AttrImpl.java
  
  Index: AttrImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/AttrImpl.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- AttrImpl.java	24 Feb 2004 23:23:18 -0000	1.56
  +++ AttrImpl.java	19 May 2004 19:16:57 -0000	1.57
  @@ -1038,10 +1038,13 @@
                   return (Node) value;
               }
           }
  +        if (index < 0) {
  +            return null;
  +        }
           ChildNode node = (ChildNode) value;
           for (int i = 0; i < index && node != null; i++) {
               node = node.nextSibling;
  -        }
  +        } 
           return node;
   
       } // item(int):Node
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org