diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-09-30 19:29:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-09-30 21:45:13 +0200 |
commit | 1064a0d941099203fb5781edf599274dbf078931 (patch) | |
tree | 65da00ff6e3a919c4ef04d14a594f4bfb80b1b9b /ridljar | |
parent | d8be0f46db22c1d73816acd5df37f7082dc46c23 (diff) |
cid#1545766 silence Unguarded read
a bit zealous here, its all on the same thread as it turns out
Change-Id: Ic2e8d8eba4fea672fa56c88abedb853fd886cecc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157437
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'ridljar')
-rw-r--r-- | ridljar/com/sun/star/lib/connections/websocket/WebsocketConnection.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ridljar/com/sun/star/lib/connections/websocket/WebsocketConnection.java b/ridljar/com/sun/star/lib/connections/websocket/WebsocketConnection.java index 7afff73048f5..d408046b13ed 100644 --- a/ridljar/com/sun/star/lib/connections/websocket/WebsocketConnection.java +++ b/ridljar/com/sun/star/lib/connections/websocket/WebsocketConnection.java @@ -201,11 +201,9 @@ public class WebsocketConnection extends WebSocketClient implements XConnection, public void flush() throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { - byte[] accumulatedBytes; - synchronized (_outputStream) { - accumulatedBytes = _outputStream.toByteArray(); - _outputStream.reset(); - } + byte[] accumulatedBytes = _outputStream.toByteArray(); + _outputStream.reset(); + byte[] outputBytes = new byte[accumulatedBytes.length + outgoingPrefix.length]; System.arraycopy(outgoingPrefix, 0, outputBytes, 0, outgoingPrefix.length); System.arraycopy(accumulatedBytes, 0, outputBytes, outgoingPrefix.length, accumulatedBytes.length); |