Program: 48090
Project: 48090
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.
 * @throws PAOSConnectionException
 */
public StartPAOSResponse sendStartPAOS(StartPAOS message) throws DispatcherException, PAOSException, PAOSConnectionException {
  Object msg=message;
  StreamHttpClientConnection conn=null;
  HttpContext ctx=new BasicHttpContext();
  HttpRequestExecutor httpexecutor=new HttpRequestExecutor();
  DefaultConnectionReuseStrategy reuse=new DefaultConnectionReuseStrategy();
  boolean firstLoop=true;
  boolean connectionDropped=false;
  try {
    while (true) {
      if (!firstLoop && tlsHandler.isSameChannel()) {
        throw new PAOSException(CONNECTION_CLOSED);
      }
      firstLoop=false;
      conn=openHttpStream();
      boolean isReusable;
      try {
        do {
          String resource=tlsHandler.getResource();
          BasicHttpEntityEnclosingRequest req=new BasicHttpEntityEnclosingRequest("String_Node_Str",resource);
          req.setParams(conn.getParams());
          HttpRequestHelper.setDefaultHeader(req,tlsHandler.getServerAddress());
          req.setHeader(HEADER_KEY_PAOS,headerValuePaos);
          req.setHeader("String_Node_Str","String_Node_Str");
          ContentType reqContentType=ContentType.create("String_Node_Str","String_Node_Str");
          HttpUtils.dumpHttpRequest(logger,"String_Node_Str",req);
          String reqMsgStr=createPAOSResponse(msg);
          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(statusCode);
          conn.receiveResponseEntity(response);
          HttpEntity entity=response.getEntity();
          byte[] entityData=FileUtils.toByteArray(entity.getContent());
          HttpUtils.dumpHttpResponse(logger,response,entityData);
          Object requestObj=processPAOSRequest(new ByteArrayInputStream(entityData));
          if (requestObj instanceof StartPAOSResponse) {
            StartPAOSResponse startPAOSResponse=(StartPAOSResponse)requestObj;
            WSHelper.checkResult(startPAOSResponse);
            return startPAOSResponse;
          }
          msg=dispatcher.deliver(requestObj);
          isReusable=reuse.keepAlive(response,ctx);
          connectionDropped=false;
        }
 while (isReusable);
      }
 catch (      IOException ex) {
        if (!connectionDropped) {
          connectionDropped=true;
          logger.warn("String_Node_Str");
        }
 else {
          String errMsg="String_Node_Str";
          logger.error(errMsg);
          throw new PAOSException(DELIVERY_FAILED,ex);
        }
      }
    }
  }
 catch (  HttpException ex) {
    throw new PAOSException(DELIVERY_FAILED,ex);
  }
catch (  SOAPException ex) {
    throw new PAOSException(SOAP_MESSAGE_FAILURE,ex);
  }
catch (  MarshallingTypeException ex) {
    throw new PAOSDispatcherException(MARSHALLING_ERROR,ex);
  }
catch (  InvocationTargetException ex) {
    throw new PAOSDispatcherException(DISPATCHER_ERROR,ex);
  }
catch (  TransformerException ex) {
    throw new DispatcherException(ex);
  }
catch (  WSException ex) {
    throw new PAOSException(ex);
  }
 finally {
    try {
      if (conn != null) {
        conn.close();
      }
    }
 catch (    IOException 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.
 * @throws PAOSConnectionException
 */
public StartPAOSResponse sendStartPAOS(StartPAOS message) throws DispatcherException, PAOSException, PAOSConnectionException {
  Object msg=message;
  StreamHttpClientConnection conn=null;
  HttpContext ctx=new BasicHttpContext();
  HttpRequestExecutor httpexecutor=new HttpRequestExecutor();
  DefaultConnectionReuseStrategy reuse=new DefaultConnectionReuseStrategy();
  boolean firstLoop=true;
  boolean connectionDropped=false;
  ResponseBaseType lastResponse=new ResponseBaseType();
  try {
    while (true) {
      if (!firstLoop && tlsHandler.isSameChannel()) {
        throw new PAOSException(CONNECTION_CLOSED);
      }
      firstLoop=false;
      conn=openHttpStream();
      boolean isReusable;
      try {
        do {
          if (msg instanceof ResponseBaseType) {
            lastResponse=(ResponseBaseType)msg;
          }
          String resource=tlsHandler.getResource();
          BasicHttpEntityEnclosingRequest req=new BasicHttpEntityEnclosingRequest("String_Node_Str",resource);
          req.setParams(conn.getParams());
          HttpRequestHelper.setDefaultHeader(req,tlsHandler.getServerAddress());
          req.setHeader(HEADER_KEY_PAOS,headerValuePaos);
          req.setHeader("String_Node_Str","String_Node_Str");
          ContentType reqContentType=ContentType.create("String_Node_Str","String_Node_Str");
          HttpUtils.dumpHttpRequest(logger,"String_Node_Str",req);
          String reqMsgStr=createPAOSResponse(msg);
          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(statusCode);
          conn.receiveResponseEntity(response);
          HttpEntity entity=response.getEntity();
          byte[] entityData=FileUtils.toByteArray(entity.getContent());
          HttpUtils.dumpHttpResponse(logger,response,entityData);
          Object requestObj=processPAOSRequest(new ByteArrayInputStream(entityData));
          if (requestObj instanceof StartPAOSResponse) {
            StartPAOSResponse startPAOSResponse=(StartPAOSResponse)requestObj;
            WSHelper.checkResult(startPAOSResponse);
            WSHelper.checkResult(lastResponse);
            return startPAOSResponse;
          }
          msg=dispatcher.deliver(requestObj);
          isReusable=reuse.keepAlive(response,ctx);
          connectionDropped=false;
        }
 while (isReusable);
      }
 catch (      IOException ex) {
        if (!connectionDropped) {
          connectionDropped=true;
          logger.warn("String_Node_Str");
        }
 else {
          String errMsg="String_Node_Str";
          logger.error(errMsg);
          throw new PAOSException(DELIVERY_FAILED,ex);
        }
      }
    }
  }
 catch (  HttpException ex) {
    throw new PAOSException(DELIVERY_FAILED,ex);
  }
catch (  SOAPException ex) {
    throw new PAOSException(SOAP_MESSAGE_FAILURE,ex);
  }
catch (  MarshallingTypeException ex) {
    throw new PAOSDispatcherException(MARSHALLING_ERROR,ex);
  }
catch (  InvocationTargetException ex) {
    throw new PAOSDispatcherException(DISPATCHER_ERROR,ex);
  }
catch (  TransformerException ex) {
    throw new DispatcherException(ex);
  }
catch (  WSException ex) {
    throw new PAOSException(ex);
  }
 finally {
    try {
      if (conn != null) {
        conn.close();
      }
    }
 catch (    IOException ex) {
    }
  }
}