mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8146484: Examine sun.misc.MessageUtils
Reviewed-by: alanb, mchung, sherman
This commit is contained in:
parent
41477d597a
commit
0c7d3be7a8
7 changed files with 21 additions and 159 deletions
|
@ -39,7 +39,6 @@ import java.nio.charset.IllegalCharsetNameException;
|
|||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.util.Arrays;
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
import sun.misc.MessageUtils;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.ArrayDecoder;
|
||||
import sun.nio.cs.ArrayEncoder;
|
||||
|
@ -106,11 +105,11 @@ class StringCoding {
|
|||
|
||||
private static void warnUnsupportedCharset(String csn) {
|
||||
if (warnUnsupportedCharset) {
|
||||
// Use sun.misc.MessageUtils rather than the Logging API or
|
||||
// System.err since this method may be called during VM
|
||||
// initialization before either is available.
|
||||
MessageUtils.err("WARNING: Default charset " + csn +
|
||||
" not supported, using ISO-8859-1 instead");
|
||||
// Use err(String) rather than the Logging API or System.err
|
||||
// since this method may be called during VM initialization
|
||||
// before either is available.
|
||||
err("WARNING: Default charset " + csn +
|
||||
" not supported, using ISO-8859-1 instead\n");
|
||||
warnUnsupportedCharset = false;
|
||||
}
|
||||
}
|
||||
|
@ -341,10 +340,9 @@ class StringCoding {
|
|||
try {
|
||||
return decode("ISO-8859-1", ba, off, len);
|
||||
} catch (UnsupportedEncodingException x) {
|
||||
// If this code is hit during VM initialization, MessageUtils is
|
||||
// If this code is hit during VM initialization, err(String) is
|
||||
// the only way we will be able to get any kind of error message.
|
||||
MessageUtils.err("ISO-8859-1 charset not available: "
|
||||
+ x.toString());
|
||||
err("ISO-8859-1 charset not available: " + x.toString() + "\n");
|
||||
// If we can not find ISO-8859-1 (a required encoding) then things
|
||||
// are seriously wrong with the installation.
|
||||
System.exit(1);
|
||||
|
@ -653,14 +651,20 @@ class StringCoding {
|
|||
try {
|
||||
return encode("ISO-8859-1", coder, val);
|
||||
} catch (UnsupportedEncodingException x) {
|
||||
// If this code is hit during VM initialization, MessageUtils is
|
||||
// If this code is hit during VM initialization, err(String) is
|
||||
// the only way we will be able to get any kind of error message.
|
||||
MessageUtils.err("ISO-8859-1 charset not available: "
|
||||
+ x.toString());
|
||||
err("ISO-8859-1 charset not available: " + x.toString() + "\n");
|
||||
// If we can not find ISO-8859-1 (a required encoding) then things
|
||||
// are seriously wrong with the installation.
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a message directly to stderr, bypassing all character conversion
|
||||
* methods.
|
||||
* @param msg message to print
|
||||
*/
|
||||
private static native void err(String msg);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue