Program: 76032
Project: 76032
Buggy source:
/** 
 * Returns if aggregation is defined on given level on specific axis
 * @param measureView
 * @param levelView
 * @param axisType
 * @return
 */
protected boolean isAggregationDefined(MeasureViewHandle measureView,LevelViewHandle levelView,int axisType){
  if (measureView != null) {
    String checkDimensionName=null;
    String checkLevelName=null;
    if (levelView != null) {
      checkDimensionName=((DimensionViewHandle)levelView.getContainer()).getCubeDimensionName();
      checkLevelName=levelView.getCubeLevelName();
    }
    boolean isInnerMost=levelView != null ? levelView.isInnerMost() : false;
    if (isInnerMost) {
      return true;
    }
    if (axisType == ROW_AXIS_TYPE) {
      int totalRowDimensions=crosstab.getDimensionCount(COLUMN_AXIS_TYPE);
      if (totalRowDimensions > 0) {
        for (int i=0; i < totalRowDimensions; i++) {
          DimensionViewHandle dv=crosstab.getDimension(COLUMN_AXIS_TYPE,i);
          int totalLevels=dv.getLevelCount();
          for (int j=0; j < totalLevels; j++) {
            LevelViewHandle lv=dv.getLevel(j);
            if ((i == totalRowDimensions - 1 && j == totalLevels - 1) || lv.getAggregationHeader() != null) {
              AggregationCellHandle cell=measureView.getAggregationCell(checkDimensionName,checkLevelName,dv.getCubeDimensionName(),lv.getCubeLevelName());
              if (cell != null) {
                return true;
              }
            }
          }
        }
      }
      if (totalRowDimensions == 0 || crosstab.getGrandTotal(COLUMN_AXIS_TYPE) != null) {
        AggregationCellHandle cell=measureView.getAggregationCell(checkDimensionName,checkLevelName,null,null);
        if (cell != null) {
          return true;
        }
      }
    }
 else     if (axisType == COLUMN_AXIS_TYPE) {
      int totalRowDimensions=crosstab.getDimensionCount(ROW_AXIS_TYPE);
      if (totalRowDimensions > 0) {
        for (int i=0; i < totalRowDimensions; i++) {
          DimensionViewHandle dv=crosstab.getDimension(ROW_AXIS_TYPE,i);
          int totalLevels=dv.getLevelCount();
          for (int j=0; j < totalLevels; j++) {
            LevelViewHandle lv=dv.getLevel(j);
            if ((i == totalRowDimensions - 1 && j == totalLevels - 1) || lv.getAggregationHeader() != null) {
              AggregationCellHandle cell=measureView.getAggregationCell(dv.getCubeDimensionName(),lv.getCubeLevelName(),checkDimensionName,checkLevelName);
              if (cell != null) {
                return true;
              }
            }
          }
        }
      }
      if (totalRowDimensions == 0 || crosstab.getGrandTotal(ROW_AXIS_TYPE) != null) {
        AggregationCellHandle cell=measureView.getAggregationCell(null,null,checkDimensionName,checkLevelName);
        if (cell != null) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns if aggregation is defined on given level on specific axis
 * @param measureView
 * @param levelView
 * @param axisType
 * @return
 */
protected boolean isAggregationDefined(MeasureViewHandle measureView,LevelViewHandle levelView,int axisType){
  if (measureView != null) {
    String checkDimensionName=null;
    String checkLevelName=null;
    if (levelView != null) {
      checkDimensionName=((DimensionViewHandle)levelView.getContainer()).getCubeDimensionName();
      checkLevelName=levelView.getCubeLevelName();
    }
    boolean isInnerMost=levelView != null ? levelView.isInnerMost() : false;
    if (isInnerMost) {
      return true;
    }
    if (axisType == ROW_AXIS_TYPE) {
      int totalColDimensions=crosstab.getDimensionCount(COLUMN_AXIS_TYPE);
      if (totalColDimensions > 0) {
        for (int i=0; i < totalColDimensions; i++) {
          DimensionViewHandle dv=crosstab.getDimension(COLUMN_AXIS_TYPE,i);
          int totalLevels=dv.getLevelCount();
          for (int j=0; j < totalLevels; j++) {
            LevelViewHandle lv=dv.getLevel(j);
            if ((i == totalColDimensions - 1 && j == totalLevels - 1) || lv.getAggregationHeader() != null) {
              AggregationCellHandle cell=measureView.getAggregationCell(checkDimensionName,checkLevelName,dv.getCubeDimensionName(),lv.getCubeLevelName());
              if (cell != null) {
                return true;
              }
            }
          }
        }
      }
      if (totalColDimensions == 0 || crosstab.getGrandTotal(COLUMN_AXIS_TYPE) != null) {
        AggregationCellHandle cell=measureView.getAggregationCell(checkDimensionName,checkLevelName,null,null);
        if (cell != null) {
          return true;
        }
      }
    }
 else     if (axisType == COLUMN_AXIS_TYPE) {
      int totalRowDimensions=crosstab.getDimensionCount(ROW_AXIS_TYPE);
      if (totalRowDimensions > 0) {
        for (int i=0; i < totalRowDimensions; i++) {
          DimensionViewHandle dv=crosstab.getDimension(ROW_AXIS_TYPE,i);
          int totalLevels=dv.getLevelCount();
          for (int j=0; j < totalLevels; j++) {
            LevelViewHandle lv=dv.getLevel(j);
            if ((i == totalRowDimensions - 1 && j == totalLevels - 1) || lv.getAggregationHeader() != null) {
              AggregationCellHandle cell=measureView.getAggregationCell(dv.getCubeDimensionName(),lv.getCubeLevelName(),checkDimensionName,checkLevelName);
              if (cell != null) {
                return true;
              }
            }
          }
        }
      }
      if (totalRowDimensions == 0 || crosstab.getGrandTotal(ROW_AXIS_TYPE) != null) {
        AggregationCellHandle cell=measureView.getAggregationCell(null,null,checkDimensionName,checkLevelName);
        if (cell != null) {
          return true;
        }
      }
    }
  }
  return false;
}