Buggy code:
final CMNodeFactory nodeFactory = new CMNodeFactory ( ) ; final CMBuilder fCMBuilder = new CMBuilder ( nodeFactory ) ; String fValidationRoot ; int fSkipValidationDepth ; int fNFullValidationDepth ; int fNNoneValidationDepth ; int fElementDepth ; boolean fSubElement ; boolean [ ] fSubElementStack = new boolean [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; XSElementDecl fCurrentElemDecl ; XSElementDecl [ ] fElemDeclStack = new XSElementDecl [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; boolean fNil ; boolean [ ] fNilStack = new boolean [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; XSNotationDecl fNotation ; XSNotationDecl [ ] fNotationStack = new XSNotationDecl [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; XSTypeDefinition fCurrentType ; XSTypeDefinition [ ] fTypeStack = new XSTypeDefinition [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; XSCMValidator fCurrentCM ; XSCMValidator [ ] fCMStack = new XSCMValidator [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; int [ ] fCurrCMState ; int [ ] [ ] fCMStateStack = new int [ XMLSchemaValidator . INITIAL_STACK_SIZE ] [ ] ; boolean fStrictAssess = true ; boolean [ ] fStrictAssessStack = new boolean [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; final StringBuffer fBuffer = new StringBuffer ( ) ; boolean fAppendBuffer = true ; boolean fSawText = false ; boolean [ ] fSawTextStack = new boolean [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; boolean fSawCharacters = false ; boolean [ ] fStringContent = new boolean [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; boolean fSawChildren = false ; boolean [ ] fSawChildrenStack = new boolean [ XMLSchemaValidator . INITIAL_STACK_SIZE ] ; final QName fTempQName = new QName ( ) ; 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 ) throws XNIException { } public XPathMatcher activateField ( Field field , int initialDepth ) { } public void endValueScopeFor ( IdentityConstraint identityConstraint , int initialDepth ) throws XNIException { } private void activateSelectorFor ( IdentityConstraint ic ) throws XNIException { } 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 ) { } Augmentations handleEndElement ( QName element , Augmentations augs ) { } final Augmentations endElementPSVI ( boolean root , SchemaGrammar [ ] grammars , Augmentations augs ) { if ( fAugPSVI ) { augs = getEmptyAugs ( augs ) ; fCurrentPSVI . fDeclaration = this . fCurrentElemDecl ; fCurrentPSVI . fTypeDecl = this . fCurrentType ; fCurrentPSVI . fNotation = this . fNotation ; fCurrentPSVI . fValidationContext = this . fValidationRoot ; if ( ( fElementDepth ) > ( fNFullValidationDepth ) ) { fCurrentPSVI . fValidationAttempted = ElementPSVI . VALIDATION_FULL ; } else if ( ( fElementDepth ) > ( fNNoneValidationDepth ) ) { fCurrentPSVI . fValidationAttempted = ElementPSVI . VALIDATION_NONE ; } else { fCurrentPSVI . fValidationAttempted = ElementPSVI . VALIDATION_PARTIAL ; fNFullValidationDepth = fNNoneValidationDepth = ( fElementDepth ) - 1 ; } if ( ( fDefaultValue ) != null ) fCurrentPSVI . fSpecified = true ; fCurrentPSVI . fNil = fNil ; fCurrentPSVI . fMemberType = fValidatedInfo . memberType ; fCurrentPSVI . fNormalizedValue = fValidatedInfo . normalizedValue ; if ( fStrictAssess ) { String [ ] errors = fXSIErrorReporter . mergeContext ( ) ; fCurrentPSVI . fErrorCodes = errors ; fCurrentPSVI . fValidity = ( errors == null ) ? ElementPSVI . VALIDITY_VALID : ElementPSVI . VALIDITY_INVALID ; } else { <START_BUG> fCurrentPSVI . fValidity = ElementPSVI . VALIDITY_UNKNOWN ; <END_BUG> fXSIErrorReporter . popContext ( ) ; } if ( root ) { fCurrentPSVI . fSchemaInformation = new XSModelImpl ( grammars ) ; } } return augs ; } Augmentations getEmptyAugs ( Augmentations augs ) { } void storeLocations ( String sLocation , String nsLocation ) { } SchemaGrammar findSchemaGrammar ( short contextType , String namespace , QName enclosingElement , QName triggeringComponet , XMLAttributes attributes ) { } XSTypeDefinition getAndCheckXsiType ( QName element , String xsiType , XMLAttributes attributes ) { } boolean getXsiNil ( QName element , String xsiNil ) { } void processAttributes ( QName element , XMLAttributes attributes , XSAttributeGroupDecl attrGrp ) { } void processOneAttribute ( QName element , XMLAttributes attributes , int index , XSAttributeDecl currDecl , XSAttributeUseImpl currUse , AttributePSVImpl attrPSVI ) { } void addDefaultAttributes ( QName element , XMLAttributes attributes , XSAttributeGroupDecl attrGrp ) { } void processElementContent ( QName element ) { } Object elementLocallyValidType ( QName element , Object textContent ) { } Object elementLocallyValidComplexType ( QName element , Object textContent ) { } void reportSchemaError ( String key , Object [ ] arguments ) { } protected static class XPathMatcherStack { protected XPathMatcher [ ] fMatchers = new XPathMatcher [ 4 ] ; protected int fMatchersCount ; protected IntStack fContextStack = new IntStack ( ) ; public XPathMatcherStack ( ) { } public void clear ( ) { } public int size ( ) { } public int getMatcherCount ( ) { } public void addMatcher ( XPathMatcher matcher ) { } public XPathMatcher getMatcherAt ( int index ) { } public void pushContext ( ) { } public void popContext ( ) { } private void ensureMatcherCapacity ( ) { } } protected abstract class ValueStoreBase implements ValueStore { protected IDValue NOT_AN_IDVALUE = new IDValue ( "￿" , null ) ; protected IdentityConstraint fIdentityConstraint ; protected final XMLSchemaValidator . OrderedHashtable fValues = new XMLSchemaValidator . OrderedHashtable ( ) ; protected int fValuesCount ;

Fix:
fCurrentPSVI . fValidity = ElementPSVI . VALIDITY_NOTKNOWN ;