nus-yam/ex-repair huggingface dataset:
Program: 48617
Project: 48617
Buggy source:
private Set<NodeGroupEntity> convertNodeGroupsToEntities(Gson gson,ClusterEntity clusterEntity,String distro,NodeGroupCreate[] groups,boolean validateWhiteList){
  Set<NodeGroupEntity> nodeGroups;
  nodeGroups=new HashSet<NodeGroupEntity>();
  Set<String> referencedNodeGroups=new HashSet<String>();
  for (  NodeGroupCreate group : groups) {
    NodeGroupEntity groupEntity=convertGroup(gson,clusterEntity,group,distro,validateWhiteList);
    if (groupEntity != null) {
      nodeGroups.add(groupEntity);
      if (groupEntity.getStorageType() == DatastoreType.TEMPFS) {
        for (        NodeGroupAssociation associate : groupEntity.getGroupAssociations()) {
          referencedNodeGroups.add(associate.getReferencedGroup());
        }
      }
    }
  }
  if (clusterEntity.getAppManager() == null) {
    for (    String nodeGroupName : referencedNodeGroups) {
      for (      NodeGroupEntity groupEntity : nodeGroups) {
        if (groupEntity.getName().equals(nodeGroupName)) {
          @SuppressWarnings("String_Node_Str") List<String> sortedRoles=gson.fromJson(groupEntity.getRoles(),List.class);
          sortedRoles.add(0,HadoopRole.TEMPFS_SERVER_ROLE.toString());
          groupEntity.setRoles(gson.toJson(sortedRoles));
        }
      }
    }
  }
  return nodeGroups;
}

Fixed version (ground truth):
private Set<NodeGroupEntity> convertNodeGroupsToEntities(Gson gson,ClusterEntity clusterEntity,String distro,NodeGroupCreate[] groups,boolean validateWhiteList){
  Set<NodeGroupEntity> nodeGroups;
  nodeGroups=new HashSet<NodeGroupEntity>();
  Set<String> referencedNodeGroups=new HashSet<String>();
  for (  NodeGroupCreate group : groups) {
    NodeGroupEntity groupEntity=convertGroup(gson,clusterEntity,group,distro,validateWhiteList);
    if (groupEntity != null) {
      nodeGroups.add(groupEntity);
      if (groupEntity.getStorageType() == DatastoreType.TEMPFS) {
        for (        NodeGroupAssociation associate : groupEntity.getGroupAssociations()) {
          referencedNodeGroups.add(associate.getReferencedGroup());
        }
      }
    }
  }
  if (clusterEntity.getAppManager() == null || Constants.IRONFAN.equalsIgnoreCase(clusterEntity.getAppManager())) {
    for (    String nodeGroupName : referencedNodeGroups) {
      for (      NodeGroupEntity groupEntity : nodeGroups) {
        if (groupEntity.getName().equals(nodeGroupName)) {
          @SuppressWarnings("String_Node_Str") List<String> sortedRoles=gson.fromJson(groupEntity.getRoles(),List.class);
          sortedRoles.add(0,HadoopRole.TEMPFS_SERVER_ROLE.toString());
          groupEntity.setRoles(gson.toJson(sortedRoles));
        }
      }
    }
  }
  return nodeGroups;
}
Program: 48620
Project: 48620
Buggy source:
private ISoftwareManagementTask createThriftTask(ChunkContext chunkContext,String targetName,StatusUpdater statusUpdater){
  ISoftwareManagementTask task;
  File workDir=CommandUtil.createWorkDir(getJobExecutionId(chunkContext));
  putIntoJobExecutionContext(chunkContext,JobConstants.CURRENT_COMMAND_WORK_DIR,workDir.getAbsolutePath());
  boolean needAllocIp=true;
  if (ManagementOperation.DESTROY.equals(managementOperation)) {
    needAllocIp=false;
  }
  String specFilePath=null;
  if (managementOperation.ordinal() != ManagementOperation.DESTROY.ordinal()) {
    File specFile=clusterManager.writeClusterSpecFile(targetName,workDir,needAllocIp);
    specFilePath=specFile.getAbsolutePath();
  }
  task=SoftwareManagementTaskFactory.createThriftTask(targetName,specFilePath,statusUpdater,managementOperation,lockClusterEntityMgr);
  return task;
}

Fixed version (ground truth):
private ISoftwareManagementTask createThriftTask(ChunkContext chunkContext,String targetName,StatusUpdater statusUpdater){
  ISoftwareManagementTask task;
  File workDir=CommandUtil.createWorkDir(getJobExecutionId(chunkContext));
  putIntoJobExecutionContext(chunkContext,JobConstants.CURRENT_COMMAND_WORK_DIR,workDir.getAbsolutePath());
  boolean needAllocIp=true;
  if (ManagementOperation.DESTROY.equals(managementOperation) || ManagementOperation.PRE_DESTROY.equals(managementOperation)) {
    needAllocIp=false;
  }
  String specFilePath=null;
  if (!(ManagementOperation.DESTROY.equals(managementOperation) || ManagementOperation.PRE_DESTROY.equals(managementOperation))) {
    File specFile=clusterManager.writeClusterSpecFile(targetName,workDir,needAllocIp);
    specFilePath=specFile.getAbsolutePath();
  }
  task=SoftwareManagementTaskFactory.createThriftTask(targetName,specFilePath,statusUpdater,managementOperation,lockClusterEntityMgr);
  return task;
}
Program: 48621
Project: 48621
Buggy source:
private ISoftwareManagementTask createExternalTask(ChunkContext chunkContext,String targetName,String clusterName,ClusterCreate clusterSpec,StatusUpdater statusUpdater){
  ISoftwareManagementTask task;
  SoftwareManager softwareMgr=softwareMgrs.getSoftwareManager(clusterSpec.getAppManager());
  ClusterBlueprint clusterBlueprint=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_BLUEPRINT_JOB_PARAM,ClusterBlueprint.class);
  if (clusterBlueprint == null) {
    clusterBlueprint=lockClusterEntityMgr.getClusterEntityMgr().toClusterBluePrint(clusterName);
    putIntoJobExecutionContext(chunkContext,JobConstants.CLUSTER_BLUEPRINT_JOB_PARAM,clusterBlueprint);
  }
  task=SoftwareManagementTaskFactory.createExternalMgtTask(targetName,managementOperation,clusterBlueprint,statusUpdater,lockClusterEntityMgr,softwareMgr);
  return task;
}

Fixed version (ground truth):
private ISoftwareManagementTask createExternalTask(ChunkContext chunkContext,String targetName,String clusterName,StatusUpdater statusUpdater){
  ISoftwareManagementTask task;
  SoftwareManager softwareMgr=softwareMgrs.getSoftwareManagerByClusterName(clusterName);
  ClusterBlueprint clusterBlueprint=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_BLUEPRINT_JOB_PARAM,ClusterBlueprint.class);
  if (clusterBlueprint == null) {
    clusterBlueprint=lockClusterEntityMgr.getClusterEntityMgr().toClusterBluePrint(clusterName);
    putIntoJobExecutionContext(chunkContext,JobConstants.CLUSTER_BLUEPRINT_JOB_PARAM,clusterBlueprint);
  }
  task=SoftwareManagementTaskFactory.createExternalMgtTask(targetName,managementOperation,clusterBlueprint,statusUpdater,lockClusterEntityMgr,softwareMgr);
  return task;
}
Program: 48623
Project: 48623
Buggy source:
@Override public String getName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getName(){
  return Constants.IRONFAN;
}
Program: 48625
Project: 48625
Buggy source:
public NodeGroupInfo toNodeGroupInfo(NodeGroupEntity group){
  Gson gson=new Gson();
  NodeGroupInfo nodeGroupInfo=new NodeGroupInfo();
  nodeGroupInfo.setName(group.getName());
  nodeGroupInfo.setInstanceNum(group.getRealInstanceNum(true));
  nodeGroupInfo.setRoles(gson.fromJson(group.getRoles(),List.class));
  if (group.getHadoopConfig() != null) {
    Map<String,Object> groupConfigs=gson.fromJson(group.getHadoopConfig(),Map.class);
    nodeGroupInfo.setConfiguration(groupConfigs);
  }
  List<NodeInfo> nodeInfos=new ArrayList<NodeInfo>();
  for (  NodeEntity node : group.getNodes()) {
    NodeInfo nodeInfo=new NodeInfo();
    nodeInfo.setName(node.getVmName());
    nodeInfo.setIpConfigs(node.convertToIpConfigInfo());
    nodeInfo.setRack(node.getRack());
    nodeInfo.setVolumes(node.getDataVolumnsMountPoint());
    nodeInfos.add(nodeInfo);
  }
  nodeGroupInfo.setNodes(nodeInfos);
  return nodeGroupInfo;
}

Fixed version (ground truth):
public NodeGroupInfo toNodeGroupInfo(String clusterName,String groupName){
  NodeGroupEntity group=findByName(clusterName,groupName);
  return toNodeGroupInfo(group);
}
Program: 48627
Project: 48627
Buggy source:
public NodeGroupInfo toNodeGroupInfo(NodeGroupEntity group);

Fixed version (ground truth):
public NodeGroupInfo toNodeGroupInfo(String clusterName,String groupName);
Program: 48629
Project: 48629
Buggy source:
public String toString(){
  return null;
}

Fixed version (ground truth):
public String toString(){
  return (new Gson()).toJson(this);
}
Program: 48630
Project: 48630
Buggy source:
public static SoftwareManagerCollectorException ILLEGAL_ACCESS(Exception ex,String name){
  return new SoftwareManagerCollectorException(ex,"String_Node_Str");
}

Fixed version (ground truth):
public static SoftwareManagerCollectorException ILLEGAL_ACCESS(Exception ex,String name){
  return new SoftwareManagerCollectorException(ex,"String_Node_Str",name);
}
Program: 48631
Project: 48631
Buggy source:
public static SoftwareManagerCollectorException CAN_NOT_INSTANTIATE(Exception ex,String name){
  return new SoftwareManagerCollectorException(ex,"String_Node_Str");
}

Fixed version (ground truth):
public static SoftwareManagerCollectorException CAN_NOT_INSTANTIATE(Exception ex,String name){
  return new SoftwareManagerCollectorException(ex,"String_Node_Str",name);
}
Program: 48632
Project: 48632
Buggy source:
public static SoftwareManagerCollectorException ECHO_FAILURE(String name){
  return new SoftwareManagerCollectorException(null,"String_Node_Str");
}

Fixed version (ground truth):
public static SoftwareManagerCollectorException ECHO_FAILURE(String name){
  return new SoftwareManagerCollectorException(null,"String_Node_Str",name);
}
Program: 48633
Project: 48633
Buggy source:
public static SoftwareManagerCollectorException DUPLICATE_NAME(String name){
  return new SoftwareManagerCollectorException(null,"String_Node_Str");
}

Fixed version (ground truth):
public static SoftwareManagerCollectorException DUPLICATE_NAME(String name){
  return new SoftwareManagerCollectorException(null,"String_Node_Str",name);
}
Program: 48634
Project: 48634
Buggy source:
public static SoftwareManagerCollectorException CLASS_NOT_DEFINED(String name){
  return new SoftwareManagerCollectorException(null,"String_Node_Str");
}

Fixed version (ground truth):
public static SoftwareManagerCollectorException CLASS_NOT_DEFINED(String name){
  return new SoftwareManagerCollectorException(null,"String_Node_Str",name);
}
Program: 48636
Project: 48636
Buggy source:
public static ClusteringServiceException CREATE_RESOURCE_POOL_FAILED(String clusterName){
  return new ClusteringServiceException(null,"String_Node_Str",clusterName);
}

Fixed version (ground truth):
public static ClusteringServiceException CREATE_RESOURCE_POOL_FAILED(String errMessage){
  return new ClusteringServiceException(null,"String_Node_Str",errMessage);
}
Program: 48637
Project: 48637
Buggy source:
@Override public void doWithRequest(ClientHttpRequest request) throws IOException {
  request.getBody().write(("String_Node_Str" + username + "String_Node_Str"+ password+ "String_Node_Str").getBytes());
}

Fixed version (ground truth):
@Override public void doWithRequest(ClientHttpRequest request) throws IOException {
  Base64 base64=new Base64();
  String encodeUserName=new String(base64.encode(username.getBytes("String_Node_Str")));
  request.getBody().write(("String_Node_Str" + encodeUserName + "String_Node_Str"+ password+ "String_Node_Str").getBytes());
}
Program: 48638
Project: 48638
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private <T>ResponseEntity<T> exchange(final String url,final String username,final String password,HttpMethod method,Class<T> responseType){
  return client.execute(url,HttpMethod.POST,new RequestCallback(){
    @Override public void doWithRequest(    ClientHttpRequest request) throws IOException {
      request.getBody().write(("String_Node_Str" + username + "String_Node_Str"+ password+ "String_Node_Str").getBytes());
    }
  }
,new ResponseEntityResponseExtractor<T>(responseType));
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private <T>ResponseEntity<T> exchange(final String url,final String username,final String password,HttpMethod method,Class<T> responseType){
  return client.execute(url,HttpMethod.POST,new RequestCallback(){
    @Override public void doWithRequest(    ClientHttpRequest request) throws IOException {
      Base64 base64=new Base64();
      String encodeUserName=new String(base64.encode(username.getBytes("String_Node_Str")));
      request.getBody().write(("String_Node_Str" + encodeUserName + "String_Node_Str"+ password+ "String_Node_Str").getBytes());
    }
  }
,new ResponseEntityResponseExtractor<T>(responseType));
}
Program: 48639
Project: 48639
Buggy source:
public void authenticateUser(String name,String password) throws Exception {
  Client vmomiClient=null;
  try {
    URI uri=new URI(serviceUrl);
    HttpConfiguration httpConfig=new HttpConfigurationImpl();
    httpConfig.setThumbprintVerifier(getThumbprintVerifier());
    HttpClientConfiguration clientConfig=HttpClientConfiguration.Factory.newInstance();
    clientConfig.setHttpConfiguration(httpConfig);
    vmomiClient=Client.Factory.createClient(uri,version,clientConfig);
    ManagedObjectReference svcRef=new ManagedObjectReference();
    svcRef.setType("String_Node_Str");
    svcRef.setValue("String_Node_Str");
    ServiceInstance instance=vmomiClient.createStub(ServiceInstance.class,svcRef);
    ServiceInstanceContent instanceContent=instance.retrieveContent();
    SessionManager sessionManager=vmomiClient.createStub(SessionManager.class,instanceContent.getSessionManager());
    sessionManager.login(name,password,sessionManager.getDefaultLocale());
    sessionManager.logout();
  }
  finally {
    if (vmomiClient != null) {
      vmomiClient.shutdown();
    }
  }
}

Fixed version (ground truth):
public void authenticateUser(String name,String password) throws Exception {
  Client vmomiClient=null;
  try {
    URI uri=new URI(serviceUrl);
    HttpConfiguration httpConfig=new HttpConfigurationImpl();
    httpConfig.setThumbprintVerifier(getThumbprintVerifier());
    HttpClientConfiguration clientConfig=HttpClientConfiguration.Factory.newInstance();
    clientConfig.setHttpConfiguration(httpConfig);
    vmomiClient=Client.Factory.createClient(uri,version,clientConfig);
    ManagedObjectReference svcRef=new ManagedObjectReference();
    svcRef.setType("String_Node_Str");
    svcRef.setValue("String_Node_Str");
    ServiceInstance instance=vmomiClient.createStub(ServiceInstance.class,svcRef);
    ServiceInstanceContent instanceContent=instance.retrieveContent();
    SessionManager sessionManager=vmomiClient.createStub(SessionManager.class,instanceContent.getSessionManager());
    Base64 base64=new Base64();
    name=name.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
    name=new String(base64.decode(name.getBytes()),"String_Node_Str");
    sessionManager.login(name,password,sessionManager.getDefaultLocale());
    sessionManager.logout();
  }
  finally {
    if (vmomiClient != null) {
      vmomiClient.shutdown();
    }
  }
}
Program: 48640
Project: 48640
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,consumes="String_Node_Str") @ResponseStatus(HttpStatus.OK) public void addPlugin(@RequestBody final PluginAdd pluginAdd){
  networkSvc.addIpPoolNetwork(na.getName(),na.getPortGroup(),na.getNetmask(),na.getGateway(),na.getDns1(),na.getDns2(),na.getIpBlocks());
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,consumes="String_Node_Str") @ResponseStatus(HttpStatus.OK) public void addPlugin(@RequestBody final PluginAdd pluginAdd){
  pluginService.addPlugin(pluginAdd);
}
Program: 48641
Project: 48641
Buggy source:
public static void printCmdFailure(String objectType,String name,String opName,String result,String message){
  if (isJansiAvailable() && !isBlank(name)) {
    try {
      name=transferEncoding(name);
    }
 catch (    UnsupportedEncodingException e) {
      logger.warn("String_Node_Str" + e.getMessage());
    }
  }
  if (!isBlank(name)) {
    System.out.println(objectType + "String_Node_Str" + name+ "String_Node_Str"+ opName+ "String_Node_Str"+ result+ "String_Node_Str"+ message);
  }
 else   if (!isBlank(opName)) {
    System.out.println(objectType + "String_Node_Str" + opName+ "String_Node_Str"+ result+ "String_Node_Str"+ message);
  }
 else {
    System.out.println(objectType + "String_Node_Str" + result+ "String_Node_Str"+ message);
  }
}

Fixed version (ground truth):
public static void printCmdFailure(String objectType,String name,String opName,String result,String message){
  if (isJansiAvailable() && !isBlank(name)) {
    try {
      name=transferEncoding(name);
    }
 catch (    UnsupportedEncodingException|CliException e) {
      logger.warn("String_Node_Str" + e.getMessage());
    }
  }
  if (!isBlank(name)) {
    System.out.println(objectType + "String_Node_Str" + name+ "String_Node_Str"+ opName+ "String_Node_Str"+ result+ "String_Node_Str"+ message);
  }
 else   if (!isBlank(opName)) {
    System.out.println(objectType + "String_Node_Str" + opName+ "String_Node_Str"+ result+ "String_Node_Str"+ message);
  }
 else {
    System.out.println(objectType + "String_Node_Str" + result+ "String_Node_Str"+ message);
  }
}
Program: 48642
Project: 48642
Buggy source:
public static void printCmdSuccess(String objectType,String name,String result){
  if (isJansiAvailable() && !isBlank(name)) {
    try {
      name=transferEncoding(name);
    }
 catch (    UnsupportedEncodingException e) {
      logger.warn("String_Node_Str" + e.getMessage());
    }
  }
  if (!isBlank(name)) {
    System.out.println(objectType + "String_Node_Str" + name+ "String_Node_Str"+ result);
  }
 else {
    System.out.println(objectType + "String_Node_Str" + result);
  }
}

