Question

After reading this article Vaadin "A connector with id xy is already registered", I've try to implement the solution suggested by Jose Luis...

But I get this traces :

java.lang.NullPointerException
    at com.vaadin.server.AbstractClientConnector.markAsDirty(AbstractClientConnector.java:138)
    at com.vaadin.ui.AbstractComponent.setWidth(AbstractComponent.java:844)
    at com.vaadin.ui.AbstractSingleComponentContainer.setWidth(AbstractSingleComponentContainer.java:210)
    at com.vaadin.ui.AbstractComponent.setSizeFull(AbstractComponent.java:817)
    at com.vaadin.ui.UI.<init>(UI.java:253)
    at com.vaadin.ui.UI.<init>(UI.java:238)
    at my.package.ui.MyUI.<init>(MyUI.java:72)

where line 72 corresponding to :

public class MyUI extends UI

Could someone can help to understand why these traces ?
I could provide more code if necessary.

Information :

public class MyUI extends UI {

    private final MyConnectorTracker tracker = new MyConnectorTracker(
  this);


    @Override
    public ConnectorTracker getConnectorTracker() {
      return this.tracker;
    }
}
Was it helpful?

Solution

public class MyUI extends UI {

  private MyConnectorTracker tracker;

  @Override
  public ConnectorTracker getConnectorTracker() {
    if (this.tracker == null) {
      this.tracker = new MyConnectorTracker(this);
    }
    return this.tracker;
  }
}

This resolve the NullPointerException. It is too early to set tracker on the first call of UI.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top