Program: 48185
Project: 48185
Buggy source:
/** 
 * Sends start PAOS and answers all successor messages to the server associated with this instance. Messages are exchanged until the server replies with a   {@code StartPAOSResponse} message.
 * @param message The StartPAOS message which is sent in the first message.
 * @return The {@code StartPAOSResponse} message from the server.
 * @throws DispatcherException In case there errors with the message conversion or the dispatcher.
 * @throws PAOSException In case there were errors in the transport layer.
 */
public StartPAOSResponse sendStartPAOS(StartPAOS message) throws DispatcherException, PAOSException {
  Object msg=message;
  String hostname=endpoint.getHost();
  int port=endpoint.getPort();
  if (port == -1) {
    port=endpoint.getDefaultPort();
  }
  String resource=endpoint.getFile();
  try {
    while (true) {
      Socket socket=ProxySettings.getDefault().getSocket(hostname,port);
      StreamHttpClientConnection conn;
      if (tlsClient != null) {
        InputStream sockIn=socket.getInputStream();
        OutputStream sockOut=socket.getOutputStream();
        TlsProtocolHandler handler=new TlsProtocolHandler(sockIn,sockOut);
        handler.connect(tlsClient);
        conn=new StreamHttpClientConnection(handler.getInputStream(),handler.getOutputStream());
      }
 else {
        conn=new StreamHttpClientConnection(socket.getInputStream(),socket.getOutputStream());
      }
      HttpContext ctx=new BasicHttpContext();
      HttpRequestExecutor httpexecutor=new HttpRequestExecutor();
      DefaultConnectionReuseStrategy reuse=new DefaultConnectionReuseStrategy();
      boolean isReusable;
      do {
        BasicHttpEntityEnclosingRequest req=new BasicHttpEntityEnclosingRequest("String_Node_Str",resource);
        req.setParams(conn.getParams());
        HttpRequestHelper.setDefaultHeader(req,hostname);
        String reqMsgStr=createPAOSResponse(msg);
        req.setHeader(ECardConstants.HEADER_KEY_PAOS,ECardConstants.HEADER_VALUE_PAOS);
        req.setHeader("String_Node_Str","String_Node_Str");
        ContentType reqContentType=ContentType.create("String_Node_Str","String_Node_Str");
        StringEntity reqMsg=new StringEntity(reqMsgStr,reqContentType);
        req.setEntity(reqMsg);
        req.setHeader(reqMsg.getContentType());
        req.setHeader("String_Node_Str",Long.toString(reqMsg.getContentLength()));
        HttpResponse response=httpexecutor.execute(req,conn,ctx);
        int statusCode=response.getStatusLine().getStatusCode();
        checkHTTPStatusCode(msg,statusCode);
        conn.receiveResponseEntity(response);
        HttpEntity entity=response.getEntity();
        Object requestObj=processPAOSRequest(entity.getContent());
        if (requestObj instanceof StartPAOSResponse) {
          StartPAOSResponse startPAOSResponse=(StartPAOSResponse)requestObj;
          WSHelper.checkResult(startPAOSResponse);
          return startPAOSResponse;
        }
        msg=dispatcher.deliver(requestObj);
        isReusable=reuse.keepAlive(response,ctx);
      }
 while (isReusable);
    }
  }
 catch (  HttpException ex) {
    throw new PAOSException("String_Node_Str",ex);
  }
catch (  IOException ex) {
    throw new PAOSException(ex);
  }
catch (  SOAPException ex) {
    throw new PAOSException("String_Node_Str",ex);
  }
catch (  URISyntaxException ex) {
    throw new PAOSException("String_Node_Str",ex);
  }
catch (  MarshallingTypeException ex) {
    throw new DispatcherException("String_Node_Str",ex);
  }
catch (  InvocationTargetException ex) {
    throw new DispatcherException("String_Node_Str",ex);
  }
catch (  TransformerException ex) {
    throw new DispatcherException(ex);
  }
catch (  WSException ex) {
    throw new PAOSException(ex);
  }
}

Fixed version (ground truth):
/** 
 * Sends start PAOS and answers all successor messages to the server associated with this instance. Messages are exchanged until the server replies with a   {@code StartPAOSResponse} message.
 * @param message The StartPAOS message which is sent in the first message.
 * @return The {@code StartPAOSResponse} message from the server.
 * @throws DispatcherException In case there errors with the message conversion or the dispatcher.
 * @throws PAOSException In case there were errors in the transport layer.
 */
public StartPAOSResponse sendStartPAOS(StartPAOS message) throws DispatcherException, PAOSException {
  Object msg=message;
  String hostname=endpoint.getHost();
  int port=endpoint.getPort();
  if (port == -1) {
    port=endpoint.getDefaultPort();
  }
  String resource=endpoint.getFile();
  try {
    while (true) {
      StreamHttpClientConnection conn;
      try {
        conn=createTlsConnection(hostname,port,ProtocolVersion.TLSv11);
      }
 catch (      IOException ex) {
        logger.error("String_Node_Str",ex);
        conn=createTlsConnection(hostname,port,ProtocolVersion.TLSv10);
      }
      HttpContext ctx=new BasicHttpContext();
      HttpRequestExecutor httpexecutor=new HttpRequestExecutor();
      DefaultConnectionReuseStrategy reuse=new DefaultConnectionReuseStrategy();
      boolean isReusable;
      do {
        BasicHttpEntityEnclosingRequest req=new BasicHttpEntityEnclosingRequest("String_Node_Str",resource);
        req.setParams(conn.getParams());
        HttpRequestHelper.setDefaultHeader(req,hostname);
        String reqMsgStr=createPAOSResponse(msg);
        req.setHeader(ECardConstants.HEADER_KEY_PAOS,ECardConstants.HEADER_VALUE_PAOS);
        req.setHeader("String_Node_Str","String_Node_Str");
        ContentType reqContentType=ContentType.create("String_Node_Str","String_Node_Str");
        StringEntity reqMsg=new StringEntity(reqMsgStr,reqContentType);
        req.setEntity(reqMsg);
        req.setHeader(reqMsg.getContentType());
        req.setHeader("String_Node_Str",Long.toString(reqMsg.getContentLength()));
        HttpResponse response=httpexecutor.execute(req,conn,ctx);
        int statusCode=response.getStatusLine().getStatusCode();
        checkHTTPStatusCode(msg,statusCode);
        conn.receiveResponseEntity(response);
        HttpEntity entity=response.getEntity();
        Object requestObj=processPAOSRequest(entity.getContent());
        if (requestObj instanceof StartPAOSResponse) {
          StartPAOSResponse startPAOSResponse=(StartPAOSResponse)requestObj;
          WSHelper.checkResult(startPAOSResponse);
          return startPAOSResponse;
        }
        msg=dispatcher.deliver(requestObj);
        isReusable=reuse.keepAlive(response,ctx);
      }
 while (isReusable);
    }
  }
 catch (  HttpException ex) {
    throw new PAOSException("String_Node_Str",ex);
  }
catch (  IOException ex) {
    throw new PAOSException(ex);
  }
catch (  SOAPException ex) {
    throw new PAOSException("String_Node_Str",ex);
  }
catch (  URISyntaxException ex) {
    throw new PAOSException("String_Node_Str",ex);
  }
catch (  MarshallingTypeException ex) {
    throw new DispatcherException("String_Node_Str",ex);
  }
catch (  InvocationTargetException ex) {
    throw new DispatcherException("String_Node_Str",ex);
  }
catch (  TransformerException ex) {
    throw new DispatcherException(ex);
  }
catch (  WSException ex) {
    throw new PAOSException(ex);
  }
}