Fixed version (ground truth):
public static void printCmdSuccess(String objectType,String name,String result){
  if (isJansiAvailable() && !isBlank(name)) {
    try {
      name=transferEncoding(name);
    }
 catch (    UnsupportedEncodingException|CliException e) {
      logger.warn("String_Node_Str" + e.getMessage());
    }
  }
  if (!isBlank(name)) {
    System.out.println(objectType + "String_Node_Str" + name+ "String_Node_Str"+ result);
  }
 else {
    System.out.println(objectType + "String_Node_Str" + result);
  }
}
Program: 48643
Project: 48643
Buggy source:
public static String transferEncoding(final String src) throws UnsupportedEncodingException {
  int codePage=Kernel32.GetConsoleOutputCP();
  String outputEncoding="String_Node_Str";
  if (codePage == 932) {
    outputEncoding="String_Node_Str";
  }
 else {
    outputEncoding="String_Node_Str" + codePage;
  }
  return new String(src.getBytes(outputEncoding),Configuration.getEncoding());
}

Fixed version (ground truth):
public static String transferEncoding(final String src) throws UnsupportedEncodingException, CliException {
  int codePage=Kernel32.GetConsoleOutputCP();
  String outputEncoding="String_Node_Str" + codePage;
  if (!java.nio.charset.Charset.isSupported(outputEncoding)) {
    outputEncoding="String_Node_Str" + codePage;
    if (!java.nio.charset.Charset.isSupported(outputEncoding)) {
      String errorMsg="String_Node_Str" + codePage + "String_Node_Str";
      logger.error("String_Node_Str" + errorMsg);
      throw new CliException(errorMsg);
    }
  }
  return new String(src.getBytes(outputEncoding),Configuration.getEncoding());
}
Program: 48644
Project: 48644
Buggy source:
private String getInputedPassword(String promptMsg){
  try {
    ConsoleReader reader=new ConsoleReader();
    reader.setPrompt(promptMsg);
    String password=null;
    password=reader.readLine(Character.valueOf('*'));
    if (isValidPassword(password)) {
      return password;
    }
 else {
      return null;
    }
  }
 catch (  IOException e) {
    return null;
  }
}

Fixed version (ground truth):
private String getInputedPassword(String promptMsg){
  try {
    ConsoleReader reader=new ConsoleReader();
    reader.setPrompt(promptMsg);
    String password=null;
    try {
      password=reader.readLine(Character.valueOf('*'));
    }
 catch (    IllegalArgumentException e) {
      if (e.getMessage().contains("String_Node_Str")) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_CLUSTER,null,Constants.OUTPUT_OP_CREATE,Constants.OUTPUT_OP_RESULT_FAIL,Constants.PASSWORD_CHARACTER_REQUIREMENT);
        return null;
      }
 else {
        throw e;
      }
    }
    if (isValidPassword(password)) {
      return password;
    }
 else {
      return null;
    }
  }
 catch (  IOException e) {
    return null;
  }
}
Program: 48645
Project: 48645
Buggy source:
public static void printCmdFailure(String objectType,String name,String opName,String result,String message){
  if (!isBlank(name)) {
    System.out.println(objectType + "String_Node_Str" + name+ "String_Node_Str"+ opName+ "String_Node_Str"+ result+ "String_Node_Str"+ message);
  }
 else   if (!isBlank(opName)) {
    System.out.println(objectType + "String_Node_Str" + opName+ "String_Node_Str"+ result+ "String_Node_Str"+ message);
  }
 else {
    System.out.println(objectType + "String_Node_Str" + result+ "String_Node_Str"+ message);
  }
}

Fixed version (ground truth):
public static void printCmdFailure(String objectType,String name,String opName,String result,String message){
  if (isJansiAvailable()) {
    try {
      name=transcoding(name);
    }
 catch (    UnsupportedEncodingException e) {
      logger.warn("String_Node_Str" + e.getMessage());
    }
  }
  if (!isBlank(name)) {
    System.out.println(objectType + "String_Node_Str" + name+ "String_Node_Str"+ opName+ "String_Node_Str"+ result+ "String_Node_Str"+ message);
  }
 else   if (!isBlank(opName)) {
    System.out.println(objectType + "String_Node_Str" + opName+ "String_Node_Str"+ result+ "String_Node_Str"+ message);
  }
 else {
    System.out.println(objectType + "String_Node_Str" + result+ "String_Node_Str"+ message);
  }
}
Program: 48646
Project: 48646
Buggy source:
public static void printCmdSuccess(String objectType,String name,String result){
  if (!isBlank(name)) {
    System.out.println(objectType + "String_Node_Str" + name+ "String_Node_Str"+ result);
  }
 else {
    System.out.println(objectType + "String_Node_Str" + result);
  }
}

Fixed version (ground truth):
public static void printCmdSuccess(String objectType,String name,String result){
  if (isJansiAvailable()) {
    try {
      name=transcoding(name);
    }
 catch (    UnsupportedEncodingException e) {
      logger.warn("String_Node_Str" + e.getMessage());
    }
  }
  if (!isBlank(name)) {
    System.out.println(objectType + "String_Node_Str" + name+ "String_Node_Str"+ result);
  }
 else {
    System.out.println(objectType + "String_Node_Str" + result);
  }
}
Program: 48647
Project: 48647
Buggy source:
public static void prettyJsonOutput(Object object,String fileName) throws Exception {
  OutputStream out=null;
  try {
    if (fileName != null) {
      out=new FileOutputStream(fileName);
    }
 else {
      out=System.out;
    }
    JsonFactory factory=new JsonFactory();
    JsonGenerator generator=factory.createJsonGenerator(out);
    ObjectMapper mapper=getMapper();
    mapper.setSerializationInclusion(Inclusion.NON_NULL);
    generator.setCodec(mapper);
    DefaultPrettyPrinter prettyPrinter=new DefaultPrettyPrinter();
    Indenter indenter=new Lf2SpacesIndenter();
    prettyPrinter.indentArraysWith(indenter);
    generator.setPrettyPrinter(prettyPrinter);
    generator.writeObject(object);
    if (fileName == null) {
      System.out.println();
    }
 else {
      File file=new File(fileName);
      String filePath=file.getAbsolutePath();
      if (isJansiAvailable()) {
        WindowsTerminal ansiTerminal=new WindowsTerminal(){
          @Override public synchronized boolean isAnsiSupported(){
            return true;
          }
        }
;
        ansiTerminal.init();
        String outEncoding=ansiTerminal.getOutputEncoding() != null ? ansiTerminal.getOutputEncoding() : Configuration.getEncoding();
        filePath=new String(filePath.getBytes(outEncoding),Configuration.getEncoding());
      }
      System.out.println("String_Node_Str" + filePath);
    }
  }
  finally {
    if (out != null && !(out instanceof PrintStream)) {
      out.close();
    }
  }
}

