nus-yam/ex-repair huggingface dataset:
Program: 47743
Project: 47743
Buggy source:
private static int calculateUtf8Length(final String str,final int beginIndex,final int endIndex){
  int utfLength=0;
  for (int i=beginIndex; i < endIndex; i++) {
    int c=str.charAt(i);
    if (c <= 0) {
      utfLength+=2;
    }
 else     if (c > 0x007F) {
      utfLength+=3;
    }
 else {
      utfLength++;
    }
  }
  return utfLength;
}

Fixed version (ground truth):
private static int calculateUtf8Length(final String str,final int beginIndex,final int endIndex){
  int utfLength=0;
  for (int i=beginIndex; i < endIndex; i++) {
    int c=str.charAt(i);
    if (c <= 0x007F && c >= 0x0001) {
      utfLength+=1;
    }
 else     if (c > 0x07FF) {
      utfLength+=3;
    }
 else {
      utfLength+=2;
    }
  }
  return utfLength;
}
Program: 47746
Project: 47746
Buggy source:
private static int calculateUtf8Length(final String str,final int beginIndex,final int endIndex){
  int utfLength=0;
  for (int i=beginIndex; i < endIndex; i++) {
    int c=str.charAt(i);
    if (c <= 0) {
      utfLength+=2;
    }
 else     if (c > 0x007F) {
      utfLength+=3;
    }
 else {
      utfLength++;
    }
  }
  return utfLength;
}

Fixed version (ground truth):
private static int calculateUtf8Length(final String str,final int beginIndex,final int endIndex){
  int utfLength=0;
  for (int i=beginIndex; i < endIndex; i++) {
    int c=str.charAt(i);
    if (c <= 0x007F && c >= 0x0001) {
      utfLength+=1;
    }
 else     if (c > 0x07FF) {
      utfLength+=3;
    }
 else {
      utfLength+=2;
    }
  }
  return utfLength;
}
Program: 47749
Project: 47749
Buggy source:
private static int calculateUtf8Length(final String str,final int beginIndex,final int endIndex){
  int utfLength=0;
  for (int i=beginIndex; i < endIndex; i++) {
    int c=str.charAt(i);
    if (c <= 0) {
      utfLength+=2;
    }
 else     if (c > 0x007F) {
      utfLength+=3;
    }
 else {
      utfLength++;
    }
  }
  return utfLength;
}

Fixed version (ground truth):
private static int calculateUtf8Length(final String str,final int beginIndex,final int endIndex){
  int utfLength=0;
  for (int i=beginIndex; i < endIndex; i++) {
    int c=str.charAt(i);
    if (c <= 0x007F && c >= 0x0001) {
      utfLength+=1;
    }
 else     if (c > 0x07FF) {
      utfLength+=3;
    }
 else {
      utfLength+=2;
    }
  }
  return utfLength;
}
Program: 47752
Project: 47752
Buggy source:
private static int calculateUtf8Length(final String str,final int beginIndex,final int endIndex){
  int utfLength=0;
  for (int i=beginIndex; i < endIndex; i++) {
    int c=str.charAt(i);
    if (c <= 0) {
      utfLength+=2;
    }
 else     if (c > 0x007F) {
      utfLength+=3;
    }
 else {
      utfLength++;
    }
  }
  return utfLength;
}

Fixed version (ground truth):
private static int calculateUtf8Length(final String str,final int beginIndex,final int endIndex){
  int utfLength=0;
  for (int i=beginIndex; i < endIndex; i++) {
    int c=str.charAt(i);
    if (c <= 0x007F && c >= 0x0001) {
      utfLength+=1;
    }
 else     if (c > 0x07FF) {
      utfLength+=3;
    }
 else {
      utfLength+=2;
    }
  }
  return utfLength;
}
Program: 47754
Project: 47754
Buggy source:
@Before @After public void killAllHazelcastInstances() throws IOException {
  HazelcastInstanceFactory.terminateAll();
}

Fixed version (ground truth):
@Before @After public void killAllHazelcastInstances() throws IOException {
  HazelcastInstanceFactory.shutdownAll();
}
Program: 47755
Project: 47755
Buggy source:
public void rollbackRemove(long itemId){
  final TxCollectionItem txItem=txMap.remove(itemId);
  if (txItem == null) {
    logger.warning("String_Node_Str" + itemId);
  }
  CollectionItem item=new CollectionItem(itemId,txItem.value);
  getCollection().add(item);
}

Fixed version (ground truth):
public void rollbackRemove(long itemId){
  final TxCollectionItem txItem=txMap.remove(itemId);
  if (txItem == null) {
    logger.warning("String_Node_Str" + itemId);
  }
 else {
    CollectionItem item=new CollectionItem(itemId,txItem.value);
    getCollection().add(item);
  }
}
Program: 47757
Project: 47757
Buggy source:
@Before @After public void killAllHazelcastInstances() throws IOException {
  HazelcastInstanceFactory.terminateAll();
}

Fixed version (ground truth):
@Before @After public void killAllHazelcastInstances() throws IOException {
  HazelcastInstanceFactory.shutdownAll();
}
Program: 47758
Project: 47758
Buggy source:
@Override public void run() throws Exception {
  assertEquals("String_Node_Str",expectedSize,instance.getCluster().getMembers().size());
}

