Buggy code:
public int derivedBy = 0 ; public int blockSet = 0 ; public int finalSet = 0 ; public boolean isAbstract = false ; public int scopeDefined = - 1 ; public int contentType ; public int contentSpecHandle = - 1 ; public int templateElementIndex = - 1 ; public int attlistHead = - 1 ; public DatatypeValidator datatypeValidator ; } private class ComplexTypeRecoverableError extends Exception { ComplexTypeRecoverableError ( ) { } ComplexTypeRecoverableError ( String s ) { } } public static final String SchemaForSchemaURI = "http:////www.w3.org//TR-1//Schema" ; private TraverseSchema ( ) { } public void setGrammarResolver ( GrammarResolver grammarResolver ) { } public void startNamespaceDeclScope ( int prefix , int uri ) { } public void endNamespaceDeclScope ( int prefix ) { } private String resolvePrefixToURI ( String prefix ) throws Exception { } public TraverseSchema ( Element root , StringPool stringPool , SchemaGrammar schemaGrammar , GrammarResolver grammarResolver , XMLErrorReporter errorReporter , String schemaURL , EntityResolver entityResolver ) throws Exception { } public TraverseSchema ( Element root , StringPool stringPool , SchemaGrammar schemaGrammar , GrammarResolver grammarResolver , XMLErrorReporter errorReporter , String schemaURL ) throws Exception { } public TraverseSchema ( Element root , StringPool stringPool , SchemaGrammar schemaGrammar , GrammarResolver grammarResolver ) throws Exception { } public void doTraverseSchema ( Element root , StringPool stringPool , SchemaGrammar schemaGrammar , GrammarResolver grammarResolver ) throws Exception { } private void checkTopLevelDuplicateNames ( Element root ) { } private void extractTopLevel3Components ( Element root ) { } private String expandSystemId ( String systemId , String currentSystemId ) throws Exception { } private static String fixURI ( String str ) { } private void traverseInclude ( Element includeDecl ) throws Exception { } private void traverseIncludedSchema ( Element root ) throws Exception { } private void traverseRedefine ( Element redefineDecl ) throws Exception { } private void renameRedefinedComponents ( Element redefineDecl , Element schemaToRedefine ) throws Exception { } private int changeRedefineGroup ( QName originalName , String elementSought , Element curr ) throws Exception { } private void fixRedefinedSchema ( String eltLocalname , String oldName , String newName , Element schemaToRedefine ) throws Exception { } private void traverseImport ( Element importDecl ) throws Exception { } private void traverseAnnotationDecl ( Element comment ) { } private Element checkContent ( Element elm , Element content , boolean isEmpty ) throws Exception { } private DatatypeValidator findDTValidator ( Element elm , String baseTypeStr ) throws Exception { } private int traverseSimpleTypeDecl ( Element simpleTypeDecl ) throws Exception { } private int traverseAny ( Element child ) throws Exception { } public DatatypeValidator getDatatypeValidator ( String uri , String localpart ) { } private XMLAttributeDecl traverseAnyAttribute ( Element anyAttributeDecl ) throws Exception { } private XMLAttributeDecl mergeTwoAnyAttribute ( XMLAttributeDecl oneAny , XMLAttributeDecl anotherAny ) { } int [ ] intersect2sets ( int [ ] one , int [ ] theOther ) { } private int traverseComplexTypeDecl ( Element complexTypeDecl ) throws Exception { } private void traverseSimpleContentDecl ( int typeNameIndex , Element simpleContentDecl , TraverseSchema . ComplexTypeInfo typeInfo ) throws Exception { } private void traverseComplexContentDecl ( int typeNameIndex , Element complexContentDecl , TraverseSchema . ComplexTypeInfo typeInfo , boolean mixedOnComplexTypeDecl ) throws Exception { } private void handleComplexTypeError ( String message , int typeNameIndex , TraverseSchema . ComplexTypeInfo typeInfo ) throws Exception { } private String genAnonTypeName ( Element complexTypeDecl ) throws Exception { String typeName ; if ( fCurrentTypeNameStack . empty ( ) ) typeName = "#" + ( ( fAnonTypeCount ) ++ ) ; else { String parentName = ( ( Element ) ( complexTypeDecl . getParentNode ( ) ) ) . getAttribute ( ATT_NAME ) ; typeName = parentName + "_AnonType" ; int index = ( fCurrentTypeNameStack . size ( ) ) - 1 ; for ( int i = index ; i > ( - 1 ) ; i -- ) { <START_BUG> String parentType = ( ( String ) ( fCurrentTypeNameStack . get ( i ) ) ) ; <END_BUG> typeName = ( parentType + "_" ) + typeName ; if ( ! ( parentType . startsWith ( "#" ) ) ) break ; } typeName = "#" + typeName ; } return typeName ; } private QName parseBase ( String base ) throws Exception { } private boolean baseFromAnotherSchema ( QName baseName ) throws Exception { } private void processBaseTypeInfo ( QName baseName , TraverseSchema . ComplexTypeInfo typeInfo ) throws Exception { } private void processComplexContent ( int typeNameIndex , Element complexContentChild , TraverseSchema . ComplexTypeInfo typeInfo , QName baseName , boolean isMixed ) throws Exception { } private void processAttributes ( Element attrNode , QName baseName , TraverseSchema . ComplexTypeInfo typeInfo ) throws Exception { } private boolean isAttrOrAttrGroup ( Element e ) { } private void checkRecursingComplexType ( ) throws Exception { } private void checkParticleDerivationOK ( Element derivedTypeNode , Element baseTypeNode ) { } private int importContentSpec ( SchemaGrammar aGrammar , int contentSpecHead ) throws Exception { } private int expandContentModel ( int index , Element particle ) throws Exception { } private int traverseAttributeDecl ( Element attrDecl , TraverseSchema . ComplexTypeInfo typeInfo , boolean referredTo ) throws Exception { } private int addAttributeDeclFromAnotherSchema ( String name , String uriStr , TraverseSchema . ComplexTypeInfo typeInfo ) throws Exception { } private int traverseAttributeGroupDecl ( Element attrGrpDecl , TraverseSchema . ComplexTypeInfo typeInfo , Vector anyAttDecls ) throws Exception { } private int traverseAttributeGroupDeclFromAnotherSchema ( String attGrpName , String uriStr , TraverseSchema . ComplexTypeInfo typeInfo , Vector anyAttDecls ) throws Exception { } private Element findAttributeSimpleType ( Element attrDecl ) throws Exception { } private QName traverseElementDecl ( Element elementDecl ) throws Exception { } private void traverseIdentityConstraintsFor ( int elementIndex , Vector identityConstraints ) throws Exception { } private void traverseUnique ( Element uelem , XMLElementDecl edecl ) throws Exception { } private void traverseKey ( Element kelem , XMLElementDecl edecl ) throws Exception { } private void traverseKeyRef ( Element krelem , XMLElementDecl edecl ) throws Exception { }

Fix:
String parentType = ( ( String ) ( fCurrentTypeNameStack . elementAt ( i ) ) ) ;