Program: 117979
Project: 117979
Buggy source:
/** 
 * Created and executes a request
 * @param uri the request URI
 * @param httpEntity the entity to send.
 * @param method HTTP method
 * @return the response to the request.
 * @throws ServiceUnavailableException
 */
protected HttpResponse createAndExecuteRequest(URI uri,HttpEntity httpEntity,HttpMethod method) throws ServiceUnavailableException {
  boolean hasRetried=false;
  while (true) {
    try {
      httpClient=(DefaultHttpClient)httpClientFactory.create(null,null);
      HttpRequestBase request=null;
      if (method == HttpMethod.POST) {
        request=new HttpPost(uri);
      }
 else       if (method == HttpMethod.PATCH) {
        request=new HttpPatch(uri);
      }
 else       if (method == HttpMethod.DELETE) {
        request=new HttpDelete(uri);
      }
 else {
        throw new HttpClientException("String_Node_Str" + method);
      }
      request.addHeader(HttpHeader.AUTHORIZATION,"String_Node_Str" + authResult.getAccessToken());
      if (request instanceof HttpEntityEnclosingRequestBase) {
        ((HttpEntityEnclosingRequestBase)request).setEntity(httpEntity);
      }
      HttpResponse response=httpClient.execute(request);
      request.releaseConnection();
      if (isResponseSuccess(response.getStatusLine().getStatusCode())) {
        EntityUtils.consume(response.getEntity());
        return response;
      }
 else {
        if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED && !hasRetried) {
          refreshToken();
          hasRetried=true;
          continue;
        }
        HttpEntity entity=response.getEntity();
        String message=null;
        if (entity != null) {
          message=odataClient.getDeserializer(ContentType.JSON).toError(entity.getContent()).getMessage();
        }
 else {
          message=response.getStatusLine().getReasonPhrase();
        }
        throw new HttpClientException(message);
      }
    }
 catch (    Exception e) {
      throw new HttpClientException(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Created and executes a request
 * @param uri the request URI
 * @param httpEntity the entity to send.
 * @param method HTTP method
 * @return the response to the request.
 * @throws ServiceUnavailableException
 */
protected HttpResponse createAndExecuteRequest(URI uri,HttpEntity httpEntity,HttpMethod method) throws ServiceUnavailableException {
  boolean hasRetried=false;
  while (true) {
    try {
      httpClient=(DefaultHttpClient)httpClientFactory.create(null,null);
      HttpRequestBase request=null;
      if (method == HttpMethod.POST) {
        request=new HttpPost(uri);
      }
 else       if (method == HttpMethod.PATCH) {
        request=new HttpPatch(uri);
      }
 else       if (method == HttpMethod.DELETE) {
        request=new HttpDelete(uri);
      }
 else {
        throw new HttpClientException("String_Node_Str" + method);
      }
      request.addHeader(HttpHeader.AUTHORIZATION,"String_Node_Str" + authResult.getAccessToken());
      if (request instanceof HttpEntityEnclosingRequestBase) {
        ((HttpEntityEnclosingRequestBase)request).setEntity(httpEntity);
      }
      HttpResponse response=httpClient.execute(request);
      if (isResponseSuccess(response.getStatusLine().getStatusCode())) {
        request.releaseConnection();
        EntityUtils.consume(response.getEntity());
        return response;
      }
 else {
        if (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED && !hasRetried) {
          refreshToken();
          hasRetried=true;
          continue;
        }
        HttpEntity entity=response.getEntity();
        String message=null;
        if (entity != null) {
          message=odataClient.getDeserializer(ContentType.JSON).toError(entity.getContent()).getMessage();
        }
 else {
          message=response.getStatusLine().getReasonPhrase();
        }
        throw new HttpClientException(message);
      }
    }
 catch (    Exception e) {
      throw new HttpClientException(e);
    }
  }
}