Using StandardCharset fields instead of Charset.forName().
This commit is contained in:
parent
208382b07d
commit
0c80567c12
|
@ -20,7 +20,7 @@ package org.eclipse.jetty.client;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -120,7 +120,7 @@ public class Socks4Proxy extends ProxyConfiguration.Proxy
|
|||
else
|
||||
{
|
||||
// SOCKS 4A
|
||||
byte[] hostBytes = host.getBytes(Charset.forName("UTF-8"));
|
||||
byte[] hostBytes = host.getBytes(StandardCharsets.UTF_8);
|
||||
ByteBuffer buffer = ByteBuffer.allocate(9 + hostBytes.length + 1);
|
||||
buffer.put((byte)4).put((byte)1).putShort(port);
|
||||
buffer.put((byte)0).put((byte)0).put((byte)0).put((byte)1).put((byte)0);
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.client.util;
|
|||
|
||||
import java.net.URI;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -217,7 +218,7 @@ public class DigestAuthentication implements Authentication
|
|||
if (digester == null)
|
||||
return;
|
||||
|
||||
Charset charset = Charset.forName("ISO-8859-1");
|
||||
Charset charset = StandardCharsets.ISO_8859_1;
|
||||
String A1 = user + ":" + realm + ":" + password;
|
||||
String hashA1 = toHexString(digester.digest(A1.getBytes(charset)));
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package org.eclipse.jetty.spdy.api;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
|
@ -28,11 +28,11 @@ public class StringDataInfo extends BytesDataInfo
|
|||
{
|
||||
public StringDataInfo(String string, boolean close)
|
||||
{
|
||||
super(string.getBytes(Charset.forName("UTF-8")), close);
|
||||
super(string.getBytes(StandardCharsets.UTF_8), close);
|
||||
}
|
||||
|
||||
public StringDataInfo(long timeout, TimeUnit unit, String string, boolean close)
|
||||
{
|
||||
super(timeout, unit, string.getBytes(Charset.forName("UTF-8")), close);
|
||||
super(timeout, unit, string.getBytes(StandardCharsets.UTF_8), close);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.eclipse.jetty.spdy.generator;
|
|||
import java.io.ByteArrayOutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -42,7 +43,7 @@ public class HeadersBlockGenerator
|
|||
public ByteBuffer generate(short version, Fields headers)
|
||||
{
|
||||
// TODO: ByteArrayOutputStream is quite inefficient, but grows on demand; optimize using ByteBuffer ?
|
||||
Charset iso1 = Charset.forName("ISO-8859-1");
|
||||
Charset iso1 = StandardCharsets.ISO_8859_1;
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream(headers.getSize() * 64);
|
||||
writeCount(version, buffer, headers.getSize());
|
||||
for (Fields.Field header : headers)
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.spdy.parser;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.zip.ZipException;
|
||||
|
||||
import org.eclipse.jetty.spdy.CompressionDictionary;
|
||||
|
@ -57,7 +58,7 @@ public abstract class HeadersBlockParser
|
|||
data = null;
|
||||
ByteBuffer decompressedHeaders = decompress(version, compressedHeaders);
|
||||
|
||||
Charset iso1 = Charset.forName("ISO-8859-1");
|
||||
Charset iso1 = StandardCharsets.ISO_8859_1;
|
||||
|
||||
// We know the decoded bytes contain the full headers,
|
||||
// so optimize instead of looping byte by byte
|
||||
|
|
Loading…
Reference in New Issue