Tapestry
  1. Tapestry
  2. TAPESTRY-2668

Setting volatile to true on Grid component in form results in NullPointerException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.0.15
    • Component/s: Core Components
    • Labels:
      None

      Description

      The fix for TAPESTRY-2636 results in a NullPointerException when my form is posted. If I revert back to the previous version of Grid.java (http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java?view=markup&pathrev=690060) everything works fine again.

      Stacktrace:

      [13 Sep 2008 13:44:44 btpool0-1] ERROR Processing of request failed with uncaught exception: Failure reading parameter 'source' of component user/Signing:signingcertificate.certificategrid.grid.columns.loop: org.apache.tapestry5.ioc.internal.util.TapestryException (org.apache.tapestry5.services.TapestryModule.RequestExceptionHandler)
      org.apache.tapestry5.runtime.ComponentEventException: Failure reading parameter 'source' of component user/Signing:signingcertificate.certificategrid.grid.columns.loop: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:mitm/mimesecure/web/components/SigningCertificate.tml, line 8, column 37]
      at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1066)
      at org.apache.tapestry5.internal.services.ComponentEventRequestHandlerImpl.handle(ComponentEventRequestHandlerImpl.java:67)
      at org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:42)
      at $ComponentEventRequestHandler_11c5be511a6.handle($ComponentEventRequestHandler_11c5be511a6.java)
      at org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
      at $ComponentEventRequestHandler_11c5be511a6.handle($ComponentEventRequestHandler_11c5be511a6.java)
      at org.apache.tapestry5.services.TapestryModule$42.handle(TapestryModule.java:2055)
      at $ComponentEventRequestHandler_11c5be511a6.handle($ComponentEventRequestHandler_11c5be511a6.java)
      at mitm.mimesecure.web.services.security.HMACFilterImpl.handle(HMACFilterImpl.java:225)
      at $HMACFilter_11c5be50e7c.handle($HMACFilter_11c5be50e7c.java)
      at $ComponentEventRequestHandler_11c5be511a6.handle($ComponentEventRequestHandler_11c5be511a6.java)
      at mitm.mimesecure.web.services.security.CSRFFilterImpl.handle(CSRFFilterImpl.java:113)
      at $CSRFFilter_11c5be50e28.handle($CSRFFilter_11c5be50e28.java)
      at $ComponentEventRequestHandler_11c5be511a6.handle($ComponentEventRequestHandler_11c5be511a6.java)
      at $ComponentEventRequestHandler_11c5be50e48.handle($ComponentEventRequestHandler_11c5be50e48.java)
      at org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:131)
      at $Dispatcher_11c5be50e49.dispatch($Dispatcher_11c5be50e49.java)
      at $Dispatcher_11c5be50e3c.dispatch($Dispatcher_11c5be50e3c.java)
      at org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:1025)
      at org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
      at $RequestHandler_11c5be50e3d.service($RequestHandler_11c5be50e3d.java)
      at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
      at $RequestHandler_11c5be50e3d.service($RequestHandler_11c5be50e3d.java)
      at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:624)
      at $RequestHandler_11c5be50e3d.service($RequestHandler_11c5be50e3d.java)
      at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:614)
      at $RequestHandler_11c5be50e3d.service($RequestHandler_11c5be50e3d.java)
      at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:85)
      at $RequestHandler_11c5be50e3d.service($RequestHandler_11c5be50e3d.java)
      at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
      at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:1)
      at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
      at org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
      at $RequestHandler_11c5be50e3d.service($RequestHandler_11c5be50e3d.java)
      at $RequestHandler_11c5be50e34.service($RequestHandler_11c5be50e34.java)
      at org.apache.tapestry5.services.TapestryModule$16.service(TapestryModule.java:1005)
      at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
      at $HttpServletRequestFilter_11c5be50e33.service($HttpServletRequestFilter_11c5be50e33.java)
      at $HttpServletRequestHandler_11c5be50e35.service($HttpServletRequestHandler_11c5be50e35.java)
      at $HttpServletRequestHandler_11c5be50e32.service($HttpServletRequestHandler_11c5be50e32.java)
      at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:177)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
      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.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
      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.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.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:116)
      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:183)
      at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
      at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
      at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
      at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      at org.mortbay.jetty.Server.handle(Server.java:324)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
      at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
      Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading parameter 'source' of component user/Signing:signingcertificate.certificategrid.grid.columns.loop: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:org/apache/tapestry5/corelib/components/GridColumns.tml, line 4, column 27]
      at org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:458)
      at org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:348)
      at org.apache.tapestry5.corelib.components.Form$onAction$invocation_11c5be52e1c.invokeAdvisedMethod(Form$onAction$invocation_11c5be52e1c.java)
      at org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
      at org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
      at org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
      at org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
      at org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
      at org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
      at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:889)
      at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1049)
      ... 84 more
      Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Failure reading parameter 'source' of component user/Signing:signingcertificate.certificategrid.grid.columns.loop: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:org/apache/tapestry5/corelib/components/GridColumns.tml, line 4, column 27]
      at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.readParameter(InternalComponentResourcesImpl.java:283)
      at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.readParameter(InternalComponentResourcesImpl.java:308)
      at org.apache.tapestry5.corelib.components.Loop._$read_parameter_source(Loop.java)
      at org.apache.tapestry5.corelib.components.Loop.setupForVolatile(Loop.java:303)
      at org.apache.tapestry5.corelib.components.Loop.access$1(Loop.java:300)
      at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:68)
      at org.apache.tapestry5.corelib.components.Loop$2.execute(Loop.java:1)
      at org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:445)
      ... 94 more
      Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException [at classpath:org/apache/tapestry5/corelib/components/GridColumns.tml, line 4, column 27]
      at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:57)
      at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.readParameter(InternalComponentResourcesImpl.java:277)
      ... 101 more
      Caused by: java.lang.NullPointerException
      at org.apache.tapestry5.corelib.components.GridColumns.getColumnNames(GridColumns.java:226)
      at $PropertyConduit_11c5be5105c.get($PropertyConduit_11c5be5105c.java)
      at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:53)
      ... 102 more

        Issue Links

          Activity

          Hide
          Martijn Brinkers added a comment -

          Somehow the new version (5.0.15) of Grid#getDataModel returns null after a post whereas the previous version returned the BeanModel instance.

          Could this be caused by the fact that model has a parameter Annotation whereas dataModel does not a parameter annotation:

          @Parameter
          private BeanModel model;

          private BeanModel dataModel;

          The old version only had the model and not dataModel. If model is null but is bound the value for model is retrieved using a getter. This does not happen with dataModel because it is not bound and is therefore null?

          Show
          Martijn Brinkers added a comment - Somehow the new version (5.0.15) of Grid#getDataModel returns null after a post whereas the previous version returned the BeanModel instance. Could this be caused by the fact that model has a parameter Annotation whereas dataModel does not a parameter annotation: @Parameter private BeanModel model; private BeanModel dataModel; The old version only had the model and not dataModel. If model is null but is bound the value for model is retrieved using a getter. This does not happen with dataModel because it is not bound and is therefore null?
          Hide
          Martijn Brinkers added a comment -

          I use grids extensively in my application. The only difference between the grid that fails and the other grids is that the failing component extends another component containing the grid.

          Pseudo code:

          class ComponentA {
          @Parameter(required = true)
          private CertificateGridDataSource source;

          public CertificateGridDataSource getSource()

          { return source; }

          }

          class ComponentB extends ComponentA{
          }

          Only ComponentB has a .tml file (ComponentA does not)

          The source parameter is set in the page that uses ComponentB.

          I 'need' to extend ComponentA because I also create ComponentC which is slightly different from ComponentB. I tried moving getSource to ComponentB but that didn't solve it (same NPE).

          Show
          Martijn Brinkers added a comment - I use grids extensively in my application. The only difference between the grid that fails and the other grids is that the failing component extends another component containing the grid. Pseudo code: class ComponentA { @Parameter(required = true) private CertificateGridDataSource source; public CertificateGridDataSource getSource() { return source; } } class ComponentB extends ComponentA{ } Only ComponentB has a .tml file (ComponentA does not) The source parameter is set in the page that uses ComponentB. I 'need' to extend ComponentA because I also create ComponentC which is slightly different from ComponentB. I tried moving getSource to ComponentB but that didn't solve it (same NPE).
          Hide
          Howard M. Lewis Ship added a comment -

          I'm not seeing anything in particular that would cause the problem.

          When processing a form submission, method setupDataSource() will be invoked early; it reads the model parameter and sets the dataModel field, which is then returned from getDataModel().

          The only place I can see anything relevant is that if the number of rows in the data set is zero, dataModel may not be assigned (will be null).

          I can't see how you can get your behavior.

          Wait ... another issue would be if you are using volatile. Are you?

          Show
          Howard M. Lewis Ship added a comment - I'm not seeing anything in particular that would cause the problem. When processing a form submission, method setupDataSource() will be invoked early; it reads the model parameter and sets the dataModel field, which is then returned from getDataModel(). The only place I can see anything relevant is that if the number of rows in the data set is zero, dataModel may not be assigned (will be null). I can't see how you can get your behavior. Wait ... another issue would be if you are using volatile. Are you?
          Hide
          Martijn Brinkers added a comment -

          No I do nothing special not volatile only extend the base component.

          Somehow after submit dataModel is null. I think with the previous version model was not null because it was bound whereas dataModel is not (because it does not have the @Parameter annotation)

          Show
          Martijn Brinkers added a comment - No I do nothing special not volatile only extend the base component. Somehow after submit dataModel is null. I think with the previous version model was not null because it was bound whereas dataModel is not (because it does not have the @Parameter annotation)
          Hide
          Martijn Brinkers added a comment - - edited

          Oh yes you are right! I set volatile=true. Setting volatile to false does not result in the NPE

          Show
          Martijn Brinkers added a comment - - edited Oh yes you are right! I set volatile=true. Setting volatile to false does not result in the NPE

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Martijn Brinkers
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development