Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4421

NullPointerException in TagAttributeImpl

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.2.13
    • 2.2.15
    • General
    • None
    • Environment ist not of interest for this issue

    Description

      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.

      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) 

      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.

      <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>

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            uulohr1 Ulrich Lohrmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: