mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +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
|
@ -42,11 +42,11 @@ import java.text.Normalizer;
|
|||
import jdk.internal.access.JavaNetUriAccess;
|
||||
import jdk.internal.access.SharedSecrets;
|
||||
import sun.nio.cs.ThreadLocalCoders;
|
||||
import sun.nio.cs.UTF_8;
|
||||
|
||||
import java.lang.Character; // for javadoc
|
||||
import java.lang.NullPointerException; // for javadoc
|
||||
|
||||
|
||||
/**
|
||||
* Represents a Uniform Resource Identifier (URI) reference.
|
||||
*
|
||||
|
@ -2739,7 +2739,7 @@ public final class URI
|
|||
private static void appendEncoded(StringBuilder sb, char c) {
|
||||
ByteBuffer bb = null;
|
||||
try {
|
||||
bb = ThreadLocalCoders.encoderFor("UTF-8")
|
||||
bb = ThreadLocalCoders.encoderFor(UTF_8.INSTANCE)
|
||||
.encode(CharBuffer.wrap("" + c));
|
||||
} catch (CharacterCodingException x) {
|
||||
assert false;
|
||||
|
@ -2807,7 +2807,7 @@ public final class URI
|
|||
String ns = Normalizer.normalize(s, Normalizer.Form.NFC);
|
||||
ByteBuffer bb = null;
|
||||
try {
|
||||
bb = ThreadLocalCoders.encoderFor("UTF-8")
|
||||
bb = ThreadLocalCoders.encoderFor(UTF_8.INSTANCE)
|
||||
.encode(CharBuffer.wrap(ns));
|
||||
} catch (CharacterCodingException x) {
|
||||
assert false;
|
||||
|
@ -2865,7 +2865,7 @@ public final class URI
|
|||
StringBuilder sb = new StringBuilder(n);
|
||||
ByteBuffer bb = ByteBuffer.allocate(n);
|
||||
CharBuffer cb = CharBuffer.allocate(n);
|
||||
CharsetDecoder dec = ThreadLocalCoders.decoderFor("UTF-8")
|
||||
CharsetDecoder dec = ThreadLocalCoders.decoderFor(UTF_8.INSTANCE)
|
||||
.onMalformedInput(CodingErrorAction.REPLACE)
|
||||
.onUnmappableCharacter(CodingErrorAction.REPLACE);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue