Program: 48679
Project: 48679
Buggy source:
private PrettyOutput getClusterPrettyOutputCallBack(final ClusterRestClient clusterRestClient,final String id,final String... completedTaskSummary){
  return new PrettyOutput(){
    private String ngSnapshotInJson=null;
    private boolean needUpdate=true;
    private ClusterRead cluster=null;
    public void prettyOutput() throws Exception {
      try {
        if (cluster != null) {
          List<NodeGroupRead> nodeGroups=cluster.getNodeGroups();
          if (nodeGroups != null) {
            for (            NodeGroupRead nodeGroup : nodeGroups) {
              System.out.printf("String_Node_Str",nodeGroup.getName(),nodeGroup.getInstanceNum());
              System.out.printf("String_Node_Str",nodeGroup.getRoles());
              printNodesInfo(nodeGroup.getInstances());
            }
            prettyOutputErrorNode(nodeGroups);
          }
        }
      }
 catch (      Exception e) {
        throw e;
      }
    }
    private void prettyOutputErrorNode(    List<NodeGroupRead> nodegroups) throws Exception {
      List<NodeRead> failedNodes=new ArrayList<NodeRead>();
      for (      NodeGroupRead nodegroup : nodegroups) {
        List<NodeRead> nodes=nodegroup.getInstances();
        if (nodes != null) {
          for (          NodeRead node : nodes) {
            if (node.isActionFailed()) {
              failedNodes.add(node);
            }
          }
        }
      }
      if (!failedNodes.isEmpty()) {
        System.out.println();
        System.out.println(Constants.FAILED_NODES_MESSAGE + failedNodes.size());
        LinkedHashMap<String,List<String>> columnNamesWithGetMethodNames=new LinkedHashMap<String,List<String>>();
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_NODE_NAME,Arrays.asList("String_Node_Str"));
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_STATUS,Arrays.asList("String_Node_Str"));
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_ERROR,Arrays.asList("String_Node_Str"));
        CommandsUtils.printInTableFormat(columnNamesWithGetMethodNames,failedNodes.toArray(),Constants.OUTPUT_INDENT);
      }
    }
    public boolean isRefresh(    boolean realTime) throws Exception {
      try {
        cluster=clusterRestClient.get(id,realTime);
        if (cluster != null) {
          List<NodeGroupRead> nodeGroups=cluster.getNodeGroups();
          if (nodeGroups != null) {
            return checkOutputUpdate(nodeGroups);
          }
        }
        return false;
      }
 catch (      CliRestException expectedException) {
        cluster=null;
        return false;
      }
catch (      Exception e) {
        throw e;
      }
    }
    private void printNodesInfo(    List<NodeRead> nodes) throws Exception {
      if (nodes != null && nodes.size() > 0) {
        LinkedHashMap<String,List<String>> columnNamesWithGetMethodNames=new LinkedHashMap<String,List<String>>();
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_NAME,Arrays.asList("String_Node_Str"));
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_IP,Arrays.asList("String_Node_Str"));
        if (nodes.get(0).getIpConfigs() != null && (nodes.get(0).getIpConfigs().containsKey(NetConfigInfo.NetTrafficType.HDFS_NETWORK) || nodes.get(0).getIpConfigs().containsKey(NetConfigInfo.NetTrafficType.MAPRED_NETWORK))) {
          columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_HDFS_IP,Arrays.asList("String_Node_Str"));
          columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_MAPRED_IP,Arrays.asList("String_Node_Str"));
        }
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_STATUS,Arrays.asList("String_Node_Str"));
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_TASK,Arrays.asList("String_Node_Str"));
        CommandsUtils.printInTableFormat(columnNamesWithGetMethodNames,nodes.toArray(),Constants.OUTPUT_INDENT);
      }
 else {
        System.out.println();
      }
    }
    private boolean checkOutputUpdate(    List<NodeGroupRead> nodeGroups) throws JsonGenerationException, IOException {
      ObjectMapper mapper=new ObjectMapper();
      String ngCurrentInJson=mapper.writeValueAsString(nodeGroups);
      if (ngSnapshotInJson != null && ngSnapshotInJson.equals(ngCurrentInJson)) {
        needUpdate=false;
      }
 else {
        ngSnapshotInJson=ngCurrentInJson;
        needUpdate=true;
      }
      return needUpdate;
    }
    public String[] getCompletedTaskSummary(){
      return completedTaskSummary;
    }
  }
