https://bz.apache.org/bugzilla/show_bug.cgi?id=58658

--- Comment #5 from imgx64...@gmail.com ---
I dug into the Tomcat 7 code, and I managed to "fix" the Spring Boot bug by
copying StandardCharsets.ISO_8859_1 into WsWebSocketContainer and changing the
static intializers. Is this an appropriate solution?

Note that StandardCharsets.ISO_8859_1 is used elsewhere in
WsWebSocketContainer, but only the static initializers are causing problems.

Index: java/org/apache/tomcat/websocket/WsWebSocketContainer.java
===================================================================
--- java/org/apache/tomcat/websocket/WsWebSocketContainer.java    (revision
1721884)
+++ java/org/apache/tomcat/websocket/WsWebSocketContainer.java    (working
copy)
@@ -29,6 +29,7 @@
 import java.nio.ByteBuffer;
 import java.nio.channels.AsynchronousChannelGroup;
 import java.nio.channels.AsynchronousSocketChannel;
+import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.security.KeyStore;
 import java.util.ArrayList;
@@ -109,10 +110,12 @@
     private static final Random random = new Random();
     private static final byte[] crlf = new byte[] {13, 10};

-    private static final byte[] GET_BYTES = "GET
".getBytes(StandardCharsets.ISO_8859_1);
-    private static final byte[] ROOT_URI_BYTES =
"/".getBytes(StandardCharsets.ISO_8859_1);
+    private static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
+
+    private static final byte[] GET_BYTES = "GET ".getBytes(ISO_8859_1);
+    private static final byte[] ROOT_URI_BYTES = "/".getBytes(ISO_8859_1);
     private static final byte[] HTTP_VERSION_BYTES =
-            " HTTP/1.1\r\n".getBytes(StandardCharsets.ISO_8859_1);
+            " HTTP/1.1\r\n".getBytes(ISO_8859_1);

     private volatile AsynchronousChannelGroup asynchronousChannelGroup = null;
     private final Object asynchronousChannelGroupLock = new Object();

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to