Buggy code:
void ensureStackCapacity ( ) { } void handleStartDocument ( XMLLocator locator , String encoding ) { } void handleEndDocument ( ) { } XMLString handleCharacters ( XMLString text ) { } private void normalizeWhitespace ( XMLString value , boolean collapse ) { } private void normalizeWhitespace ( String value , boolean collapse ) { } void handleIgnorableWhitespace ( XMLString text ) { } Augmentations handleStartElement ( QName element , XMLAttributes attributes , Augmentations augs ) { if ( XMLSchemaValidator . DEBUG ) { System . out . println ( ( "==>handleStartElement:<seq2seq4repair_space>" + element ) ) ; } if ( ( ( fElementDepth ) == ( - 1 ) ) && ( fValidationManager . isGrammarFound ( ) ) ) { if ( ( fSchemaType ) == null ) { fSchemaDynamicValidation = true ; } else { } } String sLocation = attributes . getValue ( URI_XSI , XSI_SCHEMALOCATION ) ; String nsLocation = attributes . getValue ( URI_XSI , XSI_NONAMESPACESCHEMALOCATION ) ; storeLocations ( sLocation , nsLocation ) ; if ( ( fSkipValidationDepth ) >= 0 ) { ( fElementDepth ) ++ ; if ( fAugPSVI ) augs = getEmptyAugs ( augs ) ; return augs ; } SchemaGrammar sGrammar = findSchemaGrammar ( CONTEXT_ELEMENT , element . uri , null , element , attributes ) ; Object decl = null ; if ( ( fCurrentCM ) != null ) { decl = fCurrentCM . oneTransition ( element , fCurrCMState , fSubGroupHandler ) ; if ( ( fCurrCMState [ 0 ] ) == ( XSCMValidator . FIRST_ERROR ) ) { XSComplexTypeDecl ctype = ( ( XSComplexTypeDecl ) ( fCurrentType ) ) ; Vector next ; if ( ( ( ctype . fParticle ) != null ) && ( ( ( next = fCurrentCM . whatCanGoHere ( fCurrCMState ) ) . size ( ) ) > 0 ) ) { String expected = expectedStr ( next ) ; reportSchemaError ( "cvc-complex-type.2.4.a" , new Object [ ] { element . rawname , expected } ) ; } else { reportSchemaError ( "cvc-complex-type.2.4.d" , new Object [ ] { element . rawname } ) ; } } } if ( ( fElementDepth ) != ( - 1 ) ) { ensureStackCapacity ( ) ; fSubElementStack [ fElementDepth ] = true ; fSubElement = false ; fElemDeclStack [ fElementDepth ] = fCurrentElemDecl ; fNilStack [ fElementDepth ] = fNil ; fNotationStack [ fElementDepth ] = fNotation ; fTypeStack [ fElementDepth ] = fCurrentType ; fStrictAssessStack [ fElementDepth ] = fStrictAssess ; fCMStack [ fElementDepth ] = fCurrentCM ; fCMStateStack [ fElementDepth ] = fCurrCMState ; fSawTextStack [ fElementDepth ] = fSawText ; fStringContent [ fElementDepth ] = fSawCharacters ; } ( fElementDepth ) ++ ; fCurrentElemDecl = null ; XSWildcardDecl wildcard = null ; fCurrentType = null ; fStrictAssess = true ; fNil = false ; fNotation = null ; fBuffer . setLength ( 0 ) ; fSawText = false ; fSawCharacters = false ; if ( decl != null ) { if ( decl instanceof XSElementDecl ) { fCurrentElemDecl = ( ( XSElementDecl ) ( decl ) ) ; } else { wildcard = ( ( XSWildcardDecl ) ( decl ) ) ; } } if ( ( wildcard != null ) && ( ( wildcard . fProcessContents ) == ( XSWildcardDecl . PC_SKIP ) ) ) { fSkipValidationDepth = fElementDepth ; if ( fAugPSVI ) augs = getEmptyAugs ( augs ) ; return augs ; } if ( ( ( fElementDepth ) == 0 ) && ( ( fRootTypeQName ) != null ) ) { String rootTypeNamespace = fRootTypeQName . getNamespaceURI ( ) ; if ( ( rootTypeNamespace != null ) && ( rootTypeNamespace . equals ( XMLConstants . NULL_NS_URI ) ) ) { rootTypeNamespace = null ; } <START_BUG> if ( rootTypeNamespace == ( SchemaSymbols . URI_SCHEMAFORSCHEMA ) ) { <END_BUG> fCurrentType = SG_SchemaNS . getGlobalTypeDecl ( fRootTypeQName . getLocalPart ( ) ) ; } else { SchemaGrammar grammarForRootType = findSchemaGrammar ( CONTEXT_ELEMENT , rootTypeNamespace , null , null , null ) ; if ( grammarForRootType != null ) { fCurrentType = grammarForRootType . getGlobalTypeDecl ( fRootTypeQName . getLocalPart ( ) ) ; } } if ( ( fCurrentType ) == null ) { String typeName = ( fRootTypeQName . getPrefix ( ) . equals ( XMLConstants . DEFAULT_NS_PREFIX ) ) ? fRootTypeQName . getLocalPart ( ) : ( ( fRootTypeQName . getPrefix ( ) ) + ":" ) + ( fRootTypeQName . getLocalPart ( ) ) ; reportSchemaError ( "cvc-type.1" , new Object [ ] { typeName } ) ; } } if ( ( fCurrentType ) == null ) { if ( ( fCurrentElemDecl ) == null ) { if ( sGrammar != null ) { fCurrentElemDecl = sGrammar . getGlobalElementDecl ( element . localpart ) ; } } if ( ( fCurrentElemDecl ) != null ) { fCurrentType = fCurrentElemDecl . fType ; } } if ( ( ( fElementDepth ) == ( fIgnoreXSITypeDepth ) ) && ( ( fCurrentElemDecl ) == null ) ) { ( fIgnoreXSITypeDepth ) ++ ; } String xsiType = null ; if ( ( fElementDepth ) >= ( fIgnoreXSITypeDepth ) ) { xsiType = attributes . getValue ( URI_XSI , XSI_TYPE ) ; } if ( ( ( fCurrentType ) == null ) && ( xsiType == null ) ) { if ( ( fElementDepth ) == 0 ) { if ( ( fDynamicValidation ) || ( fSchemaDynamicValidation ) ) { if ( ( fDocumentSource ) != null ) { fDocumentSource . setDocumentHandler ( fDocumentHandler ) ; if ( ( fDocumentHandler ) != null ) fDocumentHandler . setDocumentSource ( fDocumentSource ) ; fElementDepth = - 2 ; return augs ; } fSkipValidationDepth = fElementDepth ; if ( fAugPSVI ) augs = getEmptyAugs ( augs ) ; return augs ; } fXSIErrorReporter . fErrorReporter . reportError ( SCHEMA_DOMAIN , "cvc-elt.1" , new Object [ ] { element . rawname } , SEVERITY_ERROR ) ; }

Fix:
if ( URI_SCHEMAFORSCHEMA . equals ( rootTypeNamespace ) ) {