Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java')
-rw-r--r--jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java17
1 files changed, 3 insertions, 14 deletions
diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java
index c4d5ba285d..83027c0660 100644
--- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java
+++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java
@@ -19,6 +19,7 @@
package org.eclipse.jetty.websocket.common;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import org.eclipse.jetty.util.B64Code;
@@ -36,19 +37,7 @@ public class AcceptHash
* <p>
* See <a href="https://tools.ietf.org/html/rfc6455#section-1.3">Opening Handshake (Section 1.3)</a>
*/
- private final static byte[] MAGIC;
-
- static
- {
- try
- {
- MAGIC = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11".getBytes(StringUtil.__ISO_8859_1);
- }
- catch (UnsupportedEncodingException e)
- {
- throw new RuntimeException(e);
- }
- }
+ private final static byte[] MAGIC = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11".getBytes(StandardCharsets.ISO_8859_1);
/**
* Concatenate the provided key with the Magic GUID and return the Base64 encoded form.
@@ -62,7 +51,7 @@ public class AcceptHash
try
{
MessageDigest md = MessageDigest.getInstance("SHA1");
- md.update(key.getBytes("UTF-8"));
+ md.update(key.getBytes(StandardCharsets.UTF_8));
md.update(MAGIC);
return new String(B64Code.encode(md.digest()));
}

Back to the top