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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to