Buggy code:
return null ; } } Vector dTValidators = null ; XSSimpleType dv = null ; XSObjectList dvs ; if ( ( union && ( memberTypes != null ) ) && ( ( memberTypes . size ( ) ) > 0 ) ) { int size = memberTypes . size ( ) ; dTValidators = new Vector ( size , 2 ) ; for ( int i = 0 ; i < size ; i ++ ) { dv = findDTValidator ( child , name , ( ( QName ) ( memberTypes . elementAt ( i ) ) ) , DERIVATION_UNION , schemaDoc ) ; if ( dv != null ) { if ( ( dv . getVariety ( ) ) == ( XSSimpleType . VARIETY_UNION ) ) { dvs = dv . getMemberTypes ( ) ; for ( int j = 0 ; j < ( dvs . getLength ( ) ) ; j ++ ) dTValidators . addElement ( dvs . item ( j ) ) ; } else { dTValidators . addElement ( dv ) ; } } } } boolean skipFacets = false ; if ( ( content != null ) && ( DOMUtil . getLocalName ( content ) . equals ( ELT_SIMPLETYPE ) ) ) { if ( restriction || list ) { if ( baseTypeName != null ) { reportSchemaError ( ( list ? "src-simple-type.3" : "src-simple-type.2" ) , null , content ) ; } else { baseValidator = traverseLocal ( content , schemaDoc , grammar ) ; } content = DOMUtil . getNextSiblingElement ( content ) ; } else if ( union ) { if ( dTValidators == null ) { dTValidators = new Vector ( 2 , 2 ) ; } do { dv = traverseLocal ( content , schemaDoc , grammar ) ; if ( dv != null ) { if ( ( dv . getVariety ( ) ) == ( XSSimpleType . VARIETY_UNION ) ) { dvs = dv . getMemberTypes ( ) ; for ( int j = 0 ; j < ( dvs . getLength ( ) ) ; j ++ ) dTValidators . addElement ( dvs . item ( j ) ) ; } else { dTValidators . addElement ( dv ) ; } } content = DOMUtil . getNextSiblingElement ( content ) ; } while ( ( content != null ) && ( DOMUtil . getLocalName ( content ) . equals ( ELT_SIMPLETYPE ) ) ) ; } } else if ( ( restriction || list ) && ( baseTypeName == null ) ) { reportSchemaError ( "src-simple-type.2" , null , child ) ; skipFacets = true ; baseValidator = SchemaGrammar . fAnySimpleType ; } else if ( union && ( ( memberTypes == null ) || ( ( memberTypes . size ( ) ) == 0 ) ) ) { reportSchemaError ( "src-union-memberTypes-or-simpleTypes" , null , child ) ; dTValidators = new Vector ( 1 ) ; dTValidators . addElement ( fAnySimpleType ) ; } if ( ( restriction || list ) && ( baseValidator == null ) ) { baseValidator = SchemaGrammar . fAnySimpleType ; } if ( union && ( ( dTValidators == null ) || ( ( dTValidators . size ( ) ) == 0 ) ) ) { dTValidators = new Vector ( 1 ) ; dTValidators . addElement ( fAnySimpleType ) ; } if ( list && ( isListDatatype ( baseValidator ) ) ) { reportSchemaError ( "cos-list-of-atomic" , new Object [ ] { name } , child ) ; } XSSimpleType newDecl = null ; if ( restriction ) { newDecl = schemaFactory . createTypeRestriction ( name , schemaDoc . fTargetNamespace , ( ( short ) ( finalProperty ) ) , baseValidator ) ; } else if ( list ) { newDecl = schemaFactory . createTypeList ( name , schemaDoc . fTargetNamespace , ( ( short ) ( finalProperty ) ) , baseValidator ) ; } else if ( union ) { XSSimpleType [ ] memberDecls = new XSSimpleType [ dTValidators . size ( ) ] ; for ( int i = 0 ; i < ( dTValidators . size ( ) ) ; i ++ ) memberDecls [ i ] = ( ( XSSimpleType ) ( dTValidators . elementAt ( i ) ) ) ; newDecl = schemaFactory . createTypeUnion ( name , schemaDoc . fTargetNamespace , ( ( short ) ( finalProperty ) ) , memberDecls ) ; } if ( restriction && ( content != null ) ) { FacetInfo fi = traverseFacets ( content , baseValidator , schemaDoc ) ; content = fi . nodeAfterFacets ; if ( ! skipFacets ) { try { fValidationState . setNamespaceSupport ( schemaDoc . fNamespaceSupport ) ; newDecl . applyFacets ( fi . facetdata , fi . fPresentFacets , fi . fFixedFacets , fValidationState ) ; } catch ( InvalidDatatypeFacetException ex ) { reportSchemaError ( ex . getKey ( ) , ex . getArgs ( ) , child ) ; } } } if ( content != null ) { if ( restriction ) { reportSchemaError ( "s4s-elt-must-match" , new Object [ ] { SchemaSymbols . ELT_RESTRICTION , "(annotation?,<seq2seq4repair_space>(simpleType?,<seq2seq4repair_space>(minExclusive<seq2seq4repair_space>|<seq2seq4repair_space>minInclusive<seq2seq4repair_space>|<seq2seq4repair_space>maxExclusive<seq2seq4repair_space>|<seq2seq4repair_space>maxInclusive<seq2seq4repair_space>|<seq2seq4repair_space>totalDigits<seq2seq4repair_space>|<seq2seq4repair_space>fractionDigits<seq2seq4repair_space>|<seq2seq4repair_space>length<seq2seq4repair_space>|<seq2seq4repair_space>minLength<seq2seq4repair_space>|<seq2seq4repair_space>maxLength<seq2seq4repair_space>|<seq2seq4repair_space>enumeration<seq2seq4repair_space>|<seq2seq4repair_space>whiteSpace<seq2seq4repair_space>|<seq2seq4repair_space>pattern)*))" } , content ) ; } else if ( list ) { reportSchemaError ( "s4s-elt-must-match" , new Object [ ] { SchemaSymbols . ELT_LIST , "(annotation?,<seq2seq4repair_space>(simpleType?))" } , content ) ; } else if ( union ) { <START_BUG> reportSchemaError ( "s4s-elt-must-match" , new Object [ ] { SchemaSymbols . ELT_LIST , "(annotation?,<seq2seq4repair_space>(simpleType*))" } , content ) ; <END_BUG> } } fAttrChecker . returnAttrArray ( contentAttrs , schemaDoc ) ; return newDecl ; } private XSSimpleType findDTValidator ( Element elm , String refName , QName baseTypeStr , short baseRefContext , XSDocumentInfo schemaDoc ) { } private final boolean checkBuiltIn ( String name , String namespace ) { } private boolean isListDatatype ( XSSimpleType validator ) { } private XSSimpleType errorType ( String name , String namespace , short refType ) { } }

Fix:
reportSchemaError ( "s4s-elt-must-match" , new Object [ ] { SchemaSymbols . ELT_UNION , "(annotation?,<seq2seq4repair_space>(simpleType*))" } , content ) ;