[
http://issues.apache.org/jira/browse/MYFACES-599?page=comments#action_12330243
]
Adam Winer commented on MYFACES-599:
------------------------------------
The correct behavior (which the spec should state, but doesn't) is to render
nothing, but also not log a warning.
Without this, you get zillions of lines of code like:
if (someAttr != null)
writer.writeAttribute("someAttr", someAttr, "someAttr");
... which is a pain, so it's easier to just centralize that code in the
ResponseWriter and make Renderers simpler to write.
> Potential NullPointerException from HtmlResponseWriterImpl.writeAttribute()
> ---------------------------------------------------------------------------
>
> Key: MYFACES-599
> URL: http://issues.apache.org/jira/browse/MYFACES-599
> Project: MyFaces
> Type: Bug
> Versions: 1.1.0
> Environment: Any
> Reporter: Kris Nuttycombe
>
> org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl.writeAttribute() can
> throw a NullPointerException if the value passed for the attribute value is
> null because of a call to value.toString(). I'm not sure what the correct
> failure-tolerant behavior would be - the method throws NullPointerException
> explicitly with a detail message if the name is null, but the value being
> null is a common enough occurrance that the method should either:
> * Render an empty string as the value of the attribute
> * Return without rendering the attribute at all and log a warning
> I will provide a patch to supply whatever functionality is deemed
> appropriate, if desired.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira