nus-yam/ex-repair huggingface dataset:
Program: 7128
Project: 7128
Buggy source:
@Test public void testTTL() throws Exception {
  File inputDir=tmpFolder.newFolder();
  File outputDir=tmpFolder.newFolder();
  outputDir.delete();
  final long currentTime=CURRENT_TIME;
  final long ttl=1500;
  generateEvents(inputDir,500,0,1,new GenerateEvent(){
    @Override public String generate(    int index,    long timestamp){
      return "String_Node_Str" + timestamp;
    }
  }
);
  generateEvents(inputDir,1000,0,1,new GenerateEvent(){
    @Override public String generate(    int index,    long timestamp){
      if (timestamp + ttl < currentTime) {
        return "String_Node_Str" + timestamp;
      }
 else {
        return "String_Node_Str" + timestamp;
      }
    }
  }
);
  generateEvents(inputDir,1000,1000,1,new GenerateEvent(){
    @Override public String generate(    int index,    long timestamp){
      return "String_Node_Str" + timestamp;
    }
  }
);
  runMR(inputDir,outputDir,0,Long.MAX_VALUE,2000,1500);
  Map<String,Integer> output=loadMRResult(outputDir);
  Assert.assertEquals(1501,output.size());
  Assert.assertEquals(null,output.get("String_Node_Str"));
  Assert.assertEquals(1500,output.get("String_Node_Str").intValue());
  for (long i=(currentTime - ttl); i < currentTime; i++) {
    Assert.assertEquals(1,output.get(Long.toString(i)).intValue());
  }
}

Fixed version (ground truth):
@Test public void testTTL() throws Exception {
  File inputDir=tmpFolder.newFolder();
  File outputDir=tmpFolder.newFolder();
  outputDir.delete();
  final long currentTime=CURRENT_TIME;
  final long ttl=1500;
  generateEvents(inputDir,500,0,1,new GenerateEvent(){
    @Override public String generate(    int index,    long timestamp){
      return "String_Node_Str" + timestamp;
    }
  }
);
  generateEvents(inputDir,1000,0,1,new GenerateEvent(){
    @Override public String generate(    int index,    long timestamp){
      if (timestamp + ttl < currentTime) {
        return "String_Node_Str" + timestamp;
      }
 else {
        return "String_Node_Str" + timestamp;
      }
    }
  }
);
  generateEvents(inputDir,1000,1000,1,new GenerateEvent(){
    @Override public String generate(    int index,    long timestamp){
      return "String_Node_Str" + timestamp;
    }
  }
);
  runMR(inputDir,outputDir,0,Long.MAX_VALUE,2000,ttl);
  Map<String,Integer> output=loadMRResult(outputDir);
  Assert.assertEquals(ttl + 1,output.size());
  Assert.assertEquals(null,output.get("String_Node_Str"));
  Assert.assertEquals(ttl,output.get("String_Node_Str").intValue());
  for (long i=(currentTime - ttl); i < currentTime; i++) {
    Assert.assertEquals(1,output.get(Long.toString(i)).intValue());
  }
}
Program: 7129
Project: 7129
Buggy source:
@Test public void testStreamRecordReader() throws Exception {
  File inputDir=tmpFolder.newFolder();
  File partition=new File(inputDir,"String_Node_Str");
  partition.mkdirs();
  File eventFile=new File(partition,"String_Node_Str" + StreamFileType.EVENT.getSuffix());
  File indexFile=new File(partition,"String_Node_Str" + StreamFileType.INDEX.getSuffix());
  StreamDataFileWriter writer=new StreamDataFileWriter(Files.newOutputStreamSupplier(eventFile),Files.newOutputStreamSupplier(indexFile),100L);
  writer.append(StreamFileTestUtils.createEvent(1000,"String_Node_Str"));
  Configuration conf=new Configuration();
  TaskAttemptContext context=new TaskAttemptContextImpl(conf,new TaskAttemptID());
  StreamInputFormat.setStreamPath(conf,inputDir.toURI());
  StreamInputFormat format=new StreamInputFormat();
  List<InputSplit> splits=format.getSplits(new JobContextImpl(new JobConf(conf),new JobID()));
  Assert.assertEquals(2,splits.size());
  writer.append(StreamFileTestUtils.createEvent(1001,"String_Node_Str"));
  writer.close();
  StreamRecordReader<LongWritable,StreamEvent> recordReader=new StreamRecordReader<LongWritable,StreamEvent>(new IdentityStreamEventDecoder());
  recordReader.initialize(splits.get(1),context);
  Assert.assertTrue(recordReader.nextKeyValue());
  StreamEvent output=recordReader.getCurrentValue();
  Assert.assertEquals(1001,output.getTimestamp());
  Assert.assertEquals("String_Node_Str",Bytes.toString(output.getBody()));
  Assert.assertFalse(recordReader.nextKeyValue());
}

Fixed version (ground truth):
@Test public void testStreamRecordReader() throws Exception {
  File inputDir=tmpFolder.newFolder();
  File partition=new File(inputDir,"String_Node_Str");
  partition.mkdirs();
  File eventFile=new File(partition,"String_Node_Str" + StreamFileType.EVENT.getSuffix());
  File indexFile=new File(partition,"String_Node_Str" + StreamFileType.INDEX.getSuffix());
  StreamDataFileWriter writer=new StreamDataFileWriter(Files.newOutputStreamSupplier(eventFile),Files.newOutputStreamSupplier(indexFile),100L);
  writer.append(StreamFileTestUtils.createEvent(1000,"String_Node_Str"));
  writer.flush();
  Configuration conf=new Configuration();
  TaskAttemptContext context=new TaskAttemptContextImpl(conf,new TaskAttemptID());
  StreamInputFormat.setStreamPath(conf,inputDir.toURI());
  StreamInputFormat format=new StreamInputFormat();
  List<InputSplit> splits=format.getSplits(new JobContextImpl(new JobConf(conf),new JobID()));
  Assert.assertEquals(2,splits.size());
  writer.append(StreamFileTestUtils.createEvent(1001,"String_Node_Str"));
  writer.close();
  StreamRecordReader<LongWritable,StreamEvent> recordReader=new StreamRecordReader<LongWritable,StreamEvent>(new IdentityStreamEventDecoder());
  recordReader.initialize(splits.get(1),context);
  Assert.assertTrue(recordReader.nextKeyValue());
  StreamEvent output=recordReader.getCurrentValue();
  Assert.assertEquals(1001,output.getTimestamp());
  Assert.assertEquals("String_Node_Str",Bytes.toString(output.getBody()));
  Assert.assertFalse(recordReader.nextKeyValue());
}
Program: 7130
Project: 7130
Buggy source:
private Map<String,Integer> loadMRResult(File outputDir) throws IOException {
  Map<String,Integer> output=Maps.newHashMap();
  BufferedReader reader=Files.newReader(new File(outputDir,"String_Node_Str"),Charsets.UTF_8);
  try {
    String line=reader.readLine();
    while (line != null) {
      int idx=line.indexOf('\t');
      output.put(line.substring(0,idx),Integer.parseInt(line.substring(idx + 1)));
      line=reader.readLine();
    }
  }
  finally {
    reader.close();
  }
  return output;
}

Fixed version (ground truth):
private Map<String,Integer> loadMRResult(File outputDir) throws IOException {
  Map<String,Integer> output=Maps.newTreeMap();
  BufferedReader reader=Files.newReader(new File(outputDir,"String_Node_Str"),Charsets.UTF_8);
  try {
    String line=reader.readLine();
    while (line != null) {
      int idx=line.indexOf('\t');
      output.put(line.substring(0,idx),Integer.parseInt(line.substring(idx + 1)));
      line=reader.readLine();
    }
  }
  finally {
    reader.close();
  }
  return output;
}
Program: 7131
Project: 7131
Buggy source:
/** 
 * Reads or skips a   {@link StreamEvent}.
 * @param filter to determine to accept or skip a stream event by offsetand accept or skip a stream event block by timestamp.
 * @return The next StreamEvent or {@code null} if the event is rejected by the filter or reached EOF.
 */
private PositionStreamEvent nextStreamEvent(ReadFilter filter) throws IOException {
  while (!eof && !streamEventBuffer.hasEvent()) {
    readDataBlock(filter);
  }
  if (eof) {
    return null;
  }
  PositionStreamEvent event=streamEventBuffer.nextEvent(timestamp,eventTemplate.getHeaders(),filter);
  position=streamEventBuffer.getPosition();
  return event;
}

Fixed version (ground truth):
/** 
 * Reads or skips a   {@link StreamEvent}.
 * @param filter to determine to accept or skip a stream event by offsetand accept or skip a stream event block by timestamp.
 * @return The next StreamEvent or {@code null} if the event is rejected by the filter or reached EOF.
 */
private PositionStreamEvent nextStreamEvent(ReadFilter filter) throws IOException {
  while (!eof && !(streamEventBuffer.hasEvent() && acceptTimestamp(filter,timestamp))) {
    readDataBlock(filter);
  }
  if (eof) {
    return null;
  }
  PositionStreamEvent event=streamEventBuffer.nextEvent(timestamp,eventTemplate.getHeaders(),filter);
  position=streamEventBuffer.getPosition();
  return event;
}
Program: 7132
Project: 7132
Buggy source:
/** 
 * Skips events until the given condition is true.
 */
private void skipUntil(SkipCondition condition) throws IOException {
  long positionBound=position=eventInput.getPos();
  try {
    while (!eof) {
      long timestamp=readTimestamp();
      eof=timestamp < 0;
      if (eof || condition.apply(positionBound,timestamp)) {
        break;
      }
      int len=readLength();
      position=positionBound;
      eventInput.seek(eventInput.getPos() + len);
      positionBound=eventInput.getPos();
      if (condition.apply(positionBound,timestamp)) {
        break;
      }
    }
    if (eof) {
      position=positionBound;
      return;
    }
    eventInput.seek(position);
    readDataBlock(ReadFilter.ALWAYS_ACCEPT);
    while (position < positionBound) {
      if (condition.apply(position,timestamp)) {
        break;
      }
      nextStreamEvent(ReadFilter.ALWAYS_REJECT_OFFSET);
    }
  }
 catch (  IOException e) {
    if (!(e instanceof EOFException)) {
      throw e;
    }
  }
}

Fixed version (ground truth):
/** 
 * Skips events until the given condition is true.
 */
private void skipUntil(SkipCondition condition) throws IOException {
  long positionBound=position=eventInput.getPos();
  try {
    while (!eof) {
      long timestamp=readTimestamp();
      eof=timestamp < 0;
      if (eof || condition.apply(positionBound,timestamp)) {
        break;
      }
      int len=readLength();
      position=positionBound;
      eventInput.seek(eventInput.getPos() + len);
      positionBound=eventInput.getPos();
      if (condition.apply(positionBound,timestamp)) {
        break;
      }
    }
    if (eof) {
      position=positionBound;
      return;
    }
    eventInput.seek(position);
    readDataBlock(ReadFilter.ALWAYS_ACCEPT);
    while (position < positionBound) {
      if (condition.apply(streamEventBuffer.getPosition(),timestamp)) {
        break;
      }
      nextStreamEvent(ReadFilter.ALWAYS_REJECT_OFFSET);
    }
  }
 catch (  IOException e) {
    if (!(e instanceof EOFException)) {
      throw e;
    }
  }
}
Program: 7133
Project: 7133
Buggy source:
private void readDataBlock(ReadFilter filter) throws IOException {
  position=eventInput.getPos();
  long timestamp=readTimestamp();
  if (timestamp < 0) {
    eof=true;
    return;
  }
  filter.reset();
  timestamp=eventTemplate.getTimestamp() >= 0 ? eventTemplate.getTimestamp() : timestamp;
  if (filter.acceptTimestamp(timestamp)) {
    streamEventBuffer.fillBuffer(eventInput,readLength());
    this.timestamp=timestamp;
    return;
  }
  if (eventTemplate.getTimestamp() >= 0) {
    eof=true;
    return;
  }
  long nextTimestamp=filter.getNextTimestampHint();
  if (nextTimestamp > timestamp) {
    eventInput.seek(position);
    initByTime(nextTimestamp);
    readDataBlock(filter);
    return;
  }
  int length=readLength();
  long bytesSkipped=eventInput.skip(length);
  if (bytesSkipped != length) {
    throw new EOFException("String_Node_Str" + length + "String_Node_Str"+ bytesSkipped+ "String_Node_Str");
  }
  position=eventInput.getPos();
}

Fixed version (ground truth):
private void readDataBlock(ReadFilter filter) throws IOException {
  position=eventInput.getPos();
  long timestamp=readTimestamp();
  if (timestamp < 0) {
    eof=true;
    return;
  }
  timestamp=eventTemplate.getTimestamp() >= 0 ? eventTemplate.getTimestamp() : timestamp;
  if (acceptTimestamp(filter,timestamp)) {
    streamEventBuffer.fillBuffer(eventInput,readLength());
    this.timestamp=timestamp;
    return;
  }
  if (eventTemplate.getTimestamp() >= 0) {
    eof=true;
    return;
  }
  long nextTimestamp=filter.getNextTimestampHint();
  if (nextTimestamp > timestamp) {
    eventInput.seek(position);
    initByTime(nextTimestamp);
    return;
  }
  int length=readLength();
  long bytesSkipped=eventInput.skip(length);
  if (bytesSkipped != length) {
    throw new EOFException("String_Node_Str" + length + "String_Node_Str"+ bytesSkipped+ "String_Node_Str");
  }
  position=eventInput.getPos();
}
Program: 7134
Project: 7134
Buggy source:
@Override public boolean nextKeyValue() throws IOException, InterruptedException {
  StreamEvent streamEvent;
  do {
    if (reader.getPosition() - inputSplit.getStart() >= inputSplit.getLength()) {
      return false;
    }
    events.clear();
    if (reader.read(events,1,0,TimeUnit.SECONDS,readFilter) <= 0) {
      return false;
    }
    streamEvent=events.get(0);
  }
 while (streamEvent.getTimestamp() < inputSplit.getStartTime());
  if (streamEvent.getTimestamp() >= inputSplit.getEndTime()) {
    return false;
  }
  currentEntry=decoder.decode(streamEvent,currentEntry);
  return true;
}

Fixed version (ground truth):
@Override public boolean nextKeyValue() throws IOException, InterruptedException {
  events.clear();
  if (reader.read(events,1,0,TimeUnit.SECONDS,readFilter) <= 0) {
    return false;
  }
  PositionStreamEvent streamEvent=events.get(0);
  if (streamEvent.getStart() - inputSplit.getStart() >= inputSplit.getLength()) {
    return false;
  }
  currentEntry=decoder.decode(streamEvent,currentEntry);
  return true;
}
Program: 7135
Project: 7135
Buggy source:
@Override public boolean next(Void key,ObjectWritable value) throws IOException {
  StreamEvent streamEvent;
  do {
    if (reader.getPosition() - inputSplit.getStart() >= inputSplit.getLength()) {
      return false;
    }
    events.clear();
    try {
      if (reader.read(events,1,0,TimeUnit.SECONDS,readFilter) <= 0) {
        return false;
      }
    }
 catch (    InterruptedException e) {
      LOG.error("String_Node_Str",e);
      return false;
    }
    streamEvent=events.get(0);
  }
 while (streamEvent.getTimestamp() < inputSplit.getStartTime());
  if (streamEvent.getTimestamp() >= inputSplit.getEndTime()) {
    return false;
  }
  value.set(streamEvent);
  return true;
}

Fixed version (ground truth):
@Override public boolean next(Void key,ObjectWritable value) throws IOException {
  events.clear();
  try {
    if (reader.read(events,1,0,TimeUnit.SECONDS,readFilter) <= 0) {
      return false;
    }
    PositionStreamEvent streamEvent=events.get(0);
    if (streamEvent.getStart() - inputSplit.getStart() >= inputSplit.getLength()) {
      return false;
    }
    value.set(streamEvent);
    return true;
  }
 catch (  InterruptedException e) {
    LOG.error("String_Node_Str",e);
    return false;
  }
}
Program: 7137
Project: 7137
Buggy source:
@Override public List<QueryResult> previewResults(QueryHandle handle) throws ExploreException, HandleNotFoundException, SQLException {
  startAndWait();
  if (inactiveHandleCache.getIfPresent(handle) != null) {
    throw new HandleNotFoundException("String_Node_Str",true);
  }
  OperationInfo operationInfo=getOperationInfo(handle);
  Lock previewLock=operationInfo.getPreviewLock();
  previewLock.lock();
  try {
    File previewFile=operationInfo.getPreviewFile();
    if (previewFile != null) {
      try {
        Reader reader=Files.newReader(previewFile,Charsets.UTF_8);
        try {
          return GSON.fromJson(reader,new TypeToken<List<QueryResult>>(){
          }
.getType());
        }
  finally {
          Closeables.closeQuietly(reader);
        }
      }
 catch (      FileNotFoundException e) {
        LOG.error("String_Node_Str",previewFile,e);
        throw new ExploreException(e);
      }
    }
    try {
      previewFile=new File(previewsDir,handle.getHandle());
      FileWriter fileWriter=new FileWriter(previewFile);
      try {
        List<QueryResult> results=nextResults(handle,PREVIEW_COUNT);
        GSON.toJson(results,fileWriter);
        operationInfo.setPreviewFile(previewFile);
        return results;
      }
  finally {
        Closeables.closeQuietly(fileWriter);
      }
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e);
      throw new ExploreException(e);
    }
  }
  finally {
    previewLock.unlock();
  }
}

Fixed version (ground truth):
@Override public List<QueryResult> previewResults(QueryHandle handle) throws ExploreException, HandleNotFoundException, SQLException {
  startAndWait();
  if (inactiveHandleCache.getIfPresent(handle) != null) {
    throw new HandleNotFoundException("String_Node_Str",true);
  }
  OperationInfo operationInfo=getOperationInfo(handle);
  Lock previewLock=operationInfo.getPreviewLock();
  previewLock.lock();
  try {
    File previewFile=operationInfo.getPreviewFile();
    if (previewFile != null) {
      try {
        Reader reader=Files.newReader(previewFile,Charsets.UTF_8);
        try {
          return GSON.fromJson(reader,new TypeToken<List<QueryResult>>(){
          }
.getType());
        }
  finally {
          Closeables.closeQuietly(reader);
        }
      }
 catch (      FileNotFoundException e) {
        LOG.error("String_Node_Str",previewFile,e);
        throw new ExploreException(e);
      }
    }
    try {
      previewFile=new File(previewsDir,handle.getHandle());
      FileWriter fileWriter=new FileWriter(previewFile);
      try {
        List<QueryResult> results=fetchNextResults(handle,PREVIEW_COUNT);
        GSON.toJson(results,fileWriter);
        operationInfo.setPreviewFile(previewFile);
        return results;
      }
  finally {
        Closeables.closeQuietly(fileWriter);
      }
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e);
      throw new ExploreException(e);
    }
  }
  finally {
    previewLock.unlock();
  }
}
Program: 7138
Project: 7138
Buggy source:
@Override public List<QueryResult> nextResults(QueryHandle handle,int size) throws ExploreException, HandleNotFoundException, SQLException {
  startAndWait();
  InactiveOperationInfo inactiveOperationInfo=inactiveHandleCache.getIfPresent(handle);
  if (inactiveOperationInfo != null) {
    LOG.trace("String_Node_Str",handle);
    return ImmutableList.of();
  }
  Lock nextLock=getOperationInfo(handle).getNextLock();
  nextLock.lock();
  try {
    LOG.trace("String_Node_Str",handle);
    OperationHandle opHandle=getOperationHandle(handle);
    List<QueryResult> results=fetchNextResults(opHandle,size);
    QueryStatus status=getStatus(handle);
    if (results.isEmpty() && status.getStatus() == QueryStatus.OpStatus.FINISHED) {
      timeoutAggresively(handle,getResultSchema(handle),status);
    }
    return results;
  }
 catch (  HiveSQLException e) {
    throw getSqlException(e);
  }
 finally {
    nextLock.unlock();
  }
}

