Program: 89963
Project: 89963
Buggy source:
@Override protected void poll() throws Exception {
  List<S3ObjectSummary> objectSummaries=AwsUtils.listAllObjects(config.billingS3BucketName,config.billingS3BucketPrefix);
  logger.info("String_Node_Str" + objectSummaries.size() + "String_Node_Str");
  TreeMap<DateTime,S3ObjectSummary> filesToProcess=Maps.newTreeMap();
  Map<DateTime,S3ObjectSummary> monitorFilesToProcess=Maps.newTreeMap();
  DateTime currentTime=new DateTime(DateTimeZone.UTC);
  for (  S3ObjectSummary objectSummary : objectSummaries) {
    String fileKey=objectSummary.getKey();
    DateTime dataTime=AwsUtils.getDateTimeFromFileNameWithTags(fileKey);
    boolean withTags=true;
    if (dataTime == null) {
      dataTime=AwsUtils.getDateTimeFromFileName(fileKey);
      withTags=false;
    }
    if (dataTime != null && !dataTime.isBefore(config.startDate)) {
      if (!filesToProcess.containsKey(dataTime) || withTags && config.resourceService != null || !withTags && config.resourceService == null)       filesToProcess.put(dataTime,objectSummary);
 else       logger.info("String_Node_Str" + objectSummary.getKey());
    }
 else {
      logger.info("String_Node_Str" + objectSummary.getKey());
    }
  }
  for (  S3ObjectSummary objectSummary : objectSummaries) {
    String fileKey=objectSummary.getKey();
    DateTime dataTime=AwsUtils.getDateTimeFromFileNameWithMonitoring(fileKey);
    if (dataTime != null && !dataTime.isBefore(config.startDate)) {
      monitorFilesToProcess.put(dataTime,objectSummary);
    }
  }
  for (  DateTime dataTime : filesToProcess.keySet()) {
    S3ObjectSummary objectSummary=filesToProcess.get(dataTime);
    startMilli=endMilli=dataTime.getMillis();
    init();
    long lastProcessed=AwsUtils.getLastModified(config.workS3BucketName,config.workS3BucketPrefix + "String_Node_Str" + AwsUtils.monthDateFormat.print(dataTime)) - 3 * 3600000L;
    if (objectSummary.getLastModified().getTime() < lastProcessed) {
      logger.info("String_Node_Str" + objectSummary.getKey() + "String_Node_Str");
      continue;
    }
    String fileKey=objectSummary.getKey();
    File file=new File(config.localDir,fileKey.substring(fileKey.lastIndexOf("String_Node_Str") + 1));
    logger.info("String_Node_Str" + fileKey + "String_Node_Str");
    boolean downloaded=AwsUtils.downloadFileIfChangedSince(config.billingS3BucketName,config.billingS3BucketPrefix,file,lastProcessed);
    if (downloaded)     logger.info("String_Node_Str" + fileKey);
 else {
      logger.info("String_Node_Str" + fileKey + "String_Node_Str");
    }
    logger.info("String_Node_Str" + fileKey + "String_Node_Str");
    boolean withTags=fileKey.contains("String_Node_Str");
    processingMonitor=false;
    processBillingZipFile(file,withTags);
    logger.info("String_Node_Str" + fileKey);
    S3ObjectSummary monitorObjectSummary=monitorFilesToProcess.get(dataTime);
    if (monitorObjectSummary != null) {
      String monitorFileKey=monitorObjectSummary.getKey();
      logger.info("String_Node_Str" + monitorFileKey + "String_Node_Str");
      File monitorFile=new File(config.localDir,monitorFileKey.substring(monitorFileKey.lastIndexOf("String_Node_Str") + 1));
      logger.info("String_Node_Str" + monitorFileKey + "String_Node_Str");
      downloaded=AwsUtils.downloadFileIfChangedSince(config.billingS3BucketName,config.billingS3BucketPrefix,monitorFile,lastProcessed);
      if (downloaded)       logger.info("String_Node_Str" + monitorFile);
 else       logger.warn(monitorFile + "String_Node_Str");
      FileInputStream in=new FileInputStream(monitorFile);
      try {
        processBillingFile(monitorFile.getName(),in,withTags);
      }
 catch (      Exception e) {
        logger.error("String_Node_Str" + monitorFile,e);
      }
 finally {
        in.close();
      }
    }
    if (Months.monthsBetween(dataTime,currentTime).getMonths() == 0) {
      int hours=(int)((endMilli - startMilli) / 3600000L);
      logger.info("String_Node_Str" + hours);
      cutData(hours);
    }
    processReservations();
    if (withTags)     config.resourceService.commit();
    logger.info("String_Node_Str" + dataTime + "String_Node_Str");
    archive();
    logger.info("String_Node_Str" + dataTime);
    if (dataTime.equals(filesToProcess.lastKey()))     sendOndemandCostAlert();
  }
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void poll() throws Exception {
  List<S3ObjectSummary> objectSummaries=AwsUtils.listAllObjects(config.billingS3BucketName,config.billingS3BucketPrefix);
  logger.info("String_Node_Str" + objectSummaries.size() + "String_Node_Str");
  TreeMap<DateTime,S3ObjectSummary> filesToProcess=Maps.newTreeMap();
  Map<DateTime,S3ObjectSummary> monitorFilesToProcess=Maps.newTreeMap();
  DateTime currentTime=new DateTime(DateTimeZone.UTC);
  for (  S3ObjectSummary objectSummary : objectSummaries) {
    String fileKey=objectSummary.getKey();
    DateTime dataTime=AwsUtils.getDateTimeFromFileNameWithTags(fileKey);
    boolean withTags=true;
    if (dataTime == null) {
      dataTime=AwsUtils.getDateTimeFromFileName(fileKey);
      withTags=false;
    }
    if (dataTime != null && !dataTime.isBefore(config.startDate)) {
      if (!filesToProcess.containsKey(dataTime) || withTags && config.resourceService != null || !withTags && config.resourceService == null)       filesToProcess.put(dataTime,objectSummary);
 else       logger.info("String_Node_Str" + objectSummary.getKey());
    }
 else {
      logger.info("String_Node_Str" + objectSummary.getKey());
    }
  }
  for (  S3ObjectSummary objectSummary : objectSummaries) {
    String fileKey=objectSummary.getKey();
    DateTime dataTime=AwsUtils.getDateTimeFromFileNameWithMonitoring(fileKey);
    if (dataTime != null && !dataTime.isBefore(config.startDate)) {
      monitorFilesToProcess.put(dataTime,objectSummary);
    }
  }
  for (  DateTime dataTime : filesToProcess.keySet()) {
    S3ObjectSummary objectSummary=filesToProcess.get(dataTime);
    startMilli=endMilli=dataTime.getMillis();
    init();
    long lastProcessed=AwsUtils.getLastModified(config.workS3BucketName,config.workS3BucketPrefix + "String_Node_Str" + AwsUtils.monthDateFormat.print(dataTime)) - 3 * 3600000L;
    if (objectSummary.getLastModified().getTime() < lastProcessed) {
      logger.info("String_Node_Str" + objectSummary.getKey() + "String_Node_Str");
      continue;
    }
    String fileKey=objectSummary.getKey();
    File file=new File(config.localDir,fileKey.substring(fileKey.lastIndexOf("String_Node_Str") + 1));
    logger.info("String_Node_Str" + fileKey + "String_Node_Str");
    boolean downloaded=AwsUtils.downloadFileIfChangedSince(config.billingS3BucketName,config.billingS3BucketPrefix,file,lastProcessed);
    if (downloaded)     logger.info("String_Node_Str" + fileKey);
 else {
      logger.info("String_Node_Str" + fileKey + "String_Node_Str");
    }
    logger.info("String_Node_Str" + fileKey + "String_Node_Str");
    boolean withTags=fileKey.contains("String_Node_Str");
    processingMonitor=false;
    processBillingZipFile(file,withTags);
    logger.info("String_Node_Str" + fileKey);
    S3ObjectSummary monitorObjectSummary=monitorFilesToProcess.get(dataTime);
    if (monitorObjectSummary != null) {
      String monitorFileKey=monitorObjectSummary.getKey();
      logger.info("String_Node_Str" + monitorFileKey + "String_Node_Str");
      File monitorFile=new File(config.localDir,monitorFileKey.substring(monitorFileKey.lastIndexOf("String_Node_Str") + 1));
      logger.info("String_Node_Str" + monitorFileKey + "String_Node_Str");
      downloaded=AwsUtils.downloadFileIfChangedSince(config.billingS3BucketName,config.billingS3BucketPrefix,monitorFile,lastProcessed);
      if (downloaded)       logger.info("String_Node_Str" + monitorFile);
 else       logger.warn(monitorFile + "String_Node_Str");
      FileInputStream in=new FileInputStream(monitorFile);
      try {
        processBillingFile(monitorFile.getName(),in,withTags);
      }
 catch (      Exception e) {
        logger.error("String_Node_Str" + monitorFile,e);
      }
 finally {
        in.close();
      }
    }
    if (Months.monthsBetween(dataTime,currentTime).getMonths() == 0) {
      int hours=(int)((endMilli - startMilli) / 3600000L);
      logger.info("String_Node_Str" + hours);
      cutData(hours);
    }
    processReservations();
    if (withTags && config.resourceService != null)     config.resourceService.commit();
    logger.info("String_Node_Str" + dataTime + "String_Node_Str");
    archive();
    logger.info("String_Node_Str" + dataTime);
    if (dataTime.equals(filesToProcess.lastKey()))     sendOndemandCostAlert();
  }
  logger.info("String_Node_Str");
}