nus-yam/ex-repair huggingface dataset:
Program: 48678
Project: 48678
Buggy source:
public void prettyOutput() throws Exception {
  try {
    if (cluster != null) {
      List<NodeGroupRead> nodeGroups=cluster.getNodeGroups();
      if (nodeGroups != null) {
        for (        NodeGroupRead nodeGroup : nodeGroups) {
          System.out.printf("String_Node_Str",nodeGroup.getName(),nodeGroup.getInstanceNum());
          System.out.printf("String_Node_Str",nodeGroup.getRoles());
          printNodesInfo(nodeGroup.getInstances());
        }
        prettyOutputErrorNode(nodeGroups);
      }
    }
  }
 catch (  Exception e) {
    throw e;
  }
}

Fixed version (ground truth):
public void prettyOutput() throws Exception {
  try {
    if (cluster != null) {
      List<NodeGroupRead> nodeGroups=cluster.getNodeGroups();
      if (nodeGroups != null) {
        for (        NodeGroupRead nodeGroup : nodeGroups) {
          System.out.printf("String_Node_Str",nodeGroup.getName(),nodeGroup.getInstanceNum());
          System.out.printf("String_Node_Str",nodeGroup.getRoles());
          printNodesInfo(nodeGroup.getInstances());
        }
        CommandsUtils.prettyOutputErrorNode(nodeGroups);
      }
    }
  }
 catch (  Exception e) {
    throw e;
  }
}
Program: 48680
Project: 48680
Buggy source:
private <T>ResponseEntity<T> login(final String path,final Class<T> respEntityType,final String username,final String password){
  StringBuilder uriBuff=new StringBuilder();
  uriBuff.append(hostUri).append(path);
  if (!CommandsUtils.isBlank(username) && !CommandsUtils.isBlank(password)) {
    uriBuff.append("String_Node_Str").append("String_Node_Str").append(username).append("String_Node_Str").append(password);
  }
  return restPostByUri(uriBuff.toString(),respEntityType,false);
}

Fixed version (ground truth):
private <T>ResponseEntity<T> login(final String path,final Class<T> respEntityType,final String username,final String password){
  StringBuilder uriBuff=new StringBuilder();
  uriBuff.append(hostUri).append(path);
  return restPostByUri(uriBuff.toString(),username,password,respEntityType,false);
}
Program: 48681
Project: 48681
Buggy source:
private <T>ResponseEntity<T> restPostByUri(String uri,Class<T> respEntityType,boolean withCookie){
  HttpHeaders headers=buildHeaders(withCookie);
  HttpEntity<String> entity=new HttpEntity<String>(headers);
  return client.exchange(uri,HttpMethod.POST,entity,respEntityType);
}

Fixed version (ground truth):
private <T>ResponseEntity<T> restPostByUri(String uri,final String username,final String password,Class<T> respEntityType,boolean withCookie){
  HttpHeaders headers=buildHeaders(withCookie);
  HttpEntity<String> entity=new HttpEntity<String>(headers);
  return exchange(uri,username,password,HttpMethod.POST,entity,respEntityType);
}
Program: 48682
Project: 48682
Buggy source:
@Test public void testAsyncSetParamIoPriorityFailed() throws Exception {
  ClusterEntity cluster=TestClusterEntityManager.assembleClusterEntity(TEST_CLUSTER_NAME);
  cluster.setStatus(ClusterStatus.RUNNING);
  clusterEntityMgr.insert(cluster);
  MockTmScheduler.setFlag(VmOperation.RECONFIGURE_VM,false);
  try {
    clusterMgr.asyncSetParam(TEST_CLUSTER_NAME,3,1,4,true,Priority.HIGH);
    assertTrue(false,"String_Node_Str");
  }
 catch (  ClusterManagerException e) {
    List<NodeEntity> nodes=clusterEntityMgr.findAllNodes(TEST_CLUSTER_NAME);
    assertTrue(nodes.get(0).isActionFailed(),"String_Node_Str" + nodes.get(0).isActionFailed());
    assertTrue("String_Node_Str".equals(nodes.get(0).getErrMessage()),"String_Node_Str" + nodes.get(0).getErrMessage());
  }
}

Fixed version (ground truth):
@Test public void testAsyncSetParamIoPriorityFailed() throws Exception {
  ClusterEntity cluster=TestClusterEntityManager.assembleClusterEntity(TEST_CLUSTER_NAME);
  cluster.setStatus(ClusterStatus.RUNNING);
  clusterEntityMgr.insert(cluster);
  MockTmScheduler.setFlag(VmOperation.RECONFIGURE_VM,false);
  try {
    clusterMgr.asyncSetParam(TEST_CLUSTER_NAME,3,1,4,true,Priority.HIGH);
    assertTrue(false,"String_Node_Str");
  }
 catch (  ClusterManagerException e) {
    List<NodeEntity> nodes=clusterEntityMgr.findAllNodes(TEST_CLUSTER_NAME);
    assertTrue(nodes.get(0).isActionFailed(),"String_Node_Str" + nodes.get(0).isActionFailed());
    assertTrue(nodes.get(0).getErrMessage().endsWith("String_Node_Str"),"String_Node_Str" + nodes.get(0).getErrMessage());
  }
}
Program: 48683
Project: 48683
Buggy source:
private String getInputedPassword(String promptMsg){
  try {
    ConsoleReader reader=new ConsoleReader();
    reader.setPrompt(promptMsg);
    String password="String_Node_Str";
    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;
    password=reader.readLine(Character.valueOf('*'));
    if (isValidPassword(password)) {
      return password;
    }
 else {
      return null;
    }
  }
 catch (  IOException e) {
    return null;
  }
}
Program: 48684
Project: 48684
Buggy source:
private boolean containInvalidCharacter(String password){
  if (password.contains(Constants.ESCAPE_CHAR)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean containInvalidCharacter(String password){
  Pattern pattern=Pattern.compile("String_Node_Str");
  if (!pattern.matcher(password).matches()) {
    return true;
  }
  return false;
}
Program: 48685
Project: 48685
Buggy source:
public ClusterCreate getSpec(String id){
  final String path=Constants.REST_PATH_CLUSTER + "String_Node_Str" + id+ "String_Node_Str"+ Constants.REST_PATH_SPEC;
  final HttpMethod httpverb=HttpMethod.GET;
  return restClient.getObjectByPath(ClusterCreate.class,path,httpverb,false);
}

Fixed version (ground truth):
public ClusterCreate getSpec(String id){
  id=CommonUtil.encode(id);
  final String path=Constants.REST_PATH_CLUSTER + "String_Node_Str" + id+ "String_Node_Str"+ Constants.REST_PATH_SPEC;
  final HttpMethod httpverb=HttpMethod.GET;
  return restClient.getObjectByPath(ClusterCreate.class,path,httpverb,false);
}
Program: 48686
Project: 48686
Buggy source:
public ClusterRead get(String id,Boolean detail){
  final String path=Constants.REST_PATH_CLUSTER;
  final HttpMethod httpverb=HttpMethod.GET;
  return restClient.getObject(id,ClusterRead.class,path,httpverb,detail);
}

Fixed version (ground truth):
public ClusterRead get(String id,Boolean detail){
  id=CommonUtil.encode(id);
  final String path=Constants.REST_PATH_CLUSTER;
  final HttpMethod httpverb=HttpMethod.GET;
  return restClient.getObject(id,ClusterRead.class,path,httpverb,detail);
}
Program: 48687
Project: 48687
Buggy source:
/** 
 * Retrieve a cluster information by it name
 * @param clusterName
 * @param details not used by this version
 * @return The cluster information
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces="String_Node_Str") @ResponseBody public ClusterRead getCluster(@PathVariable("String_Node_Str") final String clusterName,@RequestParam(value="String_Node_Str",required=false) Boolean details){
  if (CommonUtil.isBlank(clusterName) || !CommonUtil.validateClusterName(clusterName)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  return clusterMgr.getClusterByName(clusterName,(details == null) ? false : details);
}

Fixed version (ground truth):
/** 
 * Retrieve a cluster information by it name
 * @param clusterName
 * @param details not used by this version
 * @return The cluster information
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces="String_Node_Str") @ResponseBody public ClusterRead getCluster(@PathVariable("String_Node_Str") String clusterName,@RequestParam(value="String_Node_Str",required=false) Boolean details){
  clusterName=CommonUtil.decode(clusterName);
  if (CommonUtil.isBlank(clusterName) || !CommonUtil.validateClusterName(clusterName)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  return clusterMgr.getClusterByName(clusterName,(details == null) ? false : details);
}
Program: 48688
Project: 48688
Buggy source:
/** 
 * Retrieve a cluster's specification by its name
 * @param clusterName
 * @return The cluster specification
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces="String_Node_Str") @ResponseBody public ClusterCreate getClusterSpec(@PathVariable("String_Node_Str") final String clusterName){
  if (CommonUtil.isBlank(clusterName) || !CommonUtil.validateClusterName(clusterName)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  return clusterMgr.getClusterSpec(clusterName);
}

Fixed version (ground truth):
/** 
 * Retrieve a cluster's specification by its name
 * @param clusterName
 * @return The cluster specification
 */
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces="String_Node_Str") @ResponseBody public ClusterCreate getClusterSpec(@PathVariable("String_Node_Str") String clusterName){
  clusterName=CommonUtil.decode(clusterName);
  if (CommonUtil.isBlank(clusterName) || !CommonUtil.validateClusterName(clusterName)) {
    throw BddException.INVALID_PARAMETER("String_Node_Str",clusterName);
  }
  return clusterMgr.getClusterSpec(clusterName);
}
Program: 48689
Project: 48689
Buggy source:
public boolean execCmd(String user,String privateKeyFile,String hostIP,int sshPort,String command,InputStream in,OutputStream out){
  AuAssert.check(command != null);
  connect(user,privateKeyFile,hostIP,sshPort);
  ChannelExec channel=null;
  logger.info("String_Node_Str");
  try {
    channel=(ChannelExec)session.openChannel("String_Node_Str");
    if (channel != null) {
      logger.debug("String_Node_Str");
      channel.setPty(true);
      channel.setCommand(command);
      channel.setInputStream(in);
      channel.setOutputStream(out);
      channel.connect();
      if (!channel.isConnected()) {
        logger.error("String_Node_Str");
      }
      while (true) {
        if (channel.isClosed()) {
          int exitStatus=channel.getExitStatus();
          logger.debug("String_Node_Str" + exitStatus);
          if (exitStatus == 0) {
            return true;
          }
          return false;
        }
        try {
          Thread.sleep(200);
        }
 catch (        InterruptedException e) {
        }
      }
    }
 else {
      logger.error("String_Node_Str" + hostIP + "String_Node_Str");
      return false;
    }
  }
 catch (  JSchException e) {
    e.printStackTrace();
  }
 finally {
    if (channel != null && channel.isConnected()) {
      channel.disconnect();
    }
    if (session != null && channel.isConnected()) {
      session.disconnect();
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean execCmd(String user,String privateKeyFile,String hostIP,int sshPort,String command,InputStream in,OutputStream out){
  AuAssert.check(command != null);
  connect(user,privateKeyFile,hostIP,sshPort);
  ChannelExec channel=null;
  logger.info("String_Node_Str");
  try {
    channel=(ChannelExec)session.openChannel("String_Node_Str");
    if (channel != null) {
      logger.debug("String_Node_Str");
      channel.setPty(true);
      channel.setCommand(command);
      channel.setInputStream(in);
      channel.setOutputStream(out);
      channel.connect();
      if (!channel.isConnected()) {
        logger.error("String_Node_Str");
      }
      while (true) {
        if (channel.isClosed()) {
          int exitStatus=channel.getExitStatus();
          logger.debug("String_Node_Str" + exitStatus);
          if (exitStatus == 0) {
            return true;
          }
          return false;
        }
        try {
          Thread.sleep(200);
        }
 catch (        InterruptedException e) {
        }
      }
    }
 else {
      logger.error("String_Node_Str" + hostIP + "String_Node_Str");
      return false;
    }
  }
 catch (  JSchException e) {
    e.printStackTrace();
  }
 finally {
    if (channel != null && channel.isConnected()) {
      channel.disconnect();
    }
    if (session != null && session.isConnected()) {
      session.disconnect();
    }
  }
  return false;
}
Program: 48690
Project: 48690
Buggy source:
public void forbidSystemExitCall(){
  final SecurityManager securityManager=new SecurityManager(){
    @Override public void checkPermission(    Permission permission){
      if (permission.getName().startsWith("String_Node_Str")) {
        throw new ExitTrappedException();
      }
    }
  }
;
  System.setSecurityManager(securityManager);
}

Fixed version (ground truth):
final public void forbidSystemExitCall(){
  final SecurityManager securityManager=new SecurityManager(){
    @Override public void checkPermission(    Permission permission){
      if (permission.getName().startsWith("String_Node_Str")) {
        throw new ExitTrappedException();
      }
    }
  }
;
  System.setSecurityManager(securityManager);
}
Program: 48691
Project: 48691
Buggy source:
/** 
 * Find or create a matching STATS entry. Note that the STATS source is retrieved from the thread local variable that was previous set by StatsEntry.start() or StatsEntry.push().
 * @param type current STATS type
 * @param objs objects for identifying the STATS entry
 * @return the STATS entry
 */
public static StatsEntry getStatsEntry(StatsType type,Object... objs){
  String key=StatsEntry.getKey(getStatsSrc(),type,objs);
  StatsEntry val=countMap.get(key);
  if (val == null) {
synchronized (countMap) {
      val=countMap.get(key);
      if (val == null) {
        val=new StatsEntry(getStatsSrc(),type,objs);
        countMap.put(key,val);
        sortedSet.add(val);
      }
    }
  }
  return val;
}

Fixed version (ground truth):
/** 
 * Find or create a matching STATS entry. Note that the STATS source is retrieved from the thread local variable that was previous set by StatsEntry.start() or StatsEntry.push().
 * @param type current STATS type
 * @param objs objects for identifying the STATS entry
 * @return the STATS entry
 */
public static StatsEntry getStatsEntry(StatsType type,Object... objs){
  String key=StatsEntry.getKey(getStatsSrc(),type,objs);
synchronized (countMap) {
    StatsEntry val=countMap.get(key);
    if (val == null) {
      val=new StatsEntry(getStatsSrc(),type,objs);
      countMap.put(key,val);
      sortedSet.add(val);
    }
    return val;
  }
}
Program: 48698
Project: 48698
Buggy source:
public boolean removeBadNodes(ClusterCreate cluster,List<BaseNode> existingNodes,List<BaseNode> deletedNodes,Map<String,Set<String>> occupiedIpSets,StatusUpdater statusUpdator){
  logger.info("String_Node_Str" + "String_Node_Str" + cluster.getName());
  List<BaseNode> badNodes=placementService.getBadNodes(cluster,existingNodes);
  if (badNodes == null) {
    badNodes=new ArrayList<BaseNode>();
  }
  for (  BaseNode node : deletedNodes) {
    if (node.getVmMobId() != null) {
      badNodes.add(node);
    }
  }
  if (badNodes != null && badNodes.size() > 0) {
    boolean deleted=syncDeleteVMs(badNodes,statusUpdator,false);
    afterBadVcVmDelete(existingNodes,deletedNodes,badNodes,occupiedIpSets);
    return deleted;
  }
  return true;
}

Fixed version (ground truth):
public boolean removeBadNodes(ClusterCreate cluster,List<BaseNode> existingNodes,List<BaseNode> deletedNodes,Map<String,Set<String>> occupiedIpSets,StatusUpdater statusUpdator){
  logger.info("String_Node_Str" + "String_Node_Str" + cluster.getName());
  List<BaseNode> badNodes=placementService.getBadNodes(cluster,existingNodes);
  if (badNodes == null) {
    badNodes=new ArrayList<BaseNode>();
  }
  for (  BaseNode node : deletedNodes) {
    if (node.getVmMobId() != null) {
      badNodes.add(node);
    }
 else {
      node.setSuccess(true);
    }
  }
  if (badNodes != null && badNodes.size() > 0) {
    boolean deleted=syncDeleteVMs(badNodes,statusUpdator,false);
    afterBadVcVmDelete(existingNodes,deletedNodes,badNodes,occupiedIpSets);
    return deleted;
  }
  return true;
}
Program: 48699
Project: 48699
Buggy source:
public static TaskException HOST_TIME_OUT_OF_SYNC(List<String> outOfSyncHosts){
  return new TaskException(null,"String_Node_Str",outOfSyncHosts.toString());
}

Fixed version (ground truth):
public static TaskException HOST_TIME_OUT_OF_SYNC(List<String> outOfSyncHosts,String managementServerHost){
  return new TaskException(null,"String_Node_Str",outOfSyncHosts.toString(),managementServerHost);
}
Program: 48700
Project: 48700
Buggy source:
/** 
 * Create default cluster spec.
 * @param type cluster type
 * @return default cluster spec
 * @throws FileNotFoundException
 */
public static ClusterCreate createDefaultSpec(ClusterType type,final String vendor) throws FileNotFoundException {
  if (vendor.trim().equalsIgnoreCase(Constants.MAPR_VENDOR)) {
switch (type) {
case HDFS_MAPRED:
      return loadFromFile(locateSpecFile(HDFS_MAPRED_MAPR_TEMPLATE_SPEC));
default :
    throw BddException.INVALID_PARAMETER("String_Node_Str",type);
}
}
 else if (vendor.trim().equalsIgnoreCase(Constants.GPHD_VENDOR)) {
switch (type) {
case HDFS:
  return loadFromFile(locateSpecFile(HDFS_GPHD_TEMPLATE_SPEC));
case HDFS_MAPRED:
return loadFromFile(locateSpecFile(HDFS_MAPRED_GPHD_TEMPLATE_SPEC));
case HDFS_HBASE:
return loadFromFile(locateSpecFile(HDFS_HBASE_GPHD_TEMPLATE_SPEC));
default :
throw BddException.INVALID_PARAMETER("String_Node_Str",type);
}
}
 else {
switch (type) {
case HDFS:
return loadFromFile(locateSpecFile(HDFS_TEMPLATE_SPEC));
case HDFS_MAPRED:
return loadFromFile(locateSpecFile(HDFS_MAPRED_TEMPLATE_SPEC));
case HDFS_HBASE:
return loadFromFile(locateSpecFile(HDFS_HBASE_TEMPLATE_SPEC));
default :
throw BddException.INVALID_PARAMETER("String_Node_Str",type);
}
}
}

Fixed version (ground truth):
/** 
 * Create default cluster spec.
 * @param type cluster type
 * @return default cluster spec
 * @throws FileNotFoundException
 */
public static ClusterCreate createDefaultSpec(ClusterType type,final String vendor) throws FileNotFoundException {
  if (vendor.trim().equalsIgnoreCase(Constants.MAPR_VENDOR)) {
switch (type) {
case HDFS_MAPRED:
      return loadFromFile(locateSpecFile(HDFS_MAPRED_MAPR_TEMPLATE_SPEC));
case HDFS_HBASE:
    return loadFromFile(locateSpecFile(HDFS_HBASE_MAPR_TEMPLATE_SPEC));
default :
  throw BddException.INVALID_PARAMETER("String_Node_Str",type);
}
}
 else if (vendor.trim().equalsIgnoreCase(Constants.GPHD_VENDOR)) {
switch (type) {
case HDFS:
return loadFromFile(locateSpecFile(HDFS_GPHD_TEMPLATE_SPEC));
case HDFS_MAPRED:
return loadFromFile(locateSpecFile(HDFS_MAPRED_GPHD_TEMPLATE_SPEC));
case HDFS_HBASE:
return loadFromFile(locateSpecFile(HDFS_HBASE_GPHD_TEMPLATE_SPEC));
default :
throw BddException.INVALID_PARAMETER("String_Node_Str",type);
}
}
 else {
switch (type) {
case HDFS:
return loadFromFile(locateSpecFile(HDFS_TEMPLATE_SPEC));
case HDFS_MAPRED:
return loadFromFile(locateSpecFile(HDFS_MAPRED_TEMPLATE_SPEC));
case HDFS_HBASE:
return loadFromFile(locateSpecFile(HDFS_HBASE_TEMPLATE_SPEC));
default :
throw BddException.INVALID_PARAMETER("String_Node_Str",type);
}
}
}
Program: 48702
Project: 48702
Buggy source:
@Override public synchronized void addResourcePool(String rpName,String vcClusterName,String vcResourcePool){
  boolean existed=rpDao.isRPAdded(vcClusterName,vcResourcePool);
  if (existed) {
    logger.debug("String_Node_Str" + vcResourcePool + "String_Node_Str"+ vcClusterName+ "String_Node_Str");
    throw VcProviderException.VC_RESOURCE_POOL_ALREADY_ADDED(vcResourcePool);
  }
  if (!resService.isRPExistInVc(vcClusterName,vcResourcePool)) {
    throw VcProviderException.RESOURCE_POOL_NOT_FOUND(vcResourcePool);
  }
  rpDao.addResourcePoolEntity(rpName,vcClusterName,vcResourcePool);
}

Fixed version (ground truth):
@Override public synchronized void addResourcePool(String rpName,String vcClusterName,String vcResourcePool){
  boolean existed=rpDao.isRPAdded(vcClusterName,vcResourcePool);
  if (existed) {
    logger.debug("String_Node_Str" + vcResourcePool + "String_Node_Str"+ vcClusterName+ "String_Node_Str");
    throw VcProviderException.VC_RESOURCE_POOL_ALREADY_ADDED(vcResourcePool);
  }
  resService.refreshResourcePool();
  if (!resService.isRPExistInVc(vcClusterName,vcResourcePool)) {
    throw VcProviderException.RESOURCE_POOL_NOT_FOUND(vcResourcePool);
  }
  rpDao.addResourcePoolEntity(rpName,vcClusterName,vcResourcePool);
}
Program: 48703
Project: 48703
Buggy source:
@Test(groups={"String_Node_Str"}) public void testAddResourcePool(){
  new Expectations(){
{
      rpDao.isRPAdded(anyString,anyString);
      result=false;
      resService.isRPExistInVc(anyString,anyString);
      result=true;
    }
  }
;
  rpSvc.setRpDao(rpDao);
  rpSvc.setResService(resService);
  rpSvc.addResourcePool("String_Node_Str","String_Node_Str","String_Node_Str");
  new Verifications(){
{
      rpDao.addResourcePoolEntity("String_Node_Str","String_Node_Str","String_Node_Str");
    }
  }
;
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"}) public void testAddResourcePool(){
  new Expectations(){
{
      rpDao.isRPAdded(anyString,anyString);
      result=false;
      resService.refreshResourcePool();
      resService.isRPExistInVc(anyString,anyString);
      result=true;
    }
  }
;
  rpSvc.setRpDao(rpDao);
  rpSvc.setResService(resService);
  rpSvc.addResourcePool("String_Node_Str","String_Node_Str","String_Node_Str");
  new Verifications(){
{
      rpDao.addResourcePoolEntity("String_Node_Str","String_Node_Str","String_Node_Str");
    }
  }
;
}
Program: 48704
Project: 48704
Buggy source:
@Test(groups={"String_Node_Str"},expectedExceptions=VcProviderException.class) public void testAddNonExistResourcePool(){
  new Expectations(){
{
      rpDao.isRPAdded(anyString,anyString);
      result=false;
      resService.isRPExistInVc(anyString,anyString);
      result=false;
    }
  }
;
  rpSvc.setRpDao(rpDao);
  rpSvc.setResService(resService);
  rpSvc.addResourcePool("String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test(groups={"String_Node_Str"},expectedExceptions=VcProviderException.class) public void testAddNonExistResourcePool(){
  new Expectations(){
{
      rpDao.isRPAdded(anyString,anyString);
      result=false;
      resService.refreshResourcePool();
      resService.isRPExistInVc(anyString,anyString);
      result=false;
    }
  }
;
  rpSvc.setRpDao(rpDao);
  rpSvc.setResService(resService);
  rpSvc.addResourcePool("String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 48705
Project: 48705
Buggy source:
@Test public void testExclusiveCompetitiveInTwoThread() throws Exception {
  setThreadStarted(false);
  LockTestThread t=new LockTestThread(exclusiveLockedMgr);
  t.start();
  while (!isThreadStarted()) {
    Thread.sleep(10);
  }
  Thread.sleep(40);
  long start=System.currentTimeMillis();
  exclusiveLockedMgr.removeVmReference(LOCKED_CLUSTER_NAME,"String_Node_Str");
  long end=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (end - start) + "String_Node_Str");
  Assert.assertTrue((end - start) >= 150);
  t.join();
}

Fixed version (ground truth):
@Test public void testExclusiveCompetitiveInTwoThread() throws Exception {
  setThreadStarted(false);
  LockTestThread t=new LockTestThread(exclusiveLockedMgr);
  t.start();
  while (!isThreadStarted()) {
    Thread.sleep(10);
  }
  Thread.sleep(40);
  long start=System.currentTimeMillis();
  exclusiveLockedMgr.removeVmReference(LOCKED_CLUSTER_NAME,"String_Node_Str");
  long end=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (end - start) + "String_Node_Str");
  Assert.assertTrue((end - start) >= 100,"String_Node_Str" + (end - start));
  t.join();
}
Program: 48708
Project: 48708
Buggy source:
public void removeDeletedNode(final String clusterName,final Set<String> deletedNodeNames){
  if (deletedNodeNames.isEmpty()) {
    return;
  }
  List<NodeEntity> nodes=getClusterEntityMgr().findAllNodes(clusterName);
  for (  NodeEntity node : nodes) {
    if (deletedNodeNames.contains(node.getVmName())) {
      logger.info("String_Node_Str" + node.getVmName() + "String_Node_Str");
      getClusterEntityMgr().delete(node);
    }
  }
}

Fixed version (ground truth):
@Transactional private void removeDeletedNode(final String clusterName,final List<BaseNode> deletedNodes){
  if (deletedNodes == null || deletedNodes.isEmpty()) {
    return;
  }
  for (  BaseNode deletedNode : deletedNodes) {
    NodeEntity node=getClusterEntityMgr().getNodeByVmName(deletedNode.getVmName());
    if (node != null) {
      if (deletedNode.isSuccess()) {
        getClusterEntityMgr().delete(node);
      }
 else {
        node.setActionFailed(true);
        node.setErrMessage(deletedNode.getErrMessage());
      }
    }
  }
}
Program: 48709
Project: 48709
Buggy source:
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  List<BaseNode> deletedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_DELETED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  Set<String> deletedNodeNames=new HashSet<String>();
  if (deletedNodes != null) {
    for (    BaseNode node : deletedNodes) {
      deletedNodeNames.add(node.getVmName());
    }
  }
  lockClusterEntityMgr.getLock(clusterName).lock();
  putIntoJobExecutionContext(chunkContext,JobConstants.CLUSTER_EXCLUSIVE_WRITE_LOCKED,true);
  addNodeToMetaData(clusterName,addedNodes,deletedNodeNames);
  removeDeletedNode(clusterName,deletedNodeNames);
  verifyCreatedNodes(chunkContext,clusterName);
  if (chunkContext.getStepContext().getJobName().equals(JobConstants.RESUME_CLUSTER_JOB_NAME)) {
    clusterEntityMgr.syncUp(clusterName,false);
  }
  return RepeatStatus.FINISHED;
}

Fixed version (ground truth):
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  List<BaseNode> addedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_ADDED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  List<BaseNode> deletedNodes=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_DELETED_NODES_JOB_PARAM,new TypeToken<List<BaseNode>>(){
  }
.getType());
  Set<String> deletedNodeNames=new HashSet<String>();
  if (deletedNodes != null) {
    for (    BaseNode node : deletedNodes) {
      deletedNodeNames.add(node.getVmName());
    }
  }
  lockClusterEntityMgr.getLock(clusterName).lock();
  putIntoJobExecutionContext(chunkContext,JobConstants.CLUSTER_EXCLUSIVE_WRITE_LOCKED,true);
  addNodeToMetaData(clusterName,addedNodes,deletedNodeNames);
  removeDeletedNode(clusterName,deletedNodes);
  verifyCreatedNodes(chunkContext,clusterName);
  if (chunkContext.getStepContext().getJobName().equals(JobConstants.RESUME_CLUSTER_JOB_NAME)) {
    clusterEntityMgr.syncUp(clusterName,false);
  }
  return RepeatStatus.FINISHED;
}
Program: 48710
Project: 48710
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.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(e.getMessage());
        logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ e.getMessage());
      }
      success=false;
    }
  }
  return success;
}
Program: 48711
Project: 48711
Buggy source:
public static void verifyNodeStatus(NodeEntity node,NodeStatus expectedStatus,boolean ignoreMissing){
  if (node.getStatus() != expectedStatus) {
    if (ignoreMissing && (node.getStatus() == NodeStatus.NOT_EXIST || node.isDisconnected())) {
      return;
    }
    if (node.isDisconnected()) {
      logger.info("String_Node_Str" + node.getVmName() + "String_Node_Str");
      throw ClusteringServiceException.VM_UNAVAILABLE(node.getVmName());
    }
    VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getMoId());
    if (expectedStatus == NodeStatus.VM_READY) {
      if (vm == null || (!vm.isPoweredOn()) || !VcVmUtil.checkIpAddresses(vm)) {
        throw ClusteringServiceException.VM_STATUS_ERROR(node.getStatus().toString(),expectedStatus.toString());
      }
      String haFlag=node.getNodeGroup().getHaFlag();
      if (haFlag != null && Constants.HA_FLAG_FT.equals(haFlag.toLowerCase())) {
        if (!VcVmUtil.verifyFTState(vm)) {
          logger.info("String_Node_Str" + vm.getName() + "String_Node_Str"+ "String_Node_Str"+ vm.getFTState()+ "String_Node_Str");
          throw ClusteringServiceException.ENABLE_FT_FAILED(null,node.getVmName());
        }
      }
    }
 else {
      if (vm == null || (!vm.isPoweredOff())) {
        throw ClusteringServiceException.VM_STATUS_ERROR(node.getStatus().toString(),expectedStatus.toString());
      }
    }
  }
}

Fixed version (ground truth):
public static void verifyNodeStatus(NodeEntity node,NodeStatus expectedStatus,boolean ignoreMissing){
  if (node.getStatus() != expectedStatus) {
    if (ignoreMissing && (node.getStatus() == NodeStatus.NOT_EXIST || node.isDisconnected())) {
      return;
    }
    if (node.isDisconnected()) {
      logger.info("String_Node_Str" + node.getVmName() + "String_Node_Str");
      throw ClusteringServiceException.VM_UNAVAILABLE(node.getVmName());
    }
    VcVirtualMachine vm=VcCache.getIgnoreMissing(node.getMoId());
    if (expectedStatus == NodeStatus.VM_READY) {
      if (vm == null || (!vm.isPoweredOn())) {
        throw ClusteringServiceException.VM_STATUS_ERROR(node.getStatus().toString(),expectedStatus.toString());
      }
      if (!VcVmUtil.checkIpAddresses(vm)) {
        throw ClusteringServiceException.CANNOT_GET_IP_ADDRESS(node.getVmName());
      }
      String haFlag=node.getNodeGroup().getHaFlag();
      if (haFlag != null && Constants.HA_FLAG_FT.equals(haFlag.toLowerCase())) {
        if (!VcVmUtil.verifyFTState(vm)) {
          logger.info("String_Node_Str" + vm.getName() + "String_Node_Str"+ "String_Node_Str"+ vm.getFTState()+ "String_Node_Str");
          throw ClusteringServiceException.ENABLE_FT_FAILED(null,node.getVmName());
        }
      }
    }
 else {
      if (vm == null || (!vm.isPoweredOff())) {
        throw ClusteringServiceException.VM_STATUS_ERROR(node.getStatus().toString(),expectedStatus.toString());
      }
    }
  }
}
Program: 48712
Project: 48712
Buggy source:
@Override protected boolean execute(){
  logger.info("String_Node_Str" + vmId + "String_Node_Str");
  NodeEntity nodeEntity=lockClusterEntityMgr.getClusterEntityMgr().getNodeByMobId(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);
  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);
  return true;
}
Program: 48714
Project: 48714
Buggy source:
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  if (clusterName == null) {
    clusterName=getJobParameters(chunkContext).getString(JobConstants.TARGET_NAME_JOB_PARAM).split("String_Node_Str")[0];
  }
  lockClusterEntityMgr.syncUp(clusterName,false);
  List<NodeOperationStatus> nodesStatus=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_NODES_STATUS,new TypeToken<List<NodeOperationStatus>>(){
  }
.getType());
  if (nodesStatus != null) {
    for (    NodeOperationStatus node : nodesStatus) {
      NodeEntity entity=getClusterEntityMgr().findNodeByName(node.getNodeName());
      entity.setActionFailed(!node.isSucceed());
      entity.setErrMessage(node.getErrorMessage());
    }
  }
  Boolean success=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_OPERATION_SUCCESS,Boolean.class);
  if (success != null && !success) {
    return RepeatStatus.FINISHED;
  }
  NodeStatus expectedStatus=getFromJobExecutionContext(chunkContext,JobConstants.EXPECTED_NODE_STATUS,NodeStatus.class);
  if (expectedStatus != null) {
    logger.info("String_Node_Str" + expectedStatus);
    List<NodeEntity> nodes=getClusterEntityMgr().findAllNodes(clusterName);
    success=JobUtils.verifyNodesStatus(nodes,expectedStatus,true);
    putIntoJobExecutionContext(chunkContext,JobConstants.VERIFY_NODE_STATUS_RESULT_PARAM,success);
  }
  return RepeatStatus.FINISHED;
}

Fixed version (ground truth):
@Override public RepeatStatus executeStep(ChunkContext chunkContext,JobExecutionStatusHolder jobExecutionStatusHolder) throws Exception {
  String clusterName=getJobParameters(chunkContext).getString(JobConstants.CLUSTER_NAME_JOB_PARAM);
  if (clusterName == null) {
    clusterName=getJobParameters(chunkContext).getString(JobConstants.TARGET_NAME_JOB_PARAM).split("String_Node_Str")[0];
  }
  lockClusterEntityMgr.syncUp(clusterName,false);
  setNodeErrorMessages(chunkContext);
  Boolean success=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_OPERATION_SUCCESS,Boolean.class);
  if (success != null && !success) {
    return RepeatStatus.FINISHED;
  }
  verifyNodeStatus(chunkContext,clusterName);
  return RepeatStatus.FINISHED;
}
Program: 48715
Project: 48715
Buggy source:
private void verifyCreatedNodes(ChunkContext chunkContext,String clusterName){
  Boolean created=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_CREATE_VM_OPERATION_SUCCESS,Boolean.class);
  String verifyScope=getJobParameters(chunkContext).getString(JobConstants.VERIFY_NODE_STATUS_SCOPE_PARAM);
  String groupName=null;
  long oldInstanceNum=0;
  if (verifyScope != null && verifyScope.equals(JobConstants.GROUP_NODE_SCOPE_VALUE)) {
    groupName=getJobParameters(chunkContext).getString(JobConstants.GROUP_NAME_JOB_PARAM);
    oldInstanceNum=getJobParameters(chunkContext).getLong(JobConstants.GROUP_INSTANCE_OLD_NUMBER_JOB_PARAM);
  }
  if (created != null && created) {
    boolean success=JobUtils.VerifyClusterNodes(clusterName,verifyScope,groupName,oldInstanceNum,getClusterEntityMgr());
    putIntoJobExecutionContext(chunkContext,JobConstants.VERIFY_NODE_STATUS_RESULT_PARAM,success);
  }
}

Fixed version (ground truth):
@Transactional private void verifyCreatedNodes(ChunkContext chunkContext,String clusterName){
  Boolean created=getFromJobExecutionContext(chunkContext,JobConstants.CLUSTER_CREATE_VM_OPERATION_SUCCESS,Boolean.class);
  String verifyScope=getJobParameters(chunkContext).getString(JobConstants.VERIFY_NODE_STATUS_SCOPE_PARAM);
  String groupName=null;
  long oldInstanceNum=0;
  if (verifyScope != null && verifyScope.equals(JobConstants.GROUP_NODE_SCOPE_VALUE)) {
    groupName=getJobParameters(chunkContext).getString(JobConstants.GROUP_NAME_JOB_PARAM);
    oldInstanceNum=getJobParameters(chunkContext).getLong(JobConstants.GROUP_INSTANCE_OLD_NUMBER_JOB_PARAM);
  }
  if (created != null && created) {
    boolean success=JobUtils.VerifyClusterNodes(clusterName,verifyScope,groupName,oldInstanceNum,getClusterEntityMgr());
    putIntoJobExecutionContext(chunkContext,JobConstants.VERIFY_NODE_STATUS_RESULT_PARAM,success);
  }
}
Program: 48716
Project: 48716
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);
      node.setErrMessage(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.setErrMessage(e.getMessage());
        logger.debug("String_Node_Str" + node.getVmName() + "String_Node_Str"+ e.getMessage());
      }
      success=false;
    }
  }
  return success;
}
Program: 48718
Project: 48718
Buggy source:
@Override @ClusterEntityConcurrentWriteLock public boolean handleOperationStatus(String clusterName,OperationStatusWithDetail status){
  return clusterEntityMgr.handleOperationStatus(clusterName,status);
}

