Program: 66055
Project: 66055
Buggy source:
private void initAggOn(){
  try {
    CrosstabReportItemHandle xtabHandle=(CrosstabReportItemHandle)((ExtendedItemHandle)getBindingHolder()).getReportItem();
    String[] aggOns=getAggOns(xtabHandle);
    cmbAggOn.setItems(aggOns);
    String aggstr="String_Node_Str";
    if (getBinding() != null) {
      List aggOnList=getBinding().getAggregateOnList();
      int i=0;
      for (Iterator iterator=aggOnList.iterator(); iterator.hasNext(); ) {
        if (i > 0)         aggstr+="String_Node_Str";
        String name=(String)iterator.next();
        aggstr+=name;
        i++;
      }
    }
 else     if (isTimePeriod()) {
      List rowLevelList=getCrosstabViewHandleLevels(xtabHandle,ICrosstabConstants.ROW_AXIS_TYPE);
      List columnLevelList=getCrosstabViewHandleLevels(xtabHandle,ICrosstabConstants.COLUMN_AXIS_TYPE);
      if (rowLevelList.size() != 0 && columnLevelList.size() == 0) {
        aggstr=(String)rowLevelList.get(rowLevelList.size() - 1);
      }
 else       if (rowLevelList.size() == 0 && columnLevelList.size() != 0) {
        aggstr=(String)columnLevelList.get(columnLevelList.size() - 1);
      }
 else       if (rowLevelList.size() != 0 && columnLevelList.size() != 0) {
        aggstr=(String)rowLevelList.get(rowLevelList.size() - 1) + "String_Node_Str" + (String)columnLevelList.get(columnLevelList.size() - 1);
      }
    }
 else     if (getDataItemContainer() instanceof AggregationCellHandle) {
      AggregationCellHandle cellHandle=(AggregationCellHandle)getDataItemContainer();
      if (cellHandle.getAggregationOnRow() != null) {
        aggstr+=cellHandle.getAggregationOnRow().getFullName();
        if (cellHandle.getAggregationOnColumn() != null) {
          aggstr+="String_Node_Str";
        }
      }
      if (cellHandle.getAggregationOnColumn() != null) {
        aggstr+=cellHandle.getAggregationOnColumn().getFullName();
      }
    }
 else     if (container instanceof AggregationCellHandle) {
      AggregationCellHandle cellHandle=(AggregationCellHandle)container;
      if (cellHandle.getAggregationOnRow() != null) {
        aggstr+=cellHandle.getAggregationOnRow().getFullName();
        if (cellHandle.getAggregationOnColumn() != null) {
          aggstr+="String_Node_Str";
        }
      }
      if (cellHandle.getAggregationOnColumn() != null) {
        aggstr+=cellHandle.getAggregationOnColumn().getFullName();
      }
    }
    for (int j=0; j < aggOns.length; j++) {
      if (aggOns[j].equals(aggstr)) {
        cmbAggOn.select(j);
        return;
      }
    }
    cmbAggOn.select(0);
  }
 catch (  ExtendedElementException e) {
    ExceptionUtil.handle(e);
  }
}

Fixed version (ground truth):
private void initAggOn(){
  try {
    CrosstabReportItemHandle xtabHandle=(CrosstabReportItemHandle)((ExtendedItemHandle)getBindingHolder()).getReportItem();
    String[] aggOns=getAggOns(xtabHandle);
    cmbAggOn.setItems(aggOns);
    String aggstr="String_Node_Str";
    if (getBinding() != null) {
      List aggOnList=getBinding().getAggregateOnList();
      int i=0;
      for (Iterator iterator=aggOnList.iterator(); iterator.hasNext(); ) {
        if (i > 0)         aggstr+="String_Node_Str";
        String name=(String)iterator.next();
        aggstr+=name;
        i++;
      }
    }
 else     if (isTimePeriod()) {
      List rowLevelList=getCrosstabViewHandleLevels(xtabHandle,ICrosstabConstants.ROW_AXIS_TYPE);
      List columnLevelList=getCrosstabViewHandleLevels(xtabHandle,ICrosstabConstants.COLUMN_AXIS_TYPE);
      if (rowLevelList.size() != 0 && columnLevelList.size() == 0) {
        aggstr=(String)rowLevelList.get(rowLevelList.size() - 1);
      }
 else       if (rowLevelList.size() == 0 && columnLevelList.size() != 0) {
        aggstr=(String)columnLevelList.get(columnLevelList.size() - 1);
      }
 else       if (rowLevelList.size() != 0 && columnLevelList.size() != 0) {
        aggstr=(String)rowLevelList.get(rowLevelList.size() - 1) + "String_Node_Str" + (String)columnLevelList.get(columnLevelList.size() - 1);
      }
    }
 else     if (getDataItemContainer() instanceof AggregationCellHandle) {
      AggregationCellHandle cellHandle=(AggregationCellHandle)getDataItemContainer();
      if (cellHandle.getAggregationOnRow() != null) {
        aggstr+=cellHandle.getAggregationOnRow().getFullName();
        if (cellHandle.getAggregationOnColumn() != null) {
          aggstr+="String_Node_Str";
        }
      }
      if (cellHandle.getAggregationOnColumn() != null) {
        aggstr+=cellHandle.getAggregationOnColumn().getFullName();
      }
    }
 else     if (container instanceof AggregationCellHandle) {
      AggregationCellHandle cellHandle=(AggregationCellHandle)container;
      if (cellHandle.getAggregationOnRow() != null) {
        aggstr+=cellHandle.getAggregationOnRow().getFullName();
        if (cellHandle.getAggregationOnColumn() != null) {
          aggstr+="String_Node_Str";
        }
      }
      if (cellHandle.getAggregationOnColumn() != null) {
        aggstr+=cellHandle.getAggregationOnColumn().getFullName();
      }
    }
    String[] strs=aggstr.split("String_Node_Str");
    String temAddOns="String_Node_Str";
    if (strs != null && strs.length > 1) {
      for (int i=strs.length - 1; i >= 0; i--) {
        temAddOns=temAddOns + strs[i];
        if (i != 0) {
          temAddOns=temAddOns + "String_Node_Str";
        }
      }
    }
    for (int j=0; j < aggOns.length; j++) {
      if (aggOns[j].equals(aggstr)) {
        cmbAggOn.select(j);
        return;
      }
      if (aggOns[j].equals(temAddOns)) {
        cmbAggOn.select(j);
        return;
      }
    }
    cmbAggOn.select(0);
  }
 catch (  ExtendedElementException e) {
    ExceptionUtil.handle(e);
  }
}