nus-yam/ex-repair huggingface dataset:
Program: 55288
Project: 55288
Buggy source:
@Test public void testBootstrapAllFromMap1WithSubscription2() throws InterruptedException {
  AtomicInteger map1Updates=new AtomicInteger();
  AtomicInteger map2Updates=new AtomicInteger();
  final ConcurrentMap<String,String> map1=tree1.acquireMap(name,String.class,String.class);
  assertNotNull(map1);
  tree1.registerSubscriber(name,MapEvent.class,f -> map1Updates.incrementAndGet());
  map1.clear();
  map1.put("String_Node_Str","String_Node_Str");
  map1.put("String_Node_Str","String_Node_Str");
  Thread.sleep(2);
  final ConcurrentMap<String,String> map2=tree2.acquireMap(name,String.class,String.class);
  Thread.sleep(1000);
  tree2.registerSubscriber(name,MapEvent.class,f -> map2Updates.incrementAndGet());
  map2.put("String_Node_Str","String_Node_Str");
  map2.put("String_Node_Str","String_Node_Str");
  assertNotNull(map2);
  for (int i=1; i <= 50; i++) {
    if (map1.size() == 2 && map2.size() == 2)     break;
    Jvm.pause(300);
  }
  for (  Map m : new Map[]{map1,map2}) {
    Assert.assertEquals("String_Node_Str",m.get("String_Node_Str"));
    Assert.assertEquals("String_Node_Str",m.get("String_Node_Str"));
    Assert.assertEquals(2,m.size());
  }
  Assert.assertEquals(2,map1Updates.get());
}

Fixed version (ground truth):
@Test public void testBootstrapAllFromMap1WithSubscription2() throws InterruptedException {
  AtomicInteger map1Updates=new AtomicInteger();
  AtomicInteger map2Updates=new AtomicInteger();
  final ConcurrentMap<String,String> map1=tree1.acquireMap(name,String.class,String.class);
  assertNotNull(map1);
  tree1.registerSubscriber(name,MapEvent.class,f -> map1Updates.incrementAndGet());
  map1.clear();
  map1.put("String_Node_Str","String_Node_Str");
  map1.put("String_Node_Str","String_Node_Str");
  Thread.sleep(2);
  final ConcurrentMap<String,String> map2=tree2.acquireMap(name,String.class,String.class);
  Thread.sleep(1000);
  tree2.registerSubscriber(name,MapEvent.class,f -> {
    System.out.println(("String_Node_Str" + f));
    map2Updates.incrementAndGet();
  }
);
  map2.put("String_Node_Str","String_Node_Str");
  map2.put("String_Node_Str","String_Node_Str");
  assertNotNull(map2);
  for (int i=1; i <= 50; i++) {
    if (map1.size() == 2 && map2.size() == 2)     break;
    Jvm.pause(300);
  }
  for (  Map m : new Map[]{map1,map2}) {
    Assert.assertEquals("String_Node_Str",m.get("String_Node_Str"));
    Assert.assertEquals("String_Node_Str",m.get("String_Node_Str"));
    Assert.assertEquals(2,m.size());
  }
  Assert.assertEquals(2,map1Updates.get());
  Assert.assertEquals(2,map2Updates.get());
}
Program: 55289
Project: 55289
Buggy source:
@Test public void testBootstrapAllFromMap1WithSubscription2() throws InterruptedException {
  AtomicInteger map1Updates=new AtomicInteger();
  AtomicInteger map2Updates=new AtomicInteger();
  final ConcurrentMap<String,String> map1=tree1.acquireMap(name,String.class,String.class);
  assertNotNull(map1);
  tree1.registerSubscriber(name,MapEvent.class,f -> map1Updates.incrementAndGet());
  map1.clear();
  map1.put("String_Node_Str","String_Node_Str");
  map1.put("String_Node_Str","String_Node_Str");
  Thread.sleep(2);
  final ConcurrentMap<String,String> map2=tree2.acquireMap(name,String.class,String.class);
  Thread.sleep(1000);
  tree2.registerSubscriber(name,MapEvent.class,f -> {
    System.out.println(("String_Node_Str" + f));
    map2Updates.incrementAndGet();
  }
);
  map2.put("String_Node_Str","String_Node_Str");
  map2.put("String_Node_Str","String_Node_Str");
  assertNotNull(map2);
  for (int i=1; i <= 50; i++) {
    if (map1.size() == 2 && map2.size() == 2)     break;
    Jvm.pause(300);
  }
  for (  Map m : new Map[]{map1,map2}) {
    Assert.assertEquals("String_Node_Str",m.get("String_Node_Str"));
    Assert.assertEquals("String_Node_Str",m.get("String_Node_Str"));
    Assert.assertEquals(2,m.size());
  }
  Assert.assertEquals(2,map1Updates.get());
  Assert.assertEquals(2,map2Updates.get());
}

Fixed version (ground truth):
@Test public void testBootstrapAllFromMap1WithSubscription2() throws InterruptedException {
  AtomicInteger map1Updates=new AtomicInteger();
  AtomicInteger map2Updates=new AtomicInteger();
  final ConcurrentMap<String,String> map1=tree1.acquireMap(name,String.class,String.class);
  assertNotNull(map1);
  tree1.registerSubscriber(name,MapEvent.class,f -> map1Updates.incrementAndGet());
  map1.clear();
  map1.put("String_Node_Str","String_Node_Str");
  map1.put("String_Node_Str","String_Node_Str");
  Thread.sleep(2);
  final ConcurrentMap<String,String> map2=tree2.acquireMap(name,String.class,String.class);
  Thread.sleep(1000);
  tree2.registerSubscriber(name,MapEvent.class,f -> map2Updates.incrementAndGet());
  map2.put("String_Node_Str","String_Node_Str");
  map2.put("String_Node_Str","String_Node_Str");
  assertNotNull(map2);
  for (int i=1; i <= 50; i++) {
    if (map1.size() == 2 && map2.size() == 2)     break;
    Jvm.pause(300);
  }
  for (  Map m : new Map[]{map1,map2}) {
    Assert.assertEquals("String_Node_Str",m.get("String_Node_Str"));
    Assert.assertEquals("String_Node_Str",m.get("String_Node_Str"));
    Assert.assertEquals(2,m.size());
  }
  Assert.assertEquals(2,map1Updates.get());
  Assert.assertEquals(2,map2Updates.get());
}
Program: 55290
Project: 55290
Buggy source:
/** 
 * Get or create a view with out a RequestContext.  First it looks for a matching viewType(). If found this is returned. The viewType given overrides the type provided in the RequestContext.
 * @param viewType to obtain.
 * @return the View obtained.
 * @throws AssetNotFoundException if the Asset could not be created. This can happen if arequired rule is not provided.
 */
@NotNull default <V>V acquireView(Class<V> viewType){
  return acquireView(viewType,RequestContext.requestContext(fullName()).viewType(viewType));
}

Fixed version (ground truth):
/** 
 * Get or create a view with out a RequestContext.  First it looks for a matching viewType(). If found this is returned. The viewType given overrides the type provided in the RequestContext.
 * @param viewType to obtain.
 * @return the View obtained.
 * @throws AssetNotFoundException if the Asset could not be created. This can happen if arequired rule is not provided.
 */
@NotNull default <V>V acquireView(Class<V> viewType){
  return acquireView(viewType,RequestContext.requestContext(fullName()));
}
Program: 55291
Project: 55291
Buggy source:
@NotNull @Override public KeySetView<K> keySet(){
  return asset.acquireView(KeySetView.class);
}

Fixed version (ground truth):
@NotNull @Override public KeySetView<K> keySet(){
  return asset.acquireView(KeySetView.class,context);
}
Program: 55292
Project: 55292
Buggy source:
@Override public void registerDownstream(@NotNull EventConsumer<K,V> subscription){
  registerSubscriber(rc.clone().type(MapEvent.class).type2(null),subscription::notifyEvent,Filter.empty());
}

Fixed version (ground truth):
@Override public void registerDownstream(@NotNull EventConsumer<K,V> subscription){
  registerSubscriber(rc.clone().messageType(rc.messageType()).elementType(MapEvent.class),subscription::notifyEvent,Filter.empty());
}
Program: 55293
Project: 55293
Buggy source:
@Override public void registerKeySubscriber(@org.jetbrains.annotations.NotNull @NotNull Subscriber<K> subscriber,@org.jetbrains.annotations.NotNull @NotNull Filter filter,@org.jetbrains.annotations.NotNull @NotNull Set<RequestContext.Operation> contextOperations){
  final KVSSubscription<K,V> subscription=(KVSSubscription<K,V>)asset.subscription(true);
  final RequestContext rc=RequestContext.requestContext().type(keyClass);
  contextOperations.forEach(e -> e.apply(rc));
  subscription.registerKeySubscriber(rc,subscriber,filter);
}

Fixed version (ground truth):
@Override public void registerKeySubscriber(@org.jetbrains.annotations.NotNull @NotNull Subscriber<K> subscriber,@org.jetbrains.annotations.NotNull @NotNull Filter filter,@org.jetbrains.annotations.NotNull @NotNull Set<RequestContext.Operation> contextOperations){
  final KVSSubscription<K,V> subscription=(KVSSubscription<K,V>)asset.subscription(true);
  final RequestContext rc=RequestContext.requestContext().type(keyClass).type2(valueType);
  contextOperations.forEach(e -> e.apply(rc));
  subscription.registerKeySubscriber(rc,subscriber,filter);
}
Program: 55294
Project: 55294
Buggy source:
/** 
 * before writing the tid to the wire
 * @param tid     the tid
 * @param valueIn the value in from the wire
 * @return true if processed
 */
boolean before(Long tid,@NotNull ValueIn valueIn) throws AssetNotFoundException {
  if (registerSubscriber.contentEquals(eventName)) {
    final Class subscriptionType=valueIn.typeLiteral();
    final StringBuilder sb=Wires.acquireStringBuilder();
    final ValueIn valueIn1=valueIn.wireIn().readEventName(sb);
    final Filter filter="String_Node_Str".contentEquals(sb) ? valueIn1.object(Filter.class) : Filter.empty();
    if (tidToListener.containsKey(tid)) {
      LOG.info("String_Node_Str" + tid);
      return true;
    }
    final WireOutPublisher pub=(requestContext.throttlePeriodMs() == 0) ? publisher : newThrottledWireOutPublisher(requestContext.throttlePeriodMs(),publisher);
    Subscriber<Object> listener=new LocalSubscriber(tid,pub);
    tidToListener.put(tid,listener);
    RequestContext rc=requestContext.clone().type2(subscriptionType);
    final SubscriptionCollection subscription=assetTree.acquireSubscription(rc);
    subscription.registerSubscriber(rc,listener,filter);
    return true;
  }
  if (unregisterSubscriber.contentEquals(eventName)) {
    Subscriber<Object> listener=(Subscriber)tidToListener.remove(tid);
    if (listener == null) {
      SubscriptionHandler.LOG.warn("String_Node_Str" + tid + "String_Node_Str");
      return true;
    }
    assetTree.unregisterSubscriber(requestContext.fullName(),listener);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * before writing the tid to the wire
 * @param tid     the tid
 * @param valueIn the value in from the wire
 * @return true if processed
 */
boolean before(Long tid,@NotNull ValueIn valueIn) throws AssetNotFoundException {
  if (registerSubscriber.contentEquals(eventName)) {
    final Class subscriptionType=valueIn.typeLiteral();
    final StringBuilder sb=Wires.acquireStringBuilder();
    final ValueIn valueIn1=valueIn.wireIn().readEventName(sb);
    final Filter filter="String_Node_Str".contentEquals(sb) ? valueIn1.object(Filter.class) : Filter.empty();
    if (tidToListener.containsKey(tid)) {
      LOG.info("String_Node_Str" + tid);
      return true;
    }
    final WireOutPublisher pub=(requestContext.throttlePeriodMs() == 0) ? publisher : newThrottledWireOutPublisher(requestContext.throttlePeriodMs(),publisher);
    Subscriber<Object> listener=new LocalSubscriber(tid,pub);
    tidToListener.put(tid,listener);
    RequestContext rc=requestContext.clone().elementType(subscriptionType);
    final SubscriptionCollection subscription=assetTree.acquireSubscription(rc);
    subscription.registerSubscriber(rc,listener,filter);
    return true;
  }
  if (unregisterSubscriber.contentEquals(eventName)) {
    Subscriber<Object> listener=(Subscriber)tidToListener.remove(tid);
    if (listener == null) {
      SubscriptionHandler.LOG.warn("String_Node_Str" + tid + "String_Node_Str");
      return true;
    }
    assetTree.unregisterSubscriber(requestContext.fullName(),listener);
    return true;
  }
  return false;
}
Program: 55295
Project: 55295
Buggy source:
private void connectClientAndPerformPutGetTest(String testKey,String value,BlockingQueue<String> eventQueue) throws InterruptedException {
  VanillaAssetTree remote=new VanillaAssetTree().forRemoteAccess(CONNECTION_1,WIRE_TYPE,x -> t.set(x));
  String keySubUri=_testMapUri + "String_Node_Str" + testKey+ "String_Node_Str";
  Map<String,String> map=remote.acquireMap(_testMapUri,String.class,String.class);
  map.size();
  System.out.println("String_Node_Str");
  remote.registerSubscriber(keySubUri + "String_Node_Str",String.class,(e) -> eventQueue.add(e));
  Thread.sleep(100);
  map.put(testKey,value);
  Assert.assertEquals(value,eventQueue.poll(2,SECONDS));
  String getValue=map.get(testKey);
  Assert.assertEquals(value,getValue);
  remote.close();
}

Fixed version (ground truth):
private void connectClientAndPerformPutGetTest(String testKey,String value,BlockingQueue<String> eventQueue) throws InterruptedException {
  VanillaAssetTree remote=new VanillaAssetTree().forRemoteAccess(CONNECTION_1,WIRE_TYPE,x -> t.set(x));
  String keySubUri=_testMapUri + "String_Node_Str" + testKey+ "String_Node_Str";
  Map<String,String> map=remote.acquireMap(_testMapUri,String.class,String.class);
  map.size();
  remote.registerSubscriber(keySubUri + "String_Node_Str",String.class,(e) -> eventQueue.add(e));
  Thread.sleep(100);
  map.put(testKey,value);
  Assert.assertEquals(value,eventQueue.poll(2,SECONDS));
  String getValue=map.get(testKey);
  Assert.assertEquals(value,getValue);
  remote.close();
}
Program: 55296
Project: 55296
Buggy source:
@Before public void before() throws IOException {
  serverAssetTree=new VanillaAssetTree().forTesting(x -> t.compareAndSet(null,x));
  if (isRemote) {
    methodName(name.getMethodName());
    connection="String_Node_Str";
    TCPRegistry.createServerSocketChannelFor(connection);
    serverEndpoint=new ServerEndpoint(connection,serverAssetTree,wireType);
    assetTree=new VanillaAssetTree().forRemoteAccess(connection,wireType,x -> t.set(x));
  }
 else {
    assetTree=serverAssetTree;
  }
  map=assetTree.acquireMap(NAME,String.class,String.class);
}

Fixed version (ground truth):
@Before public void before() throws IOException {
  serverAssetTree=new VanillaAssetTree().forTesting(x -> t.compareAndSet(null,x));
  if (isRemote) {
    methodName(name.getMethodName());
    connection="String_Node_Str";
    TCPRegistry.createServerSocketChannelFor(connection);
    serverEndpoint=new ServerEndpoint(connection,serverAssetTree,wireType);
    assetTree=new VanillaAssetTree().forRemoteAccess(connection,wireType,x -> t.set(x));
  }
 else {
    assetTree=serverAssetTree;
  }
  YamlLogging.setAll(true);
}
Program: 55297
Project: 55297
Buggy source:
@After public void after() throws IOException {
  assetTree.close();
  Jvm.pause(1000);
  if (serverEndpoint != null)   serverEndpoint.close();
  serverAssetTree.close();
  if (map instanceof Closeable)   ((Closeable)map).close();
  TcpChannelHub.closeAllHubs();
  TCPRegistry.reset();
}

Fixed version (ground truth):
@After public void after() throws IOException {
  assetTree.close();
  Jvm.pause(1000);
  if (serverEndpoint != null)   serverEndpoint.close();
  serverAssetTree.close();
  TcpChannelHub.closeAllHubs();
  TCPRegistry.reset();
}
Program: 55298
Project: 55298
Buggy source:
@Test(timeout=10000) public void testForEach() throws Exception {
  final MapView<Integer,Integer> map=assetTree.acquireMap("String_Node_Str",Integer.class,Integer.class);
  map.put(1,1);
  map.put(2,2);
  map.put(3,3);
  final Query<Integer> query=map.keySet().query();
  query.filter((obj) -> obj >= 1 && obj <= 2).forEach(System.out::println);
}

Fixed version (ground truth):
@Test(timeout=100000000) public void testForEach() throws Exception {
  final MapView<Integer,Integer> map=assetTree.acquireMap("String_Node_Str",Integer.class,Integer.class);
  map.put(1,1);
  map.put(2,2);
  map.put(3,3);
  final Query<Integer> query=map.keySet().query();
  query.filter((obj) -> obj >= 1 && obj <= 2).forEach(System.out::println);
}
Program: 55299
Project: 55299
Buggy source:
@Override public void registerSubscriber(@NotNull RequestContext rc,@NotNull Subscriber subscriber,@NotNull Filter filter){
  Class eClass=rc.type();
  if (eClass == Entry.class || eClass == MapEvent.class)   registerSubscriber0(rc,subscriber,filter);
 else   registerKeySubscriber(rc,subscriber,filter);
}

Fixed version (ground truth):
@Override public void registerSubscriber(@NotNull RequestContext rc,@NotNull Subscriber subscriber,@NotNull Filter filter){
  Class eClass=rc.elementType();
  if (eClass == Entry.class || eClass == MapEvent.class)   registerSubscriber0(rc,subscriber,filter);
 else   registerKeySubscriber(rc,subscriber,filter);
}
Program: 55300
Project: 55300
Buggy source:
@Override public void onEndOfConnection(boolean heartbeatTimeOut){
  for (  final AbstractHandler abstractHandler : new AbstractHandler[]{mapWireHandler,subscriptionHandler,topologySubscriptionHandler,publisherHandler,replicationHandler}) {
    abstractHandler.onEndOfConnection(heartbeatTimeOut);
  }
}

Fixed version (ground truth):
@Override public void onEndOfConnection(boolean heartbeatTimeOut){
  for (  final AbstractHandler abstractHandler : new AbstractHandler[]{mapWireHandler,subscriptionHandler,topologySubscriptionHandler,publisherHandler,replicationHandler}) {
    abstractHandler.onEndOfConnection(heartbeatTimeOut);
  }
  try {
    Thread.sleep(1000);
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
}
Program: 55301
Project: 55301
Buggy source:
public static void main(String[] args) throws IOException, InterruptedException {
  YamlLogging.clientWrites=false;
  YamlLogging.clientReads=false;
  YamlLogging.setAll(false);
  ClassAliasPool.CLASS_ALIASES.addAlias(ChronicleMapGroupFS.class);
  ClassAliasPool.CLASS_ALIASES.addAlias(FilePerKeyGroupFS.class);
  WireType writeType=WireType.BINARY;
  char[] x=new char[VALUE_SIZE];
  Arrays.fill(x,'X');
  final String s=new String(x);
  VanillaAssetTree tree1=new VanillaAssetTree("String_Node_Str").forRemoteAccess("String_Node_Str",WIRE_TYPE);
  Executors.newSingleThreadExecutor().submit(() -> {
    final ConcurrentMap<String,String> map1=tree1.acquireMap(NAME,String.class,String.class);
    for (; ; ) {
      for (int i=0; i < entries; i++) {
        try {
          map1.put("String_Node_Str" + i,s);
        }
 catch (        Throwable t) {
          t.printStackTrace();
        }
      }
    }
  }
);
  YamlLogging.setAll(false);
  final ConcurrentMap<String,String> map;
  AssetTree tree3=new VanillaAssetTree("String_Node_Str").forRemoteAccess("String_Node_Str",WIRE_TYPE);
  tree3.acquireMap(NAME,String.class,String.class).size();
  int[] count={0};
  tree3.registerSubscriber(NAME,MapEvent.class,me -> {
    System.out.print((me == null) ? "String_Node_Str" : me.getKey());
    if (++count[0] >= 20) {
      System.out.println();
      count[0]=0;
    }
 else {
      System.out.print("String_Node_Str");
    }
  }
);
  System.in.read();
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, InterruptedException {
  YamlLogging.clientWrites=false;
  YamlLogging.clientReads=false;
  YamlLogging.setAll(false);
  ClassAliasPool.CLASS_ALIASES.addAlias(ChronicleMapGroupFS.class);
  ClassAliasPool.CLASS_ALIASES.addAlias(FilePerKeyGroupFS.class);
  WireType writeType=WireType.BINARY;
  char[] x=new char[VALUE_SIZE];
  Arrays.fill(x,'X');
  final String s=new String(x);
  Executors.newSingleThreadExecutor().submit(() -> {
    VanillaAssetTree tree5=new VanillaAssetTree("String_Node_Str").forRemoteAccess("String_Node_Str",WIRE_TYPE);
    final ConcurrentMap<String,String> map1=tree5.acquireMap(NAME,String.class,String.class);
    for (; ; ) {
      for (int i=0; i < entries; i++) {
        try {
          map1.put("String_Node_Str" + i,s);
          Thread.sleep(20);
        }
 catch (        Throwable t) {
          t.printStackTrace();
        }
      }
    }
  }
);
  YamlLogging.setAll(false);
  final ConcurrentMap<String,String> map;
  AssetTree tree3=new VanillaAssetTree("String_Node_Str").forRemoteAccess("String_Node_Str",WIRE_TYPE);
  tree3.acquireMap(NAME,String.class,String.class).size();
  int[] count={0};
  tree3.registerSubscriber(NAME,MapEvent.class,me -> {
    System.out.print((me == null) ? "String_Node_Str" : me.getKey());
    if (++count[0] >= 20) {
      System.out.println();
      count[0]=0;
    }
 else {
      System.out.print("String_Node_Str");
    }
  }
);
  System.in.read();
}
Program: 55302
Project: 55302
Buggy source:
@NotNull private net.openhft.lang.io.Bytes toLangBytes(@NotNull BytesStore b){
  if (b.underlyingObject() == null)   return wrap(b.address(b.start()),b.readRemaining());
 else {
    final ByteBuffer buffer;
    if (b.underlyingObject() instanceof byte[])     buffer=ByteBuffer.wrap((byte[])b.underlyingObject());
 else     if (b.underlyingObject() instanceof ByteBuffer)     buffer=(ByteBuffer)b.underlyingObject();
 else     throw new UnsupportedOperationException("String_Node_Str" + "String_Node_Str" + b.underlyingObject().getClass());
    IByteBufferBytes wrap=ByteBufferBytes.wrap(buffer);
    wrap.limit((int)b.readLimit());
    return wrap;
  }
}

Fixed version (ground truth):
@NotNull private net.openhft.lang.io.Bytes toLangBytes(@NotNull BytesStore b){
  long l=b.readRemaining();
  int i=(int)b.readPosition();
  IByteBufferBytes wrap=ByteBufferBytes.wrap(ByteBuffer.allocate((int)l));
  wrap.clear();
  while (wrap.remaining() > 0) {
    wrap.writeByte(b.readByte(i++));
  }
  wrap.flip();
  return wrap;
}
Program: 55304
Project: 55304
Buggy source:
@Nullable private Bytes<Void> toValue(final @Nullable net.openhft.lang.io.Bytes value){
  if (value == null)   return null;
  NativeBytesStore<Void> byteStore=NativeBytesStore.lazyNativeBytesStoreWithFixedCapacity(value.remaining());
  PointerBytesStore result=valueLocal.get();
  result.set(value.address(),value.capacity());
  result.copyTo(byteStore);
  return byteStore.bytesForRead();
}

Fixed version (ground truth):
@Nullable private Bytes<Void> toValue(final @Nullable net.openhft.lang.io.Bytes value){
  if (value == null)   return null;
  if (value.remaining() == 0)   return null;
  final long position=value.position();
  try {
    NativeBytesStore<Void> byteStore=NativeBytesStore.nativeStoreWithFixedCapacity(value.remaining());
    int i=(int)value.position();
    while (value.remaining() > 0) {
      byteStore.writeByte(i++,value.readByte());
    }
    return byteStore.bytesForRead();
  }
  finally {
    value.position(position);
  }
}
Program: 55305
Project: 55305
Buggy source:
private Bytes toKey(final @NotNull net.openhft.lang.io.Bytes key){
  NativeBytesStore<Void> byteStore=NativeBytesStore.nativeStoreWithFixedCapacity(key.remaining());
  PointerBytesStore result=keyLocal.get();
  result.set(key.address(),key.capacity());
  result.copyTo(byteStore);
  return byteStore.bytesForRead();
}

Fixed version (ground truth):
private Bytes toKey(final @NotNull net.openhft.lang.io.Bytes key){
  final long position=key.position();
  try {
    NativeBytesStore<Void> byteStore=NativeBytesStore.nativeStoreWithFixedCapacity(key.remaining());
    int i=(int)key.position();
    while (key.remaining() > 0) {
      byteStore.writeByte(i++,key.readByte());
    }
    return byteStore.bytesForRead();
  }
  finally {
    key.position(position);
  }
}
Program: 55308
Project: 55308
Buggy source:
@Nullable private Bytes<Void> toValue(final @Nullable net.openhft.lang.io.Bytes value){
  if (value == null)   return null;
  NativeBytesStore<Void> byteStore=NativeBytesStore.nativeStoreWithFixedCapacity(value.remaining());
  int i=(int)value.position();
  while (value.remaining() > 0) {
    byteStore.writeByte(i++,(byte)value.readByte());
  }
  return byteStore.bytesForRead();
}

Fixed version (ground truth):
@Nullable private Bytes<Void> toValue(final @Nullable net.openhft.lang.io.Bytes value){
  if (value == null)   return null;
  final long position=value.position();
  try {
    NativeBytesStore<Void> byteStore=NativeBytesStore.nativeStoreWithFixedCapacity(value.remaining());
    int i=(int)value.position();
    while (value.remaining() > 0) {
      byteStore.writeByte(i++,value.readByte());
    }
    return byteStore.bytesForRead();
  }
  finally {
    value.position(position);
  }
}
Program: 55309
Project: 55309
Buggy source:
private Bytes toKey(final @NotNull net.openhft.lang.io.Bytes key){
  NativeBytesStore<Void> byteStore=NativeBytesStore.nativeStoreWithFixedCapacity(key.remaining());
  int i=(int)key.position();
  while (key.remaining() > 0) {
    byteStore.writeByte(i++,(byte)key.readByte());
  }
  return byteStore.bytesForRead();
}

Fixed version (ground truth):
private Bytes toKey(final @NotNull net.openhft.lang.io.Bytes key){
  final long position=key.position();
  try {
    NativeBytesStore<Void> byteStore=NativeBytesStore.nativeStoreWithFixedCapacity(key.remaining());
    int i=(int)key.position();
    while (key.remaining() > 0) {
      byteStore.writeByte(i++,key.readByte());
    }
    return byteStore.bytesForRead();
  }
  finally {
    key.position(position);
  }
}
Program: 55310
Project: 55310
Buggy source:
public static String generateValue(){
  char[] chars=new char[10];
  Arrays.fill(chars,'X');
  return new String(chars);
}

Fixed version (ground truth):
public static String generateValue(char c){
  char[] chars=new char[100];
  Arrays.fill(chars,c);
  return new String(chars);
}
Program: 55311
Project: 55311
Buggy source:
public void test() throws InterruptedException, IOException {
  String data=generateValue();
  final ConcurrentMap<String,String> map;
  final String type=System.getProperty("String_Node_Str","String_Node_Str");
  map=tree.acquireMap(NAME,String.class,String.class);
  if ("String_Node_Str".equals(type) || "String_Node_Str".equals(type)) {
    for (int i=0; i < entries; i++) {
      map.put(getKey(i),data);
    }
  }
  for (; ; ) {
    map.forEach((k,v) -> System.out.println("String_Node_Str" + k + "String_Node_Str"+ v));
    System.out.println("String_Node_Str");
    Thread.sleep(5000);
  }
}

Fixed version (ground truth):
public void test() throws InterruptedException, IOException {
  final ConcurrentMap<String,String> map;
  final String type=System.getProperty("String_Node_Str","String_Node_Str");
  map=tree.acquireMap(NAME,String.class,String.class);
  if ("String_Node_Str".equals(type)) {
    for (int i=0; i < entries; i++) {
      map.put(getKey(i),generateValue('1'));
    }
  }
  if ("String_Node_Str".equals(type)) {
    for (int i=0; i < entries; i++) {
      map.put(getKey(i),generateValue('5'));
    }
  }
  for (; ; ) {
    map.forEach((k,v) -> System.out.println("String_Node_Str" + k + "String_Node_Str"+ (v == null ? "String_Node_Str" : v.substring(1,v.length() < 50 ? v.length() : 50))));
    System.out.println("String_Node_Str");
    Thread.sleep(5000);
  }
}
Program: 55313
Project: 55313
Buggy source:
@Override public boolean action() throws InvalidEventHandlerException {
  if (hub.isOutBytesLocked())   return false;
  if (!hub.isOutBytesEmpty())   return false;
  if (ReplicationHub.this.isClosed.get())   throw new InvalidEventHandlerException();
  bytes.clear();
  if (!mi.hasNext()) {
    if (!hasSentLastUpdateTime && lastUpdateTime > 0) {
      wire.writeNotReadyDocument(false,wire -> {
        wire.writeEventName(CoreFields.lastUpdateTime).int64(lastUpdateTime);
        wire.write(() -> "String_Node_Str").int8(remoteIdentifier);
      }
);
      hasSentLastUpdateTime=true;
      if (!hasLogged) {
        System.out.println("String_Node_Str" + "String_Node_Str" + remoteIdentifier);
        hasLogged=true;
      }
      if (bytes.readRemaining() > 0) {
        ReplicationHub.this.sendBytes(bytes,false);
        return true;
      }
      return false;
    }
  }
  mi.nextEntry(e -> {
    long updateTime=Math.max(lastUpdateTime,e.timestamp());
    if (updateTime > lastUpdateTime) {
      hasSentLastUpdateTime=false;
      lastUpdateTime=updateTime;
    }
    wire.writeDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e));
  }
);
  if (bytes.readRemaining() > 0) {
    ReplicationHub.this.sendBytes(bytes,false);
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean action() throws InvalidEventHandlerException {
  if (hub.isOutBytesLocked())   return false;
  if (!hub.isOutBytesEmpty())   return false;
  if (ReplicationHub.this.isClosed.get())   throw new InvalidEventHandlerException();
  bytes.clear();
  if (!mi.hasNext()) {
    if (!hasSentLastUpdateTime && lastUpdateTime > 0) {
      wire.writeNotReadyDocument(false,wire -> {
        wire.writeEventName(CoreFields.lastUpdateTime).int64(lastUpdateTime);
        wire.write(() -> "String_Node_Str").int8(remoteIdentifier);
      }
);
      hasSentLastUpdateTime=true;
      if (!hasLogged) {
        System.out.println("String_Node_Str" + "String_Node_Str" + remoteIdentifier);
        hasLogged=true;
      }
      if (bytes.readRemaining() > 0) {
        ReplicationHub.this.sendBytes(bytes,false);
        return true;
      }
      return false;
    }
  }
  mi.nextEntry(e -> {
    long updateTime=Math.max(lastUpdateTime,e.timestamp());
    if (updateTime > lastUpdateTime) {
      hasSentLastUpdateTime=false;
      lastUpdateTime=updateTime;
    }
    wire.writeNotReadyDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e));
  }
);
  if (bytes.readRemaining() > 0) {
    ReplicationHub.this.sendBytes(bytes,false);
    return true;
  }
  return false;
}
Program: 55314
Project: 55314
Buggy source:
/** 
 * write and exceptions and rolls back if no data was written
 */
void writeData(@NotNull Bytes inBytes,@NotNull WriteMarshallable c){
  outWire.writeDocument(false,out -> {
    final long readPosition=inBytes.readPosition();
    final long position=outWire.bytes().writePosition();
    try {
      c.writeMarshallable(outWire);
    }
 catch (    Throwable t) {
      inBytes.readPosition(readPosition);
      if (LOG.isInfoEnabled())       LOG.info("String_Node_Str" + inBytes.toDebugString(),"String_Node_Str" + c,t);
      outWire.bytes().writePosition(position);
      outWire.writeEventName(() -> "String_Node_Str").throwable(t);
    }
    if (position == outWire.bytes().writePosition()) {
      outWire.writeEventName(reply).marshallable(EMPTY);
    }
  }
);
  logYaml();
}

Fixed version (ground truth):
/** 
 * write and exceptions and rolls back if no data was written
 */
void writeData(boolean isNotReady,@NotNull Bytes inBytes,@NotNull WriteMarshallable c){
  final WriteMarshallable marshallable=out -> {
    final long readPosition=inBytes.readPosition();
    final long position=outWire.bytes().writePosition();
    try {
      c.writeMarshallable(outWire);
    }
 catch (    Throwable t) {
      inBytes.readPosition(readPosition);
      if (LOG.isInfoEnabled())       LOG.info("String_Node_Str" + inBytes.toDebugString(),"String_Node_Str" + c,t);
      outWire.bytes().writePosition(position);
      outWire.writeEventName(() -> "String_Node_Str").throwable(t);
    }
    if (position == outWire.bytes().writePosition()) {
      outWire.writeEventName(reply).marshallable(EMPTY);
    }
  }
;
  if (isNotReady)   outWire.writeNotReadyDocument(false,marshallable);
 else   outWire.writeDocument(false,marshallable);
  logYaml();
}
Program: 55315
Project: 55315
Buggy source:
public void test() throws InterruptedException, IOException {
  YamlLogging.setAll(false);
  String data=generateValue();
  final ConcurrentMap<String,String> map;
  final String type=System.getProperty("String_Node_Str","String_Node_Str");
  map=tree.acquireMap(NAME,String.class,String.class);
  if ("String_Node_Str".equals(type)) {
    for (int i=0; i < entries; i++) {
      map.put(getKey(i),data);
    }
  }
  for (; ; ) {
    map.forEach((k,v) -> System.out.println("String_Node_Str" + k + "String_Node_Str"+ v));
    System.out.println("String_Node_Str");
    Thread.sleep(5000);
  }
}

Fixed version (ground truth):
public void test() throws InterruptedException, IOException {
  String data=generateValue();
  final ConcurrentMap<String,String> map;
  final String type=System.getProperty("String_Node_Str","String_Node_Str");
  map=tree.acquireMap(NAME,String.class,String.class);
  if ("String_Node_Str".equals(type) || "String_Node_Str".equals(type)) {
    for (int i=0; i < entries; i++) {
      map.put(getKey(i),data);
    }
  }
  for (; ; ) {
    map.forEach((k,v) -> System.out.println("String_Node_Str" + k + "String_Node_Str"+ v));
    System.out.println("String_Node_Str");
    Thread.sleep(5000);
  }
}
Program: 55316
Project: 55316
Buggy source:
@BeforeClass public static void before() throws IOException {
  YamlLogging.clientWrites=true;
  YamlLogging.clientReads=true;
  ClassAliasPool.CLASS_ALIASES.addAlias(ChronicleMapGroupFS.class);
  ClassAliasPool.CLASS_ALIASES.addAlias(FilePerKeyGroupFS.class);
  Files.deleteIfExists(Paths.get(OS.TARGET,NAME));
  WireType writeType=WireType.BINARY;
switch (System.getProperty("String_Node_Str","String_Node_Str")) {
case "String_Node_Str":
    tree=create(1,writeType,"String_Node_Str");
  serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=create(2,writeType,"String_Node_Str");
serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=create(3,writeType,"String_Node_Str");
serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=create(4,writeType,"String_Node_Str");
serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=create(5,writeType,"String_Node_Str");
serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=new VanillaAssetTree("String_Node_Str").forRemoteAccess("String_Node_Str",WIRE_TYPE);
}
}

Fixed version (ground truth):
@BeforeClass public static void before() throws IOException {
  YamlLogging.clientWrites=false;
  YamlLogging.clientReads=false;
  ClassAliasPool.CLASS_ALIASES.addAlias(ChronicleMapGroupFS.class);
  ClassAliasPool.CLASS_ALIASES.addAlias(FilePerKeyGroupFS.class);
  Files.deleteIfExists(Paths.get(OS.TARGET,NAME));
  WireType writeType=WireType.BINARY;
switch (System.getProperty("String_Node_Str","String_Node_Str")) {
case "String_Node_Str":
    tree=create(1,writeType,"String_Node_Str");
  serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=create(2,writeType,"String_Node_Str");
serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=create(3,writeType,"String_Node_Str");
serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=create(4,writeType,"String_Node_Str");
serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=create(5,writeType,"String_Node_Str");
serverEndpoint=new ServerEndpoint("String_Node_Str",tree,writeType);
break;
case "String_Node_Str":
tree=new VanillaAssetTree("String_Node_Str").forRemoteAccess("String_Node_Str",WIRE_TYPE);
}
}
Program: 55317
Project: 55317
Buggy source:
@Test public void testInsertFollowedByUpdateWhenPutReturnsNullTrue() throws Exception {
  final MapView<String,String> serverMap=serverAssetTree.acquireMap("String_Node_Str",String.class,String.class);
  final BlockingQueue<MapEvent> events=new ArrayBlockingQueue<>(128);
  clientAssetTree.registerSubscriber("String_Node_Str",MapEvent.class,events::add);
{
    serverMap.put("String_Node_Str","String_Node_Str");
    final MapEvent event=events.poll(10,SECONDS);
    Assert.assertTrue(event instanceof InsertedEvent);
  }
{
    serverMap.put("String_Node_Str","String_Node_Str");
    final MapEvent event=events.poll(10,SECONDS);
    Assert.assertTrue(event instanceof UpdatedEvent);
  }
}

Fixed version (ground truth):
@Test public void testInsertFollowedByUpdateWhenPutReturnsNullTrue() throws Exception {
  final MapView<String,String> serverMap=serverAssetTree.acquireMap("String_Node_Str",String.class,String.class);
  final BlockingQueue<MapEvent> events=new ArrayBlockingQueue<>(128);
  clientAssetTree.registerSubscriber("String_Node_Str",MapEvent.class,events::add);
  Jvm.pause(1000);
{
    serverMap.put("String_Node_Str","String_Node_Str");
    final MapEvent event=events.poll(10,SECONDS);
    Assert.assertTrue(event instanceof InsertedEvent);
  }
{
    serverMap.put("String_Node_Str","String_Node_Str");
    final MapEvent event=events.poll(10,SECONDS);
    Assert.assertTrue(event instanceof UpdatedEvent);
  }
}
Program: 55319
Project: 55319
Buggy source:
@Nullable @Override public V getAndPut(K key,V value){
  V oldValue=kvStore.getAndPut(key,value);
  subscriptions.notifyEvent(oldValue == null ? InsertedEvent.of(asset.fullName(),key,value,false) : UpdatedEvent.of(asset.fullName(),key,oldValue,value,false,oldValue.equals(value)));
  return oldValue;
}

Fixed version (ground truth):
@Nullable @Override public V getAndPut(K key,V value){
  V oldValue=kvStore.getAndPut(key,value);
  subscriptions.notifyEvent(oldValue == null ? InsertedEvent.of(asset.fullName(),key,value,false) : UpdatedEvent.of(asset.fullName(),key,oldValue,value,false,!oldValue.equals(value)));
  return oldValue;
}
Program: 55320
Project: 55320
Buggy source:
@Override public V replace(K key,V value){
  V oldValue=kvStore.replace(key,value);
  if (oldValue != null) {
    subscriptions.notifyEvent(UpdatedEvent.of(asset.fullName(),key,oldValue,value,false,value.equals(oldValue)));
  }
  return oldValue;
}

Fixed version (ground truth):
@Override public V replace(K key,V value){
  V oldValue=kvStore.replace(key,value);
  if (oldValue != null) {
    subscriptions.notifyEvent(UpdatedEvent.of(asset.fullName(),key,oldValue,value,false,!value.equals(oldValue)));
  }
  return oldValue;
}
Program: 55321
Project: 55321
Buggy source:
@Override public void applyReplication(@NotNull final ReplicationEntry entry){
  if (entry.isDeleted())   remove(entry);
 else   put(entry);
  setLastModificationTime(entry.identifier(),entry.bootStrapTimeStamp());
}

Fixed version (ground truth):
@Override public void applyReplication(@NotNull final ReplicationEntry entry){
  System.out.println("String_Node_Str");
  if (entry.isDeleted())   remove(entry);
 else   put(entry);
  System.out.println("String_Node_Str");
  setLastModificationTime(entry.identifier(),entry.bootStrapTimeStamp());
}
Program: 55322
Project: 55322
Buggy source:
/** 
 * publishes changes - this method pushes the replication events
 * @param mi     the modification iterator that notifies us of changes
 * @param remote details about the remote connection
 */
private void publish(@NotNull final ModificationIterator mi,@NotNull final Bootstrap remote){
  final TcpChannelHub hub=this.hub;
  mi.setModificationNotifier(eventLoop::unpause);
  eventLoop.addHandler(new EventHandler(){
    @Override public boolean action() throws InvalidEventHandlerException {
      try {
        if (ReplicationHub.this.isClosed.get())         throw new InvalidEventHandlerException();
        mi.nextEntry(e -> {
          ReplicationHub.this.sendEventAsync(replicationEvent,(Consumer<ValueOut>)v -> v.typedMarshallable(e),false);
        }
);
        return true;
      }
 catch (      ConnectionDroppedException e) {
        throw new InvalidEventHandlerException();
      }
catch (      IORuntimeException e) {
        LOG.error(e.getMessage());
        throw new InvalidEventHandlerException();
      }
    }
    public HandlerPriority priority(){
      return HandlerPriority.REPLICATION;
    }
  }
);
  mi.dirtyEntries(remote.lastUpdatedTime());
}

Fixed version (ground truth):
/** 
 * publishes changes - this method pushes the replication events
 * @param mi     the modification iterator that notifies us of changes
 * @param remote details about the remote connection
 */
private void publish(@NotNull final ModificationIterator mi,@NotNull final Bootstrap remote){
  final TcpChannelHub hub=this.hub;
  mi.setModificationNotifier(eventLoop::unpause);
  eventLoop.addHandler(new EventHandler(){
    final Bytes bytes=Bytes.elasticByteBuffer();
    final Wire wire=wireType.apply(bytes);
    @Override public boolean action() throws InvalidEventHandlerException {
      if (ReplicationHub.this.isClosed.get())       throw new InvalidEventHandlerException();
      bytes.clear();
      mi.nextEntry(e -> wire.writeDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e)));
      ReplicationHub.this.sendBytes(bytes,true);
      return true;
    }
    public HandlerPriority priority(){
      return HandlerPriority.REPLICATION;
    }
  }
);
  mi.dirtyEntries(remote.lastUpdatedTime());
}
Program: 55323
Project: 55323
Buggy source:
@Override public boolean action() throws InvalidEventHandlerException {
  try {
    if (ReplicationHub.this.isClosed.get())     throw new InvalidEventHandlerException();
    mi.nextEntry(e -> {
      ReplicationHub.this.sendEventAsync(replicationEvent,(Consumer<ValueOut>)v -> v.typedMarshallable(e),false);
    }
);
    return true;
  }
 catch (  ConnectionDroppedException e) {
    throw new InvalidEventHandlerException();
  }
catch (  IORuntimeException e) {
    LOG.error(e.getMessage());
    throw new InvalidEventHandlerException();
  }
}