Fixed version (ground truth):
public void run(){
  assertTrue(isAllInSafeState());
}
Program: 47759
Project: 47759
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + super.toString() + "String_Node_Str"+ key+ "String_Node_Str"+ oldValue+ "String_Node_Str"+ value+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + super.toString() + "String_Node_Str"+ getKey()+ "String_Node_Str"+ getOldValue()+ "String_Node_Str"+ getValue()+ '}';
}
Program: 47760
Project: 47760
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + super.toString() + "String_Node_Str"+ key+ "String_Node_Str"+ oldValue+ "String_Node_Str"+ value+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + super.toString() + "String_Node_Str"+ getKey()+ "String_Node_Str"+ getOldValue()+ "String_Node_Str"+ getValue()+ '}';
}
Program: 47761
Project: 47761
Buggy source:
@Test(timeout=30000) public void testSemaphoreWithFailures() throws InterruptedException {
  final int k=4;
  TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(k + 1);
  final HazelcastInstance[] instances=factory.newInstances();
  final ISemaphore semaphore=instances[k].getSemaphore("String_Node_Str");
  int initialPermits=20;
  semaphore.init(initialPermits);
  for (int i=0; i < k; i++) {
    int rand=(int)(Math.random() * 5) + 1;
    semaphore.acquire(rand);
    initialPermits-=rand;
    assertEquals(initialPermits,semaphore.availablePermits());
    semaphore.release(rand);
    initialPermits+=rand;
    assertEquals(initialPermits,semaphore.availablePermits());
    instances[i].getLifecycleService().shutdown();
    semaphore.acquire(rand);
    initialPermits-=rand;
    assertEquals(initialPermits,semaphore.availablePermits());
    semaphore.release(rand);
    initialPermits+=rand;
    assertEquals(initialPermits,semaphore.availablePermits());
  }
}

Fixed version (ground truth):
@Test(timeout=120000) public void testSemaphoreWithFailures() throws InterruptedException {
  final int k=4;
  final TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(k + 1);
  final HazelcastInstance[] instances=factory.newInstances();
  final ISemaphore semaphore=instances[k].getSemaphore("String_Node_Str");
  int initialPermits=20;
  semaphore.init(initialPermits);
  for (int i=0; i < k; i++) {
    int rand=(int)(Math.random() * 5) + 1;
    semaphore.acquire(rand);
    initialPermits-=rand;
    assertEquals(initialPermits,semaphore.availablePermits());
    semaphore.release(rand);
    initialPermits+=rand;
    assertEquals(initialPermits,semaphore.availablePermits());
    instances[i].shutdown();
    semaphore.acquire(rand);
    initialPermits-=rand;
    assertEquals(initialPermits,semaphore.availablePermits());
    semaphore.release(rand);
    initialPermits+=rand;
    assertEquals(initialPermits,semaphore.availablePermits());
  }
}
Program: 47762
Project: 47762
Buggy source:
@Test(timeout=30000) public void testSemaphoreWithFailuresAndJoin(){
  final TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(3);
  final HazelcastInstance instance1=factory.newHazelcastInstance();
  final HazelcastInstance instance2=factory.newHazelcastInstance();
  final ISemaphore semaphore=instance1.getSemaphore("String_Node_Str");
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  assertTrue(semaphore.init(0));
  final Thread thread=new Thread(){
    public void run(){
      for (int i=0; i < 2; i++) {
        try {
          semaphore.acquire();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
      countDownLatch.countDown();
    }
  }
;
  thread.start();
  instance2.getLifecycleService().shutdown();
  semaphore.release();
  HazelcastInstance instance3=factory.newHazelcastInstance();
  ISemaphore semaphore1=instance3.getSemaphore("String_Node_Str");
  semaphore1.release();
  try {
    assertTrue(countDownLatch.await(15,TimeUnit.SECONDS));
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
 finally {
    thread.interrupt();
  }
}

Fixed version (ground truth):
@Test(timeout=120000) public void testSemaphoreWithFailuresAndJoin(){
  final TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(3);
  final HazelcastInstance instance1=factory.newHazelcastInstance();
  final HazelcastInstance instance2=factory.newHazelcastInstance();
  final ISemaphore semaphore=instance1.getSemaphore("String_Node_Str");
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  assertTrue(semaphore.init(0));
  final Thread thread=new Thread(){
    public void run(){
      for (int i=0; i < 2; i++) {
        try {
          semaphore.acquire();
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
      }
      countDownLatch.countDown();
    }
  }
;
  thread.start();
  instance2.shutdown();
  semaphore.release();
  HazelcastInstance instance3=factory.newHazelcastInstance();
  ISemaphore semaphore1=instance3.getSemaphore("String_Node_Str");
  semaphore1.release();
  try {
    assertTrue(countDownLatch.await(15,TimeUnit.SECONDS));
  }
 catch (  InterruptedException e) {
    e.printStackTrace();
  }
 finally {
    thread.interrupt();
  }
}
Program: 47763
Project: 47763
Buggy source:
@Test(timeout=30000) public void testMutex() throws InterruptedException {
  final int threadCount=2;
  final HazelcastInstance[] instances=createHazelcastInstanceFactory(threadCount).newInstances();
  final CountDownLatch latch=new CountDownLatch(threadCount);
  final int loopCount=1000;
class Counter {
    int count=0;
    void inc(){
      count++;
    }
    int get(){
      return count;
    }
  }
  final Counter counter=new Counter();
  assertTrue(instances[0].getSemaphore("String_Node_Str").init(1));
  for (int i=0; i < threadCount; i++) {
    final ISemaphore semaphore=instances[i].getSemaphore("String_Node_Str");
    new Thread(){
      public void run(){
        for (int j=0; j < loopCount; j++) {
          try {
            semaphore.acquire();
            sleepMillis((int)(Math.random() * 3));
            counter.inc();
          }
 catch (          InterruptedException e) {
            return;
          }
 finally {
            semaphore.release();
          }
        }
        latch.countDown();
      }
    }
.start();
  }
  assertOpenEventually(latch);
  assertEquals(loopCount * threadCount,counter.get());
}

Fixed version (ground truth):
@Test(timeout=120000) public void testMutex() throws InterruptedException {
  final int threadCount=2;
  final HazelcastInstance[] instances=createHazelcastInstanceFactory(threadCount).newInstances();
  final CountDownLatch latch=new CountDownLatch(threadCount);
  final int loopCount=1000;
class Counter {
    int count=0;
    void inc(){
      count++;
    }
    int get(){
      return count;
    }
  }
  final Counter counter=new Counter();
  assertTrue(instances[0].getSemaphore("String_Node_Str").init(1));
  for (int i=0; i < threadCount; i++) {
    final ISemaphore semaphore=instances[i].getSemaphore("String_Node_Str");
    new Thread(){
      public void run(){
        for (int j=0; j < loopCount; j++) {
          try {
            semaphore.acquire();
            sleepMillis((int)(Math.random() * 3));
            counter.inc();
          }
 catch (          InterruptedException e) {
            return;
          }
 finally {
            semaphore.release();
          }
        }
        latch.countDown();
      }
    }
.start();
  }
  assertOpenEventually(latch);
  assertEquals(loopCount * threadCount,counter.get());
}
Program: 47764
Project: 47764
Buggy source:
@Test @Category(NightlyTest.class) public void testIssue1085WriteBehindBackupTransactional() throws InterruptedException {
  Config config=new Config();
  String name="String_Node_Str";
  MapConfig writeBehindBackup=config.getMapConfig(name);
  MapStoreConfig mapStoreConfig=new MapStoreConfig();
  mapStoreConfig.setWriteDelaySeconds(5);
  int size=1000;
  MapStoreWithStoreCount mapStore=new MapStoreWithStoreCount(size,20);
  mapStoreConfig.setImplementation(mapStore);
  writeBehindBackup.setMapStoreConfig(mapStoreConfig);
  TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(3);
  HazelcastInstance instance=factory.newHazelcastInstance(config);
  HazelcastInstance instance2=factory.newHazelcastInstance(config);
  final IMap map=instance.getMap(name);
  TransactionContext context=instance.newTransactionContext();
  context.beginTransaction();
  TransactionalMap<Object,Object> tmap=context.getMap(name);
  for (int i=0; i < size; i++) {
    tmap.put(i,i);
  }
  context.commitTransaction();
  instance2.getLifecycleService().shutdown();
  mapStore.awaitStores();
}

Fixed version (ground truth):
@Test public void testIssue1085WriteBehindBackupTransactional() throws InterruptedException {
  final String name=randomMapName();
  final int size=1000;
  MapStoreWithStoreCount mapStore=new MapStoreWithStoreCount(size,120);
  Config config=newConfig(name,mapStore,5);
  TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(3);
  HazelcastInstance instance=factory.newHazelcastInstance(config);
  HazelcastInstance instance2=factory.newHazelcastInstance(config);
  TransactionContext context=instance.newTransactionContext();
  context.beginTransaction();
  TransactionalMap<Object,Object> tmap=context.getMap(name);
  for (int i=0; i < size; i++) {
    tmap.put(i,i);
  }
  context.commitTransaction();
  instance2.getLifecycleService().shutdown();
  mapStore.awaitStores();
}
Program: 47765
Project: 47765
Buggy source:
@Test @Category(NightlyTest.class) public void testIssue1085WriteBehindBackupTransactional() throws InterruptedException {
  Config config=new Config();
  String name="String_Node_Str";
  MapConfig writeBehindBackup=config.getMapConfig(name);
  MapStoreConfig mapStoreConfig=new MapStoreConfig();
  mapStoreConfig.setWriteDelaySeconds(5);
  int size=1000;
  MapStoreWithStoreCount mapStore=new MapStoreWithStoreCount(size,20);
  mapStoreConfig.setImplementation(mapStore);
  writeBehindBackup.setMapStoreConfig(mapStoreConfig);
  TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(3);
  HazelcastInstance instance=factory.newHazelcastInstance(config);
  HazelcastInstance instance2=factory.newHazelcastInstance(config);
  final IMap map=instance.getMap(name);
  TransactionContext context=instance.newTransactionContext();
  context.beginTransaction();
  TransactionalMap<Object,Object> tmap=context.getMap(name);
  for (int i=0; i < size; i++) {
    tmap.put(i,i);
  }
  context.commitTransaction();
  instance2.getLifecycleService().shutdown();
  mapStore.awaitStores();
}

Fixed version (ground truth):
@Test public void testIssue1085WriteBehindBackupTransactional() throws InterruptedException {
  final String name=randomMapName();
  final int size=1000;
  MapStoreWithStoreCount mapStore=new MapStoreWithStoreCount(size,120);
  Config config=newConfig(name,mapStore,5);
  TestHazelcastInstanceFactory factory=createHazelcastInstanceFactory(3);
  HazelcastInstance instance=factory.newHazelcastInstance(config);
  HazelcastInstance instance2=factory.newHazelcastInstance(config);
  TransactionContext context=instance.newTransactionContext();
  context.beginTransaction();
  TransactionalMap<Object,Object> tmap=context.getMap(name);
  for (int i=0; i < size; i++) {
    tmap.put(i,i);
  }
  context.commitTransaction();
  instance2.getLifecycleService().shutdown();
  mapStore.awaitStores();
}
Program: 47766
Project: 47766
Buggy source:
@Override protected <K,V>void createConfigOnAllMembers(CacheConfig<K,V> cacheConfig){
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  for (  MemberImpl member : members) {
    try {
      ClientRequest request=new CacheCreateConfigRequest(cacheConfig,true,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      future.get();
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
}

Fixed version (ground truth):
@Override protected <K,V>void createConfigOnAllMembers(CacheConfig<K,V> cacheConfig){
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  final Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    try {
      ClientRequest request=new CacheCreateConfigRequest(cacheConfig,true,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      futures.add(future);
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}
Program: 47767
Project: 47767
Buggy source:
@Override public void enableStatistics(String cacheName,boolean enabled){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException();
  }
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  for (  MemberImpl member : members) {
    try {
      CacheManagementConfigRequest request=new CacheManagementConfigRequest(getCacheNameWithPrefix(cacheName),true,enabled,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      future.get();
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
}

Fixed version (ground truth):
@Override public void enableStatistics(String cacheName,boolean enabled){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException();
  }
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  final Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    try {
      CacheManagementConfigRequest request=new CacheManagementConfigRequest(getCacheNameWithPrefix(cacheName),true,enabled,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      futures.add(future);
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}
Program: 47768
Project: 47768
Buggy source:
@Override public void enableManagement(String cacheName,boolean enabled){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException();
  }
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  for (  MemberImpl member : members) {
    try {
      CacheManagementConfigRequest request=new CacheManagementConfigRequest(getCacheNameWithPrefix(cacheName),false,enabled,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      future.get();
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
}

Fixed version (ground truth):
@Override public void enableManagement(String cacheName,boolean enabled){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException();
  }
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  final Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    try {
      CacheManagementConfigRequest request=new CacheManagementConfigRequest(getCacheNameWithPrefix(cacheName),false,enabled,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      futures.add(future);
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}
Program: 47769
Project: 47769
Buggy source:
@Override protected <K,V>CacheConfig<K,V> getCacheConfigFromPartition(String cacheName){
  ClientRequest request=new CacheGetConfigRequest(cacheName);
  try {
    final Future future=clientContext.getInvocationService().invokeOnKeyOwner(request,cacheName);
    return clientContext.getSerializationService().toObject(future.get());
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return null;
}

Fixed version (ground truth):
@Override protected <K,V>CacheConfig<K,V> getCacheConfigFromPartition(String cacheName){
  ClientRequest request=new CacheGetConfigRequest(cacheName);
  try {
    final Future future=clientContext.getInvocationService().invokeOnKeyOwner(request,cacheName);
    return clientContext.getSerializationService().toObject(future.get());
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e);
  }
}
Program: 47770
Project: 47770
Buggy source:
public HazelcastClientCacheManager(HazelcastClientCachingProvider cachingProvider,HazelcastInstance hazelcastInstance,URI uri,ClassLoader classLoader,Properties properties){
  super(cachingProvider,uri,classLoader,properties);
  if (hazelcastInstance == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.hazelcastInstance=hazelcastInstance;
  final ClientCacheDistributedObject setupRef=hazelcastInstance.getDistributedObject(CacheService.SERVICE_NAME,"String_Node_Str");
  this.clientContext=setupRef.getClientContext();
}

Fixed version (ground truth):
public HazelcastClientCacheManager(HazelcastClientCachingProvider cachingProvider,HazelcastInstance hazelcastInstance,URI uri,ClassLoader classLoader,Properties properties){
  super(cachingProvider,uri,classLoader,properties);
  if (hazelcastInstance == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.hazelcastInstance=hazelcastInstance;
  final ClientCacheDistributedObject setupRef=hazelcastInstance.getDistributedObject(CacheService.SERVICE_NAME,"String_Node_Str");
  this.clientContext=setupRef.getClientContext();
  logger=clientContext.getHazelcastInstance().getLoggingService().getLogger(getClass());
}
Program: 47771
Project: 47771
Buggy source:
@Override protected CacheManager createHazelcastCacheManager(URI uri,ClassLoader classLoader,Properties managerProperties){
  if (hazelcastInstance == null) {
    hazelcastInstance=initHazelcast();
  }
  return new HazelcastClientCacheManager(this,hazelcastInstance,uri,classLoader,managerProperties);
}

Fixed version (ground truth):
@Override protected CacheManager createHazelcastCacheManager(URI uri,ClassLoader classLoader,Properties managerProperties){
  if (hazelcastInstance == null) {
    initHazelcast();
  }
  return new HazelcastClientCacheManager(this,hazelcastInstance,uri,classLoader,managerProperties);
}
Program: 47772
Project: 47772
Buggy source:
public static HazelcastClientCachingProvider createCachingProvider(HazelcastInstance hazelcastInstance){
  final HazelcastClientCachingProvider cachingProvider=new HazelcastClientCachingProvider();
  cachingProvider.hazelcastInstance=hazelcastInstance;
  return cachingProvider;
}

Fixed version (ground truth):
/** 
 * Helper method for creating caching provider for testing etc
 * @param hazelcastInstance
 * @return HazelcastClientCachingProvider
 */
public static HazelcastClientCachingProvider createCachingProvider(HazelcastInstance hazelcastInstance){
  final HazelcastClientCachingProvider cachingProvider=new HazelcastClientCachingProvider();
  cachingProvider.hazelcastInstance=hazelcastInstance;
  return cachingProvider;
}
Program: 47773
Project: 47773
Buggy source:
protected HazelcastInstance initHazelcast(){
  ClientConfig config=new XmlClientConfigBuilder().build();
  return HazelcastClient.newHazelcastClient(config);
}

Fixed version (ground truth):
protected synchronized void initHazelcast(){
  if (hazelcastInstance == null) {
    hazelcastInstance=HazelcastClient.newHazelcastClient();
  }
}
Program: 47774
Project: 47774
Buggy source:
protected void registrationOtherNodes(CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration,boolean isRegister){
  final OperationService operationService=nodeEngine.getOperationService();
  final Collection<MemberImpl> members=nodeEngine.getClusterService().getMemberList();
  Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    if (!member.localMember()) {
      final Operation op=new CacheListenerRegistrationOperation(getDistributedObjectName(),cacheEntryListenerConfiguration,isRegister);
      final InternalCompletableFuture<Object> future=operationService.invokeOnTarget(CacheService.SERVICE_NAME,op,member.getAddress());
      futures.add(future);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}

Fixed version (ground truth):
protected void registrationOtherNodes(CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration,boolean isRegister){
  final OperationService operationService=nodeEngine.getOperationService();
  final Collection<MemberImpl> members=nodeEngine.getClusterService().getMemberList();
  Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    if (!member.localMember()) {
      final Operation op=new CacheListenerRegistrationOperation(getDistributedObjectName(),cacheEntryListenerConfiguration,isRegister);
      final InternalCompletableFuture<Object> future=operationService.invokeOnTarget(CacheService.SERVICE_NAME,op,member.getAddress());
      futures.add(future);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}
Program: 47775
Project: 47775
Buggy source:
@Override public URI getDefaultURI(){
  try {
    return new URI(this.getClass().getName());
  }
 catch (  URISyntaxException e) {
    throw new CacheException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public URI getDefaultURI(){
  return defaultURI;
}
Program: 47776
Project: 47776
Buggy source:
protected void shutdownHazelcastInstance(){
  if (hazelcastInstance != null) {
    hazelcastInstance.shutdown();
  }
  hazelcastInstance=null;
}

Fixed version (ground truth):
protected void shutdownHazelcastInstance(){
  final HazelcastInstance localInstanceRef=hazelcastInstance;
  if (localInstanceRef != null) {
    hazelcastInstance.shutdown();
  }
  hazelcastInstance=null;
}
Program: 47777
Project: 47777
Buggy source:
@Override public ClassLoader getDefaultClassLoader(){
  return this.getClass().getClassLoader();
}

Fixed version (ground truth):
@Override public ClassLoader getDefaultClassLoader(){
  return defaultClassLoader;
}
Program: 47778
Project: 47778
Buggy source:
public HazelcastAbstractCachingProvider(){
  this.cacheManagers=new ConcurrentReferenceHashMap<ClassLoader,ConcurrentMap<URI,CacheManager>>();
}

Fixed version (ground truth):
public HazelcastAbstractCachingProvider(){
  this.cacheManagers=new ConcurrentReferenceHashMap<ClassLoader,ConcurrentMap<URI,CacheManager>>();
  this.defaultClassLoader=this.getClass().getClassLoader();
  try {
    defaultURI=new URI(this.getClass().getName());
  }
 catch (  URISyntaxException e) {
    throw new CacheException("String_Node_Str",e);
  }
}
Program: 47779
Project: 47779
Buggy source:
@Override public void close(URI uri,ClassLoader classLoader){
  final URI managerURI=uri == null ? getDefaultURI() : uri;
  final ClassLoader managerClassLoader=classLoader == null ? getDefaultClassLoader() : classLoader;
  final ConcurrentMap<URI,CacheManager> uriCacheManagerHashMap=this.cacheManagers.get(managerClassLoader);
  if (uriCacheManagerHashMap != null) {
    final CacheManager cacheManager=uriCacheManagerHashMap.get(managerURI);
    if (cacheManager != null) {
      cacheManager.close();
    }
  }
}

Fixed version (ground truth):
@Override public void close(URI uri,ClassLoader classLoader){
  final URI managerURI=getManagerUri(uri);
  final ClassLoader managerClassLoader=getManagerClassLoader(classLoader);
  final ConcurrentMap<URI,CacheManager> uriCacheManagerMap=this.cacheManagers.get(managerClassLoader);
  if (uriCacheManagerMap != null) {
    final CacheManager cacheManager=uriCacheManagerMap.get(managerURI);
    if (cacheManager != null) {
      cacheManager.close();
    }
  }
}
Program: 47780
Project: 47780
Buggy source:
public void releaseCacheManager(URI uri,ClassLoader classLoader){
  final URI managerURI=uri == null ? getDefaultURI() : uri;
  final ClassLoader managerClassLoader=classLoader == null ? getDefaultClassLoader() : classLoader;
  ConcurrentMap<URI,CacheManager> cacheManagersByURI=cacheManagers.get(managerClassLoader);
  if (cacheManagersByURI != null) {
    cacheManagersByURI.remove(managerURI);
    if (cacheManagersByURI.size() == 0) {
      cacheManagers.remove(managerClassLoader);
    }
  }
}

Fixed version (ground truth):
public void releaseCacheManager(URI uri,ClassLoader classLoader){
  final URI managerURI=getManagerUri(uri);
  final ClassLoader managerClassLoader=getManagerClassLoader(classLoader);
  ConcurrentMap<URI,CacheManager> cacheManagersByURI=cacheManagers.get(managerClassLoader);
  if (cacheManagersByURI != null) {
    cacheManagersByURI.remove(managerURI);
  }
}
Program: 47783
Project: 47783
Buggy source:
@Test public void testSameMasterDifferentMemberList() throws Exception {
  Config c1=buildConfig(false);
  Config c2=buildConfig(false);
  Config c3=buildConfig(false);
  c1.getNetworkConfig().setPort(45701);
  c2.getNetworkConfig().setPort(45702);
  c3.getNetworkConfig().setPort(45703);
  List<String> allMembers=Arrays.asList("String_Node_Str");
  c1.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);
  c2.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);
  c3.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);
  final HazelcastInstance h1=Hazelcast.newHazelcastInstance(c1);
  final HazelcastInstance h2=Hazelcast.newHazelcastInstance(c2);
  final HazelcastInstance h3=Hazelcast.newHazelcastInstance(c3);
  final MemberImpl m1=(MemberImpl)h1.getCluster().getLocalMember();
  final MemberImpl m2=(MemberImpl)h2.getCluster().getLocalMember();
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
  final Node n2=TestUtil.getNode(h2);
  List<MemberInfo> members=new ArrayList<MemberInfo>();
  members.add(new MemberInfo(m1.getAddress(),m1.getUuid(),Collections.<String,Object>emptyMap()));
  members.add(new MemberInfo(m2.getAddress(),m2.getUuid(),Collections.<String,Object>emptyMap()));
  n2.clusterService.updateMembers(members);
  Thread.sleep(30 * 1000);
  assertEquals(m1,h1.getCluster().getMembers().iterator().next());
  assertEquals(m1,h2.getCluster().getMembers().iterator().next());
  assertEquals(m1,h3.getCluster().getMembers().iterator().next());
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
}

Fixed version (ground truth):
@Test public void testSameMasterDifferentMemberList() throws Exception {
  List<HazelcastInstance> instanceList=buildInstances(3,45701);
  final HazelcastInstance h1=instanceList.get(0);
  final HazelcastInstance h2=instanceList.get(1);
  final HazelcastInstance h3=instanceList.get(2);
  final MemberImpl m1=(MemberImpl)h1.getCluster().getLocalMember();
  final MemberImpl m2=(MemberImpl)h2.getCluster().getLocalMember();
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
  final Node n2=TestUtil.getNode(h2);
  List<MemberInfo> members=new ArrayList<MemberInfo>();
  members.add(new MemberInfo(m1.getAddress(),m1.getUuid(),Collections.<String,Object>emptyMap()));
  members.add(new MemberInfo(m2.getAddress(),m2.getUuid(),Collections.<String,Object>emptyMap()));
  n2.clusterService.updateMembers(members);
  Thread.sleep(30 * 1000);
  assertEquals(m1,h1.getCluster().getMembers().iterator().next());
  assertEquals(m1,h2.getCluster().getMembers().iterator().next());
  assertEquals(m1,h3.getCluster().getMembers().iterator().next());
  assertEquals(3,h1.getCluster().getMembers().size());
  assertEquals(3,h2.getCluster().getMembers().size());
  assertEquals(3,h3.getCluster().getMembers().size());
}
Program: 47787
Project: 47787
Buggy source:
@Override protected <K,V>void createConfigOnAllMembers(CacheConfig<K,V> cacheConfig){
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  for (  MemberImpl member : members) {
    try {
      ClientRequest request=new CacheCreateConfigRequest(cacheConfig,true,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      future.get();
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
}

Fixed version (ground truth):
@Override protected <K,V>void createConfigOnAllMembers(CacheConfig<K,V> cacheConfig){
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  final Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    try {
      ClientRequest request=new CacheCreateConfigRequest(cacheConfig,true,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      futures.add(future);
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}
Program: 47788
Project: 47788
Buggy source:
@Override public void enableStatistics(String cacheName,boolean enabled){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException();
  }
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  for (  MemberImpl member : members) {
    try {
      CacheManagementConfigRequest request=new CacheManagementConfigRequest(getCacheNameWithPrefix(cacheName),true,enabled,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      future.get();
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
}

Fixed version (ground truth):
@Override public void enableStatistics(String cacheName,boolean enabled){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException();
  }
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  final Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    try {
      CacheManagementConfigRequest request=new CacheManagementConfigRequest(getCacheNameWithPrefix(cacheName),true,enabled,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      futures.add(future);
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}
Program: 47789
Project: 47789
Buggy source:
@Override public void enableManagement(String cacheName,boolean enabled){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException();
  }
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  for (  MemberImpl member : members) {
    try {
      CacheManagementConfigRequest request=new CacheManagementConfigRequest(getCacheNameWithPrefix(cacheName),false,enabled,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      future.get();
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
}

Fixed version (ground truth):
@Override public void enableManagement(String cacheName,boolean enabled){
  if (isClosed()) {
    throw new IllegalStateException();
  }
  if (cacheName == null) {
    throw new NullPointerException();
  }
  final ClientInvocationService invocationService=clientContext.getInvocationService();
  final Collection<MemberImpl> members=clientContext.getClusterService().getMemberList();
  final Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    try {
      CacheManagementConfigRequest request=new CacheManagementConfigRequest(getCacheNameWithPrefix(cacheName),false,enabled,member.getAddress());
      final Future future=invocationService.invokeOnTarget(request,member.getAddress());
      futures.add(future);
    }
 catch (    Exception e) {
      ExceptionUtil.sneakyThrow(e);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}
Program: 47790
Project: 47790
Buggy source:
@Override protected <K,V>CacheConfig<K,V> getCacheConfigFromPartition(String cacheName){
  ClientRequest request=new CacheGetConfigRequest(cacheName);
  try {
    final Future future=clientContext.getInvocationService().invokeOnKeyOwner(request,cacheName);
    return clientContext.getSerializationService().toObject(future.get());
  }
 catch (  Exception e) {
    EmptyStatement.ignore(e);
  }
  return null;
}

Fixed version (ground truth):
@Override protected <K,V>CacheConfig<K,V> getCacheConfigFromPartition(String cacheName){
  ClientRequest request=new CacheGetConfigRequest(cacheName);
  try {
    final Future future=clientContext.getInvocationService().invokeOnKeyOwner(request,cacheName);
    return clientContext.getSerializationService().toObject(future.get());
  }
 catch (  Exception e) {
    throw ExceptionUtil.rethrow(e);
  }
}
Program: 47791
Project: 47791
Buggy source:
public HazelcastClientCacheManager(HazelcastClientCachingProvider cachingProvider,HazelcastInstance hazelcastInstance,URI uri,ClassLoader classLoader,Properties properties){
  super(cachingProvider,uri,classLoader,properties);
  if (hazelcastInstance == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.hazelcastInstance=hazelcastInstance;
  final ClientCacheDistributedObject setupRef=hazelcastInstance.getDistributedObject(CacheService.SERVICE_NAME,"String_Node_Str");
  this.clientContext=setupRef.getClientContext();
}

Fixed version (ground truth):
public HazelcastClientCacheManager(HazelcastClientCachingProvider cachingProvider,HazelcastInstance hazelcastInstance,URI uri,ClassLoader classLoader,Properties properties){
  super(cachingProvider,uri,classLoader,properties);
  if (hazelcastInstance == null) {
    throw new NullPointerException("String_Node_Str");
  }
  this.hazelcastInstance=hazelcastInstance;
  final ClientCacheDistributedObject setupRef=hazelcastInstance.getDistributedObject(CacheService.SERVICE_NAME,"String_Node_Str");
  this.clientContext=setupRef.getClientContext();
  logger=clientContext.getHazelcastInstance().getLoggingService().getLogger(getClass());
}
Program: 47792
Project: 47792
Buggy source:
@Override protected CacheManager createHazelcastCacheManager(URI uri,ClassLoader classLoader,Properties managerProperties){
  if (hazelcastInstance == null) {
    hazelcastInstance=initHazelcast();
  }
  return new HazelcastClientCacheManager(this,hazelcastInstance,uri,classLoader,managerProperties);
}

Fixed version (ground truth):
@Override protected CacheManager createHazelcastCacheManager(URI uri,ClassLoader classLoader,Properties managerProperties){
  if (hazelcastInstance == null) {
    initHazelcast();
  }
  return new HazelcastClientCacheManager(this,hazelcastInstance,uri,classLoader,managerProperties);
}
Program: 47793
Project: 47793
Buggy source:
public static HazelcastClientCachingProvider createCachingProvider(HazelcastInstance hazelcastInstance){
  final HazelcastClientCachingProvider cachingProvider=new HazelcastClientCachingProvider();
  cachingProvider.hazelcastInstance=hazelcastInstance;
  return cachingProvider;
}

Fixed version (ground truth):
/** 
 * Helper method for creating caching provider for testing etc
 * @param hazelcastInstance
 * @return HazelcastClientCachingProvider
 */
public static HazelcastClientCachingProvider createCachingProvider(HazelcastInstance hazelcastInstance){
  final HazelcastClientCachingProvider cachingProvider=new HazelcastClientCachingProvider();
  cachingProvider.hazelcastInstance=hazelcastInstance;
  return cachingProvider;
}
Program: 47794
Project: 47794
Buggy source:
protected HazelcastInstance initHazelcast(){
  ClientConfig config=new XmlClientConfigBuilder().build();
  return HazelcastClient.newHazelcastClient(config);
}

Fixed version (ground truth):
protected synchronized void initHazelcast(){
  if (hazelcastInstance == null) {
    hazelcastInstance=HazelcastClient.newHazelcastClient();
  }
}
Program: 47795
Project: 47795
Buggy source:
protected void registrationOtherNodes(CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration,boolean isRegister){
  final OperationService operationService=nodeEngine.getOperationService();
  final Collection<MemberImpl> members=nodeEngine.getClusterService().getMemberList();
  Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    if (!member.localMember()) {
      final Operation op=new CacheListenerRegistrationOperation(getDistributedObjectName(),cacheEntryListenerConfiguration,isRegister);
      final InternalCompletableFuture<Object> future=operationService.invokeOnTarget(CacheService.SERVICE_NAME,op,member.getAddress());
      futures.add(future);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}

Fixed version (ground truth):
protected void registrationOtherNodes(CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration,boolean isRegister){
  final OperationService operationService=nodeEngine.getOperationService();
  final Collection<MemberImpl> members=nodeEngine.getClusterService().getMemberList();
  Collection<Future> futures=new ArrayList<Future>();
  for (  MemberImpl member : members) {
    if (!member.localMember()) {
      final Operation op=new CacheListenerRegistrationOperation(getDistributedObjectName(),cacheEntryListenerConfiguration,isRegister);
      final InternalCompletableFuture<Object> future=operationService.invokeOnTarget(CacheService.SERVICE_NAME,op,member.getAddress());
      futures.add(future);
    }
  }
  try {
    FutureUtil.waitWithDeadline(futures,CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS,TimeUnit.SECONDS);
  }
 catch (  TimeoutException e) {
    logger.warning(e);
  }
}
Program: 47796
Project: 47796
Buggy source:
@Override public URI getDefaultURI(){
  try {
    return new URI(this.getClass().getName());
  }
 catch (  URISyntaxException e) {
    throw new CacheException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public URI getDefaultURI(){
  return defaultURI;
}
Program: 47797
Project: 47797
Buggy source:
protected void shutdownHazelcastInstance(){
  if (hazelcastInstance != null) {
    hazelcastInstance.shutdown();
  }
  hazelcastInstance=null;
}

Fixed version (ground truth):
protected void shutdownHazelcastInstance(){
  final HazelcastInstance localInstanceRef=hazelcastInstance;
  if (localInstanceRef != null) {
    hazelcastInstance.shutdown();
  }
  hazelcastInstance=null;
}
Program: 47798
Project: 47798
Buggy source:
@Override public ClassLoader getDefaultClassLoader(){
  return this.getClass().getClassLoader();
}

Fixed version (ground truth):
@Override public ClassLoader getDefaultClassLoader(){
  return defaultClassLoader;
}
Program: 47799
Project: 47799
Buggy source:
public HazelcastAbstractCachingProvider(){
  this.cacheManagers=new ConcurrentReferenceHashMap<ClassLoader,ConcurrentMap<URI,CacheManager>>();
}

Fixed version (ground truth):
public HazelcastAbstractCachingProvider(){
  this.cacheManagers=new ConcurrentReferenceHashMap<ClassLoader,ConcurrentMap<URI,CacheManager>>();
  this.defaultClassLoader=this.getClass().getClassLoader();
  try {
    defaultURI=new URI(this.getClass().getName());
  }
 catch (  URISyntaxException e) {
    throw new CacheException("String_Node_Str",e);
  }
}
Program: 47800
Project: 47800
Buggy source:
@Override public void close(URI uri,ClassLoader classLoader){
  final URI managerURI=uri == null ? getDefaultURI() : uri;
  final ClassLoader managerClassLoader=classLoader == null ? getDefaultClassLoader() : classLoader;
  final ConcurrentMap<URI,CacheManager> uriCacheManagerHashMap=this.cacheManagers.get(managerClassLoader);
  if (uriCacheManagerHashMap != null) {
    final CacheManager cacheManager=uriCacheManagerHashMap.get(managerURI);
    if (cacheManager != null) {
      cacheManager.close();
    }
  }
}

Fixed version (ground truth):
@Override public void close(URI uri,ClassLoader classLoader){
  final URI managerURI=getManagerUri(uri);
  final ClassLoader managerClassLoader=getManagerClassLoader(classLoader);
  final ConcurrentMap<URI,CacheManager> uriCacheManagerMap=this.cacheManagers.get(managerClassLoader);
  if (uriCacheManagerMap != null) {
    final CacheManager cacheManager=uriCacheManagerMap.get(managerURI);
    if (cacheManager != null) {
      cacheManager.close();
    }
  }
}
Program: 47801
Project: 47801
Buggy source:
public void releaseCacheManager(URI uri,ClassLoader classLoader){
  final URI managerURI=uri == null ? getDefaultURI() : uri;
  final ClassLoader managerClassLoader=classLoader == null ? getDefaultClassLoader() : classLoader;
  ConcurrentMap<URI,CacheManager> cacheManagersByURI=cacheManagers.get(managerClassLoader);
  if (cacheManagersByURI != null) {
    cacheManagersByURI.remove(managerURI);
    if (cacheManagersByURI.size() == 0) {
      cacheManagers.remove(managerClassLoader);
    }
  }
}

Fixed version (ground truth):
public void releaseCacheManager(URI uri,ClassLoader classLoader){
  final URI managerURI=getManagerUri(uri);
  final ClassLoader managerClassLoader=getManagerClassLoader(classLoader);
  ConcurrentMap<URI,CacheManager> cacheManagersByURI=cacheManagers.get(managerClassLoader);
  if (cacheManagersByURI != null) {
    cacheManagersByURI.remove(managerURI);
  }
}