Fixed version (ground truth):
@Override @ClusterEntityConcurrentWriteLock public boolean handleOperationStatus(String clusterName,OperationStatusWithDetail status,boolean lastUpdate){
  return clusterEntityMgr.handleOperationStatus(clusterName,status,lastUpdate);
}
Program: 48719
Project: 48719
Buggy source:
@Override @ClusterEntityExclusiveWriteLock public boolean handleOperationStatus(String clusterName,OperationStatusWithDetail status){
  return clusterEntityMgr.handleOperationStatus(clusterName,status);
}

Fixed version (ground truth):
@Override @ClusterEntityExclusiveWriteLock public boolean handleOperationStatus(String clusterName,OperationStatusWithDetail status,boolean lastUpdate){
  return clusterEntityMgr.handleOperationStatus(clusterName,status,lastUpdate);
}
Program: 48720
Project: 48720
Buggy source:
public boolean handleOperationStatus(String clusterName,OperationStatusWithDetail status);

Fixed version (ground truth):
public boolean handleOperationStatus(String clusterName,OperationStatusWithDetail status,boolean lastUpdate);
Program: 48721
Project: 48721
Buggy source:
public boolean handleOperationStatus(String clusterName,OperationStatusWithDetail status);

Fixed version (ground truth):
public boolean handleOperationStatus(String clusterName,OperationStatusWithDetail status,boolean lastUpdate);
Program: 48724
Project: 48724
Buggy source:
@Test public void testExclusiveCompetitiveInTwoThread() throws Exception {
  setThreadStarted(false);
  LockTestThread t=new LockTestThread(exclusiveLockedMgr);
  t.start();
  while (!isThreadStarted()) {
    Thread.sleep(10);
  }
  Thread.sleep(40);
  long start=System.currentTimeMillis();
  exclusiveLockedMgr.removeVmReference(LOCKED_CLUSTER_NAME,"String_Node_Str");
  long end=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (end - start) + "String_Node_Str");
  Assert.assertTrue((end - start) >= 100,"String_Node_Str" + (end - start));
  t.join();
}

Fixed version (ground truth):
@Test public void testExclusiveCompetitiveInTwoThread() throws Exception {
  setThreadStarted(false);
  LockTestThread t=new LockTestThread(exclusiveLockedMgr);
  t.start();
  while (!isThreadStarted()) {
    Thread.sleep(10);
  }
  Thread.sleep(40);
  long start=System.currentTimeMillis();
  exclusiveLockedMgr.removeVmReference(LOCKED_CLUSTER_NAME,"String_Node_Str");
  long end=System.currentTimeMillis();
  System.out.println("String_Node_Str" + (end - start) + "String_Node_Str");
  t.join();
}
Program: 48726
Project: 48726
Buggy source:
public int compare(String str1,String str2){
  if (HadoopRole.fromString(str1).shouldRunAfterHDFS()) {
    return 1;
  }
 else   if (HadoopRole.fromString(str2).shouldRunAfterHDFS()) {
    return -1;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public int compare(NodeGroupCreate arg0,NodeGroupCreate arg1){
  if (arg0.getGroupType().equals(arg1.getGroupType())) {
    return arg0.getName().compareTo(arg1.getName());
  }
 else {
    return arg0.getGroupType().compareTo(arg1.getGroupType());
  }
}
Program: 48729
Project: 48729
Buggy source:
private Set<NodeGroupEntity> convertNodeGroupsToEntities(Gson gson,ClusterEntity clusterEntity,String distro,NodeGroupCreate[] groups,EnumSet<HadoopRole> allRoles,boolean validateWhiteList){
  Set<NodeGroupEntity> nodeGroups;
  nodeGroups=new HashSet<NodeGroupEntity>();
  Set<String> referencedNodeGroups=new HashSet<String>();
  for (  NodeGroupCreate group : groups) {
    NodeGroupEntity groupEntity=convertGroup(gson,clusterEntity,allRoles,group,distro,validateWhiteList);
    if (groupEntity != null) {
      nodeGroups.add(groupEntity);
      if (groupEntity.getStorageType() == DatastoreType.TEMPFS) {
        for (        NodeGroupAssociation associate : groupEntity.getGroupAssociations()) {
          referencedNodeGroups.add(associate.getReferencedGroup());
        }
      }
    }
  }
  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());
        }
      }
    }
  }
  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: 48731