Fixed version (ground truth):
@Override public List<QueryResult> nextResults(QueryHandle handle,int size) throws ExploreException, HandleNotFoundException, SQLException {
  startAndWait();
  InactiveOperationInfo inactiveOperationInfo=inactiveHandleCache.getIfPresent(handle);
  if (inactiveOperationInfo != null) {
    LOG.trace("String_Node_Str",handle);
    return ImmutableList.of();
  }
  try {
    List<QueryResult> results=fetchNextResults(handle,size);
    QueryStatus status=getStatus(handle);
    if (results.isEmpty() && status.getStatus() == QueryStatus.OpStatus.FINISHED) {
      timeoutAggresively(handle,getResultSchema(handle),status);
    }
    return results;
  }
 catch (  HiveSQLException e) {
    throw getSqlException(e);
  }
}
Program: 7141
Project: 7141
Buggy source:
@Inject private DatasetUpgrader(CConfiguration cConf,Configuration hConf,LocationFactory locationFactory,NamespacedLocationFactory namespacedLocationFactory,QueueAdmin queueAdmin,HBaseTableUtil hBaseTableUtil,DatasetFramework dsFramework,DatasetInstanceMDSUpgrader datasetInstanceMDSUpgrader,DatasetTypeMDSUpgrader datasetTypeMDSUpgrader){
  super(locationFactory,namespacedLocationFactory);
  this.cConf=cConf;
  this.hConf=hConf;
  this.locationFactory=locationFactory;
  this.queueAdmin=queueAdmin;
  this.hBaseTableUtil=hBaseTableUtil;
  this.dsFramework=dsFramework;
  this.datasetInstanceMDSUpgrader=datasetInstanceMDSUpgrader;
  this.datasetTypeMDSUpgrader=datasetTypeMDSUpgrader;
  this.userTablePrefix=Pattern.compile(String.format("String_Node_Str",cConf.get(Constants.Dataset.TABLE_PREFIX)));
}

Fixed version (ground truth):
@Inject private DatasetUpgrader(CConfiguration cConf,Configuration hConf,LocationFactory locationFactory,NamespacedLocationFactory namespacedLocationFactory,HBaseTableUtil hBaseTableUtil,DatasetFramework dsFramework,DatasetInstanceMDSUpgrader datasetInstanceMDSUpgrader,DatasetTypeMDSUpgrader datasetTypeMDSUpgrader){
  super(locationFactory,namespacedLocationFactory);
  this.cConf=cConf;
  this.hConf=hConf;
  this.locationFactory=locationFactory;
  this.hBaseTableUtil=hBaseTableUtil;
  this.dsFramework=dsFramework;
  this.datasetInstanceMDSUpgrader=datasetInstanceMDSUpgrader;
  this.datasetTypeMDSUpgrader=datasetTypeMDSUpgrader;
  this.userTablePrefix=Pattern.compile(String.format("String_Node_Str",cConf.get(Constants.Dataset.TABLE_PREFIX)));
}
Program: 7142
Project: 7142
Buggy source:
@Override public void upgrade() throws Exception {
  upgradeSystemDatasets();
  upgradeUserTables();
  queueAdmin.upgrade();
  datasetTypeMDSUpgrader.upgrade();
  datasetInstanceMDSUpgrader.upgrade();
  for (  DatasetSpecification fileSetSpec : datasetInstanceMDSUpgrader.getFileSetsSpecs()) {
    upgradeFileSet(fileSetSpec);
  }
}

Fixed version (ground truth):
@Override public void upgrade() throws Exception {
  upgradeSystemDatasets();
  upgradeUserTables();
  datasetTypeMDSUpgrader.upgrade();
  datasetInstanceMDSUpgrader.upgrade();
  for (  DatasetSpecification fileSetSpec : datasetInstanceMDSUpgrader.getFileSetsSpecs()) {
    upgradeFileSet(fileSetSpec);
  }
}
Program: 7143
Project: 7143
Buggy source:
@Inject public QueueConfigUpgrader(LocationFactory locationFactory,NamespacedLocationFactory namespacedLocationFactory,HBaseTableUtil tableUtil,Configuration conf){
  super(locationFactory,namespacedLocationFactory,tableUtil,conf);
}

Fixed version (ground truth):
@Inject public QueueConfigUpgrader(LocationFactory locationFactory,NamespacedLocationFactory namespacedLocationFactory,HBaseTableUtil tableUtil,Configuration conf,QueueAdmin queueAdmin){
  super(locationFactory,namespacedLocationFactory,tableUtil,conf);
  this.queueAdmin=queueAdmin;
}
Program: 7144
Project: 7144
Buggy source:
@Inject public StreamStateStoreUpgrader(LocationFactory locationFactory,NamespacedLocationFactory namespacedLocationFactory,HBaseTableUtil tableUtil,Configuration conf){
  super(locationFactory,namespacedLocationFactory,tableUtil,conf);
}

Fixed version (ground truth):
@Inject public StreamStateStoreUpgrader(LocationFactory locationFactory,NamespacedLocationFactory namespacedLocationFactory,HBaseTableUtil tableUtil,Configuration conf,StreamAdmin streamAdmin){
  super(locationFactory,namespacedLocationFactory,tableUtil,conf);
  this.streamAdmin=streamAdmin;
}
Program: 7145
Project: 7145
Buggy source:
private void doMain(String[] args) throws Exception {
  System.out.println(String.format("String_Node_Str",getClass().getSimpleName(),ProjectInfo.getVersion()));
  System.out.println();
  if (args.length < 1) {
    printHelp();
    return;
  }
  Action action=parseAction(args[0]);
  if (action == null) {
    System.out.println(String.format("String_Node_Str",args[0]));
    printHelp(true);
    return;
  }
  try {
switch (action) {
case UPGRADE:
      Scanner scan=new Scanner(System.in);
    System.out.println(String.format("String_Node_Str",action.name().toLowerCase(),action.getDescription()));
  System.out.println("String_Node_Str");
String response=scan.next();
if (response.equalsIgnoreCase("String_Node_Str") || response.equalsIgnoreCase("String_Node_Str")) {
System.out.println("String_Node_Str");
performUpgrade();
}
 else {
System.out.println("String_Node_Str");
}
break;
case HELP:
printHelp();
break;
}
}
 catch (Exception e) {
System.out.println(String.format("String_Node_Str",action,e.getMessage()));
e.printStackTrace(System.out);
throw e;
}
}

Fixed version (ground truth):
private void doMain(String[] args) throws Exception {
  System.out.println(String.format("String_Node_Str",getClass().getSimpleName(),ProjectInfo.getVersion()));
  System.out.println();
  if (args.length < 1) {
    printHelp();
    return;
  }
  Action action=parseAction(args[0]);
  if (action == null) {
    System.out.println(String.format("String_Node_Str",args[0]));
    printHelp(true);
    return;
  }
  try {
switch (action) {
case UPGRADE:
      Scanner scan=new Scanner(System.in);
    System.out.println(String.format("String_Node_Str",action.name().toLowerCase(),action.getDescription()));
  System.out.println("String_Node_Str");
String response=scan.next();
if (response.equalsIgnoreCase("String_Node_Str") || response.equalsIgnoreCase("String_Node_Str")) {
System.out.println("String_Node_Str");
try {
  startUp();
  performUpgrade();
}
  finally {
  stop();
}
}
 else {
System.out.println("String_Node_Str");
}
break;
case HELP:
printHelp();
break;
}
}
 catch (Exception e) {
System.out.println(String.format("String_Node_Str",action,e.getMessage()));
e.printStackTrace(System.out);
throw e;
}
}
Program: 7146
Project: 7146
Buggy source:
public static void main(String[] args) throws Exception {
  UpgradeTool upgradeTool=new UpgradeTool();
  upgradeTool.startUp();
  try {
    upgradeTool.doMain(args);
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",t);
  }
 finally {
    upgradeTool.stop();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    UpgradeTool upgradeTool=new UpgradeTool();
    upgradeTool.doMain(args);
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",t);
  }
}
Program: 7147
Project: 7147
Buggy source:
/** 
 * Get program location
 * @param factory  location factory
 * @param appFabricDir app fabric output directory path
 * @param id       program id
 * @param type     type of the program
 * @return         Location corresponding to the program id
 * @throws IOException incase of errors
 */
public static Location programLocation(LocationFactory factory,String appFabricDir,Id.Program id,ProgramType type) throws IOException {
  Location namespaceHome=factory.create(id.getNamespaceId());
  if (!namespaceHome.exists()) {
    throw new FileNotFoundException("String_Node_Str" + namespaceHome.toURI().getPath());
  }
  Location appFabricLocation=namespaceHome.append(appFabricDir);
  String name=String.format(Locale.ENGLISH,"String_Node_Str",id.getApplicationId(),type.toString());
  Location applicationProgramsLocation=appFabricLocation.append(name);
  if (!applicationProgramsLocation.exists()) {
    throw new FileNotFoundException("String_Node_Str" + applicationProgramsLocation.toURI().getPath());
  }
  Location programLocation=applicationProgramsLocation.append(String.format("String_Node_Str",id.getId()));
  if (!programLocation.exists()) {
    throw new FileNotFoundException(String.format("String_Node_Str",id.getApplication(),id.getId(),type));
  }
  return programLocation;
}

Fixed version (ground truth):
/** 
 * Get program location
 * @param namespacedLocationFactory the namespaced location on the file system
 * @param appFabricDir app fabric output directory path
 * @param id program id
 * @param type type of the program    @return Location corresponding to the program id
 * @throws IOException incase of errors
 */
public static Location programLocation(NamespacedLocationFactory namespacedLocationFactory,String appFabricDir,Id.Program id,ProgramType type) throws IOException {
  Location namespaceHome=namespacedLocationFactory.get(id.getApplication().getNamespace());
  if (!namespaceHome.exists()) {
    throw new FileNotFoundException("String_Node_Str" + namespaceHome.toURI().getPath());
  }
  Location appFabricLocation=namespaceHome.append(appFabricDir);
  Location applicationProgramsLocation=appFabricLocation.append(id.getApplicationId()).append(type.toString());
  if (!applicationProgramsLocation.exists()) {
    throw new FileNotFoundException("String_Node_Str" + applicationProgramsLocation.toURI().getPath());
  }
  Location programLocation=applicationProgramsLocation.append(String.format("String_Node_Str",id.getId()));
  if (!programLocation.exists()) {
    throw new FileNotFoundException(String.format("String_Node_Str",id.getApplication(),id.getId(),type));
  }
  return programLocation;
}
Program: 7148
Project: 7148
Buggy source:
@Inject public AppLifecycleHttpHandler(Authenticator authenticator,CConfiguration configuration,ManagerFactory<DeploymentInfo,ApplicationWithPrograms> managerFactory,LocationFactory locationFactory,Scheduler scheduler,ProgramRuntimeService runtimeService,StoreFactory storeFactory,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,DiscoveryServiceClient discoveryServiceClient,PreferencesStore preferencesStore,AdapterService adapterService,NamespaceAdmin namespaceAdmin,MetricStore metricStore){
  super(authenticator);
  this.configuration=configuration;
  this.managerFactory=managerFactory;
  this.namespaceAdmin=namespaceAdmin;
  this.locationFactory=locationFactory;
  this.scheduler=scheduler;
  this.runtimeService=runtimeService;
  this.store=storeFactory.create();
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.discoveryServiceClient=discoveryServiceClient;
  this.preferencesStore=preferencesStore;
  this.adapterService=adapterService;
  this.metricStore=metricStore;
}

