fixed another bug which had been caused due to owncall is not longer in the userlist

This commit is contained in:
Marc Froehlich
2023-11-21 23:31:19 +01:00
parent d79886d4c9
commit d57880d945
2 changed files with 50 additions and 48 deletions

View File

@@ -490,6 +490,9 @@ public class MessageBusManagementThread extends Thread {
// if someone sent a message without being in the userlist (cause // if someone sent a message without being in the userlist (cause
// on4kst missed implementing....), callsign will be marked // on4kst missed implementing....), callsign will be marked
} else { } else {
AirPlaneReflectionInfo preventNullpointerExc = new AirPlaneReflectionInfo();
preventNullpointerExc.setAirPlanesReachableCntr(0);
sender.setAirPlaneReflectInfo(preventNullpointerExc);
newMessage.setSender(sender); //my own call is the sender newMessage.setSender(sender); //my own call is the sender
} }
} }
@@ -540,6 +543,7 @@ 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()); // 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());
try {
if (newMessage.getReceiver().getCallSign() if (newMessage.getReceiver().getCallSign()
.equals(this.client.getChatPreferences().getLoginCallSign())) { .equals(this.client.getChatPreferences().getLoginCallSign())) {
@@ -547,19 +551,24 @@ public class MessageBusManagementThread extends Thread {
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 } else if (newMessage.getSender().getCallSign().toUpperCase()
// the "to me message list" with modified messagetext, added rxers callsign
.equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) { .equals(this.client.getChatPreferences().getLoginCallSign().toUpperCase())) {
String originalMessage = newMessage.getMessageText(); String originalMessage = newMessage.getMessageText();
newMessage newMessage
.setMessageText("(>" + newMessage.getReceiver().getCallSign() + ")" + originalMessage); .setMessageText("(>" + newMessage.getReceiver().getCallSign() + ")" + originalMessage);
this.client.getLst_toMeMessageList().add(0, newMessage); // TODO:check 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 { } else {
this.client.getLst_toOtherMessageList().add(0, newMessage); this.client.getLst_toOtherMessageList().add(0, newMessage);
// System.out.println("MSGBS bgfx: tx call = " + newMessage.getSender().getCallSign() + " / rx call = " + newMessage.getReceiver().getCallSign()); // 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 // sdtout to me message-List
@@ -613,24 +622,13 @@ public class MessageBusManagementThread extends Thread {
} else { } else {
/** /**
* User is in the list... * User is in the list...
*
*/ */
this.client.getLst_chatMemberList().get(index).setFrequency(qrg); this.client.getLst_chatMemberList().get(index).setFrequency(qrg);
System.out.println("[MSGBUSMGT:] Frequency for " + splittedMessageLine[3] + " setted: " System.out.println("[MSGBUSMGT:] Frequency for " + splittedMessageLine[3] + " setted: "
+ locatedFrequencies); + 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? // TODO: Next: get frequency infos out of name?

View File

@@ -834,6 +834,7 @@ public class Kst4ContestApplication extends Application {
public ObservableValue<String> call(CellDataFeatures<ChatMessage, String> cellDataFeatures) { public ObservableValue<String> call(CellDataFeatures<ChatMessage, String> cellDataFeatures) {
SimpleStringProperty airPlaneInfo = new SimpleStringProperty(); SimpleStringProperty airPlaneInfo = new SimpleStringProperty();
try {
if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes() == null) { if (cellDataFeatures.getValue().getSender().getAirPlaneReflectInfo().getRisingAirplanes() == null) {
airPlaneInfo.setValue("nil"); airPlaneInfo.setValue("nil");
} }
@@ -860,6 +861,9 @@ public class Kst4ContestApplication extends Application {
airPlaneInfo.setValue(apInfoText); airPlaneInfo.setValue(apInfoText);
} }
} catch (NullPointerException thereIsNoApReflectionInfo) {
//e.g. in case of mycall it´s not possible to set!
}
return airPlaneInfo; return airPlaneInfo;