Program: 43867
Project: 43867
Buggy source:
@Override public Instances getDataSet() throws IOException {
  if (!dataset.isEmpty())   return dataset;
  if (m_sourceFile == null)   throw new IOException("String_Node_Str");
  byte[] data=new byte[BLOCKSIZE];
  Calendar date=new GregorianCalendar();
  Calendar timestamp=new GregorianCalendar();
  Calendar intervalstart=new GregorianCalendar();
  Calendar intervalcurrent=new GregorianCalendar();
  FileInputStream in=new FileInputStream(m_sourceFile);
  int read=in.read(data);
  int avg_x=0;
  int avg_y=0;
  int avg_z=0;
  boolean newInterval=true;
  long interval=getIntervalLength();
  if (units > 0)   interval*=units;
  while (read != -1) {
    in.read(data,0,BLOCKSIZE);
    boolean recordEnd=setTime(date,data);
    long time=date.getTimeInMillis();
    if (recordEnd)     break;
    for (int j=0; j < CONTENT_BLOCK; j+=3) {
      timestamp.setTimeInMillis(time);
      int x=data[j];
      int y=data[j + 1];
      int z=data[j + 2];
      if (newInterval) {
        avg_x=x;
        avg_y=y;
        avg_z=z;
        newInterval=false;
        intervalstart.setTimeInMillis(time);
        intervalcurrent.setTimeInMillis(time);
      }
      time+=SAMPLE_DISTANCE;
      boolean insideBounds=intervalcurrent.getTimeInMillis() - intervalstart.getTimeInMillis() < interval;
      if (aggregate.equals("String_Node_Str") || !insideBounds) {
        DenseInstance instance=new DenseInstance(4);
        instance.setValue(timeAttribute,timestamp.getTimeInMillis());
        instance.setValue(xAttribute,avg_x);
        instance.setValue(yAttribute,avg_y);
        instance.setValue(zAttribute,avg_z);
        dataset.add(instance);
        avg_x=x;
        avg_y=y;
        avg_z=z;
        intervalstart.setTimeInMillis(time);
        intervalcurrent.setTimeInMillis(time);
      }
 else       if (insideBounds) {
        avg_x=(avg_x + x) / 2;
        avg_y=(avg_y + y) / 2;
        avg_z=(avg_z + z) / 2;
        intervalcurrent.setTimeInMillis(time);
      }
    }
    read=in.read(data);
  }
  in.close();
  if (output != null) {
    File out=new File(output);
    ArffSaver arffSaver=new ArffSaver();
    arffSaver.setFile(out);
    arffSaver.setInstances(dataset);
    arffSaver.writeBatch();
  }
  return dataset;
}

Fixed version (ground truth):
@Override public Instances getDataSet() throws IOException {
  if (!dataset.isEmpty())   return dataset;
  if (m_sourceFile == null)   throw new IOException("String_Node_Str");
  byte[] data=new byte[BLOCKSIZE];
  Calendar date=new GregorianCalendar();
  Calendar intervalstart=new GregorianCalendar();
  Calendar intervalcurrent=new GregorianCalendar();
  FileInputStream in=new FileInputStream(m_sourceFile);
  int read=in.read(data);
  int avg_x=0;
  int avg_y=0;
  int avg_z=0;
  boolean newInterval=true;
  long interval=getIntervalLength();
  if (units > 0)   interval*=units;
  while (read != -1) {
    in.read(data,0,BLOCKSIZE);
    boolean recordEnd=setTime(date,data);
    long time=date.getTimeInMillis();
    if (recordEnd)     break;
    for (int j=0; j < CONTENT_BLOCK; j+=3) {
      int x=data[j];
      int y=data[j + 1];
      int z=data[j + 2];
      if (newInterval) {
        avg_x=x;
        avg_y=y;
        avg_z=z;
        newInterval=false;
        intervalstart.setTimeInMillis(time);
        intervalcurrent.setTimeInMillis(time);
      }
      boolean insideBounds=intervalcurrent.getTimeInMillis() - intervalstart.getTimeInMillis() < interval;
      if (aggregate.equals("String_Node_Str") || !insideBounds) {
        DenseInstance instance=new DenseInstance(4);
        instance.setValue(timeAttribute,time);
        instance.setValue(xAttribute,avg_x);
        instance.setValue(yAttribute,avg_y);
        instance.setValue(zAttribute,avg_z);
        dataset.add(instance);
        avg_x=x;
        avg_y=y;
        avg_z=z;
        intervalstart.setTimeInMillis(time);
        intervalcurrent.setTimeInMillis(time);
      }
 else       if (insideBounds) {
        avg_x=(avg_x + x) / 2;
        avg_y=(avg_y + y) / 2;
        avg_z=(avg_z + z) / 2;
        intervalcurrent.setTimeInMillis(time);
      }
      time+=SAMPLE_DISTANCE;
    }
    date.setTimeInMillis(time);
    read=in.read(data);
  }
  in.close();
  return dataset;
}