Fixed version (ground truth):
@Inject public AppLifecycleHttpHandler(Authenticator authenticator,CConfiguration configuration,ManagerFactory<DeploymentInfo,ApplicationWithPrograms> managerFactory,LocationFactory locationFactory,Scheduler scheduler,ProgramRuntimeService runtimeService,StoreFactory storeFactory,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,PreferencesStore preferencesStore,AdapterService adapterService,NamespaceAdmin namespaceAdmin,MetricStore metricStore,NamespacedLocationFactory namespacedLocationFactory){
  super(authenticator);
  this.configuration=configuration;
  this.managerFactory=managerFactory;
  this.namespaceAdmin=namespaceAdmin;
  this.locationFactory=locationFactory;
  this.scheduler=scheduler;
  this.runtimeService=runtimeService;
  this.namespacedLocationFactory=namespacedLocationFactory;
  this.store=storeFactory.create();
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.preferencesStore=preferencesStore;
  this.adapterService=adapterService;
  this.metricStore=metricStore;
}
Program: 7150
Project: 7150
Buggy source:
/** 
 * Delete the jar location of the program.
 * @param appId        applicationId.
 * @throws IOException if there are errors with location IO
 */
private void deleteProgramLocations(Id.Application appId) throws IOException {
  Iterable<ProgramSpecification> programSpecs=getProgramSpecs(appId);
  String appFabricDir=configuration.get(Constants.AppFabric.OUTPUT_DIR);
  for (  ProgramSpecification spec : programSpecs) {
    ProgramType type=ProgramTypes.fromSpecification(spec);
    Id.Program programId=Id.Program.from(appId,type,spec.getName());
    try {
      Location location=Programs.programLocation(locationFactory,appFabricDir,programId,type);
      location.delete();
    }
 catch (    FileNotFoundException e) {
      LOG.warn("String_Node_Str",programId.toString(),e);
    }
  }
  try {
    Id.Program programId=Id.Program.from(appId.getNamespaceId(),appId.getId(),ProgramType.WEBAPP,ProgramType.WEBAPP.name().toLowerCase());
    Location location=Programs.programLocation(locationFactory,appFabricDir,programId,ProgramType.WEBAPP);
    location.delete();
  }
 catch (  FileNotFoundException e) {
  }
}

Fixed version (ground truth):
/** 
 * Delete the jar location of the program.
 * @param appId        applicationId.
 * @throws IOException if there are errors with location IO
 */
private void deleteProgramLocations(Id.Application appId) throws IOException {
  Iterable<ProgramSpecification> programSpecs=getProgramSpecs(appId);
  String appFabricDir=configuration.get(Constants.AppFabric.OUTPUT_DIR);
  for (  ProgramSpecification spec : programSpecs) {
    ProgramType type=ProgramTypes.fromSpecification(spec);
    Id.Program programId=Id.Program.from(appId,type,spec.getName());
    try {
      Location location=Programs.programLocation(namespacedLocationFactory,appFabricDir,programId,type);
      location.delete();
    }
 catch (    FileNotFoundException e) {
      LOG.warn("String_Node_Str",programId.toString(),e);
    }
  }
  try {
    Id.Program programId=Id.Program.from(appId.getNamespaceId(),appId.getId(),ProgramType.WEBAPP,ProgramType.WEBAPP.name().toLowerCase());
    Location location=Programs.programLocation(namespacedLocationFactory,appFabricDir,programId,ProgramType.WEBAPP);
    location.delete();
  }
 catch (  FileNotFoundException e) {
  }
}
Program: 7151
Project: 7151
Buggy source:
@Inject public ProgramLifecycleHttpHandler(Authenticator authenticator,StoreFactory storeFactory,WorkflowClient workflowClient,LocationFactory locationFactory,CConfiguration configuration,ProgramRuntimeService runtimeService,DiscoveryServiceClient discoveryServiceClient,QueueAdmin queueAdmin,Scheduler scheduler,PreferencesStore preferencesStore){
  super(authenticator);
  this.store=storeFactory.create();
  this.workflowClient=workflowClient;
  this.locationFactory=locationFactory;
  this.configuration=configuration;
  this.runtimeService=runtimeService;
  this.appFabricDir=this.configuration.get(Constants.AppFabric.OUTPUT_DIR);
  this.discoveryServiceClient=discoveryServiceClient;
  this.queueAdmin=queueAdmin;
  this.scheduler=scheduler;
  this.preferencesStore=preferencesStore;
  this.schedulerQueueResolver=new SchedulerQueueResolver(configuration,store);
}

Fixed version (ground truth):
@Inject public ProgramLifecycleHttpHandler(Authenticator authenticator,StoreFactory storeFactory,WorkflowClient workflowClient,CConfiguration configuration,ProgramRuntimeService runtimeService,DiscoveryServiceClient discoveryServiceClient,QueueAdmin queueAdmin,Scheduler scheduler,PreferencesStore preferencesStore,NamespacedLocationFactory namespacedLocationFactory){
  super(authenticator);
  this.namespacedLocationFactory=namespacedLocationFactory;
  this.store=storeFactory.create();
  this.workflowClient=workflowClient;
  this.configuration=configuration;
  this.runtimeService=runtimeService;
  this.appFabricDir=this.configuration.get(Constants.AppFabric.OUTPUT_DIR);
  this.discoveryServiceClient=discoveryServiceClient;
  this.queueAdmin=queueAdmin;
  this.scheduler=scheduler;
  this.preferencesStore=preferencesStore;
  this.schedulerQueueResolver=new SchedulerQueueResolver(configuration,store);
}
Program: 7152
Project: 7152
Buggy source:
/** 
 * 'protected' only to support v2 webapp APIs
 */
protected ProgramStatus getProgramStatus(Id.Program id,ProgramType type){
  try {
    ProgramRuntimeService.RuntimeInfo runtimeInfo=findRuntimeInfo(id,type);
    if (runtimeInfo == null) {
      if (type != ProgramType.WEBAPP) {
        ProgramSpecification spec=getProgramSpecification(id,type);
        if (spec == null) {
          return new ProgramStatus(id.getApplicationId(),id.getId(),HttpResponseStatus.NOT_FOUND.toString());
        }
 else {
          return new ProgramStatus(id.getApplicationId(),id.getId(),"String_Node_Str");
        }
      }
 else {
        Location webappLoc=null;
        try {
          webappLoc=Programs.programLocation(locationFactory,appFabricDir,id,ProgramType.WEBAPP);
        }
 catch (        FileNotFoundException e) {
        }
        if (webappLoc != null && webappLoc.exists()) {
          return new ProgramStatus(id.getApplicationId(),id.getId(),"String_Node_Str");
        }
 else {
          return new ProgramStatus(id.getApplicationId(),id.getId(),HttpResponseStatus.NOT_FOUND.toString());
        }
      }
    }
    String status=controllerStateToString(runtimeInfo.getController().getState());
    return new ProgramStatus(id.getApplicationId(),id.getId(),status);
  }
 catch (  Throwable throwable) {
    LOG.warn(throwable.getMessage(),throwable);
    throw Throwables.propagate(throwable);
  }
}

