nus-yam/ex-repair huggingface dataset:
Program: 55372
Project: 55372
Buggy source:
public void forRemoteAccess(String hostPortDescription,Function<Bytes,Wire> wire) throws AssetNotFoundException {
  standardStack(true);
  addWrappingRule(MapView.class,LAST + "String_Node_Str",RemoteMapView::new,ObjectKeyValueStore.class);
  addLeafRule(ObjectKVSSubscription.class,LAST + "String_Node_Str",RemoteKVSSubscription::new);
  addLeafRule(ObjectKeyValueStore.class,LAST + "String_Node_Str",RemoteKeyValueStore::new);
  addWrappingRule(TopicPublisher.class,LAST + "String_Node_Str",RemoteTopicPublisher::new,MapView.class);
  addLeafRule(TopologySubscription.class,LAST + "String_Node_Str",RemoteTopologySubscription::new);
  SessionProvider sessionProvider=getView(SessionProvider.class);
  VanillaSessionDetails sessionDetails=new VanillaSessionDetails();
  sessionDetails.setUserId(System.getProperty("String_Node_Str"));
  sessionProvider.set(sessionDetails);
  EventLoop eventLoop=findOrCreateView(EventLoop.class);
  if (getView(TcpChannelHub.class) == null) {
    TcpChannelHub view=Threads.withThreadGroup(findView(ThreadGroup.class),() -> new TcpChannelHub(sessionProvider,hostPortDescription,eventLoop,wire));
    addView(TcpChannelHub.class,view);
  }
}

