Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
NullPointerException in Table.findNumRowsToPaint(Table.java:3767)
Hi,
I'm getting the following stack trace:
SEVERE: Servlet.service() for servlet [com.arkivum.tapemanager.vaadin.MyVaadinUI$Servlet] in context with path [/tapemanager-ui##1.0.4] threw exception java.lang.RuntimeException: Push failed at com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:169) at com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:144) at com.vaadin.ui.UI.push(UI.java:1544) at com.vaadin.server.VaadinSession.unlock(VaadinSession.java:1026) at com.vaadin.server.VaadinService.requestEnd(VaadinService.java:1355) at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1422) at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:350) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:615) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:526) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:655) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at com.vaadin.ui.Table.findNumRowsToPaint(Table.java:3767) at com.vaadin.ui.Table.doPaintContent(Table.java:3275) at com.vaadin.ui.Table.paintContent(Table.java:3261) at com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65) at com.vaadin.server.communication.LegacyUidlWriter.write(LegacyUidlWriter.java:82) at com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:115) at com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:166) ... 32 more
It looks like the NPE is triggered here in Table.java:
private int findNumRowsToPaint(PaintTarget target, final Object cells)
throws PaintException {
int rows;
if (reqRowsToPaint >= 0) {
rows = reqRowsToPaint;
} else {
rows = cells[0].length;
if (alwaysRecalculateColumnWidths) {
// TODO experimental feature for now: tell the client to
// recalculate column widths.
// We'll only do this for paints that do not originate from
// table scroll/cache requests (i.e when reqRowsToPaint<0)
target.addAttribute("recalcWidths", true);
}
}
return rows;
}
Line 3767 equates to line 7 in the listing except.
From other parts of Table.java it looks like the class-scope variable 'cells' is not always null, hence the NPE.
Is there any way to avoid this issue?
I'm seeing the same problem with Vaadin 7.6.4, here are the top few lines of the stack trace:
Apr 20 14:42:23 app-prod tomcat: at java.lang.Thread.run(Thread.java:745)
Apr 20 14:42:23 app-prod tomcat: Caused by: java.lang.NullPointerException
Apr 20 14:42:23 app-prod tomcat: at com.vaadin.ui.Table.findNumRowsToPaint(Table.java:3809)
Apr 20 14:42:23 app-prod tomcat: at com.vaadin.ui.Table.doPaintContent(Table.java:3316)
Apr 20 14:42:23 app-prod tomcat: at com.vaadin.ui.Table.paintContent(Table.java:3302)
Apr 20 14:42:23 app-prod tomcat: at com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65)
Apr 20 14:42:23 app-prod tomcat: at com.vaadin.server.communication.LegacyUidlWriter.write(LegacyUidlWriter.java:82)
Apr 20 14:42:23 app-prod tomcat: at com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:145)
Apr 20 14:42:23 app-prod tomcat: at com.vaadin.server.communication.AtmospherePushConnection.push(AtmospherePushConnection.java:168)
Apr 20 14:42:23 app-prod tomcat: ... 29 more
Hi guys,
Please ensure you're synchronizing your sessions properly, preferably by using the UI.access() method to wrap any code that accesses a VaadinSession from outside normal request handling. Enable assertions using the -ea JVM command line parameter to help debug where the potential issue is.