Program: 115217
Project: 115217
Buggy source:
public Element mapGenericErrorConfirmation(String message,OpenClinicaException exception,HashMap<String,String> validations) throws Exception {
  DocumentBuilderFactory dbfac=DocumentBuilderFactory.newInstance();
  DocumentBuilder docBuilder=dbfac.newDocumentBuilder();
  Document document=docBuilder.newDocument();
  Element faultElement=document.createElementNS(this.SOAP_NAMESPACE,"String_Node_Str");
  Element faultCode=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  Element faultValue=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  faultValue.setTextContent("String_Node_Str");
  faultCode.appendChild(faultValue);
  faultElement.appendChild(faultCode);
  Element faultReason=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  Element faultText=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  faultText.setTextContent(exception.className + "String_Node_Str");
  faultReason.appendChild(faultText);
  faultElement.appendChild(faultReason);
  Element faultDetail=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  Element faultDetailMessage=document.createElementNS(CONNECTOR_NAMESPACE_V1,exception.className + "String_Node_Str");
  faultDetailMessage.setAttributeNS(this.XSL_NAMESPACE,"String_Node_Str",exception.className + "String_Node_Str");
  Element code=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  code.setTextContent(exception.errorID);
  Element reason=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  reason.setTextContent(exception.message);
  if ("String_Node_Str".equals(exception.className)) {
    faultDetailMessage.appendChild(reason);
    faultDetailMessage.appendChild(code);
  }
 else   if ("String_Node_Str".equals(exception.className)) {
    faultDetailMessage.appendChild(reason);
    faultDetailMessage.appendChild(code);
    java.util.Iterator itValidations=validations.entrySet().iterator();
    while (itValidations.hasNext()) {
      Map.Entry pair=(Map.Entry)itValidations.next();
      Element validationMessage=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
      Element inputName=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
      inputName.setTextContent((String)pair.getKey());
      validationMessage.appendChild(inputName);
      Element inputMessage=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
      inputMessage.setTextContent((String)pair.getValue());
      validationMessage.appendChild(inputMessage);
      faultDetailMessage.appendChild(validationMessage);
    }
  }
 else {
    faultDetailMessage.appendChild(code);
    faultDetailMessage.appendChild(reason);
  }
  faultDetail.appendChild(faultDetailMessage);
  faultElement.appendChild(faultDetail);
  return faultElement;
}

Fixed version (ground truth):
public Element mapGenericErrorConfirmation(String message,OpenClinicaException exception,HashMap<String,String> validations) throws Exception {
  DocumentBuilderFactory dbfac=DocumentBuilderFactory.newInstance();
  DocumentBuilder docBuilder=dbfac.newDocumentBuilder();
  Document document=docBuilder.newDocument();
  Element faultElement=document.createElementNS(this.SOAP_NAMESPACE,"String_Node_Str");
  Element faultCode=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  Element faultValue=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  faultValue.setTextContent("String_Node_Str");
  faultCode.appendChild(faultValue);
  faultElement.appendChild(faultCode);
  Element faultReason=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  Element faultText=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  faultText.setTextContent(exception.className + "String_Node_Str");
  faultReason.appendChild(faultText);
  faultElement.appendChild(faultReason);
  Element faultDetail=document.createElementNS(SOAP_NAMESPACE,"String_Node_Str");
  Element faultDetailMessage=document.createElementNS(CONNECTOR_NAMESPACE_V1,exception.className + "String_Node_Str");
  faultDetailMessage.setAttributeNS(this.XSL_NAMESPACE,"String_Node_Str",exception.className + "String_Node_Str");
  Element code=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  code.setTextContent(exception.errorID);
  Element reason=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
  reason.setTextContent(exception.message);
  if ("String_Node_Str".equals(exception.className)) {
    faultDetailMessage.appendChild(reason);
    faultDetailMessage.appendChild(code);
  }
 else   if ("String_Node_Str".equals(exception.className)) {
    faultDetailMessage.appendChild(reason);
    faultDetailMessage.appendChild(code);
    java.util.Iterator itValidations=validations.entrySet().iterator();
    while (itValidations.hasNext()) {
      Map.Entry pair=(Map.Entry)itValidations.next();
      Element validationMessage=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
      Element inputName=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
      inputName.setTextContent((String)pair.getKey());
      validationMessage.appendChild(inputName);
      Element inputMessage=document.createElementNS(CONNECTOR_NAMESPACE_V1,"String_Node_Str");
      inputMessage.setTextContent((String)pair.getValue());
      validationMessage.appendChild(inputMessage);
      faultDetailMessage.appendChild(validationMessage);
    }
  }
 else {
    faultDetailMessage.appendChild(reason);
    faultDetailMessage.appendChild(code);
  }
  faultDetail.appendChild(faultDetailMessage);
  faultElement.appendChild(faultDetail);
  return faultElement;
}