Fixed version (ground truth):
public void forRemoteAccess(String hostPortDescription,Function<Bytes,Wire> wire) throws AssetNotFoundException {
  standardStack(true);
  addWrappingRule(MapView.class,LAST + "String_Node_Str",RemoteMapView::new,ObjectKeyValueStore.class);
  addLeafRule(ObjectKVSSubscription.class,LAST + "String_Node_Str",RemoteKVSSubscription::new);
  addLeafRule(ObjectKeyValueStore.class,LAST + "String_Node_Str",RemoteKeyValueStore::new);
  addWrappingRule(TopicPublisher.class,LAST + "String_Node_Str",RemoteTopicPublisher::new,MapView.class);
  addLeafRule(TopologySubscription.class,LAST + "String_Node_Str",RemoteTopologySubscription::new);
  SessionProvider sessionProvider=getView(SessionProvider.class);
  VanillaSessionDetails sessionDetails=new VanillaSessionDetails();
  sessionDetails.setUserId(System.getProperty("String_Node_Str"));
  sessionProvider.set(sessionDetails);
  EventLoop eventLoop=findOrCreateView(EventLoop.class);
  eventLoop.start();
  if (getView(TcpChannelHub.class) == null) {
    TcpChannelHub view=Threads.withThreadGroup(findView(ThreadGroup.class),() -> new TcpChannelHub(sessionProvider,hostPortDescription,eventLoop,wire));
    addView(TcpChannelHub.class,view);
  }
}
Program: 55373
Project: 55373
Buggy source:
void registerSubscriber0(@NotNull RequestContext rc,@NotNull Subscriber subscriber){
  if (hub.outBytesLock().isHeldByCurrentThread())   throw new IllegalStateException("String_Node_Str");
  Boolean bootstrap=rc.bootstrap();
  String csp=this.csp;
  if (bootstrap != null)   csp=csp + "String_Node_Str" + bootstrap;
  hub.subscribe(new AbstractAsyncSubscription(hub,csp){
{
      subscribersToTid.put(subscriber,tid());
    }
    @Override public void onSubscribe(    @NotNull final WireOut wireOut){
      wireOut.writeEventName(registerSubscriber).typeLiteral(CLASS_ALIASES.nameFor(rc.elementType()));
    }
    @Override public void onConsumer(    @NotNull final WireIn inWire){
      inWire.readDocument(null,d -> {
        final StringBuilder eventname=Wires.acquireStringBuilder();
        final ValueIn valueIn=d.readEventName(eventname);
        if (PublisherHandler.EventId.onEndOfSubscription.contentEquals(eventname)) {
          subscriber.onEndOfSubscription();
          hub.unsubscribe(tid());
        }
 else         if (CoreFields.reply.contentEquals(eventname)) {
          final Class aClass=rc.elementType();
          final Object object=(MapEvent.class.isAssignableFrom(aClass) || (TopologicalEvent.class.isAssignableFrom(aClass))) ? valueIn.typedMarshallable() : valueIn.object(rc.elementType());
          AbstractRemoteSubscription.this.onEvent(object,subscriber);
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
void registerSubscriber0(@NotNull RequestContext rc,@NotNull Subscriber subscriber){
  if (hub.outBytesLock().isHeldByCurrentThread())   throw new IllegalStateException("String_Node_Str");
  Boolean bootstrap=rc.bootstrap();
  String csp=this.csp;
  if (bootstrap != null)   csp=csp + "String_Node_Str" + bootstrap;
  hub.subscribe(new AbstractAsyncSubscription(hub,csp,this.getClass().getSimpleName() + "String_Node_Str"){
{
      subscribersToTid.put(subscriber,tid());
    }
    @Override public void onSubscribe(    @NotNull final WireOut wireOut){
      wireOut.writeEventName(registerSubscriber).typeLiteral(CLASS_ALIASES.nameFor(rc.elementType()));
    }
    @Override public void onConsumer(    @NotNull final WireIn inWire){
      inWire.readDocument(null,d -> {
        final StringBuilder eventname=Wires.acquireStringBuilder();
        final ValueIn valueIn=d.readEventName(eventname);
        if (PublisherHandler.EventId.onEndOfSubscription.contentEquals(eventname)) {
          subscriber.onEndOfSubscription();
          hub.unsubscribe(tid());
        }
 else         if (CoreFields.reply.contentEquals(eventname)) {
          final Class aClass=rc.elementType();
          final Object object=(MapEvent.class.isAssignableFrom(aClass) || (TopologicalEvent.class.isAssignableFrom(aClass))) ? valueIn.typedMarshallable() : valueIn.object(rc.elementType());
          AbstractRemoteSubscription.this.onEvent(object,subscriber);
        }
      }
);
    }
  }
);
}
Program: 55374
Project: 55374
Buggy source:
@Override public void registerTopicSubscriber(RequestContext rc,@NotNull TopicSubscriber<K,V> subscriber){
  if (hub.outBytesLock().isHeldByCurrentThread())   throw new IllegalStateException("String_Node_Str");
  hub.subscribe(new AbstractAsyncSubscription(hub,csp){
    @Override public void onSubscribe(    @NotNull final WireOut wireOut){
      wireOut.writeEventName(registerTopicSubscriber).marshallable(m -> {
        m.write(() -> "String_Node_Str").typeLiteral(kClass);
        m.write(() -> "String_Node_Str").typeLiteral(vClass);
      }
);
    }
    @Override public void onConsumer(    @NotNull final WireIn inWire){
      inWire.readDocument(null,d -> {
        ValueIn valueIn=d.read(reply);
        valueIn.marshallable(m -> {
          final K topic=m.read(() -> "String_Node_Str").object(kClass);
          final V message=m.read(() -> "String_Node_Str").object(vClass);
          RemoteKVSSubscription.this.onEvent(topic,message,subscriber);
        }
);
      }
);
    }
  }
);
}

Fixed version (ground truth):
@Override public void registerTopicSubscriber(RequestContext rc,@NotNull TopicSubscriber<K,V> subscriber){
  if (hub.outBytesLock().isHeldByCurrentThread())   throw new IllegalStateException("String_Node_Str");
  hub.subscribe(new AbstractAsyncSubscription(hub,csp,"String_Node_Str"){
    @Override public void onSubscribe(    @NotNull final WireOut wireOut){
      wireOut.writeEventName(registerTopicSubscriber).marshallable(m -> {
        m.write(() -> "String_Node_Str").typeLiteral(kClass);
        m.write(() -> "String_Node_Str").typeLiteral(vClass);
      }
);
    }
    @Override public void onConsumer(    @NotNull final WireIn inWire){
      inWire.readDocument(null,d -> {
        ValueIn valueIn=d.read(reply);
        valueIn.marshallable(m -> {
          final K topic=m.read(() -> "String_Node_Str").object(kClass);
          final V message=m.read(() -> "String_Node_Str").object(vClass);
          RemoteKVSSubscription.this.onEvent(topic,message,subscriber);
        }
);
      }
);
    }
  }
);
}
Program: 55375
Project: 55375
Buggy source:
@Override public void registerSubscriber(boolean bootstrap,@NotNull final Subscriber subscriber) throws AssetNotFoundException {
  if (hub.outBytesLock().isHeldByCurrentThread())   throw new IllegalStateException("String_Node_Str");
  final AbstractAsyncSubscription asyncSubscription=new AbstractAsyncSubscription(hub,csp + "String_Node_Str" + bootstrap){
    @Override public void onSubscribe(    @NotNull final WireOut wireOut){
      wireOut.writeEventName(registerSubscriber).text("String_Node_Str");
    }
    @Override public void onConsumer(    @NotNull final WireIn w){
      w.readDocument(null,d -> {
        final StringBuilder eventname=Wires.acquireStringBuilder();
        final ValueIn valueIn=d.readEventName(eventname);
        if (EventId.onEndOfSubscription.contentEquals(eventname)) {
          subscriber.onEndOfSubscription();
          hub.unsubscribe(tid());
        }
 else         if (CoreFields.reply.contentEquals(eventname)) {
          valueIn.marshallable(m -> {
            final E message=m.read(() -> "String_Node_Str").object(messageClass);
            RemoteReference.this.onEvent(message,subscriber);
          }
);
        }
      }
);
    }
  }
;
  hub.subscribe(asyncSubscription);
}

Fixed version (ground truth):
@Override public void registerSubscriber(boolean bootstrap,@NotNull final Subscriber subscriber) throws AssetNotFoundException {
  if (hub.outBytesLock().isHeldByCurrentThread())   throw new IllegalStateException("String_Node_Str");
  final AbstractAsyncSubscription asyncSubscription=new AbstractAsyncSubscription(hub,csp + "String_Node_Str" + bootstrap,"String_Node_Str"){
    @Override public void onSubscribe(    @NotNull final WireOut wireOut){
      wireOut.writeEventName(registerSubscriber).text("String_Node_Str");
    }
    @Override public void onConsumer(    @NotNull final WireIn w){
      w.readDocument(null,d -> {
        final StringBuilder eventname=Wires.acquireStringBuilder();
        final ValueIn valueIn=d.readEventName(eventname);
        if (EventId.onEndOfSubscription.contentEquals(eventname)) {
          subscriber.onEndOfSubscription();
          hub.unsubscribe(tid());
        }
 else         if (CoreFields.reply.contentEquals(eventname)) {
          valueIn.marshallable(m -> {
            final E message=m.read(() -> "String_Node_Str").object(messageClass);
            RemoteReference.this.onEvent(message,subscriber);
          }
);
        }
      }
);
    }
  }
;
  hub.subscribe(asyncSubscription);
}
Program: 55376
Project: 55376
Buggy source:
@Override public void registerTopicSubscriber(@NotNull final TopicSubscriber<T,M> topicSubscriber) throws AssetNotFoundException {
  if (hub.outBytesLock().isHeldByCurrentThread())   throw new IllegalStateException("String_Node_Str");
  hub.subscribe(new AbstractAsyncSubscription(hub,csp){
    @Override public void onSubscribe(    @NotNull final WireOut wireOut){
      wireOut.writeEventName(registerSubscriber).text("String_Node_Str");
    }
    @Override public void onConsumer(    @NotNull final WireIn w){
      w.readDocument(null,d -> {
        final StringBuilder eventname=Wires.acquireStringBuilder();
        final ValueIn valueIn=d.readEventName(eventname);
        if (onEndOfSubscription.contentEquals(eventname)) {
          topicSubscriber.onEndOfSubscription();
          hub.unsubscribe(tid());
        }
 else         if (CoreFields.reply.contentEquals(eventname)) {
          valueIn.marshallable(m -> {
            final T topic=m.read(() -> "String_Node_Str").object(topicClass);
            final M message=m.read(() -> "String_Node_Str").object(messageClass);
            RemoteTopicPublisher.this.onEvent(topic,message,topicSubscriber);
          }
);
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
@Override public void registerTopicSubscriber(@NotNull final TopicSubscriber<T,M> topicSubscriber) throws AssetNotFoundException {
  if (hub.outBytesLock().isHeldByCurrentThread())   throw new IllegalStateException("String_Node_Str");
  hub.subscribe(new AbstractAsyncSubscription(hub,csp,"String_Node_Str"){
    @Override public void onSubscribe(    @NotNull final WireOut wireOut){
      wireOut.writeEventName(registerSubscriber).text("String_Node_Str");
    }
    @Override public void onConsumer(    @NotNull final WireIn w){
      w.readDocument(null,d -> {
        final StringBuilder eventname=Wires.acquireStringBuilder();
        final ValueIn valueIn=d.readEventName(eventname);
        if (onEndOfSubscription.contentEquals(eventname)) {
          topicSubscriber.onEndOfSubscription();
          hub.unsubscribe(tid());
        }
 else         if (CoreFields.reply.contentEquals(eventname)) {
          valueIn.marshallable(m -> {
            final T topic=m.read(() -> "String_Node_Str").object(topicClass);
            final M message=m.read(() -> "String_Node_Str").object(messageClass);
            RemoteTopicPublisher.this.onEvent(topic,message,topicSubscriber);
          }
);
        }
      }
);
    }
  }
);
}
Program: 55377
Project: 55377
Buggy source:
public AbstractAsyncSubscription(@NotNull final TcpChannelHub hub,String csp,byte identifier){
  this.tid=hub.nextUniqueTransaction(Time.currentTimeMillis()) * identifier;
  this.hub=hub;
  this.csp=csp;
}

Fixed version (ground truth):
public AbstractAsyncSubscription(@NotNull final TcpChannelHub hub,String csp,byte identifier,String name){
  this.tid=hub.nextUniqueTransaction(Time.currentTimeMillis()) * identifier;
  this.hub=hub;
  this.csp=csp;
  this.name=name;
}
Program: 55378
Project: 55378
Buggy source:
/** 
 * @param hub handles the tcp connectivity.
 * @param csp the url of the subscription.
 * @param id  use as a seed to the tid, makes unique tid'd makes reading the logs easier.
 */
public AbstractAsyncTemporarySubscription(@NotNull TcpChannelHub hub,@Nullable String csp,byte id){
  super(hub,csp,id);
}

Fixed version (ground truth):
/** 
 * @param hub handles the tcp connectivity.
 * @param csp the url of the subscription.
 * @param id  use as a seed to the tid, makes unique tid'd makes reading the logs easier.
 * @param name
 */
public AbstractAsyncTemporarySubscription(@NotNull TcpChannelHub hub,@Nullable String csp,byte id,String name){
  super(hub,csp,id,name);
}
Program: 55379
Project: 55379
Buggy source:
/** 
 * sends a heartbeat from the client to the server and logs the round trip time
 */
private void sendHeartbeat(){
  long l=System.nanoTime();
  subscribe(new AbstractAsyncTemporarySubscription(TcpChannelHub.this,null){
    @Override public void onSubscribe(    WireOut wireOut){
      wireOut.writeEventName(heartbeat).int64(Time.currentTimeMillis());
    }
    @Override public void onConsumer(    @NotNull WireIn inWire){
      long roundTipTimeMicros=NANOSECONDS.toMicros(System.nanoTime() - l);
      if (LOG.isDebugEnabled())       LOG.debug(String.format("String_Node_Str",description,TCPRegistry.lookup(description),roundTipTimeMicros));
      inWire.clear();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * sends a heartbeat from the client to the server and logs the round trip time
 */
private void sendHeartbeat(){
  long l=System.nanoTime();
  subscribe(new AbstractAsyncTemporarySubscription(TcpChannelHub.this,null,name){
    @Override public void onSubscribe(    WireOut wireOut){
      wireOut.writeEventName(heartbeat).int64(Time.currentTimeMillis());
    }
    @Override public void onConsumer(    @NotNull WireIn inWire){
      long roundTipTimeMicros=NANOSECONDS.toMicros(System.nanoTime() - l);
      if (LOG.isDebugEnabled())       LOG.debug(String.format("String_Node_Str",description,TCPRegistry.lookup(description),roundTipTimeMicros));
      inWire.clear();
    }
  }
);
}
Program: 55380
Project: 55380
Buggy source:
private void attemptConnect(){
  for (; ; ) {
    System.out.println("String_Node_Str" + remoteAddress);
    SocketChannel socketChannel;
    try {
      for (; ; ) {
        socketChannel=openSocketChannel();
        try {
          if (socketChannel == null || !socketChannel.connect(remoteAddress)) {
            pause(100);
            continue;
          }
 else           break;
        }
 catch (        ConnectException e) {
          pause(100);
          continue;
        }
      }
      socketChannel.socket().setTcpNoDelay(true);
      socketChannel.socket().setReceiveBufferSize(tcpBufferSize);
      socketChannel.socket().setSendBufferSize(tcpBufferSize);
      onMessageReceived();
      doHandShaking(socketChannel);
synchronized (this) {
        clientChannel=socketChannel;
      }
      eventLoop.addHandler(this);
      System.out.println("String_Node_Str" + remoteAddress);
      reconnect();
      onConnected();
      break;
    }
 catch (    Exception e) {
      e.printStackTrace();
      System.out.println("String_Node_Str" + remoteAddress + "String_Node_Str");
      closeSocket();
    }
  }
}

Fixed version (ground truth):
private void attemptConnect(){
  for (; ; ) {
    System.out.println("String_Node_Str" + remoteAddress);
    SocketChannel socketChannel;
    try {
      for (; ; ) {
        socketChannel=openSocketChannel();
        try {
          if (socketChannel == null || !socketChannel.connect(remoteAddress)) {
            LOG.error("String_Node_Str" + remoteAddress);
            pause(1000);
            continue;
          }
 else           break;
        }
 catch (        ConnectException e) {
          LOG.error("String_Node_Str" + remoteAddress);
          pause(1000);
          continue;
        }
      }
      socketChannel.socket().setTcpNoDelay(true);
      socketChannel.socket().setReceiveBufferSize(tcpBufferSize);
      socketChannel.socket().setSendBufferSize(tcpBufferSize);
      onMessageReceived();
      doHandShaking(socketChannel);
synchronized (this) {
        clientChannel=socketChannel;
      }
      eventLoop.addHandler(this);
      System.out.println("String_Node_Str" + remoteAddress);
      reconnect();
      onConnected();
      break;
    }
 catch (    Exception e) {
      e.printStackTrace();
      System.out.println("String_Node_Str" + remoteAddress + "String_Node_Str");
      closeSocket();
    }
  }
}
Program: 55381
Project: 55381
Buggy source:
/** 
 * blocks this thread until a response is received from the socket
 * @param timeoutTimeMs the amount of time to wait before a time out exceptions
 * @param tid           the {@code tid} of the message that we are waiting for
 * @throws InterruptedException
 */
private Wire syncBlockingReadSocket(final long timeoutTimeMs,long tid) throws InterruptedException, TimeoutException {
  long start=Time.currentTimeMillis();
  final Wire wire=syncInWireThreadLocal.get();
  wire.clear();
  Bytes<?> bytes=wire.bytes();
  ((ByteBuffer)bytes.underlyingObject()).clear();
synchronized (bytes) {
    map.put(tid,bytes);
    bytes.wait(timeoutTimeMs);
  }
  logToStandardOutMessageReceived(wire);
  if (Time.currentTimeMillis() - start >= timeoutTimeMs) {
    throw new TimeoutException("String_Node_Str" + timeoutTimeMs);
  }
  return wire;
}

Fixed version (ground truth):
/** 
 * blocks this thread until a response is received from the socket
 * @param timeoutTimeMs the amount of time to wait before a time out exceptions
 * @param tid           the {@code tid} of the message that we are waiting for
 * @throws InterruptedException
 */
private Wire syncBlockingReadSocket(final long timeoutTimeMs,long tid) throws InterruptedException, TimeoutException {
  long start=Time.currentTimeMillis();
  final Wire wire=syncInWireThreadLocal.get();
  wire.clear();
  Bytes<?> bytes=wire.bytes();
  ((ByteBuffer)bytes.underlyingObject()).clear();
synchronized (bytes) {
    map.put(tid,bytes);
    System.out.println("String_Node_Str" + tid + "String_Node_Str"+ bytes);
    bytes.wait(timeoutTimeMs);
  }
  logToStandardOutMessageReceived(wire);
  if (Time.currentTimeMillis() - start >= timeoutTimeMs) {
    throw new TimeoutException("String_Node_Str" + timeoutTimeMs);
  }
  return wire;
}
Program: 55382
Project: 55382
Buggy source:
/** 
 * re-establish all the subscriptions to the server, this method calls the   {@code net.openhft.chronicle.network.connection.AsyncSubscription#applySubscribe()} for eachsubscription, this could should establish a subscriotuib with the server.
 */
private void reconnect(){
  ReentrantLock lock=outBytesLock();
  lock.lock();
  try {
    map.values().forEach(v -> {
      if (v instanceof AsyncSubscription) {
        if (!(v instanceof AsyncTemporarySubscription))         ((AsyncSubscription)v).applySubscribe();
      }
    }
);
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * re-establish all the subscriptions to the server, this method calls the   {@code net.openhft.chronicle.network.connection.AsyncSubscription#applySubscribe()} for eachsubscription, this could should establish a subscription with the server.
 */
private void reconnect(){
  ReentrantLock lock=outBytesLock();
  lock.lock();
  try {
    map.values().forEach(v -> {
      if (v instanceof AsyncSubscription) {
        if (!(v instanceof AsyncTemporarySubscription))         ((AsyncSubscription)v).applySubscribe();
      }
    }
);
  }
  finally {
    lock.unlock();
  }
}
Program: 55383
Project: 55383
Buggy source:
void subscribe(@NotNull final AsyncSubscription asyncSubscription){
  if (clientChannel == null) {
    map.put(asyncSubscription.tid(),asyncSubscription);
    return;
  }
  final ReentrantLock reentrantLock=outBytesLock();
  reentrantLock.lock();
  try {
    map.put(asyncSubscription.tid(),asyncSubscription);
    asyncSubscription.applySubscribe();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    reentrantLock.unlock();
  }
}

Fixed version (ground truth):
void subscribe(@NotNull final AsyncSubscription asyncSubscription){
  if (clientChannel == null) {
    if (asyncSubscription instanceof AsyncTemporarySubscription) {
      LOG.error("String_Node_Str");
    }
    map.put(asyncSubscription.tid(),asyncSubscription);
    System.out.println("String_Node_Str" + asyncSubscription.tid() + "String_Node_Str"+ asyncSubscription);
    return;
  }
  final ReentrantLock reentrantLock=outBytesLock();
  reentrantLock.lock();
  try {
    map.put(asyncSubscription.tid(),asyncSubscription);
    System.out.println("String_Node_Str" + asyncSubscription.tid() + "String_Node_Str"+ asyncSubscription);
    asyncSubscription.applySubscribe();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    reentrantLock.unlock();
  }
}
Program: 55384
Project: 55384
Buggy source:
@Nullable public AcceptorEventHandler start(String hostPortDescription,@NotNull final AssetTree asset,WireType wireType) throws IOException {
  eg.start();
  AcceptorEventHandler eah=new AcceptorEventHandler(hostPortDescription,() -> new EngineWireHandler(wireType,asset,isClosed),VanillaSessionDetails::new);
  eg.addHandler(eah);
  this.eah=eah;
  return eah;
}

Fixed version (ground truth):
@Nullable public AcceptorEventHandler start(String hostPortDescription,@NotNull final AssetTree asset,WireType wireType) throws IOException {
  eg.start();
  AcceptorEventHandler eah=new AcceptorEventHandler(hostPortDescription,() -> new EngineWireHandler(wireType,asset),VanillaSessionDetails::new);
  eg.addHandler(eah);
  this.eah=eah;
  return eah;
}
Program: 55386
Project: 55386
Buggy source:
public EngineWireHandler(@NotNull final WireType byteToWire,@NotNull final AssetTree assetTree,@NotNull final AtomicBoolean isClosed){
  super(byteToWire);
  this.byteToWire=byteToWire;
  this.sessionProvider=assetTree.root().getView(SessionProvider.class);
  this.eventLoop=assetTree.root().findOrCreateView(EventLoop.class);
  try {
    this.eventLoop.start();
  }
 catch (  RejectedExecutionException e) {
    LOG.debug("String_Node_Str",e);
  }
  this.hostIdentifier=assetTree.root().findOrCreateView(HostIdentifier.class);
  this.assetTree=assetTree;
  this.mapWireHandler=new MapWireHandler<>();
  this.metaDataConsumer=wireInConsumer();
  this.keySetHandler=new CollectionWireHandler();
  this.entrySetHandler=new CollectionWireHandler();
  this.valuesHandler=new CollectionWireHandler();
  this.subscriptionHandler=new ObjectKVSubscriptionHandler();
  this.topologySubscriptionHandler=new TopologySubscriptionHandler();
  this.topicPublisherHandler=new TopicPublisherHandler();
  this.publisherHandler=new PublisherHandler();
  this.replicationHandler=new ReplicationHandler();
  this.systemHandler=new SystemHandler();
  this.isClosed=isClosed;
}

Fixed version (ground truth):
public EngineWireHandler(@NotNull final WireType byteToWire,@NotNull final AssetTree assetTree){
  super(byteToWire);
  this.byteToWire=byteToWire;
  this.sessionProvider=assetTree.root().getView(SessionProvider.class);
  this.eventLoop=assetTree.root().findOrCreateView(EventLoop.class);
  try {
    this.eventLoop.start();
  }
 catch (  RejectedExecutionException e) {
    LOG.debug("String_Node_Str",e);
  }
  this.hostIdentifier=assetTree.root().findOrCreateView(HostIdentifier.class);
  this.assetTree=assetTree;
  this.mapWireHandler=new MapWireHandler<>();
  this.metaDataConsumer=wireInConsumer();
  this.keySetHandler=new CollectionWireHandler();
  this.entrySetHandler=new CollectionWireHandler();
  this.valuesHandler=new CollectionWireHandler();
  this.subscriptionHandler=new ObjectKVSubscriptionHandler();
  this.topologySubscriptionHandler=new TopologySubscriptionHandler();
  this.topicPublisherHandler=new TopicPublisherHandler();
  this.publisherHandler=new PublisherHandler();
  this.replicationHandler=new ReplicationHandler();
  this.systemHandler=new SystemHandler();
}
Program: 55387
Project: 55387
Buggy source:
/** 
 * @param in             the data the has come in from network
 * @param out            the data that is going out to network
 * @param map            the map that is being processed
 * @param tid            the transaction id of the event
 * @param wireAdapter    adapts keys and values to and from wire
 * @param requestContext the uri of the event
 * @param byteToWire
 * @throws StreamCorruptedException
 */
public void process(@NotNull final WireIn in,@NotNull final WireOut out,@NotNull MapView map,long tid,@NotNull final WireAdapter wireAdapter,@NotNull final RequestContext requestContext,@NotNull final WireType byteToWire) throws StreamCorruptedException {
}

Fixed version (ground truth):
/** 
 * @param byteToWire
 * @param in             the data the has come in from network
 * @param out            the data that is going out to network
 * @param map            the map that is being processed
 * @param tid            the transaction id of the event
 * @param wireAdapter    adapts keys and values to and from wire
 * @param requestContext the uri of the event
 * @throws StreamCorruptedException
 */
public void process(@NotNull final WireIn in,@NotNull final WireOut out,@NotNull MapView map,long tid,@NotNull final WireAdapter wireAdapter,@NotNull final RequestContext requestContext) throws StreamCorruptedException {
}
Program: 55388
Project: 55388
Buggy source:
void process(@NotNull final WireIn inWire,final WireOutPublisher publisher,final long tid,final Wire outWire,final HostIdentifier hostId,final Replication replication,final AtomicBoolean isClosed,final EventLoop eventLoop){
  this.isClosed=isClosed;
  this.eventLoop=eventLoop;
  setOutWire(outWire);
  this.hostId=hostId;
  this.publisher=publisher;
  this.replication=replication;
  this.tid=tid;
  dataConsumer.accept(inWire,tid);
}

Fixed version (ground truth):
void process(@NotNull final WireIn inWire,final WireOutPublisher publisher,final long tid,final Wire outWire,final HostIdentifier hostId,final Replication replication,final EventLoop eventLoop){
  this.eventLoop=eventLoop;
  setOutWire(outWire);
  this.hostId=hostId;
  this.publisher=publisher;
  this.replication=replication;
  this.tid=tid;
  dataConsumer.accept(inWire,tid);
}
Program: 55389
Project: 55389
Buggy source:
private void attemptConnect(){
  for (; ; ) {
    System.out.println("String_Node_Str" + remoteAddress);
    SocketChannel socketChannel;
    try {
      for (; ; ) {
        socketChannel=openSocketChannel();
        try {
          if (socketChannel == null || !socketChannel.connect(remoteAddress)) {
            pause(100);
            continue;
          }
 else           break;
        }
 catch (        ConnectException e) {
          pause(100);
          continue;
        }
      }
      socketChannel.socket().setTcpNoDelay(true);
      socketChannel.socket().setReceiveBufferSize(tcpBufferSize);
      socketChannel.socket().setSendBufferSize(tcpBufferSize);
      onMessageReceived();
      doHandShaking(socketChannel);
synchronized (this) {
        clientChannel=socketChannel;
      }
      eventLoop.addHandler(this);
      System.out.println("String_Node_Str" + remoteAddress);
      reconnect();
      onConnected();
      break;
    }
 catch (    Exception e) {
      e.printStackTrace();
      System.out.println("String_Node_Str" + remoteAddress + "String_Node_Str");
      disconnect();
    }
  }
}

Fixed version (ground truth):
private void attemptConnect(){
  for (; ; ) {
    System.out.println("String_Node_Str" + remoteAddress);
    SocketChannel socketChannel;
    try {
      for (; ; ) {
        socketChannel=openSocketChannel();
        try {
          if (socketChannel == null || !socketChannel.connect(remoteAddress)) {
            pause(100);
            continue;
          }
 else           break;
        }
 catch (        ConnectException e) {
          pause(100);
          continue;
        }
      }
      socketChannel.socket().setTcpNoDelay(true);
      socketChannel.socket().setReceiveBufferSize(tcpBufferSize);
      socketChannel.socket().setSendBufferSize(tcpBufferSize);
      onMessageReceived();
      doHandShaking(socketChannel);
synchronized (this) {
        clientChannel=socketChannel;
      }
      eventLoop.addHandler(this);
      System.out.println("String_Node_Str" + remoteAddress);
      reconnect();
      onConnected();
      break;
    }
 catch (    Exception e) {
      e.printStackTrace();
      System.out.println("String_Node_Str" + remoteAddress + "String_Node_Str");
      closeSocket();
    }
  }
}
Program: 55390
Project: 55390
Buggy source:
/** 
 * gets called periodically to monitor the heartbeat
 * @return true, if processing was performed
 * @throws InvalidEventHandlerException
 */
@Override public boolean action() throws InvalidEventHandlerException {
  if (clientChannel == null)   throw new InvalidEventHandlerException();
  long currentTime=Time.currentTimeMillis();
  long millisecondsSinceLastMessageReceived=currentTime - lastTimeMessageReceived;
  long millisecondsSinceLastHeatbeatSend=currentTime - lastheartbeatSentTime;
  if (millisecondsSinceLastMessageReceived >= HEATBEAT_PING_PERIOD && millisecondsSinceLastHeatbeatSend >= HEATBEAT_PING_PERIOD) {
    lastheartbeatSentTime=Time.currentTimeMillis();
    sendHeartbeat();
  }
  long x=millisecondsSinceLastMessageReceived - HEATBEAT_TIMEOUT_PERIOD;
  if (x > 0) {
    LOG.warn("String_Node_Str");
    disconnect();
    throw new InvalidEventHandlerException();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * gets called periodically to monitor the heartbeat
 * @return true, if processing was performed
 * @throws InvalidEventHandlerException
 */
@Override public boolean action() throws InvalidEventHandlerException {
  if (clientChannel == null)   throw new InvalidEventHandlerException();
  long currentTime=Time.currentTimeMillis();
  long millisecondsSinceLastMessageReceived=currentTime - lastTimeMessageReceived;
  long millisecondsSinceLastHeatbeatSend=currentTime - lastheartbeatSentTime;
  if (millisecondsSinceLastMessageReceived >= HEATBEAT_PING_PERIOD && millisecondsSinceLastHeatbeatSend >= HEATBEAT_PING_PERIOD) {
    lastheartbeatSentTime=Time.currentTimeMillis();
    sendHeartbeat();
  }
  long x=millisecondsSinceLastMessageReceived - HEATBEAT_TIMEOUT_PERIOD;
  if (x > 0) {
    LOG.warn("String_Node_Str");
    closeSocket();
    throw new InvalidEventHandlerException();
  }
  return true;
}
Program: 55391
Project: 55391
Buggy source:
private void checkConnectionState(){
  if (clientChannel != null)   return;
  System.out.println("String_Node_Str" + remoteAddress);
  disconnect();
  attemptConnect();
}

Fixed version (ground truth):
private void checkConnectionState(){
  if (clientChannel != null)   return;
  System.out.println("String_Node_Str" + remoteAddress);
  attemptConnect();
}
Program: 55392
Project: 55392
Buggy source:
public Wire proxyReply(long timeoutTime,final long tid){
  checkNotClosed();
  try {
    return tcpSocketConsumer.syncBlockingReadSocket(timeoutTime,tid);
  }
 catch (  IORuntimeException|AssertionError e) {
    throw e;
  }
catch (  RuntimeException e) {
    disconnect();
    throw e;
  }
catch (  Exception e) {
    disconnect();
    throw rethrow(e);
  }
}

Fixed version (ground truth):
public Wire proxyReply(long timeoutTime,final long tid){
  checkNotClosed();
  try {
    return tcpSocketConsumer.syncBlockingReadSocket(timeoutTime,tid);
  }
 catch (  IORuntimeException|AssertionError e) {
    throw e;
  }
catch (  RuntimeException e) {
    LOG.error("String_Node_Str",e);
    closeSocket();
    throw e;
  }
catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    closeSocket();
    throw rethrow(e);
  }
}
Program: 55393
Project: 55393
Buggy source:
@Test public void test() throws InterruptedException, IOException {
  ReplicationServerMain server=new ReplicationServerMain();
  ServerEndpoint s1=server.create(1,"String_Node_Str");
  server.create(2,"String_Node_Str");
  YamlLogging.clientReads=true;
  YamlLogging.clientWrites=true;
  WireType wireType=WireType.TEXT;
  final Integer hostId=Integer.getInteger("String_Node_Str",1);
  BlockingQueue q1=new ArrayBlockingQueue(1);
  BlockingQueue q2=new ArrayBlockingQueue(1);
{
    String hostname=System.getProperty("String_Node_Str","String_Node_Str");
    int port=Integer.getInteger("String_Node_Str",5701);
    map1=create("String_Node_Str",hostId,hostname + "String_Node_Str" + port,q1,wireType);
  }
{
    String hostname=System.getProperty("String_Node_Str","String_Node_Str");
    int port=Integer.getInteger("String_Node_Str",5702);
    map2=create("String_Node_Str",hostId,hostname + "String_Node_Str" + port,q2,wireType);
  }
  map2.put("String_Node_Str","String_Node_Str");
  Assert.assertEquals("String_Node_Str",q1.take().toString());
  Assert.assertEquals("String_Node_Str",q2.take().toString());
  Assert.assertEquals(1,map1.size());
  Assert.assertEquals("String_Node_Str",map1.get("String_Node_Str"));
  Assert.assertEquals(1,map2.size());
  Assert.assertEquals("String_Node_Str",map2.get("String_Node_Str"));
  map2.remove("String_Node_Str");
  Assert.assertEquals("String_Node_Str",q1.take().toString());
  Assert.assertEquals("String_Node_Str",q2.take().toString());
}

Fixed version (ground truth):
@Test public void test() throws InterruptedException, IOException {
  ReplicationServerMain server=new ReplicationServerMain();
  YamlLogging.clientReads=true;
  YamlLogging.clientWrites=true;
  WireType wireType=WireType.TEXT;
  final Integer hostId=Integer.getInteger("String_Node_Str",1);
  BlockingQueue q1=new ArrayBlockingQueue(10);
  BlockingQueue q2=new ArrayBlockingQueue(10);
{
    String hostname=System.getProperty("String_Node_Str","String_Node_Str");
    int port=Integer.getInteger("String_Node_Str",5701);
    map1=create("String_Node_Str",hostId,hostname + "String_Node_Str" + port,q1,wireType);
  }
{
    String hostname=System.getProperty("String_Node_Str","String_Node_Str");
    int port=Integer.getInteger("String_Node_Str",5702);
    map2=create("String_Node_Str",hostId,hostname + "String_Node_Str" + port,q2,wireType);
  }
  map2.put("String_Node_Str","String_Node_Str");
  Assert.assertEquals("String_Node_Str",q1.take().toString());
  Assert.assertEquals("String_Node_Str",q2.take().toString());
  Assert.assertEquals(1,map1.size());
  Assert.assertEquals("String_Node_Str",map1.get("String_Node_Str"));
  Assert.assertEquals(1,map2.size());
  Assert.assertEquals("String_Node_Str",map2.get("String_Node_Str"));
  map2.remove("String_Node_Str");
  Assert.assertEquals("String_Node_Str",q1.take().toString());
  Assert.assertEquals("String_Node_Str",q2.take().toString());
}
Program: 55394
Project: 55394
Buggy source:
@SuppressWarnings("String_Node_Str") private int proxyReturnInt(@NotNull final EventId eventId){
  final long startTime=System.currentTimeMillis();
  return readInt(sendEvent(startTime,eventId,VOID_PARAMETERS),startTime);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private int proxyReturnInt(@NotNull final EventId eventId){
  final long startTime=Time.currentTimeMillis();
  return readInt(sendEvent(startTime,eventId,VOID_PARAMETERS),startTime);
}
Program: 55395
Project: 55395
Buggy source:
@SuppressWarnings("String_Node_Str") private boolean proxyReturnBoolean(@NotNull final EventId eventId,@Nullable final Consumer<ValueOut> consumer){
  final long startTime=System.currentTimeMillis();
  return readBoolean(sendEvent(startTime,eventId,consumer),startTime);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private boolean proxyReturnBoolean(@NotNull final EventId eventId,@Nullable final Consumer<ValueOut> consumer){
  final long startTime=Time.currentTimeMillis();
  return readBoolean(sendEvent(startTime,eventId,consumer),startTime);
}
Program: 55396
Project: 55396
Buggy source:
public void stop(){
  eg.stop();
}

Fixed version (ground truth):
public void stop(){
  if (eg != null)   eg.stop();
}
Program: 55397
Project: 55397
Buggy source:
public AbstractAsyncSubscription(@NotNull final TcpChannelHub hub,String csp,byte identifier){
  this.tid=hub.nextUniqueTransaction(System.currentTimeMillis()) * identifier;
  this.hub=hub;
  this.csp=csp;
}

Fixed version (ground truth):
public AbstractAsyncSubscription(@NotNull final TcpChannelHub hub,String csp,byte identifier){
  this.tid=hub.nextUniqueTransaction(Time.currentTimeMillis()) * identifier;
  this.hub=hub;
  this.csp=csp;
}
Program: 55398
Project: 55398
Buggy source:
public <T>T proxyReturnWireConsumerInOut(@NotNull final WireKey eventId,@NotNull final WireKey reply,@Nullable final Consumer<ValueOut> consumerOut,@NotNull final Function<ValueIn,T> consumerIn){
  final long startTime=System.currentTimeMillis();
  long tid=sendEvent(startTime,eventId,consumerOut);
  return readWire(tid,startTime,reply,consumerIn);
}

Fixed version (ground truth):
public <T>T proxyReturnWireConsumerInOut(@NotNull final WireKey eventId,@NotNull final WireKey reply,@Nullable final Consumer<ValueOut> consumerOut,@NotNull final Function<ValueIn,T> consumerIn){
  final long startTime=Time.currentTimeMillis();
  long tid=sendEvent(startTime,eventId,consumerOut);
  return readWire(tid,startTime,reply,consumerIn);
}
Program: 55399
Project: 55399
Buggy source:
@SuppressWarnings("String_Node_Str") protected boolean proxyReturnBooleanWithArgs(@NotNull final E eventId,@NotNull final Object... args){
  final long startTime=System.currentTimeMillis();
  final long tid=sendEvent(startTime,eventId,toParameters(eventId,args));
  return readBoolean(tid,startTime);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected boolean proxyReturnBooleanWithArgs(@NotNull final E eventId,@NotNull final Object... args){
  final long startTime=Time.currentTimeMillis();
  final long tid=sendEvent(startTime,eventId,toParameters(eventId,args));
  return readBoolean(tid,startTime);
}
Program: 55400
Project: 55400
Buggy source:
protected void sendEventAsyncWithoutLock(@NotNull final WireKey eventId,@Nullable final Consumer<ValueOut> consumer){
  writeAsyncMetaData(System.currentTimeMillis());
  hub.outWire().writeDocument(false,wireOut -> {
    final ValueOut valueOut=wireOut.writeEventName(eventId);
    if (consumer == null)     valueOut.marshallable(WriteMarshallable.EMPTY);
 else     consumer.accept(valueOut);
  }
);
  hub.writeSocket(hub.outWire());
}

Fixed version (ground truth):
protected void sendEventAsyncWithoutLock(@NotNull final WireKey eventId,@Nullable final Consumer<ValueOut> consumer){
  writeAsyncMetaData(Time.currentTimeMillis());
  hub.outWire().writeDocument(false,wireOut -> {
    final ValueOut valueOut=wireOut.writeEventName(eventId);
    if (consumer == null)     valueOut.marshallable(WriteMarshallable.EMPTY);
 else     consumer.accept(valueOut);
  }
);
  hub.writeSocket(hub.outWire());
}
Program: 55401
Project: 55401
Buggy source:
protected boolean proxyReturnBooleanWithSequence(@NotNull final E eventId,@NotNull final Collection sequence){
  final long startTime=System.currentTimeMillis();
  final long tid=sendEvent(startTime,eventId,out -> sequence.forEach(out::object));
  return readBoolean(tid,startTime);
}

Fixed version (ground truth):
protected boolean proxyReturnBooleanWithSequence(@NotNull final E eventId,@NotNull final Collection sequence){
  final long startTime=Time.currentTimeMillis();
  final long tid=sendEvent(startTime,eventId,out -> sequence.forEach(out::object));
  return readBoolean(tid,startTime);
}
Program: 55402
Project: 55402
Buggy source:
public <T>T proxyReturnWireConsumer(@NotNull final WireKey eventId,@NotNull final Function<ValueIn,T> consumer){
  final long startTime=System.currentTimeMillis();
  long tid=sendEvent(startTime,eventId,null);
  return readWire(tid,startTime,CoreFields.reply,consumer);
}

Fixed version (ground truth):
public <T>T proxyReturnWireConsumer(@NotNull final WireKey eventId,@NotNull final Function<ValueIn,T> consumer){
  final long startTime=Time.currentTimeMillis();
  long tid=sendEvent(startTime,eventId,null);
  return readWire(tid,startTime,CoreFields.reply,consumer);
}
Program: 55403
Project: 55403
Buggy source:
@SuppressWarnings("String_Node_Str") protected boolean proxyReturnBoolean(@NotNull final WireKey eventId){
  final long startTime=System.currentTimeMillis();
  final long tid=sendEvent(startTime,eventId,null);
  return readBoolean(tid,startTime);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected boolean proxyReturnBoolean(@NotNull final WireKey eventId){
  final long startTime=Time.currentTimeMillis();
  final long tid=sendEvent(startTime,eventId,null);
  return readBoolean(tid,startTime);
}
Program: 55404
Project: 55404
Buggy source:
/** 
 * blocks until there is a conneciton
 */
public void checkConnection(){
  long start=System.currentTimeMillis();
  while (clientChannel == null) {
    if (tcpSocketConsumer.isShutdown())     throw new IORuntimeException("String_Node_Str" + remoteAddress);
    if (start + timeoutMs > System.currentTimeMillis())     Jvm.pause(100);
 else     throw new IORuntimeException("String_Node_Str" + remoteAddress);
  }
}

Fixed version (ground truth):
/** 
 * blocks until there is a conneciton
 */
public void checkConnection(){
  long start=Time.currentTimeMillis();
  while (clientChannel == null) {
    if (tcpSocketConsumer.isShutdown())     throw new IORuntimeException("String_Node_Str" + remoteAddress);
    if (start + timeoutMs > Time.currentTimeMillis())     Jvm.pause(100);
 else     throw new IORuntimeException("String_Node_Str" + remoteAddress);
  }
}
Program: 55405
Project: 55405
Buggy source:
/** 
 * sends a heartbeat from the client to the server and logs the round trip time
 */
private void sendHeartbeat(){
  long l=System.nanoTime();
  subscribe(new AbstractAsyncTemporarySubscription(TcpChannelHub.this,null){
    @Override public void onSubscribe(    WireOut wireOut){
      wireOut.writeEventName(heartbeat).int64(System.currentTimeMillis());
    }
    @Override public void onConsumer(    @NotNull WireIn inWire){
      long roundTipTimeMicros=NANOSECONDS.toMicros(System.nanoTime() - l);
      if (LOG.isDebugEnabled())       LOG.debug(String.format("String_Node_Str",description,TCPRegistry.lookup(description),roundTipTimeMicros));
      inWire.clear();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * sends a heartbeat from the client to the server and logs the round trip time
 */
private void sendHeartbeat(){
  long l=System.nanoTime();
  subscribe(new AbstractAsyncTemporarySubscription(TcpChannelHub.this,null){
    @Override public void onSubscribe(    WireOut wireOut){
      wireOut.writeEventName(heartbeat).int64(Time.currentTimeMillis());
    }
    @Override public void onConsumer(    @NotNull WireIn inWire){
      long roundTipTimeMicros=NANOSECONDS.toMicros(System.nanoTime() - l);
      if (LOG.isDebugEnabled())       LOG.debug(String.format("String_Node_Str",description,TCPRegistry.lookup(description),roundTipTimeMicros));
      inWire.clear();
    }
  }
);
}
Program: 55406
Project: 55406
Buggy source:
/** 
 * blocks this thread until a response is received from the socket
 * @param timeoutTimeMs the amount of time to wait before a time out exceptions
 * @param tid           the {@code tid} of the message that we are waiting for
 * @throws InterruptedException
 */
private Wire syncBlockingReadSocket(final long timeoutTimeMs,long tid) throws InterruptedException, TimeoutException {
  long start=System.currentTimeMillis();
  final Wire wire=syncInWireThreadLocal.get();
  wire.clear();
  Bytes<?> bytes=wire.bytes();
  ((ByteBuffer)bytes.underlyingObject()).clear();
synchronized (bytes) {
    map.put(tid,bytes);
    bytes.wait(timeoutTimeMs);
  }
  logToStandardOutMessageReceived(wire);
  if (System.currentTimeMillis() - start >= timeoutTimeMs) {
    throw new TimeoutException("String_Node_Str" + timeoutTimeMs);
  }
  return wire;
}

Fixed version (ground truth):
/** 
 * blocks this thread until a response is received from the socket
 * @param timeoutTimeMs the amount of time to wait before a time out exceptions
 * @param tid           the {@code tid} of the message that we are waiting for
 * @throws InterruptedException
 */
private Wire syncBlockingReadSocket(final long timeoutTimeMs,long tid) throws InterruptedException, TimeoutException {
  long start=Time.currentTimeMillis();
  final Wire wire=syncInWireThreadLocal.get();
  wire.clear();
  Bytes<?> bytes=wire.bytes();
  ((ByteBuffer)bytes.underlyingObject()).clear();
synchronized (bytes) {
    map.put(tid,bytes);
    bytes.wait(timeoutTimeMs);
  }
  logToStandardOutMessageReceived(wire);
  if (Time.currentTimeMillis() - start >= timeoutTimeMs) {
    throw new TimeoutException("String_Node_Str" + timeoutTimeMs);
  }
  return wire;
}
Program: 55407
Project: 55407
Buggy source:
/** 
 * gets called periodically to monitor the heartbeat
 * @return true, if processing was performed
 * @throws InvalidEventHandlerException
 */
@Override public boolean action() throws InvalidEventHandlerException {
  if (clientChannel == null)   throw new InvalidEventHandlerException();
  long currentTime=System.currentTimeMillis();
  long millisecondsSinceLastMessageReceived=currentTime - lastTimeMessageReceived;
  long millisecondsSinceLastHeatbeatSend=currentTime - lastheartbeatSentTime;
  if (millisecondsSinceLastMessageReceived >= HEATBEAT_PING_PERIOD && millisecondsSinceLastHeatbeatSend >= HEATBEAT_PING_PERIOD) {
    lastheartbeatSentTime=System.currentTimeMillis();
    sendHeartbeat();
  }
  long x=millisecondsSinceLastMessageReceived - HEATBEAT_TIMEOUT_PERIOD;
  if (x > 0) {
    LOG.warn("String_Node_Str");
    disconnect();
    throw new InvalidEventHandlerException();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * gets called periodically to monitor the heartbeat
 * @return true, if processing was performed
 * @throws InvalidEventHandlerException
 */
@Override public boolean action() throws InvalidEventHandlerException {
  if (clientChannel == null)   throw new InvalidEventHandlerException();
  long currentTime=Time.currentTimeMillis();
  long millisecondsSinceLastMessageReceived=currentTime - lastTimeMessageReceived;
  long millisecondsSinceLastHeatbeatSend=currentTime - lastheartbeatSentTime;
  if (millisecondsSinceLastMessageReceived >= HEATBEAT_PING_PERIOD && millisecondsSinceLastHeatbeatSend >= HEATBEAT_PING_PERIOD) {
    lastheartbeatSentTime=Time.currentTimeMillis();
    sendHeartbeat();
  }
  long x=millisecondsSinceLastMessageReceived - HEATBEAT_TIMEOUT_PERIOD;
  if (x > 0) {
    LOG.warn("String_Node_Str");
    disconnect();
    throw new InvalidEventHandlerException();
  }
  return true;
}
Program: 55408
Project: 55408
Buggy source:
@Override public void onSubscribe(WireOut wireOut){
  wireOut.writeEventName(heartbeat).int64(System.currentTimeMillis());
}

Fixed version (ground truth):
@Override public void onSubscribe(WireOut wireOut){
  wireOut.writeEventName(heartbeat).int64(Time.currentTimeMillis());
}
Program: 55409
Project: 55409
Buggy source:
private void onMessageReceived(){
  lastTimeMessageReceived=System.currentTimeMillis();
}

Fixed version (ground truth):
private void onMessageReceived(){
  lastTimeMessageReceived=Time.currentTimeMillis();
}