Buggy code:
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 ) { } Augmentations getEmptyAugs ( Augmentations augs ) { } void storeLocations ( String sLocation , String nsLocation ) { } SchemaGrammar findSchemaGrammar ( short contextType , String namespace , QName enclosingElement , QName triggeringComponet , XMLAttributes attributes ) { } XSTypeDecl 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 ) { if ( XMLSchemaValidator . DEBUG ) { System . out . println ( ( "==>addDefaultAttributes:<seq2seq4repair_space>" + element ) ) ; } XSObjectList attrUses = attrGrp . getAttributeUses ( ) ; int useCount = attrUses . getLength ( ) ; XSAttributeUseImpl currUse ; XSAttributeDecl currDecl ; short constType ; ValidatedInfo defaultValue ; boolean isSpecified ; QName attName ; for ( int i = 0 ; i < useCount ; i ++ ) { currUse = ( ( XSAttributeUseImpl ) ( attrUses . getItem ( i ) ) ) ; currDecl = currUse . fAttrDecl ; constType = currUse . fConstraintType ; defaultValue = currUse . fDefault ; if ( constType == ( XSConstants . VC_NONE ) ) { constType = currDecl . getConstraintType ( ) ; defaultValue = currDecl . fDefault ; } isSpecified = ( attributes . getValue ( currDecl . fTargetNamespace , currDecl . fName ) ) != null ; if ( ( currUse . fUse ) == ( SchemaSymbols . USE_REQUIRED ) ) { if ( ! isSpecified ) reportSchemaError ( "cvc-complex-type.4" , new Object [ ] { element . rawname , currDecl . fName } ) ; } if ( ( ! isSpecified ) && ( constType != ( XSConstants . VC_NONE ) ) ) { attName = new QName ( null , currDecl . fName , currDecl . fName , currDecl . fTargetNamespace ) ; <START_BUG> String normalized = ( defaultValue != null ) ? defaultValue . toString ( ) : "" ; <END_BUG> int attrIndex = attributes . addAttribute ( attName , "CDATA" , normalized ) ; if ( attributes instanceof XMLAttributesImpl ) { XMLAttributesImpl attrs = ( ( XMLAttributesImpl ) ( attributes ) ) ; boolean schemaId = ( ( defaultValue != null ) && ( ( defaultValue . memberType ) != null ) ) ? defaultValue . memberType . isIDType ( ) : currDecl . fType . isIDType ( ) ; attrs . setSchemaId ( attrIndex , schemaId ) ; } if ( fAugPSVI ) { Augmentations augs = attributes . getAugmentations ( attrIndex ) ; AttributePSVImpl attrPSVI = new AttributePSVImpl ( ) ; augs . putItem ( ATTRIBUTE_PSVI , attrPSVI ) ; attrPSVI . fDeclaration = currDecl ; attrPSVI . fTypeDecl = currDecl . fType ; attrPSVI . fMemberType = defaultValue . memberType ; attrPSVI . fNormalizedValue = normalized ; attrPSVI . fSchemaDefault = normalized ; attrPSVI . fValidationContext = fValidationRoot ; attrPSVI . fValidity = AttributePSVI . VALIDITY_VALID ; attrPSVI . fValidationAttempted = AttributePSVI . VALIDATION_FULL ; attrPSVI . fSpecified = true ; } } } } 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 ) { }

Fix:
String normalized = ( defaultValue != null ) ? defaultValue . stringValue ( ) : "" ;