Program: 61094
Project: 61094
Buggy source:
@Override public void moveServers(Set<HostAndPort> servers,String targetGroupName) throws IOException {
  if (servers == null) {
    throw new ConstraintException("String_Node_Str");
  }
  if (StringUtils.isEmpty(targetGroupName)) {
    throw new ConstraintException("String_Node_Str");
  }
  if (servers.size() < 1) {
    return;
  }
  RSGroupInfo targetGrp=getRSGroupInfo(targetGroupName);
  if (targetGrp == null) {
    throw new ConstraintException("String_Node_Str" + targetGroupName);
  }
  RSGroupInfoManager manager=getRSGroupInfoManager();
synchronized (manager) {
    if (master.getMasterCoprocessorHost() != null) {
      master.getMasterCoprocessorHost().preMoveServers(servers,targetGroupName);
    }
    HostAndPort firstServer=servers.iterator().next();
    RSGroupInfo srcGrp=manager.getRSGroupOfServer(firstServer);
    if (srcGrp == null) {
      throw new ConstraintException("String_Node_Str" + firstServer + "String_Node_Str");
    }
    if (RSGroupInfo.DEFAULT_GROUP.equals(srcGrp.getName())) {
      Set<HostAndPort> onlineServers=new HashSet<HostAndPort>();
      for (      ServerName server : master.getServerManager().getOnlineServers().keySet()) {
        onlineServers.add(server.getHostPort());
      }
      for (      HostAndPort el : servers) {
        if (!onlineServers.contains(el)) {
          throw new ConstraintException("String_Node_Str" + el + "String_Node_Str");
        }
      }
    }
    if (srcGrp.getServers().size() <= servers.size() && srcGrp.getTables().size() > 0) {
      throw new ConstraintException("String_Node_Str" + srcGrp.getName() + "String_Node_Str"+ "String_Node_Str");
    }
    String sourceGroupName=getRSGroupInfoManager().getRSGroupOfServer(srcGrp.getServers().iterator().next()).getName();
    if (getRSGroupInfo(targetGroupName) == null) {
      throw new ConstraintException("String_Node_Str" + targetGroupName);
    }
    for (    HostAndPort server : servers) {
      if (serversInTransition.containsKey(server)) {
        throw new ConstraintException("String_Node_Str" + server);
      }
      String tmpGroup=getRSGroupInfoManager().getRSGroupOfServer(server).getName();
      if (sourceGroupName != null && !tmpGroup.equals(sourceGroupName)) {
        throw new ConstraintException("String_Node_Str" + "String_Node_Str" + sourceGroupName + "String_Node_Str"+ tmpGroup);
      }
    }
    if (sourceGroupName.equals(targetGroupName)) {
      throw new ConstraintException("String_Node_Str" + targetGroupName);
    }
    try {
      for (      HostAndPort server : servers) {
        serversInTransition.put(server,targetGroupName);
      }
      getRSGroupInfoManager().moveServers(servers,sourceGroupName,targetGroupName);
      boolean found;
      List<HostAndPort> tmpServers=Lists.newArrayList(servers);
      do {
        found=false;
        for (Iterator<HostAndPort> iter=tmpServers.iterator(); iter.hasNext(); ) {
          HostAndPort rs=iter.next();
          List<HRegionInfo> regions=new LinkedList<HRegionInfo>();
          for (          Map.Entry<HRegionInfo,ServerName> el : master.getAssignmentManager().getRegionStates().getRegionAssignments().entrySet()) {
            if (el.getValue().getHostPort().equals(rs)) {
              regions.add(el.getKey());
            }
          }
          for (          RegionState state : master.getAssignmentManager().getRegionStates().getRegionsInTransition()) {
            if (state.getServerName().getHostPort().equals(rs)) {
              regions.add(state.getRegion());
            }
          }
          LOG.info("String_Node_Str" + regions.size() + "String_Node_Str"+ rs+ "String_Node_Str"+ targetGroupName);
          if (regions.size() > 0) {
            for (            HRegionInfo region : regions) {
              if (!targetGrp.containsTable(region.getTable())) {
                master.getAssignmentManager().unassign(region);
                found=true;
              }
            }
          }
          if (!found) {
            iter.remove();
          }
        }
        try {
          Thread.sleep(1000);
        }
 catch (        InterruptedException e) {
          LOG.warn("String_Node_Str",e);
          Thread.currentThread().interrupt();
        }
      }
 while (found);
    }
  finally {
      for (      HostAndPort server : servers) {
        serversInTransition.remove(server);
      }
    }
    if (master.getMasterCoprocessorHost() != null) {
      master.getMasterCoprocessorHost().postMoveServers(servers,targetGroupName);
    }
    LOG.info("String_Node_Str" + sourceGroupName + "String_Node_Str"+ targetGroupName);
  }
}

