Program: 71658
Project: 71658
Buggy source:
public void testTotalConcatenate() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_CONCATENATE_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(4,ag.getParameterDefn().length);
  String separator="String_Node_Str";
  String result="String_Node_Str";
  ac.start();
  for (int i=0; i < str2.length; i++) {
    ac.onRow(new Object[]{str2[i],separator,null,null});
    result+=str2[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  for (int i=0; i < str4.length; i++) {
    ac.onRow(new Object[]{str4[i],separator,null,null});
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  boolean exceedsMaxLength=false;
  for (int i=0; i < str4.length; i++) {
    ac.onRow(new Object[]{str4[i],separator,50,true});
    if (exceedsMaxLength || result.getBytes().length > 50 - str4[i].length()) {
      exceedsMaxLength=true;
      continue;
    }
    result+=str4[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  exceedsMaxLength=false;
  for (int i=0; i < str2.length; i++) {
    ac.onRow(new Object[]{str2[i],separator,20,null});
    if (exceedsMaxLength || result.getBytes().length > 20 - str2[i].length()) {
      exceedsMaxLength=true;
      continue;
    }
    result+=str2[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  separator="String_Node_Str";
  exceedsMaxLength=false;
  LinkedHashSet<String> objects=new LinkedHashSet<String>();
  for (int i=0; i < anyObjectArray2.length; i++) {
    if (anyObjectArray2[i] != null) {
      objects.add(anyObjectArray2[i].toString());
    }
  }
  Iterator<String> iterator=objects.iterator();
  while (iterator.hasNext()) {
    String value=iterator.next();
    ac.onRow(new Object[]{value,separator,30,false});
    if (value != null) {
      if (exceedsMaxLength || result.getBytes().length > 30 - value.length()) {
        exceedsMaxLength=true;
        continue;
      }
      result+=value;
      result+=separator;
    }
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
}

Fixed version (ground truth):
public void testTotalConcatenate() throws Exception {
  IAggrFunction ag=buildInAggrFactory.getAggregation("String_Node_Str");
  Accumulator ac=ag.newAccumulator();
  assertEquals(IBuildInAggregation.TOTAL_CONCATENATE_FUNC,ag.getName());
  assertEquals(IAggrFunction.SUMMARY_AGGR,ag.getType());
  assertEquals(4,ag.getParameterDefn().length);
  String separator="String_Node_Str";
  String result="String_Node_Str";
  ac.start();
  for (int i=0; i < str2.length; i++) {
    ac.onRow(new Object[]{str2[i],separator,null,null});
    result+=str2[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  for (int i=0; i < str4.length; i++) {
    ac.onRow(new Object[]{str4[i],separator,null,null});
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  boolean exceedsMaxLength=false;
  for (int i=0; i < str4.length; i++) {
    ac.onRow(new Object[]{str4[i],separator,50,true});
    if (exceedsMaxLength || result.getBytes().length > 50 - str4[i].length()) {
      exceedsMaxLength=true;
      continue;
    }
    result+=str4[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  exceedsMaxLength=false;
  for (int i=0; i < str2.length; i++) {
    ac.onRow(new Object[]{str2[i],separator,20,null});
    if (exceedsMaxLength || result.getBytes().length > 20 - str2[i].length()) {
      exceedsMaxLength=true;
      continue;
    }
    result+=str2[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  separator="String_Node_Str";
  exceedsMaxLength=false;
  for (int i=0; i < str2.length; i++) {
    ac.onRow(new Object[]{str2[i],separator,20,null});
    if (exceedsMaxLength || result.getBytes().length > 20 - str2[i].length()) {
      exceedsMaxLength=true;
      continue;
    }
    result+=str2[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  separator="String_Node_Str";
  exceedsMaxLength=false;
  for (int i=0; i < str2.length; i++) {
    ac.onRow(new Object[]{str2[i],separator,20,null});
    if (exceedsMaxLength || result.getBytes().length > 20 - str2[i].length()) {
      exceedsMaxLength=true;
      continue;
    }
    result+=str2[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  separator="String_Node_Str";
  exceedsMaxLength=false;
  for (int i=0; i < str2.length; i++) {
    ac.onRow(new Object[]{str2[i],separator,20,null});
    if (exceedsMaxLength || result.getBytes().length > 20 - str2[i].length()) {
      exceedsMaxLength=true;
      continue;
    }
    result+=str2[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  separator="String_Node_Str";
  exceedsMaxLength=false;
  for (int i=0; i < str2.length; i++) {
    ac.onRow(new Object[]{str2[i],separator,20,null});
    if (exceedsMaxLength || result.getBytes().length > 20 - str2[i].length()) {
      exceedsMaxLength=true;
      continue;
    }
    result+=str2[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  separator="String_Node_Str";
  exceedsMaxLength=false;
  for (int i=0; i < str2.length; i++) {
    ac.onRow(new Object[]{str2[i],separator,20,null});
    if (exceedsMaxLength || result.getBytes().length > 20 - str2[i].length()) {
      exceedsMaxLength=true;
      continue;
    }
    result+=str2[i];
    result+=separator;
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
  ac.start();
  result="String_Node_Str";
  separator="String_Node_Str";
  exceedsMaxLength=false;
  LinkedHashSet<String> objects=new LinkedHashSet<String>();
  for (int i=0; i < anyObjectArray2.length; i++) {
    if (anyObjectArray2[i] != null) {
      objects.add(anyObjectArray2[i].toString());
    }
  }
  Iterator<String> iterator=objects.iterator();
  while (iterator.hasNext()) {
    String value=iterator.next();
    ac.onRow(new Object[]{value,separator,30,false});
    if (value != null) {
      if (exceedsMaxLength || result.getBytes().length > 30 - value.length()) {
        exceedsMaxLength=true;
        continue;
      }
      result+=value;
      result+=separator;
    }
  }
  if (result.length() > 0) {
    result=result.substring(0,result.length() - 1);
  }
  ac.finish();
  assertEquals(result,ac.getValue());
}