mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8234147: Avoid looking up standard charsets in core libraries
Reviewed-by: alanb
This commit is contained in:
parent
4e64af81a2
commit
cd589d8469
36 changed files with 200 additions and 237 deletions
|
@ -28,6 +28,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.AccessController;
|
||||
import java.util.Iterator;
|
||||
|
||||
|
@ -166,18 +167,10 @@ class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts {
|
|||
return false;
|
||||
out.write(1);
|
||||
out.write(userName.length());
|
||||
try {
|
||||
out.write(userName.getBytes("ISO-8859-1"));
|
||||
} catch (java.io.UnsupportedEncodingException uee) {
|
||||
assert false;
|
||||
}
|
||||
out.write(userName.getBytes(StandardCharsets.ISO_8859_1));
|
||||
if (password != null) {
|
||||
out.write(password.length());
|
||||
try {
|
||||
out.write(password.getBytes("ISO-8859-1"));
|
||||
} catch (java.io.UnsupportedEncodingException uee) {
|
||||
assert false;
|
||||
}
|
||||
out.write(password.getBytes(StandardCharsets.ISO_8859_1));
|
||||
} else
|
||||
out.write(0);
|
||||
out.flush();
|
||||
|
@ -208,11 +201,7 @@ class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts {
|
|||
out.write((endpoint.getPort() >> 0) & 0xff);
|
||||
out.write(endpoint.getAddress().getAddress());
|
||||
String userName = getUserName();
|
||||
try {
|
||||
out.write(userName.getBytes("ISO-8859-1"));
|
||||
} catch (java.io.UnsupportedEncodingException uee) {
|
||||
assert false;
|
||||
}
|
||||
out.write(userName.getBytes(StandardCharsets.ISO_8859_1));
|
||||
out.write(0);
|
||||
out.flush();
|
||||
byte[] data = new byte[8];
|
||||
|
@ -427,11 +416,7 @@ class SocksSocketImpl extends DelegatingSocketImpl implements SocksConsts {
|
|||
if (epoint.isUnresolved()) {
|
||||
out.write(DOMAIN_NAME);
|
||||
out.write(epoint.getHostName().length());
|
||||
try {
|
||||
out.write(epoint.getHostName().getBytes("ISO-8859-1"));
|
||||
} catch (java.io.UnsupportedEncodingException uee) {
|
||||
assert false;
|
||||
}
|
||||
out.write(epoint.getHostName().getBytes(StandardCharsets.ISO_8859_1));
|
||||
out.write((epoint.getPort() >> 8) & 0xff);
|
||||
out.write((epoint.getPort() >> 0) & 0xff);
|
||||
} else if (epoint.getAddress() instanceof Inet6Address) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue