nus-yam/ex-repair huggingface dataset:
Program: 48378
Project: 48378
Buggy source:
private void createBlueprint(final AmClusterDef clusterDef,final ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  String clusterName=clusterDef.getName();
  try {
    logger.info("String_Node_Str" + clusterName);
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setProgress(ProgressSplit.CREATE_BLUEPRINT.getProgress());
    reportStatus(clusterDef.getCurrentReport(),reportQueue);
    if (!isBlueprintCreated(clusterDef)) {
      apiManager.createBlueprint(clusterName,clusterDef.toApiBlueprint());
    }
 else {
      if (isBlueprintCreatedByBDE(clusterDef)) {
        if (isBlueprintCreatedByBDE(clusterDef)) {
          apiManager.deleteBlueprint(clusterName);
        }
        apiManager.createBlueprint(clusterName,clusterDef.toApiBlueprint());
      }
    }
  }
 catch (  Exception e) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    String errorMessage=errorMessage("String_Node_Str" + clusterName,e);
    logger.error(errorMessage);
    throw AmException.CREATE_BLUEPRINT_FAILED(e,clusterName);
  }
 finally {
    reportStatus(clusterDef.getCurrentReport(),reportQueue);
  }
}

Fixed version (ground truth):
private void createBlueprint(final AmClusterDef clusterDef,final ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  String clusterName=clusterDef.getName();
  try {
    logger.info("String_Node_Str" + clusterName);
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setProgress(ProgressSplit.CREATE_BLUEPRINT.getProgress());
    reportStatus(clusterDef.getCurrentReport(),reportQueue);
    ApiBlueprint apiBlueprint=clusterDef.toApiBlueprint();
    if (!isBlueprintCreated(clusterDef)) {
      apiManager.createBlueprint(clusterName,apiBlueprint);
    }
 else {
      if (isBlueprintCreatedByBDE(clusterDef)) {
        apiManager.deleteBlueprint(clusterName);
      }
      apiManager.createBlueprint(clusterName,apiBlueprint);
    }
  }
 catch (  Exception e) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    String errorMessage=errorMessage("String_Node_Str" + clusterName,e);
    logger.error(errorMessage);
    throw AmException.CREATE_BLUEPRINT_FAILED(e,clusterName);
  }
 finally {
    reportStatus(clusterDef.getCurrentReport(),reportQueue);
  }
}
Program: 48379
Project: 48379
Buggy source:
private boolean isBlueprintCreatedByBDE(final AmClusterDef clusterDef) throws SoftwareManagementPluginException {
  String clusterName=clusterDef.getName();
  ApiBlueprint apiBlueprint=apiManager.getBlueprint(clusterName);
  Map<String,Set> groupNamesWithComponents=new HashMap<String,Set>();
  for (  AmNodeDef node : clusterDef.getNodes()) {
    HashSet<String> components=new HashSet<String>();
    groupNamesWithComponents.put(node.getName(),components);
  }
  for (  ApiHostGroup apiHostGroup : apiBlueprint.getApiHostGroups()) {
    String groupName=apiHostGroup.getName();
    if (!groupNamesWithComponents.containsKey(groupName)) {
      throw AmException.BLUEPRINT_ALREADY_EXIST(clusterName);
    }
    @SuppressWarnings("String_Node_Str") Set<String> components=groupNamesWithComponents.get(groupName);
    if (components != null && !components.isEmpty()) {
      for (      ApiComponentInfo apiComponent : apiHostGroup.getApiComponents()) {
        if (!components.contains(apiComponent.getName())) {
          throw AmException.BLUEPRINT_ALREADY_EXIST(clusterName);
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean isBlueprintCreatedByBDE(final AmClusterDef clusterDef) throws SoftwareManagementPluginException {
  ApiBlueprint apiBlueprint=clusterDef.toApiBlueprint();
  String clusterName=clusterDef.getName();
  ApiBlueprint apiBlueprintFromAm=apiManager.getBlueprint(clusterName);
  Map<String,Set> groupNamesWithComponents=new HashMap<String,Set>();
  for (  ApiHostGroup hostGroup : apiBlueprint.getApiHostGroups()) {
    HashSet<String> components=new HashSet<String>();
    groupNamesWithComponents.put(hostGroup.getName(),components);
  }
  for (  ApiHostGroup apiHostGroup : apiBlueprintFromAm.getApiHostGroups()) {
    String groupName=apiHostGroup.getName();
    if (!groupNamesWithComponents.containsKey(groupName)) {
      throw AmException.BLUEPRINT_ALREADY_EXIST(clusterName);
    }
    @SuppressWarnings("String_Node_Str") Set<String> components=groupNamesWithComponents.get(groupName);
    if (components != null && !components.isEmpty()) {
      for (      ApiComponentInfo apiComponent : apiHostGroup.getApiComponents()) {
        if (!components.contains(apiComponent.getName())) {
          throw AmException.BLUEPRINT_ALREADY_EXIST(clusterName);
        }
      }
    }
  }
  return true;
}
Program: 48380
Project: 48380
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|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);
  }
}

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);
      message=transferEncoding(message);
    }
 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: 48381
Project: 48381
Buggy source:
private void startService(CmClusterDef cluster,CmServiceDef serviceDef,int toProgress,final ClusterReportQueue reportQueue) throws Exception {
  if (apiResourceRootV6.getClustersResource().getServicesResource(cluster.getName()).readService(serviceDef.getName()).getServiceState().equals(ApiServiceState.STARTED)) {
    return;
  }
  executeAndReport("String_Node_Str" + serviceDef.getType().getDisplayName(),apiResourceRootV6.getClustersResource().getServicesResource(cluster.getName()).startCommand(serviceDef.getName()),toProgress,cluster.getCurrentReport(),reportQueue,true);
}

Fixed version (ground truth):
private void startService(CmClusterDef cluster,CmServiceDef serviceDef,int toProgress,final ClusterReportQueue reportQueue) throws Exception {
  if (apiResourceRootV6.getClustersResource().getServicesResource(cluster.getName()).readService(serviceDef.getName()).getServiceState().equals(ApiServiceState.STARTED)) {
    return;
  }
  String serviceDisplayName=serviceDef.getType().getDisplayName();
  if (serviceDisplayName.equalsIgnoreCase("String_Node_Str")) {
    return;
  }
  logger.info("String_Node_Str" + serviceDisplayName);
  executeAndReport("String_Node_Str" + serviceDisplayName,apiResourceRootV6.getClustersResource().getServicesResource(cluster.getName()).startCommand(serviceDef.getName()),toProgress,cluster.getCurrentReport(),reportQueue,true);
}
Program: 48382
Project: 48382
Buggy source:
private Map<String,Map<String,Object>> packagingOperationData(Map<String,Map<String,Object>> data,Map<String,Object> rawdata){
  Map<String,Object> modifydata=new HashMap<>();
  modifydata.putAll(rawdata);
  modifydata.remove(CollectionConstants.TASK_ID);
  modifydata.put(CollectionConstants.OBJECT_ID,CommonUtil.getUUID());
  List<Object> operationParameters=(List<Object>)rawdata.get(CollectionConstants.OPERATION_PARAMETERS);
  if (!operationParameters.isEmpty()) {
    MethodParameter methodParameter=new MethodParameter();
    int index=0;
    for (    Object parameter : operationParameters) {
      if (parameter != null) {
        methodParameter.setParameter("String_Node_Str" + index,parameter);
        index++;
      }
    }
    modifydata.put(CollectionConstants.OPERATION_PARAMETERS,methodParameter);
  }
 else {
    modifydata.put(CollectionConstants.OPERATION_PARAMETERS,"String_Node_Str");
  }
  data.put(DataObjectType.OPERATION.getName(),modifydata);
  return data;
}

Fixed version (ground truth):
private Map<String,Map<String,Object>> packagingOperationData(Map<String,Map<String,Object>> data,Map<String,Object> rawdata){
  Map<String,Object> modifydata=new HashMap<>();
  modifydata.putAll(rawdata);
  modifydata.remove(CollectionConstants.TASK_ID);
  modifydata.put(CollectionConstants.OBJECT_ID,CommonUtil.getUUID());
  List<Object> operationParameters=(List<Object>)rawdata.get(CollectionConstants.OPERATION_PARAMETERS);
  if (!operationParameters.isEmpty()) {
    MethodParameter methodParameter=new MethodParameter();
    int index=0;
    for (    Object parameter : operationParameters) {
      if (parameter != null) {
        filterSensitiveData(parameter);
        methodParameter.setParameter("String_Node_Str" + index,parameter);
        index++;
      }
    }
    modifydata.put(CollectionConstants.OPERATION_PARAMETERS,methodParameter);
  }
 else {
    modifydata.put(CollectionConstants.OPERATION_PARAMETERS,"String_Node_Str");
  }
  data.put(DataObjectType.OPERATION.getName(),modifydata);
  return data;
}
Program: 48383
Project: 48383
Buggy source:
@Test public void testCreateClusterWithDistroName() throws Exception {
  CookieCache.put("String_Node_Str","String_Node_Str");
  DistroRead[] distros=new DistroRead[3];
  distros[0]=new DistroRead();
  distros[0].setName(Constants.DEFAULT_DISTRO + 0);
  distros[1]=new DistroRead();
  distros[1].setName(Constants.DEFAULT_DISTRO);
  distros[2]=new DistroRead();
  distros[2].setName(Constants.DEFAULT_DISTRO + 2);
  NetworkRead[] networks=new NetworkRead[1];
  NetworkRead network=new NetworkRead();
  network.setName("String_Node_Str");
  network.setDhcp(true);
  network.setPortGroup("String_Node_Str");
  networks[0]=network;
  ObjectMapper mapper=new ObjectMapper();
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(distros));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(networks));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.POST,HttpStatus.NO_CONTENT,"String_Node_Str");
  clusterCommands.createCluster("String_Node_Str",null,"String_Node_Str",Constants.DEFAULT_DISTRO,null,null,null,null,null,null,null,false,false,true,false,"String_Node_Str",null,null,null);
  CookieCache.clear();
}

Fixed version (ground truth):
@Test public void testCreateClusterWithDistroName() throws Exception {
  CookieCache.put("String_Node_Str","String_Node_Str");
  DistroRead[] distros=new DistroRead[3];
  distros[0]=new DistroRead();
  distros[0].setName(Constants.DEFAULT_DISTRO + 0);
  distros[1]=new DistroRead();
  distros[1].setName(Constants.DEFAULT_DISTRO);
  distros[2]=new DistroRead();
  distros[2].setName(Constants.DEFAULT_DISTRO + 2);
  NetworkRead[] networks=new NetworkRead[1];
  NetworkRead network=new NetworkRead();
  network.setName("String_Node_Str");
  network.setDhcp(true);
  network.setPortGroup("String_Node_Str");
  networks[0]=network;
  ObjectMapper mapper=new ObjectMapper();
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(distros));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(networks));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.POST,HttpStatus.NO_CONTENT,"String_Node_Str");
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(getClusterResponseForCreate()));
  clusterCommands.createCluster("String_Node_Str",null,"String_Node_Str",Constants.DEFAULT_DISTRO,null,null,null,null,null,null,null,false,false,true,false,"String_Node_Str",null,null,null);
  CookieCache.clear();
}
Program: 48384
Project: 48384
Buggy source:
@Test public void testCreateClusterFailure() throws Exception {
  CookieCache.put("String_Node_Str","String_Node_Str");
  DistroRead[] distros=new DistroRead[1];
  DistroRead distro=new DistroRead();
  distro.setName(Constants.DEFAULT_DISTRO);
  distros[0]=distro;
  NetworkRead[] networks=new NetworkRead[1];
  NetworkRead network=new NetworkRead();
  network.setName("String_Node_Str");
  network.setDhcp(true);
  network.setPortGroup("String_Node_Str");
  networks[0]=network;
  ObjectMapper mapper=new ObjectMapper();
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(distros[0]));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(networks));
  BddErrorMessage errorMsg=new BddErrorMessage();
  errorMsg.setMessage("String_Node_Str");
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.POST,HttpStatus.BAD_REQUEST,mapper.writeValueAsString(errorMsg));
  clusterCommands.createCluster("String_Node_Str",null,"String_Node_Str",null,null,null,null,null,null,null,null,false,false,true,false,"String_Node_Str",null,null,null);
  CookieCache.clear();
}

Fixed version (ground truth):
@Test public void testCreateClusterFailure() throws Exception {
  CookieCache.put("String_Node_Str","String_Node_Str");
  DistroRead[] distros=new DistroRead[1];
  DistroRead distro=new DistroRead();
  distro.setName(Constants.DEFAULT_DISTRO);
  distros[0]=distro;
  NetworkRead[] networks=new NetworkRead[1];
  NetworkRead network=new NetworkRead();
  network.setName("String_Node_Str");
  network.setDhcp(true);
  network.setPortGroup("String_Node_Str");
  networks[0]=network;
  ObjectMapper mapper=new ObjectMapper();
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(distros[0]));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(networks));
  BddErrorMessage errorMsg=new BddErrorMessage();
  errorMsg.setMessage("String_Node_Str");
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.POST,HttpStatus.BAD_REQUEST,mapper.writeValueAsString(errorMsg));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(getClusterResponseForCreate()));
  clusterCommands.createCluster("String_Node_Str",null,"String_Node_Str",null,null,null,null,null,null,null,null,false,false,true,false,"String_Node_Str",null,null,null);
  CookieCache.clear();
}
Program: 48387
Project: 48387
Buggy source:
@Test public void testCreateCluster() throws Exception {
  CookieCache.put("String_Node_Str","String_Node_Str");
  DistroRead[] distros=new DistroRead[1];
  DistroRead distro=new DistroRead();
  distro.setName(Constants.DEFAULT_DISTRO);
  distros[0]=distro;
  NetworkRead[] networks=new NetworkRead[1];
  NetworkRead network=new NetworkRead();
  network.setName("String_Node_Str");
  network.setDhcp(true);
  network.setPortGroup("String_Node_Str");
  networks[0]=network;
  ObjectMapper mapper=new ObjectMapper();
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(distros[0]));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(networks));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.POST,HttpStatus.NO_CONTENT,"String_Node_Str");
  clusterCommands.createCluster("String_Node_Str",null,"String_Node_Str",null,null,null,null,null,null,null,null,false,false,true,false,"String_Node_Str",null,null,null);
  CookieCache.clear();
}

Fixed version (ground truth):
@Test public void testCreateCluster() throws Exception {
  ObjectMapper mapper=new ObjectMapper();
  CookieCache.put("String_Node_Str","String_Node_Str");
  DistroRead[] distros=new DistroRead[1];
  DistroRead distro=new DistroRead();
  distro.setName(Constants.DEFAULT_DISTRO);
  distros[0]=distro;
  NetworkRead[] networks=new NetworkRead[1];
  NetworkRead network=new NetworkRead();
  network.setName("String_Node_Str");
  network.setDhcp(true);
  network.setPortGroup("String_Node_Str");
  networks[0]=network;
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(distros[0]));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(networks));
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.POST,HttpStatus.NO_CONTENT,"String_Node_Str");
  buildReqRespWithoutReqBody("String_Node_Str",HttpMethod.GET,HttpStatus.OK,mapper.writeValueAsString(getClusterResponseForCreate()));
  clusterCommands.createCluster("String_Node_Str",null,"String_Node_Str",null,null,null,null,null,null,null,null,false,false,true,false,"String_Node_Str",null,null,null);
  CookieCache.clear();
}
Program: 48388
Project: 48388
Buggy source:
@BeforeMethod(groups={"String_Node_Str"}) public void setMockup(){
  Mockit.setUpMock(MockVcVmUtil.class);
  Mockit.setUpMock(MockVcResourceUtilsForHeal.class);
}

Fixed version (ground truth):
@BeforeMethod(groups={"String_Node_Str"}) public void setMockup(){
  Mockit.setUpMock(MockVcVmUtil.class);
  Mockit.setUpMock(MockVcResourceUtilsForHeal.class);
  Mockit.setUpMock(MockClusterHealService.class);
}
Program: 48390
Project: 48390
Buggy source:
@Test(groups={"String_Node_Str"}) public void testGetBadDisks(){
  logger.info("String_Node_Str");
  List<DiskSpec> badDisks=service.getBadDisks(NODE_1_NAME);
  Assert.assertTrue(badDisks.size() == 1,"String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) public void testGetBadDisks(){
  logger.info("String_Node_Str");
  List<DiskSpec> badDisks=service.getBadDisks(NODE_1_NAME);
  Assert.assertEquals(badDisks.size(),1,"String_Node_Str");
}
Program: 48391
Project: 48391
Buggy source:
@BeforeMethod public void setUp(){
  Mockit.setUpMock(MockVcContext.class);
  Mockit.setUpMock(MockVcCache.class);
  ClusterEntity cluster=clusterEntityMgr.findByName(TEST_CLUSTER_NAME);
  if (cluster != null) {
    clusterEntityMgr.delete(cluster);
  }
  cluster=TestClusterEntityManager.assembleClusterEntity(TEST_CLUSTER_NAME);
  int i=0;
  for (  NodeGroupEntity group : cluster.getNodeGroups()) {
    for (    NodeEntity node : group.getNodes()) {
      node.setMoId(VM_MOB_PREFIX + i++);
    }
  }
  nodeNum=i;
  clusterEntityMgr.insert(cluster);
}

Fixed version (ground truth):
@BeforeMethod public void setUp(){
  Mockit.setUpMock(MockVcContext.class);
  Mockit.setUpMock(MockVcCache.class);
  new MockUp<VcVmUtil>(){
    @Mock public String getMgtHostName(    VcVirtualMachine vcVm,    String primaryMgtIpV4){
      return vcVm.getName();
    }
  }
;
  ClusterEntity cluster=clusterEntityMgr.findByName(TEST_CLUSTER_NAME);
  if (cluster != null) {
    clusterEntityMgr.delete(cluster);
  }
  cluster=TestClusterEntityManager.assembleClusterEntity(TEST_CLUSTER_NAME);
  int i=0;
  for (  NodeGroupEntity group : cluster.getNodeGroups()) {
    for (    NodeEntity node : group.getNodes()) {
      node.setMoId(VM_MOB_PREFIX + i++);
    }
  }
  nodeNum=i;
  clusterEntityMgr.insert(cluster);
}
Program: 48392
Project: 48392
Buggy source:
public void run(){
  try {
    this.sleep(2000);
  }
 catch (  InterruptedException e) {
    logger.error("String_Node_Str");
    return;
  }
  for (int j=0; j < nodeNum; j++) {
    VcVirtualMachine vm=MockVcCache.getIgnoreMissing(VM_MOB_PREFIX + j);
    Map<String,String> map=new HashMap<String,String>();
switch (settings) {
case 0:
      if (flag) {
        map.put(Constants.VM_DISK_FORMAT_STATUS_KEY,"String_Node_Str");
      }
    break;
case 1:
  if (flag) {
    map.put(Constants.VM_DISK_FORMAT_STATUS_KEY,"String_Node_Str");
  }
 else {
    map.put(Constants.VM_DISK_FORMAT_STATUS_KEY,"String_Node_Str");
  }
break;
default :
break;
}
Mockito.when(vm.getGuestVariables()).thenReturn(map);
}
}

Fixed version (ground truth):
public void run(){
  try {
    this.sleep(2000);
  }
 catch (  InterruptedException e) {
    logger.error("String_Node_Str");
    return;
  }
  for (int j=0; j < nodeNum; j++) {
    VcVirtualMachine vm=MockVcCache.getIgnoreMissing(VM_MOB_PREFIX + j);
    Map<String,String> map=new HashMap<String,String>();
switch (settings) {
case 0:
      if (flag) {
        map.put(Constants.VM_DISK_FORMAT_STATUS_KEY,"String_Node_Str");
        map.put(Constants.VM_FQDN_REGISTER_STATUS_KEY,"String_Node_Str");
      }
    break;
case 1:
  if (flag) {
    map.put(Constants.VM_DISK_FORMAT_STATUS_KEY,"String_Node_Str");
    map.put(Constants.VM_FQDN_REGISTER_STATUS_KEY,"String_Node_Str");
    map.put("String_Node_Str","String_Node_Str");
  }
 else {
    map.put(Constants.VM_DISK_FORMAT_STATUS_KEY,"String_Node_Str");
    map.put(Constants.VM_FQDN_REGISTER_STATUS_KEY,"String_Node_Str");
  }
break;
default :
break;
}
Mockito.when(vm.getGuestVariables()).thenReturn(map);
}
}
Program: 48394
Project: 48394
Buggy source:
@Override public boolean createCluster(ClusterBlueprint blueprint,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  boolean success=false;
  CmClusterDef clusterDef=null;
  try {
    ReflectionUtils.getPreStartServicesHook().preStartServices(blueprint.getName());
    clusterDef=new CmClusterDef(blueprint);
    validateBlueprint(blueprint);
    provisionCluster(clusterDef,null,reportQueue);
    provisionParcels(clusterDef,null,reportQueue);
    configureServices(clusterDef,reportQueue,true);
    startServices(clusterDef,reportQueue,true);
    success=true;
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setProgress(100);
    clusterDef.getCurrentReport().setSuccess(true);
  }
 catch (  SoftwareManagementPluginException ex) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setSuccess(false);
    throw ex;
  }
catch (  Exception e) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setSuccess(false);
    logger.error(e.getMessage());
    throw SoftwareManagementPluginException.CREATE_CLUSTER_EXCEPTION(e,Constants.CDH_PLUGIN_NAME,clusterDef.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    if (success) {
      clusterDef.getCurrentReport().setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
    }
    reportQueue.addClusterReport(clusterDef.getCurrentReport().clone());
  }
  return success;
}

Fixed version (ground truth):
@Override public boolean createCluster(ClusterBlueprint blueprint,ClusterReportQueue reportQueue) throws SoftwareManagementPluginException {
  boolean success=false;
  CmClusterDef clusterDef=null;
  try {
    clusterDef=new CmClusterDef(blueprint);
    ReflectionUtils.getPreStartServicesHook().preStartServices(blueprint.getName());
    validateBlueprint(blueprint);
    provisionCluster(clusterDef,null,reportQueue);
    provisionParcels(clusterDef,null,reportQueue);
    configureServices(clusterDef,reportQueue,true);
    startServices(clusterDef,reportQueue,true);
    success=true;
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setProgress(100);
    clusterDef.getCurrentReport().setSuccess(true);
  }
 catch (  SoftwareManagementPluginException ex) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setSuccess(false);
    throw ex;
  }
catch (  Exception e) {
    clusterDef.getCurrentReport().setAction("String_Node_Str");
    clusterDef.getCurrentReport().setSuccess(false);
    logger.error(e.getMessage());
    throw SoftwareManagementPluginException.CREATE_CLUSTER_EXCEPTION(e,Constants.CDH_PLUGIN_NAME,clusterDef.getName());
  }
 finally {
    clusterDef.getCurrentReport().setFinished(true);
    if (success) {
      clusterDef.getCurrentReport().setClusterAndNodesServiceStatus(ServiceStatus.STARTED);
    }
    reportQueue.addClusterReport(clusterDef.getCurrentReport().clone());
  }
  return success;
}
Program: 48398
Project: 48398
Buggy source:
public NicDeviceConfigSpec(NetworkAdd networkAdd,Map<String,String> ipInfo,NodeEntity node,INetworkService networkMgr){
  this(networkAdd,ipInfo);
  NetworkEntity networkEntity=networkMgr.getNetworkEntityByName(networkAdd.getName());
  this.dhcpHostname=HostnameManager.generateHostname(networkEntity,node);
  this.dnsType=NetworkDnsType.DYNAMIC;
}

Fixed version (ground truth):
public NicDeviceConfigSpec(NetworkAdd networkAdd,Map<String,String> ipInfo,NodeEntity node,INetworkService networkMgr){
  this(networkAdd,ipInfo);
  NetworkEntity networkEntity=networkMgr.getNetworkEntityByName(networkAdd.getName());
  this.dhcpHostname=HostnameManager.generateHostname(networkEntity,node);
  this.dnsType=networkEntity.getDnsType();
}
Program: 48399
Project: 48399
Buggy source:
@Transactional private Void updateNodes(final String clusterName){
  return VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      List<NodeEntity> nodes=clusterEntityMgr.findAllNodes(clusterName);
      for (      NodeEntity node : nodes) {
        node=clusterEntityMgr.getNodeWithNicsByMobId(node.getMoId());
        VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getMoId());
        String hostname=VcVmUtil.getMgtHostName(vm,node.getPrimaryMgtIpV4());
        if (hostname != null && !hostname.isEmpty() && !hostname.equals(node.getGuestHostName())) {
          node.setGuestHostName(hostname);
          clusterEntityMgr.update(node);
          logger.info("String_Node_Str" + node.getVmName() + "String_Node_Str"+ node.getGuestHostName());
        }
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
@Transactional private Void updateNodes(final String clusterName){
  return VcContext.inVcSessionDo(new VcSession<Void>(){
    @Override protected Void body() throws Exception {
      List<NodeEntity> nodes=clusterEntityMgr.findAllNodes(clusterName);
      for (      NodeEntity node : nodes) {
        if (node.getMoId() == null || node.getMoId().isEmpty()) {
          continue;
        }
        node=clusterEntityMgr.getNodeWithNicsByMobId(node.getMoId());
        VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getMoId());
        String hostname=VcVmUtil.getMgtHostName(vm,node.getPrimaryMgtIpV4());
        if (hostname != null && !hostname.isEmpty() && !hostname.equals(node.getGuestHostName())) {
          node.setGuestHostName(hostname);
          clusterEntityMgr.update(node);
          logger.info("String_Node_Str" + node.getVmName() + "String_Node_Str"+ node.getGuestHostName());
        }
      }
      return null;
    }
  }
);
}
Program: 48400
Project: 48400
Buggy source:
@Override protected Void body() throws Exception {
  List<NodeEntity> nodes=clusterEntityMgr.findAllNodes(clusterName);
  for (  NodeEntity node : nodes) {
    node=clusterEntityMgr.getNodeWithNicsByMobId(node.getMoId());
    VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getMoId());
    String hostname=VcVmUtil.getMgtHostName(vm,node.getPrimaryMgtIpV4());
    if (hostname != null && !hostname.isEmpty() && !hostname.equals(node.getGuestHostName())) {
      node.setGuestHostName(hostname);
      clusterEntityMgr.update(node);
      logger.info("String_Node_Str" + node.getVmName() + "String_Node_Str"+ node.getGuestHostName());
    }
  }
  return null;
}

Fixed version (ground truth):
@Override protected Void body() throws Exception {
  List<NodeEntity> nodes=clusterEntityMgr.findAllNodes(clusterName);
  for (  NodeEntity node : nodes) {
    if (node.getMoId() == null || node.getMoId().isEmpty()) {
      continue;
    }
    node=clusterEntityMgr.getNodeWithNicsByMobId(node.getMoId());
    VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getMoId());
    String hostname=VcVmUtil.getMgtHostName(vm,node.getPrimaryMgtIpV4());
    if (hostname != null && !hostname.isEmpty() && !hostname.equals(node.getGuestHostName())) {
      node.setGuestHostName(hostname);
      clusterEntityMgr.update(node);
      logger.info("String_Node_Str" + node.getVmName() + "String_Node_Str"+ node.getGuestHostName());
    }
  }
  return null;
}
Program: 48401
Project: 48401
Buggy source:
public static String getHostNameFromIpV4(VcVirtualMachine vcVm,String ipV4){
  VcVmNetworkInfo vcVmNetworkInfo=null;
  String guestNetworkInfo=vcVm.getGuestVariables().get("String_Node_Str");
  if (guestNetworkInfo != null && !guestNetworkInfo.isEmpty()) {
    Gson gson=new Gson();
    vcVmNetworkInfo=gson.fromJson(guestNetworkInfo,VcVmNetworkInfo.class);
  }
  if (vcVmNetworkInfo == null || ipV4 == null) {
    return null;
  }
  String hostName=null;
  for (  VcVmNicInfo vcVmNicInfo : vcVmNetworkInfo.getNics()) {
    if (ipV4.equals(vcVmNicInfo.getIpAddress())) {
      hostName=vcVmNicInfo.getFqdn();
      break;
    }
  }
  return hostName;
}

Fixed version (ground truth):
public static String getHostNameFromIpV4(VcVirtualMachine vcVm,String ipV4){
  VcVmNetworkInfo vcVmNetworkInfo=null;
  if (vcVm == null) {
    return null;
  }
  String guestNetworkInfo=vcVm.getGuestVariables().get("String_Node_Str");
  if (guestNetworkInfo != null && !guestNetworkInfo.isEmpty()) {
    Gson gson=new Gson();
    vcVmNetworkInfo=gson.fromJson(guestNetworkInfo,VcVmNetworkInfo.class);
  }
  if (vcVmNetworkInfo == null || ipV4 == null || Constants.NULL_IPV4_ADDRESS.equals(ipV4)) {
    return null;
  }
  String hostName=null;
  for (  VcVmNicInfo vcVmNicInfo : vcVmNetworkInfo.getNics()) {
    if (ipV4.equals(vcVmNicInfo.getIpAddress())) {
      hostName=vcVmNicInfo.getFqdn();
      break;
    }
  }
  return hostName;
}
Program: 48402
Project: 48402
Buggy source:
@Override public void initResource(){
  final String serverMobId=Configuration.getString(Constants.SERENGETI_SERVER_VM_MOBID);
  logger.info("String_Node_Str" + serverMobId);
  final VcVirtualMachine serverVm=VcResourceUtils.findVM(serverMobId);
  VcResourcePool vcRP=VcResourceUtils.getVmRp(serverVm);
  String dcName=vcRP.getVcCluster().getDatacenter().getName();
  String clusterName=vcRP.getVcCluster().getName();
  String vcRPName=vcRP.getName();
  logger.info("String_Node_Str" + vcRPName + "String_Node_Str"+ clusterName+ "String_Node_Str"+ dcName);
  String networkName=VcResourceUtils.getVMNetwork(serverVm);
  Map<DatastoreType,List<String>> dsNames=VcResourceUtils.getVmDatastore(serverVm);
  if (rpSvc.isDeployedUnderCluster(clusterName,vcRPName)) {
    vcRPName="String_Node_Str";
  }
  addResourceIntoDB(clusterName,vcRPName,networkName,dsNames);
}

Fixed version (ground truth):
@Override public void initResource(){
  final String serverMobId=Configuration.getString(Constants.SERENGETI_SERVER_VM_MOBID);
  logger.info("String_Node_Str" + serverMobId);
  final VcVirtualMachine serverVm=VcResourceUtils.findVM(serverMobId);
  final VcResourcePool vcRP=VcResourceUtils.getVmRp(serverVm);
  String clusterName=VcResourceUtils.getRpCluster(vcRP).getName();
  String vcRPName=vcRP.getName();
  logger.info("String_Node_Str" + vcRPName + "String_Node_Str"+ clusterName);
  String networkName=VcResourceUtils.getVMNetwork(serverVm);
  Map<DatastoreType,List<String>> dsNames=VcResourceUtils.getVmDatastore(serverVm);
  if (rpSvc.isDeployedUnderCluster(clusterName,vcRPName)) {
    vcRPName="String_Node_Str";
  }
  addResourceIntoDB(clusterName,vcRPName,networkName,dsNames);
}
Program: 48403
Project: 48403
Buggy source:
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
  JAXBContext jaxbContext;
  try {
    jaxbContext=JAXBContext.newInstance(Users.class);
    Unmarshaller jaxbUnmarshaller=jaxbContext.createUnmarshaller();
    Users users=(Users)jaxbUnmarshaller.unmarshal(FileUtils.getConfigurationFile(UserService.UsersFile,"String_Node_Str"));
    User userDTO=null;
    boolean exsiting=false;
    boolean anonymous=false;
    if (users != null) {
      for (      User user : users.getUsers()) {
        if (user.getName().equals(username)) {
          exsiting=true;
          userDTO=user;
          break;
        }
 else         if (user.getName().trim().equals("String_Node_Str")) {
          anonymous=true;
          userDTO=user;
          userDTO.setName("String_Node_Str");
        }
      }
    }
    if (!exsiting && !anonymous) {
      throw new UsernameNotFoundException("String_Node_Str");
    }
    ArrayList<GrantedAuthority> roleList=new ArrayList<GrantedAuthority>();
    roleList.add(new SimpleGrantedAuthority(ADMIN_ROLE));
    return new org.springframework.security.core.userdetails.User(userDTO.getName(),"String_Node_Str",roleList);
  }
 catch (  UsernameNotFoundException userNotFoundEx) {
    throw userNotFoundEx;
  }
catch (  Exception e) {
    logger.error("String_Node_Str" + e.getMessage());
    throw new UsernameNotFoundException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
  JAXBContext jaxbContext;
  try {
    jaxbContext=JAXBContext.newInstance(Users.class);
    Unmarshaller jaxbUnmarshaller=jaxbContext.createUnmarshaller();
    Users users=(Users)jaxbUnmarshaller.unmarshal(FileUtils.getConfigurationFile(UserService.UsersFile,"String_Node_Str"));
    User userDTO=null;
    if (users != null) {
      for (      User user : users.getUsers()) {
        if (user.getName().equals(username)) {
          userDTO=user;
          break;
        }
 else         if (user.getName().trim().equals("String_Node_Str")) {
          userDTO=user;
          userDTO.setName("String_Node_Str");
        }
      }
    }
    if (null == userDTO) {
      throw new UsernameNotFoundException("String_Node_Str");
    }
    ArrayList<GrantedAuthority> roleList=new ArrayList<GrantedAuthority>();
    roleList.add(new SimpleGrantedAuthority(ADMIN_ROLE));
    return new org.springframework.security.core.userdetails.User(userDTO.getName(),"String_Node_Str",roleList);
  }
 catch (  UsernameNotFoundException userNotFoundEx) {
    throw userNotFoundEx;
  }
catch (  Exception e) {
    logger.error("String_Node_Str" + e.getMessage());
    throw new UsernameNotFoundException("String_Node_Str");
  }
}
Program: 48404
Project: 48404
Buggy source:
private List<String> getDatastoreNamePattern(DatastoreType storageType,List<String> storeNames){
  if (storageType == null && (storeNames == null || storeNames.isEmpty())) {
    return null;
  }
  Set<String> storePattern=null;
  if (storageType == null) {
    logger.debug("String_Node_Str");
    storePattern=datastoreMgr.getDatastoresByNames(storeNames);
  }
  if (storageType == DatastoreType.LOCAL) {
    storePattern=datastoreMgr.getLocalDatastoresByNames(storeNames);
  }
 else {
    storePattern=datastoreMgr.getSharedDatastoresByNames(storeNames);
  }
  if (storePattern == null || storePattern.isEmpty()) {
    logger.warn("String_Node_Str" + storeNames + "String_Node_Str"+ storageType+ "String_Node_Str");
    return null;
  }
  return new ArrayList<String>(storePattern);
}

Fixed version (ground truth):
private List<String> getDatastoreNamePattern(List<String> storeNames){
  if (storeNames == null || storeNames.isEmpty()) {
    return null;
  }
  Set<String> storePattern=null;
  storePattern=datastoreMgr.getDatastoresByNames(storeNames);
  if (storePattern == null || storePattern.isEmpty()) {
    String datastoreNames=new Gson().toJson(storeNames);
    logger.error("String_Node_Str" + datastoreNames + "String_Node_Str");
    throw BddException.NOT_FOUND("String_Node_Str",datastoreNames);
  }
  return new ArrayList<>(storePattern);
}
Program: 48408
Project: 48408
Buggy source:
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,com.vmware.bdd.utils.Constants.PASSWORD_REQUIREMENT);
        return null;
      }
 else {
        throw e;
      }
    }
    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=CommandsUtils.getConsoleReader();
    reader.setPrompt(promptMsg);
    String password=null;
    password=reader.readLine(Character.valueOf('*'));
    if (isValidPassword(password)) {
      return password;
    }
 else {
      return null;
    }
  }
 catch (  IOException e) {
    return null;
  }
}
Program: 48409
Project: 48409
Buggy source:
private static String readEnter(String msg,PromptType promptType) throws Exception {
  String enter="String_Node_Str";
  ConsoleReader reader=new ConsoleReader();
  reader.setPrompt(msg);
  if (promptType == PromptType.USER_NAME) {
    enter=reader.readLine();
  }
 else   if (promptType == PromptType.PASSWORD) {
    enter=reader.readLine(Character.valueOf('*'));
  }
  return enter;
}

Fixed version (ground truth):
private static String readEnter(String msg,PromptType promptType) throws Exception {
  String enter="String_Node_Str";
  ConsoleReader reader=getConsoleReader();
  reader.setPrompt(msg);
  if (promptType == PromptType.USER_NAME) {
    enter=reader.readLine();
  }
 else   if (promptType == PromptType.PASSWORD) {
    enter=reader.readLine(Character.valueOf('*'));
  }
  return enter;
}
Program: 48410
Project: 48410
Buggy source:
public List<AbstractHost> getAllHosts(){
  List<AbstractHost> hosts=new ArrayList<AbstractHost>();
  for (  AbstractCluster cluster : this.clusters) {
    hosts.addAll(cluster.getHosts());
  }
  return hosts;
}

Fixed version (ground truth):
public List<AbstractHost> getAllHosts(){
  List<AbstractHost> hosts=new ArrayList<AbstractHost>();
  for (  AbstractCluster cluster : this.clusters) {
    List<AbstractHost> clusterHosts=cluster.getHosts();
    if ((clusterHosts != null) && (!clusterHosts.isEmpty())) {
      hosts.addAll(clusterHosts);
    }
  }
  return hosts;
}
Program: 48411
Project: 48411
Buggy source:
public void configureUserMgmt(String clusterName,NodeEntity node){
}

Fixed version (ground truth):
public void configureUserMgmt(String clusterName,NodeEntity node){
  configureUserMgmt(clusterName,Arrays.asList(node));
}
Program: 48412
Project: 48412
Buggy source:
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder){
  clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  List<NodeEntity> nodes=findNodesToEnableLdap(chunkContext);
  clusterLdapUserMgmtCfgService.configureUserMgmt(clusterName,nodes);
  putIntoJobExecutionContext(chunkContext,JobConstants.SET_PASSWORD_SUCCEED_JOB_PARAM,false);
  return RepeatStatus.FINISHED;
}

Fixed version (ground truth):
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder){
  clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  List<NodeEntity> nodes=findNodesToEnableLdap(chunkContext);
  clusterLdapUserMgmtCfgService.configureUserMgmt(clusterName,nodes);
  putIntoJobExecutionContext(chunkContext,"String_Node_Str",false);
  return RepeatStatus.FINISHED;
}
Program: 48413
Project: 48413
Buggy source:
private List<NodeEntity> findNodesToEnableLdap(ChunkContext chunkContext) throws TaskException {
  List<NodeEntity> foundNodeList=null;
  if ((managementOperation == ManagementOperation.CREATE) || (managementOperation == ManagementOperation.RESUME)) {
    foundNodeList=getClusterEntityMgr().findAllNodes(clusterName);
    return foundNodeList;
  }
 else   if (managementOperation == ManagementOperation.RESIZE) {
    String groupName=getJobParameters(chunkContext).getString(JobConstants.GROUP_NAME_JOB_PARAM);
    List<NodeEntity> nodesInGroup=clusterEntityMgr.findAllNodes(clusterName,groupName);
    long oldInstanceNum=getJobParameters(chunkContext).getLong(JobConstants.GROUP_INSTANCE_OLD_NUMBER_JOB_PARAM);
    for (    NodeEntity node : nodesInGroup) {
      long index=CommonUtil.getVmIndex(node.getVmName());
      if (index < oldInstanceNum) {
        continue;
      }
      if (node.getStatus().ordinal() >= NodeStatus.VM_READY.ordinal()) {
        if (foundNodeList == null) {
          foundNodeList=new ArrayList<NodeEntity>();
        }
        foundNodeList.add(node);
      }
    }
    return foundNodeList;
  }
 else {
    throw TaskException.EXECUTION_FAILED("String_Node_Str");
  }
}

Fixed version (ground truth):
private List<NodeEntity> findNodesToEnableLdap(ChunkContext chunkContext) throws TaskException {
  List<NodeEntity> foundNodeList=null;
  if ((managementOperation == ManagementOperation.CREATE) || (managementOperation == ManagementOperation.RESUME)) {
    foundNodeList=getClusterEntityMgr().findAllNodes(clusterName);
    return foundNodeList;
  }
 else   if (managementOperation == ManagementOperation.RESIZE) {
    String groupName=getJobParameters(chunkContext).getString(JobConstants.GROUP_NAME_JOB_PARAM);
    List<NodeEntity> nodesInGroup=clusterEntityMgr.findAllNodes(clusterName,groupName);
    long oldInstanceNum=getJobParameters(chunkContext).getLong(JobConstants.GROUP_INSTANCE_OLD_NUMBER_JOB_PARAM);
    for (    NodeEntity node : nodesInGroup) {
      long index=CommonUtil.getVmIndex(node.getVmName());
      if (index < oldInstanceNum) {
        continue;
      }
      if (node.getStatus().ordinal() >= NodeStatus.VM_READY.ordinal()) {
        if (foundNodeList == null) {
          foundNodeList=new ArrayList<>();
        }
        foundNodeList.add(node);
      }
    }
    return foundNodeList;
  }
 else {
    throw TaskException.EXECUTION_FAILED("String_Node_Str");
  }
}
Program: 48414
Project: 48414
Buggy source:
private static File locateSpecFile(String filename,String appManagerType){
  File specFile=new File(filename);
  if (specFile.exists()) {
    return specFile;
  }
  String homeDir=System.getProperties().getProperty("String_Node_Str");
  if (homeDir != null && !homeDir.trim().isEmpty()) {
    StringBuilder builder=new StringBuilder();
    builder.append(homeDir).append(File.separator).append("String_Node_Str").append(File.separator).append(appManagerType).append(File.separator).append("String_Node_Str").append(File.separator).append(filename);
    specFile=new File(builder.toString());
    if (!specFile.exists()) {
      logger.warn("String_Node_Str" + builder);
    }
 else {
      return specFile;
    }
  }
  URL filePath=ConfigurationUtils.locate(filename);
  if (filePath != null) {
    specFile=ConfigurationUtils.fileFromURL(filePath);
  }
  AuAssert.check(specFile.exists());
  return specFile;
}

Fixed version (ground truth):
private static File locateSpecFile(String filename,String appManagerType){
  File specFile=new File(filename);
  if (specFile.exists()) {
    return specFile;
  }
  String homeDir=System.getProperties().getProperty("String_Node_Str");
  if (homeDir != null && !homeDir.trim().isEmpty()) {
    StringBuilder builder=new StringBuilder();
    builder.append(homeDir).append(File.separator).append("String_Node_Str").append(File.separator).append(appManagerType).append(File.separator).append("String_Node_Str").append(File.separator).append(filename);
    specFile=new File(builder.toString());
    if (!specFile.exists()) {
      logger.warn("String_Node_Str" + builder);
    }
 else {
      return specFile;
    }
  }
  URL filePath=ConfigurationUtils.locate(filename);
  if (filePath != null) {
    specFile=ConfigurationUtils.fileFromURL(filePath);
  }
  AuAssert.check(specFile.exists(),"String_Node_Str" + specFile.getAbsolutePath());
  return specFile;
}
Program: 48415
Project: 48415
Buggy source:
public static int compare(String[] srcVersionArray,String[] destVersionArray,int type){
  for (int j=srcVersionArray.length; j < destVersionArray.length; j++) {
    if (Integer.parseInt(destVersionArray[j]) > 0) {
      return type;
    }
  }
  return 0;
}

Fixed version (ground truth):
public static int compare(int[] srcVersionArray,int[] destVersionArray,int type){
  for (int j=srcVersionArray.length; j < destVersionArray.length; j++) {
    if (destVersionArray[j] > 0) {
      return type;
    }
  }
  return 0;
}
Program: 48417
Project: 48417
Buggy source:
@Transactional(readOnly=true) public ClusterCreate getClusterConfig(String clusterName,boolean needAllocIp){
  ClusterEntity clusterEntity=clusterEntityMgr.findByName(clusterName);
  if (clusterEntity == null) {
    throw ClusterConfigException.CLUSTER_CONFIG_NOT_FOUND(clusterName);
  }
  ClusterCreate clusterConfig=new ClusterCreate();
  clusterConfig.setName(clusterEntity.getName());
  clusterConfig.setAppManager(clusterEntity.getAppManager());
  clusterConfig.setDistro(clusterEntity.getDistro());
  convertClusterConfig(clusterEntity,clusterConfig,needAllocIp);
  Gson gson=new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
  String manifest=gson.toJson(clusterConfig);
  logger.debug("String_Node_Str" + manifest);
  return clusterConfig;
}

Fixed version (ground truth):
@Transactional(readOnly=true) public ClusterCreate getClusterConfig(String clusterName,boolean needAllocIp){
  ClusterEntity clusterEntity=clusterEntityMgr.findByName(clusterName);
  if (clusterEntity == null) {
    throw ClusterConfigException.CLUSTER_CONFIG_NOT_FOUND(clusterName);
  }
  ClusterCreate clusterConfig=new ClusterCreate();
  clusterConfig.setName(clusterEntity.getName());
  clusterConfig.setAppManager(clusterEntity.getAppManager());
  clusterConfig.setDistro(clusterEntity.getDistro());
  Map<NetTrafficType,List<ClusterNetConfigInfo>> networkConfigInfo=clusterEntity.getNetworkConfigInfo();
  if (networkConfigInfo != null && !networkConfigInfo.isEmpty()) {
    for (    NetTrafficType trafficType : networkConfigInfo.keySet()) {
      clusterConfig.setHostnamePrefix(networkConfigInfo.get(trafficType).get(0).getHostnamePrefix());
      break;
    }
  }
  convertClusterConfig(clusterEntity,clusterConfig,needAllocIp);
  Gson gson=new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
  String manifest=gson.toJson(clusterConfig);
  logger.debug("String_Node_Str" + manifest);
  return clusterConfig;
}
Program: 48418
Project: 48418
Buggy source:
private static String generateHostnameWithTrafficType(NetTrafficType netTrafficType,String vNodeName) throws BddException {
  String prefix=getHostnamePrefix();
  String hdfsSuffix=getHostnameHdfsSuffix();
  String mapredSuffix=getHostnameMapredSuffix();
  String hostname="String_Node_Str";
  String suffix="String_Node_Str";
switch (netTrafficType) {
case MGT_NETWORK:
    suffix=vNodeName;
  break;
case HDFS_NETWORK:
suffix=vNodeName + hdfsSuffix;
break;
case MAPRED_NETWORK:
suffix=vNodeName + mapredSuffix;
break;
default :
suffix=vNodeName;
break;
}
hostname=(prefix + suffix).replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
return hostname;
}

Fixed version (ground truth):
private static String generateHostnameWithTrafficType(NetTrafficType netTrafficType,String vNodeName,String hostnamePrefix) throws BddException {
  String prefix=getHostnamePrefix();
  if (hostnamePrefix != null) {
    prefix=hostnamePrefix;
  }
  String hdfsSuffix=getHostnameHdfsSuffix();
  String mapredSuffix=getHostnameMapredSuffix();
  String hostname="String_Node_Str";
  String suffix="String_Node_Str";
switch (netTrafficType) {
case MGT_NETWORK:
    suffix=vNodeName;
  break;
case HDFS_NETWORK:
suffix=vNodeName + hdfsSuffix;
break;
case MAPRED_NETWORK:
suffix=vNodeName + mapredSuffix;
break;
default :
suffix=vNodeName;
break;
}
hostname=(prefix + suffix).replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
return hostname;
}