Program: 67542
Project: 67542
Buggy source:
private void createList(Composite container,final ListingParameter listParam){
  boolean isRequired=listParam.getHandle().isRequired();
  boolean isStringType=listParam.getHandle().getDataType().equals(DesignChoiceConstants.PARAM_TYPE_STRING);
  Object value=null;
  try {
    value=listParam.converToDataType(listParam.getDefaultValues() == null ? new Object[0] : listParam.getDefaultValues().toArray());
  }
 catch (  BirtException e) {
  }
  if (paramValues.containsKey(listParam.getHandle().getName())) {
    value=paramValues.get(listParam.getHandle().getName());
    if (value != null) {
      listParam.setSelectionValue(value);
    }
  }
  ListViewer listViewer=new ListViewer(container);
  GridData gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.heightHint=70;
  listViewer.getList().setLayoutData(gd);
  List list=new ArrayList();
  if (isStringType && !isRequired) {
    list.add(blankValueChoice);
  }
  list.addAll(listParam.getValueList());
  checkParam(listParam.getDefaultValue(),value,list);
  if (!isRequired) {
    list.add(InputParameterDialog.nullValueChoice);
  }
  for (Iterator iterator=list.iterator(); iterator.hasNext(); ) {
    IParameterSelectionChoice choice=(IParameterSelectionChoice)iterator.next();
    String label=(choice.getLabel() == null ? String.valueOf(choice.getValue()) : choice.getLabel());
    if (label != null) {
      listViewer.getList().add(label);
      listViewer.getList().setData(label,choice.getValue());
    }
  }
  if (value == null && !isRequired) {
    listViewer.getList().select(listViewer.getList().getItemCount() - 1);
  }
 else {
    List newValueList=new ArrayList();
    List oldvalueList=new ArrayList();
    if (value instanceof Object[]) {
      oldvalueList=Arrays.asList((Object[])value);
    }
 else {
      oldvalueList.add(value);
    }
    for (int i=0; i < listViewer.getList().getItemCount(); i++) {
      Object item=listViewer.getList().getData(listViewer.getList().getItem(i));
      if (oldvalueList.indexOf(item) >= 0) {
        listViewer.getList().select(i);
        newValueList.add(listViewer.getList().getData(listViewer.getList().getItem(i)));
      }
    }
    paramValues.put(listParam.getHandle().getName(),newValueList.toArray(new Object[newValueList.size()]));
  }
  if (listParam.getParentGroup() instanceof CascadingParameterGroup) {
    CascadingParameterGroup group=(CascadingParameterGroup)listParam.getParentGroup();
    if (group.getPreParameter(listParam) != null) {
      postParamLists.put(group.getPreParameter(listParam),listViewer.getList());
    }
  }
  listViewer.getList().addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent e){
      org.eclipse.swt.widgets.List list=(org.eclipse.swt.widgets.List)e.getSource();
      String[] strs=list.getSelection();
      if (strs != null && strs.length > 0) {
        List array=new ArrayList();
        for (int i=0; i < strs.length; i++) {
          Object obj=list.getData(strs[i]);
          array.add(obj);
        }
        Object[] objs=new Object[array.size()];
        array.toArray(objs);
        paramValues.put(listParam.getHandle().getName(),objs);
      }
 else {
        paramValues.remove(listParam.getHandle().getName());
      }
      if (listParam.getParentGroup() instanceof CascadingParameterGroup) {
        CascadingParameterGroup group=(CascadingParameterGroup)listParam.getParentGroup();
        if (group.getPostParameter(listParam) != null) {
          cascadingParamValueChanged(group,listParam);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
private void createList(Composite container,final ListingParameter listParam){
  boolean isRequired=listParam.getHandle().isRequired();
  boolean isStringType=listParam.getHandle().getDataType().equals(DesignChoiceConstants.PARAM_TYPE_STRING);
  Object value=null;
  try {
    value=listParam.converToDataType(listParam.getDefaultValues() == null ? new Object[0] : listParam.getDefaultValues().toArray());
  }
 catch (  BirtException e) {
  }
  if (paramValues.containsKey(listParam.getHandle().getName())) {
    value=paramValues.get(listParam.getHandle().getName());
    if (value != null) {
      listParam.setSelectionValue(value);
    }
  }
  ListViewer listViewer=new ListViewer(container);
  GridData gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.heightHint=70;
  listViewer.getList().setLayoutData(gd);
  List list=new ArrayList();
  if (isStringType && !isRequired) {
    list.add(blankValueChoice);
  }
  list.addAll(listParam.getValueList());
  try {
    checkParam(listParam.converToDataType(listParam.getDefaultValue()),list);
  }
 catch (  BirtException e1) {
  }
  if (!isRequired) {
    list.add(InputParameterDialog.nullValueChoice);
  }
  for (Iterator iterator=list.iterator(); iterator.hasNext(); ) {
    IParameterSelectionChoice choice=(IParameterSelectionChoice)iterator.next();
    String label=(choice.getLabel() == null ? String.valueOf(choice.getValue()) : choice.getLabel());
    if (label != null) {
      listViewer.getList().add(label);
      listViewer.getList().setData(label,choice.getValue());
    }
  }
  if (value == null && !isRequired) {
    listViewer.getList().select(listViewer.getList().getItemCount() - 1);
  }
 else {
    List newValueList=new ArrayList();
    List oldvalueList=new ArrayList();
    if (value instanceof Object[]) {
      oldvalueList=Arrays.asList((Object[])value);
    }
 else {
      oldvalueList.add(value);
    }
    for (int i=0; i < listViewer.getList().getItemCount(); i++) {
      Object item=listViewer.getList().getData(listViewer.getList().getItem(i));
      if (oldvalueList.indexOf(item) >= 0) {
        listViewer.getList().select(i);
        newValueList.add(listViewer.getList().getData(listViewer.getList().getItem(i)));
      }
    }
    paramValues.put(listParam.getHandle().getName(),newValueList.toArray(new Object[newValueList.size()]));
  }
  if (listParam.getParentGroup() instanceof CascadingParameterGroup) {
    CascadingParameterGroup group=(CascadingParameterGroup)listParam.getParentGroup();
    if (group.getPreParameter(listParam) != null) {
      postParamLists.put(group.getPreParameter(listParam),listViewer.getList());
    }
  }
  listViewer.getList().addSelectionListener(new SelectionListener(){
    public void widgetDefaultSelected(    SelectionEvent e){
    }
    public void widgetSelected(    SelectionEvent e){
      org.eclipse.swt.widgets.List list=(org.eclipse.swt.widgets.List)e.getSource();
      String[] strs=list.getSelection();
      if (strs != null && strs.length > 0) {
        List array=new ArrayList();
        for (int i=0; i < strs.length; i++) {
          Object obj=list.getData(strs[i]);
          array.add(obj);
        }
        Object[] objs=new Object[array.size()];
        array.toArray(objs);
        paramValues.put(listParam.getHandle().getName(),objs);
      }
 else {
        paramValues.remove(listParam.getHandle().getName());
      }
      if (listParam.getParentGroup() instanceof CascadingParameterGroup) {
        CascadingParameterGroup group=(CascadingParameterGroup)listParam.getParentGroup();
        if (group.getPostParameter(listParam) != null) {
          cascadingParamValueChanged(group,listParam);
        }
      }
    }
  }
);
}