[ 
http://www.stripesframework.org/jira/browse/STS-713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Frederic Daoud closed STS-713.
------------------------------

    Resolution: Not a Bug

After some investigation it turns out that a formatter returning null causes 
problems in other places as well.

The reason is that Stripes expects a formatter to return a non-null value. This 
is (somewhat) stated in the Javadoc for Formatter: "If the value cannot be 
formatted because it is an inappropriate type, or because faulty pattern 
information was supplied, should fail loudly by throwing a RuntimeException or 
subclass thereof." I've added a further note stating that the method should 
never return null.

I think this is a valid requirement: asking a formatter to format a value to a 
String value, should not return null.


> InputTagSupport.isItemSelected() throws NPE if a Formatter returns null
> -----------------------------------------------------------------------
>
>                 Key: STS-713
>                 URL: http://www.stripesframework.org/jira/browse/STS-713
>             Project: Stripes
>          Issue Type: Bug
>          Components: Tag Library
>    Affects Versions: Release 1.5.1
>            Reporter: Niels Godfredsen
>            Assignee: Frederic Daoud
>            Priority: Minor
>
> I encountered the follow exception when using a <stripes:option /> tag in a 
> JSP:
> java.lang.NullPointerException
>                       
> net.sourceforge.stripes.tag.InputTagSupport.isItemSelected(InputTagSupport.java:218)
>                       
> net.sourceforge.stripes.tag.InputSelectTag.isOptionSelected(InputSelectTag.java:107)
>                       
> net.sourceforge.stripes.tag.InputOptionTag.doEndInputTag(InputOptionTag.java:125)
>                       
> net.sourceforge.stripes.tag.InputTagSupport.doEndTag(InputTagSupport.java:442)
> After some investigation it appeared that the NPE was triggered by the custom 
> formatter for an object returning null (in this case because the object's id 
> field was empty).  Updating the formatter to return empty string instead of 
> null avoided the NPE, but it would be preferable for the tag to handle this 
> case gracefully.

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

        

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to