Buggy code:
protected Object getGlobalDeclFromGrammar ( SchemaGrammar sGrammar , int declType , String localpart , String schemaLoc ) { } protected Object traverseGlobalDecl ( int declType , Element decl , XSDocumentInfo schemaDoc , SchemaGrammar grammar ) { } public String schemaDocument2SystemId ( XSDocumentInfo schemaDoc ) { } Object getGrpOrAttrGrpRedefinedByRestriction ( int type , QName name , XSDocumentInfo currSchema , Element elmNode ) { } protected void resolveKeyRefs ( ) { } protected Hashtable getIDRegistry ( ) { } protected Hashtable getIDRegistry_sub ( ) { } protected void storeKeyRef ( Element keyrefToStore , XSDocumentInfo schemaDoc , XSElementDecl currElemDecl ) { } private Element resolveSchema ( XSDDescription desc , boolean mustResolve , Element referElement , boolean usePairs ) { } private Element resolveSchema ( XMLInputSource schemaSource , XSDDescription desc , boolean mustResolve , Element referElement ) { } private XMLInputSource resolveSchemaSource ( XSDDescription desc , boolean mustResolve , Element referElement , boolean usePairs ) { } private Element getSchemaDocument ( String schemaNamespace , XMLInputSource schemaSource , boolean mustResolve , short referType , Element referElement ) { } private Element getSchemaDocument ( String schemaNamespace , SAXInputSource schemaSource , boolean mustResolve , short referType , Element referElement ) { } private Element getSchemaDocument ( String schemaNamespace , DOMInputSource schemaSource , boolean mustResolve , short referType , Element referElement ) { } private Element getSchemaDocument ( String schemaNamespace , StAXInputSource schemaSource , boolean mustResolve , short referType , Element referElement ) { } private Element getSchemaDocument0 ( XSDHandler . XSDKey key , String schemaId , Element schemaElement ) { } private Element getSchemaDocument1 ( boolean mustResolve , boolean hasInput , XMLInputSource schemaSource , Element referElement , IOException ioe ) { } private Element getSchemaDocument ( XSInputSource schemaSource , XSDDescription desc ) { } private Vector expandGrammars ( SchemaGrammar [ ] grammars ) { } private boolean existingGrammars ( Vector grammars ) { } private boolean canAddComponents ( Vector components ) { } private boolean canAddComponent ( XSObject component , XSDDescription desc ) { } private void addGrammars ( Vector grammars ) { } private void addGrammarComponents ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private SchemaGrammar createGrammarFrom ( SchemaGrammar grammar ) { } private void addNewGrammarLocations ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private void addNewImportedGrammars ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private void updateImportList ( Vector importedSrc , Vector importedDst ) { } private void addNewGrammarComponents ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private void addGlobalElementDecls ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private void addGlobalAttributeDecls ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private void addGlobalAttributeGroupDecls ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private void addGlobalNotationDecls ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private void addGlobalGroupDecls ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private void addGlobalTypeDecls ( SchemaGrammar srcGrammar , SchemaGrammar dstGrammar ) { } private Vector expandComponents ( XSObject [ ] components , Hashtable dependencies ) { } private void expandRelatedComponents ( XSObject component , Vector componentList , Hashtable dependencies ) { } private void expandRelatedAttributeComponents ( XSAttributeDeclaration decl , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedElementComponents ( XSElementDeclaration decl , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedTypeComponents ( XSTypeDefinition type , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedModelGroupDefinitionComponents ( XSModelGroupDefinition modelGroupDef , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedAttributeGroupComponents ( XSAttributeGroupDefinition attrGroup , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedComplexTypeComponents ( XSComplexTypeDecl type , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedSimpleTypeComponents ( XSSimpleTypeDefinition type , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedAttributeUsesComponents ( XSObjectList attrUses , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedAttributeUseComponents ( XSAttributeUse component , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedParticleComponents ( XSParticle component , Vector componentList , String namespace , Hashtable dependencies ) { } private void expandRelatedModelGroupComponents ( XSModelGroup modelGroup , Vector componentList , String namespace , Hashtable dependencies ) { } private void addRelatedType ( XSTypeDefinition type , Vector componentList , String namespace , Hashtable dependencies ) { if ( ! ( type . getAnonymous ( ) ) ) { <START_BUG> if ( ! ( type . getNamespace ( ) . equals ( URI_SCHEMAFORSCHEMA ) ) ) { <END_BUG> if ( ! ( componentList . contains ( type ) ) ) { final Vector importedNamespaces = findDependentNamespaces ( namespace , dependencies ) ; addNamespaceDependency ( namespace , type . getNamespace ( ) , importedNamespaces ) ; componentList . add ( type ) ; } } } else { expandRelatedTypeComponents ( type , componentList , namespace , dependencies ) ; } } private void addRelatedElement ( XSElementDeclaration decl , Vector componentList , String namespace , Hashtable dependencies ) { } private void addRelatedAttribute ( XSAttributeDeclaration decl , Vector componentList , String namespace , Hashtable dependencies ) { } private void addGlobalComponents ( Vector components , Hashtable importDependencies ) { } private void addGlobalComponent ( XSObject component , XSDDescription desc ) { } private void updateImportDependencies ( Hashtable table ) { } private void expandImportList ( String namespace , Vector namespaceList ) { } private void addImportList ( SchemaGrammar sg , Vector importedGrammars , Vector namespaceList ) { } private void updateImportList ( SchemaGrammar sg , Vector importedGrammars , Vector namespaceList ) { } private boolean containedImportedGrammar ( Vector importedGrammar , SchemaGrammar grammar ) { } private SchemaGrammar getSchemaGrammar ( XSDDescription desc ) { } private Vector findDependentNamespaces ( String namespace , Hashtable table ) { } private void addNamespaceDependency ( String namespace1 , String namespace2 , Vector list ) { } private void reportSharingError ( String namespace , String name ) { } private void createTraversers ( ) { } void prepareForParse ( ) { }

Fix:
if ( ! ( URI_SCHEMAFORSCHEMA . equals ( type . getNamespace ( ) ) ) ) {