nus-yam/ex-repair huggingface dataset:
Program: 132328
Project: 132328
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void after(Object[] args){
  BabuDBInsertGroup irg=(BabuDBInsertGroup)args[0];
  LSMDatabase lsmDB=(LSMDatabase)args[1];
  if (lsmDB == null) {
    lsmDB=((DatabaseImpl)dbsById.get(irg.getRecord().getDatabaseId())).getLSMDB();
  }
  BabuDBRequestResultImpl<Object> listener=(BabuDBRequestResultImpl<Object>)args[2];
  if (dbs.getConfig().getSyncMode() != SyncMode.ASYNC) {
    for (    InsertRecord ir : irg.getRecord().getInserts()) {
      LSMTree index=lsmDB.getIndex(ir.getIndexId());
      if (ir.getValue() != null) {
        index.insert(ir.getKey(),ir.getValue());
      }
 else {
        index.delete(ir.getKey());
      }
    }
    if (listener != null)     listener.finished();
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void after(Object[] args){
  InsertRecordGroup irg=(InsertRecordGroup)args[0];
  LSMDatabase lsmDB=(LSMDatabase)args[1];
  if (lsmDB == null) {
    lsmDB=((DatabaseImpl)dbsById.get(irg.getDatabaseId())).getLSMDB();
  }
  BabuDBRequestResultImpl<Object> listener=(BabuDBRequestResultImpl<Object>)args[2];
  if (dbs.getConfig().getSyncMode() != SyncMode.ASYNC) {
    for (    InsertRecord ir : irg.getInserts()) {
      LSMTree index=lsmDB.getIndex(ir.getIndexId());
      if (ir.getValue() != null) {
        index.insert(ir.getKey(),ir.getValue());
      }
 else {
        index.delete(ir.getKey());
      }
    }
    if (listener != null)     listener.finished();
  }
}
Program: 132330
Project: 132330
Buggy source:
private boolean useMmap(){
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + OutputUtils.formatBytes(totalOnDiskSize));
  return useMMap && totalOnDiskSize < mmapLimitBytes;
}

Fixed version (ground truth):
private boolean useMmap(){
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + OutputUtils.formatBytes(totalOnDiskSize));
  return useMMap && (mmapLimitBytes < 0 || totalOnDiskSize < mmapLimitBytes);
}
Program: 132332
Project: 132332
Buggy source:
public void destroy() throws IOException {
  LogEntry tmp=nextEntry;
  nextEntry=null;
  if (tmp != null)   tmp.free();
  currentFile.close();
}

Fixed version (ground truth):
public void destroy() throws IOException {
  LogEntry tmp=nextEntry;
  nextEntry=null;
  if (tmp != null)   tmp.free();
  if (currentFile != null)   currentFile.close();
}
Program: 132333
Project: 132333
Buggy source:
protected LogEntry findNextEntry() throws IOException, LogEntryException {
  if (logList == null)   return null;
  if (currentFile.hasNext())   return currentFile.next();
  if (!logList.hasNext())   return null;
  currentFile.close();
  if (!logList.hasNext())   return null;
  currentLog=logList.next();
  currentFile=new DiskLogFile(dbLogDir,currentLog);
  return findNextEntry();
}

Fixed version (ground truth):
protected LogEntry findNextEntry() throws IOException, LogEntryException {
  if (logList == null)   return null;
  if (currentFile.hasNext())   return currentFile.next();
  currentFile.close();
  if (!logList.hasNext())   return null;
  currentLog=logList.next();
  currentFile=new DiskLogFile(dbLogDir,currentLog);
  return findNextEntry();
}
Program: 132334
Project: 132334
Buggy source:
protected void findFirstEntry() throws IOException, LogEntryException {
  if (logList == null || !logList.hasNext())   return;
  do {
    currentLog=logList.next();
    currentFile=new DiskLogFile(dbLogDir,currentLog);
  }
 while (!currentFile.hasNext() && logList.hasNext());
  while (currentFile.hasNext()) {
    LogEntry le=currentFile.next();
    if (from == null || le.getLSN().compareTo(from) >= 0) {
      nextEntry=le;
      break;
    }
    le.free();
  }
}

Fixed version (ground truth):
protected void findFirstEntry() throws IOException, LogEntryException {
  if (logList == null || !logList.hasNext())   return;
  do {
    currentLog=logList.next();
    if (currentFile != null)     currentFile.close();
    currentFile=new DiskLogFile(dbLogDir,currentLog);
  }
 while (!currentFile.hasNext() && logList.hasNext());
  while (currentFile.hasNext()) {
    LogEntry le=currentFile.next();
    if (from == null || le.getLSN().compareTo(from) >= 0) {
      nextEntry=le;
      break;
    }
    le.free();
  }
}
Program: 132336
Project: 132336
Buggy source:
@After public void tearDown(){
  l.shutdown();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  l.shutdown();
  l.waitForShutdown();
  try {
    l.finalize();
  }
 catch (  Throwable th) {
    throw new Exception(th);
  }
}
Program: 132337
Project: 132337
Buggy source:
/** 
 * Creates a new multi-overlay tree.
 * @param nullValue A value that will never be inserted in the tree. This value will be used to mark entries as deleted.
 * @param comparator The comparator for the keys. If a <code>null</code> comparator is provided, the natural ordering of the keys will be used if defined.
 */
public MultiOverlayTree(V nullValue,Comparator<K> comparator){
  if (comparator == null) {
    this.comparator=new Comparator<K>(){
      public int compare(      K o1,      K o2){
        return ((Comparable<K>)o1).compareTo(o2);
      }
    }
;
  }
 else   this.comparator=comparator;
  treeList=new OverlayTreeList<K,V>(new TreeMap<K,V>(comparator),null);
  overlayMap=new HashMap<Integer,OverlayTreeList<K,V>>();
  this.nullValue=nullValue;
}

Fixed version (ground truth):
/** 
 * Creates a new multi-overlay tree.
 * @param nullValue A value that will never be inserted in the tree. This value will be used to mark entries as deleted.
 * @param comparator The comparator for the keys. If a <code>null</code> comparator is provided, the natural ordering of the keys will be used if defined.
 */
