When primefaces h:head renderer is used with inner f:facet (first\middle\last) like follows:
Application crashes with NPE during some AJAX requests on ComponentTagHandlerDelegate:337
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.
Refresh facetName when parent is changed, see diff:
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.