Just a wild guess without seeing your template: your method is called with a null value. Assigning null to a primitive variable results in a nullpointer. Try *Long* sysRowId instead and you probably won’t get that exception. The root cause might be that the context of your event link does not contain the value that it should. Check the network inspector in your browser to see what’s sent to the server.
Christian > Am 22.03.2017 um 15:41 schrieb Davide Vecchi <d...@amc.dk>: > > Hi everybody, > > I'm using Tapestry 5.3.8 . I am at a complete loss trying to figure out why I > always get a NullPointerException when I click on a grid row of a certain > page. > > I'm describing the situation here and if anyone has *any* thought, feeling, > suggestion, observation, things to check or anything else about one or more > parts of this issue, I would really appreciate to hear about it, because I > know it's impossible to think of a solution for this kind of problem, and > anything that *potentially* could allow me to get a tiny bit closer to the > solution or narrow down the possible cause or discard possibilities is very > welcome. I'm at the stage where I'm progressively removing stuff from that > page until the crash disappears so I will know that was the "cause"... > > The weird thing is that in the Java side I have a handler for the > t:rowevent="selectReceipt" event, and if such method is coded without any > argument, like > > public void onSelectReceipt () // This works normally. > { > System.out.println("onSelectReceipt () executed"); > } > > , then when I click on a grid row this null pointer doesn't occur and the > method is entered, but if I add an argument to it which is the row index > (like all the other grids of this webapp have), then the null pointer on > click does occur and the method is not entered: > > public void onSelectReceipt (long sysRowId) // This causes the NPE. > { > System.out.println("onSelectReceipt (" + sysRowId + ") > executed"); > } > > To make this even more interesting... if both the above mentioned handlers > are there, the null pointer occurs. Then I just remove the 1-argument handler > and the null pointer doesn't occur. So, the mere presence of the non-working, > 1-argument handler causes the null pointer, even if the working, no-arguments > handler is there as well. > > We use a customized grid, but the grid in the problematic page is being used > in the same way as the grids in all the other pages, which all have the > 1-argument handler and don't have this problem. > > If the cause was that (for some reason unknown to me) the 1-argument handler > was not recognized as the handler of the t:rowevent="selectReceipt" event, I > would expect that the exception would be a TapestryException "... you must > provide a matching event handler method ...", as it always happens when I > forget to write the event handler. Instead I get this null pointer. And if in > this page itself I omit the 1-argument event handler too, then I do get that > TapestryException as expected; but when I put it back I get the null pointer, > and the method is not even entered. > > This is the full stacktrace of the NullPointerException, from the exception > page. The first line is the one that puzzles me the most, because > Receipts.java is actually the problematic page, but it does not have the > dispatchComponentEvent method, plus that line doesn't show the number of the > line of source code or "Unknown Source", while all the others do. > > en.abc.link.tapestry.pages.function.magazines.receipts.Receipts.dispatchComponentEvent(Receipts.java) > org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:932) > org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1117) > org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3100(ComponentPageElementImpl.java:61) > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1062) > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1060) > org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74) > org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87) > org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124) > org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:146) > org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1058) > org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler.handle(AjaxComponentEventRequestHandler.java:110) > org.apache.tapestry5.internal.services.ajax.AjaxFormUpdateFilter.handle(AjaxFormUpdateFilter.java:56) > $ComponentEventRequestHandler_18b9bf935047d.handle(Unknown Source) > $ComponentEventRequestHandler_18b9bf935028e.handle(Unknown Source) > org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42) > $ComponentEventRequestHandler_18b9bf9350290.handle(Unknown Source) > org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75) > $ComponentEventRequestHandler_18b9bf9350290.handle(Unknown Source) > org.apache.tapestry5.services.TapestryModule$41.handle(TapestryModule.java:2475) > $ComponentEventRequestHandler_18b9bf9350290.handle(Unknown Source) > $ComponentEventRequestHandler_18b9bf9350123.handle(Unknown Source) > org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43) > en.abc.zcore.tapestry.services.XKernelThreadFilter.handleComponentEvent(XKernelThreadFilter.java:27) > $ComponentRequestFilter_18b9bf9350121.handleComponentEvent(Unknown Source) > $ComponentRequestHandler_18b9bf9350125.handleComponentEvent(Unknown Source) > en.abc.zcore.tapestry.services.MDCFilter.handleComponentEvent(MDCFilter.java:33) > $ComponentRequestFilter_18b9bf9350120.handleComponentEvent(Unknown Source) > $ComponentRequestHandler_18b9bf9350125.handleComponentEvent(Unknown Source) > en.abc.zcore.tapestry.services.filters.ABCDatabaseSessionFilter.handleComponentEvent(ABCDatabaseSessionFilter.java:104) > $ComponentRequestFilter_18b9bf935011f.handleComponentEvent(Unknown Source) > $ComponentRequestHandler_18b9bf9350125.handleComponentEvent(Unknown Source) > org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39) > $ComponentRequestHandler_18b9bf9350125.handleComponentEvent(Unknown Source) > org.tynamo.security.SecurityComponentRequestFilter.handleComponentEvent(SecurityComponentRequestFilter.java:41) > $ComponentRequestFilter_18b9bf9350122.handleComponentEvent(Unknown Source) > $ComponentRequestHandler_18b9bf9350125.handleComponentEvent(Unknown Source) > $ComponentRequestHandler_18b9bf93500e0.handleComponentEvent(Unknown Source) > org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46) > $Dispatcher_18b9bf93500e4.dispatch(Unknown Source) > $Dispatcher_18b9bf93500dc.dispatch(Unknown Source) > org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302) > en.abc.link.tapestry.services.DoerModule$2.service(DoerModule.java:955) > $RequestFilter_18b9bf93500db.service(Unknown Source) > $RequestHandler_18b9bf93500dd.service(Unknown Source) > org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26) > $RequestHandler_18b9bf93500dd.service(Unknown Source) > org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902) > $RequestHandler_18b9bf93500dd.service(Unknown Source) > org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892) > $RequestHandler_18b9bf93500dd.service(Unknown Source) > org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90) > $RequestHandler_18b9bf93500dd.service(Unknown Source) > org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105) > org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:96) > org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85) > org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119) > $RequestHandler_18b9bf93500dd.service(Unknown Source) > $RequestHandler_18b9bf93500b6.service(Unknown Source) > org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253) > org.tynamo.security.services.impl.SecurityConfiguration$1.call(SecurityConfiguration.java:59) > org.tynamo.security.services.impl.SecurityConfiguration$1.call(SecurityConfiguration.java:54) > org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) > org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) > org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) > org.tynamo.security.services.impl.SecurityConfiguration.service(SecurityConfiguration.java:54) > $HttpServletRequestFilter_18b9bf93500b5.service(Unknown Source) > $HttpServletRequestHandler_18b9bf93500b8.service(Unknown Source) > org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:44) > $HttpServletRequestHandler_18b9bf93500b8.service(Unknown Source) > org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53) > $HttpServletRequestHandler_18b9bf93500b8.service(Unknown Source) > org.got5.tapestry5.jquery.services.AjaxUploadServletRequestFilter.service(AjaxUploadServletRequestFilter.java:27) > $HttpServletRequestHandler_18b9bf93500b8.service(Unknown Source) > org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62) > $HttpServletRequestFilter_18b9bf93500b2.service(Unknown Source) > $HttpServletRequestHandler_18b9bf93500b8.service(Unknown Source) > org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852) > $HttpServletRequestHandler_18b9bf93500b8.service(Unknown Source) > $HttpServletRequestHandler_18b9bf935009e.service(Unknown Source) > org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171) > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751) > org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) > org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) > org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) > org.eclipse.jetty.server.Server.handle(Server.java:534) > org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) > org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) > org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) > org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) > org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) > org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) > org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) > org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) > org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) > java.lang.Thread.run(Thread.java:745) > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org