public MultiOverlayTree(V nullValue,Comparator<K> comparator){
  if (comparator == null) {
    this.comparator=new Comparator<K>(){
      public int compare(      K o1,      K o2){
        return ((Comparable<K>)o1).compareTo(o2);
      }
    }
;
  }
 else   this.comparator=comparator;
  treeList=new OverlayTreeList<K,V>(new TreeMap<K,V>(comparator),null);
  overlayMap=Collections.synchronizedMap(new HashMap<Integer,OverlayTreeList<K,V>>());
  this.nullValue=nullValue;
}
Program: 132338
Project: 132338
Buggy source:
public void free(){
  if (!isBuffered)   BufferPool.free(readBuffer);
}

Fixed version (ground truth):
public void free(){
  if (readBuffer != null)   BufferPool.free(readBuffer);
}
Program: 132339
Project: 132339
Buggy source:
public byte[] lookup(byte[] key){
  int indexPosition=getBlockIndexPosition(key,blockIndex);
  if (indexPosition == -1)   return null;
  int startBlockOffset=getBlockOffset(indexPosition,blockIndex);
  int fileId=getBlockFileId(indexPosition,blockIndex);
  int endBlockOffset;
  if (indexPosition == blockIndex.getNumEntries() - 1)   endBlockOffset=-1;
 else {
    ByteRange indexPos=getBlockEntry(indexPosition + 1,blockIndex);
    ByteBuffer indexPosBuf=indexPos.getBuf();
    endBlockOffset=getBlockIndexOffset(indexPosBuf,indexPos.getStartOffset());
    if (getBlockIndexFileId(indexPosBuf,indexPos.getStartOffset()) > fileId)     endBlockOffset=-1;
  }
  BlockReader targetBlock=null;
  try {
    targetBlock=mmaped ? getBlock(startBlockOffset,endBlockOffset,dbFiles[fileId]) : getBlock(startBlockOffset,endBlockOffset,dbFileChannels[fileId]);
  }
 catch (  IOException e) {
    Logging.logError(Logging.LEVEL_ERROR,this,e);
  }
  ByteRange val=targetBlock.lookup(key);
  targetBlock.free();
  return val == null ? null : val.toBuffer();
}

Fixed version (ground truth):
public byte[] lookup(byte[] key){
  int indexPosition=getBlockIndexPosition(key,blockIndex);
  if (indexPosition == -1)   return null;
  int startBlockOffset=getBlockOffset(indexPosition,blockIndex);
  int fileId=getBlockFileId(indexPosition,blockIndex);
  int endBlockOffset;
  if (indexPosition == blockIndex.getNumEntries() - 1)   endBlockOffset=-1;
 else {
    ByteRange indexPos=getBlockEntry(indexPosition + 1,blockIndex);
    ByteBuffer indexPosBuf=indexPos.getBuf();
    endBlockOffset=getBlockIndexOffset(indexPosBuf,indexPos.getStartOffset());
    if (getBlockIndexFileId(indexPosBuf,indexPos.getStartOffset()) > fileId)     endBlockOffset=-1;
  }
  BlockReader targetBlock=null;
  try {
    targetBlock=mmaped ? getBlock(startBlockOffset,endBlockOffset,dbFiles[fileId]) : getBlock(startBlockOffset,endBlockOffset,dbFileChannels[fileId]);
  }
 catch (  IOException e) {
    Logging.logError(Logging.LEVEL_ERROR,this,e);
  }
  ByteRange val=targetBlock.lookup(key);
  byte[] result=val == null ? null : val.toBuffer();
  targetBlock.free();
  return result;
}
Program: 132340
Project: 132340
Buggy source:
@Override public Entry<byte[],byte[]> next(){
  if (!hasNext())   throw new NoSuchElementException();
  final Entry<ByteRange,ByteRange> entry=currentBlockIterator.next();
  return new Entry<byte[],byte[]>(){
    private byte[] key;
    private byte[] value;
{
      key=entry.getKey().toBuffer();
      value=entry.getValue().toBuffer();
    }
    @Override public byte[] getKey(){
      return key;
    }
    @Override public byte[] getValue(){
      return value;
    }
    @Override public byte[] setValue(    byte[] value){
      throw new UnsupportedOperationException();
    }
  }
;
}

Fixed version (ground truth):
@Override public Entry<byte[],byte[]> next(){
  if (!hasNext())   throw new NoSuchElementException();
  final Entry<ByteRange,ByteRange> entry=currentBlockIterator.next();
  return new Entry<byte[],byte[]>(){
    private byte[] key;
    private byte[] value;
{
      key=entry.getKey().toBuffer();
      value=entry.getValue().toBuffer();
      if (entry.getValue().getReusableBuf() != null)       BufferPool.free(entry.getValue().getReusableBuf());
    }
    @Override public byte[] getKey(){
      return key;
    }
    @Override public byte[] getValue(){
      return value;
    }
    @Override public byte[] setValue(    byte[] value){
      throw new UnsupportedOperationException();
    }
  }
;
}
Program: 132341
Project: 132341
Buggy source:
private void getNextBlockData(){
  if (blockIndexStart == -1 && blockIndexEnd == -1)   return;
  if (ascending) {
    if (currentBlockIndex > blockIndexEnd) {
      if (currentBlock != null)       currentBlock.free();
      currentBlock=null;
      currentBlockIterator=null;
      return;
    }
  }
 else {
    if (currentBlockIndex < blockIndexStart) {
      if (currentBlock != null)       currentBlock.free();
      currentBlock=null;
      currentBlockIterator=null;
      return;
    }
  }
  int startOffset=DiskIndex.getBlockOffset(currentBlockIndex,blockIndexReader);
  int fileId=DiskIndex.getBlockFileId(currentBlockIndex,blockIndexReader);
  int endOffset;
  if (currentBlockIndex == blockIndexReader.getNumEntries() - 1)   endOffset=-1;
 else {
    ByteRange indexPos=DiskIndex.getBlockEntry(currentBlockIndex + 1,blockIndexReader);
    ByteBuffer indexPosBuf=indexPos.getBuf();
    endOffset=DiskIndex.getBlockIndexOffset(indexPosBuf,indexPos.getStartOffset());
    if (DiskIndex.getBlockIndexFileId(indexPosBuf,indexPos.getStartOffset()) > fileId)     endOffset=-1;
  }
  try {
    if (currentBlock != null)     currentBlock.free();
    currentBlock=maps != null ? index.getBlock(startOffset,endOffset,maps[fileId]) : index.getBlock(startOffset,endOffset,dbFileChannels[fileId]);
  }
 catch (  ClosedByInterruptException exc) {
    Logging.logError(Logging.LEVEL_DEBUG,this,exc);
  }
catch (  IOException exc) {
    Logging.logError(Logging.LEVEL_ERROR,this,exc);
  }
  currentBlockIterator=currentBlock == null ? null : currentBlock.rangeLookup(from == null ? null : from,to == null ? null : to,ascending);
}

