Program: 70760
Project: 70760
Buggy source:
protected void okPressed(){
  try {
    validateValue(defaultValue);
  }
 catch (  BirtException e1) {
    ExceptionHandler.handle(e1);
    return;
  }
  try {
    inputParameter.setName(nameEditor.getText());
    inputParameter.setPromptText(UIUtil.convertToModelString(promptTextEditor.getText(),true));
    inputParameter.setParamType(DesignChoiceConstants.SCALAR_PARAM_TYPE_SIMPLE);
    String newControlType=getSelectedControlType();
    if (PARAM_CONTROL_COMBO.equals(newControlType)) {
      newControlType=DesignChoiceConstants.PARAM_CONTROL_LIST_BOX;
      inputParameter.setMustMatch(false);
    }
 else     if (PARAM_CONTROL_LIST.equals(newControlType)) {
      newControlType=DesignChoiceConstants.PARAM_CONTROL_LIST_BOX;
      inputParameter.setMustMatch(true);
      if (allowMultiChoice.isVisible() && allowMultiChoice.getSelection()) {
        inputParameter.setParamType(DesignChoiceConstants.SCALAR_PARAM_TYPE_MULTI_VALUE);
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.MUCH_MATCH_PROP,null);
    }
    inputParameter.setControlType(newControlType);
    inputParameter.setDefaultValue(defaultValue);
    inputParameter.setDataType(DATA_TYPE_CHOICE_SET.findChoiceByDisplayName(dataTypeChooser.getText()).getName());
    PropertyHandle selectionChioceList=inputParameter.getPropertyHandle(ScalarParameterHandle.SELECTION_LIST_PROP);
    selectionChioceList.setValue(new ArrayList());
    if (isStatic()) {
      inputParameter.setValueType(DesignChoiceConstants.PARAM_VALUE_TYPE_STATIC);
      if (!DesignChoiceConstants.PARAM_CONTROL_TEXT_BOX.equals(newControlType) && !DesignChoiceConstants.PARAM_CONTROL_CHECK_BOX.equals(newControlType)) {
        for (Iterator iter=choiceList.iterator(); iter.hasNext(); ) {
          SelectionChoice choice=(SelectionChoice)iter.next();
          if (isValidValue(choice.getValue()) == null) {
            selectionChioceList.addItem(choice);
          }
        }
      }
      inputParameter.setDataSetName(null);
      inputParameter.setValueExpr(null);
      inputParameter.setLabelExpr(null);
    }
 else {
      inputParameter.setValueType(DesignChoiceConstants.PARAM_VALUE_TYPE_DYNAMIC);
      inputParameter.setDataSetName(dataSetChooser.getText());
      inputParameter.setValueExpr(getExpression(columnChooser.getText()));
      if (displayTextChooser.getText().equals(LABEL_NULL)) {
        inputParameter.setLabelExpr("String_Node_Str");
      }
 else {
        inputParameter.setLabelExpr(getExpression(displayTextChooser.getText()));
      }
      if (startPointTypeHelper != null) {
        if (startPointTypeHelper.getControl() != null && startPointTypeHelper.getControl().isVisible()) {
          startPointTypeHelper.update(false);
          inputParameter.setAutoSuggestThreshold((Integer)startPointTypeHelper.getProperty(STARTPOINT_VALUE));
        }
      }
    }
    inputParameter.setHelpText(UIUtil.convertToModelString(helpTextEditor.getText(),false));
    inputParameter.setCategory(formatCategroy);
    inputParameter.setPattern(formatPattern);
    if (isStatic() && (PARAM_CONTROL_COMBO.equals(getSelectedControlType()) || DesignChoiceConstants.PARAM_CONTROL_RADIO_BUTTON.equals(getSelectedControlType())) && !containValue(null,defaultValue,COLUMN_VALUE)) {
      defaultValue=null;
    }
    if (dirtyProperties.containsKey(CHECKBOX_HIDDEN)) {
      inputParameter.setHidden(getProperty(CHECKBOX_HIDDEN));
    }
    if (dirtyProperties.containsKey(CHECKBOX_ISREQUIRED)) {
      inputParameter.setIsRequired(getProperty(CHECKBOX_ISREQUIRED));
    }
    if (doNotEcho.isEnabled()) {
      if (dirtyProperties.containsKey(CHECKBOX_DO_NOT_ECHO)) {
        inputParameter.setConcealValue(getProperty(CHECKBOX_DO_NOT_ECHO));
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.CONCEAL_VALUE_PROP,null);
    }
    if (distinct.isEnabled()) {
      inputParameter.setDistinct(!distinct.getSelection());
    }
 else {
      inputParameter.setDistinct(true);
    }
    if (sorttingArea != null && !sorttingArea.isDisposed() && sorttingArea.isVisible()) {
      if (sortKeyChooser.getText().equals(NONE_DISPLAY_TEXT)) {
        inputParameter.setFixedOrder(true);
        inputParameter.setSortBy(null);
        inputParameter.setSortDirection(null);
        inputParameter.setSortByColumn(null);
      }
 else {
        if (isStatic()) {
          inputParameter.setFixedOrder(false);
          if (sortKeyChooser.getText().equals(CHOICE_DISPLAY_TEXT)) {
            inputParameter.setSortBy(DesignChoiceConstants.PARAM_SORT_VALUES_LABEL);
          }
 else           if (sortKeyChooser.getText().equals(CHOICE_VALUE_COLUMN)) {
            inputParameter.setSortBy(DesignChoiceConstants.PARAM_SORT_VALUES_VALUE);
          }
          inputParameter.setSortByColumn(null);
        }
 else         if (dynamicRadio.getSelection()) {
          inputParameter.setSortBy(null);
          inputParameter.setFixedOrder(false);
          inputParameter.setSortByColumn(getExpression(sortKeyChooser.getText()));
        }
        if (sortDirectionChooser.getText().equals(CHOICE_ASCENDING)) {
          inputParameter.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_ASC);
        }
 else         if (sortDirectionChooser.getText().equals(CHOICE_DESCENDING)) {
          inputParameter.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_DESC);
        }
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.FIXED_ORDER_PROP,null);
    }
    if (!isStatic() && !StringUtil.isBlank(listLimit.getText()) && !DesignChoiceConstants.PARAM_CONTROL_AUTO_SUGGEST.equals(getSelectedControlType())) {
      try {
        inputParameter.setListlimit(Integer.parseInt(listLimit.getText()));
      }
 catch (      NumberFormatException ex) {
        ExceptionHandler.openErrorMessageBox(ERROR_TITLE_INVALID_LIST_LIMIT,MessageFormat.format(ERROR_MSG_INVALID_LIST_LIMIT,new Object[]{Integer.toString(Integer.MAX_VALUE)}));
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.LIST_LIMIT_PROP,null);
    }
  }
 catch (  Exception e) {
    ExceptionHandler.handle(e);
    return;
  }
  setResult(inputParameter);
  super.okPressed();
}

