nus-yam/ex-repair huggingface dataset:
Program: 87178
Project: 87178
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000),"String_Node_Str".getBytes());
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000),"String_Node_Str".getBytes());
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000),"String_Node_Str".getBytes());
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000),"String_Node_Str".getBytes());
  _node2.init(_tport2);
}
Program: 87179
Project: 87179
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87180
Project: 87180
Buggy source:
@Before public void init() throws Exception {
  FileSystem.deleteDirectory(new File(_node1Log));
  FileSystem.deleteDirectory(new File(_node2Log));
  _node1=new ServerDispatcher(new HowlLogger(_node1Log));
  _node2=new ServerDispatcher(new HowlLogger(_node2Log));
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  FileSystem.deleteDirectory(new File(_node1Log));
  FileSystem.deleteDirectory(new File(_node2Log));
  _node1=new ServerDispatcher(new HowlLogger(_node1Log),Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(new HowlLogger(_node2Log),Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87181
Project: 87181
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87182
Project: 87182
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _tport2.filterTx(new LastDropper());
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _tport2.filterTx(new LastDropper());
  _node2.init(_tport2);
}
Program: 87183
Project: 87183
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87184
Project: 87184
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87185
Project: 87185
Buggy source:
@Before public void init() throws Exception {
  FileSystem.deleteDirectory(new File(_node1Log));
  FileSystem.deleteDirectory(new File(_node2Log));
  FileSystem.deleteDirectory(new File(_node3Log));
  Leader.LeaseDuration.set(10000);
  _node1=new ServerDispatcher(new HowlLogger(_node1Log),true);
  _node2=new ServerDispatcher(new HowlLogger(_node2Log),true);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  FileSystem.deleteDirectory(new File(_node1Log));
  FileSystem.deleteDirectory(new File(_node2Log));
  FileSystem.deleteDirectory(new File(_node3Log));
  Leader.LeaseDuration.set(10000);
  _node1=new ServerDispatcher(new HowlLogger(_node1Log),Listener.NULL_LISTENER,true);
  _node2=new ServerDispatcher(new HowlLogger(_node2Log),Listener.NULL_LISTENER,true);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87187
Project: 87187
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new DroppingTransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new DroppingTransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87188
Project: 87188
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _fd1=new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN);
  _tport1=new TransportImpl(_fd1);
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _fd1=new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN);
  _tport1=new TransportImpl(_fd1);
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87189
Project: 87189
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87190
Project: 87190
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87191
Project: 87191
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node2.init(_tport2);
}
Program: 87192
Project: 87192
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _tport2.filterRx(new Dropping());
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _tport2.filterRx(new Dropping());
  _node2.init(_tport2);
}
Program: 87193
Project: 87193
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _node2=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _tport2.filterRx(new Dropping());
  _node2.init(_tport2);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _node2=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
  _tport2=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _tport2.filterRx(new Dropping());
  _node2.init(_tport2);
}
Program: 87194
Project: 87194
Buggy source:
@Before public void init() throws Exception {
  _node1=new ServerDispatcher();
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
}

Fixed version (ground truth):
@Before public void init() throws Exception {
  _node1=new ServerDispatcher(Listener.NULL_LISTENER);
  _tport1=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN));
  _node1.init(_tport1);
}
Program: 87195
Project: 87195
Buggy source:
@Test public void pin() throws Exception {
  _tport1.getFD().pin(FailureDetectorImpl.OPEN_PIN);
  _tport2.getFD().pin(FailureDetectorImpl.OPEN_PIN);
  FDUtil.ensureFD(_tport1.getFD());
  FDUtil.ensureFD(_tport2.getFD());
  Assert.assertTrue(_tport1.getFD().getMembers().getMembers().size() == 2);
  Assert.assertTrue(_tport2.getFD().getMembers().getMembers().size() == 2);
  Collection<InetSocketAddress> myMembers=_tport1.getFD().getMembers().getMembers().keySet();
  _tport1.getFD().pin(myMembers);
  _tport2.getFD().pin(myMembers);
  TransportImpl myTport=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN),"String_Node_Str".getBytes());
  myTport.getFD().pin(FailureDetectorImpl.OPEN_PIN);
  Assembly myAssembly=myTport.getFD().barrier(3).get(10000,TimeUnit.MILLISECONDS);
  Assert.assertNotNull(myAssembly);
  Assert.assertTrue(_tport1.getFD().getMembers().getMembers().size() == 2);
  Assert.assertTrue(_tport2.getFD().getMembers().getMembers().size() == 2);
  Assert.assertFalse(_tport1.getFD().getMembers().getMembers().containsValue("String_Node_Str"));
  Assert.assertFalse(_tport2.getFD().getMembers().getMembers().containsValue("String_Node_Str"));
  myTport.terminate();
}