Fixed version (ground truth):
private void getNextBlockData(){
  if (blockIndexStart == -1 && blockIndexEnd == -1)   return;
  if (ascending && currentBlockIndex > blockIndexEnd) {
    currentBlock=null;
    currentBlockIterator=null;
    return;
  }
 else   if (!ascending && currentBlockIndex < blockIndexStart) {
    currentBlock=null;
    currentBlockIterator=null;
    return;
  }
  int startOffset=DiskIndex.getBlockOffset(currentBlockIndex,blockIndexReader);
  int fileId=DiskIndex.getBlockFileId(currentBlockIndex,blockIndexReader);
  int endOffset;
  if (currentBlockIndex == blockIndexReader.getNumEntries() - 1)   endOffset=-1;
 else {
    ByteRange indexPos=DiskIndex.getBlockEntry(currentBlockIndex + 1,blockIndexReader);
    ByteBuffer indexPosBuf=indexPos.getBuf();
    endOffset=DiskIndex.getBlockIndexOffset(indexPosBuf,indexPos.getStartOffset());
    if (DiskIndex.getBlockIndexFileId(indexPosBuf,indexPos.getStartOffset()) > fileId)     endOffset=-1;
  }
  try {
    currentBlock=maps != null ? index.getBlock(startOffset,endOffset,maps[fileId]) : index.getBlock(startOffset,endOffset,dbFileChannels[fileId]);
  }
 catch (  ClosedByInterruptException exc) {
    Logging.logError(Logging.LEVEL_DEBUG,this,exc);
  }
catch (  IOException exc) {
    Logging.logError(Logging.LEVEL_ERROR,this,exc);
  }
  currentBlockIterator=currentBlock == null ? null : currentBlock.rangeLookup(from == null ? null : from,to == null ? null : to,ascending);
}
Program: 132344
Project: 132344
Buggy source:
/** 
 * Creates a new LSM tree.
 * @param indexFile the on-disk index file - may be <code>null</code>
 * @param comp a comparator for byte ranges
 * @param compressed Compression of disk-index
 * @throws IOException if an I/O error occurs when accessing the on-disk index file
 */
public LSMTree(String indexFile,ByteRangeComparator comp,boolean compressed,int maxEntriesPerBlock,int maxBlockFileSize) throws IOException {
  this.comp=comp;
  this.compressed=compressed;
  this.maxEntriesPerBlock=maxEntriesPerBlock;
  this.maxBlockFileSize=maxBlockFileSize;
  overlay=new MultiOverlayBufferTree(NULL_ELEMENT,comp);
  index=indexFile == null ? null : new DiskIndex(indexFile,comp,compressed,useMmap(new File(indexFile).length()));
  lock=new Object();
}

Fixed version (ground truth):
/** 
 * Creates a new LSM tree.
 * @param indexFile the on-disk index file - may be <code>null</code>
 * @param comp a comparator for byte ranges
 * @param compressed Compression of disk-index
 * @throws IOException if an I/O error occurs when accessing the on-disk index file
 */
public LSMTree(String indexFile,ByteRangeComparator comp,boolean compressed,int maxEntriesPerBlock,int maxBlockFileSize) throws IOException {
  this.comp=comp;
  this.compressed=compressed;
  this.maxEntriesPerBlock=maxEntriesPerBlock;
  this.maxBlockFileSize=maxBlockFileSize;
  overlay=new MultiOverlayBufferTree(NULL_ELEMENT,comp);
  totalOnDiskSize+=indexFile == null ? 0 : getTotalDirSize(new File(indexFile));
  index=indexFile == null ? null : new DiskIndex(indexFile,comp,compressed,useMmap());
  lock=new Object();
}
Program: 132345
Project: 132345
Buggy source:
/** 
 * Links the LSM tree to a new snapshot file. The on-disk index is replaced with the index stored in the given snapshot file, and all in-memory snapshots are discarded.
 * @param snapshotFile the snapshot file
 * @throws IOException if an I/O error occurred while reading the snapshot file
 */
public void linkToSnapshot(String snapshotFile) throws IOException {
  final DiskIndex oldIndex=index;
synchronized (lock) {
    totalOnDiskSize-=index == null ? 0 : index.getSize();
    index=new DiskIndex(snapshotFile,comp,this.compressed,useMmap(new File(snapshotFile).length()));
    totalOnDiskSize+=index.getSize();
    if (oldIndex != null)     oldIndex.destroy();
    overlay.cleanup();
  }
}

Fixed version (ground truth):
/** 
 * Links the LSM tree to a new snapshot file. The on-disk index is replaced with the index stored in the given snapshot file, and all in-memory snapshots are discarded.
 * @param snapshotFile the snapshot file
 * @throws IOException if an I/O error occurred while reading the snapshot file
 */
public void linkToSnapshot(String snapshotFile) throws IOException {
  final DiskIndex oldIndex=index;
synchronized (lock) {
    totalOnDiskSize-=index == null ? 0 : index.getSize();
    index=new DiskIndex(snapshotFile,comp,this.compressed,useMmap());
    totalOnDiskSize+=index.getSize();
    if (oldIndex != null)     oldIndex.destroy();
    overlay.cleanup();
  }
}
Program: 132346
Project: 132346
Buggy source:
private boolean useMmap(long currentFileSize){
  final long maxSize=500 * 1024 * 1024;
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + OutputUtils.formatBytes(totalOnDiskSize + currentFileSize));
  return "String_Node_Str".equals(System.getProperty("String_Node_Str")) || totalOnDiskSize + currentFileSize < maxSize;
}

Fixed version (ground truth):
private boolean useMmap(){
  final long maxSize=200 * 1024 * 1024;
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + OutputUtils.formatBytes(totalOnDiskSize));
  boolean mmap="String_Node_Str".equals(System.getProperty("String_Node_Str")) || totalOnDiskSize < maxSize;
  return mmap;
}
Program: 132348
Project: 132348
Buggy source:
private boolean useMmap(long currentFileSize){
  final long maxSize=500 * 1024 * 1024;
  System.out.println("String_Node_Str" + OutputUtils.formatBytes(totalOnDiskSize + currentFileSize));
  return "String_Node_Str".equals(System.getProperty("String_Node_Str")) || totalOnDiskSize + currentFileSize < maxSize;
}