Fixed version (ground truth):
protected void okPressed(){
  try {
    validateValue(defaultValue);
  }
 catch (  BirtException e1) {
    ExceptionHandler.handle(e1);
    return;
  }
  try {
    inputParameter.setName(nameEditor.getText());
    inputParameter.setPromptText(UIUtil.convertToModelString(promptTextEditor.getText(),true));
    inputParameter.setParamType(DesignChoiceConstants.SCALAR_PARAM_TYPE_SIMPLE);
    String newControlType=getSelectedControlType();
    if (PARAM_CONTROL_COMBO.equals(newControlType)) {
      newControlType=DesignChoiceConstants.PARAM_CONTROL_LIST_BOX;
      inputParameter.setMustMatch(false);
    }
 else     if (PARAM_CONTROL_LIST.equals(newControlType)) {
      newControlType=DesignChoiceConstants.PARAM_CONTROL_LIST_BOX;
      inputParameter.setMustMatch(true);
      if (allowMultiChoice.isVisible() && allowMultiChoice.getSelection()) {
        inputParameter.setParamType(DesignChoiceConstants.SCALAR_PARAM_TYPE_MULTI_VALUE);
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.MUCH_MATCH_PROP,null);
    }
    inputParameter.setControlType(newControlType);
    inputParameter.setDefaultValue(defaultValue);
    inputParameter.setDataType(DATA_TYPE_CHOICE_SET.findChoiceByDisplayName(dataTypeChooser.getText()).getName());
    PropertyHandle selectionChioceList=inputParameter.getPropertyHandle(ScalarParameterHandle.SELECTION_LIST_PROP);
    selectionChioceList.setValue(new ArrayList());
    if (isStatic()) {
      inputParameter.setValueType(DesignChoiceConstants.PARAM_VALUE_TYPE_STATIC);
      if (!DesignChoiceConstants.PARAM_CONTROL_TEXT_BOX.equals(newControlType) && !DesignChoiceConstants.PARAM_CONTROL_CHECK_BOX.equals(newControlType)) {
        for (Iterator iter=choiceList.iterator(); iter.hasNext(); ) {
          SelectionChoice choice=(SelectionChoice)iter.next();
          if (isValidValue(choice.getValue()) == null) {
            selectionChioceList.addItem(choice);
          }
        }
      }
      inputParameter.setDataSetName(null);
      inputParameter.setValueExpr(null);
      inputParameter.setLabelExpr(null);
    }
 else {
      inputParameter.setValueType(DesignChoiceConstants.PARAM_VALUE_TYPE_DYNAMIC);
      inputParameter.setDataSetName(dataSetChooser.getText());
      inputParameter.setValueExpr(getExpression(columnChooser.getText()));
      if (displayTextChooser.getText().equals(LABEL_NULL)) {
        inputParameter.setLabelExpr("String_Node_Str");
      }
 else {
        inputParameter.setLabelExpr(getExpression(displayTextChooser.getText()));
      }
      if (startPointTypeHelper != null) {
        if (startPointTypeHelper.getControl() != null && startPointTypeHelper.getControl().isVisible()) {
          startPointTypeHelper.update(false);
          inputParameter.setAutoSuggestThreshold((Integer)startPointTypeHelper.getProperty(STARTPOINT_VALUE));
        }
      }
    }
    inputParameter.setHelpText(UIUtil.convertToModelString(helpTextEditor.getText(),false));
    inputParameter.setCategory(formatCategroy);
    inputParameter.setPattern(formatPattern);
    if (isStatic() && (PARAM_CONTROL_COMBO.equals(getSelectedControlType()) || DesignChoiceConstants.PARAM_CONTROL_RADIO_BUTTON.equals(getSelectedControlType())) && !containValue(null,defaultValue,COLUMN_VALUE)) {
      defaultValue=null;
    }
    if (dirtyProperties.containsKey(CHECKBOX_HIDDEN)) {
      inputParameter.setHidden(getProperty(CHECKBOX_HIDDEN));
    }
    if (dirtyProperties.containsKey(CHECKBOX_ISREQUIRED)) {
      inputParameter.setIsRequired(getProperty(CHECKBOX_ISREQUIRED));
    }
    if (doNotEcho.isEnabled()) {
      if (dirtyProperties.containsKey(CHECKBOX_DO_NOT_ECHO)) {
        inputParameter.setConcealValue(getProperty(CHECKBOX_DO_NOT_ECHO));
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.CONCEAL_VALUE_PROP,null);
    }
    if (distinct.isEnabled()) {
      inputParameter.setDistinct(!distinct.getSelection());
    }
 else {
      inputParameter.setDistinct(true);
    }
    if (sorttingArea != null && !sorttingArea.isDisposed() && sorttingArea.isVisible()) {
      if (sortKeyChooser.getText().equals(NONE_DISPLAY_TEXT)) {
        inputParameter.setFixedOrder(true);
        inputParameter.setSortBy(null);
        inputParameter.setSortDirection(null);
        inputParameter.setSortByColumn(null);
      }
 else {
        if (isStatic()) {
          inputParameter.setFixedOrder(false);
          if (sortKeyChooser.getText().equals(CHOICE_DISPLAY_TEXT)) {
            inputParameter.setSortBy(DesignChoiceConstants.PARAM_SORT_VALUES_LABEL);
          }
 else           if (sortKeyChooser.getText().equals(CHOICE_VALUE_COLUMN)) {
            inputParameter.setSortBy(DesignChoiceConstants.PARAM_SORT_VALUES_VALUE);
          }
          inputParameter.setSortByColumn(null);
        }
 else         if (dynamicRadio.getSelection()) {
          inputParameter.setSortBy(null);
          inputParameter.setFixedOrder(false);
          inputParameter.setSortByColumn(getExpression(sortKeyChooser.getText()));
        }
        if (sortDirectionChooser.getText().equals(CHOICE_ASCENDING)) {
          inputParameter.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_ASC);
        }
 else         if (sortDirectionChooser.getText().equals(CHOICE_DESCENDING)) {
          inputParameter.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_DESC);
        }
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.FIXED_ORDER_PROP,null);
    }
    if (!isStatic() && !StringUtil.isBlank(listLimit.getText()) && !DesignChoiceConstants.PARAM_CONTROL_AUTO_SUGGEST.equals(getSelectedControlType())) {
      try {
        inputParameter.setListlimit(Integer.parseInt(listLimit.getText()));
      }
 catch (      NumberFormatException ex) {
        ExceptionHandler.openErrorMessageBox(ERROR_TITLE_INVALID_LIST_LIMIT,MessageFormat.format(ERROR_MSG_INVALID_LIST_LIMIT,new Object[]{Integer.toString(Integer.MAX_VALUE)}));
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.LIST_LIMIT_PROP,null);
    }
  }
 catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return;
  }
  setResult(inputParameter);
  super.okPressed();
}