Program: 112343
Project: 112343
Buggy source:
Object invokeClient(IClientResponseHandler binding,BaseClientInvocation clientInvocation,boolean theLogRequestAndResponse){
  HttpRequestBase httpRequest;
  HttpResponse response;
  try {
    httpRequest=clientInvocation.asHttpRequest(myUrlBase,createExtraParams(),getEncoding());
    if (theLogRequestAndResponse) {
      ourLog.info("String_Node_Str",httpRequest);
    }
    response=myClient.execute(httpRequest);
  }
 catch (  DataFormatException e) {
    throw new FhirClientConnectionException(e);
  }
catch (  IOException e) {
    throw new FhirClientConnectionException(e);
  }
  try {
    Reader reader=createReaderFromResponse(response);
    if (ourLog.isTraceEnabled() || myKeepResponses) {
      String responseString=IOUtils.toString(reader);
      if (myKeepResponses) {
        myLastResponse=response;
        myLastResponseBody=responseString;
      }
      ourLog.trace("String_Node_Str",response,responseString);
      reader=new StringReader(responseString);
    }
    ContentType ct=ContentType.get(response.getEntity());
    String mimeType=ct != null ? ct.getMimeType() : null;
    Map<String,List<String>> headers=new HashMap<String,List<String>>();
    if (response.getAllHeaders() != null) {
      for (      Header next : response.getAllHeaders()) {
        String name=next.getName().toLowerCase();
        List<String> list=headers.get(name);
        if (list == null) {
          list=new ArrayList<String>();
          headers.put(name,list);
        }
        list.add(next.getValue());
      }
    }
    if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 299) {
      throw BaseServerResponseException.newInstance(response.getStatusLine().getStatusCode(),response.getStatusLine().getReasonPhrase());
    }
    try {
      return binding.invokeClient(mimeType,reader,response.getStatusLine().getStatusCode(),headers);
    }
  finally {
      reader.close();
    }
  }
 catch (  IllegalStateException e) {
    throw new FhirClientConnectionException(e);
  }
catch (  IOException e) {
    throw new FhirClientConnectionException(e);
  }
 finally {
    if (response instanceof CloseableHttpResponse) {
      try {
        ((CloseableHttpResponse)response).close();
      }
 catch (      IOException e) {
        ourLog.debug("String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
<T>T invokeClient(IClientResponseHandler<T> binding,BaseClientInvocation clientInvocation,boolean theLogRequestAndResponse){
  HttpRequestBase httpRequest;
  HttpResponse response;
  try {
    httpRequest=clientInvocation.asHttpRequest(myUrlBase,createExtraParams(),getEncoding());
    if (theLogRequestAndResponse) {
      ourLog.info("String_Node_Str",httpRequest);
    }
    response=myClient.execute(httpRequest);
  }
 catch (  DataFormatException e) {
    throw new FhirClientConnectionException(e);
  }
catch (  IOException e) {
    throw new FhirClientConnectionException(e);
  }
  try {
    Reader reader=createReaderFromResponse(response);
    if (ourLog.isTraceEnabled() || myKeepResponses) {
      String responseString=IOUtils.toString(reader);
      if (myKeepResponses) {
        myLastResponse=response;
        myLastResponseBody=responseString;
      }
      ourLog.trace("String_Node_Str",response,responseString);
      reader=new StringReader(responseString);
    }
    ContentType ct=ContentType.get(response.getEntity());
    String mimeType=ct != null ? ct.getMimeType() : null;
    Map<String,List<String>> headers=new HashMap<String,List<String>>();
    if (response.getAllHeaders() != null) {
      for (      Header next : response.getAllHeaders()) {
        String name=next.getName().toLowerCase();
        List<String> list=headers.get(name);
        if (list == null) {
          list=new ArrayList<String>();
          headers.put(name,list);
        }
        list.add(next.getValue());
      }
    }
    if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 299) {
      BaseServerResponseException exception=BaseServerResponseException.newInstance(response.getStatusLine().getStatusCode(),response.getStatusLine().getReasonPhrase());
      try {
        String body=IOUtils.toString(reader);
        exception.setResponseBody(body);
      }
 catch (      Exception e) {
        ourLog.debug("String_Node_Str",e);
      }
 finally {
        IOUtils.closeQuietly(reader);
      }
      throw exception;
    }
    try {
      return binding.invokeClient(mimeType,reader,response.getStatusLine().getStatusCode(),headers);
    }
  finally {
      IOUtils.closeQuietly(reader);
    }
  }
 catch (  IllegalStateException e) {
    throw new FhirClientConnectionException(e);
  }
catch (  IOException e) {
    throw new FhirClientConnectionException(e);
  }
 finally {
    if (response instanceof CloseableHttpResponse) {
      try {
        ((CloseableHttpResponse)response).close();
      }
 catch (      IOException e) {
        ourLog.debug("String_Node_Str",e);
      }
    }
  }
}