Fixed version (ground truth):
private boolean useMmap(long currentFileSize){
  final long maxSize=500 * 1024 * 1024;
  Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + OutputUtils.formatBytes(totalOnDiskSize + currentFileSize));
  return "String_Node_Str".equals(System.getProperty("String_Node_Str")) || totalOnDiskSize + currentFileSize < maxSize;
}
Program: 132349
Project: 132349
Buggy source:
public DiskLogIterator(File[] logFiles,LSN from) throws LogEntryException, IOException {
  this.from=from;
  if (logFiles != null && logFiles.length > 0) {
    dbLogDir=logFiles[0].getParent() + "String_Node_Str";
    int count=-1;
    SortedSet<LSN> orderedLogList=new TreeSet<LSN>();
    Pattern p=Pattern.compile("String_Node_Str");
    for (    File logFile : logFiles) {
      Matcher m=p.matcher(logFile.getName());
      m.matches();
      String tmp=m.group(1);
      int viewId=Integer.valueOf(tmp);
      tmp=m.group(2);
      int seqNo=Integer.valueOf(tmp);
      orderedLogList.add(new LSN(viewId,seqNo));
      count++;
    }
    LSN[] copy=orderedLogList.toArray(new LSN[orderedLogList.size()]);
    LSN last=null;
    for (    LSN lsn : copy) {
      if (last == null)       last=lsn;
 else {
        if (from != null && lsn.compareTo(from) <= 0) {
          orderedLogList.remove(last);
          last=lsn;
        }
 else         break;
      }
    }
    logList=orderedLogList.iterator();
    findFirstEntry();
  }
}

Fixed version (ground truth):
/** 
 * @param logFiles
 * @param from - inclusive, if everything went fine, next() will return thelog entry identified by LSN <code>from</code>.
 * @throws LogEntryException
 * @throws IOException
 */
public DiskLogIterator(File[] logFiles,LSN from) throws LogEntryException, IOException {
  this.from=from;
  if (logFiles != null && logFiles.length > 0) {
    dbLogDir=logFiles[0].getParent() + "String_Node_Str";
    int count=-1;
    SortedSet<LSN> orderedLogList=new TreeSet<LSN>();
    Pattern p=Pattern.compile("String_Node_Str");
    for (    File logFile : logFiles) {
      Matcher m=p.matcher(logFile.getName());
      m.matches();
      String tmp=m.group(1);
      int viewId=Integer.valueOf(tmp);
      tmp=m.group(2);
      int seqNo=Integer.valueOf(tmp);
      orderedLogList.add(new LSN(viewId,seqNo));
      count++;
    }
    LSN[] copy=orderedLogList.toArray(new LSN[orderedLogList.size()]);
    LSN last=null;
    LSN lastRemoved=null;
    for (    LSN lsn : copy) {
      if (last == null)       last=lsn;
 else {
        if (from != null && lsn.compareTo(from) < 0) {
          orderedLogList.remove(last);
          lastRemoved=last;
          last=lsn;
        }
 else         break;
      }
    }
    if (lastRemoved != null && from.compareTo(last) < 0) {
      orderedLogList.add(lastRemoved);
    }
    logList=orderedLogList.iterator();
    findFirstEntry();
  }
}
Program: 132350
Project: 132350
Buggy source:
public LSN switchLogFile(boolean incrementViewId) throws IOException {
  if (!hasLock()) {
    throw new IllegalStateException("String_Node_Str");
  }
  final String newFileName=createLogFileName();
  channel.close();
  fos.close();
  currentLogFileName=newFileName;
  File lf=new File(this.currentLogFileName);
  String openMode="String_Node_Str";
switch (syncMode) {
case ASYNC:
case FSYNC:
case FDATASYNC:
{
      openMode="String_Node_Str";
      break;
    }
case SYNC_WRITE:
{
    openMode="String_Node_Str";
    break;
  }
case SYNC_WRITE_METADATA:
{
  openMode="String_Node_Str";
  break;
}
}
fos=new RandomAccessFile(lf,openMode);
fos.setLength(0);
channel=fos.getChannel();
fdes=fos.getFD();
Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + "String_Node_Str" + currentLogFileName);
LSN lastSyncedLSN=null;
if (incrementViewId) {
int view=this.currentViewId.getAndIncrement();
long seq=this.nextLogSequenceNo.getAndSet(1L) - 1L;
lastSyncedLSN=new LSN(view,seq);
}
 else {
lastSyncedLSN=new LSN(this.currentViewId.get(),this.nextLogSequenceNo.get() - 1L);
}
return lastSyncedLSN;
}

