Merge
This commit is contained in:
commit
ef4467590b
4976
jdk/make/data/charsetmapping/Big5_HKSCS.c2b
Normal file
4976
jdk/make/data/charsetmapping/Big5_HKSCS.c2b
Normal file
File diff suppressed because it is too large
Load Diff
18598
jdk/make/data/charsetmapping/Big5_HKSCS.map
Normal file
18598
jdk/make/data/charsetmapping/Big5_HKSCS.map
Normal file
File diff suppressed because it is too large
Load Diff
16
jdk/make/data/charsetmapping/Big5_HKSCS.nr
Normal file
16
jdk/make/data/charsetmapping/Big5_HKSCS.nr
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
0xA15A 0xFF3F #SPACING UNDERSCORE
|
||||
0xA1FE 0x2571 #LT DIAG UP RIGHT TO LOW LEFT
|
||||
0xA240 0x2572 #LT DIAG UP LEFT TO LOW RIGHTG
|
||||
0xA2CC 0x5341 #HANGHZOU NUMERAL TEN
|
||||
0xA2CE 0x5345 #HANGZHOU NUMERAL THIRTY
|
||||
#
|
||||
0xA27E 0x256D # BOX DRAWINGS LIGHT ARC DOWN AND RIGHT
|
||||
0xA2A1 0x256E # BOX DRAWINGS LIGHT ARC DOWN AND LEFT
|
||||
0xA2A2 0x2570 # BOX DRAWINGS LIGHT ARC UP AND RIGHT
|
||||
0xA2A3 0x256F # BOX DRAWINGS LIGHT ARC UP AND LEFT
|
||||
0xA2A4 0x2550 # BOX DRAWINGS DOUBLE HORIZONTAL
|
||||
0xA2A5 0x255E # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
|
||||
0xA2A6 0x256A # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
|
||||
0xA2A7 0x2561 # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
|
||||
|
13706
jdk/make/data/charsetmapping/Big5_Solaris.map
Normal file
13706
jdk/make/data/charsetmapping/Big5_Solaris.map
Normal file
File diff suppressed because it is too large
Load Diff
13107
jdk/make/data/charsetmapping/EUC_JP.map
Normal file
13107
jdk/make/data/charsetmapping/EUC_JP.map
Normal file
File diff suppressed because it is too large
Load Diff
7040
jdk/make/data/charsetmapping/EUC_JP_LINUX.map
Normal file
7040
jdk/make/data/charsetmapping/EUC_JP_LINUX.map
Normal file
File diff suppressed because it is too large
Load Diff
13558
jdk/make/data/charsetmapping/EUC_JP_Open.map
Normal file
13558
jdk/make/data/charsetmapping/EUC_JP_Open.map
Normal file
File diff suppressed because it is too large
Load Diff
1
jdk/make/data/charsetmapping/EUC_TW.nr
Normal file
1
jdk/make/data/charsetmapping/EUC_TW.nr
Normal file
@ -0,0 +1 @@
|
||||
a4bf 5344
|
63491
jdk/make/data/charsetmapping/GB18030.map
Normal file
63491
jdk/make/data/charsetmapping/GB18030.map
Normal file
File diff suppressed because it is too large
Load Diff
1
jdk/make/data/charsetmapping/IBM1140.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1140.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1
jdk/make/data/charsetmapping/IBM1141.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1141.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1
jdk/make/data/charsetmapping/IBM1142.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1142.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1
jdk/make/data/charsetmapping/IBM1143.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1143.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1
jdk/make/data/charsetmapping/IBM1144.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1144.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1
jdk/make/data/charsetmapping/IBM1145.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1145.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1
jdk/make/data/charsetmapping/IBM1146.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1146.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1
jdk/make/data/charsetmapping/IBM1147.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1147.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1
jdk/make/data/charsetmapping/IBM1148.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1148.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1
jdk/make/data/charsetmapping/IBM1149.nr
Normal file
1
jdk/make/data/charsetmapping/IBM1149.nr
Normal file
@ -0,0 +1 @@
|
||||
0x25 U+000a
|
1599
jdk/make/data/charsetmapping/MS950_HKSCS_XP.map
Normal file
1599
jdk/make/data/charsetmapping/MS950_HKSCS_XP.map
Normal file
File diff suppressed because it is too large
Load Diff
@ -681,7 +681,7 @@ charset x-euc-jp-linux EUC_JP_LINUX
|
||||
alias euc_jp_linux # JDK historical
|
||||
alias euc-jp-linux
|
||||
|
||||
charset x-eucjp-open EUC_JP_Open
|
||||
charset x-eucJP-Open EUC_JP_Open
|
||||
package sun.nio.cs.ext
|
||||
type template
|
||||
hisname EUC_JP_Solari
|
||||
|
@ -179,7 +179,7 @@ public class DBCS {
|
||||
.replace("$NAME_CLZ$", clzName)
|
||||
.replace("$NAME_ALIASES$",
|
||||
"sun.nio.cs".equals(pkgName) ?
|
||||
"StandardCharsets.aliases_" + clzName :
|
||||
"StandardCharsets.aliases_" + clzName + "()" :
|
||||
"ExtendedCharsets.aliasesFor(\"" + csName + "\")")
|
||||
.replace("$NAME_CS$" , csName)
|
||||
.replace("$CONTAINS$",
|
||||
|
@ -82,7 +82,7 @@ public class EUC_TW {
|
||||
|
||||
static void genClass(String pkg, String args[]) throws Exception
|
||||
{
|
||||
InputStream is = new FileInputStream(new File(args[0], "euc_tw.map"));
|
||||
InputStream is = new FileInputStream(new File(args[0], "EUC_TW.map"));
|
||||
PrintStream ps = new PrintStream(new File(args[1], "EUC_TWMapping.java"),
|
||||
"ISO-8859-1");
|
||||
String copyright = getCopyright(new File(args[7], "EUC_TW.java"));
|
||||
|
@ -161,7 +161,7 @@ public class SBCS {
|
||||
if (line.indexOf("$NAME_ALIASES$", i) != -1) {
|
||||
if ("sun.nio.cs".equals(pkgName))
|
||||
line = line.replace("$NAME_ALIASES$",
|
||||
"StandardCharsets.aliases_" + clzName);
|
||||
"StandardCharsets.aliases_" + clzName + "()");
|
||||
else
|
||||
line = line.replace("$NAME_ALIASES$",
|
||||
"ExtendedCharsets.aliasesFor(\"" + csName + "\")");
|
||||
|
@ -93,21 +93,28 @@ public class SPI {
|
||||
.filter(cs -> cs.pkgName.equals("sun.nio.cs"))
|
||||
.forEach( cs -> {
|
||||
if (cs.aliases == null || cs.aliases.length == 0) {
|
||||
out.printf(" static final String[] aliases_%s = null;%n%n",
|
||||
out.printf(" static String[] aliases_%s() { return null; }%n%n",
|
||||
cs.clzName);
|
||||
} else {
|
||||
boolean methodEnd = true;
|
||||
// non-final for SJIS and MS932 to support sun.nio.cs.map
|
||||
if (cs.clzName.equals("SJIS") || cs.clzName.equals("MS932")) {
|
||||
out.printf(" static String[] aliases_%s() { return aliases_%s; }%n%n",
|
||||
cs.clzName, cs.clzName);
|
||||
out.printf(" static String[] aliases_%s = new String[] {%n",
|
||||
cs.clzName);
|
||||
methodEnd = false;
|
||||
} else {
|
||||
out.printf(" static final String[] aliases_%s = new String[] {%n",
|
||||
out.printf(" static String[] aliases_%s() { return new String[] {%n",
|
||||
cs.clzName);
|
||||
}
|
||||
for (String alias : cs.aliases) {
|
||||
out.printf(" \"%s\",%n", alias);
|
||||
out.printf(" \"%s\",%n", alias);
|
||||
}
|
||||
out.printf(" };%n%n");
|
||||
if (methodEnd) {
|
||||
out.printf(" }%n%n");
|
||||
}
|
||||
out.printf(" };%n%n");
|
||||
}
|
||||
});
|
||||
Charset cs = charsets.get("SJIS");
|
||||
|
@ -51,7 +51,7 @@ public class SRC {
|
||||
} else if (line.indexOf("$ALIASES$") != -1) {
|
||||
if ("sun.nio.cs".equals(pkgName))
|
||||
out.println(line.replace("$ALIASES$",
|
||||
"StandardCharsets.aliases_" + clzName));
|
||||
"StandardCharsets.aliases_" + clzName + "()"));
|
||||
else
|
||||
out.println(line.replace("$ALIASES$",
|
||||
"ExtendedCharsets.aliasesFor(\"" + csName + "\")"));
|
||||
|
@ -42,6 +42,7 @@ import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
import sun.nio.cs.HistoricallyNamedCharset;
|
||||
import sun.nio.cs.ArrayDecoder;
|
||||
import sun.nio.cs.ArrayEncoder;
|
||||
import sun.nio.cs.StandardCharsets;
|
||||
|
||||
import static java.lang.String.LATIN1;
|
||||
import static java.lang.String.UTF16;
|
||||
@ -61,9 +62,9 @@ class StringCoding {
|
||||
private static final ThreadLocal<SoftReference<StringEncoder>> encoder =
|
||||
new ThreadLocal<>();
|
||||
|
||||
private static final Charset ISO_8859_1 = Charset.forName("iso-8859-1");
|
||||
private static final Charset US_ASCII = Charset.forName("us-ascii");
|
||||
private static final Charset UTF_8 = Charset.forName("utf-8");
|
||||
private static final Charset ISO_8859_1 = sun.nio.cs.ISO_8859_1.INSTANCE;
|
||||
private static final Charset US_ASCII = sun.nio.cs.US_ASCII.INSTANCE;
|
||||
private static final Charset UTF_8 = sun.nio.cs.UTF_8.INSTANCE;
|
||||
|
||||
private static boolean warnUnsupportedCharset = true;
|
||||
|
||||
|
@ -37,7 +37,6 @@ import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.CodingErrorAction;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import java.text.Normalizer;
|
||||
import jdk.internal.loader.URLClassPath;
|
||||
import jdk.internal.misc.JavaNetUriAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.nio.cs.ThreadLocalCoders;
|
||||
@ -2528,51 +2527,54 @@ public final class URI
|
||||
// precompiling the mask information so that a character's presence in a
|
||||
// given mask could be determined by a single table lookup.
|
||||
|
||||
// To save startup time, we manually calculate the low-/highMask constants.
|
||||
// For reference, the following methods were used to calculate the values:
|
||||
|
||||
// Compute the low-order mask for the characters in the given string
|
||||
private static long lowMask(String chars) {
|
||||
int n = chars.length();
|
||||
long m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
char c = chars.charAt(i);
|
||||
if (c < 64)
|
||||
m |= (1L << c);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
// private static long lowMask(String chars) {
|
||||
// int n = chars.length();
|
||||
// long m = 0;
|
||||
// for (int i = 0; i < n; i++) {
|
||||
// char c = chars.charAt(i);
|
||||
// if (c < 64)
|
||||
// m |= (1L << c);
|
||||
// }
|
||||
// return m;
|
||||
// }
|
||||
|
||||
// Compute the high-order mask for the characters in the given string
|
||||
private static long highMask(String chars) {
|
||||
int n = chars.length();
|
||||
long m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
char c = chars.charAt(i);
|
||||
if ((c >= 64) && (c < 128))
|
||||
m |= (1L << (c - 64));
|
||||
}
|
||||
return m;
|
||||
}
|
||||
// private static long highMask(String chars) {
|
||||
// int n = chars.length();
|
||||
// long m = 0;
|
||||
// for (int i = 0; i < n; i++) {
|
||||
// char c = chars.charAt(i);
|
||||
// if ((c >= 64) && (c < 128))
|
||||
// m |= (1L << (c - 64));
|
||||
// }
|
||||
// return m;
|
||||
// }
|
||||
|
||||
// Compute a low-order mask for the characters
|
||||
// between first and last, inclusive
|
||||
private static long lowMask(char first, char last) {
|
||||
long m = 0;
|
||||
int f = Math.max(Math.min(first, 63), 0);
|
||||
int l = Math.max(Math.min(last, 63), 0);
|
||||
for (int i = f; i <= l; i++)
|
||||
m |= 1L << i;
|
||||
return m;
|
||||
}
|
||||
// private static long lowMask(char first, char last) {
|
||||
// long m = 0;
|
||||
// int f = Math.max(Math.min(first, 63), 0);
|
||||
// int l = Math.max(Math.min(last, 63), 0);
|
||||
// for (int i = f; i <= l; i++)
|
||||
// m |= 1L << i;
|
||||
// return m;
|
||||
// }
|
||||
|
||||
// Compute a high-order mask for the characters
|
||||
// between first and last, inclusive
|
||||
private static long highMask(char first, char last) {
|
||||
long m = 0;
|
||||
int f = Math.max(Math.min(first, 127), 64) - 64;
|
||||
int l = Math.max(Math.min(last, 127), 64) - 64;
|
||||
for (int i = f; i <= l; i++)
|
||||
m |= 1L << i;
|
||||
return m;
|
||||
}
|
||||
// private static long highMask(char first, char last) {
|
||||
// long m = 0;
|
||||
// int f = Math.max(Math.min(first, 127), 64) - 64;
|
||||
// int l = Math.max(Math.min(last, 127), 64) - 64;
|
||||
// for (int i = f; i <= l; i++)
|
||||
// m |= 1L << i;
|
||||
// return m;
|
||||
// }
|
||||
|
||||
// Tell whether the given character is permitted by the given mask pair
|
||||
private static boolean match(char c, long lowMask, long highMask) {
|
||||
@ -2590,20 +2592,20 @@ public final class URI
|
||||
|
||||
// digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
|
||||
// "8" | "9"
|
||||
private static final long L_DIGIT = lowMask('0', '9');
|
||||
private static final long L_DIGIT = 0x3FF000000000000L; // lowMask('0', '9');
|
||||
private static final long H_DIGIT = 0L;
|
||||
|
||||
// upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" |
|
||||
// "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" |
|
||||
// "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"
|
||||
private static final long L_UPALPHA = 0L;
|
||||
private static final long H_UPALPHA = highMask('A', 'Z');
|
||||
private static final long H_UPALPHA = 0x7FFFFFEL; // highMask('A', 'Z');
|
||||
|
||||
// lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" |
|
||||
// "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" |
|
||||
// "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"
|
||||
private static final long L_LOWALPHA = 0L;
|
||||
private static final long H_LOWALPHA = highMask('a', 'z');
|
||||
private static final long H_LOWALPHA = 0x7FFFFFE00000000L; // highMask('a', 'z');
|
||||
|
||||
// alpha = lowalpha | upalpha
|
||||
private static final long L_ALPHA = L_LOWALPHA | L_UPALPHA;
|
||||
@ -2616,12 +2618,12 @@ public final class URI
|
||||
// hex = digit | "A" | "B" | "C" | "D" | "E" | "F" |
|
||||
// "a" | "b" | "c" | "d" | "e" | "f"
|
||||
private static final long L_HEX = L_DIGIT;
|
||||
private static final long H_HEX = highMask('A', 'F') | highMask('a', 'f');
|
||||
private static final long H_HEX = 0x7E0000007EL; // highMask('A', 'F') | highMask('a', 'f');
|
||||
|
||||
// mark = "-" | "_" | "." | "!" | "~" | "*" | "'" |
|
||||
// "(" | ")"
|
||||
private static final long L_MARK = lowMask("-_.!~*'()");
|
||||
private static final long H_MARK = highMask("-_.!~*'()");
|
||||
private static final long L_MARK = 0x678200000000L; // lowMask("-_.!~*'()");
|
||||
private static final long H_MARK = 0x4000000080000000L; // highMask("-_.!~*'()");
|
||||
|
||||
// unreserved = alphanum | mark
|
||||
private static final long L_UNRESERVED = L_ALPHANUM | L_MARK;
|
||||
@ -2630,8 +2632,8 @@ public final class URI
|
||||
// reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
|
||||
// "$" | "," | "[" | "]"
|
||||
// Added per RFC2732: "[", "]"
|
||||
private static final long L_RESERVED = lowMask(";/?:@&=+$,[]");
|
||||
private static final long H_RESERVED = highMask(";/?:@&=+$,[]");
|
||||
private static final long L_RESERVED = 0xAC00985000000000L; // lowMask(";/?:@&=+$,[]");
|
||||
private static final long H_RESERVED = 0x28000001L; // highMask(";/?:@&=+$,[]");
|
||||
|
||||
// The zero'th bit is used to indicate that escape pairs and non-US-ASCII
|
||||
// characters are allowed; this is handled by the scanEscape method below.
|
||||
@ -2645,60 +2647,58 @@ public final class URI
|
||||
// pchar = unreserved | escaped |
|
||||
// ":" | "@" | "&" | "=" | "+" | "$" | ","
|
||||
private static final long L_PCHAR
|
||||
= L_UNRESERVED | L_ESCAPED | lowMask(":@&=+$,");
|
||||
= L_UNRESERVED | L_ESCAPED | 0x2400185000000000L; // lowMask(":@&=+$,");
|
||||
private static final long H_PCHAR
|
||||
= H_UNRESERVED | H_ESCAPED | highMask(":@&=+$,");
|
||||
= H_UNRESERVED | H_ESCAPED | 0x1L; // highMask(":@&=+$,");
|
||||
|
||||
// All valid path characters
|
||||
private static final long L_PATH = L_PCHAR | lowMask(";/");
|
||||
private static final long H_PATH = H_PCHAR | highMask(";/");
|
||||
private static final long L_PATH = L_PCHAR | 0x800800000000000L; // lowMask(";/");
|
||||
private static final long H_PATH = H_PCHAR; // highMask(";/") == 0x0L;
|
||||
|
||||
// Dash, for use in domainlabel and toplabel
|
||||
private static final long L_DASH = lowMask("-");
|
||||
private static final long H_DASH = highMask("-");
|
||||
private static final long L_DASH = 0x200000000000L; // lowMask("-");
|
||||
private static final long H_DASH = 0x0L; // highMask("-");
|
||||
|
||||
// Dot, for use in hostnames
|
||||
private static final long L_DOT = lowMask(".");
|
||||
private static final long H_DOT = highMask(".");
|
||||
private static final long L_DOT = 0x400000000000L; // lowMask(".");
|
||||
private static final long H_DOT = 0x0L; // highMask(".");
|
||||
|
||||
// userinfo = *( unreserved | escaped |
|
||||
// ";" | ":" | "&" | "=" | "+" | "$" | "," )
|
||||
private static final long L_USERINFO
|
||||
= L_UNRESERVED | L_ESCAPED | lowMask(";:&=+$,");
|
||||
= L_UNRESERVED | L_ESCAPED | 0x2C00185000000000L; // lowMask(";:&=+$,");
|
||||
private static final long H_USERINFO
|
||||
= H_UNRESERVED | H_ESCAPED | highMask(";:&=+$,");
|
||||
= H_UNRESERVED | H_ESCAPED; // | highMask(";:&=+$,") == 0L;
|
||||
|
||||
// reg_name = 1*( unreserved | escaped | "$" | "," |
|
||||
// ";" | ":" | "@" | "&" | "=" | "+" )
|
||||
private static final long L_REG_NAME
|
||||
= L_UNRESERVED | L_ESCAPED | lowMask("$,;:@&=+");
|
||||
= L_UNRESERVED | L_ESCAPED | 0x2C00185000000000L; // lowMask("$,;:@&=+");
|
||||
private static final long H_REG_NAME
|
||||
= H_UNRESERVED | H_ESCAPED | highMask("$,;:@&=+");
|
||||
= H_UNRESERVED | H_ESCAPED | 0x1L; // highMask("$,;:@&=+");
|
||||
|
||||
// All valid characters for server-based authorities
|
||||
private static final long L_SERVER
|
||||
= L_USERINFO | L_ALPHANUM | L_DASH | lowMask(".:@[]");
|
||||
= L_USERINFO | L_ALPHANUM | L_DASH | 0x400400000000000L; // lowMask(".:@[]");
|
||||
private static final long H_SERVER
|
||||
= H_USERINFO | H_ALPHANUM | H_DASH | highMask(".:@[]");
|
||||
= H_USERINFO | H_ALPHANUM | H_DASH | 0x28000001L; // highMask(".:@[]");
|
||||
|
||||
// Special case of server authority that represents an IPv6 address
|
||||
// In this case, a % does not signify an escape sequence
|
||||
private static final long L_SERVER_PERCENT
|
||||
= L_SERVER | lowMask("%");
|
||||
= L_SERVER | 0x2000000000L; // lowMask("%");
|
||||
private static final long H_SERVER_PERCENT
|
||||
= H_SERVER | highMask("%");
|
||||
private static final long L_LEFT_BRACKET = lowMask("[");
|
||||
private static final long H_LEFT_BRACKET = highMask("[");
|
||||
= H_SERVER; // | highMask("%") == 0L;
|
||||
|
||||
// scheme = alpha *( alpha | digit | "+" | "-" | "." )
|
||||
private static final long L_SCHEME = L_ALPHA | L_DIGIT | lowMask("+-.");
|
||||
private static final long H_SCHEME = H_ALPHA | H_DIGIT | highMask("+-.");
|
||||
private static final long L_SCHEME = L_ALPHA | L_DIGIT | 0x680000000000L; // lowMask("+-.");
|
||||
private static final long H_SCHEME = H_ALPHA | H_DIGIT; // | highMask("+-.") == 0L
|
||||
|
||||
// scope_id = alpha | digit | "_" | "."
|
||||
private static final long L_SCOPE_ID
|
||||
= L_ALPHANUM | lowMask("_.");
|
||||
= L_ALPHANUM | 0x400000000000L; // lowMask("_.");
|
||||
private static final long H_SCOPE_ID
|
||||
= H_ALPHANUM | highMask("_.");
|
||||
= H_ALPHANUM | 0x80000000L; // highMask("_.");
|
||||
|
||||
// -- Escaping and encoding --
|
||||
|
||||
|
@ -609,7 +609,7 @@ public abstract class Charset
|
||||
if (cs != null)
|
||||
defaultCharset = cs;
|
||||
else
|
||||
defaultCharset = forName("UTF-8");
|
||||
defaultCharset = sun.nio.cs.UTF_8.INSTANCE;
|
||||
}
|
||||
}
|
||||
return defaultCharset;
|
||||
@ -639,11 +639,10 @@ public abstract class Charset
|
||||
String[] as = Objects.requireNonNullElse(aliases, zeroAliases);
|
||||
|
||||
// Skip checks for the standard, built-in Charsets we always load
|
||||
// during initialization. Use of identity is intentional to be
|
||||
// consistent with sun.nio.cs.StandardCharsets
|
||||
if (canonicalName != StandardCharsets.ISO_8859_1
|
||||
&& canonicalName != StandardCharsets.US_ASCII
|
||||
&& canonicalName != StandardCharsets.UTF_8) {
|
||||
// during initialization.
|
||||
if (canonicalName != "ISO-8859-1"
|
||||
&& canonicalName != "US-ASCII"
|
||||
&& canonicalName != "UTF-8") {
|
||||
checkName(canonicalName);
|
||||
for (int i = 0; i < as.length; i++) {
|
||||
checkName(as[i]);
|
||||
|
@ -41,15 +41,15 @@ public final class StandardCharsets {
|
||||
* Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the
|
||||
* Unicode character set
|
||||
*/
|
||||
public static final Charset US_ASCII = Charset.forName("US-ASCII");
|
||||
public static final Charset US_ASCII = sun.nio.cs.US_ASCII.INSTANCE;
|
||||
/**
|
||||
* ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
|
||||
*/
|
||||
public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
|
||||
public static final Charset ISO_8859_1 = sun.nio.cs.ISO_8859_1.INSTANCE;
|
||||
/**
|
||||
* Eight-bit UCS Transformation Format
|
||||
*/
|
||||
public static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||
public static final Charset UTF_8 = sun.nio.cs.UTF_8.INSTANCE;
|
||||
/**
|
||||
* Sixteen-bit UCS Transformation Format, big-endian byte order
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ import sun.util.locale.provider.LocaleServiceProviderPool;
|
||||
* comparisons. Four strengths are provided: <code>PRIMARY</code>,
|
||||
* <code>SECONDARY</code>, <code>TERTIARY</code>, and <code>IDENTICAL</code>.
|
||||
* The exact assignment of strengths to language features is
|
||||
* locale dependant. For example, in Czech, "e" and "f" are considered
|
||||
* locale dependent. For example, in Czech, "e" and "f" are considered
|
||||
* primary differences, while "e" and "ě" are secondary differences,
|
||||
* "e" and "E" are tertiary differences and "e" and "e" are identical.
|
||||
* The following shows how both case and accents could be ignored for
|
||||
@ -132,7 +132,7 @@ public abstract class Collator
|
||||
/**
|
||||
* Collator strength value. When set, only PRIMARY differences are
|
||||
* considered significant during comparison. The assignment of strengths
|
||||
* to language features is locale dependant. A common example is for
|
||||
* to language features is locale dependent. A common example is for
|
||||
* different base letters ("a" vs "b") to be considered a PRIMARY difference.
|
||||
* @see java.text.Collator#setStrength
|
||||
* @see java.text.Collator#getStrength
|
||||
@ -141,7 +141,7 @@ public abstract class Collator
|
||||
/**
|
||||
* Collator strength value. When set, only SECONDARY and above differences are
|
||||
* considered significant during comparison. The assignment of strengths
|
||||
* to language features is locale dependant. A common example is for
|
||||
* to language features is locale dependent. A common example is for
|
||||
* different accented forms of the same base letter ("a" vs "\u00E4") to be
|
||||
* considered a SECONDARY difference.
|
||||
* @see java.text.Collator#setStrength
|
||||
@ -151,7 +151,7 @@ public abstract class Collator
|
||||
/**
|
||||
* Collator strength value. When set, only TERTIARY and above differences are
|
||||
* considered significant during comparison. The assignment of strengths
|
||||
* to language features is locale dependant. A common example is for
|
||||
* to language features is locale dependent. A common example is for
|
||||
* case differences ("a" vs "A") to be considered a TERTIARY difference.
|
||||
* @see java.text.Collator#setStrength
|
||||
* @see java.text.Collator#getStrength
|
||||
@ -161,7 +161,7 @@ public abstract class Collator
|
||||
/**
|
||||
* Collator strength value. When set, all differences are
|
||||
* considered significant during comparison. The assignment of strengths
|
||||
* to language features is locale dependant. A common example is for control
|
||||
* to language features is locale dependent. A common example is for control
|
||||
* characters ("\u0001" vs "\u0002") to be considered equal at the
|
||||
* PRIMARY, SECONDARY, and TERTIARY levels but different at the IDENTICAL
|
||||
* level. Additionally, differences between pre-composed accents such as
|
||||
|
@ -412,7 +412,7 @@ public abstract class NumberFormat extends Format {
|
||||
* For example in the English locale, with ParseIntegerOnly true, the
|
||||
* string "1234." would be parsed as the integer value 1234 and parsing
|
||||
* would stop at the "." character. Of course, the exact format accepted
|
||||
* by the parse operation is locale dependant and determined by sub-classes
|
||||
* by the parse operation is locale dependent and determined by sub-classes
|
||||
* of NumberFormat.
|
||||
*
|
||||
* @return {@code true} if numbers should be parsed as integers only;
|
||||
@ -657,7 +657,7 @@ public abstract class NumberFormat extends Format {
|
||||
* Returns true if grouping is used in this format. For example, in the
|
||||
* English locale, with grouping on, the number 1234567 might be formatted
|
||||
* as "1,234,567". The grouping separator as well as the size of each group
|
||||
* is locale dependant and is determined by sub-classes of NumberFormat.
|
||||
* is locale dependent and is determined by sub-classes of NumberFormat.
|
||||
*
|
||||
* @return {@code true} if grouping is used;
|
||||
* {@code false} otherwise
|
||||
|
@ -137,9 +137,10 @@ public abstract class AbstractResourceBundleProvider implements ResourceBundlePr
|
||||
*
|
||||
* <p>For example, if {@code baseName} is {@code "p.resources.Bundle"} then
|
||||
* the resource bundle name of {@code "p.resources.Bundle"} of
|
||||
* {@code Locale("ja", "", "XX")} and {@code Locale("en")}
|
||||
* could be {@code "p.resources.ja.Bundle_ja_ _XX"} and
|
||||
* {@code p.resources.Bundle_en"} respectively
|
||||
* <code style="white-space:nowrap">Locale("ja", "", "XX")</code>
|
||||
* and {@code Locale("en")} could be <code style="white-space:nowrap">
|
||||
* "p.resources.ja.Bundle_ja_ _XX"</code> and
|
||||
* {@code "p.resources.Bundle_en"} respectively.
|
||||
*
|
||||
* <p> This method is called from the default implementation of the
|
||||
* {@link #getBundle(String, Locale)} method.
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package sun.net.www;
|
||||
|
||||
import java.util.BitSet;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.net.MalformedURLException;
|
||||
@ -34,6 +33,7 @@ import java.net.URISyntaxException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
|
||||
import sun.nio.cs.ThreadLocalCoders;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
@ -45,43 +45,6 @@ import java.nio.charset.CodingErrorAction;
|
||||
*/
|
||||
|
||||
public class ParseUtil {
|
||||
static BitSet encodedInPath;
|
||||
|
||||
static {
|
||||
encodedInPath = new BitSet(128);
|
||||
|
||||
// Set the bits corresponding to characters that are encoded in the
|
||||
// path component of a URI.
|
||||
|
||||
// These characters are reserved in the path segment as described in
|
||||
// RFC2396 section 3.3.
|
||||
encodedInPath.set('=');
|
||||
encodedInPath.set(';');
|
||||
encodedInPath.set('?');
|
||||
encodedInPath.set('/');
|
||||
|
||||
// These characters are defined as excluded in RFC2396 section 2.4.3
|
||||
// and must be escaped if they occur in the data part of a URI.
|
||||
encodedInPath.set('#');
|
||||
encodedInPath.set(' ');
|
||||
encodedInPath.set('<');
|
||||
encodedInPath.set('>');
|
||||
encodedInPath.set('%');
|
||||
encodedInPath.set('"');
|
||||
encodedInPath.set('{');
|
||||
encodedInPath.set('}');
|
||||
encodedInPath.set('|');
|
||||
encodedInPath.set('\\');
|
||||
encodedInPath.set('^');
|
||||
encodedInPath.set('[');
|
||||
encodedInPath.set(']');
|
||||
encodedInPath.set('`');
|
||||
|
||||
// US ASCII control characters 00-1F and 7F.
|
||||
for (int i=0; i<32; i++)
|
||||
encodedInPath.set(i);
|
||||
encodedInPath.set(127);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an encoded version of the specified path string suitable
|
||||
@ -122,7 +85,7 @@ public class ParseUtil {
|
||||
c >= 'A' && c <= 'Z' ||
|
||||
c >= '0' && c <= '9') {
|
||||
continue;
|
||||
} else if (c > 0x007F || encodedInPath.get(c)) {
|
||||
} else if (c > 0x007F || match(c, L_ENCODED, H_ENCODED)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -147,7 +110,7 @@ public class ParseUtil {
|
||||
c >= 'A' && c <= 'Z' ||
|
||||
c >= '0' && c <= '9') {
|
||||
retCC[retLen++] = c;
|
||||
} else if (encodedInPath.get(c)) {
|
||||
} else if (match(c, L_ENCODED, H_ENCODED)) {
|
||||
retLen = escape(retCC, c, retLen);
|
||||
} else {
|
||||
retCC[retLen++] = c;
|
||||
@ -570,76 +533,79 @@ public class ParseUtil {
|
||||
|
||||
// -- Character classes for parsing --
|
||||
|
||||
// To save startup time, we manually calculate the low-/highMask constants.
|
||||
// For reference, the following methods were used to calculate the values:
|
||||
|
||||
// Compute a low-order mask for the characters
|
||||
// between first and last, inclusive
|
||||
private static long lowMask(char first, char last) {
|
||||
long m = 0;
|
||||
int f = Math.max(Math.min(first, 63), 0);
|
||||
int l = Math.max(Math.min(last, 63), 0);
|
||||
for (int i = f; i <= l; i++)
|
||||
m |= 1L << i;
|
||||
return m;
|
||||
}
|
||||
// private static long lowMask(char first, char last) {
|
||||
// long m = 0;
|
||||
// int f = Math.max(Math.min(first, 63), 0);
|
||||
// int l = Math.max(Math.min(last, 63), 0);
|
||||
// for (int i = f; i <= l; i++)
|
||||
// m |= 1L << i;
|
||||
// return m;
|
||||
// }
|
||||
|
||||
// Compute the low-order mask for the characters in the given string
|
||||
private static long lowMask(String chars) {
|
||||
int n = chars.length();
|
||||
long m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
char c = chars.charAt(i);
|
||||
if (c < 64)
|
||||
m |= (1L << c);
|
||||
}
|
||||
return m;
|
||||
}
|
||||
// private static long lowMask(String chars) {
|
||||
// int n = chars.length();
|
||||
// long m = 0;
|
||||
// for (int i = 0; i < n; i++) {
|
||||
// char c = chars.charAt(i);
|
||||
// if (c < 64)
|
||||
// m |= (1L << c);
|
||||
// }
|
||||
// return m;
|
||||
// }
|
||||
|
||||
// Compute a high-order mask for the characters
|
||||
// between first and last, inclusive
|
||||
private static long highMask(char first, char last) {
|
||||
long m = 0;
|
||||
int f = Math.max(Math.min(first, 127), 64) - 64;
|
||||
int l = Math.max(Math.min(last, 127), 64) - 64;
|
||||
for (int i = f; i <= l; i++)
|
||||
m |= 1L << i;
|
||||
return m;
|
||||
}
|
||||
// private static long highMask(char first, char last) {
|
||||
// long m = 0;
|
||||
// int f = Math.max(Math.min(first, 127), 64) - 64;
|
||||
// int l = Math.max(Math.min(last, 127), 64) - 64;
|
||||
// for (int i = f; i <= l; i++)
|
||||
// m |= 1L << i;
|
||||
// return m;
|
||||
// }
|
||||
|
||||
// Compute the high-order mask for the characters in the given string
|
||||
private static long highMask(String chars) {
|
||||
int n = chars.length();
|
||||
long m = 0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
char c = chars.charAt(i);
|
||||
if ((c >= 64) && (c < 128))
|
||||
m |= (1L << (c - 64));
|
||||
}
|
||||
return m;
|
||||
}
|
||||
// private static long highMask(String chars) {
|
||||
// int n = chars.length();
|
||||
// long m = 0;
|
||||
// for (int i = 0; i < n; i++) {
|
||||
// char c = chars.charAt(i);
|
||||
// if ((c >= 64) && (c < 128))
|
||||
// m |= (1L << (c - 64));
|
||||
// }
|
||||
// return m;
|
||||
// }
|
||||
|
||||
|
||||
// Character-class masks
|
||||
|
||||
// digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
|
||||
// "8" | "9"
|
||||
private static final long L_DIGIT = lowMask('0', '9');
|
||||
private static final long L_DIGIT = 0x3FF000000000000L; // lowMask('0', '9');
|
||||
private static final long H_DIGIT = 0L;
|
||||
|
||||
// hex = digit | "A" | "B" | "C" | "D" | "E" | "F" |
|
||||
// "a" | "b" | "c" | "d" | "e" | "f"
|
||||
private static final long L_HEX = L_DIGIT;
|
||||
private static final long H_HEX = highMask('A', 'F') | highMask('a', 'f');
|
||||
private static final long H_HEX = 0x7E0000007EL; // highMask('A', 'F') | highMask('a', 'f');
|
||||
|
||||
// upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" |
|
||||
// "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" |
|
||||
// "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"
|
||||
private static final long L_UPALPHA = 0L;
|
||||
private static final long H_UPALPHA = highMask('A', 'Z');
|
||||
private static final long H_UPALPHA = 0x7FFFFFEL; // highMask('A', 'Z');
|
||||
|
||||
// lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" |
|
||||
// "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" |
|
||||
// "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"
|
||||
private static final long L_LOWALPHA = 0L;
|
||||
private static final long H_LOWALPHA = highMask('a', 'z');
|
||||
private static final long H_LOWALPHA = 0x7FFFFFE00000000L; // highMask('a', 'z');
|
||||
|
||||
// alpha = lowalpha | upalpha
|
||||
private static final long L_ALPHA = L_LOWALPHA | L_UPALPHA;
|
||||
@ -651,8 +617,8 @@ public class ParseUtil {
|
||||
|
||||
// mark = "-" | "_" | "." | "!" | "~" | "*" | "'" |
|
||||
// "(" | ")"
|
||||
private static final long L_MARK = lowMask("-_.!~*'()");
|
||||
private static final long H_MARK = highMask("-_.!~*'()");
|
||||
private static final long L_MARK = 0x678200000000L; // lowMask("-_.!~*'()");
|
||||
private static final long H_MARK = 0x4000000080000000L; // highMask("-_.!~*'()");
|
||||
|
||||
// unreserved = alphanum | mark
|
||||
private static final long L_UNRESERVED = L_ALPHANUM | L_MARK;
|
||||
@ -661,18 +627,14 @@ public class ParseUtil {
|
||||
// reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
|
||||
// "$" | "," | "[" | "]"
|
||||
// Added per RFC2732: "[", "]"
|
||||
private static final long L_RESERVED = lowMask(";/?:@&=+$,[]");
|
||||
private static final long H_RESERVED = highMask(";/?:@&=+$,[]");
|
||||
private static final long L_RESERVED = 0xAC00985000000000L; // lowMask(";/?:@&=+$,[]");
|
||||
private static final long H_RESERVED = 0x28000001L; // highMask(";/?:@&=+$,[]");
|
||||
|
||||
// The zero'th bit is used to indicate that escape pairs and non-US-ASCII
|
||||
// characters are allowed; this is handled by the scanEscape method below.
|
||||
private static final long L_ESCAPED = 1L;
|
||||
private static final long H_ESCAPED = 0L;
|
||||
|
||||
// Dash, for use in domainlabel and toplabel
|
||||
private static final long L_DASH = lowMask("-");
|
||||
private static final long H_DASH = highMask("-");
|
||||
|
||||
// uric = reserved | unreserved | escaped
|
||||
private static final long L_URIC = L_RESERVED | L_UNRESERVED | L_ESCAPED;
|
||||
private static final long H_URIC = H_RESERVED | H_UNRESERVED | H_ESCAPED;
|
||||
@ -680,31 +642,55 @@ public class ParseUtil {
|
||||
// pchar = unreserved | escaped |
|
||||
// ":" | "@" | "&" | "=" | "+" | "$" | ","
|
||||
private static final long L_PCHAR
|
||||
= L_UNRESERVED | L_ESCAPED | lowMask(":@&=+$,");
|
||||
= L_UNRESERVED | L_ESCAPED | 0x2400185000000000L; // lowMask(":@&=+$,");
|
||||
private static final long H_PCHAR
|
||||
= H_UNRESERVED | H_ESCAPED | highMask(":@&=+$,");
|
||||
= H_UNRESERVED | H_ESCAPED | 0x1L; // highMask(":@&=+$,");
|
||||
|
||||
// All valid path characters
|
||||
private static final long L_PATH = L_PCHAR | lowMask(";/");
|
||||
private static final long H_PATH = H_PCHAR | highMask(";/");
|
||||
private static final long L_PATH = L_PCHAR | 0x800800000000000L; // lowMask(";/");
|
||||
private static final long H_PATH = H_PCHAR; // highMask(";/") == 0x0L;
|
||||
|
||||
// Dash, for use in domainlabel and toplabel
|
||||
private static final long L_DASH = 0x200000000000L; // lowMask("-");
|
||||
private static final long H_DASH = 0x0L; // highMask("-");
|
||||
|
||||
// userinfo = *( unreserved | escaped |
|
||||
// ";" | ":" | "&" | "=" | "+" | "$" | "," )
|
||||
private static final long L_USERINFO
|
||||
= L_UNRESERVED | L_ESCAPED | lowMask(";:&=+$,");
|
||||
= L_UNRESERVED | L_ESCAPED | 0x2C00185000000000L; // lowMask(";:&=+$,");
|
||||
private static final long H_USERINFO
|
||||
= H_UNRESERVED | H_ESCAPED | highMask(";:&=+$,");
|
||||
= H_UNRESERVED | H_ESCAPED; // | highMask(";:&=+$,") == 0L;
|
||||
|
||||
// reg_name = 1*( unreserved | escaped | "$" | "," |
|
||||
// ";" | ":" | "@" | "&" | "=" | "+" )
|
||||
private static final long L_REG_NAME
|
||||
= L_UNRESERVED | L_ESCAPED | lowMask("$,;:@&=+");
|
||||
= L_UNRESERVED | L_ESCAPED | 0x2C00185000000000L; // lowMask("$,;:@&=+");
|
||||
private static final long H_REG_NAME
|
||||
= H_UNRESERVED | H_ESCAPED | highMask("$,;:@&=+");
|
||||
= H_UNRESERVED | H_ESCAPED | 0x1L; // highMask("$,;:@&=+");
|
||||
|
||||
// All valid characters for server-based authorities
|
||||
private static final long L_SERVER
|
||||
= L_USERINFO | L_ALPHANUM | L_DASH | lowMask(".:@[]");
|
||||
= L_USERINFO | L_ALPHANUM | L_DASH | 0x400400000000000L; // lowMask(".:@[]");
|
||||
private static final long H_SERVER
|
||||
= H_USERINFO | H_ALPHANUM | H_DASH | highMask(".:@[]");
|
||||
= H_USERINFO | H_ALPHANUM | H_DASH | 0x28000001L; // highMask(".:@[]");
|
||||
|
||||
// Characters that are encoded in the path component of a URI.
|
||||
//
|
||||
// These characters are reserved in the path segment as described in
|
||||
// RFC2396 section 3.3:
|
||||
// "=" | ";" | "?" | "/"
|
||||
//
|
||||
// These characters are defined as excluded in RFC2396 section 2.4.3
|
||||
// and must be escaped if they occur in the data part of a URI:
|
||||
// "#" | " " | "<" | ">" | "%" | "\"" | "{" | "}" | "|" | "\\" | "^" |
|
||||
// "[" | "]" | "`"
|
||||
//
|
||||
// Also US ASCII control characters 00-1F and 7F.
|
||||
|
||||
// lowMask((char)0, (char)31) | lowMask("=;?/# <>%\"{}|\\^[]`");
|
||||
private static final long L_ENCODED = 0xF800802DFFFFFFFFL;
|
||||
|
||||
// highMask((char)0x7F, (char)0x7F) | highMask("=;?/# <>%\"{}|\\^[]`");
|
||||
private static final long H_ENCODED = 0xB800000178000000L;
|
||||
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ public class Net {
|
||||
|
||||
/**
|
||||
* Event masks for the various poll system calls.
|
||||
* They will be set platform dependant in the static initializer below.
|
||||
* They will be set platform dependent in the static initializer below.
|
||||
*/
|
||||
public static final short POLLIN;
|
||||
public static final short POLLOUT;
|
||||
|
@ -52,7 +52,7 @@ import java.nio.charset.CodingErrorAction;
|
||||
class CESU_8 extends Unicode
|
||||
{
|
||||
public CESU_8() {
|
||||
super("CESU-8", StandardCharsets.aliases_CESU_8);
|
||||
super("CESU-8", StandardCharsets.aliases_CESU_8());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -31,18 +31,19 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
|
||||
class ISO_8859_1
|
||||
public class ISO_8859_1
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
|
||||
public static final ISO_8859_1 INSTANCE = new ISO_8859_1();
|
||||
|
||||
public ISO_8859_1() {
|
||||
super(StandardCharsets.ISO_8859_1, StandardCharsets.aliases_ISO_8859_1);
|
||||
super("ISO-8859-1", StandardCharsets.aliases_ISO_8859_1());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -33,6 +33,8 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.spi.CharsetProvider;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
public class StandardCharsets extends CharsetProvider {
|
||||
@ -43,31 +45,52 @@ public class StandardCharsets extends CharsetProvider {
|
||||
_INCLUDE_CACHE_MAP_
|
||||
|
||||
// Maps canonical names to class names
|
||||
private final Map<String,String> classMap;
|
||||
private @Stable Map<String,String> classMap;
|
||||
|
||||
// Maps alias names to canonical names
|
||||
private final Map<String,String> aliasMap;
|
||||
private @Stable Map<String,String> aliasMap;
|
||||
|
||||
// Maps canonical names to cached instances
|
||||
private final Map<String,Charset> cache;
|
||||
private @Stable Map<String,Charset> cache;
|
||||
|
||||
private static final String packagePrefix = "sun.nio.cs";
|
||||
|
||||
public static final String US_ASCII = "US-ASCII";
|
||||
|
||||
public static final String ISO_8859_1 = "ISO-8859-1";
|
||||
|
||||
public static final String UTF_8 = "UTF-8";
|
||||
private static final String packagePrefix = "sun.nio.cs.";
|
||||
|
||||
public StandardCharsets() {
|
||||
this.aliasMap = new Aliases();
|
||||
this.classMap = new Classes();
|
||||
this.cache = new Cache();
|
||||
}
|
||||
|
||||
private String canonicalize(String csn) {
|
||||
String acn = aliasMap.get(csn);
|
||||
String acn = aliasMap().get(csn);
|
||||
return (acn != null) ? acn : csn;
|
||||
}
|
||||
|
||||
private Map<String,String> aliasMap() {
|
||||
Map<String,String> map = aliasMap;
|
||||
if (map == null) {
|
||||
aliasMap = map = new Aliases();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map<String,String> classMap() {
|
||||
Map<String,String> map = classMap;
|
||||
if (map == null) {
|
||||
classMap = map = new Classes();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private Map<String,Charset> cache() {
|
||||
Map<String,Charset> map = cache;
|
||||
if (map == null) {
|
||||
map = new Cache();
|
||||
map.put("utf-8", UTF_8.INSTANCE);
|
||||
map.put("iso-8859-1", ISO_8859_1.INSTANCE);
|
||||
map.put("us-ascii", US_ASCII.INSTANCE);
|
||||
cache = map;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// Private ASCII-only version, optimized for interpretation during startup
|
||||
//
|
||||
private static String toLower(String s) {
|
||||
@ -82,47 +105,47 @@ public class StandardCharsets extends CharsetProvider {
|
||||
}
|
||||
if (allLower)
|
||||
return s;
|
||||
char[] ca = new char[n];
|
||||
StringBuilder sb = new StringBuilder(n);
|
||||
for (int i = 0; i < n; i++) {
|
||||
int c = s.charAt(i);
|
||||
if (((c - 'A') | ('Z' - c)) >= 0)
|
||||
ca[i] = (char)(c + 0x20);
|
||||
sb.append((char)(c + 0x20));
|
||||
else
|
||||
ca[i] = (char)c;
|
||||
sb.append((char)c);
|
||||
}
|
||||
return new String(ca);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private Charset lookup(String charsetName) {
|
||||
init();
|
||||
String csn = canonicalize(toLower(charsetName));
|
||||
|
||||
// By checking these built-ins we can avoid initializing Aliases and
|
||||
// Classes eagerly during bootstrap
|
||||
String csn;
|
||||
if (charsetName.equals("UTF-8")) {
|
||||
return UTF_8.INSTANCE;
|
||||
} else if (charsetName.equals("US-ASCII")) {
|
||||
return US_ASCII.INSTANCE;
|
||||
} else if (charsetName.equals("ISO-8859-1")) {
|
||||
return ISO_8859_1.INSTANCE;
|
||||
} else {
|
||||
csn = canonicalize(toLower(charsetName));
|
||||
}
|
||||
|
||||
// Check cache first
|
||||
Charset cs = cache.get(csn);
|
||||
Charset cs = cache().get(csn);
|
||||
if (cs != null)
|
||||
return cs;
|
||||
|
||||
// Do we even support this charset?
|
||||
String cln = classMap.get(csn);
|
||||
String cln = classMap().get(csn);
|
||||
if (cln == null)
|
||||
return null;
|
||||
|
||||
// As all charset class names added to classMap are string literals we
|
||||
// can check identity here as an optimization
|
||||
if (cln == US_ASCII) {
|
||||
return cache(csn, new US_ASCII());
|
||||
}
|
||||
if (cln == ISO_8859_1) {
|
||||
return cache(csn, new ISO_8859_1());
|
||||
}
|
||||
if (cln == UTF_8) {
|
||||
return cache(csn, new UTF_8());
|
||||
}
|
||||
|
||||
// Instantiate the charset and cache it
|
||||
try {
|
||||
@SuppressWarnings("deprecation")
|
||||
Object o = Class.forName(packagePrefix + "." + cln,
|
||||
Object o = Class.forName(packagePrefix + cln,
|
||||
true,
|
||||
this.getClass().getClassLoader()).newInstance();
|
||||
return cache(csn, (Charset)o);
|
||||
@ -134,23 +157,28 @@ public class StandardCharsets extends CharsetProvider {
|
||||
}
|
||||
|
||||
private Charset cache(String csn, Charset cs) {
|
||||
cache.put(csn, cs);
|
||||
cache().put(csn, cs);
|
||||
return cs;
|
||||
}
|
||||
|
||||
public final Charset charsetForName(String charsetName) {
|
||||
synchronized (this) {
|
||||
return lookup(canonicalize(charsetName));
|
||||
return lookup(charsetName);
|
||||
}
|
||||
}
|
||||
|
||||
public final Iterator<Charset> charsets() {
|
||||
Set<String> charsetNames;
|
||||
synchronized (this) {
|
||||
init();
|
||||
// Ensure initialized in synchronized block
|
||||
charsetNames = classMap().keySet();
|
||||
aliasMap();
|
||||
cache();
|
||||
}
|
||||
return new Iterator<Charset>() {
|
||||
|
||||
Iterator<String> i = classMap.keySet().iterator();
|
||||
Iterator<String> i = charsetNames.iterator();
|
||||
|
||||
public boolean hasNext() {
|
||||
return i.hasNext();
|
||||
@ -181,6 +209,8 @@ public class StandardCharsets extends CharsetProvider {
|
||||
|
||||
String map = GetPropertyAction.privilegedGetProperty("sun.nio.cs.map");
|
||||
if (map != null) {
|
||||
Map<String,String> aliasMap = aliasMap();
|
||||
Map<String,String> classMap = classMap();
|
||||
String[] maps = map.split(",");
|
||||
for (int i = 0; i < maps.length; i++) {
|
||||
if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) {
|
||||
@ -207,7 +237,7 @@ public class StandardCharsets extends CharsetProvider {
|
||||
for (String alias : aliases_MS932) {
|
||||
aliasMap.put(toLower(alias), "windows-31j");
|
||||
}
|
||||
cache.put("shift_jis", null);
|
||||
cache().put("shift_jis", null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,10 @@ public class US_ASCII
|
||||
extends Charset
|
||||
implements HistoricallyNamedCharset
|
||||
{
|
||||
public static final US_ASCII INSTANCE = new US_ASCII();
|
||||
|
||||
public US_ASCII() {
|
||||
super(StandardCharsets.US_ASCII, StandardCharsets.aliases_US_ASCII);
|
||||
super("US-ASCII", StandardCharsets.aliases_US_ASCII());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -33,7 +33,7 @@ class UTF_16 extends Unicode
|
||||
{
|
||||
|
||||
public UTF_16() {
|
||||
super("UTF-16", StandardCharsets.aliases_UTF_16);
|
||||
super("UTF-16", StandardCharsets.aliases_UTF_16());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -33,7 +33,7 @@ class UTF_16BE extends Unicode
|
||||
{
|
||||
|
||||
public UTF_16BE() {
|
||||
super("UTF-16BE", StandardCharsets.aliases_UTF_16BE);
|
||||
super("UTF-16BE", StandardCharsets.aliases_UTF_16BE());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -33,7 +33,7 @@ class UTF_16LE extends Unicode
|
||||
{
|
||||
|
||||
public UTF_16LE() {
|
||||
super("UTF-16LE", StandardCharsets.aliases_UTF_16LE);
|
||||
super("UTF-16LE", StandardCharsets.aliases_UTF_16LE());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -33,7 +33,7 @@ class UTF_16LE_BOM extends Unicode
|
||||
{
|
||||
|
||||
public UTF_16LE_BOM() {
|
||||
super("x-UTF-16LE-BOM", StandardCharsets.aliases_UTF_16LE_BOM);
|
||||
super("x-UTF-16LE-BOM", StandardCharsets.aliases_UTF_16LE_BOM());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -31,7 +31,7 @@ import java.nio.charset.CharsetEncoder;
|
||||
public class UTF_32 extends Unicode
|
||||
{
|
||||
public UTF_32() {
|
||||
super("UTF-32", StandardCharsets.aliases_UTF_32);
|
||||
super("UTF-32", StandardCharsets.aliases_UTF_32());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -31,7 +31,7 @@ import java.nio.charset.CharsetEncoder;
|
||||
public class UTF_32BE extends Unicode
|
||||
{
|
||||
public UTF_32BE() {
|
||||
super("UTF-32BE", StandardCharsets.aliases_UTF_32BE);
|
||||
super("UTF-32BE", StandardCharsets.aliases_UTF_32BE());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -31,7 +31,7 @@ import java.nio.charset.CharsetEncoder;
|
||||
public class UTF_32BE_BOM extends Unicode
|
||||
{
|
||||
public UTF_32BE_BOM() {
|
||||
super("X-UTF-32BE-BOM", StandardCharsets.aliases_UTF_32BE_BOM);
|
||||
super("X-UTF-32BE-BOM", StandardCharsets.aliases_UTF_32BE_BOM());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -32,7 +32,7 @@ import java.nio.charset.CharsetEncoder;
|
||||
public class UTF_32LE extends Unicode
|
||||
{
|
||||
public UTF_32LE() {
|
||||
super("UTF-32LE", StandardCharsets.aliases_UTF_32LE);
|
||||
super("UTF-32LE", StandardCharsets.aliases_UTF_32LE());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -31,7 +31,7 @@ import java.nio.charset.CharsetEncoder;
|
||||
public class UTF_32LE_BOM extends Unicode
|
||||
{
|
||||
public UTF_32LE_BOM() {
|
||||
super("X-UTF-32LE-BOM", StandardCharsets.aliases_UTF_32LE_BOM);
|
||||
super("X-UTF-32LE-BOM", StandardCharsets.aliases_UTF_32LE_BOM());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
|
@ -54,10 +54,12 @@ import java.nio.charset.CodingErrorAction;
|
||||
*
|
||||
*/
|
||||
|
||||
class UTF_8 extends Unicode
|
||||
{
|
||||
public final class UTF_8 extends Unicode {
|
||||
|
||||
public static final UTF_8 INSTANCE = new UTF_8();
|
||||
|
||||
public UTF_8() {
|
||||
super(StandardCharsets.UTF_8, StandardCharsets.aliases_UTF_8);
|
||||
super("UTF-8", StandardCharsets.aliases_UTF_8());
|
||||
}
|
||||
|
||||
public String historicalName() {
|
||||
@ -72,7 +74,7 @@ class UTF_8 extends Unicode
|
||||
return new Encoder(this);
|
||||
}
|
||||
|
||||
private static final void updatePositions(Buffer src, int sp,
|
||||
static final void updatePositions(Buffer src, int sp,
|
||||
Buffer dst, int dp) {
|
||||
src.position(sp - src.arrayOffset());
|
||||
dst.position(dp - dst.arrayOffset());
|
||||
|
@ -87,9 +87,15 @@ public class CalendarNameProviderImpl extends CalendarNameProvider implements Av
|
||||
Era[] jeras = CalendarSystem.forName("japanese").getEras();
|
||||
if (jeras.length == value) {
|
||||
Era supEra = jeras[value - 1]; // 0-based index
|
||||
return style == LONG ?
|
||||
supEra.getName() :
|
||||
supEra.getAbbreviation();
|
||||
if (javatime) {
|
||||
return getBaseStyle(style) == NARROW_FORMAT ?
|
||||
supEra.getAbbreviation() :
|
||||
supEra.getName();
|
||||
} else {
|
||||
return (style & LONG) != 0 ?
|
||||
supEra.getName() :
|
||||
supEra.getAbbreviation();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -192,7 +192,7 @@ SplashInitPlatform(Splash * splash) {
|
||||
|
||||
|
||||
//TODO: the following is too much of a hack but should work in 90% cases.
|
||||
// besides we don't use device-dependant drawing, so probably
|
||||
// besides we don't use device-dependent drawing, so probably
|
||||
// that's very fine indeed
|
||||
splash->byteAlignment = 1;
|
||||
initFormat(&splash->screenFormat, 0xff << 8,
|
||||
|
@ -424,7 +424,7 @@ public class EventQueue {
|
||||
|
||||
/*
|
||||
* Should avoid of calling this method by any means
|
||||
* as it's working time is dependant on EQ length.
|
||||
* as it's working time is dependent on EQ length.
|
||||
* In the worst case this method alone can slow down the entire application
|
||||
* 10 times by stalling the Event processing.
|
||||
* Only here by backward compatibility reasons.
|
||||
|
@ -45,7 +45,7 @@ import java.util.List;
|
||||
* exit cleanly. Implicit opening is done by calling
|
||||
* {@link MidiSystem#getReceiver} and {@link MidiSystem#getTransmitter}. The
|
||||
* {@code MidiDevice} used by {@code MidiSystem.getReceiver} and
|
||||
* {@code MidiSystem.getTransmitter} is implementation-dependant unless the
|
||||
* {@code MidiSystem.getTransmitter} is implementation-dependent unless the
|
||||
* properties {@code javax.sound.midi.Receiver} and
|
||||
* {@code javax.sound.midi.Transmitter} are used (see the description of
|
||||
* properties to select default providers in {@link MidiSystem}). A
|
||||
|
@ -224,7 +224,7 @@ public class BasicToolTipUI extends ToolTipUI
|
||||
/**
|
||||
* Invoked when the <code>JCompoment</code> associated with the
|
||||
* <code>JToolTip</code> has changed, or at initialization time. This
|
||||
* should update any state dependant upon the <code>JComponent</code>.
|
||||
* should update any state dependent upon the <code>JComponent</code>.
|
||||
*
|
||||
* @param c the JToolTip the JComponent has changed on.
|
||||
*/
|
||||
|
@ -518,7 +518,7 @@ public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane {
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates any state dependant upon the JInternalFrame being shown in
|
||||
* Updates any state dependent upon the JInternalFrame being shown in
|
||||
* a <code>JOptionPane</code>.
|
||||
*/
|
||||
private void updateOptionPaneState() {
|
||||
|
@ -538,7 +538,7 @@ class MetalTitlePane extends JComponent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates state dependant upon the Window's active state.
|
||||
* Updates state dependent upon the Window's active state.
|
||||
*/
|
||||
private void setActive(boolean isActive) {
|
||||
Boolean activeB = isActive ? Boolean.TRUE : Boolean.FALSE;
|
||||
|
@ -1131,7 +1131,7 @@ public class GlyphView extends View implements TabableView, Cloneable {
|
||||
* facilitate faster rendering and model/view
|
||||
* translation. At a minimum, the GlyphPainter
|
||||
* allows a View implementation to perform its
|
||||
* duties independant of a particular version
|
||||
* duties independent of a particular version
|
||||
* of JVM and selection of capabilities (i.e.
|
||||
* shaping for i18n, etc).
|
||||
*
|
||||
|
@ -61,7 +61,7 @@ import javax.swing.text.html.HTML;
|
||||
* gridbag layout), where table cells can request to span more
|
||||
* than one grid cell. The default horizontal span of table cells
|
||||
* will be based upon this grid, but can be changed by reimplementing
|
||||
* the requested span of the cell (i.e. table cells can have independant
|
||||
* the requested span of the cell (i.e. table cells can have independent
|
||||
* spans if desired).
|
||||
*
|
||||
* @author Timothy Prinzing
|
||||
|
@ -104,23 +104,25 @@ public class LockInfo {
|
||||
* Returns a {@code LockInfo} object represented by the
|
||||
* given {@code CompositeData}.
|
||||
* The given {@code CompositeData} must contain the following attributes:
|
||||
* <blockquote>
|
||||
* <table border="1">
|
||||
* <table class="striped" style="margin-left:2em;">
|
||||
* <caption style="display:none">The attributes and the types the given CompositeData contains</caption>
|
||||
* <thead style="text-align:left">
|
||||
* <tr>
|
||||
* <th style="text-align:left">Attribute Name</th>
|
||||
* <th style="text-align:left">Type</th>
|
||||
* <th scope="col">Attribute Name</th>
|
||||
* <th scope="col">Type</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr>
|
||||
* <td>className</td>
|
||||
* <th scope="row">className</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>identityHashCode</td>
|
||||
* <th scope="row">identityHashCode</th>
|
||||
* <td>{@code java.lang.Integer}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* @param cd {@code CompositeData} representing a {@code LockInfo}
|
||||
*
|
||||
|
@ -140,96 +140,102 @@ import sun.management.spi.PlatformMBeanProvider.PlatformComponent;
|
||||
* A Java virtual machine has a single instance of the following management
|
||||
* interfaces:
|
||||
*
|
||||
* <blockquote>
|
||||
* <table border="1">
|
||||
* <table class="striped" style="margin-left:2em">
|
||||
* <caption style="display:none">The list of Management Interfaces and their single instances</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th>Management Interface</th>
|
||||
* <th>ObjectName</th>
|
||||
* <th scope="col">Management Interface</th>
|
||||
* <th scope="col">ObjectName</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left;">
|
||||
* <tr>
|
||||
* <td> {@link ClassLoadingMXBean} </td>
|
||||
* <th scope="row"> {@link ClassLoadingMXBean} </th>
|
||||
* <td> {@link #CLASS_LOADING_MXBEAN_NAME
|
||||
* java.lang:type=ClassLoading}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> {@link MemoryMXBean} </td>
|
||||
* <th scope="row"> {@link MemoryMXBean} </th>
|
||||
* <td> {@link #MEMORY_MXBEAN_NAME
|
||||
* java.lang:type=Memory}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> {@link ThreadMXBean} </td>
|
||||
* <th scope="row"> {@link ThreadMXBean} </th>
|
||||
* <td> {@link #THREAD_MXBEAN_NAME
|
||||
* java.lang:type=Threading}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> {@link RuntimeMXBean} </td>
|
||||
* <th scope="row"> {@link RuntimeMXBean} </th>
|
||||
* <td> {@link #RUNTIME_MXBEAN_NAME
|
||||
* java.lang:type=Runtime}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> {@link OperatingSystemMXBean} </td>
|
||||
* <th scope="row"> {@link OperatingSystemMXBean} </th>
|
||||
* <td> {@link #OPERATING_SYSTEM_MXBEAN_NAME
|
||||
* java.lang:type=OperatingSystem}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> {@link PlatformLoggingMXBean} </td>
|
||||
* <th scope="row"> {@link PlatformLoggingMXBean} </th>
|
||||
* <td> {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME
|
||||
* java.util.logging:type=Logging}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* <p>
|
||||
* A Java virtual machine has zero or a single instance of
|
||||
* the following management interfaces.
|
||||
*
|
||||
* <blockquote>
|
||||
* <table border="1">
|
||||
* <table class="striped" style="margin-left:2em">
|
||||
* <caption style="display:none">The list of Management Interfaces and their single instances</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th>Management Interface</th>
|
||||
* <th>ObjectName</th>
|
||||
* <th scope="col">Management Interface</th>
|
||||
* <th scope="col">ObjectName</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left;">
|
||||
* <tr>
|
||||
* <td> {@link CompilationMXBean} </td>
|
||||
* <th scope="row"> {@link CompilationMXBean} </th>
|
||||
* <td> {@link #COMPILATION_MXBEAN_NAME
|
||||
* java.lang:type=Compilation}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* <p>
|
||||
* A Java virtual machine may have one or more instances of the following
|
||||
* management interfaces.
|
||||
* <blockquote>
|
||||
* <table border="1">
|
||||
* <table class="striped" style="margin-left:2em">
|
||||
* <caption style="display:none">The list of Management Interfaces and their single instances</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th>Management Interface</th>
|
||||
* <th>ObjectName</th>
|
||||
* <th scope="col">Management Interface</th>
|
||||
* <th scope="col">ObjectName</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left;">
|
||||
* <tr>
|
||||
* <td> {@link GarbageCollectorMXBean} </td>
|
||||
* <th scope="row"> {@link GarbageCollectorMXBean} </th>
|
||||
* <td> {@link #GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE
|
||||
* java.lang:type=GarbageCollector}{@code ,name=}<i>collector's name</i></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> {@link MemoryManagerMXBean} </td>
|
||||
* <th scope="row"> {@link MemoryManagerMXBean} </th>
|
||||
* <td> {@link #MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
|
||||
* java.lang:type=MemoryManager}{@code ,name=}<i>manager's name</i></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> {@link MemoryPoolMXBean} </td>
|
||||
* <th scope="row"> {@link MemoryPoolMXBean} </th>
|
||||
* <td> {@link #MEMORY_POOL_MXBEAN_DOMAIN_TYPE
|
||||
* java.lang:type=MemoryPool}{@code ,name=}<i>pool's name</i></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td> {@link BufferPoolMXBean} </td>
|
||||
* <th scope="row"> {@link BufferPoolMXBean} </th>
|
||||
* <td> {@code java.nio:type=BufferPool,name=}<i>pool name</i></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* @see <a href="../../../javax/management/package-summary.html">
|
||||
* JMX Specification</a>
|
||||
|
@ -36,14 +36,17 @@ package java.lang.management;
|
||||
*
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">Table shows permission target name, what the permission allows, and associated risks</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th>Permission Target Name</th>
|
||||
* <th>What the Permission Allows</th>
|
||||
* <th>Risks of Allowing this Permission</th>
|
||||
* <th scope="col">Permission Target Name</th>
|
||||
* <th scope="col">What the Permission Allows</th>
|
||||
* <th scope="col">Risks of Allowing this Permission</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text=align:left">
|
||||
*
|
||||
* <tr>
|
||||
* <td>control</td>
|
||||
* <th scope="row">control</th>
|
||||
* <td>Ability to control the runtime characteristics of the Java virtual
|
||||
* machine, for example, enabling and disabling the verbose output for
|
||||
* the class loading or memory system, setting the threshold of a memory
|
||||
@ -59,7 +62,7 @@ package java.lang.management;
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>monitor</td>
|
||||
* <th scope="row">monitor</th>
|
||||
* <td>Ability to retrieve runtime information about
|
||||
* the Java virtual machine such as thread
|
||||
* stack trace, a list of all loaded class names, and input arguments
|
||||
@ -68,6 +71,7 @@ package java.lang.management;
|
||||
* uncover vulnerabilities.</td>
|
||||
* </tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <p>
|
||||
|
@ -211,27 +211,29 @@ public class MemoryNotificationInfo {
|
||||
* given {@code CompositeData}.
|
||||
* The given {@code CompositeData} must contain
|
||||
* the following attributes:
|
||||
* <blockquote>
|
||||
* <table border="1">
|
||||
* <table class="striped" style="margin-left:2em">
|
||||
* <caption style="display:none">The attributes and the types the given CompositeData contains</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th style="text-align:left">Attribute Name</th>
|
||||
* <th style="text-align:left">Type</th>
|
||||
* <th scope="col">Attribute Name</th>
|
||||
* <th scope="col">Type</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr>
|
||||
* <td>poolName</td>
|
||||
* <th scope="row">poolName</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>usage</td>
|
||||
* <th scope="row">usage</th>
|
||||
* <td>{@code javax.management.openmbean.CompositeData}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>count</td>
|
||||
* <th scope="row">count</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* @param cd {@code CompositeData} representing a
|
||||
* {@code MemoryNotificationInfo}
|
||||
|
@ -36,10 +36,14 @@ import sun.management.MemoryUsageCompositeData;
|
||||
* the heap or non-heap memory of the Java virtual machine as a whole.
|
||||
*
|
||||
* <p> A {@code MemoryUsage} object contains four values:
|
||||
* <table>
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">Describes the MemoryUsage object content</caption>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Value</th><th scope="col">Description</th></tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr>
|
||||
* <td style="vertical-align:top"> {@code init} </td>
|
||||
* <th scope="row" style="vertical-align:top"> {@code init} </th>
|
||||
* <td style="vertical-align:top"> represents the initial amount of memory (in bytes) that
|
||||
* the Java virtual machine requests from the operating system
|
||||
* for memory management during startup. The Java virtual machine
|
||||
@ -49,12 +53,12 @@ import sun.management.MemoryUsageCompositeData;
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td style="vertical-align:top"> {@code used} </td>
|
||||
* <th scope="row" style="vertical-align:top"> {@code used} </th>
|
||||
* <td style="vertical-align:top"> represents the amount of memory currently used (in bytes).
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td style="vertical-align:top"> {@code committed} </td>
|
||||
* <th scope="row" style="vertical-align:top"> {@code committed} </th>
|
||||
* <td style="vertical-align:top"> represents the amount of memory (in bytes) that is
|
||||
* guaranteed to be available for use by the Java virtual machine.
|
||||
* The amount of committed memory may change over time (increase
|
||||
@ -65,7 +69,7 @@ import sun.management.MemoryUsageCompositeData;
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td style="vertical-align:top"> {@code max} </td>
|
||||
* <th scope="row" style="vertical-align:top"> {@code max} </th>
|
||||
* <td style="vertical-align:top"> represents the maximum amount of memory (in bytes)
|
||||
* that can be used for memory management. Its value may be undefined.
|
||||
* The maximum amount of memory may change over time if defined.
|
||||
@ -77,6 +81,7 @@ import sun.management.MemoryUsageCompositeData;
|
||||
* when the system is low on virtual memory).
|
||||
* </td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* Below is a picture showing an example of a memory pool:
|
||||
@ -252,31 +257,33 @@ public class MemoryUsage {
|
||||
* given {@code CompositeData}. The given {@code CompositeData}
|
||||
* must contain the following attributes:
|
||||
*
|
||||
* <blockquote>
|
||||
* <table border="1">
|
||||
* <table class="striped" style="margin-left:2em;">
|
||||
* <caption style="display:none">The attributes and the types the given CompositeData contains</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th style="text-align:left">Attribute Name</th>
|
||||
* <th style="text-align:left">Type</th>
|
||||
* <th scope="col">Attribute Name</th>
|
||||
* <th scope="col">Type</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr>
|
||||
* <td>init</td>
|
||||
* <th scope="row">init</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>used</td>
|
||||
* <th scope="row">used</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>committed</td>
|
||||
* <th scope="row">committed</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>max</td>
|
||||
* <th scope="row">max</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* @param cd {@code CompositeData} representing a {@code MemoryUsage}
|
||||
*
|
||||
|
@ -105,15 +105,17 @@ public class MonitorInfo extends LockInfo {
|
||||
* as well as the attributes specified in the
|
||||
* <a href="LockInfo.html#MappedType">
|
||||
* mapped type</a> for the {@link LockInfo} class:
|
||||
* <blockquote>
|
||||
* <table border="1">
|
||||
* <table class="striped" style="margin-left:2em">
|
||||
* <caption style="display:none">The attributes and their types the given CompositeData contains</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th style="text-align:left">Attribute Name</th>
|
||||
* <th style="text-align:left">Type</th>
|
||||
* <th scope="col">Attribute Name</th>
|
||||
* <th scope="col">Type</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr>
|
||||
* <td>lockedStackFrame</td>
|
||||
* <th scope="row">lockedStackFrame</th>
|
||||
* <td><code>CompositeData as specified in the
|
||||
* <a href="ThreadInfo.html#StackTrace">stackTrace</a>
|
||||
* attribute defined in the {@link ThreadInfo#from
|
||||
@ -121,11 +123,11 @@ public class MonitorInfo extends LockInfo {
|
||||
* </code></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>lockedStackDepth</td>
|
||||
* <th scope="row">lockedStackDepth</th>
|
||||
* <td>{@code java.lang.Integer}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* @param cd {@code CompositeData} representing a {@code MonitorInfo}
|
||||
*
|
||||
|
@ -311,23 +311,25 @@ public interface RuntimeMXBean extends PlatformManagedObject {
|
||||
* The mapped type of {@code Map<String,String>} is
|
||||
* {@link javax.management.openmbean.TabularData TabularData}
|
||||
* with two items in each row as follows:
|
||||
* <blockquote>
|
||||
* <table border="1">
|
||||
* <table class="striped" style="margin-left:2em">
|
||||
* <caption style="display:none">Name and Type for each item</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th>Item Name</th>
|
||||
* <th>Item Type</th>
|
||||
* <th scope="col">Item Name</th>
|
||||
* <th scope="col">Item Type</th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>{@code key}</td>
|
||||
* </thead>
|
||||
* <tbody>
|
||||
* <tr style="text-align:left">
|
||||
* <th scope="row">{@code key}</th>
|
||||
* <td>{@code String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>{@code value}</td>
|
||||
* <th scope="row">{@code value}</th>
|
||||
* <td>{@code String}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* @return a map of names and values of all system properties.
|
||||
*
|
||||
|
@ -694,51 +694,53 @@ public class ThreadInfo {
|
||||
* given {@code CompositeData}.
|
||||
* The given {@code CompositeData} must contain the following attributes
|
||||
* unless otherwise specified below:
|
||||
* <blockquote>
|
||||
* <table class="plain">
|
||||
* <table class="striped" style="margin-left:2em">
|
||||
* <caption style="display:none">The attributes and their types the given CompositeData contains</caption>
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th style="text-align:left">Attribute Name</th>
|
||||
* <th style="text-align:left">Type</th>
|
||||
* <th scope="col">Attribute Name</th>
|
||||
* <th scope="col">Type</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr>
|
||||
* <td>threadId</td>
|
||||
* <th scope="row">threadId</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>threadName</td>
|
||||
* <th scope="row">threadName</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>threadState</td>
|
||||
* <th scope="row">threadState</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>suspended</td>
|
||||
* <th scope="row">suspended</th>
|
||||
* <td>{@code java.lang.Boolean}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>inNative</td>
|
||||
* <th scope="row">inNative</th>
|
||||
* <td>{@code java.lang.Boolean}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>blockedCount</td>
|
||||
* <th scope="row">blockedCount</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>blockedTime</td>
|
||||
* <th scope="row">blockedTime</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>waitedCount</td>
|
||||
* <th scope="row">waitedCount</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>waitedTime</td>
|
||||
* <th scope="row">waitedTime</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>lockInfo</td>
|
||||
* <th scope="row">lockInfo</th>
|
||||
* <td>{@code javax.management.openmbean.CompositeData}
|
||||
* - the mapped type for {@link LockInfo} as specified in the
|
||||
* {@link LockInfo#from} method.
|
||||
@ -748,64 +750,66 @@ public class ThreadInfo {
|
||||
* the value of the {@code lockName} attribute. </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>lockName</td>
|
||||
* <th scope="row">lockName</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>lockOwnerId</td>
|
||||
* <th scope="row">lockOwnerId</th>
|
||||
* <td>{@code java.lang.Long}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>lockOwnerName</td>
|
||||
* <th scope="row">lockOwnerName</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td><a id="StackTrace">stackTrace</a></td>
|
||||
* <th scope="row"><a id="StackTrace">stackTrace</a></th>
|
||||
* <td>{@code javax.management.openmbean.CompositeData[]}
|
||||
* <p>
|
||||
* Each element is a {@code CompositeData} representing
|
||||
* StackTraceElement containing the following attributes:
|
||||
* <blockquote>
|
||||
* <table class="borderless">
|
||||
* <table class="striped" style="margin-left:2em">
|
||||
* <caption style="display:none">The attributes and their types the given CompositeData contains</caption>
|
||||
* <thead style="text-align:center">
|
||||
* <tr>
|
||||
* <th style="text-align:left">Attribute Name</th>
|
||||
* <th style="text-align:left">Type</th>
|
||||
* <th scope="col">Attribute Name</th>
|
||||
* <th scope="col">Type</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr>
|
||||
* <td>moduleName</td>
|
||||
* <th scope="row">moduleName</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>moduleVersion</td>
|
||||
* <th scope="row">moduleVersion</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>className</td>
|
||||
* <th scope="row">className</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>methodName</td>
|
||||
* <th scope="row">methodName</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>fileName</td>
|
||||
* <th scope="row">fileName</th>
|
||||
* <td>{@code java.lang.String}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>lineNumber</td>
|
||||
* <th scope="row">lineNumber</th>
|
||||
* <td>{@code java.lang.Integer}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>nativeMethod</td>
|
||||
* <th scope="row">nativeMethod</th>
|
||||
* <td>{@code java.lang.Boolean}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
* </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>lockedMonitors</td>
|
||||
* <th scope="row">lockedMonitors</th>
|
||||
* <td>{@code javax.management.openmbean.CompositeData[]}
|
||||
* whose element type is the mapped type for
|
||||
* {@link MonitorInfo} as specified in the
|
||||
@ -815,7 +819,7 @@ public class ThreadInfo {
|
||||
* this attribute will be set to an empty array. </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>lockedSynchronizers</td>
|
||||
* <th scope="row">lockedSynchronizers</th>
|
||||
* <td>{@code javax.management.openmbean.CompositeData[]}
|
||||
* whose element type is the mapped type for
|
||||
* {@link LockInfo} as specified in the {@link LockInfo#from} method.
|
||||
@ -824,15 +828,15 @@ public class ThreadInfo {
|
||||
* this attribute will be set to an empty array. </td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>daemon</td>
|
||||
* <th scope="row">daemon</th>
|
||||
* <td>{@code java.lang.Boolean}</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>priority</td>
|
||||
* <th scope="row">priority</th>
|
||||
* <td>{@code java.lang.Integer}</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* @param cd {@code CompositeData} representing a {@code ThreadInfo}
|
||||
*
|
||||
|
@ -98,16 +98,21 @@ import javax.management.openmbean.OpenType;
|
||||
*
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">Descriptor Fields</caption>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Name</th>
|
||||
* <th scope="col">Type</th>
|
||||
* <th scope="col">Used in</th>
|
||||
* <th scope="col">Meaning</th></tr>
|
||||
* </thead>
|
||||
*
|
||||
* <tr><th>Name</th><th>Type</th><th>Used in</th><th>Meaning</th></tr>
|
||||
*
|
||||
* <tr id="defaultValue"><td><i>defaultValue</i><td>Object</td>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr id="defaultValue"><th scope="row"><i>defaultValue</i><td>Object</td>
|
||||
* <td>MBeanAttributeInfo<br>MBeanParameterInfo</td>
|
||||
*
|
||||
* <td>Default value for an attribute or parameter. See
|
||||
* {@link javax.management.openmbean}.</td>
|
||||
*
|
||||
* <tr><td>deprecated</td><td>String</td><td>Any</td>
|
||||
* <tr><th scope="row">deprecated</th><td>String</td><td>Any</td>
|
||||
*
|
||||
* <td>An indication that this element of the information model is no
|
||||
* longer recommended for use. A set of MBeans defined by an
|
||||
@ -118,8 +123,8 @@ import javax.management.openmbean.OpenType;
|
||||
* deprecation, for example {@code "1.3 Replaced by the Capacity
|
||||
* attribute"}.</td>
|
||||
*
|
||||
* <tr><td id="descriptionResourceBundleBaseName">descriptionResource<br>
|
||||
* BundleBaseName</td><td>String</td><td>Any</td>
|
||||
* <tr><th scope="row" id="descriptionResourceBundleBaseName">descriptionResource<br>
|
||||
* BundleBaseName</th><td>String</td><td>Any</td>
|
||||
*
|
||||
* <td>The base name for the {@link ResourceBundle} in which the key given in
|
||||
* the {@code descriptionResourceKey} field can be found, for example
|
||||
@ -127,7 +132,7 @@ import javax.management.openmbean.OpenType;
|
||||
* field is defined by this specification but the field is not set or
|
||||
* used by the JMX API itself.</td>
|
||||
*
|
||||
* <tr><td id="descriptionResourceKey">descriptionResourceKey</td>
|
||||
* <tr><th scope="row" id="descriptionResourceKey">descriptionResourceKey</th>
|
||||
* <td>String</td><td>Any</td>
|
||||
*
|
||||
* <td>A resource key for the description of this element. In
|
||||
@ -136,7 +141,7 @@ import javax.management.openmbean.OpenType;
|
||||
* The meaning of this field is defined by this specification but the
|
||||
* field is not set or used by the JMX API itself.</td>
|
||||
*
|
||||
* <tr><td>enabled</td><td>String</td>
|
||||
* <tr><th scope="row">enabled</th><td>String</td>
|
||||
* <td>MBeanAttributeInfo<br>MBeanNotificationInfo<br>MBeanOperationInfo</td>
|
||||
*
|
||||
* <td>The string {@code "true"} or {@code "false"} according as this
|
||||
@ -148,7 +153,7 @@ import javax.management.openmbean.OpenType;
|
||||
* might be disabled if it cannot currently be emitted but could be in
|
||||
* other circumstances.</td>
|
||||
*
|
||||
* <tr id="exceptions"><td>exceptions<td>String[]</td>
|
||||
* <tr id="exceptions"><th scope="row">exceptions<td>String[]</td>
|
||||
* <td>MBeanAttributeInfo, MBeanConstructorInfo, MBeanOperationInfo</td>
|
||||
*
|
||||
* <td>The class names of the exceptions that can be thrown when invoking a
|
||||
@ -158,7 +163,7 @@ import javax.management.openmbean.OpenType;
|
||||
* setting an attribute are specified by the field
|
||||
* <a href="#setExceptions">{@code setExceptions}</a>.
|
||||
*
|
||||
* <tr id="immutableInfo"><td><i>immutableInfo</i><td>String</td>
|
||||
* <tr id="immutableInfo"><th scope="row"><i>immutableInfo</i><td>String</td>
|
||||
* <td>MBeanInfo</td>
|
||||
*
|
||||
* <td>The string {@code "true"} or {@code "false"} according as this
|
||||
@ -171,7 +176,7 @@ import javax.management.openmbean.OpenType;
|
||||
* href="MBeanInfo.html#info-changed">{@code "jmx.mbean.info.changed"}</a>
|
||||
* notification.</td>
|
||||
*
|
||||
* <tr id="infoTimeout"><td>infoTimeout</td><td>String<br>Long</td><td>MBeanInfo</td>
|
||||
* <tr id="infoTimeout"><th scope="row">infoTimeout</th><td>String<br>Long</td><td>MBeanInfo</td>
|
||||
*
|
||||
* <td>The time in milli-seconds that the MBeanInfo can reasonably be
|
||||
* expected to be unchanged. The value can be a {@code Long} or a
|
||||
@ -184,7 +189,7 @@ import javax.management.openmbean.OpenType;
|
||||
* href="MBeanInfo.html#info-changed">{@code "jmx.mbean.info.changed"}</a> in
|
||||
* its {@link MBeanNotificationInfo} array.</td></tr>
|
||||
*
|
||||
* <tr id="interfaceClassName"><td><i>interfaceClassName</i></td>
|
||||
* <tr id="interfaceClassName"><th scope="row"><i>interfaceClassName</i></th>
|
||||
* <td>String</td><td>MBeanInfo</td>
|
||||
*
|
||||
* <td>The Java interface name for a Standard MBean or MXBean, as
|
||||
@ -193,26 +198,26 @@ import javax.management.openmbean.OpenType;
|
||||
* StandardMBean} class will have this field in its MBeanInfo
|
||||
* Descriptor.</td>
|
||||
*
|
||||
* <tr id="legalValues"><td><i>legalValues</i></td>
|
||||
* <tr id="legalValues"><th scope="row"><i>legalValues</i></th>
|
||||
* <td>{@literal Set<?>}</td><td>MBeanAttributeInfo<br>MBeanParameterInfo</td>
|
||||
*
|
||||
* <td>Legal values for an attribute or parameter. See
|
||||
* {@link javax.management.openmbean}.</td>
|
||||
*
|
||||
* <tr id="locale"><td>locale</td>
|
||||
* <tr id="locale"><th scope="row">locale</th>
|
||||
* <td>String</td><td>Any</td>
|
||||
*
|
||||
* <td>The {@linkplain Locale locale} of the description in this
|
||||
* {@code MBeanInfo}, {@code MBeanAttributeInfo}, etc, as returned
|
||||
* by {@link Locale#toString()}.</td>
|
||||
*
|
||||
* <tr id="maxValue"><td><i>maxValue</i><td>Object</td>
|
||||
* <tr id="maxValue"><th scope="row"><i>maxValue</i><td>Object</td>
|
||||
* <td>MBeanAttributeInfo<br>MBeanParameterInfo</td>
|
||||
*
|
||||
* <td>Maximum legal value for an attribute or parameter. See
|
||||
* {@link javax.management.openmbean}.</td>
|
||||
*
|
||||
* <tr id="metricType"><td>metricType</td><td>String</td>
|
||||
* <tr id="metricType"><th scope="row">metricType</th><td>String</td>
|
||||
* <td>MBeanAttributeInfo<br>MBeanOperationInfo</td>
|
||||
*
|
||||
* <td>The type of a metric, one of the strings "counter" or "gauge".
|
||||
@ -225,13 +230,13 @@ import javax.management.openmbean.OpenType;
|
||||
* that can increase or decrease. Examples might be the number of
|
||||
* open connections or a cache hit rate or a temperature reading.
|
||||
*
|
||||
* <tr id="minValue"><td><i>minValue</i><td>Object</td>
|
||||
* <tr id="minValue"><th scope="row"><i>minValue</i><td>Object</td>
|
||||
* <td>MBeanAttributeInfo<br>MBeanParameterInfo</td>
|
||||
*
|
||||
* <td>Minimum legal value for an attribute or parameter. See
|
||||
* {@link javax.management.openmbean}.</td>
|
||||
*
|
||||
* <tr id="mxbean"><td><i>mxbean</i><td>String</td>
|
||||
* <tr id="mxbean"><th scope="row"><i>mxbean</i><td>String</td>
|
||||
* <td>MBeanInfo</td>
|
||||
*
|
||||
* <td>The string {@code "true"} or {@code "false"} according as this
|
||||
@ -240,7 +245,7 @@ import javax.management.openmbean.OpenType;
|
||||
* StandardMBean} class will have this field in its MBeanInfo
|
||||
* Descriptor.</td>
|
||||
*
|
||||
* <tr id="openType"><td><i>openType</i><td>{@link OpenType}</td>
|
||||
* <tr id="openType"><th scope="row"><i>openType</i><td>{@link OpenType}</td>
|
||||
* <td>MBeanAttributeInfo<br>MBeanOperationInfo<br>MBeanParameterInfo</td>
|
||||
*
|
||||
* <td><p>The Open Type of this element. In the case of {@code
|
||||
@ -257,7 +262,7 @@ import javax.management.openmbean.OpenType;
|
||||
* which case it indicates the Open Type that the {@link
|
||||
* Notification#getUserData() user data} will have.</td>
|
||||
*
|
||||
* <tr id="originalType"><td><i>originalType</i><td>String</td>
|
||||
* <tr id="originalType"><th scope="row"><i>originalType</i><td>String</td>
|
||||
* <td>MBeanAttributeInfo<br>MBeanOperationInfo<br>MBeanParameterInfo</td>
|
||||
*
|
||||
* <td><p>The original Java type of this element as it appeared in the
|
||||
@ -273,7 +278,7 @@ import javax.management.openmbean.OpenType;
|
||||
* href="MXBean.html#type-names">Type Names</a> of the MXBean
|
||||
* specification.</p>
|
||||
*
|
||||
* <tr id="setExceptions"><td><i>setExceptions</i><td>String[]</td>
|
||||
* <tr id="setExceptions"><th scope="row"><i>setExceptions</i><td>String[]</td>
|
||||
* <td>MBeanAttributeInfo</td>
|
||||
*
|
||||
* <td>The class names of the exceptions that can be thrown when setting
|
||||
@ -282,7 +287,7 @@ import javax.management.openmbean.OpenType;
|
||||
* JMX API itself. Exceptions thrown when getting an attribute are specified
|
||||
* by the field <a href="#exceptions">{@code exceptions}</a>.
|
||||
*
|
||||
* <tr><td>severity</td><td>String<br>Integer</td>
|
||||
* <tr><th scope="row">severity</th><td>String<br>Integer</td>
|
||||
* <td>MBeanNotificationInfo</td>
|
||||
*
|
||||
* <td>The severity of this notification. It can be 0 to mean
|
||||
@ -290,7 +295,7 @@ import javax.management.openmbean.OpenType;
|
||||
* levels of severity. It can be represented as a decimal string or
|
||||
* an {@code Integer}.</td>
|
||||
*
|
||||
* <tr><td>since</td><td>String</td><td>Any</td>
|
||||
* <tr><th scope="row">since</th><td>String</td><td>Any</td>
|
||||
*
|
||||
* <td>The version of the information model in which this element
|
||||
* was introduced. A set of MBeans defined by an application is
|
||||
@ -299,13 +304,14 @@ import javax.management.openmbean.OpenType;
|
||||
* {@code "since"} field to record the version in which an element
|
||||
* first appeared.</td>
|
||||
*
|
||||
* <tr><td>units</td><td>String</td>
|
||||
* <tr><th scope="row">units</th><td>String</td>
|
||||
* <td>MBeanAttributeInfo<br>MBeanParameterInfo<br>MBeanOperationInfo</td>
|
||||
*
|
||||
* <td>The units in which an attribute, parameter, or operation return
|
||||
* value is measured, for example {@code "bytes"} or {@code
|
||||
* "seconds"}.</td>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <p>Some additional fields are defined by Model MBeans. See the
|
||||
@ -334,106 +340,113 @@ import javax.management.openmbean.OpenType;
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">ModelMBean Fields</caption>
|
||||
*
|
||||
* <tr><th>Name</th><th>Type</th><th>Used in</th><th>Meaning</th></tr>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Name</th>
|
||||
* <th scope="col">Type</th>
|
||||
* <th scope="col">Used in</th>
|
||||
* <th scope="col">Meaning</th></tr>
|
||||
* </thead>
|
||||
*
|
||||
* <tr><td>class</td><td>String</td><td>ModelMBeanOperationInfo</td>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr><th scope="row">class</th><td>String</td><td>ModelMBeanOperationInfo</td>
|
||||
* <td>Class where method is defined (fully qualified).</td></tr>
|
||||
*
|
||||
* <tr><td>currencyTimeLimit</td><td>Number</td>
|
||||
* <tr><th scope="row">currencyTimeLimit</th><td>Number</td>
|
||||
* <td>ModelMBeanInfo<br>ModelMBeanAttributeInfo<br>ModelMBeanOperationInfo</td>
|
||||
* <td>How long cached value is valid: <0 never, =0 always,
|
||||
* >0 seconds.</td></tr>
|
||||
*
|
||||
* <tr><td>default</td><td>Object</td><td>ModelMBeanAttributeInfo</td>
|
||||
* <tr><th scope="row">default</th><td>Object</td><td>ModelMBeanAttributeInfo</td>
|
||||
* <td>Default value for attribute.</td></tr>
|
||||
*
|
||||
* <tr><td>descriptorType</td><td>String</td><td>Any</td>
|
||||
* <tr><th scope="row">descriptorType</th><td>String</td><td>Any</td>
|
||||
* <td>Type of descriptor, "mbean", "attribute", "constructor", "operation",
|
||||
* or "notification".</td></tr>
|
||||
*
|
||||
* <tr id="displayName"><td>displayName</td><td>String</td><td>Any</td>
|
||||
* <tr id="displayName"><th scope="row">displayName</th><td>String</td><td>Any</td>
|
||||
* <td>Human readable name of this item.</td></tr>
|
||||
*
|
||||
* <tr><td>export</td><td>String</td><td>ModelMBeanInfo</td>
|
||||
* <tr><th scope="row">export</th><td>String</td><td>ModelMBeanInfo</td>
|
||||
* <td>Name to be used to export/expose this MBean so that it is
|
||||
* findable by other JMX Agents.</td></tr>
|
||||
*
|
||||
* <tr><td>getMethod</td><td>String</td><td>ModelMBeanAttributeInfo</td>
|
||||
* <tr><th scope="row">getMethod</th><td>String</td><td>ModelMBeanAttributeInfo</td>
|
||||
* <td>Name of operation descriptor for get method.</td></tr>
|
||||
*
|
||||
* <tr><td>lastUpdatedTimeStamp</td><td>Number</td>
|
||||
* <tr><th scope="row">lastUpdatedTimeStamp</th><td>Number</td>
|
||||
* <td>ModelMBeanAttributeInfo<br>ModelMBeanOperationInfo</td>
|
||||
* <td>When <a href="#value-field">value</a> was set.</td></tr>
|
||||
*
|
||||
* <tr><td>log</td><td>String</td><td>ModelMBeanInfo<br>ModelMBeanNotificationInfo</td>
|
||||
* <tr><th scope="row">log</th><td>String</td><td>ModelMBeanInfo<br>ModelMBeanNotificationInfo</td>
|
||||
* <td>t or T: log all notifications, f or F: log no notifications.</td></tr>
|
||||
*
|
||||
* <tr><td>logFile</td><td>String</td><td>ModelMBeanInfo<br>ModelMBeanNotificationInfo</td>
|
||||
* <tr><th scope="row">logFile</th><td>String</td><td>ModelMBeanInfo<br>ModelMBeanNotificationInfo</td>
|
||||
* <td>Fully qualified filename to log events to.</td></tr>
|
||||
*
|
||||
* <tr><td>messageID</td><td>String</td><td>ModelMBeanNotificationInfo</td>
|
||||
* <tr><th scope="row">messageID</th><td>String</td><td>ModelMBeanNotificationInfo</td>
|
||||
* <td>Unique key for message text (to allow translation, analysis).</td></tr>
|
||||
*
|
||||
* <tr><td>messageText</td><td>String</td><td>ModelMBeanNotificationInfo</td>
|
||||
* <tr><th scope="row">messageText</th><td>String</td><td>ModelMBeanNotificationInfo</td>
|
||||
* <td>Text of notification.</td></tr>
|
||||
*
|
||||
* <tr><td>name</td><td>String</td><td>Any</td>
|
||||
* <tr><th scope="row">name</th><td>String</td><td>Any</td>
|
||||
* <td>Name of this item.</td></tr>
|
||||
*
|
||||
* <tr><td>persistFile</td><td>String</td><td>ModelMBeanInfo</td>
|
||||
* <tr><th scope="row">persistFile</th><td>String</td><td>ModelMBeanInfo</td>
|
||||
* <td>File name into which the MBean should be persisted.</td></tr>
|
||||
*
|
||||
* <tr><td>persistLocation</td><td>String</td><td>ModelMBeanInfo</td>
|
||||
* <tr><th scope="row">persistLocation</th><td>String</td><td>ModelMBeanInfo</td>
|
||||
* <td>The fully qualified directory name where the MBean should be
|
||||
* persisted (if appropriate).</td></tr>
|
||||
*
|
||||
* <tr><td>persistPeriod</td><td>Number</td>
|
||||
* <tr><th scope="row">persistPeriod</th><td>Number</td>
|
||||
* <td>ModelMBeanInfo<br>ModelMBeanAttributeInfo</td>
|
||||
* <td>Frequency of persist cycle in seconds. Used when persistPolicy is
|
||||
* "OnTimer" or "NoMoreOftenThan".</td></tr>
|
||||
*
|
||||
* <tr><td>persistPolicy</td><td>String</td>
|
||||
* <tr><th scope="row">persistPolicy</th><td>String</td>
|
||||
* <td>ModelMBeanInfo<br>ModelMBeanAttributeInfo</td>
|
||||
* <td>One of: OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never.
|
||||
* See the section "MBean Descriptor Fields" in the JMX specification
|
||||
* document.</td></tr>
|
||||
*
|
||||
* <tr><td>presentationString</td><td>String</td><td>Any</td>
|
||||
* <tr><th scope="row">presentationString</th><td>String</td><td>Any</td>
|
||||
* <td>XML formatted string to allow presentation of data.</td></tr>
|
||||
*
|
||||
* <tr><td>protocolMap</td><td>Descriptor</td><td>ModelMBeanAttributeInfo</td>
|
||||
* <tr><th scope="row">protocolMap</th><td>Descriptor</td><td>ModelMBeanAttributeInfo</td>
|
||||
* <td>See the section "Protocol Map Support" in the JMX specification
|
||||
* document. Mappings must be appropriate for the attribute and entries
|
||||
* can be updated or augmented at runtime.</td></tr>
|
||||
*
|
||||
* <tr><td>role</td><td>String</td>
|
||||
* <tr><th scope="row">role</th><td>String</td>
|
||||
* <td>ModelMBeanConstructorInfo<br>ModelMBeanOperationInfo</td>
|
||||
* <td>One of "constructor", "operation", "getter", or "setter".</td></tr>
|
||||
*
|
||||
* <tr><td>setMethod</td><td>String</td><td>ModelMBeanAttributeInfo</td>
|
||||
* <tr><th scope="row">setMethod</th><td>String</td><td>ModelMBeanAttributeInfo</td>
|
||||
* <td>Name of operation descriptor for set method.</td></tr>
|
||||
*
|
||||
* <tr id="severity"><td>severity</td><td>Number</td>
|
||||
* <tr id="severity"><th scope="row">severity</th><td>Number</td>
|
||||
* <td>ModelMBeanNotificationInfo</td>
|
||||
* <td>0-6 where 0: unknown; 1: non-recoverable;
|
||||
* 2: critical, failure; 3: major, severe;
|
||||
* 4: minor, marginal, error; 5: warning;
|
||||
* 6: normal, cleared, informative</td></tr>
|
||||
*
|
||||
* <tr><td>targetObject</td><td>Object</td><td>ModelMBeanOperationInfo</td>
|
||||
* <tr><th scope="row">targetObject</th><td>Object</td><td>ModelMBeanOperationInfo</td>
|
||||
* <td>Object on which to execute this method.</td></tr>
|
||||
*
|
||||
* <tr><td>targetType</td><td>String</td><td>ModelMBeanOperationInfo</td>
|
||||
* <tr><th scope="row">targetType</th><td>String</td><td>ModelMBeanOperationInfo</td>
|
||||
* <td>type of object reference for targetObject. Can be:
|
||||
* ObjectReference | Handle | EJBHandle | IOR | RMIReference.</td></tr>
|
||||
*
|
||||
* <tr id="value-field"><td>value</td><td>Object</td>
|
||||
* <tr id="value-field"><th scope="row">value</th><td>Object</td>
|
||||
* <td>ModelMBeanAttributeInfo<br>ModelMBeanOperationInfo</td>
|
||||
* <td>Current (cached) value for attribute or operation.</td></tr>
|
||||
*
|
||||
* <tr id="visibility"><td>visibility</td><td>Number</td><td>Any</td>
|
||||
* <tr id="visibility"><th scope="row">visibility</th><td>Number</td><td>Any</td>
|
||||
* <td>1-4 where 1: always visible, 4: rarely visible.</td></tr>
|
||||
*
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @since 1.5
|
||||
|
@ -94,13 +94,17 @@ import java.lang.annotation.*;
|
||||
* <p>then the resulting {@code Descriptor} will contain the following
|
||||
* fields:</p>
|
||||
*
|
||||
* <table border="1">
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">Descriptor Fields</caption>
|
||||
* <tr><th>Name</th><th>Value</th></tr>
|
||||
* <tr><td>units</td><td>"bytes"</td></tr>
|
||||
* <tr><td>descriptionResourceKey</td><td>"bytes.key"</td></tr>
|
||||
* <tr><td>descriptionResourceBundleBaseName</td>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Name</th><th scope="col">Value</th></tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr><th scope="row">units</th><td>"bytes"</td></tr>
|
||||
* <tr><th scope="row">descriptionResourceKey</th><td>"bytes.key"</td></tr>
|
||||
* <tr><th scope="row">descriptionResourceBundleBaseName</th>
|
||||
* <td>"com.example.foo.MBeanResources"</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <p>An annotation such as {@code @Units} can be applied to:</p>
|
||||
@ -144,24 +148,28 @@ import java.lang.annotation.*;
|
||||
* or an array of annotations. The value of the field is derived from
|
||||
* the value of the annotation element as follows:</p>
|
||||
*
|
||||
* <table border="1">
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">Descriptor Field Types</caption>
|
||||
* <tr><th>Annotation element</th><th>Descriptor field</th></tr>
|
||||
* <tr><td>Primitive value ({@code 5}, {@code false}, etc)</td>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Annotation element</th><th scope="col">Descriptor field</th></tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr><th scope="row">Primitive value ({@code 5}, {@code false}, etc)</th>
|
||||
* <td>Wrapped value ({@code Integer.valueOf(5)},
|
||||
* {@code Boolean.FALSE}, etc)</td></tr>
|
||||
* <tr><td>Class constant (e.g. {@code Thread.class})</td>
|
||||
* <tr><th scope="row">Class constant (e.g. {@code Thread.class})</th>
|
||||
* <td>Class name from {@link Class#getName()}
|
||||
* (e.g. {@code "java.lang.Thread"})</td></tr>
|
||||
* <tr><td>Enum constant (e.g. {@link ElementType#FIELD})</td>
|
||||
* <tr><th scope="row">Enum constant (e.g. {@link ElementType#FIELD})</th>
|
||||
* <td>Constant name from {@link Enum#name()}
|
||||
* (e.g. {@code "FIELD"})</td></tr>
|
||||
* <tr><td>Array of class constants or enum constants</td>
|
||||
* <tr><th scope="row">Array of class constants or enum constants</th>
|
||||
* <td>String array derived by applying these rules to each
|
||||
* element</td></tr>
|
||||
* <tr><td>Value of any other type<br>
|
||||
* ({@code String}, {@code String[]}, {@code int[]}, etc)</td>
|
||||
* <tr><th scope="row">Value of any other type<br>
|
||||
* ({@code String}, {@code String[]}, {@code int[]}, etc)</th>
|
||||
* <td>The same value</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* @since 1.6
|
||||
|
@ -93,28 +93,26 @@ import javax.management.openmbean.TabularType;
|
||||
Standard MBean concept. Here is how a managed object might be
|
||||
represented as a Standard MBean, and as an MXBean:</p>
|
||||
|
||||
<table class="plain">
|
||||
<caption style="display:none">Standard Bean vs. MXBean</caption>
|
||||
<tr>
|
||||
<th>Standard MBean</th><th>MXBean</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>Standard MBean</h4>
|
||||
<pre>
|
||||
public interface MemoryPool<b>MBean</b> {
|
||||
String getName();
|
||||
MemoryUsage getUsage();
|
||||
// ...
|
||||
}
|
||||
</pre></td>
|
||||
<td><pre>
|
||||
</pre>
|
||||
</div>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>MXBean</h4>
|
||||
<pre>
|
||||
public interface MemoryPool<b>MXBean</b> {
|
||||
String getName();
|
||||
MemoryUsage getUsage();
|
||||
// ...
|
||||
}
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>As you can see, the definitions are very similar. The only
|
||||
difference is that the convention for naming the interface is to use
|
||||
@ -134,13 +132,9 @@ public interface MemoryPool<b>MXBean</b> {
|
||||
|
||||
<p>So, we might define <code>MemoryUsage</code> like this:</p>
|
||||
|
||||
<table class="plain">
|
||||
<caption style="display:none">Standard Bean vs. MXBean</caption>
|
||||
<tr>
|
||||
<th>Standard MBean</th><th>MXBean</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>Standard MBean</h4>
|
||||
<pre>
|
||||
public class MemoryUsage <b>implements Serializable</b> {
|
||||
// standard JavaBean conventions with getters
|
||||
|
||||
@ -151,8 +145,11 @@ public class MemoryUsage <b>implements Serializable</b> {
|
||||
long getCommitted() {...}
|
||||
long getMax() {...}
|
||||
}
|
||||
</pre></td>
|
||||
<td><pre>
|
||||
</pre>
|
||||
</div>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>MXBean</h4>
|
||||
<pre>
|
||||
public class MemoryUsage {
|
||||
// standard JavaBean conventions with getters
|
||||
<b>@ConstructorParameters({"init", "used", "committed", "max"})</b>
|
||||
@ -163,9 +160,8 @@ public class MemoryUsage {
|
||||
long getCommitted() {...}
|
||||
long getMax() {...}
|
||||
}
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>The definitions are the same in the two cases, except
|
||||
that with the MXBean, <code>MemoryUsage</code> no longer needs to
|
||||
@ -197,29 +193,28 @@ public class MemoryUsage {
|
||||
<p>This becomes clearer if we compare what the clients of the two
|
||||
models might look like:</p>
|
||||
|
||||
<table class="plain">
|
||||
<caption style="display:none">Standard Bean vs. MXBean</caption>
|
||||
<tr>
|
||||
<th>Standard MBean</th><th>MXBean</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>Standard MBean</h4>
|
||||
<pre>
|
||||
String name = (String)
|
||||
mbeanServer.{@link MBeanServer#getAttribute
|
||||
getAttribute}(objectName, "Name");
|
||||
<b>MemoryUsage</b> usage = (<b>MemoryUsage</b>)
|
||||
mbeanServer.getAttribute(objectName, "Usage");
|
||||
<b>long used = usage.getUsed();</b>
|
||||
</pre></td>
|
||||
<td><pre>
|
||||
</pre>
|
||||
</div>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>MXBean</h4>
|
||||
<pre>
|
||||
String name = (String)
|
||||
mbeanServer.{@link MBeanServer#getAttribute
|
||||
getAttribute}(objectName, "Name");
|
||||
<b>{@link CompositeData}</b> usage = (<b>CompositeData</b>)
|
||||
mbeanServer.getAttribute(objectName, "Usage");
|
||||
<b>long used = (Long) usage.{@link CompositeData#get get}("used");</b>
|
||||
</pre></td>
|
||||
</table>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>For attributes with simple types like <code>String</code>, the
|
||||
code is the same. But for attributes with complex types, the
|
||||
@ -235,13 +230,9 @@ String name = (String)
|
||||
managed objects when you know the model beforehand, regardless
|
||||
of whether you are using Standard MBeans or MXBeans:</p>
|
||||
|
||||
<table class="plain">
|
||||
<caption style="display:none">Standard Bean vs. MXBean</caption>
|
||||
<tr>
|
||||
<th>Standard MBean</th><th>MXBean</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>Standard MBean</h4>
|
||||
<pre>
|
||||
MemoryPool<b>MBean</b> proxy =
|
||||
JMX.<b>{@link JMX#newMBeanProxy(MBeanServerConnection, ObjectName,
|
||||
Class) newMBeanProxy}</b>(
|
||||
@ -251,8 +242,11 @@ MemoryPool<b>MBean</b> proxy =
|
||||
String name = proxy.getName();
|
||||
MemoryUsage usage = proxy.getUsage();
|
||||
long used = usage.getUsed();
|
||||
</pre></td>
|
||||
<td><pre>
|
||||
</pre>
|
||||
</div>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>MXBean</h4>
|
||||
<pre>
|
||||
MemoryPool<b>MXBean</b> proxy =
|
||||
JMX.<b>{@link JMX#newMXBeanProxy(MBeanServerConnection, ObjectName,
|
||||
Class) newMXBeanProxy}</b>(
|
||||
@ -262,63 +256,58 @@ MemoryPool<b>MXBean</b> proxy =
|
||||
String name = proxy.getName();
|
||||
MemoryUsage usage = proxy.getUsage();
|
||||
long used = usage.getUsed();
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Implementing the MemoryPool object works similarly for both
|
||||
Standard MBeans and MXBeans.</p>
|
||||
|
||||
<table class="plain">
|
||||
<caption style="display:none">Standard Bean vs. MXBean</caption>
|
||||
<tr>
|
||||
<th>Standard MBean</th><th>MXBean</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>Standard MBean</h4>
|
||||
<pre>
|
||||
public class MemoryPool
|
||||
implements MemoryPool<b>MBean</b> {
|
||||
public String getName() {...}
|
||||
public MemoryUsage getUsage() {...}
|
||||
// ...
|
||||
}
|
||||
</pre></td>
|
||||
<td><pre>
|
||||
</pre>
|
||||
</div>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>MXBean</h4>
|
||||
<pre>
|
||||
public class MemoryPool
|
||||
implements MemoryPool<b>MXBean</b> {
|
||||
public String getName() {...}
|
||||
public MemoryUsage getUsage() {...}
|
||||
// ...
|
||||
}
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>Registering the MBean in the MBean Server works in the same way
|
||||
in both cases:</p>
|
||||
|
||||
<table class="plain">
|
||||
<caption style="display:none">Standard Bean vs. MXBean</caption>
|
||||
<tr>
|
||||
<th>Standard MBean</th><th>MXBean</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>Standard MBean</h4>
|
||||
<pre>
|
||||
{
|
||||
MemoryPool<b>MBean</b> pool = new MemoryPool();
|
||||
mbeanServer.{@link MBeanServer#registerMBean
|
||||
registerMBean}(pool, objectName);
|
||||
}
|
||||
</pre></td>
|
||||
<td><pre>
|
||||
</pre>
|
||||
</div>
|
||||
<div style="display:inline-block; margin: 0 3em">
|
||||
<h4>MXBean</h4>
|
||||
<pre>
|
||||
{
|
||||
MemoryPool<b>MXBean</b> pool = new MemoryPool();
|
||||
mbeanServer.{@link MBeanServer#registerMBean
|
||||
registerMBean}(pool, objectName);
|
||||
}
|
||||
</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<h2 id="mxbean-def">Definition of an MXBean</h2>
|
||||
@ -486,70 +475,71 @@ public class MemoryPool
|
||||
|
||||
<table class="striped">
|
||||
<caption style="display:none">Type Mapping Rules</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Java type <em>J</em></th>
|
||||
<th><em>opentype(J)</em></th>
|
||||
<th><em>opendata(J)</em></th>
|
||||
<th scope="col">Java type <em>J</em></th>
|
||||
<th scope="col"><em>opentype(J)</em></th>
|
||||
<th scope="col"><em>opendata(J)</em></th>
|
||||
</tr>
|
||||
<tbody style="vertical-align:top">
|
||||
</thead>
|
||||
<tbody style="text-align:left; vertical-align:top">
|
||||
<tr>
|
||||
<td>{@code int}, {@code boolean}, etc<br>
|
||||
(the 8 primitive Java types)</td>
|
||||
<th scope="row">{@code int}, {@code boolean}, etc<br>
|
||||
(the 8 primitive Java types)</th>
|
||||
<td>{@code SimpleType.INTEGER},<br>
|
||||
{@code SimpleType.BOOLEAN}, etc</td>
|
||||
<td>{@code Integer}, {@code Boolean}, etc<br>
|
||||
(the corresponding boxed types)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{@code Integer}, {@code ObjectName}, etc<br>
|
||||
(the types covered by {@link SimpleType})</td>
|
||||
<th scope="row">{@code Integer}, {@code ObjectName}, etc<br>
|
||||
(the types covered by {@link SimpleType})</th>
|
||||
<td>the corresponding {@code SimpleType}</td>
|
||||
<td><em>J</em>, the same type</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{@code int[]} etc<br>
|
||||
(a one-dimensional array with<br>
|
||||
primitive element type)</td>
|
||||
<th scope="row">{@code int[]} etc<br>
|
||||
(a one-dimensional array with primitive element type)</th>
|
||||
<td>{@code ArrayType.getPrimitiveArrayType(int[].class)} etc</td>
|
||||
<td><em>J</em>, the same type</td>
|
||||
<tr>
|
||||
<td><em>E</em>{@code []}<br>
|
||||
<th scope="row"><em>E</em>{@code []}<br>
|
||||
(an array with non-primitive element type <em>E</em>;
|
||||
this includes {@code int[][]}, where <em>E</em> is {@code int[]})</td>
|
||||
this includes {@code int[][]}, where <em>E</em> is {@code int[]})</th>
|
||||
<td>{@code ArrayType.getArrayType(}<em>opentype(E)</em>{@code )}</td>
|
||||
<td><em>opendata(E)</em>{@code []}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{@code List<}<em>E</em>{@code >}<br>
|
||||
<th scope="row">{@code List<}<em>E</em>{@code >}<br>
|
||||
{@code Set<}<em>E</em>{@code >}<br>
|
||||
{@code SortedSet<}<em>E</em>{@code >} (see below)</td>
|
||||
{@code SortedSet<}<em>E</em>{@code >} (see below)</th>
|
||||
<td>same as for <em>E</em>{@code []}</td>
|
||||
<td>same as for <em>E</em>{@code []}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>An enumeration <em>E</em><br>
|
||||
<th scope="row">An enumeration <em>E</em><br>
|
||||
(declared in Java as {@code enum }<em>E</em>
|
||||
{@code {...}})</td>
|
||||
{@code {...}})</th>
|
||||
<td>{@code SimpleType.STRING}</td>
|
||||
<td>{@code String}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{@code Map<}<em>K</em>,<em>V</em>{@code >}<br>
|
||||
{@code SortedMap<}<em>K</em>,<em>V</em>{@code >}</td>
|
||||
<th scope="row">{@code Map<}<em>K</em>,<em>V</em>{@code >}<br>
|
||||
{@code SortedMap<}<em>K</em>,<em>V</em>{@code >}</th>
|
||||
<td>{@link TabularType}<br>
|
||||
(see below)</td>
|
||||
<td>{@link TabularData}<br>
|
||||
(see below)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>An MXBean interface</td>
|
||||
<th scope="row">An MXBean interface</th>
|
||||
<td>{@code SimpleType.OBJECTNAME}<br>
|
||||
(see below)</td>
|
||||
<td>{@link ObjectName}<br>
|
||||
(see below)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Any other type</td>
|
||||
<th scope="row">Any other type</th>
|
||||
<td>{@link CompositeType},
|
||||
if possible<br>
|
||||
(see below)</td>
|
||||
|
@ -59,41 +59,45 @@ import javax.management.RuntimeOperationsException;
|
||||
*
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">ModelMBeanAttributeInfo Fields</caption>
|
||||
* <tr><th>Name</th><th>Type</th><th>Meaning</th></tr>
|
||||
* <tr><td>name</td><td>String</td>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Name</th><th scope="col">Type</th><th scope="col">Meaning</th></tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr><th scope="row">name</th><td>String</td>
|
||||
* <td>Attribute name.</td></tr>
|
||||
* <tr><td>descriptorType</td><td>String</td>
|
||||
* <tr><th scope="row">descriptorType</th><td>String</td>
|
||||
* <td>Must be "attribute".</td></tr>
|
||||
* <tr id="value-field"><td>value</td><td>Object</td>
|
||||
* <tr id="value-field"><th scope="row">value</th><td>Object</td>
|
||||
* <td>Current (cached) value for attribute.</td></tr>
|
||||
* <tr><td>default</td><td>Object</td>
|
||||
* <tr><th scope="row">default</th><td>Object</td>
|
||||
* <td>Default value for attribute.</td></tr>
|
||||
* <tr><td>displayName</td><td>String</td>
|
||||
* <tr><th scope="row">displayName</th><td>String</td>
|
||||
* <td>Name of attribute to be used in displays.</td></tr>
|
||||
* <tr><td>getMethod</td><td>String</td>
|
||||
* <tr><th scope="row">getMethod</th><td>String</td>
|
||||
* <td>Name of operation descriptor for get method.</td></tr>
|
||||
* <tr><td>setMethod</td><td>String</td>
|
||||
* <tr><th scope="row">setMethod</th><td>String</td>
|
||||
* <td>Name of operation descriptor for set method.</td></tr>
|
||||
* <tr><td>protocolMap</td><td>Descriptor</td>
|
||||
* <tr><th scope="row">protocolMap</th><td>Descriptor</td>
|
||||
* <td>See the section "Protocol Map Support" in the JMX specification
|
||||
* document. Mappings must be appropriate for the attribute and entries
|
||||
* can be updated or augmented at runtime.</td></tr>
|
||||
* <tr><td>persistPolicy</td><td>String</td>
|
||||
* <tr><th scope="row">persistPolicy</th><td>String</td>
|
||||
* <td>One of: OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never.
|
||||
* See the section "MBean Descriptor Fields" in the JMX specification
|
||||
* document.</td></tr>
|
||||
* <tr><td>persistPeriod</td><td>Number</td>
|
||||
* <tr><th scope="row">persistPeriod</th><td>Number</td>
|
||||
* <td>Frequency of persist cycle in seconds. Used when persistPolicy is
|
||||
* "OnTimer" or "NoMoreOftenThan".</td></tr>
|
||||
* <tr><td>currencyTimeLimit</td><td>Number</td>
|
||||
* <td>How long <a href="#value=field">value</a> is valid: <0 never,
|
||||
* <tr><th scope="row">currencyTimeLimit</th><td>Number</td>
|
||||
* <td>How long <a href="#value-field">value</a> is valid: <0 never,
|
||||
* =0 always, >0 seconds.</td></tr>
|
||||
* <tr><td>lastUpdatedTimeStamp</td><td>Number</td>
|
||||
* <tr><th scope="row">lastUpdatedTimeStamp</th><td>Number</td>
|
||||
* <td>When <a href="#value-field">value</a> was set.</td></tr>
|
||||
* <tr><td>visibility</td><td>Number</td>
|
||||
* <tr><th scope="row">visibility</th><td>Number</td>
|
||||
* <td>1-4 where 1: always visible, 4: rarely visible.</td></tr>
|
||||
* <tr><td>presentationString</td><td>String</td>
|
||||
* <tr><th scope="row">presentationString</th><td>String</td>
|
||||
* <td>XML formatted string to allow presentation of data.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <p>The default descriptor contains the name, descriptorType and displayName
|
||||
|
@ -60,19 +60,23 @@ import javax.management.RuntimeOperationsException;
|
||||
*
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">ModelMBeanConstructorInfo Fields</caption>
|
||||
* <tr><th>Name</th><th>Type</th><th>Meaning</th></tr>
|
||||
* <tr><td>name</td><td>String</td>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Name</th><th scope="col">Type</th><th scope="col">Meaning</th></tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr><th scope="row">name</th><td>String</td>
|
||||
* <td>Constructor name.</td></tr>
|
||||
* <tr><td>descriptorType</td><td>String</td>
|
||||
* <tr><th scope="row">descriptorType</th><td>String</td>
|
||||
* <td>Must be "operation".</td></tr>
|
||||
* <tr><td>role</td><td>String</td>
|
||||
* <tr><th scope="row">role</th><td>String</td>
|
||||
* <td>Must be "constructor".</td></tr>
|
||||
* <tr><td>displayName</td><td>String</td>
|
||||
* <tr><th scope="row">displayName</th><td>String</td>
|
||||
* <td>Human readable name of constructor.</td></tr>
|
||||
* <tr><td>visibility</td><td>Number</td>
|
||||
* <tr><th scope="row">visibility</th><td>Number</td>
|
||||
* <td>1-4 where 1: always visible 4: rarely visible.</td></tr>
|
||||
* <tr><td>presentationString</td><td>String</td>
|
||||
* <tr><th scope="row">presentationString</th><td>String</td>
|
||||
* <td>XML formatted string to describe how to present operation</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <p>The {@code persistPolicy} and {@code currencyTimeLimit} fields
|
||||
|
@ -167,40 +167,44 @@ public interface ModelMBeanInfo
|
||||
*
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">ModelMBean Fields</caption>
|
||||
* <tr><th>Name</th><th>Type</th><th>Meaning</th></tr>
|
||||
* <tr><td>name</td><td>String</td>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Name</th><th scope="col">Type</th><th scope="col">Meaning</th></tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr><th scope="row">name</th><td>String</td>
|
||||
* <td>MBean name.</td></tr>
|
||||
* <tr><td>descriptorType</td><td>String</td>
|
||||
* <tr><th scope="row">descriptorType</th><td>String</td>
|
||||
* <td>Must be "mbean".</td></tr>
|
||||
* <tr><td>displayName</td><td>String</td>
|
||||
* <tr><th scope="row">displayName</th><td>String</td>
|
||||
* <td>Name of MBean to be used in displays.</td></tr>
|
||||
* <tr><td>persistPolicy</td><td>String</td>
|
||||
* <tr><th scope="row">persistPolicy</th><td>String</td>
|
||||
* <td>One of: OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never.
|
||||
* See the section "MBean Descriptor Fields" in the JMX specification
|
||||
* document.</td></tr>
|
||||
* <tr><td>persistLocation</td><td>String</td>
|
||||
* <tr><th scope="row">persistLocation</th><td>String</td>
|
||||
* <td>The fully qualified directory name where the MBean should be
|
||||
* persisted (if appropriate).</td></tr>
|
||||
* <tr><td>persistFile</td><td>String</td>
|
||||
* <tr><th scope="row">persistFile</th><td>String</td>
|
||||
* <td>File name into which the MBean should be persisted.</td></tr>
|
||||
* <tr><td>persistPeriod</td><td>Number</td>
|
||||
* <tr><th scope="row">persistPeriod</th><td>Number</td>
|
||||
* <td>Frequency of persist cycle in seconds, for OnTime and
|
||||
* NoMoreOftenThan PersistPolicy</td></tr>
|
||||
* <tr><td>currencyTimeLimit</td><td>Number</td>
|
||||
* <tr><th scope="row">currencyTimeLimit</th><td>Number</td>
|
||||
* <td>How long cached value is valid: <0 never, =0 always,
|
||||
* >0 seconds.</td></tr>
|
||||
* <tr><td>log</td><td>String</td>
|
||||
* <tr><th scope="row">log</th><td>String</td>
|
||||
* <td>t: log all notifications, f: log no notifications.</td></tr>
|
||||
* <tr><td>logfile</td><td>String</td>
|
||||
* <tr><th scope="row">logfile</th><td>String</td>
|
||||
* <td>Fully qualified filename to log events to.</td></tr>
|
||||
* <tr><td>visibility</td><td>Number</td>
|
||||
* <tr><th scope="row">visibility</th><td>Number</td>
|
||||
* <td>1-4 where 1: always visible 4: rarely visible.</td></tr>
|
||||
* <tr><td>export</td><td>String</td>
|
||||
* <tr><th scope="row">export</th><td>String</td>
|
||||
* <td>Name to be used to export/expose this MBean so that it is
|
||||
* findable by other JMX Agents.</td></tr>
|
||||
* <tr><td>presentationString</td><td>String</td>
|
||||
* <tr><th scope="row">presentationString</th><td>String</td>
|
||||
* <td>XML formatted string to allow presentation of data to be
|
||||
* associated with the MBean.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <P>
|
||||
|
@ -58,28 +58,32 @@ import javax.management.RuntimeOperationsException;
|
||||
*
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">ModelMBeanNotificationInfo Fields</caption>
|
||||
* <tr><th>Name</th><th>Type</th><th>Meaning</th></tr>
|
||||
* <tr><td>name</td><td>String</td>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Name</th><th scope="col">Type</th><th scope="col">Meaning</th></tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr><th scope="row">name</th><td>String</td>
|
||||
* <td>Notification name.</td></tr>
|
||||
* <tr><td>descriptorType</td><td>String</td>
|
||||
* <tr><th scope="row">descriptorType</th><td>String</td>
|
||||
* <td>Must be "notification".</td></tr>
|
||||
* <tr><td>severity</td><td>Number</td>
|
||||
* <tr><th scope="row">severity</th><td>Number</td>
|
||||
* <td>0-6 where 0: unknown; 1: non-recoverable;
|
||||
* 2: critical, failure; 3: major, severe;
|
||||
* 4: minor, marginal, error; 5: warning;
|
||||
* 6: normal, cleared, informative</td></tr>
|
||||
* <tr><td>messageID</td><td>String</td>
|
||||
* <tr><th scope="row">messageID</th><td>String</td>
|
||||
* <td>Unique key for message text (to allow translation, analysis).</td></tr>
|
||||
* <tr><td>messageText</td><td>String</td>
|
||||
* <tr><th scope="row">messageText</th><td>String</td>
|
||||
* <td>Text of notification.</td></tr>
|
||||
* <tr><td>log</td><td>String</td>
|
||||
* <tr><th scope="row">log</th><td>String</td>
|
||||
* <td>T - log message, F - do not log message.</td></tr>
|
||||
* <tr><td>logfile</td><td>String</td>
|
||||
* <tr><th scope="row">logfile</th><td>String</td>
|
||||
* <td>fully qualified file name appropriate for operating system.</td></tr>
|
||||
* <tr><td>visibility</td><td>Number</td>
|
||||
* <tr><th scope="row">visibility</th><td>Number</td>
|
||||
* <td>1-4 where 1: always visible 4: rarely visible.</td></tr>
|
||||
* <tr><td>presentationString</td><td>String</td>
|
||||
* <tr><th scope="row">presentationString</th><td>String</td>
|
||||
* <td>XML formatted string to allow presentation of data.</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <p>The default descriptor contains the name, descriptorType,
|
||||
|
@ -61,32 +61,36 @@ import javax.management.RuntimeOperationsException;
|
||||
*
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">ModelMBeanOperationInfo Fields</caption>
|
||||
* <tr><th>Name</th><th>Type</th><th>Meaning</th></tr>
|
||||
* <tr><td>name</td><td>String</td>
|
||||
* <thead>
|
||||
* <tr><th scope="col">Name</th><th scope="col">Type</th><th scope="col">Meaning</th></tr>
|
||||
* </thead>
|
||||
* <tbody style="text-align:left">
|
||||
* <tr><th scope="row">name</th><td>String</td>
|
||||
* <td>Operation name.</td></tr>
|
||||
* <tr><td>descriptorType</td><td>String</td>
|
||||
* <tr><th scope="row">descriptorType</th><td>String</td>
|
||||
* <td>Must be "operation".</td></tr>
|
||||
* <tr><td>class</td><td>String</td>
|
||||
* <tr><th scope="row">class</th><td>String</td>
|
||||
* <td>Class where method is defined (fully qualified).</td></tr>
|
||||
* <tr><td>role</td><td>String</td>
|
||||
* <tr><th scope="row">role</th><td>String</td>
|
||||
* <td>Must be "operation", "getter", or "setter".</td></tr>
|
||||
* <tr><td>targetObject</td><td>Object</td>
|
||||
* <tr><th scope="row">targetObject</th><td>Object</td>
|
||||
* <td>Object on which to execute this method.</td></tr>
|
||||
* <tr><td>targetType</td><td>String</td>
|
||||
* <tr><th scope="row">targetType</th><td>String</td>
|
||||
* <td>type of object reference for targetObject. Can be:
|
||||
* ObjectReference | Handle | EJBHandle | IOR | RMIReference.</td></tr>
|
||||
* <tr><td>value</td><td>Object</td>
|
||||
* <tr><th scope="row">value</th><td>Object</td>
|
||||
* <td>Cached value for operation.</td></tr>
|
||||
* <tr><td>displayName</td><td>String</td>
|
||||
* <tr><th scope="row">displayName</th><td>String</td>
|
||||
* <td>Human readable display name of the operation.</td>
|
||||
* <tr><td>currencyTimeLimit</td><td>Number</td>
|
||||
* <tr><th scope="row">currencyTimeLimit</th><td>Number</td>
|
||||
* <td>How long cached value is valid.</td></tr>
|
||||
* <tr><td>lastUpdatedTimeStamp</td><td>Number</td>
|
||||
* <tr><th scope="row">lastUpdatedTimeStamp</th><td>Number</td>
|
||||
* <td>When cached value was set.</td></tr>
|
||||
* <tr><td>visibility</td><td>Number</td>
|
||||
* <tr><th scope="row">visibility</th><td>Number</td>
|
||||
* <td>1-4 where 1: always visible 4: rarely visible.</td></tr>
|
||||
* <tr><td>presentationString</td><td>String</td>
|
||||
* <tr><th scope="row">presentationString</th><td>String</td>
|
||||
* <td>XML formatted string to describe how to present operation</td></tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <p>The default descriptor will have name, descriptorType, displayName and
|
||||
|
@ -40,34 +40,38 @@ import javax.management.ObjectName;
|
||||
*
|
||||
* <p>The notification type is one of the following:</p>
|
||||
*
|
||||
* <table>
|
||||
* <table class="striped">
|
||||
* <caption style="display:none">JMXConnectionNotification Types</caption>
|
||||
*
|
||||
* <thead style="text-align:left">
|
||||
* <tr>
|
||||
* <th style="text-align:left">Type</th>
|
||||
* <th style="text-align:left">Meaning</th>
|
||||
* <th scope="col">Type</th>
|
||||
* <th scope="col">Meaning</th>
|
||||
* </tr>
|
||||
* </thead>
|
||||
*
|
||||
* <tbody style="text-align:left">
|
||||
* <tr>
|
||||
* <td><code>jmx.remote.connection.opened</code></td>
|
||||
* <th scope="row"><code>jmx.remote.connection.opened</code></th>
|
||||
* <td>A new client connection has been opened.</td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr>
|
||||
* <td><code>jmx.remote.connection.closed</code></td>
|
||||
* <th scope="row"><code>jmx.remote.connection.closed</code></th>
|
||||
* <td>A client connection has been closed.</td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr>
|
||||
* <td><code>jmx.remote.connection.failed</code></td>
|
||||
* <th scope="row"><code>jmx.remote.connection.failed</code></th>
|
||||
* <td>A client connection has failed unexpectedly.</td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr>
|
||||
* <td><code>jmx.remote.connection.notifs.lost</code></td>
|
||||
* <th scope="row"><code>jmx.remote.connection.notifs.lost</code></th>
|
||||
* <td>A client connection has potentially lost notifications. This
|
||||
* notification only appears on the client side.</td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
*
|
||||
* <p>The <code>timeStamp</code> of the notification is a time value
|
||||
|
@ -80,62 +80,64 @@ import java.util.Properties;
|
||||
*
|
||||
<table class="striped"><caption style="display:none">examples showing string
|
||||
form of composite name and its corresponding structural form (CompositeName)</caption>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>String Name</th>
|
||||
<th>CompositeName</th>
|
||||
<th scope="col">String Name</th>
|
||||
<th scope="col">CompositeName</th>
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
<tbody style="text-align:left">
|
||||
<tr>
|
||||
<td>
|
||||
<th scope="row">
|
||||
""
|
||||
</td>
|
||||
</th>
|
||||
<td>{} (the empty name == new CompositeName("") == new CompositeName())
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<th scope="row">
|
||||
"x"
|
||||
</td>
|
||||
</th>
|
||||
<td>{"x"}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<th scope="row">
|
||||
"x/y"
|
||||
</td>
|
||||
</th>
|
||||
<td>{"x", "y"}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>"x/"</td>
|
||||
<th scope="row">"x/"</th>
|
||||
<td>{"x", ""}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>"/x"</td>
|
||||
<th scope="row">"/x"</th>
|
||||
<td>{"", "x"}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>"/"</td>
|
||||
<th scope="row">"/"</th>
|
||||
<td>{""}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>"//"</td>
|
||||
<th scope="row">"//"</th>
|
||||
<td>{"", ""}</td>
|
||||
</tr>
|
||||
|
||||
<tr><td>"/x/"</td>
|
||||
<tr><th scope="row">"/x/"</th>
|
||||
<td>{"", "x", ""}</td>
|
||||
</tr>
|
||||
|
||||
<tr><td>"x//y"</td>
|
||||
<tr><th scope="row">"x//y"</th>
|
||||
<td>{"x", "", "y"}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
*
|
||||
*<h1>Composition Examples</h1>
|
||||
@ -147,48 +149,50 @@ import java.util.Properties;
|
||||
|
||||
<table class="striped"><caption style="display:none">composition examples
|
||||
showing string names and composite names</caption>
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>String Names</th>
|
||||
<th>CompositeNames</th>
|
||||
<th scope="col">String Names</th>
|
||||
<th scope="col">CompositeNames</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody style="text-align:left">
|
||||
<tr>
|
||||
<td>
|
||||
<th scope="row">
|
||||
"x/y" + "/" = x/y/
|
||||
</td>
|
||||
</th>
|
||||
<td>
|
||||
{"x", "y"} + {""} = {"x", "y", ""}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<th scope="row">
|
||||
"" + "x" = "x"
|
||||
</td>
|
||||
</th>
|
||||
<td>
|
||||
{} + {"x"} = {"x"}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<th scope="row">
|
||||
"/" + "x" = "/x"
|
||||
</td>
|
||||
</th>
|
||||
<td>
|
||||
{""} + {"x"} = {"", "x"}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<th scope="row">
|
||||
"x" + "" + "" = "x"
|
||||
</td>
|
||||
</th>
|
||||
<td>
|
||||
{"x"} + {} + {} = {"x"}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
*
|
||||
*<h1>Multithreaded Access</h1>
|
||||
|
@ -34,7 +34,7 @@ import static sun.nio.cs.CharsetMapping.*;
|
||||
|
||||
public class MS932_0213 extends Charset {
|
||||
public MS932_0213() {
|
||||
super("x-MS932_0213", ExtendedCharsets.aliasesFor("MS932_0213"));
|
||||
super("x-MS932_0213", ExtendedCharsets.aliasesFor("x-MS932_0213"));
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
|
@ -59,7 +59,7 @@ import sun.nio.cs.*;
|
||||
|
||||
public class SJIS_0213 extends Charset {
|
||||
public SJIS_0213() {
|
||||
super("x-SJIS_0213", ExtendedCharsets.aliasesFor("SJIS_0213"));
|
||||
super("x-SJIS_0213", ExtendedCharsets.aliasesFor("x-SJIS_0213"));
|
||||
}
|
||||
|
||||
public boolean contains(Charset cs) {
|
||||
|
@ -3532,7 +3532,7 @@ public class ConsoleReader
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a platform-dependant newline.
|
||||
* Output a platform-dependent newline.
|
||||
*/
|
||||
public final void println() throws IOException {
|
||||
print(CR);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,7 +57,7 @@ getName(PacketInputStream *in, PacketOutputStream *out)
|
||||
}
|
||||
(void)outStream_writeString(out, name);
|
||||
if (name != NULL) {
|
||||
jvmtiDeallocate(name);
|
||||
JNI_FUNC_PTR(env, ReleaseStringUTFChars)(env, namestr, name);
|
||||
}
|
||||
return JNI_TRUE;
|
||||
}
|
||||
|
@ -42,9 +42,9 @@
|
||||
* entire address list at an endpoint for a specific session.
|
||||
*
|
||||
* <P> SCTP is message based. I/O operations operate upon messages and message
|
||||
* boundaries are preserved. Each association may support multiple independant
|
||||
* boundaries are preserved. Each association may support multiple independent
|
||||
* logical streams. Each stream represents a sequence of messages within a single
|
||||
* association and streams are independant of one another, meaning that stream
|
||||
* association and streams are independent of one another, meaning that stream
|
||||
* identifiers and sequence numbers are included in the data packet to allow
|
||||
* sequencing of messages on a per-stream basis.
|
||||
*
|
||||
|
@ -25,7 +25,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.time.chrono.JapaneseChronology;
|
||||
import java.time.chrono.JapaneseDate;
|
||||
import java.time.chrono.JapaneseEra;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.TextStyle;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@ -166,17 +166,15 @@ public class SupplementalJapaneseEraTest {
|
||||
errors++;
|
||||
}
|
||||
|
||||
// test long/abbreviated names with java.time.format
|
||||
got = new DateTimeFormatterBuilder()
|
||||
.appendPattern("GGGG")
|
||||
.appendLiteral(" ")
|
||||
.appendPattern("G")
|
||||
.toFormatter(Locale.US)
|
||||
// test full/short/narrow names with java.time.format
|
||||
got = DateTimeFormatter
|
||||
.ofPattern("GGGG G GGGGG")
|
||||
.withLocale(Locale.US)
|
||||
.withChronology(JapaneseChronology.INSTANCE)
|
||||
.format(jdate);
|
||||
expected = NEW_ERA_NAME + " " + NEW_ERA_ABBR;
|
||||
expected = NEW_ERA_NAME + " " + NEW_ERA_NAME + " " + NEW_ERA_ABBR;
|
||||
if (!expected.equals(got)) {
|
||||
System.err.printf("java.time formatter long/abbr names: got=\"%s\", expected=\"%s\"%n", got, expected);
|
||||
System.err.printf("java.time formatter full/short/narrow names: got=\"%s\", expected=\"%s\"%n", got, expected);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public final class LayoutControlPanel extends JPanel implements SwingConstants {
|
||||
// PositioningListener positioningListener = new PositioningListener();
|
||||
// JRadioButton absolutePos = new JRadioButton("Absolute");
|
||||
// absolutePos.setMnemonic('a');
|
||||
// absolutePos.setToolTipText("Text/Content positioning is independant of line direction");
|
||||
// absolutePos.setToolTipText("Text/Content positioning is independent of line direction");
|
||||
// group.add(absolutePos);
|
||||
// absolutePos.addItemListener(positioningListener);
|
||||
// add(absolutePos);
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 4114080
|
||||
* @bug 4114080 8186803
|
||||
* @summary Make sure the euro converters, which are derived from
|
||||
* existing converters, only differ from their parents at the expected
|
||||
* code point.
|
||||
@ -98,9 +98,9 @@ public class EuroConverter {
|
||||
bytes[0] = (byte)j;
|
||||
char euroValue = new String(bytes, euroEnc).charAt(0);
|
||||
chars[0] = euroValue;
|
||||
// NOTE: 0x15 doesn't round trip on the EBCDIC code pages,
|
||||
// NOTE: 0x25 doesn't round trip on the EBCDIC code pages,
|
||||
// so we don't check that code point in the sanity check.
|
||||
if (j != 0x0015) {
|
||||
if (j != 0x0025) {
|
||||
int euroRoundTrip = new String(chars).getBytes(euroEnc)[0];
|
||||
if (euroRoundTrip != j) {
|
||||
pass = false;
|
||||
|
659
jdk/test/sun/nio/cs/TestCharsetMapping.java
Normal file
659
jdk/test/sun/nio/cs/TestCharsetMapping.java
Normal file
@ -0,0 +1,659 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 8186801
|
||||
* @summary Test the charset mappings
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.*;
|
||||
import java.nio.file.*;
|
||||
import java.nio.charset.*;
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
import java.util.regex.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
public class TestCharsetMapping {
|
||||
|
||||
private static final int BUFSIZ = 8192; // Initial buffer size
|
||||
private static final int MAXERRS = 10; // Errors reported per test
|
||||
|
||||
private static final PrintStream log = System.out;
|
||||
|
||||
// Set by -v on the command line
|
||||
private static boolean verbose = false;
|
||||
|
||||
// Test modes
|
||||
private static final int ENCODE = 1;
|
||||
private static final int DECODE = 2;
|
||||
|
||||
// Utilities
|
||||
private static ByteBuffer expand(ByteBuffer bb) {
|
||||
ByteBuffer nbb = ByteBuffer.allocate(bb.capacity() * 2);
|
||||
bb.flip();
|
||||
nbb.put(bb);
|
||||
return nbb;
|
||||
}
|
||||
|
||||
private static CharBuffer expand(CharBuffer cb) {
|
||||
CharBuffer ncb = CharBuffer.allocate(cb.capacity() * 2);
|
||||
cb.flip();
|
||||
ncb.put(cb);
|
||||
return ncb;
|
||||
}
|
||||
|
||||
private static byte[] parseBytes(String s) {
|
||||
int nb = s.length() / 2;
|
||||
byte[] bs = new byte[nb];
|
||||
for (int i = 0; i < nb; i++) {
|
||||
int j = i * 2;
|
||||
if (j + 2 > s.length())
|
||||
throw new RuntimeException("Malformed byte string: " + s);
|
||||
bs[i] = (byte)Integer.parseInt(s.substring(j, j + 2), 16);
|
||||
}
|
||||
return bs;
|
||||
}
|
||||
|
||||
private static String printBytes(byte[] bs) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < bs.length; i++) {
|
||||
sb.append(Integer.toHexString((bs[i] >> 4) & 0xf));
|
||||
sb.append(Integer.toHexString((bs[i] >> 0) & 0xf));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static String printCodePoint(int cp) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("U+");
|
||||
if (cp > 0xffff)
|
||||
sb.append(Integer.toHexString((cp >> 16) & 0xf));
|
||||
sb.append(Integer.toHexString((cp >> 12) & 0xf));
|
||||
sb.append(Integer.toHexString((cp >> 8) & 0xf));
|
||||
sb.append(Integer.toHexString((cp >> 4) & 0xf));
|
||||
sb.append(Integer.toHexString((cp >> 0) & 0xf));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static int getCodePoint(CharBuffer cb) {
|
||||
char c = cb.get();
|
||||
if (Character.isHighSurrogate(c))
|
||||
return Character.toCodePoint(c, cb.get());
|
||||
else
|
||||
return c;
|
||||
}
|
||||
|
||||
private static String plural(int n) {
|
||||
return (n == 1 ? "" : "s");
|
||||
}
|
||||
|
||||
// TestCharsetMapping
|
||||
private CharsetInfo csinfo;
|
||||
private CharsetDecoder decoder = null;
|
||||
private CharsetEncoder encoder = null;
|
||||
|
||||
// Stateful dbcs encoding has leading shift byte '0x0e'
|
||||
// and trailing shift byte '0x0f'.
|
||||
// The flag variable shiftHackDBCS is 'true' for stateful
|
||||
// EBCDIC encodings, which indicates the need of adding/
|
||||
// removing the shift bytes.
|
||||
private boolean shiftHackDBCS = false;
|
||||
|
||||
private TestCharsetMapping(CharsetInfo csinfo) throws Exception {
|
||||
this.csinfo = csinfo;
|
||||
this.encoder = csinfo.cs.newEncoder()
|
||||
.onUnmappableCharacter(CodingErrorAction.REPLACE)
|
||||
.onMalformedInput(CodingErrorAction.REPLACE);
|
||||
this.decoder = csinfo.cs.newDecoder()
|
||||
.onUnmappableCharacter(CodingErrorAction.REPLACE)
|
||||
.onMalformedInput(CodingErrorAction.REPLACE);
|
||||
}
|
||||
|
||||
private class Test {
|
||||
// An instance of this class tests all mappings for
|
||||
// a particular bytesPerChar value
|
||||
private int bytesPerChar;
|
||||
|
||||
// Reference data from .map/nr/c2b files
|
||||
private ByteBuffer refBytes = ByteBuffer.allocate(BUFSIZ);
|
||||
private CharBuffer refChars = CharBuffer.allocate(BUFSIZ);
|
||||
|
||||
private ByteBuffer dRefBytes = ByteBuffer.allocateDirect(BUFSIZ);
|
||||
private CharBuffer dRefChars = ByteBuffer.allocateDirect(BUFSIZ*2).asCharBuffer();
|
||||
|
||||
private Test(int bpc) {
|
||||
bytesPerChar = bpc;
|
||||
}
|
||||
|
||||
// shiftHackDBCS can add the leading/trailing shift bytesa
|
||||
private void put(byte[] bs) {
|
||||
if (refBytes.remaining() < bytesPerChar)
|
||||
refBytes = expand(refBytes);
|
||||
refBytes.put(bs);
|
||||
}
|
||||
|
||||
private void put(byte[] bs, char[] cc) {
|
||||
if (bs.length != bytesPerChar)
|
||||
throw new IllegalArgumentException(bs.length
|
||||
+ " != "
|
||||
+ bytesPerChar);
|
||||
if (refBytes.remaining() < bytesPerChar)
|
||||
refBytes = expand(refBytes);
|
||||
refBytes.put(bs);
|
||||
if (refChars.remaining() < cc.length)
|
||||
refChars = expand(refChars);
|
||||
refChars.put(cc);
|
||||
}
|
||||
|
||||
private boolean decode(ByteBuffer refBytes, CharBuffer refChars)
|
||||
throws Exception {
|
||||
log.println(" decode" + (refBytes.isDirect()?" (direct)":""));
|
||||
CharBuffer out = decoder.decode(refBytes);
|
||||
|
||||
refBytes.rewind();
|
||||
byte[] bs = new byte[bytesPerChar];
|
||||
int e = 0;
|
||||
|
||||
if (shiftHackDBCS && bytesPerChar == 2 && refBytes.get() != (byte)0x0e) {
|
||||
log.println("Missing leading byte");
|
||||
}
|
||||
|
||||
while (refChars.hasRemaining()) {
|
||||
refBytes.get(bs);
|
||||
int rcp = getCodePoint(refChars);
|
||||
int ocp = getCodePoint(out);
|
||||
if (rcp != ocp) {
|
||||
log.println(" Error: "
|
||||
+ printBytes(bs)
|
||||
+ " --> "
|
||||
+ printCodePoint(ocp)
|
||||
+ ", expected "
|
||||
+ printCodePoint(rcp));
|
||||
if (++e >= MAXERRS) {
|
||||
log.println(" Too many errors, giving up");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (verbose) {
|
||||
log.println(" "
|
||||
+ printBytes(bs)
|
||||
+ " --> "
|
||||
+ printCodePoint(rcp));
|
||||
}
|
||||
}
|
||||
|
||||
if (shiftHackDBCS && bytesPerChar == 2 && refBytes.get() != (byte)0x0f) {
|
||||
log.println("Missing trailing byte");
|
||||
}
|
||||
|
||||
if (e == 0 && (refChars.hasRemaining() || out.hasRemaining())) {
|
||||
// Paranoia: Didn't consume everything
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
refBytes.rewind();
|
||||
refChars.rewind();
|
||||
return (e == 0);
|
||||
}
|
||||
|
||||
private boolean encode(ByteBuffer refBytes, CharBuffer refChars)
|
||||
throws Exception {
|
||||
log.println(" encode" + (refBytes.isDirect()?" (direct)":""));
|
||||
ByteBuffer out = encoder.encode(refChars);
|
||||
refChars.rewind();
|
||||
|
||||
if (shiftHackDBCS && bytesPerChar == 2 && out.get() != refBytes.get()) {
|
||||
log.println("Missing leading byte");
|
||||
return false;
|
||||
}
|
||||
|
||||
byte[] rbs = new byte[bytesPerChar];
|
||||
byte[] obs = new byte[bytesPerChar];
|
||||
int e = 0;
|
||||
while (refChars.hasRemaining()) {
|
||||
int cp = getCodePoint(refChars);
|
||||
refBytes.get(rbs);
|
||||
out.get(obs);
|
||||
boolean eq = true;
|
||||
for (int i = 0; i < bytesPerChar; i++)
|
||||
eq &= rbs[i] == obs[i];
|
||||
if (!eq) {
|
||||
log.println(" Error: "
|
||||
+ printCodePoint(cp)
|
||||
+ " --> "
|
||||
+ printBytes(obs)
|
||||
+ ", expected "
|
||||
+ printBytes(rbs));
|
||||
if (++e >= MAXERRS) {
|
||||
log.println(" Too many errors, giving up");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (verbose) {
|
||||
log.println(" "
|
||||
+ printCodePoint(cp)
|
||||
+ " --> "
|
||||
+ printBytes(rbs));
|
||||
}
|
||||
}
|
||||
|
||||
if (shiftHackDBCS && bytesPerChar == 2 && out.get() != refBytes.get()) {
|
||||
log.println("Missing trailing byte");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (e == 0 && (refBytes.hasRemaining() || out.hasRemaining())) {
|
||||
// Paranoia: Didn't consume everything
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
refBytes.rewind();
|
||||
refChars.rewind();
|
||||
return (e == 0);
|
||||
}
|
||||
|
||||
private boolean run(int mode) throws Exception {
|
||||
log.println(" " + bytesPerChar
|
||||
+ " byte" + plural(bytesPerChar) + "/char");
|
||||
|
||||
if (dRefBytes.capacity() < refBytes.capacity()) {
|
||||
dRefBytes = ByteBuffer.allocateDirect(refBytes.capacity());
|
||||
}
|
||||
if (dRefChars.capacity() < refChars.capacity()) {
|
||||
dRefChars = ByteBuffer.allocateDirect(refChars.capacity()*2)
|
||||
.asCharBuffer();
|
||||
}
|
||||
refBytes.flip();
|
||||
refChars.flip();
|
||||
dRefBytes.clear();
|
||||
dRefChars.clear();
|
||||
|
||||
dRefBytes.put(refBytes).flip();
|
||||
dRefChars.put(refChars).flip();
|
||||
refBytes.flip();
|
||||
refChars.flip();
|
||||
|
||||
boolean rv = true;
|
||||
if (mode != ENCODE) {
|
||||
rv &= decode(refBytes, refChars);
|
||||
rv &= decode(dRefBytes, dRefChars);
|
||||
}
|
||||
if (mode != DECODE) {
|
||||
rv &= encode(refBytes, refChars);
|
||||
rv &= encode(dRefBytes, dRefChars);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
// Maximum bytes/char being tested
|
||||
private int maxBytesPerChar = 0;
|
||||
|
||||
// Tests, indexed by bytesPerChar - 1
|
||||
private Test[] tests;
|
||||
|
||||
private void clearTests() {
|
||||
maxBytesPerChar = 0;
|
||||
tests = new Test[0];
|
||||
}
|
||||
|
||||
// Find the test for the given bytes/char value,
|
||||
// expanding the test array if needed
|
||||
//
|
||||
private Test testFor(int bpc) {
|
||||
if (bpc > maxBytesPerChar) {
|
||||
Test[] ts = new Test[bpc];
|
||||
System.arraycopy(tests, 0, ts, 0, maxBytesPerChar);
|
||||
for (int i = maxBytesPerChar; i < bpc; i++)
|
||||
ts[i] = new Test(i + 1);
|
||||
tests = ts;
|
||||
maxBytesPerChar = bpc;
|
||||
}
|
||||
return tests[bpc - 1];
|
||||
}
|
||||
|
||||
private boolean testStringConv() throws Exception {
|
||||
if (shiftHackDBCS) {
|
||||
log.println(" string de/encoding skipped for ebcdic");
|
||||
return true;
|
||||
}
|
||||
boolean rv = true;
|
||||
log.println(" string de/encoding");
|
||||
// for new String()
|
||||
ByteArrayOutputStream baosDec = new ByteArrayOutputStream();
|
||||
StringBuilder sbDec = new StringBuilder();
|
||||
// for String.getBytes()
|
||||
ByteArrayOutputStream baosEnc = new ByteArrayOutputStream();
|
||||
StringBuilder sbEnc = new StringBuilder();
|
||||
|
||||
for (Entry e : csinfo.mappings) {
|
||||
baosDec.write(e.bs);
|
||||
sbDec.append(Character.toChars(e.cp));
|
||||
if (e.cp2 != 0)
|
||||
sbDec.append(e.cp2);
|
||||
|
||||
// non-roundtrip b2c, and c2b
|
||||
if (csinfo.nr != null && csinfo.nr.containsKey(e.bb) ||
|
||||
csinfo.c2b != null && !csinfo.c2b.containsKey(e.cp))
|
||||
continue;
|
||||
baosEnc.write(e.bs);
|
||||
sbEnc.append(Character.toChars(e.cp));
|
||||
if (e.cp2 != 0)
|
||||
sbEnc.append(e.cp2);
|
||||
}
|
||||
log.println(" new String()");
|
||||
if (!new String(baosDec.toByteArray(), csinfo.csName).equals(sbDec.toString())) {
|
||||
log.println(" Error: new String() failed");
|
||||
rv = false;
|
||||
}
|
||||
log.println(" String.getBytes()");
|
||||
if (!Arrays.equals(baosEnc.toByteArray(), sbEnc.toString().getBytes(csinfo.csName))) {
|
||||
log.println(" Error: String().getBytes() failed");
|
||||
rv = false;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
private boolean run() throws Exception {
|
||||
boolean rv = true;
|
||||
shiftHackDBCS = csinfo.type.equals("ebcdic"); // isStateful;
|
||||
|
||||
// (1) new String()/String.getBytes()
|
||||
rv &= testStringConv();
|
||||
|
||||
// (2) DECODE:
|
||||
clearTests();
|
||||
if (shiftHackDBCS) {
|
||||
testFor(2).put(new byte[] { 0x0e });
|
||||
}
|
||||
csinfo.mappings.forEach(e -> {
|
||||
if (e.cp2 != 0)
|
||||
return; // skip composite (base+cc) for now
|
||||
byte[] bs = e.bs;
|
||||
char[] cc = Character.toChars(e.cp);
|
||||
testFor(bs.length).put(bs, cc);
|
||||
});
|
||||
if (shiftHackDBCS) {
|
||||
testFor(2).put(new byte[] { 0x0f });
|
||||
}
|
||||
for (int i = 0; i < maxBytesPerChar; i++) {
|
||||
rv &= tests[i].run(DECODE);
|
||||
}
|
||||
|
||||
// (3) ENCODE:
|
||||
clearTests();
|
||||
if (shiftHackDBCS) {
|
||||
testFor(2).put(new byte[] { 0x0e });
|
||||
}
|
||||
csinfo.mappings.forEach(e -> {
|
||||
if (e.cp2 != 0)
|
||||
return; // skip composite (base+cc) for now
|
||||
if (csinfo.nr != null && csinfo.nr.containsKey(e.bb))
|
||||
return; // non-roundtrip b2c
|
||||
if (csinfo.c2b != null && csinfo.c2b.containsKey(e.cp))
|
||||
return; // c2b only mapping
|
||||
byte[] bs = e.bs;
|
||||
char[] cc = Character.toChars(e.cp);
|
||||
testFor(bs.length).put(bs, cc);
|
||||
});
|
||||
if (csinfo.c2b != null)
|
||||
csinfo.c2b.values().forEach(e -> {
|
||||
byte[] bs = e.bs;
|
||||
char[] cc = Character.toChars(e.cp);
|
||||
testFor(bs.length).put(bs, cc);
|
||||
});
|
||||
if (shiftHackDBCS) {
|
||||
testFor(2).put(new byte[] { 0x0f });
|
||||
}
|
||||
for (int i = 0; i < maxBytesPerChar; i++) {
|
||||
rv &= tests[i].run(ENCODE);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
private static class Entry {
|
||||
byte[] bs; // byte sequence reps
|
||||
int cp; // Unicode codepoint
|
||||
int cp2; // CC of composite
|
||||
long bb; // bs in "long" form for nr lookup;
|
||||
}
|
||||
|
||||
private final static int UNMAPPABLE = 0xFFFD;
|
||||
private static final Pattern ptn = Pattern.compile("(?:0x)?(\\p{XDigit}++)\\s++(?:U\\+|0x)?(\\p{XDigit}++)(?:\\s++#.*)?");
|
||||
private static final int G_BS = 1;
|
||||
private static final int G_CP = 2;
|
||||
private static final int G_CP2 = 3;
|
||||
|
||||
private static class CharsetInfo {
|
||||
Charset cs;
|
||||
String pkgName;
|
||||
String clzName;
|
||||
String csName;
|
||||
String hisName;
|
||||
String type;
|
||||
boolean isInternal;
|
||||
Set<String> aliases = new HashSet<>();
|
||||
|
||||
// mapping entries
|
||||
List<Entry> mappings;
|
||||
Map<Long, Entry> nr; // bytes -> entry
|
||||
Map<Integer, Entry> c2b; // cp -> entry
|
||||
|
||||
CharsetInfo(String csName, String clzName) {
|
||||
this.csName = csName;
|
||||
this.clzName = clzName;
|
||||
}
|
||||
|
||||
private Entry parse(Matcher m) {
|
||||
Entry e = new Entry();
|
||||
e.bb = Long.parseLong(m.group(G_BS), 16);
|
||||
if (e.bb < 0x100)
|
||||
e.bs = new byte[] { (byte)e.bb };
|
||||
else
|
||||
e.bs = parseBytes(m.group(G_BS));
|
||||
e.cp = Integer.parseInt(m.group(G_CP), 16);
|
||||
if (G_CP2 <= m.groupCount() && m.group(G_CP2) != null)
|
||||
e.cp2 = Integer.parseInt(m.group(G_CP2), 16);
|
||||
else
|
||||
e.cp2 = 0;
|
||||
return e;
|
||||
}
|
||||
|
||||
boolean loadMappings(Path dir) throws IOException {
|
||||
// xxx.map
|
||||
Path path = dir.resolve(clzName + ".map");
|
||||
if (!Files.exists(path)) {
|
||||
return false;
|
||||
}
|
||||
Matcher m = ptn.matcher("");
|
||||
mappings = Files.lines(path)
|
||||
.filter(ln -> !ln.startsWith("#") && m.reset(ln).lookingAt())
|
||||
.map(ln -> parse(m))
|
||||
.filter(e -> e.cp != UNMAPPABLE) // non-mapping
|
||||
.collect(Collectors.toList());
|
||||
// xxx.nr
|
||||
path = dir.resolve(clzName + ".nr");
|
||||
if (Files.exists(path)) {
|
||||
nr = Files.lines(path)
|
||||
.filter(ln -> !ln.startsWith("#") && m.reset(ln).lookingAt())
|
||||
.map(ln -> parse(m))
|
||||
.collect(Collectors.toMap(e -> e.bb, Function.identity()));
|
||||
}
|
||||
// xxx.c2b
|
||||
path = dir.resolve(clzName + ".c2b");
|
||||
if (Files.exists(path)) {
|
||||
c2b = Files.lines(path)
|
||||
.filter(ln -> !ln.startsWith("#") && m.reset(ln).lookingAt())
|
||||
.map(ln -> parse(m))
|
||||
.collect(Collectors.toMap(e -> e.cp, Function.identity()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static Set<CharsetInfo> charsets(Path cslist) throws IOException {
|
||||
Set<CharsetInfo> charsets = new LinkedHashSet<>();
|
||||
Iterator<String> itr = Files.readAllLines(cslist).iterator();
|
||||
CharsetInfo cs = null;
|
||||
|
||||
while (itr.hasNext()) {
|
||||
String line = itr.next();
|
||||
if (line.startsWith("#") || line.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
String[] tokens = line.split("\\s+");
|
||||
if (tokens.length < 2) {
|
||||
continue;
|
||||
}
|
||||
if ("charset".equals(tokens[0])) {
|
||||
if (cs != null) {
|
||||
charsets.add(cs);
|
||||
cs = null;
|
||||
}
|
||||
if (tokens.length < 3) {
|
||||
throw new RuntimeException("Error: incorrect charset line [" + line + "]");
|
||||
}
|
||||
cs = new CharsetInfo(tokens[1], tokens[2]);
|
||||
} else {
|
||||
String key = tokens[1]; // leading empty str
|
||||
switch (key) {
|
||||
case "alias":
|
||||
if (tokens.length < 3) {
|
||||
throw new RuntimeException("Error: incorrect alias line [" + line + "]");
|
||||
}
|
||||
cs.aliases.add(tokens[2]); // ALIAS_NAME
|
||||
break;
|
||||
case "package":
|
||||
cs.pkgName = tokens[2];
|
||||
break;
|
||||
case "type":
|
||||
cs.type = tokens[2];
|
||||
break;
|
||||
case "hisname":
|
||||
cs.hisName = tokens[2];
|
||||
break;
|
||||
case "internal":
|
||||
cs.isInternal = Boolean.parseBoolean(tokens[2]);
|
||||
break;
|
||||
default: // ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cs != null) {
|
||||
charsets.add(cs);
|
||||
}
|
||||
return charsets;
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
Path dir = Paths.get(System.getProperty("test.src", ".") +
|
||||
"/../../../../make/data/charsetmapping");
|
||||
if (!Files.exists(dir)) {
|
||||
// not inside jdk repo, no mappings, exit silently
|
||||
log.println("Nothing done, not in a jdk repo: ");
|
||||
return;
|
||||
}
|
||||
if (args.length > 0 && "-v".equals(args[0])) {
|
||||
// For debugging: java CoderTest [-v]
|
||||
verbose = true;
|
||||
}
|
||||
|
||||
int errors = 0;
|
||||
int tested = 0;
|
||||
int skipped = 0;
|
||||
int known = 0;
|
||||
|
||||
for (CharsetInfo csinfo : charsets(dir.resolve("charsets"))) {
|
||||
String csname = csinfo.csName;
|
||||
|
||||
if (csinfo.isInternal) {
|
||||
continue;
|
||||
}
|
||||
|
||||
log.printf("%ntesting: %-16s", csname);
|
||||
|
||||
if (!Charset.isSupported(csname)) {
|
||||
errors++;
|
||||
log.println(" [error: charset is not supported]");
|
||||
continue;
|
||||
}
|
||||
|
||||
Charset cs = csinfo.cs = Charset.forName(csinfo.csName);
|
||||
// test name()
|
||||
if (!cs.name().equals(csinfo.csName)) {
|
||||
errors++;
|
||||
log.printf(" [error: wrong csname: " + csinfo.csName
|
||||
+ " vs " + cs.name() + "]");
|
||||
}
|
||||
// test aliases()
|
||||
if (!cs.aliases().equals(csinfo.aliases)) {
|
||||
errors++;
|
||||
log.printf(" [error wrong aliases]");
|
||||
if (verbose) {
|
||||
log.println();
|
||||
log.println(" expected: " + csinfo.aliases);
|
||||
log.println(" got: " + cs.aliases());
|
||||
}
|
||||
}
|
||||
|
||||
if (csinfo.type.equals("source")) {
|
||||
log.println(" [skipped: source based]");
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!csinfo.loadMappings(dir)) {
|
||||
log.println(" [error loading mappings failed]");
|
||||
errors++;
|
||||
continue;
|
||||
}
|
||||
|
||||
tested++;
|
||||
log.println();
|
||||
if (!new TestCharsetMapping(csinfo).run()) {
|
||||
|
||||
/////////////// known nr/c2b issues ////////////////
|
||||
if (csinfo.csName.equals("x-IBM948") ||
|
||||
csinfo.csName.equals("x-IBM950") ||
|
||||
csinfo.csName.equals("x-IBM937") ||
|
||||
csinfo.csName.equals("x-IBM1383"))
|
||||
{
|
||||
log.println(" [**** skipped, KNOWN nr/c2b mapping issue]");
|
||||
known++;
|
||||
continue;
|
||||
}
|
||||
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
|
||||
log.println();
|
||||
log.println(tested + " charset" + plural(tested) + " tested, "
|
||||
+ skipped + " skipped, " + known + " known issue(s)");
|
||||
log.println();
|
||||
if (errors > 0)
|
||||
throw new Exception("Errors detected in "
|
||||
+ errors + " charset" + plural(errors));
|
||||
}
|
||||
}
|
73
jdk/test/sun/nio/cs/TestEBCDICLineFeed.java
Normal file
73
jdk/test/sun/nio/cs/TestEBCDICLineFeed.java
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 8186803
|
||||
* @summary Check if the linefeed is de/encoded correctly in ebcdic
|
||||
* @modules jdk.charsets
|
||||
*/
|
||||
|
||||
public class TestEBCDICLineFeed {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
String[] csnames = new String[] {
|
||||
"IBM037", "IBM1025", "IBM1026", "IBM1112", "IBM1122", "IBM1123",
|
||||
"IBM1166", "IBM273", "IBM277", "IBM278", "IBM280", "IBM284",
|
||||
"IBM285", "IBM297", "IBM420", "IBM424", "IBM500", "IBM838",
|
||||
"IBM870", "IBM871", "IBM875", "IBM918", "IBM930", "IBM935",
|
||||
"IBM937", "IBM939",
|
||||
|
||||
"IBM01140", "IBM01141", "IBM01142", "IBM01143", "IBM01144",
|
||||
"IBM01145", "IBM01146", "IBM01147", "IBM01148", "IBM01149",
|
||||
};
|
||||
|
||||
int errs = 0;
|
||||
for (String cs : csnames) {
|
||||
byte[] bb = "\n".getBytes(cs);
|
||||
if (bb.length != 1 || bb[0] != 0x15) {
|
||||
System.out.printf(" error: %s c2b u+000A -> %x%n",
|
||||
cs, bb[0] & 0xff);
|
||||
errs++;
|
||||
}
|
||||
bb = "\u0085".getBytes(cs);
|
||||
if (bb.length != 1 || bb[0] != 0x15) {
|
||||
System.out.printf(" error: %s c2b u+0085 -> %x%n",
|
||||
cs, bb[0] & 0xff);
|
||||
errs++;
|
||||
}
|
||||
String str = new String(new byte[] { 0x15 }, cs);
|
||||
if (!str.equals("\n")) {
|
||||
System.out.printf(" error: %s b2c 0015 -> 0x%x%n",
|
||||
cs, str.toCharArray()[0] & 0xffff);
|
||||
}
|
||||
str = new String(new byte[] { 0x25 }, cs);
|
||||
if (!str.equals("\n")) {
|
||||
System.out.printf(" error: %s b2c 0025 -> 0x%x%n",
|
||||
cs, str.toCharArray()[0] & 0xffff);
|
||||
}
|
||||
}
|
||||
if (errs > 0)
|
||||
throw new Exception(errs + " error(s) detected");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user