nus-yam/ex-repair huggingface dataset:
Program: 47342
Project: 47342
Buggy source:
@Override protected <T>CacheRecord createRecord(T value,long creationTime,long expiryTime){
  evictIfRequired();
  return cacheRecordFactory.newRecordWithExpiry(value,creationTime,expiryTime);
}

Fixed version (ground truth):
@Override protected CacheRecord createRecord(Object value,long creationTime,long expiryTime){
  evictIfRequired();
  return cacheRecordFactory.newRecordWithExpiry(value,creationTime,expiryTime);
}
Program: 47343
Project: 47343
Buggy source:
@Override protected <T>Data valueToData(T value){
  return cacheService.toData(value);
}

Fixed version (ground truth):
@Override protected Data valueToData(Object value){
  return cacheService.toData(value);
}
Program: 47344
Project: 47344
Buggy source:
@Override protected <T>CacheRecord valueToRecord(T value){
  return cacheRecordFactory.newRecord(value);
}

Fixed version (ground truth):
@Override protected CacheRecord valueToRecord(Object value){
  return cacheRecordFactory.newRecord(value);
}
Program: 47345
Project: 47345
Buggy source:
protected AbstractCompletableFuture(NodeEngine nodeEngine,ILogger logger){
  this.nodeEngine=nodeEngine;
  this.logger=logger;
  this.callbackUpdater=AtomicReferenceFieldUpdater.newUpdater(AbstractCompletableFuture.class,ExecutionCallbackNode.class,"String_Node_Str");
  this.resultUpdater=AtomicReferenceFieldUpdater.newUpdater(AbstractCompletableFuture.class,Object.class,"String_Node_Str");
}

Fixed version (ground truth):
protected AbstractCompletableFuture(NodeEngine nodeEngine,ILogger logger){
  this.nodeEngine=nodeEngine;
  this.logger=logger;
}
Program: 47346
Project: 47346
Buggy source:
protected void fireCallbacks(){
  ExecutionCallbackNode<V> callbackChain;
  for (; ; ) {
    callbackChain=callbackHead;
    if (callbackUpdater.compareAndSet(this,callbackChain,null)) {
      break;
    }
  }
  while (callbackChain != null) {
    runAsynchronous(callbackChain.callback,callbackChain.executor);
    callbackChain=callbackChain.next;
  }
}

Fixed version (ground truth):
protected void fireCallbacks(ExecutionCallbackNode<V> callbackChain){
  while (callbackChain != null) {
    runAsynchronous(callbackChain.callback,callbackChain.executor);
    callbackChain=callbackChain.next;
  }
}
Program: 47347
Project: 47347
Buggy source:
public void setResult(Object result){
  if (resultUpdater.compareAndSet(this,NULL_VALUE,result)) {
    fireCallbacks();
  }
}

Fixed version (ground truth):
public void setResult(Object result){
  ExecutionCallbackNode<V> callbackChain;
synchronized (completionLock) {
    if (isDoneInternal()) {
      return;
    }
    this.result=result;
    callbackChain=callbackHead;
    callbackHead=null;
  }
  fireCallbacks(callbackChain);
}
Program: 47348
Project: 47348
Buggy source:
private void runAsynchronous(final ExecutionCallback<V> callback,final Executor executor){
  final Object result=this.result;
  executor.execute(new Runnable(){
    @Override public void run(){
      try {
        if (result instanceof Throwable) {
          callback.onFailure((Throwable)result);
        }
 else {
          callback.onResponse((V)result);
        }
      }
 catch (      Throwable cause) {
        logger.severe("String_Node_Str" + callback + "String_Node_Str"+ AbstractCompletableFuture.this,cause);
      }
    }
  }
);
}

Fixed version (ground truth):
private void runAsynchronous(final ExecutionCallback<V> callback,final Executor executor){
  try {
    final Object result=this.result;
    executor.execute(new Runnable(){
      @Override public void run(){
        try {
          if (result instanceof Throwable) {
            callback.onFailure((Throwable)result);
          }
 else {
            callback.onResponse((V)result);
          }
        }
 catch (        Throwable cause) {
          logger.severe("String_Node_Str" + callback + "String_Node_Str"+ AbstractCompletableFuture.this,cause);
        }
      }
    }
);
  }
 catch (  RejectedExecutionException e) {
    logger.warning("String_Node_Str" + callback + "String_Node_Str",e);
  }
}
Program: 47349
Project: 47349
Buggy source:
@Override public boolean isDone(){
  return result != NULL_VALUE;
}

Fixed version (ground truth):
@Override public boolean isDone(){
  return isDoneInternal();
}
Program: 47350
Project: 47350
Buggy source:
@Override public void andThen(ExecutionCallback<V> callback,Executor executor){
  isNotNull(callback,"String_Node_Str");
  isNotNull(executor,"String_Node_Str");
  if (isDone()) {
    runAsynchronous(callback,executor);
    return;
  }
  for (; ; ) {
    ExecutionCallbackNode oldCallbackHead=callbackHead;
    ExecutionCallbackNode newCallbackHead=new ExecutionCallbackNode<V>(callback,executor,oldCallbackHead);
    if (callbackUpdater.compareAndSet(this,oldCallbackHead,newCallbackHead)) {
      break;
    }
  }
}

Fixed version (ground truth):
@Override public void andThen(ExecutionCallback<V> callback,Executor executor){
  isNotNull(callback,"String_Node_Str");
  isNotNull(executor,"String_Node_Str");
  if (isDoneInternal()) {
    runAsynchronous(callback,executor);
    return;
  }
synchronized (completionLock) {
    if (isDoneInternal()) {
      runAsynchronous(callback,executor);
      return;
    }
    this.callbackHead=new ExecutionCallbackNode<V>(callback,executor,callbackHead);
  }
}
Program: 47351
Project: 47351
Buggy source:
protected AbstractCompletableFuture(NodeEngine nodeEngine,ILogger logger){
  this.nodeEngine=nodeEngine;
  this.logger=logger;
  this.callbackUpdater=AtomicReferenceFieldUpdater.newUpdater(AbstractCompletableFuture.class,ExecutionCallbackNode.class,"String_Node_Str");
  this.resultUpdater=AtomicReferenceFieldUpdater.newUpdater(AbstractCompletableFuture.class,Object.class,"String_Node_Str");
}

Fixed version (ground truth):
protected AbstractCompletableFuture(NodeEngine nodeEngine,ILogger logger){
  this.nodeEngine=nodeEngine;
  this.logger=logger;
}
Program: 47352
Project: 47352
Buggy source:
protected void fireCallbacks(){
  ExecutionCallbackNode<V> callbackChain;
  for (; ; ) {
    callbackChain=callbackHead;
    if (callbackUpdater.compareAndSet(this,callbackChain,null)) {
      break;
    }
  }
  while (callbackChain != null) {
    runAsynchronous(callbackChain.callback,callbackChain.executor);
    callbackChain=callbackChain.next;
  }
}

Fixed version (ground truth):
protected void fireCallbacks(ExecutionCallbackNode<V> callbackChain){
  while (callbackChain != null) {
    runAsynchronous(callbackChain.callback,callbackChain.executor);
    callbackChain=callbackChain.next;
  }
}
Program: 47353
Project: 47353
Buggy source:
public void setResult(Object result){
  if (resultUpdater.compareAndSet(this,NULL_VALUE,result)) {
    fireCallbacks();
  }
}

Fixed version (ground truth):
public void setResult(Object result){
  ExecutionCallbackNode<V> callbackChain;
synchronized (completionLock) {
    if (isDoneInternal()) {
      return;
    }
    this.result=result;
    callbackChain=callbackHead;
    callbackHead=null;
  }
  fireCallbacks(callbackChain);
}
Program: 47354
Project: 47354
Buggy source:
private void runAsynchronous(final ExecutionCallback<V> callback,final Executor executor){
  final Object result=this.result;
  executor.execute(new Runnable(){
    @Override public void run(){
      try {
        if (result instanceof Throwable) {
          callback.onFailure((Throwable)result);
        }
 else {
          callback.onResponse((V)result);
        }
      }
 catch (      Throwable cause) {
        logger.severe("String_Node_Str" + callback + "String_Node_Str"+ AbstractCompletableFuture.this,cause);
      }
    }
  }
);
}

Fixed version (ground truth):
private void runAsynchronous(final ExecutionCallback<V> callback,final Executor executor){
  try {
    final Object result=this.result;
    executor.execute(new Runnable(){
      @Override public void run(){
        try {
          if (result instanceof Throwable) {
            callback.onFailure((Throwable)result);
          }
 else {
            callback.onResponse((V)result);
          }
        }
 catch (        Throwable cause) {
          logger.severe("String_Node_Str" + callback + "String_Node_Str"+ AbstractCompletableFuture.this,cause);
        }
      }
    }
);
  }
 catch (  RejectedExecutionException e) {
    logger.warning("String_Node_Str" + callback + "String_Node_Str",e);
  }
}
Program: 47355
Project: 47355
Buggy source:
@Override public boolean isDone(){
  return result != NULL_VALUE;
}

Fixed version (ground truth):
@Override public boolean isDone(){
  return isDoneInternal();
}
Program: 47356
Project: 47356
Buggy source:
@Override public void andThen(ExecutionCallback<V> callback,Executor executor){
  isNotNull(callback,"String_Node_Str");
  isNotNull(executor,"String_Node_Str");
  if (isDone()) {
    runAsynchronous(callback,executor);
    return;
  }
  for (; ; ) {
    ExecutionCallbackNode oldCallbackHead=callbackHead;
    ExecutionCallbackNode newCallbackHead=new ExecutionCallbackNode<V>(callback,executor,oldCallbackHead);
    if (callbackUpdater.compareAndSet(this,oldCallbackHead,newCallbackHead)) {
      break;
    }
  }
}

Fixed version (ground truth):
@Override public void andThen(ExecutionCallback<V> callback,Executor executor){
  isNotNull(callback,"String_Node_Str");
  isNotNull(executor,"String_Node_Str");
  if (isDoneInternal()) {
    runAsynchronous(callback,executor);
    return;
  }
synchronized (completionLock) {
    if (isDoneInternal()) {
      runAsynchronous(callback,executor);
      return;
    }
    this.callbackHead=new ExecutionCallbackNode<V>(callback,executor,callbackHead);
  }
}
Program: 47357
Project: 47357
Buggy source:
/** 
 * This test calls   {@link IMap} methods once which are expected to throw {@link QueryResultSizeExceededException}. <p/> This test fills the map to an amount where the exception is safely triggered. Then all   {@link IMap} methods are calledwhich should trigger the exception. <p/> This test fails if any of the called methods does not trigger the exception.
 * @param partitionCount  number of partitions the created cluster
 * @param limit           result size limit which will be configured for the cluster
 * @param preCheckTrigger number of partitions which will be used for local pre-check, <tt>-1</tt> deactivates the pre-check
 */
protected void runClientMapTestWithException(int partitionCount,int limit,int preCheckTrigger){
  internalSetUpClient(partitionCount,1,limit,preCheckTrigger);
  fillToUpperLimit(serverMap,clientMap);
  internalRunWithException(clientMap);
  shutdown(serverMap);
}

Fixed version (ground truth):
/** 
 * This test calls   {@link IMap} methods once which are expected to throw {@link QueryResultSizeExceededException}. <p/> This test fills the map to an amount where the exception is safely triggered. Then all   {@link IMap} methods are calledwhich should trigger the exception. <p/> This test fails if any of the called methods does not trigger the exception.
 * @param partitionCount  number of partitions the created cluster
 * @param limit           result size limit which will be configured for the cluster
 * @param preCheckTrigger number of partitions which will be used for local pre-check, <tt>-1</tt> deactivates the pre-check
 */
protected void runClientMapTestWithException(int partitionCount,int limit,int preCheckTrigger){
  internalSetUpClient(partitionCount,1,limit,preCheckTrigger);
  fillToUpperLimit(serverMap,clientMap);
  internalRunWithException(clientMap);
}
Program: 47358
Project: 47358
Buggy source:
/** 
 * Test which calls   {@link TransactionalMap} methods which are expected to throw {@link QueryResultSizeExceededException}. <p/> This test fills the map to an amount where the exception is safely triggered. Then all   {@link TransactionalMap} methods arecalled which should trigger the exception. <p/> This test fails if any of the called methods does not trigger the exception.
 * @param partitionCount  number of partitions the created cluster
 * @param limit           result size limit which will be configured for the cluster
 * @param preCheckTrigger number of partitions which will be used for local pre-check, <tt>-1</tt> deactivates the pre-check
 */
protected void runClientMapTestTxnWithException(int partitionCount,int limit,int preCheckTrigger){
  internalSetUpClient(partitionCount,1,limit,preCheckTrigger);
  fillToUpperLimit(serverMap,clientMap);
  internalRunTxnWithException(clientMap.getName());
  shutdown(serverMap);
}

Fixed version (ground truth):
/** 
 * Test which calls   {@link TransactionalMap} methods which are expected to throw {@link QueryResultSizeExceededException}. <p/> This test fills the map to an amount where the exception is safely triggered. Then all   {@link TransactionalMap} methods arecalled which should trigger the exception. <p/> This test fails if any of the called methods does not trigger the exception.
 * @param partitionCount  number of partitions the created cluster
 * @param limit           result size limit which will be configured for the cluster
 * @param preCheckTrigger number of partitions which will be used for local pre-check, <tt>-1</tt> deactivates the pre-check
 */
protected void runClientMapTestTxnWithException(int partitionCount,int limit,int preCheckTrigger){
  internalSetUpClient(partitionCount,1,limit,preCheckTrigger);
  fillToUpperLimit(serverMap,clientMap);
  internalRunTxnWithException(clientMap.getName());
}
Program: 47359
Project: 47359
Buggy source:
/** 
 * Calls   {@link TransactionalMap} methods once which are expected to throw {@link QueryResultSizeExceededException}. <p/> This method requires the map to be filled to an amount where the exception is safely triggered. <p/> This methods fails if any of the called methods does not trigger the exception.
 */
private void internalRunTxnWithException(String mapName){
  TransactionContext transactionContext=instance.newTransactionContext();
  transactionContext.beginTransaction();
  TransactionalMap<Object,Integer> txnMap=transactionContext.getMap(mapName);
  try {
    txnMap.values(TruePredicate.INSTANCE);
    failExpectedException("String_Node_Str");
  }
 catch (  QueryResultSizeExceededException e) {
    EmptyStatement.ignore(e);
  }
  try {
    txnMap.keySet(TruePredicate.INSTANCE);
    failExpectedException("String_Node_Str");
  }
 catch (  QueryResultSizeExceededException e) {
    EmptyStatement.ignore(e);
  }
  transactionContext.rollbackTransaction();
}

Fixed version (ground truth):
/** 
 * Calls   {@link TransactionalMap} methods once which are expected to throw {@link QueryResultSizeExceededException}. <p/> This method requires the map to be filled to an amount where the exception is safely triggered. <p/> This methods fails if any of the called methods does not trigger the exception.
 */
private void internalRunTxnWithException(String mapName){
  TransactionContext transactionContext=instance.newTransactionContext();
  try {
    transactionContext.beginTransaction();
    TransactionalMap<Object,Integer> txnMap=transactionContext.getMap(mapName);
    try {
      txnMap.values(TruePredicate.INSTANCE);
      failExpectedException("String_Node_Str");
    }
 catch (    QueryResultSizeExceededException e) {
      checkException(e);
    }
    try {
      txnMap.keySet(TruePredicate.INSTANCE);
      failExpectedException("String_Node_Str");
    }
 catch (    QueryResultSizeExceededException e) {
      checkException(e);
    }
  }
  finally {
    transactionContext.rollbackTransaction();
  }
}
Program: 47360
Project: 47360
Buggy source:
/** 
 * This test calls   {@link IMap} methods once which are not expected to throw {@link QueryResultSizeExceededException}. <p/> This test fills the map to an amount where the exception is safely triggered. Then all   {@link IMap} methods are calledwhich should not trigger the exception. <p/> This methods fails if any of the called methods triggers the exception.
 * @param partitionCount  number of partitions the created cluster
 * @param limit           result size limit which will be configured for the cluster
 * @param preCheckTrigger number of partitions which will be used for local pre-check, <tt>-1</tt> deactivates the pre-check
 */
protected void runClientMapTestWithoutException(int partitionCount,int limit,int preCheckTrigger){
  internalSetUpClient(partitionCount,1,limit,preCheckTrigger);
  fillToUpperLimit(serverMap,clientMap);
  internalRunWithoutException(clientMap);
  shutdown(serverMap);
}

Fixed version (ground truth):
/** 
 * This test calls   {@link IMap} methods once which are not expected to throw {@link QueryResultSizeExceededException}. <p/> This test fills the map to an amount where the exception is safely triggered. Then all   {@link IMap} methods are calledwhich should not trigger the exception. <p/> This methods fails if any of the called methods triggers the exception.
 * @param partitionCount  number of partitions the created cluster
 * @param limit           result size limit which will be configured for the cluster
 * @param preCheckTrigger number of partitions which will be used for local pre-check, <tt>-1</tt> deactivates the pre-check
 */
protected void runClientMapTestWithoutException(int partitionCount,int limit,int preCheckTrigger){
  internalSetUpClient(partitionCount,1,limit,preCheckTrigger);
  fillToUpperLimit(serverMap,clientMap);
  internalRunWithoutException(clientMap);
}
Program: 47361
Project: 47361
Buggy source:
/** 
 * Test which calls   {@link TransactionalMap} methods which are not expected to throw {@link QueryResultSizeExceededException}. <p/> This test fills the map to an amount where the exception is safely triggered. Then all   {@link TransactionalMap} methods arecalled which should not trigger the exception. <p/> This methods fails if any of the called methods triggers the exception.
 * @param partitionCount  number of partitions the created cluster
 * @param limit           result size limit which will be configured for the cluster
 * @param preCheckTrigger number of partitions which will be used for local pre-check, <tt>-1</tt> deactivates the pre-check
 */
protected void runClientMapTestTxnWithoutException(int partitionCount,int limit,int preCheckTrigger){
  internalSetUpClient(partitionCount,1,limit,preCheckTrigger);
  fillToUpperLimit(serverMap,clientMap);
  internalRunTxnWithoutException(clientMap.getName());
  shutdown(serverMap);
}

Fixed version (ground truth):
/** 
 * Test which calls   {@link TransactionalMap} methods which are not expected to throw {@link QueryResultSizeExceededException}. <p/> This test fills the map to an amount where the exception is safely triggered. Then all   {@link TransactionalMap} methods arecalled which should not trigger the exception. <p/> This methods fails if any of the called methods triggers the exception.
 * @param partitionCount  number of partitions the created cluster
 * @param limit           result size limit which will be configured for the cluster
 * @param preCheckTrigger number of partitions which will be used for local pre-check, <tt>-1</tt> deactivates the pre-check
 */
protected void runClientMapTestTxnWithoutException(int partitionCount,int limit,int preCheckTrigger){
  internalSetUpClient(partitionCount,1,limit,preCheckTrigger);
  fillToUpperLimit(serverMap,clientMap);
  internalRunTxnWithoutException(clientMap.getName());
}
Program: 47362
Project: 47362
Buggy source:
/** 
 * Calls   {@link TransactionalMap} methods once which are not expected to throw a {@link QueryResultSizeExceededException}. <p/> This method requires the map to be filled to an amount where the exception is safely triggered. <p/> This methods fails if any of the called methods triggers the exception.
 */
private void internalRunTxnWithoutException(String mapName){
  TransactionContext transactionContext=instance.newTransactionContext();
  transactionContext.beginTransaction();
  TransactionalMap<Object,Integer> txnMap=transactionContext.getMap(mapName);
  try {
    assertEquals("String_Node_Str",upperLimit,txnMap.values().size());
  }
 catch (  QueryResultSizeExceededException e) {
    failUnwantedException("String_Node_Str");
  }
  try {
    assertEquals("String_Node_Str",upperLimit,txnMap.keySet().size());
  }
 catch (  QueryResultSizeExceededException e) {
    failUnwantedException("String_Node_Str");
  }
  transactionContext.rollbackTransaction();
}

Fixed version (ground truth):
/** 
 * Calls   {@link TransactionalMap} methods once which are not expected to throw a {@link QueryResultSizeExceededException}. <p/> This method requires the map to be filled to an amount where the exception is safely triggered. <p/> This methods fails if any of the called methods triggers the exception.
 */
private void internalRunTxnWithoutException(String mapName){
  TransactionContext transactionContext=instance.newTransactionContext();
  try {
    transactionContext.beginTransaction();
    TransactionalMap<Object,Integer> txnMap=transactionContext.getMap(mapName);
    try {
      assertEquals("String_Node_Str",upperLimit,txnMap.values().size());
    }
 catch (    QueryResultSizeExceededException e) {
      failUnwantedException("String_Node_Str");
    }
    try {
      assertEquals("String_Node_Str",upperLimit,txnMap.keySet().size());
    }
 catch (    QueryResultSizeExceededException e) {
      failUnwantedException("String_Node_Str");
    }
  }
  finally {
    transactionContext.rollbackTransaction();
  }
}
Program: 47363
Project: 47363
Buggy source:
/** 
 * This test calls   {@link IMap} methods which have to be implemented but are not supported by the client.<p/> This methods fails if any of the called methods does not throw a  {@link UnsupportedOperationException}.
 */
protected void runClientMapTestCheckUnsupported(){
  internalSetUpClient(PARTITION_COUNT,1,1,PRE_CHECK_TRIGGER_LIMIT_INACTIVE);
  internalRunCheckUnsupported(clientMap);
  shutdown(serverMap);
}

Fixed version (ground truth):
/** 
 * This test calls   {@link IMap} methods which have to be implemented but are not supported by the client.<p/> This methods fails if any of the called methods does not throw a  {@link UnsupportedOperationException}.
 */
protected void runClientMapTestCheckUnsupported(){
  internalSetUpClient(PARTITION_COUNT,1,1,PRE_CHECK_TRIGGER_LIMIT_INACTIVE);
  internalRunCheckUnsupported(clientMap);
}
Program: 47364
Project: 47364
Buggy source:
/** 
 * Calls   {@link IMap} methods once which are expected to throw {@link QueryResultSizeExceededException}. <p/> This method requires the map to be filled to an amount where the exception is safely triggered. <p/> This methods fails if any of the called methods does not trigger the exception.
 */
private void internalRunWithException(IMap<Integer,Integer> queryMap){
  try {
    queryMap.values(TruePredicate.INSTANCE);
    failExpectedException("String_Node_Str");
  }
 catch (  QueryResultSizeExceededException e) {
    EmptyStatement.ignore(e);
  }
  try {
    queryMap.keySet(TruePredicate.INSTANCE);
    failExpectedException("String_Node_Str");
  }
 catch (  QueryResultSizeExceededException e) {
    EmptyStatement.ignore(e);
  }
  try {
    queryMap.entrySet(TruePredicate.INSTANCE);
    failExpectedException("String_Node_Str");
  }
 catch (  QueryResultSizeExceededException e) {
    EmptyStatement.ignore(e);
  }
}

Fixed version (ground truth):
/** 
 * Calls   {@link IMap} methods once which are expected to throw {@link QueryResultSizeExceededException}. <p/> This method requires the map to be filled to an amount where the exception is safely triggered. <p/> This methods fails if any of the called methods does not trigger the exception.
 */
private void internalRunWithException(IMap<Integer,Integer> queryMap){
  try {
    queryMap.values(TruePredicate.INSTANCE);
    failExpectedException("String_Node_Str");
  }
 catch (  QueryResultSizeExceededException e) {
    checkException(e);
  }
  try {
    queryMap.keySet(TruePredicate.INSTANCE);
    failExpectedException("String_Node_Str");
  }
 catch (  QueryResultSizeExceededException e) {
    checkException(e);
  }
  try {
    queryMap.entrySet(TruePredicate.INSTANCE);
    failExpectedException("String_Node_Str");
  }
 catch (  QueryResultSizeExceededException e) {
    checkException(e);
  }
}
Program: 47365
Project: 47365
Buggy source:
public AddAllBackupOperation(String name,Data[] items){
  super(name);
  this.items=items;
}

Fixed version (ground truth):
@edu.umd.cs.findbugs.annotations.SuppressWarnings({"String_Node_Str"}) public AddAllBackupOperation(String name,Data[] items){
  super(name);
  this.items=items;
}
Program: 47366
Project: 47366
Buggy source:
public AddAllOperation(String name,Data[] items,OverflowPolicy overflowPolicy){
  super(name);
  this.items=items;
  this.overflowPolicy=overflowPolicy;
}

Fixed version (ground truth):
@edu.umd.cs.findbugs.annotations.SuppressWarnings({"String_Node_Str"}) public AddAllOperation(String name,Data[] items,OverflowPolicy overflowPolicy){
  super(name);
  this.items=items;
  this.overflowPolicy=overflowPolicy;
}
Program: 47367
Project: 47367
Buggy source:
protected Config createConfig(){
  return new Config();
}

Fixed version (ground truth):
protected Config createConfig(){
  Config config=new Config();
  JoinConfig joinConfig=config.getNetworkConfig().getJoin();
  joinConfig.getAwsConfig().setEnabled(false);
  joinConfig.getMulticastConfig().setEnabled(false);
  joinConfig.getTcpIpConfig().setEnabled(false);
  return config;
}
Program: 47368
Project: 47368
Buggy source:
protected Config createConfig(){
  return new Config();
}

