Program: 48427
Project: 48427
Buggy source:
@Override public void run() throws Exception {
  response=new MapEntrySet();
  final InternalPartitionService partitionService=getNodeEngine().getPartitionService();
  final RecordStore recordStore=mapService.getRecordStore(getPartitionId(),name);
  MapEntrySimple entry;
  for (  Data key : keys) {
    if (partitionService.getPartitionId(key) != getPartitionId())     continue;
    Object objectKey=mapService.toObject(key);
    final Map.Entry<Data,Object> mapEntry=recordStore.getMapEntry(key);
    final Object valueBeforeProcess=mapService.toObject(mapEntry.getValue());
    entry=new MapEntrySimple(objectKey,valueBeforeProcess);
    final Object result=entryProcessor.process(entry);
    final Object valueAfterProcess=entry.getValue();
    Data dataValue=null;
    if (result != null) {
      dataValue=mapService.toData(result);
      response.add(new AbstractMap.SimpleImmutableEntry<Data,Data>(key,dataValue));
    }
    EntryEventType eventType;
    if (valueAfterProcess == null) {
      recordStore.remove(key);
      eventType=EntryEventType.REMOVED;
    }
 else {
      if (valueBeforeProcess == null) {
        eventType=EntryEventType.ADDED;
      }
 else       if (!entry.isModified()) {
        eventType=__NO_NEED_TO_FIRE_EVENT;
      }
 else {
        eventType=EntryEventType.UPDATED;
      }
      if (eventType != __NO_NEED_TO_FIRE_EVENT) {
        recordStore.put(new AbstractMap.SimpleImmutableEntry<Data,Object>(key,valueAfterProcess));
      }
    }
    if (eventType != __NO_NEED_TO_FIRE_EVENT) {
      Data dataOldValue=mapService.toData(mapEntry.getValue());
      mapService.publishEvent(getCallerAddress(),name,eventType,key,dataOldValue,dataValue);
      if (mapContainer.isNearCacheEnabled() && mapContainer.getMapConfig().getNearCacheConfig().isInvalidateOnChange()) {
        mapService.invalidateAllNearCaches(name,key);
      }
      if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
        if (EntryEventType.REMOVED.equals(eventType)) {
          mapService.publishWanReplicationRemove(name,key,Clock.currentTimeMillis());
        }
 else {
          Record r=recordStore.getRecord(key);
          Data tempValue=mapService.toData(dataValue);
          RecordStatistics statistics=r.getStatistics();
          long cost=r.getCost();
          long version=r.getVersion();
          SimpleEntryView entryView=new SimpleEntryView(key,tempValue,statistics,cost,version);
          mapService.publishWanReplicationUpdate(name,entryView);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run() throws Exception {
  response=new MapEntrySet();
  final InternalPartitionService partitionService=getNodeEngine().getPartitionService();
  final RecordStore recordStore=mapService.getRecordStore(getPartitionId(),name);
  MapEntrySimple entry;
  for (  Data key : keys) {
    if (partitionService.getPartitionId(key) != getPartitionId())     continue;
    Object objectKey=mapService.toObject(key);
    final Map.Entry<Data,Object> mapEntry=recordStore.getMapEntry(key);
    final Object valueBeforeProcess=mapService.toObject(mapEntry.getValue());
    entry=new MapEntrySimple(objectKey,valueBeforeProcess);
    final Object result=entryProcessor.process(entry);
    final Object valueAfterProcess=entry.getValue();
    Data dataValue=null;
    if (result != null) {
      dataValue=mapService.toData(result);
      response.add(new AbstractMap.SimpleImmutableEntry<Data,Data>(key,dataValue));
    }
    EntryEventType eventType;
    if (valueAfterProcess == null) {
      recordStore.remove(key);
      eventType=EntryEventType.REMOVED;
    }
 else {
      if (valueBeforeProcess == null) {
        eventType=EntryEventType.ADDED;
      }
 else       if (!entry.isModified()) {
        eventType=__NO_NEED_TO_FIRE_EVENT;
      }
 else {
        eventType=EntryEventType.UPDATED;
      }
      if (eventType != __NO_NEED_TO_FIRE_EVENT) {
        recordStore.put(new AbstractMap.SimpleImmutableEntry<Data,Object>(key,valueAfterProcess));
      }
    }
    if (eventType != __NO_NEED_TO_FIRE_EVENT) {
      Data dataOldValue=mapService.toData(mapEntry.getValue());
      mapService.publishEvent(getCallerAddress(),name,eventType,key,dataOldValue,dataValue);
      if (mapService.isNearCacheAndInvalidationEnabled(name)) {
        mapService.invalidateAllNearCaches(name,key);
      }
      if (mapContainer.getWanReplicationPublisher() != null && mapContainer.getWanMergePolicy() != null) {
        if (EntryEventType.REMOVED.equals(eventType)) {
          mapService.publishWanReplicationRemove(name,key,Clock.currentTimeMillis());
        }
 else {
          Record r=recordStore.getRecord(key);
          Data tempValue=mapService.toData(dataValue);
          RecordStatistics statistics=r.getStatistics();
          long cost=r.getCost();
          long version=r.getVersion();
          SimpleEntryView entryView=new SimpleEntryView(key,tempValue,statistics,cost,version);
          mapService.publishWanReplicationUpdate(name,entryView);
        }
      }
    }
  }
}