Program: 74904
Project: 74904
Buggy source:
/** 
 * @param selectValueExpression
 * @param dataSetHandle
 * @return
 * @throws BirtException
 */
public static List getSelectValueList(String expression,DataSetHandle dataSetHandle) throws BirtException {
  ParamBindingHandle[] bindingParams=null;
  List selectValueList=new ArrayList();
  if (expression != null && expression.trim().length() > 0) {
    QueryDefinition query=new QueryDefinition();
    query.setDataSetName(dataSetHandle.getQualifiedName());
    PropertyHandle handle=dataSetHandle.getPropertyHandle(DataSetHandle.PARAMETERS_PROP);
    if (handle != null) {
      Iterator paramIter=handle.iterator();
      while (paramIter.hasNext()) {
        DataSetParameterHandle paramDefn=(DataSetParameterHandle)paramIter.next();
        if (paramDefn.isInput()) {
          String defaultValue=null;
          if (paramDefn instanceof OdaDataSetParameterHandle && ((OdaDataSetParameterHandle)paramDefn).getParamName() != null)           defaultValue=ExpressionUtil.createJSParameterExpression(((OdaDataSetParameterHandle)paramDefn).getParamName());
 else           defaultValue=paramDefn.getDefaultValue();
          if (defaultValue != null) {
            InputParameterBinding binding=new InputParameterBinding(paramDefn.getName(),new ScriptExpression(defaultValue));
            query.addInputParamBinding(binding);
          }
        }
      }
    }
    IBaseExpression bindingExprGroup=new ScriptExpression(ExpressionUtility.getReplacedColRefExpr(expression));
    GroupDefinition groupDefn=new GroupDefinition(BINDING_GROUP_NAME);
    groupDefn.setKeyExpression(BINDING_GROUP_EXPRESSION);
    query.addBinding(new Binding(BINDING_ROW_NAME,bindingExprGroup));
    query.addGroup(groupDefn);
    query.setUsesDetails(false);
    IPreparedQuery preparedQuery=DataSetProvider.getCurrentInstance().prepareQuery(dataSetHandle,(IQueryDefinition)query,true,false);
    IQueryResults results=preparedQuery.execute(null);
    if (results != null) {
      IResultIterator iter=null;
      iter=results.getResultIterator();
      if (iter != null) {
        while (iter.next()) {
          Object candiateValue=iter.getValue(BINDING_ROW_NAME);
          if (candiateValue != null) {
            selectValueList.add(candiateValue);
          }
          iter.skipToEnd(1);
        }
      }
      results.close();
    }
  }
  return selectValueList;
}

Fixed version (ground truth):
/** 
 * @param selectValueExpression
 * @param dataSetHandle
 * @return
 * @throws BirtException
 */
public static List getSelectValueList(String expression,DataSetHandle dataSetHandle) throws BirtException {
  List selectValueList=new ArrayList();
  if (expression != null && expression.trim().length() > 0) {
    QueryDefinition query=new QueryDefinition();
    query.setDataSetName(dataSetHandle.getQualifiedName());
    PropertyHandle handle=dataSetHandle.getPropertyHandle(DataSetHandle.PARAMETERS_PROP);
    if (handle != null) {
      Iterator paramIter=handle.iterator();
      while (paramIter.hasNext()) {
        DataSetParameterHandle paramDefn=(DataSetParameterHandle)paramIter.next();
        if (paramDefn.isInput()) {
          String defaultValue=null;
          if (paramDefn instanceof OdaDataSetParameterHandle && ((OdaDataSetParameterHandle)paramDefn).getParamName() != null)           defaultValue=ExpressionUtil.createJSParameterExpression(((OdaDataSetParameterHandle)paramDefn).getParamName());
 else           defaultValue=paramDefn.getDefaultValue();
          if (defaultValue != null) {
            InputParameterBinding binding=new InputParameterBinding(paramDefn.getName(),new ScriptExpression(defaultValue));
            query.addInputParamBinding(binding);
          }
        }
      }
    }
    IBaseExpression bindingExprGroup=new ScriptExpression(ExpressionUtility.getReplacedColRefExpr(expression));
    GroupDefinition groupDefn=new GroupDefinition(BINDING_GROUP_NAME);
    groupDefn.setKeyExpression(BINDING_GROUP_EXPRESSION);
    query.addBinding(new Binding(BINDING_ROW_NAME,bindingExprGroup));
    query.addGroup(groupDefn);
    query.setUsesDetails(false);
    DataRequestSession session=DataRequestSession.newSession(new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION,dataSetHandle == null ? null : dataSetHandle.getModuleHandle()));
    if (dataSetHandle != null) {
      if (dataSetHandle.getDataSource() != null)       session.defineDataSource(session.getModelAdaptor().adaptDataSource(dataSetHandle.getDataSource()));
      session.defineDataSet(session.getModelAdaptor().adaptDataSet(dataSetHandle));
    }
    IPreparedQuery preparedQuery=session.prepare(query);
    IQueryResults results=preparedQuery.execute(null);
    if (results != null) {
      IResultIterator iter=null;
      iter=results.getResultIterator();
      if (iter != null) {
        while (iter.next()) {
          Object candiateValue=iter.getValue(BINDING_ROW_NAME);
          if (candiateValue != null) {
            selectValueList.add(candiateValue);
          }
          iter.skipToEnd(1);
        }
      }
      results.close();
    }
  }
  return selectValueList;
}