Hi guys,

Attached is a small patch to stop NodeListImpl.item() throwing an IndexOutOfBoundsException when the given index < 0 or >= getLength(). It now returns null to comply with the DOM.

Can someone commit it to the tree?

Cheers,
Mike.

--
Mike Gratton <[EMAIL PROTECTED]>
"Every motive escalate."
 Blatant self-promotion: <http://web.vee.net/>
Index: java/src/org/apache/xindice/xml/dom/NodeListImpl.java
===================================================================
RCS file: 
/home/cvspublic/xml-xindice/java/src/org/apache/xindice/xml/dom/NodeListImpl.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 NodeListImpl.java
--- java/src/org/apache/xindice/xml/dom/NodeListImpl.java       6 Dec 2001 
19:34:00 -0000       1.1.1.1
+++ java/src/org/apache/xindice/xml/dom/NodeListImpl.java       16 Jan 2002 
04:35:51 -0000
@@ -83,7 +83,12 @@
     *   index.
     */
    public final Node item(int index) {
-      return (Node)get(index);
+      try {
+         return (Node)get(index);
+      }
+      catch (IndexOutOfBoundsException ioobe) {
+         return null;
+      }
    }
 
    /**

Reply via email to