Program: 49594
Project: 49594
Buggy source:
public void put(Request req){
  long now=Clock.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=createNewTransientRecord(record.getKeyData(),record.getValueData());
    }
    record.setValueData(null);
    record.setMultiValues(null);
  }
  if (req.operation == CONCURRENT_MAP_PUT_IF_ABSENT) {
    if (!isApplicable(CONCURRENT_MAP_PUT_IF_ABSENT,req,now)) {
      req.clearForResponse();
      req.response=record.getValueData();
      return;
    }
  }
 else   if (req.operation == CONCURRENT_MAP_REPLACE_IF_NOT_NULL) {
    if (!isApplicable(CONCURRENT_MAP_REPLACE_IF_NOT_NULL,req,now)) {
      req.value=null;
      return;
    }
  }
  Data oldValue=null;
  if (record == null) {
    record=createAndAddNewRecord(req.key,req.value);
  }
 else {
    markAsActive(record);
    oldValue=(record.isValid(now)) ? record.getValueData() : null;
    record.setValueData(req.value);
    record.incrementVersion();
    record.setLastUpdated();
  }
  if (req.ttl > 0 && req.ttl < Long.MAX_VALUE) {
    record.setTTL(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,false);
  req.clearForResponse();
  req.version=record.getVersion();
  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=Clock.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=createNewTransientRecord(record.getKeyData(),record.getValueData());
    }
    record.setValueData(null);
    record.setMultiValues(null);
  }
  if (req.operation == CONCURRENT_MAP_PUT_IF_ABSENT) {
    if (!isApplicable(CONCURRENT_MAP_PUT_IF_ABSENT,req,now)) {
      req.clearForResponse();
      req.response=record.getValueData();
      return;
    }
  }
 else   if (req.operation == CONCURRENT_MAP_REPLACE_IF_NOT_NULL) {
    if (!isApplicable(CONCURRENT_MAP_REPLACE_IF_NOT_NULL,req,now)) {
      req.value=null;
      return;
    }
  }
  Data oldValue=null;
  if (record == null) {
    record=createAndAddNewRecord(req.key,req.value);
  }
 else {
    markAsActive(record);
    oldValue=(record.isValid(now)) ? record.getValueData() : null;
    record.setValueData(req.value);
    record.incrementVersion();
    record.setLastUpdated();
  }
  if (req.ttl > 0 && req.ttl < Long.MAX_VALUE) {
    record.setTTL(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,false);
  req.clearForResponse();
  req.version=record.getVersion();
  if (localUpdateListener != null && req.txnId != Long.MIN_VALUE) {
    localUpdateListener.recordUpdated(record);
  }
  if (req.operation == CONCURRENT_MAP_SET || req.operation == CONCURRENT_MAP_TRY_PUT || req.operation == CONCURRENT_MAP_PUT_TRANSIENT || req.operation == CONCURRENT_MAP_REPLACE_IF_SAME || req.operation == CONCURRENT_MAP_PUT_AND_UNLOCK) {
    req.response=Boolean.TRUE;
  }
 else {
    req.response=oldValue;
  }
}