Fixed version (ground truth):
@Override public void moveServers(Set<HostAndPort> servers,String targetGroupName) throws IOException {
  if (servers == null) {
    throw new ConstraintException("String_Node_Str");
  }
  if (StringUtils.isEmpty(targetGroupName)) {
    throw new ConstraintException("String_Node_Str");
  }
  if (servers.size() < 1) {
    return;
  }
  RSGroupInfo targetGrp=getRSGroupInfo(targetGroupName);
  if (targetGrp == null) {
    throw new ConstraintException("String_Node_Str" + targetGroupName);
  }
  RSGroupInfoManager manager=getRSGroupInfoManager();
synchronized (manager) {
    if (master.getMasterCoprocessorHost() != null) {
      master.getMasterCoprocessorHost().preMoveServers(servers,targetGroupName);
    }
    HostAndPort firstServer=servers.iterator().next();
    RSGroupInfo srcGrp=manager.getRSGroupOfServer(firstServer);
    if (srcGrp == null) {
      throw new ConstraintException("String_Node_Str" + firstServer + "String_Node_Str");
    }
    if (RSGroupInfo.DEFAULT_GROUP.equals(srcGrp.getName())) {
      Set<HostAndPort> onlineServers=new HashSet<HostAndPort>();
      for (      ServerName server : master.getServerManager().getOnlineServers().keySet()) {
        onlineServers.add(server.getHostPort());
      }
      for (      HostAndPort el : servers) {
        if (!onlineServers.contains(el)) {
          throw new ConstraintException("String_Node_Str" + el + "String_Node_Str");
        }
      }
    }
    if (srcGrp.getServers().size() <= servers.size() && srcGrp.getTables().size() > 0) {
      throw new ConstraintException("String_Node_Str" + srcGrp.getName() + "String_Node_Str"+ "String_Node_Str");
    }
    String sourceGroupName=getRSGroupInfoManager().getRSGroupOfServer(srcGrp.getServers().iterator().next()).getName();
    if (getRSGroupInfo(targetGroupName) == null) {
      throw new ConstraintException("String_Node_Str" + targetGroupName);
    }
    for (    HostAndPort server : servers) {
      if (serversInTransition.containsKey(server)) {
        throw new ConstraintException("String_Node_Str" + server);
      }
      String tmpGroup=getRSGroupInfoManager().getRSGroupOfServer(server).getName();
      if (sourceGroupName != null && !tmpGroup.equals(sourceGroupName)) {
        throw new ConstraintException("String_Node_Str" + "String_Node_Str" + sourceGroupName + "String_Node_Str"+ tmpGroup);
      }
    }
    if (sourceGroupName.equals(targetGroupName)) {
      throw new ConstraintException("String_Node_Str" + targetGroupName);
    }
    try {
      for (      HostAndPort server : servers) {
        serversInTransition.put(server,targetGroupName);
      }
      getRSGroupInfoManager().moveServers(servers,sourceGroupName,targetGroupName);
      boolean found;
      List<HostAndPort> tmpServers=Lists.newArrayList(servers);
      do {
        found=false;
        for (Iterator<HostAndPort> iter=tmpServers.iterator(); iter.hasNext(); ) {
          HostAndPort rs=iter.next();
          List<HRegionInfo> regions=new LinkedList<HRegionInfo>();
          for (          Map.Entry<HRegionInfo,ServerName> el : master.getAssignmentManager().getRegionStates().getRegionAssignments().entrySet()) {
            if (el.getValue().getHostPort().equals(rs)) {
              regions.add(el.getKey());
            }
          }
          for (          RegionState state : master.getAssignmentManager().getRegionStates().getRegionsInTransition()) {
            if (state.getServerName().getHostPort().equals(rs)) {
              regions.add(state.getRegion());
            }
          }
          LOG.info("String_Node_Str" + regions.size() + "String_Node_Str"+ rs+ "String_Node_Str"+ targetGroupName);
          if (regions.size() > 0) {
            for (            HRegionInfo region : regions) {
              if (!targetGrp.containsTable(region.getTable())) {
                master.getAssignmentManager().unassign(region);
                found=true;
              }
            }
          }
          if (!found) {
            iter.remove();
          }
        }
        try {
          manager.wait(1000);
        }
 catch (        InterruptedException e) {
          LOG.warn("String_Node_Str",e);
          Thread.currentThread().interrupt();
        }
      }
 while (found);
    }
  finally {
      for (      HostAndPort server : servers) {
        serversInTransition.remove(server);
      }
    }
    if (master.getMasterCoprocessorHost() != null) {
      master.getMasterCoprocessorHost().postMoveServers(servers,targetGroupName);
    }
    LOG.info("String_Node_Str" + sourceGroupName + "String_Node_Str"+ targetGroupName);
  }
}