Program: 70049
Project: 70049
Buggy source:
private List getSelectedValueList(){
  CubeHandle cube=null;
  CrosstabReportItemHandle crosstab=null;
  if (designHandle instanceof ExtendedItemHandle) {
    try {
      Object obj=((ExtendedItemHandle)designHandle).getReportItem();
      DesignElementHandle tmp=designHandle;
      while (true) {
        if (obj == null || obj instanceof ReportDesignHandle) {
          break;
        }
 else         if (obj instanceof CrosstabReportItemHandle) {
          crosstab=(CrosstabReportItemHandle)obj;
          cube=crosstab.getCube();
          break;
        }
 else         if (tmp instanceof ExtendedItemHandle) {
          tmp=tmp.getContainer();
          if (tmp instanceof ExtendedItemHandle) {
            obj=((ExtendedItemHandle)tmp).getReportItem();
          }
        }
      }
    }
 catch (    ExtendedElementException e) {
      logger.log(Level.SEVERE,e.getMessage(),e);
    }
  }
  if (cube == null || (!(cube instanceof TabularCubeHandle)) || expression.getText().length() == 0) {
    return new ArrayList();
  }
  Iterator iter=null;
  ICubeQueryDefinition cubeQueryDefn=null;
  DataRequestSession session=null;
  try {
    session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION));
    cubeQueryDefn=CrosstabUIHelper.createBindingQuery(crosstab);
    iter=session.getCubeQueryUtil().getMemberValueIterator((TabularCubeHandle)cube,expression.getText(),cubeQueryDefn);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
 finally {
    if (session != null) {
      session.shutdown();
    }
  }
  List valueList=new ArrayList();
  int count=0;
  int MAX_COUNT=PreferenceFactory.getInstance().getPreferences(CrosstabPlugin.getDefault(),UIUtil.getCurrentProject()).getInt(CrosstabPlugin.PREFERENCE_FILTER_LIMIT);
  while (iter != null && iter.hasNext()) {
    Object obj=iter.next();
    if (obj != null) {
      if (valueList.indexOf(obj) < 0) {
        valueList.add(obj);
        if (++count >= MAX_COUNT) {
          break;
        }
      }
    }
  }
  return valueList;
}

Fixed version (ground truth):
private List getSelectedValueList(){
  CubeHandle cube=null;
  CrosstabReportItemHandle crosstab=null;
  if (designHandle instanceof ExtendedItemHandle) {
    try {
      Object obj=((ExtendedItemHandle)designHandle).getReportItem();
      DesignElementHandle tmp=designHandle;
      while (true) {
        if (obj == null || obj instanceof ReportDesignHandle) {
          break;
        }
 else         if (obj instanceof CrosstabReportItemHandle) {
          crosstab=(CrosstabReportItemHandle)obj;
          cube=crosstab.getCube();
          break;
        }
 else         if (tmp instanceof ExtendedItemHandle) {
          tmp=tmp.getContainer();
          if (tmp instanceof ExtendedItemHandle) {
            obj=((ExtendedItemHandle)tmp).getReportItem();
          }
        }
      }
    }
 catch (    ExtendedElementException e) {
      logger.log(Level.SEVERE,e.getMessage(),e);
    }
  }
  if (cube == null || (!(cube instanceof TabularCubeHandle)) || expression.getText().length() == 0) {
    return new ArrayList();
  }
  Iterator iter=null;
  ICubeQueryDefinition cubeQueryDefn=null;
  DataRequestSession session=null;
  try {
    session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION));
    cubeQueryDefn=CrosstabUIHelper.createBindingQuery(crosstab);
    iter=session.getCubeQueryUtil().getMemberValueIterator((TabularCubeHandle)cube,expression.getText(),cubeQueryDefn);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
  List valueList=new ArrayList();
  int count=0;
  int MAX_COUNT=PreferenceFactory.getInstance().getPreferences(CrosstabPlugin.getDefault(),UIUtil.getCurrentProject()).getInt(CrosstabPlugin.PREFERENCE_FILTER_LIMIT);
  while (iter != null && iter.hasNext()) {
    Object obj=iter.next();
    if (obj != null) {
      if (valueList.indexOf(obj) < 0) {
        valueList.add(obj);
        if (++count >= MAX_COUNT) {
          break;
        }
      }
    }
  }
  if (session != null) {
    session.shutdown();
  }
  return valueList;
}