From d79886d4c9f68d3542967c346e0bc2bf82907924 Mon Sep 17 00:00:00 2001 From: Marc Froehlich Date: Tue, 21 Nov 2023 20:24:58 +0100 Subject: [PATCH 1/2] removed own callsign of userlist, which made neccessarry some changes for processing rxed commandlines of the server --- .../controller/MessageBusManagementThread.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/kst4contest/controller/MessageBusManagementThread.java b/src/main/java/kst4contest/controller/MessageBusManagementThread.java index 4b3ef43..4b57b01 100644 --- a/src/main/java/kst4contest/controller/MessageBusManagementThread.java +++ b/src/main/java/kst4contest/controller/MessageBusManagementThread.java @@ -822,9 +822,13 @@ public class MessageBusManagementThread extends Thread { int index = checkListForChatMemberIndexByCallSign(this.client.getLst_chatMemberList(), stateChangeMember); - this.client.getLst_chatMemberList().get(index).setName(stateChangeMember.getName()); - this.client.getLst_chatMemberList().get(index).setQra(stateChangeMember.getQra()); - this.client.getLst_chatMemberList().get(index).setState(stateChangeMember.getState()); + //-1 could be the case if mycall is processed + if (index != -1) { + this.client.getLst_chatMemberList().get(index).setName(stateChangeMember.getName()); + this.client.getLst_chatMemberList().get(index).setQra(stateChangeMember.getQra()); + this.client.getLst_chatMemberList().get(index).setState(stateChangeMember.getState()); + } + // this.client.getChatMemberTable().get(stateChangeMember.getCallSign()) // .setName(stateChangeMember.getName()); From d57880d94595f2da91c42fd345c1099292d5df9c Mon Sep 17 00:00:00 2001 From: Marc Froehlich Date: Tue, 21 Nov 2023 23:31:19 +0100 Subject: [PATCH 2/2] fixed another bug which had been caused due to owncall is not longer in the userlist --- .../MessageBusManagementThread.java | 48 +++++++++--------- .../view/Kst4ContestApplication.java | 50 ++++++++++--------- 2 files changed, 50 insertions(+), 48 deletions(-) diff --git a/src/main/java/kst4contest/controller/MessageBusManagementThread.java b/src/main/java/kst4contest/controller/MessageBusManagementThread.java index 4b57b01..87d5eb4 100644 --- a/src/main/java/kst4contest/controller/MessageBusManagementThread.java +++ b/src/main/java/kst4contest/controller/MessageBusManagementThread.java @@ -490,6 +490,9 @@ public class MessageBusManagementThread extends Thread { // if someone sent a message without being in the userlist (cause // on4kst missed implementing....), callsign will be marked } else { + AirPlaneReflectionInfo preventNullpointerExc = new AirPlaneReflectionInfo(); + preventNullpointerExc.setAirPlanesReachableCntr(0); + sender.setAirPlaneReflectInfo(preventNullpointerExc); newMessage.setSender(sender); //my own call is the sender } } @@ -540,25 +543,31 @@ public class MessageBusManagementThread extends Thread { // System.out.println("message directed to: " + newMessage.getReceiver().getCallSign() + ". EQ?: " + this.client.getownChatMemberObject().getCallSign() + " sent by: " + newMessage.getSender().getCallSign().toUpperCase() + " -> EQ?: "+ this.client.getChatPreferences().getLoginCallSign().toUpperCase()); - if (newMessage.getReceiver().getCallSign() - .equals(this.client.getChatPreferences().getLoginCallSign())) { + try { + if (newMessage.getReceiver().getCallSign() + .equals(this.client.getChatPreferences().getLoginCallSign())) { - this.client.getLst_toMeMessageList().add(0, newMessage); + this.client.getLst_toMeMessageList().add(0, newMessage); - System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + "."); + System.out.println("message directed to me: " + newMessage.getReceiver().getCallSign() + "."); - } else if (newMessage.getSender().getCallSign().toUpperCase() // if you sent the message to another station, it will be sorted in to - // the "to me message list" with modified messagetext, added rxers callsign - .equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) { - String originalMessage = newMessage.getMessageText(); - newMessage - .setMessageText("(>" + newMessage.getReceiver().getCallSign() + ")" + originalMessage); - this.client.getLst_toMeMessageList().add(0, newMessage); // TODO:check + } else if (newMessage.getSender().getCallSign().toUpperCase() + .equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) { + String originalMessage = newMessage.getMessageText(); + newMessage + .setMessageText("(>" + newMessage.getReceiver().getCallSign() + ")" + originalMessage); + this.client.getLst_toMeMessageList().add(0, newMessage); + // if you sent the message to another station, it will be sorted in to + // the "to me message list" with modified messagetext, added rxers callsign - } else { - this.client.getLst_toOtherMessageList().add(0, newMessage); + } else { + this.client.getLst_toOtherMessageList().add(0, newMessage); // System.out.println("MSGBS bgfx: tx call = " + newMessage.getSender().getCallSign() + " / rx call = " + newMessage.getReceiver().getCallSign()); + } + } catch (NullPointerException referenceDeletedByUserLeftChatDuringMessageprocessing) { + System.out.println("MSGBS bgfx, catched error: referenced user left the chat during messageprocessing: "); + referenceDeletedByUserLeftChatDuringMessageprocessing.printStackTrace(); } // sdtout to me message-List @@ -613,24 +622,13 @@ public class MessageBusManagementThread extends Thread { } else { /** * User is in the list... - * */ this.client.getLst_chatMemberList().get(index).setFrequency(qrg); System.out.println("[MSGBUSMGT:] Frequency for " + splittedMessageLine[3] + " setted: " + locatedFrequencies); - -// this.client.getLst_chatMemberList(). - -// ChatMember dummy = new ChatMember(); -// -// dummy.setAirPlaneReflectInfo(new AirPlaneReflectionInfo()); //TODO: check if this is neccessary -// this.client.getLst_chatMemberList().add(dummy); // TODO: Bugfix for UI actualization, maybe we dont need that any more -// this.client.getLst_chatMemberList().remove(dummy); -// this.client.getLst_chatMemberList().sorted(); - -// } } + } // TODO: Next: get frequency infos out of name? diff --git a/src/main/java/kst4contest/view/Kst4ContestApplication.java b/src/main/java/kst4contest/view/Kst4ContestApplication.java index 4e36dc2..6f7e18e 100644 --- a/src/main/java/kst4contest/view/Kst4ContestApplication.java +++ b/src/main/java/kst4contest/view/Kst4ContestApplication.java @@ -834,31 +834,35 @@ public class Kst4ContestApplication extends Application { public ObservableValue call(CellDataFeatures cellDataFeatures) { SimpleStringProperty airPlaneInfo = new SimpleStringProperty(); - if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes() == null) { - airPlaneInfo.setValue("nil"); - } - - else if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().size() <= 0) { - airPlaneInfo.setValue("nil"); - } else { - String apInfoText = "" - + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().get(0) - .getArrivingDurationMinutes() - + " (" + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().get(0) - .getPotential() - + "%)"; -// -// - if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().size() > 1) { - apInfoText += " / " - + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().get(1) - .getArrivingDurationMinutes() - + " (" + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes() - .get(1).getPotential() - + "%)"; + try { + if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes() == null) { + airPlaneInfo.setValue("nil"); } - airPlaneInfo.setValue(apInfoText); + else if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().size() <= 0) { + airPlaneInfo.setValue("nil"); + } else { + String apInfoText = "" + + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().get(0) + .getArrivingDurationMinutes() + + " (" + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().get(0) + .getPotential() + + "%)"; +// +// + if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().size() > 1) { + apInfoText += " / " + + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes().get(1) + .getArrivingDurationMinutes() + + " (" + cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes() + .get(1).getPotential() + + "%)"; + } + + airPlaneInfo.setValue(apInfoText); + } + } catch (NullPointerException thereIsNoApReflectionInfo) { + //e.g. in case of mycall it´s not possible to set! } return airPlaneInfo;