Problem with 'null' parameter values in plug-in configuration when handling errors
There seems to be an issue with how the plug-in configuration wizard is handling 'null' (eg. empty or not selected) parameter values. This was first seen when investigating #1584. The configuration error as such is catched and displayed for the user. But, the 'Source intensities' and 'Resulting intensities' are then marked (an 'x' in the list) as having values. Selecting one of the parameters one can see that the 'not specified' option is selected indicating that the 'x' is incorrect. Then, clicking 'Next' results in a different error:
The value '' isn't in the list of allowed values for parameter 'sourceTransform'
This indicates that the parameter has been given an empty string value instead of null.
At first, I would expect the same thing to happen if one tries to re-configure an already existing configuration, but due to a Hibernate "feature" the null value is not saved in the database. The reason that we see this behaviour after an error is that the null value is still present in the request object.
So, there seems to be two issues here:
- We should not try to save null values, since Hibernate will not save them anyway.
- We should not convert null values to
''when displaying the configuration form.