Fixed version (ground truth):
@Test public void pin() throws Exception {
  _tport1.getFD().pin(FailureDetectorImpl.OPEN_PIN);
  _tport2.getFD().pin(FailureDetectorImpl.OPEN_PIN);
  FDUtil.ensureFD(_tport1.getFD());
  FDUtil.ensureFD(_tport2.getFD());
  Assert.assertTrue(_tport1.getFD().getMembers().getMembers().size() == 2);
  Assert.assertTrue(_tport2.getFD().getMembers().getMembers().size() == 2);
  Collection<InetSocketAddress> myMembers=_tport1.getFD().getMembers().getMembers().keySet();
  _tport1.getFD().pin(myMembers);
  _tport2.getFD().pin(myMembers);
  TransportImpl myTport=new TransportImpl(new FailureDetectorImpl(5000,FailureDetectorImpl.OPEN_PIN),"String_Node_Str".getBytes());
  myTport.getFD().pin(FailureDetectorImpl.OPEN_PIN);
  Assembly myAssembly=myTport.getFD().barrier(3).get(10000,TimeUnit.MILLISECONDS);
  Assert.assertNotNull(myAssembly);
  Assert.assertTrue(_tport1.getFD().getMembers().getMembers().size() == 2);
  Assert.assertTrue(_tport2.getFD().getMembers().getMembers().size() == 2);
  for (  FailureDetector.MetaData c : _tport1.getFD().getMembers().getMembers().values()) {
    System.err.println("String_Node_Str" + new String(c.getData()));
  }
  Assert.assertFalse(_tport1.getFD().getMembers().getMembers().values().stream().map(m -> new String(m.getData())).collect(Collectors.toSet()).contains("String_Node_Str"));
  Assert.assertFalse(_tport2.getFD().getMembers().getMembers().values().stream().map(m -> new String(m.getData())).collect(Collectors.toSet()).contains("String_Node_Str"));
  myTport.terminate();
}
Program: 87196
Project: 87196
Buggy source:
Instance nextInstance(long aPause){
  long myExpiry=(aPause == 0) ? Long.MAX_VALUE : System.currentTimeMillis() + aPause;
synchronized (_inflight) {
    if (!_amLeader) {
      while (_inflight.size() > 0) {
        long myPause=myExpiry - System.currentTimeMillis();
        if (myPause < 1)         return null;
        try {
          _inflight.wait(myPause);
        }
 catch (        InterruptedException anIE) {
        }
      }
      for (      Listener anL : _listeners)       anL.inFlight();
      return new NextInstance((_amLeader) ? Leader.State.BEGIN : Leader.State.COLLECT,chooseNext(),_nextRnd);
    }
 else {
      while (_inflight.size() >= _maxInflight) {
        long myPause=myExpiry - System.currentTimeMillis();
        if (myPause < 1)         return null;
        try {
          _inflight.wait(myPause);
        }
 catch (        InterruptedException anIE) {
        }
      }
      if (_inflight.size() == 1)       for (      Listener anL : _listeners)       anL.inFlight();
      return new NextInstance((_amLeader) ? Leader.State.BEGIN : Leader.State.COLLECT,chooseNext(),_nextRnd);
    }
  }
}

Fixed version (ground truth):
Instance nextInstance(long aPause){
  long myExpiry=(aPause == 0) ? Long.MAX_VALUE : System.currentTimeMillis() + aPause;
synchronized (_inflight) {
    if (!_amLeader) {
      while (_inflight.size() > 0) {
        long myPause=myExpiry - System.currentTimeMillis();
        if (myPause < 1)         return null;
        try {
          _inflight.wait(myPause);
        }
 catch (        InterruptedException anIE) {
        }
      }
      for (      Listener anL : _listeners)       anL.inFlight();
      return new NextInstance((_amLeader) ? Leader.State.BEGIN : Leader.State.COLLECT,chooseNext(),_nextRnd);
    }
 else {
      while (_inflight.size() >= _maxInflight) {
        long myPause=myExpiry - System.currentTimeMillis();
        if (myPause < 1)         return null;
        try {
          _inflight.wait(myPause);
        }
 catch (        InterruptedException anIE) {
        }
      }
      NextInstance myNext=new NextInstance((_amLeader) ? Leader.State.BEGIN : Leader.State.COLLECT,chooseNext(),_nextRnd);
      if (_inflight.size() == 1)       for (      Listener anL : _listeners)       anL.inFlight();
      return myNext;
    }
  }
}
Program: 87197
Project: 87197
Buggy source:
/** 
 * @param aTimeout the time in milliseconds to wait for the outcome of a negative number indicating no wait
 */
public VoteOutcome getNext(long aTimeout){
synchronized (this) {
    while (_queue.isEmpty()) {
      try {
        if (aTimeout >= 0)         wait(aTimeout);
 else         return null;
      }
 catch (      InterruptedException anIE) {
      }
    }
    return _queue.remove(0);
  }
}

Fixed version (ground truth):
/** 
 * @param aTimeout the time in milliseconds to wait for the outcome of a negative number indicating no wait
 */
public VoteOutcome getNext(long aTimeout){
  long myStartTime=System.currentTimeMillis();
synchronized (this) {
    while (_queue.isEmpty()) {
      try {
        long myCurrent=System.currentTimeMillis();
        if ((aTimeout >= 0) && (myCurrent < myStartTime + aTimeout)) {
          wait(myStartTime + aTimeout - myCurrent);
        }
 else {
          return null;
        }
      }
 catch (      InterruptedException anIE) {
      }
    }
    return _queue.remove(0);
  }
}
Program: 87198
Project: 87198
Buggy source:
public OrderedMemoryNetwork.OrderedMemoryTransport newTransport(InetSocketAddress aLocalAddr,InetSocketAddress aBroadcastAddr,OrderedMemoryNetwork aNetwork,MessageBasedFailureDetector anFD,Object aContext){
  NodeAdminImpl myTp=new NodeAdminImpl(aLocalAddr,aBroadcastAddr,aNetwork,anFD,(NodeAdminImpl.Config)aContext,EnvironmentImpl.this);
  _nodes.add(myTp);
  return myTp.getTransport();
}

