Program: 37999
Project: 37999
Buggy source:
/** 
 * Invoke.
 * @param apiUrl the api url
 * @param httpMethod the http method
 * @param payload the payload
 * @param contentType the content type
 * @param basicAuth the basic auth
 * @return the http response
 */
public HttpResponse invoke(final String apiUrl,final HttpMethod httpMethod,final String payload,final String contentType,final String basicAuth){
  _log.info("String_Node_Str");
  HttpResponse httpResponse=null;
  try {
    HttpClient client=HttpClients.createDefault();
    HttpUriRequest httpUriRequest=null;
    HttpEntityEnclosingRequestBase httpEntityEnclosingRequest=null;
    if (HttpMethod.POST.equals(httpMethod)) {
      httpEntityEnclosingRequest=new HttpPost(apiUrl);
    }
 else     if (HttpMethod.PUT.equals(httpMethod)) {
      httpEntityEnclosingRequest=new HttpPut(apiUrl);
    }
 else     if (HttpMethod.DELETE.equals(httpMethod)) {
      httpUriRequest=new HttpDelete(apiUrl);
    }
 else {
      httpUriRequest=new HttpGet(apiUrl);
    }
    if (!HttpMethod.POST.equals(httpMethod) && !HttpMethod.PUT.equals(httpMethod)) {
      if (!StringUtil.isNullOrEmpty(basicAuth)) {
        _log.debug("String_Node_Str" + IAuthConstants.Header.AUTHORIZATION);
        httpUriRequest.setHeader(IAuthConstants.Header.AUTHORIZATION,basicAuth);
      }
    }
    if (HttpMethod.POST.equals(httpMethod) || HttpMethod.PUT.equals(httpMethod)) {
      _log.info("String_Node_Str" + httpEntityEnclosingRequest + "String_Node_Str"+ payload);
      httpEntityEnclosingRequest.setHeader(HttpHeaders.CONTENT_TYPE,contentType);
      httpEntityEnclosingRequest.setHeader(IAuthConstants.Header.BASIC_AUTH,basicAuth);
      httpEntityEnclosingRequest.setEntity(new StringEntity(payload));
      httpResponse=client.execute(httpEntityEnclosingRequest);
      _log.debug("String_Node_Str");
    }
 else     if (HttpMethod.DELETE.equals(httpMethod) || HttpMethod.GET.equals(httpMethod)) {
      _log.info("String_Node_Str" + httpUriRequest);
      httpResponse=client.execute(httpUriRequest);
      _log.info("String_Node_Str");
    }
  }
 catch (  Exception e) {
    _log.error("String_Node_Str",e);
    throw new RestCallFailedException(e);
  }
  _log.info("String_Node_Str");
  return httpResponse;
}

Fixed version (ground truth):
/** 
 * Invoke.
 * @param apiUrl the api url
 * @param httpMethod the http method
 * @param payload the payload
 * @param contentType the content type
 * @param basicAuth the basic auth
 * @return the http response
 */
public HttpResponse invoke(final String apiUrl,final HttpMethod httpMethod,final String payload,final String contentType,final String basicAuth){
  LOGGER.info("String_Node_Str");
  HttpResponse httpResponse=null;
  try {
    HttpClient client=HttpClients.createDefault();
    HttpUriRequest httpUriRequest=null;
    HttpEntityEnclosingRequestBase httpEntityEnclosingRequest=null;
    if (HttpMethod.POST.equals(httpMethod)) {
      httpEntityEnclosingRequest=new HttpPost(apiUrl);
    }
 else     if (HttpMethod.PUT.equals(httpMethod)) {
      httpEntityEnclosingRequest=new HttpPut(apiUrl);
    }
 else     if (HttpMethod.DELETE.equals(httpMethod)) {
      httpUriRequest=new HttpDelete(apiUrl);
    }
 else {
      httpUriRequest=new HttpGet(apiUrl);
    }
    if (!HttpMethod.POST.equals(httpMethod) && !HttpMethod.PUT.equals(httpMethod)) {
      if (!StringUtil.isNullOrEmpty(basicAuth)) {
        LOGGER.debug("String_Node_Str" + IAuthConstants.Header.AUTHORIZATION);
        httpUriRequest.setHeader(IAuthConstants.Header.AUTHORIZATION,basicAuth);
      }
    }
    if (HttpMethod.POST.equals(httpMethod) || HttpMethod.PUT.equals(httpMethod)) {
      LOGGER.info("String_Node_Str" + httpEntityEnclosingRequest + "String_Node_Str"+ payload);
      httpEntityEnclosingRequest.setHeader(HttpHeaders.CONTENT_TYPE,contentType);
      httpEntityEnclosingRequest.setHeader(IAuthConstants.Header.BASIC_AUTH,basicAuth);
      httpEntityEnclosingRequest.setEntity(new StringEntity(payload));
      httpResponse=client.execute(httpEntityEnclosingRequest);
      LOGGER.debug("String_Node_Str");
    }
 else     if (HttpMethod.DELETE.equals(httpMethod) || HttpMethod.GET.equals(httpMethod)) {
      LOGGER.info("String_Node_Str" + httpUriRequest);
      httpResponse=client.execute(httpUriRequest);
      LOGGER.info("String_Node_Str");
    }
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
    throw new RestCallFailedException(e);
  }
  LOGGER.info("String_Node_Str");
  return httpResponse;
}