Program: 72147
Project: 72147
Buggy source:
TableColumnGenerator(CrosstabReportItemHandle item,IColumnWalker walker,IBaseResultSet resultSet,EdgeCursor columnCursor,List<EdgeGroup> columnGroups) throws OLAPException {
  this.crosstabItem=item;
  this.walker=walker;
  this.columnCursor=columnCursor;
  this.columnGroups=columnGroups;
  if (columnCursor != null) {
    groupCursors=columnCursor.getDimensionCursor();
  }
  if (columnGroups.size() > 0) {
    pageBreakBeforeInts=new int[columnGroups.size()];
    pageBreakAfterInts=new int[columnGroups.size()];
    hasTotalBefore=new boolean[columnGroups.size()];
    hasTotalAfter=new boolean[columnGroups.size()];
    Arrays.fill(hasTotalBefore,false);
    Arrays.fill(hasTotalAfter,false);
    String pageBreak;
    boolean allowTotal=crosstabItem.getMeasureCount() > 0 || !IColumnWalker.IGNORE_TOTAL_COLUMN_WITHOUT_MEASURE;
    for (int i=0; i < columnGroups.size(); i++) {
      EdgeGroup eg=columnGroups.get(i);
      LevelViewHandle lv=crosstabItem.getDimension(COLUMN_AXIS_TYPE,eg.dimensionIndex).getLevel(eg.levelIndex);
      pageBreak=lv.getPageBreakBefore();
      pageBreakBeforeInts[i]=DesignChoiceConstants.PAGE_BREAK_BEFORE_ALWAYS.equals(pageBreak) ? 1 : (DesignChoiceConstants.PAGE_BREAK_BEFORE_ALWAYS_EXCLUDING_FIRST.equals(pageBreak) ? 2 : 0);
      pageBreak=lv.getPageBreakAfter();
      pageBreakAfterInts[i]=DesignChoiceConstants.PAGE_BREAK_AFTER_ALWAYS.equals(pageBreak) ? 1 : (DesignChoiceConstants.PAGE_BREAK_AFTER_ALWAYS_EXCLUDING_LAST.equals(pageBreak) ? 2 : 0);
      if (allowTotal && i != columnGroups.size() - 1 && lv.getAggregationHeader() != null) {
        if (AGGREGATION_HEADER_LOCATION_BEFORE.equals(lv.getAggregationHeaderLocation())) {
          hasTotalBefore[i]=true;
        }
 else         if (AGGREGATION_HEADER_LOCATION_AFTER.equals(lv.getAggregationHeaderLocation())) {
          hasTotalAfter[i]=true;
        }
      }
    }
  }
  int rdCount=crosstabItem.getDimensionCount(ROW_AXIS_TYPE);
  if (rdCount > 0) {
    DimensionViewHandle dv=crosstabItem.getDimension(ROW_AXIS_TYPE,rdCount - 1);
    if (dv.getLevelCount() > 0) {
      LevelViewHandle lv=dv.getLevel(dv.getLevelCount() - 1);
      rowDimension=dv.getCubeDimensionName();
      rowLevel=lv.getCubeLevelName();
    }
  }
}

Fixed version (ground truth):
TableColumnGenerator(CrosstabReportItemHandle item,IColumnWalker walker,IBaseResultSet resultSet,EdgeCursor columnCursor,List<EdgeGroup> columnGroups) throws OLAPException {
  this.crosstabItem=item;
  this.walker=walker;
  this.columnCursor=columnCursor;
  this.columnGroups=columnGroups;
  if (columnCursor != null) {
    groupCursors=columnCursor.getDimensionCursor();
  }
  if (columnGroups.size() > 0) {
    pageBreakBeforeInts=new int[columnGroups.size()];
    pageBreakAfterInts=new int[columnGroups.size()];
    hasTotalBefore=new boolean[columnGroups.size()];
    hasTotalAfter=new boolean[columnGroups.size()];
    Arrays.fill(hasTotalBefore,false);
    Arrays.fill(hasTotalAfter,false);
    firstTotalMeasureIndex=new int[columnGroups.size()];
    lastTotalMeasureIndex=new int[columnGroups.size()];
    Arrays.fill(firstTotalMeasureIndex,-1);
    Arrays.fill(lastTotalMeasureIndex,-1);
    int totalMeasureCount=crosstabItem.getMeasureCount();
    lastMeasureIndex=totalMeasureCount - 1;
    firstGrandTotalMeasureIndex=-1;
    String pageBreak;
    boolean allowTotal=totalMeasureCount > 0 || !IColumnWalker.IGNORE_TOTAL_COLUMN_WITHOUT_MEASURE;
    for (int i=0; i < columnGroups.size(); i++) {
      EdgeGroup eg=columnGroups.get(i);
      LevelViewHandle lv=crosstabItem.getDimension(COLUMN_AXIS_TYPE,eg.dimensionIndex).getLevel(eg.levelIndex);
      pageBreak=lv.getPageBreakBefore();
      pageBreakBeforeInts[i]=DesignChoiceConstants.PAGE_BREAK_BEFORE_ALWAYS.equals(pageBreak) ? 1 : (DesignChoiceConstants.PAGE_BREAK_BEFORE_ALWAYS_EXCLUDING_FIRST.equals(pageBreak) ? 2 : 0);
      pageBreak=lv.getPageBreakAfter();
      pageBreakAfterInts[i]=DesignChoiceConstants.PAGE_BREAK_AFTER_ALWAYS.equals(pageBreak) ? 1 : (DesignChoiceConstants.PAGE_BREAK_AFTER_ALWAYS_EXCLUDING_LAST.equals(pageBreak) ? 2 : 0);
      if (allowTotal && i != columnGroups.size() - 1 && lv.getAggregationHeader() != null) {
        if (AGGREGATION_HEADER_LOCATION_BEFORE.equals(lv.getAggregationHeaderLocation())) {
          hasTotalBefore[i]=true;
        }
 else         if (AGGREGATION_HEADER_LOCATION_AFTER.equals(lv.getAggregationHeaderLocation())) {
          hasTotalAfter[i]=true;
        }
        List mvs=lv.getAggregationMeasures();
        if (mvs.size() > 0) {
          firstTotalMeasureIndex[i]=((MeasureViewHandle)mvs.get(0)).getIndex();
          lastTotalMeasureIndex[i]=((MeasureViewHandle)mvs.get(mvs.size() - 1)).getIndex();
        }
      }
    }
    if (allowTotal && crosstabItem.getGrandTotal(COLUMN_AXIS_TYPE) != null) {
      List mvs=crosstabItem.getAggregationMeasures(COLUMN_AXIS_TYPE);
      if (mvs.size() > 0) {
        firstGrandTotalMeasureIndex=((MeasureViewHandle)mvs.get(0)).getIndex();
      }
    }
  }
  int rdCount=crosstabItem.getDimensionCount(ROW_AXIS_TYPE);
  if (rdCount > 0) {
    DimensionViewHandle dv=crosstabItem.getDimension(ROW_AXIS_TYPE,rdCount - 1);
    if (dv.getLevelCount() > 0) {
      LevelViewHandle lv=dv.getLevel(dv.getLevelCount() - 1);
      rowDimension=dv.getCubeDimensionName();
      rowLevel=lv.getCubeLevelName();
    }
  }
}