Fixed version (ground truth):
protected Config createConfig(){
  Config config=new Config();
  JoinConfig joinConfig=config.getNetworkConfig().getJoin();
  joinConfig.getAwsConfig().setEnabled(false);
  joinConfig.getMulticastConfig().setEnabled(false);
  joinConfig.getTcpIpConfig().setEnabled(false);
  return config;
}
Program: 47369
Project: 47369
Buggy source:
private EvictionConfig getEvictionConfig(final Node node){
  final EvictionConfig evictionConfig=new EvictionConfig();
  final Node size=node.getAttributes().getNamedItem("String_Node_Str");
  final Node maxSizePolicy=node.getAttributes().getNamedItem("String_Node_Str");
  final Node evictionPolicy=node.getAttributes().getNamedItem("String_Node_Str");
  if (size != null) {
    evictionConfig.setSize(Integer.parseInt(getTextContent(size)));
  }
  if (maxSizePolicy != null) {
    evictionConfig.setMaxSizePolicy(EvictionConfig.MaxSizePolicy.valueOf(upperCaseInternal(getTextContent(maxSizePolicy))));
  }
  if (evictionPolicy != null) {
    evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(upperCaseInternal(getTextContent(evictionPolicy))));
  }
  return evictionConfig;
}

Fixed version (ground truth):
private EvictionConfig getEvictionConfig(final Node node){
  final EvictionConfig evictionConfig=new EvictionConfig();
  final Node size=node.getAttributes().getNamedItem("String_Node_Str");
  final Node maxSizePolicy=node.getAttributes().getNamedItem("String_Node_Str");
  final Node evictionPolicy=node.getAttributes().getNamedItem("String_Node_Str");
  if (size != null) {
    evictionConfig.setSize(Integer.parseInt(getTextContent(size)));
  }
  if (maxSizePolicy != null) {
    evictionConfig.setMaximumSizePolicy(EvictionConfig.MaxSizePolicy.valueOf(upperCaseInternal(getTextContent(maxSizePolicy))));
  }
  if (evictionPolicy != null) {
    evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(upperCaseInternal(getTextContent(evictionPolicy))));
  }
  return evictionConfig;
}
Program: 47370
Project: 47370
Buggy source:
@Test public void testNearCacheConfigWithEvictionConfig() throws IOException {
  URL schemaResource=XMLConfigBuilderTest.class.getClassLoader().getResource("String_Node_Str");
  ClientConfig clientConfig=new XmlClientConfigBuilder(schemaResource).build();
  NearCacheConfig nearCacheConfig=clientConfig.getNearCacheConfig("String_Node_Str");
  assertEquals(10000,nearCacheConfig.getTimeToLiveSeconds());
  assertEquals(5000,nearCacheConfig.getMaxIdleSeconds());
  assertFalse(nearCacheConfig.isInvalidateOnChange());
  assertEquals(InMemoryFormat.OBJECT,nearCacheConfig.getInMemoryFormat());
  assertTrue(nearCacheConfig.isCacheLocalEntries());
  assertNotNull(nearCacheConfig.getEvictionConfig());
  assertEquals(100,nearCacheConfig.getEvictionConfig().getSize());
  assertEquals(EvictionConfig.MaxSizePolicy.ENTRY_COUNT,nearCacheConfig.getEvictionConfig().getMaxSizePolicy());
  assertEquals(EvictionPolicy.LFU,nearCacheConfig.getEvictionConfig().getEvictionPolicy());
}

Fixed version (ground truth):
@Test public void testNearCacheConfigWithEvictionConfig() throws IOException {
  URL schemaResource=XMLConfigBuilderTest.class.getClassLoader().getResource("String_Node_Str");
  ClientConfig clientConfig=new XmlClientConfigBuilder(schemaResource).build();
  NearCacheConfig nearCacheConfig=clientConfig.getNearCacheConfig("String_Node_Str");
  assertEquals(10000,nearCacheConfig.getTimeToLiveSeconds());
  assertEquals(5000,nearCacheConfig.getMaxIdleSeconds());
  assertFalse(nearCacheConfig.isInvalidateOnChange());
  assertEquals(InMemoryFormat.OBJECT,nearCacheConfig.getInMemoryFormat());
  assertTrue(nearCacheConfig.isCacheLocalEntries());
  assertNotNull(nearCacheConfig.getEvictionConfig());
  assertEquals(100,nearCacheConfig.getEvictionConfig().getSize());
  assertEquals(EvictionConfig.MaxSizePolicy.ENTRY_COUNT,nearCacheConfig.getEvictionConfig().getMaximumSizePolicy());
  assertEquals(EvictionPolicy.LFU,nearCacheConfig.getEvictionConfig().getEvictionPolicy());
}
Program: 47371
Project: 47371
Buggy source:
private EvictionConfig getEvictionConfig(final Node node){
  final EvictionConfig evictionConfig=new EvictionConfig();
  final Node size=node.getAttributes().getNamedItem("String_Node_Str");
  final Node maxSizePolicy=node.getAttributes().getNamedItem("String_Node_Str");
  final Node evictionPolicy=node.getAttributes().getNamedItem("String_Node_Str");
  if (size != null) {
    evictionConfig.setSize(Integer.parseInt(getTextContent(size)));
  }
  if (maxSizePolicy != null) {
    evictionConfig.setMaxSizePolicy(EvictionConfig.MaxSizePolicy.valueOf(upperCaseInternal(getTextContent(maxSizePolicy))));
  }
  if (evictionPolicy != null) {
    evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(upperCaseInternal(getTextContent(evictionPolicy))));
  }
  return evictionConfig;
}