Fixed version (ground truth):
public static void prettyJsonOutput(Object object,String fileName) throws Exception {
  OutputStream out=null;
  try {
    if (fileName != null) {
      out=new FileOutputStream(fileName);
    }
 else {
      out=System.out;
    }
    JsonFactory factory=new JsonFactory();
    JsonGenerator generator=factory.createJsonGenerator(out);
    ObjectMapper mapper=getMapper();
    mapper.setSerializationInclusion(Inclusion.NON_NULL);
    generator.setCodec(mapper);
    DefaultPrettyPrinter prettyPrinter=new DefaultPrettyPrinter();
    Indenter indenter=new Lf2SpacesIndenter();
    prettyPrinter.indentArraysWith(indenter);
    generator.setPrettyPrinter(prettyPrinter);
    generator.writeObject(object);
    if (fileName == null) {
      System.out.println();
    }
 else {
      File file=new File(fileName);
      String filePath=file.getAbsolutePath();
      if (isJansiAvailable()) {
        filePath=transcoding(filePath);
      }
      System.out.println("String_Node_Str" + filePath);
    }
  }
  finally {
    if (out != null && !(out instanceof PrintStream)) {
      out.close();
    }
  }
}
Program: 48648
Project: 48648
Buggy source:
private static boolean isJansiAvailable(){
  return ClassUtils.isPresent("String_Node_Str",JLineShell.class.getClassLoader()) && OsUtils.isWindows() && System.getProperty("String_Node_Str") == null;
}

Fixed version (ground truth):
public static boolean isJansiAvailable(){
  return ClassUtils.isPresent("String_Node_Str",JLineShell.class.getClassLoader()) && OsUtils.isWindows() && System.getProperty("String_Node_Str") == null;
}
Program: 48650
Project: 48650
Buggy source:
@Transactional @RetryTransaction public boolean needUpgrade(String clusterName){
  String serverVersion=getServerVersion();
  String clusterVersion=findByName(clusterName).getVersion();
  return !serverVersion.equals(clusterVersion);
}

Fixed version (ground truth):
@Transactional @RetryTransaction public boolean needUpgrade(String clusterName){
  String serverVersion=getServerVersion();
  String clusterVersion=findByName(clusterName).getVersion();
  List<NodeEntity> nodes=findAllNodes(clusterName);
  boolean allNodesUpgraded=true;
  for (  NodeEntity node : nodes) {
    if (node.canBeUpgrade() && node.needUpgrade(serverVersion)) {
      allNodesUpgraded=false;
      break;
    }
  }
  return !serverVersion.equals(clusterVersion) || !allNodesUpgraded;
}
Program: 48651
Project: 48651
Buggy source:
public ArrayList<String> setPasswordForNodes(String clusterName,ArrayList<String> ipsOfNodes,String password){
  AuAssert.check(!ipsOfNodes.isEmpty());
  logger.info("String_Node_Str" + clusterName);
  logger.info("String_Node_Str" + ipsOfNodes.toString());
  ArrayList<String> failedIPs=null;
  List<Callable<Void>> storeProcedures=new ArrayList<Callable<Void>>();
  for (  String nodeIP : ipsOfNodes) {
    SetVMPasswordSP setVMPasswordSP=new SetVMPasswordSP(nodeIP,password);
    storeProcedures.add(setVMPasswordSP);
  }
  AuAssert.check(!storeProcedures.isEmpty());
  try {
    Callable<Void>[] storeProceduresArray=storeProcedures.toArray(new Callable[0]);
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storeProceduresArray,callback);
    for (int i=0; i < storeProceduresArray.length; i++) {
      if (!result[i].finished || result[i].throwable != null) {
        SetVMPasswordSP sp=(SetVMPasswordSP)storeProceduresArray[i];
        String failedNodeIP=sp.getNodeIP();
        if (failedIPs == null) {
          failedIPs=new ArrayList<String>();
        }
        failedIPs.add(failedNodeIP);
      }
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + clusterName);
    throw BddException.INTERNAL(e,"String_Node_Str" + clusterName);
  }
  return failedIPs;
}

Fixed version (ground truth):
public ArrayList<String> setPasswordForNodes(String clusterName,ArrayList<String> ipsOfNodes,String password){
  AuAssert.check(!ipsOfNodes.isEmpty());
  logger.info("String_Node_Str" + clusterName);
  logger.info("String_Node_Str" + ipsOfNodes.toString());
  ArrayList<String> failedIPs=null;
  List<Callable<Void>> storeProcedures=new ArrayList<Callable<Void>>();
  for (  String nodeIP : ipsOfNodes) {
    SetVMPasswordSP setVMPasswordSP=new SetVMPasswordSP(nodeIP,password);
    storeProcedures.add(setVMPasswordSP);
  }
  AuAssert.check(!storeProcedures.isEmpty());
  try {
    Callable<Void>[] storeProceduresArray=storeProcedures.toArray(new Callable[0]);
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storeProceduresArray,callback);
    for (int i=0; i < storeProceduresArray.length; i++) {
      if (!result[i].finished || result[i].throwable != null) {
        SetVMPasswordSP sp=(SetVMPasswordSP)storeProceduresArray[i];
        String failedNodeIP=sp.getNodeIP();
        if (failedIPs == null) {
          failedIPs=new ArrayList<String>();
        }
        failedIPs.add(failedNodeIP);
      }
    }
  }
 catch (  Exception e) {
    String errMsg="String_Node_Str" + e.getMessage();
    logger.error("String_Node_Str" + clusterName + errMsg);
    throw BddException.INTERNAL(e,"String_Node_Str" + clusterName + errMsg);
  }
  return failedIPs;
}
Program: 48652
Project: 48652
Buggy source:
@Override public boolean setPasswordForNode(String clusterName,String nodeIP,String password) throws Exception {
  AuAssert.check(clusterName != null && nodeIP != null && password != null);
  List<Callable<Void>> storeProcedures=new ArrayList<Callable<Void>>();
  SetVMPasswordSP setVMPasswordSP=new SetVMPasswordSP(nodeIP,password);
  storeProcedures.add(setVMPasswordSP);
  AuAssert.check(!storeProcedures.isEmpty());
  try {
    Callable<Void>[] storeProceduresArray=storeProcedures.toArray(new Callable[0]);
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storeProceduresArray,callback);
    if (result[0].finished && result[0].throwable == null) {
      return true;
    }
    return false;
  }
 catch (  Exception e) {
    throw BddException.INTERNAL(e,"String_Node_Str" + nodeIP + "String_Node_Str"+ clusterName);
  }
}

Fixed version (ground truth):
@Override public boolean setPasswordForNode(String clusterName,String nodeIP,String password) throws Exception {
  AuAssert.check(clusterName != null && nodeIP != null && password != null);
  List<Callable<Void>> storeProcedures=new ArrayList<Callable<Void>>();
  SetVMPasswordSP setVMPasswordSP=new SetVMPasswordSP(nodeIP,password);
  storeProcedures.add(setVMPasswordSP);
  AuAssert.check(!storeProcedures.isEmpty());
  try {
    Callable<Void>[] storeProceduresArray=storeProcedures.toArray(new Callable[0]);
    NoProgressUpdateCallback callback=new NoProgressUpdateCallback();
    ExecutionResult[] result=Scheduler.executeStoredProcedures(com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,storeProceduresArray,callback);
    if (result[0].finished && result[0].throwable == null) {
      return true;
    }
    return false;
  }
 catch (  Exception e) {
    throw BddException.INTERNAL(e,"String_Node_Str" + nodeIP + "String_Node_Str"+ clusterName+ "String_Node_Str"+ e.getMessage());
  }
}
Program: 48654
Project: 48654
Buggy source:
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder){
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  ClusterCreate clusterSpec=configMgr.getClusterConfig(clusterName);
  String newPassword=clusterSpec.getPassword();
  ArrayList<String> nodeIPs=null;
  if (managementOperation == ManagementOperation.CREATE || managementOperation == ManagementOperation.RESIZE) {
    List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
    }
.getType());
    nodeIPs=getAddedNodeIPs(addedNodes);
  }
 else   if (managementOperation == ManagementOperation.RESUME) {
    nodeIPs=getAllNodeIPsFromEntitys(getClusterEntityMgr().findAllNodes(clusterName));
  }
 else {
    throw TaskException.EXECUTION_FAILED("String_Node_Str");
  }
  if (nodeIPs == null) {
    throw TaskException.EXECUTION_FAILED("String_Node_Str");
  }
  ArrayList<String> failedNodes=setPasswordService.setPasswordForNodes(clusterName,nodeIPs,newPassword);
  boolean success=false;
  if (failedNodes == null) {
    success=true;
  }
 else {
    logger.info("String_Node_Str" + failedNodes.toString());
  }
  putIntoJobExecutionContext(chunkContext,JobConstants.CLUSTER_EXISTING_NODES_JOB_PARAM,success);
  if (!success) {
    throw TaskException.EXECUTION_FAILED("String_Node_Str" + failedNodes.toString());
  }
  return RepeatStatus.FINISHED;
}

Fixed version (ground truth):
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder){
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  ClusterCreate clusterSpec=configMgr.getClusterConfig(clusterName);
  String newPassword=clusterSpec.getPassword();
  ArrayList<String> nodeIPs=null;
  if (managementOperation == ManagementOperation.CREATE || managementOperation == ManagementOperation.RESIZE) {
    List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
    }
.getType());
    nodeIPs=getAddedNodeIPs(addedNodes);
  }
 else   if (managementOperation == ManagementOperation.RESUME) {
    nodeIPs=getAllNodeIPsFromEntitys(getClusterEntityMgr().findAllNodes(clusterName));
  }
 else {
    throw TaskException.EXECUTION_FAILED("String_Node_Str");
  }
  if (nodeIPs == null || nodeIPs.isEmpty()) {
    throw TaskException.EXECUTION_FAILED("String_Node_Str");
  }
  ArrayList<String> failedNodes=setPasswordService.setPasswordForNodes(clusterName,nodeIPs,newPassword);
  boolean success=false;
  if (failedNodes == null) {
    success=true;
  }
 else {
    logger.info("String_Node_Str" + failedNodes.toString());
  }
  putIntoJobExecutionContext(chunkContext,JobConstants.CLUSTER_EXISTING_NODES_JOB_PARAM,success);
  if (!success) {
    throw TaskException.EXECUTION_FAILED("String_Node_Str" + failedNodes.toString());
  }
  return RepeatStatus.FINISHED;
}
Program: 48660
Project: 48660
Buggy source:
public void actionOps(String id,Map<String,String> queryStrings){
  actionOps(id,id,queryStrings);
}

Fixed version (ground truth):
public void actionOps(String id,Map<String,String> queryStrings){
  id=CommonUtil.encode(id);
  actionOps(id,id,queryStrings);
}
Program: 48661
Project: 48661
Buggy source:
public void delete(String id){
  final String path=Constants.REST_PATH_CLUSTER;
  final HttpMethod httpverb=HttpMethod.DELETE;
  PrettyOutput outputCallBack=getClusterPrettyOutputCallBack(this,id);
  restClient.deleteObject(id,path,httpverb,outputCallBack);
}

