Program: 44026
Project: 44026
Buggy source:
private void mergeImportedXsd(Document document,XSDDocument xsdDocument,String tagName) throws ParserException, SAXException, IOException {
  if (document != null) {
    NodeList nodes=document.getElementsByTagNameNS("String_Node_Str",tagName);
    if (nodes != null) {
      for (int i=0; i < nodes.getLength(); i++) {
        org.w3c.dom.Element element=(org.w3c.dom.Element)nodes.item(i);
        if (element.hasAttribute("String_Node_Str")) {
          URL url=convertToURL(element.getAttribute("String_Node_Str"),xsdDocument.getDocumentURL());
          if (url != null) {
            String schemaLocation=url.toExternalForm();
            if (!xsdDocument.getXsdsProcessed().contains(schemaLocation)) {
              XSDParserImpl parser=Context.getContext().getNewXsdParser();
              XSDDocument parsedDocument=(XSDDocument)parser.parse(schemaLocation);
              for (              Element elem : parsedDocument.getAllIndependentElements()) {
                xsdDocument.addIndependentElement(elem);
              }
              for (              ComplexType elem : parsedDocument.getAllComplexTypes()) {
                xsdDocument.addComplexType(elem);
              }
              for (              SimpleType elem : parsedDocument.getAllSimpleTypes()) {
                xsdDocument.addSimpleType(elem);
              }
              xsdDocument.getAllEnums().addAll(parsedDocument.getAllEnums());
              xsdDocument.getElementComplexTypeMap().putAll(parsedDocument.getElementComplexTypeMap());
              xsdDocument.getParentToComplexTypeMap().putAll(parsedDocument.getParentToComplexTypeMap());
              xsdDocument.getXsdsProcessed().addAll(parsedDocument.getXsdsProcessed());
              xsdDocument.getXsdsProcessed().add(schemaLocation);
            }
          }
 else {
            Logger.getLogger(XSDParserImpl.class.getName()).log(Level.SEVERE,element.getAttribute("String_Node_Str") + "String_Node_Str");
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void mergeImportedXsd(Document document,XSDDocument xsdDocument,String tagName) throws ParserException, SAXException, IOException {
  if (document != null) {
    NodeList nodes=document.getElementsByTagNameNS("String_Node_Str",tagName);
    if (nodes != null) {
      for (int i=0; i < nodes.getLength(); i++) {
        org.w3c.dom.Element element=(org.w3c.dom.Element)nodes.item(i);
        if (element.hasAttribute("String_Node_Str")) {
          URL url=convertToURL(element.getAttribute("String_Node_Str"),xsdDocument.getDocumentURL());
          if (url != null) {
            String schemaLocation=url.toExternalForm();
            if (!xsdDocument.getXsdsProcessed().contains(schemaLocation)) {
              XSDParserImpl parser=Context.getContext().getNewXsdParser();
              XSDDocument parsedDocument=(XSDDocument)parser.parse(schemaLocation);
              for (              Element elem : parsedDocument.getAllIndependentElements()) {
                xsdDocument.addIndependentElement(elem);
              }
              for (              ComplexType elem : parsedDocument.getAllComplexTypes()) {
                ComplexType cType=xsdDocument.searchCType(elem.getName());
                if (cType != null && cType.getParentType() != null && cType.getParentType().equals(elem.getName())) {
                  if (cType.getChildElements() != null) {
                    cType.getChildElements().addAll(elem.getChildElements());
                  }
 else {
                    cType.setChildElements(elem.getChildElements());
                  }
                  if (cType.getAttributes() != null) {
                    cType.getAttributes().addAll(elem.getAttributes());
                  }
 else {
                    cType.setAttributes(elem.getAttributes());
                  }
                  if (cType.getInstanceElements() != null) {
                    cType.getInstanceElements().addAll(elem.getInstanceElements());
                  }
 else {
                    cType.setInstanceElements(elem.getInstanceElements());
                  }
                  cType.setParentType(null);
                }
 else {
                  xsdDocument.addComplexType(elem);
                }
              }
              for (              SimpleType elem : parsedDocument.getAllSimpleTypes()) {
                xsdDocument.addSimpleType(elem);
              }
              xsdDocument.getAllEnums().addAll(parsedDocument.getAllEnums());
              xsdDocument.getElementComplexTypeMap().putAll(parsedDocument.getElementComplexTypeMap());
              xsdDocument.getParentToComplexTypeMap().putAll(parsedDocument.getParentToComplexTypeMap());
              xsdDocument.getXsdsProcessed().addAll(parsedDocument.getXsdsProcessed());
              xsdDocument.getXsdsProcessed().add(schemaLocation);
            }
          }
 else {
            Logger.getLogger(XSDParserImpl.class.getName()).log(Level.SEVERE,element.getAttribute("String_Node_Str") + "String_Node_Str");
          }
        }
      }
    }
  }
}