nus-yam/ex-repair huggingface dataset:
Program: 47912
Project: 47912
Buggy source:
private void send(ItemEvent event){
  if (endpoint.live()) {
    DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
    Data item=dataAwareItemEvent.getItemData();
    PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
    endpoint.sendEvent(portableItemEvent,getCallId());
  }
}

Fixed version (ground truth):
private void send(ItemEvent event){
  if (endpoint.live()) {
    if (!(event instanceof DataAwareItemEvent)) {
      throw new IllegalArgumentException("String_Node_Str" + event.getClass().getSimpleName());
    }
    DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
    Data item=dataAwareItemEvent.getItemData();
    PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
    endpoint.sendEvent(portableItemEvent,getCallId());
  }
}
Program: 47913
Project: 47913
Buggy source:
@Override public void onMessage(Message message){
  if (!endpoint.live()) {
    return;
  }
  DataAwareMessage dataAwareMessage=(DataAwareMessage)message;
  Data messageData=dataAwareMessage.getMessageData();
  String publisherUuid=message.getPublishingMember().getUuid();
  PortableMessage portableMessage=new PortableMessage(messageData,message.getPublishTime(),publisherUuid);
  endpoint.sendEvent(portableMessage,callId);
}

Fixed version (ground truth):
@Override public void onMessage(Message message){
  if (!endpoint.live()) {
    return;
  }
  if (!(message instanceof DataAwareMessage)) {
    throw new IllegalArgumentException("String_Node_Str" + message.getClass().getSimpleName());
  }
  DataAwareMessage dataAwareMessage=(DataAwareMessage)message;
  Data messageData=dataAwareMessage.getMessageData();
  String publisherUuid=message.getPublishingMember().getUuid();
  PortableMessage portableMessage=new PortableMessage(messageData,message.getPublishTime(),publisherUuid);
  endpoint.sendEvent(portableMessage,callId);
}
Program: 47914
Project: 47914
Buggy source:
protected HttpResponse request(RequestType reqType,String context,int serverPort,CookieStore cookieStore) throws Exception {
  if (reqType == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  HttpClient client=HttpClientBuilder.create().disableRedirectHandling().setDefaultCookieStore(cookieStore).build();
  HttpUriRequest request=null;
switch (reqType) {
case GET_REQUEST:
    request=new HttpGet("String_Node_Str" + serverPort + "String_Node_Str"+ context);
  break;
case POST_REQUEST:
request=new HttpPost("String_Node_Str" + serverPort + "String_Node_Str"+ context);
break;
default :
throw new IllegalArgumentException(reqType + "String_Node_Str");
}
HttpResponse response=client.execute(request);
return response;
}

Fixed version (ground truth):
protected HttpResponse request(RequestType reqType,String context,int serverPort,CookieStore cookieStore) throws Exception {
  if (reqType == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  HttpClient client=HttpClientBuilder.create().disableRedirectHandling().setDefaultCookieStore(cookieStore).build();
  HttpUriRequest request;
switch (reqType) {
case GET_REQUEST:
    request=new HttpGet("String_Node_Str" + serverPort + "String_Node_Str"+ context);
  break;
case POST_REQUEST:
request=new HttpPost("String_Node_Str" + serverPort + "String_Node_Str"+ context);
break;
default :
throw new IllegalArgumentException(reqType + "String_Node_Str");
}
return client.execute(request);
}
Program: 47915
Project: 47915
Buggy source:
@Before public void setup() throws Exception {
  final URL root=new URL(TestServlet.class.getResource("String_Node_Str"),"String_Node_Str");
  final String baseDir=new File(root.getFile().replaceAll("String_Node_Str","String_Node_Str")).toString();
  final String sourceDir=baseDir + "String_Node_Str";
  hz=Hazelcast.newHazelcastInstance(new FileSystemXmlConfig(new File(sourceDir + "String_Node_Str","String_Node_Str")));
  serverPort1=availablePort();
  server1=getServletContainer(serverPort1,sourceDir,serverXml1);
  if (serverXml2 != null) {
    serverPort2=availablePort();
    server2=getServletContainer(serverPort2,sourceDir,serverXml2);
  }
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  ContainerContext cc=CONTAINER_CONTEXT_MAP.get(getClass());
  if (cc == null) {
    ensureInstanceIsUp();
    CONTAINER_CONTEXT_MAP.put(getClass(),new ContainerContext(this,serverXml1,serverXml2,serverPort1,serverPort2,server1,server2,hz));
  }
 else {
    cc.copyInto(this);
    ensureInstanceIsUp();
    cc.copyFrom(this);
  }
  IMap<String,Object> map=hz.getMap(DEFAULT_MAP_NAME);
  map.clear();
}
Program: 47916
Project: 47916
Buggy source:
public void buildTomcat(int port,String sourceDir,String serverXml) throws LifecycleException {
  tomcat=new Tomcat();
  File baseDir=new File(System.getProperty("String_Node_Str"));
  tomcat.setPort(port);
  tomcat.setBaseDir(baseDir.getAbsolutePath());
  Context context=tomcat.addContext("String_Node_Str",sourceDir);
  context.getServletContext().setAttribute(Globals.ALT_DD_ATTR,sourceDir + "String_Node_Str" + serverXml);
  ContextConfig contextConfig=new ContextConfig();
  context.addLifecycleListener(contextConfig);
  context.setCookies(true);
  context.setBackgroundProcessorDelay(1);
  context.setReloadable(true);
  tomcat.getEngine().setJvmRoute("String_Node_Str" + port);
  tomcat.getEngine().setName("String_Node_Str" + port);
  tomcat.start();
}

Fixed version (ground truth):
public void buildTomcat(String sourceDir,String serverXml) throws LifecycleException {
  tomcat=new Tomcat();
  File baseDir=new File(System.getProperty("String_Node_Str"));
  tomcat.setPort(port);
  tomcat.setBaseDir(baseDir.getAbsolutePath());
  Context context=tomcat.addContext("String_Node_Str",sourceDir);
  context.getServletContext().setAttribute(Globals.ALT_DD_ATTR,sourceDir + "String_Node_Str" + serverXml);
  ContextConfig contextConfig=new ContextConfig();
  context.addLifecycleListener(contextConfig);
  context.setCookies(true);
  context.setBackgroundProcessorDelay(1);
  context.setReloadable(true);
  tomcat.getEngine().setJvmRoute("String_Node_Str" + port);
  tomcat.getEngine().setName("String_Node_Str" + port);
  tomcat.start();
  running=true;
}
Program: 47917
Project: 47917
Buggy source:
@Override public void stop() throws LifecycleException {
  tomcat.stop();
}

Fixed version (ground truth):
@Override public void stop() throws Exception {
  tomcat.stop();
  tomcat.destroy();
  running=false;
}
Program: 47918
Project: 47918
Buggy source:
@Override public void restart() throws LifecycleException, InterruptedException {
  int port=tomcat.getConnector().getLocalPort();
  tomcat.stop();
  tomcat.destroy();
  Thread.sleep(5000);
  buildTomcat(port,sourceDir,serverXml);
  Thread.sleep(5000);
}

Fixed version (ground truth):
@Override public void restart() throws Exception {
  stop();
  Thread.sleep(5000);
  start();
}
Program: 47919
Project: 47919
Buggy source:
@Override public void start() throws Exception {
  tomcat.start();
}

Fixed version (ground truth):
@Override public void start() throws Exception {
  buildTomcat(sourceDir,serverXml);
  running=true;
}
Program: 47920
Project: 47920
Buggy source:
public TomcatServer(int port,String sourceDir,String serverXml) throws Exception {
  this.serverXml=serverXml;
  this.sourceDir=sourceDir;
  buildTomcat(port,sourceDir,serverXml);
}

Fixed version (ground truth):
public TomcatServer(int port,String sourceDir,String serverXml) throws Exception {
  this.port=port;
  this.serverXml=serverXml;
  this.sourceDir=sourceDir;
  buildTomcat(sourceDir,serverXml);
}
Program: 47921
Project: 47921
Buggy source:
protected HttpResponse request(RequestType reqType,String context,int serverPort,CookieStore cookieStore) throws Exception {
  if (reqType == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  HttpClient client=HttpClientBuilder.create().disableRedirectHandling().setDefaultCookieStore(cookieStore).build();
  HttpUriRequest request=null;
switch (reqType) {
case GET_REQUEST:
    request=new HttpGet("String_Node_Str" + serverPort + "String_Node_Str"+ context);
  break;
case POST_REQUEST:
request=new HttpPost("String_Node_Str" + serverPort + "String_Node_Str"+ context);
break;
default :
throw new IllegalArgumentException(reqType + "String_Node_Str");
}
HttpResponse response=client.execute(request);
return response;
}

Fixed version (ground truth):
protected HttpResponse request(RequestType reqType,String context,int serverPort,CookieStore cookieStore) throws Exception {
  if (reqType == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  HttpClient client=HttpClientBuilder.create().disableRedirectHandling().setDefaultCookieStore(cookieStore).build();
  HttpUriRequest request;
switch (reqType) {
case GET_REQUEST:
    request=new HttpGet("String_Node_Str" + serverPort + "String_Node_Str"+ context);
  break;
case POST_REQUEST:
request=new HttpPost("String_Node_Str" + serverPort + "String_Node_Str"+ context);
break;
default :
throw new IllegalArgumentException(reqType + "String_Node_Str");
}
return client.execute(request);
}
Program: 47922
Project: 47922
Buggy source:
@Before public void setup() throws Exception {
  final URL root=new URL(TestServlet.class.getResource("String_Node_Str"),"String_Node_Str");
  final String baseDir=new File(root.getFile().replaceAll("String_Node_Str","String_Node_Str")).toString();
  final String sourceDir=baseDir + "String_Node_Str";
  hz=Hazelcast.newHazelcastInstance(new FileSystemXmlConfig(new File(sourceDir + "String_Node_Str","String_Node_Str")));
  serverPort1=availablePort();
  server1=getServletContainer(serverPort1,sourceDir,serverXml1);
  if (serverXml2 != null) {
    serverPort2=availablePort();
    server2=getServletContainer(serverPort2,sourceDir,serverXml2);
  }
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  ContainerContext cc=CONTAINER_CONTEXT_MAP.get(getClass());
  if (cc == null || isInstanceNotActive(cc.hz)) {
    buildInstance();
    CONTAINER_CONTEXT_MAP.put(getClass(),new ContainerContext(this,serverXml1,serverXml2,serverPort1,serverPort2,server1,server2,hz));
    if (cc == null) {
      onTestStart();
    }
    onContainerStart();
  }
 else {
    cc.copyInto(this);
  }
  IMap<String,Object> map=hz.getMap(DEFAULT_MAP_NAME);
  map.clear();
}
Program: 47923
Project: 47923
Buggy source:
@Test(timeout=20000) public void test_clusterMapSize() throws Exception {
  CookieStore cookieStore=new BasicCookieStore();
  IMap<String,Object> map=hz.getMap("String_Node_Str");
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  assertEquals(2,map.size());
}

Fixed version (ground truth):
@Test(timeout=20000) public void test_clusterMapSize() throws Exception {
  CookieStore cookieStore=new BasicCookieStore();
  IMap<String,Object> map=hz.getMap(DEFAULT_MAP_NAME);
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  assertEquals(2,map.size());
}
Program: 47924
Project: 47924
Buggy source:
@Test(timeout=20000) public void test_clusterMapSizeAfterRemove() throws Exception {
  CookieStore cookieStore=new BasicCookieStore();
  IMap<String,Object> map=hz.getMap("String_Node_Str");
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  executeRequest("String_Node_Str",serverPort2,cookieStore);
  assertEquals(1,map.size());
}

Fixed version (ground truth):
@Test(timeout=20000) public void test_clusterMapSizeAfterRemove() throws Exception {
  CookieStore cookieStore=new BasicCookieStore();
  IMap<String,Object> map=hz.getMap(DEFAULT_MAP_NAME);
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  executeRequest("String_Node_Str",serverPort2,cookieStore);
  assertEquals(1,map.size());
}
Program: 47925
Project: 47925
Buggy source:
@Test(timeout=20000) public void test_updateAttribute() throws Exception {
  IMap<String,Object> map=hz.getMap("String_Node_Str");
  CookieStore cookieStore=new BasicCookieStore();
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  executeRequest("String_Node_Str",serverPort2,cookieStore);
  assertEquals("String_Node_Str",executeRequest("String_Node_Str",serverPort1,cookieStore));
  assertSizeEventually(2,map);
}

Fixed version (ground truth):
@Test(timeout=20000) public void test_updateAttribute() throws Exception {
  IMap<String,Object> map=hz.getMap(DEFAULT_MAP_NAME);
  CookieStore cookieStore=new BasicCookieStore();
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  executeRequest("String_Node_Str",serverPort2,cookieStore);
  assertEquals("String_Node_Str",executeRequest("String_Node_Str",serverPort1,cookieStore));
  assertSizeEventually(2,map);
}
Program: 47926
Project: 47926
Buggy source:
@Test(timeout=20000) public void test_invalidateSession() throws Exception {
  IMap<String,Object> map=hz.getMap("String_Node_Str");
  CookieStore cookieStore=new BasicCookieStore();
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  executeRequest("String_Node_Str",serverPort2,cookieStore);
  assertSizeEventually(0,map);
}

Fixed version (ground truth):
@Test(timeout=20000) public void test_invalidateSession() throws Exception {
  IMap<String,Object> map=hz.getMap(DEFAULT_MAP_NAME);
  CookieStore cookieStore=new BasicCookieStore();
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  executeRequest("String_Node_Str",serverPort2,cookieStore);
  assertSizeEventually(0,map);
}
Program: 47927
Project: 47927
Buggy source:
@Test(timeout=20000) public void test_sessionTimeout() throws Exception {
  CookieStore cookieStore=new BasicCookieStore();
  IMap<String,Object> map=hz.getMap("String_Node_Str");
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  assertSizeEventually(0,map);
}

Fixed version (ground truth):
@Test(timeout=20000) public void test_sessionTimeout() throws Exception {
  CookieStore cookieStore=new BasicCookieStore();
  IMap<String,Object> map=hz.getMap(DEFAULT_MAP_NAME);
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  executeRequest("String_Node_Str",serverPort1,cookieStore);
  assertSizeEventually(0,map);
}
Program: 47928
Project: 47928
Buggy source:
@Test(timeout=130000) public void testSessionTimeout() throws Exception {
  IMap<String,Object> map=hz.getMap("String_Node_Str");
  CookieStore cookieStore=new BasicCookieStore();
  assertEquals("String_Node_Str",executeRequest("String_Node_Str",serverPort1,cookieStore));
  String sessionId=findHazelcastSessionId(map);
  assertEquals(2,map.size());
  assertEquals("String_Node_Str",1,((Integer)map.get(sessionId)).intValue());
  Thread.sleep(TimeUnit.SECONDS.toMillis(30L));
  assertEquals("String_Node_Str",executeRequest("String_Node_Str",serverPort2,cookieStore));
  assertEquals(2,map.size());
  assertEquals("String_Node_Str",2,((Integer)map.get(sessionId)).intValue());
  Thread.sleep(TimeUnit.SECONDS.toMillis(45));
  assertEquals(2,map.size());
  assertEquals("String_Node_Str",1,((Integer)map.get(sessionId)).intValue());
  Thread.sleep(TimeUnit.SECONDS.toMillis(30L));
  assertTrue("String_Node_Str",map.isEmpty());
}

Fixed version (ground truth):
@Test(timeout=130000) public void testSessionTimeout() throws Exception {
  IMap<String,Object> map=hz.getMap(DEFAULT_MAP_NAME);
  CookieStore cookieStore=new BasicCookieStore();
  assertEquals("String_Node_Str",executeRequest("String_Node_Str",serverPort1,cookieStore));
  String sessionId=findHazelcastSessionId(map);
  assertEquals(2,map.size());
  assertEquals("String_Node_Str",1,((Integer)map.get(sessionId)).intValue());
  Thread.sleep(TimeUnit.SECONDS.toMillis(30L));
  assertEquals("String_Node_Str",executeRequest("String_Node_Str",serverPort2,cookieStore));
  assertEquals(2,map.size());
  assertEquals("String_Node_Str",2,((Integer)map.get(sessionId)).intValue());
  Thread.sleep(TimeUnit.SECONDS.toMillis(45));
  assertEquals(2,map.size());
  assertEquals("String_Node_Str",1,((Integer)map.get(sessionId)).intValue());
  Thread.sleep(TimeUnit.SECONDS.toMillis(30L));
  assertTrue("String_Node_Str",map.isEmpty());
}
Program: 47929
Project: 47929
Buggy source:
protected HttpResponse request(RequestType reqType,String context,int serverPort,CookieStore cookieStore) throws Exception {
  if (reqType == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  HttpClient client=HttpClientBuilder.create().disableRedirectHandling().setDefaultCookieStore(cookieStore).build();
  HttpUriRequest request=null;
switch (reqType) {
case GET_REQUEST:
    request=new HttpGet("String_Node_Str" + serverPort + "String_Node_Str"+ context);
  break;
case POST_REQUEST:
request=new HttpPost("String_Node_Str" + serverPort + "String_Node_Str"+ context);
break;
default :
throw new IllegalArgumentException(reqType + "String_Node_Str");
}
HttpResponse response=client.execute(request);
return response;
}

Fixed version (ground truth):
protected HttpResponse request(RequestType reqType,String context,int serverPort,CookieStore cookieStore) throws Exception {
  if (reqType == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  HttpClient client=HttpClientBuilder.create().disableRedirectHandling().setDefaultCookieStore(cookieStore).build();
  HttpUriRequest request;
switch (reqType) {
case GET_REQUEST:
    request=new HttpGet("String_Node_Str" + serverPort + "String_Node_Str"+ context);
  break;
case POST_REQUEST:
request=new HttpPost("String_Node_Str" + serverPort + "String_Node_Str"+ context);
break;
default :
throw new IllegalArgumentException(reqType + "String_Node_Str");
}
return client.execute(request);
}
Program: 47930
Project: 47930
Buggy source:
@Before public void setup() throws Exception {
  final URL root=new URL(TestServlet.class.getResource("String_Node_Str"),"String_Node_Str");
  final String baseDir=new File(root.getFile().replaceAll("String_Node_Str","String_Node_Str")).toString();
  final String sourceDir=baseDir + "String_Node_Str";
  hz=Hazelcast.newHazelcastInstance(new FileSystemXmlConfig(new File(sourceDir + "String_Node_Str","String_Node_Str")));
  serverPort1=availablePort();
  server1=getServletContainer(serverPort1,sourceDir,serverXml1);
  if (serverXml2 != null) {
    serverPort2=availablePort();
    server2=getServletContainer(serverPort2,sourceDir,serverXml2);
  }
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  ContainerContext cc=CONTAINER_CONTEXT_MAP.get(getClass());
  if (cc == null) {
    ensureInstanceIsUp();
    CONTAINER_CONTEXT_MAP.put(getClass(),new ContainerContext(this,serverXml1,serverXml2,serverPort1,serverPort2,server1,server2,hz));
  }
 else {
    cc.copyInto(this);
    ensureInstanceIsUp();
    cc.copyFrom(this);
  }
  IMap<String,Object> map=hz.getMap(DEFAULT_MAP_NAME);
  map.clear();
}
Program: 47931
Project: 47931
Buggy source:
public void buildTomcat(int port,String sourceDir,String serverXml) throws LifecycleException {
  tomcat=new Tomcat();
  File baseDir=new File(System.getProperty("String_Node_Str"));
  tomcat.setPort(port);
  tomcat.setBaseDir(baseDir.getAbsolutePath());
  Context context=tomcat.addContext("String_Node_Str",sourceDir);
  context.getServletContext().setAttribute(Globals.ALT_DD_ATTR,sourceDir + "String_Node_Str" + serverXml);
  ContextConfig contextConfig=new ContextConfig();
  context.addLifecycleListener(contextConfig);
  context.setCookies(true);
  context.setBackgroundProcessorDelay(1);
  context.setReloadable(true);
  tomcat.getEngine().setJvmRoute("String_Node_Str" + port);
  tomcat.getEngine().setName("String_Node_Str" + port);
  tomcat.start();
}

Fixed version (ground truth):
public void buildTomcat(int port,String sourceDir,String serverXml) throws LifecycleException {
  tomcat=new Tomcat();
  File baseDir=new File(System.getProperty("String_Node_Str"));
  tomcat.setPort(port);
  tomcat.setBaseDir(baseDir.getAbsolutePath());
  Context context=tomcat.addContext("String_Node_Str",sourceDir);
  context.getServletContext().setAttribute(Globals.ALT_DD_ATTR,sourceDir + "String_Node_Str" + serverXml);
  ContextConfig contextConfig=new ContextConfig();
  context.addLifecycleListener(contextConfig);
  context.setCookies(true);
  context.setBackgroundProcessorDelay(1);
  context.setReloadable(true);
  tomcat.getEngine().setJvmRoute("String_Node_Str" + port);
  tomcat.getEngine().setName("String_Node_Str" + port);
  tomcat.start();
  running=true;
}
Program: 47932
Project: 47932
Buggy source:
@Override public void stop() throws LifecycleException {
  tomcat.stop();
}

Fixed version (ground truth):
@Override public void stop() throws LifecycleException {
  tomcat.stop();
  running=false;
}
Program: 47933
Project: 47933
Buggy source:
@Override public void restart() throws LifecycleException, InterruptedException {
  int port=tomcat.getConnector().getLocalPort();
  tomcat.stop();
  tomcat.destroy();
  Thread.sleep(5000);
  buildTomcat(port,sourceDir,serverXml);
  Thread.sleep(5000);
}

Fixed version (ground truth):
@Override public void restart() throws LifecycleException, InterruptedException {
  int port=tomcat.getConnector().getLocalPort();
  tomcat.stop();
  running=false;
  tomcat.destroy();
  Thread.sleep(5000);
  buildTomcat(port,sourceDir,serverXml);
  Thread.sleep(5000);
  running=true;
}
Program: 47934
Project: 47934
Buggy source:
@Override public void start() throws Exception {
  tomcat.start();
}

Fixed version (ground truth):
@Override public void start() throws Exception {
  tomcat.start();
  running=true;
}
Program: 47935
Project: 47935
Buggy source:
private ItemListener createItemListener(final ClientEndpoint endpoint){
  return new ItemListener(){
    @Override public void itemAdded(    ItemEvent item){
      send(item);
    }
    @Override public void itemRemoved(    ItemEvent item){
      send(item);
    }
    private void send(    ItemEvent event){
      if (endpoint.live()) {
        DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
        Data item=dataAwareItemEvent.getItemData();
        PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
        endpoint.sendEvent(portableItemEvent,getCallId());
      }
    }
  }
;
}

Fixed version (ground truth):
private ItemListener createItemListener(final ClientEndpoint endpoint){
  return new ItemListener(){
    @Override public void itemAdded(    ItemEvent item){
      send(item);
    }
    @Override public void itemRemoved(    ItemEvent item){
      send(item);
    }
    private void send(    ItemEvent event){
      if (endpoint.live()) {
        if (!(event instanceof DataAwareItemEvent)) {
          throw new IllegalArgumentException("String_Node_Str" + event.getClass().getSimpleName());
        }
        DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
        Data item=dataAwareItemEvent.getItemData();
        PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
        endpoint.sendEvent(portableItemEvent,getCallId());
      }
    }
  }
;
}
Program: 47936
Project: 47936
Buggy source:
private void send(ItemEvent event){
  if (endpoint.live()) {
    DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
    Data item=dataAwareItemEvent.getItemData();
    PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
    endpoint.sendEvent(portableItemEvent,getCallId());
  }
}

Fixed version (ground truth):
private void send(ItemEvent event){
  if (endpoint.live()) {
    if (!(event instanceof DataAwareItemEvent)) {
      throw new IllegalArgumentException("String_Node_Str" + event.getClass().getSimpleName());
    }
    DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
    Data item=dataAwareItemEvent.getItemData();
    PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
    endpoint.sendEvent(portableItemEvent,getCallId());
  }
}
Program: 47938
Project: 47938
Buggy source:
@Override public void onEntryEvent(EntryEvent<Object,Object> event){
  DataAwareEntryEvent dataAwareEntryEvent=(DataAwareEntryEvent)event;
  if (endpoint.live()) {
    Data key=dataAwareEntryEvent.getKeyData();
    Data value=dataAwareEntryEvent.getNewValueData();
    Data oldValue=dataAwareEntryEvent.getOldValueData();
    PortableEntryEvent portableEntryEvent=new PortableEntryEvent(key,value,oldValue,event.getEventType(),event.getMember().getUuid());
    endpoint.sendEvent(portableEntryEvent,getCallId());
  }
}

Fixed version (ground truth):
@Override public void onEntryEvent(EntryEvent<Object,Object> event){
  if (endpoint.live()) {
    if (!(event instanceof DataAwareEntryEvent)) {
      throw new IllegalArgumentException("String_Node_Str" + event.getClass().getSimpleName());
    }
    DataAwareEntryEvent dataAwareEntryEvent=(DataAwareEntryEvent)event;
    Data key=dataAwareEntryEvent.getKeyData();
    Data value=dataAwareEntryEvent.getNewValueData();
    Data oldValue=dataAwareEntryEvent.getOldValueData();
    PortableEntryEvent portableEntryEvent=new PortableEntryEvent(key,value,oldValue,event.getEventType(),event.getMember().getUuid());
    endpoint.sendEvent(portableEntryEvent,getCallId());
  }
}
Program: 47939
Project: 47939
Buggy source:
@Override public void onEntryEvent(EntryEvent event){
  if (endpoint.live()) {
    DataAwareEntryEvent dataAwareEntryEvent=(DataAwareEntryEvent)event;
    Data key=dataAwareEntryEvent.getKeyData();
    Data value=dataAwareEntryEvent.getNewValueData();
    final EntryEventType type=event.getEventType();
    final String uuid=event.getMember().getUuid();
    PortableEntryEvent portableEntryEvent=new PortableEntryEvent(key,value,null,type,uuid);
    endpoint.sendEvent(portableEntryEvent,getCallId());
  }
}

Fixed version (ground truth):
@Override public void onEntryEvent(EntryEvent event){
  if (endpoint.live()) {
    if (!(event instanceof DataAwareEntryEvent)) {
      throw new IllegalArgumentException("String_Node_Str" + event.getClass().getSimpleName());
    }
    DataAwareEntryEvent dataAwareEntryEvent=(DataAwareEntryEvent)event;
    Data key=dataAwareEntryEvent.getKeyData();
    Data value=dataAwareEntryEvent.getNewValueData();
    final EntryEventType type=event.getEventType();
    final String uuid=event.getMember().getUuid();
    PortableEntryEvent portableEntryEvent=new PortableEntryEvent(key,value,null,type,uuid);
    endpoint.sendEvent(portableEntryEvent,getCallId());
  }
}
Program: 47940
Project: 47940
Buggy source:
public Object call() throws Exception {
  final ClientEndpoint endpoint=getEndpoint();
  final MultiMapService service=getService();
  EntryListener listener=new EntryAdapter(){
    @Override public void onEntryEvent(    EntryEvent event){
      if (endpoint.live()) {
        DataAwareEntryEvent dataAwareEntryEvent=(DataAwareEntryEvent)event;
        Data key=dataAwareEntryEvent.getKeyData();
        Data value=dataAwareEntryEvent.getNewValueData();
        final EntryEventType type=event.getEventType();
        final String uuid=event.getMember().getUuid();
        PortableEntryEvent portableEntryEvent=new PortableEntryEvent(key,value,null,type,uuid);
        endpoint.sendEvent(portableEntryEvent,getCallId());
      }
    }
    @Override public void onMapEvent(    MapEvent event){
      if (endpoint.live()) {
        final EntryEventType type=event.getEventType();
        final String uuid=event.getMember().getUuid();
        PortableEntryEvent portableEntryEvent=new PortableEntryEvent(type,uuid,event.getNumberOfEntriesAffected());
        endpoint.sendEvent(portableEntryEvent,getCallId());
      }
    }
  }
;
  String registrationId=service.addListener(name,listener,key,includeValue,false);
  endpoint.setListenerRegistration(MultiMapService.SERVICE_NAME,name,registrationId);
  return registrationId;
}

Fixed version (ground truth):
public Object call() throws Exception {
  final ClientEndpoint endpoint=getEndpoint();
  final MultiMapService service=getService();
  EntryListener listener=new EntryAdapter(){
    @Override public void onEntryEvent(    EntryEvent event){
      if (endpoint.live()) {
        if (!(event instanceof DataAwareEntryEvent)) {
          throw new IllegalArgumentException("String_Node_Str" + event.getClass().getSimpleName());
        }
        DataAwareEntryEvent dataAwareEntryEvent=(DataAwareEntryEvent)event;
        Data key=dataAwareEntryEvent.getKeyData();
        Data value=dataAwareEntryEvent.getNewValueData();
        final EntryEventType type=event.getEventType();
        final String uuid=event.getMember().getUuid();
        PortableEntryEvent portableEntryEvent=new PortableEntryEvent(key,value,null,type,uuid);
        endpoint.sendEvent(portableEntryEvent,getCallId());
      }
    }
    @Override public void onMapEvent(    MapEvent event){
      if (endpoint.live()) {
        final EntryEventType type=event.getEventType();
        final String uuid=event.getMember().getUuid();
        PortableEntryEvent portableEntryEvent=new PortableEntryEvent(type,uuid,event.getNumberOfEntriesAffected());
        endpoint.sendEvent(portableEntryEvent,getCallId());
      }
    }
  }
;
  String registrationId=service.addListener(name,listener,key,includeValue,false);
  endpoint.setListenerRegistration(MultiMapService.SERVICE_NAME,name,registrationId);
  return registrationId;
}
Program: 47941
Project: 47941
Buggy source:
@Override public Object call() throws Exception {
  final ClientEndpoint endpoint=getEndpoint();
  final QueueService service=getService();
  ItemListener listener=new ItemListener(){
    @Override public void itemAdded(    ItemEvent item){
      send(item);
    }
    @Override public void itemRemoved(    ItemEvent item){
      send(item);
    }
    private void send(    ItemEvent event){
      if (endpoint.live()) {
        DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
        Data item=dataAwareItemEvent.getItemData();
        PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
        endpoint.sendEvent(portableItemEvent,getCallId());
      }
    }
  }
;
  String registrationId=service.addItemListener(name,listener,includeValue);
  endpoint.setListenerRegistration(QueueService.SERVICE_NAME,name,registrationId);
  return registrationId;
}

Fixed version (ground truth):
@Override public Object call() throws Exception {
  final ClientEndpoint endpoint=getEndpoint();
  final QueueService service=getService();
  ItemListener listener=new ItemListener(){
    @Override public void itemAdded(    ItemEvent item){
      send(item);
    }
    @Override public void itemRemoved(    ItemEvent item){
      send(item);
    }
    private void send(    ItemEvent event){
      if (endpoint.live()) {
        if (!(event instanceof DataAwareItemEvent)) {
          throw new IllegalArgumentException("String_Node_Str" + event.getClass().getSimpleName());
        }
        DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
        Data item=dataAwareItemEvent.getItemData();
        PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
        endpoint.sendEvent(portableItemEvent,getCallId());
      }
    }
  }
;
  String registrationId=service.addItemListener(name,listener,includeValue);
  endpoint.setListenerRegistration(QueueService.SERVICE_NAME,name,registrationId);
  return registrationId;
}
Program: 47942
Project: 47942
Buggy source:
private void send(ItemEvent event){
  if (endpoint.live()) {
    DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
    Data item=dataAwareItemEvent.getItemData();
    PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
    endpoint.sendEvent(portableItemEvent,getCallId());
  }
}

Fixed version (ground truth):
private void send(ItemEvent event){
  if (endpoint.live()) {
    if (!(event instanceof DataAwareItemEvent)) {
      throw new IllegalArgumentException("String_Node_Str" + event.getClass().getSimpleName());
    }
    DataAwareItemEvent dataAwareItemEvent=(DataAwareItemEvent)event;
    Data item=dataAwareItemEvent.getItemData();
    PortableItemEvent portableItemEvent=new PortableItemEvent(item,event.getEventType(),event.getMember().getUuid());
    endpoint.sendEvent(portableItemEvent,getCallId());
  }
}
Program: 47943
Project: 47943
Buggy source:
@Override public void onMessage(Message message){
  if (!endpoint.live()) {
    return;
  }
  DataAwareMessage dataAwareMessage=(DataAwareMessage)message;
  Data messageData=dataAwareMessage.getMessageData();
  String publisherUuid=message.getPublishingMember().getUuid();
  PortableMessage portableMessage=new PortableMessage(messageData,message.getPublishTime(),publisherUuid);
  endpoint.sendEvent(portableMessage,callId);
}

Fixed version (ground truth):
@Override public void onMessage(Message message){
  if (!endpoint.live()) {
    return;
  }
  if (!(message instanceof DataAwareMessage)) {
    throw new IllegalArgumentException("String_Node_Str" + message.getClass().getSimpleName());
  }
  DataAwareMessage dataAwareMessage=(DataAwareMessage)message;
  Data messageData=dataAwareMessage.getMessageData();
  String publisherUuid=message.getPublishingMember().getUuid();
  PortableMessage portableMessage=new PortableMessage(messageData,message.getPublishTime(),publisherUuid);
  endpoint.sendEvent(portableMessage,callId);
}
Program: 47944
Project: 47944
Buggy source:
public boolean resend(){
  if (request.isSingleConnection()) {
    return false;
  }
  if (handler == null && reSendCount.incrementAndGet() > retryCount) {
    return false;
  }
  sleep();
  executionService.execute(new ReSendTask());
  return true;
}

Fixed version (ground truth):
public boolean resend(){
  if (request.isSingleConnection()) {
    return false;
  }
  if (handler == null && reSendCount.incrementAndGet() > retryCount) {
    return false;
  }
  executionService.schedule(new ReSendTask(),retryWaitTime,TimeUnit.MILLISECONDS);
  return true;
}
Program: 47945
Project: 47945
Buggy source:
/** 
 * Used if inner predicate is instanceof   {@link IndexAwarePredicate} for checking if indexed
 * @param queryContext
 * @return
 */
@Override public boolean isIndexed(QueryContext queryContext){
  if (predicate instanceof IndexAwarePredicate) {
    return ((IndexAwarePredicate)predicate).isIndexed(queryContext);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Used if inner predicate is instanceof   {@link IndexAwarePredicate} for checking if indexed
 * @param queryContext
 * @return
 */
public boolean isIndexed(QueryContext queryContext){
  if (predicate instanceof IndexAwarePredicate) {
    return ((IndexAwarePredicate)predicate).isIndexed(queryContext);
  }
  return false;
}
Program: 47946
Project: 47946
Buggy source:
@Override public void readData(ObjectDataInput in) throws IOException {
  predicate=in.readObject();
  comparator=in.readObject();
  page=in.readInt();
  pageSize=in.readInt();
  iterationType=IterationType.valueOf(in.readUTF());
  int size=in.readInt();
  for (int i=0; i < size; i++) {
    final int key=in.readInt();
    final Object anchorKey=in.readObject();
    final Object anchorValue=in.readObject();
    anchorMap.put(key,new AbstractMap.SimpleImmutableEntry(anchorKey,anchorValue));
  }
}

Fixed version (ground truth):
public void readData(ObjectDataInput in) throws IOException {
  predicate=in.readObject();
  comparator=in.readObject();
  page=in.readInt();
  pageSize=in.readInt();
  iterationType=IterationType.valueOf(in.readUTF());
  int size=in.readInt();
  for (int i=0; i < size; i++) {
    final int key=in.readInt();
    final Object anchorKey=in.readObject();
    final Object anchorValue=in.readObject();
    anchorMap.put(key,new AbstractMap.SimpleImmutableEntry(anchorKey,anchorValue));
  }
}
Program: 47947
Project: 47947
Buggy source:
/** 
 * Used for delegating filtering to inner predicate
 * @param mapEntry
 * @return
 */
@Override public boolean apply(Map.Entry mapEntry){
  if (predicate != null) {
    return predicate.apply(mapEntry);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Used for delegating filtering to inner predicate
 * @param mapEntry
 * @return
 */
public boolean apply(Map.Entry mapEntry){
  if (predicate != null) {
    return predicate.apply(mapEntry);
  }
  return true;
}
Program: 47948
Project: 47948
Buggy source:
@Override public void writeData(ObjectDataOutput out) throws IOException {
  out.writeObject(predicate);
  out.writeObject(comparator);
  out.writeInt(page);
  out.writeInt(pageSize);
  out.writeUTF(iterationType.name());
  out.writeInt(anchorMap.size());
  for (  Map.Entry<Integer,Map.Entry> entry : anchorMap.entrySet()) {
    out.writeInt(entry.getKey());
    final Map.Entry anchorEntry=entry.getValue();
    out.writeObject(anchorEntry.getKey());
    out.writeObject(anchorEntry.getValue());
  }
}

Fixed version (ground truth):
public void writeData(ObjectDataOutput out) throws IOException {
  out.writeObject(predicate);
  out.writeObject(comparator);
  out.writeInt(page);
  out.writeInt(pageSize);
  out.writeUTF(iterationType.name());
  out.writeInt(anchorMap.size());
  for (  Map.Entry<Integer,Map.Entry> entry : anchorMap.entrySet()) {
    out.writeInt(entry.getKey());
    final Map.Entry anchorEntry=entry.getValue();
    out.writeObject(anchorEntry.getKey());
    out.writeObject(anchorEntry.getValue());
  }
}
Program: 47949
Project: 47949
Buggy source:
/** 
 * Used if inner predicate is instanceof   {@link IndexAwarePredicate} for filtering
 * @param queryContext
 * @return
 */
@Override public Set<QueryableEntry> filter(QueryContext queryContext){
  if (predicate instanceof IndexAwarePredicate) {
    Set<QueryableEntry> set=((IndexAwarePredicate)predicate).filter(queryContext);
    if (set == null) {
      return null;
    }
    List<QueryableEntry> list=new LinkedList<QueryableEntry>();
    Map.Entry anchor=getAnchor();
    for (    QueryableEntry entry : set) {
      if (anchor != null && SortingUtil.compare(comparator,iterationType,anchor,entry) >= 0) {
        continue;
      }
      list.add(entry);
    }
    Collections.sort(list,SortingUtil.newComparator(this));
    if (list.size() > pageSize) {
      list=list.subList(0,pageSize);
    }
    return new LinkedHashSet<QueryableEntry>(list);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Used if inner predicate is instanceof   {@link IndexAwarePredicate} for filtering
 * @param queryContext
 * @return
 */
public Set<QueryableEntry> filter(QueryContext queryContext){
  if (predicate instanceof IndexAwarePredicate) {
    Set<QueryableEntry> set=((IndexAwarePredicate)predicate).filter(queryContext);
    if (set == null) {
      return null;
    }
    List<QueryableEntry> list=new LinkedList<QueryableEntry>();
    Map.Entry anchor=getAnchor();
    for (    QueryableEntry entry : set) {
      if (SortingUtil.isSuitableForCompare(comparator,iterationType,entry)) {
        if (anchor != null && SortingUtil.compare(comparator,iterationType,anchor,entry) >= 0) {
          continue;
        }
        list.add(entry);
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
      }
    }
    if (list.isEmpty()) {
      return null;
    }
    Collections.sort(list,SortingUtil.newComparator(this));
    if (list.size() > pageSize) {
      list=list.subList(0,pageSize);
    }
    return new LinkedHashSet<QueryableEntry>(list);
  }
  return null;
}
Program: 47950
Project: 47950
Buggy source:
/** 
 * Retrieve the anchor object which is the last value object on the previous page. Note: This method will return `null` on the first page of the query result.
 * @return Map.Entry
 */
public Map.Entry getAnchor(){
  return anchorMap.get(page);
}

Fixed version (ground truth):
public Map.Entry getAnchor(){
  return anchorMap.get(page);
}
Program: 47951
Project: 47951
Buggy source:
/** 
 * Used if inner predicate is instanceof   {@link IndexAwarePredicate} for filtering
 * @param queryContext
 * @return
 */
public Set<QueryableEntry> filter(QueryContext queryContext){
  if (predicate instanceof IndexAwarePredicate) {
    Set<QueryableEntry> set=((IndexAwarePredicate)predicate).filter(queryContext);
    if (set == null) {
      return null;
    }
    List<QueryableEntry> list=new LinkedList<QueryableEntry>();
    Map.Entry anchor=getAnchor();
    for (    QueryableEntry entry : set) {
      if (anchor != null && SortingUtil.compare(comparator,iterationType,anchor,entry) >= 0) {
        continue;
      }
      list.add(entry);
    }
    Collections.sort(list,SortingUtil.newComparator(this));
    if (list.size() > pageSize) {
      list=list.subList(0,pageSize);
    }
    return new LinkedHashSet<QueryableEntry>(list);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Used if inner predicate is instanceof   {@link IndexAwarePredicate} for filtering
 * @param queryContext
 * @return
 */
public Set<QueryableEntry> filter(QueryContext queryContext){
  if (predicate instanceof IndexAwarePredicate) {
    Set<QueryableEntry> set=((IndexAwarePredicate)predicate).filter(queryContext);
    if (set == null) {
      return null;
    }
    List<QueryableEntry> list=new LinkedList<QueryableEntry>();
    Map.Entry anchor=getAnchor();
    for (    QueryableEntry entry : set) {
      if (SortingUtil.isSuitableForCompare(comparator,iterationType,entry)) {
        if (anchor != null && SortingUtil.compare(comparator,iterationType,anchor,entry) >= 0) {
          continue;
        }
        list.add(entry);
      }
    }
    if (list.isEmpty()) {
      return null;
    }
    Collections.sort(list,SortingUtil.newComparator(this));
    if (list.size() > pageSize) {
      list=list.subList(0,pageSize);
    }
    return new LinkedHashSet<QueryableEntry>(list);
  }
  return null;
}
Program: 47952
Project: 47952
Buggy source:
/** 
 * Used if inner predicate is instanceof   {@link IndexAwarePredicate} for filtering
 * @param queryContext
 * @return
 */
public Set<QueryableEntry> filter(QueryContext queryContext){
  if (predicate instanceof IndexAwarePredicate) {
    Set<QueryableEntry> set=((IndexAwarePredicate)predicate).filter(queryContext);
    if (set == null) {
      return null;
    }
    List<QueryableEntry> list=new LinkedList<QueryableEntry>();
    Map.Entry anchor=getAnchor();
    for (    QueryableEntry entry : set) {
      if (SortingUtil.isSuitableForCompare(comparator,iterationType,entry)) {
        if (anchor != null && SortingUtil.compare(comparator,iterationType,anchor,entry) >= 0) {
          continue;
        }
        list.add(entry);
      }
    }
    if (list.isEmpty()) {
      return null;
    }
    Collections.sort(list,SortingUtil.newComparator(this));
    if (list.size() > pageSize) {
      list=list.subList(0,pageSize);
    }
    return new LinkedHashSet<QueryableEntry>(list);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Used if inner predicate is instanceof   {@link IndexAwarePredicate} for filtering
 * @param queryContext
 * @return
 */
public Set<QueryableEntry> filter(QueryContext queryContext){
  if (predicate instanceof IndexAwarePredicate) {
    Set<QueryableEntry> set=((IndexAwarePredicate)predicate).filter(queryContext);
    if (set == null) {
      return null;
    }
    List<QueryableEntry> list=new LinkedList<QueryableEntry>();
    Map.Entry anchor=getAnchor();
    for (    QueryableEntry entry : set) {
      if (SortingUtil.isSuitableForCompare(comparator,iterationType,entry)) {
        if (anchor != null && SortingUtil.compare(comparator,iterationType,anchor,entry) >= 0) {
          continue;
        }
        list.add(entry);
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
      }
    }
    if (list.isEmpty()) {
      return null;
    }
    Collections.sort(list,SortingUtil.newComparator(this));
    if (list.size() > pageSize) {
      list=list.subList(0,pageSize);
    }
    return new LinkedHashSet<QueryableEntry>(list);
  }
  return null;
}
Program: 47953
Project: 47953
Buggy source:
@Test(expected=IllegalStateException.class) public void testAwait_whenInstanceShutdown_thenLatchOpened() throws InterruptedException {
  TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(1);
  final HazelcastInstance instance=factory.newHazelcastInstance(new Config());
  ICountDownLatch latch=instance.getCountDownLatch(randomString());
  latch.trySetCount(10);
  Thread thread=(new Thread(){
    public void run(){
      instance.shutdown();
    }
  }
);
  thread.start();
  assertOpenEventually(latch);
}

Fixed version (ground truth):
@Test public void testAwait_whenInstanceShutdown_thenLatchOpened() throws InterruptedException {
  HazelcastInstance instance=createHazelcastInstance();
  final ICountDownLatch latch=instance.getCountDownLatch(randomString());
  latch.trySetCount(10);
  final TestThread awaitThread=new TestThread(){
    @Override public void doRun() throws Exception {
      latch.await(1,TimeUnit.HOURS);
    }
  }
;
  awaitThread.start();
  sleepSeconds(5);
  instance.shutdown();
  awaitThread.assertFailsEventually(HazelcastInstanceNotActiveException.class);
}
Program: 47954
Project: 47954
Buggy source:
@Test public void testDestroy(){
  final HazelcastInstance instance=createHazelcastInstance();
  ICountDownLatch latch=instance.getCountDownLatch(randomString());
  NodeEngineImpl nodeEngine=getNode(instance).getNodeEngine();
  CountDownLatchService service=nodeEngine.getService(CountDownLatchService.SERVICE_NAME);
  latch.destroy();
  assertFalse(service.containsLatch(latch.getName()));
}

Fixed version (ground truth):
@Test public void testDestroy(){
  HazelcastInstance instance=createHazelcastInstance();
  ICountDownLatch latch=instance.getCountDownLatch(randomString());
  NodeEngineImpl nodeEngine=getNode(instance).getNodeEngine();
  CountDownLatchService service=nodeEngine.getService(CountDownLatchService.SERVICE_NAME);
  latch.destroy();
  assertFalse(service.containsLatch(latch.getName()));
}
Program: 47955
Project: 47955
Buggy source:
@Test public void testTrySetCount_whenPositive(){
  final HazelcastInstance instance=createHazelcastInstance();
  ICountDownLatch latch=instance.getCountDownLatch(randomString());
  latch.trySetCount(10);
  assertFalse(latch.trySetCount(20));
  assertEquals(10,latch.getCount());
}

Fixed version (ground truth):
@Test public void testTrySetCount_whenPositive(){
  HazelcastInstance instance=createHazelcastInstance();
  ICountDownLatch latch=instance.getCountDownLatch(randomString());
  latch.trySetCount(10);
  assertFalse(latch.trySetCount(20));
  assertEquals(10,latch.getCount());
}
Program: 47956
Project: 47956
Buggy source:
@Test(timeout=15000) public void testAwait() throws InterruptedException {
  final HazelcastInstance instance=createHazelcastInstance();
  final ICountDownLatch latch=instance.getCountDownLatch(randomString());
  latch.trySetCount(1);
  Thread thread=(new Thread(){
    public void run(){
      latch.countDown();
    }
  }
);
  thread.start();
  assertOpenEventually(latch);
}

Fixed version (ground truth):
@Test(timeout=15000) public void testAwait() throws InterruptedException {
  HazelcastInstance instance=createHazelcastInstance();
  final ICountDownLatch latch=instance.getCountDownLatch(randomString());
  latch.trySetCount(1);
  TestThread thread=new TestThread(){
    public void doRun(){
      latch.countDown();
    }
  }
;
  thread.start();
  assertOpenEventually(latch);
}
Program: 47957
Project: 47957
Buggy source:
@Test public void testCountDown(){
  final HazelcastInstance instance=createHazelcastInstance();
  ICountDownLatch latch=instance.getCountDownLatch(randomString());
  latch.trySetCount(20);
  for (int i=19; i >= 0; i--) {
    latch.countDown();
    assertEquals(i,latch.getCount());
  }
}

Fixed version (ground truth):
@Test public void testCountDown(){
  HazelcastInstance instance=createHazelcastInstance();
  ICountDownLatch latch=instance.getCountDownLatch(randomString());
  latch.trySetCount(20);
  for (int i=19; i >= 0; i--) {
    latch.countDown();
    assertEquals(i,latch.getCount());
  }
}
Program: 47958
Project: 47958
Buggy source:
public void run(){
  try {
    sleep(1000);
  }
 catch (  InterruptedException e) {
    return;
  }
  latch.destroy();
}

Fixed version (ground truth):
public void run(){
  for (int i=1; i < k; i++) {
    try {
      sleep(100);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    final ICountDownLatch l=instances[i].getCountDownLatch("String_Node_Str");
    l.countDown();
    assertEquals(k - 1 - i,l.getCount());
  }
}