Hi,

There is a inconsistency of how null is handled in ChoiceRenderer#getIdValue and AbstractSingleSelectChoice#getModelValue.

ChoiceRenderer renders either "" as id, or index under which the null value is in choices list.

AbstractSingleSelectChoice#getModelValue returns always -1 for null.

The outcome is that if RadioChoice has item with null value and the model object is also null, the item is not pre-selected.

(because getValue() is compared to getChoiceRenderer().getIdValue(choice, 0))

It is a bug, but I'm not sure what would be the best way to fix it.

Perhaps when AbstractSingleSelectChoice#isNullValid() is true the getModelValue should call choiceRenderer.getIdValue(object, index) even for null objects?

WDYT?

-Matej

Reply via email to