Author: sandygao
Date: Mon Sep  8 13:50:42 2008
New Revision: 693266

URL: http://svn.apache.org/viewvc?rev=693266&view=rev
Log:
When ID/IDREF/ENTITY rules are checked against a list value, we temporarily 
hijack the ValidatedInfo object for the list value and use it for individual 
items in the list. We then restore it back to the original state.

This doesn't work when one of the items is invalid and an exception is thrown, 
because the ValidatedInfo would contain information for the bad item, as 
opposed to the list.

Fixed by adding a try-finally block to always restore the ValidatedInfo to the 
"list value" sate.

Modified:
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=693266&r1=693265&r2=693266&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
 Mon Sep  8 13:50:42 2008
@@ -1759,23 +1759,27 @@
         } else if (fVariety == VARIETY_LIST) {
 
             ListDV.ListData values = (ListDV.ListData)ob;
+            XSSimpleType memberType = validatedInfo.memberType;
             int len = values.getLength();
-            if (fItemType.fVariety == VARIETY_UNION) {
-                XSSimpleTypeDecl[] memberTypes = 
(XSSimpleTypeDecl[])validatedInfo.memberTypes;
-                XSSimpleType memberType = validatedInfo.memberType;
-                for (int i = len-1; i >= 0; i--) {
-                    validatedInfo.actualValue = values.item(i);
-                    validatedInfo.memberType = memberTypes[i];
-                    fItemType.checkExtraRules(context, validatedInfo);
+            try {
+                if (fItemType.fVariety == VARIETY_UNION) {
+                    XSSimpleTypeDecl[] memberTypes = 
(XSSimpleTypeDecl[])validatedInfo.memberTypes;
+                    for (int i = len-1; i >= 0; i--) {
+                        validatedInfo.actualValue = values.item(i);
+                        validatedInfo.memberType = memberTypes[i];
+                        fItemType.checkExtraRules(context, validatedInfo);
+                    }
+                } else { // (fVariety == VARIETY_ATOMIC)
+                    for (int i = len-1; i >= 0; i--) {
+                        validatedInfo.actualValue = values.item(i);
+                        fItemType.checkExtraRules(context, validatedInfo);
+                    }
                 }
+            }
+            finally {
+                validatedInfo.actualValue = values;
                 validatedInfo.memberType = memberType;
-            } else { // (fVariety == VARIETY_ATOMIC)
-                for (int i = len-1; i >= 0; i--) {
-                    validatedInfo.actualValue = values.item(i);
-                    fItemType.checkExtraRules(context, validatedInfo);
-                }
             }
-            validatedInfo.actualValue = values;
 
         } else { // (fVariety == VARIETY_UNION)
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to