nus-yam/ex-repair huggingface dataset:
Program: 46309
Project: 46309
Buggy source:
protected Object putIfAbsentInternal(K key,V value,ExpiryPolicy expiryPolicy,boolean withCompletionEvent,boolean async){
  long start=System.nanoTime();
  ensureOpen();
  validateNotNull(key,value);
  CacheProxyUtil.validateConfiguredTypes(cacheConfig,key,value);
  Data keyData=toData(key);
  Data valueData=toData(value);
  boolean marked=cacheOnUpdate ? keyStateMarker.tryMark(keyData) : true;
  Data expiryPolicyData=toData(expiryPolicy);
  int completionId=withCompletionEvent ? nextCompletionId() : -1;
  ClientMessage request=CachePutIfAbsentCodec.encodeRequest(nameWithPrefix,keyData,valueData,expiryPolicyData,completionId);
  ClientInvocationFuture future;
  try {
    future=invoke(request,keyData,completionId);
  }
 catch (  Exception e) {
    throw rethrow(e);
  }
  ClientDelegatingFuture<Boolean> delegatingFuture=new ClientDelegatingFuture<Boolean>(future,clientContext.getSerializationService(),PUT_IF_ABSENT_RESPONSE_DECODER);
  if (async) {
    return putIfAbsentInternalAsync(value,start,keyData,valueData,delegatingFuture,marked);
  }
  return putIfAbsentInternalSync(value,start,keyData,valueData,delegatingFuture,marked);
}

Fixed version (ground truth):
protected Object putIfAbsentInternal(K key,V value,ExpiryPolicy expiryPolicy,boolean withCompletionEvent,boolean async){
  long start=System.nanoTime();
  ensureOpen();
  validateNotNull(key,value);
  CacheProxyUtil.validateConfiguredTypes(cacheConfig,key,value);
  Data keyData=toData(key);
  Data valueData=toData(value);
  boolean marked=!cacheOnUpdate || keyStateMarker.markIfUnmarked(keyData);
  Data expiryPolicyData=toData(expiryPolicy);
  int completionId=withCompletionEvent ? nextCompletionId() : -1;
  ClientMessage request=CachePutIfAbsentCodec.encodeRequest(nameWithPrefix,keyData,valueData,expiryPolicyData,completionId);
  ClientInvocationFuture future;
  try {
    future=invoke(request,keyData,completionId);
  }
 catch (  Exception e) {
    resetToUnmarkedState(keyData);
    throw rethrow(e);
  }
  ClientDelegatingFuture<Boolean> delegatingFuture=new ClientDelegatingFuture<Boolean>(future,clientContext.getSerializationService(),PUT_IF_ABSENT_RESPONSE_DECODER);
  if (async) {
    return putIfAbsentInternalAsync(value,start,keyData,valueData,delegatingFuture,marked);
  }
  return putIfAbsentInternalSync(value,start,keyData,valueData,delegatingFuture,marked);
}
Program: 46310
Project: 46310
Buggy source:
private Object putInternalSync(V value,boolean isGet,long start,Data keyData,Data valueData,ClientInvocationFuture future,boolean marked){
  try {
    ClientDelegatingFuture delegatingFuture=new ClientDelegatingFuture(future,clientContext.getSerializationService(),PUT_RESPONSE_DECODER);
    Object response=delegatingFuture.get();
    if (nearCache != null) {
      if (cacheOnUpdate) {
        storeInNearCache(keyData,valueData,value,marked);
      }
 else {
        invalidateNearCache(keyData);
      }
    }
    if (statisticsEnabled) {
      handleStatisticsOnPut(isGet,start,response);
    }
    return response;
  }
 catch (  Throwable e) {
    throw rethrowAllowedTypeFirst(e,CacheException.class);
  }
}

Fixed version (ground truth):
private Object putInternalSync(V value,boolean isGet,long start,Data keyData,Data valueData,ClientInvocationFuture future,boolean marked){
  try {
    ClientDelegatingFuture delegatingFuture=new ClientDelegatingFuture(future,clientContext.getSerializationService(),PUT_RESPONSE_DECODER);
    Object response=delegatingFuture.get();
    if (statisticsEnabled) {
      handleStatisticsOnPut(isGet,start,response);
    }
    return response;
  }
 catch (  Throwable e) {
    throw rethrowAllowedTypeFirst(e,CacheException.class);
  }
 finally {
    if (nearCache != null) {
      if (cacheOnUpdate) {
        storeInNearCache(keyData,valueData,value,marked);
      }
 else {
        invalidateNearCache(keyData);
      }
    }
  }
}
Program: 46311
Project: 46311
Buggy source:
private Object putIfAbsentInternalAsync(final V value,final long start,final Data keyData,final Data valueData,ClientDelegatingFuture<Boolean> delegatingFuture,final boolean marked){
  if (nearCache != null || statisticsEnabled) {
    delegatingFuture.andThen(new ExecutionCallback<Boolean>(){
      @Override public void onResponse(      Boolean responseData){
        if (nearCache != null) {
          if (cacheOnUpdate) {
            storeInNearCache(keyData,valueData,value,marked);
          }
 else {
            invalidateNearCache(keyData);
          }
        }
        if (statisticsEnabled) {
          Object response=clientContext.getSerializationService().toObject(responseData);
          handleStatisticsOnPutIfAbsent(start,(Boolean)response);
        }
      }
      @Override public void onFailure(      Throwable t){
      }
    }
);
  }
  return delegatingFuture;
}

