Program: 166478
Project: 166478
Buggy source:
public List<String> getServiceList(String topologyName,String serviceNameMatching){
  List<String> serviceList=new ArrayList<String>();
  String errMsg="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  if (serviceNameMatching == null || serviceNameMatching.trim().isEmpty()) {
    serviceNameMatching="String_Node_Str";
  }
  try {
    Client client=null;
    ClientResponse response=null;
    try {
      client=Client.create();
      ;
      client.addFilter(new HTTPBasicAuthFilter(userName,password));
      WebResource webResource=client.resource(knoxUrl + "String_Node_Str" + topologyName);
      response=webResource.accept(EXPECTED_MIME_TYPE).get(ClientResponse.class);
      LOG.debug("String_Node_Str" + response);
      if (response != null) {
        if (response.getStatus() == 200) {
          String jsonString=response.getEntity(String.class);
          LOG.debug("String_Node_Str" + jsonString);
          ObjectMapper objectMapper=new ObjectMapper();
          JsonNode rootNode=objectMapper.readTree(jsonString);
          JsonNode topologyNode=rootNode.findValue("String_Node_Str");
          JsonNode servicesNode=topologyNode.get("String_Node_Str");
          Iterator<JsonNode> services=servicesNode.getElements();
          while (services.hasNext()) {
            JsonNode service=services.next();
            String serviceName=service.get("String_Node_Str").getValueAsText();
            LOG.debug("String_Node_Str" + serviceName);
            if (serviceName.startsWith(serviceNameMatching)) {
              serviceList.add(serviceName);
            }
          }
        }
 else {
          LOG.error("String_Node_Str" + knoxUrl + "String_Node_Str"+ response.getStatus());
        }
      }
 else {
        String msgDesc="String_Node_Str" + "String_Node_Str" + knoxUrl + "String_Node_Str";
        LOG.error(msgDesc);
        HadoopException hdpException=new HadoopException(msgDesc);
        hdpException.generateResponseDataMap(false,msgDesc,msgDesc + errMsg,null,null);
        throw hdpException;
      }
    }
  finally {
      if (response != null) {
        response.close();
      }
      if (client != null) {
        client.destroy();
      }
    }
  }
 catch (  Throwable t) {
    String msgDesc="String_Node_Str" + knoxUrl + "String_Node_Str";
    HadoopException hdpException=new HadoopException(msgDesc,t);
    LOG.error(msgDesc,t);
    if (!(t instanceof HadoopException)) {
      hdpException.generateResponseDataMap(false,BaseClient.getMessage(t),msgDesc + errMsg,null,null);
    }
    throw hdpException;
  }
 finally {
  }
  return serviceList;
}

Fixed version (ground truth):
public List<String> getServiceList(String topologyName,String serviceNameMatching){
  List<String> serviceList=new ArrayList<String>();
  String errMsg="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  if (serviceNameMatching == null || serviceNameMatching.trim().isEmpty()) {
    serviceNameMatching="String_Node_Str";
  }
  try {
    Client client=null;
    ClientResponse response=null;
    try {
      client=Client.create();
      ;
      client.addFilter(new HTTPBasicAuthFilter(userName,password));
      WebResource webResource=client.resource(knoxUrl + "String_Node_Str" + topologyName);
      response=webResource.accept(EXPECTED_MIME_TYPE).get(ClientResponse.class);
      LOG.debug("String_Node_Str" + response);
      if (response != null) {
        if (response.getStatus() == 200) {
          String jsonString=response.getEntity(String.class);
          LOG.debug("String_Node_Str" + jsonString);
          ObjectMapper objectMapper=new ObjectMapper();
          JsonNode rootNode=objectMapper.readTree(jsonString);
          JsonNode topologyNode=rootNode.findValue("String_Node_Str");
          JsonNode servicesNode=topologyNode.get("String_Node_Str");
          Iterator<JsonNode> services=servicesNode.getElements();
          while (services.hasNext()) {
            JsonNode service=services.next();
            String serviceName=service.get("String_Node_Str").getValueAsText();
            LOG.debug("String_Node_Str" + serviceName);
            if (serviceName.startsWith(serviceNameMatching)) {
              serviceList.add(serviceName);
            }
          }
        }
 else {
          LOG.error("String_Node_Str" + knoxUrl + "String_Node_Str"+ response.getStatus());
        }
      }
 else {
        String msgDesc="String_Node_Str" + "String_Node_Str" + knoxUrl + "String_Node_Str";
        LOG.error(msgDesc);
        HadoopException hdpException=new HadoopException(msgDesc);
        hdpException.generateResponseDataMap(false,msgDesc,msgDesc + errMsg,null,null);
        throw hdpException;
      }
    }
  finally {
      if (response != null) {
        response.close();
      }
      if (client != null) {
        client.destroy();
      }
    }
  }
 catch (  HadoopException he) {
    throw he;
  }
catch (  Throwable t) {
    String msgDesc="String_Node_Str" + knoxUrl + "String_Node_Str";
    HadoopException hdpException=new HadoopException(msgDesc,t);
    LOG.error(msgDesc,t);
    hdpException.generateResponseDataMap(false,BaseClient.getMessage(t),msgDesc + errMsg,null,null);
    throw hdpException;
  }
 finally {
  }
  return serviceList;
}