You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Volodymyr Siedlecki (Jira)" <de...@myfaces.apache.org> on 2022/06/09 15:12:00 UTC

[jira] [Commented] (MYFACES-4421) NullPointerException in TagAttributeImpl

    [ https://issues.apache.org/jira/browse/MYFACES-4421?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17552264#comment-17552264 ] 

Volodymyr Siedlecki commented on MYFACES-4421:
----------------------------------------------

I see MYFACES-4285 applied to 2.2. I will mark this as closed.

> NullPointerException in TagAttributeImpl
> ----------------------------------------
>
>                 Key: MYFACES-4421
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4421
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.2.13
>         Environment: Environment ist not of interest for this issue
>            Reporter: Ulrich Lohrmann
>            Priority: Major
>             Fix For: 2.2.15
>
>
> Beginning with MyFaces version 2.2.13 I get a NullPointerException in the TagAttributeImpl class upon rendering a JSF page. This error did not occur before 2.2.13.
> {code:java}
> java.lang.NullPointerException
>     org.apache.myfaces.view.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:569)
>     org.apache.myfaces.view.facelets.tag.jsf.ComponentRule$ValueExpressionMetadata.applyMetadata(ComponentRule.java:73)
>     org.apache.myfaces.view.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:45)
>     javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:63)
>     javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:90)
>     org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:291)
>     javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:50)
>     org.apache.myfaces.view.facelets.tag.jsf.core.FacetHandler.apply(FacetHandler.java:75)
>     org.apache.myfaces.view.facelets.tag.composite.CompositeComponentResourceTagHandler.applyNextHandlerIfNotApplied(CompositeComponentResourceTagHandler.java:299)
>     org.apache.myfaces.view.facelets.tag.composite.CompositeComponentResourceTagHandler.applyNextHandler(CompositeComponentResourceTagHandler.java:235)
>     org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:374)
>     javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:50)
>     javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
>     javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:55)
>     org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:374)
>     javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:50)
>     javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
>     org.apache.myfaces.view.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:66)
>     javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
>     javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:46)
>     org.apache.myfaces.view.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:48)
>     org.apache.myfaces.view.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:189)
>     org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.buildView(FaceletViewDeclarationLanguage.java:477)
>     org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:83)
>     org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:267)
>     javax.faces.webapp.FacesServlet.service(FacesServlet.java:200)
>     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) {code}
> I have created a show case on Github: [https://github.com/UlrichLohrmann/MyFacesError.git] that can be used to reproduce the error.
> I have a composite component ConfirmDialog.xhtml that hides details of a Primefaces dialog. In addition that composite component defines two facets "buttonOne" and "buttonTwo".
> I now use this composite component in the JSF page index.html.
> Here I provide content for the two facets.
> {code:java}
> <m:ConfirmDialog id="confirmDialog_Empfangsberechtigter_Loeschen" widgetVar="confirmDialog_Empfangsberechtigter_Loeschen_widget">
>   <f:facet name="buttonOne">
>     <p:commandButton value="Yes" oncomplete="PF('#{cc.attrs.widgetVar}').hide();" /> 
>   </f:facet>
>   .
>   <f:facet name="buttonTwo">
>     <p:commandButton value="No"
>       styleClass="ui-button-ghost"
>       onclick="PF('#{cc.attrs.widgetVar}').hide();" ajax="true" />
>   </f:facet>{code}
> As I don't want to use the widget var of the composite component in the f:facet, I use "#\{cc.attrs.widgetVar}" in the facet to address the name of the widget var INSIDE the composite component.
> That works with MyFaces 2.2.12 but not more with 2.2.13 and higher.
> If I replace the "cc.attrs.widgetVar" with the name of the widgetVar (confirmDialog_Empfangsberechtigter_Loeschen_widget) everything works fine.
> So it looks to me that Myfaces 2.2.12 and earlier evaluates the "cc.attrs.widgetVar" expression AFTER the facet was rendered in the composite component (so from the inside view of the composite component) whereas from 2.2.13 on it seems that the expression is renderes BEFORE the facet is rendered inside the composite component.
> The sample from github can be executed in a tomcat and the error occurs when accessing index.xhtml



--
This message was sent by Atlassian Jira
(v8.20.7#820007)