Program: 18225
Project: 18225
Buggy source:
/** 
 * Send a REST request
 * @param inMessage The request to send
 * @return <code>OutMessage</code> the response as an OutMessage object
 * @throws IOException 
 * @throws ClientProtocolException 
 */
private OutMessage sendRestRequest(InMessage inMessage) throws ClientProtocolException, IOException {
  DefaultHttpClient httpClient=new DefaultHttpClient();
  if (retryHandler != null) {
    httpClient.setHttpRequestRetryHandler(retryHandler);
  }
  HttpParams httpParams=httpClient.getParams();
  if (forwardHttpConnexionTimeoutMs > 0) {
    HttpConnectionParams.setConnectionTimeout(httpParams,this.forwardHttpConnexionTimeoutMs);
  }
  if (forwardHttpSocketTimeoutMs > 0) {
    HttpConnectionParams.setSoTimeout(httpParams,this.forwardHttpSocketTimeoutMs);
  }
  StringBuffer requestUrlBuffer=new StringBuffer();
  requestUrlBuffer.append(inMessage.buildCompleteUrl());
  if (inMessage.getQueryString() != null) {
    requestUrlBuffer.append("String_Node_Str");
    boolean firstParam=true;
    for (    QueryParam queryParam : inMessage.getQueryString().getQueryParams()) {
      if (!firstParam) {
        requestUrlBuffer.append("String_Node_Str");
      }
      requestUrlBuffer.append(queryParam.getName());
      requestUrlBuffer.append("String_Node_Str");
      requestUrlBuffer.append(queryParam.getValue().replace("String_Node_Str","String_Node_Str"));
      firstParam=false;
    }
  }
  logger.debug("String_Node_Str" + requestUrlBuffer.toString());
  HttpEntity httpEntity=new StringEntity(inMessage.getMessageContent().getRawContent());
  HttpUriRequest httpUriRequest;
  if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpGet(requestUrlBuffer.toString());
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    HttpPut httpPut=new HttpPut(requestUrlBuffer.toString());
    httpPut.setEntity(httpEntity);
    httpUriRequest=httpPut;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpDelete(requestUrlBuffer.toString());
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpOptions(requestUrlBuffer.toString());
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpOptions(requestUrlBuffer.toString());
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpOptions(requestUrlBuffer.toString());
  }
 else {
    HttpPost httpPost=new HttpPost(requestUrlBuffer.toString());
    httpPost.setEntity(httpEntity);
    httpUriRequest=httpPost;
  }
  setHeaders(inMessage,httpUriRequest);
  Date requestSendDate=new Date();
  HttpResponse clientResponse=httpClient.execute(httpUriRequest);
  Date responseSendDate=new Date();
  OutMessage outMessage=new OutMessage(clientResponse.getStatusLine().getStatusCode(),clientResponse.getStatusLine().getReasonPhrase());
  inMessage.setRequestTimeStamp(requestSendDate.getTime());
  outMessage.setResponseTimeStamp(responseSendDate.getTime());
  MessageContent messageContent=new MessageContent();
  InputStreamReader in=new InputStreamReader(clientResponse.getEntity().getContent());
  BufferedReader bin=new BufferedReader(in);
  StringBuffer responseBuffer=new StringBuffer();
  String line;
  do {
    line=bin.readLine();
    if (line != null) {
      responseBuffer.append(line);
    }
  }
 while (line != null);
  messageContent.setRawContent(responseBuffer.toString());
  messageContent.setSize(clientResponse.getEntity().getContentLength());
  if (clientResponse.getEntity().getContentType() != null) {
    messageContent.setMimeType(clientResponse.getEntity().getContentType().getValue());
  }
  outMessage.setMessageContent(messageContent);
  messageContent.setEncoding(clientResponse.getEntity().getContentEncoding().getValue());
  return outMessage;
}

Fixed version (ground truth):
/** 
 * Send a REST request
 * @param inMessage The request to send
 * @return <code>OutMessage</code> the response as an OutMessage object
 * @throws IOException 
 * @throws ClientProtocolException 
 */
private OutMessage sendRestRequest(InMessage inMessage) throws ClientProtocolException, IOException {
  DefaultHttpClient httpClient=new DefaultHttpClient();
  if (retryHandler != null) {
    httpClient.setHttpRequestRetryHandler(retryHandler);
  }
  HttpParams httpParams=httpClient.getParams();
  if (forwardHttpConnexionTimeoutMs > 0) {
    HttpConnectionParams.setConnectionTimeout(httpParams,this.forwardHttpConnexionTimeoutMs);
  }
  if (forwardHttpSocketTimeoutMs > 0) {
    HttpConnectionParams.setSoTimeout(httpParams,this.forwardHttpSocketTimeoutMs);
  }
  StringBuffer requestUrlBuffer=new StringBuffer();
  requestUrlBuffer.append(inMessage.buildCompleteUrl());
  if (inMessage.getQueryString() != null) {
    requestUrlBuffer.append("String_Node_Str");
    boolean firstParam=true;
    for (    QueryParam queryParam : inMessage.getQueryString().getQueryParams()) {
      if (!firstParam) {
        requestUrlBuffer.append("String_Node_Str");
      }
      requestUrlBuffer.append(queryParam.getName());
      requestUrlBuffer.append("String_Node_Str");
      requestUrlBuffer.append(queryParam.getValue().replace("String_Node_Str","String_Node_Str"));
      firstParam=false;
    }
  }
  logger.debug("String_Node_Str" + requestUrlBuffer.toString());
  HttpEntity httpEntity=new StringEntity(inMessage.getMessageContent().getRawContent());
  HttpUriRequest httpUriRequest;
  if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpGet(requestUrlBuffer.toString());
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    HttpPut httpPut=new HttpPut(requestUrlBuffer.toString());
    httpPut.setEntity(httpEntity);
    httpUriRequest=httpPut;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpDelete(requestUrlBuffer.toString());
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpOptions(requestUrlBuffer.toString());
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpOptions(requestUrlBuffer.toString());
  }
 else   if ("String_Node_Str".equalsIgnoreCase(inMessage.getMethod())) {
    httpUriRequest=new HttpOptions(requestUrlBuffer.toString());
  }
 else {
    HttpPost httpPost=new HttpPost(requestUrlBuffer.toString());
    httpPost.setEntity(httpEntity);
    httpUriRequest=httpPost;
  }
  setHeaders(inMessage,httpUriRequest);
  Date requestSendDate=new Date();
  HttpResponse clientResponse=httpClient.execute(httpUriRequest);
  Date responseSendDate=new Date();
  OutMessage outMessage=new OutMessage(clientResponse.getStatusLine().getStatusCode(),clientResponse.getStatusLine().getReasonPhrase());
  inMessage.setRequestTimeStamp(requestSendDate.getTime());
  outMessage.setResponseTimeStamp(responseSendDate.getTime());
  MessageContent messageContent=new MessageContent();
  InputStreamReader in=new InputStreamReader(clientResponse.getEntity().getContent());
  BufferedReader bin=new BufferedReader(in);
  StringBuffer responseBuffer=new StringBuffer();
  String line;
  do {
    line=bin.readLine();
    if (line != null) {
      responseBuffer.append(line);
    }
  }
 while (line != null);
  messageContent.setRawContent(responseBuffer.toString());
  messageContent.setSize(clientResponse.getEntity().getContentLength());
  if (clientResponse.getEntity().getContentType() != null) {
    messageContent.setMimeType(clientResponse.getEntity().getContentType().getValue());
  }
  outMessage.setMessageContent(messageContent);
  return outMessage;
}