Program: 71885
Project: 71885
Buggy source:
public void testTotalPercentile() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_PERCENTILE_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(2,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  assertFalse(!ag.getParameterDefn()[1].isOptional());
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(0.1)});
  }
  ac.finish();
  Object value=ac.getValue();
  assertEquals(value,new Double(10.0));
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(0)});
  }
  ac.finish();
  value=ac.getValue();
  assertEquals(value,new Double(10));
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(1)});
  }
  ac.finish();
  value=ac.getValue();
  assertEquals(value,new Double(300));
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(0.7)});
  }
  ac.finish();
  value=ac.getValue();
  assertEquals(value,new Double(70));
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(0.35)});
  }
  ac.finish();
  value=ac.getValue();
  assertEquals(value,new Double(17.5));
  try {
    ac.start();
    for (int i=0; i < doubleArray3.length; i++) {
      ac.onRow(new Object[]{doubleArray3[i],new Double(-1)});
    }
    ac.finish();
    fail("String_Node_Str");
  }
 catch (  DataException e) {
  }
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    try {
      ac.onRow(new Object[]{doubleArray3[i],new Double(-0.9)});
      fail();
    }
 catch (    DataException e) {
    }
    try {
      ac.onRow(new Object[]{doubleArray3[i],new Double(4.1)});
      fail();
    }
 catch (    DataException e) {
    }
  }
  ac.finish();
  ac=ag.newAccumulator();
  ac.start();
  for (int i=0; i < bigDecimalArray.length; i++) {
    ac.onRow(new Object[]{bigDecimalArray[i],new Double(0.1)});
  }
  ac.finish();
  Object ret=ac.getValue();
  assertTrue(ret instanceof BigDecimal);
  assertTrue(new BigDecimal("String_Node_Str").compareTo((BigDecimal)ret) == 0);
}

Fixed version (ground truth):
public void testTotalPercentile() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_PERCENTILE_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(2,ag.getParameterDefn().length);
  assertTrue(!ag.getParameterDefn()[0].isOptional());
  assertFalse(ag.getParameterDefn()[1].isOptional());
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(0.1)});
  }
  ac.finish();
  Object value=ac.getValue();
  assertEquals(value,new Double(10.0));
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(0)});
  }
  ac.finish();
  value=ac.getValue();
  assertEquals(value,new Double(10));
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(1)});
  }
  ac.finish();
  value=ac.getValue();
  assertEquals(value,new Double(300));
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(0.7)});
  }
  ac.finish();
  value=ac.getValue();
  assertEquals(value,new Double(70));
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    ac.onRow(new Object[]{doubleArray3[i],new Double(0.35)});
  }
  ac.finish();
  value=ac.getValue();
  assertEquals(value,new Double(17.5));
  try {
    ac.start();
    for (int i=0; i < doubleArray3.length; i++) {
      ac.onRow(new Object[]{doubleArray3[i],new Double(-1)});
    }
    ac.finish();
    fail("String_Node_Str");
  }
 catch (  DataException e) {
  }
  ac.start();
  for (int i=0; i < doubleArray3.length; i++) {
    try {
      ac.onRow(new Object[]{doubleArray3[i],new Double(-0.9)});
      fail();
    }
 catch (    DataException e) {
    }
    try {
      ac.onRow(new Object[]{doubleArray3[i],new Double(4.1)});
      fail();
    }
 catch (    DataException e) {
    }
  }
  ac.finish();
  ac=ag.newAccumulator();
  ac.start();
  for (int i=0; i < bigDecimalArray.length; i++) {
    ac.onRow(new Object[]{bigDecimalArray[i],new Double(0.1)});
  }
  ac.finish();
  Object ret=ac.getValue();
  assertTrue(ret instanceof BigDecimal);
  assertTrue(new BigDecimal("String_Node_Str").compareTo((BigDecimal)ret) == 0);
}