Fixed version (ground truth):
private EvictionConfig getEvictionConfig(final Node node){
  final EvictionConfig evictionConfig=new EvictionConfig();
  final Node size=node.getAttributes().getNamedItem("String_Node_Str");
  final Node maxSizePolicy=node.getAttributes().getNamedItem("String_Node_Str");
  final Node evictionPolicy=node.getAttributes().getNamedItem("String_Node_Str");
  if (size != null) {
    evictionConfig.setSize(Integer.parseInt(getTextContent(size)));
  }
  if (maxSizePolicy != null) {
    evictionConfig.setMaximumSizePolicy(EvictionConfig.MaxSizePolicy.valueOf(upperCaseInternal(getTextContent(maxSizePolicy))));
  }
  if (evictionPolicy != null) {
    evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(upperCaseInternal(getTextContent(evictionPolicy))));
  }
  return evictionConfig;
}
Program: 47372
Project: 47372
Buggy source:
@Test public void testNearCacheConfigWithEvictionConfig() throws IOException {
  URL schemaResource=XMLConfigBuilderTest.class.getClassLoader().getResource("String_Node_Str");
  ClientConfig clientConfig=new XmlClientConfigBuilder(schemaResource).build();
  NearCacheConfig nearCacheConfig=clientConfig.getNearCacheConfig("String_Node_Str");
  assertEquals(10000,nearCacheConfig.getTimeToLiveSeconds());
  assertEquals(5000,nearCacheConfig.getMaxIdleSeconds());
  assertFalse(nearCacheConfig.isInvalidateOnChange());
  assertEquals(InMemoryFormat.OBJECT,nearCacheConfig.getInMemoryFormat());
  assertTrue(nearCacheConfig.isCacheLocalEntries());
  assertNotNull(nearCacheConfig.getEvictionConfig());
  assertEquals(100,nearCacheConfig.getEvictionConfig().getSize());
  assertEquals(EvictionConfig.MaxSizePolicy.ENTRY_COUNT,nearCacheConfig.getEvictionConfig().getMaxSizePolicy());
  assertEquals(EvictionPolicy.LFU,nearCacheConfig.getEvictionConfig().getEvictionPolicy());
}

Fixed version (ground truth):
@Test public void testNearCacheConfigWithEvictionConfig() throws IOException {
  URL schemaResource=XMLConfigBuilderTest.class.getClassLoader().getResource("String_Node_Str");
  ClientConfig clientConfig=new XmlClientConfigBuilder(schemaResource).build();
  NearCacheConfig nearCacheConfig=clientConfig.getNearCacheConfig("String_Node_Str");
  assertEquals(10000,nearCacheConfig.getTimeToLiveSeconds());
  assertEquals(5000,nearCacheConfig.getMaxIdleSeconds());
  assertFalse(nearCacheConfig.isInvalidateOnChange());
  assertEquals(InMemoryFormat.OBJECT,nearCacheConfig.getInMemoryFormat());
  assertTrue(nearCacheConfig.isCacheLocalEntries());
  assertNotNull(nearCacheConfig.getEvictionConfig());
  assertEquals(100,nearCacheConfig.getEvictionConfig().getSize());
  assertEquals(EvictionConfig.MaxSizePolicy.ENTRY_COUNT,nearCacheConfig.getEvictionConfig().getMaximumSizePolicy());
  assertEquals(EvictionPolicy.LFU,nearCacheConfig.getEvictionConfig().getEvictionPolicy());
}
Program: 47373
Project: 47373
Buggy source:
private EvictionConfig getEvictionConfig(final Node node){
  final EvictionConfig evictionConfig=new EvictionConfig();
  final Node size=node.getAttributes().getNamedItem("String_Node_Str");
  final Node maxSizePolicy=node.getAttributes().getNamedItem("String_Node_Str");
  final Node evictionPolicy=node.getAttributes().getNamedItem("String_Node_Str");
  if (size != null) {
    evictionConfig.setSize(Integer.parseInt(getTextContent(size)));
  }
  if (maxSizePolicy != null) {
    evictionConfig.setMaxSizePolicy(EvictionConfig.MaxSizePolicy.valueOf(upperCaseInternal(getTextContent(maxSizePolicy))));
  }
  if (evictionPolicy != null) {
    evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(upperCaseInternal(getTextContent(evictionPolicy))));
  }
  return evictionConfig;
}

Fixed version (ground truth):
private EvictionConfig getEvictionConfig(final Node node){
  final EvictionConfig evictionConfig=new EvictionConfig();
  final Node size=node.getAttributes().getNamedItem("String_Node_Str");
  final Node maxSizePolicy=node.getAttributes().getNamedItem("String_Node_Str");
  final Node evictionPolicy=node.getAttributes().getNamedItem("String_Node_Str");
  if (size != null) {
    evictionConfig.setSize(Integer.parseInt(getTextContent(size)));
  }
  if (maxSizePolicy != null) {
    evictionConfig.setMaximumSizePolicy(EvictionConfig.MaxSizePolicy.valueOf(upperCaseInternal(getTextContent(maxSizePolicy))));
  }
  if (evictionPolicy != null) {
    evictionConfig.setEvictionPolicy(EvictionPolicy.valueOf(upperCaseInternal(getTextContent(evictionPolicy))));
  }
  return evictionConfig;
}
Program: 47376
Project: 47376
Buggy source:
protected MaxSizeChecker createNearCacheMaxSizeChecker(EvictionConfig evictionConfig,NearCacheConfig nearCacheConfig,NearCacheContext nearCacheContext){
  EvictionConfig.MaxSizePolicy maxSizePolicy=evictionConfig.getMaxSizePolicy();
  if (maxSizePolicy == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (maxSizePolicy == EvictionConfig.MaxSizePolicy.ENTRY_COUNT) {
    return new EntryCountNearCacheMaxSizeChecker(evictionConfig.getSize(),records);
  }
  throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + maxSizePolicy + "String_Node_Str"+ getClass().getName()+ "String_Node_Str"+ EvictionConfig.MaxSizePolicy.ENTRY_COUNT+ "String_Node_Str");
}

Fixed version (ground truth):
protected MaxSizeChecker createNearCacheMaxSizeChecker(EvictionConfig evictionConfig,NearCacheConfig nearCacheConfig,NearCacheContext nearCacheContext){
  EvictionConfig.MaxSizePolicy maxSizePolicy=evictionConfig.getMaximumSizePolicy();
  if (maxSizePolicy == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (maxSizePolicy == EvictionConfig.MaxSizePolicy.ENTRY_COUNT) {
    return new EntryCountNearCacheMaxSizeChecker(evictionConfig.getSize(),records);
  }
  throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + maxSizePolicy + "String_Node_Str"+ getClass().getName()+ "String_Node_Str"+ EvictionConfig.MaxSizePolicy.ENTRY_COUNT+ "String_Node_Str");
}
Program: 47377
Project: 47377
Buggy source:
/** 
 * Sets the   {@link EvictionConfig} instance for eviction configuration of the cache config.
 * @param evictionConfig the {@link EvictionConfig} instance for eviction configuration to set
 * @return current cache config instance
 */
