1 Reply Latest reply on Aug 17, 2008 10:12 PM by Tim Evers

    Rich:DataTable and EL expressions causing Null Pointer Excep

    Tim Evers Master

      Using the following code:

      <rich:dataTable id="olTable" var="item"
       value="#{OperationalLedgerViewDataBean.opLedgerDisplayList}"
       columnClasses="centerCols">
       <f:facet name="header">
       <rich:columnGroup columnClasses="centerCols">
       <rich:column />
       <rich:column>
       <h:commandLink id="effectiveSort" value="EFFECTIVE" action="#{OperationalLedgerActionBean.doEffectiveSort()}" immediate="true" />
       </rich:column>
       <rich:column>
       <h:commandLink id="postingSort" value="POSTING" action="#{OperationalLedgerActionBean.doPostingSort()}" immediate="true" />
       </rich:column>
       <rich:column styleClass="nowrapCol">ADJ TYPE</rich:column>
       ...
       <rich:column>REMISSION BALANCE</rich:column>
       </rich:columnGroup>
       </f:facet>
       <rich:columnGroup>
       <rich:column>
       <gekko:commandIcon
       icon="DELETE"
       action="#{OperationalLedgerViewDataBean.doDeleteEntry(item)}"
       rendered="#{OperationalLedgerViewDataBean.canDeleteEntry(item)}"
       id="delete_icon" />
       <gekko:selectBooleanCheckbox
       id="selectOpLedger"
       value="#{item.selected}"
       rendered="#{OperationalLedgerViewDataBean.canReverseEntry(item)}" />
       </rich:column>
       <rich:column>#{item.opLedger.effective}</rich:column>
       <rich:column styleClass="nowrapCol">#{item.opLedger.posting}</rich:column>
       <rich:column styleClass="nowrapCol">#{OperationalLedgerViewDataBean.getAdjustmentTypeDesc(item.opLedger.adjType)}</rich:column>
       ...
       <rich:column></rich:column>
       </rich:columnGroup>
      </rich:dataTable>
      


      The problem is that sometimes the el expression in the redered attirbutes are called with null params. (See data part of column 1 in the xhtml above) Why is the component executing the EL expressions but not passing a param. This bug seems to happen twice on each page render. I'm not sure if this is like a header/footer issue or what.
      My list contains no null entries but I still get a null param being passed to my function.

      Can anyone explain what is going on?

      Thanks

        • 1. Re: Rich:DataTable and EL expressions causing Null Pointer E
          Tim Evers Master

          This is an example of the stack traces I get: (Note, these are not from the above xhtml page. I'm trying to create a simple page that reproduces the error and this is the result)
          The code calling the el expression is this:

          <rich:column>
           <h:commandLink id="selectTitleRefLink"
           action="#{TenureSearchController.viewTenure(tenure)}"
           rendered="#{TenureSearchController.rendered(tenure)}"
           value="#{tenure.titleRef}" />
          </rich:column>
          


          And the stack traces are:

          java.lang.NullPointerException
           at gekko.web.module.tenure.search.TenureSearchController.rendered(TenureSearchController.java:186)
           at sun.reflect.GeneratedMethodAccessor651.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
           at gekko.web.services.GekkoExceptionInterceptor.aroundInvoke(GekkoExceptionInterceptor.java:22)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at gekko.web.services.GekkoSpringInjector.aroundInvoke(GekkoSpringInjector.java:42)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
           at gekko.web.module.tenure.search.TenureSearchController_$$_javassist_10.rendered(TenureSearchController_$$_javassist_10.java)
           at sun.reflect.GeneratedMethodAccessor650.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)
           at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
           at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
           at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
           at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:370)
           at org.richfaces.component.DataScrollerViewPhaseListener.updateScrollers(DataScrollerViewPhaseListener.java:51)
           at org.richfaces.component.DataScrollerViewPhaseListener.updateScrollers(DataScrollerViewPhaseListener.java:59)
           at org.richfaces.component.DataScrollerViewPhaseListener.updateScrollers(DataScrollerViewPhaseListener.java:59)
           at org.richfaces.component.DataScrollerViewPhaseListener.updateScrollers(DataScrollerViewPhaseListener.java:59)
           at org.richfaces.component.DataScrollerViewPhaseListener.updateScrollers(DataScrollerViewPhaseListener.java:59)
           at org.richfaces.component.DataScrollerViewPhaseListener.updateScrollers(DataScrollerViewPhaseListener.java:59)
           at org.richfaces.component.DataScrollerViewPhaseListener.updateScrollers(DataScrollerViewPhaseListener.java:59)
           at org.richfaces.component.DataScrollerViewPhaseListener.beforePhase(DataScrollerViewPhaseListener.java:68)
           at javax.faces.component.UIViewRoot.notifyPhaseListeners(UIViewRoot.java:605)
           at javax.faces.component.UIViewRoot.encodeBegin(UIViewRoot.java:537)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
           at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
           at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
           at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189)
           at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:302)
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:302)
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           at java.lang.Thread.run(Thread.java:619)
          




          And another like this:
          java.lang.NullPointerException
           at gekko.web.module.tenure.search.TenureSearchController.rendered(TenureSearchController.java:186)
           at sun.reflect.GeneratedMethodAccessor651.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
           at gekko.web.services.GekkoExceptionInterceptor.aroundInvoke(GekkoExceptionInterceptor.java:22)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at gekko.web.services.GekkoSpringInjector.aroundInvoke(GekkoSpringInjector.java:42)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
           at gekko.web.module.tenure.search.TenureSearchController_$$_javassist_10.rendered(TenureSearchController_$$_javassist_10.java)
           at sun.reflect.GeneratedMethodAccessor650.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)
           at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
           at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
           at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
           at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:370)
           at sun.reflect.GeneratedMethodAccessor512.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at com.sun.facelets.util.DevTools.writeAttributes(DevTools.java:240)
           at com.sun.facelets.util.DevTools.writeStart(DevTools.java:284)
           at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:189)
           at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:207)
           at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:207)
           at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:207)
           at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:207)
           at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:207)
           at com.sun.facelets.util.DevTools.writeComponent(DevTools.java:207)
           at com.sun.facelets.util.DevTools.debugHtml(DevTools.java:133)
           at com.sun.facelets.tag.ui.UIDebug.writeDebugOutput(UIDebug.java:92)
           at com.sun.facelets.tag.ui.UIDebug.encodeBegin(UIDebug.java:81)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
           at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
           at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
           at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:189)
           at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
           at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:302)
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:302)
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
           at java.lang.Thread.run(Thread.java:619)
          


          Now, to be honest this does not really stop my app from working because this excaption gets hidden by jsf. But, relying on this is in my opinion a mistake for the richfaces component to do.