cid#1546393 SBSC: String concatenation in loop using + operator

Change-Id: I697830e97b3168aab3e41e96b744ab80edbad31c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157401
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara
2023-09-29 14:14:32 +02:00
parent 1ca97423ab
commit b409fb0eba
@@ -279,7 +279,7 @@ public class WebsocketConnection extends WebSocketClient implements XConnection,
public void onMessage(ByteBuffer message) {
byte[] prefixedMessageBytes = message.array();
String messageType = "";
StringBuffer messageTypeBuf = new StringBuffer();
boolean hasType = false;
int i;
for (i = 0; i < prefixedMessageBytes.length - 1; i++) {
@@ -287,7 +287,7 @@ public class WebsocketConnection extends WebSocketClient implements XConnection,
hasType = true;
break; // The type ends with ": ", so if we find this sequence we found the end of our type
}
messageType += (char)prefixedMessageBytes[i];
messageTypeBuf.append((char)prefixedMessageBytes[i]);
}
if(!hasType) {
@@ -295,6 +295,8 @@ public class WebsocketConnection extends WebSocketClient implements XConnection,
return;
}
String messageType = messageTypeBuf.toString();
int messageStartIndex = i + 2;
if (!messageType.equals("urp")) {