Program: 166477
Project: 166477
Buggy source:
public List<String> getTopologyList(String topologyNameMatching){
  LOG.debug("String_Node_Str" + topologyNameMatching);
  List<String> topologyList=new ArrayList<String>();
  String errMsg="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  if (topologyNameMatching == null || topologyNameMatching.trim().isEmpty()) {
    topologyNameMatching="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);
      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");
          if (topologyNode == null) {
            return topologyList;
          }
          Iterator<JsonNode> elements=topologyNode.getElements();
          while (elements.hasNext()) {
            JsonNode element=elements.next();
            String topologyName=element.get("String_Node_Str").getValueAsText();
            LOG.debug("String_Node_Str" + topologyName);
            if (topologyName.startsWith(topologyNameMatching)) {
              topologyList.add(topologyName);
            }
          }
        }
 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 topologyList;
}

Fixed version (ground truth):
public List<String> getTopologyList(String topologyNameMatching){
  LOG.debug("String_Node_Str" + topologyNameMatching);
  List<String> topologyList=new ArrayList<String>();
  String errMsg="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
  if (topologyNameMatching == null || topologyNameMatching.trim().isEmpty()) {
    topologyNameMatching="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);
      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");
          if (topologyNode == null) {
            return topologyList;
          }
          Iterator<JsonNode> elements=topologyNode.getElements();
          while (elements.hasNext()) {
            JsonNode element=elements.next();
            String topologyName=element.get("String_Node_Str").getValueAsText();
            LOG.debug("String_Node_Str" + topologyName);
            if (topologyName.startsWith(topologyNameMatching)) {
              topologyList.add(topologyName);
            }
          }
        }
 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 topologyList;
}