Fixed version (ground truth):
/** 
 * 'protected' only to support v2 webapp APIs
 */
protected ProgramStatus getProgramStatus(Id.Program id,ProgramType type){
  try {
    ProgramRuntimeService.RuntimeInfo runtimeInfo=findRuntimeInfo(id,type);
    if (runtimeInfo == null) {
      if (type != ProgramType.WEBAPP) {
        ProgramSpecification spec=getProgramSpecification(id,type);
        if (spec == null) {
          return new ProgramStatus(id.getApplicationId(),id.getId(),HttpResponseStatus.NOT_FOUND.toString());
        }
 else {
          return new ProgramStatus(id.getApplicationId(),id.getId(),"String_Node_Str");
        }
      }
 else {
        Location webappLoc=null;
        try {
          webappLoc=Programs.programLocation(namespacedLocationFactory,appFabricDir,id,ProgramType.WEBAPP);
        }
 catch (        FileNotFoundException e) {
        }
        if (webappLoc != null && webappLoc.exists()) {
          return new ProgramStatus(id.getApplicationId(),id.getId(),"String_Node_Str");
        }
 else {
          return new ProgramStatus(id.getApplicationId(),id.getId(),HttpResponseStatus.NOT_FOUND.toString());
        }
      }
    }
    String status=controllerStateToString(runtimeInfo.getController().getState());
    return new ProgramStatus(id.getApplicationId(),id.getId(),status);
  }
 catch (  Throwable throwable) {
    LOG.warn(throwable.getMessage(),throwable);
    throw Throwables.propagate(throwable);
  }
}
Program: 7153
Project: 7153
Buggy source:
@Inject public LocalManager(CConfiguration configuration,PipelineFactory pipelineFactory,LocationFactory locationFactory,StoreFactory storeFactory,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,DiscoveryServiceClient discoveryServiceClient,DatasetFramework datasetFramework,@Named("String_Node_Str") DatasetFramework inMemoryDatasetFramework,StreamAdmin streamAdmin,ExploreFacade exploreFacade,Scheduler scheduler,AdapterService adapterService,@Assisted ProgramTerminator programTerminator){
  this.configuration=configuration;
  this.pipelineFactory=pipelineFactory;
  this.locationFactory=locationFactory;
  this.discoveryServiceClient=discoveryServiceClient;
  this.store=storeFactory.create();
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.programTerminator=programTerminator;
  this.datasetFramework=datasetFramework;
  this.inMemoryDatasetFramework=inMemoryDatasetFramework;
  this.streamAdmin=streamAdmin;
  this.exploreFacade=exploreFacade;
  this.scheduler=scheduler;
  this.exploreEnabled=configuration.getBoolean(Constants.Explore.EXPLORE_ENABLED);
  this.adapterService=adapterService;
}

Fixed version (ground truth):
@Inject public LocalManager(CConfiguration configuration,PipelineFactory pipelineFactory,NamespacedLocationFactory namespacedLocationFactory,StoreFactory storeFactory,StreamConsumerFactory streamConsumerFactory,QueueAdmin queueAdmin,DiscoveryServiceClient discoveryServiceClient,DatasetFramework datasetFramework,@Named("String_Node_Str") DatasetFramework inMemoryDatasetFramework,StreamAdmin streamAdmin,ExploreFacade exploreFacade,Scheduler scheduler,AdapterService adapterService,@Assisted ProgramTerminator programTerminator){
  this.configuration=configuration;
  this.namespacedLocationFactory=namespacedLocationFactory;
  this.pipelineFactory=pipelineFactory;
  this.discoveryServiceClient=discoveryServiceClient;
  this.store=storeFactory.create();
  this.streamConsumerFactory=streamConsumerFactory;
  this.queueAdmin=queueAdmin;
  this.programTerminator=programTerminator;
  this.datasetFramework=datasetFramework;
  this.inMemoryDatasetFramework=inMemoryDatasetFramework;
  this.streamAdmin=streamAdmin;
  this.exploreFacade=exploreFacade;
  this.scheduler=scheduler;
  this.exploreEnabled=configuration.getBoolean(Constants.Explore.EXPLORE_ENABLED);
  this.adapterService=adapterService;
}
Program: 7154
Project: 7154
Buggy source:
@Override public ListenableFuture<O> deploy(Id.Namespace id,@Nullable String appId,I input) throws Exception {
  Pipeline<O> pipeline=pipelineFactory.getPipeline();
  pipeline.addLast(new LocalArchiveLoaderStage(store,configuration,id,appId));
  pipeline.addLast(new VerificationStage(store,datasetFramework,adapterService));
  pipeline.addLast(new DeployDatasetModulesStage(configuration,datasetFramework,inMemoryDatasetFramework));
  pipeline.addLast(new CreateDatasetInstancesStage(configuration,datasetFramework));
  pipeline.addLast(new CreateStreamsStage(id,streamAdmin,exploreFacade,exploreEnabled));
  pipeline.addLast(new DeletedProgramHandlerStage(store,programTerminator,streamConsumerFactory,queueAdmin,discoveryServiceClient));
  pipeline.addLast(new ProgramGenerationStage(configuration,locationFactory));
  pipeline.addLast(new ApplicationRegistrationStage(store));
  pipeline.addLast(new CreateSchedulesStage(scheduler));
  pipeline.setFinally(new DeployCleanupStage());
  return pipeline.execute(input);
}

