nus-yam/ex-repair huggingface dataset:
Program: 61090
Project: 61090
Buggy source:
/** 
 * Creates store files.
 * @param basePath the path to create file
 * @family the family name
 * @qualifier the column qualifier
 * @count the store file number
 * @type the key type
 */
private void createStoreFiles(Path basePath,String family,String qualifier,int count,Type type) throws IOException {
  HFileContext meta=new HFileContextBuilder().withBlockSize(8 * 1024).build();
  String startKey="String_Node_Str";
  MobFileName mobFileName=null;
  for (int i=0; i < count; i++) {
    byte[] startRow=Bytes.toBytes(startKey + i);
    if (type.equals(Type.Delete)) {
      mobFileName=MobFileName.create(startRow,MobUtils.formatDate(new Date()),delSuffix);
    }
    if (type.equals(Type.Put)) {
      mobFileName=MobFileName.create(Bytes.toBytes(startKey + i),MobUtils.formatDate(new Date()),mobSuffix);
    }
    StoreFileWriter mobFileWriter=new StoreFileWriter.Builder(conf,cacheConf,fs).withFileContext(meta).withFilePath(new Path(basePath,mobFileName.getFileName())).build();
    writeStoreFile(mobFileWriter,startRow,Bytes.toBytes(family),Bytes.toBytes(qualifier),type,(i + 1) * 1000);
  }
}

Fixed version (ground truth):
private void createStoreFiles(Path basePath,String family,String qualifier,int count,Type type,boolean sameStartKey) throws IOException {
  HFileContext meta=new HFileContextBuilder().withBlockSize(8 * 1024).build();
  String startKey="String_Node_Str";
  MobFileName mobFileName=null;
  for (int i=0; i < count; i++) {
    byte[] startRow;
    if (sameStartKey) {
      startRow=Bytes.toBytes(startKey);
      mobSuffix=UUID.randomUUID().toString().replaceAll("String_Node_Str","String_Node_Str");
      delSuffix=UUID.randomUUID().toString().replaceAll("String_Node_Str","String_Node_Str") + "String_Node_Str";
    }
 else {
      startRow=Bytes.toBytes(startKey + i);
    }
    if (type.equals(Type.Delete)) {
      mobFileName=MobFileName.create(startRow,MobUtils.formatDate(new Date()),delSuffix);
    }
    if (type.equals(Type.Put)) {
      mobFileName=MobFileName.create(startRow,MobUtils.formatDate(new Date()),mobSuffix);
    }
    StoreFileWriter mobFileWriter=new StoreFileWriter.Builder(conf,cacheConf,fs).withFileContext(meta).withFilePath(new Path(basePath,mobFileName.getFileName())).build();
    writeStoreFile(mobFileWriter,startRow,Bytes.toBytes(family),Bytes.toBytes(qualifier),type,(i + 1) * 1000);
  }
}
Program: 61091
Project: 61091
Buggy source:
@BeforeClass public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.getConfiguration().setInt("String_Node_Str",3);
  TEST_UTIL.startMiniCluster(1);
  pool=createThreadPool();
}

Fixed version (ground truth):
@BeforeClass public static void setUpBeforeClass() throws Exception {
  TEST_UTIL.getConfiguration().setInt("String_Node_Str",3);
  TEST_UTIL.getConfiguration().setClass("String_Node_Str",FaultyDistributedFileSystem.class,DistributedFileSystem.class);
  TEST_UTIL.startMiniCluster(1);
  pool=createThreadPool();
}
Program: 61092
Project: 61092
Buggy source:
/** 
 * Actually do the mvcc read. Does no checks.
 * @param offsetFromPos
 */
private void _readMvccVersion(int offsetFromPos){
  byte firstByte=blockBuffer.getByteAfterPosition(offsetFromPos);
  int len=WritableUtils.decodeVIntSize(firstByte);
  if (len == 1) {
    this.currMemstoreTS=firstByte;
  }
 else {
    int remaining=len - 1;
    long i=0;
    offsetFromPos++;
    if (remaining >= Bytes.SIZEOF_INT) {
      i=blockBuffer.getIntAfterPosition(offsetFromPos);
      remaining-=Bytes.SIZEOF_INT;
      offsetFromPos+=Bytes.SIZEOF_INT;
    }
    if (remaining >= Bytes.SIZEOF_SHORT) {
      short s=blockBuffer.getShortAfterPosition(offsetFromPos);
      i=i << 16;
      i=i | (s & 0xFFFF);
      remaining-=Bytes.SIZEOF_SHORT;
      offsetFromPos+=Bytes.SIZEOF_SHORT;
    }
    for (int idx=0; idx < remaining; idx++) {
      byte b=blockBuffer.getByteAfterPosition(offsetFromPos + idx);
      i=i << 8;
      i=i | (b & 0xFF);
    }
    currMemstoreTS=(WritableUtils.isNegativeVInt(firstByte) ? ~i : i);
  }
  this.currMemstoreTSLen=len;
}

Fixed version (ground truth):
/** 
 * Actually do the mvcc read. Does no checks.
 * @param offsetFromPos
 */
private void _readMvccVersion(int offsetFromPos){
  byte firstByte=blockBuffer.getByteAfterPosition(offsetFromPos);
  int len=WritableUtils.decodeVIntSize(firstByte);
  if (len == 1) {
    this.currMemstoreTS=firstByte;
  }
 else {
    int remaining=len - 1;
    long i=0;
    offsetFromPos++;
    if (remaining >= Bytes.SIZEOF_INT) {
      i=(blockBuffer.getIntAfterPosition(offsetFromPos) & 0x00000000ffffffffL);
      remaining-=Bytes.SIZEOF_INT;
      offsetFromPos+=Bytes.SIZEOF_INT;
    }
    if (remaining >= Bytes.SIZEOF_SHORT) {
      short s=blockBuffer.getShortAfterPosition(offsetFromPos);
      i=i << 16;
      i=i | (s & 0xFFFF);
      remaining-=Bytes.SIZEOF_SHORT;
      offsetFromPos+=Bytes.SIZEOF_SHORT;
    }
    for (int idx=0; idx < remaining; idx++) {
      byte b=blockBuffer.getByteAfterPosition(offsetFromPos + idx);
      i=i << 8;
      i=i | (b & 0xFF);
    }
    currMemstoreTS=(WritableUtils.isNegativeVInt(firstByte) ? ~i : i);
  }
  this.currMemstoreTSLen=len;
}
Program: 61093
Project: 61093
Buggy source:
@Override public void start(CoprocessorEnvironment env) throws IOException {
  MasterCoprocessorEnvironment menv=(MasterCoprocessorEnvironment)env;
  master=menv.getMasterServices();
  groupInfoManager=new RSGroupInfoManagerImpl(master);
  groupAdminServer=new RSGroupAdminServer(master,groupInfoManager);
  Class clazz=master.getConfiguration().getClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,null);
  if (!RSGroupableBalancer.class.isAssignableFrom(clazz)) {
    throw new IOException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void start(CoprocessorEnvironment env) throws IOException {
  MasterCoprocessorEnvironment menv=(MasterCoprocessorEnvironment)env;
  master=menv.getMasterServices();
  setGroupInfoManager(new RSGroupInfoManagerImpl(master));
  groupAdminServer=new RSGroupAdminServer(master,groupInfoManager);
  Class clazz=master.getConfiguration().getClass(HConstants.HBASE_MASTER_LOADBALANCER_CLASS,null);
  if (!RSGroupableBalancer.class.isAssignableFrom(clazz)) {
    throw new IOException("String_Node_Str");
  }
}
Program: 61095
Project: 61095
Buggy source:
private Map<ServerName,List<HRegionInfo>> correctAssignments(Map<ServerName,List<HRegionInfo>> existingAssignments){
  Map<ServerName,List<HRegionInfo>> correctAssignments=new TreeMap<ServerName,List<HRegionInfo>>();
  List<HRegionInfo> misplacedRegions=new LinkedList<HRegionInfo>();
  correctAssignments.put(LoadBalancer.BOGUS_SERVER_NAME,new LinkedList<HRegionInfo>());
  for (  ServerName sName : existingAssignments.keySet()) {
    correctAssignments.put(sName,new LinkedList<HRegionInfo>());
    List<HRegionInfo> regions=existingAssignments.get(sName);
    for (    HRegionInfo region : regions) {
      RSGroupInfo info=null;
      try {
        info=RSGroupInfoManager.getRSGroup(RSGroupInfoManager.getRSGroupOfTable(region.getTable()));
      }
 catch (      IOException exp) {
        LOG.debug("String_Node_Str" + region.getTable(),exp);
      }
      if ((info == null) || (!info.containsServer(sName.getHostPort()))) {
        correctAssignments.get(LoadBalancer.BOGUS_SERVER_NAME).add(region);
      }
 else {
        correctAssignments.get(sName).add(region);
      }
    }
  }
  for (  HRegionInfo info : misplacedRegions) {
    this.masterServices.getAssignmentManager().unassign(info);
  }
  return correctAssignments;
}

Fixed version (ground truth):
private Map<ServerName,List<HRegionInfo>> correctAssignments(Map<ServerName,List<HRegionInfo>> existingAssignments){
  Map<ServerName,List<HRegionInfo>> correctAssignments=new TreeMap<ServerName,List<HRegionInfo>>();
  List<HRegionInfo> misplacedRegions=new LinkedList<HRegionInfo>();
  correctAssignments.put(LoadBalancer.BOGUS_SERVER_NAME,new LinkedList<HRegionInfo>());
  for (  Map.Entry<ServerName,List<HRegionInfo>> assignments : existingAssignments.entrySet()) {
    ServerName sName=assignments.getKey();
    correctAssignments.put(sName,new LinkedList<HRegionInfo>());
    List<HRegionInfo> regions=assignments.getValue();
    for (    HRegionInfo region : regions) {
      RSGroupInfo info=null;
      try {
        info=RSGroupInfoManager.getRSGroup(RSGroupInfoManager.getRSGroupOfTable(region.getTable()));
      }
 catch (      IOException exp) {
        LOG.debug("String_Node_Str" + region.getTable(),exp);
      }
      if ((info == null) || (!info.containsServer(sName.getHostPort()))) {
        correctAssignments.get(LoadBalancer.BOGUS_SERVER_NAME).add(region);
      }
 else {
        correctAssignments.get(sName).add(region);
      }
    }
  }
  for (  HRegionInfo info : misplacedRegions) {
    this.masterServices.getAssignmentManager().unassign(info);
  }
  return correctAssignments;
}
Program: 61096
Project: 61096
Buggy source:
private Set<HRegionInfo> getMisplacedRegions(Map<HRegionInfo,ServerName> regions) throws IOException {
  Set<HRegionInfo> misplacedRegions=new HashSet<HRegionInfo>();
  for (  HRegionInfo region : regions.keySet()) {
    ServerName assignedServer=regions.get(region);
    RSGroupInfo info=RSGroupInfoManager.getRSGroup(RSGroupInfoManager.getRSGroupOfTable(region.getTable()));
    if (assignedServer != null && (info == null || !info.containsServer(assignedServer.getHostPort()))) {
      LOG.debug("String_Node_Str" + region.getRegionNameAsString() + "String_Node_Str"+ assignedServer+ "String_Node_Str"+ RSGroupInfoManager.getRSGroupOfServer(assignedServer.getHostPort())+ "String_Node_Str"+ (info == null ? "String_Node_Str" : info.getName()));
      misplacedRegions.add(region);
    }
  }
  return misplacedRegions;
}

Fixed version (ground truth):
private Set<HRegionInfo> getMisplacedRegions(Map<HRegionInfo,ServerName> regions) throws IOException {
  Set<HRegionInfo> misplacedRegions=new HashSet<HRegionInfo>();
  for (  Map.Entry<HRegionInfo,ServerName> region : regions.entrySet()) {
    HRegionInfo regionInfo=region.getKey();
    ServerName assignedServer=region.getValue();
    RSGroupInfo info=RSGroupInfoManager.getRSGroup(RSGroupInfoManager.getRSGroupOfTable(regionInfo.getTable()));
    if (assignedServer != null && (info == null || !info.containsServer(assignedServer.getHostPort()))) {
      LOG.debug("String_Node_Str" + regionInfo.getRegionNameAsString() + "String_Node_Str"+ assignedServer+ "String_Node_Str"+ RSGroupInfoManager.getRSGroupOfServer(assignedServer.getHostPort())+ "String_Node_Str"+ (info == null ? "String_Node_Str" : info.getName()));
      misplacedRegions.add(regionInfo);
    }
  }
  return misplacedRegions;
}
Program: 61098
Project: 61098
Buggy source:
public RSGroupInfoManagerImpl(MasterServices master) throws IOException {
  this.rsGroupMap=Collections.EMPTY_MAP;
  this.tableMap=Collections.EMPTY_MAP;
  rsGroupSerDe=new RSGroupSerDe();
  this.master=master;
  this.watcher=master.getZooKeeper();
  this.conn=master.getClusterConnection();
  rsGroupStartupWorker=new RSGroupStartupWorker(this,master,conn);
  prevRSGroups=new HashSet<String>();
  refresh();
  rsGroupStartupWorker.start();
  defaultServerUpdater=new DefaultServerUpdater(this);
  master.getServerManager().registerListener(this);
  defaultServerUpdater.start();
}

Fixed version (ground truth):
public RSGroupInfoManagerImpl(MasterServices master) throws IOException {
  this.rsGroupMap=Collections.EMPTY_MAP;
  this.tableMap=Collections.EMPTY_MAP;
  rsGroupSerDe=new RSGroupSerDe();
  this.master=master;
  this.watcher=master.getZooKeeper();
  this.conn=master.getClusterConnection();
  prevRSGroups=new HashSet<String>();
}
Program: 61099
Project: 61099
Buggy source:
@Override public synchronized void moveTables(Set<TableName> tableNames,String groupName) throws IOException {
  if (groupName != null && !rsGroupMap.containsKey(groupName)) {
    throw new DoNotRetryIOException("String_Node_Str" + groupName + "String_Node_Str");
  }
  Map<String,RSGroupInfo> newGroupMap=Maps.newHashMap(rsGroupMap);
  for (  TableName tableName : tableNames) {
    if (tableMap.containsKey(tableName)) {
      RSGroupInfo src=new RSGroupInfo(rsGroupMap.get(tableMap.get(tableName)));
      src.removeTable(tableName);
      newGroupMap.put(src.getName(),src);
    }
    if (groupName != null) {
      RSGroupInfo dst=new RSGroupInfo(newGroupMap.get(groupName));
      dst.addTable(tableName);
      newGroupMap.put(dst.getName(),dst);
    }
  }
  flushConfig(newGroupMap);
}

Fixed version (ground truth):
@Override public synchronized void moveTables(Set<TableName> tableNames,String groupName) throws IOException {
  if (groupName != null && !rsGroupMap.containsKey(groupName)) {
    throw new DoNotRetryIOException("String_Node_Str" + groupName + "String_Node_Str");
  }
  Map<String,RSGroupInfo> newGroupMap=Maps.newHashMap(rsGroupMap);
  for (  TableName tableName : tableNames) {
    if (tableMap.containsKey(tableName)) {
      RSGroupInfo src=new RSGroupInfo(newGroupMap.get(tableMap.get(tableName)));
      src.removeTable(tableName);
      newGroupMap.put(src.getName(),src);
    }
    if (groupName != null) {
      RSGroupInfo dst=new RSGroupInfo(newGroupMap.get(groupName));
      dst.addTable(tableName);
      newGroupMap.put(dst.getName(),dst);
    }
  }
  flushConfig(newGroupMap);
}
Program: 61100
Project: 61100
Buggy source:
@Override public boolean evaluate() throws Exception {
  return cluster.getClusterStatus().getRegionsInTransition().size() == 0;
}

Fixed version (ground truth):
@Override public boolean evaluate() throws Exception {
  List<String> regionsA=getTableRegionMap().get(tableNameA);
  if (regionsA == null)   return false;
  List<String> regionsB=getTableRegionMap().get(tableNameB);
  if (regionsB == null)   return false;
  return getTableRegionMap().get(tableNameA).size() >= 1 && getTableRegionMap().get(tableNameB).size() >= 1;
}
Program: 61101
Project: 61101
Buggy source:
@Override public synchronized void moveTables(Set<TableName> tableNames,String groupName) throws IOException {
  if (groupName != null && !rsGroupMap.containsKey(groupName)) {
    throw new DoNotRetryIOException("String_Node_Str" + groupName + "String_Node_Str");
  }
  Map<String,RSGroupInfo> newGroupMap=Maps.newHashMap(rsGroupMap);
  for (  TableName tableName : tableNames) {
    if (tableMap.containsKey(tableName)) {
      RSGroupInfo src=new RSGroupInfo(rsGroupMap.get(tableMap.get(tableName)));
      src.removeTable(tableName);
      newGroupMap.put(src.getName(),src);
    }
    if (groupName != null) {
      RSGroupInfo dst=new RSGroupInfo(newGroupMap.get(groupName));
      dst.addTable(tableName);
      newGroupMap.put(dst.getName(),dst);
    }
  }
  flushConfig(newGroupMap);
}

Fixed version (ground truth):
@Override public synchronized void moveTables(Set<TableName> tableNames,String groupName) throws IOException {
  if (groupName != null && !rsGroupMap.containsKey(groupName)) {
    throw new DoNotRetryIOException("String_Node_Str" + groupName + "String_Node_Str");
  }
  Map<String,RSGroupInfo> newGroupMap=Maps.newHashMap(rsGroupMap);
  for (  TableName tableName : tableNames) {
    if (tableMap.containsKey(tableName)) {
      RSGroupInfo src=new RSGroupInfo(newGroupMap.get(tableMap.get(tableName)));
      src.removeTable(tableName);
      newGroupMap.put(src.getName(),src);
    }
    if (groupName != null) {
      RSGroupInfo dst=new RSGroupInfo(newGroupMap.get(groupName));
      dst.addTable(tableName);
      newGroupMap.put(dst.getName(),dst);
    }
  }
  flushConfig(newGroupMap);
}
Program: 61102
Project: 61102
Buggy source:
@Override public boolean evaluate() throws Exception {
  return cluster.getClusterStatus().getRegionsInTransition().size() == 0;
}

Fixed version (ground truth):
@Override public boolean evaluate() throws Exception {
  List<String> regionsA=getTableRegionMap().get(tableNameA);
  if (regionsA == null)   return false;
  List<String> regionsB=getTableRegionMap().get(tableNameB);
  if (regionsB == null)   return false;
  return getTableRegionMap().get(tableNameA).size() >= 1 && getTableRegionMap().get(tableNameB).size() >= 1;
}
Program: 61104
Project: 61104
Buggy source:
/** 
 * Check if the range has any overlap with TimeRange
 * @param tr TimeRange
 * @return True if there is overlap, false otherwise
 */
public boolean includesTimeRange(final TimeRange tr){
  if (this.allTime) {
    return true;
  }
  return getMin() < tr.getMax() && getMax() >= tr.getMin();
}

Fixed version (ground truth):
/** 
 * Check if the range has any overlap with TimeRange
 * @param tr TimeRange
 * @return True if there is overlap, false otherwise
 */
public boolean includesTimeRange(final TimeRange tr){
}
Program: 61105
Project: 61105
Buggy source:
/** 
 * Represents interval [minStamp, maxStamp)
 * @param minStamp the minimum timestamp, inclusive
 * @param maxStamp the maximum timestamp, exclusive
 * @throws IOException
 */
public TimeRange(byte[] minStamp,byte[] maxStamp) throws IOException {
  this(Bytes.toLong(minStamp),Bytes.toLong(maxStamp));
}

Fixed version (ground truth):
/** 
 * Represents interval [minStamp, maxStamp)
 * @param minStamp the minimum timestamp, inclusive
 * @param maxStamp the maximum timestamp, exclusive
 * @throws IllegalArgumentException if either <0,
 * @deprecated This is made @InterfaceAudience.Private in the 2.0 line and above
 */
@Deprecated public TimeRange(long minStamp,long maxStamp){
  check(minStamp,maxStamp);
  this.minStamp=minStamp;
  this.maxStamp=maxStamp;
  this.allTime=isAllTime(minStamp,maxStamp);
}
Program: 61106
Project: 61106
Buggy source:
/** 
 * Check if the specified timestamp is within this TimeRange. <p> Returns true if within interval [minStamp, maxStamp), false if not.
 * @param timestamp timestamp to check
 * @return true if within TimeRange, false if not
 */
public boolean withinOrAfterTimeRange(long timestamp){
  if (allTime)   return true;
  return (timestamp >= minStamp);
}

Fixed version (ground truth):
/** 
 * Check if the specified timestamp is within this TimeRange. <p> Returns true if within interval [minStamp, maxStamp), false if not.
 * @param timestamp timestamp to check
 * @return true if within TimeRange, false if not
 */
public boolean withinOrAfterTimeRange(long timestamp){
}
Program: 61107
Project: 61107
Buggy source:
/** 
 * Compare the timestamp to timerange
 * @param timestamp
 * @return -1 if timestamp is less than timerange,0 if timestamp is within timerange, 1 if timestamp is greater than timerange
 */
public int compare(long timestamp){
  if (allTime)   return 0;
  if (timestamp < minStamp) {
    return -1;
  }
 else   if (timestamp >= maxStamp) {
    return 1;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
/** 
 * Compare the timestamp to timerange.
 * @return -1 if timestamp is less than timerange,0 if timestamp is within timerange, 1 if timestamp is greater than timerange
 */
public int compare(long timestamp){
}
Program: 61108
Project: 61108
Buggy source:
/** 
 * Check if the specified timestamp is within this TimeRange. <p> Returns true if within interval [minStamp, maxStamp), false if not.
 * @param timestamp timestamp to check
 * @return true if within TimeRange, false if not
 */
public boolean withinTimeRange(long timestamp){
  if (this.allTime) {
    return true;
  }
  return (minStamp <= timestamp && timestamp < maxStamp);
}

Fixed version (ground truth):
/** 
 * Check if the specified timestamp is within this TimeRange. <p> Returns true if within interval [minStamp, maxStamp), false if not.
 * @param timestamp timestamp to check
 * @return true if within TimeRange, false if not
 */
public boolean withinTimeRange(long timestamp){
}
Program: 61110
Project: 61110
Buggy source:
@Override public List<Path> flushSnapshot(MemStoreSnapshot snapshot,long cacheFlushId,MonitoredTask status,ThroughputController throughputController) throws IOException {
  ArrayList<Path> result=new ArrayList<Path>();
  int cellsCount=snapshot.getCellsCount();
  if (cellsCount == 0)   return result;
  long smallestReadPoint=store.getSmallestReadPoint();
  InternalScanner scanner=createScanner(snapshot.getScanner(),smallestReadPoint);
  if (scanner == null) {
    return result;
  }
  StoreFileWriter writer;
  try {
synchronized (flushLock) {
      status.setStatus("String_Node_Str" + store + "String_Node_Str");
      writer=store.createWriterInTmp(cellsCount,store.getFamily().getCompressionType(),false,true,snapshot.isTagsPresent(),false);
      writer.setTimeRangeTracker(snapshot.getTimeRangeTracker());
      IOException e=null;
      try {
        performFlush(scanner,writer,smallestReadPoint,throughputController);
      }
 catch (      IOException ioe) {
        e=ioe;
        throw ioe;
      }
 finally {
        if (e != null) {
          writer.close();
        }
 else {
          finalizeWriter(writer,cacheFlushId,status);
        }
      }
    }
  }
  finally {
    scanner.close();
  }
  LOG.info("String_Node_Str" + cacheFlushId + "String_Node_Str"+ StringUtils.TraditionalBinaryPrefix.long2String(snapshot.getSize(),"String_Node_Str",1)+ "String_Node_Str"+ writer.hasGeneralBloom()+ "String_Node_Str"+ writer.getPath());
  result.add(writer.getPath());
  return result;
}

Fixed version (ground truth):
@Override public List<Path> flushSnapshot(MemStoreSnapshot snapshot,long cacheFlushId,MonitoredTask status,ThroughputController throughputController) throws IOException {
  ArrayList<Path> result=new ArrayList<Path>();
  int cellsCount=snapshot.getCellsCount();
  if (cellsCount == 0)   return result;
  long smallestReadPoint=store.getSmallestReadPoint();
  InternalScanner scanner=createScanner(snapshot.getScanner(),smallestReadPoint);
  if (scanner == null) {
    return result;
  }
  StoreFileWriter writer;
  try {
synchronized (flushLock) {
      status.setStatus("String_Node_Str" + store + "String_Node_Str");
      writer=store.createWriterInTmp(cellsCount,store.getFamily().getCompressionType(),false,true,snapshot.isTagsPresent(),false,snapshot.getTimeRangeTracker());
      IOException e=null;
      try {
        performFlush(scanner,writer,smallestReadPoint,throughputController);
      }
 catch (      IOException ioe) {
        e=ioe;
        throw ioe;
      }
 finally {
        if (e != null) {
          writer.close();
        }
 else {
          finalizeWriter(writer,cacheFlushId,status);
        }
      }
    }
  }
  finally {
    scanner.close();
  }
  LOG.info("String_Node_Str" + cacheFlushId + "String_Node_Str"+ StringUtils.TraditionalBinaryPrefix.long2String(snapshot.getSize(),"String_Node_Str",1)+ "String_Node_Str"+ writer.hasGeneralBloom()+ "String_Node_Str"+ writer.getPath());
  result.add(writer.getPath());
  return result;
}
Program: 61111
Project: 61111
Buggy source:
/** 
 * Default constructor.
 * @param columns columns specified user in query
 * @param minVersions minimum number of versions to keep
 * @param maxVersions maximum versions to return per column
 * @param oldestUnexpiredTS the oldest timestamp we are interested in,based on TTL 
 */
public ExplicitColumnTracker(NavigableSet<byte[]> columns,int minVersions,int maxVersions,long oldestUnexpiredTS){
  this.maxVersions=maxVersions;
  this.minVersions=minVersions;
  this.oldestStamp=oldestUnexpiredTS;
  this.columns=new ColumnCount[columns.size()];
  int i=0;
  for (  byte[] column : columns) {
    this.columns[i++]=new ColumnCount(column);
  }
  reset();
}

Fixed version (ground truth):
/** 
 * Default constructor.
 * @param columns columns specified user in query
 * @param minVersions minimum number of versions to keep
 * @param maxVersions maximum versions to return per column
 * @param oldestUnexpiredTS the oldest timestamp we are interested in,based on TTL
 */
public ExplicitColumnTracker(NavigableSet<byte[]> columns,int minVersions,int maxVersions,long oldestUnexpiredTS){
  this.maxVersions=maxVersions;
  this.minVersions=minVersions;
  this.oldestStamp=oldestUnexpiredTS;
  this.columns=new ColumnCount[columns.size()];
  int i=0;
  for (  byte[] column : columns) {
    this.columns[i++]=new ColumnCount(column);
  }
  reset();
}
Program: 61112
Project: 61112
Buggy source:
@Override public StoreFileWriter createWriterInTmp(long maxKeyCount,Compression.Algorithm compression,boolean isCompaction,boolean includeMVCCReadpoint,boolean includesTag,boolean shouldDropBehind) throws IOException {
  final CacheConfig writerCacheConf;
  if (isCompaction) {
    writerCacheConf=new CacheConfig(cacheConf);
    writerCacheConf.setCacheDataOnWrite(false);
  }
 else {
    writerCacheConf=cacheConf;
  }
  InetSocketAddress[] favoredNodes=null;
  if (region.getRegionServerServices() != null) {
    favoredNodes=region.getRegionServerServices().getFavoredNodesForRegion(region.getRegionInfo().getEncodedName());
  }
  HFileContext hFileContext=createFileContext(compression,includeMVCCReadpoint,includesTag,cryptoContext);
  StoreFileWriter w=new StoreFileWriter.Builder(conf,writerCacheConf,this.getFileSystem()).withFilePath(fs.createTempName()).withComparator(comparator).withBloomType(family.getBloomFilterType()).withMaxKeyCount(maxKeyCount).withFavoredNodes(favoredNodes).withFileContext(hFileContext).withShouldDropCacheBehind(shouldDropBehind).build();
  return w;
}

Fixed version (ground truth):
@Override public StoreFileWriter createWriterInTmp(long maxKeyCount,Compression.Algorithm compression,boolean isCompaction,boolean includeMVCCReadpoint,boolean includesTag,boolean shouldDropBehind,final TimeRangeTracker trt) throws IOException {
  final CacheConfig writerCacheConf;
  if (isCompaction) {
    writerCacheConf=new CacheConfig(cacheConf);
    writerCacheConf.setCacheDataOnWrite(false);
  }
 else {
    writerCacheConf=cacheConf;
  }
  InetSocketAddress[] favoredNodes=null;
  if (region.getRegionServerServices() != null) {
    favoredNodes=region.getRegionServerServices().getFavoredNodesForRegion(region.getRegionInfo().getEncodedName());
  }
  HFileContext hFileContext=createFileContext(compression,includeMVCCReadpoint,includesTag,cryptoContext);
  StoreFileWriter.Builder builder=new StoreFileWriter.Builder(conf,writerCacheConf,this.getFileSystem()).withFilePath(fs.createTempName()).withComparator(comparator).withBloomType(family.getBloomFilterType()).withMaxKeyCount(maxKeyCount).withFavoredNodes(favoredNodes).withFileContext(hFileContext).withShouldDropCacheBehind(shouldDropBehind);
  if (trt != null) {
    builder.withTimeRangeTracker(trt);
  }
  return builder.build();
}
Program: 61114
Project: 61114
Buggy source:
/** 
 * @param maxKeyCount
 * @param compression Compression algorithm to use
 * @param isCompaction whether we are creating a new file in a compaction
 * @param includeMVCCReadpoint whether we should out the MVCC readpoint
 * @param shouldDropBehind should the writer drop caches behind writes
 * @return Writer for a new StoreFile in the tmp dir.
 */
StoreFileWriter createWriterInTmp(long maxKeyCount,Compression.Algorithm compression,boolean isCompaction,boolean includeMVCCReadpoint,boolean includesTags,boolean shouldDropBehind) throws IOException ;

Fixed version (ground truth):
/** 
 * @param maxKeyCount
 * @param compression Compression algorithm to use
 * @param isCompaction whether we are creating a new file in a compaction
 * @param includeMVCCReadpoint whether we should out the MVCC readpoint
 * @param shouldDropBehind should the writer drop caches behind writes
 * @param trt Ready-made timetracker to use.
 * @return Writer for a new StoreFile in the tmp dir.
 */
StoreFileWriter createWriterInTmp(long maxKeyCount,Compression.Algorithm compression,boolean isCompaction,boolean includeMVCCReadpoint,boolean includesTags,boolean shouldDropBehind,final TimeRangeTracker trt) throws IOException ;
Program: 61115
Project: 61115
Buggy source:
public long getMaxTimestamp(){
  return timeRange == null ? Long.MAX_VALUE : timeRange.getMax();
}

Fixed version (ground truth):
public long getMaxTimestamp(){
  return timeRange == null ? TimeRange.INITIAL_MAX_TIMESTAMP : timeRange.getMax();
}
Program: 61116
Project: 61116
Buggy source:
/** 
 * Perform normalization of cluster (invoked by   {@link RegionNormalizerChore}).
 * @return true if normalization step was performed successfully, false otherwise(specifically, if HMaster hasn't been initialized properly or normalization is globally disabled)
 */
public boolean normalizeRegions() throws IOException {
  if (!isInitialized()) {
    LOG.debug("String_Node_Str");
    return false;
  }
  if (!this.regionNormalizerTracker.isNormalizerOn()) {
    LOG.debug("String_Node_Str");
    return false;
  }
synchronized (this.normalizer) {
    List<TableName> allEnabledTables=new ArrayList<>(this.tableStateManager.getTablesInStates(TableState.State.ENABLED));
    Collections.shuffle(allEnabledTables);
    for (    TableName table : allEnabledTables) {
      HTableDescriptor tblDesc=getTableDescriptors().get(table);
      if (table.isSystemTable() || (tblDesc != null && tblDesc != null && !tblDesc.isNormalizationEnabled())) {
        LOG.debug("String_Node_Str" + table + "String_Node_Str"+ "String_Node_Str");
        continue;
      }
      List<NormalizationPlan> plans=this.normalizer.computePlanForTable(table);
      if (plans != null) {
        for (        NormalizationPlan plan : plans) {
          plan.execute(clusterConnection.getAdmin());
          if (plan.getType() == PlanType.SPLIT) {
            splitPlanCount++;
          }
 else           if (plan.getType() == PlanType.MERGE) {
            mergePlanCount++;
          }
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Perform normalization of cluster (invoked by   {@link RegionNormalizerChore}).
 * @return true if normalization step was performed successfully, false otherwise(specifically, if HMaster hasn't been initialized properly or normalization is globally disabled)
 */
public boolean normalizeRegions() throws IOException {
  if (!isInitialized()) {
    LOG.debug("String_Node_Str");
    return false;
  }
  if (!this.regionNormalizerTracker.isNormalizerOn()) {
    LOG.debug("String_Node_Str");
    return false;
  }
synchronized (this.normalizer) {
    List<TableName> allEnabledTables=new ArrayList<>(this.tableStateManager.getTablesInStates(TableState.State.ENABLED));
    Collections.shuffle(allEnabledTables);
    for (    TableName table : allEnabledTables) {
      HTableDescriptor tblDesc=getTableDescriptors().get(table);
      if (table.isSystemTable() || (tblDesc != null && !tblDesc.isNormalizationEnabled())) {
        LOG.debug("String_Node_Str" + table + "String_Node_Str"+ "String_Node_Str");
        continue;
      }
      List<NormalizationPlan> plans=this.normalizer.computePlanForTable(table);
      if (plans != null) {
        for (        NormalizationPlan plan : plans) {
          plan.execute(clusterConnection.getAdmin());
          if (plan.getType() == PlanType.SPLIT) {
            splitPlanCount++;
          }
 else           if (plan.getType() == PlanType.MERGE) {
            mergePlanCount++;
          }
        }
      }
    }
  }
  return true;
}
Program: 61117
Project: 61117
Buggy source:
@Override protected void encode(ChannelHandlerContext channelHandlerContext,ClusterStatus clusterStatus,List<Object> objects){
  ClusterStatusProtos.ClusterStatus csp=clusterStatus.convert();
  objects.add(new DatagramPacket(Unpooled.wrappedBuffer(csp.toByteArray()),isa));
}

Fixed version (ground truth):
@Override protected void encode(ChannelHandlerContext channelHandlerContext,ClusterStatus clusterStatus,List<Object> objects){
  ClusterStatusProtos.ClusterStatus csp=ProtobufUtil.convert(clusterStatus);
  objects.add(new DatagramPacket(Unpooled.wrappedBuffer(csp.toByteArray()),isa));
}
Program: 61118
Project: 61118
Buggy source:
/** 
 * Verifies that one can't modify instance of EMPTY_RESULT.
 */
public void testEmptyResultIsReadonly(){
  Result emptyResult=Result.EMPTY_RESULT;
  Result otherResult=new Result();
  try {
    emptyResult.copyFrom(otherResult);
    fail("String_Node_Str");
  }
 catch (  UnsupportedOperationException ex) {
    LOG.debug("String_Node_Str" + ex.getMessage());
  }
  try {
    emptyResult.addResults(new RegionLoadStats(0,0,0));
    fail("String_Node_Str");
  }
 catch (  UnsupportedOperationException ex) {
    LOG.debug("String_Node_Str" + ex.getMessage());
  }
  try {
    emptyResult.setExists(true);
    fail("String_Node_Str");
  }
 catch (  UnsupportedOperationException ex) {
    LOG.debug("String_Node_Str" + ex.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Verifies that one can't modify instance of EMPTY_RESULT.
 */
public void testEmptyResultIsReadonly(){
  Result emptyResult=Result.EMPTY_RESULT;
  Result otherResult=new Result();
  try {
    emptyResult.copyFrom(otherResult);
    fail("String_Node_Str");
  }
 catch (  UnsupportedOperationException ex) {
    LOG.debug("String_Node_Str" + ex.getMessage());
  }
  try {
    emptyResult.setExists(true);
    fail("String_Node_Str");
  }
 catch (  UnsupportedOperationException ex) {
    LOG.debug("String_Node_Str" + ex.getMessage());
  }
}
Program: 61119
Project: 61119
Buggy source:
/** 
 * @return True if we should send data in cellblocks.  This is an expensive call.  Cache theresult if you can rather than call each time.
 */
private boolean isCellBlock(){
  HConnection connection=getConnection();
  if (!(connection instanceof ClusterConnection))   return true;
  return ((ClusterConnection)connection).hasCellBlockSupport();
}

Fixed version (ground truth):
/** 
 * @return True if we should send data in cellblocks.  This is an expensive call.  Cache theresult if you can rather than call each time.
 */
private boolean isCellBlock(){
  ClusterConnection conn=getConnection();
  return conn.hasCellBlockSupport();
}
Program: 61120
Project: 61120
Buggy source:
/** 
 * Find the size of compressed data assuming that buffer will be compressed using given algorithm.
 * @param algo compression algorithm
 * @param compressor compressor already requested from codec
 * @param inputBuffer Array to be compressed.
 * @param offset Offset to beginning of the data.
 * @param length Length to be compressed.
 * @return Size of compressed data in bytes.
 * @throws IOException
 */
public static int getCompressedSize(Algorithm algo,Compressor compressor,byte[] inputBuffer,int offset,int length) throws IOException {
  DataOutputStream compressedStream=new DataOutputStream(new IOUtils.NullOutputStream());
  if (compressor != null) {
    compressor.reset();
  }
  OutputStream compressingStream=null;
  try {
    compressingStream=algo.createCompressionStream(compressedStream,compressor,0);
    compressingStream.write(inputBuffer,offset,length);
    compressingStream.flush();
    return compressedStream.size();
  }
  finally {
    if (compressingStream != null)     compressingStream.close();
  }
}

Fixed version (ground truth):
/** 
 * Find the size of compressed data assuming that buffer will be compressed using given algorithm.
 * @param algo compression algorithm
 * @param compressor compressor already requested from codec
 * @param inputBuffer Array to be compressed.
 * @param offset Offset to beginning of the data.
 * @param length Length to be compressed.
 * @return Size of compressed data in bytes.
 * @throws IOException
 */
public static int getCompressedSize(Algorithm algo,Compressor compressor,byte[] inputBuffer,int offset,int length) throws IOException {
  final IOUtils.NullOutputStream nullOutputStream=new IOUtils.NullOutputStream();
  final DataOutputStream compressedStream=new DataOutputStream(nullOutputStream);
  OutputStream compressingStream=null;
  try {
    if (compressor != null) {
      compressor.reset();
    }
    compressingStream=algo.createCompressionStream(compressedStream,compressor,0);
    compressingStream.write(inputBuffer,offset,length);
    compressingStream.flush();
    return compressedStream.size();
  }
  finally {
    nullOutputStream.close();
    compressedStream.close();
    if (compressingStream != null)     compressingStream.close();
  }
}
Program: 61121
Project: 61121
Buggy source:
/** 
 * Convenience method for reading a binary file and base64-encoding it.
 * @param filename Filename for reading binary data
 * @return base64-encoded string or null if unsuccessful
 * @since 2.1
 */
public static String encodeFromFile(String filename){
  String encodedData=null;
  Base64InputStream bis=null;
  try {
    File file=new File(filename);
    byte[] buffer=new byte[Math.max((int)(file.length() * 1.4),40)];
    bis=new Base64InputStream(new BufferedInputStream(new FileInputStream(file)),ENCODE);
    int length=0;
    for (int numBytes; (numBytes=bis.read(buffer,length,4096)) >= 0; ) {
      length+=numBytes;
    }
    encodedData=new String(buffer,0,length,PREFERRED_ENCODING);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str" + filename,e);
  }
 finally {
    if (bis != null) {
      try {
        bis.close();
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
  return encodedData;
}

Fixed version (ground truth):
/** 
 * Convenience method for reading a binary file and base64-encoding it.
 * @param filename Filename for reading binary data
 * @return base64-encoded string or null if unsuccessful
 * @since 2.1
 */
public static String encodeFromFile(String filename){
  String encodedData=null;
  FileInputStream fileInputStream=null;
  BufferedInputStream bufferedInputStream=null;
  Base64InputStream base64InputStream=null;
  try {
    File file=new File(filename);
    byte[] buffer=new byte[Math.max((int)(file.length() * 1.4),40)];
    fileInputStream=new FileInputStream(file);
    bufferedInputStream=new BufferedInputStream(fileInputStream);
    base64InputStream=new Base64InputStream(bufferedInputStream,ENCODE);
    int length=0;
    for (int numBytes; (numBytes=base64InputStream.read(buffer,length,4096)) >= 0; ) {
      length+=numBytes;
    }
    encodedData=new String(buffer,0,length,PREFERRED_ENCODING);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str" + filename,e);
  }
 finally {
    if (fileInputStream != null) {
      try {
        fileInputStream.close();
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
      }
    }
    if (bufferedInputStream != null) {
      try {
        bufferedInputStream.close();
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
      }
    }
    if (base64InputStream != null) {
      try {
        base64InputStream.close();
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
  return encodedData;
}
Program: 61122
Project: 61122
Buggy source:
/** 
 * Convenience method for reading a base64-encoded file and decoding it.
 * @param filename Filename for reading encoded data
 * @return decoded byte array or null if unsuccessful
 * @since 2.1
 */
public static byte[] decodeFromFile(String filename){
  byte[] decodedData=null;
  Base64InputStream bis=null;
  try {
    File file=new File(filename);
    byte[] buffer;
    if (file.length() > Integer.MAX_VALUE) {
      LOG.fatal("String_Node_Str" + file.length() + "String_Node_Str");
      return null;
    }
    buffer=new byte[(int)file.length()];
    bis=new Base64InputStream(new BufferedInputStream(new FileInputStream(file)),DECODE);
    int length=0;
    for (int numBytes; (numBytes=bis.read(buffer,length,4096)) >= 0; ) {
      length+=numBytes;
    }
    decodedData=new byte[length];
    System.arraycopy(buffer,0,decodedData,0,length);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str" + filename,e);
  }
 finally {
    if (bis != null) {
      try {
        bis.close();
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
  return decodedData;
}

Fixed version (ground truth):
/** 
 * Convenience method for reading a base64-encoded file and decoding it.
 * @param filename Filename for reading encoded data
 * @return decoded byte array or null if unsuccessful
 * @since 2.1
 */
public static byte[] decodeFromFile(String filename){
  byte[] decodedData=null;
  BufferedInputStream bufferedInputStream=null;
  FileInputStream fileInputStream=null;
  Base64InputStream base64InputStream=null;
  try {
    File file=new File(filename);
    byte[] buffer;
    if (file.length() > Integer.MAX_VALUE) {
      LOG.fatal("String_Node_Str" + file.length() + "String_Node_Str");
      return null;
    }
    buffer=new byte[(int)file.length()];
    fileInputStream=new FileInputStream(file);
    bufferedInputStream=new BufferedInputStream(fileInputStream);
    base64InputStream=new Base64InputStream(bufferedInputStream,DECODE);
    int length=0;
    for (int numBytes; (numBytes=base64InputStream.read(buffer,length,4096)) >= 0; ) {
      length+=numBytes;
    }
    decodedData=new byte[length];
    System.arraycopy(buffer,0,decodedData,0,length);
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str" + filename,e);
  }
 finally {
    if (fileInputStream != null) {
      try {
        fileInputStream.close();
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
      }
    }
    if (bufferedInputStream != null) {
      try {
        bufferedInputStream.close();
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
      }
    }
    if (base64InputStream != null) {
      try {
        base64InputStream.close();
      }
 catch (      Exception e) {
        LOG.error("String_Node_Str",e);
      }
    }
  }
  return decodedData;
}
Program: 61123
Project: 61123
Buggy source:
/** 
 * Determines if we are running in a 32-bit JVM. Some unit tests need to know this too.
 */
public static boolean is32BitJVM(){
  return System.getProperty("String_Node_Str").equals("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Determines if we are running in a 32-bit JVM. Some unit tests need to know this too.
 */
public static boolean is32BitJVM(){
  final String model=System.getProperty("String_Node_Str");
  return model != null && model.equals("String_Node_Str");
}
Program: 61125
Project: 61125
Buggy source:
/** 
 * Removes all store files with max timestamp older than (current - maxAge).
 * @param storeFiles all store files to consider
 * @param maxAge the age in milliseconds when a store file stops participating in compaction.
 * @param now current time. store files with max timestamp less than (now - maxAge) are filtered.
 * @return a list of storeFiles with the store file older than maxAge excluded
 */
private static Iterable<StoreFile> filterOldStoreFiles(List<StoreFile> storeFiles,long maxAge,long now){
  if (maxAge == 0) {
    return ImmutableList.of();
  }
  final long cutoff=now - maxAge;
  return Iterables.filter(storeFiles,new Predicate<StoreFile>(){
    @Override public boolean apply(    StoreFile storeFile){
      if (storeFile == null) {
        throw new NullPointerException();
      }
      return storeFile.getMaximumTimestamp() >= cutoff;
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Removes all store files with max timestamp older than (current - maxAge).
 * @param storeFiles all store files to consider
 * @param maxAge the age in milliseconds when a store file stops participating in compaction.
 * @param now current time. store files with max timestamp less than (now - maxAge) are filtered.
 * @return a list of storeFiles with the store file older than maxAge excluded
 */
private static Iterable<StoreFile> filterOldStoreFiles(List<StoreFile> storeFiles,long maxAge,long now){
  if (maxAge == 0) {
    return ImmutableList.of();
  }
  final long cutoff=now - maxAge;
  return Iterables.filter(storeFiles,new Predicate<StoreFile>(){
    @Override public boolean apply(    StoreFile storeFile){
      if (storeFile == null) {
        return false;
      }
      return storeFile.getMaximumTimestamp() >= cutoff;
    }
  }
);
}
Program: 61126
Project: 61126
Buggy source:
/** 
 * Input candidates are sorted from oldest to newest by seqId. Could return null if no candidates are found.
 */
@VisibleForTesting public ArrayList<StoreFile> applyCompactionPolicy(ArrayList<StoreFile> candidates,boolean mayUseOffPeak,boolean mayBeStuck,long now) throws IOException {
  Iterable<StoreFile> candidatesInWindow=filterOldStoreFiles(Lists.newArrayList(candidates),comConf.getMaxStoreFileAgeMillis(),now);
  List<ArrayList<StoreFile>> buckets=partitionFilesToBuckets(candidatesInWindow,comConf.getBaseWindowMillis(),comConf.getWindowsPerTier(),now);
  LOG.debug("String_Node_Str" + buckets);
  return newestBucket(buckets,comConf.getIncomingWindowMin(),now,comConf.getBaseWindowMillis(),mayUseOffPeak);
}

Fixed version (ground truth):
/** 
 * Input candidates are sorted from oldest to newest by seqId. Could return null if no candidates are found.
 */
@VisibleForTesting public ArrayList<StoreFile> applyCompactionPolicy(ArrayList<StoreFile> candidates,boolean mayUseOffPeak,boolean mayBeStuck,long now) throws IOException {
  Iterable<StoreFile> candidatesInWindow=filterOldStoreFiles(Lists.newArrayList(candidates),comConf.getMaxStoreFileAgeMillis(),now);
  List<ArrayList<StoreFile>> buckets=partitionFilesToBuckets(candidatesInWindow,comConf.getBaseWindowMillis(),comConf.getWindowsPerTier(),now);
  LOG.debug("String_Node_Str" + buckets);
  if (buckets.size() >= storeConfigInfo.getBlockingFileCount()) {
    LOG.warn("String_Node_Str" + buckets.size() + "String_Node_Str"+ storeConfigInfo.getBlockingFileCount()+ "String_Node_Str"+ "String_Node_Str");
  }
  return newestBucket(buckets,comConf.getIncomingWindowMin(),now,comConf.getBaseWindowMillis(),mayUseOffPeak);
}
Program: 61127
Project: 61127
Buggy source:
@Override public boolean apply(StoreFile storeFile){
  if (storeFile == null) {
    throw new NullPointerException();
  }
  return storeFile.getMaximumTimestamp() >= cutoff;
}

Fixed version (ground truth):
@Override public boolean apply(StoreFile storeFile){
  if (storeFile == null) {
    return false;
  }
  return storeFile.getMaximumTimestamp() >= cutoff;
}
Program: 61128
Project: 61128
Buggy source:
@Test public void testAssignmentManagerTruncatedList() throws IOException {
  AssignmentManager am=Mockito.mock(AssignmentManager.class);
  RegionStates rs=Mockito.mock(RegionStates.class);
  NavigableMap<String,RegionState> regionsInTransition=Maps.newTreeMap();
  for (byte i=0; i < 100; i++) {
    HRegionInfo hri=new HRegionInfo(FAKE_TABLE.getTableName(),new byte[]{i},new byte[]{(byte)(i + 1)});
    regionsInTransition.put(hri.getEncodedName(),new RegionState(hri,RegionState.State.CLOSING,12345L,FAKE_HOST));
  }
  regionsInTransition.put(HRegionInfo.FIRST_META_REGIONINFO.getEncodedName(),new RegionState(HRegionInfo.FIRST_META_REGIONINFO,RegionState.State.CLOSING,12345L,FAKE_HOST));
  Mockito.doReturn(rs).when(am).getRegionStates();
  Mockito.doReturn(regionsInTransition).when(rs).getRegionsInTransition();
  StringWriter sw=new StringWriter();
  new AssignmentManagerStatusTmpl().setLimit(50).render(sw,am);
  String result=sw.toString();
  assertTrue(result.contains(HRegionInfo.FIRST_META_REGIONINFO.getEncodedName()));
  Matcher matcher=Pattern.compile("String_Node_Str").matcher(result);
  int count=0;
  while (matcher.find()) {
    count++;
  }
  assertEquals(50,count);
}

Fixed version (ground truth):
@Test public void testAssignmentManagerTruncatedList() throws IOException {
  AssignmentManager am=Mockito.mock(AssignmentManager.class);
  RegionStates rs=Mockito.mock(RegionStates.class);
  NavigableMap<String,RegionState> regionsInTransition=Maps.newTreeMap();
  for (byte i=0; i < 100; i++) {
    HRegionInfo hri=new HRegionInfo(FAKE_TABLE.getTableName(),new byte[]{i},new byte[]{(byte)(i + 1)});
    regionsInTransition.put(hri.getEncodedName(),new RegionState(hri,RegionState.State.CLOSING,12345L,FAKE_HOST));
  }
  regionsInTransition.put(HRegionInfo.FIRST_META_REGIONINFO.getEncodedName(),new RegionState(HRegionInfo.FIRST_META_REGIONINFO,RegionState.State.CLOSING,12345L,FAKE_HOST));
  Mockito.doReturn(rs).when(am).getRegionStates();
  Mockito.doReturn(regionsInTransition).when(rs).getRegionsInTransition();
  Mockito.doReturn(regionsInTransition).when(rs).getRegionsInTransitionOrderedByTimestamp();
  StringWriter sw=new StringWriter();
  new AssignmentManagerStatusTmpl().render(sw,am);
  String result=sw.toString();
  assertTrue(result.contains(HRegionInfo.FIRST_META_REGIONINFO.getEncodedName()));
}