public CacheConfig setEvictionConfig(EvictionConfig evictionConfig){
  this.evictionConfig=isNotNull(evictionConfig,"String_Node_Str");
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the   {@link EvictionConfig} instance for eviction configuration of the cache config.
 * @param evictionConfig the {@link EvictionConfig} instance for eviction configuration to set
 * @return current cache config instance
 */
public CacheConfig setEvictionConfig(EvictionConfig evictionConfig){
  isNotNull(evictionConfig,"String_Node_Str");
  if (evictionConfig instanceof CacheEvictionConfig) {
    this.evictionConfig=(CacheEvictionConfig)evictionConfig;
  }
 else {
    this.evictionConfig=new CacheEvictionConfig(evictionConfig);
  }
  return this;
}
Program: 47379
Project: 47379
Buggy source:
/** 
 * Gets the   {@link EvictionConfig} instance for eviction configuration of the cache config.
 * @return the {@link EvictionConfig} instance for eviction configuration
 */
public EvictionConfig getEvictionConfig(){
  return evictionConfig;
}

Fixed version (ground truth):
/** 
 * Gets the   {@link EvictionConfig} instance for eviction configuration of the cache config.
 * @return the {@link EvictionConfig} instance for eviction configuration
 */
public CacheEvictionConfig getEvictionConfig(){
  return evictionConfig;
}
Program: 47380
Project: 47380
Buggy source:
@Override public EvictionConfig getEvictionConfig(){
  final EvictionConfig evictionConfig=super.getEvictionConfig();
  if (evictionConfig == null) {
    return null;
  }
  return evictionConfig.getAsReadOnly();
}

Fixed version (ground truth):
@Override public CacheEvictionConfig getEvictionConfig(){
  final CacheEvictionConfig evictionConfig=super.getEvictionConfig();
  if (evictionConfig == null) {
    return null;
  }
  return (CacheEvictionConfig)evictionConfig.getAsReadOnly();
}
Program: 47381
Project: 47381
Buggy source:
private void initNearCache(){
  NearCacheConfig clientNearCacheConfig=clientContext.getClientConfig().getNearCacheConfig(name);
  NearCacheConfig cacheNearCacheConfig=cacheConfig.getNearCacheConfig();
  NearCacheConfig nearCacheConfig;
  if (clientNearCacheConfig == null) {
    nearCacheConfig=cacheNearCacheConfig;
  }
 else {
    if (cacheNearCacheConfig != null) {
      if ("String_Node_Str".equals(clientNearCacheConfig.getName())) {
        nearCacheConfig=cacheNearCacheConfig;
      }
 else {
        nearCacheConfig=clientNearCacheConfig;
      }
    }
 else {
      nearCacheConfig=clientNearCacheConfig;
    }
  }
  if (nearCacheConfig != null) {
    cacheOnUpdate=nearCacheConfig.getLocalUpdatePolicy() == NearCacheConfig.LocalUpdatePolicy.CACHE;
    NearCacheContext nearCacheContext=new NearCacheContext(clientContext.getSerializationService(),createNearCacheExecutor(clientContext.getExecutionService()));
    nearCache=nearCacheManager.getOrCreateNearCache(nameWithPrefix,nearCacheConfig,nearCacheContext);
    registerInvalidationListener();
  }
}

Fixed version (ground truth):
private void initNearCache(){
  NearCacheConfig nearCacheConfig=clientContext.getClientConfig().getNearCacheConfig(name);
  if (nearCacheConfig != null) {
    cacheOnUpdate=nearCacheConfig.getLocalUpdatePolicy() == NearCacheConfig.LocalUpdatePolicy.CACHE;
    NearCacheContext nearCacheContext=new NearCacheContext(clientContext.getSerializationService(),createNearCacheExecutor(clientContext.getExecutionService()));
    nearCache=nearCacheManager.getOrCreateNearCache(nameWithPrefix,nearCacheConfig,nearCacheContext);
    registerInvalidationListener();
  }
}
Program: 47383
Project: 47383
Buggy source:
protected void putToCacheAndRemoveFromOtherNodeThenCantGetUpdatedFromClientNearCache(InMemoryFormat inMemoryFormat){
  NearCacheConfig nearCacheConfig=createNearCacheConfig(inMemoryFormat);
  nearCacheConfig.setInvalidateOnChange(true);
  NearCacheTestContext nearCacheTestContext1=createNearCacheTest(DEFAULT_CACHE_NAME,nearCacheConfig);
  final NearCacheTestContext nearCacheTestContext2=getNearCacheTest(DEFAULT_CACHE_NAME);
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    nearCacheTestContext1.cache.put(i,generateValueFromKey(i));
  }
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    final Integer key=i;
    final String value=nearCacheTestContext2.cache.get(key);
    HazelcastTestSupport.assertTrueEventually(new AssertTask(){
      @Override public void run() throws Exception {
        assertEquals(value,nearCacheTestContext2.nearCache.get(nearCacheTestContext2.serializationService.toData(key)));
      }
    }
);
  }
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    nearCacheTestContext1.cache.remove(i);
  }
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    final int key=i;
    HazelcastTestSupport.assertTrueEventually(new AssertTask(){
      @Override public void run() throws Exception {
        assertNull(nearCacheTestContext2.nearCache.get(nearCacheTestContext2.serializationService.toData(key)));
      }
    }
);
  }
  nearCacheTestContext1.close();
  nearCacheTestContext2.close();
}