Fixed version (ground truth):
public LSN switchLogFile(boolean incrementViewId) throws IOException {
  if (!hasLock()) {
    throw new IllegalStateException("String_Node_Str");
  }
  LSN lastSyncedLSN=null;
  if (incrementViewId) {
    int view=this.currentViewId.getAndIncrement();
    long seq=this.nextLogSequenceNo.getAndSet(1L) - 1L;
    lastSyncedLSN=new LSN(view,seq);
  }
 else {
    lastSyncedLSN=new LSN(this.currentViewId.get(),this.nextLogSequenceNo.get() - 1L);
  }
  final String newFileName=createLogFileName();
  this.channel.close();
  this.fos.close();
  this.currentLogFileName=newFileName;
  File lf=new File(this.currentLogFileName);
  String openMode="String_Node_Str";
switch (syncMode) {
case ASYNC:
case FSYNC:
case FDATASYNC:
{
      openMode="String_Node_Str";
      break;
    }
case SYNC_WRITE:
{
    openMode="String_Node_Str";
    break;
  }
case SYNC_WRITE_METADATA:
{
  openMode="String_Node_Str";
  break;
}
}
fos=new RandomAccessFile(lf,openMode);
fos.setLength(0);
channel=fos.getChannel();
fdes=fos.getFD();
Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + "String_Node_Str" + currentLogFileName);
return lastSyncedLSN;
}
Program: 132351
Project: 132351
Buggy source:
@Override public boolean isMaster(){
  try {
    return this.controlLayer.hasLease();
  }
 catch (  InterruptedException e) {
    Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str",e.getMessage());
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean isMaster(){
  return this.controlLayer.hasLease();
}
Program: 132352
Project: 132352
Buggy source:
@Override public boolean hasLease() throws InterruptedException {
  return this.leaseHolder.amIOwner();
}

Fixed version (ground truth):
@Override public boolean hasLease(){
  return !this.replicationController.isSuspended() && this.leaseHolder.amIOwner();
}
Program: 132353
Project: 132353
Buggy source:
/** 
 * Delays the request if there is a failover in progress.
 * @return true, if this server has the lease, false otherwise.
 */
public boolean hasLease() throws InterruptedException ;

Fixed version (ground truth):
/** 
 * @return true, if this server has the lease and is not suspended, false otherwise.
 */
public boolean hasLease();
Program: 132354
Project: 132354
Buggy source:
/** 
 * This server has to become the new master.
 * @throws InterruptedException 
 * @throws BabuDBException 
 * @throws IOException 
 */
private void becomeMaster() throws InterruptedException, BabuDBException, IOException {
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
  this.serviceInterface.synchronize();
  this.ctrlLayer.getTimeDriftDetectorControl().start();
}

Fixed version (ground truth):
/** 
 * This server has to become the new master.
 * @throws InterruptedException 
 * @throws BabuDBException 
 * @throws IOException 
 */
private void becomeMaster() throws InterruptedException, BabuDBException, IOException {
  Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str");
  this.serviceInterface.synchronize();
  this.ctrlLayer.getTimeDriftDetectorControl().start();
  this.serviceInterface.changeMaster(null);
}
Program: 132355
Project: 132355
Buggy source:
/** 
 * Method to trigger a   {@link LOAD} manually.Listener will contain true on finish , if it was a request synchronization, or if just the log file was switched.  otherwise, if it was a load, the listener will notified with false.
 * @param listener
 * @return 
 */
public void manualLoad(BabuDBRequest<Boolean> listener,LSN from,LSN to){
  this.listener=listener;
  org.xtreemfs.babudb.interfaces.LSN start=new org.xtreemfs.babudb.interfaces.LSN(from.getViewId(),from.getSequenceNo());
  org.xtreemfs.babudb.interfaces.LSN end=new org.xtreemfs.babudb.interfaces.LSN(to.getViewId(),to.getSequenceNo());
  missing=new LSNRange(start,end);
  setLogic(REQUEST,"String_Node_Str");
  if (q.isEmpty())   q.add(new StageRequest(null));
}

Fixed version (ground truth):
/** 
 * Method to trigger a   {@link LOAD} manually.Listener will contain true on finish , if it was a request synchronization, or if just the log file was switched.  otherwise, if it was a load, the listener will notified with false.
 * @param listener
 * @return 
 */
public void manualLoad(BabuDBRequest<Boolean> listener,LSN from,LSN to){
  assert(from.compareTo(to) < 0);
  this.listener=listener;
  org.xtreemfs.babudb.interfaces.LSN start=new org.xtreemfs.babudb.interfaces.LSN(from.getViewId(),from.getSequenceNo());
  org.xtreemfs.babudb.interfaces.LSN end=new org.xtreemfs.babudb.interfaces.LSN(to.getViewId(),to.getSequenceNo() + 1L);
  missing=new LSNRange(start,end);
  setLogic(REQUEST,"String_Node_Str");
  if (q.isEmpty())   q.add(new StageRequest(null));
}
Program: 132356
Project: 132356
Buggy source:
@Override public void run(){
  notifyStarted();
  while (!quit) {
    boolean infarcted=false;
    try {
      if (tries != 0)       Thread.sleep(RETRY_DELAY_MS * tries);
      if (!infarcted && !logicID.equals(BASIC)) {
        this.pacemaker.infarction();
        infarcted=true;
      }
      logics.get(logicID).run();
      if (infarcted && logicID.equals(BASIC)) {
        this.pacemaker.updateLSN(lastInserted);
        infarcted=false;
      }
      tries=0;
    }
 catch (    ConnectionLostException cle) {
switch (cle.errNo) {
case LOG_REMOVED:
        setLogic(LOAD,"String_Node_Str");
      break;
case BUSY:
    if (++tries < ReplicationConfig.MAX_RETRIES)     break;
case SERVICE_UNAVAILABLE:
default :
  Logging.logError(Logging.LEVEL_WARN,this,cle);
quit=true;
if (listener != null) {
listener.failed(new BabuDBException(ErrorCode.REPLICATION_FAILURE,cle.getMessage()));
}
this.roleChangeListener.suspend();
break;
}
}
catch (InterruptedException ie) {
if (!quit) {
quit=true;
notifyCrashed(ie);
return;
}
}
}
notifyStopped();
}

Fixed version (ground truth):
@Override public void run(){
  notifyStarted();
  while (!quit) {
    boolean infarcted=false;
    try {
      if (tries != 0)       Thread.sleep(RETRY_DELAY_MS * tries);
      if (!infarcted && !logicID.equals(BASIC)) {
        this.pacemaker.infarction();
        infarcted=true;
      }
      logics.get(logicID).run();
      if (infarcted && logicID.equals(BASIC)) {
        this.pacemaker.updateLSN(lastInserted);
        infarcted=false;
      }
      tries=0;
    }
 catch (    ConnectionLostException cle) {
switch (cle.errNo) {
case LOG_UNAVAILABLE:
        setLogic(LOAD,"String_Node_Str" + cle.getMessage());
      break;
case BUSY:
    if (++tries < ReplicationConfig.MAX_RETRIES)     break;
case SERVICE_UNAVAILABLE:
default :
  Logging.logError(Logging.LEVEL_WARN,this,cle);
quit=true;
if (listener != null) {
listener.failed(new BabuDBException(ErrorCode.REPLICATION_FAILURE,cle.getMessage()));
}
this.roleChangeListener.suspend();
break;
}
}
catch (InterruptedException ie) {
if (!quit) {
quit=true;
notifyCrashed(ie);
return;
}
}
}
notifyStopped();
}
Program: 132357
Project: 132357
Buggy source:
/** 
 * Registers a new master given by its address, valid for all replication components.
 * @param address - may be null, if no master is available at the moment.
 */
public void changeMaster(InetAddress address);

Fixed version (ground truth):
/** 
 * Registers a new master given by its address, valid for all replication components.
 * @param address - may be null, if no master is available at the moment, orthe local instance is owner of the master privilege.
 */
public void changeMaster(InetAddress address);
Program: 132358
Project: 132358
Buggy source:
/** 
 * <p> Sets a new master, valid for all replication components. Resets the  states of all participants. </p>
 * @param address
 */
public void setMaster(InetAddress address){
  this.masterClient.set(this.stateTable.get(address).client);
  this.reset();
}

Fixed version (ground truth):
/** 
 * <p> Sets a new master, valid for all replication components. Resets the  states of all participants. </p>
 * @param address - may be null, if master is unknown or the local babuDBinstance is owner of the master privilege
 */
public void setMaster(InetAddress address){
  if (address != null)   this.masterClient.set(this.stateTable.get(address).client);
 else   this.masterClient.set(null);
  this.reset();
}
Program: 132359
Project: 132359
Buggy source:
/** 
 * Method to decide which logic shall be used next.
 */
private void finish(){
  if (stage.lastInserted.compareTo(new LSN(stage.missing.getEnd())) < 0) {
    stage.missing=new LSNRange(new org.xtreemfs.babudb.interfaces.LSN(stage.lastInserted.getViewId(),stage.lastInserted.getSequenceNo()),stage.missing.getEnd());
  }
 else {
    stage.missing=null;
    stage.setLogic(BASIC,"String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Method to decide which logic shall be used next.
 */
private void finish(){
  LSN next=new LSN(stage.lastInserted.getViewId(),stage.lastInserted.getSequenceNo() + 1L);
  if (next.compareTo(new LSN(stage.missing.getEnd())) < 0) {
    stage.missing=new LSNRange(new org.xtreemfs.babudb.interfaces.LSN(stage.lastInserted.getViewId(),stage.lastInserted.getSequenceNo()),stage.missing.getEnd());
  }
 else {
    stage.missing=null;
    stage.setLogic(BASIC,"String_Node_Str" + "String_Node_Str");
  }
}
Program: 132360
Project: 132360
Buggy source:
@Override public void startRequest(final Request rq){
  heartbeatRequest request=(heartbeatRequest)rq.getRequestMessage();
  LSN lsn=new LSN(request.getLsn());
  try {
    this.sManipulator.update(rq.getRPCRequest().getClientIdentity(),lsn,TimeSync.getGlobalTime());
    rq.sendSuccess(request.createDefaultResponse());
  }
 catch (  UnknownParticipantException e) {
    rq.sendReplicationException(ErrNo.SECURITY,"String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void startRequest(final Request rq){
  heartbeatRequest request=(heartbeatRequest)rq.getRequestMessage();
  LSN lsn=new LSN(request.getLsn());
  try {
    this.sManipulator.update(rq.getRPCRequest().getClientIdentity(),lsn,TimeSync.getGlobalTime());
    rq.sendSuccess(request.createDefaultResponse());
  }
 catch (  UnknownParticipantException e) {
    rq.sendReplicationException(ErrNo.NO_ACCESS,"String_Node_Str" + "String_Node_Str");
  }
}
Program: 132361
Project: 132361
Buggy source:
/** 
 * @param lastOnView
 * @param slaveView
 * @param roleChangeListener - listener to notify about the need of a role change.
 * @param pacemaker - for the hearbeat.
 * @param max_q - 0 means infinite.
 */
public ReplicationStage(int max_q,Pacemaker pacemaker,SlaveView slaveView,FileIOInterface fileIO,BabuDBInterface babuInterface){
  super("String_Node_Str");
  this.pacemaker=pacemaker;
  this.q=new PriorityBlockingQueue<StageRequest>();
  this.numRequests=new AtomicInteger(0);
  this.MAX_Q=max_q;
  this.quit=false;
  logics=new HashMap<LogicID,Logic>();
  Logic lg=new BasicLogic(this,pacemaker,slaveView,fileIO,babuInterface,q);
  logics.put(lg.getId(),lg);
  lg=new RequestLogic(this,pacemaker,slaveView,fileIO,babuInterface);
  logics.put(lg.getId(),lg);
  lg=new LoadLogic(this,pacemaker,slaveView,fileIO,babuInterface);
  logics.put(lg.getId(),lg);
}

Fixed version (ground truth):
/** 
 * @param lastOnView
 * @param slaveView
 * @param roleChangeListener - listener to notify about the need of a role change.
 * @param pacemaker - for the hearbeat.
 * @param max_q - 0 means infinite.
 * @param lastOnView - reference for the compare-variable lastOnView.
 */
public ReplicationStage(int max_q,Pacemaker pacemaker,SlaveView slaveView,FileIOInterface fileIO,BabuDBInterface babuInterface,AtomicReference<LSN> lastOnView){
  super("String_Node_Str");
  this.lastOnView=lastOnView;
  this.pacemaker=pacemaker;
  this.q=new PriorityBlockingQueue<StageRequest>();
  this.numRequests=new AtomicInteger(0);
  this.MAX_Q=max_q;
  this.quit=false;
  logics=new HashMap<LogicID,Logic>();
  Logic lg=new BasicLogic(this,pacemaker,slaveView,fileIO,babuInterface,q);
  logics.put(lg.getId(),lg);
  lg=new RequestLogic(this,pacemaker,slaveView,fileIO,babuInterface);
  logics.put(lg.getId(),lg);
  lg=new LoadLogic(this,pacemaker,slaveView,fileIO,babuInterface);
  logics.put(lg.getId(),lg);
}
Program: 132362
Project: 132362
Buggy source:
/** 
 * @param config
 * @param underlyingLayer
 * @param clientFactory
 * @param latest
 * @throws IOException if {@link Flease} could not be initialized.
 */
public ServiceLayer(ReplicationConfig config,BabuDBInterface babuDB,TransmissionToServiceInterface transLayer) throws IOException {
  this.transmissionInterface=transLayer;
  this.babuDBInterface=babuDB;
  int syncN=((config.getSyncN() > 0) ? config.getSyncN() - 1 : config.getSyncN());
  this.participantsStates=new ParticipantsStates(syncN,config.getParticipants(),transLayer);
  this.heartbeatThread=new HeartbeatThread(this.participantsStates);
  this.replicationStage=new ReplicationStage(config.getMaxQueueLength(),this.heartbeatThread,this,transLayer.getFileIOInterface(),this.babuDBInterface);
}

Fixed version (ground truth):
/** 
 * @param config
 * @param underlyingLayer
 * @param clientFactory
 * @param latest
 * @throws IOException if {@link Flease} could not be initialized.
 */
public ServiceLayer(ReplicationConfig config,BabuDBInterface babuDB,TransmissionToServiceInterface transLayer) throws IOException {
  this.transmissionInterface=transLayer;
  this.babuDBInterface=babuDB;
  int syncN=((config.getSyncN() > 0) ? config.getSyncN() - 1 : config.getSyncN());
  this.participantsStates=new ParticipantsStates(syncN,config.getParticipants(),transLayer);
  this.heartbeatThread=new HeartbeatThread(this.participantsStates);
  this.replicationStage=new ReplicationStage(config.getMaxQueueLength(),this.heartbeatThread,this,transLayer.getFileIOInterface(),this.babuDBInterface,this.lastOnView);
}
Program: 132363
Project: 132363
Buggy source:
@Override public void requestFinished(SlaveClient slave){
synchronized (stateTable) {
    final State s=stateTable.get(slave.getDefaultServerAddress().getAddress());
    s.openRequests--;
    if (s.openRequests == (MAX_OPEN_REQUESTS_PER_SLAVE - 1)) {
      availableSlaves++;
      stateTable.notify();
    }
  }
}

Fixed version (ground truth):
@Override public void requestFinished(SlaveClient slave){
synchronized (stateTable) {
    final State s=stateTable.get(slave.getDefaultServerAddress().getAddress());
    if (s.openRequests > 0)     s.openRequests--;
    if (s.openRequests == (MAX_OPEN_REQUESTS_PER_SLAVE - 1)) {
      availableSlaves++;
      stateTable.notify();
    }
  }
}
Program: 132364
Project: 132364
Buggy source:
@Override public void markAsDead(SlaveClient slave){
synchronized (stateTable) {
    final State s=stateTable.get(slave.getDefaultServerAddress().getAddress());
    s.openRequests--;
    if (!s.dead) {
      Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str",slave.getDefaultServerAddress().toString(),toString());
      s.dead=true;
      deadSlaves++;
      availableSlaves--;
      stateTable.notify();
    }
  }
}

Fixed version (ground truth):
@Override public void markAsDead(SlaveClient slave){
synchronized (stateTable) {
    final State s=stateTable.get(slave.getDefaultServerAddress().getAddress());
    s.openRequests=0;
    if (!s.dead) {
      Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str",slave.getDefaultServerAddress().toString(),toString());
      s.dead=true;
      deadSlaves++;
      availableSlaves--;
      stateTable.notify();
    }
  }
}
Program: 132365
Project: 132365
Buggy source:
public void close() throws IOException {
  channel.close();
  fis.close();
}

Fixed version (ground truth):
public void close() throws IOException {
  LogEntry tmp=next;
  next=null;
  if (tmp != null)   tmp.free();
  channel.close();
  fis.close();
}
Program: 132366
Project: 132366
Buggy source:
public void destroy() throws IOException {
  currentFile.close();
}

Fixed version (ground truth):
public void destroy() throws IOException {
  LogEntry tmp=nextEntry;
  nextEntry=null;
  if (tmp != null)   tmp.free();
  currentFile.close();
}
Program: 132367
Project: 132367
Buggy source:
/** 
 * Removes the detection task.
 */
void stop(){
synchronized (this) {
    this.task.cancel();
    this.task=null;
  }
}

Fixed version (ground truth):
/** 
 * Removes the detection task.
 */
void stop(){
synchronized (this) {
    if (this.task != null) {
      this.task.cancel();
      this.task=null;
    }
  }
}
Program: 132368
Project: 132368
Buggy source:
@Test public void testgetReplicaUnavailable() throws Exception {
  System.out.println("String_Node_Str");
  makeDB();
  insertData();
  long seqToRequest=1L;
  RPCResponse<LogEntries> result=client.getReplica(new LSNRange(1,seqToRequest,seqToRequest));
  try {
    result.get();
  }
 catch (  ONCRPCError e) {
    fail();
  }
 finally {
    result.freeBuffers();
  }
}

Fixed version (ground truth):
@Test public void testgetReplicaUnavailable() throws Exception {
  System.out.println("String_Node_Str");
  makeDB();
  insertData();
  long seqToRequest=1L;
  RPCResponse<LogEntries> result=client.getReplica(new LSNRange(viewID,seqToRequest,seqToRequest));
  try {
    result.get();
  }
 catch (  ONCRPCError e) {
    fail();
  }
 finally {
    result.freeBuffers();
  }
}
Program: 132369
Project: 132369
Buggy source:
@Test public void testgetReplica() throws Exception {
  System.out.println("String_Node_Str");
  makeDB();
  insertData();
  long seqToRequest=2L;
  RPCResponse<LogEntries> result=client.getReplica(new LSNRange(1,seqToRequest,seqToRequest));
  LogEntries les=result.get();
  assertNotNull(les);
  assertEquals(1,les.size());
  LogEntry le=LogEntry.deserialize(les.get(0).getPayload(),new CRC32());
  assertEquals(viewID,le.getViewId());
  assertEquals(seqToRequest,le.getLogSequenceNo());
  assertEquals(viewID,le.getLSN().getViewId());
  assertEquals(seqToRequest,le.getLSN().getSequenceNo());
  assertNotNull(le.getPayload());
  result.freeBuffers();
  le.free();
}

Fixed version (ground truth):
@Test public void testgetReplica() throws Exception {
  System.out.println("String_Node_Str");
  makeDB();
  insertData();
  long seqToRequest=2L;
  RPCResponse<LogEntries> result=client.getReplica(new LSNRange(viewID,seqToRequest,seqToRequest));
  LogEntries les=result.get();
  assertNotNull(les);
  assertEquals(1,les.size());
  LogEntry le=LogEntry.deserialize(les.get(0).getPayload(),new CRC32());
  assertEquals(viewID,le.getViewId());
  assertEquals(seqToRequest,le.getLogSequenceNo());
  assertEquals(viewID,le.getLSN().getViewId());
  assertEquals(seqToRequest,le.getLSN().getSequenceNo());
  assertNotNull(le.getPayload());
  result.freeBuffers();
  le.free();
}
Program: 132370
Project: 132370
Buggy source:
@SuppressWarnings("String_Node_Str") @Override protected ReplicateResponse _replicate(LogEntry le,ReusableBuffer payload) throws NotEnoughAvailableSlavesException, InterruptedException {
  List<SlaveClient> slaves=getSlavesForBroadCast();
  final ReplicateResponse result=new ReplicateResponse(le,slaves.size() - getSyncN());
  if (slaves.size() == 0) {
    Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + "String_Node_Str");
  }
 else {
    for (    final SlaveClient slave : slaves) {
      ((RPCResponse<Object>)slave.replicate(le.getLSN(),payload.createViewBuffer())).registerListener(new RPCResponseAvailableListener<Object>(){
        @Override public void responseAvailable(        RPCResponse<Object> r){
          try {
            r.get();
            markSlaveAsFinished(slave);
          }
 catch (          Exception e) {
            markSlaveAsDead(slave);
            result.decrementPermittedFailures();
            Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str",slave.getDefaultServerAddress().toString(),e.getMessage());
            if (e.getMessage() == null)             Logging.logError(Logging.LEVEL_DEBUG,this,e);
          }
 finally {
            if (r != null)             r.freeBuffers();
          }
        }
      }
);
    }
  }
  return result;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected ReplicateResponse _replicate(LogEntry le,ReusableBuffer payload) throws NotEnoughAvailableSlavesException, InterruptedException {
  List<SlaveClient> slaves=getSlavesForBroadCast();
  final ReplicateResponse result=new ReplicateResponse(le,slaves.size() - this.syncN);
  if (slaves.size() == 0) {
    Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str" + "String_Node_Str");
  }
 else {
    for (    final SlaveClient slave : slaves) {
      ((RPCResponse<Object>)slave.replicate(le.getLSN(),payload.createViewBuffer())).registerListener(new RPCResponseAvailableListener<Object>(){
        @Override public void responseAvailable(        RPCResponse<Object> r){
          try {
            r.get();
            markSlaveAsFinished(slave);
          }
 catch (          Exception e) {
            markSlaveAsDead(slave);
            result.decrementPermittedFailures();
            Logging.logMessage(Logging.LEVEL_INFO,this,"String_Node_Str",slave.getDefaultServerAddress().toString(),e.getMessage());
            if (e.getMessage() == null)             Logging.logError(Logging.LEVEL_DEBUG,this,e);
          }
 finally {
            if (r != null)             r.freeBuffers();
          }
        }
      }
);
    }
  }
  return result;
}
Program: 132371
Project: 132371
Buggy source:
/** 
 * Constructor to change the   {@link RequestDispatcher} behavior tomaster using the old dispatcher.
 * @param oldDispatcher
 * @param own - address of the master.
 * @throws IOException 
 */
public MasterRequestDispatcher(RequestDispatcher oldDispatcher,InetSocketAddress own) throws IOException {
  super("String_Node_Str",oldDispatcher);
  assert(oldDispatcher.isPaused());
  DispatcherState oldState=oldDispatcher.getState();
  if (oldState.requestQueue != null)   for (  StageRequest rq : oldState.requestQueue)   rq.free();
  this.chunkSize=oldDispatcher.configuration.getChunkSize();
  this.syncN=oldDispatcher.configuration.getSyncN();
  List<InetSocketAddress> slaves=new LinkedList<InetSocketAddress>(oldDispatcher.configuration.getParticipants());
  this.states=new SlavesStates(((ReplicationConfig)dbs.getConfig()).getSyncN(),slaves,rpcClient);
  LSN initial=oldDispatcher.getState().latest;
  this.lastOnView=(initial.getSequenceNo() == 0L) ? new LSN(0,0L) : initial;
}

Fixed version (ground truth):
/** 
 * Constructor to change the   {@link RequestDispatcher} behavior tomaster using the old dispatcher.
 * @param oldDispatcher
 * @param own - address of the master.
 * @throws IOException 
 */
public MasterRequestDispatcher(RequestDispatcher oldDispatcher,InetSocketAddress own) throws IOException {
  super("String_Node_Str",oldDispatcher);
  assert(oldDispatcher.isPaused());
  DispatcherState oldState=oldDispatcher.getState();
  if (oldState.requestQueue != null)   for (  StageRequest rq : oldState.requestQueue)   rq.free();
  this.chunkSize=oldDispatcher.configuration.getChunkSize();
  this.syncN=(oldDispatcher.configuration.getSyncN() > 0) ? oldDispatcher.configuration.getSyncN() - 1 : oldDispatcher.configuration.getSyncN();
  List<InetSocketAddress> slaves=new LinkedList<InetSocketAddress>(oldDispatcher.configuration.getParticipants());
  this.states=new SlavesStates(this.syncN,slaves,rpcClient);
  LSN initial=oldDispatcher.getState().latest;
  this.lastOnView=(initial.getSequenceNo() == 0L) ? new LSN(0,0L) : initial;
}
Program: 132373
Project: 132373
Buggy source:
public void read() throws IOException {
}

Fixed version (ground truth):
public void read() throws IOException {
  super.read();
  this.localTimeRenew=this.readOptionalInt("String_Node_Str",3000);
  if (this.readRequiredBoolean("String_Node_Str")) {
    this.sslOptions=new SSLOptions(new FileInputStream(this.readRequiredString("String_Node_Str")),this.readRequiredString("String_Node_Str"),this.readRequiredString("String_Node_Str"),new FileInputStream(this.readRequiredString("String_Node_Str")),this.readRequiredString("String_Node_Str"),this.readRequiredString("String_Node_Str"),this.readRequiredBoolean("String_Node_Str"));
  }
  this.participants=new HashSet<InetSocketAddress>();
  int number=0;
  Socket s;
  InetSocketAddress addrs;
  while ((addrs=this.readOptionalInetSocketAddr("String_Node_Str" + number,"String_Node_Str" + number + "String_Node_Str",null)) != null) {
    s=new Socket();
    try {
      s.bind(addrs);
      if (this.address != null && !this.address.equals(addrs))       throw new BindException();
      this.address=addrs;
    }
 catch (    BindException e) {
      this.participants.add(addrs);
    }
 finally {
      try {
        s.close();
      }
 catch (      IOException e) {
      }
    }
    number++;
  }
  if (this.address == null)   throw new IOException("String_Node_Str" + "String_Node_Str");
  this.chunkSize=this.readOptionalInt("String_Node_Str",DEFAULT_MAX_CHUNK_SIZE);
  this.syncN=this.readOptionalInt("String_Node_Str",0);
  if (this.syncN < 0 || this.syncN > this.participants.size())   throw new IOException("String_Node_Str" + "String_Node_Str");
  if (this.syncN != 0 && this.syncN <= participants.size() / 2)   throw new IOException("String_Node_Str" + this.syncN + "String_Node_Str"+ "String_Node_Str"+ this.participants.size()+ "String_Node_Str"+ "String_Node_Str"+ (this.participants.size() / 2)+ 1+ "String_Node_Str");
  String backupDir=this.readRequiredString("String_Node_Str");
  if (backupDir.equals(baseDir) || backupDir.equals(dbLogDir))   throw new IOException("String_Node_Str" + "String_Node_Str");
  this.backupDir=(backupDir.endsWith(File.separator)) ? backupDir : backupDir + File.separator;
}