Program: 123892
Project: 123892
Buggy source:
/** 
 * invoke soap and return the response document
 */
public Document extractContentAsDocument(String version,String destination,String soapAction,String soapMessage) throws SOAPException, TransformerException, ParserConfigurationException, FileNotFoundException {
  MessageFactory messageFactory=null;
  if (version.equals(SOAP12)) {
    messageFactory=MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
  }
 else {
    messageFactory=MessageFactory.newInstance();
  }
  SOAPMessage message=messageFactory.createMessage();
  MimeHeaders mimeHeaders=message.getMimeHeaders();
  mimeHeaders.setHeader("String_Node_Str",soapAction);
  SOAPPart soapPart=message.getSOAPPart();
  ByteArrayInputStream stream=new ByteArrayInputStream(soapMessage.getBytes());
  StreamSource preppedMsgSrc=new StreamSource(stream);
  soapPart.setContent(preppedMsgSrc);
  message.saveChanges();
  SOAPMessage reply=connection.call(message,destination);
  SOAPPart reSoapPart=reply.getSOAPPart();
  reSoapPart.getNamespaceURI();
  SOAPEnvelope reEnvelope=reSoapPart.getEnvelope();
  Document document;
  DocumentBuilderFactory factory=new com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl();
  factory.setNamespaceAware(true);
  DocumentBuilder builder=factory.newDocumentBuilder();
  document=builder.newDocument();
  Element element;
  Element envelopeRootElem=document.createElement(reEnvelope.getNodeName());
  if (reEnvelope.getNamespaceURI() != null && reEnvelope.getPrefix() != null) {
    envelopeRootElem.setAttribute("String_Node_Str" + reEnvelope.getPrefix(),reEnvelope.getNamespaceURI());
  }
  Iterator childElements=reEnvelope.getChildElements();
  org.w3c.dom.Node domNode=null;
  while (childElements.hasNext()) {
    domNode=(org.w3c.dom.Node)childElements.next();
    element=(Element)document.importNode(domNode,true);
    envelopeRootElem.appendChild(element);
  }
  document.appendChild(envelopeRootElem);
  return document;
}

Fixed version (ground truth):
/** 
 * invoke soap and return the response document
 */
public String extractContentAsDocument(String version,String destination,String soapAction,String soapMessage) throws SOAPException, TransformerException, ParserConfigurationException, FileNotFoundException {
  MessageFactory messageFactory=null;
  if (version.equals(SOAP12)) {
    messageFactory=MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
  }
 else {
    messageFactory=MessageFactory.newInstance();
  }
  SOAPMessage message=messageFactory.createMessage();
  MimeHeaders mimeHeaders=message.getMimeHeaders();
  mimeHeaders.setHeader("String_Node_Str",soapAction);
  SOAPPart soapPart=message.getSOAPPart();
  ByteArrayInputStream stream=new ByteArrayInputStream(soapMessage.getBytes());
  StreamSource preppedMsgSrc=new StreamSource(stream);
  soapPart.setContent(preppedMsgSrc);
  message.saveChanges();
  SOAPMessage reply=connection.call(message,destination);
  SOAPPart reSoapPart=reply.getSOAPPart();
  try {
    TransformerFactory tf=TransformerFactory.newInstance();
    Transformer t=tf.newTransformer();
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    t.transform(reSoapPart.getContent(),new StreamResult(bos));
    return bos.toString();
  }
 catch (  Exception e) {
    e.printStackTrace();
    return null;
  }
}