IDEMPIERE-5811 - Fix NPE on event for BroadcastMessages / fix kill session feature (#1956)

This commit is contained in:
Carlos Ruiz 2023-07-28 23:37:05 +02:00 committed by GitHub
parent 9af815acf6
commit 1eef599bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 14 deletions

View File

@ -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;
}
}