NPE from rendering button with missing resource URL
---------------------------------------------------
Key: MYFACES-2991
URL: https://issues.apache.org/jira/browse/MYFACES-2991
Project: MyFaces Core
Issue Type: Bug
Components: General
Affects Versions: 2.0.3-SNAPSHOT
Reporter: David Jencks
Attachments: MYFACES-2991.patch
I ran into this with the tck in geronimo. The test appears to be trying to
render a button that is just created and not part of a view to test the EL bits
of encodeBegin. There's no resource info associated with this button so the
resource URL is null, and trying to encode it throws an NPE. Some comments in
the code seem to indicate that something else should be happening. In any case
this can be fixed by testing for a null resourceURL and not trying to encode
null.
Code involved and comments that make be wonder what should be happening are in
HtmlOutcomeTargetButtonRendererBase line 115:
String href = facesContext.getExternalContext().encodeResourceURL(
HtmlRendererUtils.getOutcomeTargetLinkHref(facesContext,
(UIOutcomeTarget) uiComponent));
ServletExternalContextImpl line 325:
@Override
public String encodeResourceURL(final String url)
{
checkNull(url, "url");
checkHttpServletRequest();
return ((HttpServletResponse) _servletResponse).encodeURL(url);
}
HtmlRendererUtils line 1771:
public static String getOutcomeTargetLinkHref(
FacesContext facesContext, UIOutcomeTarget component) throws
IOException {
...
// when navigation case is null, force the "link" to be rendered as text
if (navigationCase == null) {
return null;
}
...
Result appears to be that when there is no navigation case the first method
will throw an NPE, although the comment in getOutcomeTargetLinkHref seems to
indicate something else should happen.
I haven't yet figured out how to add an appropriate renderer to the mock
renderkit to write a unit test showing the problem.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.