NPE in ConnectorTracker (Beta 2)

Hei!

Due to recent change made to ConnectorTracker - making diffState map transient - a restored VaadinSession in Beta 2 produces a NullPointerException when using GAEVaadinServlet. See ticket
http://dev.vaadin.com/ticket/9717
. Either the proposed improvement should be implemented or the map has to be created on-the-fly … or something else that avoids:



java.lang.NullPointerException
at com.vaadin.ui.ConnectorTracker.getDiffState(ConnectorTracker.java:413)
at com.vaadin.server.AbstractCommunicationManager.encodeState(AbstractCommunicationManager.java:1260)
at com.vaadin.server.AbstractClientConnector.encodeState(AbstractClientConnector.java:165)
at com.vaadin.server.AbstractCommunicationManager.writeUidlResponse(AbstractCommunicationManager.java:890)
at com.vaadin.server.AbstractCommunicationManager.paintAfterVariableChanges(AbstractCommunicationManager.java:770)
at com.vaadin.server.AbstractCommunicationManager.handleUidlRequest(AbstractCommunicationManager.java:610)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:293)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:211)
at com.vaadin.server.GAEVaadinServlet.service(GAEVaadinServlet.java:246)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Cheers,
Christian

As a quick solution, I added a getter, that creates the map on-the-fly and replaced all usages of the private field:

[font=Courier New]
[size=1]
private transient Map<ClientConnector, Object> diffStatesLazy;

private Map<ClientConnector, Object> getDiffStates() {
  if (diffStatesLazy == null) {
    diffStatesLazy = new HashMap<ClientConnector, Object>();
  }
  return diffStatesLazy;
}

[/font]
[/size]

Shall I file a patch?

Cheers,
Christian


Changeset 41f2e9e7 in vaadin
looks good. (=

Thanks,
Christia