Fixed version (ground truth):
private Object putIfAbsentInternalAsync(final V value,final long start,final Data keyData,final Data valueData,ClientDelegatingFuture<Boolean> delegatingFuture,final boolean marked){
  if (nearCache != null || statisticsEnabled) {
    delegatingFuture.andThen(new ExecutionCallback<Boolean>(){
      @Override public void onResponse(      Boolean responseData){
        if (nearCache != null) {
          if (cacheOnUpdate) {
            storeInNearCache(keyData,valueData,value,marked);
          }
 else {
            invalidateNearCache(keyData);
          }
        }
        if (statisticsEnabled) {
          Object response=clientContext.getSerializationService().toObject(responseData);
          handleStatisticsOnPutIfAbsent(start,(Boolean)response);
        }
      }
      @Override public void onFailure(      Throwable t){
        if (nearCache != null && cacheOnUpdate) {
          resetToUnmarkedState(keyData);
        }
      }
    }
);
  }
  return delegatingFuture;
}
Program: 46312
Project: 46312
Buggy source:
private Object putIfAbsentInternalSync(V value,long start,Data keyData,Data valueData,ClientDelegatingFuture<Boolean> delegatingFuture,boolean marked){
  try {
    Object response=delegatingFuture.get();
    if (nearCache != null) {
      if (cacheOnUpdate) {
        storeInNearCache(keyData,valueData,value,marked);
      }
 else {
        invalidateNearCache(keyData);
      }
    }
    if (statisticsEnabled) {
      handleStatisticsOnPutIfAbsent(start,(Boolean)response);
    }
    return response;
  }
 catch (  Throwable e) {
    throw rethrowAllowedTypeFirst(e,CacheException.class);
  }
}

Fixed version (ground truth):
private Object putIfAbsentInternalSync(V value,long start,Data keyData,Data valueData,ClientDelegatingFuture<Boolean> delegatingFuture,boolean marked){
  try {
    Object response=delegatingFuture.get();
    if (statisticsEnabled) {
      handleStatisticsOnPutIfAbsent(start,(Boolean)response);
    }
    return response;
  }
 catch (  Throwable e) {
    throw rethrowAllowedTypeFirst(e,CacheException.class);
  }
 finally {
    if (nearCache != null) {
      if (cacheOnUpdate) {
        storeInNearCache(keyData,valueData,value,marked);
      }
 else {
        invalidateNearCache(keyData);
      }
    }
  }
}
Program: 46313
Project: 46313
Buggy source:
@Override protected void getAllObjectInternal(List<Data> keys,List<Object> resultingKeyValuePairs){
  Map<Data,Boolean> keyStates=null;
  try {
    getCachedValue(keys,resultingKeyValuePairs);
    keyStates=createHashMap(keys.size());
    for (    Data key : keys) {
      keyStates.put(key,keyStateMarker.tryMark(key));
    }
    int currentSize=resultingKeyValuePairs.size();
    super.getAllObjectInternal(keys,resultingKeyValuePairs);
    for (int i=currentSize; i < resultingKeyValuePairs.size(); ) {
      Data key=toData(resultingKeyValuePairs.get(i++));
      Data value=toData(resultingKeyValuePairs.get(i++));
      boolean marked=keyStates.remove(key);
      if (marked) {
        tryToPutNearCache(key,value);
      }
    }
  }
  finally {
    unmarkRemainingMarkedKeys(keyStates);
  }
}

Fixed version (ground truth):
@Override protected void getAllObjectInternal(List<Data> keys,List<Object> resultingKeyValuePairs){
  Map<Data,Boolean> keyStates=createHashMap(keys.size());
  try {
    getCachedValue(keys,resultingKeyValuePairs);
    for (    Data key : keys) {
      keyStates.put(key,keyStateMarker.tryMark(key));
    }
    int currentSize=resultingKeyValuePairs.size();
    super.getAllObjectInternal(keys,resultingKeyValuePairs);
    for (int i=currentSize; i < resultingKeyValuePairs.size(); ) {
      Data key=toData(resultingKeyValuePairs.get(i++));
      Data value=toData(resultingKeyValuePairs.get(i++));
      boolean marked=keyStates.remove(key);
      if (marked) {
        tryToPutNearCache(key,value);
      }
    }
  }
  finally {
    unmarkRemainingMarkedKeys(keyStates);
  }
}
Program: 46314
Project: 46314
Buggy source:
@Before public void setup(){
  Config config=new Config();
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.addQueryCacheConfig(TEST_MAP_NAME,new QueryCacheConfig(QUERY_CACHE_NAME).setPredicateConfig(new PredicateConfig(predicate)).setIncludeValue(includeValues));
  if (useNearCache) {
    clientConfig.addNearCacheConfig(new NearCacheConfig().setName(TEST_MAP_NAME).setCacheLocalEntries(true));
  }
  clientConfig.setProperty(MapEventPublisherImpl.LISTENER_WITH_PREDICATE_PRODUCES_NATURAL_EVENT_TYPES.getName(),Boolean.toString(useQueryCacheNaturalFilteringStrategy));
  factory=new TestHazelcastFactory();
  factory.newHazelcastInstance(config);
  HazelcastInstance client=factory.newHazelcastClient(clientConfig);
  map=client.getMap(TEST_MAP_NAME);
  queryCache=map.getQueryCache(QUERY_CACHE_NAME);
}

Fixed version (ground truth):
@Before public void setup(){
  Config config=new Config();
  ClientConfig clientConfig=new ClientConfig();
  clientConfig.addQueryCacheConfig(TEST_MAP_NAME,new QueryCacheConfig(QUERY_CACHE_NAME).setPredicateConfig(new PredicateConfig(predicate)).setIncludeValue(includeValues));
  if (useNearCache) {
    clientConfig.addNearCacheConfig(new NearCacheConfig().setName(TEST_MAP_NAME).setInvalidateOnChange(true));
  }
  clientConfig.setProperty(MapEventPublisherImpl.LISTENER_WITH_PREDICATE_PRODUCES_NATURAL_EVENT_TYPES.getName(),Boolean.toString(useQueryCacheNaturalFilteringStrategy));
  factory=new TestHazelcastFactory();
  factory.newHazelcastInstance(config);
  HazelcastInstance client=factory.newHazelcastClient(clientConfig);
  map=client.getMap(TEST_MAP_NAME);
  queryCache=map.getQueryCache(QUERY_CACHE_NAME);
}
Program: 46315
Project: 46315
Buggy source:
@Override public void dispatchEvent(Object eventData,ListenerAdapter listener){
  if (eventData instanceof QueryCacheEventData) {
    dispatchQueryCacheEventData((QueryCacheEventData)eventData,listener);
    return;
  }
  if (eventData instanceof BatchEventData) {
    dispatchBatchEventData((BatchEventData)eventData,listener);
    return;
  }
  if (eventData instanceof LocalEntryEventData) {
    dispatchLocalEventData(((LocalEntryEventData)eventData),listener);
    return;
  }
  if (eventData instanceof LocalCacheWideEventData) {
    dispatchLocalEventData(((LocalCacheWideEventData)eventData),listener);
    return;
  }
  if (eventData instanceof EntryEventData) {
    dispatchEntryEventData((EntryEventData)eventData,listener);
    return;
  }
  if (eventData instanceof MapEventData) {
    dispatchMapEventData((MapEventData)eventData,listener);
    return;
  }
  if (eventData instanceof MapPartitionEventData) {
    dispatchMapPartitionLostEventData((MapPartitionEventData)eventData,listener);
    return;
  }
  if (eventData instanceof Invalidation) {
    listener.onEvent(eventData);
    incrementEventStats(((Invalidation)eventData));
    return;
  }
  throw new IllegalArgumentException("String_Node_Str" + eventData + ']');
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public void dispatchEvent(Object eventData,ListenerAdapter listener){
  if (eventData instanceof QueryCacheEventData) {
    dispatchQueryCacheEventData((QueryCacheEventData)eventData,listener);
    return;
  }
  if (eventData instanceof BatchEventData) {
    dispatchBatchEventData((BatchEventData)eventData,listener);
    return;
  }
  if (eventData instanceof LocalEntryEventData) {
    dispatchLocalEventData(((LocalEntryEventData)eventData),listener);
    return;
  }
  if (eventData instanceof LocalCacheWideEventData) {
    dispatchLocalEventData(((LocalCacheWideEventData)eventData),listener);
    return;
  }
  if (eventData instanceof EntryEventData) {
    dispatchEntryEventData((EntryEventData)eventData,listener);
    return;
  }
  if (eventData instanceof MapEventData) {
    dispatchMapEventData((MapEventData)eventData,listener);
    return;
  }
  if (eventData instanceof MapPartitionEventData) {
    dispatchMapPartitionLostEventData((MapPartitionEventData)eventData,listener);
    return;
  }
  if (eventData instanceof Invalidation) {
    listener.onEvent(eventData);
    incrementEventStats(((Invalidation)eventData));
    return;
  }
  throw new IllegalArgumentException("String_Node_Str" + eventData + ']');
}
Program: 46316
Project: 46316
Buggy source:
@Override public void onResponse(Data response){
  if (marked) {
    tryToPutNearCache(keyData,response);
  }
}

Fixed version (ground truth):
@Override public void onResponse(Data response){
  if (marked) {
    tryToPutNearCache(key,response);
  }
}
Program: 46317
Project: 46317
Buggy source:
@Override public void onFailure(Throwable t){
}

Fixed version (ground truth):
@Override public void onFailure(Throwable t){
  if (marked) {
    resetToUnmarkedState(key);
  }
}
Program: 46318
Project: 46318
Buggy source:
@Override protected V getInternal(Data key){
  Object cached=nearCache.get(key);
  if (cached != null) {
    if (NULL_OBJECT == cached) {
      return null;
    }
    return (V)cached;
  }
  boolean marked=keyStateMarker.tryMark(key);
  V value=super.getInternal(key);
  if (marked) {
    tryToPutNearCache(key,value);
  }
  return value;
}

Fixed version (ground truth):
@Override protected V getInternal(Data key){
  Object cached=nearCache.get(key);
  if (cached != null) {
    if (NULL_OBJECT == cached) {
      return null;
    }
    return (V)cached;
  }
  boolean marked=keyStateMarker.tryMark(key);
  V value;
  try {
    value=super.getInternal(key);
    if (marked) {
      tryToPutNearCache(key,value);
    }
  }
 catch (  Throwable t) {
    resetToUnmarkedState(key);
    throw ExceptionUtil.rethrow(t);
  }
  return value;
}
Program: 46319
Project: 46319
Buggy source:
@Override public ICompletableFuture<V> getAsyncInternal(final Data keyData){
  Object cached=nearCache.get(keyData);
  if (cached != null && NULL_OBJECT != cached) {
    return new CompletedFuture<V>(getContext().getSerializationService(),cached,getContext().getExecutionService().getAsyncExecutor());
  }
  final boolean marked=keyStateMarker.tryMark(keyData);
  ICompletableFuture<V> future=super.getAsyncInternal(keyData);
  ((ClientDelegatingFuture)future).andThenInternal(new ExecutionCallback<Data>(){
    @Override public void onResponse(    Data response){
      if (marked) {
        tryToPutNearCache(keyData,response);
      }
    }
    @Override public void onFailure(    Throwable t){
    }
  }
);
  return future;
}

Fixed version (ground truth):
@Override public ICompletableFuture<V> getAsyncInternal(final Data key){
  Object cached=nearCache.get(key);
  if (cached != null && NULL_OBJECT != cached) {
    return new CompletedFuture<V>(getContext().getSerializationService(),cached,getContext().getExecutionService().getAsyncExecutor());
  }
  final boolean marked=keyStateMarker.tryMark(key);
  ICompletableFuture<V> future;
  try {
    future=super.getAsyncInternal(key);
  }
 catch (  Throwable t) {
    resetToUnmarkedState(key);
    throw ExceptionUtil.rethrow(t);
  }
  ((ClientDelegatingFuture)future).andThenInternal(new ExecutionCallback<Data>(){
    @Override public void onResponse(    Data response){
      if (marked) {
        tryToPutNearCache(key,response);
      }
    }
    @Override public void onFailure(    Throwable t){
      if (marked) {
        resetToUnmarkedState(key);
      }
    }
  }
);
  return future;
}
Program: 46320
Project: 46320
Buggy source:
@Override protected List<MapGetAllCodec.ResponseParameters> getAllInternal(Map<Integer,List<Data>> pIdToKeyData,Map<K,V> result){
  Map<Data,Boolean> markers=EMPTY_MAP;
  for (  Entry<Integer,List<Data>> partitionKeyEntry : pIdToKeyData.entrySet()) {
    List<Data> keyList=partitionKeyEntry.getValue();
    Iterator<Data> iterator=keyList.iterator();
    while (iterator.hasNext()) {
      Data key=iterator.next();
      Object cached=nearCache.get(key);
      if (cached != null && NULL_OBJECT != cached) {
        result.put((K)toObject(key),(V)cached);
        iterator.remove();
      }
 else       if (invalidateOnChange) {
        if (markers == EMPTY_MAP) {
          markers=new HashMap<Data,Boolean>();
        }
        markers.put(key,keyStateMarker.tryMark(key));
      }
    }
  }
  List<MapGetAllCodec.ResponseParameters> responses=super.getAllInternal(pIdToKeyData,result);
  for (  MapGetAllCodec.ResponseParameters resultParameters : responses) {
    for (    Entry<Data,Data> entry : resultParameters.response) {
      Data key=entry.getKey();
      Data value=entry.getValue();
      Boolean marked=markers.get(key);
      if ((null != marked && marked)) {
        tryToPutNearCache(key,value);
      }
 else       if (!invalidateOnChange) {
        nearCache.put(key,value);
      }
    }
  }
  return responses;
}

Fixed version (ground truth):
@Override protected List<MapGetAllCodec.ResponseParameters> getAllInternal(Map<Integer,List<Data>> pIdToKeyData,Map<K,V> result){
  Map<Data,Boolean> markers=EMPTY_MAP;
  List<MapGetAllCodec.ResponseParameters> responses;
  try {
    for (    Entry<Integer,List<Data>> partitionKeyEntry : pIdToKeyData.entrySet()) {
      List<Data> keyList=partitionKeyEntry.getValue();
      Iterator<Data> iterator=keyList.iterator();
      while (iterator.hasNext()) {
        Data key=iterator.next();
        Object cached=nearCache.get(key);
        if (cached != null && NULL_OBJECT != cached) {
          result.put((K)toObject(key),(V)cached);
          iterator.remove();
        }
 else         if (invalidateOnChange) {
          if (markers == EMPTY_MAP) {
            markers=new HashMap<Data,Boolean>();
          }
          markers.put(key,keyStateMarker.tryMark(key));
        }
      }
    }
    responses=super.getAllInternal(pIdToKeyData,result);
    for (    MapGetAllCodec.ResponseParameters resultParameters : responses) {
      for (      Entry<Data,Data> entry : resultParameters.response) {
        Data key=entry.getKey();
        Data value=entry.getValue();
        Boolean marked=markers.remove(key);
        if ((null != marked && marked)) {
          tryToPutNearCache(key,value);
        }
 else         if (!invalidateOnChange) {
          nearCache.put(key,value);
        }
      }
    }
  }
  finally {
    unmarkRemainingMarkedKeys(markers);
  }
  return responses;
}
Program: 46321
Project: 46321
Buggy source:
private void tryToPutNearCache(Data key,Object response){
  try {
    nearCache.put(key,response);
  }
  finally {
    if (!keyStateMarker.tryUnmark(key)) {
      invalidateNearCache(key);
      keyStateMarker.forceUnmark(key);
    }
  }
}

Fixed version (ground truth):
private void tryToPutNearCache(Data key,Object response){
  try {
    nearCache.put(key,response);
  }
  finally {
    resetToUnmarkedState(key);
  }
}
Program: 46322
Project: 46322
Buggy source:
public ClientSubscriberContext(QueryCacheContext context){
  super(context);
  clientSubscriberContextSupport=new ClientSubscriberContextSupport();
}

Fixed version (ground truth):
public ClientSubscriberContext(QueryCacheContext context){
  super(context);
  clientSubscriberContextSupport=new ClientSubscriberContextSupport(context.getSerializationService());
}
Program: 46323
Project: 46323
Buggy source:
public ClientSubscriberContextSupport(){
}

Fixed version (ground truth):
public ClientSubscriberContextSupport(SerializationService serializationService){
  this.serializationService=serializationService;
}
Program: 46324
Project: 46324
Buggy source:
private void createPublishAccumulatorWithIncludeValue(AccumulatorInfo info){
  Data data=context.getSerializationService().toData(info.getPredicate());
  ClientMessage request=EnterpriseMapPublisherCreateWithValueCodec.encodeRequest(info.getMapName(),info.getCacheName(),data,info.getBatchSize(),info.getBufferSize(),info.getDelaySeconds(),info.isPopulate(),info.isCoalesce());
  InvokerWrapper invokerWrapper=context.getInvokerWrapper();
  ClientMessage response=(ClientMessage)invokerWrapper.invoke(request);
  Collection<Map.Entry<Data,Data>> result=EnterpriseMapPublisherCreateWithValueCodec.decodeResponse(response).entries;
  populateWithValues(queryCache,result);
}

Fixed version (ground truth):
private void createPublishAccumulatorWithIncludeValue(AccumulatorInfo info){
  Data data=context.getSerializationService().toData(info.getPredicate());
  ClientMessage request=EnterpriseMapPublisherCreateWithValueCodec.encodeRequest(info.getMapName(),info.getCacheName(),data,info.getBatchSize(),info.getBufferSize(),info.getDelaySeconds(),info.isPopulate(),info.isCoalesce());
  InvokerWrapper invokerWrapper=context.getInvokerWrapper();
  ClientMessage response=(ClientMessage)invokerWrapper.invoke(request);
  Collection<Map.Entry<Data,Data>> result=EnterpriseMapPublisherCreateWithValueCodec.decodeResponse(response).response;
  populateWithValues(queryCache,result);
}
Program: 46325
Project: 46325
Buggy source:
private void createPublishAccumulatorWithoutIncludeValue(AccumulatorInfo info){
  Data data=context.getSerializationService().toData(info.getPredicate());
  ClientMessage request=EnterpriseMapPublisherCreateCodec.encodeRequest(info.getMapName(),info.getCacheName(),data,info.getBatchSize(),info.getBufferSize(),info.getDelaySeconds(),info.isPopulate(),info.isCoalesce());
  InvokerWrapper invokerWrapper=context.getInvokerWrapper();
  ClientMessage response=(ClientMessage)invokerWrapper.invoke(request);
  Collection<Data> result=EnterpriseMapPublisherCreateCodec.decodeResponse(response).list;
  populateWithoutValues(queryCache,result);
}

Fixed version (ground truth):
private void createPublishAccumulatorWithoutIncludeValue(AccumulatorInfo info){
  Data data=context.getSerializationService().toData(info.getPredicate());
  ClientMessage request=EnterpriseMapPublisherCreateCodec.encodeRequest(info.getMapName(),info.getCacheName(),data,info.getBatchSize(),info.getBufferSize(),info.getDelaySeconds(),info.isPopulate(),info.isCoalesce());
  InvokerWrapper invokerWrapper=context.getInvokerWrapper();
  ClientMessage response=(ClientMessage)invokerWrapper.invoke(request);
  Collection<Data> result=EnterpriseMapPublisherCreateCodec.decodeResponse(response).response;
  populateWithoutValues(queryCache,result);
}
Program: 46326
Project: 46326
Buggy source:
@Override public ClientMessage encodeAddRequest(boolean localOnly){
  return CacheAddInvalidationListenerCodec.encodeRequest(nameWithPrefix,localOnly);
}

Fixed version (ground truth):
@Override public ClientMessage encodeAddRequest(boolean localOnly){
  if (supportsRepairableNearCache()) {
    return CacheAddNearCacheInvalidationListenerCodec.encodeRequest(nameWithPrefix,localOnly);
  }
  return CacheAddInvalidationListenerCodec.encodeRequest(nameWithPrefix,localOnly);
}
Program: 46327
Project: 46327
Buggy source:
@Override public String decodeAddResponse(ClientMessage clientMessage){
  return CacheAddInvalidationListenerCodec.decodeResponse(clientMessage).response;
}

Fixed version (ground truth):
@Override public String decodeAddResponse(ClientMessage clientMessage){
  if (supportsRepairableNearCache()) {
    return CacheAddNearCacheInvalidationListenerCodec.decodeResponse(clientMessage).response;
  }
  return CacheAddInvalidationListenerCodec.decodeResponse(clientMessage).response;
}
Program: 46328
Project: 46328
Buggy source:
@Override public void handle(String name,Collection<Data> keys,Collection<String> sourceUuids,Collection<UUID> partitionUuids,Collection<Long> sequences){
  repairingHandler.handle(keys,sourceUuids,partitionUuids,sequences);
}

Fixed version (ground truth):
@Override public void handle(String name,Collection<Data> keys,Collection<String> sourceUuids,Collection<UUID> partitionUuids,Collection<Long> sequences){
  if (sourceUuids != null && !sourceUuids.isEmpty()) {
    Iterator<Data> keysIt=keys.iterator();
    Iterator<String> sourceUuidsIt=sourceUuids.iterator();
    while (keysIt.hasNext() && sourceUuidsIt.hasNext()) {
      Data key=keysIt.next();
      String sourceUuid=sourceUuidsIt.next();
      if (!clientUuid.equals(sourceUuid)) {
        nearCache.remove(key);
      }
    }
  }
 else {
    for (    Data key : keys) {
      nearCache.remove(key);
    }
  }
}
Program: 46329
Project: 46329
Buggy source:
private ListenerMessageCodec createInvalidationListenerCodec(){
  return new ListenerMessageCodec(){
    @Override public ClientMessage encodeAddRequest(    boolean localOnly){
      return CacheAddInvalidationListenerCodec.encodeRequest(nameWithPrefix,localOnly);
    }
    @Override public String decodeAddResponse(    ClientMessage clientMessage){
      return CacheAddInvalidationListenerCodec.decodeResponse(clientMessage).response;
    }
    @Override public ClientMessage encodeRemoveRequest(    String realRegistrationId){
      return CacheRemoveEntryListenerCodec.encodeRequest(nameWithPrefix,realRegistrationId);
    }
    @Override public boolean decodeRemoveResponse(    ClientMessage clientMessage){
      return CacheRemoveEntryListenerCodec.decodeResponse(clientMessage).response;
    }
  }
;
}

Fixed version (ground truth):
private ListenerMessageCodec createInvalidationListenerCodec(){
  return new ListenerMessageCodec(){
    @Override public ClientMessage encodeAddRequest(    boolean localOnly){
      if (supportsRepairableNearCache()) {
        return CacheAddNearCacheInvalidationListenerCodec.encodeRequest(nameWithPrefix,localOnly);
      }
      return CacheAddInvalidationListenerCodec.encodeRequest(nameWithPrefix,localOnly);
    }
    @Override public String decodeAddResponse(    ClientMessage clientMessage){
      if (supportsRepairableNearCache()) {
        return CacheAddNearCacheInvalidationListenerCodec.decodeResponse(clientMessage).response;
      }
      return CacheAddInvalidationListenerCodec.decodeResponse(clientMessage).response;
    }
    @Override public ClientMessage encodeRemoveRequest(    String realRegistrationId){
      return CacheRemoveEntryListenerCodec.encodeRequest(nameWithPrefix,realRegistrationId);
    }
    @Override public boolean decodeRemoveResponse(    ClientMessage clientMessage){
      return CacheRemoveEntryListenerCodec.decodeResponse(clientMessage).response;
    }
  }
;
}
Program: 46330
Project: 46330
Buggy source:
private void registerInvalidationListener(){
  if (nearCache == null || !nearCache.isInvalidatedOnChange()) {
    return;
  }
  int partitionCount=getContext().getPartitionService().getPartitionCount();
  nearCache=asInvalidationAware(nearCache,partitionCount);
  keyStateMarker=((InvalidationAwareWrapper)nearCache).getKeyStateMarker();
  RepairingTask repairingTask=clientContext.getRepairingTask(SERVICE_NAME);
  repairingHandler=repairingTask.registerAndGetHandler(nameWithPrefix,nearCache);
  EventHandler handler=new NearCacheRepairingHandlerAdapter();
  ListenerMessageCodec listenerCodec=createInvalidationListenerCodec();
  ClientListenerService listenerService=clientContext.getListenerService();
  nearCacheMembershipRegistrationId=listenerService.registerListener(listenerCodec,handler);
}

Fixed version (ground truth):
private void registerInvalidationListener(){
  if (nearCache == null || !nearCache.isInvalidatedOnChange()) {
    return;
  }
  int partitionCount=getContext().getPartitionService().getPartitionCount();
  nearCache=asInvalidationAware(nearCache,partitionCount);
  keyStateMarker=((InvalidationAwareWrapper)nearCache).getKeyStateMarker();
  ListenerMessageCodec listenerCodec=createInvalidationListenerCodec();
  ClientListenerService listenerService=clientContext.getListenerService();
  EventHandler eventHandler=createInvalidationEventHandler();
  nearCacheMembershipRegistrationId=listenerService.registerListener(listenerCodec,eventHandler);
}
Program: 46331
Project: 46331
Buggy source:
Collection<Address> terminateNodes(int count) throws InterruptedException {
  List<HazelcastInstance> instances=new ArrayList<HazelcastInstance>(factory.getAllHazelcastInstances());
  assertThat(instances.size(),greaterThanOrEqualTo(count));
  Collections.shuffle(instances);
  if (count == 1) {
    HazelcastInstance hz=instances.get(0);
    Address address=getNode(hz).getThisAddress();
    TestUtil.terminateInstance(hz);
    return Collections.singleton(address);
  }
 else {
    final CountDownLatch latch=new CountDownLatch(count);
    Collection<Address> addresses=new HashSet<Address>();
    for (int i=0; i < count; i++) {
      final HazelcastInstance hz=instances.get(i);
      addresses.add(getNode(hz).getThisAddress());
      new Thread(){
        public void run(){
          TestUtil.terminateInstance(hz);
          latch.countDown();
        }
      }
.start();
    }
    assertTrue(latch.await(2,TimeUnit.MINUTES));
    return addresses;
  }
}

Fixed version (ground truth):
Collection<Address> terminateNodes(int count) throws InterruptedException {
  List<HazelcastInstance> instances=new ArrayList<HazelcastInstance>(factory.getAllHazelcastInstances());
  assertThat(instances.size(),greaterThanOrEqualTo(count));
  Collections.shuffle(instances);
  if (count == 1) {
    HazelcastInstance hz=instances.get(0);
    Address address=getNode(hz).getThisAddress();
    TestUtil.terminateInstance(hz);
    return Collections.singleton(address);
  }
 else {
    final CountDownLatch latch=new CountDownLatch(count);
    final Throwable[] error=new Throwable[1];
    Collection<Address> addresses=new HashSet<Address>();
    for (int i=0; i < count; i++) {
      final HazelcastInstance hz=instances.get(i);
      addresses.add(getNode(hz).getThisAddress());
      new Thread(){
        public void run(){
          try {
            TestUtil.terminateInstance(hz);
          }
 catch (          Throwable e) {
            error[0]=e;
          }
 finally {
            latch.countDown();
          }
        }
      }
.start();
    }
    assertTrue(latch.await(2,TimeUnit.MINUTES));
    if (error[0] != null) {
      ExceptionUtil.sneakyThrow(error[0]);
    }
    return addresses;
  }
}
Program: 46332
Project: 46332
Buggy source:
@Override public void stop(){
  logger.fine("String_Node_Str");
  live=false;
  final Member localMember=node.getLocalMember();
  final Address thisAddress=localMember.getAddress();
  for (  Address address : registry.getAddresses()) {
    if (address.equals(thisAddress)) {
      continue;
    }
    Node otherNode=registry.getNode(address);
    if (otherNode != null && otherNode.getState() != NodeState.SHUT_DOWN) {
      logger.fine(otherNode.getThisAddress() + "String_Node_Str");
      ILogger otherLogger=otherNode.getLogger(MockConnectionManager.class);
      otherLogger.fine(localMember + "String_Node_Str" + "String_Node_Str");
      ClusterServiceImpl clusterService=otherNode.getClusterService();
      clusterService.removeAddress(localMember.getAddress(),localMember.getUuid(),"String_Node_Str" + localMember);
    }
  }
  for (  Connection connection : mapConnections.values()) {
    connection.close(null,null);
  }
}

Fixed version (ground truth):
@Override public void stop(){
  logger.fine("String_Node_Str");
  live=false;
  final Member localMember=node.getLocalMember();
  final Address thisAddress=localMember.getAddress();
  for (  Address address : registry.getAddresses()) {
    if (address.equals(thisAddress)) {
      continue;
    }
    Node otherNode=registry.getNode(address);
    if (otherNode != null && otherNode.getState() != NodeState.SHUT_DOWN) {
      logger.fine(otherNode.getThisAddress() + "String_Node_Str");
      ILogger otherLogger=otherNode.getLogger(MockConnectionManager.class);
      otherLogger.fine(localMember + "String_Node_Str" + "String_Node_Str");
      try {
        ClusterServiceImpl clusterService=otherNode.getClusterService();
        clusterService.removeAddress(localMember.getAddress(),localMember.getUuid(),"String_Node_Str" + localMember);
      }
 catch (      Throwable e) {
        otherLogger.warning("String_Node_Str" + thisAddress,e);
      }
    }
  }
  for (  Connection connection : mapConnections.values()) {
    connection.close(null,null);
  }
}
Program: 46333
Project: 46333
Buggy source:
@Test(timeout=TimeoutInMillis.MINUTE) public void testIntegerSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(INTEGER);
  long expectation=Sums.sumValueContainer(values,INTEGER);
  Aggregator<Long,ValueContainer,ValueContainer> aggregation=Aggregators.integerSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  long result=aggregation.aggregate();
  assertThat(result,is(equalTo(expectation)));
}

Fixed version (ground truth):
@Test(timeout=TimeoutInMillis.MINUTE) public void testIntegerSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(INTEGER);
  long expectation=Sums.sumValueContainer(values,INTEGER).intValue();
  Aggregator<Long,ValueContainer,ValueContainer> aggregation=Aggregators.integerSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  long result=aggregation.aggregate();
  assertThat(result,is(equalTo(expectation)));
}
Program: 46334
Project: 46334
Buggy source:
@Test(timeout=TimeoutInMillis.MINUTE) public void testLongSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(LONG);
  long expectation=Sums.sumValueContainer(values,LONG);
  Aggregator<Long,ValueContainer,ValueContainer> aggregation=Aggregators.longSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  long result=aggregation.aggregate();
  assertThat(result,is(equalTo(expectation)));
}

Fixed version (ground truth):
@Test(timeout=TimeoutInMillis.MINUTE) public void testLongSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(LONG);
  long expectation=Sums.sumValueContainer(values,LONG).longValue();
  Aggregator<Long,ValueContainer,ValueContainer> aggregation=Aggregators.longSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  long result=aggregation.aggregate();
  assertThat(result,is(equalTo(expectation)));
}
Program: 46335
Project: 46335
Buggy source:
@Test(timeout=TimeoutInMillis.MINUTE) public void testFloatingPointSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(NUMBER);
  addValues(values,DOUBLE);
  double expectation=Sums.sumValueContainer(values,NUMBER);
  Aggregator<Double,ValueContainer,ValueContainer> aggregation=Aggregators.floatingPointSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  double result=aggregation.aggregate();
  assertThat(result,is(closeTo(expectation,ERROR)));
}

Fixed version (ground truth):
@Test(timeout=TimeoutInMillis.MINUTE) public void testFloatingPointSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(NUMBER);
  addValues(values,DOUBLE);
  double expectation=Sums.sumValueContainer(values,NUMBER).doubleValue();
  Aggregator<Double,ValueContainer,ValueContainer> aggregation=Aggregators.floatingPointSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  double result=aggregation.aggregate();
  assertThat(result,is(closeTo(expectation,ERROR)));
}
Program: 46336
Project: 46336
Buggy source:
@Test(timeout=TimeoutInMillis.MINUTE) public void testDoubleSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(DOUBLE);
  double expectation=Sums.sumValueContainer(values,DOUBLE);
  Aggregator<Double,ValueContainer,ValueContainer> aggregation=Aggregators.doubleSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  double result=aggregation.aggregate();
  assertThat(result,is(equalTo(expectation)));
}

Fixed version (ground truth):
@Test(timeout=TimeoutInMillis.MINUTE) public void testDoubleSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(DOUBLE);
  double expectation=Sums.sumValueContainer(values,DOUBLE).doubleValue();
  Aggregator<Double,ValueContainer,ValueContainer> aggregation=Aggregators.doubleSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  double result=aggregation.aggregate();
  assertThat(result,is(equalTo(expectation)));
}
Program: 46337
Project: 46337
Buggy source:
@Test(timeout=TimeoutInMillis.MINUTE) public void testFixedPointSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(NUMBER);
  addValues(values,BIG_INTEGER);
  double expectation=Sums.sumValueContainer(values,NUMBER);
  Aggregator<Long,ValueContainer,ValueContainer> aggregation=Aggregators.fixedPointSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  double result=aggregation.aggregate();
  assertThat(result,is(equalTo(expectation)));
}

