Program: 66914
Project: 66914
Buggy source:
private List getSelectedValueList(){
  if (needRefreshList == false) {
    return selValueList;
  }
  CubeHandle cube=null;
  CrosstabReportItemHandle crosstab=null;
  if (designHandle instanceof ExtendedItemHandle) {
    try {
      Object obj=((ExtendedItemHandle)designHandle).getReportItem();
      if (obj instanceof CrosstabReportItemHandle) {
        crosstab=(CrosstabReportItemHandle)obj;
      }
      crosstab=(CrosstabReportItemHandle)((ExtendedItemHandle)designHandle).getReportItem();
      cube=crosstab.getCube();
    }
 catch (    ExtendedElementException e) {
      logger.log(Level.SEVERE,e.getMessage(),e);
    }
  }
  if (cube == null || (!(cube instanceof CubeHandle)) || expressionCCombo.getText().length() == 0) {
    return new ArrayList();
  }
  Iterator iter=null;
  ICubeQueryDefinition cubeQueryDefn=null;
  DataRequestSession session=null;
  try {
    String expression=null;
    if (ExpressionType.JAVASCRIPT.equals(ExpressionButtonUtil.getExpression(expressionCCombo).getType())) {
      expression=expressionCCombo.getText();
    }
 else {
      expression=ExpressionButtonUtil.getCurrentExpressionConverter(expressionCCombo).convertExpression(expressionCCombo.getText(),ExpressionType.JAVASCRIPT,IExpressionConverter.EXPRESSION_CLASS_CUBE);
    }
    ReportDesignHandle copy=(ReportDesignHandle)(designHandle.getModuleHandle().copy().getHandle(null));
    EngineConfig config=new EngineConfig();
    config.setProperty(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,DataSetProvider.getCustomScriptClassLoader(Thread.currentThread().getContextClassLoader(),copy));
    ReportEngine engine=(ReportEngine)new ReportEngineFactory().createReportEngine(config);
    DummyEngineTask engineTask=new DummyEngineTask(engine,new ReportEngineHelper(engine).openReportDesign((ReportDesignHandle)copy),copy);
    session=engineTask.getDataSession();
    engineTask.run();
    DataService.getInstance().registerSession(cube,session);
    cubeQueryDefn=CrosstabUIHelper.createBindingQuery(crosstab);
    Map context=session.getDataSessionContext().getAppContext();
    iter=CubeValueSelector.getMemberValueIterator(session,cube,expression,cubeQueryDefn,context);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
  selValueList=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 (selValueList.indexOf(obj) < 0) {
        selValueList.add(obj);
        if (++count >= MAX_COUNT) {
          break;
        }
      }
    }
  }
  needRefreshList=false;
  if (session != null) {
    session.shutdown();
  }
  return selValueList;
}

Fixed version (ground truth):
private List getSelectedValueList(){
  if (needRefreshList == false) {
    return selValueList;
  }
  CubeHandle cube=null;
  CrosstabReportItemHandle crosstab=null;
  if (designHandle instanceof ExtendedItemHandle) {
    try {
      Object obj=((ExtendedItemHandle)designHandle).getReportItem();
      if (obj instanceof CrosstabReportItemHandle) {
        crosstab=(CrosstabReportItemHandle)obj;
      }
      crosstab=(CrosstabReportItemHandle)((ExtendedItemHandle)designHandle).getReportItem();
      cube=crosstab.getCube();
    }
 catch (    ExtendedElementException e) {
      logger.log(Level.SEVERE,e.getMessage(),e);
    }
  }
  if (cube == null || expressionCCombo.getText().length() == 0) {
    return new ArrayList();
  }
  Iterator iter=null;
  ICubeQueryDefinition cubeQueryDefn=null;
  DataRequestSession session=null;
  try {
    String expression=null;
    if (ExpressionType.JAVASCRIPT.equals(ExpressionButtonUtil.getExpression(expressionCCombo).getType())) {
      expression=expressionCCombo.getText();
    }
 else {
      expression=ExpressionButtonUtil.getCurrentExpressionConverter(expressionCCombo).convertExpression(expressionCCombo.getText(),ExpressionType.JAVASCRIPT,IExpressionConverter.EXPRESSION_CLASS_CUBE);
    }
    ReportDesignHandle copy=(ReportDesignHandle)(designHandle.getModuleHandle().copy().getHandle(null));
    EngineConfig config=new EngineConfig();
    config.setProperty(EngineConstants.APPCONTEXT_CLASSLOADER_KEY,DataSetProvider.getCustomScriptClassLoader(Thread.currentThread().getContextClassLoader(),copy));
    ReportEngine engine=(ReportEngine)new ReportEngineFactory().createReportEngine(config);
    DummyEngineTask engineTask=new DummyEngineTask(engine,new ReportEngineHelper(engine).openReportDesign((ReportDesignHandle)copy),copy);
    session=engineTask.getDataSession();
    engineTask.run();
    DataService.getInstance().registerSession(cube,session);
    cubeQueryDefn=CrosstabUIHelper.createBindingQuery(crosstab);
    Map context=session.getDataSessionContext().getAppContext();
    iter=CubeValueSelector.getMemberValueIterator(session,cube,expression,cubeQueryDefn,context);
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
  selValueList=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 (selValueList.indexOf(obj) < 0) {
        selValueList.add(obj);
        if (++count >= MAX_COUNT) {
          break;
        }
      }
    }
  }
  needRefreshList=false;
  if (session != null) {
    session.shutdown();
  }
  return selValueList;
}