Buggy code:
private javax . xml . namespace . QName fRootElementDeclQName = null ; private XSElementDecl fRootElementDeclaration = null ; private int fIgnoreXSITypeDepth ; private boolean fIDCChecking ; private ValidatedInfo fValidatedInfo = new ValidatedInfo ( ) ; private ValidationState fState4XsiType = new ValidationState ( ) ; private ValidationState fState4ApplyDefault = new ValidationState ( ) ; protected XMLSchemaValidator . XPathMatcherStack fMatcherStack = new XMLSchemaValidator . XPathMatcherStack ( ) ; protected XMLSchemaValidator . ValueStoreCache fValueStoreCache = new XMLSchemaValidator . ValueStoreCache ( ) ; public XMLSchemaValidator ( ) { } public void reset ( XMLComponentManager componentManager ) throws XMLConfigurationException { } public void startValueScopeFor ( IdentityConstraint identityConstraint , int initialDepth ) { } public XPathMatcher activateField ( Field field , int initialDepth ) { } public void endValueScopeFor ( IdentityConstraint identityConstraint , int initialDepth ) { } private void activateSelectorFor ( IdentityConstraint ic ) { } public XSElementDecl getGlobalElementDecl ( QName element ) { } 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 { } } if ( ! ( fUseGrammarPoolOnly ) ) { String sLocation = attributes . getValue ( URI_XSI , SchemaSymbols . XSI_SCHEMALOCATION ) ; String nsLocation = attributes . getValue ( URI_XSI , SchemaSymbols . XSI_NONAMESPACESCHEMALOCATION ) ; storeLocations ( sLocation , nsLocation ) ; } if ( ( fSkipValidationDepth ) >= 0 ) { ( fElementDepth ) ++ ; if ( fAugPSVI ) augs = getEmptyAugs ( augs ) ; return augs ; } 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 ) ; final int [ ] occurenceInfo = fCurrentCM . occurenceInfo ( fCurrCMState ) ; String elemExpandedQname = ( ( element . uri ) != null ) ? ( ( ( ( ( "{" + '"' ) + ( element . uri ) ) + '"' ) + ":" ) + ( element . localpart ) ) + "}" : element . localpart ; if ( occurenceInfo != null ) { final int minOccurs = occurenceInfo [ 0 ] ; final int maxOccurs = occurenceInfo [ 1 ] ; final int count = occurenceInfo [ 2 ] ; if ( count < minOccurs ) { final int required = minOccurs - count ; if ( required > 1 ) { reportSchemaError ( "cvc-complex-type.2.4.h" , new Object [ ] { element . rawname , fCurrentCM . getTermName ( occurenceInfo [ 3 ] ) , Integer . toString ( minOccurs ) , Integer . toString ( required ) } ) ; } else { reportSchemaError ( "cvc-complex-type.2.4.g" , new Object [ ] { element . rawname , fCurrentCM . getTermName ( occurenceInfo [ 3 ] ) , Integer . toString ( minOccurs ) } ) ; } } else if ( ( count >= maxOccurs ) && ( maxOccurs != ( SchemaSymbols . OCCURRENCE_UNBOUNDED ) ) ) { reportSchemaError ( "cvc-complex-type.2.4.e" , new Object [ ] { element . rawname , expected , Integer . toString ( maxOccurs ) } ) ; } else { reportSchemaError ( "cvc-complex-type.2.4.a" , new Object [ ] { elemExpandedQname , expected } ) ; } } else { reportSchemaError ( "cvc-complex-type.2.4.a" , new Object [ ] { elemExpandedQname , expected } ) ; } } else { final int [ ] occurenceInfo = fCurrentCM . occurenceInfo ( fCurrCMState ) ; if ( occurenceInfo != null ) { final int maxOccurs = occurenceInfo [ 1 ] ; final int count = occurenceInfo [ 2 ] ; if ( ( count >= maxOccurs ) && ( maxOccurs != ( SchemaSymbols . OCCURRENCE_UNBOUNDED ) ) ) { <START_BUG> reportSchemaError ( "cvc-complex-type.2.4.f" , new Object [ ] { element . rawname , Integer . toString ( maxOccurs ) } ) ; <END_BUG> } else { reportSchemaError ( "cvc-complex-type.2.4.d" , new Object [ ] { element . rawname } ) ; } } 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 ;

Fix:
reportSchemaError ( "cvc-complex-type.2.4.f" , new Object [ ] { fCurrentCM . getTermName ( occurenceInfo [ 3 ] ) , Integer . toString ( maxOccurs ) } ) ;