Author: mrglavas
Date: Sun Apr 25 04:13:11 2010
New Revision: 937740

URL: http://svn.apache.org/viewvc?rev=937740&view=rev
Log:
Fixing JIRA Issue #1446: http://issues.apache.org/jira/browse/XERCESJ-1446. 
When the value passed in is a StringBuffer we normalize the value in place. 
This is problematic for unions because it corrupts the initial value seen by 
the subsequent type validators. If there is more than one member type convert 
the initial value to a string before passing it on to the member type 
validators.

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=937740&r1=937739&r2=937740&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
 Sun Apr 25 04:13:11 2010
@@ -2130,7 +2130,8 @@ public class XSSimpleTypeDecl implements
             return v;
 
         } else { // (fVariety == VARIETY_UNION)
-            for(int i = 0 ; i < fMemberTypes.length; i++) {
+            final Object _content = (fMemberTypes.length > 1 && content != 
null) ? content.toString() : content;
+            for (int i = 0; i < fMemberTypes.length; i++) {
                 try {
                     // we can't call fMemberType[i].validate(), otherwise 
checkExtraRules()
                     // will be called twice: once in fMemberType[i].validate, 
once in
@@ -2138,7 +2139,7 @@ public class XSSimpleTypeDecl implements
                     // so we take two steps to get the actual value:
                     // 1. fMemberType[i].getActualValue()
                     // 2. fMemberType[i].chekcFacets()
-                    Object aValue = fMemberTypes[i].getActualValue(content, 
context, validatedInfo, true);
+                    Object aValue = fMemberTypes[i].getActualValue(_content, 
context, validatedInfo, true);
                     if (context.needFacetChecking() &&
                             (fMemberTypes[i].fFacetsDefined != 0 && 
fMemberTypes[i].fFacetsDefined != FACET_WHITESPACE)) {
                         fMemberTypes[i].checkFacets(validatedInfo);



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to