Program: 46302
Project: 46302
Buggy source:
protected Object getInternal(K key,ExpiryPolicy expiryPolicy,boolean async){
  final long start=System.nanoTime();
  ensureOpen();
  validateNotNull(key);
  final Data keyData=toData(key);
  Object cached=getFromNearCache(keyData,async);
  if (cached != null) {
    return cached;
  }
  final boolean marked=keyStateMarker.tryMark(keyData);
  final Data expiryPolicyData=toData(expiryPolicy);
  ClientMessage request=CacheGetCodec.encodeRequest(nameWithPrefix,keyData,expiryPolicyData);
  ClientInvocationFuture future;
  try {
    final int partitionId=clientContext.getPartitionService().getPartitionId(key);
    final HazelcastClientInstanceImpl client=(HazelcastClientInstanceImpl)clientContext.getHazelcastInstance();
    final ClientInvocation clientInvocation=new ClientInvocation(client,request,partitionId);
    future=clientInvocation.invoke();
  }
 catch (  Exception e) {
    throw rethrow(e);
  }
  SerializationService serializationService=clientContext.getSerializationService();
  ClientDelegatingFuture<V> delegatingFuture=new ClientDelegatingFuture<V>(future,serializationService,cacheGetResponseDecoder);
  if (async) {
    if (nearCache != null) {
      delegatingFuture.andThenInternal(new ExecutionCallback<Data>(){
        public void onResponse(        Data valueData){
          storeInNearCache(keyData,valueData,null,marked);
          if (statisticsEnabled) {
            handleStatisticsOnGet(start,valueData);
          }
        }
        public void onFailure(        Throwable t){
        }
      }
);
    }
    return delegatingFuture;
  }
 else {
    try {
      Object value=toObject(delegatingFuture.get());
      if (nearCache != null) {
        storeInNearCache(keyData,(Data)delegatingFuture.getResponse(),(V)value,marked);
      }
      if (statisticsEnabled) {
        handleStatisticsOnGet(start,value);
      }
      return value;
    }
 catch (    Throwable e) {
      throw ExceptionUtil.rethrowAllowedTypeFirst(e,CacheException.class);
    }
  }
}

Fixed version (ground truth):
protected Object getInternal(K key,ExpiryPolicy expiryPolicy,boolean async){
  final long start=System.nanoTime();
  ensureOpen();
  validateNotNull(key);
  final Data keyData=toData(key);
  Object cached=getFromNearCache(keyData,async);
  if (cached != null) {
    return cached;
  }
  final boolean marked=keyStateMarker.markIfUnmarked(keyData);
  final Data expiryPolicyData=toData(expiryPolicy);
  ClientMessage request=CacheGetCodec.encodeRequest(nameWithPrefix,keyData,expiryPolicyData);
  ClientInvocationFuture future;
  try {
    final int partitionId=clientContext.getPartitionService().getPartitionId(key);
    final HazelcastClientInstanceImpl client=(HazelcastClientInstanceImpl)clientContext.getHazelcastInstance();
    final ClientInvocation clientInvocation=new ClientInvocation(client,request,partitionId);
    future=clientInvocation.invoke();
  }
 catch (  Exception e) {
    resetToUnmarkedState(keyData);
    throw rethrow(e);
  }
  SerializationService serializationService=clientContext.getSerializationService();
  ClientDelegatingFuture<V> delegatingFuture=new ClientDelegatingFuture<V>(future,serializationService,cacheGetResponseDecoder);
  if (async) {
    if (nearCache != null) {
      delegatingFuture.andThenInternal(new ExecutionCallback<Data>(){
        public void onResponse(        Data valueData){
          storeInNearCache(keyData,valueData,null,marked);
          if (statisticsEnabled) {
            handleStatisticsOnGet(start,valueData);
          }
        }
        public void onFailure(        Throwable t){
          resetToUnmarkedState(keyData);
        }
      }
);
    }
    return delegatingFuture;
  }
 else {
    try {
      Object value=toObject(delegatingFuture.get());
      if (nearCache != null) {
        storeInNearCache(keyData,(Data)delegatingFuture.getResponse(),(V)value,marked);
      }
      if (statisticsEnabled) {
        handleStatisticsOnGet(start,value);
      }
      return value;
    }
 catch (    Throwable e) {
      resetToUnmarkedState(keyData);
      throw ExceptionUtil.rethrowAllowedTypeFirst(e,CacheException.class);
    }
  }
}