vaadin / multiplatform-runtime

4 stars 1 forks source link

UI.getCurrent().getSession() returns null while constructing / post constructing #5

Open gilberto-torrezan opened 6 years ago

gilberto-torrezan commented 6 years ago

@stefanuebe commented on Thu Aug 30 2018

The method com.vaadin.ui.UI.getCurrent() returns a valid UI instance, but calling getSession() on that UI instance returns null, while initiating the class.

VaadinSession.getCurrent() returns the valid session.


@Legioth commented on Thu Aug 30 2018

We might have to document this as a known limitation. The problem here is that the legacy UI instance won't be attached and inited until during the next round trip. If we manually attach it earlier, I suspect there will be problems when the regular code path tries to attach it again.

TatuLund commented 5 years ago

I just found out that this issue can cause NPE when calling "Page.getCurrent().getLocation()", since getLocation(..) is calling uI.getSession().getConfiguration().