Fixed version (ground truth):
public Constructed newTransport(InetSocketAddress aLocalAddr,InetSocketAddress aBroadcastAddr,OrderedMemoryNetwork aNetwork,MessageBasedFailureDetector anFD,Object aContext){
  NodeAdminImpl myNode=new NodeAdminImpl(aLocalAddr,aBroadcastAddr,aNetwork,anFD,(NodeAdminImpl.Config)aContext,EnvironmentImpl.this);
  return new Constructed(myNode.getTransport(),myNode);
}
Program: 87199
Project: 87199
Buggy source:
EnvironmentImpl(long aSeed,long aCycles,boolean doCalibrate,long aCkptCycle,boolean inMemory) throws Exception {
  _ckptCycle=aCkptCycle;
  _isLive=!doCalibrate;
  _maxCycles=aCycles;
  _baseRng=new Random(aSeed);
  _factory=new OrderedMemoryNetwork();
  _isStorage=!inMemory;
  _decisionMaker=(_isLive) ? new RandomFailureDecider(this) : new PassiveDecider();
  _nodeFactory=new OrderedMemoryNetwork.Factory(){
    public OrderedMemoryNetwork.OrderedMemoryTransport newTransport(    InetSocketAddress aLocalAddr,    InetSocketAddress aBroadcastAddr,    OrderedMemoryNetwork aNetwork,    MessageBasedFailureDetector anFD,    Object aContext){
      NodeAdminImpl myTp=new NodeAdminImpl(aLocalAddr,aBroadcastAddr,aNetwork,anFD,(NodeAdminImpl.Config)aContext,EnvironmentImpl.this);
      _nodes.add(myTp);
      return myTp.getTransport();
    }
  }
;
  for (int i=0; i < 5; i++) {
    LogStorageFactory myFactory=(_isStorage) ? new HowlLoggerFactory(BASEDIR,i) : new MemoryLoggerFactory();
    addNodeAdmin(Utils.getTestAddress(),new NodeAdminImpl.Config(i,myFactory));
  }
  _currentLeader=_nodes.getFirst();
}

