Opened 12 years ago

Closed 12 years ago

#119 closed defect (fixed)

ConstrainedStringParameterEditor should handle case when the value of the param is null

Reported by: Kevin Milner Owned by: Peter Powers
Priority: major Milestone: OpenSHA 1.1
Component: commons Version:
Keywords: Cc:

Description

ConstrainedStringParameterEditor? can currently accept a parameter with a null value. This can lead to strange results, because it will show the first String in the list, leading the user to think that the parameter is not actually null. It will only be set if the user actually changes the parameter via the editor.

I see 3 options:

  • throw an exception if the parameter is null when the ConstrainedStringParameterEditor? is created
  • set the parameter as default if possible, and if not set it to the first option
  • add a special case for actually setting it to null (like "(null)" in the options list) when null is allowed by the parameter. this is more intensive, but would allow us to set constrained string parameters to null via a GUI.

Comments?

Change History (2)

comment:1 Changed 12 years ago by Ned Field

Do we have any cases where a null value could actually be used? If so you option 3 seems like a must. Otherwise I'd go with option 1. Option 2 sounds dangerous.

comment:2 Changed 12 years ago by Kevin Milner

Resolution: fixed
Status: newclosed

I couldn't find any cases where null is allowed, so for now I'm going with option 1 (throw exception if null is allowed). If this turns out to be a problem or if we need this functionality in the future, then I agree to go with option 3 (make it possible to set it to null from the editor).

Fixed in [7381].

Note: See TracTickets for help on using tickets.