Program: 49914
Project: 49914
Buggy source:
public void put(Request req){
  long now=System.currentTimeMillis();
  boolean sendEvictEvent=false;
  Record evictedRecord=null;
  if (req.value == null) {
    req.value=new Data();
  }
  Record record=getRecord(req);
  if (record != null && !record.isValid(now)) {
    if (record.isActive() && record.isEvictable()) {
      sendEvictEvent=true;
      evictedRecord=createNewRecord(record.getKeyData(),record.getValueData());
    }
    record.setValue(null);
    record.setMultiValues(null);
  }
  if (req.operation == CONCURRENT_MAP_PUT_IF_ABSENT) {
    if (record != null && record.isActive() && record.isValid(now) && record.getValueData() != null) {
      req.clearForResponse();
      req.response=record.getValueData();
      return;
    }
  }
 else   if (req.operation == CONCURRENT_MAP_REPLACE_IF_NOT_NULL) {
    if (record == null || !record.isActive() || !record.isValid(now) || record.getValueData() == null) {
      req.value=null;
      return;
    }
  }
 else   if (req.operation == CONCURRENT_MAP_REPLACE_IF_SAME) {
    if (record == null || !record.isActive() || !record.isValid(now)) {
      req.response=Boolean.FALSE;
      return;
    }
    MultiData multiData=(MultiData)toObject(req.value);
    if (multiData == null || multiData.size() != 2) {
      throw new RuntimeException("String_Node_Str" + multiData);
    }
    Data expectedOldValue=multiData.getData(0);
    req.value=multiData.getData(1);
    if (!expectedOldValue.equals(record.getValueData())) {
      req.response=Boolean.FALSE;
      return;
    }
  }
  Data oldValue=null;
  if (record == null) {
    record=createNewRecord(req.key,req.value);
    mapRecords.put(req.key,record);
  }
 else {
    markAsActive(record);
    oldValue=(record.isValid(now)) ? record.getValueData() : null;
    record.setValue(req.value);
    record.incrementVersion();
    record.setLastUpdated();
  }
  if (req.ttl > 0 && req.ttl < Long.MAX_VALUE) {
    record.setExpirationTime(req.ttl);
    ttlPerRecord=true;
  }
  if (sendEvictEvent) {
    concurrentMapManager.fireMapEvent(mapListeners,EntryEvent.TYPE_EVICTED,null,evictedRecord,req.caller);
  }
  if (oldValue == null) {
    concurrentMapManager.fireMapEvent(mapListeners,EntryEvent.TYPE_ADDED,null,record,req.caller);
  }
 else {
    fireInvalidation(record);
    concurrentMapManager.fireMapEvent(mapListeners,EntryEvent.TYPE_UPDATED,oldValue,record,req.caller);
  }
  if (req.txnId != -1 || req.operation == ClusterOperation.CONCURRENT_MAP_PUT_AND_UNLOCK) {
    unlock(record);
  }
  record.setIndexes(req.indexes,req.indexTypes);
  updateIndexes(record);
  markAsDirty(record);
  req.clearForResponse();
  req.version=record.getVersion();
  req.longValue=record.getCopyCount();
  if (localUpdateListener != null && req.txnId != Long.MIN_VALUE) {
    localUpdateListener.recordUpdated(record);
  }
  if (req.operation == CONCURRENT_MAP_REPLACE_IF_SAME || req.operation == CONCURRENT_MAP_SET) {
    req.response=Boolean.TRUE;
  }
 else {
    req.response=oldValue;
  }
}

Fixed version (ground truth):
public void put(Request req){
  long now=System.currentTimeMillis();
  boolean sendEvictEvent=false;
  Record evictedRecord=null;
  if (req.value == null) {
    req.value=new Data();
  }
  Record record=getRecord(req);
  if (record != null && !record.isValid(now)) {
    if (record.isActive() && record.isEvictable()) {
      sendEvictEvent=true;
      evictedRecord=createNewRecord(record.getKeyData(),record.getValueData());
    }
    record.setValue(null);
    record.setMultiValues(null);
  }
  if (req.operation == CONCURRENT_MAP_PUT_IF_ABSENT) {
    if (record != null && record.isActive() && record.isValid(now) && record.getValueData() != null) {
      req.clearForResponse();
      req.response=record.getValueData();
      return;
    }
  }
 else   if (req.operation == CONCURRENT_MAP_REPLACE_IF_NOT_NULL) {
    if (record == null || !record.isActive() || !record.isValid(now) || record.getValueData() == null) {
      req.value=null;
      return;
    }
  }
 else   if (req.operation == CONCURRENT_MAP_REPLACE_IF_SAME) {
    if (record == null || !record.isActive() || !record.isValid(now)) {
      req.response=Boolean.FALSE;
      return;
    }
    MultiData multiData=(MultiData)toObject(req.value);
    if (multiData == null || multiData.size() != 2) {
      throw new RuntimeException("String_Node_Str" + multiData);
    }
    Data expectedOldValue=multiData.getData(0);
    req.value=multiData.getData(1);
    if (!expectedOldValue.equals(record.getValueData())) {
      req.response=Boolean.FALSE;
      return;
    }
  }
  Data oldValue=null;
  if (record == null) {
    record=createNewRecord(req.key,req.value);
    mapRecords.put(req.key,record);
  }
 else {
    markAsActive(record);
    oldValue=(record.isValid(now)) ? record.getValueData() : null;
    record.setValue(req.value);
    record.incrementVersion();
    record.setLastUpdated();
  }
  if (req.ttl > 0 && req.ttl < Long.MAX_VALUE) {
    record.setExpirationTime(req.ttl);
    ttlPerRecord=true;
  }
  if (sendEvictEvent) {
    concurrentMapManager.fireMapEvent(mapListeners,EntryEvent.TYPE_EVICTED,null,evictedRecord,req.caller);
  }
  if (oldValue == null) {
    concurrentMapManager.fireMapEvent(mapListeners,EntryEvent.TYPE_ADDED,null,record,req.caller);
  }
 else {
    fireInvalidation(record);
    concurrentMapManager.fireMapEvent(mapListeners,EntryEvent.TYPE_UPDATED,oldValue,record,req.caller);
  }
  if (req.txnId != -1 || req.operation == ClusterOperation.CONCURRENT_MAP_PUT_AND_UNLOCK) {
    unlock(record,req);
  }
  record.setIndexes(req.indexes,req.indexTypes);
  updateIndexes(record);
  markAsDirty(record);
  req.clearForResponse();
  req.version=record.getVersion();
  req.longValue=record.getCopyCount();
  if (localUpdateListener != null && req.txnId != Long.MIN_VALUE) {
    localUpdateListener.recordUpdated(record);
  }
  if (req.operation == CONCURRENT_MAP_REPLACE_IF_SAME || req.operation == CONCURRENT_MAP_SET) {
    req.response=Boolean.TRUE;
  }
 else {
    req.response=oldValue;
  }
}