Fixed version (ground truth):
@Override public ListenableFuture<O> deploy(Id.Namespace id,@Nullable String appId,I input) throws Exception {
  Pipeline<O> pipeline=pipelineFactory.getPipeline();
  pipeline.addLast(new LocalArchiveLoaderStage(store,configuration,id,appId));
  pipeline.addLast(new VerificationStage(store,datasetFramework,adapterService));
  pipeline.addLast(new DeployDatasetModulesStage(configuration,datasetFramework,inMemoryDatasetFramework));
  pipeline.addLast(new CreateDatasetInstancesStage(configuration,datasetFramework));
  pipeline.addLast(new CreateStreamsStage(id,streamAdmin,exploreFacade,exploreEnabled));
  pipeline.addLast(new DeletedProgramHandlerStage(store,programTerminator,streamConsumerFactory,queueAdmin,discoveryServiceClient));
  pipeline.addLast(new ProgramGenerationStage(configuration,namespacedLocationFactory));
  pipeline.addLast(new ApplicationRegistrationStage(store));
  pipeline.addLast(new CreateSchedulesStage(scheduler));
  pipeline.setFinally(new DeployCleanupStage());
  return pipeline.execute(input);
}
Program: 7155
Project: 7155
Buggy source:
@Override public Location call() throws Exception {
  ProgramType type=ProgramTypes.fromSpecification(spec);
  String name=String.format(Locale.ENGLISH,"String_Node_Str",applicationName,type);
  Location programDir=newOutputDir.append(name);
  if (!programDir.exists()) {
    programDir.mkdirs();
  }
  Location output=programDir.append(String.format("String_Node_Str",spec.getName()));
  return ProgramBundle.create(input.getId(),bundler,output,spec.getName(),spec.getClassName(),type,appSpec);
}

Fixed version (ground truth):
@Override public Location call() throws Exception {
  ProgramType type=ProgramTypes.fromSpecification(spec);
  String name=String.format(Locale.ENGLISH,"String_Node_Str",applicationName,type);
  Location programDir=appFabricDir.append(name);
  if (!programDir.exists()) {
    programDir.mkdirs();
  }
  Location output=programDir.append(String.format("String_Node_Str",spec.getName()));
  return ProgramBundle.create(input.getId(),bundler,output,spec.getName(),spec.getClassName(),type,appSpec);
}
Program: 7157
Project: 7157
Buggy source:
public ProgramGenerationStage(Configuration configuration,LocationFactory locationFactory){
  super(TypeToken.of(ApplicationDeployable.class));
  this.configuration=configuration;
  this.locationFactory=locationFactory;
}

Fixed version (ground truth):
public ProgramGenerationStage(CConfiguration configuration,NamespacedLocationFactory namespacedLocationFactory){
  super(TypeToken.of(ApplicationDeployable.class));
  this.configuration=configuration;
  this.namespacedLocationFactory=namespacedLocationFactory;
}
Program: 7158
Project: 7158
Buggy source:
@Override public DatasetAdmin getAdmin(DatasetContext datasetContext,DatasetSpecification spec,ClassLoader classLoader) throws IOException {
  return new CompositeDatasetAdmin(filesetDef.getAdmin(datasetContext,spec.getSpecification(FILESET_NAME),classLoader),tableDef.getAdmin(datasetContext,spec.getSpecification(PARTITION_TABLE_NAME),classLoader));
}

Fixed version (ground truth):
@Override public DatasetAdmin getAdmin(DatasetContext datasetContext,DatasetSpecification spec,ClassLoader classLoader) throws IOException {
  return new PartitionedFileSetAdmin(datasetContext,spec,getExploreProvider(),filesetDef.getAdmin(datasetContext,spec.getSpecification(FILESET_NAME),classLoader),tableDef.getAdmin(datasetContext,spec.getSpecification(PARTITION_TABLE_NAME),classLoader));
}
Program: 7159
Project: 7159
Buggy source:
@Override public DequeueResult<byte[]> dequeue(int maxBatchSize) throws IOException {
  DequeueResult<byte[]> result=performDequeue(maxBatchSize);
  if (scanStartRow != null) {
    if (!consumingEntries.isEmpty()) {
      byte[] floorKey=consumingEntries.floorKey(scanStartRow);
      if (floorKey != null) {
        updateStartRow(floorKey);
      }
    }
 else {
      updateStartRow(scanStartRow);
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public DequeueResult<byte[]> dequeue(int maxBatchSize) throws IOException {
  DequeueResult<byte[]> result=performDequeue(maxBatchSize);
  byte[] floorKey=consumingEntries.floorKey(scanStartRow);
  updateStartRow(floorKey == null ? scanStartRow : floorKey);
  return result;
}
Program: 7160
Project: 7160
Buggy source:
/** 
 * Creates a HBaseQueue2Consumer.
 * @param hTable The HTable instance to use for communicating with HBase. This consumer is responsible for closing it.
 * @param queueName Name of the queue.
 * @param consumerState The persisted state of this consumer.
 * @param stateStore The store for persisting state for this consumer.
 */
HBaseQueueConsumer(CConfiguration cConf,HTable hTable,QueueName queueName,HBaseConsumerState consumerState,HBaseConsumerStateStore stateStore,HBaseQueueStrategy queueStrategy){
  super(cConf,consumerState.getConsumerConfig(),queueName,consumerState.getStartRow());
  this.hTable=hTable;
  this.stateStore=stateStore;
  this.queueRowPrefix=QueueEntryRow.getQueueRowPrefix(queueName);
  this.queueStrategy=queueStrategy;
  this.state=consumerState;
  this.canConsume=false;
}

Fixed version (ground truth):
/** 
 * Creates a HBaseQueue2Consumer.
 * @param hTable The HTable instance to use for communicating with HBase. This consumer is responsible for closing it.
 * @param queueName Name of the queue.
 * @param consumerState The persisted state of this consumer.
 * @param stateStore The store for persisting state for this consumer.
 */
HBaseQueueConsumer(CConfiguration cConf,HTable hTable,QueueName queueName,HBaseConsumerState consumerState,HBaseConsumerStateStore stateStore,HBaseQueueStrategy queueStrategy){
  super(cConf,consumerState.getConsumerConfig(),queueName,consumerState.getStartRow());
  this.hTable=hTable;
  this.state=consumerState;
  this.stateStore=stateStore;
  this.queueRowPrefix=QueueEntryRow.getQueueRowPrefix(queueName);
  this.queueStrategy=queueStrategy;
  this.canConsume=false;
}
Program: 7161
Project: 7161
Buggy source:
@Override protected void updateStartRow(byte[] startRow){
  ConsumerConfig consumerConfig=getConfig();
  stateStore.updateState(consumerConfig.getGroupId(),consumerConfig.getInstanceId(),startRow);
}

Fixed version (ground truth):
@Override protected void updateStartRow(byte[] startRow){
  if (canConsume && !completed) {
    ConsumerConfig consumerConfig=getConfig();
    stateStore.updateState(consumerConfig.getGroupId(),consumerConfig.getInstanceId(),startRow);
  }
}