Fixed version (ground truth):
@Override public boolean action() throws InvalidEventHandlerException {
  if (ReplicationHub.this.isClosed.get())   throw new InvalidEventHandlerException();
  bytes.clear();
  mi.nextEntry(e -> wire.writeDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e)));
  ReplicationHub.this.sendBytes(bytes,true);
  return true;
}
Program: 55324
Project: 55324
Buggy source:
public ReplicationHub(@NotNull RequestContext context,@NotNull final TcpChannelHub hub,@NotNull EventLoop eventLoop,@NotNull AtomicBoolean isClosed){
  super(hub,(long)0,toUri(context));
  this.eventLoop=eventLoop;
  this.isClosed=isClosed;
}

Fixed version (ground truth):
public ReplicationHub(@NotNull RequestContext context,@NotNull final TcpChannelHub hub,@NotNull EventLoop eventLoop,@NotNull AtomicBoolean isClosed,@NotNull Function<Bytes,Wire> wireType){
  super(hub,(long)0,toUri(context));
  this.eventLoop=eventLoop;
  this.isClosed=isClosed;
  this.wireType=wireType;
}
Program: 55325
Project: 55325
Buggy source:
@Ignore @Test public void test() throws InterruptedException {
  YamlLogging.setAll(false);
  char[] chars=new char[1048576 * 2];
  Arrays.fill(chars,'X');
  String data=new String(chars);
  final ConcurrentMap<String,String> map;
  final String type=System.getProperty("String_Node_Str","String_Node_Str");
  if ("String_Node_Str".equals(type)) {
    map=tree1.acquireMap(NAME,String.class,String.class);
  }
 else {
    map=tree2.acquireMap(NAME,String.class,String.class);
  }
  for (int i=0; i < 50; i++) {
    map.put("String_Node_Str" + i,data);
  }
  for (; ; ) {
    Thread.sleep(5000);
  }
}

Fixed version (ground truth):
@Test public void test() throws InterruptedException {
  YamlLogging.setAll(false);
  char[] chars=new char[(1 << 20) * 2];
  Arrays.fill(chars,'X');
  String data=new String(chars);
  final ConcurrentMap<String,String> map;
  final String type=System.getProperty("String_Node_Str","String_Node_Str");
  if ("String_Node_Str".equals(type)) {
    map=tree1.acquireMap(NAME,String.class,String.class);
  }
 else {
    map=tree2.acquireMap(NAME,String.class,String.class);
  }
  for (int i=0; i < 500; i++) {
    map.put("String_Node_Str" + i,data);
  }
  for (; ; ) {
    Thread.sleep(5000);
  }
}
Program: 55326
Project: 55326
Buggy source:
/** 
 * publishes changes - this method pushes the replication events
 * @param mi     the modification iterator that notifies us of changes
 * @param remote details about the remote connection
 */
private void publish(@NotNull final ModificationIterator mi,@NotNull final Bootstrap remote){
  final TcpChannelHub hub=this.hub;
  mi.setModificationNotifier(eventLoop::unpause);
  eventLoop.addHandler(new EventHandler(){
    final Bytes bytes=Bytes.elasticByteBuffer();
    final Wire wire=wireType.apply(bytes);
    @Override public boolean action() throws InvalidEventHandlerException {
      if (ReplicationHub.this.isClosed.get())       throw new InvalidEventHandlerException();
      bytes.clear();
      mi.nextEntry(e -> wire.writeDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e)));
      ReplicationHub.this.sendBytes(bytes,false);
      return true;
    }
    public HandlerPriority priority(){
      return HandlerPriority.REPLICATION;
    }
  }
);
  mi.dirtyEntries(remote.lastUpdatedTime());
}

