Program: 2141
Project: 2141
Buggy source:
@SuppressWarnings("String_Node_Str") @Test(groups="String_Node_Str") public void testBasicAccumulator() throws Exception {
  final int hostId=123;
  final int sampleKindId=456;
  final TimelineChunkAccumulator accum=new TimelineChunkAccumulator(hostId,sampleKindId);
  final List<DateTime> dateTimes=new ArrayList<DateTime>();
  final DateTime startTime=new DateTime();
  final DateTime endTime=startTime.plus(1000);
  accum.addSample(new ScalarSample(SampleOpcode.INT,new Integer(25)));
  int timesCounter=0;
  dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  for (int i=0; i < 5; i++) {
    accum.addSample(new ScalarSample(SampleOpcode.INT,new Integer(10)));
    dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  }
  accum.addSample(new ScalarSample(SampleOpcode.DOUBLE,new Double(100.0)));
  dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  accum.addSample(new ScalarSample(SampleOpcode.DOUBLE,new Double(100.0)));
  dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  accum.addSample(new ScalarSample(SampleOpcode.STRING,new String("String_Node_Str")));
  dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  final byte[] compressedTimes=TimelineCoder.compressDateTimes(dateTimes);
  final TimelineChunk chunk=accum.extractTimelineChunkAndReset(startTime,endTime,compressedTimes);
  Assert.assertEquals(chunk.getSampleCount(),9);
  SampleCoder.scan(chunk.getSamples(),compressedTimes,dateTimes.size(),new SampleProcessor(){
    private int sampleNumber=0;
    @Override public void processSamples(    TimeCursor timeCursor,    int sampleCount,    SampleOpcode opcode,    Object value){
      timeCursor.consumeRepeat(sampleCount);
      if (sampleNumber == 0) {
        Assert.assertEquals(opcode,SampleOpcode.INT);
        Assert.assertEquals(value,new Integer(25));
      }
 else       if (sampleNumber >= 1 && sampleNumber < 6) {
        Assert.assertEquals(opcode,SampleOpcode.INT);
        Assert.assertEquals(value,new Integer(10));
      }
 else       if (sampleNumber >= 6 && sampleNumber < 8) {
        Assert.assertEquals(opcode,SampleOpcode.DOUBLE);
        Assert.assertEquals(value,new Double(100.0));
      }
 else       if (sampleNumber == 8) {
        Assert.assertEquals(opcode,SampleOpcode.STRING);
        Assert.assertEquals(value,new String("String_Node_Str"));
      }
 else {
        Assert.assertTrue(false);
      }
      sampleNumber+=sampleCount;
    }
  }
);
  final TimelineChunkDecoded chunkDecoded=new TimelineChunkDecoded(chunk);
  System.out.printf("String_Node_Str",chunkDecoded.toString());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Test(groups="String_Node_Str") public void testBasicAccumulator() throws Exception {
  final int hostId=123;
  final int sampleKindId=456;
  final TimelineChunkAccumulator accum=new TimelineChunkAccumulator(hostId,sampleKindId);
  final List<DateTime> dateTimes=new ArrayList<DateTime>();
  final DateTime startTime=new DateTime();
  final DateTime endTime=startTime.plus(1000);
  accum.addSample(new ScalarSample(SampleOpcode.INT,new Integer(25)));
  int timesCounter=0;
  dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  for (int i=0; i < 5; i++) {
    accum.addSample(new ScalarSample(SampleOpcode.INT,new Integer(10)));
    dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  }
  accum.addSample(new ScalarSample(SampleOpcode.DOUBLE,new Double(100.0)));
  dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  accum.addSample(new ScalarSample(SampleOpcode.DOUBLE,new Double(100.0)));
  dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  accum.addSample(new ScalarSample(SampleOpcode.STRING,new String("String_Node_Str")));
  dateTimes.add(startTime.plusSeconds(30 * timesCounter++));
  final byte[] compressedTimes=TimelineCoder.compressDateTimes(dateTimes);
  final TimelineChunk chunk=accum.extractTimelineChunkAndReset(startTime,endTime,compressedTimes);
  Assert.assertEquals(chunk.getSampleCount(),9);
  SampleCoder.scan(chunk.getSamples(),compressedTimes,dateTimes.size(),new SampleProcessor(){
    private int sampleNumber=0;
    @Override public void processSamples(    TimeCursor timeCursor,    int sampleCount,    SampleOpcode opcode,    Object value){
      if (sampleNumber == 0) {
        Assert.assertEquals(opcode,SampleOpcode.INT);
        Assert.assertEquals(value,new Integer(25));
      }
 else       if (sampleNumber >= 1 && sampleNumber < 6) {
        Assert.assertEquals(opcode,SampleOpcode.INT);
        Assert.assertEquals(value,new Integer(10));
      }
 else       if (sampleNumber >= 6 && sampleNumber < 8) {
        Assert.assertEquals(opcode,SampleOpcode.DOUBLE);
        Assert.assertEquals(value,new Double(100.0));
      }
 else       if (sampleNumber == 8) {
        Assert.assertEquals(opcode,SampleOpcode.STRING);
        Assert.assertEquals(value,new String("String_Node_Str"));
      }
 else {
        Assert.assertTrue(false);
      }
      sampleNumber+=sampleCount;
    }
  }
);
  final TimelineChunkDecoded chunkDecoded=new TimelineChunkDecoded(chunk);
  System.out.printf("String_Node_Str",chunkDecoded.toString());
}