IDEMPIERE-3538 NPE happen if show dialog at time not yet complete login

This commit is contained in:
Heng Sin Low 2017-11-11 21:49:02 +08:00
parent 2fdd02f65a
commit 87db420650
3 changed files with 12 additions and 2 deletions

View File

@ -459,6 +459,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
} }
if (getDesktop() != null && getDesktop().getSession() != null) { if (getDesktop() != null && getDesktop().getSession() != null) {
getDesktop().getSession().setAttribute(CLIENT_INFO, clientInfo); getDesktop().getSession().setAttribute(CLIENT_INFO, clientInfo);
} else if (Executions.getCurrent() != null){
Executions.getCurrent().getSession().setAttribute(CLIENT_INFO, clientInfo);
} }
Env.setContext(Env.getCtx(), "#clientInfo_desktopWidth", clientInfo.desktopWidth); Env.setContext(Env.getCtx(), "#clientInfo_desktopWidth", clientInfo.desktopWidth);
@ -541,6 +543,11 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
Executions.sendRedirect("index.zul"); Executions.sendRedirect("index.zul");
} }
@Override
public ClientInfo getClientInfo() {
return clientInfo;
}
/** /**
* @return string for setupload * @return string for setupload
*/ */

View File

@ -103,7 +103,7 @@ public class ClientInfo implements Serializable {
* @return the current clientinfo instance * @return the current clientinfo instance
*/ */
public static ClientInfo get() { public static ClientInfo get() {
return SessionManager.getAppDesktop().getClientInfo(); return SessionManager.getSessionApplication().getClientInfo();
} }
/** /**

View File

@ -67,5 +67,8 @@ public interface IWebClient {
* @return keylistener * @return keylistener
*/ */
public abstract Keylistener getKeylistener(); public abstract Keylistener getKeylistener();
default ClientInfo getClientInfo() {
return getAppDeskop().getClientInfo();
}
} }