Program: 44061
Project: 44061
Buggy source:
/** 
 * Parses the all elements.
 * @param tagName the tag name
 * @param srcDoc the src doc
 * @param xsdDocument parses "element" nodes from the document and constructs its POJO representation. sticks the annotation associated with the element.
 */
private void parseAllElements(String tagName,Document srcDoc,XSDDocument xsdDocument){
  logger.log(Level.FINER,"String_Node_Str",new Object[]{tagName,srcDoc,xsdDocument});
  List<Element> elements=new ArrayList<Element>();
  String[] strs=tagName.split("String_Node_Str");
  String nsprefix=strs[0] + "String_Node_Str";
  NodeList domElements=srcDoc.getElementsByTagName(tagName);
  int noOfDomElements=domElements.getLength();
  for (int i=0; i < noOfDomElements; i++) {
    org.w3c.dom.Element obj=(org.w3c.dom.Element)domElements.item(i);
    String name=obj.getAttribute("String_Node_Str");
    String type=obj.getAttribute("String_Node_Str");
    String[] typeParts=type.split("String_Node_Str");
    if (typeParts != null && typeParts.length > 1)     type=typeParts[1];
    Element elem=new Element();
    elem.setName(name);
    elem.setType(type);
    List<Element> instances=(List<Element>)typeElementsMap.get(type);
    if (instances == null) {
      instances=new ArrayList<Element>();
      instances.add(elem);
      typeElementsMap.put(type,instances);
    }
 else {
      instances.add(elem);
      typeElementsMap.put(type,instances);
    }
    NamedNodeMap nameNodeMap=obj.getAttributes();
    int size=nameNodeMap.getLength();
    for (int j=0; j < size; j++) {
      Attr attr=(Attr)nameNodeMap.item(j);
      if (attr != null) {
        Attribute attribute=new Attribute();
        attribute.setName(attr.getName());
        attribute.setValue(attr.getValue());
        elem.getAttributes().add(attribute);
      }
    }
    elem.setAnnotationInfo(parseAnnotation(obj));
    elements.add(elem);
    xsdDocument.addIndependentElement(elem);
    logger.log(Level.FINER,"String_Node_Str",xsdDocument);
  }
}

Fixed version (ground truth):
/** 
 * Parses the all elements.
 * @param tagName the tag name
 * @param srcDoc the src doc
 * @param xsdDocument parses "element" nodes from the document and constructs its POJO representation. sticks the annotation associated with the element.
 */
private void parseAllElements(String tagName,Document srcDoc,XSDDocument xsdDocument){
  logger.log(Level.FINER,"String_Node_Str",new Object[]{tagName,srcDoc,xsdDocument});
  List<Element> elements=new ArrayList<Element>();
  NodeList domElements=srcDoc.getElementsByTagName(tagName);
  int noOfDomElements=domElements.getLength();
  for (int i=0; i < noOfDomElements; i++) {
    org.w3c.dom.Element obj=(org.w3c.dom.Element)domElements.item(i);
    String name=obj.getAttribute("String_Node_Str");
    String type=obj.getAttribute("String_Node_Str");
    String[] typeParts=type.split("String_Node_Str");
    if (typeParts != null && typeParts.length > 1)     type=typeParts[1];
    Element elem=new Element();
    elem.setName(name);
    elem.setType(type);
    String prevComment=Utils.getPreviousComment(obj);
    String nextComment=Utils.getNextComment(obj);
    if (prevComment != null || nextComment != null) {
      Comment comment=new Comment();
      comment.setNextComment(nextComment);
      comment.setPreviousComment(prevComment);
      elem.setComment(comment);
    }
    List<Element> instances=(List<Element>)typeElementsMap.get(type);
    if (instances == null) {
      instances=new ArrayList<Element>();
      instances.add(elem);
      typeElementsMap.put(type,instances);
    }
 else {
      instances.add(elem);
      typeElementsMap.put(type,instances);
    }
    NamedNodeMap nameNodeMap=obj.getAttributes();
    int size=nameNodeMap.getLength();
    for (int j=0; j < size; j++) {
      Attr attr=(Attr)nameNodeMap.item(j);
      if (attr != null) {
        Attribute attribute=new Attribute();
        attribute.setName(attr.getName());
        attribute.setValue(attr.getValue());
        elem.getAttributes().add(attribute);
      }
    }
    elem.setAnnotationInfo(parseAnnotation(obj));
    elements.add(elem);
    xsdDocument.addIndependentElement(elem);
    logger.log(Level.FINER,"String_Node_Str",xsdDocument);
  }
}