xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkro...@apache.org
Subject svn commit: r155974 - in xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values: JavaStringEnumerationHolderEx.java JavaStringHolderEx.java XmlUnionImpl.java
Date Wed, 02 Mar 2005 23:15:07 GMT
Author: kkrouse
Date: Wed Mar  2 15:15:05 2005
New Revision: 155974

URL: http://svn.apache.org/viewcvs?view=rev&rev=155974
Log:
- fixed broken checkintests: XmlUnionImpl was always throwing
XmlValueOutOfRangeException when validateOnSet was true.

- string enums in base type are now validated against when adding facets.

Modified:
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java
    xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnionImpl.java

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java?view=diff&r1=155973&r2=155974
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
(original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringEnumerationHolderEx.java
Wed Mar  2 15:15:05 2005
@@ -46,18 +46,6 @@
     public static void validateLexical(String v, SchemaType sType, ValidationContext context)
     {
         JavaStringHolderEx.validateLexical(v, sType, context);
-
-        if (sType.hasStringEnumValues())
-        {
-            if (sType.enumForString(v) == null)
-            {
-                if (context != null)
-                {
-                    context.invalid(XmlErrorCodes.DATATYPE_ENUM_VALID,
-                        new Object[] { "string", v, QNameHelper.readable(sType) });
-                }
-            }
-        }
     }
     
     protected void set_nil()

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java?view=diff&r1=155973&r2=155974
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/JavaStringHolderEx.java Wed
Mar  2 15:15:05 2005
@@ -18,6 +18,7 @@
 import org.apache.xmlbeans.SchemaType;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlErrorCodes;
+import org.apache.xmlbeans.XmlAnySimpleType;
 import org.apache.xmlbeans.impl.common.ValidationContext;
 import org.apache.xmlbeans.impl.common.QNameHelper;
 
@@ -100,6 +101,23 @@
                     new Object[] { "string", new Integer(v.length()), new Integer(m), QNameHelper.readable(sType)
});
                 return;
             }
+        }
+        
+        // enumeration
+        // NOTE: can't use .hasStringEnumValues() or .enumForString()
+        // here since we may be validating against a string enum value
+        // during StscSimpleTypeResolver.resolveFacets() and the string
+        // enum table hasn't been constructed yet.
+        XmlAnySimpleType[] vals = sType.getEnumerationValues();
+        if (vals != null)
+        {
+            for (int i = 0; i < vals.length; i++)
+            {
+                if (v.equals(vals[i].getStringValue()))
+                    return;
+            }
+            context.invalid(XmlErrorCodes.DATATYPE_ENUM_VALID,
+                new Object[] { "string", v, QNameHelper.readable(sType) });
         }
     }
     

Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnionImpl.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnionImpl.java?view=diff&r1=155973&r2=155974
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnionImpl.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/values/XmlUnionImpl.java Wed Mar
 2 15:15:05 2005
@@ -107,7 +107,7 @@
         }
         try
         {
-            for (boolean validate = true; !_validateOnSet(); validate = false)
+            for (boolean validate = true; validate || !_validateOnSet(); validate = false)
             {
             for (int i = 0; i < members.length; i++)
             {
@@ -448,7 +448,7 @@
         }
         try
         {
-            for (boolean validate = true; !_validateOnSet(); validate = false)
+            for (boolean validate = true; validate || !_validateOnSet(); validate = false)
             {
             outer: for (int i = 0; i < members.length; i++)
             {



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


Mime
View raw message