Program: 154965
Project: 154965
Buggy source:
private void doInternalRecovery(String logFileName) throws IOException {
  log.info("String_Node_Str" + logFileName + "String_Node_Str");
  buffer.clear();
  buffer.limit(8);
  if (fileChannel.read(buffer) != 8) {
    log.info("String_Node_Str" + "String_Node_Str");
    fileChannel.close();
    boolean success=FileUtils.renameFile(new File(logFileName),new File(logFileName + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"));
    assert success;
    fileChannel=new RandomAccessFile(logFileName,"String_Node_Str").getChannel();
    return;
  }
  buffer.flip();
  logVersion=buffer.getLong();
  log.fine("String_Node_Str" + logVersion);
  long logEntriesFound=0;
  long lastEntryPos=fileChannel.position();
  while (readEntry()) {
    logEntriesFound++;
    lastEntryPos=fileChannel.position();
  }
  fileChannel.position(lastEntryPos);
  scanIsComplete=true;
  log.fine("String_Node_Str" + logEntriesFound + "String_Node_Str");
  xaRm.checkXids();
  if (xidIdentMap.size() == 0) {
    log.fine("String_Node_Str");
  }
 else {
    log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ xidIdentMap.size()+ "String_Node_Str");
    for (    StartEntry entry : xidIdentMap.values()) {
      log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ entry.getXid()+ "String_Node_Str");
    }
  }
  recoveredTxMap.clear();
}

Fixed version (ground truth):
private void doInternalRecovery(String logFileName) throws IOException {
  log.info("String_Node_Str" + logFileName + "String_Node_Str");
  buffer.clear();
  buffer.limit(8);
  if (fileChannel.read(buffer) != 8) {
    log.info("String_Node_Str" + "String_Node_Str");
    fileChannel.close();
    boolean success=FileUtils.renameFile(new File(logFileName),new File(logFileName + "String_Node_Str" + System.currentTimeMillis()+ "String_Node_Str"));
    assert success;
    fileChannel=new RandomAccessFile(logFileName,"String_Node_Str").getChannel();
    return;
  }
  buffer.flip();
  logVersion=buffer.getLong();
  log.fine("String_Node_Str" + logVersion);
  long logEntriesFound=0;
  long lastEntryPos=fileChannel.position();
  while (readEntry()) {
    logEntriesFound++;
    lastEntryPos=fileChannel.position();
  }
  fileChannel.position(lastEntryPos);
  buffer.clear();
  while (buffer.hasRemaining()) {
    buffer.put((byte)0);
  }
  buffer.flip();
  long endPosition=fileChannel.size();
  do {
    long bytesLeft=fileChannel.size() - fileChannel.position();
    if (bytesLeft < buffer.capacity()) {
      buffer.limit((int)bytesLeft);
    }
    fileChannel.write(buffer);
    buffer.flip();
  }
 while (fileChannel.position() < endPosition);
  fileChannel.position(lastEntryPos);
  scanIsComplete=true;
  log.fine("String_Node_Str" + logEntriesFound + "String_Node_Str");
  xaRm.checkXids();
  if (xidIdentMap.size() == 0) {
    log.fine("String_Node_Str");
  }
 else {
    log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ xidIdentMap.size()+ "String_Node_Str");
    for (    StartEntry entry : xidIdentMap.values()) {
      log.fine("String_Node_Str" + logFileName + "String_Node_Str"+ entry.getXid()+ "String_Node_Str");
    }
  }
  recoveredTxMap.clear();
}