[jbossseam-issues] [JBoss JIRA] Reopened: (JBSEAM-880) Make UISelectItems more permissive to null-values

Guy Veraghtert (JIRA) jira-events at lists.jboss.org
Mon Feb 19 07:47:37 EST 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-880?page=all ]

Guy Veraghtert reopened JBSEAM-880:
-----------------------------------

             
I can confirm that an IllegalArgumentException is thrown now.

However, I'm reopening this issue, because I don't agree with the choice of throwing an exception, unless this is clearly specified. A production system can "crash" because the flow followed made the value(binding)expression evaluate to null, this may have been overlooked while testing/implementing (question: how can a programmer know that he must check for null-values before returning the value?). This situation is not that severe and a quality component can deal with this easily by rendering, for example, an empty dropdown menu. This is much more informative to an end user than a standard error-page (maybe the user has a screen in which he can enter the data for the dropdown menu).

Moverover, complex components like h:dataTable deal with null-values, why shouldn't s:selectItems do that?

In my opinion, framework or component classes must prefer a defensive (total) approach and try to recover from (minor) exceptional cases OR/AND specify a clear contract ("analyze the source code" is unacceptable)

> Make UISelectItems more permissive to null-values
> -------------------------------------------------
>
>                 Key: JBSEAM-880
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-880
>             Project: JBoss Seam
>          Issue Type: Patch
>          Components: JSF
>    Affects Versions: 1.1.7.GA
>            Reporter: Guy Veraghtert
>         Assigned To: Peter Muir
>            Priority: Minor
>             Fix For: 1.1.7.GA
>
>         Attachments: patch-880.txt
>
>
> The method createSelectItems(Object value) in UISelectItems is not permissive to null-values; a framework class should not die on NPE.
> This can be fixed by assigning an empty list to value when value == null

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list