Fixed version (ground truth):
protected void putToCacheAndRemoveFromOtherNodeThenCantGetUpdatedFromClientNearCache(InMemoryFormat inMemoryFormat){
  NearCacheConfig nearCacheConfig=createNearCacheConfig(inMemoryFormat);
  nearCacheConfig.setInvalidateOnChange(true);
  NearCacheTestContext nearCacheTestContext1=createNearCacheTest(DEFAULT_CACHE_NAME,nearCacheConfig);
  final NearCacheTestContext nearCacheTestContext2=createNearCacheTest(DEFAULT_CACHE_NAME,nearCacheConfig);
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    nearCacheTestContext1.cache.put(i,generateValueFromKey(i));
  }
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    final Integer key=i;
    final String value=nearCacheTestContext2.cache.get(key);
    HazelcastTestSupport.assertTrueEventually(new AssertTask(){
      @Override public void run() throws Exception {
        assertEquals(value,nearCacheTestContext2.nearCache.get(nearCacheTestContext2.serializationService.toData(key)));
      }
    }
);
  }
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    nearCacheTestContext1.cache.remove(i);
  }
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    final int key=i;
    HazelcastTestSupport.assertTrueEventually(new AssertTask(){
      @Override public void run() throws Exception {
        assertNull(nearCacheTestContext2.nearCache.get(nearCacheTestContext2.serializationService.toData(key)));
      }
    }
);
  }
  nearCacheTestContext1.close();
  nearCacheTestContext2.close();
}
Program: 47384
Project: 47384
Buggy source:
protected NearCacheTestContext createNearCacheTest(String cacheName,NearCacheConfig nearCacheConfig){
  HazelcastClientProxy client=(HazelcastClientProxy)HazelcastClient.newHazelcastClient(createClientConfig());
  NearCacheManager nearCacheManager=client.client.getNearCacheManager();
  CachingProvider provider=HazelcastClientCachingProvider.createCachingProvider(client);
  HazelcastClientCacheManager cacheManager=(HazelcastClientCacheManager)provider.getCacheManager();
  CacheConfig<Integer,String> cacheConfig=new CacheConfig<Integer,String>();
  cacheConfig.setNearCacheConfig(nearCacheConfig);
  ICache<Integer,String> cache=cacheManager.createCache(cacheName,cacheConfig);
  NearCache<Data,String> nearCache=nearCacheManager.getNearCache(cacheManager.getCacheNameWithPrefix(cacheName));
  return new NearCacheTestContext(client,cacheManager,nearCacheManager,cache,nearCache);
}

Fixed version (ground truth):
protected NearCacheTestContext createNearCacheTest(String cacheName,NearCacheConfig nearCacheConfig){
  ClientConfig clientConfig=createClientConfig();
  clientConfig.addNearCacheConfig(nearCacheConfig);
  HazelcastClientProxy client=(HazelcastClientProxy)HazelcastClient.newHazelcastClient(clientConfig);
  NearCacheManager nearCacheManager=client.client.getNearCacheManager();
  CachingProvider provider=HazelcastClientCachingProvider.createCachingProvider(client);
  HazelcastClientCacheManager cacheManager=(HazelcastClientCacheManager)provider.getCacheManager();
  CacheConfig<Integer,String> cacheConfig=new CacheConfig<Integer,String>();
  ICache<Integer,String> cache=cacheManager.createCache(cacheName,cacheConfig);
  NearCache<Data,String> nearCache=nearCacheManager.getNearCache(cacheManager.getCacheNameWithPrefix(cacheName));
  return new NearCacheTestContext(client,cacheManager,nearCacheManager,cache,nearCache);
}
Program: 47385
Project: 47385
Buggy source:
protected void putToCacheAndClearOrDestroyThenCantGetAnyRecordFromClientNearCache(InMemoryFormat inMemoryFormat){
  NearCacheConfig nearCacheConfig=createNearCacheConfig(inMemoryFormat);
  nearCacheConfig.setInvalidateOnChange(true);
  NearCacheTestContext nearCacheTestContext1=createNearCacheTest(DEFAULT_CACHE_NAME,nearCacheConfig);
  final NearCacheTestContext nearCacheTestContext2=getNearCacheTest(DEFAULT_CACHE_NAME);
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    nearCacheTestContext1.cache.put(i,generateValueFromKey(i));
  }
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    final Integer key=i;
    final String value=nearCacheTestContext2.cache.get(key);
    HazelcastTestSupport.assertTrueEventually(new AssertTask(){
      @Override public void run() throws Exception {
        assertEquals(value,nearCacheTestContext2.nearCache.get(nearCacheTestContext2.serializationService.toData(key)));
      }
    }
);
  }
  nearCacheTestContext1.cache.clear();
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    final int key=i;
    HazelcastTestSupport.assertTrueEventually(new AssertTask(){
      @Override public void run() throws Exception {
        assertNull(nearCacheTestContext2.nearCache.get(nearCacheTestContext2.serializationService.toData(key)));
      }
    }
);
  }
  nearCacheTestContext1.close();
  nearCacheTestContext2.close();
}

Fixed version (ground truth):
protected void putToCacheAndClearOrDestroyThenCantGetAnyRecordFromClientNearCache(InMemoryFormat inMemoryFormat){
  NearCacheConfig nearCacheConfig=createNearCacheConfig(inMemoryFormat);
  nearCacheConfig.setInvalidateOnChange(true);
  NearCacheTestContext nearCacheTestContext1=createNearCacheTest(DEFAULT_CACHE_NAME,nearCacheConfig);
  final NearCacheTestContext nearCacheTestContext2=createNearCacheTest(DEFAULT_CACHE_NAME,nearCacheConfig);
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    nearCacheTestContext1.cache.put(i,generateValueFromKey(i));
  }
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    final Integer key=i;
    final String value=nearCacheTestContext2.cache.get(key);
    HazelcastTestSupport.assertTrueEventually(new AssertTask(){
      @Override public void run() throws Exception {
        assertEquals(value,nearCacheTestContext2.nearCache.get(nearCacheTestContext2.serializationService.toData(key)));
      }
    }
);
  }
  nearCacheTestContext1.cache.clear();
  for (int i=0; i < DEFAULT_RECORD_COUNT; i++) {
    final int key=i;
    HazelcastTestSupport.assertTrueEventually(new AssertTask(){
      @Override public void run() throws Exception {
        assertNull(nearCacheTestContext2.nearCache.get(nearCacheTestContext2.serializationService.toData(key)));
      }
    }
);
  }
  nearCacheTestContext1.close();
  nearCacheTestContext2.close();
}
Program: 47386
Project: 47386
Buggy source:
@Override protected CachingProvider getCachingProvider(){
  Hazelcast.newHazelcastInstance();
  Hazelcast.newHazelcastInstance();
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.getNetworkConfig().addAddress("String_Node_Str");
  hazelcastInstance=HazelcastClient.newHazelcastClient(clientConfig);
  return HazelcastClientCachingProvider.createCachingProvider(hazelcastInstance);
}

Fixed version (ground truth):
@Override protected CachingProvider getCachingProvider(){
  Config config=new Config();
  JoinConfig joinConfig=config.getNetworkConfig().getJoin();
  joinConfig.getAwsConfig().setEnabled(false);
  joinConfig.getMulticastConfig().setEnabled(false);
  joinConfig.getTcpIpConfig().setEnabled(false);
  Hazelcast.newHazelcastInstance(config);
  Hazelcast.newHazelcastInstance(config);
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.getNetworkConfig().addAddress("String_Node_Str");
  hazelcastInstance=HazelcastClient.newHazelcastClient(clientConfig);
  return HazelcastClientCachingProvider.createCachingProvider(hazelcastInstance);
}