Grid does not update correctly

Hello,

I am using Vaadin 7.5.6 and jdk1.8.0_25.

I have a Grid component and I am getting the following exception at sporadic times (not always). It looks an awful lot like issue #15454 which was supposedly already resolved.

Does anyone have any idea why?

Oct 07, 2015 2:09:47 PM com.vaadin.server.DefaultErrorHandler doDefault
SEVERE:
java.lang.IndexOutOfBoundsException: Index: 4, Size: 4
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at com.vaadin.data.util.AbstractInMemoryContainer.getIdByIndex(AbstractInMemoryContainer.java:333)
at com.vaadin.data.RpcDataProviderExtension$ActiveRowHandler.addValueChangeListeners(RpcDataProviderExtension.java:357)
at com.vaadin.data.RpcDataProviderExtension$ActiveRowHandler.setActiveRows(RpcDataProviderExtension.java:347)
at com.vaadin.data.RpcDataProviderExtension.pushRowData(RpcDataProviderExtension.java:955)
at com.vaadin.data.RpcDataProviderExtension.access$1100(RpcDataProviderExtension.java:80)
at com.vaadin.data.RpcDataProviderExtension$2.requestRows(RpcDataProviderExtension.java:853)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158)
at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:118)
at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:313)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:202)
at com.vaadin.server.communication.PushHandler$2.run(PushHandler.java:153)
at com.vaadin.server.communication.PushHandler.callWithUi(PushHandler.java:232)
at com.vaadin.server.communication.PushHandler.onMessage(PushHandler.java:492)
at com.vaadin.server.communication.PushAtmosphereHandler.onMessage(PushAtmosphereHandler.java:88)
at com.vaadin.server.communication.PushAtmosphereHandler.onRequest(PushAtmosphereHandler.java:78)
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:199)
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:107)
at org.atmosphere.container.Jetty9AsyncSupportWithWebSocket.service(Jetty9AsyncSupportWithWebSocket.java:180)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2075)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:571)
at org.atmosphere.websocket.DefaultWebSocketProcessor$3.run(DefaultWebSocketProcessor.java:333)
at org.atmosphere.util.VoidExecutorService.execute(VoidExecutorService.java:101)
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(DefaultWebSocketProcessor.java:328)
at org.atmosphere.websocket.DefaultWebSocketProcessor.invokeWebSocketProtocol(DefaultWebSocketProcessor.java:425)
at org.atmosphere.container.Jetty9WebSocketHandler.onWebSocketText(Jetty9WebSocketHandler.java:92)
at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onTextMessage(JettyListenerEventDriver.java:128)
at org.eclipse.jetty.websocket.common.message.SimpleTextMessage.messageComplete(SimpleTextMessage.java:69)
at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.appendMessage(AbstractEventDriver.java:64)
at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onTextFrame(JettyListenerEventDriver.java:122)
at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.incomingFrame(AbstractEventDriver.java:160)
at org.eclipse.jetty.websocket.common.WebSocketSession.incomingFrame(WebSocketSession.java:309)
at org.eclipse.jetty.websocket.common.extensions.ExtensionStack.incomingFrame(ExtensionStack.java:214)
at org.eclipse.jetty.websocket.common.Parser.notifyFrame(Parser.java:220)
at org.eclipse.jetty.websocket.common.Parser.parse(Parser.java:258)
at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.readParse(AbstractWebSocketConnection.java:628)
at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:476)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)

Many thanks,
-George Soler

Our Grid must show the updates to the bound data once per second. Calling msgContainer.removeAllItems() every second and then adding items to it, for some reason appears to cause a problem inside the Grid.
This solution may not be the best one, but we were able to eliminate the runtime exception by creating a msgContainer msgContainer = IndexedContainer();
msgGrid.setContainerDataSource(msgContainer);
Then when
Item item = this.msgContainer.addItem(msg);
check that item != null

Still, we should not be getting the Vaadin exception…