Program: 48806
Project: 48806
Buggy source:
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void resizeCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String name,@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String nodeGroup,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",help="String_Node_Str") final int instanceNum,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",help="String_Node_Str") final int cpuNumber,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",help="String_Node_Str") final long memory){
  if ((instanceNum > 0 && cpuNumber == 0 && memory == 0) || (instanceNum == 0 && (cpuNumber > 0 || memory > 0))) {
    try {
      ClusterRead cluster=restClient.get(name,false);
      if (cluster == null) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str" + name + "String_Node_Str");
        return;
      }
      List<NodeGroupRead> ngs=cluster.getNodeGroups();
      boolean found=false;
      for (      NodeGroupRead ng : ngs) {
        if (ng.getName().equals(nodeGroup)) {
          found=true;
          if (ng.getRoles() != null && ng.getRoles().contains(HadoopRole.ZOOKEEPER_ROLE.toString()) && instanceNum > 1) {
            CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.ZOOKEEPER_NOT_RESIZE);
            return;
          }
          break;
        }
      }
      if (!found) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str" + nodeGroup + "String_Node_Str");
        return;
      }
      TaskRead taskRead=null;
      if (instanceNum > 0) {
        restClient.resize(name,nodeGroup,instanceNum);
      }
 else       if (cpuNumber > 0 || memory > 0) {
        if (cluster.getStatus().ordinal() != ClusterStatus.RUNNING.ordinal()) {
          CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str");
          return;
        }
        ResourceScale resScale=new ResourceScale(name,nodeGroup,cpuNumber,memory);
        taskRead=restClient.scale(resScale);
      }
      CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESULT_RESIZE);
      if (taskRead != null) {
        System.out.println();
        printScaleReport(taskRead,name,nodeGroup);
      }
    }
 catch (    CliRestException e) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    }
  }
 else {
    if (instanceNum > 0 && (cpuNumber > 0 || memory > 0)) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str");
    }
 else     if (instanceNum == 0 && cpuNumber == 0 && memory == 0) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str");
    }
 else {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INVALID_VALUE + (instanceNum < 0 ? "String_Node_Str" + instanceNum + "String_Node_Str" : "String_Node_Str") + (cpuNumber < 0 ? "String_Node_Str" + cpuNumber + "String_Node_Str" : "String_Node_Str")+ (memory < 0 ? "String_Node_Str" + memory : "String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
@CliCommand(value="String_Node_Str",help="String_Node_Str") public void resizeCluster(@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String name,@CliOption(key={"String_Node_Str"},mandatory=true,help="String_Node_Str") final String nodeGroup,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",help="String_Node_Str") final int instanceNum,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",help="String_Node_Str") final int cpuNumber,@CliOption(key={"String_Node_Str"},mandatory=false,unspecifiedDefaultValue="String_Node_Str",help="String_Node_Str") final long memory){
  if ((instanceNum > 0 && cpuNumber == 0 && memory == 0) || (instanceNum == 0 && (cpuNumber > 0 || memory > 0))) {
    try {
      ClusterRead cluster=restClient.get(name,false);
      if (cluster == null) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str" + name + "String_Node_Str");
        return;
      }
      List<NodeGroupRead> ngs=cluster.getNodeGroups();
      boolean found=false;
      for (      NodeGroupRead ng : ngs) {
        if (ng.getName().equals(nodeGroup)) {
          found=true;
          if (ng.getRoles() != null && ng.getRoles().contains(HadoopRole.ZOOKEEPER_ROLE.toString()) && instanceNum > 1) {
            CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.ZOOKEEPER_NOT_RESIZE);
            return;
          }
          break;
        }
      }
      if (!found) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str" + nodeGroup + "String_Node_Str");
        return;
      }
      TaskRead taskRead=null;
      if (instanceNum > 0) {
        restClient.resize(name,nodeGroup,instanceNum);
      }
 else       if (cpuNumber > 0 || memory > 0) {
        if (cluster.getStatus().ordinal() != ClusterStatus.RUNNING.ordinal()) {
          CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str");
          return;
        }
        ResourceScale resScale=new ResourceScale(name,nodeGroup,cpuNumber,memory);
        taskRead=restClient.scale(resScale);
      }
      CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESULT_RESIZE);
      if (taskRead != null) {
        System.out.println();
        printScaleReport(taskRead,name,nodeGroup);
      }
    }
 catch (    CliRestException e) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,e.getMessage());
    }
  }
 else {
    if (instanceNum > 0 && (cpuNumber > 0 || memory > 0)) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str");
    }
 else     if (instanceNum == 0 && cpuNumber == 0 && memory == 0) {
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,"String_Node_Str");
    }
 else {
      List<String> invalidParams=new ArrayList<String>();
      if (instanceNum < 0) {
        invalidParams.add("String_Node_Str" + instanceNum);
      }
      if (cpuNumber < 0) {
        invalidParams.add("String_Node_Str" + cpuNumber);
      }
      if (memory < 0) {
        invalidParams.add("String_Node_Str" + memory);
      }
      CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,name,Constants.OUTPUT_OP_RESIZE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.INVALID_VALUE + "String_Node_Str" + StringUtils.join(invalidParams,"String_Node_Str"));
    }
  }
}