Program: 50374
Project: 50374
Buggy source:
public void put(Request req){
  long now=System.currentTimeMillis();
  if (mapRecords.size() >= maxSize) {
  }
  if (req.value == null) {
    req.value=new Data();
  }
  Record record=getRecord(req.key);
  if (record != null && !record.isValid(now)) {
    markAsRemoved(record);
  }
  if (req.operation == CONCURRENT_MAP_PUT_IF_ABSENT) {
    if (record != null && record.isActive() && record.isValid(now) && record.getValue() != null) {
      req.clearForResponse();
      req.response=record.getValue();
      return;
    }
  }
 else   if (req.operation == CONCURRENT_MAP_REPLACE_IF_NOT_NULL) {
    if (record == null || !record.isActive() || !record.isValid(now) || record.getValue() == 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 (!record.getValue().equals(expectedOldValue)) {
      req.response=Boolean.FALSE;
      return;
    }
  }
  Data oldValue=null;
  Op op=UPDATE;
  if (record == null) {
    record=createNewRecord(req.key,req.value);
    mapRecords.put(req.key,record);
    op=CREATE;
  }
 else {
    if (!record.isActive()) {
      op=CREATE;
    }
    markAsActive(record);
    oldValue=(record.isValid(now)) ? record.getValue() : null;
    record.setValue(req.value);
    record.incrementVersion();
    record.setLastUpdated();
  }
  if (req.ttl > 0) {
    record.setExpirationTime(req.ttl);
    ttlPerRecord=true;
  }
  if (oldValue == null) {
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_ADDED,record);
  }
 else {
    fireInvalidation(record);
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_UPDATED,record);
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  record.setIndexes(req.indexes,req.indexTypes);
  updateStats(op,record,true,oldValue);
  updateIndexes(record);
  markAsDirty(record);
  req.clearForResponse();
  req.version=record.getVersion();
  req.longValue=record.getCopyCount();
  if (req.operation == CONCURRENT_MAP_REPLACE_IF_SAME) {
    req.response=Boolean.TRUE;
  }
 else {
    req.response=oldValue;
  }
}

Fixed version (ground truth):
public void put(Request req){
  long now=System.currentTimeMillis();
  if (mapRecords.size() >= maxSize) {
  }
  if (req.value == null) {
    req.value=new Data();
  }
  Record record=getRecord(req.key);
  if (record != null && !record.isValid(now)) {
  }
  if (req.operation == CONCURRENT_MAP_PUT_IF_ABSENT) {
    if (record != null && record.isActive() && record.isValid(now) && record.getValue() != null) {
      req.clearForResponse();
      req.response=record.getValue();
      return;
    }
  }
 else   if (req.operation == CONCURRENT_MAP_REPLACE_IF_NOT_NULL) {
    if (record == null || !record.isActive() || !record.isValid(now) || record.getValue() == 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 (!record.getValue().equals(expectedOldValue)) {
      req.response=Boolean.FALSE;
      return;
    }
  }
  Data oldValue=null;
  Op op=UPDATE;
  if (record == null) {
    record=createNewRecord(req.key,req.value);
    mapRecords.put(req.key,record);
    op=CREATE;
  }
 else {
    if (!record.isActive()) {
      op=CREATE;
    }
    markAsActive(record);
    oldValue=(record.isValid(now)) ? record.getValue() : null;
    record.setValue(req.value);
    record.incrementVersion();
    record.setLastUpdated();
  }
  if (req.ttl > 0) {
    record.setExpirationTime(req.ttl);
    ttlPerRecord=true;
  }
  if (oldValue == null) {
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_ADDED,record);
  }
 else {
    fireInvalidation(record);
    concurrentMapManager.fireMapEvent(mapListeners,getName(),EntryEvent.TYPE_UPDATED,record);
  }
  if (req.txnId != -1) {
    unlock(record);
  }
  record.setIndexes(req.indexes,req.indexTypes);
  updateStats(op,record,true,oldValue);
  updateIndexes(record);
  markAsDirty(record);
  req.clearForResponse();
  req.version=record.getVersion();
  req.longValue=record.getCopyCount();
  if (req.operation == CONCURRENT_MAP_REPLACE_IF_SAME) {
    req.response=Boolean.TRUE;
  }
 else {
    req.response=oldValue;
  }
}