summaryrefslogtreecommitdiff
path: root/external/java_websocket/patches/0001-cid-1546264-Dm-Dubious-method-used.patch
blob: 22730e59f83a4a966c180096b633b2a0a35941a1 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 83e8f4ee244e2616032dc0b8b260fda30ca1105b 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:52:37 +0100
Subject: [PATCH] cid#1546264 Dm: Dubious method used

and

cid#1546494 Dm: Dubious method used
---
 src/main/java/org/java_websocket/SSLSocketChannel2.java    | 7 ++++---
 .../java/org/java_websocket/framing/FramedataImpl1.java    | 3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/java_websocket/SSLSocketChannel2.java b/src/main/java/org/java_websocket/SSLSocketChannel2.java
index c0ea28e..2d3a279 100644
--- a/src/main/java/org/java_websocket/SSLSocketChannel2.java
+++ b/src/main/java/org/java_websocket/SSLSocketChannel2.java
@@ -34,6 +34,7 @@
 import java.nio.channels.SelectableChannel;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -257,12 +258,12 @@
       }
     }
     if (inData.remaining() != 0 && log.isLoggable(Level.FINE)) {
-      log.fine(new String(inData.array(), inData.position(), inData.remaining()));
+      log.fine(new String(inData.array(), inData.position(), inData.remaining(), StandardCharsets.US_ASCII));
     }
     inData.rewind();
     inData.flip();
     if (inCrypt.remaining() != 0 && log.isLoggable(Level.FINE)) {
-      log.fine(new String(inCrypt.array(), inCrypt.position(), inCrypt.remaining()));
+      log.fine(new String(inCrypt.array(), inCrypt.position(), inCrypt.remaining(), StandardCharsets.US_ASCII));
     }
     inCrypt.rewind();
     inCrypt.flip();
diff --git a/src/main/java/org/java_websocket/framing/FramedataImpl1.java b/src/main/java/org/java_websocket/framing/FramedataImpl1.java
index fc74f7a..6ff1af2 100644
--- a/src/main/java/org/java_websocket/framing/FramedataImpl1.java
+++ b/src/main/java/org/java_websocket/framing/FramedataImpl1.java
@@ -26,6 +26,7 @@
 package org.java_websocket.framing;
 
 import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
 import org.java_websocket.enums.Opcode;
 import org.java_websocket.exceptions.InvalidDataException;
 import org.java_websocket.util.ByteBufferUtils;
@@ -162,7 +163,7 @@ public abstract class FramedataImpl1 implements Framedata {
         + ", rsv2:" + isRSV2() + ", rsv3:" + isRSV3() + ", payload length:[pos:" + unmaskedpayload
         .position() + ", len:" + unmaskedpayload.remaining() + "], payload:" + (
         unmaskedpayload.remaining() > 1000 ? "(too big to display)"
-            : new String(unmaskedpayload.array())) + '}';
+            : new String(unmaskedpayload.array(), StandardCharsets.US_ASCII)) + '}';
   }
 
   /**
-- 
2.41.0