Program: 50375
Project: 50375
Buggy source:
void resetLocalMapStats(Map<Address,Integer> distances){
  long now=System.currentTimeMillis();
  int ownedEntryCount=0;
  int backupEntryCount=0;
  int markedAsRemovedEntryCount=0;
  int ownedEntryMemoryCost=0;
  int backupEntryMemoryCost=0;
  int markedAsRemovedMemoryCost=0;
  int hits=0;
  int lockedEntryCount=0;
  int lockWaitCount=0;
  ClusterImpl clusterImpl=node.getClusterImpl();
  for (  Record record : mapRecords.values()) {
    if (!record.isActive() || !record.isValid(now)) {
      markedAsRemovedEntryCount++;
      markedAsRemovedMemoryCost+=record.getCost();
    }
 else {
      Block block=concurrentMapManager.getOrCreateBlock(record.getBlockId());
      boolean owned=thisAddress.equals(block.getOwner());
      if (owned) {
        ownedEntryCount+=record.valueCount();
        ownedEntryMemoryCost+=record.getCost();
        localMapStats.setLastAccessTime(record.getLastAccessTime());
        localMapStats.setLastUpdateTime(record.getLastUpdateTime());
        hits+=record.getHits();
        if (record.isLocked()) {
          lockedEntryCount++;
          lockWaitCount+=record.getScheduledActionCount();
        }
      }
 else {
        boolean unknown=false;
        Address eventualOwner=(block.isMigrating()) ? block.getMigrationAddress() : block.getOwner();
        if (!thisAddress.equals(eventualOwner)) {
          Integer distance=distances.get(eventualOwner);
          if (distance != null && distance > getBackupCount()) {
            unknown=true;
          }
        }
        if (unknown) {
          markedAsRemovedEntryCount++;
          markedAsRemovedMemoryCost+=record.getCost();
          markAsRemoved(record);
        }
 else {
          backupEntryCount+=record.valueCount();
          backupEntryMemoryCost+=record.getCost();
        }
      }
    }
  }
  localMapStats.setMarkedAsRemovedEntryCount(markedAsRemovedEntryCount);
  localMapStats.setMarkedAsRemovedMemoryCost(markedAsRemovedMemoryCost);
  localMapStats.setLockWaitCount(lockWaitCount);
  localMapStats.setLockedEntryCount(lockedEntryCount);
  localMapStats.setHits(hits);
  localMapStats.setOwnedEntryCount(ownedEntryCount);
  localMapStats.setBackupEntryCount(backupEntryCount);
  localMapStats.setOwnedEntryMemoryCost(ownedEntryMemoryCost);
  localMapStats.setBackupEntryMemoryCost(backupEntryMemoryCost);
  localMapStats.setLastEvictionTime(clusterImpl.getClusterTimeFor(lastEvictionTime));
  localMapStats.setCreationTime(clusterImpl.getClusterTimeFor(creationTime));
}

Fixed version (ground truth):
void resetLocalMapStats(Map<Address,Integer> distances){
  long now=System.currentTimeMillis();
  int ownedEntryCount=0;
  int backupEntryCount=0;
  int markedAsRemovedEntryCount=0;
  int ownedEntryMemoryCost=0;
  int backupEntryMemoryCost=0;
  int markedAsRemovedMemoryCost=0;
  int hits=0;
  int lockedEntryCount=0;
  int lockWaitCount=0;
  ClusterImpl clusterImpl=node.getClusterImpl();
  for (  Record record : mapRecords.values()) {
    Block block=concurrentMapManager.getOrCreateBlock(record.getBlockId());
    boolean owned=thisAddress.equals(block.getOwner());
    if (owned) {
      if (!record.isActive() || !record.isValid(now)) {
        markedAsRemovedEntryCount++;
        markedAsRemovedMemoryCost+=record.getCost();
      }
 else {
        ownedEntryCount+=record.valueCount();
        ownedEntryMemoryCost+=record.getCost();
        localMapStats.setLastAccessTime(record.getLastAccessTime());
        localMapStats.setLastUpdateTime(record.getLastUpdateTime());
        hits+=record.getHits();
        if (record.isLocked()) {
          lockedEntryCount++;
          lockWaitCount+=record.getScheduledActionCount();
        }
      }
    }
 else {
      boolean unknown=false;
      Address eventualOwner=(block.isMigrating()) ? block.getMigrationAddress() : block.getOwner();
      if (!thisAddress.equals(eventualOwner)) {
        Integer distance=distances.get(eventualOwner);
        if (distance != null && distance > getBackupCount()) {
          unknown=true;
        }
      }
      backupEntryCount+=record.valueCount();
      backupEntryMemoryCost+=record.getCost();
    }
  }
  localMapStats.setMarkedAsRemovedEntryCount(markedAsRemovedEntryCount);
  localMapStats.setMarkedAsRemovedMemoryCost(markedAsRemovedMemoryCost);
  localMapStats.setLockWaitCount(lockWaitCount);
  localMapStats.setLockedEntryCount(lockedEntryCount);
  localMapStats.setHits(hits);
  localMapStats.setOwnedEntryCount(ownedEntryCount);
  localMapStats.setBackupEntryCount(backupEntryCount);
  localMapStats.setOwnedEntryMemoryCost(ownedEntryMemoryCost);
  localMapStats.setBackupEntryMemoryCost(backupEntryMemoryCost);
  localMapStats.setLastEvictionTime(clusterImpl.getClusterTimeFor(lastEvictionTime));
  localMapStats.setCreationTime(clusterImpl.getClusterTimeFor(creationTime));
}