3 Replies Latest reply on Feb 10, 2009 5:18 AM by ilya_shaikovsky

    rich:datatable: Error filtering columns when table contains

    apf

      I'm trying to filter a datatable based on a value in the backing data object. When the page is first displayed, the table is empty. When the user selects an item on the page the table is filled. I've tried using both filterExpression and filterMethod. In both cases I get the following exception when the page is displayed:

      java.lang.NullPointerException: Argument Error: Parameter key is null

      My current filter expression looks like this:

      <rich:column
      filterExpression="#{orderBean.itemsDataModel.rowCount > 0 and
      orderBean.itemsDataModel.rowData.isParentSelected}"

      I thought checking for row count might help but I'm still getting the same error.

      The complete stack trace follows.

      java.lang.NullPointerException: Argument Error: Parameter key is null
      at com.sun.faces.util.Util.notNull(Util.java:241)
      at com.sun.faces.context.RequestMap.get(ExternalContextImpl.java:1079)
      at org.richfaces.model.impl.expressive.ObjectWrapperFactory.wrapList(ObjectWrapperFactory.java:173)
      at org.richfaces.model.ModifiableModel.filter(ModifiableModel.java:216)
      at org.richfaces.model.ModifiableModel.modify(ModifiableModel.java:205)
      at org.richfaces.component.UIDataTable.createDataModel(UIDataTable.java:133)
      at org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621)
      at org.ajax4jsf.component.UIDataAdaptor.setRowKey(UIDataAdaptor.java:339)
      at org.richfaces.renderkit.AbstractTableRenderer.encodeTableStructure(AbstractTableRenderer.java:121)
      at org.richfaces.renderkit.html.DataTableRenderer.doEncodeBegin(DataTableRenderer.java:206)
      at org.richfaces.renderkit.html.DataTableRenderer.doEncodeBegin(DataTableRenderer.java:194)
      at org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:101)
      at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
      at javax.faces.component.UIData.encodeBegin(UIData.java:962)
      at org.ajax4jsf.component.UIDataAdaptor.encodeBegin(UIDataAdaptor.java:1220)
      at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:232)
      at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:106)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:234)
      at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:106)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
      at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
      at org.springframework.faces.webflow.JsfView.render(JsfView.java:92)
      at org.springframework.webflow.engine.ViewState.render(ViewState.java:240)
      at org.springframework.webflow.engine.ViewState.resume(ViewState.java:199)
      at org.springframework.webflow.engine.Flow.resume(Flow.java:535)
      at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:261)
      at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:153)
      at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:173)
      at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(FlowController.java:172)
      at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
      at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
      at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
      at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
      at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
      at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
      at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
      at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
      at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
      at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
      at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:271)
      at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
      at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
      at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
      at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
      at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
      at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
      at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
      at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
      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:286)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:595)

        • 1. Re: rich:datatable: Error filtering columns when table conta
          apf

          I'm still getting this error even when the table has data. In debugging the code, I looked at the ModifiableModel.filter method. The global variable var is null, which causes the NullPointerException in ObjectWrapperFactory.wrapList on this line:

          varValue = getRequestMap().get(var);

          I thought var was null when the table was empty, since it's pointing to the current row. But even when there is data, var is still null.

          By the way, I'm using richfaces-ui-3.2.2.GA.

          Any ideas why var is null?

          I've looked at the reference guide and the live sample many times, just to see if I'm missing something, but I can't see what. The only difference I see in my code is that I don't have a field for the user to enter the filter value. I'm setting the filter value in the code behind.

          • 2. Re: rich:datatable: Error filtering columns when table conta
            apf

            The problem was I didn't define the "var" attribute in the datatable. Once I did that the filter worked, but then I encountered the problem described by other users that getRowData does not work correctly on a filtered list. So I'm just going to emulate the behavior myself.

            • 3. Re: rich:datatable: Error filtering columns when table conta
              ilya_shaikovsky

              b.t.w.
              https://jira.jboss.org/jira/browse/RF-3012
              should be fixed in 3.2.2. update the issue please if something still not works for you.