Program: 4640
Project: 4640
Buggy source:
/** 
 * There are two possible places for important document information  may be stored.  1. it may be in the root element. In which case the root variable should be set as true. In this case all the important doc info will be remembered, and any non-doc info present as attributes will be put into the hashmap <p> The other possible place is at the (only) child of the root element. If this is the node that is being passed. then root variable should be set to false. In this case. Just the doc info is grabbed. The non-doc info of a non-doc Node is not even looked at in this method. <p>  For this method to be effective, keep the following points in mind. The doc info mey be either in the root alone or in both the root and the only child of root. If it is only in root - call this method on  root, and create map on root. <p> If the doc-info is spread out b/w the root and the child. First call this method with root, then call it with child, and then  call createMap wht root. This will ensure no loss of data
 */
private void grabDocInfo(Node docElement,boolean root) throws SchemaNotFoundException, IOException {
  if (docElement == null)   throw new IOException("String_Node_Str");
  List attributes=LimeXMLUtils.getAttributes(docElement.getAttributes());
  int size=attributes.size();
  for (int i=0; i < size; i++) {
    Node att=(Node)attributes.get(i);
    String attName=att.getNodeName();
    String lowerAttName=attName.toLowerCase();
    if (lowerAttName.indexOf("String_Node_Str") >= 0)     schemaUri=att.getNodeValue();
 else     if (lowerAttName.indexOf(XML_ID_ATTRIBUTE_STRING) >= 0) {
      identifier=att.getNodeValue();
      Element e=(Element)docElement;
      e.removeAttribute(attName);
    }
 else     if (lowerAttName.indexOf("String_Node_Str") >= 0)     action=att.getNodeValue();
 else     if (lowerAttName.indexOf("String_Node_Str") >= 0) {
      Element e=(Element)docElement;
      e.removeAttribute(attName);
    }
 else {
      if (root) {
        String canonicalizedAttName=docElement.getNodeName() + XMLStringUtils.DELIMITER + att.getNodeName()+ XMLStringUtils.DELIMITER;
        fieldToValue.put(canonicalizedAttName.trim(),att.getNodeValue().trim());
      }
    }
  }
  if (schemaUri == null)   throw new SchemaNotFoundException();
}

Fixed version (ground truth):
/** 
 * There are two possible places for important document information  may be stored.  1. it may be in the root element. In which case the root variable should be set as true. In this case all the important doc info will be remembered, and any non-doc info present as attributes will be put into the hashmap <p> The other possible place is at the (only) child of the root element. If this is the node that is being passed. then root variable should be set to false. In this case. Just the doc info is grabbed. The non-doc info of a non-doc Node is not even looked at in this method. <p>  For this method to be effective, keep the following points in mind. The doc info mey be either in the root alone or in both the root and the only child of root. If it is only in root - call this method on  root, and create map on root. <p> If the doc-info is spread out b/w the root and the child. First call this method with root, then call it with child, and then  call createMap wht root. This will ensure no loss of data
 */
private void grabDocInfo(Node docElement,boolean root) throws SchemaNotFoundException, IOException {
  if (docElement == null)   throw new IOException("String_Node_Str");
  NamedNodeMap nnm=docElement.getAttributes();
  if (nnm == null)   throw new IOException("String_Node_Str");
  List attributes=LimeXMLUtils.getAttributes(nnm);
  int size=attributes.size();
  for (int i=0; i < size; i++) {
    Node att=(Node)attributes.get(i);
    String attName=att.getNodeName();
    String lowerAttName=attName.toLowerCase();
    if (lowerAttName.indexOf("String_Node_Str") >= 0)     schemaUri=att.getNodeValue();
 else     if (lowerAttName.indexOf(XML_ID_ATTRIBUTE_STRING) >= 0) {
      identifier=att.getNodeValue();
      Element e=(Element)docElement;
      e.removeAttribute(attName);
    }
 else     if (lowerAttName.indexOf("String_Node_Str") >= 0)     action=att.getNodeValue();
 else     if (lowerAttName.indexOf("String_Node_Str") >= 0) {
      Element e=(Element)docElement;
      e.removeAttribute(attName);
    }
 else {
      if (root) {
        String canonicalizedAttName=docElement.getNodeName() + XMLStringUtils.DELIMITER + att.getNodeName()+ XMLStringUtils.DELIMITER;
        fieldToValue.put(canonicalizedAttName.trim(),att.getNodeValue().trim());
      }
    }
  }
  if (schemaUri == null)   throw new SchemaNotFoundException();
}