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 2006/04/23 04:46:46 UTC

svn commit: r396205 - in /xerces/java/trunk/src/org/apache/xerces/impl: dv/xs/XSSimpleTypeDecl.java xs/util/ShortListImpl.java

Author: mrglavas
Date: Sat Apr 22 19:46:42 2006
New Revision: 396205

URL: http://svn.apache.org/viewcvs?rev=396205&view=rev
Log:
Return an empty ShortList from XSSimpleTypeDecl.getEnumerationTypeList() instead of null.

Modified:
    xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
    xerces/java/trunk/src/org/apache/xerces/impl/xs/util/ShortListImpl.java

Modified: xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=396205&r1=396204&r2=396205&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java Sat Apr 22 19:46:42 2006
@@ -2244,8 +2244,9 @@
 	
 	public ShortList getEnumerationTypeList() {
 		if (fEnumerationTypeList == null) {
-            if (fEnumerationType == null)
-                return null;
+            if (fEnumerationType == null) {
+                return ShortListImpl.EMPTY_LIST;
+            }
             fEnumerationTypeList = new ShortListImpl (fEnumerationType, fEnumerationType.length);
 		}
 		return fEnumerationTypeList;

Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/util/ShortListImpl.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/impl/xs/util/ShortListImpl.java?rev=396205&r1=396204&r2=396205&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/util/ShortListImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/util/ShortListImpl.java Sat Apr 22 19:46:42 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2002,2003-2004 The Apache Software Foundation.
+ * Copyright 2002,2003-2004,2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,6 +30,21 @@
  */
 public class ShortListImpl implements ShortList {
 
+    /**
+     * An immutable empty list.
+     */
+    public static final ShortList EMPTY_LIST = new ShortList() {
+        public int getLength() {
+            return 0;
+        }
+        public boolean contains(short item) {
+            return false;
+        }
+        public short item(int index) throws XSException {
+            throw new XSException(XSException.INDEX_SIZE_ERR, null);
+        }
+    };
+    
     // The array to hold all data
     private short[] fArray = null;
     // Number of elements in this list



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