From b246c3c7e33e7934c14a3720dbfb6bce69eefa7a Mon Sep 17 00:00:00 2001 From: schrom01 Date: Tue, 12 Apr 2022 08:59:53 +0200 Subject: [PATCH] fix Problem with StringBuilder in ClientMessageList --- .../java/ch/zhaw/pm2/multichat/client/ChatWindowController.java | 2 +- .../java/ch/zhaw/pm2/multichat/client/ClientMessageList.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/main/java/ch/zhaw/pm2/multichat/client/ChatWindowController.java b/client/src/main/java/ch/zhaw/pm2/multichat/client/ChatWindowController.java index 51bc48f..f73e498 100644 --- a/client/src/main/java/ch/zhaw/pm2/multichat/client/ChatWindowController.java +++ b/client/src/main/java/ch/zhaw/pm2/multichat/client/ChatWindowController.java @@ -189,7 +189,7 @@ public class ChatWindowController { private void redrawMessageList() { this.messageArea.clear(); - Platform.runLater(() -> this.messageArea.appendText(messages.getFilteredMessages(filterValue.getText().strip()))); + Platform.runLater(() -> this.messageArea.setText(messages.getFilteredMessages(filterValue.getText().strip()))); } class WindowCloseHandler implements EventHandler { diff --git a/client/src/main/java/ch/zhaw/pm2/multichat/client/ClientMessageList.java b/client/src/main/java/ch/zhaw/pm2/multichat/client/ClientMessageList.java index 402d19d..a811406 100644 --- a/client/src/main/java/ch/zhaw/pm2/multichat/client/ClientMessageList.java +++ b/client/src/main/java/ch/zhaw/pm2/multichat/client/ClientMessageList.java @@ -12,7 +12,7 @@ public class ClientMessageList { } public String getFilteredMessages(String filter) { - StringBuilder result = null; + StringBuilder result = new StringBuilder(); boolean showAll = filter == null || filter.isBlank(); for(Message message : messages) { if(showAll || message.matchesFilter(filter))