;
}

Fixed version (ground truth):
private PrettyOutput getClusterPrettyOutputCallBack(final ClusterRestClient clusterRestClient,final String id,final String... completedTaskSummary){
  return new PrettyOutput(){
    private String ngSnapshotInJson=null;
    private boolean needUpdate=true;
    private ClusterRead cluster=null;
    public void prettyOutput() throws Exception {
      try {
        if (cluster != null) {
          List<NodeGroupRead> nodeGroups=cluster.getNodeGroups();
          if (nodeGroups != null) {
            for (            NodeGroupRead nodeGroup : nodeGroups) {
              System.out.printf("String_Node_Str",nodeGroup.getName(),nodeGroup.getInstanceNum());
              System.out.printf("String_Node_Str",nodeGroup.getRoles());
              printNodesInfo(nodeGroup.getInstances());
            }
            CommandsUtils.prettyOutputErrorNode(nodeGroups);
          }
        }
      }
 catch (      Exception e) {
        throw e;
      }
    }
    public boolean isRefresh(    boolean realTime) throws Exception {
      try {
        cluster=clusterRestClient.get(id,realTime);
        if (cluster != null) {
          List<NodeGroupRead> nodeGroups=cluster.getNodeGroups();
          if (nodeGroups != null) {
            return checkOutputUpdate(nodeGroups);
          }
        }
        return false;
      }
 catch (      CliRestException expectedException) {
        cluster=null;
        return false;
      }
catch (      Exception e) {
        throw e;
      }
    }
    private void printNodesInfo(    List<NodeRead> nodes) throws Exception {
      if (nodes != null && nodes.size() > 0) {
        LinkedHashMap<String,List<String>> columnNamesWithGetMethodNames=new LinkedHashMap<String,List<String>>();
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_NAME,Arrays.asList("String_Node_Str"));
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_IP,Arrays.asList("String_Node_Str"));
        if (nodes.get(0).getIpConfigs() != null && (nodes.get(0).getIpConfigs().containsKey(NetConfigInfo.NetTrafficType.HDFS_NETWORK) || nodes.get(0).getIpConfigs().containsKey(NetConfigInfo.NetTrafficType.MAPRED_NETWORK))) {
          columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_HDFS_IP,Arrays.asList("String_Node_Str"));
          columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_MAPRED_IP,Arrays.asList("String_Node_Str"));
        }
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_STATUS,Arrays.asList("String_Node_Str"));
        columnNamesWithGetMethodNames.put(Constants.FORMAT_TABLE_COLUMN_TASK,Arrays.asList("String_Node_Str"));
        CommandsUtils.printInTableFormat(columnNamesWithGetMethodNames,nodes.toArray(),Constants.OUTPUT_INDENT);
      }
 else {
        System.out.println();
      }
    }
    private boolean checkOutputUpdate(    List<NodeGroupRead> nodeGroups) throws JsonGenerationException, IOException {
      ObjectMapper mapper=new ObjectMapper();
      String ngCurrentInJson=mapper.writeValueAsString(nodeGroups);
      if (ngSnapshotInJson != null && ngSnapshotInJson.equals(ngCurrentInJson)) {
        needUpdate=false;
      }
 else {
        ngSnapshotInJson=ngCurrentInJson;
        needUpdate=true;
      }
      return needUpdate;
    }
    public String[] getCompletedTaskSummary(){
      return completedTaskSummary;
    }
  }
;
}