Fixed version (ground truth):
@Test(timeout=TimeoutInMillis.MINUTE) public void testFixedPointSum_withAttributePath(){
  List<ValueContainer> values=sampleValueContainers(NUMBER);
  addValues(values,BIG_INTEGER);
  double expectation=Sums.sumValueContainer(values,NUMBER).doubleValue();
  Aggregator<Long,ValueContainer,ValueContainer> aggregation=Aggregators.fixedPointSum("String_Node_Str");
  for (  ValueContainer value : values) {
    aggregation.accumulate(createExtractableEntryWithValue(value));
  }
  double result=aggregation.aggregate();
  assertThat(result,is(equalTo(expectation)));
}
Program: 46338
Project: 46338
Buggy source:
Collection<Address> terminateNodes(int count) throws InterruptedException {
  List<HazelcastInstance> instances=new ArrayList<HazelcastInstance>(factory.getAllHazelcastInstances());
  assertThat(instances.size(),greaterThanOrEqualTo(count));
  Collections.shuffle(instances);
  if (count == 1) {
    HazelcastInstance hz=instances.get(0);
    Address address=getNode(hz).getThisAddress();
    TestUtil.terminateInstance(hz);
    return Collections.singleton(address);
  }
 else {
    final CountDownLatch latch=new CountDownLatch(count);
    Collection<Address> addresses=new HashSet<Address>();
    for (int i=0; i < count; i++) {
      final HazelcastInstance hz=instances.get(i);
      addresses.add(getNode(hz).getThisAddress());
      new Thread(){
        public void run(){
          TestUtil.terminateInstance(hz);
          latch.countDown();
        }
      }
.start();
    }
    assertTrue(latch.await(2,TimeUnit.MINUTES));
    return addresses;
  }
}

