Program: 76869
Project: 76869
Buggy source:
protected void okPressed(){
  try {
    inputParameter.setName(nameEditor.getText());
    inputParameter.setPromptText(UIUtil.convertToModelString(promptTextEditor.getText(),true));
    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);
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.MUCH_MATCH_PROP,null);
    }
    inputParameter.setControlType(newControlType);
    if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(getSelectedDataType())) {
      defaultValue=DEUtil.convertToXMLString(DataTypeUtil.toDate(defaultValue,ULocale.US));
    }
    inputParameter.setDefaultValue(defaultValue);
    inputParameter.setDataType(DATA_TYPE_CHOICE_SET.findChoiceByDisplayName(dataTypeChooser.getText()).getName());
    PropertyHandle selectionChioceList=inputParameter.getPropertyHandle(ScalarParameterHandle.SELECTION_LIST_PROP);
    selectionChioceList.setValue(null);
    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()));
      inputParameter.setLabelExpr(getExpression(displayTextChooser.getText()));
    }
    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_ALLOW_NULL)) {
      inputParameter.setAllowNull(getProperty(CHECKBOX_ALLOW_NULL));
    }
    if (allowBlank.isEnabled()) {
      if (dirtyProperties.containsKey(CHECKBOX_ALLOW_BLANK)) {
        inputParameter.setAllowBlank(getProperty(CHECKBOX_ALLOW_BLANK));
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.ALLOW_BLANK_PROP,null);
    }
    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 (needSort.isEnabled()) {
      if (dirtyProperties.containsKey(CHECKBOX_SORT)) {
        inputParameter.setFixedOrder(!getProperty(CHECKBOX_SORT));
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.FIXED_ORDER_PROP,null);
    }
    if (!isStatic() && !StringUtil.isBlank(listLimit.getText())) {
      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 {
    inputParameter.setName(nameEditor.getText());
    inputParameter.setPromptText(UIUtil.convertToModelString(promptTextEditor.getText(),true));
    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);
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.MUCH_MATCH_PROP,null);
    }
    inputParameter.setControlType(newControlType);
    if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(getSelectedDataType())) {
      defaultValue=DEUtil.convertToXMLString(DataTypeUtil.toDate(defaultValue,ULocale.US));
    }
    inputParameter.setDefaultValue(defaultValue);
    inputParameter.setDataType(DATA_TYPE_CHOICE_SET.findChoiceByDisplayName(dataTypeChooser.getText()).getName());
    PropertyHandle selectionChioceList=inputParameter.getPropertyHandle(ScalarParameterHandle.SELECTION_LIST_PROP);
    selectionChioceList.setValue(null);
    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("String_Node_Str")) {
        inputParameter.setLabelExpr("String_Node_Str");
      }
 else {
        inputParameter.setLabelExpr(getExpression(displayTextChooser.getText()));
      }
    }
    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_ALLOW_NULL)) {
      inputParameter.setAllowNull(getProperty(CHECKBOX_ALLOW_NULL));
    }
    if (allowBlank.isEnabled()) {
      if (dirtyProperties.containsKey(CHECKBOX_ALLOW_BLANK)) {
        inputParameter.setAllowBlank(getProperty(CHECKBOX_ALLOW_BLANK));
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.ALLOW_BLANK_PROP,null);
    }
    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 (needSort.isEnabled()) {
      if (dirtyProperties.containsKey(CHECKBOX_SORT)) {
        inputParameter.setFixedOrder(!getProperty(CHECKBOX_SORT));
      }
    }
 else {
      inputParameter.setProperty(ScalarParameterHandle.FIXED_ORDER_PROP,null);
    }
    if (!isStatic() && !StringUtil.isBlank(listLimit.getText())) {
      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();
}