Fixed version (ground truth):
/** 
 * publishes changes - this method pushes the replication events
 * @param mi     the modification iterator that notifies us of changes
 * @param remote details about the remote connection
 */
private void publish(@NotNull final ModificationIterator mi,@NotNull final Bootstrap remote){
  final TcpChannelHub hub=this.hub;
  mi.setModificationNotifier(eventLoop::unpause);
  eventLoop.addHandler(new EventHandler(){
    final Bytes bytes=Bytes.elasticByteBuffer();
    final Wire wire=wireType.apply(bytes);
    @Override public boolean action() throws InvalidEventHandlerException {
      if (!hub.outWireIsEmpty())       return true;
      if (ReplicationHub.this.isClosed.get())       throw new InvalidEventHandlerException();
      bytes.clear();
      mi.nextEntry(e -> wire.writeDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e)));
      if (bytes.readRemaining() > 0) {
        ReplicationHub.this.sendBytes(bytes,false);
        return true;
      }
      return false;
    }
    public HandlerPriority priority(){
      return HandlerPriority.REPLICATION;
    }
  }
);
  mi.dirtyEntries(remote.lastUpdatedTime());
}
Program: 55327
Project: 55327
Buggy source:
@Override public boolean action() throws InvalidEventHandlerException {
  if (ReplicationHub.this.isClosed.get())   throw new InvalidEventHandlerException();
  bytes.clear();
  mi.nextEntry(e -> wire.writeDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e)));
  ReplicationHub.this.sendBytes(bytes,false);
  return true;
}

