IDEMPIERE-5811 - Fix NPE on event for BroadcastMessages / fix kill session feature (#1956)
This commit is contained in:
parent
9af815acf6
commit
1eef599bb2
|
@ -972,49 +972,44 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
BroadCastMsg msg = (BroadCastMsg) event.getData();
|
||||
MBroadcastMessage mbMessage = MBroadcastMessage.get(Env.getCtx(), msg.getIntData());
|
||||
|
||||
if (mbMessage == null)
|
||||
return;
|
||||
|
||||
MBroadcastMessage mbMessage = null;
|
||||
switch (msg.getEventId()) {
|
||||
case BroadCastUtil.EVENT_TEST_BROADCAST_MESSAGE:
|
||||
String currSession = Integer
|
||||
.toString(Env.getContextAsInt(Env.getCtx(),
|
||||
"AD_Session_ID"));
|
||||
mbMessage = MBroadcastMessage.get(Env.getCtx(), msg.getIntData());
|
||||
if (mbMessage == null)
|
||||
return;
|
||||
String currSession = Integer.toString(Env.getContextAsInt(Env.getCtx(), "AD_Session_ID"));
|
||||
if (currSession.equals(msg.getTarget())) {
|
||||
BroadcastMessageWindow testMessageWindow = new BroadcastMessageWindow(
|
||||
pnlHead);
|
||||
testMessageWindow.appendMessage(mbMessage, true);
|
||||
testMessageWindow = null;
|
||||
|
||||
}
|
||||
break;
|
||||
case BroadCastUtil.EVENT_BROADCAST_MESSAGE:
|
||||
mbMessage = MBroadcastMessage.get(Env.getCtx(), msg.getIntData());
|
||||
if (mbMessage == null)
|
||||
return;
|
||||
if (mbMessage.isValidUserforMessage()) {
|
||||
|
||||
BroadcastMessageWindow messageWindow = new BroadcastMessageWindow(
|
||||
pnlHead);
|
||||
messageWindow.appendMessage(mbMessage, false);
|
||||
}
|
||||
break;
|
||||
case BroadCastUtil.EVENT_SESSION_TIMEOUT:
|
||||
|
||||
currSession = Integer.toString(Env.getContextAsInt(
|
||||
Env.getCtx(), "AD_Session_ID"));
|
||||
if (currSession.equalsIgnoreCase(msg.getTarget())) {
|
||||
new TimeoutPanel(pnlHead, msg.getIntData());
|
||||
}
|
||||
|
||||
break;
|
||||
case BroadCastUtil.EVENT_SESSION_ONNODE_TIMEOUT:
|
||||
|
||||
currSession = WebUtil.getServerName();
|
||||
|
||||
if (currSession.equalsIgnoreCase(msg.getTarget())) {
|
||||
new TimeoutPanel(pnlHead, msg.getIntData());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue