Program: 78071
Project: 78071
Buggy source:
private void refreshValues(){
  resultList.clear();
  if (columnChooser.isEnabled()) {
    DataSetItemModel selectedColumn=null;
    try {
      BaseQueryDefinition query=(BaseQueryDefinition)DataSetManager.getCurrentInstance().getPreparedQuery(getDataSetHandle()).getReportQueryDefn();
      String queryExpr=null;
      for (int i=0; i < columns.length; i++) {
        if (columns[i].getName().equals(columnChooser.getText())) {
          String colName=(columns[i]).getAlias();
          if (colName == null || colName.trim().length() == 0) {
            colName=(columns[i]).getName();
          }
          queryExpr=DEUtil.getResultSetColumnExpression(colName);
          selectedColumn=columns[i];
          break;
        }
      }
      if (queryExpr == null) {
        return;
      }
      ScriptExpression expression=new ScriptExpression(queryExpr);
      String columnBindingName="String_Node_Str";
      query.addResultSetExpression(columnBindingName,expression);
      IPreparedQuery preparedQuery=DataSetManager.getCurrentInstance().getEngine().prepare((IQueryDefinition)query);
      IQueryResults results=preparedQuery.execute(null);
      if (results != null) {
        IResultIterator iter=results.getResultIterator();
        if (iter != null) {
          DateFormatter formatter=new DateFormatter(DATE_TIME_PATTERN);
          while (iter.next()) {
            String result=null;
            if (selectedColumn.getDataType() == DataType.DATE_TYPE) {
              result=formatter.format(iter.getDate(columnBindingName));
            }
 else {
              result=iter.getString(columnBindingName);
            }
            if (!StringUtil.isBlank(result) && !resultList.contains(result)) {
              resultList.add(result);
            }
          }
        }
        results.close();
      }
    }
 catch (    Exception e) {
      ExceptionHandler.handle(e);
      valueList.removeAll();
      valueList.deselectAll();
      updateButtons();
    }
    filteValues();
  }
 else {
    valueList.removeAll();
    valueList.deselectAll();
    updateButtons();
  }
}

Fixed version (ground truth):
private void refreshValues(){
  resultList.clear();
  if (columnChooser.isEnabled()) {
    ResultSetColumnHandle selectedColumn=null;
    try {
      BaseQueryDefinition query=(BaseQueryDefinition)DataUtil.getPreparedQuery(engine,getDataSetHandle()).getReportQueryDefn();
      String queryExpr=null;
      for (Iterator iter=columnList.iterator(); iter.hasNext(); ) {
        ResultSetColumnHandle column=(ResultSetColumnHandle)iter.next();
        if (column.getColumnName().equals(columnChooser.getText())) {
          queryExpr=DEUtil.getResultSetColumnExpression(column.getColumnName());
          selectedColumn=column;
          break;
        }
      }
      if (queryExpr == null) {
        return;
      }
      ScriptExpression expression=new ScriptExpression(queryExpr);
      String columnBindingName="String_Node_Str";
      query.addResultSetExpression(columnBindingName,expression);
      IPreparedQuery preparedQuery=engine.prepare((IQueryDefinition)query);
      IQueryResults results=preparedQuery.execute(null);
      if (results != null) {
        IResultIterator iter=results.getResultIterator();
        if (iter != null) {
          DateFormatter formatter=new DateFormatter(DATE_TIME_PATTERN);
          while (iter.next()) {
            String result=null;
            if (DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME.equals(selectedColumn.getDataType())) {
              result=formatter.format(iter.getDate(columnBindingName));
            }
 else {
              result=iter.getString(columnBindingName);
            }
            if (!StringUtil.isBlank(result) && !resultList.contains(result)) {
              resultList.add(result);
            }
          }
        }
        results.close();
      }
    }
 catch (    Exception e) {
      ExceptionHandler.handle(e);
      valueList.removeAll();
      valueList.deselectAll();
      updateButtons();
    }
    filteValues();
  }
 else {
    valueList.removeAll();
    valueList.deselectAll();
    updateButtons();
  }
}