Program: 65261
Project: 65261
Buggy source:
public List getQueryList(String expression,ExtendedItemHandle extendedItem){
  CrosstabReportItemHandle crosstab=null;
  CubeHandle cube=null;
  try {
    Object obj=((ExtendedItemHandle)extendedItem).getReportItem();
    DesignElementHandle tmp=extendedItem;
    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) {
  }
  if (cube == null || (!(cube instanceof TabularCubeHandle)) || expression.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=CubeValueSelector.getMemberValueIterator(session,cube,expression,cubeQueryDefn);
  }
 catch (  Exception 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;
}

Fixed version (ground truth):
public List getQueryList(String expression,ExtendedItemHandle extendedItem){
  CrosstabReportItemHandle crosstab=null;
  CubeHandle cube=null;
  try {
    Object obj=((ExtendedItemHandle)extendedItem).getReportItem();
    DesignElementHandle tmp=extendedItem;
    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) {
  }
  if (cube == null || (!(cube instanceof TabularCubeHandle)) || expression.length() == 0) {
    return new ArrayList();
  }
  Iterator iter=null;
  ICubeQueryDefinition cubeQueryDefn=null;
  DataRequestSession session=null;
  try {
    session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION,extendedItem.getModuleHandle()));
    DataService.getInstance().registerSession(cube,session);
    cubeQueryDefn=CrosstabUIHelper.createBindingQuery(crosstab);
    iter=CubeValueSelector.getMemberValueIterator(session,cube,expression,cubeQueryDefn);
  }
 catch (  Exception 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;
}