Buggy code:
class XSDAttributeTraverser extends XSDAbstractTraverser { public XSDAttributeTraverser ( XSDHandler handler , XSAttributeChecker gAttrCheck ) { } protected XSAttributeUse traverseLocal ( Element attrDecl , XSDocumentInfo schemaDoc , SchemaGrammar grammar ) { } protected XSAttributeDecl traverseGlobal ( Element attrDecl , XSDocumentInfo schemaDoc , SchemaGrammar grammar ) { } XSAttributeDecl traverseNamedAttr ( Element attrDecl , Object [ ] attrValues , XSDocumentInfo schemaDoc , SchemaGrammar grammar , boolean isGlobal ) { String defaultAtt = ( ( String ) ( attrValues [ XSAttributeChecker . ATTIDX_DEFAULT ] ) ) ; String fixedAtt = ( ( String ) ( attrValues [ XSAttributeChecker . ATTIDX_FIXED ] ) ) ; XInt formAtt = ( ( XInt ) ( attrValues [ XSAttributeChecker . ATTIDX_FORM ] ) ) ; String nameAtt = ( ( String ) ( attrValues [ XSAttributeChecker . ATTIDX_NAME ] ) ) ; QName typeAtt = ( ( QName ) ( attrValues [ XSAttributeChecker . ATTIDX_TYPE ] ) ) ; XSAttributeDecl attribute = new XSAttributeDecl ( ) ; if ( nameAtt != null ) attribute . fName = fSymbolTable . addSymbol ( nameAtt ) ; if ( isGlobal ) { attribute . fTargetNamespace = schemaDoc . fTargetNamespace ; } else if ( formAtt != null ) { if ( ( formAtt . intValue ( ) ) == ( SchemaSymbols . FORM_QUALIFIED ) ) attribute . fTargetNamespace = schemaDoc . fTargetNamespace ; else attribute . fTargetNamespace = null ; } else if ( schemaDoc . fAreLocalAttributesQualified ) { attribute . fTargetNamespace = schemaDoc . fTargetNamespace ; } else { attribute . fTargetNamespace = null ; } if ( isGlobal ) { if ( fixedAtt != null ) { attribute . fDefault = fixedAtt ; attribute . fConstraintType = XSElementDecl . FIXED_VALUE ; } else if ( defaultAtt != null ) { attribute . fDefault = defaultAtt ; attribute . fConstraintType = XSElementDecl . DEFAULT_VALUE ; } else { attribute . fConstraintType = XSElementDecl . NO_CONSTRAINT ; } } Element child = DOMUtil . getFirstChildElement ( attrDecl ) ; if ( ( child != null ) && ( DOMUtil . getLocalName ( child ) . equals ( ELT_ANNOTATION ) ) ) { traverseAnnotationDecl ( child , attrValues , false , schemaDoc ) ; child = DOMUtil . getNextSiblingElement ( child ) ; } DatatypeValidator attrType = null ; boolean haveAnonType = false ; if ( child != null ) { String childName = DOMUtil . getLocalName ( child ) ; if ( childName . equals ( ELT_SIMPLETYPE ) ) { attrType = fSimpleTypeTraverser . traverseLocal ( child , schemaDoc , grammar ) ; haveAnonType = true ; child = DOMUtil . getNextSiblingElement ( child ) ; } } if ( ( attrType == null ) && ( typeAtt != null ) ) { XSTypeDecl type = ( ( XSTypeDecl ) ( fSchemaHandler . getGlobalDecl ( schemaDoc , TYPEDECL_TYPE , typeAtt ) ) ) ; if ( type instanceof DatatypeValidator ) attrType = ( ( DatatypeValidator ) ( type ) ) ; else reportGenericSchemaError ( ( ( "the<seq2seq4repair_space>type<seq2seq4repair_space>for<seq2seq4repair_space>attribute<seq2seq4repair_space>'" + nameAtt ) + "'<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>a<seq2seq4repair_space>simpleType" ) ) ; } if ( attrType == null ) { attrType = SchemaGrammar . fAnySimpleType ; } attribute . fType = attrType ; <START_BUG> if ( nameAtt != null ) <END_BUG> grammar . addGlobalAttributeDecl ( attribute ) ; if ( nameAtt == null ) { if ( isGlobal ) reportSchemaError ( "s4s-att-must-appear" , new Object [ ] { NO_NAME , SchemaSymbols . ATT_NAME } ) ; else reportSchemaError ( "src-attribute.3.1" , null ) ; nameAtt = NO_NAME ; } if ( child != null ) { reportSchemaError ( "s4s-elt-must-match" , new Object [ ] { nameAtt , "(annotation?,<seq2seq4repair_space>(simpleType?))" } ) ; } if ( ( defaultAtt != null ) && ( fixedAtt != null ) ) { reportSchemaError ( "src-attribute.1" , new Object [ ] { nameAtt } ) ; } if ( haveAnonType && ( typeAtt != null ) ) { reportSchemaError ( "src-attribute.4" , new Object [ ] { nameAtt } ) ; } checkNotationType ( nameAtt , attrType ) ; if ( ( attribute . fDefault ) != null ) { if ( ! ( checkDefaultValid ( attribute ) ) ) { reportSchemaError ( "a-props-correct.2" , new Object [ ] { nameAtt , defaultAtt } ) ; } } if ( ( attribute . fDefault ) != null ) { if ( attrType instanceof IDDatatypeValidator ) { reportSchemaError ( "a-props-correct.3" , new Object [ ] { nameAtt } ) ; } } if ( ( nameAtt != null ) && ( nameAtt . equals ( XMLNS ) ) ) { reportSchemaError ( "no-xmlns" , null ) ; } if ( ( ( attribute . fTargetNamespace ) != null ) && ( attribute . fTargetNamespace . equals ( URI_XSI ) ) ) { reportSchemaError ( "no-xsi" , new Object [ ] { SchemaSymbols . URI_XSI } ) ; } return attribute ; } boolean checkDefaultValid ( XSAttributeDecl attribute ) { } boolean checkDefaultValid ( XSAttributeUse attrUse ) { } }

Fix:
if ( isGlobal && ( nameAtt != null ) )