summaryrefslogtreecommitdiffstats
path: root/external/java_websocket/patches/0001-cid-1545515-Dm-Dubious-method-used.patch
blob: e56780600ad01fbb57fd5b7d69e1f46be511f26f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 695941c8da3e6cefa0553996773a8cf8673bb00e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolan.mcnamara@collabora.com>
Date: Sun, 1 Oct 2023 19:50:02 +0100
Subject: [PATCH] cid#1545515 Dm: Dubious method used

---
 src/main/java/org/java_websocket/WebSocketImpl.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/java_websocket/WebSocketImpl.java b/src/main/java/org/java_websocket/WebSocketImpl.java
index 85fd413..926f330 100644
--- a/src/main/java/org/java_websocket/WebSocketImpl.java
+++ b/src/main/java/org/java_websocket/WebSocketImpl.java
@@ -30,6 +30,7 @@
 import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
 import java.nio.channels.SelectionKey;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -227,7 +228,7 @@
     if (log.isLoggable(Level.FINE)) {
       log.fine("process({}): ({})" + " : " + socketBuffer.remaining() + " : " +
               (socketBuffer.remaining() > 1000 ? "too big to display"
-                      : new String(socketBuffer.array(), socketBuffer.position(), socketBuffer.remaining())));
+                      : new String(socketBuffer.array(), socketBuffer.position(), socketBuffer.remaining(), StandardCharsets.US_ASCII)));
     }
     if (readyState != ReadyState.NOT_YET_CONNECTED) {
       if (readyState == ReadyState.OPEN) {
@@ -740,7 +741,7 @@
 
   private void write(ByteBuffer buf) {
     log.fine("write({}): {}" + " : " + buf.remaining() + " : " +
-        (buf.remaining() > 1000 ? "too big to display" : new String(buf.array())));
+        (buf.remaining() > 1000 ? "too big to display" : new String(buf.array(), StandardCharsets.US_ASCII)));
 
     outQueue.add(buf);
     wsl.onWriteDemand(this);
-- 
2.41.0