Merge pull request #2251 from lachlan-roberts/jetty-9.4.x-2206-util-defaultCharset

Resolved default charset warning in jetty-util for #2206

Merging prior to CI as no substantive code changes (and CI is borked anyway at the moment)
This commit is contained in:
Greg Wilkins 2018-02-27 12:26:55 +11:00 committed by GitHub
commit eb42a9e71f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -255,12 +255,14 @@ public class B64Code
* <p>Unlike {@link #decode(char[])}, extra whitespace is ignored.
* @param encoded String to decode.
* @param charEncoding String representing the character encoding
* used to map the decoded bytes into a String.
* used to map the decoded bytes into a String. If null
* the platforms default charset is used.
* @return String decoded byte array.
* @throws UnsupportedCharsetException if the encoding is not supported
* @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);
@ -274,11 +276,13 @@ public class B64Code
* <p>Unlike {@link #decode(char[])}, extra whitespace is ignored.
* @param encoded String to decode.
* @param charEncoding Character encoding
* used to map the decoded bytes into a String.
* used to map the decoded bytes into a String. If null
* the platforms default charset is used.
* @return String decoded byte array.
* @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);

View File

@ -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)