Fixed version (ground truth):
Collection<Address> terminateNodes(int count) throws InterruptedException {
  List<HazelcastInstance> instances=new ArrayList<HazelcastInstance>(factory.getAllHazelcastInstances());
  assertThat(instances.size(),greaterThanOrEqualTo(count));
  Collections.shuffle(instances);
  if (count == 1) {
    HazelcastInstance hz=instances.get(0);
    Address address=getNode(hz).getThisAddress();
    TestUtil.terminateInstance(hz);
    return Collections.singleton(address);
  }
 else {
    final CountDownLatch latch=new CountDownLatch(count);
    final Throwable[] error=new Throwable[1];
    Collection<Address> addresses=new HashSet<Address>();
    for (int i=0; i < count; i++) {
      final HazelcastInstance hz=instances.get(i);
      addresses.add(getNode(hz).getThisAddress());
      new Thread(){
        public void run(){
          try {
            TestUtil.terminateInstance(hz);
          }
 catch (          Throwable e) {
            error[0]=e;
          }
 finally {
            latch.countDown();
          }
        }
      }
.start();
    }
    assertTrue(latch.await(2,TimeUnit.MINUTES));
    if (error[0] != null) {
      ExceptionUtil.sneakyThrow(error[0]);
    }
    return addresses;
  }
}
Program: 46339
Project: 46339
Buggy source:
@Override public void stop(){
  logger.fine("String_Node_Str");
  live=false;
  final Member localMember=node.getLocalMember();
  final Address thisAddress=localMember.getAddress();
  for (  Address address : registry.getAddresses()) {
    if (address.equals(thisAddress)) {
      continue;
    }
    Node otherNode=registry.getNode(address);
    if (otherNode != null && otherNode.getState() != NodeState.SHUT_DOWN) {
      logger.fine(otherNode.getThisAddress() + "String_Node_Str");
      ILogger otherLogger=otherNode.getLogger(MockConnectionManager.class);
      otherLogger.fine(localMember + "String_Node_Str" + "String_Node_Str");
      ClusterServiceImpl clusterService=otherNode.getClusterService();
      clusterService.removeAddress(localMember.getAddress(),localMember.getUuid(),"String_Node_Str" + localMember);
    }
  }
  for (  Connection connection : mapConnections.values()) {
    connection.close(null,null);
  }
}

