Program: 69083
Project: 69083
Buggy source:
public void testTotalMode() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_MODE_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  ac.start();
  for (int i=0; i < doubleArray1.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray1[i])});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray2.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray2[i])});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray4.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray4[i])});
  }
  ac.finish();
  assertEquals(null,ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray5.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray5[i])});
  }
  ac.finish();
  assertEquals(new Double(1.0),ac.getValue());
  ac.start();
  for (int i=0; i < str1.length; i++) {
    ac.onRow(new Object[]{str1[i]});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  ac.finish();
  assertEquals(null,ac.getValue());
  ac.start();
  try {
    ac.getValue();
    assertTrue(false);
  }
 catch (  RuntimeException e) {
    assertTrue(true);
  }
  ac.start();
  ac.onRow(new Double[]{new Double(4)});
  ac.onRow(new Double[]{new Double(4)});
  ac.onRow(new Double[]{new Double(3)});
  ac.finish();
  assertEquals(ac.getValue(),new Double(4));
  ac.start();
  for (int i=0; i < dates.length; i++) {
    ac.onRow(new Object[]{dates[i]});
  }
  ac.finish();
  assertEquals(ac.getValue(),null);
  ac.start();
  for (int i=0; i < dates2.length; i++) {
    ac.onRow(new Object[]{dates2[i]});
  }
  ac.finish();
  assertEquals(ac.getValue(),new Date(2000000L));
  ac.start();
  for (int i=0; i < bigDecimalArray.length; i++) {
    ac.onRow(new Object[]{bigDecimalArray[i]});
  }
  ac.finish();
  Object ret=ac.getValue();
  assertTrue(ret instanceof BigDecimal);
  assertTrue(new BigDecimal(4).compareTo((BigDecimal)ret) == 0);
}

Fixed version (ground truth):
public void testTotalMode() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_MODE_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(1,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  ac.start();
  for (int i=0; i < doubleArray1.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray1[i])});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray2.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray2[i])});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray4.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray4[i])});
  }
  ac.finish();
  assertEquals(null,ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray5.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray5[i])});
  }
  ac.finish();
  assertEquals(new Double(1.0),ac.getValue());
  ac.start();
  for (int i=0; i < doubleArray6.length; i++) {
    ac.onRow(new Double[]{new Double(doubleArray6[i])});
  }
  ac.finish();
  assertEquals(new Double(1.0),ac.getValue());
  ac.start();
  for (int i=0; i < str1.length; i++) {
    ac.onRow(new Object[]{str1[i]});
  }
  ac.finish();
  assertEquals(new Double(4.0),ac.getValue());
  ac.start();
  ac.finish();
  assertEquals(null,ac.getValue());
  ac.start();
  try {
    ac.getValue();
    assertTrue(false);
  }
 catch (  RuntimeException e) {
    assertTrue(true);
  }
  ac.start();
  ac.onRow(new Double[]{new Double(4)});
  ac.onRow(new Double[]{new Double(4)});
  ac.onRow(new Double[]{new Double(3)});
  ac.finish();
  assertEquals(ac.getValue(),new Double(4));
  ac.start();
  for (int i=0; i < dates.length; i++) {
    ac.onRow(new Object[]{dates[i]});
  }
  ac.finish();
  assertEquals(ac.getValue(),null);
  ac.start();
  for (int i=0; i < dates2.length; i++) {
    ac.onRow(new Object[]{dates2[i]});
  }
  ac.finish();
  assertEquals(ac.getValue(),new Date(2000000L));
  ac.start();
  for (int i=0; i < bigDecimalArray.length; i++) {
    ac.onRow(new Object[]{bigDecimalArray[i]});
  }
  ac.finish();
  Object ret=ac.getValue();
  assertTrue(ret instanceof BigDecimal);
  assertTrue(new BigDecimal(4).compareTo((BigDecimal)ret) == 0);
}