mrglavas 2004/10/08 08:20:39
Modified: java/src/org/apache/xerces/impl/dv/xs ListDV.java
java/src/org/apache/xerces/xs/datatypes ObjectList.java
Log:
Make ObjectList consistent with other object lists
in the XML Schema API by returning null instead
of throwing an exception when the index specified
is invalid.
Revision Changes Path
1.10 +4 -4 xml-xerces/java/src/org/apache/xerces/impl/dv/xs/ListDV.java
Index: ListDV.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/ListDV.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ListDV.java 6 Oct 2004 14:56:47 -0000 1.9
+++ ListDV.java 8 Oct 2004 15:20:39 -0000 1.10
@@ -99,9 +99,9 @@
return false;
}
- public Object item(int index) throws XSException {
- if (index < 0 || index > data.length - 1) {
- throw new XSException(XSException.INDEX_SIZE_ERR, null);
+ public Object item(int index) {
+ if (index < 0 || index >= data.length) {
+ return null;
}
return data[index];
}
1.5 +7 -10
xml-xerces/java/src/org/apache/xerces/xs/datatypes/ObjectList.java
Index: ObjectList.java
===================================================================
RCS file:
/home/cvs/xml-xerces/java/src/org/apache/xerces/xs/datatypes/ObjectList.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ObjectList.java 29 Sep 2004 21:39:01 -0000 1.4
+++ ObjectList.java 8 Oct 2004 15:20:39 -0000 1.5
@@ -15,8 +15,6 @@
*/
package org.apache.xerces.xs.datatypes;
-import org.apache.xerces.xs.XSException;
-
/**
* <p><b>EXPERIMENTAL: This interface should not be considered stable.
* It is likely it may be altered or replaced in the future.</b></p>
@@ -47,15 +45,14 @@
public boolean contains(Object item);
/**
- * Returns the <code>index</code>th item in the collection. The index
- * starts at 0.
+ * Returns the <code>index</code>th item in the collection or
+ * <code>null</code> if <code>index</code> is greater than or equal to
+ * the number of objects in the list. The index starts at 0.
* @param index index into the collection.
* @return The <code>Object</code> at the <code>index</code>th
- * position in the <code>ObjectList</code>.
- * @exception XSException
- * INDEX_SIZE_ERR: if <code>index</code> is greater than or equal to the
- * number of objects in the list.
+ * position in the <code>ObjectList</code>, or <code>null</code> if
+ * the index specified is not valid.
*/
- public Object item(int index) throws XSException;
+ public Object item(int index);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]