Program: 50407
Project: 50407
Buggy source:
private Object txnalPut(ClusterOperation operation,String name,Object key,Object value,long timeout,long ttl){
  ThreadContext threadContext=ThreadContext.get();
  TransactionImpl txn=threadContext.getCallContext().getTransaction();
  if (txn != null && txn.getStatus() == Transaction.TXN_STATUS_ACTIVE) {
    if (!txn.has(name,key)) {
      MLock mlock=new MLock();
      boolean locked=mlock.lockAndGetValue(name,key,DEFAULT_TXN_TIMEOUT);
      if (!locked)       throwCME(key);
      Object oldObject=null;
      Data oldValue=mlock.oldValue;
      if (oldValue != null) {
        oldObject=toObject(oldValue);
      }
      txn.attachPutOp(name,key,value,(oldObject == null));
      return threadContext.isClient() ? oldValue : oldObject;
    }
 else {
      return txn.attachPutOp(name,key,value,false);
    }
  }
 else {
    setLocal(operation,name,key,value,timeout,ttl);
    request.longValue=(request.value == null) ? Integer.MIN_VALUE : request.value.hashCode();
    setIndexValues(request,value);
    if (operation == CONCURRENT_MAP_TRY_PUT) {
      request.setBooleanRequest();
      doOp();
      Boolean returnObject=getResultAsBoolean();
      if (returnObject) {
        backup(CONCURRENT_MAP_BACKUP_PUT);
      }
      return returnObject;
    }
 else {
      request.setObjectRequest();
      doOp();
      Object returnObject=getResultAsObject();
      if (returnObject instanceof AddressAwareException) {
        rethrowException(operation,(AddressAwareException)returnObject);
      }
      backup(CONCURRENT_MAP_BACKUP_PUT);
      return returnObject;
    }
  }
}

Fixed version (ground truth):
private Object txnalPut(ClusterOperation operation,String name,Object key,Object value,long timeout,long ttl){
  ThreadContext threadContext=ThreadContext.get();
  TransactionImpl txn=threadContext.getCallContext().getTransaction();
  if (txn != null && txn.getStatus() == Transaction.TXN_STATUS_ACTIVE) {
    if (!txn.has(name,key)) {
      MLock mlock=new MLock();
      boolean locked=mlock.lockAndGetValue(name,key,DEFAULT_TXN_TIMEOUT);
      if (!locked)       throwCME(key);
      Object oldObject=null;
      Data oldValue=mlock.oldValue;
      if (oldValue != null) {
        oldObject=toObject(oldValue);
      }
      txn.attachPutOp(name,key,value,(oldObject == null));
      return threadContext.isClient() ? oldValue : oldObject;
    }
 else {
      return txn.attachPutOp(name,key,value,false);
    }
  }
 else {
    setLocal(operation,name,key,value,timeout,ttl);
    request.longValue=(request.value == null) ? Integer.MIN_VALUE : request.value.hashCode();
    setIndexValues(request,value);
    if (operation == CONCURRENT_MAP_TRY_PUT) {
      request.setBooleanRequest();
      doOp();
      Boolean returnObject=getResultAsBoolean();
      if (returnObject) {
        backup(CONCURRENT_MAP_BACKUP_PUT);
      }
      return returnObject;
    }
 else {
      request.setObjectRequest();
      doOp();
      Object returnObject=getResultAsObject();
      if (returnObject instanceof AddressAwareException) {
        rethrowException(operation,(AddressAwareException)returnObject);
      }
      request.longValue=request.ttl;
      backup(CONCURRENT_MAP_BACKUP_PUT);
      return returnObject;
    }
  }
}