Program: 14438
Project: 14438
Buggy source:
@ExposedCommand public static void generateFalseData(){
  log.debug("String_Node_Str");
  int uniqueUserId=0;
  int uniqueAccountId=0;
  int uniqueClusterId=0;
  for (int availZoneNum=0; availZoneNum < NUM_AVAIL_ZONE; availZoneNum++) {
    String availZone="String_Node_Str" + availZoneNum;
    for (int clusterNum=0; clusterNum < NUM_CLUSTERS_PER_ZONE; clusterNum++) {
      uniqueClusterId++;
      String cluster="String_Node_Str" + uniqueClusterId;
      for (int accountNum=0; accountNum < NUM_ACCOUNTS_PER_CLUSTER; accountNum++) {
        uniqueAccountId++;
        String accountId="String_Node_Str" + uniqueAccountId;
        String accountName="String_Node_Str" + uniqueAccountId;
        ReportingAccountCrud.getInstance().createOrUpdateAccount(accountId,accountName);
        for (int userNum=0; userNum < NUM_USERS_PER_ACCOUNT; userNum++) {
          log.debug(String.format("String_Node_Str",userNum));
          String user="String_Node_Str" + userNum;
          uniqueUserId++;
          List<Attachment> attachments=new ArrayList<Attachment>();
          String userId="String_Node_Str" + uniqueUserId;
          String userName="String_Node_Str" + uniqueUserId;
          ReportingUserCrud.getInstance().createOrUpdateUser(userId,accountId,userName);
          long instanceUuidNum=INSTANCE_UUID_START;
          long volumeUuidNum=VOLUME_UUID_START;
          long elasticIpUuidNum=ELASTIC_IP_UUID_START;
          long snapshotUuidNum=SNAPSHOT_UUID_START;
          long bucketUuidNum=BUCKET_UUID_START;
          long objectUuidNum=OBJECT_UUID_START;
          String instanceUuid="String_Node_Str";
          String volumeUuid="String_Node_Str";
          String elasticIpUuid="String_Node_Str";
          String bucketName="String_Node_Str";
          int createdInstanceNum=0;
          for (int periodNum=0; periodNum < NUM_PERIODS; periodNum++) {
            log.debug(String.format("String_Node_Str",periodNum));
            long timeMs=START_TIME + (PERIOD_DURATION * periodNum);
            if (periodNum % NUM_PERIODS_PER_ENTITY == 0) {
              int typeNum=createdInstanceNum % FalseInstanceType.values().length;
              FalseInstanceType type=FalseInstanceType.values()[typeNum];
              instanceUuid=String.format(UUID_FORMAT,uniqueUserId,instanceUuidNum++);
              log.debug(String.format("String_Node_Str",instanceUuid));
              ReportingInstanceEventStore.getInstance().insertCreateEvent(instanceUuid,("String_Node_Str" + userNum + "String_Node_Str"+ periodNum),timeMs,type.toString(),userId,availZone);
              createdInstanceNum++;
              volumeUuid=String.format(UUID_FORMAT,uniqueUserId,volumeUuidNum++);
              log.debug(String.format("String_Node_Str",volumeUuid));
              ReportingVolumeEventStore.getInstance().insertCreateEvent(volumeUuid,("String_Node_Str" + userNum + "String_Node_Str"+ periodNum),timeMs,userId,availZone,VOLUME_SIZE);
              elasticIpUuid=String.format(UUID_FORMAT,uniqueUserId,elasticIpUuidNum++);
              log.debug(String.format("String_Node_Str",elasticIpUuid));
              String ip=String.format("String_Node_Str",(userNum >> 8) % 256,userNum % 256,(periodNum >> 8) % 256,periodNum % 256);
              ReportingElasticIpEventStore.getInstance().insertCreateEvent(elasticIpUuid,timeMs,userId,ip);
            }
            if (periodNum % NUM_PERIODS_PER_SNAPSHOT == 0) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,snapshotUuidNum++);
              log.debug(String.format("String_Node_Str",uuid));
              ReportingVolumeSnapshotEventStore.getInstance().insertCreateEvent(uuid,volumeUuid,("String_Node_Str" + userNum + "String_Node_Str"+ periodNum),timeMs,userId,SNAPSHOT_SIZE);
            }
            if (periodNum % NUM_PERIODS_PER_BUCKET == 0) {
              bucketName="String_Node_Str" + bucketUuidNum++;
            }
            if (periodNum % NUM_PERIODS_PER_OBJECT == 0) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,objectUuidNum++);
              log.debug(String.format("String_Node_Str",uuid));
              for (int i=0; i < NUM_VERSIONS_PER_OBJECT; i++) {
                ReportingS3ObjectEventStore.getInstance().insertS3ObjectCreateEvent(bucketName,uuid,"String_Node_Str",OBJECT_SIZE,timeMs,userId);
              }
            }
            double oneMB=1024d * 11024d;
            for (long i=INSTANCE_UUID_START; i < instanceUuidNum - 2; i++) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,i);
              log.debug(String.format("String_Node_Str",uuid));
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 2 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 3 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 4 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 5 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 6 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 7 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 8 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",100000d * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",200000d * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",(double)(PERIOD_DURATION / 2) * periodNum);
            }
            for (long i=VOLUME_UUID_START; i < volumeUuidNum - 2; i++) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,i);
              log.debug(String.format("String_Node_Str",uuid));
              ReportingVolumeEventStore.getInstance().insertUsageEvent(uuid,timeMs,VOLUME_CUMULATIVE_READ_PER_PERIOD,VOLUME_CUMULATIVE_WRITTEN_PER_PERIOD);
            }
            for (long i=OBJECT_UUID_START; i < objectUuidNum - 2; i++) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,i);
              long bucketNum=i / (NUM_PERIODS_PER_BUCKET / NUM_PERIODS_PER_OBJECT);
              bucketName=String.format(UUID_FORMAT,uniqueUserId,bucketNum);
              log.debug(String.format("String_Node_Str",bucketName,uuid));
              ReportingS3ObjectEventStore.getInstance().insertS3ObjectUsageEvent(bucketName,uuid,"String_Node_Str",OBJECT_SIZE,timeMs,userId);
            }
            ReportingVolumeEventStore.getInstance().insertAttachEvent(volumeUuid,instanceUuid,VOLUME_SIZE,timeMs);
            ReportingElasticIpEventStore.getInstance().insertAttachEvent(elasticIpUuid,instanceUuid,timeMs);
            log.debug(String.format("String_Node_Str",volumeUuid,elasticIpUuid,instanceUuid));
            attachments.add(new Attachment(instanceUuid,volumeUuid,elasticIpUuid));
            if (attachments.size() >= ATTACH_PERIODS_DURATION) {
              Attachment attachment=attachments.remove(0);
              ReportingVolumeEventStore.getInstance().insertDetachEvent(attachment.getVolumeUuid(),attachment.getInstanceUuid(),VOLUME_SIZE,timeMs);
              ReportingElasticIpEventStore.getInstance().insertDetachEvent(attachment.getElasticIpUuid(),attachment.getInstanceUuid(),timeMs);
              log.debug(String.format("String_Node_Str",attachment.getVolumeUuid(),attachment.getElasticIpUuid(),attachment.getInstanceUuid()));
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@ExposedCommand public static void generateFalseData(){
  log.debug("String_Node_Str");
  int uniqueUserId=0;
  int uniqueAccountId=0;
  int uniqueClusterId=0;
  for (int availZoneNum=0; availZoneNum < NUM_AVAIL_ZONE; availZoneNum++) {
    String availZone="String_Node_Str" + availZoneNum;
    for (int clusterNum=0; clusterNum < NUM_CLUSTERS_PER_ZONE; clusterNum++) {
      uniqueClusterId++;
      String cluster="String_Node_Str" + uniqueClusterId;
      for (int accountNum=0; accountNum < NUM_ACCOUNTS_PER_CLUSTER; accountNum++) {
        uniqueAccountId++;
        String accountId="String_Node_Str" + uniqueAccountId;
        String accountName="String_Node_Str" + uniqueAccountId;
        ReportingAccountCrud.getInstance().createOrUpdateAccount(accountId,accountName);
        for (int userNum=0; userNum < NUM_USERS_PER_ACCOUNT; userNum++) {
          log.debug(String.format("String_Node_Str",userNum));
          String user="String_Node_Str" + userNum;
          uniqueUserId++;
          List<Attachment> attachments=new ArrayList<Attachment>();
          String userId="String_Node_Str" + uniqueUserId;
          String userName="String_Node_Str" + uniqueUserId;
          ReportingUserCrud.getInstance().createOrUpdateUser(userId,accountId,userName);
          long instanceUuidNum=INSTANCE_UUID_START;
          long volumeUuidNum=VOLUME_UUID_START;
          long elasticIpUuidNum=ELASTIC_IP_UUID_START;
          long snapshotUuidNum=SNAPSHOT_UUID_START;
          long bucketUuidNum=BUCKET_UUID_START;
          long objectUuidNum=OBJECT_UUID_START;
          String instanceUuid="String_Node_Str";
          String volumeUuid="String_Node_Str";
          String elasticIpUuid="String_Node_Str";
          String bucketName="String_Node_Str";
          int createdInstanceNum=0;
          for (int periodNum=0; periodNum < NUM_PERIODS; periodNum++) {
            log.debug(String.format("String_Node_Str",periodNum));
            long timeMs=START_TIME + (PERIOD_DURATION * periodNum);
            if (periodNum % NUM_PERIODS_PER_ENTITY == 0) {
              int typeNum=createdInstanceNum % FalseInstanceType.values().length;
              FalseInstanceType type=FalseInstanceType.values()[typeNum];
              instanceUuid=String.format(UUID_FORMAT,uniqueUserId,instanceUuidNum++);
              log.debug(String.format("String_Node_Str",instanceUuid));
              ReportingInstanceEventStore.getInstance().insertCreateEvent(instanceUuid,("String_Node_Str" + userNum + "String_Node_Str"+ periodNum),timeMs,type.toString(),userId,availZone);
              createdInstanceNum++;
              volumeUuid=String.format(UUID_FORMAT,uniqueUserId,volumeUuidNum++);
              log.debug(String.format("String_Node_Str",volumeUuid));
              ReportingVolumeEventStore.getInstance().insertCreateEvent(volumeUuid,("String_Node_Str" + userNum + "String_Node_Str"+ periodNum),timeMs,userId,availZone,VOLUME_SIZE);
              elasticIpUuid=String.format(UUID_FORMAT,uniqueUserId,elasticIpUuidNum++);
              log.debug(String.format("String_Node_Str",elasticIpUuid));
              String ip=String.format("String_Node_Str",(userNum >> 8) % 256,userNum % 256,(periodNum >> 8) % 256,periodNum % 256);
              ReportingElasticIpEventStore.getInstance().insertCreateEvent(elasticIpUuid,timeMs,userId,ip);
            }
            if (periodNum % NUM_PERIODS_PER_SNAPSHOT == 0) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,snapshotUuidNum++);
              log.debug(String.format("String_Node_Str",uuid));
              ReportingVolumeSnapshotEventStore.getInstance().insertCreateEvent(uuid,volumeUuid,("String_Node_Str" + userNum + "String_Node_Str"+ periodNum),timeMs,userId,SNAPSHOT_SIZE);
            }
            if (periodNum % NUM_PERIODS_PER_BUCKET == 0) {
              bucketName="String_Node_Str" + bucketUuidNum++;
            }
            if (periodNum % NUM_PERIODS_PER_OBJECT == 0) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,objectUuidNum++);
              log.debug(String.format("String_Node_Str",uuid));
              for (int i=0; i < NUM_VERSIONS_PER_OBJECT; i++) {
                ReportingS3ObjectEventStore.getInstance().insertS3ObjectCreateEvent(bucketName,uuid,"String_Node_Str",OBJECT_SIZE,timeMs,userId);
              }
            }
            double oneMB=1024d * 11024d;
            for (long i=INSTANCE_UUID_START; i < instanceUuidNum - 2; i++) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,i);
              log.debug(String.format("String_Node_Str",uuid));
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 2 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 3 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 4 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 5 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 6 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 7 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",oneMB * 8 * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",100000d * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",200000d * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",100000d * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",200000d * periodNum);
              ReportingInstanceEventStore.getInstance().insertUsageEvent(uuid,timeMs,"String_Node_Str",0L,"String_Node_Str",(double)(PERIOD_DURATION / 2) * periodNum);
            }
            for (long i=VOLUME_UUID_START; i < volumeUuidNum - 2; i++) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,i);
              log.debug(String.format("String_Node_Str",uuid));
              ReportingVolumeEventStore.getInstance().insertUsageEvent(uuid,timeMs,VOLUME_CUMULATIVE_READ_PER_PERIOD,VOLUME_CUMULATIVE_WRITTEN_PER_PERIOD);
            }
            for (long i=OBJECT_UUID_START; i < objectUuidNum - 2; i++) {
              String uuid=String.format(UUID_FORMAT,uniqueUserId,i);
              long bucketNum=i / (NUM_PERIODS_PER_BUCKET / NUM_PERIODS_PER_OBJECT);
              bucketName=String.format(UUID_FORMAT,uniqueUserId,bucketNum);
              log.debug(String.format("String_Node_Str",bucketName,uuid));
              ReportingS3ObjectEventStore.getInstance().insertS3ObjectUsageEvent(bucketName,uuid,"String_Node_Str",OBJECT_SIZE,timeMs,userId);
            }
            ReportingVolumeEventStore.getInstance().insertAttachEvent(volumeUuid,instanceUuid,VOLUME_SIZE,timeMs);
            ReportingElasticIpEventStore.getInstance().insertAttachEvent(elasticIpUuid,instanceUuid,timeMs);
            log.debug(String.format("String_Node_Str",volumeUuid,elasticIpUuid,instanceUuid));
            attachments.add(new Attachment(instanceUuid,volumeUuid,elasticIpUuid));
            if (attachments.size() >= ATTACH_PERIODS_DURATION) {
              Attachment attachment=attachments.remove(0);
              ReportingVolumeEventStore.getInstance().insertDetachEvent(attachment.getVolumeUuid(),attachment.getInstanceUuid(),VOLUME_SIZE,timeMs);
              ReportingElasticIpEventStore.getInstance().insertDetachEvent(attachment.getElasticIpUuid(),attachment.getInstanceUuid(),timeMs);
              log.debug(String.format("String_Node_Str",attachment.getVolumeUuid(),attachment.getElasticIpUuid(),attachment.getInstanceUuid()));
            }
          }
        }
      }
    }
  }
}