Program: 73870
Project: 73870
Buggy source:
String printCubeAlongEdge(CubeCursor cursor,List columnEdgeBindingNames,List rowEdgeBindingNames,List measureBindingNames,List rowGrandTotal,String columnGrandTotal,String totalGrandTotal,List countryGrandTotal) throws Exception {
  EdgeCursor edge1=(EdgeCursor)(cursor.getOrdinateEdge().get(0));
  EdgeCursor edge2=(EdgeCursor)(cursor.getOrdinateEdge().get(1));
  String[] lines=new String[edge1.getDimensionCursor().size()];
  for (int i=0; i < lines.length; i++) {
    lines[i]="String_Node_Str";
  }
  while (edge1.next()) {
    for (int i=0; i < lines.length; i++) {
      DimensionCursor dimCursor=(DimensionCursor)edge1.getDimensionCursor().get(i);
      lines[i]+=dimCursor.getObject(columnEdgeBindingNames.get(i).toString()) + "String_Node_Str";
    }
  }
  String output="String_Node_Str";
  for (int i=0; i < lines.length; i++) {
    output+="String_Node_Str" + lines[i];
  }
  while (edge2.next()) {
    String line="String_Node_Str";
    for (int k=0; k < rowEdgeBindingNames.size(); k++) {
      DimensionCursor dimCursor=(DimensionCursor)edge2.getDimensionCursor().get(k);
      line+=dimCursor.getObject(rowEdgeBindingNames.get(k).toString()).toString() + "String_Node_Str";
    }
    edge1.beforeFirst();
    while (edge1.next()) {
      DimensionCursor countryCursor=(DimensionCursor)edge1.getDimensionCursor().get(0);
      if (measureBindingNames != null) {
        for (int j=0; j < measureBindingNames.size(); j++) {
          line+=cursor.getObject(measureBindingNames.get(j).toString()) + "String_Node_Str";
        }
        if (countryGrandTotal != null)         for (int k=0; k < countryGrandTotal.size(); k++) {
          if (edge1.getPosition() == countryCursor.getEdgeEnd() && countryGrandTotal != null) {
            line+=cursor.getObject(countryGrandTotal.get(k).toString());
          }
        }
        line+="String_Node_Str";
      }
    }
    if (rowGrandTotal != null)     for (int j=0; j < rowGrandTotal.size(); j++) {
      line+=cursor.getObject(rowGrandTotal.get(j).toString()) + "String_Node_Str";
    }
    output+="String_Node_Str" + line;
  }
  edge1.close();
  edge2.close();
  if (columnGrandTotal != null) {
    output+="String_Node_Str" + columnGrandTotal + "String_Node_Str";
    edge1.beforeFirst();
    while (edge1.next()) {
      output+=cursor.getObject(columnGrandTotal) + "String_Node_Str";
    }
  }
  if (totalGrandTotal != null)   output+=cursor.getObject(totalGrandTotal);
  cursor.close();
  System.out.print(output);
  return output;
}

Fixed version (ground truth):
String printCubeAlongEdge(CubeCursor cursor,List columnEdgeBindingNames,List rowEdgeBindingNames,List measureBindingNames,List rowGrandTotal,String columnGrandTotal,String totalGrandTotal,List countryGrandTotal) throws Exception {
  EdgeCursor edge1=(EdgeCursor)(cursor.getOrdinateEdge().get(0));
  EdgeCursor edge2=(EdgeCursor)(cursor.getOrdinateEdge().get(1));
  String[] lines=new String[edge1.getDimensionCursor().size()];
  for (int i=0; i < lines.length; i++) {
    lines[i]="String_Node_Str";
  }
  while (edge1.next()) {
    for (int i=0; i < lines.length; i++) {
      DimensionCursor dimCursor=(DimensionCursor)edge1.getDimensionCursor().get(i);
      lines[i]+=dimCursor.getObject(columnEdgeBindingNames.get(i).toString()) + "String_Node_Str";
    }
  }
  String output="String_Node_Str";
  for (int i=0; i < lines.length; i++) {
    output+="String_Node_Str" + lines[i];
  }
  while (edge2.next()) {
    String line="String_Node_Str";
    for (int k=0; k < rowEdgeBindingNames.size(); k++) {
      DimensionCursor dimCursor=(DimensionCursor)edge2.getDimensionCursor().get(k);
      line+=dimCursor.getObject(rowEdgeBindingNames.get(k).toString()).toString() + "String_Node_Str";
    }
    edge1.beforeFirst();
    while (edge1.next()) {
      DimensionCursor countryCursor=(DimensionCursor)edge1.getDimensionCursor().get(0);
      if (measureBindingNames != null) {
        for (int j=0; j < measureBindingNames.size(); j++) {
          line+=cursor.getObject(OlapExpressionUtil.createMeasureCalculateMemeberName(measureBindingNames.get(j).toString())) + "String_Node_Str";
        }
        if (countryGrandTotal != null)         for (int k=0; k < countryGrandTotal.size(); k++) {
          if (edge1.getPosition() == countryCursor.getEdgeEnd() && countryGrandTotal != null) {
            line+=cursor.getObject(countryGrandTotal.get(k).toString());
          }
        }
        line+="String_Node_Str";
      }
    }
    if (rowGrandTotal != null)     for (int j=0; j < rowGrandTotal.size(); j++) {
      line+=cursor.getObject(rowGrandTotal.get(j).toString()) + "String_Node_Str";
    }
    output+="String_Node_Str" + line;
  }
  edge1.close();
  edge2.close();
  if (columnGrandTotal != null) {
    output+="String_Node_Str" + columnGrandTotal + "String_Node_Str";
    edge1.beforeFirst();
    while (edge1.next()) {
      output+=cursor.getObject(columnGrandTotal) + "String_Node_Str";
    }
  }
  if (totalGrandTotal != null)   output+=cursor.getObject(totalGrandTotal);
  cursor.close();
  System.out.print(output);
  return output;
}