Author: mrglavas
Date: Sun Apr 25 04:12:41 2010
New Revision: 937739
URL: http://svn.apache.org/viewvc?rev=937739&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/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java
URL:
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/impl/dv/xs/XSSimpleTypeDecl.java?rev=937739&r1=937738&r2=937739&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
Sun Apr 25 04:12:41 2010
@@ -1903,7 +1903,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
@@ -1911,7 +1912,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]