Program: 7993
Project: 7993
Buggy source:
public final void run(){
  try {
    init();
    long start=System.currentTimeMillis();
    long unixTime;
    boolean interrupt=false;
    ArrayList<Map<String,Long>> previousMetrics=new ArrayList<Map<String,Long>>(groups.length);
    for (int i=0; i < groups.length; i++) {
      previousMetrics.add(null);
    }
    long[] previousMillis=new long[groups.length];
    for (int seconds=reportInterval; !interrupt; seconds+=reportInterval) {
      long wakeup=start + (seconds * 1000);
      long currentTime=System.currentTimeMillis();
      unixTime=currentTime / 1000L;
      try {
        if (wakeup > currentTime) {
          Thread.sleep(wakeup - currentTime);
        }
      }
 catch (      InterruptedException e) {
        interrupt=true;
      }
      long latestMillis;
      if (interrupt) {
        latestMillis=System.currentTimeMillis() - start;
      }
 else {
        latestMillis=seconds * 1000L;
      }
      LOG.debug("String_Node_Str",time2String(latestMillis));
      for (int i=0; i < groups.length; i++) {
        Map<String,Long> latestGrpMetrics=groupMetrics[i].list();
        Map<String,Long> previousGrpMetrics=previousMetrics.get(i);
        processGroupMetricsInterval(unixTime,groups[i],previousMillis[i],latestMillis,previousGrpMetrics,latestGrpMetrics,interrupt);
        previousMetrics.set(i,latestGrpMetrics);
        previousMillis[i]=latestMillis;
      }
    }
    LOG.debug("String_Node_Str");
    unixTime=System.currentTimeMillis() / 1000L;
    for (    AgentGroup group : groups) {
      processGroupMetricsFinal(unixTime,group);
    }
  }
 catch (  Exception e) {
    LOG.error(e.getMessage(),e);
  }
 finally {
    shutdown();
  }
}

Fixed version (ground truth):
public final void run(){
  try {
    init();
    long start=System.currentTimeMillis();
    long unixTime;
    boolean interrupt=false;
    ArrayList<Map<String,Long>> previousMetrics=new ArrayList<Map<String,Long>>(groups.length);
    for (int i=0; i < groups.length; i++) {
      previousMetrics.add(null);
    }
    long[] previousMillis=new long[groups.length];
    int interval=getInterval();
    for (int seconds=interval; !interrupt; seconds+=interval) {
      long wakeup=start + (seconds * 1000);
      long currentTime=System.currentTimeMillis();
      unixTime=currentTime / 1000L;
      try {
        if (wakeup > currentTime) {
          Thread.sleep(wakeup - currentTime);
        }
      }
 catch (      InterruptedException e) {
        interrupt=true;
      }
      long latestMillis;
      if (interrupt) {
        latestMillis=System.currentTimeMillis() - start;
      }
 else {
        latestMillis=seconds * 1000L;
      }
      LOG.debug("String_Node_Str",time2String(latestMillis));
      for (int i=0; i < groups.length; i++) {
        Map<String,Long> latestGrpMetrics=groupMetrics[i].list();
        Map<String,Long> previousGrpMetrics=previousMetrics.get(i);
        processGroupMetricsInterval(unixTime,groups[i],previousMillis[i],latestMillis,previousGrpMetrics,latestGrpMetrics,interrupt);
        previousMetrics.set(i,latestGrpMetrics);
        previousMillis[i]=latestMillis;
      }
    }
    LOG.debug("String_Node_Str");
    unixTime=System.currentTimeMillis() / 1000L;
    for (    AgentGroup group : groups) {
      processGroupMetricsFinal(unixTime,group);
    }
  }
 catch (  Exception e) {
    LOG.error(e.getMessage(),e);
  }
 finally {
    shutdown();
  }
}