Fixed version (ground truth):
EnvironmentImpl(long aSeed,long aCycles,boolean doCalibrate,long aCkptCycle,boolean inMemory) throws Exception {
  _ckptCycle=aCkptCycle;
  _isLive=!doCalibrate;
  _maxCycles=aCycles;
  _baseRng=new Random(aSeed);
  _factory=new OrderedMemoryNetwork();
  _isStorage=!inMemory;
  _decisionMaker=(_isLive) ? new RandomFailureDecider(this) : new PassiveDecider();
  _nodeFactory=new OrderedMemoryNetwork.Factory(){
    public Constructed newTransport(    InetSocketAddress aLocalAddr,    InetSocketAddress aBroadcastAddr,    OrderedMemoryNetwork aNetwork,    MessageBasedFailureDetector anFD,    Object aContext){
      NodeAdminImpl myNode=new NodeAdminImpl(aLocalAddr,aBroadcastAddr,aNetwork,anFD,(NodeAdminImpl.Config)aContext,EnvironmentImpl.this);
      return new Constructed(myNode.getTransport(),myNode);
    }
  }
;
  Deque<NodeAdmin> myNodes=new LinkedList<>();
  for (int i=0; i < 5; i++) {
    LogStorageFactory myFactory=(_isStorage) ? new HowlLoggerFactory(BASEDIR,i) : new MemoryLoggerFactory();
    OrderedMemoryNetwork.Factory.Constructed myResult=addNodeAdmin(Utils.getTestAddress(),new NodeAdminImpl.Config(i,myFactory));
    myNodes.add((NodeAdmin)myResult.getAdditional());
  }
  _currentLeader=myNodes.getFirst();
  _nodes.addAll(myNodes);
}
Program: 87200
Project: 87200
Buggy source:
private void run() throws Exception {
  long myProgressTarget=(long)(getSettleCycles() * 0.75);
  long mySuccesses=0;
  ClientDispatcher myClient=new ClientDispatcher();
  Transport myTransport=_env.getFactory().newTransport(null,null,Utils.getTestAddress(),null);
  myTransport.routeTo(myClient);
  myClient.init(myTransport);
  cycle(myClient,_env.getMaxCycles());
  if (_env.isLive()) {
    _logger.info("String_Node_Str");
    _env.settle();
    mySuccesses=cycle(myClient,getSettleCycles());
  }
  myTransport.terminate();
  _env.terminate();
  _logger.info("String_Node_Str" + _env.getDropCount());
  _logger.info("String_Node_Str" + _env.getRxCount());
  _logger.info("String_Node_Str" + _env.getTxCount());
  _logger.info("String_Node_Str" + _env.getTempDeathCount());
  if (_env.isLive()) {
    _logger.info("String_Node_Str" + myProgressTarget + "String_Node_Str"+ mySuccesses);
    if (!(mySuccesses > myProgressTarget))     throw new Exception("String_Node_Str");
    if (!_env.validate())     throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void run() throws Exception {
  long myProgressTarget=(long)(getSettleCycles() * 0.75);
  long mySuccesses=0;
  ClientDispatcher myClient=new ClientDispatcher();
  OrderedMemoryNetwork.Factory.Constructed myResult=_env.getFactory().newTransport(null,null,Utils.getTestAddress(),null);
  myResult.getTransport().routeTo(myClient);
  myClient.init(myResult.getTransport());
  cycle(myClient,_env.getMaxCycles());
  if (_env.isLive()) {
    _logger.info("String_Node_Str");
    _env.settle();
    mySuccesses=cycle(myClient,getSettleCycles());
  }
  myResult.getTransport().terminate();
  _env.terminate();
  _logger.info("String_Node_Str" + _env.getDropCount());
  _logger.info("String_Node_Str" + _env.getRxCount());
  _logger.info("String_Node_Str" + _env.getTxCount());
  _logger.info("String_Node_Str" + _env.getTempDeathCount());
  if (_env.isLive()) {
    _logger.info("String_Node_Str" + myProgressTarget + "String_Node_Str"+ mySuccesses);
    if (!(mySuccesses > myProgressTarget))     throw new Exception("String_Node_Str");
    if (!_env.validate())     throw new IllegalStateException("String_Node_Str");
  }
}
Program: 87201
Project: 87201
Buggy source:
public void addNodeAdmin(NodeAdmin.Memento aMemento){
  addNodeAdmin(aMemento.getAddress(),(NodeAdminImpl.Config)aMemento.getContext());
}

Fixed version (ground truth):
public void addNodeAdmin(NodeAdmin.Memento aMemento){
  OrderedMemoryNetwork.Factory.Constructed myResult=addNodeAdmin(aMemento.getAddress(),(NodeAdminImpl.Config)aMemento.getContext());
  _nodes.add((NodeAdmin)myResult.getAdditional());
}
Program: 87202
Project: 87202
Buggy source:
public Transport newTransport(Factory aFactory,MessageBasedFailureDetector anFD,InetSocketAddress anAddr,Object aContext){
  OrderedMemoryTransport myTrans=(aFactory == null) ? _factory.newTransport(anAddr,_broadcastAddr,this,anFD,aContext) : aFactory.newTransport(anAddr,_broadcastAddr,this,anFD,aContext);
  _transports.put(anAddr,myTrans);
  return myTrans;
}

Fixed version (ground truth):
public Factory.Constructed newTransport(Factory aFactory,MessageBasedFailureDetector anFD,InetSocketAddress anAddr,Object aContext){
  Factory.Constructed myResult=(aFactory == null) ? _factory.newTransport(anAddr,_broadcastAddr,this,anFD,aContext) : aFactory.newTransport(anAddr,_broadcastAddr,this,anFD,aContext);
  _transports.put(anAddr,myResult.getTransport());
  return myResult;
}
Program: 87203
Project: 87203
Buggy source:
private void expired(){
synchronized (this) {
    _logger.debug(toString() + "String_Node_Str");
switch (_stateMachine.getCurrentState()) {
case SUCCESS:
{
        ++_tries;
        if (_tries < MAX_TRIES) {
          cancelInteraction();
          process(_messages);
          _messages.clear();
        }
 else {
          error(VoteOutcome.Reason.VOTE_TIMEOUT);
        }
        break;
      }
case EXIT:
case ABORT:
case SHUTDOWN:
{
      break;
    }
default :
{
    error(VoteOutcome.Reason.VOTE_TIMEOUT);
    break;
  }
}
}
}

Fixed version (ground truth):
private void expired(){
synchronized (this) {
    _logger.debug(toString() + "String_Node_Str");
switch (_stateMachine.getCurrentState()) {
case SUCCESS:
{
        ++_tries;
        if (_tries < MAX_TRIES) {
          cancelInteraction();
          process(_messages.values());
          _messages.clear();
        }
 else {
          error(VoteOutcome.Reason.VOTE_TIMEOUT);
        }
        break;
      }
case EXIT:
case ABORT:
case SHUTDOWN:
{
      break;
    }
default :
{
    error(VoteOutcome.Reason.VOTE_TIMEOUT);
    break;
  }
}
}
}
Program: 87205
Project: 87205
Buggy source:
private boolean goneBad(List<Transport.Packet> aMessages){
  OldRound myOld=null;
  for (  Transport.Packet aPacket : aMessages) {
    PaxosMessage myMessage=aPacket.getMessage();
    if (myMessage.getType() == PaxosMessage.Types.OLDROUND) {
      OldRound myTempOld=(OldRound)myMessage;
      if ((myOld == null) || (myTempOld.getLastRound() > myOld.getLastRound()))       myOld=myTempOld;
    }
  }
  if (myOld != null) {
    oldRound(myOld);
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
private boolean goneBad(Collection<Transport.Packet> aMessages){
  OldRound myOld=null;
  for (  Transport.Packet aPacket : aMessages) {
    PaxosMessage myMessage=aPacket.getMessage();
    if (myMessage.getType() == PaxosMessage.Types.OLDROUND) {
      OldRound myTempOld=(OldRound)myMessage;
      if ((myOld == null) || (myTempOld.getLastRound() > myOld.getLastRound()))       myOld=myTempOld;
    }
  }
  if (myOld != null) {
    oldRound(myOld);
    return true;
  }
 else   return false;
}
Program: 87206
Project: 87206
Buggy source:
/** 
 * @return number of successful cycles in the run
 */
private long cycle(ClientDispatcher aClient,long aCycles){
  long mySuccessCount=0;
  while (_env.getDoneOps() < aCycles) {
    ByteBuffer myBuffer=ByteBuffer.allocate(8);
    myBuffer.putLong(_env.getDoneOps());
    Proposal myProposal=new Proposal("String_Node_Str",myBuffer.array());
    aClient.send(new Envelope(myProposal),_env.getCurrentLeader().getTransport().getLocalAddress());
    VoteOutcome myEv=aClient.getNext(10000);
    if (myEv.getResult() == VoteOutcome.Reason.OTHER_LEADER) {
      _env.updateLeader(myEv.getLeader());
    }
 else     if (myEv.getResult() == VoteOutcome.Reason.VALUE) {
      mySuccessCount++;
    }
    _env.doneOp();
  }
  return mySuccessCount;
}

Fixed version (ground truth):
/** 
 * @return number of successful cycles in the run
 */
private long cycle(ClientDispatcher aClient,long aCycles){
  long mySuccessCount=0;
  long myEndCycles=_env.getDoneOps() + aCycles;
  while (_env.getDoneOps() < myEndCycles) {
    ByteBuffer myBuffer=ByteBuffer.allocate(8);
    myBuffer.putLong(_env.getDoneOps());
    Proposal myProposal=new Proposal("String_Node_Str",myBuffer.array());
    aClient.send(new Envelope(myProposal),_env.getCurrentLeader().getTransport().getLocalAddress());
    VoteOutcome myEv=aClient.getNext(10000);
    if (myEv.getResult() == VoteOutcome.Reason.OTHER_LEADER) {
      _env.updateLeader(myEv.getLeader());
    }
 else     if (myEv.getResult() == VoteOutcome.Reason.VALUE) {
      mySuccessCount++;
    }
    _env.doneOp();
  }
  return mySuccessCount;
}
Program: 87207
Project: 87207
Buggy source:
/** 
 * Examine a received   {@link PaxosMessage} and update liveness information as appropriate.
 */
public void processMessage(Packet aPacket){
  PaxosMessage myMessage=aPacket.getMessage();
  if (myMessage.getType() == Operations.HEARTBEAT) {
    MetaDataImpl myLast;
    final Heartbeat myHeartbeat=(Heartbeat)myMessage;
    final InetSocketAddress myNodeId=aPacket.getSource();
    if ((_pinned != null) && (!_pinned.contains(myNodeId)))     return;
    for (; ; ) {
      myLast=_lastHeartbeats.get(myNodeId);
      if (myLast == null) {
        if (_lastHeartbeats.putIfAbsent(myNodeId,new MetaDataImpl(System.currentTimeMillis(),myHeartbeat.getMetaData())) == null)         break;
      }
 else {
        if (_lastHeartbeats.replace(myNodeId,myLast,new MetaDataImpl(System.currentTimeMillis(),myHeartbeat.getMetaData())))         break;
      }
    }
    if (_futures.size() != 0) {
      Membership myMembership=new MembershipImpl(new HashMap<InetSocketAddress,MetaData>(_lastHeartbeats));
      Iterator<FutureImpl> myFutures=_futures.iterator();
      while (myFutures.hasNext()) {
        FutureImpl myFuture=myFutures.next();
        myFuture.offer(myMembership);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Examine a received   {@link PaxosMessage} and update liveness information as appropriate.
 */
public void processMessage(Packet aPacket){
  PaxosMessage myMessage=aPacket.getMessage();
  if (myMessage.getType() == Operations.HEARTBEAT) {
    MetaDataImpl myLast;
    final Heartbeat myHeartbeat=(Heartbeat)myMessage;
    final InetSocketAddress myNodeId=aPacket.getSource();
    if ((_pinned == null) || ((_pinned != null) && (!_pinned.contains(myNodeId))))     return;
    for (; ; ) {
      myLast=_lastHeartbeats.get(myNodeId);
      if (myLast == null) {
        if (_lastHeartbeats.putIfAbsent(myNodeId,new MetaDataImpl(System.currentTimeMillis(),myHeartbeat.getMetaData())) == null)         break;
      }
 else {
        if (_lastHeartbeats.replace(myNodeId,myLast,new MetaDataImpl(System.currentTimeMillis(),myHeartbeat.getMetaData())))         break;
      }
    }
    if (_futures.size() != 0) {
      Membership myMembership=new MembershipImpl(new HashMap<InetSocketAddress,MetaData>(_lastHeartbeats));
      Iterator<FutureImpl> myFutures=_futures.iterator();
      while (myFutures.hasNext()) {
        FutureImpl myFuture=myFutures.next();
        myFuture.offer(myMembership);
      }
    }
  }
}
Program: 87208
Project: 87208
Buggy source:
public static void main(String[] anArgs) throws Exception {
  Args myArgs=CliFactory.parseArguments(Args.class,anArgs);
  LongTerm myLT=new LongTerm(myArgs.getSeed(),myArgs.getCycles(),myArgs.isCalibrate(),myArgs.getCkptCycle());
  long myStart=System.currentTimeMillis();
  myLT.run();
  double myDuration=(System.currentTimeMillis() - myStart) / 1000.0;
  if (myArgs.isCalibrate()) {
    System.out.println("String_Node_Str" + myArgs.getCycles() + "String_Node_Str"+ myDuration+ "String_Node_Str");
    double myOpsPerSec=myDuration / myArgs.getCycles();
    double myOpsHour=myOpsPerSec * 60 * 60;
    System.out.println("String_Node_Str" + myOpsPerSec + "String_Node_Str"+ myOpsHour);
  }
 else {
    System.out.println("String_Node_Str" + (myArgs.getCycles() + myLT.getSettleCycles()) + "String_Node_Str"+ myDuration+ "String_Node_Str");
  }
}

Fixed version (ground truth):
public static void main(String[] anArgs) throws Exception {
  Args myArgs=CliFactory.parseArguments(Args.class,anArgs);
  LongTerm myLT=new LongTerm(myArgs.getSeed(),myArgs.getCycles(),myArgs.isCalibrate(),myArgs.getCkptCycle());
  long myStart=System.currentTimeMillis();
  myLT.run();
  double myDuration=(System.currentTimeMillis() - myStart) / 1000.0;
  if (myArgs.isCalibrate()) {
    System.out.println("String_Node_Str" + myArgs.getCycles() + "String_Node_Str"+ myDuration+ "String_Node_Str");
    double myOpsPerSec=myArgs.getCycles() / myDuration;
    double myOpsHour=myOpsPerSec * 60 * 60;
    System.out.println("String_Node_Str" + myOpsPerSec + "String_Node_Str"+ myOpsHour);
  }
 else {
    System.out.println("String_Node_Str" + (myArgs.getCycles() + myLT.getSettleCycles()) + "String_Node_Str"+ myDuration+ "String_Node_Str");
  }
}
Program: 87210
Project: 87210
Buggy source:
public boolean recover(Need aNeed){
  boolean myResult=_common.getNodeState().testAndSet(NodeState.State.ACTIVE,NodeState.State.RECOVERING);
  if (myResult) {
    _recoveryWindow.set(aNeed);
    _cachedBegins.clear();
    _acceptLedgers.clear();
    _logger.debug(AcceptorLearner.this.toString() + "String_Node_Str" + Long.toHexString(_common.getLowWatermark().getSeqNum()));
    if (_common.getLastCollect().getMessage().getSeqNum() > aNeed.getMinSeq()) {
      _logger.warn(AcceptorLearner.this.toString() + "String_Node_Str" + _common.getLastCollect().getMessage()+ "String_Node_Str"+ aNeed);
      _common.clearLeadership();
    }
    InetSocketAddress myNeedTarget=_common.getTransport().getFD().getRandomMember(_common.getTransport().getLocalAddress());
    if (myNeedTarget != null)     new LiveSender().send(aNeed,myNeedTarget);
    reschedule();
  }
  return myResult;
}

Fixed version (ground truth):
public boolean recover(Need aNeed,InetSocketAddress aSourceAddr){
  boolean myResult=_common.getNodeState().testAndSet(NodeState.State.ACTIVE,NodeState.State.RECOVERING);
  if (myResult) {
    _recoveryWindow.set(aNeed);
    _cachedBegins.clear();
    _acceptLedgers.clear();
    _logger.debug(AcceptorLearner.this.toString() + "String_Node_Str" + Long.toHexString(_common.getLowWatermark().getSeqNum()));
    if (_common.getLastCollect().getMessage().getSeqNum() > aNeed.getMinSeq()) {
      _logger.warn(AcceptorLearner.this.toString() + "String_Node_Str" + _common.getLastCollect().getMessage()+ "String_Node_Str"+ aNeed);
      _common.clearLeadership();
    }
    InetSocketAddress myNeedTarget=_common.getTransport().getFD().getRandomMember(_common.getTransport().getLocalAddress());
    if (myNeedTarget != null)     new LiveSender().send(aNeed,myNeedTarget);
 else     new LiveSender().send(aNeed,aSourceAddr);
    reschedule();
  }
  return myResult;
}
Program: 87212
Project: 87212
Buggy source:
/** 
 * @param aNeed
 * @return true if the transition to recovery was successful
 */
boolean recover(Need aNeed);

Fixed version (ground truth):
/** 
 * @param aNeed
 * @param aSourceAddr the node that originated the packet triggering recovery
 * @return true if the transition to recovery was successful
 */
boolean recover(Need aNeed,InetSocketAddress aSourceAddr);
Program: 87213
Project: 87213
Buggy source:
public boolean recover(Need aNeed){
  _recoveryRequested=true;
  return _recoveryReturn;
}

Fixed version (ground truth):
public boolean recover(Need aNeed,InetSocketAddress aTriggeringSource){
  _recoveryRequested=true;
  return _recoveryReturn;
}
Program: 87214
Project: 87214
Buggy source:
public void change(FailureDetector aDetector,FailureDetector.State aState){
  if (aState.equals(FailureDetector.State.PINNED)) {
    _logger.debug("String_Node_Str");
    _hb=_fd.newHeartbeater(TransportImpl.this,_meta);
    _hb.start();
  }
}

Fixed version (ground truth):
public void change(FailureDetector aDetector,FailureDetector.State aState){
  if ((aState.equals(FailureDetector.State.PINNED)) && (_hb == null)) {
    _logger.debug("String_Node_Str");
    _hb=_fd.newHeartbeater(TransportImpl.this,_meta);
    _hb.start();
  }
}
Program: 87215
Project: 87215
Buggy source:
public void run(){
  while (!isStopping()) {
    _transport.send(_transport.getPickler().newPacket(new Heartbeat(_metaData)),_transport.getBroadcastAddress());
    try {
      Thread.sleep(_pulseRate);
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (!isStopping()) {
    try {
      _transport.send(_transport.getPickler().newPacket(new Heartbeat(_metaData)),_transport.getBroadcastAddress());
    }
 catch (    Throwable aT) {
    }
    try {
      Thread.sleep(_pulseRate);
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 87216
Project: 87216
Buggy source:
/** 
 * Return a random member that the FD believes is live, excluding the local address specified
 * @param aLocal the address of the node to exclude from the result
 */
public InetSocketAddress getRandomMember(InetSocketAddress aLocal);

Fixed version (ground truth):
/** 
 * @param aLocal the address of the node to exclude from the result
 * @return a random member that the FD believes is live, excluding the local address specified or <code>null</code>if there are no suitable candidates.
 */
public InetSocketAddress getRandomMember(InetSocketAddress aLocal);
Program: 87218
Project: 87218
Buggy source:
public boolean recover(Need aNeed){
  boolean myResult=_common.testAndSetState(Constants.FSMStates.ACTIVE,Constants.FSMStates.RECOVERING);
  if (myResult) {
    _recoveryWindow.set(aNeed);
    _cachedBegins.clear();
    _acceptLedgers.clear();
    _logger.debug(AcceptorLearner.this.toString() + "String_Node_Str" + Long.toHexString(_common.getLowWatermark().getSeqNum()));
    if (_common.getLastCollect().getMessage().getSeqNum() > aNeed.getMinSeq()) {
      _logger.warn(AcceptorLearner.this.toString() + "String_Node_Str" + _common.getLastCollect().getMessage()+ "String_Node_Str"+ aNeed);
      _common.clearLeadership();
    }
    new LiveSender().send(aNeed,_common.getTransport().getFD().getRandomMember(_common.getTransport().getLocalAddress()));
    reschedule();
  }
  return myResult;
}

Fixed version (ground truth):
public boolean recover(Need aNeed){
  boolean myResult=_common.testAndSetState(Constants.FSMStates.ACTIVE,Constants.FSMStates.RECOVERING);
  if (myResult) {
    _recoveryWindow.set(aNeed);
    _cachedBegins.clear();
    _acceptLedgers.clear();
    _logger.debug(AcceptorLearner.this.toString() + "String_Node_Str" + Long.toHexString(_common.getLowWatermark().getSeqNum()));
    if (_common.getLastCollect().getMessage().getSeqNum() > aNeed.getMinSeq()) {
      _logger.warn(AcceptorLearner.this.toString() + "String_Node_Str" + _common.getLastCollect().getMessage()+ "String_Node_Str"+ aNeed);
      _common.clearLeadership();
    }
    InetSocketAddress myNeedTarget=_common.getTransport().getFD().getRandomMember(_common.getTransport().getLocalAddress());
    if (myNeedTarget != null)     new LiveSender().send(aNeed,myNeedTarget);
    reschedule();
  }
  return myResult;
}
Program: 87219
Project: 87219
Buggy source:
public InetSocketAddress getRandomMember(InetSocketAddress aLocalAddress){
  LinkedList<InetSocketAddress> myMembers=new LinkedList<>(_lastHeartbeats.keySet());
  myMembers.remove(aLocalAddress);
  return myMembers.get(_random.nextInt(myMembers.size()));
}

Fixed version (ground truth):
public InetSocketAddress getRandomMember(InetSocketAddress aLocalAddress){
  LinkedList<InetSocketAddress> myMembers=new LinkedList<>(_lastHeartbeats.keySet());
  myMembers.remove(aLocalAddress);
  if (myMembers.size() > 0)   return myMembers.get(_random.nextInt(myMembers.size()));
 else   return null;
}
Program: 87220
Project: 87220
Buggy source:
/** 
 * Determines whether a sufficient number of accepts can be tallied against the specified begin.
 * @param aBegin
 * @return A Learned to be logged if there are sufficient accepts, <code>null</code> otherwise.
 */
Learned tally(Begin aBegin,int aMajority){
synchronized (this) {
    int myAcceptTally=0;
    if (_ledger.size() < aMajority)     return null;
    for (    Transport.Packet myAcc : _ledger)     if (((Accept)myAcc.getMessage()).getRndNumber() == aBegin.getRndNumber())     ++myAcceptTally;
    if (myAcceptTally >= aMajority)     return new Learned(aBegin.getSeqNum(),aBegin.getRndNumber());
 else     return null;
  }
}

Fixed version (ground truth):
/** 
 * Determines whether a sufficient number of accepts can be tallied against the specified begin.
 * @param aBegin
 * @return A Learned to be logged if there are sufficient accepts, <code>null</code> otherwise.
 */
Learned tally(Begin aBegin,int aMajority){
synchronized (this) {
    int myAcceptTally=0;
    if (_ledger.size() < aMajority)     return null;
    for (    Transport.Packet myAcc : _ledger)     if (((Accept)myAcc.getMessage()).getRndNumber() == aBegin.getRndNumber())     ++myAcceptTally;
    if (myAcceptTally >= aMajority) {
      _logger.debug("String_Node_Str" + _ledger + "String_Node_Str"+ aMajority);
      return new Learned(aBegin.getSeqNum(),aBegin.getRndNumber());
    }
 else     return null;
  }
}
Program: 87221
Project: 87221
Buggy source:
public boolean equals(Object anObject){
  if (anObject instanceof Accept) {
    Accept myOther=(Accept)anObject;
    return (_seqNum == myOther._seqNum) && (_rndNumber == myOther._seqNum);
  }
  return false;
}

Fixed version (ground truth):
public boolean equals(Object anObject){
  if (anObject instanceof Accept) {
    Accept myOther=(Accept)anObject;
    return (_seqNum == myOther._seqNum) && (_rndNumber == myOther._rndNumber);
  }
  return false;
}
Program: 87222
Project: 87222
Buggy source:
public boolean equals(Object anObject){
  if (anObject instanceof FakePacket) {
    FakePacket myPacket=(FakePacket)anObject;
    return ((myPacket._address == _address) && (myPacket._message.equals(_message)));
  }
  return false;
}

Fixed version (ground truth):
public boolean equals(Object anObject){
  if (anObject instanceof FakePacket) {
    FakePacket myPacket=(FakePacket)anObject;
    return ((myPacket._address.equals(_address)) && (myPacket._message.equals(_message)));
  }
  return false;
}
Program: 87223
Project: 87223
Buggy source:
public boolean equals(Object anObject){
  if (anObject instanceof PacketImpl) {
    PacketImpl myPacket=(PacketImpl)anObject;
    return ((myPacket._source == _source) && (myPacket._msg.equals(_msg)));
  }
  return false;
}

Fixed version (ground truth):
public boolean equals(Object anObject){
  if (anObject instanceof PacketImpl) {
    PacketImpl myPacket=(PacketImpl)anObject;
    return ((myPacket._source.equals(_source)) && (myPacket._msg.equals(_msg)));
  }
  return false;
}
Program: 87224
Project: 87224
Buggy source:
public boolean equals(Object anObject){
  if (anObject instanceof FakePacket) {
    FakePacket myPacket=(FakePacket)anObject;
    return ((myPacket._address == _address) && (myPacket._message.equals(_message)));
  }
  return false;
}

Fixed version (ground truth):
public boolean equals(Object anObject){
  if (anObject instanceof FakePacket) {
    FakePacket myPacket=(FakePacket)anObject;
    return ((myPacket._address.equals(_address)) && (myPacket._message.equals(_message)));
  }
  return false;
}
Program: 87225
Project: 87225
Buggy source:
public boolean equals(Object anObject){
  if (anObject instanceof PacketImpl) {
    PacketImpl myPacket=(PacketImpl)anObject;
    return ((myPacket._source == _source) && (myPacket._msg.equals(_msg)));
  }
  return false;
}

Fixed version (ground truth):
public boolean equals(Object anObject){
  if (anObject instanceof PacketImpl) {
    PacketImpl myPacket=(PacketImpl)anObject;
    return ((myPacket._source.equals(_source)) && (myPacket._msg.equals(_msg)));
  }
  return false;
}
Program: 87226
Project: 87226
Buggy source:
/** 
 * Utility method to manage the lifecycle of creating an accept ledger.
 * @param anAccept
 * @return the newly or previously created ledger for the specified sequence number.
 */
private List<Accept> getAndCreateAcceptLedger(Accept anAccept){
  Long mySeqNum=anAccept.getSeqNum();
  List<Accept> myAccepts=_acceptLedgers.get(mySeqNum);
  if (myAccepts == null) {
    List<Accept> myInitial=new CopyOnWriteArrayList<>();
    List<Accept> myResult=_acceptLedgers.put(mySeqNum,myInitial);
    myAccepts=((myResult == null) ? myInitial : myResult);
  }
  return myAccepts;
}

Fixed version (ground truth):
/** 
 * Utility method to manage the lifecycle of creating an accept ledger.
 * @param anAccept
 * @return the newly or previously created ledger for the specified sequence number.
 */
private Set<Transport.Packet> getAndCreateAcceptLedger(Transport.Packet anAccept){
  Long mySeqNum=anAccept.getMessage().getSeqNum();
  Set<Transport.Packet> myAccepts=_acceptLedgers.get(mySeqNum);
  if (myAccepts == null) {
    Set<Transport.Packet> myInitial=new HashSet<>();
    Set<Transport.Packet> myResult=_acceptLedgers.put(mySeqNum,myInitial);
    myAccepts=((myResult == null) ? myInitial : myResult);
  }
  return myAccepts;
}
Program: 87227
Project: 87227
Buggy source:
/** 
 * Remove any accepts in the ledger not appropriate for the passed begin. We must tally only those accepts that match the round and sequence number of this begin. All others should be flushed.
 * @param aBegin
 */
private void purgeAcceptLedger(Begin aBegin){
  List<Accept> myAccepts=_acceptLedgers.get(aBegin.getSeqNum());
  if (myAccepts == null)   return;
  Iterator<Accept> myAccs=myAccepts.iterator();
  while (myAccs.hasNext()) {
    Accept myAcc=myAccs.next();
    if (myAcc.getRndNumber() != aBegin.getRndNumber())     myAccs.remove();
  }
}

Fixed version (ground truth):
/** 
 * Remove any accepts in the ledger not appropriate for the passed begin. We must tally only those accepts that match the round and sequence number of this begin. All others should be flushed.
 * @param aBegin
 */
private void purgeAcceptLedger(Begin aBegin){
  Set<Transport.Packet> myAccepts=_acceptLedgers.get(aBegin.getSeqNum());
  if (myAccepts == null)   return;
  Iterator<Transport.Packet> myAccs=myAccepts.iterator();
  while (myAccs.hasNext()) {
    Transport.Packet myAcc=myAccs.next();
    if (((Accept)myAcc.getMessage()).getRndNumber() != aBegin.getRndNumber())     myAccs.remove();
  }
}