Buggy code:
class XSDComplexTypeTraverser extends XSDAbstractParticleTraverser { XSDComplexTypeTraverser ( XSDHandler handler , XSAttributeChecker gAttrCheck ) { } private static final boolean DEBUG = false ; private static XSParticleDecl fErrorContent = null ; private static XSWildcardDecl fErrorWildcard = null ; private SchemaDVFactory schemaFactory = SchemaDVFactory . getInstance ( ) ; private class ComplexTypeRecoverableError extends Exception { Object [ ] errorSubstText = null ; Element errorElem = null ; ComplexTypeRecoverableError ( ) { } ComplexTypeRecoverableError ( String msgKey , Object [ ] args , Element e ) { } } XSComplexTypeDecl traverseLocal ( Element complexTypeNode , XSDocumentInfo schemaDoc , SchemaGrammar grammar ) { } XSComplexTypeDecl traverseGlobal ( Element complexTypeNode , XSDocumentInfo schemaDoc , SchemaGrammar grammar ) { } private XSComplexTypeDecl traverseComplexTypeDecl ( Element complexTypeDecl , String complexTypeName , Object [ ] attrValues , XSDocumentInfo schemaDoc , SchemaGrammar grammar ) { } private void traverseSimpleContent ( Element simpleContentElement , XSComplexTypeDecl typeInfo , XSDocumentInfo schemaDoc , SchemaGrammar grammar ) throws XSDComplexTypeTraverser . ComplexTypeRecoverableError { } private void traverseComplexContent ( Element complexContentElement , XSComplexTypeDecl typeInfo , boolean mixedOnType , XSDocumentInfo schemaDoc , SchemaGrammar grammar ) throws XSDComplexTypeTraverser . ComplexTypeRecoverableError { } private void mergeAttributes ( XSAttributeGroupDecl fromAttrGrp , XSAttributeGroupDecl toAttrGrp , String typeName , boolean extension , Element elem ) throws XSDComplexTypeTraverser . ComplexTypeRecoverableError { XSObjectList attrUseS = fromAttrGrp . getAttributeUses ( ) ; XSAttributeUseImpl existingAttrUse ; XSAttributeUseImpl duplicateAttrUse = null ; XSAttributeUseImpl oneAttrUse ; <START_BUG> int attrCount = attrUseS . getListLength ( ) ; <END_BUG> for ( int i = 0 ; i < attrCount ; i ++ ) { oneAttrUse = ( ( XSAttributeUseImpl ) ( attrUseS . getItem ( i ) ) ) ; existingAttrUse = toAttrGrp . getAttributeUse ( oneAttrUse . fAttrDecl . fTargetNamespace , oneAttrUse . fAttrDecl . fName ) ; if ( existingAttrUse == null ) { String idName = toAttrGrp . addAttributeUse ( oneAttrUse ) ; if ( idName != null ) { throw new XSDComplexTypeTraverser . ComplexTypeRecoverableError ( "ct-props-correct.5" , new Object [ ] { typeName , idName , oneAttrUse . fAttrDecl . fName } , elem ) ; } } else { if ( extension ) { throw new XSDComplexTypeTraverser . ComplexTypeRecoverableError ( "ct-props-correct.4" , new Object [ ] { typeName , existingAttrUse . fAttrDecl . fName } , elem ) ; } } } if ( extension ) { if ( ( toAttrGrp . fAttributeWC ) == null ) { toAttrGrp . fAttributeWC = fromAttrGrp . fAttributeWC ; } else if ( ( fromAttrGrp . fAttributeWC ) != null ) { toAttrGrp . fAttributeWC = toAttrGrp . fAttributeWC . performUnionWith ( fromAttrGrp . fAttributeWC , toAttrGrp . fAttributeWC . fProcessContents ) ; } } } private void processComplexContent ( Element complexContentChild , XSComplexTypeDecl typeInfo , boolean isMixed , boolean isDerivation , XSDocumentInfo schemaDoc , SchemaGrammar grammar ) throws XSDComplexTypeTraverser . ComplexTypeRecoverableError { } private boolean isAttrOrAttrGroup ( Element e ) { } private void traverseSimpleContentDecl ( Element simpleContentDecl , XSComplexTypeDecl typeInfo ) { } private void traverseComplexContentDecl ( Element complexContentDecl , XSComplexTypeDecl typeInfo , boolean mixedOnComplexTypeDecl ) { } private String genAnonTypeName ( Element complexTypeDecl ) { } private void handleComplexTypeError ( String messageId , Object [ ] args , XSComplexTypeDecl typeInfo , Element e ) { } private static synchronized XSParticleDecl getErrorContent ( ) { } }

Fix:
int attrCount = attrUseS . getLength ( ) ;