From cf5b501254e937178d53e3bc50e44b825e1fcffa Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Tue, 27 Feb 2018 11:09:47 +1100 Subject: [PATCH] Resolved default charset warning in jetty-util for #2206 Ignored warning in B64Code US-ASCII in UnixCrypt Signed-off-by: Lachlan Roberts --- jetty-util/src/main/java/org/eclipse/jetty/util/B64Code.java | 2 ++ .../main/java/org/eclipse/jetty/util/security/UnixCrypt.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/B64Code.java b/jetty-util/src/main/java/org/eclipse/jetty/util/B64Code.java index 1fe4006b7cb..078b8f8e4f5 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/B64Code.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/B64Code.java @@ -261,6 +261,7 @@ public class B64Code * @throws IllegalArgumentException if the input is not a valid * B64 encoding. */ + @SuppressWarnings("DefaultCharset") public static String decode(String encoded,String charEncoding) { byte[] decoded=decode(encoded); @@ -279,6 +280,7 @@ public class B64Code * @throws IllegalArgumentException if the input is not a valid * B64 encoding. */ + @SuppressWarnings("DefaultCharset") public static String decode(String encoded, Charset charEncoding) { byte[] decoded=decode(encoded); diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/security/UnixCrypt.java b/jetty-util/src/main/java/org/eclipse/jetty/util/security/UnixCrypt.java index e3f98e807f6..8e7e78c108d 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/security/UnixCrypt.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/security/UnixCrypt.java @@ -23,6 +23,7 @@ package org.eclipse.jetty.util.security; +import java.nio.charset.StandardCharsets; /* ------------------------------------------------------------ */ /** @@ -444,7 +445,7 @@ public class UnixCrypt rsltblock >>= 6; } - return new String(cryptresult, 0, 13); + return new String(cryptresult, 0, 13, StandardCharsets.US_ASCII); } public static void main(String[] arg)