You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ra...@apache.org on 2005/05/26 23:58:00 UTC
svn commit: r178694 -
/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscChecker.java
Author: radup
Date: Thu May 26 14:57:58 2005
New Revision: 178694
URL: http://svn.apache.org/viewcvs?rev=178694&view=rev
Log:
Fix potential NPE in StscChecker.
Modified:
xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscChecker.java
Modified: xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscChecker.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscChecker.java?rev=178694&r1=178693&r2=178694&view=diff
==============================================================================
--- xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscChecker.java (original)
+++ xmlbeans/trunk/src/typeimpl/org/apache/xmlbeans/impl/schema/StscChecker.java Thu May 26 14:57:58 2005
@@ -37,6 +37,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.math.BigInteger;
@@ -1421,15 +1422,14 @@
SchemaType currentType = derivedType;
// XMLBEANS-66: if baseType is a union, check restriction is of one of the constituant types
- List possibleTypes;
+ Set possibleTypes = null;
if (baseType.getSimpleVariety() == SchemaType.UNION)
- possibleTypes = Arrays.asList(baseType.getUnionConstituentTypes());
- else
- possibleTypes = Arrays.asList(new SchemaType[] { baseType });
+ possibleTypes = new HashSet(Arrays.asList(baseType.getUnionConstituentTypes()));
// run up the types hierarchy from derived Type to base Type and make sure that all are derived by
// restriction. If any are not then this is not a valid restriction.
- while (!possibleTypes.contains(currentType)) {
+ while (!baseType.equals(currentType) &&
+ possibleTypes != null && !possibleTypes.contains(currentType)) {
if (currentType.getDerivationType() == SchemaType.DT_RESTRICTION) {
currentType = currentType.getBaseType();
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org