Fixed version (ground truth):
public void delete(String id){
  final String path=Constants.REST_PATH_CLUSTER;
  final HttpMethod httpverb=HttpMethod.DELETE;
  id=CommonUtil.encode(id);
  PrettyOutput outputCallBack=getClusterPrettyOutputCallBack(this,id);
  restClient.deleteObject(id,path,httpverb,outputCallBack);
}
Program: 48662
Project: 48662
Buggy source:
/** 
 * Delete a cluster
 * @param clusterName
 * @param request
 * @return Return a response with Accepted status and put task uri in the Location of header that can be used to monitor the progress
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.DELETE) @ResponseStatus(HttpStatus.ACCEPTED) public void deleteCluster(@PathVariable("String_Node_Str") String clusterName,HttpServletRequest request,HttpServletResponse response) throws Exception {
  verifyInitialized();
  if (!CommonUtil.validateClusterName(clusterName)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  Long taskId=clusterMgr.deleteClusterByName(clusterName);
  redirectRequest(taskId,request,response);
}

Fixed version (ground truth):
/** 
 * Delete a cluster
 * @param clusterName
 * @param request
 * @return Return a response with Accepted status and put task uri in the Location of header that can be used to monitor the progress
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.DELETE) @ResponseStatus(HttpStatus.ACCEPTED) public void deleteCluster(@PathVariable("String_Node_Str") String clusterName,HttpServletRequest request,HttpServletResponse response) throws Exception {
  verifyInitialized();
  clusterName=CommonUtil.decode(clusterName);
  if (!CommonUtil.validateClusterName(clusterName)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  Long taskId=clusterMgr.deleteClusterByName(clusterName);
  redirectRequest(taskId,request,response);
}
Program: 48663
Project: 48663
Buggy source:
/** 
 * Start or stop a normal cluster, or resume a failed cluster after adjusting the resources allocated to this cluster
 * @param clusterName
 * @param state Can be start, stop, or resume
 * @param request
 * @return Return a response with Accepted status and put task uri in the Location of header that can be used to monitor the progress
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT) @ResponseStatus(HttpStatus.ACCEPTED) public void startStopResumeCluster(@PathVariable("String_Node_Str") String clusterName,@RequestParam(value="String_Node_Str",required=true) String state,HttpServletRequest request,HttpServletResponse response) throws Exception {
  verifyInitialized();
  if (CommonUtil.isBlank(clusterName) || !CommonUtil.validateClusterName(clusterName)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  Long taskId;
  if (state.equals("String_Node_Str")) {
    taskId=clusterMgr.stopCluster(clusterName);
    redirectRequest(taskId,request,response);
  }
 else   if (state.equals("String_Node_Str")) {
    taskId=clusterMgr.startCluster(clusterName);
    redirectRequest(taskId,request,response);
  }
 else   if (state.equals("String_Node_Str")) {
    taskId=clusterMgr.resumeClusterCreation(clusterName);
    redirectRequest(taskId,request,response);
  }
 else {
    throw BddException.INVALID_PARAMETER("String_Node_Str",state);
  }
}

Fixed version (ground truth):
/** 
 * Start or stop a normal cluster, or resume a failed cluster after adjusting the resources allocated to this cluster
 * @param clusterName
 * @param state Can be start, stop, or resume
 * @param request
 * @return Return a response with Accepted status and put task uri in the Location of header that can be used to monitor the progress
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT) @ResponseStatus(HttpStatus.ACCEPTED) public void startStopResumeCluster(@PathVariable("String_Node_Str") String clusterName,@RequestParam(value="String_Node_Str",required=true) String state,HttpServletRequest request,HttpServletResponse response) throws Exception {
  verifyInitialized();
  clusterName=CommonUtil.decode(clusterName);
  if (CommonUtil.isBlank(clusterName) || !CommonUtil.validateClusterName(clusterName)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  Long taskId;
  if (state.equals("String_Node_Str")) {
    taskId=clusterMgr.stopCluster(clusterName);
    redirectRequest(taskId,request,response);
  }
 else   if (state.equals("String_Node_Str")) {
    taskId=clusterMgr.startCluster(clusterName);
    redirectRequest(taskId,request,response);
  }
 else   if (state.equals("String_Node_Str")) {
    taskId=clusterMgr.resumeClusterCreation(clusterName);
    redirectRequest(taskId,request,response);
  }
 else {
    throw BddException.INVALID_PARAMETER("String_Node_Str",state);
  }
}
Program: 48664
Project: 48664
Buggy source:
@Transactional private void updateNodeData(NodeEntity node,boolean upgraded,String errorMessage){
  node=clusterEntityMgr.getNodeWithNicsByMobId(node.getMoId());
  String nodeVmName=node.getVmName();
  if (upgraded) {
    if (node.canBeUpgrade()) {
      logger.info("String_Node_Str" + nodeVmName);
      node.setVersion(serverVersion);
      node.setAction(Constants.NODE_ACTION_UPGRADE_SUCCESS);
      node.setActionFailed(false);
      node.setErrMessage(null);
      clusterEntityMgr.update(node);
    }
  }
 else {
    logger.error("String_Node_Str" + nodeVmName);
    node.setAction(Constants.NODE_ACTION_UPGRADE_FAILED);
    node.setActionFailed(true);
    String[] messages=errorMessage.split("String_Node_Str");
    if (messages != null && messages.length > 0) {
      node.setErrMessage(messages[messages.length - 1]);
    }
 else {
      node.setErrMessage("String_Node_Str" + nodeVmName + "String_Node_Str");
    }
    clusterEntityMgr.update(node);
  }
}

Fixed version (ground truth):
@Transactional private void updateNodeData(NodeEntity node,boolean upgraded,String errorMessage,String errorTimestamp){
  node=clusterEntityMgr.getNodeWithNicsByMobId(node.getMoId());
  String nodeVmName=node.getVmName();
  if (upgraded) {
    if (node.canBeUpgrade()) {
      logger.info("String_Node_Str" + nodeVmName);
      node.setVersion(serverVersion);
      node.setAction(Constants.NODE_ACTION_UPGRADE_SUCCESS);
      node.setActionFailed(false);
      node.setErrMessage(null);
      clusterEntityMgr.update(node);
    }
  }
 else {
    logger.error("String_Node_Str" + nodeVmName);
    node.setAction(Constants.NODE_ACTION_UPGRADE_FAILED);
    node.setActionFailed(true);
    String[] messages=errorMessage.split("String_Node_Str");
    if (messages != null && messages.length > 0) {
      node.setErrMessage(errorTimestamp + "String_Node_Str" + messages[messages.length - 1]);
    }
 else {
      node.setErrMessage(errorTimestamp + "String_Node_Str" + "String_Node_Str"+ nodeVmName+ "String_Node_Str");
    }
    clusterEntityMgr.update(node);
  }
}
Program: 48668
Project: 48668
Buggy source:
private String getErrorMessage(Throwable throwable){
  if (throwable == null) {
    return null;
  }
  return throwable.getMessage();
}

Fixed version (ground truth):
private String getErrorMessage(Throwable throwable){
  if (throwable == null) {
    return null;
  }
  return CommonUtil.getCurrentTimestamp() + "String_Node_Str" + throwable.getMessage();
}
Program: 48669
Project: 48669
Buggy source:
public static boolean verifyNodesStatus(List<NodeEntity> nodes,NodeStatus expectedStatus,boolean ignoreMissing){
  boolean success=true;
  for (  NodeEntity node : nodes) {
    try {
      verifyNodeStatus(node,expectedStatus,ignoreMissing);
    }
 catch (    Exception e) {
      node.setActionFailed(true);
      logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ e.getMessage());
      if (node.getErrMessage() == null || node.getErrMessage().isEmpty()) {
        node.setErrMessage(e.getMessage());
        logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ e.getMessage());
      }
      success=false;
    }
  }
  return success;
}

Fixed version (ground truth):
public static boolean verifyNodesStatus(List<NodeEntity> nodes,NodeStatus expectedStatus,boolean ignoreMissing){
  boolean success=true;
  for (  NodeEntity node : nodes) {
    try {
      verifyNodeStatus(node,expectedStatus,ignoreMissing);
    }
 catch (    Exception e) {
      node.setActionFailed(true);
      logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ e.getMessage());
      if (node.getErrMessage() == null || node.getErrMessage().isEmpty()) {
        node.setErrMessage(CommonUtil.getCurrentTimestamp() + "String_Node_Str" + e.getMessage());
        logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ e.getMessage());
      }
      success=false;
    }
  }
  return success;
}
Program: 48673
Project: 48673
Buggy source:
@Transactional private void updateNodeData(NodeEntity node,boolean upgraded,String errorMessage){
  node=clusterEntityMgr.getNodeWithNicsByMobId(node.getMoId());
  String nodeVmName=node.getVmName();
  String nodeIp=node.getPrimaryMgtIpV4();
  if (upgraded) {
    if (nodeIp != null && !Constants.NULL_IPV4_ADDRESS.equals(nodeIp)) {
      logger.info("String_Node_Str" + nodeVmName);
      node.setVersion(serverVersion);
      node.setAction(Constants.NODE_ACTION_UPGRADE_SUCCESS);
      node.setActionFailed(false);
      node.setErrMessage(null);
      clusterEntityMgr.update(node);
    }
  }
 else {
    logger.error("String_Node_Str" + nodeVmName);
    node.setAction(Constants.NODE_ACTION_UPGRADE_FAILED);
    node.setActionFailed(true);
    String[] messages=errorMessage.split("String_Node_Str");
    if (messages != null && messages.length > 0) {
      node.setErrMessage(messages[messages.length - 1]);
    }
 else {
      node.setErrMessage("String_Node_Str" + nodeVmName + "String_Node_Str");
    }
    clusterEntityMgr.update(node);
  }
}

Fixed version (ground truth):
@Transactional private void updateNodeData(NodeEntity node,boolean upgraded,String errorMessage){
  node=clusterEntityMgr.getNodeWithNicsByMobId(node.getMoId());
  String nodeVmName=node.getVmName();
  if (upgraded) {
    if (node.canBeUpgrade()) {
      logger.info("String_Node_Str" + nodeVmName);
      node.setVersion(serverVersion);
      node.setAction(Constants.NODE_ACTION_UPGRADE_SUCCESS);
      node.setActionFailed(false);
      node.setErrMessage(null);
      clusterEntityMgr.update(node);
    }
  }
 else {
    logger.error("String_Node_Str" + nodeVmName);
    node.setAction(Constants.NODE_ACTION_UPGRADE_FAILED);
    node.setActionFailed(true);
    String[] messages=errorMessage.split("String_Node_Str");
    if (messages != null && messages.length > 0) {
      node.setErrMessage(messages[messages.length - 1]);
    }
 else {
      node.setErrMessage("String_Node_Str" + nodeVmName + "String_Node_Str");
    }
    clusterEntityMgr.update(node);
  }
}
Program: 48676
Project: 48676
Buggy source:
@Override protected boolean execute(){
  logger.info("String_Node_Str" + vmId + "String_Node_Str");
  NodeEntity nodeEntity=lockClusterEntityMgr.getClusterEntityMgr().getNodeWithNicsByMobId(vmId);
  if (nodeEntity == null) {
    logger.info("String_Node_Str" + nodeEntity.getVmName() + "String_Node_Str");
  }
  QueryIpAddress query=new QueryIpAddress(nodeEntity.fetchAllPortGroups(),Constants.VM_POWER_ON_WAITING_SEC);
  query.setVmId(vmId);
  try {
    query.call();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + vmId,e);
  }
  String clusterName=CommonUtil.getClusterName(nodeEntity.getVmName());
  lockClusterEntityMgr.refreshNodeByMobId(clusterName,vmId,false);
  ClusterUpgradeService upgradeService=new ClusterUpgradeService();
  IClusterEntityManager clusterEntityMgr=lockClusterEntityMgr.getClusterEntityMgr();
  upgradeService.setClusterEntityMgr(clusterEntityMgr);
  logger.debug("String_Node_Str" + nodeEntity.getVmName() + "String_Node_Str");
  upgradeService.upgradeNode(nodeEntity);
  return true;
}

Fixed version (ground truth):
@Override protected boolean execute(){
  logger.info("String_Node_Str" + vmId + "String_Node_Str");
  NodeEntity nodeEntity=lockClusterEntityMgr.getClusterEntityMgr().getNodeWithNicsByMobId(vmId);
  if (nodeEntity == null) {
    logger.info("String_Node_Str" + nodeEntity.getVmName() + "String_Node_Str");
  }
  QueryIpAddress query=new QueryIpAddress(nodeEntity.fetchAllPortGroups(),Constants.VM_POWER_ON_WAITING_SEC);
  query.setVmId(vmId);
  try {
    query.call();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + vmId,e);
  }
  String clusterName=CommonUtil.getClusterName(nodeEntity.getVmName());
  lockClusterEntityMgr.refreshNodeByMobId(clusterName,vmId,false);
  ClusterUpgradeService upgradeService=new ClusterUpgradeService();
  IClusterEntityManager clusterEntityMgr=lockClusterEntityMgr.getClusterEntityMgr();
  upgradeService.setClusterEntityMgr(clusterEntityMgr);
  logger.debug("String_Node_Str" + nodeEntity.getVmName() + "String_Node_Str");
  clusterEntityMgr.updateNodeAction(nodeEntity,Constants.NODE_ACTION_UPGRADING);
  upgradeService.upgradeNode(nodeEntity);
  return true;
}