Program: 51309
Project: 51309
Buggy source:
public MDDataSet_Tabular(Result result){
  super(result);
  final Axis[] axes=result.getAxes();
  axisCount=axes.length;
  pos=new int[axisCount];
  boolean empty=false;
  int dimensionCount=0;
  for (int i=axes.length - 1; i > 0; i--) {
    Axis axis=axes[i];
    if (axis.getPositions().size() == 0) {
      empty=true;
      continue;
    }
    dimensionCount+=axis.getPositions().get(0).size();
  }
  this.empty=empty;
  Level[] levels=new Level[dimensionCount];
  List<ColumnHandler> columnHandlerList=new ArrayList<ColumnHandler>();
  int memberOrdinal=0;
  if (!empty) {
    for (int i=axes.length - 1; i > 0; i--) {
      final Axis axis=axes[i];
      final QueryAxis queryAxis=result.getQuery().getAxes()[i];
      final int z0=memberOrdinal;
      final List<Position> positions=axis.getPositions();
      int jj=0;
      for (      Position position : positions) {
        memberOrdinal=z0;
        for (        Member member : position) {
          if (jj == 0 || member.getLevel().getDepth() > levels[memberOrdinal].getDepth()) {
            levels[memberOrdinal]=member.getLevel();
          }
        }
        ++memberOrdinal;
        jj++;
      }
      Id[] dimProps=queryAxis.getDimensionProperties();
      if (dimProps.length == 0) {
        dimProps=MemberCaptionIdArray;
      }
      for (int j=z0; j < memberOrdinal; j++) {
        Level level=levels[j];
        for (int k=0; k <= level.getDepth(); k++) {
          final Level level2=level.getHierarchy().getLevels()[k];
          if (level2.isAll()) {
            continue;
          }
          for (          Id dimProp : dimProps) {
            columnHandlerList.add(new MemberColumnHandler(dimProp.toStringArray()[0],level2,j));
          }
        }
      }
    }
  }
  this.members=new Member[memberOrdinal];
  Axis columnsAxis=axes[0];
  for (  Position position : columnsAxis.getPositions()) {
    String name=null;
    int j=0;
    for (    Member member : position) {
      if (j == 0) {
        name=member.getUniqueName();
      }
 else {
        name=name + "String_Node_Str" + member.getUniqueName();
      }
      j++;
    }
    columnHandlerList.add(new CellColumnHandler(name));
  }
  this.columnHandlers=columnHandlerList.toArray(new ColumnHandler[columnHandlerList.size()]);
}

Fixed version (ground truth):
public MDDataSet_Tabular(Result result){
  super(result);
  final Axis[] axes=result.getAxes();
  axisCount=axes.length;
  pos=new int[axisCount];
  boolean empty=false;
  int dimensionCount=0;
  for (int i=axes.length - 1; i > 0; i--) {
    Axis axis=axes[i];
    if (axis.getPositions().size() == 0) {
      empty=true;
      continue;
    }
    dimensionCount+=axis.getPositions().get(0).size();
  }
  this.empty=empty;
  Level[] levels=new Level[dimensionCount];
  List<ColumnHandler> columnHandlerList=new ArrayList<ColumnHandler>();
  int memberOrdinal=0;
  if (!empty) {
    for (int i=axes.length - 1; i > 0; i--) {
      final Axis axis=axes[i];
      final QueryAxis queryAxis=result.getQuery().getAxes()[i];
      final int z0=memberOrdinal;
      final List<Position> positions=axis.getPositions();
      int jj=0;
      for (      Position position : positions) {
        memberOrdinal=z0;
        for (        Member member : position) {
          if (jj == 0 || member.getLevel().getDepth() > levels[memberOrdinal].getDepth()) {
            levels[memberOrdinal]=member.getLevel();
          }
          memberOrdinal++;
        }
        jj++;
      }
      Id[] dimProps=queryAxis.getDimensionProperties();
      if (dimProps.length == 0) {
        dimProps=MemberCaptionIdArray;
      }
      for (int j=z0; j < memberOrdinal; j++) {
        Level level=levels[j];
        for (int k=0; k <= level.getDepth(); k++) {
          final Level level2=level.getHierarchy().getLevels()[k];
          if (level2.isAll()) {
            continue;
          }
          for (          Id dimProp : dimProps) {
            columnHandlerList.add(new MemberColumnHandler(dimProp.toStringArray()[0],level2,j));
          }
        }
      }
    }
  }
  this.members=new Member[memberOrdinal + 1];
  if (axes.length > 0) {
    Axis columnsAxis=axes[0];
    for (    Position position : columnsAxis.getPositions()) {
      String name=null;
      int j=0;
      for (      Member member : position) {
        if (j == 0) {
          name=member.getUniqueName();
        }
 else {
          name=name + "String_Node_Str" + member.getUniqueName();
        }
        j++;
      }
      columnHandlerList.add(new CellColumnHandler(name));
    }
  }
  this.columnHandlers=columnHandlerList.toArray(new ColumnHandler[columnHandlerList.size()]);
}