Fixed version (ground truth):
@Override public void stop(){
  logger.fine("String_Node_Str");
  live=false;
  final Member localMember=node.getLocalMember();
  final Address thisAddress=localMember.getAddress();
  for (  Address address : registry.getAddresses()) {
    if (address.equals(thisAddress)) {
      continue;
    }
    Node otherNode=registry.getNode(address);
    if (otherNode != null && otherNode.getState() != NodeState.SHUT_DOWN) {
      logger.fine(otherNode.getThisAddress() + "String_Node_Str");
      ILogger otherLogger=otherNode.getLogger(MockConnectionManager.class);
      otherLogger.fine(localMember + "String_Node_Str" + "String_Node_Str");
      try {
        ClusterServiceImpl clusterService=otherNode.getClusterService();
        clusterService.removeAddress(localMember.getAddress(),localMember.getUuid(),"String_Node_Str" + localMember);
      }
 catch (      Throwable e) {
        otherLogger.warning("String_Node_Str" + thisAddress,e);
      }
    }
  }
  for (  Connection connection : mapConnections.values()) {
    connection.close(null,null);
  }
}
Program: 46340
Project: 46340
Buggy source:
@Override public void close(String reason,Throwable cause){
  if (!alive.compareAndSet(true,false)) {
    return;
  }
  closeCause=cause;
  closeReason=reason;
  closedTime=System.currentTimeMillis();
  String message="String_Node_Str" + getRemoteSocketAddress() + "String_Node_Str";
  if (cause != null) {
    message+=cause.getClass().getName() + '[' + cause.getMessage()+ ']';
  }
 else {
    message+="String_Node_Str";
  }
  try {
    innerClose();
  }
 catch (  Exception e) {
    logger.warning(e);
  }
  if (lifecycleService.isRunning()) {
    logger.warning(message);
  }
 else {
    logger.finest(message);
  }
  connectionManager.onClose(this);
  client.getMetricsRegistry().discardMetrics(this);
}

Fixed version (ground truth):
@Override public void close(String reason,Throwable cause){
  if (!alive.compareAndSet(true,false)) {
    return;
  }
  closeCause=cause;
  closeReason=reason;
  closedTime=System.currentTimeMillis();
  String message="String_Node_Str" + getRemoteSocketAddress() + "String_Node_Str";
  if (cause != null) {
    message+=cause.getClass().getName() + '[' + cause.getMessage()+ ']';
  }
 else {
    message+="String_Node_Str";
  }
  try {
    innerClose();
  }
 catch (  Exception e) {
    logger.warning(e);
  }
  if (lifecycleService.isRunning()) {
    logger.warning(message);
  }
 else {
    logger.finest(message);
  }
  connectionManager.onClose(this);
  client.getMetricsRegistry().discardMetrics(this);
  closed=true;
}
Program: 46341
Project: 46341
Buggy source:
@Before public void before(){
  factory=new TestHazelcastFactory();
  instances=factory.newInstances(new Config(),3);
  for (  HazelcastInstance instance : instances) {
    assertClusterSizeEventually(3,instance);
  }
  instance=instances[instances.length - 1];
}

Fixed version (ground truth):
@Before public void before(){
  factory=new TestHazelcastFactory();
  instances=factory.newInstances(new Config(),4);
  for (  HazelcastInstance instance : instances) {
    assertClusterSizeEventually(4,instance);
  }
  instance=instances[instances.length - 1];
}
Program: 46342
Project: 46342
Buggy source:
public long[] runningOperations(){
  return runningOperations;
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") public long[] runningOperations(){
  return runningOperations;
}
Program: 46343
Project: 46343
Buggy source:
public long[] operationsToCancel(){
  return operationsToCancel;
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") public long[] operationsToCancel(){
  return operationsToCancel;
}
Program: 46344
Project: 46344
Buggy source:
public OperationControl(long[] runningOperations,long[] operationsToCancel){
  this.runningOperations=runningOperations;
  this.operationsToCancel=operationsToCancel;
}

Fixed version (ground truth):
@SuppressFBWarnings("String_Node_Str") public OperationControl(long[] runningOperations,long[] operationsToCancel){
  this.runningOperations=runningOperations;
  this.operationsToCancel=operationsToCancel;
}
Program: 46345
Project: 46345
Buggy source:
/** 
 * Init the ObjectDataInput for the given Data skipping the header-bytes, - in case of DataSerializable, it skips the first header byte, and then the class-name - in case of IdentifiedDataSerializable, it skips the first header byte, and then the factoryId and classId integer bytes
 * @param data data to initialize the ObjectDataInput with.
 * @return the initialized ObjectDataInput without the header.
 * @throws IOException
 */
public ObjectDataInput initDataSerializableInputAndSkipTheHeader(Data data) throws IOException {
  ObjectDataInput input=createObjectDataInput(data);
  byte header=input.readByte();
  if (header == IDENTIFIED_DATA_SERIALIZABLE_HEADER_VALUE) {
    input.skipBytes(FACTORY_AND_CLASS_ID_BYTE_LENGTH);
  }
 else   if (header == DATA_SERIALIZABLE_HEADER_VALUE) {
    input.readUTF();
  }
 else {
    throw new HazelcastSerializationException("String_Node_Str");
  }
  return input;
}

Fixed version (ground truth):
/** 
 * Init the ObjectDataInput for the given Data skipping the header-bytes, - in case of DataSerializable, it skips the first header byte, and then the class-name - in case of IdentifiedDataSerializable, it skips the first header byte, and then the factoryId and classId integer bytes
 * @param data data to initialize the ObjectDataInput with.
 * @return the initialized ObjectDataInput without the header.
 * @throws IOException
 */
public ObjectDataInput initDataSerializableInputAndSkipTheHeader(Data data) throws IOException {
  ObjectDataInput input=createObjectDataInput(data);
  byte header=input.readByte();
  if (header == IDENTIFIED_DATA_SERIALIZABLE_HEADER_VALUE) {
    if (input.skipBytes(FACTORY_AND_CLASS_ID_BYTE_LENGTH) != FACTORY_AND_CLASS_ID_BYTE_LENGTH) {
      throw new HazelcastSerializationException("String_Node_Str");
    }
  }
 else   if (header == DATA_SERIALIZABLE_HEADER_VALUE) {
    input.readUTF();
  }
 else {
    throw new HazelcastSerializationException("String_Node_Str");
  }
  return input;
}