Project: 48731
Buggy source:
private boolean containInvalidCharacter(String password){
  if (password.contains(Constants.NEW_LINE)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean containInvalidCharacter(String password){
  if (password.contains(Constants.ESCAPE_CHAR)) {
    return true;
  }
  return false;
}
Program: 48734
Project: 48734
Buggy source:
private List<ManagedObjectReference> getSharedNetworkInt() throws Exception {
  List<HostSystem> hostList=MoUtil.getManagedObjects(host);
  List<ManagedObjectReference> results=new ArrayList<ManagedObjectReference>();
  ManagedObjectReference[] candidateList=null;
  HashMap<ManagedObjectReference,Integer> map=new HashMap<ManagedObjectReference,Integer>();
  if (hostList.size() == 0) {
    return results;
  }
  for (  HostSystem h : hostList) {
    ManagedObjectReference[] netMorefs=h.getNetwork();
    if (candidateList == null) {
      candidateList=netMorefs;
    }
    for (    ManagedObjectReference mo : netMorefs) {
      Integer count=map.get(mo);
      if (count != null) {
        map.put(mo,count + 1);
      }
 else {
        map.put(mo,Integer.valueOf(1));
      }
    }
  }
  for (  ManagedObjectReference mo : candidateList) {
    if (map.get(mo).equals(hostList.size())) {
      results.add(mo);
    }
  }
  return results;
}

Fixed version (ground truth):
private List<ManagedObjectReference> getSharedNetworkInt() throws Exception {
  List<HostSystem> hostList=MoUtil.getManagedObjects(host);
  List<ManagedObjectReference> results=new ArrayList<ManagedObjectReference>();
  ManagedObjectReference[] candidateList=null;
  HashMap<ManagedObjectReference,Integer> map=new HashMap<ManagedObjectReference,Integer>();
  if (hostList.size() == 0) {
    return results;
  }
  for (  HostSystem h : hostList) {
    ManagedObjectReference[] netMorefs=h.getNetwork();
    if (candidateList == null) {
      candidateList=netMorefs;
    }
    for (    ManagedObjectReference mo : netMorefs) {
      Integer count=map.get(mo);
      if (count != null) {
        map.put(mo,count + 1);
      }
 else {
        map.put(mo,Integer.valueOf(1));
      }
    }
  }
  if (candidateList != null) {
    for (    ManagedObjectReference mo : candidateList) {
      if (map.get(mo).equals(hostList.size())) {
        results.add(mo);
      }
    }
  }
  return results;
}
Program: 48735
Project: 48735
Buggy source:
private Folder getTargetFolder(NodeEntity node){
  VcVirtualMachine vm=VcCache.get(node.getMoId());
  return vm.getParentFolder();
}

Fixed version (ground truth):
private Folder getTargetFolder(final NodeEntity node){
  return VcContext.inVcSessionDo(new VcSession<Folder>(){
    @Override protected Folder body() throws Exception {
      VcVirtualMachine vm=VcCache.get(node.getMoId());
      return vm.getParentFolder();
    }
  }
);
}