Fixed version (ground truth):
@Override public boolean action() throws InvalidEventHandlerException {
  if (!hub.outWireIsEmpty())   return true;
  if (ReplicationHub.this.isClosed.get())   throw new InvalidEventHandlerException();
  bytes.clear();
  mi.nextEntry(e -> wire.writeDocument(false,wireOut -> wireOut.writeEventName(replicationEvent).typedMarshallable(e)));
  if (bytes.readRemaining() > 0) {
    ReplicationHub.this.sendBytes(bytes,false);
    return true;
  }
  return false;
}
Program: 55329
Project: 55329
Buggy source:
@Override public void onEndOfSubscription(){
  subscriptionEnded=true;
  if (!publisher.isClosed()) {
    WriteMarshallable toPublish=publish -> {
      publish.writeDocument(true,wire -> wire.writeEventName(CoreFields.tid).int64(tid));
      publish.writeDocument(false,wire -> wire.writeEventName(ObjectKVSubscriptionHandler.EventId.onEndOfSubscription).text("String_Node_Str"));
    }
;
    publisher.put(null,toPublish);
  }
}

Fixed version (ground truth):
@Override public void onEndOfSubscription(){
  subscriptionEnded=true;
synchronized (publisher) {
    if (!publisher.isClosed()) {
      WriteMarshallable toPublish=publish -> {
        publish.writeDocument(true,wire -> wire.writeEventName(CoreFields.tid).int64(tid));
        publish.writeDocument(false,wire -> wire.writeEventName(ObjectKVSubscriptionHandler.EventId.onEndOfSubscription).text("String_Node_Str"));
      }
;
      publisher.put(null,toPublish);
    }
  }
}