[
https://issues.apache.org/jira/browse/MYFACES-3931?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Leonardo Uribe resolved MYFACES-3931.
-------------------------------------
Resolution: Fixed
Fix Version/s: 2.2.6
2.1.17
2.0.23
Assignee: Leonardo Uribe
I was able to reproduce the issue without primefaces, just setting "target"
property to h:outputScript. In that part getFacetName(...) does not work the
way you suppose, because the algorithm is used in other way, so I wrote a
solution that checks the component location and calculate properly the
facetName (if any). In this case there is no facetName, because an special
container component is used, that's why call getFacetName(...) works, it return
null.
> RelocatableResourceHandler tag + inner f:facet = NullPointerException
> ---------------------------------------------------------------------
>
> Key: MYFACES-3931
> URL: https://issues.apache.org/jira/browse/MYFACES-3931
> Project: MyFaces Core
> Issue Type: Bug
> Components: General
> Affects Versions: 2.1.12, 2.2.5
> Environment: Primefaces compatibility issue (discovered with
> primfaces component, but reproducible on standalone myfaces app)
> Reporter: Anton Zukovskij
> Assignee: Leonardo Uribe
> Fix For: 2.0.23, 2.1.17, 2.2.6
>
>
> When primefaces h:head renderer is used with inner f:facet
> (first\middle\last) like follows:
> {code}
> <h:head id="head">
> <f:facet name="first">
> <h:outputScript name="jquery.js"/>
> </f:facet>
> </h:head>
> {code}
> Application crashes with NPE during some AJAX requests on
> ComponentTagHandlerDelegate:337
> {code}
> ComponentSupport.removeFacet(ctx, parent, c, facetName);
> {code}
> *This is caused by:*
> # ComponentTagHandlerDelegate:190 - Resolves facet name from non-relocated
> parent __HtmlHead (id="head")_
> # ComponentTagHandlerDelegate:327 - Changes parent to re-located element
> _UIPanel(id="j_idhead__f_first")_, resolved with HtmlOutputScriptHandler
> # ComponentTagHandlerDelegate:337 - Uses re-located parent with non-relocated
> parents facet name, facet isn't found, NPE is thrown.
> *Solution:*
> Refresh facetName when parent is changed, see diff:
> {code}
> ---
> a/myfaces-2.1.12/myfaces-impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
> Wed Oct 08 15:18:20 2014 +0300
> +++
> b/myfaces-2.1.12/myfaces-impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
> Wed Oct 08 15:18:33 2014 +0300
> @@ -325,6 +325,7 @@
> {
> // Replace parent with the relocated parent.
> parent = c.getParent();
> + facetName = this.getFacetName(ctx, parent); //
> refresh facet name according to new parent
> }
> }
> if (facetName == null)
> {code}
> *Note:* Exception handling for such cases can be improved, as application
> crashes during render phase no response is rendered and MyFaces
> ExceptionHandler is unable to add exception into AJAX response - this way no
> exception is logged or returned, empty screen is rendered without any errors.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)