--- a/.hgtags-top-repo Thu Aug 06 11:17:57 2015 -0700
+++ b/.hgtags-top-repo Wed Jul 05 20:44:51 2017 +0200
@@ -318,3 +318,4 @@
4c2cbaae528bce970dabbb5676005d379357f4b6 jdk9-b73
57f3134853ecdd4a3ee2d4d26f22ba981d653d79 jdk9-b74
8fd6eeb878606e39c908f12535f34ebbfd225a4a jdk9-b75
+d82072b699b880a1f647a5e2d7c0f86cec958941 jdk9-b76
--- a/corba/.hgtags Thu Aug 06 11:17:57 2015 -0700
+++ b/corba/.hgtags Wed Jul 05 20:44:51 2017 +0200
@@ -318,3 +318,4 @@
29096b78d93b01a2f8882509cd40755e3d6b8cd9 jdk9-b73
622fe934e351e89107edf3c667d6b57f543f58f1 jdk9-b74
960b56805abd8460598897481820bd6a75f979e7 jdk9-b75
+d8126bc88fa5cd1ae4e44d86a4b1280ca1c9e2aa jdk9-b76
--- a/hotspot/.hgtags Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/.hgtags Wed Jul 05 20:44:51 2017 +0200
@@ -478,3 +478,4 @@
e37d432868be0aa7cb5e0f3d7caff1e825d8ead3 jdk9-b73
fff6b54e9770ac4c12c2fb4cab5aa7672affa4bd jdk9-b74
2f354281e9915275693c4e519a959b8a6f22d3a3 jdk9-b75
+0bc8d1656d6f2b1fdfe803c1305a108bb9939f35 jdk9-b76
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/SAGetopt.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+package sun.jvm.hotspot;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class SAGetopt {
+
+ private String[] _argv;
+
+ private int _optind; // index in arguments array
+ private int _optopt; // index within an argument
+ private String _optarg; // last option argument
+ private boolean _optreset; // special handling of first call
+
+ public SAGetopt(String[] args) {
+ _argv = args;
+ _optind = 0;
+ _optopt = 1;
+ _optarg = null;
+ _optreset = true;
+ }
+
+ public String getOptarg() {
+ return _optarg;
+ }
+
+ public int getOptind() {
+ return _optind;
+ }
+
+ private void extractOptarg(String opt) {
+ // Argument expected
+ if (_optind > _argv.length) {
+ throw new RuntimeException("Not enough arguments for '" + opt + "'");
+ }
+
+ if (! _argv[_optind].isEmpty() && _argv[_optind].charAt(0) == '-') {
+ throw new RuntimeException("Argument is expected for '" + opt + "'");
+ }
+
+ _optarg = _argv[_optind];
+ _optind += 1;
+ }
+
+ private String processLongOptions(String carg, String[] longOptStr) {
+ List<String> los = Arrays.asList(longOptStr);
+ String[] ca = carg.split("=", 2);
+
+ if (los.contains(ca[0])) {
+ if (ca.length > 1) {
+ throw new RuntimeException("Argument is not expected for '" + ca[0] + "'");
+ }
+ return carg;
+ }
+
+ if (los.contains(ca[0] + "=")) {
+ if (ca.length > 1) {
+ // GNU style options --file=name
+ _optarg = ca[1];
+ }
+ else {
+ // Mixed style options --file name
+ extractOptarg(ca[0]);
+ }
+
+ return ca[0];
+ }
+
+ throw new RuntimeException("Invalid option '" + ca[0] + "'");
+ }
+
+ public String next(String optStr, String[] longOptStr) {
+
+ if (_optind >= _argv.length || _argv[_optind] == null) {
+ // All arguments processed
+ return null;
+ }
+
+ String carg = _argv[_optind];
+ _optarg = null;
+
+ if (_optreset) {
+ // End of option batch like '-abc' reached, expect option to start from '-'
+
+ if (carg.isEmpty() || carg.charAt(0) != '-' || carg.equals("--")) {
+ // Stop processing on -- or first non-option argument;
+ return null;
+ }
+
+ if (carg.startsWith("--")) {
+ // Handle long options, it can't be combined so it's simple
+ if (longOptStr == null || longOptStr.length == 0) {
+ // No long options expected, stop options processing
+ return null;
+ }
+ ++ _optind;
+
+ // at this point carg contains at least one character besides --
+ carg = carg.substring(2);
+ return processLongOptions(carg, longOptStr);
+ }
+
+ if (optStr == null || optStr.length() == 0) {
+ // No short options
+ return null;
+ }
+
+ // At this point carg[0] contains '-'
+ _optreset = false;
+ _optopt = 1;
+ }
+
+ char ch = carg.charAt(_optopt);
+
+ // adjust pointer to next character
+ _optopt += 1;
+
+ // Okay, ready to process options like
+ // -abc -d bla -ef
+
+ int chIndex = optStr.indexOf(ch);
+ if (chIndex == -1) {
+ throw new RuntimeException("Invalid option '" + ch + "'");
+ }
+
+ if (_optopt >= carg.length()) {
+ _optind += 1;
+ _optreset = true;
+ }
+
+ if (chIndex < optStr.length()-1 && optStr.charAt(chIndex+1) == ':') {
+ // Argument expected
+ extractOptarg(String.valueOf(ch));
+ }
+
+ return String.valueOf(ch);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/SALauncher.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+package sun.jvm.hotspot;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import sun.jvm.hotspot.tools.JStack;
+import sun.jvm.hotspot.tools.JMap;
+import sun.jvm.hotspot.tools.JInfo;
+
+public class SALauncher {
+
+ private static boolean launcherHelp() {
+ System.out.println(" clhsdb \tcommand line debugger");
+ System.out.println(" hsdb \tui debugger");
+ System.out.println(" jstack --help\tto get more information");
+ System.out.println(" jmap --help\tto get more information");
+ System.out.println(" jinfo --help\tto get more information");
+ return false;
+ }
+
+ private static boolean commonHelp() {
+ // --pid <pid>
+ // --exe <exe>
+ // --core <core>
+ System.out.println(" --exe\texecutable image name");
+ System.out.println(" --core\tpath to coredump");
+ System.out.println(" --pid\tpid of process to attach");
+ return false;
+ }
+
+ private static boolean jinfoHelp() {
+ // --flags -> -flags
+ // --sysprops -> -sysprops
+ System.out.println(" --flags\tto print VM flags");
+ System.out.println(" --sysprops\tto print Java System properties");
+ System.out.println(" <no option>\tto print both of the above");
+ return commonHelp();
+ }
+
+ private static boolean jmapHelp() {
+ // --heap -> -heap
+ // --binaryheap -> -heap:format=b
+ // --histo -> -histo
+ // --clstats -> -clstats
+ // --finalizerinfo -> -finalizerinfo
+
+ System.out.println(" <no option>\tto print same info as Solaris pmap");
+ System.out.println(" --heap\tto print java heap summary");
+ System.out.println(" --binaryheap\tto dump java heap in hprof binary format");
+ System.out.println(" --histo\tto print histogram of java object heap");
+ System.out.println(" --clstats\tto print class loader statistics");
+ System.out.println(" --finalizerinfo\tto print information on objects awaiting finalization");
+ return commonHelp();
+ }
+
+ private static boolean jstackHelp() {
+ // --locks -> -l
+ // --mixed -> -m
+ System.out.println(" --locks\tto print java.util.concurrent locks");
+ System.out.println(" --mixed\tto print both java and native frames (mixed mode)");
+ return commonHelp();
+ }
+
+ private static boolean toolHelp(String toolName) {
+ if (toolName.equals("jstack")) {
+ return jstackHelp();
+ }
+ if (toolName.equals("jinfo")) {
+ return jinfoHelp();
+ }
+ if (toolName.equals("jmap")) {
+ return jmapHelp();
+ }
+ if (toolName.equals("hsdb") || toolName.equals("clhsdb")) {
+ return commonHelp();
+ }
+ return launcherHelp();
+ }
+
+ private static void runCLHSDB(String[] oldArgs) {
+ SAGetopt sg = new SAGetopt(oldArgs);
+ String[] longOpts = {"exe=", "core=", "pid="};
+
+ ArrayList<String> newArgs = new ArrayList();
+ String exeORpid = null;
+ String core = null;
+ String s = null;
+
+ while((s = sg.next(null, longOpts)) != null) {
+ if (s.equals("exe")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("core")) {
+ core = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("pid")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ }
+
+ if (exeORpid != null) {
+ newArgs.add(exeORpid);
+ if (core != null) {
+ newArgs.add(core);
+ }
+ }
+ CLHSDB.main(newArgs.toArray(new String[newArgs.size()]));
+ }
+
+ private static void runHSDB(String[] oldArgs) {
+ SAGetopt sg = new SAGetopt(oldArgs);
+ String[] longOpts = {"exe=", "core=", "pid="};
+
+ ArrayList<String> newArgs = new ArrayList();
+ String exeORpid = null;
+ String core = null;
+ String s = null;
+
+ while((s = sg.next(null, longOpts)) != null) {
+ if (s.equals("exe")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("core")) {
+ core = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("pid")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ }
+
+ if (exeORpid != null) {
+ newArgs.add(exeORpid);
+ if (core != null) {
+ newArgs.add(core);
+ }
+ }
+ HSDB.main(newArgs.toArray(new String[newArgs.size()]));
+ }
+
+ private static void runJSTACK(String[] oldArgs) {
+ SAGetopt sg = new SAGetopt(oldArgs);
+ String[] longOpts = {"exe=", "core=", "pid=",
+ "mixed", "locks"};
+
+ ArrayList<String> newArgs = new ArrayList();
+ String exeORpid = null;
+ String core = null;
+ String s = null;
+
+ while((s = sg.next(null, longOpts)) != null) {
+ if (s.equals("exe")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("core")) {
+ core = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("pid")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("mixed")) {
+ newArgs.add("-m");
+ continue;
+ }
+ if (s.equals("locks")) {
+ newArgs.add("-l");
+ continue;
+ }
+ }
+
+ if (exeORpid != null) {
+ newArgs.add(exeORpid);
+ if (core != null) {
+ newArgs.add(core);
+ }
+ }
+
+ JStack.main(newArgs.toArray(new String[newArgs.size()]));
+ }
+
+ private static void runJMAP(String[] oldArgs) {
+ SAGetopt sg = new SAGetopt(oldArgs);
+ String[] longOpts = {"exe=", "core=", "pid=",
+ "heap", "binaryheap", "histo", "clstats", "finalizerinfo"};
+
+ ArrayList<String> newArgs = new ArrayList();
+ String exeORpid = null;
+ String core = null;
+ String s = null;
+
+ while((s = sg.next(null, longOpts)) != null) {
+ if (s.equals("exe")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("core")) {
+ core = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("pid")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("heap")) {
+ newArgs.add("-heap");
+ continue;
+ }
+ if (s.equals("binaryheap")) {
+ newArgs.add("-heap:format=b");
+ continue;
+ }
+ if (s.equals("histo")) {
+ newArgs.add("-histo");
+ continue;
+ }
+ if (s.equals("clstats")) {
+ newArgs.add("-clstats");
+ continue;
+ }
+ if (s.equals("finalizerinfo")) {
+ newArgs.add("-finalizerinfo");
+ continue;
+ }
+ }
+
+ if (exeORpid != null) {
+ newArgs.add(exeORpid);
+ if (core != null) {
+ newArgs.add(core);
+ }
+ }
+
+ JMap.main(newArgs.toArray(new String[newArgs.size()]));
+ }
+
+ private static void runJINFO(String[] oldArgs) {
+ SAGetopt sg = new SAGetopt(oldArgs);
+ String[] longOpts = {"exe=", "core=", "pid=",
+ "flags", "sysprops"};
+
+ ArrayList<String> newArgs = new ArrayList();
+ String exeORpid = null;
+ String core = null;
+ String s = null;
+
+ while((s = sg.next(null, longOpts)) != null) {
+ if (s.equals("exe")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("core")) {
+ core = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("pid")) {
+ exeORpid = sg.getOptarg();
+ continue;
+ }
+ if (s.equals("flags")) {
+ newArgs.add("-flags");
+ continue;
+ }
+ if (s.equals("sysprops")) {
+ newArgs.add("-sysprops");
+ continue;
+ }
+ }
+
+ if (exeORpid != null) {
+ newArgs.add(exeORpid);
+ if (core != null) {
+ newArgs.add(core);
+ }
+ }
+
+ JInfo.main(newArgs.toArray(new String[newArgs.size()]));
+ }
+
+ public static void main(String[] args) {
+ // Provide a help
+ if (args.length == 0) {
+ launcherHelp();
+ return;
+ }
+ // No arguments imply help for jstack, jmap, jinfo but launch clhsdb and hsdb
+ if (args.length == 1 && !args[0].equals("clhsdb") && !args[0].equals("hsdb")) {
+ toolHelp(args[0]);
+ return;
+ }
+
+ for (String arg : args) {
+ if (arg.equals("-h") || arg.equals("-help") || arg.equals("--help")) {
+ toolHelp(args[0]);
+ return;
+ }
+ }
+
+ String[] oldArgs = Arrays.copyOfRange(args, 1, args.length);
+
+ // Run SA interactive mode
+ if (args[0].equals("clhsdb")) {
+ runCLHSDB(oldArgs);
+ return;
+ }
+
+ if (args[0].equals("hsdb")) {
+ runHSDB(oldArgs);
+ return;
+ }
+
+ // Run SA tmtools mode
+ if (args[0].equals("jstack")) {
+ runJSTACK(oldArgs);
+ return;
+ }
+
+ if (args[0].equals("jmap")) {
+ runJMAP(oldArgs);
+ return;
+ }
+
+ if (args[0].equals("jinfo")) {
+ runJINFO(oldArgs);
+ return;
+ }
+ }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/aarch64/AARCH64ThreadContext.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/aarch64/AARCH64ThreadContext.java Wed Jul 05 20:44:51 2017 +0200
@@ -37,6 +37,21 @@
public abstract class AARCH64ThreadContext implements ThreadContext {
// Taken from /usr/include/asm/sigcontext.h on Linux/AARCH64.
+ // /*
+ // * Signal context structure - contains all info to do with the state
+ // * before the signal handler was invoked.
+ // */
+ // struct sigcontext {
+ // __u64 fault_address;
+ // /* AArch64 registers */
+ // __u64 regs[31];
+ // __u64 sp;
+ // __u64 pc;
+ // __u64 pstate;
+ // /* 4K reserved for FP/SIMD state and future expansion */
+ // __u8 __reserved[4096] __attribute__((__aligned__(16)));
+ // };
+
// NOTE: the indices for the various registers must be maintained as
// listed across various operating systems. However, only a small
// subset of the registers' values are guaranteed to be present (and
@@ -78,8 +93,9 @@
public static final int LR = 30;
public static final int SP = 31;
public static final int PC = 32;
+ public static final int PSTATE = 33;
- public static final int NPRGREG = 33;
+ public static final int NPRGREG = 34;
private long[] data;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/g1/G1Allocator.java Thu Aug 06 11:17:57 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-package sun.jvm.hotspot.gc.g1;
-
-import java.util.Observable;
-import java.util.Observer;
-
-import sun.jvm.hotspot.debugger.Address;
-import sun.jvm.hotspot.runtime.VM;
-import sun.jvm.hotspot.runtime.VMObject;
-import sun.jvm.hotspot.types.CIntegerField;
-import sun.jvm.hotspot.types.Type;
-import sun.jvm.hotspot.types.TypeDataBase;
-
-public class G1Allocator extends VMObject {
-
- //size_t _summary_bytes_used;
- static private CIntegerField summaryBytesUsedField;
-
- static {
- VM.registerVMInitializedObserver(new Observer() {
- public void update(Observable o, Object data) {
- initialize(VM.getVM().getTypeDataBase());
- }
- });
- }
-
- static private synchronized void initialize(TypeDataBase db) {
- Type type = db.lookupType("G1Allocator");
-
- summaryBytesUsedField = type.getCIntegerField("_summary_bytes_used");
- }
-
- public long getSummaryBytes() {
- return summaryBytesUsedField.getValue(addr);
- }
-
- public G1Allocator(Address addr) {
- super(addr);
-
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,6 +36,7 @@
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObjectFactory;
import sun.jvm.hotspot.types.AddressField;
+import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
@@ -46,8 +47,8 @@
static private long hrmFieldOffset;
// MemRegion _g1_reserved;
static private long g1ReservedFieldOffset;
- // G1Allocator* _allocator
- static private AddressField g1Allocator;
+ // size_t _summary_bytes_used;
+ static private CIntegerField summaryBytesUsedField;
// G1MonitoringSupport* _g1mm;
static private AddressField g1mmField;
// HeapRegionSet _old_set;
@@ -67,7 +68,7 @@
Type type = db.lookupType("G1CollectedHeap");
hrmFieldOffset = type.getField("_hrm").getOffset();
- g1Allocator = type.getAddressField("_allocator");
+ summaryBytesUsedField = type.getCIntegerField("_summary_bytes_used");
g1mmField = type.getAddressField("_g1mm");
oldSetFieldOffset = type.getField("_old_set").getOffset();
humongousSetFieldOffset = type.getField("_humongous_set").getOffset();
@@ -78,7 +79,7 @@
}
public long used() {
- return allocator().getSummaryBytes();
+ return summaryBytesUsedField.getValue(addr);
}
public long n_regions() {
@@ -96,11 +97,6 @@
return (G1MonitoringSupport) VMObjectFactory.newObject(G1MonitoringSupport.class, g1mmAddr);
}
- public G1Allocator allocator() {
- Address g1AllocatorAddr = g1Allocator.getValue(addr);
- return (G1Allocator) VMObjectFactory.newObject(G1Allocator.class, g1AllocatorAddr);
- }
-
public HeapRegionSetBase oldSet() {
Address oldSetAddr = addr.addOffsetTo(oldSetFieldOffset);
return (HeapRegionSetBase) VMObjectFactory.newObject(HeapRegionSetBase.class,
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad Wed Jul 05 20:44:51 2017 +0200
@@ -2167,8 +2167,12 @@
return 0; // Self copy, no move.
}
+ bool is64 = (src_lo & 1) == 0 && src_lo + 1 == src_hi &&
+ (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi;
+ int src_offset = ra_->reg2offset(src_lo);
+ int dst_offset = ra_->reg2offset(dst_lo);
+
if (bottom_type()->isa_vect() != NULL) {
- uint len = 4;
uint ireg = ideal_reg();
assert(ireg == Op_VecD || ireg == Op_VecX, "must be 64 bit or 128 bit vector");
if (cbuf) {
@@ -2176,334 +2180,115 @@
assert((src_lo_rc != rc_int && dst_lo_rc != rc_int), "sanity");
if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) {
// stack->stack
- int src_offset = ra_->reg2offset(src_lo);
- int dst_offset = ra_->reg2offset(dst_lo);
assert((src_offset & 7) && (dst_offset & 7), "unaligned stack offset");
- len = 8;
if (ireg == Op_VecD) {
- __ ldr(rscratch1, Address(sp, src_offset));
- __ str(rscratch1, Address(sp, dst_offset));
+ __ unspill(rscratch1, true, src_offset);
+ __ spill(rscratch1, true, dst_offset);
} else {
- if (src_offset < 512) {
- __ ldp(rscratch1, rscratch2, Address(sp, src_offset));
- } else {
- __ ldr(rscratch1, Address(sp, src_offset));
- __ ldr(rscratch2, Address(sp, src_offset+4));
- len += 4;
- }
- if (dst_offset < 512) {
- __ stp(rscratch1, rscratch2, Address(sp, dst_offset));
- } else {
- __ str(rscratch1, Address(sp, dst_offset));
- __ str(rscratch2, Address(sp, dst_offset+4));
- len += 4;
- }
+ __ spill_copy128(src_offset, dst_offset);
}
} else if (src_lo_rc == rc_float && dst_lo_rc == rc_float) {
- __ orr(as_FloatRegister(Matcher::_regEncode[dst_lo]),
+ __ mov(as_FloatRegister(Matcher::_regEncode[dst_lo]),
ireg == Op_VecD ? __ T8B : __ T16B,
- as_FloatRegister(Matcher::_regEncode[src_lo]),
as_FloatRegister(Matcher::_regEncode[src_lo]));
} else if (src_lo_rc == rc_float && dst_lo_rc == rc_stack) {
- __ str(as_FloatRegister(Matcher::_regEncode[src_lo]),
- ireg == Op_VecD ? __ D : __ Q,
- Address(sp, ra_->reg2offset(dst_lo)));
+ __ spill(as_FloatRegister(Matcher::_regEncode[src_lo]),
+ ireg == Op_VecD ? __ D : __ Q,
+ ra_->reg2offset(dst_lo));
} else if (src_lo_rc == rc_stack && dst_lo_rc == rc_float) {
- __ ldr(as_FloatRegister(Matcher::_regEncode[dst_lo]),
- ireg == Op_VecD ? __ D : __ Q,
- Address(sp, ra_->reg2offset(src_lo)));
+ __ unspill(as_FloatRegister(Matcher::_regEncode[dst_lo]),
+ ireg == Op_VecD ? __ D : __ Q,
+ ra_->reg2offset(src_lo));
} else {
ShouldNotReachHere();
}
- } else if (st) {
- if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) {
- // stack->stack
- int src_offset = ra_->reg2offset(src_lo);
- int dst_offset = ra_->reg2offset(dst_lo);
- if (ireg == Op_VecD) {
- st->print("ldr rscratch1, [sp, #%d]", src_offset);
- st->print("str rscratch1, [sp, #%d]", dst_offset);
+ }
+ } else if (cbuf) {
+ MacroAssembler _masm(cbuf);
+ switch (src_lo_rc) {
+ case rc_int:
+ if (dst_lo_rc == rc_int) { // gpr --> gpr copy
+ if (is64) {
+ __ mov(as_Register(Matcher::_regEncode[dst_lo]),
+ as_Register(Matcher::_regEncode[src_lo]));
} else {
- if (src_offset < 512) {
- st->print("ldp rscratch1, rscratch2, [sp, #%d]", src_offset);
- } else {
- st->print("ldr rscratch1, [sp, #%d]", src_offset);
- st->print("\nldr rscratch2, [sp, #%d]", src_offset+4);
- }
- if (dst_offset < 512) {
- st->print("\nstp rscratch1, rscratch2, [sp, #%d]", dst_offset);
- } else {
- st->print("\nstr rscratch1, [sp, #%d]", dst_offset);
- st->print("\nstr rscratch2, [sp, #%d]", dst_offset+4);
- }
- }
- st->print("\t# vector spill, stack to stack");
- } else if (src_lo_rc == rc_float && dst_lo_rc == rc_float) {
- st->print("mov %s, %s\t# vector spill, reg to reg",
- Matcher::regName[dst_lo], Matcher::regName[src_lo]);
- } else if (src_lo_rc == rc_float && dst_lo_rc == rc_stack) {
- st->print("str %s, [sp, #%d]\t# vector spill, reg to stack",
- Matcher::regName[src_lo], ra_->reg2offset(dst_lo));
- } else if (src_lo_rc == rc_stack && dst_lo_rc == rc_float) {
- st->print("ldr %s, [sp, #%d]\t# vector spill, stack to reg",
- Matcher::regName[dst_lo], ra_->reg2offset(src_lo));
- }
- }
- return len;
- }
-
- switch (src_lo_rc) {
- case rc_int:
- if (dst_lo_rc == rc_int) { // gpr --> gpr copy
- if (((src_lo & 1) == 0 && src_lo + 1 == src_hi) &&
- (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi) {
- // 64 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ mov(as_Register(Matcher::_regEncode[dst_lo]),
- as_Register(Matcher::_regEncode[src_lo]));
- } else if (st) {
- st->print("mov %s, %s\t# shuffle",
- Matcher::regName[dst_lo],
- Matcher::regName[src_lo]);
- }
- } else {
- // 32 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ movw(as_Register(Matcher::_regEncode[dst_lo]),
- as_Register(Matcher::_regEncode[src_lo]));
- } else if (st) {
- st->print("movw %s, %s\t# shuffle",
- Matcher::regName[dst_lo],
- Matcher::regName[src_lo]);
+ MacroAssembler _masm(cbuf);
+ __ movw(as_Register(Matcher::_regEncode[dst_lo]),
+ as_Register(Matcher::_regEncode[src_lo]));
}
- }
- } else if (dst_lo_rc == rc_float) { // gpr --> fpr copy
- if (((src_lo & 1) == 0 && src_lo + 1 == src_hi) &&
- (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi) {
- // 64 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ fmovd(as_FloatRegister(Matcher::_regEncode[dst_lo]),
- as_Register(Matcher::_regEncode[src_lo]));
- } else if (st) {
- st->print("fmovd %s, %s\t# shuffle",
- Matcher::regName[dst_lo],
- Matcher::regName[src_lo]);
- }
- } else {
- // 32 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ fmovs(as_FloatRegister(Matcher::_regEncode[dst_lo]),
- as_Register(Matcher::_regEncode[src_lo]));
- } else if (st) {
- st->print("fmovs %s, %s\t# shuffle",
- Matcher::regName[dst_lo],
- Matcher::regName[src_lo]);
- }
- }
- } else { // gpr --> stack spill
- assert(dst_lo_rc == rc_stack, "spill to bad register class");
- int dst_offset = ra_->reg2offset(dst_lo);
- if (((src_lo & 1) == 0 && src_lo + 1 == src_hi) &&
- (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi) {
- // 64 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ str(as_Register(Matcher::_regEncode[src_lo]),
- Address(sp, dst_offset));
- } else if (st) {
- st->print("str %s, [sp, #%d]\t# spill",
- Matcher::regName[src_lo],
- dst_offset);
- }
- } else {
- // 32 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ strw(as_Register(Matcher::_regEncode[src_lo]),
- Address(sp, dst_offset));
- } else if (st) {
- st->print("strw %s, [sp, #%d]\t# spill",
- Matcher::regName[src_lo],
- dst_offset);
- }
- }
- }
- return 4;
- case rc_float:
- if (dst_lo_rc == rc_int) { // fpr --> gpr copy
- if (((src_lo & 1) == 0 && src_lo + 1 == src_hi) &&
- (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi) {
- // 64 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ fmovd(as_Register(Matcher::_regEncode[dst_lo]),
- as_FloatRegister(Matcher::_regEncode[src_lo]));
- } else if (st) {
- st->print("fmovd %s, %s\t# shuffle",
- Matcher::regName[dst_lo],
- Matcher::regName[src_lo]);
+ } else if (dst_lo_rc == rc_float) { // gpr --> fpr copy
+ if (is64) {
+ __ fmovd(as_FloatRegister(Matcher::_regEncode[dst_lo]),
+ as_Register(Matcher::_regEncode[src_lo]));
+ } else {
+ __ fmovs(as_FloatRegister(Matcher::_regEncode[dst_lo]),
+ as_Register(Matcher::_regEncode[src_lo]));
}
- } else {
- // 32 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ fmovs(as_Register(Matcher::_regEncode[dst_lo]),
- as_FloatRegister(Matcher::_regEncode[src_lo]));
- } else if (st) {
- st->print("fmovs %s, %s\t# shuffle",
- Matcher::regName[dst_lo],
- Matcher::regName[src_lo]);
- }
- }
- } else if (dst_lo_rc == rc_float) { // fpr --> fpr copy
- if (((src_lo & 1) == 0 && src_lo + 1 == src_hi) &&
- (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi) {
- // 64 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ fmovd(as_FloatRegister(Matcher::_regEncode[dst_lo]),
- as_FloatRegister(Matcher::_regEncode[src_lo]));
- } else if (st) {
- st->print("fmovd %s, %s\t# shuffle",
- Matcher::regName[dst_lo],
- Matcher::regName[src_lo]);
- }
- } else {
- // 32 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ fmovs(as_FloatRegister(Matcher::_regEncode[dst_lo]),
- as_FloatRegister(Matcher::_regEncode[src_lo]));
- } else if (st) {
- st->print("fmovs %s, %s\t# shuffle",
- Matcher::regName[dst_lo],
- Matcher::regName[src_lo]);
- }
- }
- } else { // fpr --> stack spill
- assert(dst_lo_rc == rc_stack, "spill to bad register class");
- int dst_offset = ra_->reg2offset(dst_lo);
- if (((src_lo & 1) == 0 && src_lo + 1 == src_hi) &&
- (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi) {
- // 64 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ strd(as_FloatRegister(Matcher::_regEncode[src_lo]),
- Address(sp, dst_offset));
- } else if (st) {
- st->print("strd %s, [sp, #%d]\t# spill",
- Matcher::regName[src_lo],
- dst_offset);
- }
- } else {
- // 32 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ strs(as_FloatRegister(Matcher::_regEncode[src_lo]),
- Address(sp, dst_offset));
- } else if (st) {
- st->print("strs %s, [sp, #%d]\t# spill",
- Matcher::regName[src_lo],
- dst_offset);
- }
+ } else { // gpr --> stack spill
+ assert(dst_lo_rc == rc_stack, "spill to bad register class");
+ __ spill(as_Register(Matcher::_regEncode[src_lo]), is64, dst_offset);
}
- }
- return 4;
- case rc_stack:
- int src_offset = ra_->reg2offset(src_lo);
- if (dst_lo_rc == rc_int) { // stack --> gpr load
- if (((src_lo & 1) == 0 && src_lo + 1 == src_hi) &&
- (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi) {
- // 64 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ ldr(as_Register(Matcher::_regEncode[dst_lo]),
- Address(sp, src_offset));
- } else if (st) {
- st->print("ldr %s, [sp, %d]\t# restore",
- Matcher::regName[dst_lo],
- src_offset);
+ break;
+ case rc_float:
+ if (dst_lo_rc == rc_int) { // fpr --> gpr copy
+ if (is64) {
+ __ fmovd(as_Register(Matcher::_regEncode[dst_lo]),
+ as_FloatRegister(Matcher::_regEncode[src_lo]));
+ } else {
+ __ fmovs(as_Register(Matcher::_regEncode[dst_lo]),
+ as_FloatRegister(Matcher::_regEncode[src_lo]));
}
- } else {
- // 32 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ ldrw(as_Register(Matcher::_regEncode[dst_lo]),
- Address(sp, src_offset));
- } else if (st) {
- st->print("ldr %s, [sp, %d]\t# restore",
- Matcher::regName[dst_lo],
- src_offset);
- }
- }
- return 4;
- } else if (dst_lo_rc == rc_float) { // stack --> fpr load
- if (((src_lo & 1) == 0 && src_lo + 1 == src_hi) &&
- (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi) {
- // 64 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ ldrd(as_FloatRegister(Matcher::_regEncode[dst_lo]),
- Address(sp, src_offset));
- } else if (st) {
- st->print("ldrd %s, [sp, %d]\t# restore",
- Matcher::regName[dst_lo],
- src_offset);
+ } else if (dst_lo_rc == rc_float) { // fpr --> fpr copy
+ if (cbuf) {
+ __ fmovd(as_FloatRegister(Matcher::_regEncode[dst_lo]),
+ as_FloatRegister(Matcher::_regEncode[src_lo]));
+ } else {
+ __ fmovs(as_FloatRegister(Matcher::_regEncode[dst_lo]),
+ as_FloatRegister(Matcher::_regEncode[src_lo]));
}
- } else {
- // 32 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ ldrs(as_FloatRegister(Matcher::_regEncode[dst_lo]),
- Address(sp, src_offset));
- } else if (st) {
- st->print("ldrs %s, [sp, %d]\t# restore",
- Matcher::regName[dst_lo],
- src_offset);
- }
+ } else { // fpr --> stack spill
+ assert(dst_lo_rc == rc_stack, "spill to bad register class");
+ __ spill(as_FloatRegister(Matcher::_regEncode[src_lo]),
+ is64 ? __ D : __ S, dst_offset);
}
- return 4;
- } else { // stack --> stack copy
- assert(dst_lo_rc == rc_stack, "spill to bad register class");
- int dst_offset = ra_->reg2offset(dst_lo);
- if (((src_lo & 1) == 0 && src_lo + 1 == src_hi) &&
- (dst_lo & 1) == 0 && dst_lo + 1 == dst_hi) {
- // 64 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ ldr(rscratch1, Address(sp, src_offset));
- __ str(rscratch1, Address(sp, dst_offset));
- } else if (st) {
- st->print("ldr rscratch1, [sp, %d]\t# mem-mem spill",
- src_offset);
- st->print("\n\t");
- st->print("str rscratch1, [sp, %d]",
- dst_offset);
- }
- } else {
- // 32 bit
- if (cbuf) {
- MacroAssembler _masm(cbuf);
- __ ldrw(rscratch1, Address(sp, src_offset));
- __ strw(rscratch1, Address(sp, dst_offset));
- } else if (st) {
- st->print("ldrw rscratch1, [sp, %d]\t# mem-mem spill",
- src_offset);
- st->print("\n\t");
- st->print("strw rscratch1, [sp, %d]",
- dst_offset);
- }
+ break;
+ case rc_stack:
+ if (dst_lo_rc == rc_int) { // stack --> gpr load
+ __ unspill(as_Register(Matcher::_regEncode[dst_lo]), is64, src_offset);
+ } else if (dst_lo_rc == rc_float) { // stack --> fpr load
+ __ unspill(as_FloatRegister(Matcher::_regEncode[dst_lo]),
+ is64 ? __ D : __ S, src_offset);
+ } else { // stack --> stack copy
+ assert(dst_lo_rc == rc_stack, "spill to bad register class");
+ __ unspill(rscratch1, is64, src_offset);
+ __ spill(rscratch1, is64, dst_offset);
}
- return 8;
+ break;
+ default:
+ assert(false, "bad rc_class for spill");
+ ShouldNotReachHere();
}
}
- assert(false," bad rc_class for spill ");
- Unimplemented();
+ if (st) {
+ st->print("spill ");
+ if (src_lo_rc == rc_stack) {
+ st->print("[sp, #%d] -> ", ra_->reg2offset(src_lo));
+ } else {
+ st->print("%s -> ", Matcher::regName[src_lo]);
+ }
+ if (dst_lo_rc == rc_stack) {
+ st->print("[sp, #%d]", ra_->reg2offset(dst_lo));
+ } else {
+ st->print("%s", Matcher::regName[dst_lo]);
+ }
+ if (bottom_type()->isa_vect() != NULL) {
+ st->print("\t# vector spill size = %d", ideal_reg()==Op_VecD ? 64:128);
+ } else {
+ st->print("\t# spill size = %d", is64 ? 64:32);
+ }
+ }
+
return 0;
}
@@ -2522,7 +2307,7 @@
}
uint MachSpillCopyNode::size(PhaseRegAlloc *ra_) const {
- return implementation(NULL, ra_, true, NULL);
+ return MachNode::size(ra_);
}
//=============================================================================
--- a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -1896,7 +1896,7 @@
public:
enum SIMD_Arrangement {
- T8B, T16B, T4H, T8H, T2S, T4S, T1D, T2D
+ T8B, T16B, T4H, T8H, T2S, T4S, T1D, T2D, T1Q
};
enum SIMD_RegVariant {
@@ -2225,14 +2225,16 @@
f(0b001111, 15, 10), rf(Vn, 5), rf(Xd, 0);
}
- // We do not handle the 1Q arrangement.
void pmull(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) {
starti;
- assert(Ta == T8H && (Tb == T8B || Tb == T16B), "Invalid Size specifier");
- f(0, 31), f(Tb & 1, 30), f(0b001110001, 29, 21), rf(Vm, 16), f(0b111000, 15, 10);
- rf(Vn, 5), rf(Vd, 0);
+ assert((Ta == T1Q && (Tb == T1D || Tb == T2D)) ||
+ (Ta == T8H && (Tb == T8B || Tb == T16B)), "Invalid Size specifier");
+ int size = (Ta == T1Q) ? 0b11 : 0b00;
+ f(0, 31), f(Tb & 1, 30), f(0b001110, 29, 24), f(size, 23, 22);
+ f(1, 21), rf(Vm, 16), f(0b111000, 15, 10), rf(Vn, 5), rf(Vd, 0);
}
void pmull2(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) {
+ assert(Tb == T2D || Tb == T16B, "pmull2 assumes T2D or T16B as the second size specifier");
pmull(Vd, Ta, Vn, Vm, Tb);
}
@@ -2245,15 +2247,6 @@
f(0b100001010010, 21, 10), rf(Vn, 5), rf(Vd, 0);
}
- void rev32(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn)
- {
- starti;
- assert(T <= T8H, "must be one of T8B, T16B, T4H, T8H");
- f(0, 31), f((int)T & 1, 30), f(0b101110, 29, 24);
- f(T <= T16B ? 0b00 : 0b01, 23, 22), f(0b100000000010, 21, 10);
- rf(Vn, 5), rf(Vd, 0);
- }
-
void dup(FloatRegister Vd, SIMD_Arrangement T, Register Xs)
{
starti;
@@ -2290,6 +2283,57 @@
#undef INSN
+ // Table vector lookup
+#define INSN(NAME, op) \
+ void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, unsigned registers, FloatRegister Vm) { \
+ starti; \
+ assert(T == T8B || T == T16B, "invalid arrangement"); \
+ assert(0 < registers && registers <= 4, "invalid number of registers"); \
+ f(0, 31), f((int)T & 1, 30), f(0b001110000, 29, 21), rf(Vm, 16), f(0, 15); \
+ f(registers - 1, 14, 13), f(op, 12),f(0b00, 11, 10), rf(Vn, 5), rf(Vd, 0); \
+ }
+
+ INSN(tbl, 0);
+ INSN(tbx, 1);
+
+#undef INSN
+
+#define INSN(NAME, U, opcode) \
+ void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { \
+ starti; \
+ assert((ASSERTION), MSG); \
+ f(0, 31), f((int)T & 1, 30), f(U, 29), f(0b01110, 28, 24); \
+ f((int)(T >> 1), 23, 22), f(0b10000, 21, 17), f(opcode, 16, 12); \
+ f(0b10, 11, 10), rf(Vn, 5), rf(Vd, 0); \
+ }
+
+#define MSG "invalid arrangement"
+
+#define ASSERTION (T == T8B || T == T16B || T == T4H || T == T8H || T == T2S || T == T4S)
+ INSN(rev64, 0, 0b00000);
+#undef ASSERTION
+
+#define ASSERTION (T == T8B || T == T16B || T == T4H || T == T8H)
+ INSN(rev32, 1, 0b00000);
+#undef ASSERTION
+
+#define ASSERTION (T == T8B || T == T16B)
+ INSN(rev16, 0, 0b00001);
+#undef ASSERTION
+
+#undef MSG
+
+#undef INSN
+
+void ext(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, FloatRegister Vm, int index)
+ {
+ starti;
+ assert(T == T8B || T == T16B, "invalid arrangement");
+ assert((T == T8B && index <= 0b0111) || (T == T16B && index <= 0b1111), "Invalid index value");
+ f(0, 31), f((int)T & 1, 30), f(0b101110000, 29, 21);
+ rf(Vm, 16), f(0, 15), f(index, 14, 11);
+ f(0, 10), rf(Vn, 5), rf(Vd, 0);
+ }
/* Simulator extensions to the ISA
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -2009,6 +2009,14 @@
}
}
+void MacroAssembler::sub(Register Rd, Register Rn, RegisterOrConstant decrement) {
+ if (decrement.is_register()) {
+ sub(Rd, Rn, decrement.as_register());
+ } else {
+ sub(Rd, Rn, decrement.as_constant());
+ }
+}
+
void MacroAssembler::reinit_heapbase()
{
if (UseCompressedOops) {
@@ -2307,6 +2315,28 @@
}
}
+Address MacroAssembler::spill_address(int size, int offset, Register tmp)
+{
+ assert(offset >= 0, "spill to negative address?");
+ // Offset reachable ?
+ // Not aligned - 9 bits signed offset
+ // Aligned - 12 bits unsigned offset shifted
+ Register base = sp;
+ if ((offset & (size-1)) && offset >= (1<<8)) {
+ add(tmp, base, offset & ((1<<12)-1));
+ base = tmp;
+ offset &= -1<<12;
+ }
+
+ if (offset >= (1<<12) * size) {
+ add(tmp, base, offset & (((1<<12)-1)<<12));
+ base = tmp;
+ offset &= ~(((1<<12)-1)<<12);
+ }
+
+ return Address(base, offset);
+}
+
/**
* Multiply 64 bit by 64 bit first loop.
*/
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -464,10 +464,21 @@
mov(dst, (long)i);
}
+ void mov(Register dst, RegisterOrConstant src) {
+ if (src.is_register())
+ mov(dst, src.as_register());
+ else
+ mov(dst, src.as_constant());
+ }
+
void movptr(Register r, uintptr_t imm64);
void mov(FloatRegister Vd, SIMD_Arrangement T, u_int32_t imm32);
+ void mov(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) {
+ orr(Vd, T, Vn, Vn);
+ }
+
// macro instructions for accessing and updating floating point
// status register
//
@@ -1045,6 +1056,7 @@
void add(Register Rd, Register Rn, RegisterOrConstant increment);
void addw(Register Rd, Register Rn, RegisterOrConstant increment);
+ void sub(Register Rd, Register Rn, RegisterOrConstant decrement);
void adrp(Register reg1, const Address &dest, unsigned long &byte_offset);
@@ -1161,6 +1173,46 @@
// Uses rscratch2.
Address offsetted_address(Register r, Register r1, Address::extend ext,
int offset, int size);
+
+private:
+ // Returns an address on the stack which is reachable with a ldr/str of size
+ // Uses rscratch2 if the address is not directly reachable
+ Address spill_address(int size, int offset, Register tmp=rscratch2);
+
+public:
+ void spill(Register Rx, bool is64, int offset) {
+ if (is64) {
+ str(Rx, spill_address(8, offset));
+ } else {
+ strw(Rx, spill_address(4, offset));
+ }
+ }
+ void spill(FloatRegister Vx, SIMD_RegVariant T, int offset) {
+ str(Vx, T, spill_address(1 << (int)T, offset));
+ }
+ void unspill(Register Rx, bool is64, int offset) {
+ if (is64) {
+ ldr(Rx, spill_address(8, offset));
+ } else {
+ ldrw(Rx, spill_address(4, offset));
+ }
+ }
+ void unspill(FloatRegister Vx, SIMD_RegVariant T, int offset) {
+ ldr(Vx, T, spill_address(1 << (int)T, offset));
+ }
+ void spill_copy128(int src_offset, int dst_offset,
+ Register tmp1=rscratch1, Register tmp2=rscratch2) {
+ if (src_offset < 512 && (src_offset & 7) == 0 &&
+ dst_offset < 512 && (dst_offset & 7) == 0) {
+ ldp(tmp1, tmp2, Address(sp, src_offset));
+ stp(tmp1, tmp2, Address(sp, dst_offset));
+ } else {
+ unspill(tmp1, true, src_offset);
+ spill(tmp1, true, dst_offset);
+ unspill(tmp1, true, src_offset+8);
+ spill(tmp1, true, dst_offset+8);
+ }
+ }
};
#ifdef ASSERT
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -120,10 +120,8 @@
// we save r19-r28 which Java uses as scratch registers and C
// expects to be callee-save
//
- // we don't save any FP registers since only v8-v15 are callee-save
- // (strictly only the f and d components) and Java uses them as
- // callee-save. v0-v7 are arg registers and C treats v16-v31 as
- // volatile (as does Java?)
+ // we save the bottom 64 bits of each value stored in v8-v15; it is
+ // the responsibility of the caller to preserve larger values.
//
// so the stub frame looks like this when we enter Java code
//
@@ -131,14 +129,14 @@
// [ argument word n ]
// ...
// -27 [ argument word 1 ]
- // -26 [ saved d15 ] <--- sp_after_call
- // -25 [ saved d14 ]
- // -24 [ saved d13 ]
- // -23 [ saved d12 ]
- // -22 [ saved d11 ]
- // -21 [ saved d10 ]
- // -20 [ saved d9 ]
- // -19 [ saved d8 ]
+ // -26 [ saved v15 ] <--- sp_after_call
+ // -25 [ saved v14 ]
+ // -24 [ saved v13 ]
+ // -23 [ saved v12 ]
+ // -22 [ saved v11 ]
+ // -21 [ saved v10 ]
+ // -20 [ saved v9 ]
+ // -19 [ saved v8 ]
// -18 [ saved r28 ]
// -17 [ saved r27 ]
// -16 [ saved r26 ]
@@ -2437,6 +2435,137 @@
return start;
}
+ /**
+ * Arguments:
+ *
+ * Input:
+ * c_rarg0 - current state address
+ * c_rarg1 - H key address
+ * c_rarg2 - data address
+ * c_rarg3 - number of blocks
+ *
+ * Output:
+ * Updated state at c_rarg0
+ */
+ address generate_ghash_processBlocks() {
+ __ align(CodeEntryAlignment);
+ Label L_ghash_loop, L_exit;
+
+ StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
+ address start = __ pc();
+
+ Register state = c_rarg0;
+ Register subkeyH = c_rarg1;
+ Register data = c_rarg2;
+ Register blocks = c_rarg3;
+
+ FloatRegister vzr = v30;
+ __ eor(vzr, __ T16B, vzr, vzr); // zero register
+
+ __ mov(v26, __ T16B, 1);
+ __ mov(v27, __ T16B, 63);
+ __ mov(v28, __ T16B, 62);
+ __ mov(v29, __ T16B, 57);
+
+ __ ldrq(v6, Address(state));
+ __ ldrq(v16, Address(subkeyH));
+
+ __ ext(v0, __ T16B, v6, v6, 0x08);
+ __ ext(v1, __ T16B, v16, v16, 0x08);
+ __ eor(v16, __ T16B, v16, v1);
+
+ __ bind(L_ghash_loop);
+
+ __ ldrq(v2, Address(__ post(data, 0x10)));
+ __ rev64(v2, __ T16B, v2); // swap data
+
+ __ ext(v6, __ T16B, v0, v0, 0x08);
+ __ eor(v6, __ T16B, v6, v2);
+ __ ext(v2, __ T16B, v6, v6, 0x08);
+
+ __ pmull2(v7, __ T1Q, v2, v1, __ T2D); // A1*B1
+ __ eor(v6, __ T16B, v6, v2);
+ __ pmull(v5, __ T1Q, v2, v1, __ T1D); // A0*B0
+ __ pmull(v20, __ T1Q, v6, v16, __ T1D); // (A1 + A0)(B1 + B0)
+
+ __ ext(v21, __ T16B, v5, v7, 0x08);
+ __ eor(v18, __ T16B, v7, v5); // A1*B1 xor A0*B0
+ __ eor(v20, __ T16B, v20, v21);
+ __ eor(v20, __ T16B, v20, v18);
+
+ // Registers pair <v7:v5> holds the result of carry-less multiplication
+ __ ins(v7, __ D, v20, 0, 1);
+ __ ins(v5, __ D, v20, 1, 0);
+
+ // Result of the multiplication is shifted by one bit position
+ // [X3:X2:X1:X0] = [X3:X2:X1:X0] << 1
+ __ ushr(v18, __ T2D, v5, -63 & 63);
+ __ ins(v25, __ D, v18, 1, 0);
+ __ ins(v25, __ D, vzr, 0, 0);
+ __ ushl(v5, __ T2D, v5, v26);
+ __ orr(v5, __ T16B, v5, v25);
+
+ __ ushr(v19, __ T2D, v7, -63 & 63);
+ __ ins(v19, __ D, v19, 1, 0);
+ __ ins(v19, __ D, v18, 0, 1);
+ __ ushl(v7, __ T2D, v7, v26);
+ __ orr(v6, __ T16B, v7, v19);
+
+ __ ins(v24, __ D, v5, 0, 1);
+
+ // A = X0 << 63
+ __ ushl(v21, __ T2D, v5, v27);
+
+ // A = X0 << 62
+ __ ushl(v22, __ T2D, v5, v28);
+
+ // A = X0 << 57
+ __ ushl(v23, __ T2D, v5, v29);
+
+ // D = X1^A^B^C
+ __ eor(v21, __ T16B, v21, v22);
+ __ eor(v21, __ T16B, v21, v23);
+ __ eor(v21, __ T16B, v21, v24);
+ __ ins(v5, __ D, v21, 1, 0);
+
+ // [E1:E0] = [D:X0] >> 1
+ __ ushr(v20, __ T2D, v5, -1 & 63);
+ __ ushl(v18, __ T2D, v5, v27);
+ __ ext(v25, __ T16B, v18, vzr, 0x08);
+ __ orr(v19, __ T16B, v20, v25);
+
+ __ eor(v7, __ T16B, v5, v19);
+
+ // [F1:F0] = [D:X0] >> 2
+ __ ushr(v20, __ T2D, v5, -2 & 63);
+ __ ushl(v18, __ T2D, v5, v28);
+ __ ins(v25, __ D, v18, 0, 1);
+ __ orr(v19, __ T16B, v20, v25);
+
+ __ eor(v7, __ T16B, v7, v19);
+
+ // [G1:G0] = [D:X0] >> 7
+ __ ushr(v20, __ T2D, v5, -7 & 63);
+ __ ushl(v18, __ T2D, v5, v29);
+ __ ins(v25, __ D, v18, 0, 1);
+ __ orr(v19, __ T16B, v20, v25);
+
+ // [H1:H0] = [D^E1^F1^G1:X0^E0^F0^G0]
+ __ eor(v7, __ T16B, v7, v19);
+
+ // Result = [H1:H0]^[X3:X2]
+ __ eor(v0, __ T16B, v7, v6);
+
+ __ subs(blocks, blocks, 1);
+ __ cbnz(blocks, L_ghash_loop);
+
+ __ ext(v1, __ T16B, v0, v0, 0x08);
+ __ st1(v1, __ T16B, state);
+ __ ret(lr);
+
+ return start;
+ }
+
// Continuation point for throwing of implicit exceptions that are
// not handled in the current activation. Fabricates an exception
// oop and initiates normal exception dispatching in this
@@ -2544,6 +2673,828 @@
return stub->entry_point();
}
+ class MontgomeryMultiplyGenerator : public MacroAssembler {
+
+ Register Pa_base, Pb_base, Pn_base, Pm_base, inv, Rlen, Ra, Rb, Rm, Rn,
+ Pa, Pb, Pn, Pm, Rhi_ab, Rlo_ab, Rhi_mn, Rlo_mn, t0, t1, t2, Ri, Rj;
+
+ RegSet _toSave;
+ bool _squaring;
+
+ public:
+ MontgomeryMultiplyGenerator (Assembler *as, bool squaring)
+ : MacroAssembler(as->code()), _squaring(squaring) {
+
+ // Register allocation
+
+ Register reg = c_rarg0;
+ Pa_base = reg; // Argument registers
+ if (squaring)
+ Pb_base = Pa_base;
+ else
+ Pb_base = ++reg;
+ Pn_base = ++reg;
+ Rlen= ++reg;
+ inv = ++reg;
+ Pm_base = ++reg;
+
+ // Working registers:
+ Ra = ++reg; // The current digit of a, b, n, and m.
+ Rb = ++reg;
+ Rm = ++reg;
+ Rn = ++reg;
+
+ Pa = ++reg; // Pointers to the current/next digit of a, b, n, and m.
+ Pb = ++reg;
+ Pm = ++reg;
+ Pn = ++reg;
+
+ t0 = ++reg; // Three registers which form a
+ t1 = ++reg; // triple-precision accumuator.
+ t2 = ++reg;
+
+ Ri = ++reg; // Inner and outer loop indexes.
+ Rj = ++reg;
+
+ Rhi_ab = ++reg; // Product registers: low and high parts
+ Rlo_ab = ++reg; // of a*b and m*n.
+ Rhi_mn = ++reg;
+ Rlo_mn = ++reg;
+
+ // r19 and up are callee-saved.
+ _toSave = RegSet::range(r19, reg) + Pm_base;
+ }
+
+ private:
+ void save_regs() {
+ push(_toSave, sp);
+ }
+
+ void restore_regs() {
+ pop(_toSave, sp);
+ }
+
+ template <typename T>
+ void unroll_2(Register count, T block) {
+ Label loop, end, odd;
+ tbnz(count, 0, odd);
+ cbz(count, end);
+ align(16);
+ bind(loop);
+ (this->*block)();
+ bind(odd);
+ (this->*block)();
+ subs(count, count, 2);
+ br(Assembler::GT, loop);
+ bind(end);
+ }
+
+ template <typename T>
+ void unroll_2(Register count, T block, Register d, Register s, Register tmp) {
+ Label loop, end, odd;
+ tbnz(count, 0, odd);
+ cbz(count, end);
+ align(16);
+ bind(loop);
+ (this->*block)(d, s, tmp);
+ bind(odd);
+ (this->*block)(d, s, tmp);
+ subs(count, count, 2);
+ br(Assembler::GT, loop);
+ bind(end);
+ }
+
+ void pre1(RegisterOrConstant i) {
+ block_comment("pre1");
+ // Pa = Pa_base;
+ // Pb = Pb_base + i;
+ // Pm = Pm_base;
+ // Pn = Pn_base + i;
+ // Ra = *Pa;
+ // Rb = *Pb;
+ // Rm = *Pm;
+ // Rn = *Pn;
+ ldr(Ra, Address(Pa_base));
+ ldr(Rb, Address(Pb_base, i, Address::uxtw(LogBytesPerWord)));
+ ldr(Rm, Address(Pm_base));
+ ldr(Rn, Address(Pn_base, i, Address::uxtw(LogBytesPerWord)));
+ lea(Pa, Address(Pa_base));
+ lea(Pb, Address(Pb_base, i, Address::uxtw(LogBytesPerWord)));
+ lea(Pm, Address(Pm_base));
+ lea(Pn, Address(Pn_base, i, Address::uxtw(LogBytesPerWord)));
+
+ // Zero the m*n result.
+ mov(Rhi_mn, zr);
+ mov(Rlo_mn, zr);
+ }
+
+ // The core multiply-accumulate step of a Montgomery
+ // multiplication. The idea is to schedule operations as a
+ // pipeline so that instructions with long latencies (loads and
+ // multiplies) have time to complete before their results are
+ // used. This most benefits in-order implementations of the
+ // architecture but out-of-order ones also benefit.
+ void step() {
+ block_comment("step");
+ // MACC(Ra, Rb, t0, t1, t2);
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ umulh(Rhi_ab, Ra, Rb);
+ mul(Rlo_ab, Ra, Rb);
+ ldr(Ra, pre(Pa, wordSize));
+ ldr(Rb, pre(Pb, -wordSize));
+ acc(Rhi_mn, Rlo_mn, t0, t1, t2); // The pending m*n from the
+ // previous iteration.
+ // MACC(Rm, Rn, t0, t1, t2);
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+ umulh(Rhi_mn, Rm, Rn);
+ mul(Rlo_mn, Rm, Rn);
+ ldr(Rm, pre(Pm, wordSize));
+ ldr(Rn, pre(Pn, -wordSize));
+ acc(Rhi_ab, Rlo_ab, t0, t1, t2);
+ }
+
+ void post1() {
+ block_comment("post1");
+
+ // MACC(Ra, Rb, t0, t1, t2);
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ umulh(Rhi_ab, Ra, Rb);
+ mul(Rlo_ab, Ra, Rb);
+ acc(Rhi_mn, Rlo_mn, t0, t1, t2); // The pending m*n
+ acc(Rhi_ab, Rlo_ab, t0, t1, t2);
+
+ // *Pm = Rm = t0 * inv;
+ mul(Rm, t0, inv);
+ str(Rm, Address(Pm));
+
+ // MACC(Rm, Rn, t0, t1, t2);
+ // t0 = t1; t1 = t2; t2 = 0;
+ umulh(Rhi_mn, Rm, Rn);
+
+#ifndef PRODUCT
+ // assert(m[i] * n[0] + t0 == 0, "broken Montgomery multiply");
+ {
+ mul(Rlo_mn, Rm, Rn);
+ add(Rlo_mn, t0, Rlo_mn);
+ Label ok;
+ cbz(Rlo_mn, ok); {
+ stop("broken Montgomery multiply");
+ } bind(ok);
+ }
+#endif
+ // We have very carefully set things up so that
+ // m[i]*n[0] + t0 == 0 (mod b), so we don't have to calculate
+ // the lower half of Rm * Rn because we know the result already:
+ // it must be -t0. t0 + (-t0) must generate a carry iff
+ // t0 != 0. So, rather than do a mul and an adds we just set
+ // the carry flag iff t0 is nonzero.
+ //
+ // mul(Rlo_mn, Rm, Rn);
+ // adds(zr, t0, Rlo_mn);
+ subs(zr, t0, 1); // Set carry iff t0 is nonzero
+ adcs(t0, t1, Rhi_mn);
+ adc(t1, t2, zr);
+ mov(t2, zr);
+ }
+
+ void pre2(RegisterOrConstant i, RegisterOrConstant len) {
+ block_comment("pre2");
+ // Pa = Pa_base + i-len;
+ // Pb = Pb_base + len;
+ // Pm = Pm_base + i-len;
+ // Pn = Pn_base + len;
+
+ if (i.is_register()) {
+ sub(Rj, i.as_register(), len);
+ } else {
+ mov(Rj, i.as_constant());
+ sub(Rj, Rj, len);
+ }
+ // Rj == i-len
+
+ lea(Pa, Address(Pa_base, Rj, Address::uxtw(LogBytesPerWord)));
+ lea(Pb, Address(Pb_base, len, Address::uxtw(LogBytesPerWord)));
+ lea(Pm, Address(Pm_base, Rj, Address::uxtw(LogBytesPerWord)));
+ lea(Pn, Address(Pn_base, len, Address::uxtw(LogBytesPerWord)));
+
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+ ldr(Ra, pre(Pa, wordSize));
+ ldr(Rb, pre(Pb, -wordSize));
+ ldr(Rm, pre(Pm, wordSize));
+ ldr(Rn, pre(Pn, -wordSize));
+
+ mov(Rhi_mn, zr);
+ mov(Rlo_mn, zr);
+ }
+
+ void post2(RegisterOrConstant i, RegisterOrConstant len) {
+ block_comment("post2");
+ if (i.is_constant()) {
+ mov(Rj, i.as_constant()-len.as_constant());
+ } else {
+ sub(Rj, i.as_register(), len);
+ }
+
+ adds(t0, t0, Rlo_mn); // The pending m*n, low part
+
+ // As soon as we know the least significant digit of our result,
+ // store it.
+ // Pm_base[i-len] = t0;
+ str(t0, Address(Pm_base, Rj, Address::uxtw(LogBytesPerWord)));
+
+ // t0 = t1; t1 = t2; t2 = 0;
+ adcs(t0, t1, Rhi_mn); // The pending m*n, high part
+ adc(t1, t2, zr);
+ mov(t2, zr);
+ }
+
+ // A carry in t0 after Montgomery multiplication means that we
+ // should subtract multiples of n from our result in m. We'll
+ // keep doing that until there is no carry.
+ void normalize(RegisterOrConstant len) {
+ block_comment("normalize");
+ // while (t0)
+ // t0 = sub(Pm_base, Pn_base, t0, len);
+ Label loop, post, again;
+ Register cnt = t1, i = t2; // Re-use registers; we're done with them now
+ cbz(t0, post); {
+ bind(again); {
+ mov(i, zr);
+ mov(cnt, len);
+ ldr(Rm, Address(Pm_base, i, Address::uxtw(LogBytesPerWord)));
+ ldr(Rn, Address(Pn_base, i, Address::uxtw(LogBytesPerWord)));
+ subs(zr, zr, zr); // set carry flag, i.e. no borrow
+ align(16);
+ bind(loop); {
+ sbcs(Rm, Rm, Rn);
+ str(Rm, Address(Pm_base, i, Address::uxtw(LogBytesPerWord)));
+ add(i, i, 1);
+ ldr(Rm, Address(Pm_base, i, Address::uxtw(LogBytesPerWord)));
+ ldr(Rn, Address(Pn_base, i, Address::uxtw(LogBytesPerWord)));
+ sub(cnt, cnt, 1);
+ } cbnz(cnt, loop);
+ sbc(t0, t0, zr);
+ } cbnz(t0, again);
+ } bind(post);
+ }
+
+ // Move memory at s to d, reversing words.
+ // Increments d to end of copied memory
+ // Destroys tmp1, tmp2
+ // Preserves len
+ // Leaves s pointing to the address which was in d at start
+ void reverse(Register d, Register s, Register len, Register tmp1, Register tmp2) {
+ assert(tmp1 < r19 && tmp2 < r19, "register corruption");
+
+ lea(s, Address(s, len, Address::uxtw(LogBytesPerWord)));
+ mov(tmp1, len);
+ unroll_2(tmp1, &MontgomeryMultiplyGenerator::reverse1, d, s, tmp2);
+ sub(s, d, len, ext::uxtw, LogBytesPerWord);
+ }
+ // where
+ void reverse1(Register d, Register s, Register tmp) {
+ ldr(tmp, pre(s, -wordSize));
+ ror(tmp, tmp, 32);
+ str(tmp, post(d, wordSize));
+ }
+
+ void step_squaring() {
+ // An extra ACC
+ step();
+ acc(Rhi_ab, Rlo_ab, t0, t1, t2);
+ }
+
+ void last_squaring(RegisterOrConstant i) {
+ Label dont;
+ // if ((i & 1) == 0) {
+ tbnz(i.as_register(), 0, dont); {
+ // MACC(Ra, Rb, t0, t1, t2);
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ umulh(Rhi_ab, Ra, Rb);
+ mul(Rlo_ab, Ra, Rb);
+ acc(Rhi_ab, Rlo_ab, t0, t1, t2);
+ } bind(dont);
+ }
+
+ void extra_step_squaring() {
+ acc(Rhi_mn, Rlo_mn, t0, t1, t2); // The pending m*n
+
+ // MACC(Rm, Rn, t0, t1, t2);
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+ umulh(Rhi_mn, Rm, Rn);
+ mul(Rlo_mn, Rm, Rn);
+ ldr(Rm, pre(Pm, wordSize));
+ ldr(Rn, pre(Pn, -wordSize));
+ }
+
+ void post1_squaring() {
+ acc(Rhi_mn, Rlo_mn, t0, t1, t2); // The pending m*n
+
+ // *Pm = Rm = t0 * inv;
+ mul(Rm, t0, inv);
+ str(Rm, Address(Pm));
+
+ // MACC(Rm, Rn, t0, t1, t2);
+ // t0 = t1; t1 = t2; t2 = 0;
+ umulh(Rhi_mn, Rm, Rn);
+
+#ifndef PRODUCT
+ // assert(m[i] * n[0] + t0 == 0, "broken Montgomery multiply");
+ {
+ mul(Rlo_mn, Rm, Rn);
+ add(Rlo_mn, t0, Rlo_mn);
+ Label ok;
+ cbz(Rlo_mn, ok); {
+ stop("broken Montgomery multiply");
+ } bind(ok);
+ }
+#endif
+ // We have very carefully set things up so that
+ // m[i]*n[0] + t0 == 0 (mod b), so we don't have to calculate
+ // the lower half of Rm * Rn because we know the result already:
+ // it must be -t0. t0 + (-t0) must generate a carry iff
+ // t0 != 0. So, rather than do a mul and an adds we just set
+ // the carry flag iff t0 is nonzero.
+ //
+ // mul(Rlo_mn, Rm, Rn);
+ // adds(zr, t0, Rlo_mn);
+ subs(zr, t0, 1); // Set carry iff t0 is nonzero
+ adcs(t0, t1, Rhi_mn);
+ adc(t1, t2, zr);
+ mov(t2, zr);
+ }
+
+ void acc(Register Rhi, Register Rlo,
+ Register t0, Register t1, Register t2) {
+ adds(t0, t0, Rlo);
+ adcs(t1, t1, Rhi);
+ adc(t2, t2, zr);
+ }
+
+ public:
+ /**
+ * Fast Montgomery multiplication. The derivation of the
+ * algorithm is in A Cryptographic Library for the Motorola
+ * DSP56000, Dusse and Kaliski, Proc. EUROCRYPT 90, pp. 230-237.
+ *
+ * Arguments:
+ *
+ * Inputs for multiplication:
+ * c_rarg0 - int array elements a
+ * c_rarg1 - int array elements b
+ * c_rarg2 - int array elements n (the modulus)
+ * c_rarg3 - int length
+ * c_rarg4 - int inv
+ * c_rarg5 - int array elements m (the result)
+ *
+ * Inputs for squaring:
+ * c_rarg0 - int array elements a
+ * c_rarg1 - int array elements n (the modulus)
+ * c_rarg2 - int length
+ * c_rarg3 - int inv
+ * c_rarg4 - int array elements m (the result)
+ *
+ */
+ address generate_multiply() {
+ Label argh, nothing;
+ bind(argh);
+ stop("MontgomeryMultiply total_allocation must be <= 8192");
+
+ align(CodeEntryAlignment);
+ address entry = pc();
+
+ cbzw(Rlen, nothing);
+
+ enter();
+
+ // Make room.
+ cmpw(Rlen, 512);
+ br(Assembler::HI, argh);
+ sub(Ra, sp, Rlen, ext::uxtw, exact_log2(4 * sizeof (jint)));
+ andr(sp, Ra, -2 * wordSize);
+
+ lsrw(Rlen, Rlen, 1); // length in longwords = len/2
+
+ {
+ // Copy input args, reversing as we go. We use Ra as a
+ // temporary variable.
+ reverse(Ra, Pa_base, Rlen, t0, t1);
+ if (!_squaring)
+ reverse(Ra, Pb_base, Rlen, t0, t1);
+ reverse(Ra, Pn_base, Rlen, t0, t1);
+ }
+
+ // Push all call-saved registers and also Pm_base which we'll need
+ // at the end.
+ save_regs();
+
+#ifndef PRODUCT
+ // assert(inv * n[0] == -1UL, "broken inverse in Montgomery multiply");
+ {
+ ldr(Rn, Address(Pn_base, 0));
+ mul(Rlo_mn, Rn, inv);
+ cmp(Rlo_mn, -1);
+ Label ok;
+ br(EQ, ok); {
+ stop("broken inverse in Montgomery multiply");
+ } bind(ok);
+ }
+#endif
+
+ mov(Pm_base, Ra);
+
+ mov(t0, zr);
+ mov(t1, zr);
+ mov(t2, zr);
+
+ block_comment("for (int i = 0; i < len; i++) {");
+ mov(Ri, zr); {
+ Label loop, end;
+ cmpw(Ri, Rlen);
+ br(Assembler::GE, end);
+
+ bind(loop);
+ pre1(Ri);
+
+ block_comment(" for (j = i; j; j--) {"); {
+ movw(Rj, Ri);
+ unroll_2(Rj, &MontgomeryMultiplyGenerator::step);
+ } block_comment(" } // j");
+
+ post1();
+ addw(Ri, Ri, 1);
+ cmpw(Ri, Rlen);
+ br(Assembler::LT, loop);
+ bind(end);
+ block_comment("} // i");
+ }
+
+ block_comment("for (int i = len; i < 2*len; i++) {");
+ mov(Ri, Rlen); {
+ Label loop, end;
+ cmpw(Ri, Rlen, Assembler::LSL, 1);
+ br(Assembler::GE, end);
+
+ bind(loop);
+ pre2(Ri, Rlen);
+
+ block_comment(" for (j = len*2-i-1; j; j--) {"); {
+ lslw(Rj, Rlen, 1);
+ subw(Rj, Rj, Ri);
+ subw(Rj, Rj, 1);
+ unroll_2(Rj, &MontgomeryMultiplyGenerator::step);
+ } block_comment(" } // j");
+
+ post2(Ri, Rlen);
+ addw(Ri, Ri, 1);
+ cmpw(Ri, Rlen, Assembler::LSL, 1);
+ br(Assembler::LT, loop);
+ bind(end);
+ }
+ block_comment("} // i");
+
+ normalize(Rlen);
+
+ mov(Ra, Pm_base); // Save Pm_base in Ra
+ restore_regs(); // Restore caller's Pm_base
+
+ // Copy our result into caller's Pm_base
+ reverse(Pm_base, Ra, Rlen, t0, t1);
+
+ leave();
+ bind(nothing);
+ ret(lr);
+
+ return entry;
+ }
+ // In C, approximately:
+
+ // void
+ // montgomery_multiply(unsigned long Pa_base[], unsigned long Pb_base[],
+ // unsigned long Pn_base[], unsigned long Pm_base[],
+ // unsigned long inv, int len) {
+ // unsigned long t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
+ // unsigned long *Pa, *Pb, *Pn, *Pm;
+ // unsigned long Ra, Rb, Rn, Rm;
+
+ // int i;
+
+ // assert(inv * Pn_base[0] == -1UL, "broken inverse in Montgomery multiply");
+
+ // for (i = 0; i < len; i++) {
+ // int j;
+
+ // Pa = Pa_base;
+ // Pb = Pb_base + i;
+ // Pm = Pm_base;
+ // Pn = Pn_base + i;
+
+ // Ra = *Pa;
+ // Rb = *Pb;
+ // Rm = *Pm;
+ // Rn = *Pn;
+
+ // int iters = i;
+ // for (j = 0; iters--; j++) {
+ // assert(Ra == Pa_base[j] && Rb == Pb_base[i-j], "must be");
+ // MACC(Ra, Rb, t0, t1, t2);
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ // assert(Rm == Pm_base[j] && Rn == Pn_base[i-j], "must be");
+ // MACC(Rm, Rn, t0, t1, t2);
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+ // }
+
+ // assert(Ra == Pa_base[i] && Rb == Pb_base[0], "must be");
+ // MACC(Ra, Rb, t0, t1, t2);
+ // *Pm = Rm = t0 * inv;
+ // assert(Rm == Pm_base[i] && Rn == Pn_base[0], "must be");
+ // MACC(Rm, Rn, t0, t1, t2);
+
+ // assert(t0 == 0, "broken Montgomery multiply");
+
+ // t0 = t1; t1 = t2; t2 = 0;
+ // }
+
+ // for (i = len; i < 2*len; i++) {
+ // int j;
+
+ // Pa = Pa_base + i-len;
+ // Pb = Pb_base + len;
+ // Pm = Pm_base + i-len;
+ // Pn = Pn_base + len;
+
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+
+ // int iters = len*2-i-1;
+ // for (j = i-len+1; iters--; j++) {
+ // assert(Ra == Pa_base[j] && Rb == Pb_base[i-j], "must be");
+ // MACC(Ra, Rb, t0, t1, t2);
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ // assert(Rm == Pm_base[j] && Rn == Pn_base[i-j], "must be");
+ // MACC(Rm, Rn, t0, t1, t2);
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+ // }
+
+ // Pm_base[i-len] = t0;
+ // t0 = t1; t1 = t2; t2 = 0;
+ // }
+
+ // while (t0)
+ // t0 = sub(Pm_base, Pn_base, t0, len);
+ // }
+
+ /**
+ * Fast Montgomery squaring. This uses asymptotically 25% fewer
+ * multiplies than Montgomery multiplication so it should be up to
+ * 25% faster. However, its loop control is more complex and it
+ * may actually run slower on some machines.
+ *
+ * Arguments:
+ *
+ * Inputs:
+ * c_rarg0 - int array elements a
+ * c_rarg1 - int array elements n (the modulus)
+ * c_rarg2 - int length
+ * c_rarg3 - int inv
+ * c_rarg4 - int array elements m (the result)
+ *
+ */
+ address generate_square() {
+ Label argh;
+ bind(argh);
+ stop("MontgomeryMultiply total_allocation must be <= 8192");
+
+ align(CodeEntryAlignment);
+ address entry = pc();
+
+ enter();
+
+ // Make room.
+ cmpw(Rlen, 512);
+ br(Assembler::HI, argh);
+ sub(Ra, sp, Rlen, ext::uxtw, exact_log2(4 * sizeof (jint)));
+ andr(sp, Ra, -2 * wordSize);
+
+ lsrw(Rlen, Rlen, 1); // length in longwords = len/2
+
+ {
+ // Copy input args, reversing as we go. We use Ra as a
+ // temporary variable.
+ reverse(Ra, Pa_base, Rlen, t0, t1);
+ reverse(Ra, Pn_base, Rlen, t0, t1);
+ }
+
+ // Push all call-saved registers and also Pm_base which we'll need
+ // at the end.
+ save_regs();
+
+ mov(Pm_base, Ra);
+
+ mov(t0, zr);
+ mov(t1, zr);
+ mov(t2, zr);
+
+ block_comment("for (int i = 0; i < len; i++) {");
+ mov(Ri, zr); {
+ Label loop, end;
+ bind(loop);
+ cmp(Ri, Rlen);
+ br(Assembler::GE, end);
+
+ pre1(Ri);
+
+ block_comment("for (j = (i+1)/2; j; j--) {"); {
+ add(Rj, Ri, 1);
+ lsr(Rj, Rj, 1);
+ unroll_2(Rj, &MontgomeryMultiplyGenerator::step_squaring);
+ } block_comment(" } // j");
+
+ last_squaring(Ri);
+
+ block_comment(" for (j = i/2; j; j--) {"); {
+ lsr(Rj, Ri, 1);
+ unroll_2(Rj, &MontgomeryMultiplyGenerator::extra_step_squaring);
+ } block_comment(" } // j");
+
+ post1_squaring();
+ add(Ri, Ri, 1);
+ cmp(Ri, Rlen);
+ br(Assembler::LT, loop);
+
+ bind(end);
+ block_comment("} // i");
+ }
+
+ block_comment("for (int i = len; i < 2*len; i++) {");
+ mov(Ri, Rlen); {
+ Label loop, end;
+ bind(loop);
+ cmp(Ri, Rlen, Assembler::LSL, 1);
+ br(Assembler::GE, end);
+
+ pre2(Ri, Rlen);
+
+ block_comment(" for (j = (2*len-i-1)/2; j; j--) {"); {
+ lsl(Rj, Rlen, 1);
+ sub(Rj, Rj, Ri);
+ sub(Rj, Rj, 1);
+ lsr(Rj, Rj, 1);
+ unroll_2(Rj, &MontgomeryMultiplyGenerator::step_squaring);
+ } block_comment(" } // j");
+
+ last_squaring(Ri);
+
+ block_comment(" for (j = (2*len-i)/2; j; j--) {"); {
+ lsl(Rj, Rlen, 1);
+ sub(Rj, Rj, Ri);
+ lsr(Rj, Rj, 1);
+ unroll_2(Rj, &MontgomeryMultiplyGenerator::extra_step_squaring);
+ } block_comment(" } // j");
+
+ post2(Ri, Rlen);
+ add(Ri, Ri, 1);
+ cmp(Ri, Rlen, Assembler::LSL, 1);
+
+ br(Assembler::LT, loop);
+ bind(end);
+ block_comment("} // i");
+ }
+
+ normalize(Rlen);
+
+ mov(Ra, Pm_base); // Save Pm_base in Ra
+ restore_regs(); // Restore caller's Pm_base
+
+ // Copy our result into caller's Pm_base
+ reverse(Pm_base, Ra, Rlen, t0, t1);
+
+ leave();
+ ret(lr);
+
+ return entry;
+ }
+ // In C, approximately:
+
+ // void
+ // montgomery_square(unsigned long Pa_base[], unsigned long Pn_base[],
+ // unsigned long Pm_base[], unsigned long inv, int len) {
+ // unsigned long t0 = 0, t1 = 0, t2 = 0; // Triple-precision accumulator
+ // unsigned long *Pa, *Pb, *Pn, *Pm;
+ // unsigned long Ra, Rb, Rn, Rm;
+
+ // int i;
+
+ // assert(inv * Pn_base[0] == -1UL, "broken inverse in Montgomery multiply");
+
+ // for (i = 0; i < len; i++) {
+ // int j;
+
+ // Pa = Pa_base;
+ // Pb = Pa_base + i;
+ // Pm = Pm_base;
+ // Pn = Pn_base + i;
+
+ // Ra = *Pa;
+ // Rb = *Pb;
+ // Rm = *Pm;
+ // Rn = *Pn;
+
+ // int iters = (i+1)/2;
+ // for (j = 0; iters--; j++) {
+ // assert(Ra == Pa_base[j] && Rb == Pa_base[i-j], "must be");
+ // MACC2(Ra, Rb, t0, t1, t2);
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ // assert(Rm == Pm_base[j] && Rn == Pn_base[i-j], "must be");
+ // MACC(Rm, Rn, t0, t1, t2);
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+ // }
+ // if ((i & 1) == 0) {
+ // assert(Ra == Pa_base[j], "must be");
+ // MACC(Ra, Ra, t0, t1, t2);
+ // }
+ // iters = i/2;
+ // assert(iters == i-j, "must be");
+ // for (; iters--; j++) {
+ // assert(Rm == Pm_base[j] && Rn == Pn_base[i-j], "must be");
+ // MACC(Rm, Rn, t0, t1, t2);
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+ // }
+
+ // *Pm = Rm = t0 * inv;
+ // assert(Rm == Pm_base[i] && Rn == Pn_base[0], "must be");
+ // MACC(Rm, Rn, t0, t1, t2);
+
+ // assert(t0 == 0, "broken Montgomery multiply");
+
+ // t0 = t1; t1 = t2; t2 = 0;
+ // }
+
+ // for (i = len; i < 2*len; i++) {
+ // int start = i-len+1;
+ // int end = start + (len - start)/2;
+ // int j;
+
+ // Pa = Pa_base + i-len;
+ // Pb = Pa_base + len;
+ // Pm = Pm_base + i-len;
+ // Pn = Pn_base + len;
+
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+
+ // int iters = (2*len-i-1)/2;
+ // assert(iters == end-start, "must be");
+ // for (j = start; iters--; j++) {
+ // assert(Ra == Pa_base[j] && Rb == Pa_base[i-j], "must be");
+ // MACC2(Ra, Rb, t0, t1, t2);
+ // Ra = *++Pa;
+ // Rb = *--Pb;
+ // assert(Rm == Pm_base[j] && Rn == Pn_base[i-j], "must be");
+ // MACC(Rm, Rn, t0, t1, t2);
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+ // }
+ // if ((i & 1) == 0) {
+ // assert(Ra == Pa_base[j], "must be");
+ // MACC(Ra, Ra, t0, t1, t2);
+ // }
+ // iters = (2*len-i)/2;
+ // assert(iters == len-j, "must be");
+ // for (; iters--; j++) {
+ // assert(Rm == Pm_base[j] && Rn == Pn_base[i-j], "must be");
+ // MACC(Rm, Rn, t0, t1, t2);
+ // Rm = *++Pm;
+ // Rn = *--Pn;
+ // }
+ // Pm_base[i-len] = t0;
+ // t0 = t1; t1 = t2; t2 = 0;
+ // }
+
+ // while (t0)
+ // t0 = sub(Pm_base, Pn_base, t0, len);
+ // }
+ };
+
// Initialization
void generate_initial() {
// Generate initial stubs and initializes the entry points
@@ -2603,7 +3554,26 @@
StubRoutines::_multiplyToLen = generate_multiplyToLen();
}
+ if (UseMontgomeryMultiplyIntrinsic) {
+ StubCodeMark mark(this, "StubRoutines", "montgomeryMultiply");
+ MontgomeryMultiplyGenerator g(_masm, /*squaring*/false);
+ StubRoutines::_montgomeryMultiply = g.generate_multiply();
+ }
+
+ if (UseMontgomerySquareIntrinsic) {
+ StubCodeMark mark(this, "StubRoutines", "montgomerySquare");
+ MontgomeryMultiplyGenerator g(_masm, /*squaring*/true);
+ // We use generate_multiply() rather than generate_square()
+ // because it's faster for the sizes of modulus we care about.
+ StubRoutines::_montgomerySquare = g.generate_multiply();
+ }
+
#ifndef BUILTIN_SIM
+ // generate GHASH intrinsics code
+ if (UseGHASHIntrinsics) {
+ StubRoutines::_ghash_processBlocks = generate_ghash_processBlocks();
+ }
+
if (UseAESIntrinsics) {
StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -45,6 +45,10 @@
#define HWCAP_AES (1<<3)
#endif
+#ifndef HWCAP_PMULL
+#define HWCAP_PMULL (1<<4)
+#endif
+
#ifndef HWCAP_SHA1
#define HWCAP_SHA1 (1<<5)
#endif
@@ -190,11 +194,6 @@
}
}
- if (UseGHASHIntrinsics) {
- warning("GHASH intrinsics are not available on this CPU");
- FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
- }
-
if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
UseCRC32Intrinsics = true;
}
@@ -232,7 +231,7 @@
}
} else if (UseSHA256Intrinsics) {
warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
- FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
+ FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
}
if (UseSHA512Intrinsics) {
@@ -244,6 +243,15 @@
FLAG_SET_DEFAULT(UseSHA, false);
}
+ if (auxv & HWCAP_PMULL) {
+ if (FLAG_IS_DEFAULT(UseGHASHIntrinsics)) {
+ FLAG_SET_DEFAULT(UseGHASHIntrinsics, true);
+ }
+ } else if (UseGHASHIntrinsics) {
+ warning("GHASH intrinsics are not available on this CPU");
+ FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
+ }
+
// This machine allows unaligned memory accesses
if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
FLAG_SET_DEFAULT(UseUnalignedAccesses, true);
@@ -261,6 +269,13 @@
UsePopCountInstruction = true;
}
+ if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
+ UseMontgomeryMultiplyIntrinsic = true;
+ }
+ if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) {
+ UseMontgomerySquareIntrinsic = true;
+ }
+
#ifdef COMPILER2
if (FLAG_IS_DEFAULT(OptoScheduling)) {
OptoScheduling = true;
--- a/hotspot/src/os/aix/vm/os_aix.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/os/aix/vm/os_aix.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -1550,6 +1550,13 @@
LoadedLibraries::print(st);
}
+void os::get_summary_os_info(char* buf, size_t buflen) {
+ // There might be something more readable than uname results for AIX.
+ struct utsname name;
+ uname(&name);
+ snprintf(buf, buflen, "%s %s", name.release, name.version);
+}
+
void os::print_os_info(outputStream* st) {
st->print("OS:");
@@ -1654,6 +1661,17 @@
}
}
+// Get a string for the cpuinfo that is a summary of the cpu type
+void os::get_summary_cpu_info(char* buf, size_t buflen) {
+ // This looks good
+ os::Aix::cpuinfo_t ci;
+ if (os::Aix::get_cpuinfo(&ci)) {
+ strncpy(buf, ci.version, buflen);
+ } else {
+ strncpy(buf, "AIX", buflen);
+ }
+}
+
void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
}
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -1600,24 +1600,6 @@
return dlsym(handle, name);
}
-
-static bool _print_ascii_file(const char* filename, outputStream* st) {
- int fd = ::open(filename, O_RDONLY);
- if (fd == -1) {
- return false;
- }
-
- char buf[32];
- int bytes;
- while ((bytes = ::read(fd, buf, sizeof(buf))) > 0) {
- st->print_raw(buf, bytes);
- }
-
- ::close(fd);
-
- return true;
-}
-
int _print_dll_info_cb(const char * name, address base_address, address top_address, void * param) {
outputStream * out = (outputStream *) param;
out->print_cr(PTR_FORMAT " \t%s", base_address, name);
@@ -1678,15 +1660,38 @@
#endif
}
+void os::get_summary_os_info(char* buf, size_t buflen) {
+ // These buffers are small because we want this to be brief
+ // and not use a lot of stack while generating the hs_err file.
+ char os[100];
+ size_t size = sizeof(os);
+ int mib_kern[] = { CTL_KERN, KERN_OSTYPE };
+ if (sysctl(mib_kern, 2, os, &size, NULL, 0) < 0) {
+#ifdef __APPLE__
+ strncpy(os, "Darwin", sizeof(os));
+#elif __OpenBSD__
+ strncpy(os, "OpenBSD", sizeof(os));
+#else
+ strncpy(os, "BSD", sizeof(os));
+#endif
+ }
+
+ char release[100];
+ size = sizeof(release);
+ int mib_release[] = { CTL_KERN, KERN_OSRELEASE };
+ if (sysctl(mib_release, 2, release, &size, NULL, 0) < 0) {
+ // if error, leave blank
+ strncpy(release, "", sizeof(release));
+ }
+ snprintf(buf, buflen, "%s %s", os, release);
+}
+
void os::print_os_info_brief(outputStream* st) {
- st->print("Bsd");
-
os::Posix::print_uname_info(st);
}
void os::print_os_info(outputStream* st) {
st->print("OS:");
- st->print("Bsd");
os::Posix::print_uname_info(st);
@@ -1699,6 +1704,33 @@
// Nothing to do for now.
}
+void os::get_summary_cpu_info(char* buf, size_t buflen) {
+ unsigned int mhz;
+ size_t size = sizeof(mhz);
+ int mib[] = { CTL_HW, HW_CPU_FREQ };
+ if (sysctl(mib, 2, &mhz, &size, NULL, 0) < 0) {
+ mhz = 1; // looks like an error but can be divided by
+ } else {
+ mhz /= 1000000; // reported in millions
+ }
+
+ char model[100];
+ size = sizeof(model);
+ int mib_model[] = { CTL_HW, HW_MODEL };
+ if (sysctl(mib_model, 2, model, &size, NULL, 0) < 0) {
+ strncpy(model, cpu_arch, sizeof(model));
+ }
+
+ char machine[100];
+ size = sizeof(machine);
+ int mib_machine[] = { CTL_HW, HW_MACHINE };
+ if (sysctl(mib_machine, 2, machine, &size, NULL, 0) < 0) {
+ strncpy(machine, "", sizeof(machine));
+ }
+
+ snprintf(buf, buflen, "%s %s %d MHz", model, machine, mhz);
+}
+
void os::print_memory_info(outputStream* st) {
st->print("Memory:");
@@ -1709,11 +1741,6 @@
st->print("(" UINT64_FORMAT "k free)",
os::available_memory() >> 10);
st->cr();
-
- // meminfo
- st->print("\n/proc/meminfo:\n");
- _print_ascii_file("/proc/meminfo", st);
- st->cr();
}
void os::print_siginfo(outputStream* st, void* siginfo) {
--- a/hotspot/src/os/linux/vm/os_linux.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -2043,31 +2043,96 @@
// Searching for the debian_version file is the last resort. It contains
// an informative string like "6.0.6" or "wheezy/sid". Because of this
// "Debian " is printed before the contents of the debian_version file.
+
+const char* distro_files[] = {
+ "/etc/oracle-release",
+ "/etc/mandriva-release",
+ "/etc/mandrake-release",
+ "/etc/sun-release",
+ "/etc/redhat-release",
+ "/etc/lsb-release",
+ "/etc/SuSE-release",
+ "/etc/turbolinux-release",
+ "/etc/gentoo-release",
+ "/etc/ltib-release",
+ "/etc/angstrom-version",
+ "/etc/system-release",
+ "/etc/os-release",
+ NULL };
+
void os::Linux::print_distro_info(outputStream* st) {
- if (!_print_ascii_file("/etc/oracle-release", st) &&
- !_print_ascii_file("/etc/mandriva-release", st) &&
- !_print_ascii_file("/etc/mandrake-release", st) &&
- !_print_ascii_file("/etc/sun-release", st) &&
- !_print_ascii_file("/etc/redhat-release", st) &&
- !_print_ascii_file("/etc/lsb-release", st) &&
- !_print_ascii_file("/etc/SuSE-release", st) &&
- !_print_ascii_file("/etc/turbolinux-release", st) &&
- !_print_ascii_file("/etc/gentoo-release", st) &&
- !_print_ascii_file("/etc/ltib-release", st) &&
- !_print_ascii_file("/etc/angstrom-version", st) &&
- !_print_ascii_file("/etc/system-release", st) &&
- !_print_ascii_file("/etc/os-release", st)) {
-
- if (file_exists("/etc/debian_version")) {
- st->print("Debian ");
- _print_ascii_file("/etc/debian_version", st);
- } else {
- st->print("Linux");
+ for (int i = 0;; i++) {
+ const char* file = distro_files[i];
+ if (file == NULL) {
+ break; // done
}
+ // If file prints, we found it.
+ if (_print_ascii_file(file, st)) {
+ return;
+ }
+ }
+
+ if (file_exists("/etc/debian_version")) {
+ st->print("Debian ");
+ _print_ascii_file("/etc/debian_version", st);
+ } else {
+ st->print("Linux");
}
st->cr();
}
+static void parse_os_info(char* distro, size_t length, const char* file) {
+ FILE* fp = fopen(file, "r");
+ if (fp != NULL) {
+ char buf[256];
+ // get last line of the file.
+ while (fgets(buf, sizeof(buf), fp)) { }
+ // Edit out extra stuff in expected ubuntu format
+ if (strstr(buf, "DISTRIB_DESCRIPTION=") != NULL) {
+ char* ptr = strstr(buf, "\""); // the name is in quotes
+ if (ptr != NULL) {
+ ptr++; // go beyond first quote
+ char* nl = strchr(ptr, '\"');
+ if (nl != NULL) *nl = '\0';
+ strncpy(distro, ptr, length);
+ } else {
+ ptr = strstr(buf, "=");
+ ptr++; // go beyond equals then
+ char* nl = strchr(ptr, '\n');
+ if (nl != NULL) *nl = '\0';
+ strncpy(distro, ptr, length);
+ }
+ } else {
+ // if not in expected Ubuntu format, print out whole line minus \n
+ char* nl = strchr(buf, '\n');
+ if (nl != NULL) *nl = '\0';
+ strncpy(distro, buf, length);
+ }
+ // close distro file
+ fclose(fp);
+ }
+}
+
+void os::get_summary_os_info(char* buf, size_t buflen) {
+ for (int i = 0;; i++) {
+ const char* file = distro_files[i];
+ if (file == NULL) {
+ break; // ran out of distro_files
+ }
+ if (file_exists(file)) {
+ parse_os_info(buf, buflen, file);
+ return;
+ }
+ }
+ // special case for debian
+ if (file_exists("/etc/debian_version")) {
+ strncpy(buf, "Debian ", buflen);
+ parse_os_info(&buf[7], buflen-7, "/etc/debian_version");
+ } else {
+ strncpy(buf, "Linux", buflen);
+ }
+}
+
void os::Linux::print_libversion_info(outputStream* st) {
// libc, pthread
st->print("libc:");
@@ -2150,6 +2215,48 @@
}
}
+const char* search_string = IA32_ONLY("model name") AMD64_ONLY("model name")
+ IA64_ONLY("") SPARC_ONLY("cpu")
+ ARM32_ONLY("Processor") PPC_ONLY("Processor") AARCH64_ONLY("Processor");
+
+// Parses the cpuinfo file for string representing the model name.
+void os::get_summary_cpu_info(char* cpuinfo, size_t length) {
+ FILE* fp = fopen("/proc/cpuinfo", "r");
+ if (fp != NULL) {
+ while (!feof(fp)) {
+ char buf[256];
+ if (fgets(buf, sizeof(buf), fp)) {
+ char* start = strstr(buf, search_string);
+ if (start != NULL) {
+ char *ptr = start + strlen(search_string);
+ char *end = buf + strlen(buf);
+ while (ptr != end) {
+ // skip whitespace and colon for the rest of the name.
+ if (*ptr != ' ' && *ptr != '\t' && *ptr != ':') {
+ break;
+ }
+ ptr++;
+ }
+ if (ptr != end) {
+ // reasonable string, get rid of newline and keep the rest
+ char* nl = strchr(buf, '\n');
+ if (nl != NULL) *nl = '\0';
+ strncpy(cpuinfo, ptr, length);
+ fclose(fp);
+ return;
+ }
+ }
+ }
+ }
+ fclose(fp);
+ }
+ // cpuinfo not found or parsing failed, just print generic string. The entire
+ // /proc/cpuinfo file will be printed later in the file (or enough of it for x86)
+ strncpy(cpuinfo, IA32_ONLY("x86_32") AMD64_ONLY("x86_32")
+ IA64_ONLY("IA64") SPARC_ONLY("sparcv9")
+ ARM32_ONLY("ARM") PPC_ONLY("PPC64") AARCH64_ONLY("AArch64"), length);
+}
+
void os::print_siginfo(outputStream* st, void* siginfo) {
const siginfo_t* si = (const siginfo_t*)siginfo;
--- a/hotspot/src/os/posix/vm/os_posix.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/os/posix/vm/os_posix.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -236,6 +236,15 @@
st->cr();
}
+#ifndef PRODUCT
+bool os::get_host_name(char* buf, size_t buflen) {
+ struct utsname name;
+ uname(&name);
+ jio_snprintf(buf, buflen, "%s", name.nodename);
+ return true;
+}
+#endif // PRODUCT
+
bool os::has_allocatable_memory_limit(julong* limit) {
struct rlimit rlim;
int getrlimit_res = getrlimit(RLIMIT_AS, &rlim);
@@ -1070,7 +1079,7 @@
return ret == 0;
}
-bool PosixSemaphore::timedwait(const struct timespec ts) {
+bool PosixSemaphore::timedwait(struct timespec ts) {
while (true) {
int result = sem_timedwait(&_semaphore, &ts);
if (result == 0) {
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -1971,6 +1971,26 @@
st->cr();
}
+void os::get_summary_os_info(char* buf, size_t buflen) {
+ strncpy(buf, "Solaris", buflen); // default to plain solaris
+ FILE* fp = fopen("/etc/release", "r");
+ if (fp != NULL) {
+ char tmp[256];
+ // Only get the first line and chop out everything but the os name.
+ if (fgets(tmp, sizeof(tmp), fp)) {
+ char* ptr = tmp;
+ // skip past whitespace characters
+ while (*ptr != '\0' && (*ptr == ' ' || *ptr == '\t' || *ptr == '\n')) ptr++;
+ if (*ptr != '\0') {
+ char* nl = strchr(ptr, '\n');
+ if (nl != NULL) *nl = '\0';
+ strncpy(buf, ptr, buflen);
+ }
+ }
+ fclose(fp);
+ }
+}
+
void os::Solaris::print_libversion_info(outputStream* st) {
st->print(" (T2 libthread)");
st->cr();
@@ -1998,6 +2018,22 @@
return status;
}
+void os::get_summary_cpu_info(char* buf, size_t buflen) {
+ // Get MHz with system call. We don't seem to already have this.
+ processor_info_t stats;
+ processorid_t id = getcpuid();
+ int clock = 0;
+ if (processor_info(id, &stats) != -1) {
+ clock = stats.pi_clock; // pi_processor_type isn't more informative than below
+ }
+#ifdef AMD64
+ snprintf(buf, buflen, "x86 64 bit %d MHz", clock);
+#else
+ // must be sparc
+ snprintf(buf, buflen, "Sparcv9 64 bit %d MHz", clock);
+#endif
+}
+
void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
// Nothing to do for now.
}
--- a/hotspot/src/os/windows/vm/os_windows.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -1593,6 +1593,21 @@
return result;
}
+#ifndef PRODUCT
+bool os::get_host_name(char* buf, size_t buflen) {
+ DWORD size = (DWORD)buflen;
+ return (GetComputerNameEx(ComputerNameDnsHostname, buf, &size) == TRUE);
+}
+#endif // PRODUCT
+
+void os::get_summary_os_info(char* buf, size_t buflen) {
+ stringStream sst(buf, buflen);
+ os::win32::print_windows_version(&sst);
+ // chop off newline character
+ char* nl = strchr(buf, '\n');
+ if (nl != NULL) *nl = '\0';
+}
+
void os::print_os_info_brief(outputStream* st) {
os::print_os_info(st);
}
@@ -1600,15 +1615,14 @@
void os::print_os_info(outputStream* st) {
#ifdef ASSERT
char buffer[1024];
- DWORD size = sizeof(buffer);
- st->print(" HostName: ");
- if (GetComputerNameEx(ComputerNameDnsHostname, buffer, &size)) {
- st->print("%s", buffer);
+ st->print("HostName: ");
+ if (get_host_name(buffer, sizeof(buffer))) {
+ st->print("%s ", buffer);
} else {
- st->print("N/A");
+ st->print("N/A ");
}
#endif
- st->print(" OS:");
+ st->print("OS:");
os::win32::print_windows_version(st);
}
@@ -1738,6 +1752,23 @@
// Nothing to do for now.
}
+void os::get_summary_cpu_info(char* buf, size_t buflen) {
+ HKEY key;
+ DWORD status = RegOpenKey(HKEY_LOCAL_MACHINE,
+ "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", &key);
+ if (status == ERROR_SUCCESS) {
+ DWORD size = (DWORD)buflen;
+ status = RegQueryValueEx(key, "ProcessorNameString", NULL, NULL, (byte*)buf, &size);
+ if (status != ERROR_SUCCESS) {
+ strncpy(buf, "## __CPU__", buflen);
+ }
+ RegCloseKey(key);
+ } else {
+ // Put generic cpu info to return
+ strncpy(buf, "## __CPU__", buflen);
+ }
+}
+
void os::print_memory_info(outputStream* st) {
st->print("Memory:");
st->print(" %dk page", os::vm_page_size()>>10);
--- a/hotspot/src/share/vm/c1/c1_Compiler.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -99,6 +99,164 @@
return buffer_blob;
}
+bool Compiler::is_intrinsic_supported(methodHandle method) {
+ vmIntrinsics::ID id = method->intrinsic_id();
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+
+ if (method->is_synchronized()) {
+ // C1 does not support intrinsification of synchronized methods.
+ return false;
+ }
+
+ switch (id) {
+ case vmIntrinsics::_compareAndSwapLong:
+ if (!VM_Version::supports_cx8()) return false;
+ break;
+ case vmIntrinsics::_getAndAddInt:
+ if (!VM_Version::supports_atomic_getadd4()) return false;
+ break;
+ case vmIntrinsics::_getAndAddLong:
+ if (!VM_Version::supports_atomic_getadd8()) return false;
+ break;
+ case vmIntrinsics::_getAndSetInt:
+ if (!VM_Version::supports_atomic_getset4()) return false;
+ break;
+ case vmIntrinsics::_getAndSetLong:
+ if (!VM_Version::supports_atomic_getset8()) return false;
+ break;
+ case vmIntrinsics::_getAndSetObject:
+#ifdef _LP64
+ if (!UseCompressedOops && !VM_Version::supports_atomic_getset8()) return false;
+ if (UseCompressedOops && !VM_Version::supports_atomic_getset4()) return false;
+#else
+ if (!VM_Version::supports_atomic_getset4()) return false;
+#endif
+ break;
+ case vmIntrinsics::_arraycopy:
+ case vmIntrinsics::_currentTimeMillis:
+ case vmIntrinsics::_nanoTime:
+ case vmIntrinsics::_Reference_get:
+ // Use the intrinsic version of Reference.get() so that the value in
+ // the referent field can be registered by the G1 pre-barrier code.
+ // Also to prevent commoning reads from this field across safepoint
+ // since GC can change its value.
+ case vmIntrinsics::_loadFence:
+ case vmIntrinsics::_storeFence:
+ case vmIntrinsics::_fullFence:
+ case vmIntrinsics::_floatToRawIntBits:
+ case vmIntrinsics::_intBitsToFloat:
+ case vmIntrinsics::_doubleToRawLongBits:
+ case vmIntrinsics::_longBitsToDouble:
+ case vmIntrinsics::_getClass:
+ case vmIntrinsics::_isInstance:
+ case vmIntrinsics::_currentThread:
+ case vmIntrinsics::_dabs:
+ case vmIntrinsics::_dsqrt:
+ case vmIntrinsics::_dsin:
+ case vmIntrinsics::_dcos:
+ case vmIntrinsics::_dtan:
+ case vmIntrinsics::_dlog:
+ case vmIntrinsics::_dlog10:
+ case vmIntrinsics::_dexp:
+ case vmIntrinsics::_dpow:
+ case vmIntrinsics::_getObject:
+ case vmIntrinsics::_getBoolean:
+ case vmIntrinsics::_getByte:
+ case vmIntrinsics::_getShort:
+ case vmIntrinsics::_getChar:
+ case vmIntrinsics::_getInt:
+ case vmIntrinsics::_getLong:
+ case vmIntrinsics::_getFloat:
+ case vmIntrinsics::_getDouble:
+ case vmIntrinsics::_putObject:
+ case vmIntrinsics::_putBoolean:
+ case vmIntrinsics::_putByte:
+ case vmIntrinsics::_putShort:
+ case vmIntrinsics::_putChar:
+ case vmIntrinsics::_putInt:
+ case vmIntrinsics::_putLong:
+ case vmIntrinsics::_putFloat:
+ case vmIntrinsics::_putDouble:
+ case vmIntrinsics::_getObjectVolatile:
+ case vmIntrinsics::_getBooleanVolatile:
+ case vmIntrinsics::_getByteVolatile:
+ case vmIntrinsics::_getShortVolatile:
+ case vmIntrinsics::_getCharVolatile:
+ case vmIntrinsics::_getIntVolatile:
+ case vmIntrinsics::_getLongVolatile:
+ case vmIntrinsics::_getFloatVolatile:
+ case vmIntrinsics::_getDoubleVolatile:
+ case vmIntrinsics::_putObjectVolatile:
+ case vmIntrinsics::_putBooleanVolatile:
+ case vmIntrinsics::_putByteVolatile:
+ case vmIntrinsics::_putShortVolatile:
+ case vmIntrinsics::_putCharVolatile:
+ case vmIntrinsics::_putIntVolatile:
+ case vmIntrinsics::_putLongVolatile:
+ case vmIntrinsics::_putFloatVolatile:
+ case vmIntrinsics::_putDoubleVolatile:
+ case vmIntrinsics::_getByte_raw:
+ case vmIntrinsics::_getShort_raw:
+ case vmIntrinsics::_getChar_raw:
+ case vmIntrinsics::_getInt_raw:
+ case vmIntrinsics::_getLong_raw:
+ case vmIntrinsics::_getFloat_raw:
+ case vmIntrinsics::_getDouble_raw:
+ case vmIntrinsics::_putByte_raw:
+ case vmIntrinsics::_putShort_raw:
+ case vmIntrinsics::_putChar_raw:
+ case vmIntrinsics::_putInt_raw:
+ case vmIntrinsics::_putLong_raw:
+ case vmIntrinsics::_putFloat_raw:
+ case vmIntrinsics::_putDouble_raw:
+ case vmIntrinsics::_putOrderedObject:
+ case vmIntrinsics::_putOrderedInt:
+ case vmIntrinsics::_putOrderedLong:
+ case vmIntrinsics::_getShortUnaligned:
+ case vmIntrinsics::_getCharUnaligned:
+ case vmIntrinsics::_getIntUnaligned:
+ case vmIntrinsics::_getLongUnaligned:
+ case vmIntrinsics::_putShortUnaligned:
+ case vmIntrinsics::_putCharUnaligned:
+ case vmIntrinsics::_putIntUnaligned:
+ case vmIntrinsics::_putLongUnaligned:
+ case vmIntrinsics::_checkIndex:
+ case vmIntrinsics::_updateCRC32:
+ case vmIntrinsics::_updateBytesCRC32:
+ case vmIntrinsics::_updateByteBufferCRC32:
+ case vmIntrinsics::_compareAndSwapInt:
+ case vmIntrinsics::_compareAndSwapObject:
+#ifdef TRACE_HAVE_INTRINSICS
+ case vmIntrinsics::_classID:
+ case vmIntrinsics::_threadID:
+ case vmIntrinsics::_counterTime:
+#endif
+ break;
+ default:
+ return false; // Intrinsics not on the previous list are not available.
+ }
+
+ return true;
+}
+
+bool Compiler::is_intrinsic_disabled_by_flag(methodHandle method) {
+ vmIntrinsics::ID id = method->intrinsic_id();
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+
+ if (vmIntrinsics::is_disabled_by_flags(id)) {
+ return true;
+ }
+
+ if (!InlineNatives && id != vmIntrinsics::_Reference_get) {
+ return true;
+ }
+
+ if (!InlineClassNatives && id == vmIntrinsics::_getClass) {
+ return true;
+ }
+
+ return false;
+}
void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
@@ -117,3 +275,7 @@
void Compiler::print_timers() {
Compilation::print_timers();
}
+
+bool Compiler::is_intrinsic_available(methodHandle method, methodHandle compilation_context) {
+ return is_intrinsic_supported(method) && !is_intrinsic_disabled_by_flag(method);
+}
--- a/hotspot/src/share/vm/c1/c1_Compiler.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compiler.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -55,6 +55,18 @@
// Print compilation timers and statistics
virtual void print_timers();
+ // Check the availability of an intrinsic for 'method' given a compilation context.
+ // The compilation context is needed to support per-method usage of the
+ // DisableIntrinsic flag. However, as C1 ignores the DisableIntrinsic flag, it
+ // ignores the compilation context.
+ virtual bool is_intrinsic_available(methodHandle method, methodHandle compilation_context);
+
+ // Check if the C1 compiler supports an intrinsic for 'method'.
+ virtual bool is_intrinsic_supported(methodHandle method);
+
+ // Processing of command-line flags specific to the C1 compiler.
+ virtual bool is_intrinsic_disabled_by_flag(methodHandle method);
+
// Size of the code buffer
static int code_buffer_size();
};
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -3372,231 +3372,85 @@
return NULL;
}
-
-bool GraphBuilder::try_inline_intrinsics(ciMethod* callee) {
- if (callee->is_synchronized()) {
- // We don't currently support any synchronized intrinsics
- return false;
- }
-
- // callee seems like a good candidate
- // determine id
+void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee) {
vmIntrinsics::ID id = callee->intrinsic_id();
- if (!InlineNatives && id != vmIntrinsics::_Reference_get) {
- // InlineNatives does not control Reference.get
- INLINE_BAILOUT("intrinsic method inlining disabled");
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+
+ // Some intrinsics need special IR nodes.
+ switch(id) {
+ case vmIntrinsics::_getObject : append_unsafe_get_obj(callee, T_OBJECT, false); return;
+ case vmIntrinsics::_getBoolean : append_unsafe_get_obj(callee, T_BOOLEAN, false); return;
+ case vmIntrinsics::_getByte : append_unsafe_get_obj(callee, T_BYTE, false); return;
+ case vmIntrinsics::_getShort : append_unsafe_get_obj(callee, T_SHORT, false); return;
+ case vmIntrinsics::_getChar : append_unsafe_get_obj(callee, T_CHAR, false); return;
+ case vmIntrinsics::_getInt : append_unsafe_get_obj(callee, T_INT, false); return;
+ case vmIntrinsics::_getLong : append_unsafe_get_obj(callee, T_LONG, false); return;
+ case vmIntrinsics::_getFloat : append_unsafe_get_obj(callee, T_FLOAT, false); return;
+ case vmIntrinsics::_getDouble : append_unsafe_get_obj(callee, T_DOUBLE, false); return;
+ case vmIntrinsics::_putObject : append_unsafe_put_obj(callee, T_OBJECT, false); return;
+ case vmIntrinsics::_putBoolean : append_unsafe_put_obj(callee, T_BOOLEAN, false); return;
+ case vmIntrinsics::_putByte : append_unsafe_put_obj(callee, T_BYTE, false); return;
+ case vmIntrinsics::_putShort : append_unsafe_put_obj(callee, T_SHORT, false); return;
+ case vmIntrinsics::_putChar : append_unsafe_put_obj(callee, T_CHAR, false); return;
+ case vmIntrinsics::_putInt : append_unsafe_put_obj(callee, T_INT, false); return;
+ case vmIntrinsics::_putLong : append_unsafe_put_obj(callee, T_LONG, false); return;
+ case vmIntrinsics::_putFloat : append_unsafe_put_obj(callee, T_FLOAT, false); return;
+ case vmIntrinsics::_putDouble : append_unsafe_put_obj(callee, T_DOUBLE, false); return;
+ case vmIntrinsics::_getShortUnaligned : append_unsafe_get_obj(callee, T_SHORT, false); return;
+ case vmIntrinsics::_getCharUnaligned : append_unsafe_get_obj(callee, T_CHAR, false); return;
+ case vmIntrinsics::_getIntUnaligned : append_unsafe_get_obj(callee, T_INT, false); return;
+ case vmIntrinsics::_getLongUnaligned : append_unsafe_get_obj(callee, T_LONG, false); return;
+ case vmIntrinsics::_putShortUnaligned : append_unsafe_put_obj(callee, T_SHORT, false); return;
+ case vmIntrinsics::_putCharUnaligned : append_unsafe_put_obj(callee, T_CHAR, false); return;
+ case vmIntrinsics::_putIntUnaligned : append_unsafe_put_obj(callee, T_INT, false); return;
+ case vmIntrinsics::_putLongUnaligned : append_unsafe_put_obj(callee, T_LONG, false); return;
+ case vmIntrinsics::_getObjectVolatile : append_unsafe_get_obj(callee, T_OBJECT, true); return;
+ case vmIntrinsics::_getBooleanVolatile : append_unsafe_get_obj(callee, T_BOOLEAN, true); return;
+ case vmIntrinsics::_getByteVolatile : append_unsafe_get_obj(callee, T_BYTE, true); return;
+ case vmIntrinsics::_getShortVolatile : append_unsafe_get_obj(callee, T_SHORT, true); return;
+ case vmIntrinsics::_getCharVolatile : append_unsafe_get_obj(callee, T_CHAR, true); return;
+ case vmIntrinsics::_getIntVolatile : append_unsafe_get_obj(callee, T_INT, true); return;
+ case vmIntrinsics::_getLongVolatile : append_unsafe_get_obj(callee, T_LONG, true); return;
+ case vmIntrinsics::_getFloatVolatile : append_unsafe_get_obj(callee, T_FLOAT, true); return;
+ case vmIntrinsics::_getDoubleVolatile : append_unsafe_get_obj(callee, T_DOUBLE, true); return;
+ case vmIntrinsics::_putObjectVolatile : append_unsafe_put_obj(callee, T_OBJECT, true); return;
+ case vmIntrinsics::_putBooleanVolatile : append_unsafe_put_obj(callee, T_BOOLEAN, true); return;
+ case vmIntrinsics::_putByteVolatile : append_unsafe_put_obj(callee, T_BYTE, true); return;
+ case vmIntrinsics::_putShortVolatile : append_unsafe_put_obj(callee, T_SHORT, true); return;
+ case vmIntrinsics::_putCharVolatile : append_unsafe_put_obj(callee, T_CHAR, true); return;
+ case vmIntrinsics::_putIntVolatile : append_unsafe_put_obj(callee, T_INT, true); return;
+ case vmIntrinsics::_putLongVolatile : append_unsafe_put_obj(callee, T_LONG, true); return;
+ case vmIntrinsics::_putFloatVolatile : append_unsafe_put_obj(callee, T_FLOAT, true); return;
+ case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return;
+ case vmIntrinsics::_getByte_raw : append_unsafe_get_raw(callee, T_BYTE ); return;
+ case vmIntrinsics::_getShort_raw : append_unsafe_get_raw(callee, T_SHORT ); return;
+ case vmIntrinsics::_getChar_raw : append_unsafe_get_raw(callee, T_CHAR ); return;
+ case vmIntrinsics::_getInt_raw : append_unsafe_get_raw(callee, T_INT ); return;
+ case vmIntrinsics::_getLong_raw : append_unsafe_get_raw(callee, T_LONG ); return;
+ case vmIntrinsics::_getFloat_raw : append_unsafe_get_raw(callee, T_FLOAT ); return;
+ case vmIntrinsics::_getDouble_raw : append_unsafe_get_raw(callee, T_DOUBLE); return;
+ case vmIntrinsics::_putByte_raw : append_unsafe_put_raw(callee, T_BYTE ); return;
+ case vmIntrinsics::_putShort_raw : append_unsafe_put_raw(callee, T_SHORT ); return;
+ case vmIntrinsics::_putChar_raw : append_unsafe_put_raw(callee, T_CHAR ); return;
+ case vmIntrinsics::_putInt_raw : append_unsafe_put_raw(callee, T_INT ); return;
+ case vmIntrinsics::_putLong_raw : append_unsafe_put_raw(callee, T_LONG ); return;
+ case vmIntrinsics::_putFloat_raw : append_unsafe_put_raw(callee, T_FLOAT ); return;
+ case vmIntrinsics::_putDouble_raw : append_unsafe_put_raw(callee, T_DOUBLE); return;
+ case vmIntrinsics::_putOrderedObject : append_unsafe_put_obj(callee, T_OBJECT, true); return;
+ case vmIntrinsics::_putOrderedInt : append_unsafe_put_obj(callee, T_INT, true); return;
+ case vmIntrinsics::_putOrderedLong : append_unsafe_put_obj(callee, T_LONG, true); return;
+ case vmIntrinsics::_compareAndSwapLong:
+ case vmIntrinsics::_compareAndSwapInt:
+ case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return;
+ case vmIntrinsics::_getAndAddInt:
+ case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return;
+ case vmIntrinsics::_getAndSetInt :
+ case vmIntrinsics::_getAndSetLong :
+ case vmIntrinsics::_getAndSetObject : append_unsafe_get_and_set_obj(callee, false); return;
+ default:
+ break;
}
- bool preserves_state = false;
- bool cantrap = true;
- switch (id) {
- case vmIntrinsics::_arraycopy:
- if (!InlineArrayCopy) return false;
- break;
-
-#ifdef TRACE_HAVE_INTRINSICS
- case vmIntrinsics::_classID:
- case vmIntrinsics::_threadID:
- preserves_state = true;
- cantrap = true;
- break;
-
- case vmIntrinsics::_counterTime:
- preserves_state = true;
- cantrap = false;
- break;
-#endif
-
- case vmIntrinsics::_currentTimeMillis:
- case vmIntrinsics::_nanoTime:
- preserves_state = true;
- cantrap = false;
- break;
-
- case vmIntrinsics::_floatToRawIntBits :
- case vmIntrinsics::_intBitsToFloat :
- case vmIntrinsics::_doubleToRawLongBits :
- case vmIntrinsics::_longBitsToDouble :
- if (!InlineMathNatives) return false;
- preserves_state = true;
- cantrap = false;
- break;
-
- case vmIntrinsics::_getClass :
- case vmIntrinsics::_isInstance :
- if (!InlineClassNatives) return false;
- preserves_state = true;
- break;
-
- case vmIntrinsics::_currentThread :
- if (!InlineThreadNatives) return false;
- preserves_state = true;
- cantrap = false;
- break;
-
- case vmIntrinsics::_dabs : // fall through
- case vmIntrinsics::_dsqrt : // fall through
- case vmIntrinsics::_dsin : // fall through
- case vmIntrinsics::_dcos : // fall through
- case vmIntrinsics::_dtan : // fall through
- case vmIntrinsics::_dlog : // fall through
- case vmIntrinsics::_dlog10 : // fall through
- case vmIntrinsics::_dexp : // fall through
- case vmIntrinsics::_dpow : // fall through
- if (!InlineMathNatives) return false;
- cantrap = false;
- preserves_state = true;
- break;
-
- // Use special nodes for Unsafe instructions so we can more easily
- // perform an address-mode optimization on the raw variants
- case vmIntrinsics::_getObject : return append_unsafe_get_obj(callee, T_OBJECT, false);
- case vmIntrinsics::_getBoolean: return append_unsafe_get_obj(callee, T_BOOLEAN, false);
- case vmIntrinsics::_getByte : return append_unsafe_get_obj(callee, T_BYTE, false);
- case vmIntrinsics::_getShort : return append_unsafe_get_obj(callee, T_SHORT, false);
- case vmIntrinsics::_getChar : return append_unsafe_get_obj(callee, T_CHAR, false);
- case vmIntrinsics::_getInt : return append_unsafe_get_obj(callee, T_INT, false);
- case vmIntrinsics::_getLong : return append_unsafe_get_obj(callee, T_LONG, false);
- case vmIntrinsics::_getFloat : return append_unsafe_get_obj(callee, T_FLOAT, false);
- case vmIntrinsics::_getDouble : return append_unsafe_get_obj(callee, T_DOUBLE, false);
-
- case vmIntrinsics::_putObject : return append_unsafe_put_obj(callee, T_OBJECT, false);
- case vmIntrinsics::_putBoolean: return append_unsafe_put_obj(callee, T_BOOLEAN, false);
- case vmIntrinsics::_putByte : return append_unsafe_put_obj(callee, T_BYTE, false);
- case vmIntrinsics::_putShort : return append_unsafe_put_obj(callee, T_SHORT, false);
- case vmIntrinsics::_putChar : return append_unsafe_put_obj(callee, T_CHAR, false);
- case vmIntrinsics::_putInt : return append_unsafe_put_obj(callee, T_INT, false);
- case vmIntrinsics::_putLong : return append_unsafe_put_obj(callee, T_LONG, false);
- case vmIntrinsics::_putFloat : return append_unsafe_put_obj(callee, T_FLOAT, false);
- case vmIntrinsics::_putDouble : return append_unsafe_put_obj(callee, T_DOUBLE, false);
-
- case vmIntrinsics::_getShortUnaligned :
- return UseUnalignedAccesses ? append_unsafe_get_obj(callee, T_SHORT, false) : false;
- case vmIntrinsics::_getCharUnaligned :
- return UseUnalignedAccesses ? append_unsafe_get_obj(callee, T_CHAR, false) : false;
- case vmIntrinsics::_getIntUnaligned :
- return UseUnalignedAccesses ? append_unsafe_get_obj(callee, T_INT, false) : false;
- case vmIntrinsics::_getLongUnaligned :
- return UseUnalignedAccesses ? append_unsafe_get_obj(callee, T_LONG, false) : false;
-
- case vmIntrinsics::_putShortUnaligned :
- return UseUnalignedAccesses ? append_unsafe_put_obj(callee, T_SHORT, false) : false;
- case vmIntrinsics::_putCharUnaligned :
- return UseUnalignedAccesses ? append_unsafe_put_obj(callee, T_CHAR, false) : false;
- case vmIntrinsics::_putIntUnaligned :
- return UseUnalignedAccesses ? append_unsafe_put_obj(callee, T_INT, false) : false;
- case vmIntrinsics::_putLongUnaligned :
- return UseUnalignedAccesses ? append_unsafe_put_obj(callee, T_LONG, false) : false;
-
- case vmIntrinsics::_getObjectVolatile : return append_unsafe_get_obj(callee, T_OBJECT, true);
- case vmIntrinsics::_getBooleanVolatile: return append_unsafe_get_obj(callee, T_BOOLEAN, true);
- case vmIntrinsics::_getByteVolatile : return append_unsafe_get_obj(callee, T_BYTE, true);
- case vmIntrinsics::_getShortVolatile : return append_unsafe_get_obj(callee, T_SHORT, true);
- case vmIntrinsics::_getCharVolatile : return append_unsafe_get_obj(callee, T_CHAR, true);
- case vmIntrinsics::_getIntVolatile : return append_unsafe_get_obj(callee, T_INT, true);
- case vmIntrinsics::_getLongVolatile : return append_unsafe_get_obj(callee, T_LONG, true);
- case vmIntrinsics::_getFloatVolatile : return append_unsafe_get_obj(callee, T_FLOAT, true);
- case vmIntrinsics::_getDoubleVolatile : return append_unsafe_get_obj(callee, T_DOUBLE, true);
-
- case vmIntrinsics::_putObjectVolatile : return append_unsafe_put_obj(callee, T_OBJECT, true);
- case vmIntrinsics::_putBooleanVolatile: return append_unsafe_put_obj(callee, T_BOOLEAN, true);
- case vmIntrinsics::_putByteVolatile : return append_unsafe_put_obj(callee, T_BYTE, true);
- case vmIntrinsics::_putShortVolatile : return append_unsafe_put_obj(callee, T_SHORT, true);
- case vmIntrinsics::_putCharVolatile : return append_unsafe_put_obj(callee, T_CHAR, true);
- case vmIntrinsics::_putIntVolatile : return append_unsafe_put_obj(callee, T_INT, true);
- case vmIntrinsics::_putLongVolatile : return append_unsafe_put_obj(callee, T_LONG, true);
- case vmIntrinsics::_putFloatVolatile : return append_unsafe_put_obj(callee, T_FLOAT, true);
- case vmIntrinsics::_putDoubleVolatile : return append_unsafe_put_obj(callee, T_DOUBLE, true);
-
- case vmIntrinsics::_getByte_raw : return append_unsafe_get_raw(callee, T_BYTE);
- case vmIntrinsics::_getShort_raw : return append_unsafe_get_raw(callee, T_SHORT);
- case vmIntrinsics::_getChar_raw : return append_unsafe_get_raw(callee, T_CHAR);
- case vmIntrinsics::_getInt_raw : return append_unsafe_get_raw(callee, T_INT);
- case vmIntrinsics::_getLong_raw : return append_unsafe_get_raw(callee, T_LONG);
- case vmIntrinsics::_getFloat_raw : return append_unsafe_get_raw(callee, T_FLOAT);
- case vmIntrinsics::_getDouble_raw : return append_unsafe_get_raw(callee, T_DOUBLE);
-
- case vmIntrinsics::_putByte_raw : return append_unsafe_put_raw(callee, T_BYTE);
- case vmIntrinsics::_putShort_raw : return append_unsafe_put_raw(callee, T_SHORT);
- case vmIntrinsics::_putChar_raw : return append_unsafe_put_raw(callee, T_CHAR);
- case vmIntrinsics::_putInt_raw : return append_unsafe_put_raw(callee, T_INT);
- case vmIntrinsics::_putLong_raw : return append_unsafe_put_raw(callee, T_LONG);
- case vmIntrinsics::_putFloat_raw : return append_unsafe_put_raw(callee, T_FLOAT);
- case vmIntrinsics::_putDouble_raw : return append_unsafe_put_raw(callee, T_DOUBLE);
-
- case vmIntrinsics::_checkIndex :
- if (!InlineNIOCheckIndex) return false;
- preserves_state = true;
- break;
- case vmIntrinsics::_putOrderedObject : return append_unsafe_put_obj(callee, T_OBJECT, true);
- case vmIntrinsics::_putOrderedInt : return append_unsafe_put_obj(callee, T_INT, true);
- case vmIntrinsics::_putOrderedLong : return append_unsafe_put_obj(callee, T_LONG, true);
-
- case vmIntrinsics::_compareAndSwapLong:
- if (!VM_Version::supports_cx8()) return false;
- // fall through
- case vmIntrinsics::_compareAndSwapInt:
- case vmIntrinsics::_compareAndSwapObject:
- append_unsafe_CAS(callee);
- return true;
-
- case vmIntrinsics::_getAndAddInt:
- if (!VM_Version::supports_atomic_getadd4()) {
- return false;
- }
- return append_unsafe_get_and_set_obj(callee, true);
- case vmIntrinsics::_getAndAddLong:
- if (!VM_Version::supports_atomic_getadd8()) {
- return false;
- }
- return append_unsafe_get_and_set_obj(callee, true);
- case vmIntrinsics::_getAndSetInt:
- if (!VM_Version::supports_atomic_getset4()) {
- return false;
- }
- return append_unsafe_get_and_set_obj(callee, false);
- case vmIntrinsics::_getAndSetLong:
- if (!VM_Version::supports_atomic_getset8()) {
- return false;
- }
- return append_unsafe_get_and_set_obj(callee, false);
- case vmIntrinsics::_getAndSetObject:
-#ifdef _LP64
- if (!UseCompressedOops && !VM_Version::supports_atomic_getset8()) {
- return false;
- }
- if (UseCompressedOops && !VM_Version::supports_atomic_getset4()) {
- return false;
- }
-#else
- if (!VM_Version::supports_atomic_getset4()) {
- return false;
- }
-#endif
- return append_unsafe_get_and_set_obj(callee, false);
-
- case vmIntrinsics::_Reference_get:
- // Use the intrinsic version of Reference.get() so that the value in
- // the referent field can be registered by the G1 pre-barrier code.
- // Also to prevent commoning reads from this field across safepoint
- // since GC can change its value.
- preserves_state = true;
- break;
-
- case vmIntrinsics::_updateCRC32:
- case vmIntrinsics::_updateBytesCRC32:
- case vmIntrinsics::_updateByteBufferCRC32:
- if (!UseCRC32Intrinsics) return false;
- cantrap = false;
- preserves_state = true;
- break;
-
- case vmIntrinsics::_loadFence :
- case vmIntrinsics::_storeFence:
- case vmIntrinsics::_fullFence :
- break;
-
- default : return false; // do not inline
- }
+
// create intrinsic node
const bool has_receiver = !callee->is_static();
ValueType* result_type = as_ValueType(callee->return_type());
@@ -3621,8 +3475,10 @@
}
}
- Intrinsic* result = new Intrinsic(result_type, id, args, has_receiver, state_before,
- preserves_state, cantrap);
+ Intrinsic* result = new Intrinsic(result_type, callee->intrinsic_id(),
+ args, has_receiver, state_before,
+ vmIntrinsics::preserves_state(id),
+ vmIntrinsics::can_trap(id));
// append instruction & push result
Value value = append_split(result);
if (result_type != voidType) push(result_type, value);
@@ -3630,8 +3486,22 @@
if (callee != method() && profile_return() && result_type->is_object_kind()) {
profile_return_type(result, callee);
}
-
- // done
+}
+
+bool GraphBuilder::try_inline_intrinsics(ciMethod* callee) {
+ // For calling is_intrinsic_available we need to transition to
+ // the '_thread_in_vm' state because is_intrinsic_available()
+ // does not accesses critical VM-internal data.
+ if (!_compilation->compiler()->is_intrinsic_available(callee->get_Method(), NULL)) {
+ if (!InlineNatives) {
+ // Return false and also set message that the inlining of
+ // intrinsics has been disabled in general.
+ INLINE_BAILOUT("intrinsic method inlining disabled");
+ } else {
+ return false;
+ }
+ }
+ build_graph_for_intrinsic(callee);
return true;
}
@@ -4224,58 +4094,46 @@
_scope_data = scope_data()->parent();
}
-bool GraphBuilder::append_unsafe_get_obj(ciMethod* callee, BasicType t, bool is_volatile) {
- if (InlineUnsafeOps) {
- Values* args = state()->pop_arguments(callee->arg_size());
- null_check(args->at(0));
- Instruction* offset = args->at(2);
+void GraphBuilder::append_unsafe_get_obj(ciMethod* callee, BasicType t, bool is_volatile) {
+ Values* args = state()->pop_arguments(callee->arg_size());
+ null_check(args->at(0));
+ Instruction* offset = args->at(2);
#ifndef _LP64
- offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
+ offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
#endif
- Instruction* op = append(new UnsafeGetObject(t, args->at(1), offset, is_volatile));
- push(op->type(), op);
- compilation()->set_has_unsafe_access(true);
- }
- return InlineUnsafeOps;
+ Instruction* op = append(new UnsafeGetObject(t, args->at(1), offset, is_volatile));
+ push(op->type(), op);
+ compilation()->set_has_unsafe_access(true);
}
-bool GraphBuilder::append_unsafe_put_obj(ciMethod* callee, BasicType t, bool is_volatile) {
- if (InlineUnsafeOps) {
- Values* args = state()->pop_arguments(callee->arg_size());
- null_check(args->at(0));
- Instruction* offset = args->at(2);
+void GraphBuilder::append_unsafe_put_obj(ciMethod* callee, BasicType t, bool is_volatile) {
+ Values* args = state()->pop_arguments(callee->arg_size());
+ null_check(args->at(0));
+ Instruction* offset = args->at(2);
#ifndef _LP64
- offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
+ offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
#endif
- Instruction* op = append(new UnsafePutObject(t, args->at(1), offset, args->at(3), is_volatile));
- compilation()->set_has_unsafe_access(true);
- kill_all();
- }
- return InlineUnsafeOps;
+ Instruction* op = append(new UnsafePutObject(t, args->at(1), offset, args->at(3), is_volatile));
+ compilation()->set_has_unsafe_access(true);
+ kill_all();
}
-bool GraphBuilder::append_unsafe_get_raw(ciMethod* callee, BasicType t) {
- if (InlineUnsafeOps) {
- Values* args = state()->pop_arguments(callee->arg_size());
- null_check(args->at(0));
- Instruction* op = append(new UnsafeGetRaw(t, args->at(1), false));
- push(op->type(), op);
- compilation()->set_has_unsafe_access(true);
- }
- return InlineUnsafeOps;
+void GraphBuilder::append_unsafe_get_raw(ciMethod* callee, BasicType t) {
+ Values* args = state()->pop_arguments(callee->arg_size());
+ null_check(args->at(0));
+ Instruction* op = append(new UnsafeGetRaw(t, args->at(1), false));
+ push(op->type(), op);
+ compilation()->set_has_unsafe_access(true);
}
-bool GraphBuilder::append_unsafe_put_raw(ciMethod* callee, BasicType t) {
- if (InlineUnsafeOps) {
- Values* args = state()->pop_arguments(callee->arg_size());
- null_check(args->at(0));
- Instruction* op = append(new UnsafePutRaw(t, args->at(1), args->at(2)));
- compilation()->set_has_unsafe_access(true);
- }
- return InlineUnsafeOps;
+void GraphBuilder::append_unsafe_put_raw(ciMethod* callee, BasicType t) {
+ Values* args = state()->pop_arguments(callee->arg_size());
+ null_check(args->at(0));
+ Instruction* op = append(new UnsafePutRaw(t, args->at(1), args->at(2)));
+ compilation()->set_has_unsafe_access(true);
}
@@ -4352,21 +4210,18 @@
}
}
-bool GraphBuilder::append_unsafe_get_and_set_obj(ciMethod* callee, bool is_add) {
- if (InlineUnsafeOps) {
- Values* args = state()->pop_arguments(callee->arg_size());
- BasicType t = callee->return_type()->basic_type();
- null_check(args->at(0));
- Instruction* offset = args->at(2);
+void GraphBuilder::append_unsafe_get_and_set_obj(ciMethod* callee, bool is_add) {
+ Values* args = state()->pop_arguments(callee->arg_size());
+ BasicType t = callee->return_type()->basic_type();
+ null_check(args->at(0));
+ Instruction* offset = args->at(2);
#ifndef _LP64
- offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
+ offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
#endif
- Instruction* op = append(new UnsafeGetAndSetObject(t, args->at(1), offset, args->at(3), is_add));
- compilation()->set_has_unsafe_access(true);
- kill_all();
- push(op->type(), op);
- }
- return InlineUnsafeOps;
+ Instruction* op = append(new UnsafeGetAndSetObject(t, args->at(1), offset, args->at(3), is_add));
+ compilation()->set_has_unsafe_access(true);
+ kill_all();
+ push(op->type(), op);
}
#ifndef PRODUCT
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -339,6 +339,8 @@
void inline_sync_entry(Value lock, BlockBegin* sync_handler);
void fill_sync_handler(Value lock, BlockBegin* sync_handler, bool default_handler = false);
+ void build_graph_for_intrinsic(ciMethod* callee);
+
// inliners
bool try_inline( ciMethod* callee, bool holder_known, Bytecodes::Code bc = Bytecodes::_illegal, Value receiver = NULL);
bool try_inline_intrinsics(ciMethod* callee);
@@ -364,12 +366,12 @@
void pop_scope();
void pop_scope_for_jsr();
- bool append_unsafe_get_obj(ciMethod* callee, BasicType t, bool is_volatile);
- bool append_unsafe_put_obj(ciMethod* callee, BasicType t, bool is_volatile);
- bool append_unsafe_get_raw(ciMethod* callee, BasicType t);
- bool append_unsafe_put_raw(ciMethod* callee, BasicType t);
+ void append_unsafe_get_obj(ciMethod* callee, BasicType t, bool is_volatile);
+ void append_unsafe_put_obj(ciMethod* callee, BasicType t, bool is_volatile);
+ void append_unsafe_get_raw(ciMethod* callee, BasicType t);
+ void append_unsafe_put_raw(ciMethod* callee, BasicType t);
void append_unsafe_CAS(ciMethod* callee);
- bool append_unsafe_get_and_set_obj(ciMethod* callee, bool is_add);
+ void append_unsafe_get_and_set_obj(ciMethod* callee, bool is_add);
void print_inlining(ciMethod* callee, const char* msg = NULL, bool success = true);
--- a/hotspot/src/share/vm/c1/c1_ValueType.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_ValueType.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -153,7 +153,19 @@
case T_FLOAT : return new FloatConstant (value.as_float ());
case T_DOUBLE : return new DoubleConstant(value.as_double());
case T_ARRAY : // fall through (ciConstant doesn't have an array accessor)
- case T_OBJECT : return new ObjectConstant(value.as_object());
+ case T_OBJECT : {
+ // TODO: Common the code with GraphBuilder::load_constant?
+ ciObject* obj = value.as_object();
+ if (obj->is_null_object())
+ return objectNull;
+ if (obj->is_loaded()) {
+ if (obj->is_array())
+ return new ArrayConstant(obj->as_array());
+ else if (obj->is_instance())
+ return new InstanceConstant(obj->as_instance());
+ }
+ return new ObjectConstant(obj);
+ }
}
ShouldNotReachHere();
return illegalType;
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -809,6 +809,22 @@
return name;
}
+// Returns the Java name for this Java mirror (Resource allocated)
+// See Klass::external_name().
+// For primitive type Java mirrors, its type name is returned.
+const char* java_lang_Class::as_external_name(oop java_class) {
+ assert(java_lang_Class::is_instance(java_class), "must be a Class object");
+ const char* name = NULL;
+ if (is_primitive(java_class)) {
+ name = type2name(primitive_type(java_class));
+ } else {
+ name = as_Klass(java_class)->external_name();
+ }
+ if (name == NULL) {
+ name = "<null>";
+ }
+ return name;
+}
Klass* java_lang_Class::array_klass(oop java_class) {
Klass* k = ((Klass*)java_class->metadata_field(_array_klass_offset));
@@ -1468,6 +1484,19 @@
};
+Symbol* get_source_file_name(InstanceKlass* holder, int version) {
+ // Find the specific ik version that contains this source_file_name_index
+ // via the previous versions list, but use the current version's
+ // constant pool to look it up. The previous version's index has been
+ // merged for the current constant pool.
+ InstanceKlass* ik = holder->get_klass_version(version);
+ // This version has been cleaned up.
+ if (ik == NULL) return NULL;
+ int source_file_name_index = ik->source_file_name_index();
+ return (source_file_name_index == 0) ?
+ (Symbol*)NULL : holder->constants()->symbol_at(source_file_name_index);
+}
+
// Print stack trace element to resource allocated buffer
char* java_lang_Throwable::print_stack_element_to_buffer(Handle mirror,
int method_id, int version, int bci, int cpref) {
@@ -1484,17 +1513,11 @@
char* method_name = sym->as_C_string();
buf_len += (int)strlen(method_name);
- // Use specific ik version as a holder since the mirror might
- // refer to version that is now obsolete and no longer accessible
- // via the previous versions list.
- holder = holder->get_klass_version(version);
char* source_file_name = NULL;
- if (holder != NULL) {
- Symbol* source = holder->source_file_name();
- if (source != NULL) {
- source_file_name = source->as_C_string();
- buf_len += (int)strlen(source_file_name);
- }
+ Symbol* source = get_source_file_name(holder, version);
+ if (source != NULL) {
+ source_file_name = source->as_C_string();
+ buf_len += (int)strlen(source_file_name);
}
// Allocate temporary buffer with extra space for formatting and line number
@@ -1909,12 +1932,7 @@
java_lang_StackTraceElement::set_lineNumber(element(), -1);
} else {
// Fill in source file name and line number.
- // Use specific ik version as a holder since the mirror might
- // refer to version that is now obsolete and no longer accessible
- // via the previous versions list.
- holder = holder->get_klass_version(version);
- assert(holder != NULL, "sanity check");
- Symbol* source = holder->source_file_name();
+ Symbol* source = get_source_file_name(holder, version);
if (ShowHiddenFrames && source == NULL)
source = vmSymbols::unknown_class_name();
oop filename = StringTable::intern(source, CHECK_0);
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -276,6 +276,7 @@
}
static Symbol* as_signature(oop java_class, bool intern_if_not_found, TRAPS);
static void print_signature(oop java_class, outputStream *st);
+ static const char* as_external_name(oop java_class);
// Testing
static bool is_instance(oop obj);
--- a/hotspot/src/share/vm/classfile/verificationType.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/classfile/verificationType.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -86,7 +86,7 @@
VerificationType comp_this = get_component(context, CHECK_false);
VerificationType comp_from = from.get_component(context, CHECK_false);
if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
- return comp_this.is_assignable_from(comp_from, context,
+ return comp_this.is_component_assignable_from(comp_from, context,
from_field_is_protected, CHECK_false);
}
}
--- a/hotspot/src/share/vm/classfile/verificationType.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/classfile/verificationType.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -297,6 +297,26 @@
}
}
+ // Check to see if one array component type is assignable to another.
+ // Same as is_assignable_from() except int primitives must be identical.
+ bool is_component_assignable_from(
+ const VerificationType& from, ClassVerifier* context,
+ bool from_field_is_protected, TRAPS) const {
+ if (equals(from) || is_bogus()) {
+ return true;
+ } else {
+ switch(_u._data) {
+ case Boolean:
+ case Byte:
+ case Char:
+ case Short:
+ return false;
+ default:
+ return is_assignable_from(from, context, from_field_is_protected, CHECK_false);
+ }
+ }
+ }
+
VerificationType get_component(ClassVerifier* context, TRAPS) const;
int dimensions() const {
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -324,6 +324,319 @@
return vmIntrinsics::_none;
}
+bool vmIntrinsics::preserves_state(vmIntrinsics::ID id) {
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+ switch(id) {
+#ifdef TRACE_HAVE_INTRINSICS
+ case vmIntrinsics::_classID:
+ case vmIntrinsics::_threadID:
+ case vmIntrinsics::_counterTime:
+#endif
+ case vmIntrinsics::_currentTimeMillis:
+ case vmIntrinsics::_nanoTime:
+ case vmIntrinsics::_floatToRawIntBits:
+ case vmIntrinsics::_intBitsToFloat:
+ case vmIntrinsics::_doubleToRawLongBits:
+ case vmIntrinsics::_longBitsToDouble:
+ case vmIntrinsics::_getClass:
+ case vmIntrinsics::_isInstance:
+ case vmIntrinsics::_currentThread:
+ case vmIntrinsics::_dabs:
+ case vmIntrinsics::_dsqrt:
+ case vmIntrinsics::_dsin:
+ case vmIntrinsics::_dcos:
+ case vmIntrinsics::_dtan:
+ case vmIntrinsics::_dlog:
+ case vmIntrinsics::_dlog10:
+ case vmIntrinsics::_dexp:
+ case vmIntrinsics::_dpow:
+ case vmIntrinsics::_checkIndex:
+ case vmIntrinsics::_Reference_get:
+ case vmIntrinsics::_updateCRC32:
+ case vmIntrinsics::_updateBytesCRC32:
+ case vmIntrinsics::_updateByteBufferCRC32:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool vmIntrinsics::can_trap(vmIntrinsics::ID id) {
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+ switch(id) {
+#ifdef TRACE_HAVE_INTRINSICS
+ case vmIntrinsics::_counterTime:
+#endif
+ case vmIntrinsics::_currentTimeMillis:
+ case vmIntrinsics::_nanoTime:
+ case vmIntrinsics::_floatToRawIntBits:
+ case vmIntrinsics::_intBitsToFloat:
+ case vmIntrinsics::_doubleToRawLongBits:
+ case vmIntrinsics::_longBitsToDouble:
+ case vmIntrinsics::_currentThread:
+ case vmIntrinsics::_dabs:
+ case vmIntrinsics::_dsqrt:
+ case vmIntrinsics::_dsin:
+ case vmIntrinsics::_dcos:
+ case vmIntrinsics::_dtan:
+ case vmIntrinsics::_dlog:
+ case vmIntrinsics::_dlog10:
+ case vmIntrinsics::_dexp:
+ case vmIntrinsics::_dpow:
+ case vmIntrinsics::_updateCRC32:
+ case vmIntrinsics::_updateBytesCRC32:
+ case vmIntrinsics::_updateByteBufferCRC32:
+ return false;
+ default:
+ return true;
+ }
+}
+
+bool vmIntrinsics::does_virtual_dispatch(vmIntrinsics::ID id) {
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+ switch(id) {
+ case vmIntrinsics::_hashCode:
+ case vmIntrinsics::_clone:
+ return true;
+ break;
+ default:
+ return false;
+ }
+}
+
+int vmIntrinsics::predicates_needed(vmIntrinsics::ID id) {
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+ switch (id) {
+ case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
+ case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
+ return 1;
+ case vmIntrinsics::_digestBase_implCompressMB:
+ return 3;
+ default:
+ return 0;
+ }
+}
+
+bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+ switch (id) {
+ case vmIntrinsics::_isInstance:
+ case vmIntrinsics::_isAssignableFrom:
+ case vmIntrinsics::_getModifiers:
+ case vmIntrinsics::_isInterface:
+ case vmIntrinsics::_isArray:
+ case vmIntrinsics::_isPrimitive:
+ case vmIntrinsics::_getSuperclass:
+ case vmIntrinsics::_Class_cast:
+ case vmIntrinsics::_getLength:
+ case vmIntrinsics::_newArray:
+ if (!InlineClassNatives) return true;
+ break;
+ case vmIntrinsics::_currentThread:
+ case vmIntrinsics::_isInterrupted:
+ if (!InlineThreadNatives) return true;
+ break;
+ case vmIntrinsics::_floatToRawIntBits:
+ case vmIntrinsics::_intBitsToFloat:
+ case vmIntrinsics::_doubleToRawLongBits:
+ case vmIntrinsics::_longBitsToDouble:
+ case vmIntrinsics::_dabs:
+ case vmIntrinsics::_dsqrt:
+ case vmIntrinsics::_dsin:
+ case vmIntrinsics::_dcos:
+ case vmIntrinsics::_dtan:
+ case vmIntrinsics::_dlog:
+ case vmIntrinsics::_dexp:
+ case vmIntrinsics::_dpow:
+ case vmIntrinsics::_dlog10:
+ case vmIntrinsics::_datan2:
+ case vmIntrinsics::_min:
+ case vmIntrinsics::_max:
+ case vmIntrinsics::_floatToIntBits:
+ case vmIntrinsics::_doubleToLongBits:
+ if (!InlineMathNatives) return true;
+ break;
+ case vmIntrinsics::_arraycopy:
+ if (!InlineArrayCopy) return true;
+ break;
+ case vmIntrinsics::_updateCRC32:
+ case vmIntrinsics::_updateBytesCRC32:
+ case vmIntrinsics::_updateByteBufferCRC32:
+ if (!UseCRC32Intrinsics) return true;
+ break;
+ case vmIntrinsics::_getObject:
+ case vmIntrinsics::_getBoolean:
+ case vmIntrinsics::_getByte:
+ case vmIntrinsics::_getShort:
+ case vmIntrinsics::_getChar:
+ case vmIntrinsics::_getInt:
+ case vmIntrinsics::_getLong:
+ case vmIntrinsics::_getFloat:
+ case vmIntrinsics::_getDouble:
+ case vmIntrinsics::_putObject:
+ case vmIntrinsics::_putBoolean:
+ case vmIntrinsics::_putByte:
+ case vmIntrinsics::_putShort:
+ case vmIntrinsics::_putChar:
+ case vmIntrinsics::_putInt:
+ case vmIntrinsics::_putLong:
+ case vmIntrinsics::_putFloat:
+ case vmIntrinsics::_putDouble:
+ case vmIntrinsics::_getObjectVolatile:
+ case vmIntrinsics::_getBooleanVolatile:
+ case vmIntrinsics::_getByteVolatile:
+ case vmIntrinsics::_getShortVolatile:
+ case vmIntrinsics::_getCharVolatile:
+ case vmIntrinsics::_getIntVolatile:
+ case vmIntrinsics::_getLongVolatile:
+ case vmIntrinsics::_getFloatVolatile:
+ case vmIntrinsics::_getDoubleVolatile:
+ case vmIntrinsics::_putObjectVolatile:
+ case vmIntrinsics::_putBooleanVolatile:
+ case vmIntrinsics::_putByteVolatile:
+ case vmIntrinsics::_putShortVolatile:
+ case vmIntrinsics::_putCharVolatile:
+ case vmIntrinsics::_putIntVolatile:
+ case vmIntrinsics::_putLongVolatile:
+ case vmIntrinsics::_putFloatVolatile:
+ case vmIntrinsics::_putDoubleVolatile:
+ case vmIntrinsics::_getByte_raw:
+ case vmIntrinsics::_getShort_raw:
+ case vmIntrinsics::_getChar_raw:
+ case vmIntrinsics::_getInt_raw:
+ case vmIntrinsics::_getLong_raw:
+ case vmIntrinsics::_getFloat_raw:
+ case vmIntrinsics::_getDouble_raw:
+ case vmIntrinsics::_putByte_raw:
+ case vmIntrinsics::_putShort_raw:
+ case vmIntrinsics::_putChar_raw:
+ case vmIntrinsics::_putInt_raw:
+ case vmIntrinsics::_putLong_raw:
+ case vmIntrinsics::_putFloat_raw:
+ case vmIntrinsics::_putDouble_raw:
+ case vmIntrinsics::_putOrderedObject:
+ case vmIntrinsics::_putOrderedLong:
+ case vmIntrinsics::_putOrderedInt:
+ case vmIntrinsics::_getAndAddInt:
+ case vmIntrinsics::_getAndAddLong:
+ case vmIntrinsics::_getAndSetInt:
+ case vmIntrinsics::_getAndSetLong:
+ case vmIntrinsics::_getAndSetObject:
+ if (!InlineUnsafeOps) return true;
+ break;
+ case vmIntrinsics::_getShortUnaligned:
+ case vmIntrinsics::_getCharUnaligned:
+ case vmIntrinsics::_getIntUnaligned:
+ case vmIntrinsics::_getLongUnaligned:
+ case vmIntrinsics::_putShortUnaligned:
+ case vmIntrinsics::_putCharUnaligned:
+ case vmIntrinsics::_putIntUnaligned:
+ case vmIntrinsics::_putLongUnaligned:
+ case vmIntrinsics::_allocateInstance:
+ case vmIntrinsics::_getAddress_raw:
+ case vmIntrinsics::_putAddress_raw:
+ if (!InlineUnsafeOps || !UseUnalignedAccesses) return true;
+ break;
+ case vmIntrinsics::_hashCode:
+ if (!InlineObjectHash) return true;
+ break;
+ case vmIntrinsics::_aescrypt_encryptBlock:
+ case vmIntrinsics::_aescrypt_decryptBlock:
+ if (!UseAESIntrinsics) return true;
+ break;
+ case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
+ case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
+ if (!UseAESIntrinsics) return true;
+ break;
+ case vmIntrinsics::_sha_implCompress:
+ if (!UseSHA1Intrinsics) return true;
+ break;
+ case vmIntrinsics::_sha2_implCompress:
+ if (!UseSHA256Intrinsics) return true;
+ break;
+ case vmIntrinsics::_sha5_implCompress:
+ if (!UseSHA512Intrinsics) return true;
+ break;
+ case vmIntrinsics::_digestBase_implCompressMB:
+ if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) return true;
+ break;
+ case vmIntrinsics::_ghash_processBlocks:
+ if (!UseGHASHIntrinsics) return true;
+ break;
+ case vmIntrinsics::_updateBytesCRC32C:
+ case vmIntrinsics::_updateDirectByteBufferCRC32C:
+ if (!UseCRC32CIntrinsics) return true;
+ break;
+ case vmIntrinsics::_copyMemory:
+ if (!InlineArrayCopy || !InlineUnsafeOps) return true;
+ break;
+#ifdef COMPILER1
+ case vmIntrinsics::_checkIndex:
+ if (!InlineNIOCheckIndex) return true;
+ break;
+#endif // COMPILER1
+#ifdef COMPILER2
+ case vmIntrinsics::_clone:
+ case vmIntrinsics::_copyOf:
+ case vmIntrinsics::_copyOfRange:
+ // These intrinsics use both the objectcopy and the arraycopy
+ // intrinsic mechanism.
+ if (!InlineObjectCopy || !InlineArrayCopy) return true;
+ break;
+ case vmIntrinsics::_compareTo:
+ if (!SpecialStringCompareTo) return true;
+ break;
+ case vmIntrinsics::_indexOf:
+ if (!SpecialStringIndexOf) return true;
+ break;
+ case vmIntrinsics::_equals:
+ if (!SpecialStringEquals) return true;
+ break;
+ case vmIntrinsics::_equalsC:
+ if (!SpecialArraysEquals) return true;
+ break;
+ case vmIntrinsics::_encodeISOArray:
+ if (!SpecialEncodeISOArray) return true;
+ break;
+ case vmIntrinsics::_getCallerClass:
+ if (!InlineReflectionGetCallerClass) return true;
+ break;
+ case vmIntrinsics::_multiplyToLen:
+ if (!UseMultiplyToLenIntrinsic) return true;
+ break;
+ case vmIntrinsics::_squareToLen:
+ if (!UseSquareToLenIntrinsic) return true;
+ break;
+ case vmIntrinsics::_mulAdd:
+ if (!UseMulAddIntrinsic) return true;
+ break;
+ case vmIntrinsics::_montgomeryMultiply:
+ if (!UseMontgomeryMultiplyIntrinsic) return true;
+ break;
+ case vmIntrinsics::_montgomerySquare:
+ if (!UseMontgomerySquareIntrinsic) return true;
+ break;
+ case vmIntrinsics::_addExactI:
+ case vmIntrinsics::_addExactL:
+ case vmIntrinsics::_decrementExactI:
+ case vmIntrinsics::_decrementExactL:
+ case vmIntrinsics::_incrementExactI:
+ case vmIntrinsics::_incrementExactL:
+ case vmIntrinsics::_multiplyExactI:
+ case vmIntrinsics::_multiplyExactL:
+ case vmIntrinsics::_negateExactI:
+ case vmIntrinsics::_negateExactL:
+ case vmIntrinsics::_subtractExactI:
+ case vmIntrinsics::_subtractExactL:
+ if (!UseMathExactIntrinsics || !InlineMathNatives) return true;
+ break;
+#endif // COMPILER2
+ default:
+ return false;
+ }
+
+ return false;
+}
#define VM_INTRINSIC_INITIALIZE(id, klass, name, sig, flags) #id "\0"
static const char* vm_intrinsic_name_bodies =
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -1368,6 +1368,26 @@
// Raw conversion:
static ID for_raw_conversion(BasicType src, BasicType dest);
+
+ // The methods below provide information related to compiling intrinsics.
+
+ // (1) Information needed by the C1 compiler.
+
+ static bool preserves_state(vmIntrinsics::ID id);
+ static bool can_trap(vmIntrinsics::ID id);
+
+ // (2) Information needed by the C2 compiler.
+
+ // Returns true if the intrinsic for method 'method' will perform a virtual dispatch.
+ static bool does_virtual_dispatch(vmIntrinsics::ID id);
+ // A return value larger than 0 indicates that the intrinsic for method
+ // 'method' requires predicated logic.
+ static int predicates_needed(vmIntrinsics::ID id);
+
+ // Returns true if an intrinsic is disabled by command-line flags and
+ // false otherwise. Implements functionality common to the C1
+ // and the C2 compiler.
+ static bool is_disabled_by_flags(vmIntrinsics::ID id);
};
#endif // SHARE_VM_CLASSFILE_VMSYMBOLS_HPP
--- a/hotspot/src/share/vm/compiler/abstractCompiler.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/compiler/abstractCompiler.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -66,6 +66,58 @@
virtual bool supports_osr () { return true; }
virtual bool can_compile_method(methodHandle method) { return true; }
+ // Determine if the current compiler provides an intrinsic
+ // for method 'method'. An intrinsic is available if:
+ // - the intrinsic is enabled (by using the appropriate command-line flag) and
+ // - the platform on which the VM is running supports the intrinsic
+ // (i.e., the platform provides the instructions necessary for the compiler
+ // to generate the intrinsic code).
+ //
+ // The second parameter, 'compilation_context', is needed to implement functionality
+ // related to the DisableIntrinsic command-line flag. The DisableIntrinsic flag can
+ // be used to prohibit the C2 compiler (but not the C1 compiler) to use an intrinsic.
+ // There are three ways to disable an intrinsic using the DisableIntrinsic flag:
+ //
+ // (1) -XX:DisableIntrinsic=_hashCode,_getClass
+ // Disables intrinsification of _hashCode and _getClass globally
+ // (i.e., the intrinsified version the methods will not be used at all).
+ // (2) -XX:CompileCommand=option,aClass::aMethod,ccstr,DisableIntrinsic,_hashCode
+ // Disables intrinsification of _hashCode if it is called from
+ // aClass::aMethod (but not for any other call site of _hashCode)
+ // (3) -XX:CompileCommand=option,java.lang.ref.Reference::get,ccstr,DisableIntrinsic,_Reference_get
+ // Some methods are not compiled by C2. Instead, the C2 compiler
+ // returns directly the intrinsified version of these methods.
+ // The command above forces C2 to compile _Reference_get, but
+ // allows using the intrinsified version of _Reference_get at all
+ // other call sites.
+ //
+ // From the modes above, (1) disable intrinsics globally, (2) and (3)
+ // disable intrinsics on a per-method basis. In cases (2) and (3) the
+ // compilation context is aClass::aMethod and java.lang.ref.Reference::get,
+ // respectively.
+ virtual bool is_intrinsic_available(methodHandle method, methodHandle compilation_context) {
+ return false;
+ }
+
+ // Determines if an intrinsic is supported by the compiler, that is,
+ // the compiler provides the instructions necessary to generate
+ // the intrinsic code for method 'method'.
+ //
+ // The 'is_intrinsic_supported' method is a white list, that is,
+ // by default no intrinsics are supported by a compiler except
+ // the ones listed in the method. Overriding methods should conform
+ // to this behavior.
+ virtual bool is_intrinsic_supported(methodHandle method) {
+ return false;
+ }
+
+ // Implements compiler-specific processing of command-line flags.
+ // Processing of command-line flags common to all compilers is implemented
+ // in vmIntrinsicss::is_disabled_by_flag.
+ virtual bool is_intrinsic_disabled_by_flag(methodHandle method) {
+ return false;
+ }
+
// Compiler type queries.
bool is_c1() { return _type == c1; }
bool is_c2() { return _type == c2; }
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -345,6 +345,14 @@
}
}
+// RedefineClasses support
+void CompileTask::metadata_do(void f(Metadata*)) {
+ f(method());
+ if (hot_method() != NULL && hot_method() != method()) {
+ f(hot_method());
+ }
+}
+
// ------------------------------------------------------------------
// CompileTask::print_line_on_error
//
@@ -660,6 +668,11 @@
* Get the next CompileTask from a CompileQueue
*/
CompileTask* CompileQueue::get() {
+ // save methods from RedefineClasses across safepoint
+ // across MethodCompileQueue_lock below.
+ methodHandle save_method;
+ methodHandle save_hot_method;
+
MutexLocker locker(MethodCompileQueue_lock);
// If _first is NULL we have no more compile jobs. There are two reasons for
// having no compile jobs: First, we compiled everything we wanted. Second,
@@ -693,6 +706,12 @@
No_Safepoint_Verifier nsv;
task = CompilationPolicy::policy()->select_task(this);
}
+
+ // Save method pointers across unlock safepoint. The task is removed from
+ // the compilation queue, which is walked during RedefineClasses.
+ save_method = methodHandle(task->method());
+ save_hot_method = methodHandle(task->hot_method());
+
remove(task);
purge_stale_tasks(); // may temporarily release MCQ lock
return task;
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -80,6 +80,7 @@
int compile_id() const { return _compile_id; }
Method* method() const { return _method; }
+ Method* hot_method() const { return _hot_method; }
int osr_bci() const { return _osr_bci; }
bool is_complete() const { return _is_complete; }
bool is_blocking() const { return _is_blocking; }
@@ -108,6 +109,9 @@
bool is_free() const { return _is_free; }
void set_is_free(bool val) { _is_free = val; }
+ // RedefineClasses support
+ void metadata_do(void f(Metadata*));
+
private:
static void print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level,
bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false,
--- a/hotspot/src/share/vm/gc/cms/parCardTableModRefBS.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/cms/parCardTableModRefBS.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -36,10 +36,11 @@
#include "runtime/orderAccess.inline.hpp"
#include "runtime/vmThread.hpp"
-void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
- OopsInGenClosure* cl,
- CardTableRS* ct,
- uint n_threads) {
+void CardTableModRefBSForCTRS::
+non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
+ OopsInGenClosure* cl,
+ CardTableRS* ct,
+ uint n_threads) {
assert(n_threads > 0, "expected n_threads > 0");
assert(n_threads <= ParallelGCThreads,
err_msg("n_threads: %u > ParallelGCThreads: %u", n_threads, ParallelGCThreads));
@@ -81,7 +82,7 @@
}
void
-CardTableModRefBS::
+CardTableModRefBSForCTRS::
process_stride(Space* sp,
MemRegion used,
jint stride, int n_strides,
@@ -170,7 +171,7 @@
#endif
void
-CardTableModRefBS::
+CardTableModRefBSForCTRS::
process_chunk_boundaries(Space* sp,
DirtyCardToOopClosure* dcto_cl,
MemRegion chunk_mr,
@@ -426,7 +427,7 @@
#undef NOISY
void
-CardTableModRefBS::
+CardTableModRefBSForCTRS::
get_LNC_array_for_space(Space* sp,
jbyte**& lowest_non_clean,
uintptr_t& lowest_non_clean_base_chunk_index,
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -403,14 +403,6 @@
_saved_index = -1;
}
-void CMMarkStack::oops_do(OopClosure* f) {
- assert(_saved_index == _index,
- err_msg("saved index: %d index: %d", _saved_index, _index));
- for (int i = 0; i < _index; i += 1) {
- f->do_oop(&_base[i]);
- }
-}
-
CMRootRegions::CMRootRegions() :
_young_list(NULL), _cm(NULL), _scan_in_progress(false),
_should_abort(false), _next_survivor(NULL) { }
@@ -2717,53 +2709,26 @@
}
#ifndef PRODUCT
-enum VerifyNoCSetOopsPhase {
- VerifyNoCSetOopsStack,
- VerifyNoCSetOopsQueues
-};
-
-class VerifyNoCSetOopsClosure : public OopClosure, public ObjectClosure {
+class VerifyNoCSetOops VALUE_OBJ_CLASS_SPEC {
private:
G1CollectedHeap* _g1h;
- VerifyNoCSetOopsPhase _phase;
+ const char* _phase;
int _info;
- const char* phase_str() {
- switch (_phase) {
- case VerifyNoCSetOopsStack: return "Stack";
- case VerifyNoCSetOopsQueues: return "Queue";
- default: ShouldNotReachHere();
- }
- return NULL;
- }
-
- void do_object_work(oop obj) {
+public:
+ VerifyNoCSetOops(const char* phase, int info = -1) :
+ _g1h(G1CollectedHeap::heap()),
+ _phase(phase),
+ _info(info)
+ { }
+
+ void operator()(oop obj) const {
+ guarantee(obj->is_oop(),
+ err_msg("Non-oop " PTR_FORMAT ", phase: %s, info: %d",
+ p2i(obj), _phase, _info));
guarantee(!_g1h->obj_in_cs(obj),
err_msg("obj: " PTR_FORMAT " in CSet, phase: %s, info: %d",
- p2i((void*) obj), phase_str(), _info));
- }
-
-public:
- VerifyNoCSetOopsClosure() : _g1h(G1CollectedHeap::heap()) { }
-
- void set_phase(VerifyNoCSetOopsPhase phase, int info = -1) {
- _phase = phase;
- _info = info;
- }
-
- virtual void do_oop(oop* p) {
- oop obj = oopDesc::load_decode_heap_oop(p);
- do_object_work(obj);
- }
-
- virtual void do_oop(narrowOop* p) {
- // We should not come across narrow oops while scanning marking
- // stacks
- ShouldNotReachHere();
- }
-
- virtual void do_object(oop obj) {
- do_object_work(obj);
+ p2i(obj), _phase, _info));
}
};
@@ -2773,17 +2738,13 @@
return;
}
- VerifyNoCSetOopsClosure cl;
-
// Verify entries on the global mark stack
- cl.set_phase(VerifyNoCSetOopsStack);
- _markStack.oops_do(&cl);
+ _markStack.iterate(VerifyNoCSetOops("Stack"));
// Verify entries on the task queues
- for (uint i = 0; i < _max_worker_id; i += 1) {
- cl.set_phase(VerifyNoCSetOopsQueues, i);
+ for (uint i = 0; i < _max_worker_id; ++i) {
CMTaskQueue* queue = _task_queues->queue(i);
- queue->oops_do(&cl);
+ queue->iterate(VerifyNoCSetOops("Queue", i));
}
// Verify the global finger
@@ -2806,7 +2767,7 @@
// Verify the task fingers
assert(parallel_marking_threads() <= _max_worker_id, "sanity");
- for (int i = 0; i < (int) parallel_marking_threads(); i += 1) {
+ for (uint i = 0; i < parallel_marking_threads(); ++i) {
CMTask* task = _tasks[i];
HeapWord* task_finger = task->finger();
if (task_finger != NULL && task_finger < _heap_end) {
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -246,9 +246,10 @@
// Make sure that we have not added any entries to the stack during GC.
void note_end_of_gc();
- // iterate over the oops in the mark stack, up to the bound recorded via
- // the call above.
- void oops_do(OopClosure* f);
+ // Apply fn to each oop in the mark stack, up to the bound recorded
+ // via one of the above "note" functions. The mark stack must not
+ // be modified while iterating.
+ template<typename Fn> void iterate(Fn fn);
};
class ForceOverflowSettings VALUE_OBJ_CLASS_SPEC {
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.inline.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.inline.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -223,6 +223,15 @@
#undef check_mark
+template<typename Fn>
+inline void CMMarkStack::iterate(Fn fn) {
+ assert(_saved_index == _index,
+ err_msg("saved index: %d index: %d", _saved_index, _index));
+ for (int i = 0; i < _index; ++i) {
+ fn(_base[i]);
+ }
+}
+
inline void CMTask::push(oop obj) {
HeapWord* objAddr = (HeapWord*) obj;
assert(_g1h->is_in_g1_reserved(objAddr), "invariant");
--- a/hotspot/src/share/vm/gc/g1/g1Allocator.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1Allocator.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -39,13 +39,8 @@
protected:
G1CollectedHeap* _g1h;
- // Outside of GC pauses, the number of bytes used in all regions other
- // than the current allocation region.
- size_t _summary_bytes_used;
-
public:
- G1Allocator(G1CollectedHeap* heap) :
- _g1h(heap), _summary_bytes_used(0) { }
+ G1Allocator(G1CollectedHeap* heap) : _g1h(heap) { }
static G1Allocator* create_allocator(G1CollectedHeap* g1h);
@@ -59,32 +54,13 @@
virtual MutatorAllocRegion* mutator_alloc_region(AllocationContext_t context) = 0;
virtual SurvivorGCAllocRegion* survivor_gc_alloc_region(AllocationContext_t context) = 0;
virtual OldGCAllocRegion* old_gc_alloc_region(AllocationContext_t context) = 0;
- virtual size_t used() = 0;
+ virtual size_t used_in_alloc_regions() = 0;
virtual bool is_retained_old_region(HeapRegion* hr) = 0;
void reuse_retained_old_region(EvacuationInfo& evacuation_info,
OldGCAllocRegion* old,
HeapRegion** retained);
- size_t used_unlocked() const {
- return _summary_bytes_used;
- }
-
- void increase_used(size_t bytes) {
- _summary_bytes_used += bytes;
- }
-
- void decrease_used(size_t bytes) {
- assert(_summary_bytes_used >= bytes,
- err_msg("invariant: _summary_bytes_used: " SIZE_FORMAT " should be >= bytes: " SIZE_FORMAT,
- _summary_bytes_used, bytes));
- _summary_bytes_used -= bytes;
- }
-
- void set_used(size_t bytes) {
- _summary_bytes_used = bytes;
- }
-
virtual HeapRegion* new_heap_region(uint hrs_index,
G1BlockOffsetSharedArray* sharedOffsetArray,
MemRegion mr) {
@@ -133,10 +109,10 @@
return &_old_gc_alloc_region;
}
- virtual size_t used() {
+ virtual size_t used_in_alloc_regions() {
assert(Heap_lock->owner() != NULL,
"Should be owned on this thread's behalf.");
- size_t result = _summary_bytes_used;
+ size_t result = 0;
// Read only once in case it is set to NULL concurrently
HeapRegion* hr = mutator_alloc_region(AllocationContext::current())->get();
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -632,7 +632,7 @@
check_bitmaps("Humongous Region Allocation", first_hr);
assert(first_hr->used() == word_size * HeapWordSize, "invariant");
- _allocator->increase_used(first_hr->used());
+ increase_used(first_hr->used());
_humongous_set.add(first_hr);
return new_obj;
@@ -998,7 +998,7 @@
if ((prev_last_region != NULL) && (start_region == prev_last_region)) {
start_address = start_region->end();
if (start_address > last_address) {
- _allocator->increase_used(word_size * HeapWordSize);
+ increase_used(word_size * HeapWordSize);
start_region->set_top(last_address + 1);
continue;
}
@@ -1012,7 +1012,7 @@
if (!_hrm.allocate_containing_regions(curr_range, &commits)) {
return false;
}
- _allocator->increase_used(word_size * HeapWordSize);
+ increase_used(word_size * HeapWordSize);
if (commits != 0) {
ergo_verbose1(ErgoHeapSizing,
"attempt heap expansion",
@@ -1104,7 +1104,7 @@
if (start_address != bottom_address) {
size_t fill_size = pointer_delta(start_address, bottom_address);
G1CollectedHeap::fill_with_objects(bottom_address, fill_size);
- _allocator->increase_used(fill_size * HeapWordSize);
+ increase_used(fill_size * HeapWordSize);
}
}
}
@@ -1917,7 +1917,6 @@
_ref_processor_cm(NULL),
_ref_processor_stw(NULL),
_bot_shared(NULL),
- _evac_failure_scan_stack(NULL),
_cg1r(NULL),
_g1mm(NULL),
_refine_cte_cl(NULL),
@@ -1930,6 +1929,7 @@
_free_regions_coming(false),
_young_list(new YoungList(this)),
_gc_time_stamp(0),
+ _summary_bytes_used(0),
_survivor_plab_stats(YoungPLABSize, PLABWeight),
_old_plab_stats(OldPLABSize, PLABWeight),
_expand_heap_after_alloc_failure(true),
@@ -2204,6 +2204,11 @@
G1StringDedup::initialize();
+ _preserved_objs = NEW_C_HEAP_ARRAY(OopAndMarkOopStack, ParallelGCThreads, mtGC);
+ for (uint i = 0; i < ParallelGCThreads; i++) {
+ new (&_preserved_objs[i]) OopAndMarkOopStack();
+ }
+
return JNI_OK;
}
@@ -2371,7 +2376,7 @@
// Computes the sum of the storage used by the various regions.
size_t G1CollectedHeap::used() const {
- size_t result = _allocator->used();
+ size_t result = _summary_bytes_used + _allocator->used_in_alloc_regions();
if (_archive_allocator != NULL) {
result += _archive_allocator->used();
}
@@ -2379,7 +2384,7 @@
}
size_t G1CollectedHeap::used_unlocked() const {
- return _allocator->used_unlocked();
+ return _summary_bytes_used;
}
class SumUsedClosure: public HeapRegionClosure {
@@ -3376,7 +3381,7 @@
// Print the per-region information.
st->cr();
- st->print_cr("Heap Regions: (Y=young(eden), SU=young(survivor), "
+ st->print_cr("Heap Regions: (E=young(eden), S=young(survivor), O=old, "
"HS=humongous(starts), HC=humongous(continues), "
"CS=collection set, F=free, A=archive, TS=gc time stamp, "
"PTAMS=previous top-at-mark-start, "
@@ -4102,7 +4107,7 @@
_young_list->reset_auxilary_lists();
if (evacuation_failed()) {
- _allocator->set_used(recalculate_used());
+ set_used(recalculate_used());
if (_archive_allocator != NULL) {
_archive_allocator->clear_used();
}
@@ -4114,7 +4119,7 @@
} else {
// The "used" of the the collection set have already been subtracted
// when they were freed. Add in the bytes evacuated.
- _allocator->increase_used(g1_policy()->bytes_copied_during_gc());
+ increase_used(g1_policy()->bytes_copied_during_gc());
}
if (collector_state()->during_initial_mark_pause()) {
@@ -4255,21 +4260,6 @@
return true;
}
-void G1CollectedHeap::init_for_evac_failure(OopsInHeapRegionClosure* cl) {
- _drain_in_progress = false;
- set_evac_failure_closure(cl);
- _evac_failure_scan_stack = new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(40, true);
-}
-
-void G1CollectedHeap::finalize_for_evac_failure() {
- assert(_evac_failure_scan_stack != NULL &&
- _evac_failure_scan_stack->length() == 0,
- "Postcondition");
- assert(!_drain_in_progress, "Postcondition");
- delete _evac_failure_scan_stack;
- _evac_failure_scan_stack = NULL;
-}
-
void G1CollectedHeap::remove_self_forwarding_pointers() {
double remove_self_forwards_start = os::elapsedTime();
@@ -4277,104 +4267,30 @@
workers()->run_task(&rsfp_task);
// Now restore saved marks, if any.
- assert(_objs_with_preserved_marks.size() ==
- _preserved_marks_of_objs.size(), "Both or none.");
- while (!_objs_with_preserved_marks.is_empty()) {
- oop obj = _objs_with_preserved_marks.pop();
- markOop m = _preserved_marks_of_objs.pop();
- obj->set_mark(m);
- }
- _objs_with_preserved_marks.clear(true);
- _preserved_marks_of_objs.clear(true);
+ for (uint i = 0; i < ParallelGCThreads; i++) {
+ OopAndMarkOopStack& cur = _preserved_objs[i];
+ while (!cur.is_empty()) {
+ OopAndMarkOop elem = cur.pop();
+ elem.set_mark();
+ }
+ cur.clear(true);
+ }
g1_policy()->phase_times()->record_evac_fail_remove_self_forwards((os::elapsedTime() - remove_self_forwards_start) * 1000.0);
}
-void G1CollectedHeap::push_on_evac_failure_scan_stack(oop obj) {
- _evac_failure_scan_stack->push(obj);
-}
-
-void G1CollectedHeap::drain_evac_failure_scan_stack() {
- assert(_evac_failure_scan_stack != NULL, "precondition");
-
- while (_evac_failure_scan_stack->length() > 0) {
- oop obj = _evac_failure_scan_stack->pop();
- _evac_failure_closure->set_region(heap_region_containing(obj));
- obj->oop_iterate_backwards(_evac_failure_closure);
- }
-}
-
-oop
-G1CollectedHeap::handle_evacuation_failure_par(G1ParScanThreadState* _par_scan_state,
- oop old) {
- assert(obj_in_cs(old),
- err_msg("obj: " PTR_FORMAT " should still be in the CSet",
- p2i(old)));
- markOop m = old->mark();
- oop forward_ptr = old->forward_to_atomic(old);
- if (forward_ptr == NULL) {
- // Forward-to-self succeeded.
- assert(_par_scan_state != NULL, "par scan state");
- OopsInHeapRegionClosure* cl = _par_scan_state->evac_failure_closure();
- uint queue_num = _par_scan_state->queue_num();
-
+void G1CollectedHeap::preserve_mark_during_evac_failure(uint queue_num, oop obj, markOop m) {
+ if (!_evacuation_failed) {
_evacuation_failed = true;
- _evacuation_failed_info_array[queue_num].register_copy_failure(old->size());
- if (_evac_failure_closure != cl) {
- MutexLockerEx x(EvacFailureStack_lock, Mutex::_no_safepoint_check_flag);
- assert(!_drain_in_progress,
- "Should only be true while someone holds the lock.");
- // Set the global evac-failure closure to the current thread's.
- assert(_evac_failure_closure == NULL, "Or locking has failed.");
- set_evac_failure_closure(cl);
- // Now do the common part.
- handle_evacuation_failure_common(old, m);
- // Reset to NULL.
- set_evac_failure_closure(NULL);
- } else {
- // The lock is already held, and this is recursive.
- assert(_drain_in_progress, "This should only be the recursive case.");
- handle_evacuation_failure_common(old, m);
- }
- return old;
- } else {
- // Forward-to-self failed. Either someone else managed to allocate
- // space for this object (old != forward_ptr) or they beat us in
- // self-forwarding it (old == forward_ptr).
- assert(old == forward_ptr || !obj_in_cs(forward_ptr),
- err_msg("obj: " PTR_FORMAT " forwarded to: " PTR_FORMAT " "
- "should not be in the CSet",
- p2i(old), p2i(forward_ptr)));
- return forward_ptr;
- }
-}
-
-void G1CollectedHeap::handle_evacuation_failure_common(oop old, markOop m) {
- preserve_mark_if_necessary(old, m);
-
- HeapRegion* r = heap_region_containing(old);
- if (!r->evacuation_failed()) {
- r->set_evacuation_failed(true);
- _hr_printer.evac_failure(r);
- }
-
- push_on_evac_failure_scan_stack(old);
-
- if (!_drain_in_progress) {
- // prevent recursion in copy_to_survivor_space()
- _drain_in_progress = true;
- drain_evac_failure_scan_stack();
- _drain_in_progress = false;
- }
-}
-
-void G1CollectedHeap::preserve_mark_if_necessary(oop obj, markOop m) {
- assert(evacuation_failed(), "Oversaving!");
+ }
+
+ _evacuation_failed_info_array[queue_num].register_copy_failure(obj->size());
+
// We want to call the "for_promotion_failure" version only in the
// case of a promotion failure.
if (m->must_be_preserved_for_promotion_failure(obj)) {
- _objs_with_preserved_marks.push(obj);
- _preserved_marks_of_objs.push(m);
+ OopAndMarkOop elem(obj, m);
+ _preserved_objs[queue_num].push(elem);
}
}
@@ -4450,14 +4366,7 @@
mark_object(obj);
}
}
-
- if (barrier == G1BarrierEvac) {
- _par_scan_state->update_rs(_from, p, _worker_id);
- }
-}
-
-template void G1ParCopyClosure<G1BarrierEvac, G1MarkNone>::do_oop_work(oop* p);
-template void G1ParCopyClosure<G1BarrierEvac, G1MarkNone>::do_oop_work(narrowOop* p);
+}
class G1ParEvacuateFollowersClosure : public VoidClosure {
protected:
@@ -4597,9 +4506,6 @@
ReferenceProcessor* rp = _g1h->ref_processor_stw();
G1ParScanThreadState pss(_g1h, worker_id, rp);
- G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, rp);
-
- pss.set_evac_failure_closure(&evac_failure_cl);
bool only_young = _g1h->collector_state()->gcs_are_young();
@@ -5269,9 +5175,6 @@
G1STWIsAliveClosure is_alive(_g1h);
G1ParScanThreadState pss(_g1h, worker_id, NULL);
- G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL);
-
- pss.set_evac_failure_closure(&evac_failure_cl);
G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL);
@@ -5368,10 +5271,6 @@
HandleMark hm;
G1ParScanThreadState pss(_g1h, worker_id, NULL);
- G1ParScanHeapEvacFailureClosure evac_failure_cl(_g1h, &pss, NULL);
-
- pss.set_evac_failure_closure(&evac_failure_cl);
-
assert(pss.queue_is_empty(), "both queue and overflow should be empty");
G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, &pss, NULL);
@@ -5476,15 +5375,11 @@
// Use only a single queue for this PSS.
G1ParScanThreadState pss(this, 0, NULL);
+ assert(pss.queue_is_empty(), "pre-condition");
// We do not embed a reference processor in the copying/scanning
// closures while we're actually processing the discovered
// reference objects.
- G1ParScanHeapEvacFailureClosure evac_failure_cl(this, &pss, NULL);
-
- pss.set_evac_failure_closure(&evac_failure_cl);
-
- assert(pss.queue_is_empty(), "pre-condition");
G1ParScanExtRootClosure only_copy_non_heap_cl(this, &pss, NULL);
@@ -5590,8 +5485,6 @@
const uint n_workers = workers()->active_workers();
- init_for_evac_failure(NULL);
-
assert(dirty_card_queue_set().completed_buffers_num() == 0, "Should be empty");
double start_par_time_sec = os::elapsedTime();
double end_par_time_sec;
@@ -5655,8 +5548,6 @@
purge_code_root_memory();
- finalize_for_evac_failure();
-
if (evacuation_failed()) {
remove_self_forwarding_pointers();
@@ -5745,7 +5636,7 @@
}
void G1CollectedHeap::decrement_summary_bytes(size_t bytes) {
- _allocator->decrease_used(bytes);
+ decrease_used(bytes);
}
class G1ParCleanupCTTask : public AbstractGangTask {
@@ -6395,6 +6286,21 @@
_hrm.remove_all_free_regions();
}
+void G1CollectedHeap::increase_used(size_t bytes) {
+ _summary_bytes_used += bytes;
+}
+
+void G1CollectedHeap::decrease_used(size_t bytes) {
+ assert(_summary_bytes_used >= bytes,
+ err_msg("invariant: _summary_bytes_used: " SIZE_FORMAT " should be >= bytes: " SIZE_FORMAT,
+ _summary_bytes_used, bytes));
+ _summary_bytes_used -= bytes;
+}
+
+void G1CollectedHeap::set_used(size_t bytes) {
+ _summary_bytes_used = bytes;
+}
+
class RebuildRegionSetsClosure : public HeapRegionClosure {
private:
bool _free_list_only;
@@ -6463,15 +6369,15 @@
heap_region_iterate(&cl);
if (!free_list_only) {
- _allocator->set_used(cl.total_used());
+ set_used(cl.total_used());
if (_archive_allocator != NULL) {
_archive_allocator->clear_used();
}
}
- assert(_allocator->used_unlocked() == recalculate_used(),
- err_msg("inconsistent _allocator->used_unlocked(), "
+ assert(used_unlocked() == recalculate_used(),
+ err_msg("inconsistent used_unlocked(), "
"value: " SIZE_FORMAT " recalculated: " SIZE_FORMAT,
- _allocator->used_unlocked(), recalculate_used()));
+ used_unlocked(), recalculate_used()));
}
void G1CollectedHeap::set_refine_cte_cl_concurrency(bool concurrent) {
@@ -6511,7 +6417,7 @@
assert(alloc_region->is_eden(), "all mutator alloc regions should be eden");
g1_policy()->add_region_to_incremental_cset_lhs(alloc_region);
- _allocator->increase_used(allocated_bytes);
+ increase_used(allocated_bytes);
_hr_printer.retire(alloc_region);
// We update the eden sizes here, when the region is retired,
// instead of when it's allocated, since this is the point that its
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -251,6 +251,15 @@
// Class that handles the different kinds of allocations.
G1Allocator* _allocator;
+ // Outside of GC pauses, the number of bytes used in all regions other
+ // than the current allocation region(s).
+ size_t _summary_bytes_used;
+
+ void increase_used(size_t bytes);
+ void decrease_used(size_t bytes);
+
+ void set_used(size_t bytes);
+
// Class that handles archive allocation ranges.
G1ArchiveAllocator* _archive_allocator;
@@ -858,44 +867,27 @@
// forwarding pointers to themselves. Reset them.
void remove_self_forwarding_pointers();
- // Together, these store an object with a preserved mark, and its mark value.
- Stack<oop, mtGC> _objs_with_preserved_marks;
- Stack<markOop, mtGC> _preserved_marks_of_objs;
+ struct OopAndMarkOop {
+ private:
+ oop _o;
+ markOop _m;
+ public:
+ OopAndMarkOop(oop obj, markOop m) : _o(obj), _m(m) {
+ }
+
+ void set_mark() {
+ _o->set_mark(_m);
+ }
+ };
+
+ typedef Stack<OopAndMarkOop,mtGC> OopAndMarkOopStack;
+ // Stores marks with the corresponding oop that we need to preserve during evacuation
+ // failure.
+ OopAndMarkOopStack* _preserved_objs;
// Preserve the mark of "obj", if necessary, in preparation for its mark
// word being overwritten with a self-forwarding-pointer.
- void preserve_mark_if_necessary(oop obj, markOop m);
-
- // The stack of evac-failure objects left to be scanned.
- GrowableArray<oop>* _evac_failure_scan_stack;
- // The closure to apply to evac-failure objects.
-
- OopsInHeapRegionClosure* _evac_failure_closure;
- // Set the field above.
- void
- set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_closure) {
- _evac_failure_closure = evac_failure_closure;
- }
-
- // Push "obj" on the scan stack.
- void push_on_evac_failure_scan_stack(oop obj);
- // Process scan stack entries until the stack is empty.
- void drain_evac_failure_scan_stack();
- // True iff an invocation of "drain_scan_stack" is in progress; to
- // prevent unnecessary recursion.
- bool _drain_in_progress;
-
- // Do any necessary initialization for evacuation-failure handling.
- // "cl" is the closure that will be used to process evac-failure
- // objects.
- void init_for_evac_failure(OopsInHeapRegionClosure* cl);
- // Do any necessary cleanup for evacuation-failure handling data
- // structures.
- void finalize_for_evac_failure();
-
- // An attempt to evacuate "obj" has failed; take necessary steps.
- oop handle_evacuation_failure_par(G1ParScanThreadState* _par_scan_state, oop obj);
- void handle_evacuation_failure_common(oop obj, markOop m);
+ void preserve_mark_during_evac_failure(uint queue, oop obj, markOop m);
#ifndef PRODUCT
// Support for forcing evacuation failures. Analogous to
--- a/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1OopClosures.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -111,7 +111,6 @@
enum G1Barrier {
G1BarrierNone,
- G1BarrierEvac,
G1BarrierKlass
};
@@ -148,8 +147,6 @@
// We use a separate closure to handle references during evacuation
// failure processing.
-typedef G1ParCopyClosure<G1BarrierEvac, G1MarkNone> G1ParScanHeapEvacFailureClosure;
-
class FilterIntoCSClosure: public ExtendedOopClosure {
G1CollectedHeap* _g1;
OopClosure* _oc;
--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -144,8 +144,6 @@
#endif // ASSERT
void G1ParScanThreadState::trim_queue() {
- assert(_evac_failure_cl != NULL, "not set");
-
StarTask ref;
do {
// Drain the overflow stack first, so other threads can steal.
@@ -222,7 +220,7 @@
if (obj_ptr == NULL) {
// This will either forward-to-self, or detect that someone else has
// installed a forwarding pointer.
- return _g1h->handle_evacuation_failure_par(this, old);
+ return handle_evacuation_failure_par(old, old_mark);
}
}
}
@@ -236,7 +234,7 @@
// Doing this after all the allocation attempts also tests the
// undo_allocation() method too.
_g1_par_allocator->undo_allocation(dest_state, obj_ptr, word_sz, context);
- return _g1h->handle_evacuation_failure_par(this, old);
+ return handle_evacuation_failure_par(old, old_mark);
}
#endif // !PRODUCT
@@ -301,3 +299,36 @@
return forward_ptr;
}
}
+
+oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markOop m) {
+ assert(_g1h->obj_in_cs(old),
+ err_msg("Object " PTR_FORMAT " should be in the CSet", p2i(old)));
+
+ oop forward_ptr = old->forward_to_atomic(old);
+ if (forward_ptr == NULL) {
+ // Forward-to-self succeeded. We are the "owner" of the object.
+ HeapRegion* r = _g1h->heap_region_containing(old);
+
+ if (!r->evacuation_failed()) {
+ r->set_evacuation_failed(true);
+ _g1h->hr_printer()->evac_failure(r);
+ }
+
+ _g1h->preserve_mark_during_evac_failure(_queue_num, old, m);
+
+ _scanner.set_region(r);
+ old->oop_iterate_backwards(&_scanner);
+
+ return old;
+ } else {
+ // Forward-to-self failed. Either someone else managed to allocate
+ // space for this object (old != forward_ptr) or they beat us in
+ // self-forwarding it (old == forward_ptr).
+ assert(old == forward_ptr || !_g1h->obj_in_cs(forward_ptr),
+ err_msg("Object " PTR_FORMAT " forwarded to: " PTR_FORMAT " "
+ "should not be in the CSet",
+ p2i(old), p2i(forward_ptr)));
+ return forward_ptr;
+ }
+}
+
--- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -54,8 +54,6 @@
uint _tenuring_threshold;
G1ParScanClosure _scanner;
- OopsInHeapRegionClosure* _evac_failure_cl;
-
int _hash_seed;
uint _queue_num;
@@ -114,12 +112,6 @@
}
}
- void set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_cl) {
- _evac_failure_cl = evac_failure_cl;
- }
-
- OopsInHeapRegionClosure* evac_failure_closure() { return _evac_failure_cl; }
-
int* hash_seed() { return &_hash_seed; }
uint queue_num() { return _queue_num; }
@@ -211,6 +203,9 @@
void trim_queue();
inline void steal_and_trim_queue(RefToScanQueueSet *task_queues);
+
+ // An attempt to evacuate "obj" has failed; take necessary steps.
+ oop handle_evacuation_failure_par(oop obj, markOop m);
};
#endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP
--- a/hotspot/src/share/vm/gc/g1/g1_globals.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/g1_globals.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -252,12 +252,12 @@
"Percentage (0-100) of the heap size to use as default " \
" maximum young gen size.") \
range(0, 100) \
- constraint(G1MaxNewSizePercentConstraintFunc) \
+ constraint(G1MaxNewSizePercentConstraintFunc,AfterErgo) \
\
experimental(uintx, G1NewSizePercent, 5, \
"Percentage (0-100) of the heap size to use as default " \
"minimum young gen size.") \
- constraint(G1NewSizePercentConstraintFunc) \
+ constraint(G1NewSizePercentConstraintFunc,AfterErgo) \
\
experimental(uintx, G1MixedGCLiveThresholdPercent, 85, \
"Threshold for regions to be considered for inclusion in the " \
--- a/hotspot/src/share/vm/gc/g1/vmStructs_g1.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/g1/vmStructs_g1.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -45,13 +45,11 @@
nonstatic_field(HeapRegionManager, _regions, G1HeapRegionTable) \
nonstatic_field(HeapRegionManager, _num_committed, uint) \
\
- nonstatic_field(G1Allocator, _summary_bytes_used, size_t) \
- \
+ nonstatic_field(G1CollectedHeap, _summary_bytes_used, size_t) \
nonstatic_field(G1CollectedHeap, _hrm, HeapRegionManager) \
nonstatic_field(G1CollectedHeap, _g1mm, G1MonitoringSupport*) \
nonstatic_field(G1CollectedHeap, _old_set, HeapRegionSetBase) \
nonstatic_field(G1CollectedHeap, _humongous_set, HeapRegionSetBase) \
- nonstatic_field(G1CollectedHeap, _allocator, G1Allocator*) \
\
nonstatic_field(G1MonitoringSupport, _eden_committed, size_t) \
nonstatic_field(G1MonitoringSupport, _eden_used, size_t) \
@@ -78,12 +76,10 @@
declare_toplevel_type(HeapRegionSetBase) \
declare_toplevel_type(HeapRegionSetCount) \
declare_toplevel_type(G1MonitoringSupport) \
- declare_toplevel_type(G1Allocator) \
\
declare_toplevel_type(G1CollectedHeap*) \
declare_toplevel_type(HeapRegion*) \
declare_toplevel_type(G1MonitoringSupport*) \
- declare_toplevel_type(G1Allocator*) \
#endif // SHARE_VM_GC_G1_VMSTRUCTS_G1_HPP
--- a/hotspot/src/share/vm/gc/parallel/cardTableExtension.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/parallel/cardTableExtension.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -40,7 +40,6 @@
PSYoungGen* _young_gen;
CardTableExtension* _card_table;
HeapWord* _unmarked_addr;
- jbyte* _unmarked_card;
protected:
template <class T> void do_oop_work(T* p) {
@@ -50,7 +49,6 @@
// Don't overwrite the first missing card mark
if (_unmarked_addr == NULL) {
_unmarked_addr = (HeapWord*)p;
- _unmarked_card = _card_table->byte_for(p);
}
}
}
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -623,7 +623,7 @@
{
// DefNew needs to run with n_threads == 0, to make sure the serial
// version of the card table scanning code is used.
- // See: CardTableModRefBS::non_clean_card_iterate_possibly_parallel.
+ // See: CardTableModRefBSForCTRS::non_clean_card_iterate_possibly_parallel.
StrongRootsScope srs(0);
gch->gen_process_roots(&srs,
--- a/hotspot/src/share/vm/gc/shared/cardTableModRefBS.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBS.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -24,22 +24,12 @@
#include "precompiled.hpp"
#include "gc/shared/cardTableModRefBS.inline.hpp"
-#include "gc/shared/cardTableRS.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/genCollectedHeap.hpp"
-#include "gc/shared/space.hpp"
#include "gc/shared/space.inline.hpp"
-#include "memory/allocation.inline.hpp"
-#include "memory/universe.hpp"
#include "memory/virtualspace.hpp"
-#include "runtime/java.hpp"
-#include "runtime/mutexLocker.hpp"
#include "services/memTracker.hpp"
#include "utilities/macros.hpp"
-#ifdef COMPILER1
-#include "c1/c1_LIR.hpp"
-#include "c1/c1_LIRGenerator.hpp"
-#endif
// This kind of "BarrierSet" allows a "CollectedHeap" to detect and
// enumerate ref fields that have been modified (since the last
@@ -68,12 +58,7 @@
_committed(NULL),
_cur_covered_regions(0),
_byte_map(NULL),
- byte_map_base(NULL),
- // LNC functionality
- _lowest_non_clean(NULL),
- _lowest_non_clean_chunk_size(NULL),
- _lowest_non_clean_base_chunk_index(NULL),
- _last_LNC_resizing_collection(NULL)
+ byte_map_base(NULL)
{
assert((uintptr_t(_whole_heap.start()) & (card_size - 1)) == 0, "heap must start at card boundary");
assert((uintptr_t(_whole_heap.end()) & (card_size - 1)) == 0, "heap must end at card boundary");
@@ -130,25 +115,6 @@
!ExecMem, "card table last card");
*guard_card = last_card;
- _lowest_non_clean =
- NEW_C_HEAP_ARRAY(CardArr, _max_covered_regions, mtGC);
- _lowest_non_clean_chunk_size =
- NEW_C_HEAP_ARRAY(size_t, _max_covered_regions, mtGC);
- _lowest_non_clean_base_chunk_index =
- NEW_C_HEAP_ARRAY(uintptr_t, _max_covered_regions, mtGC);
- _last_LNC_resizing_collection =
- NEW_C_HEAP_ARRAY(int, _max_covered_regions, mtGC);
- if (_lowest_non_clean == NULL
- || _lowest_non_clean_chunk_size == NULL
- || _lowest_non_clean_base_chunk_index == NULL
- || _last_LNC_resizing_collection == NULL)
- vm_exit_during_initialization("couldn't allocate an LNC array.");
- for (int i = 0; i < _max_covered_regions; i++) {
- _lowest_non_clean[i] = NULL;
- _lowest_non_clean_chunk_size[i] = 0;
- _last_LNC_resizing_collection[i] = -1;
- }
-
if (TraceCardTableModRefBS) {
gclog_or_tty->print_cr("CardTableModRefBS::CardTableModRefBS: ");
gclog_or_tty->print_cr(" "
@@ -171,22 +137,6 @@
delete[] _committed;
_committed = NULL;
}
- if (_lowest_non_clean) {
- FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean);
- _lowest_non_clean = NULL;
- }
- if (_lowest_non_clean_chunk_size) {
- FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size);
- _lowest_non_clean_chunk_size = NULL;
- }
- if (_lowest_non_clean_base_chunk_index) {
- FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index);
- _lowest_non_clean_base_chunk_index = NULL;
- }
- if (_last_LNC_resizing_collection) {
- FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection);
- _last_LNC_resizing_collection = NULL;
- }
}
int CardTableModRefBS::find_covering_region_by_base(HeapWord* base) {
@@ -437,32 +387,6 @@
}
-void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
- MemRegion mr,
- OopsInGenClosure* cl,
- CardTableRS* ct,
- uint n_threads) {
- if (!mr.is_empty()) {
- if (n_threads > 0) {
-#if INCLUDE_ALL_GCS
- non_clean_card_iterate_parallel_work(sp, mr, cl, ct, n_threads);
-#else // INCLUDE_ALL_GCS
- fatal("Parallel gc not supported here.");
-#endif // INCLUDE_ALL_GCS
- } else {
- // clear_cl finds contiguous dirty ranges of cards to process and clear.
-
- // This is the single-threaded version used by DefNew.
- const bool parallel = false;
-
- DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), cl->gen_boundary(), parallel);
- ClearNoncleanCardWrapper clear_cl(dcto_cl, ct, parallel);
-
- clear_cl.do_MemRegion(mr);
- }
- }
-}
-
void CardTableModRefBS::dirty_MemRegion(MemRegion mr) {
assert((HeapWord*)align_size_down((uintptr_t)mr.start(), HeapWordSize) == mr.start(), "Unaligned start");
assert((HeapWord*)align_size_up ((uintptr_t)mr.end(), HeapWordSize) == mr.end(), "Unaligned end" );
@@ -623,15 +547,3 @@
p2i(_byte_map), p2i(_byte_map + _byte_map_size), p2i(byte_map_base));
}
-bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) {
- return
- CardTableModRefBS::card_will_be_scanned(cv) ||
- _rs->is_prev_nonclean_card_val(cv);
-};
-
-bool CardTableModRefBSForCTRS::card_may_have_been_dirty(jbyte cv) {
- return
- cv != clean_card &&
- (CardTableModRefBS::card_may_have_been_dirty(cv) ||
- CardTableRS::youngergen_may_have_been_dirty(cv));
-};
--- a/hotspot/src/share/vm/gc/shared/cardTableModRefBS.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBS.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -40,23 +40,9 @@
// Closures used to scan dirty cards should take these
// considerations into account.
-class Generation;
-class OopsInGenClosure;
-class DirtyCardToOopClosure;
-class ClearNoncleanCardWrapper;
-class CardTableRS;
-
class CardTableModRefBS: public ModRefBarrierSet {
// Some classes get to look at some private stuff.
- friend class BytecodeInterpreter;
friend class VMStructs;
- friend class CardTableRS;
- friend class CheckForUnmarkedOops; // Needs access to raw card bytes.
- friend class SharkBuilder;
-#ifndef PRODUCT
- // For debugging.
- friend class GuaranteeNotModClosure;
-#endif
protected:
enum CardValues {
@@ -75,24 +61,6 @@
// a word's worth (row) of clean card values
static const intptr_t clean_card_row = (intptr_t)(-1);
- // dirty and precleaned are equivalent wrt younger_refs_iter.
- static bool card_is_dirty_wrt_gen_iter(jbyte cv) {
- return cv == dirty_card || cv == precleaned_card;
- }
-
- // Returns "true" iff the value "cv" will cause the card containing it
- // to be scanned in the current traversal. May be overridden by
- // subtypes.
- virtual bool card_will_be_scanned(jbyte cv) {
- return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv);
- }
-
- // Returns "true" iff the value "cv" may have represented a dirty card at
- // some point.
- virtual bool card_may_have_been_dirty(jbyte cv) {
- return card_is_dirty_wrt_gen_iter(cv);
- }
-
// The declaration order of these const fields is important; see the
// constructor before changing.
const MemRegion _whole_heap; // the region covered by the card table
@@ -174,20 +142,6 @@
return byte_for(p) + 1;
}
- // Iterate over the portion of the card-table which covers the given
- // region mr in the given space and apply cl to any dirty sub-regions
- // of mr. Clears the dirty cards as they are processed.
- void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr,
- OopsInGenClosure* cl, CardTableRS* ct,
- uint n_threads);
-
- private:
- // Work method used to implement non_clean_card_iterate_possibly_parallel()
- // above in the parallel case.
- void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
- OopsInGenClosure* cl, CardTableRS* ct,
- uint n_threads);
-
protected:
// Dirty the bytes corresponding to "mr" (not all of which must be
// covered.)
@@ -197,65 +151,6 @@
// all of which must be covered.)
void clear_MemRegion(MemRegion mr);
- // *** Support for parallel card scanning.
-
- // This is an array, one element per covered region of the card table.
- // Each entry is itself an array, with one element per chunk in the
- // covered region. Each entry of these arrays is the lowest non-clean
- // card of the corresponding chunk containing part of an object from the
- // previous chunk, or else NULL.
- typedef jbyte* CardPtr;
- typedef CardPtr* CardArr;
- CardArr* _lowest_non_clean;
- size_t* _lowest_non_clean_chunk_size;
- uintptr_t* _lowest_non_clean_base_chunk_index;
- int* _last_LNC_resizing_collection;
-
- // Initializes "lowest_non_clean" to point to the array for the region
- // covering "sp", and "lowest_non_clean_base_chunk_index" to the chunk
- // index of the corresponding to the first element of that array.
- // Ensures that these arrays are of sufficient size, allocating if necessary.
- // May be called by several threads concurrently.
- void get_LNC_array_for_space(Space* sp,
- jbyte**& lowest_non_clean,
- uintptr_t& lowest_non_clean_base_chunk_index,
- size_t& lowest_non_clean_chunk_size);
-
- // Returns the number of chunks necessary to cover "mr".
- size_t chunks_to_cover(MemRegion mr) {
- return (size_t)(addr_to_chunk_index(mr.last()) -
- addr_to_chunk_index(mr.start()) + 1);
- }
-
- // Returns the index of the chunk in a stride which
- // covers the given address.
- uintptr_t addr_to_chunk_index(const void* addr) {
- uintptr_t card = (uintptr_t) byte_for(addr);
- return card / ParGCCardsPerStrideChunk;
- }
-
- // Apply cl, which must either itself apply dcto_cl or be dcto_cl,
- // to the cards in the stride (of n_strides) within the given space.
- void process_stride(Space* sp,
- MemRegion used,
- jint stride, int n_strides,
- OopsInGenClosure* cl,
- CardTableRS* ct,
- jbyte** lowest_non_clean,
- uintptr_t lowest_non_clean_base_chunk_index,
- size_t lowest_non_clean_chunk_size);
-
- // Makes sure that chunk boundaries are handled appropriately, by
- // adjusting the min_done of dcto_cl, and by using a special card-table
- // value to indicate how min_done should be set.
- void process_chunk_boundaries(Space* sp,
- DirtyCardToOopClosure* dcto_cl,
- MemRegion chunk_mr,
- MemRegion used,
- jbyte** lowest_non_clean,
- uintptr_t lowest_non_clean_base_chunk_index,
- size_t lowest_non_clean_chunk_size);
-
public:
// Constants
enum SomePublicConstants {
@@ -436,34 +331,5 @@
static const BarrierSet::Name value = BarrierSet::CardTableModRef;
};
-class CardTableRS;
-
-// A specialization for the CardTableRS gen rem set.
-class CardTableModRefBSForCTRS: public CardTableModRefBS {
- CardTableRS* _rs;
-protected:
- bool card_will_be_scanned(jbyte cv);
- bool card_may_have_been_dirty(jbyte cv);
-public:
- CardTableModRefBSForCTRS(MemRegion whole_heap) :
- CardTableModRefBS(
- whole_heap,
- // Concrete tag should be BarrierSet::CardTableForRS.
- // That will presently break things in a bunch of places though.
- // The concrete tag is used as a dispatch key in many places, and
- // CardTableForRS does not correctly dispatch in some of those
- // uses. This will be addressed as part of a reorganization of the
- // BarrierSet hierarchy.
- BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableForRS))
- {}
-
- void set_CTRS(CardTableRS* rs) { _rs = rs; }
-};
-
-template<>
-struct BarrierSet::GetName<CardTableModRefBSForCTRS> {
- static const BarrierSet::Name value = BarrierSet::CardTableForRS;
-};
-
#endif // SHARE_VM_GC_SHARED_CARDTABLEMODREFBS_HPP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/cardTableModRefBS.inline.hpp"
+#include "gc/shared/cardTableRS.hpp"
+#include "memory/allocation.inline.hpp"
+#include "gc/shared/space.inline.hpp"
+
+CardTableModRefBSForCTRS::CardTableModRefBSForCTRS(MemRegion whole_heap) :
+ CardTableModRefBS(
+ whole_heap,
+ // Concrete tag should be BarrierSet::CardTableForRS.
+ // That will presently break things in a bunch of places though.
+ // The concrete tag is used as a dispatch key in many places, and
+ // CardTableForRS does not correctly dispatch in some of those
+ // uses. This will be addressed as part of a reorganization of the
+ // BarrierSet hierarchy.
+ BarrierSet::FakeRtti(BarrierSet::CardTableModRef, 0).add_tag(BarrierSet::CardTableForRS)),
+ // LNC functionality
+ _lowest_non_clean(NULL),
+ _lowest_non_clean_chunk_size(NULL),
+ _lowest_non_clean_base_chunk_index(NULL),
+ _last_LNC_resizing_collection(NULL)
+{ }
+
+void CardTableModRefBSForCTRS::initialize() {
+ CardTableModRefBS::initialize();
+ _lowest_non_clean =
+ NEW_C_HEAP_ARRAY(CardArr, _max_covered_regions, mtGC);
+ _lowest_non_clean_chunk_size =
+ NEW_C_HEAP_ARRAY(size_t, _max_covered_regions, mtGC);
+ _lowest_non_clean_base_chunk_index =
+ NEW_C_HEAP_ARRAY(uintptr_t, _max_covered_regions, mtGC);
+ _last_LNC_resizing_collection =
+ NEW_C_HEAP_ARRAY(int, _max_covered_regions, mtGC);
+ if (_lowest_non_clean == NULL
+ || _lowest_non_clean_chunk_size == NULL
+ || _lowest_non_clean_base_chunk_index == NULL
+ || _last_LNC_resizing_collection == NULL)
+ vm_exit_during_initialization("couldn't allocate an LNC array.");
+ for (int i = 0; i < _max_covered_regions; i++) {
+ _lowest_non_clean[i] = NULL;
+ _lowest_non_clean_chunk_size[i] = 0;
+ _last_LNC_resizing_collection[i] = -1;
+ }
+}
+
+CardTableModRefBSForCTRS::~CardTableModRefBSForCTRS() {
+ if (_lowest_non_clean) {
+ FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean);
+ _lowest_non_clean = NULL;
+ }
+ if (_lowest_non_clean_chunk_size) {
+ FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size);
+ _lowest_non_clean_chunk_size = NULL;
+ }
+ if (_lowest_non_clean_base_chunk_index) {
+ FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index);
+ _lowest_non_clean_base_chunk_index = NULL;
+ }
+ if (_last_LNC_resizing_collection) {
+ FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection);
+ _last_LNC_resizing_collection = NULL;
+ }
+}
+
+bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) {
+ return
+ card_is_dirty_wrt_gen_iter(cv) ||
+ _rs->is_prev_nonclean_card_val(cv);
+}
+
+bool CardTableModRefBSForCTRS::card_may_have_been_dirty(jbyte cv) {
+ return
+ cv != clean_card &&
+ (card_is_dirty_wrt_gen_iter(cv) ||
+ CardTableRS::youngergen_may_have_been_dirty(cv));
+}
+
+void CardTableModRefBSForCTRS::non_clean_card_iterate_possibly_parallel(
+ Space* sp,
+ MemRegion mr,
+ OopsInGenClosure* cl,
+ CardTableRS* ct,
+ uint n_threads)
+{
+ if (!mr.is_empty()) {
+ if (n_threads > 0) {
+#if INCLUDE_ALL_GCS
+ non_clean_card_iterate_parallel_work(sp, mr, cl, ct, n_threads);
+#else // INCLUDE_ALL_GCS
+ fatal("Parallel gc not supported here.");
+#endif // INCLUDE_ALL_GCS
+ } else {
+ // clear_cl finds contiguous dirty ranges of cards to process and clear.
+
+ // This is the single-threaded version used by DefNew.
+ const bool parallel = false;
+
+ DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(), cl->gen_boundary(), parallel);
+ ClearNoncleanCardWrapper clear_cl(dcto_cl, ct, parallel);
+
+ clear_cl.do_MemRegion(mr);
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBSForCTRS.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+#ifndef SHARE_VM_GC_SHARED_CARDTABLEMODREFBSFORCTRS_HPP
+#define SHARE_VM_GC_SHARED_CARDTABLEMODREFBSFORCTRS_HPP
+
+#include "gc/shared/cardTableModRefBS.hpp"
+
+class CardTableRS;
+class DirtyCardToOopClosure;
+class OopsInGenClosure;
+
+// A specialization for the CardTableRS gen rem set.
+class CardTableModRefBSForCTRS: public CardTableModRefBS {
+ friend class CardTableRS;
+
+public:
+ CardTableModRefBSForCTRS(MemRegion whole_heap);
+ ~CardTableModRefBSForCTRS();
+
+ virtual void initialize();
+
+ void set_CTRS(CardTableRS* rs) { _rs = rs; }
+
+private:
+ CardTableRS* _rs;
+
+ // *** Support for parallel card scanning.
+
+ // dirty and precleaned are equivalent wrt younger_refs_iter.
+ static bool card_is_dirty_wrt_gen_iter(jbyte cv) {
+ return cv == dirty_card || cv == precleaned_card;
+ }
+
+ // Returns "true" iff the value "cv" will cause the card containing it
+ // to be scanned in the current traversal. May be overridden by
+ // subtypes.
+ bool card_will_be_scanned(jbyte cv);
+
+ // Returns "true" iff the value "cv" may have represented a dirty card at
+ // some point.
+ bool card_may_have_been_dirty(jbyte cv);
+
+ // Iterate over the portion of the card-table which covers the given
+ // region mr in the given space and apply cl to any dirty sub-regions
+ // of mr. Clears the dirty cards as they are processed.
+ void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr,
+ OopsInGenClosure* cl, CardTableRS* ct,
+ uint n_threads);
+
+ // Work method used to implement non_clean_card_iterate_possibly_parallel()
+ // above in the parallel case.
+ void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
+ OopsInGenClosure* cl, CardTableRS* ct,
+ uint n_threads);
+
+ // This is an array, one element per covered region of the card table.
+ // Each entry is itself an array, with one element per chunk in the
+ // covered region. Each entry of these arrays is the lowest non-clean
+ // card of the corresponding chunk containing part of an object from the
+ // previous chunk, or else NULL.
+ typedef jbyte* CardPtr;
+ typedef CardPtr* CardArr;
+ CardArr* _lowest_non_clean;
+ size_t* _lowest_non_clean_chunk_size;
+ uintptr_t* _lowest_non_clean_base_chunk_index;
+ int* _last_LNC_resizing_collection;
+
+ // Initializes "lowest_non_clean" to point to the array for the region
+ // covering "sp", and "lowest_non_clean_base_chunk_index" to the chunk
+ // index of the corresponding to the first element of that array.
+ // Ensures that these arrays are of sufficient size, allocating if necessary.
+ // May be called by several threads concurrently.
+ void get_LNC_array_for_space(Space* sp,
+ jbyte**& lowest_non_clean,
+ uintptr_t& lowest_non_clean_base_chunk_index,
+ size_t& lowest_non_clean_chunk_size);
+
+ // Returns the number of chunks necessary to cover "mr".
+ size_t chunks_to_cover(MemRegion mr) {
+ return (size_t)(addr_to_chunk_index(mr.last()) -
+ addr_to_chunk_index(mr.start()) + 1);
+ }
+
+ // Returns the index of the chunk in a stride which
+ // covers the given address.
+ uintptr_t addr_to_chunk_index(const void* addr) {
+ uintptr_t card = (uintptr_t) byte_for(addr);
+ return card / ParGCCardsPerStrideChunk;
+ }
+
+ // Apply cl, which must either itself apply dcto_cl or be dcto_cl,
+ // to the cards in the stride (of n_strides) within the given space.
+ void process_stride(Space* sp,
+ MemRegion used,
+ jint stride, int n_strides,
+ OopsInGenClosure* cl,
+ CardTableRS* ct,
+ jbyte** lowest_non_clean,
+ uintptr_t lowest_non_clean_base_chunk_index,
+ size_t lowest_non_clean_chunk_size);
+
+ // Makes sure that chunk boundaries are handled appropriately, by
+ // adjusting the min_done of dcto_cl, and by using a special card-table
+ // value to indicate how min_done should be set.
+ void process_chunk_boundaries(Space* sp,
+ DirtyCardToOopClosure* dcto_cl,
+ MemRegion chunk_mr,
+ MemRegion used,
+ jbyte** lowest_non_clean,
+ uintptr_t lowest_non_clean_base_chunk_index,
+ size_t lowest_non_clean_chunk_size);
+
+};
+
+template<>
+struct BarrierSet::GetName<CardTableModRefBSForCTRS> {
+ static const BarrierSet::Name value = BarrierSet::CardTableForRS;
+};
+
+#endif // include guard
+
--- a/hotspot/src/share/vm/gc/shared/cardTableRS.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/cardTableRS.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -240,7 +240,7 @@
// cur-younger-gen ==> cur_younger_gen
// cur_youngergen_and_prev_nonclean_card ==> no change.
void CardTableRS::write_ref_field_gc_par(void* field, oop new_val) {
- jbyte* entry = ct_bs()->byte_for(field);
+ jbyte* entry = _ct_bs->byte_for(field);
do {
jbyte entry_val = *entry;
// We put this first because it's probably the most common case.
@@ -398,10 +398,10 @@
jbyte* cur_entry = byte_for(used.start());
jbyte* limit = byte_after(used.last());
while (cur_entry < limit) {
- if (*cur_entry == CardTableModRefBS::clean_card) {
+ if (*cur_entry == clean_card_val()) {
jbyte* first_dirty = cur_entry+1;
while (first_dirty < limit &&
- *first_dirty == CardTableModRefBS::clean_card) {
+ *first_dirty == clean_card_val()) {
first_dirty++;
}
// If the first object is a regular object, and it has a
@@ -418,7 +418,7 @@
!boundary_obj->is_typeArray()) {
guarantee(cur_entry > byte_for(used.start()),
"else boundary would be boundary_block");
- if (*byte_for(boundary_block) != CardTableModRefBS::clean_card) {
+ if (*byte_for(boundary_block) != clean_card_val()) {
begin = boundary_block + s->block_size(boundary_block);
start_block = begin;
}
--- a/hotspot/src/share/vm/gc/shared/cardTableRS.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/cardTableRS.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -25,7 +25,7 @@
#ifndef SHARE_VM_GC_SHARED_CARDTABLERS_HPP
#define SHARE_VM_GC_SHARED_CARDTABLERS_HPP
-#include "gc/shared/cardTableModRefBS.hpp"
+#include "gc/shared/cardTableModRefBSForCTRS.hpp"
#include "gc/shared/genRemSet.hpp"
#include "memory/memRegion.hpp"
@@ -42,16 +42,16 @@
friend class ClearNoncleanCardWrapper;
static jbyte clean_card_val() {
- return CardTableModRefBS::clean_card;
+ return CardTableModRefBSForCTRS::clean_card;
}
static intptr_t clean_card_row() {
- return CardTableModRefBS::clean_card_row;
+ return CardTableModRefBSForCTRS::clean_card_row;
}
static bool
card_is_dirty_wrt_gen_iter(jbyte cv) {
- return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv);
+ return CardTableModRefBSForCTRS::card_is_dirty_wrt_gen_iter(cv);
}
CardTableModRefBSForCTRS* _ct_bs;
@@ -61,17 +61,17 @@
void verify_space(Space* s, HeapWord* gen_start);
enum ExtendedCardValue {
- youngergen_card = CardTableModRefBS::CT_MR_BS_last_reserved + 1,
+ youngergen_card = CardTableModRefBSForCTRS::CT_MR_BS_last_reserved + 1,
// These are for parallel collection.
// There are three P (parallel) youngergen card values. In general, this
// needs to be more than the number of generations (including the perm
// gen) that might have younger_refs_do invoked on them separately. So
// if we add more gens, we have to add more values.
- youngergenP1_card = CardTableModRefBS::CT_MR_BS_last_reserved + 2,
- youngergenP2_card = CardTableModRefBS::CT_MR_BS_last_reserved + 3,
- youngergenP3_card = CardTableModRefBS::CT_MR_BS_last_reserved + 4,
+ youngergenP1_card = CardTableModRefBSForCTRS::CT_MR_BS_last_reserved + 2,
+ youngergenP2_card = CardTableModRefBSForCTRS::CT_MR_BS_last_reserved + 3,
+ youngergenP3_card = CardTableModRefBSForCTRS::CT_MR_BS_last_reserved + 4,
cur_youngergen_and_prev_nonclean_card =
- CardTableModRefBS::CT_MR_BS_last_reserved + 5
+ CardTableModRefBSForCTRS::CT_MR_BS_last_reserved + 5
};
// An array that contains, for each generation, the card table value last
@@ -107,7 +107,7 @@
// *** GenRemSet functions.
CardTableRS* as_CardTableRS() { return this; }
- CardTableModRefBS* ct_bs() { return _ct_bs; }
+ CardTableModRefBSForCTRS* ct_bs() { return _ct_bs; }
// Override.
void prepare_for_younger_refs_iterate(bool parallel);
@@ -147,7 +147,7 @@
void invalidate_or_clear(Generation* old_gen);
static uintx ct_max_alignment_constraint() {
- return CardTableModRefBS::ct_max_alignment_constraint();
+ return CardTableModRefBSForCTRS::ct_max_alignment_constraint();
}
jbyte* byte_for(void* p) { return _ct_bs->byte_for(p); }
--- a/hotspot/src/share/vm/gc/shared/taskqueue.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -295,8 +295,9 @@
// Delete any resource associated with the queue.
~GenericTaskQueue();
- // apply the closure to all elements in the task queue
- void oops_do(OopClosure* f);
+ // Apply fn to each element in the task queue. The queue must not
+ // be modified while iterating.
+ template<typename Fn> void iterate(Fn fn);
private:
// Element array.
--- a/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/gc/shared/taskqueue.inline.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -259,20 +259,14 @@
}
template<class E, MEMFLAGS F, unsigned int N>
-inline void GenericTaskQueue<E, F, N>::oops_do(OopClosure* f) {
- // tty->print_cr("START OopTaskQueue::oops_do");
+template<class Fn>
+inline void GenericTaskQueue<E, F, N>::iterate(Fn fn) {
uint iters = size();
uint index = _bottom;
for (uint i = 0; i < iters; ++i) {
index = decrement_index(index);
- // tty->print_cr(" doing entry %d," INTPTR_T " -> " INTPTR_T,
- // index, &_elems[index], _elems[index]);
- E* t = (E*)&_elems[index]; // cast away volatility
- oop* p = (oop*)t;
- assert((*t)->is_oop_or_null(), err_msg("Expected an oop or NULL at " PTR_FORMAT, p2i(*t)));
- f->do_oop(p);
+ fn(const_cast<E&>(_elems[index])); // cast away volatility
}
- // tty->print_cr("END OopTaskQueue::oops_do");
}
--- a/hotspot/src/share/vm/memory/universe.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/memory/universe.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -56,6 +56,7 @@
#include "prims/jvmtiRedefineClassesTrace.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.inline.hpp"
+#include "runtime/commandLineFlagConstraintList.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/fprofiler.hpp"
#include "runtime/handles.inline.hpp"
@@ -656,6 +657,11 @@
Metaspace::global_initialize();
+ // Checks 'AfterMemoryInit' constraints.
+ if (!CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::AfterMemoryInit)) {
+ return JNI_EINVAL;
+ }
+
// Create memory for metadata. Must be after initializing heap for
// DumpSharedSpaces.
ClassLoaderData::init_null_class_loader_data();
--- a/hotspot/src/share/vm/oops/oop.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/oops/oop.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -200,7 +200,6 @@
// Access to fields in a instanceOop through these methods.
oop obj_field(int offset) const;
- volatile oop obj_field_volatile(int offset) const;
void obj_field_put(int offset, oop value);
void obj_field_put_raw(int offset, oop value);
void obj_field_put_volatile(int offset, oop value);
--- a/hotspot/src/share/vm/oops/oop.inline.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -284,11 +284,7 @@
load_decode_heap_oop(obj_field_addr<narrowOop>(offset)) :
load_decode_heap_oop(obj_field_addr<oop>(offset));
}
-inline volatile oop oopDesc::obj_field_volatile(int offset) const {
- volatile oop value = obj_field(offset);
- OrderAccess::acquire();
- return value;
-}
+
inline void oopDesc::obj_field_put(int offset, oop value) {
UseCompressedOops ? oop_store(obj_field_addr<narrowOop>(offset), value) :
oop_store(obj_field_addr<oop>(offset), value);
--- a/hotspot/src/share/vm/opto/c2_globals.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -659,7 +659,7 @@
"0 for no aliasing, 1 for oop/field/static/array split, " \
"2 for class split, 3 for unique instances") \
range(0, 3) \
- constraint(AliasLevelConstraintFunc) \
+ constraint(AliasLevelConstraintFunc,AfterErgo) \
\
develop(bool, VerifyAliases, false, \
"perform extra checks on the results of alias analysis") \
--- a/hotspot/src/share/vm/opto/c2compiler.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -79,7 +79,6 @@
return OptoRuntime::generate(thread->env());
}
-
void C2Compiler::initialize() {
// The first compiler thread that gets here will initialize the
// small amount of global state (and runtime stubs) that C2 needs.
@@ -154,11 +153,361 @@
}
}
-
void C2Compiler::print_timers() {
Compile::print_timers();
}
+bool C2Compiler::is_intrinsic_available(methodHandle method, methodHandle compilation_context) {
+ // Assume a non-virtual dispatch. A virtual dispatch is
+ // possible for only a limited set of available intrinsics whereas
+ // a non-virtual dispatch is possible for all available intrinsics.
+ return is_intrinsic_supported(method, false) &&
+ !is_intrinsic_disabled_by_flag(method, compilation_context);
+}
+
+bool C2Compiler::is_intrinsic_supported(methodHandle method, bool is_virtual) {
+ vmIntrinsics::ID id = method->intrinsic_id();
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+
+ if (id < vmIntrinsics::FIRST_ID || id >= vmIntrinsics::LAST_COMPILER_INLINE) {
+ return false;
+ }
+
+ // Only Object.hashCode and Object.clone intrinsics implement also a virtual
+ // dispatch because calling both methods is expensive but both methods are
+ // frequently overridden. All other intrinsics implement only a non-virtual
+ // dispatch.
+ if (is_virtual) {
+ switch (id) {
+ case vmIntrinsics::_hashCode:
+ case vmIntrinsics::_clone:
+ break;
+ default:
+ return false;
+ }
+ }
+
+ switch (id) {
+ case vmIntrinsics::_compareTo:
+ if (!Matcher::match_rule_supported(Op_StrComp)) return false;
+ break;
+ case vmIntrinsics::_equals:
+ if (!Matcher::match_rule_supported(Op_StrEquals)) return false;
+ break;
+ case vmIntrinsics::_equalsC:
+ if (!Matcher::match_rule_supported(Op_AryEq)) return false;
+ break;
+ case vmIntrinsics::_copyMemory:
+ if (StubRoutines::unsafe_arraycopy() == NULL) return false;
+ break;
+ case vmIntrinsics::_encodeISOArray:
+ if (!Matcher::match_rule_supported(Op_EncodeISOArray)) return false;
+ break;
+ case vmIntrinsics::_bitCount_i:
+ if (!Matcher::match_rule_supported(Op_PopCountI)) return false;
+ break;
+ case vmIntrinsics::_bitCount_l:
+ if (!Matcher::match_rule_supported(Op_PopCountL)) return false;
+ break;
+ case vmIntrinsics::_numberOfLeadingZeros_i:
+ if (!Matcher::match_rule_supported(Op_CountLeadingZerosI)) return false;
+ break;
+ case vmIntrinsics::_numberOfLeadingZeros_l:
+ if (!Matcher::match_rule_supported(Op_CountLeadingZerosL)) return false;
+ break;
+ case vmIntrinsics::_numberOfTrailingZeros_i:
+ if (!Matcher::match_rule_supported(Op_CountTrailingZerosI)) return false;
+ break;
+ case vmIntrinsics::_numberOfTrailingZeros_l:
+ if (!Matcher::match_rule_supported(Op_CountTrailingZerosL)) return false;
+ break;
+ case vmIntrinsics::_reverseBytes_c:
+ if (!Matcher::match_rule_supported(Op_ReverseBytesUS)) return false;
+ break;
+ case vmIntrinsics::_reverseBytes_s:
+ if (!Matcher::match_rule_supported(Op_ReverseBytesS)) return false;
+ break;
+ case vmIntrinsics::_reverseBytes_i:
+ if (!Matcher::match_rule_supported(Op_ReverseBytesI)) return false;
+ break;
+ case vmIntrinsics::_reverseBytes_l:
+ if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return false;
+ break;
+ case vmIntrinsics::_compareAndSwapObject:
+#ifdef _LP64
+ if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false;
+#endif
+ break;
+ case vmIntrinsics::_compareAndSwapLong:
+ if (!Matcher::match_rule_supported(Op_CompareAndSwapL)) return false;
+ break;
+ case vmIntrinsics::_getAndAddInt:
+ if (!Matcher::match_rule_supported(Op_GetAndAddI)) return false;
+ break;
+ case vmIntrinsics::_getAndAddLong:
+ if (!Matcher::match_rule_supported(Op_GetAndAddL)) return false;
+ break;
+ case vmIntrinsics::_getAndSetInt:
+ if (!Matcher::match_rule_supported(Op_GetAndSetI)) return false;
+ break;
+ case vmIntrinsics::_getAndSetLong:
+ if (!Matcher::match_rule_supported(Op_GetAndSetL)) return false;
+ break;
+ case vmIntrinsics::_getAndSetObject:
+#ifdef _LP64
+ if (!UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetP)) return false;
+ if (UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetN)) return false;
+ break;
+#else
+ if (!Matcher::match_rule_supported(Op_GetAndSetP)) return false;
+ break;
+#endif
+ case vmIntrinsics::_incrementExactI:
+ case vmIntrinsics::_addExactI:
+ if (!Matcher::match_rule_supported(Op_OverflowAddI)) return false;
+ break;
+ case vmIntrinsics::_incrementExactL:
+ case vmIntrinsics::_addExactL:
+ if (!Matcher::match_rule_supported(Op_OverflowAddL)) return false;
+ break;
+ case vmIntrinsics::_decrementExactI:
+ case vmIntrinsics::_subtractExactI:
+ if (!Matcher::match_rule_supported(Op_OverflowSubI)) return false;
+ break;
+ case vmIntrinsics::_decrementExactL:
+ case vmIntrinsics::_subtractExactL:
+ if (!Matcher::match_rule_supported(Op_OverflowSubL)) return false;
+ break;
+ case vmIntrinsics::_negateExactI:
+ if (!Matcher::match_rule_supported(Op_OverflowSubI)) return false;
+ break;
+ case vmIntrinsics::_negateExactL:
+ if (!Matcher::match_rule_supported(Op_OverflowSubL)) return false;
+ break;
+ case vmIntrinsics::_multiplyExactI:
+ if (!Matcher::match_rule_supported(Op_OverflowMulI)) return false;
+ break;
+ case vmIntrinsics::_multiplyExactL:
+ if (!Matcher::match_rule_supported(Op_OverflowMulL)) return false;
+ break;
+ case vmIntrinsics::_getCallerClass:
+ if (SystemDictionary::reflect_CallerSensitive_klass() == NULL) return false;
+ break;
+ case vmIntrinsics::_hashCode:
+ case vmIntrinsics::_identityHashCode:
+ case vmIntrinsics::_getClass:
+ case vmIntrinsics::_dsin:
+ case vmIntrinsics::_dcos:
+ case vmIntrinsics::_dtan:
+ case vmIntrinsics::_dabs:
+ case vmIntrinsics::_datan2:
+ case vmIntrinsics::_dsqrt:
+ case vmIntrinsics::_dexp:
+ case vmIntrinsics::_dlog:
+ case vmIntrinsics::_dlog10:
+ case vmIntrinsics::_dpow:
+ case vmIntrinsics::_min:
+ case vmIntrinsics::_max:
+ case vmIntrinsics::_arraycopy:
+ case vmIntrinsics::_indexOf:
+ case vmIntrinsics::_getObject:
+ case vmIntrinsics::_getBoolean:
+ case vmIntrinsics::_getByte:
+ case vmIntrinsics::_getShort:
+ case vmIntrinsics::_getChar:
+ case vmIntrinsics::_getInt:
+ case vmIntrinsics::_getLong:
+ case vmIntrinsics::_getFloat:
+ case vmIntrinsics::_getDouble:
+ case vmIntrinsics::_putObject:
+ case vmIntrinsics::_putBoolean:
+ case vmIntrinsics::_putByte:
+ case vmIntrinsics::_putShort:
+ case vmIntrinsics::_putChar:
+ case vmIntrinsics::_putInt:
+ case vmIntrinsics::_putLong:
+ case vmIntrinsics::_putFloat:
+ case vmIntrinsics::_putDouble:
+ case vmIntrinsics::_getByte_raw:
+ case vmIntrinsics::_getShort_raw:
+ case vmIntrinsics::_getChar_raw:
+ case vmIntrinsics::_getInt_raw:
+ case vmIntrinsics::_getLong_raw:
+ case vmIntrinsics::_getFloat_raw:
+ case vmIntrinsics::_getDouble_raw:
+ case vmIntrinsics::_getAddress_raw:
+ case vmIntrinsics::_putByte_raw:
+ case vmIntrinsics::_putShort_raw:
+ case vmIntrinsics::_putChar_raw:
+ case vmIntrinsics::_putInt_raw:
+ case vmIntrinsics::_putLong_raw:
+ case vmIntrinsics::_putFloat_raw:
+ case vmIntrinsics::_putDouble_raw:
+ case vmIntrinsics::_putAddress_raw:
+ case vmIntrinsics::_getObjectVolatile:
+ case vmIntrinsics::_getBooleanVolatile:
+ case vmIntrinsics::_getByteVolatile:
+ case vmIntrinsics::_getShortVolatile:
+ case vmIntrinsics::_getCharVolatile:
+ case vmIntrinsics::_getIntVolatile:
+ case vmIntrinsics::_getLongVolatile:
+ case vmIntrinsics::_getFloatVolatile:
+ case vmIntrinsics::_getDoubleVolatile:
+ case vmIntrinsics::_putObjectVolatile:
+ case vmIntrinsics::_putBooleanVolatile:
+ case vmIntrinsics::_putByteVolatile:
+ case vmIntrinsics::_putShortVolatile:
+ case vmIntrinsics::_putCharVolatile:
+ case vmIntrinsics::_putIntVolatile:
+ case vmIntrinsics::_putLongVolatile:
+ case vmIntrinsics::_putFloatVolatile:
+ case vmIntrinsics::_putDoubleVolatile:
+ case vmIntrinsics::_getShortUnaligned:
+ case vmIntrinsics::_getCharUnaligned:
+ case vmIntrinsics::_getIntUnaligned:
+ case vmIntrinsics::_getLongUnaligned:
+ case vmIntrinsics::_putShortUnaligned:
+ case vmIntrinsics::_putCharUnaligned:
+ case vmIntrinsics::_putIntUnaligned:
+ case vmIntrinsics::_putLongUnaligned:
+ case vmIntrinsics::_compareAndSwapInt:
+ case vmIntrinsics::_putOrderedObject:
+ case vmIntrinsics::_putOrderedInt:
+ case vmIntrinsics::_putOrderedLong:
+ case vmIntrinsics::_loadFence:
+ case vmIntrinsics::_storeFence:
+ case vmIntrinsics::_fullFence:
+ case vmIntrinsics::_currentThread:
+ case vmIntrinsics::_isInterrupted:
+#ifdef TRACE_HAVE_INTRINSICS
+ case vmIntrinsics::_classID:
+ case vmIntrinsics::_threadID:
+ case vmIntrinsics::_counterTime:
+#endif
+ case vmIntrinsics::_currentTimeMillis:
+ case vmIntrinsics::_nanoTime:
+ case vmIntrinsics::_allocateInstance:
+ case vmIntrinsics::_newArray:
+ case vmIntrinsics::_getLength:
+ case vmIntrinsics::_copyOf:
+ case vmIntrinsics::_copyOfRange:
+ case vmIntrinsics::_clone:
+ case vmIntrinsics::_isAssignableFrom:
+ case vmIntrinsics::_isInstance:
+ case vmIntrinsics::_getModifiers:
+ case vmIntrinsics::_isInterface:
+ case vmIntrinsics::_isArray:
+ case vmIntrinsics::_isPrimitive:
+ case vmIntrinsics::_getSuperclass:
+ case vmIntrinsics::_getClassAccessFlags:
+ case vmIntrinsics::_floatToRawIntBits:
+ case vmIntrinsics::_floatToIntBits:
+ case vmIntrinsics::_intBitsToFloat:
+ case vmIntrinsics::_doubleToRawLongBits:
+ case vmIntrinsics::_doubleToLongBits:
+ case vmIntrinsics::_longBitsToDouble:
+ case vmIntrinsics::_Reference_get:
+ case vmIntrinsics::_Class_cast:
+ case vmIntrinsics::_aescrypt_encryptBlock:
+ case vmIntrinsics::_aescrypt_decryptBlock:
+ case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
+ case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
+ case vmIntrinsics::_sha_implCompress:
+ case vmIntrinsics::_sha2_implCompress:
+ case vmIntrinsics::_sha5_implCompress:
+ case vmIntrinsics::_digestBase_implCompressMB:
+ case vmIntrinsics::_multiplyToLen:
+ case vmIntrinsics::_squareToLen:
+ case vmIntrinsics::_mulAdd:
+ case vmIntrinsics::_montgomeryMultiply:
+ case vmIntrinsics::_montgomerySquare:
+ case vmIntrinsics::_ghash_processBlocks:
+ case vmIntrinsics::_updateCRC32:
+ case vmIntrinsics::_updateBytesCRC32:
+ case vmIntrinsics::_updateByteBufferCRC32:
+ case vmIntrinsics::_updateBytesCRC32C:
+ case vmIntrinsics::_updateDirectByteBufferCRC32C:
+ case vmIntrinsics::_profileBoolean:
+ case vmIntrinsics::_isCompileConstant:
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+bool C2Compiler::is_intrinsic_disabled_by_flag(methodHandle method, methodHandle compilation_context) {
+ vmIntrinsics::ID id = method->intrinsic_id();
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+
+ if (vmIntrinsics::is_disabled_by_flags(method->intrinsic_id())) {
+ return true;
+ }
+
+ // Check if the intrinsic corresponding to 'method' has been disabled on
+ // the command line by using the DisableIntrinsic flag (either globally
+ // or on a per-method level, see src/share/vm/compiler/abstractCompiler.hpp
+ // for details).
+ // Usually, the compilation context is the caller of the method 'method'.
+ // The only case when for a non-recursive method 'method' the compilation context
+ // is not the caller of the 'method' (but it is the method itself) is
+ // java.lang.ref.Referene::get.
+ // For java.lang.ref.Reference::get, the intrinsic version is used
+ // instead of the C2-compiled version so that the value in the referent
+ // field can be registered by the G1 pre-barrier code. The intrinsified
+ // version of Reference::get also adds a memory barrier to prevent
+ // commoning reads from the referent field across safepoint since GC
+ // can change the referent field's value. See Compile::Compile()
+ // in src/share/vm/opto/compile.cpp for more details.
+ ccstr disable_intr = NULL;
+ if ((DisableIntrinsic[0] != '\0' && strstr(DisableIntrinsic, vmIntrinsics::name_at(id)) != NULL) ||
+ (!compilation_context.is_null() &&
+ CompilerOracle::has_option_value(compilation_context, "DisableIntrinsic", disable_intr) &&
+ strstr(disable_intr, vmIntrinsics::name_at(id)) != NULL)
+ ) {
+ return true;
+ }
+
+ // -XX:-InlineNatives disables nearly all intrinsics except the ones listed in
+ // the following switch statement.
+ if (!InlineNatives) {
+ switch (id) {
+ case vmIntrinsics::_indexOf:
+ case vmIntrinsics::_compareTo:
+ case vmIntrinsics::_equals:
+ case vmIntrinsics::_equalsC:
+ case vmIntrinsics::_getAndAddInt:
+ case vmIntrinsics::_getAndAddLong:
+ case vmIntrinsics::_getAndSetInt:
+ case vmIntrinsics::_getAndSetLong:
+ case vmIntrinsics::_getAndSetObject:
+ case vmIntrinsics::_loadFence:
+ case vmIntrinsics::_storeFence:
+ case vmIntrinsics::_fullFence:
+ case vmIntrinsics::_Reference_get:
+ break;
+ default:
+ return true;
+ }
+ }
+
+ if (!InlineUnsafeOps) {
+ switch (id) {
+ case vmIntrinsics::_loadFence:
+ case vmIntrinsics::_storeFence:
+ case vmIntrinsics::_fullFence:
+ case vmIntrinsics::_compareAndSwapObject:
+ case vmIntrinsics::_compareAndSwapLong:
+ case vmIntrinsics::_compareAndSwapInt:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ return false;
+}
+
int C2Compiler::initial_code_buffer_size() {
assert(SegmentedCodeCache, "Should be only used with a segmented code cache");
return Compile::MAX_inst_size + Compile::MAX_locs_size + initial_const_capacity;
--- a/hotspot/src/share/vm/opto/c2compiler.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/c2compiler.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -36,7 +36,6 @@
// Name
const char *name() { return "C2"; }
-
void initialize();
// Compilation entry point for methods
@@ -52,6 +51,26 @@
// Print compilation timers and statistics
void print_timers();
+ // Check the availability of an intrinsic for 'method' given a compilation context.
+ virtual bool is_intrinsic_available(methodHandle method, methodHandle compilation_context);
+
+ // Return true if the intrinsification of a method supported by the compiler
+ // assuming a non-virtual dispatch. Return false otherwise.
+ virtual bool is_intrinsic_supported(methodHandle method) {
+ return is_intrinsic_supported(method, false);
+ }
+
+ // Check if the compiler supports an intrinsic for 'method' given the
+ // the dispatch mode specified by the 'is_virtual' parameter.
+ virtual bool is_intrinsic_supported(methodHandle method, bool is_virtual);
+
+ // Processing of command-line flags specific to the C2 compiler.
+ virtual bool is_intrinsic_disabled_by_flag(methodHandle method) {
+ return is_intrinsic_disabled_by_flag(method, NULL);
+ }
+
+ virtual bool is_intrinsic_disabled_by_flag(methodHandle method, methodHandle compilation_context);
+
// Initial size of the code buffer (may be increased at runtime)
static int initial_code_buffer_size();
};
--- a/hotspot/src/share/vm/opto/library_call.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/opto/library_call.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -31,6 +31,7 @@
#include "oops/objArrayKlass.hpp"
#include "opto/addnode.hpp"
#include "opto/arraycopynode.hpp"
+#include "opto/c2compiler.hpp"
#include "opto/callGenerator.hpp"
#include "opto/castnode.hpp"
#include "opto/cfgnode.hpp"
@@ -305,330 +306,40 @@
bool inline_isCompileConstant();
};
-
//---------------------------make_vm_intrinsic----------------------------
CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
vmIntrinsics::ID id = m->intrinsic_id();
assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
- ccstr disable_intr = NULL;
-
- if ((DisableIntrinsic[0] != '\0'
- && strstr(DisableIntrinsic, vmIntrinsics::name_at(id)) != NULL) ||
- (method_has_option_value("DisableIntrinsic", disable_intr)
- && strstr(disable_intr, vmIntrinsics::name_at(id)) != NULL)) {
- // disabled by a user request on the command line:
- // example: -XX:DisableIntrinsic=_hashCode,_getClass
- return NULL;
- }
-
if (!m->is_loaded()) {
- // do not attempt to inline unloaded methods
- return NULL;
- }
-
- // Only a few intrinsics implement a virtual dispatch.
- // They are expensive calls which are also frequently overridden.
- if (is_virtual) {
- switch (id) {
- case vmIntrinsics::_hashCode:
- case vmIntrinsics::_clone:
- // OK, Object.hashCode and Object.clone intrinsics come in both flavors
- break;
- default:
- return NULL;
- }
- }
-
- // -XX:-InlineNatives disables nearly all intrinsics:
- if (!InlineNatives) {
- switch (id) {
- case vmIntrinsics::_indexOf:
- case vmIntrinsics::_compareTo:
- case vmIntrinsics::_equals:
- case vmIntrinsics::_equalsC:
- case vmIntrinsics::_getAndAddInt:
- case vmIntrinsics::_getAndAddLong:
- case vmIntrinsics::_getAndSetInt:
- case vmIntrinsics::_getAndSetLong:
- case vmIntrinsics::_getAndSetObject:
- case vmIntrinsics::_loadFence:
- case vmIntrinsics::_storeFence:
- case vmIntrinsics::_fullFence:
- break; // InlineNatives does not control String.compareTo
- case vmIntrinsics::_Reference_get:
- break; // InlineNatives does not control Reference.get
- default:
- return NULL;
- }
- }
-
- int predicates = 0;
- bool does_virtual_dispatch = false;
-
- switch (id) {
- case vmIntrinsics::_compareTo:
- if (!SpecialStringCompareTo) return NULL;
- if (!Matcher::match_rule_supported(Op_StrComp)) return NULL;
- break;
- case vmIntrinsics::_indexOf:
- if (!SpecialStringIndexOf) return NULL;
- break;
- case vmIntrinsics::_equals:
- if (!SpecialStringEquals) return NULL;
- if (!Matcher::match_rule_supported(Op_StrEquals)) return NULL;
- break;
- case vmIntrinsics::_equalsC:
- if (!SpecialArraysEquals) return NULL;
- if (!Matcher::match_rule_supported(Op_AryEq)) return NULL;
- break;
- case vmIntrinsics::_arraycopy:
- if (!InlineArrayCopy) return NULL;
- break;
- case vmIntrinsics::_copyMemory:
- if (StubRoutines::unsafe_arraycopy() == NULL) return NULL;
- if (!InlineArrayCopy) return NULL;
- break;
- case vmIntrinsics::_hashCode:
- if (!InlineObjectHash) return NULL;
- does_virtual_dispatch = true;
- break;
- case vmIntrinsics::_clone:
- does_virtual_dispatch = true;
- case vmIntrinsics::_copyOf:
- case vmIntrinsics::_copyOfRange:
- if (!InlineObjectCopy) return NULL;
- // These also use the arraycopy intrinsic mechanism:
- if (!InlineArrayCopy) return NULL;
- break;
- case vmIntrinsics::_encodeISOArray:
- if (!SpecialEncodeISOArray) return NULL;
- if (!Matcher::match_rule_supported(Op_EncodeISOArray)) return NULL;
- break;
- case vmIntrinsics::_checkIndex:
- // We do not intrinsify this. The optimizer does fine with it.
+ // Do not attempt to inline unloaded methods.
return NULL;
-
- case vmIntrinsics::_getCallerClass:
- if (!InlineReflectionGetCallerClass) return NULL;
- if (SystemDictionary::reflect_CallerSensitive_klass() == NULL) return NULL;
- break;
-
- case vmIntrinsics::_bitCount_i:
- if (!Matcher::match_rule_supported(Op_PopCountI)) return NULL;
- break;
-
- case vmIntrinsics::_bitCount_l:
- if (!Matcher::match_rule_supported(Op_PopCountL)) return NULL;
- break;
-
- case vmIntrinsics::_numberOfLeadingZeros_i:
- if (!Matcher::match_rule_supported(Op_CountLeadingZerosI)) return NULL;
- break;
-
- case vmIntrinsics::_numberOfLeadingZeros_l:
- if (!Matcher::match_rule_supported(Op_CountLeadingZerosL)) return NULL;
- break;
-
- case vmIntrinsics::_numberOfTrailingZeros_i:
- if (!Matcher::match_rule_supported(Op_CountTrailingZerosI)) return NULL;
- break;
-
- case vmIntrinsics::_numberOfTrailingZeros_l:
- if (!Matcher::match_rule_supported(Op_CountTrailingZerosL)) return NULL;
- break;
-
- case vmIntrinsics::_reverseBytes_c:
- if (!Matcher::match_rule_supported(Op_ReverseBytesUS)) return NULL;
- break;
- case vmIntrinsics::_reverseBytes_s:
- if (!Matcher::match_rule_supported(Op_ReverseBytesS)) return NULL;
- break;
- case vmIntrinsics::_reverseBytes_i:
- if (!Matcher::match_rule_supported(Op_ReverseBytesI)) return NULL;
- break;
- case vmIntrinsics::_reverseBytes_l:
- if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return NULL;
- break;
-
- case vmIntrinsics::_Reference_get:
- // Use the intrinsic version of Reference.get() so that the value in
- // the referent field can be registered by the G1 pre-barrier code.
- // Also add memory barrier to prevent commoning reads from this field
- // across safepoint since GC can change it value.
- break;
-
- case vmIntrinsics::_compareAndSwapObject:
-#ifdef _LP64
- if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return NULL;
-#endif
- break;
-
- case vmIntrinsics::_compareAndSwapLong:
- if (!Matcher::match_rule_supported(Op_CompareAndSwapL)) return NULL;
- break;
-
- case vmIntrinsics::_getAndAddInt:
- if (!Matcher::match_rule_supported(Op_GetAndAddI)) return NULL;
- break;
-
- case vmIntrinsics::_getAndAddLong:
- if (!Matcher::match_rule_supported(Op_GetAndAddL)) return NULL;
- break;
-
- case vmIntrinsics::_getAndSetInt:
- if (!Matcher::match_rule_supported(Op_GetAndSetI)) return NULL;
- break;
-
- case vmIntrinsics::_getAndSetLong:
- if (!Matcher::match_rule_supported(Op_GetAndSetL)) return NULL;
- break;
-
- case vmIntrinsics::_getAndSetObject:
-#ifdef _LP64
- if (!UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetP)) return NULL;
- if (UseCompressedOops && !Matcher::match_rule_supported(Op_GetAndSetN)) return NULL;
- break;
-#else
- if (!Matcher::match_rule_supported(Op_GetAndSetP)) return NULL;
- break;
-#endif
-
- case vmIntrinsics::_aescrypt_encryptBlock:
- case vmIntrinsics::_aescrypt_decryptBlock:
- if (!UseAESIntrinsics) return NULL;
- break;
-
- case vmIntrinsics::_multiplyToLen:
- if (!UseMultiplyToLenIntrinsic) return NULL;
- break;
-
- case vmIntrinsics::_squareToLen:
- if (!UseSquareToLenIntrinsic) return NULL;
- break;
-
- case vmIntrinsics::_mulAdd:
- if (!UseMulAddIntrinsic) return NULL;
- break;
-
- case vmIntrinsics::_montgomeryMultiply:
- if (!UseMontgomeryMultiplyIntrinsic) return NULL;
- break;
- case vmIntrinsics::_montgomerySquare:
- if (!UseMontgomerySquareIntrinsic) return NULL;
- break;
-
- case vmIntrinsics::_cipherBlockChaining_encryptAESCrypt:
- case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
- if (!UseAESIntrinsics) return NULL;
- // these two require the predicated logic
- predicates = 1;
- break;
-
- case vmIntrinsics::_sha_implCompress:
- if (!UseSHA1Intrinsics) return NULL;
- break;
-
- case vmIntrinsics::_sha2_implCompress:
- if (!UseSHA256Intrinsics) return NULL;
- break;
-
- case vmIntrinsics::_sha5_implCompress:
- if (!UseSHA512Intrinsics) return NULL;
- break;
-
- case vmIntrinsics::_digestBase_implCompressMB:
- if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) return NULL;
- predicates = 3;
- break;
-
- case vmIntrinsics::_ghash_processBlocks:
- if (!UseGHASHIntrinsics) return NULL;
- break;
-
- case vmIntrinsics::_updateCRC32:
- case vmIntrinsics::_updateBytesCRC32:
- case vmIntrinsics::_updateByteBufferCRC32:
- if (!UseCRC32Intrinsics) return NULL;
- break;
-
- case vmIntrinsics::_updateBytesCRC32C:
- case vmIntrinsics::_updateDirectByteBufferCRC32C:
- if (!UseCRC32CIntrinsics) return NULL;
- break;
-
- case vmIntrinsics::_incrementExactI:
- case vmIntrinsics::_addExactI:
- if (!Matcher::match_rule_supported(Op_OverflowAddI) || !UseMathExactIntrinsics) return NULL;
- break;
- case vmIntrinsics::_incrementExactL:
- case vmIntrinsics::_addExactL:
- if (!Matcher::match_rule_supported(Op_OverflowAddL) || !UseMathExactIntrinsics) return NULL;
- break;
- case vmIntrinsics::_decrementExactI:
- case vmIntrinsics::_subtractExactI:
- if (!Matcher::match_rule_supported(Op_OverflowSubI) || !UseMathExactIntrinsics) return NULL;
- break;
- case vmIntrinsics::_decrementExactL:
- case vmIntrinsics::_subtractExactL:
- if (!Matcher::match_rule_supported(Op_OverflowSubL) || !UseMathExactIntrinsics) return NULL;
- break;
- case vmIntrinsics::_negateExactI:
- if (!Matcher::match_rule_supported(Op_OverflowSubI) || !UseMathExactIntrinsics) return NULL;
- break;
- case vmIntrinsics::_negateExactL:
- if (!Matcher::match_rule_supported(Op_OverflowSubL) || !UseMathExactIntrinsics) return NULL;
- break;
- case vmIntrinsics::_multiplyExactI:
- if (!Matcher::match_rule_supported(Op_OverflowMulI) || !UseMathExactIntrinsics) return NULL;
- break;
- case vmIntrinsics::_multiplyExactL:
- if (!Matcher::match_rule_supported(Op_OverflowMulL) || !UseMathExactIntrinsics) return NULL;
- break;
-
- case vmIntrinsics::_getShortUnaligned:
- case vmIntrinsics::_getCharUnaligned:
- case vmIntrinsics::_getIntUnaligned:
- case vmIntrinsics::_getLongUnaligned:
- case vmIntrinsics::_putShortUnaligned:
- case vmIntrinsics::_putCharUnaligned:
- case vmIntrinsics::_putIntUnaligned:
- case vmIntrinsics::_putLongUnaligned:
- if (!UseUnalignedAccesses) return NULL;
- break;
-
- default:
+ }
+
+ C2Compiler* compiler = (C2Compiler*)CompileBroker::compiler(CompLevel_full_optimization);
+ bool is_available = false;
+
+ {
+ // For calling is_intrinsic_supported and is_intrinsic_disabled_by_flag
+ // the compiler must transition to '_thread_in_vm' state because both
+ // methods access VM-internal data.
+ VM_ENTRY_MARK;
+ methodHandle mh(THREAD, m->get_Method());
+ methodHandle ct(THREAD, method()->get_Method());
+ is_available = compiler->is_intrinsic_supported(mh, is_virtual) &&
+ !compiler->is_intrinsic_disabled_by_flag(mh, ct);
+ }
+
+ if (is_available) {
assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
- break;
- }
-
- // -XX:-InlineClassNatives disables natives from the Class class.
- // The flag applies to all reflective calls, notably Array.newArray
- // (visible to Java programmers as Array.newInstance).
- if (m->holder()->name() == ciSymbol::java_lang_Class() ||
- m->holder()->name() == ciSymbol::java_lang_reflect_Array()) {
- if (!InlineClassNatives) return NULL;
- }
-
- // -XX:-InlineThreadNatives disables natives from the Thread class.
- if (m->holder()->name() == ciSymbol::java_lang_Thread()) {
- if (!InlineThreadNatives) return NULL;
- }
-
- // -XX:-InlineMathNatives disables natives from the Math,Float and Double classes.
- if (m->holder()->name() == ciSymbol::java_lang_Math() ||
- m->holder()->name() == ciSymbol::java_lang_Float() ||
- m->holder()->name() == ciSymbol::java_lang_Double()) {
- if (!InlineMathNatives) return NULL;
- }
-
- // -XX:-InlineUnsafeOps disables natives from the Unsafe class.
- if (m->holder()->name() == ciSymbol::sun_misc_Unsafe()) {
- if (!InlineUnsafeOps) return NULL;
- }
-
- return new LibraryIntrinsic(m, is_virtual, predicates, does_virtual_dispatch, (vmIntrinsics::ID) id);
+ return new LibraryIntrinsic(m, is_virtual,
+ vmIntrinsics::predicates_needed(id),
+ vmIntrinsics::does_virtual_dispatch(id),
+ (vmIntrinsics::ID) id);
+ } else {
+ return NULL;
+ }
}
//----------------------register_library_intrinsics-----------------------
@@ -812,7 +523,6 @@
case vmIntrinsics::_getLong: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, !is_volatile);
case vmIntrinsics::_getFloat: return inline_unsafe_access(!is_native_ptr, !is_store, T_FLOAT, !is_volatile);
case vmIntrinsics::_getDouble: return inline_unsafe_access(!is_native_ptr, !is_store, T_DOUBLE, !is_volatile);
-
case vmIntrinsics::_putObject: return inline_unsafe_access(!is_native_ptr, is_store, T_OBJECT, !is_volatile);
case vmIntrinsics::_putBoolean: return inline_unsafe_access(!is_native_ptr, is_store, T_BOOLEAN, !is_volatile);
case vmIntrinsics::_putByte: return inline_unsafe_access(!is_native_ptr, is_store, T_BYTE, !is_volatile);
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -2824,7 +2824,7 @@
if (klass->oop_is_instance()) {
InstanceKlass* ik = InstanceKlass::cast(klass);
- // ignore the class if it's has been initialized yet
+ // Ignore the class if it hasn't been initialized yet
if (!ik->is_linked()) {
return true;
}
--- a/hotspot/src/share/vm/prims/whitebox.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/prims/whitebox.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -528,6 +528,24 @@
return mh->queued_for_compilation();
WB_END
+WB_ENTRY(jboolean, WB_IsIntrinsicAvailable(JNIEnv* env, jobject o, jobject method, jobject compilation_context, jint compLevel))
+ if (compLevel < CompLevel_none || compLevel > CompLevel_highest_tier) {
+ return false; // Intrinsic is not available on a non-existent compilation level.
+ }
+ jmethodID method_id, compilation_context_id;
+ method_id = reflected_method_to_jmid(thread, env, method);
+ CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
+ methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(method_id));
+ if (compilation_context != NULL) {
+ compilation_context_id = reflected_method_to_jmid(thread, env, compilation_context);
+ CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
+ methodHandle cch(THREAD, Method::checked_resolve_jmethod_id(compilation_context_id));
+ return CompileBroker::compiler(compLevel)->is_intrinsic_available(mh, cch);
+ } else {
+ return CompileBroker::compiler(compLevel)->is_intrinsic_available(mh, NULL);
+ }
+WB_END
+
WB_ENTRY(jint, WB_GetMethodCompilationLevel(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
CHECK_JNI_EXCEPTION_(env, CompLevel_none);
@@ -1477,14 +1495,17 @@
#endif // INCLUDE_NMT
{CC"deoptimizeFrames", CC"(Z)I", (void*)&WB_DeoptimizeFrames },
{CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll },
- {CC"deoptimizeMethod0", CC"(Ljava/lang/reflect/Executable;Z)I",
- (void*)&WB_DeoptimizeMethod },
+ {CC"deoptimizeMethod0", CC"(Ljava/lang/reflect/Executable;Z)I",
+ (void*)&WB_DeoptimizeMethod },
{CC"isMethodCompiled0", CC"(Ljava/lang/reflect/Executable;Z)Z",
(void*)&WB_IsMethodCompiled },
{CC"isMethodCompilable0", CC"(Ljava/lang/reflect/Executable;IZ)Z",
(void*)&WB_IsMethodCompilable},
{CC"isMethodQueuedForCompilation0",
CC"(Ljava/lang/reflect/Executable;)Z", (void*)&WB_IsMethodQueuedForCompilation},
+ {CC"isIntrinsicAvailable0",
+ CC"(Ljava/lang/reflect/Executable;Ljava/lang/reflect/Executable;I)Z",
+ (void*)&WB_IsIntrinsicAvailable},
{CC"makeMethodNotCompilable0",
CC"(Ljava/lang/reflect/Executable;IZ)V", (void*)&WB_MakeMethodNotCompilable},
{CC"testSetDontInlineMethod0",
--- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -788,9 +788,11 @@
st->print_cr("VM Arguments:");
if (num_jvm_flags() > 0) {
st->print("jvm_flags: "); print_jvm_flags_on(st);
+ st->cr();
}
if (num_jvm_args() > 0) {
st->print("jvm_args: "); print_jvm_args_on(st);
+ st->cr();
}
st->print_cr("java_command: %s", java_command() ? java_command() : "<unknown>");
if (_java_class_path != NULL) {
@@ -800,12 +802,32 @@
st->print_cr("Launcher Type: %s", _sun_java_launcher);
}
+void Arguments::print_summary_on(outputStream* st) {
+ // Print the command line. Environment variables that are helpful for
+ // reproducing the problem are written later in the hs_err file.
+ // flags are from setting file
+ if (num_jvm_flags() > 0) {
+ st->print_raw("Settings File: ");
+ print_jvm_flags_on(st);
+ st->cr();
+ }
+ // args are the command line and environment variable arguments.
+ st->print_raw("Command Line: ");
+ if (num_jvm_args() > 0) {
+ print_jvm_args_on(st);
+ }
+ // this is the classfile and any arguments to the java program
+ if (java_command() != NULL) {
+ st->print("%s", java_command());
+ }
+ st->cr();
+}
+
void Arguments::print_jvm_flags_on(outputStream* st) {
if (_num_jvm_flags > 0) {
for (int i=0; i < _num_jvm_flags; i++) {
st->print("%s ", _jvm_flags_array[i]);
}
- st->cr();
}
}
@@ -814,7 +836,6 @@
for (int i=0; i < _num_jvm_args; i++) {
st->print("%s ", _jvm_args_array[i]);
}
- st->cr();
}
}
@@ -1205,32 +1226,6 @@
}
}
-/**
- * Returns the minimum number of compiler threads needed to run the JVM. The following
- * configurations are possible.
- *
- * 1) The JVM is build using an interpreter only. As a result, the minimum number of
- * compiler threads is 0.
- * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As
- * a result, either C1 or C2 is used, so the minimum number of compiler threads is 1.
- * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However,
- * the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only
- * C1 can be used, so the minimum number of compiler threads is 1.
- * 4) The JVM is build using the compilers and tiered compilation is enabled. The option
- * 'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result,
- * the minimum number of compiler threads is 2.
- */
-int Arguments::get_min_number_of_compiler_threads() {
-#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)
- return 0; // case 1
-#else
- if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) {
- return 1; // case 2 or case 3
- }
- return 2; // case 4 (tiered)
-#endif
-}
-
#if INCLUDE_ALL_GCS
static void disable_adaptive_size_policy(const char* collector_name) {
if (UseAdaptiveSizePolicy) {
@@ -2178,10 +2173,6 @@
status = false;
}
- int min_number_of_compiler_threads = get_min_number_of_compiler_threads();
- // The default CICompilerCount's value is CI_COMPILER_COUNT.
- assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
-
if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
}
@@ -3989,10 +3980,10 @@
return JNI_OK;
}
-// Any custom code post the final range and constraint check
+// Any custom code post the 'CommandLineFlagConstraint::AfterErgo' constraint check
// can be done here. We pass a flag that specifies whether
// the check passed successfully
-void Arguments::post_final_range_and_constraint_check(bool check_passed) {
+void Arguments::post_after_ergo_constraint_check(bool check_passed) {
// This does not set the flag itself, but stores the value in a safe place for later usage.
_min_heap_free_ratio = MinHeapFreeRatio;
_max_heap_free_ratio = MaxHeapFreeRatio;
--- a/hotspot/src/share/vm/runtime/arguments.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -445,9 +445,6 @@
static char* SharedArchivePath;
public:
- // Tiered
- static int get_min_number_of_compiler_threads();
-
// Scale compile thresholds
// Returns threshold scaled with CompileThresholdScaling
static intx scaled_compile_threshold(intx threshold, double scale);
@@ -466,8 +463,8 @@
static jint apply_ergo();
// Adjusts the arguments after the OS have adjusted the arguments
static jint adjust_after_os();
- // Set any arguments that need to be set after the final range and constraint check
- static void post_final_range_and_constraint_check(bool check_passed);
+ // Set any arguments that need to be set after the 'CommandLineFlagConstraint::AfterErgo' constraint check
+ static void post_after_ergo_constraint_check(bool check_passed);
static void set_gc_specific_flags();
static inline bool gc_selected(); // whether a gc has been selected
@@ -495,6 +492,7 @@
// print jvm_flags, jvm_args and java_command
static void print_on(outputStream* st);
+ static void print_summary_on(outputStream* st);
// convenient methods to obtain / print jvm_flags and jvm_args
static const char* jvm_flags() { return build_resource_string(_jvm_flags_array, _num_jvm_flags); }
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -39,7 +39,9 @@
public:
// the "name" argument must be a string literal
- CommandLineFlagConstraint_bool(const char* name, CommandLineFlagConstraintFunc_bool func) : CommandLineFlagConstraint(name) {
+ CommandLineFlagConstraint_bool(const char* name,
+ CommandLineFlagConstraintFunc_bool func,
+ ConstraintType type) : CommandLineFlagConstraint(name, type) {
_constraint=func;
}
@@ -53,7 +55,9 @@
public:
// the "name" argument must be a string literal
- CommandLineFlagConstraint_int(const char* name, CommandLineFlagConstraintFunc_int func) : CommandLineFlagConstraint(name) {
+ CommandLineFlagConstraint_int(const char* name,
+ CommandLineFlagConstraintFunc_int func,
+ ConstraintType type) : CommandLineFlagConstraint(name, type) {
_constraint=func;
}
@@ -67,7 +71,9 @@
public:
// the "name" argument must be a string literal
- CommandLineFlagConstraint_intx(const char* name, CommandLineFlagConstraintFunc_intx func) : CommandLineFlagConstraint(name) {
+ CommandLineFlagConstraint_intx(const char* name,
+ CommandLineFlagConstraintFunc_intx func,
+ ConstraintType type) : CommandLineFlagConstraint(name, type) {
_constraint=func;
}
@@ -81,7 +87,9 @@
public:
// the "name" argument must be a string literal
- CommandLineFlagConstraint_uint(const char* name, CommandLineFlagConstraintFunc_uint func) : CommandLineFlagConstraint(name) {
+ CommandLineFlagConstraint_uint(const char* name,
+ CommandLineFlagConstraintFunc_uint func,
+ ConstraintType type) : CommandLineFlagConstraint(name, type) {
_constraint=func;
}
@@ -95,7 +103,9 @@
public:
// the "name" argument must be a string literal
- CommandLineFlagConstraint_uintx(const char* name, CommandLineFlagConstraintFunc_uintx func) : CommandLineFlagConstraint(name) {
+ CommandLineFlagConstraint_uintx(const char* name,
+ CommandLineFlagConstraintFunc_uintx func,
+ ConstraintType type) : CommandLineFlagConstraint(name, type) {
_constraint=func;
}
@@ -109,7 +119,9 @@
public:
// the "name" argument must be a string literal
- CommandLineFlagConstraint_uint64_t(const char* name, CommandLineFlagConstraintFunc_uint64_t func) : CommandLineFlagConstraint(name) {
+ CommandLineFlagConstraint_uint64_t(const char* name,
+ CommandLineFlagConstraintFunc_uint64_t func,
+ ConstraintType type) : CommandLineFlagConstraint(name, type) {
_constraint=func;
}
@@ -123,7 +135,9 @@
public:
// the "name" argument must be a string literal
- CommandLineFlagConstraint_size_t(const char* name, CommandLineFlagConstraintFunc_size_t func) : CommandLineFlagConstraint(name) {
+ CommandLineFlagConstraint_size_t(const char* name,
+ CommandLineFlagConstraintFunc_size_t func,
+ ConstraintType type) : CommandLineFlagConstraint(name, type) {
_constraint=func;
}
@@ -137,7 +151,9 @@
public:
// the "name" argument must be a string literal
- CommandLineFlagConstraint_double(const char* name, CommandLineFlagConstraintFunc_double func) : CommandLineFlagConstraint(name) {
+ CommandLineFlagConstraint_double(const char* name,
+ CommandLineFlagConstraintFunc_double func,
+ ConstraintType type) : CommandLineFlagConstraint(name, type) {
_constraint=func;
}
@@ -162,29 +178,29 @@
void emit_constraint_double(const char* /*name*/) { /* NOP */ }
// CommandLineFlagConstraint emitting code functions if function argument is provided
-void emit_constraint_bool(const char* name, CommandLineFlagConstraintFunc_bool func) {
- CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_bool(name, func));
+void emit_constraint_bool(const char* name, CommandLineFlagConstraintFunc_bool func, CommandLineFlagConstraint::ConstraintType type) {
+ CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_bool(name, func, type));
}
-void emit_constraint_int(const char* name, CommandLineFlagConstraintFunc_int func) {
- CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_int(name, func));
+void emit_constraint_int(const char* name, CommandLineFlagConstraintFunc_int func, CommandLineFlagConstraint::ConstraintType type) {
+ CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_int(name, func, type));
}
-void emit_constraint_intx(const char* name, CommandLineFlagConstraintFunc_intx func) {
- CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_intx(name, func));
+void emit_constraint_intx(const char* name, CommandLineFlagConstraintFunc_intx func, CommandLineFlagConstraint::ConstraintType type) {
+ CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_intx(name, func, type));
}
-void emit_constraint_uint(const char* name, CommandLineFlagConstraintFunc_uint func) {
- CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uint(name, func));
+void emit_constraint_uint(const char* name, CommandLineFlagConstraintFunc_uint func, CommandLineFlagConstraint::ConstraintType type) {
+ CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uint(name, func, type));
}
-void emit_constraint_uintx(const char* name, CommandLineFlagConstraintFunc_uintx func) {
- CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uintx(name, func));
+void emit_constraint_uintx(const char* name, CommandLineFlagConstraintFunc_uintx func, CommandLineFlagConstraint::ConstraintType type) {
+ CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uintx(name, func, type));
}
-void emit_constraint_uint64_t(const char* name, CommandLineFlagConstraintFunc_uint64_t func) {
- CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uint64_t(name, func));
+void emit_constraint_uint64_t(const char* name, CommandLineFlagConstraintFunc_uint64_t func, CommandLineFlagConstraint::ConstraintType type) {
+ CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_uint64_t(name, func, type));
}
-void emit_constraint_size_t(const char* name, CommandLineFlagConstraintFunc_size_t func) {
- CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_size_t(name, func));
+void emit_constraint_size_t(const char* name, CommandLineFlagConstraintFunc_size_t func, CommandLineFlagConstraint::ConstraintType type) {
+ CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_size_t(name, func, type));
}
-void emit_constraint_double(const char* name, CommandLineFlagConstraintFunc_double func) {
- CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_double(name, func));
+void emit_constraint_double(const char* name, CommandLineFlagConstraintFunc_double func, CommandLineFlagConstraint::ConstraintType type) {
+ CommandLineFlagConstraintList::add(new CommandLineFlagConstraint_double(name, func, type));
}
// Generate code to call emit_constraint_xxx function
@@ -201,16 +217,17 @@
#define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_constraint_##type(#name
// Generate func argument to pass into emit_constraint_xxx functions
-#define EMIT_CONSTRAINT_CHECK(func) , func
+#define EMIT_CONSTRAINT_CHECK(func, type) , func, CommandLineFlagConstraint::type
// the "name" argument must be a string literal
-#define INITIAL_CONTRAINTS_SIZE 16
+#define INITIAL_CONSTRAINTS_SIZE 16
GrowableArray<CommandLineFlagConstraint*>* CommandLineFlagConstraintList::_constraints = NULL;
+CommandLineFlagConstraint::ConstraintType CommandLineFlagConstraintList::_validating_type = CommandLineFlagConstraint::AtParse;
// Check the ranges of all flags that have them or print them out and exit if requested
void CommandLineFlagConstraintList::init(void) {
- _constraints = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<CommandLineFlagConstraint*>(INITIAL_CONTRAINTS_SIZE, true);
+ _constraints = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<CommandLineFlagConstraint*>(INITIAL_CONSTRAINTS_SIZE, true);
emit_constraint_no(NULL RUNTIME_FLAGS(EMIT_CONSTRAINT_DEVELOPER_FLAG,
EMIT_CONSTRAINT_PD_DEVELOPER_FLAG,
@@ -273,14 +290,89 @@
#endif // INCLUDE_ALL_GCS
}
-CommandLineFlagConstraint* CommandLineFlagConstraintList::find(const char* name) {
+// Find constraints by name and return only if found constraint's type is equal or lower than current validating type.
+CommandLineFlagConstraint* CommandLineFlagConstraintList::find_if_needs_check(const char* name) {
CommandLineFlagConstraint* found = NULL;
for (int i=0; i<length(); i++) {
CommandLineFlagConstraint* constraint = at(i);
- if (strcmp(constraint->name(), name) == 0) {
+ if ((strcmp(constraint->name(), name) == 0) &&
+ (constraint->type() <= _validating_type)) {
found = constraint;
break;
}
}
return found;
}
+
+// Check constraints for specific constraint type.
+bool CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::ConstraintType type) {
+//#define PRINT_CONSTRAINTS_SIZES
+#ifdef PRINT_CONSTRAINTS_SIZES
+ {
+ size_t size_constraints = sizeof(CommandLineFlagConstraintList);
+ for (int i=0; i<length(); i++) {
+ size_constraints += sizeof(CommandLineFlagConstraint);
+ CommandLineFlagConstraint* constraint = at(i);
+ const char* name = constraint->name();
+ Flag* flag = Flag::find_flag(name, strlen(name), true, true);
+ if (flag->is_bool()) {
+ size_constraints += sizeof(CommandLineFlagConstraintFunc_bool);
+ size_constraints += sizeof(CommandLineFlagConstraint*);
+ } else if (flag->is_intx()) {
+ size_constraints += sizeof(CommandLineFlagConstraintFunc_intx);
+ size_constraints += sizeof(CommandLineFlagConstraint*);
+ } else if (flag->is_uintx()) {
+ size_constraints += sizeof(CommandLineFlagConstraintFunc_uintx);
+ size_constraints += sizeof(CommandLineFlagConstraint*);
+ } else if (flag->is_uint64_t()) {
+ size_constraints += sizeof(CommandLineFlagConstraintFunc_uint64_t);
+ size_constraints += sizeof(CommandLineFlagConstraint*);
+ } else if (flag->is_size_t()) {
+ size_constraints += sizeof(CommandLineFlagConstraintFunc_size_t);
+ size_constraints += sizeof(CommandLineFlagConstraint*);
+ } else if (flag->is_double()) {
+ size_constraints += sizeof(CommandLineFlagConstraintFunc_double);
+ size_constraints += sizeof(CommandLineFlagConstraint*);
+ }
+ }
+ fprintf(stderr, "Size of %d constraints: " SIZE_FORMAT " bytes\n",
+ length(), size_constraints);
+ }
+#endif // PRINT_CONSTRAINTS_SIZES
+
+ // Skip if we already checked.
+ if (type < _validating_type) {
+ return true;
+ }
+ _validating_type = type;
+
+ bool status = true;
+ for (int i=0; i<length(); i++) {
+ CommandLineFlagConstraint* constraint = at(i);
+ if (type != constraint->type()) continue;
+ const char*name = constraint->name();
+ Flag* flag = Flag::find_flag(name, strlen(name), true, true);
+ if (flag != NULL) {
+ if (flag->is_bool()) {
+ bool value = flag->get_bool();
+ if (constraint->apply_bool(&value, true) != Flag::SUCCESS) status = false;
+ } else if (flag->is_intx()) {
+ intx value = flag->get_intx();
+ if (constraint->apply_intx(&value, true) != Flag::SUCCESS) status = false;
+ } else if (flag->is_uintx()) {
+ uintx value = flag->get_uintx();
+ if (constraint->apply_uintx(&value, true) != Flag::SUCCESS) status = false;
+ } else if (flag->is_uint64_t()) {
+ uint64_t value = flag->get_uint64_t();
+ if (constraint->apply_uint64_t(&value, true) != Flag::SUCCESS) status = false;
+ } else if (flag->is_size_t()) {
+ size_t value = flag->get_size_t();
+ if (constraint->apply_size_t(&value, true) != Flag::SUCCESS) status = false;
+ } else if (flag->is_double()) {
+ double value = flag->get_double();
+ if (constraint->apply_double(&value, true) != Flag::SUCCESS) status = false;
+ }
+ }
+ }
+ return status;
+}
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -49,13 +49,27 @@
typedef Flag::Error (*CommandLineFlagConstraintFunc_double)(bool verbose, double* value);
class CommandLineFlagConstraint : public CHeapObj<mtInternal> {
+public:
+ // During VM initialization, constraint validation will be done order of ConstraintType.
+ enum ConstraintType {
+ // Will be validated during argument processing (Arguments::parse_argument).
+ AtParse = 0,
+ // Will be validated by CommandLineFlags::check_constraints_of_after_ergo().
+ AfterErgo = 1,
+ // Will be validated by CommandLineFlags::check_constraints_of_after_memory_init().
+ AfterMemoryInit = 2
+ };
+
private:
const char* _name;
+ ConstraintType _validate_type;
+
public:
// the "name" argument must be a string literal
- CommandLineFlagConstraint(const char* name) { _name=name; };
+ CommandLineFlagConstraint(const char* name, ConstraintType type) { _name=name; _validate_type=type; };
~CommandLineFlagConstraint() {};
- const char* name() { return _name; }
+ const char* name() const { return _name; }
+ ConstraintType type() const { return _validate_type; }
virtual Flag::Error apply_bool(bool* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_int(int* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
virtual Flag::Error apply_intx(intx* value, bool verbose = true) { ShouldNotReachHere(); return Flag::ERR_OTHER; };
@@ -69,12 +83,17 @@
class CommandLineFlagConstraintList : public AllStatic {
private:
static GrowableArray<CommandLineFlagConstraint*>* _constraints;
+ // Latest constraint validation type.
+ static CommandLineFlagConstraint::ConstraintType _validating_type;
public:
static void init();
static int length() { return (_constraints != NULL) ? _constraints->length() : 0; }
static CommandLineFlagConstraint* at(int i) { return (_constraints != NULL) ? _constraints->at(i) : NULL; }
- static CommandLineFlagConstraint* find(const char* name);
+ static CommandLineFlagConstraint* find_if_needs_check(const char* name);
static void add(CommandLineFlagConstraint* constraint) { _constraints->append(constraint); }
+ // True if 'AfterErgo' or later constraint functions are validated.
+ static bool validated_after_ergo() { return _validating_type >= CommandLineFlagConstraint::AfterErgo; };
+ static bool check_constraints(CommandLineFlagConstraint::ConstraintType type);
};
#endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTLIST_HPP */
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -29,16 +29,57 @@
#include "utilities/defaultStream.hpp"
Flag::Error AliasLevelConstraintFunc(bool verbose, intx* value) {
- if (CommandLineFlags::finishedInitializing() == true) {
- if ((*value <= 1) && (Arguments::mode() == Arguments::_comp)) {
- if (verbose == true) {
- jio_fprintf(defaultStream::error_stream(),
- "AliasLevel (" INTX_FORMAT ") is not compatible "
- "with -Xcomp \n",
- *value);
- }
- return Flag::VIOLATES_CONSTRAINT;
+ if ((*value <= 1) && (Arguments::mode() == Arguments::_comp)) {
+ if (verbose == true) {
+ jio_fprintf(defaultStream::error_stream(),
+ "AliasLevel (" INTX_FORMAT ") is not compatible "
+ "with -Xcomp \n",
+ *value);
}
+ return Flag::VIOLATES_CONSTRAINT;
+ } else {
+ return Flag::SUCCESS;
}
- return Flag::SUCCESS;
}
+
+/**
+ * Validate the minimum number of compiler threads needed to run the
+ * JVM. The following configurations are possible.
+ *
+ * 1) The JVM is build using an interpreter only. As a result, the minimum number of
+ * compiler threads is 0.
+ * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As
+ * a result, either C1 or C2 is used, so the minimum number of compiler threads is 1.
+ * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However,
+ * the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only
+ * C1 can be used, so the minimum number of compiler threads is 1.
+ * 4) The JVM is build using the compilers and tiered compilation is enabled. The option
+ * 'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result,
+ * the minimum number of compiler threads is 2.
+ */
+Flag::Error CICompilerCountConstraintFunc(bool verbose, intx* value) {
+ int min_number_of_compiler_threads = 0;
+#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)
+ // case 1
+#else
+ if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) {
+ min_number_of_compiler_threads = 1; // case 2 or case 3
+ } else {
+ min_number_of_compiler_threads = 2; // case 4 (tiered)
+ }
+#endif
+
+ // The default CICompilerCount's value is CI_COMPILER_COUNT.
+ assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
+
+ if (*value < (intx)min_number_of_compiler_threads) {
+ if (verbose == true) {
+ jio_fprintf(defaultStream::error_stream(),
+ "CICompilerCount=" INTX_FORMAT " must be at least %d \n",
+ *value, min_number_of_compiler_threads);
+ }
+ return Flag::VIOLATES_CONSTRAINT;
+ } else {
+ return Flag::SUCCESS;
+ }
+}
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -36,4 +36,6 @@
Flag::Error AliasLevelConstraintFunc(bool verbose, intx* value);
+Flag::Error CICompilerCountConstraintFunc(bool verbose, intx* value);
+
#endif /* SHARE_VM_RUNTIME_COMMANDLINEFLAGCONSTRAINTSCOMPILER_HPP */
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -30,6 +30,9 @@
#if INCLUDE_ALL_GCS
#include "gc/g1/g1_globals.hpp"
+#include "gc/g1/heapRegionBounds.inline.hpp"
+#include "gc/parallel/parallelScavengeHeap.hpp"
+#include "gc/shared/plab.hpp"
#endif // INCLUDE_ALL_GCS
#ifdef COMPILER1
#include "c1/c1_globals.hpp"
@@ -38,8 +41,49 @@
#include "opto/c2_globals.hpp"
#endif // COMPILER2
+static Flag::Error MinPLABSizeBounds(const char* name, bool verbose, size_t* value) {
+#if INCLUDE_ALL_GCS
+ if ((UseConcMarkSweepGC || UseG1GC) && (*value < PLAB::min_size())) {
+ if (verbose == true) {
+ jio_fprintf(defaultStream::error_stream(),
+ "%s (" SIZE_FORMAT ") must be greater than "
+ "ergonomic PLAB minimum size (" SIZE_FORMAT ")\n",
+ name, *value, PLAB::min_size());
+ }
+ return Flag::VIOLATES_CONSTRAINT;
+ }
+#endif // INCLUDE_ALL_GCS
+ return Flag::SUCCESS;
+}
+
+static Flag::Error MaxPLABSizeBounds(const char* name, bool verbose, size_t* value) {
+#if INCLUDE_ALL_GCS
+ if ((UseConcMarkSweepGC || UseG1GC) && (*value > PLAB::max_size())) {
+ if (verbose == true) {
+ jio_fprintf(defaultStream::error_stream(),
+ "%s (" SIZE_FORMAT ") must be less than "
+ "ergonomic PLAB maximum size (" SIZE_FORMAT ")\n",
+ name, *value, PLAB::max_size());
+ }
+ return Flag::VIOLATES_CONSTRAINT;
+ }
+#endif // INCLUDE_ALL_GCS
+ return Flag::SUCCESS;
+}
+
+static Flag::Error MinMaxPLABSizeBounds(const char* name, bool verbose, size_t* value) {
+ if (MinPLABSizeBounds(name, verbose, value) == Flag::SUCCESS) {
+ return MaxPLABSizeBounds(name, verbose, value);
+ }
+ return Flag::VIOLATES_CONSTRAINT;
+}
+
+Flag::Error YoungPLABSizeConstraintFunc(bool verbose, size_t* value) {
+ return MinMaxPLABSizeBounds("YoungPLABSize", verbose, value);
+}
+
Flag::Error MinHeapFreeRatioConstraintFunc(bool verbose, uintx* value) {
- if ((CommandLineFlags::finishedInitializing()) && (*value > MaxHeapFreeRatio)) {
+ if (*value > MaxHeapFreeRatio) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"MinHeapFreeRatio (" UINTX_FORMAT ") must be less than or "
@@ -53,7 +97,7 @@
}
Flag::Error MaxHeapFreeRatioConstraintFunc(bool verbose, uintx* value) {
- if ((CommandLineFlags::finishedInitializing()) && (*value < MinHeapFreeRatio)) {
+ if (*value < MinHeapFreeRatio) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"MaxHeapFreeRatio (" UINTX_FORMAT ") must be greater than or "
@@ -67,7 +111,7 @@
}
Flag::Error MinMetaspaceFreeRatioConstraintFunc(bool verbose, uintx* value) {
- if ((CommandLineFlags::finishedInitializing()) && (*value > MaxMetaspaceFreeRatio)) {
+ if (*value > MaxMetaspaceFreeRatio) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"MinMetaspaceFreeRatio (" UINTX_FORMAT ") must be less than or "
@@ -81,7 +125,7 @@
}
Flag::Error MaxMetaspaceFreeRatioConstraintFunc(bool verbose, uintx* value) {
- if ((CommandLineFlags::finishedInitializing()) && (*value < MinMetaspaceFreeRatio)) {
+ if (*value < MinMetaspaceFreeRatio) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"MaxMetaspaceFreeRatio (" UINTX_FORMAT ") must be greater than or "
@@ -106,7 +150,7 @@
Flag::Error InitialTenuringThresholdConstraintFunc(bool verbose, uintx* value) {
UseConcMarkSweepGCWorkaroundIfNeeded(*value, MaxTenuringThreshold);
- if ((CommandLineFlags::finishedInitializing()) && (*value > MaxTenuringThreshold)) {
+ if (*value > MaxTenuringThreshold) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"InitialTenuringThreshold (" UINTX_FORMAT ") must be less than or "
@@ -122,7 +166,7 @@
Flag::Error MaxTenuringThresholdConstraintFunc(bool verbose, uintx* value) {
UseConcMarkSweepGCWorkaroundIfNeeded(InitialTenuringThreshold, *value);
- if ((CommandLineFlags::finishedInitializing()) && (*value < InitialTenuringThreshold)) {
+ if (*value < InitialTenuringThreshold) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"MaxTenuringThreshold (" UINTX_FORMAT ") must be greater than or "
@@ -136,9 +180,8 @@
}
#if INCLUDE_ALL_GCS
-
Flag::Error G1NewSizePercentConstraintFunc(bool verbose, uintx* value) {
- if ((CommandLineFlags::finishedInitializing()) && (*value > G1MaxNewSizePercent)) {
+ if (*value > G1MaxNewSizePercent) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"G1NewSizePercent (" UINTX_FORMAT ") must be less than or "
@@ -152,7 +195,7 @@
}
Flag::Error G1MaxNewSizePercentConstraintFunc(bool verbose, uintx* value) {
- if ((CommandLineFlags::finishedInitializing()) && (*value < G1NewSizePercent)) {
+ if (*value < G1NewSizePercent) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"G1MaxNewSizePercent (" UINTX_FORMAT ") must be greater than or "
@@ -168,7 +211,7 @@
#endif // INCLUDE_ALL_GCS
Flag::Error CMSOldPLABMinConstraintFunc(bool verbose, size_t* value) {
- if ((CommandLineFlags::finishedInitializing()) && (*value > CMSOldPLABMax)) {
+ if (*value > CMSOldPLABMax) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"CMSOldPLABMin (" SIZE_FORMAT ") must be less than or "
@@ -182,7 +225,7 @@
}
Flag::Error CMSPrecleanDenominatorConstraintFunc(bool verbose, uintx* value) {
- if ((CommandLineFlags::finishedInitializing()) && (*value <= CMSPrecleanNumerator)) {
+ if (*value <= CMSPrecleanNumerator) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"CMSPrecleanDenominator (" UINTX_FORMAT ") must be strickly greater than "
@@ -196,7 +239,7 @@
}
Flag::Error CMSPrecleanNumeratorConstraintFunc(bool verbose, uintx* value) {
- if ((CommandLineFlags::finishedInitializing()) && (*value > (CMSPrecleanDenominator - 1))) {
+ if (*value > (CMSPrecleanDenominator - 1)) {
if (verbose == true) {
jio_fprintf(defaultStream::error_stream(),
"CMSPrecleanNumerator (" UINTX_FORMAT ") must be less than or "
@@ -210,25 +253,23 @@
}
Flag::Error SurvivorAlignmentInBytesConstraintFunc(bool verbose, intx* value) {
- if (CommandLineFlags::finishedInitializing()) {
- if (*value != 0) {
- if (!is_power_of_2(*value)) {
- if (verbose == true) {
- jio_fprintf(defaultStream::error_stream(),
- "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be power of 2\n",
- *value);
- }
- return Flag::VIOLATES_CONSTRAINT;
+ if (*value != 0) {
+ if (!is_power_of_2(*value)) {
+ if (verbose == true) {
+ jio_fprintf(defaultStream::error_stream(),
+ "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be power of 2\n",
+ *value);
}
- if (*value < ObjectAlignmentInBytes) {
- if (verbose == true) {
- jio_fprintf(defaultStream::error_stream(),
- "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be greater than or "
- "equal to ObjectAlignmentInBytes (" INTX_FORMAT ") \n",
- *value, ObjectAlignmentInBytes);
- }
- return Flag::VIOLATES_CONSTRAINT;
+ return Flag::VIOLATES_CONSTRAINT;
+ }
+ if (*value < ObjectAlignmentInBytes) {
+ if (verbose == true) {
+ jio_fprintf(defaultStream::error_stream(),
+ "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be greater than or "
+ "equal to ObjectAlignmentInBytes (" INTX_FORMAT ")\n",
+ *value, ObjectAlignmentInBytes);
}
+ return Flag::VIOLATES_CONSTRAINT;
}
}
return Flag::SUCCESS;
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -34,6 +34,8 @@
* an appropriate error value.
*/
+Flag::Error YoungPLABSizeConstraintFunc(bool verbose, size_t* value);
+
Flag::Error MinHeapFreeRatioConstraintFunc(bool verbose, uintx* value);
Flag::Error MaxHeapFreeRatioConstraintFunc(bool verbose, uintx* value);
--- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -365,3 +365,63 @@
st->print("[ ... ]");
}
}
+
+bool CommandLineFlagRangeList::check_ranges() {
+//#define PRINT_RANGES_SIZES
+#ifdef PRINT_RANGES_SIZES
+ {
+ size_t size_ranges = sizeof(CommandLineFlagRangeList);
+ for (int i=0; i<length(); i++) {
+ size_ranges += sizeof(CommandLineFlagRange);
+ CommandLineFlagRange* range = at(i);
+ const char* name = range->name();
+ Flag* flag = Flag::find_flag(name, strlen(name), true, true);
+ if (flag->is_intx()) {
+ size_ranges += 2*sizeof(intx);
+ size_ranges += sizeof(CommandLineFlagRange*);
+ } else if (flag->is_uintx()) {
+ size_ranges += 2*sizeof(uintx);
+ size_ranges += sizeof(CommandLineFlagRange*);
+ } else if (flag->is_uint64_t()) {
+ size_ranges += 2*sizeof(uint64_t);
+ size_ranges += sizeof(CommandLineFlagRange*);
+ } else if (flag->is_size_t()) {
+ size_ranges += 2*sizeof(size_t);
+ size_ranges += sizeof(CommandLineFlagRange*);
+ } else if (flag->is_double()) {
+ size_ranges += 2*sizeof(double);
+ size_ranges += sizeof(CommandLineFlagRange*);
+ }
+ }
+ fprintf(stderr, "Size of %d ranges: " SIZE_FORMAT " bytes\n",
+ length(), size_ranges);
+ }
+#endif // PRINT_RANGES_SIZES
+
+ // Check ranges.
+ bool status = true;
+ for (int i=0; i<length(); i++) {
+ CommandLineFlagRange* range = at(i);
+ const char* name = range->name();
+ Flag* flag = Flag::find_flag(name, strlen(name), true, true);
+ if (flag != NULL) {
+ if (flag->is_intx()) {
+ intx value = flag->get_intx();
+ if (range->check_intx(value, true) != Flag::SUCCESS) status = false;
+ } else if (flag->is_uintx()) {
+ uintx value = flag->get_uintx();
+ if (range->check_uintx(value, true) != Flag::SUCCESS) status = false;
+ } else if (flag->is_uint64_t()) {
+ uint64_t value = flag->get_uint64_t();
+ if (range->check_uint64_t(value, true) != Flag::SUCCESS) status = false;
+ } else if (flag->is_size_t()) {
+ size_t value = flag->get_size_t();
+ if (range->check_size_t(value, true) != Flag::SUCCESS) status = false;
+ } else if (flag->is_double()) {
+ double value = flag->get_double();
+ if (range->check_double(value, true) != Flag::SUCCESS) status = false;
+ }
+ }
+ }
+ return status;
+}
--- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -66,6 +66,8 @@
static CommandLineFlagRange* find(const char* name);
static void add(CommandLineFlagRange* range) { _ranges->append(range); }
static void print(const char* name, outputStream* st, bool unspecified = false);
+ // Check the final values of all flags for ranges.
+ static bool check_ranges();
};
#endif // SHARE_VM_RUNTIME_COMMANDLINEFLAGRANGELIST_HPP
--- a/hotspot/src/share/vm/runtime/globals.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/globals.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -770,7 +770,7 @@
static Flag::Error apply_constraint_and_check_range_bool(const char* name, bool* new_value, bool verbose = true) {
Flag::Error status = Flag::SUCCESS;
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name);
+ CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
if (constraint != NULL) {
status = constraint->apply_bool(new_value, verbose);
}
@@ -789,7 +789,7 @@
Flag* result = Flag::find_flag(name, len);
if (result == NULL) return Flag::INVALID_FLAG;
if (!result->is_bool()) return Flag::WRONG_FORMAT;
- Flag::Error check = apply_constraint_and_check_range_bool(name, value, !CommandLineFlags::finishedInitializing());
+ Flag::Error check = apply_constraint_and_check_range_bool(name, value, !CommandLineFlagConstraintList::validated_after_ergo());
if (check != Flag::SUCCESS) return check;
bool old_value = result->get_bool();
trace_flag_changed<EventBooleanFlagChanged, bool>(name, old_value, *value, origin);
@@ -817,7 +817,7 @@
range_status = range->check_int(*new_value, verbose);
}
Flag::Error constraint_status = Flag::SUCCESS;
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name);
+ CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
if (constraint != NULL) {
constraint_status = constraint->apply_int(new_value, verbose);
}
@@ -836,7 +836,7 @@
Flag* result = Flag::find_flag(name, len);
if (result == NULL) return Flag::INVALID_FLAG;
if (!result->is_int()) return Flag::WRONG_FORMAT;
- Flag::Error check = apply_constraint_and_check_range_int(name, value, !CommandLineFlags::finishedInitializing());
+ Flag::Error check = apply_constraint_and_check_range_int(name, value, !CommandLineFlagConstraintList::validated_after_ergo());
if (check != Flag::SUCCESS) return check;
int old_value = result->get_int();
trace_flag_changed<EventIntFlagChanged, s4>(name, old_value, *value, origin);
@@ -862,7 +862,7 @@
range_status = range->check_uint(*new_value, verbose);
}
Flag::Error constraint_status = Flag::SUCCESS;
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name);
+ CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
if (constraint != NULL) {
constraint_status = constraint->apply_uint(new_value, verbose);
}
@@ -881,7 +881,7 @@
Flag* result = Flag::find_flag(name, len);
if (result == NULL) return Flag::INVALID_FLAG;
if (!result->is_uint()) return Flag::WRONG_FORMAT;
- Flag::Error check = apply_constraint_and_check_range_uint(name, value, !CommandLineFlags::finishedInitializing());
+ Flag::Error check = apply_constraint_and_check_range_uint(name, value, !CommandLineFlagConstraintList::validated_after_ergo());
if (check != Flag::SUCCESS) return check;
uint old_value = result->get_uint();
trace_flag_changed<EventUnsignedIntFlagChanged, u4>(name, old_value, *value, origin);
@@ -915,7 +915,7 @@
range_status = range->check_intx(*new_value, verbose);
}
Flag::Error constraint_status = Flag::SUCCESS;
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name);
+ CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
if (constraint != NULL) {
constraint_status = constraint->apply_intx(new_value, verbose);
}
@@ -926,7 +926,7 @@
Flag* result = Flag::find_flag(name, len);
if (result == NULL) return Flag::INVALID_FLAG;
if (!result->is_intx()) return Flag::WRONG_FORMAT;
- Flag::Error check = apply_constraint_and_check_range_intx(name, value, !CommandLineFlags::finishedInitializing());
+ Flag::Error check = apply_constraint_and_check_range_intx(name, value, !CommandLineFlagConstraintList::validated_after_ergo());
if (check != Flag::SUCCESS) return check;
intx old_value = result->get_intx();
trace_flag_changed<EventLongFlagChanged, intx>(name, old_value, *value, origin);
@@ -962,7 +962,7 @@
range_status = range->check_uintx(*new_value, verbose);
}
Flag::Error constraint_status = Flag::SUCCESS;
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name);
+ CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
if (constraint != NULL) {
constraint_status = constraint->apply_uintx(new_value, verbose);
}
@@ -973,7 +973,7 @@
Flag* result = Flag::find_flag(name, len);
if (result == NULL) return Flag::INVALID_FLAG;
if (!result->is_uintx()) return Flag::WRONG_FORMAT;
- Flag::Error check = apply_constraint_and_check_range_uintx(name, value, !CommandLineFlags::finishedInitializing());
+ Flag::Error check = apply_constraint_and_check_range_uintx(name, value, !CommandLineFlagConstraintList::validated_after_ergo());
if (check != Flag::SUCCESS) return check;
uintx old_value = result->get_uintx();
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
@@ -1009,7 +1009,7 @@
range_status = range->check_uint64_t(*new_value, verbose);
}
Flag::Error constraint_status = Flag::SUCCESS;
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name);
+ CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
if (constraint != NULL) {
constraint_status = constraint->apply_uint64_t(new_value, verbose);
}
@@ -1020,7 +1020,7 @@
Flag* result = Flag::find_flag(name, len);
if (result == NULL) return Flag::INVALID_FLAG;
if (!result->is_uint64_t()) return Flag::WRONG_FORMAT;
- Flag::Error check = apply_constraint_and_check_range_uint64_t(name, value, !CommandLineFlags::finishedInitializing());
+ Flag::Error check = apply_constraint_and_check_range_uint64_t(name, value, !CommandLineFlagConstraintList::validated_after_ergo());
if (check != Flag::SUCCESS) return check;
uint64_t old_value = result->get_uint64_t();
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
@@ -1056,7 +1056,7 @@
range_status = range->check_size_t(*new_value, verbose);
}
Flag::Error constraint_status = Flag::SUCCESS;
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name);
+ CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
if (constraint != NULL) {
constraint_status = constraint->apply_size_t(new_value, verbose);
}
@@ -1067,7 +1067,7 @@
Flag* result = Flag::find_flag(name, len);
if (result == NULL) return Flag::INVALID_FLAG;
if (!result->is_size_t()) return Flag::WRONG_FORMAT;
- Flag::Error check = apply_constraint_and_check_range_size_t(name, value, !CommandLineFlags::finishedInitializing());
+ Flag::Error check = apply_constraint_and_check_range_size_t(name, value, !CommandLineFlagConstraintList::validated_after_ergo());
if (check != Flag::SUCCESS) return check;
size_t old_value = result->get_size_t();
trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
@@ -1103,7 +1103,7 @@
range_status = range->check_double(*new_value, verbose);
}
Flag::Error constraint_status = Flag::SUCCESS;
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find(name);
+ CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::find_if_needs_check(name);
if (constraint != NULL) {
constraint_status = constraint->apply_double(new_value, verbose);
}
@@ -1114,7 +1114,7 @@
Flag* result = Flag::find_flag(name, len);
if (result == NULL) return Flag::INVALID_FLAG;
if (!result->is_double()) return Flag::WRONG_FORMAT;
- Flag::Error check = apply_constraint_and_check_range_double(name, value, !CommandLineFlags::finishedInitializing());
+ Flag::Error check = apply_constraint_and_check_range_double(name, value, !CommandLineFlagConstraintList::validated_after_ergo());
if (check != Flag::SUCCESS) return check;
double old_value = result->get_double();
trace_flag_changed<EventDoubleFlagChanged, double>(name, old_value, *value, origin);
@@ -1127,7 +1127,7 @@
Flag::Error CommandLineFlagsEx::doubleAtPut(CommandLineFlagWithType flag, double value, Flag::Flags origin) {
Flag* faddr = address_of_flag(flag);
guarantee(faddr != NULL && faddr->is_double(), "wrong flag type");
- Flag::Error check = apply_constraint_and_check_range_double(faddr->_name, &value, !CommandLineFlags::finishedInitializing());
+ Flag::Error check = apply_constraint_and_check_range_double(faddr->_name, &value);
if (check != Flag::SUCCESS) return check;
trace_flag_changed<EventDoubleFlagChanged, double>(faddr->_name, faddr->get_double(), value, origin);
faddr->set_double(value);
@@ -1210,129 +1210,6 @@
FREE_C_HEAP_ARRAY(Flag*, array);
}
-bool CommandLineFlags::_finished_initializing = false;
-
-bool CommandLineFlags::check_all_ranges_and_constraints() {
-
-//#define PRINT_RANGES_AND_CONSTRAINTS_SIZES
-#ifdef PRINT_RANGES_AND_CONSTRAINTS_SIZES
- {
- size_t size_ranges = sizeof(CommandLineFlagRangeList);
- for (int i=0; i<CommandLineFlagRangeList::length(); i++) {
- size_ranges += sizeof(CommandLineFlagRange);
- CommandLineFlagRange* range = CommandLineFlagRangeList::at(i);
- const char* name = range->name();
- Flag* flag = Flag::find_flag(name, strlen(name), true, true);
- if (flag->is_intx()) {
- size_ranges += 2*sizeof(intx);
- size_ranges += sizeof(CommandLineFlagRange*);
- } else if (flag->is_uintx()) {
- size_ranges += 2*sizeof(uintx);
- size_ranges += sizeof(CommandLineFlagRange*);
- } else if (flag->is_uint64_t()) {
- size_ranges += 2*sizeof(uint64_t);
- size_ranges += sizeof(CommandLineFlagRange*);
- } else if (flag->is_size_t()) {
- size_ranges += 2*sizeof(size_t);
- size_ranges += sizeof(CommandLineFlagRange*);
- } else if (flag->is_double()) {
- size_ranges += 2*sizeof(double);
- size_ranges += sizeof(CommandLineFlagRange*);
- }
- }
- fprintf(stderr, "Size of %d ranges: " SIZE_FORMAT " bytes\n",
- CommandLineFlagRangeList::length(), size_ranges);
- }
- {
- size_t size_constraints = sizeof(CommandLineFlagConstraintList);
- for (int i=0; i<CommandLineFlagConstraintList::length(); i++) {
- size_constraints += sizeof(CommandLineFlagConstraint);
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::at(i);
- const char* name = constraint->name();
- Flag* flag = Flag::find_flag(name, strlen(name), true, true);
- if (flag->is_bool()) {
- size_constraints += sizeof(CommandLineFlagConstraintFunc_bool);
- size_constraints += sizeof(CommandLineFlagConstraint*);
- } else if (flag->is_intx()) {
- size_constraints += sizeof(CommandLineFlagConstraintFunc_intx);
- size_constraints += sizeof(CommandLineFlagConstraint*);
- } else if (flag->is_uintx()) {
- size_constraints += sizeof(CommandLineFlagConstraintFunc_uintx);
- size_constraints += sizeof(CommandLineFlagConstraint*);
- } else if (flag->is_uint64_t()) {
- size_constraints += sizeof(CommandLineFlagConstraintFunc_uint64_t);
- size_constraints += sizeof(CommandLineFlagConstraint*);
- } else if (flag->is_size_t()) {
- size_constraints += sizeof(CommandLineFlagConstraintFunc_size_t);
- size_constraints += sizeof(CommandLineFlagConstraint*);
- } else if (flag->is_double()) {
- size_constraints += sizeof(CommandLineFlagConstraintFunc_double);
- size_constraints += sizeof(CommandLineFlagConstraint*);
- }
- }
- fprintf(stderr, "Size of %d constraints: " SIZE_FORMAT " bytes\n",
- CommandLineFlagConstraintList::length(), size_constraints);
- }
-#endif // PRINT_RANGES_AND_CONSTRAINTS_SIZES
-
- _finished_initializing = true;
-
- bool status = true;
- for (int i=0; i<CommandLineFlagRangeList::length(); i++) {
- CommandLineFlagRange* range = CommandLineFlagRangeList::at(i);
- const char* name = range->name();
- Flag* flag = Flag::find_flag(name, strlen(name), true, true);
- if (flag != NULL) {
- if (flag->is_intx()) {
- intx value = flag->get_intx();
- if (range->check_intx(value, true) != Flag::SUCCESS) status = false;
- } else if (flag->is_uintx()) {
- uintx value = flag->get_uintx();
- if (range->check_uintx(value, true) != Flag::SUCCESS) status = false;
- } else if (flag->is_uint64_t()) {
- uint64_t value = flag->get_uint64_t();
- if (range->check_uint64_t(value, true) != Flag::SUCCESS) status = false;
- } else if (flag->is_size_t()) {
- size_t value = flag->get_size_t();
- if (range->check_size_t(value, true) != Flag::SUCCESS) status = false;
- } else if (flag->is_double()) {
- double value = flag->get_double();
- if (range->check_double(value, true) != Flag::SUCCESS) status = false;
- }
- }
- }
- for (int i=0; i<CommandLineFlagConstraintList::length(); i++) {
- CommandLineFlagConstraint* constraint = CommandLineFlagConstraintList::at(i);
- const char*name = constraint->name();
- Flag* flag = Flag::find_flag(name, strlen(name), true, true);
- if (flag != NULL) {
- if (flag->is_bool()) {
- bool value = flag->get_bool();
- if (constraint->apply_bool(&value, true) != Flag::SUCCESS) status = false;
- } else if (flag->is_intx()) {
- intx value = flag->get_intx();
- if (constraint->apply_intx(&value, true) != Flag::SUCCESS) status = false;
- } else if (flag->is_uintx()) {
- uintx value = flag->get_uintx();
- if (constraint->apply_uintx(&value, true) != Flag::SUCCESS) status = false;
- } else if (flag->is_uint64_t()) {
- uint64_t value = flag->get_uint64_t();
- if (constraint->apply_uint64_t(&value, true) != Flag::SUCCESS) status = false;
- } else if (flag->is_size_t()) {
- size_t value = flag->get_size_t();
- if (constraint->apply_size_t(&value, true) != Flag::SUCCESS) status = false;
- } else if (flag->is_double()) {
- double value = flag->get_double();
- if (constraint->apply_double(&value, true) != Flag::SUCCESS) status = false;
- }
- }
- }
-
- Arguments::post_final_range_and_constraint_check(status);
-
- return status;
-}
-
#ifndef PRODUCT
void CommandLineFlags::verify() {
--- a/hotspot/src/share/vm/runtime/globals.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -450,7 +450,6 @@
class CommandLineFlags {
- static bool _finished_initializing;
public:
static Flag::Error boolAt(const char* name, size_t len, bool* value, bool allow_locked = false, bool return_flag = false);
static Flag::Error boolAt(const char* name, bool* value, bool allow_locked = false, bool return_flag = false) { return boolAt(name, strlen(name), value, allow_locked, return_flag); }
@@ -506,12 +505,6 @@
// printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
static void printFlags(outputStream* out, bool withComments, bool printRanges = false);
- // Returns true if all flags have their final values set (ready for ranges and constraint check)
- static bool finishedInitializing() { return _finished_initializing; }
-
- // Check the final values of all flags for ranges and constraints
- static bool check_all_ranges_and_constraints();
-
static void verify() PRODUCT_RETURN;
};
@@ -640,7 +633,7 @@
lp64_product(intx, ObjectAlignmentInBytes, 8, \
"Default object alignment in bytes, 8 is minimum") \
range(8, 256) \
- constraint(ObjectAlignmentInBytesConstraintFunc) \
+ constraint(ObjectAlignmentInBytesConstraintFunc,AtParse) \
\
product(bool, AssumeMP, false, \
"Instruct the VM to assume multiple processors are available") \
@@ -1286,7 +1279,7 @@
\
experimental(intx, SyncVerbose, 0, "(Unstable)") \
\
- product(bool, InlineNotify, true, "intrinsify subset of notify" ) \
+ diagnostic(bool, InlineNotify, true, "intrinsify subset of notify") \
\
experimental(intx, ClearFPUAtPark, 0, "(Unsafe, Unstable)") \
\
@@ -1396,7 +1389,7 @@
product(intx, ContendedPaddingWidth, 128, \
"How many bytes to pad the fields/classes marked @Contended with")\
range(0, 8192) \
- constraint(ContendedPaddingWidthConstraintFunc) \
+ constraint(ContendedPaddingWidthConstraintFunc,AtParse) \
\
product(bool, EnableContended, true, \
"Enable @Contended annotation support") \
@@ -1597,6 +1590,7 @@
\
product(size_t, YoungPLABSize, 4096, \
"Size of young gen promotion LAB's (in HeapWords)") \
+ constraint(YoungPLABSizeConstraintFunc,AfterMemoryInit) \
\
product(size_t, OldPLABSize, 1024, \
"Size of old gen promotion LAB's (in HeapWords), or Number \
@@ -1735,7 +1729,7 @@
"Minimum size of CMS gen promotion LAB caches per worker " \
"per block size") \
range(1, max_uintx) \
- constraint(CMSOldPLABMinConstraintFunc) \
+ constraint(CMSOldPLABMinConstraintFunc,AfterErgo) \
\
product(uintx, CMSOldPLABNumRefills, 4, \
"Nominal number of refills of CMS gen promotion LAB cache " \
@@ -1931,13 +1925,13 @@
"CMSPrecleanNumerator:CMSPrecleanDenominator yields convergence " \
"ratio") \
range(1, max_uintx) \
- constraint(CMSPrecleanDenominatorConstraintFunc) \
+ constraint(CMSPrecleanDenominatorConstraintFunc,AfterErgo) \
\
product(uintx, CMSPrecleanNumerator, 2, \
"CMSPrecleanNumerator:CMSPrecleanDenominator yields convergence " \
"ratio") \
range(0, max_uintx-1) \
- constraint(CMSPrecleanNumeratorConstraintFunc) \
+ constraint(CMSPrecleanNumeratorConstraintFunc,AfterErgo) \
\
product(bool, CMSPrecleanRefLists1, true, \
"Preclean ref lists during (initial) preclean phase") \
@@ -2649,8 +2643,8 @@
/* because of overflow issue */ \
product(intx, CICompilerCount, CI_COMPILER_COUNT, \
"Number of compiler threads to run") \
- range((intx)Arguments::get_min_number_of_compiler_threads(), \
- max_jint) \
+ range(0, max_jint) \
+ constraint(CICompilerCountConstraintFunc, AtParse) \
\
product(intx, CompilationPolicyChoice, 0, \
"which compilation policy (0-3)") \
@@ -3361,14 +3355,14 @@
" For most GCs this applies to the old generation. In G1 and" \
" ParallelGC it applies to the whole heap.") \
range(0, 100) \
- constraint(MinHeapFreeRatioConstraintFunc) \
+ constraint(MinHeapFreeRatioConstraintFunc,AfterErgo) \
\
manageable(uintx, MaxHeapFreeRatio, 70, \
"The maximum percentage of heap free after GC to avoid shrinking."\
" For most GCs this applies to the old generation. In G1 and" \
" ParallelGC it applies to the whole heap.") \
range(0, 100) \
- constraint(MaxHeapFreeRatioConstraintFunc) \
+ constraint(MaxHeapFreeRatioConstraintFunc,AfterErgo) \
\
product(intx, SoftRefLRUPolicyMSPerMB, 1000, \
"Number of milliseconds per MB of free space in the heap") \
@@ -3383,13 +3377,13 @@
"The maximum percentage of Metaspace free after GC to avoid " \
"shrinking") \
range(0, 100) \
- constraint(MaxMetaspaceFreeRatioConstraintFunc) \
+ constraint(MaxMetaspaceFreeRatioConstraintFunc,AfterErgo) \
\
product(uintx, MinMetaspaceFreeRatio, 40, \
"The minimum percentage of Metaspace free after GC to avoid " \
"expansion") \
range(0, 99) \
- constraint(MinMetaspaceFreeRatioConstraintFunc) \
+ constraint(MinMetaspaceFreeRatioConstraintFunc,AfterErgo) \
\
product(size_t, MaxMetaspaceExpansion, ScaleForWordSize(4*M), \
"The maximum expansion of Metaspace without full GC (in bytes)") \
@@ -3407,12 +3401,12 @@
product(uintx, MaxTenuringThreshold, 15, \
"Maximum value for tenuring threshold") \
range(0, markOopDesc::max_age + 1) \
- constraint(MaxTenuringThresholdConstraintFunc) \
+ constraint(MaxTenuringThresholdConstraintFunc,AfterErgo) \
\
product(uintx, InitialTenuringThreshold, 7, \
"Initial value for tenuring threshold") \
range(0, markOopDesc::max_age + 1) \
- constraint(InitialTenuringThresholdConstraintFunc) \
+ constraint(InitialTenuringThresholdConstraintFunc,AfterErgo) \
\
product(uintx, TargetSurvivorRatio, 50, \
"Desired percentage of survivor space used after scavenge") \
@@ -4090,7 +4084,7 @@
\
experimental(intx, SurvivorAlignmentInBytes, 0, \
"Default survivor space alignment in bytes") \
- constraint(SurvivorAlignmentInBytesConstraintFunc) \
+ constraint(SurvivorAlignmentInBytesConstraintFunc,AfterErgo) \
\
product(bool , AllowNonVirtualCalls, false, \
"Obey the ACC_SUPER flag and allow invokenonvirtual calls") \
@@ -4194,7 +4188,7 @@
// Only materialize src code for range checking when required, ignore otherwise
#define IGNORE_RANGE(a, b)
// Only materialize src code for contraint checking when required, ignore otherwise
-#define IGNORE_CONSTRAINT(func)
+#define IGNORE_CONSTRAINT(func,type)
RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, \
DECLARE_PD_DEVELOPER_FLAG, \
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -83,7 +83,6 @@
Monitor* DirtyCardQ_CBL_mon = NULL;
Mutex* Shared_DirtyCardQ_lock = NULL;
Mutex* ParGCRareEvent_lock = NULL;
-Mutex* EvacFailureStack_lock = NULL;
Mutex* DerivedPointerTableGC_lock = NULL;
Mutex* Compile_lock = NULL;
Monitor* MethodCompileQueue_lock = NULL;
@@ -201,7 +200,6 @@
def(OldSets_lock , Mutex , leaf , true, Monitor::_safepoint_check_never);
def(RootRegionScan_lock , Monitor, leaf , true, Monitor::_safepoint_check_never);
def(MMUTracker_lock , Mutex , leaf , true, Monitor::_safepoint_check_never);
- def(EvacFailureStack_lock , Mutex , nonleaf , true, Monitor::_safepoint_check_never);
def(StringDedupQueue_lock , Monitor, leaf, true, Monitor::_safepoint_check_never);
def(StringDedupTable_lock , Mutex , leaf, true, Monitor::_safepoint_check_never);
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -87,7 +87,6 @@
// non-Java threads.
// (see option ExplicitGCInvokesConcurrent)
extern Mutex* ParGCRareEvent_lock; // Synchronizes various (rare) parallel GC ops.
-extern Mutex* EvacFailureStack_lock; // guards the evac failure scan stack
extern Mutex* Compile_lock; // a lock held when Compilation is updating code (used to block CodeCache traversal, CHA updates, etc)
extern Monitor* MethodCompileQueue_lock; // a lock held when method compilations are enqueued, dequeued
extern Monitor* CompileThread_lock; // a lock held by compile threads during compilation system initialization
--- a/hotspot/src/share/vm/runtime/os.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/os.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -843,6 +843,28 @@
pd_print_cpu_info(st, buf, buflen);
}
+// Print a one line string summarizing the cpu, number of cores, memory, and operating system version
+void os::print_summary_info(outputStream* st, char* buf, size_t buflen) {
+ st->print("Host: ");
+#ifndef PRODUCT
+ if (get_host_name(buf, buflen)) {
+ st->print("%s, ", buf);
+ }
+#endif // PRODUCT
+ get_summary_cpu_info(buf, buflen);
+ st->print("%s, ", buf);
+ size_t mem = physical_memory()/G;
+ if (mem == 0) { // for low memory systems
+ mem = physical_memory()/M;
+ st->print("%d cores, %dM, ", processor_count(), mem);
+ } else {
+ st->print("%d cores, %dG, ", processor_count(), mem);
+ }
+ get_summary_os_info(buf, buflen);
+ st->print_raw(buf);
+ st->cr();
+}
+
void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
const int secs_per_day = 86400;
const int secs_per_hour = 3600;
@@ -850,12 +872,19 @@
time_t tloc;
(void)time(&tloc);
- st->print("time: %s", ctime(&tloc)); // ctime adds newline.
+ char* timestring = ctime(&tloc); // ctime adds newline.
+ // edit out the newline
+ char* nl = strchr(timestring, '\n');
+ if (nl != NULL) {
+ *nl = '\0';
+ }
struct tm tz;
if (localtime_pd(&tloc, &tz) != NULL) {
::strftime(buf, buflen, "%Z", &tz);
- st->print_cr("timezone: %s", buf);
+ st->print("Time: %s %s", timestring, buf);
+ } else {
+ st->print("Time: %s", timestring);
}
double t = os::elapsedTime();
@@ -872,7 +901,7 @@
int elmins = (eltime - day_secs - hour_secs) / secs_per_min;
int minute_secs = elmins * secs_per_min;
int elsecs = (eltime - day_secs - hour_secs - minute_secs);
- st->print_cr("elapsed time: %d seconds (%dd %dh %dm %ds)", eltime, eldays, elhours, elmins, elsecs);
+ st->print_cr(" elapsed time: %d seconds (%dd %dh %dm %ds)", eltime, eldays, elhours, elmins, elsecs);
}
// moved from debug.cpp (used to be find()) but still called from there
--- a/hotspot/src/share/vm/runtime/os.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/os.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -150,6 +150,11 @@
static size_t page_size_for_region(size_t region_size, size_t min_pages, bool must_be_aligned);
+ // Get summary strings for system information in buffer provided
+ static bool get_host_name(char* buf, size_t buflen) PRODUCT_RETURN_(return false;); // true if available
+ static void get_summary_cpu_info(char* buf, size_t buflen);
+ static void get_summary_os_info(char* buf, size_t buflen);
+
public:
static void init(void); // Called before command line parsing
static void init_before_ergo(void); // Called after command line parsing
@@ -590,6 +595,7 @@
static void print_os_info_brief(outputStream* st);
static void print_cpu_info(outputStream* st, char* buf, size_t buflen);
static void pd_print_cpu_info(outputStream* st, char* buf, size_t buflen);
+ static void print_summary_info(outputStream* st, char* buf, size_t buflen);
static void print_memory_info(outputStream* st);
static void print_dll_info(outputStream* st);
static void print_environment_variables(outputStream* st, const char** env_list);
--- a/hotspot/src/share/vm/runtime/thread.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -52,6 +52,8 @@
#include "runtime/arguments.hpp"
#include "runtime/atomic.inline.hpp"
#include "runtime/biasedLocking.hpp"
+#include "runtime/commandLineFlagConstraintList.hpp"
+#include "runtime/commandLineFlagRangeList.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/fprofiler.hpp"
#include "runtime/frame.inline.hpp"
@@ -2739,6 +2741,9 @@
if (ct->env() != NULL) {
ct->env()->metadata_do(f);
}
+ if (ct->task() != NULL) {
+ ct->task()->metadata_do(f);
+ }
}
}
@@ -3319,8 +3324,15 @@
jint ergo_result = Arguments::apply_ergo();
if (ergo_result != JNI_OK) return ergo_result;
- // Final check of all arguments after ergonomics which may change values.
- if (!CommandLineFlags::check_all_ranges_and_constraints()) {
+ // Final check of all ranges after ergonomics which may change values.
+ if (!CommandLineFlagRangeList::check_ranges()) {
+ return JNI_EINVAL;
+ }
+
+ // Final check of all 'AfterErgo' constraints after ergonomics which may change values.
+ bool constraint_result = CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::AfterErgo);
+ Arguments::post_after_ergo_constraint_check(constraint_result);
+ if (!constraint_result) {
return JNI_EINVAL;
}
--- a/hotspot/src/share/vm/runtime/vframe.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/runtime/vframe.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -148,8 +148,7 @@
if (obj.not_null()) {
st->print("\t- %s <" INTPTR_FORMAT "> ", lock_state, (address)obj());
if (obj->klass() == SystemDictionary::Class_klass()) {
- Klass* target_klass = java_lang_Class::as_Klass(obj());
- st->print_cr("(a java.lang.Class for %s)", InstanceKlass::cast(target_klass)->external_name());
+ st->print_cr("(a java.lang.Class for %s)", java_lang_Class::as_external_name(obj()));
} else {
Klass* k = obj->klass();
st->print_cr("(a %s)", k->external_name());
--- a/hotspot/src/share/vm/services/heapDumper.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/services/heapDumper.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -899,6 +899,11 @@
assert(klass->oop_is_instance(), "not an InstanceKlass");
InstanceKlass* ik = (InstanceKlass*)klass;
+ // Ignore the class if it hasn't been initialized yet
+ if (!ik->is_linked()) {
+ return;
+ }
+
writer->write_u1(HPROF_GC_CLASS_DUMP);
// class ID
--- a/hotspot/src/share/vm/shark/sharkBuilder.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/shark/sharkBuilder.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -25,6 +25,8 @@
#include "precompiled.hpp"
#include "ci/ciMethod.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/cardTableModRefBS.hpp"
#include "memory/resourceArea.hpp"
#include "oops/method.hpp"
#include "runtime/os.hpp"
@@ -442,7 +444,7 @@
Unimplemented();
CreateStore(
- LLVMValue::jbyte_constant(CardTableModRefBS::dirty_card),
+ LLVMValue::jbyte_constant(CardTableModRefBS::dirty_card_val()),
CreateIntToPtr(
CreateAdd(
LLVMValue::intptr_constant(
--- a/hotspot/src/share/vm/shark/sharkBuilder.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/shark/sharkBuilder.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -27,8 +27,6 @@
#define SHARE_VM_SHARK_SHARKBUILDER_HPP
#include "ci/ciType.hpp"
-#include "gc/shared/barrierSet.hpp"
-#include "gc/shared/cardTableModRefBS.hpp"
#include "shark/llvmHeaders.hpp"
#include "shark/llvmValue.hpp"
#include "shark/sharkCodeBuffer.hpp"
@@ -38,6 +36,8 @@
#include "utilities/debug.hpp"
#include "utilities/sizes.hpp"
+class BarrierSet;
+
class SharkBuilder : public llvm::IRBuilder<> {
friend class SharkCompileInvariants;
--- a/hotspot/src/share/vm/utilities/vmError.cpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.cpp Wed Jul 05 20:44:51 2017 +0200
@@ -306,6 +306,30 @@
#endif // ZERO
}
+void VMError::print_oom_reasons(outputStream* st) {
+ st->print_cr("# Possible reasons:");
+ st->print_cr("# The system is out of physical RAM or swap space");
+ st->print_cr("# In 32 bit mode, the process size limit was hit");
+ st->print_cr("# Possible solutions:");
+ st->print_cr("# Reduce memory load on the system");
+ st->print_cr("# Increase physical memory or swap space");
+ st->print_cr("# Check if swap backing store is full");
+ st->print_cr("# Use 64 bit Java on a 64 bit OS");
+ st->print_cr("# Decrease Java heap size (-Xmx/-Xms)");
+ st->print_cr("# Decrease number of Java threads");
+ st->print_cr("# Decrease Java thread stack sizes (-Xss)");
+ st->print_cr("# Set larger code cache with -XX:ReservedCodeCacheSize=");
+ st->print_cr("# This output file may be truncated or incomplete.");
+}
+
+const char* VMError::gc_mode() {
+ if (UseG1GC) return "g1 gc";
+ if (UseParallelGC) return "parallel gc";
+ if (UseConcMarkSweepGC) return "concurrent mark sweep gc";
+ if (UseSerialGC) return "serial gc";
+ return "ERROR in GC mode";
+}
+
// This is the main function to report a fatal error. Only one thread can
// call this function, so we don't need to worry about MT-safety. But it's
// possible that the error handler itself may crash or die on an internal
@@ -358,21 +382,21 @@
// test secondary error handling. Test it twice, to test that resetting
// error handler after a secondary crash works.
- STEP(11, "(test secondary crash 1)")
+ STEP(20, "(test secondary crash 1)")
if (_verbose && TestCrashInErrorHandler != 0) {
st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...",
TestCrashInErrorHandler);
controlled_crash(TestCrashInErrorHandler);
}
- STEP(12, "(test secondary crash 2)")
+ STEP(30, "(test secondary crash 2)")
if (_verbose && TestCrashInErrorHandler != 0) {
st->print_cr("Will crash now (TestCrashInErrorHandler=%d)...",
TestCrashInErrorHandler);
controlled_crash(TestCrashInErrorHandler);
}
- STEP(13, "(test safefetch in error handler)")
+ STEP(40, "(test safefetch in error handler)")
// test whether it is safe to use SafeFetch32 in Crash Handler. Test twice
// to test that resetting the signal handler works correctly.
if (_verbose && TestSafeFetchInErrorHandler) {
@@ -393,7 +417,7 @@
}
#endif // PRODUCT
- STEP(15, "(printing type of error)")
+ STEP(50, "(printing type of error)")
switch(_id) {
case OOM_MALLOC_ERROR:
@@ -418,19 +442,7 @@
}
// In error file give some solutions
if (_verbose) {
- st->print_cr("# Possible reasons:");
- st->print_cr("# The system is out of physical RAM or swap space");
- st->print_cr("# In 32 bit mode, the process size limit was hit");
- st->print_cr("# Possible solutions:");
- st->print_cr("# Reduce memory load on the system");
- st->print_cr("# Increase physical memory or swap space");
- st->print_cr("# Check if swap backing store is full");
- st->print_cr("# Use 64 bit Java on a 64 bit OS");
- st->print_cr("# Decrease Java heap size (-Xmx/-Xms)");
- st->print_cr("# Decrease number of Java threads");
- st->print_cr("# Decrease Java thread stack sizes (-Xss)");
- st->print_cr("# Set larger code cache with -XX:ReservedCodeCacheSize=");
- st->print_cr("# This output file may be truncated or incomplete.");
+ print_oom_reasons(st);
} else {
return; // that's enough for the screen
}
@@ -440,7 +452,7 @@
break;
}
- STEP(20, "(printing exception/signal name)")
+ STEP(60, "(printing exception/signal name)")
st->print_cr("#");
st->print("# ");
@@ -470,14 +482,14 @@
}
}
- STEP(30, "(printing current thread and pid)")
+ STEP(70, "(printing current thread and pid)")
// process id, thread id
st->print(", pid=%d", os::current_process_id());
st->print(", tid=" INTPTR_FORMAT, os::current_thread_id());
st->cr();
- STEP(40, "(printing error message)")
+ STEP(80, "(printing error message)")
if (should_report_bug(_id)) { // already printed the message.
// error message
@@ -488,7 +500,7 @@
}
}
- STEP(50, "(printing Java version string)")
+ STEP(90, "(printing Java version string)")
// VM version
st->print_cr("#");
@@ -498,15 +510,18 @@
const char* runtime_version = JDK_Version::runtime_version() != NULL ?
JDK_Version::runtime_version() : "";
st->print_cr("# JRE version: %s (%s) (build %s)", runtime_name, buf, runtime_version);
- st->print_cr("# Java VM: %s (%s %s %s %s)",
+ // This is the long version with some default settings added
+ st->print_cr("# Java VM: %s (%s, %s%s%s, %s, %s)",
Abstract_VM_Version::vm_name(),
Abstract_VM_Version::vm_release(),
Abstract_VM_Version::vm_info_string(),
- Abstract_VM_Version::vm_platform_string(),
- UseCompressedOops ? "compressed oops" : ""
+ TieredCompilation ? ", tiered" : "",
+ UseCompressedOops ? ", compressed oops" : "",
+ gc_mode(),
+ Abstract_VM_Version::vm_platform_string()
);
- STEP(60, "(printing problematic frame)")
+ STEP(100, "(printing problematic frame)")
// Print current frame if we have a context (i.e. it's a crash)
if (_context) {
@@ -517,7 +532,8 @@
st->cr();
st->print_cr("#");
}
- STEP(63, "(printing core file information)")
+
+ STEP(110, "(printing core file information)")
st->print("# ");
if (CreateCoredumpOnCrash) {
if (coredump_status) {
@@ -531,13 +547,42 @@
st->cr();
st->print_cr("#");
- STEP(65, "(printing bug submit message)")
+ STEP(120, "(printing bug submit message)")
if (should_report_bug(_id) && _verbose) {
print_bug_submit_message(st, _thread);
}
- STEP(70, "(printing thread)" )
+ STEP(130, "(printing summary)" )
+
+ if (_verbose) {
+ st->cr();
+ st->print_cr("--------------- S U M M A R Y ------------");
+ st->cr();
+ }
+
+ STEP(140, "(printing VM option summary)" )
+
+ if (_verbose) {
+ // VM options
+ Arguments::print_summary_on(st);
+ st->cr();
+ }
+
+ STEP(150, "(printing summary machine and OS info)")
+
+ if (_verbose) {
+ os::print_summary_info(st, buf, sizeof(buf));
+ }
+
+
+ STEP(160, "(printing date and time)" )
+
+ if (_verbose) {
+ os::print_date_and_time(st, buf, sizeof(buf));
+ }
+
+ STEP(170, "(printing thread)" )
if (_verbose) {
st->cr();
@@ -545,7 +590,7 @@
st->cr();
}
- STEP(80, "(printing current thread)" )
+ STEP(180, "(printing current thread)" )
// current thread
if (_verbose) {
@@ -559,31 +604,20 @@
st->cr();
}
- STEP(90, "(printing siginfo)" )
+ STEP(190, "(printing current compile task)" )
- // signal no, signal code, address that caused the fault
- if (_verbose && _siginfo) {
- os::print_siginfo(st, _siginfo);
- st->cr();
+ if (_verbose && _thread && _thread->is_Compiler_thread()) {
+ CompilerThread* t = (CompilerThread*)_thread;
+ if (t->task()) {
+ st->cr();
+ st->print_cr("Current CompileTask:");
+ t->task()->print_line_on_error(st, buf, sizeof(buf));
+ st->cr();
+ }
}
- STEP(100, "(printing registers, top of stack, instructions near pc)")
- // registers, top of stack, instructions near pc
- if (_verbose && _context) {
- os::print_context(st, _context);
- st->cr();
- }
-
- STEP(105, "(printing register info)")
-
- // decode register contents if possible
- if (_verbose && _context && Universe::is_fully_initialized()) {
- os::print_register_info(st, _context);
- st->cr();
- }
-
- STEP(110, "(printing stack bounds)" )
+ STEP(200, "(printing stack bounds)" )
if (_verbose) {
st->print("Stack: ");
@@ -614,7 +648,7 @@
st->cr();
}
- STEP(120, "(printing native stack)" )
+ STEP(210, "(printing native stack)" )
if (_verbose) {
if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) {
@@ -628,13 +662,13 @@
}
}
- STEP(130, "(printing Java stack)" )
+ STEP(220, "(printing Java stack)" )
if (_verbose && _thread && _thread->is_Java_thread()) {
print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf));
}
- STEP(135, "(printing target Java thread stack)" )
+ STEP(230, "(printing target Java thread stack)" )
// printing Java thread stack trace if it is involved in GC crash
if (_verbose && _thread && (_thread->is_Named_thread())) {
@@ -645,7 +679,32 @@
}
}
- STEP(140, "(printing VM operation)" )
+ STEP(240, "(printing siginfo)" )
+
+ // signal no, signal code, address that caused the fault
+ if (_verbose && _siginfo) {
+ st->cr();
+ os::print_siginfo(st, _siginfo);
+ st->cr();
+ }
+
+ STEP(250, "(printing register info)")
+
+ // decode register contents if possible
+ if (_verbose && _context && Universe::is_fully_initialized()) {
+ os::print_register_info(st, _context);
+ st->cr();
+ }
+
+ STEP(260, "(printing registers, top of stack, instructions near pc)")
+
+ // registers, top of stack, instructions near pc
+ if (_verbose && _context) {
+ os::print_context(st, _context);
+ st->cr();
+ }
+
+ STEP(270, "(printing VM operation)" )
if (_verbose && _thread && _thread->is_VM_thread()) {
VMThread* t = (VMThread*)_thread;
@@ -657,19 +716,7 @@
}
}
- STEP(150, "(printing current compile task)" )
-
- if (_verbose && _thread && _thread->is_Compiler_thread()) {
- CompilerThread* t = (CompilerThread*)_thread;
- if (t->task()) {
- st->cr();
- st->print_cr("Current CompileTask:");
- t->task()->print_line_on_error(st, buf, sizeof(buf));
- st->cr();
- }
- }
-
- STEP(160, "(printing process)" )
+ STEP(280, "(printing process)" )
if (_verbose) {
st->cr();
@@ -677,7 +724,7 @@
st->cr();
}
- STEP(170, "(printing all threads)" )
+ STEP(290, "(printing all threads)" )
// all threads
if (_verbose && _thread) {
@@ -685,7 +732,7 @@
st->cr();
}
- STEP(175, "(printing VM state)" )
+ STEP(300, "(printing VM state)" )
if (_verbose) {
// Safepoint state
@@ -707,7 +754,7 @@
st->cr();
}
- STEP(180, "(printing owned locks on error)" )
+ STEP(310, "(printing owned locks on error)" )
// mutexes/monitors that currently have an owner
if (_verbose) {
@@ -715,7 +762,7 @@
st->cr();
}
- STEP(182, "(printing number of OutOfMemoryError and StackOverflow exceptions)")
+ STEP(320, "(printing number of OutOfMemoryError and StackOverflow exceptions)")
if (_verbose && Exceptions::has_exception_counts()) {
st->print_cr("OutOfMemory and StackOverflow Exception counts:");
@@ -723,7 +770,7 @@
st->cr();
}
- STEP(185, "(printing compressed oops mode")
+ STEP(330, "(printing compressed oops mode")
if (_verbose && UseCompressedOops) {
Universe::print_compressed_oops_mode(st);
@@ -733,7 +780,7 @@
st->cr();
}
- STEP(190, "(printing heap information)" )
+ STEP(340, "(printing heap information)" )
if (_verbose && Universe::is_fully_initialized()) {
Universe::heap()->print_on_error(st);
@@ -743,7 +790,7 @@
st->cr();
}
- STEP(195, "(printing code cache information)" )
+ STEP(350, "(printing code cache information)" )
if (_verbose && Universe::is_fully_initialized()) {
// print code cache information before vm abort
@@ -751,14 +798,14 @@
st->cr();
}
- STEP(200, "(printing ring buffers)" )
+ STEP(360, "(printing ring buffers)" )
if (_verbose) {
Events::print_all(st);
st->cr();
}
- STEP(205, "(printing dynamic libraries)" )
+ STEP(370, "(printing dynamic libraries)" )
if (_verbose) {
// dynamic libraries, or memory map
@@ -766,7 +813,7 @@
st->cr();
}
- STEP(210, "(printing VM options)" )
+ STEP(380, "(printing VM options)" )
if (_verbose) {
// VM options
@@ -774,33 +821,33 @@
st->cr();
}
- STEP(215, "(printing warning if internal testing API used)" )
+ STEP(390, "(printing warning if internal testing API used)" )
if (WhiteBox::used()) {
st->print_cr("Unsupported internal testing APIs have been used.");
st->cr();
}
- STEP(220, "(printing environment variables)" )
+ STEP(400, "(printing all environment variables)" )
if (_verbose) {
os::print_environment_variables(st, env_list);
st->cr();
}
- STEP(225, "(printing signal handlers)" )
+ STEP(410, "(printing signal handlers)" )
if (_verbose) {
os::print_signal_handlers(st, buf, sizeof(buf));
st->cr();
}
- STEP(228, "(Native Memory Tracking)" )
+ STEP(420, "(Native Memory Tracking)" )
if (_verbose) {
MemTracker::error_report(st);
}
- STEP(230, "" )
+ STEP(430, "(printing system)" )
if (_verbose) {
st->cr();
@@ -808,48 +855,39 @@
st->cr();
}
- STEP(240, "(printing OS information)" )
+ STEP(440, "(printing OS information)" )
if (_verbose) {
os::print_os_info(st);
st->cr();
}
- STEP(250, "(printing CPU info)" )
+ STEP(450, "(printing CPU info)" )
if (_verbose) {
os::print_cpu_info(st, buf, sizeof(buf));
st->cr();
}
- STEP(260, "(printing memory info)" )
+ STEP(460, "(printing memory info)" )
if (_verbose) {
os::print_memory_info(st);
st->cr();
}
- STEP(270, "(printing internal vm info)" )
+ STEP(470, "(printing internal vm info)" )
if (_verbose) {
st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string());
st->cr();
}
- STEP(280, "(printing date and time)" )
-
- if (_verbose) {
- os::print_date_and_time(st, buf, sizeof(buf));
- st->cr();
- }
-
-#ifndef PRODUCT
// print a defined marker to show that error handling finished correctly.
- STEP(290, "(printing end marker)" )
+ STEP(480, "(printing end marker)" )
if (_verbose) {
st->print_cr("END.");
}
-#endif
END
--- a/hotspot/src/share/vm/utilities/vmError.hpp Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/src/share/vm/utilities/vmError.hpp Wed Jul 05 20:44:51 2017 +0200
@@ -89,6 +89,9 @@
static void print_stack_trace(outputStream* st, JavaThread* jt,
char* buf, int buflen, bool verbose = false);
+ static const char* gc_mode();
+ static void print_oom_reasons(outputStream* st);
+
// accessor
const char* message() const { return _message; }
const char* detail_msg() const { return _detail_msg; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/arguments/CheckCICompilerCount.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import jdk.test.lib.*;
+
+/*
+ * @test CheckCheckCICompilerCount
+ * @bug 8130858
+ * @summary Check that correct range of values for CICompilerCount are allowed depending on whether tiered is enabled or not
+ * @library /testlibrary
+ * @modules java.base/sun.misc
+ * java.management
+ * @run main CheckCICompilerCount
+ */
+
+public class CheckCICompilerCount {
+ private static final String[][] NON_TIERED_ARGUMENTS = {
+ {
+ "-XX:-TieredCompilation",
+ "-XX:+PrintFlagsFinal",
+ "-XX:CICompilerCount=0",
+ "-version"
+ },
+ {
+ "-XX:-TieredCompilation",
+ "-XX:+PrintFlagsFinal",
+ "-XX:CICompilerCount=1",
+ "-version"
+ }
+ };
+
+ private static final String[][] NON_TIERED_EXPECTED_OUTPUTS = {
+ {
+ "CICompilerCount=0 must be at least 1",
+ "Improperly specified VM option 'CICompilerCount=0'"
+ },
+ {
+ "intx CICompilerCount := 1 {product}"
+ }
+ };
+
+ private static final int[] NON_TIERED_EXIT = {
+ 1,
+ 0
+ };
+
+ private static final String[][] TIERED_ARGUMENTS = {
+ {
+ "-XX:+TieredCompilation",
+ "-XX:+PrintFlagsFinal",
+ "-XX:CICompilerCount=1",
+ "-version"
+ },
+ {
+ "-XX:+TieredCompilation",
+ "-XX:+PrintFlagsFinal",
+ "-XX:CICompilerCount=2",
+ "-version"
+ }
+ };
+
+ private static final String[][] TIERED_EXPECTED_OUTPUTS = {
+ {
+ "CICompilerCount=1 must be at least 2",
+ "Improperly specified VM option 'CICompilerCount=1'"
+ },
+ {
+ "intx CICompilerCount := 2 {product}"
+ }
+ };
+
+ private static final int[] TIERED_EXIT = {
+ 1,
+ 0
+ };
+
+ private static void verifyValidOption(String[] arguments, String[] expected_outputs, int exit, boolean tiered) throws Exception {
+ ProcessBuilder pb;
+ OutputAnalyzer out;
+
+ pb = ProcessTools.createJavaProcessBuilder(arguments);
+ out = new OutputAnalyzer(pb.start());
+
+ try {
+ out.shouldHaveExitValue(exit);
+ for (String expected_output : expected_outputs) {
+ out.shouldContain(expected_output);
+ }
+ } catch (RuntimeException e) {
+ // Check if tiered compilation is available in this JVM
+ // Version. Throw exception only if it is available.
+ if (!(tiered && out.getOutput().contains("TieredCompilation is disabled in this release."))) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ if (NON_TIERED_ARGUMENTS.length != NON_TIERED_EXPECTED_OUTPUTS.length || NON_TIERED_ARGUMENTS.length != NON_TIERED_EXIT.length) {
+ throw new RuntimeException("Test is set up incorrectly: length of arguments, expected outputs and exit codes in non-tiered mode of operation do not match.");
+ }
+
+ if (TIERED_ARGUMENTS.length != TIERED_EXPECTED_OUTPUTS.length || TIERED_ARGUMENTS.length != TIERED_EXIT.length) {
+ throw new RuntimeException("Test is set up incorrectly: length of arguments, expected outputs and exit codes in tiered mode of operation do not match.");
+ }
+
+ for (int i = 0; i < NON_TIERED_ARGUMENTS.length; i++) {
+ verifyValidOption(NON_TIERED_ARGUMENTS[i], NON_TIERED_EXPECTED_OUTPUTS[i], NON_TIERED_EXIT[i], false);
+ }
+
+ for (int i = 0; i < TIERED_ARGUMENTS.length; i++) {
+ verifyValidOption(TIERED_ARGUMENTS[i], TIERED_EXPECTED_OUTPUTS[i], TIERED_EXIT[i], true);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+import java.lang.reflect.Executable;
+import java.util.concurrent.Callable;
+import java.util.Objects;
+/*
+ * @test
+ * @bug 8130832
+ * @library /testlibrary /../../test/lib /compiler/whitebox /compiler/testlibrary
+ * @build IntrinsicAvailableTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseCRC32Intrinsics
+ * IntrinsicAvailableTest
+ * @run main/othervm -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:-UseCRC32Intrinsics
+ * IntrinsicAvailableTest
+ */
+public class IntrinsicAvailableTest extends CompilerWhiteBoxTest {
+ protected String VMName;
+
+ public IntrinsicAvailableTest(IntrinsicAvailableTestTestCase testCase) {
+ super(testCase);
+ VMName = System.getProperty("java.vm.name");
+ }
+
+ public static class IntrinsicAvailableTestTestCase implements TestCase {
+
+ public String name() {
+ return "IntrinsicAvailableTestTestCase";
+ }
+
+ public Executable getExecutable() {
+ // Using a single method to test the
+ // WhiteBox.isIntrinsicAvailable(Executable method, int compLevel)
+ // call for the compilation level corresponding to both the C1 and C2
+ // compiler keeps the current test simple.
+ //
+ // The tested method is java.util.zip.CRC32.update(int, int) because
+ // both C1 and C2 define an intrinsic for the method and
+ // the UseCRC32Intrinsics flag can be used to enable/disable
+ // intrinsification of the method in both product and fastdebug
+ // builds.
+ try {
+ return Class.forName("java.util.zip.CRC32").getDeclaredMethod("update", int.class, int.class);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException("Test bug, method unavailable. " + e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Test bug, class unavailable. " + e);
+ }
+ }
+
+ public Callable<Integer> getCallable() {
+ return null;
+ }
+
+ public boolean isOsr() {
+ return false;
+ }
+
+ }
+
+ protected void checkIntrinsicForCompilationLevel(Executable method, int compLevel) throws Exception {
+ boolean intrinsicEnabled = Boolean.valueOf(getVMOption("UseCRC32Intrinsics"));
+ boolean intrinsicAvailable = WHITE_BOX.isIntrinsicAvailable(method,
+ compLevel);
+
+ String intrinsicEnabledMessage = intrinsicEnabled ? "enabled" : "disabled";
+ String intrinsicAvailableMessage = intrinsicAvailable ? "available" : "not available";
+
+ if (intrinsicEnabled == intrinsicAvailable) {
+ System.out.println("Expected result: intrinsic for java.util.zip.CRC32.update() is " +
+ intrinsicEnabledMessage + " and intrinsic is " + intrinsicAvailableMessage +
+ " at compilation level " + compLevel);
+ } else {
+ throw new RuntimeException("Unexpected result: intrinsic for java.util.zip.CRC32.update() is " +
+ intrinsicEnabledMessage + " but intrinsic is " + intrinsicAvailableMessage +
+ " at compilation level " + compLevel);
+ }
+ }
+
+ protected boolean isServerVM() {
+ return VMName.toLowerCase().contains("server");
+ }
+
+ public void test() throws Exception {
+ Executable intrinsicMethod = testCase.getExecutable();
+ if (isServerVM()) {
+ if (TIERED_COMPILATION) {
+ checkIntrinsicForCompilationLevel(intrinsicMethod, COMP_LEVEL_SIMPLE);
+ }
+ checkIntrinsicForCompilationLevel(intrinsicMethod, COMP_LEVEL_FULL_OPTIMIZATION);
+ } else {
+ checkIntrinsicForCompilationLevel(intrinsicMethod, COMP_LEVEL_SIMPLE);
+ }
+ }
+
+ public static void main(String args[]) throws Exception {
+ new IntrinsicAvailableTest(new IntrinsicAvailableTestTestCase()).test();
+ }
+}
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java Wed Jul 05 20:44:51 2017 +0200
@@ -67,7 +67,7 @@
compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
}
- if (!isIntrinsicSupported()) {
+ if (!isIntrinsicAvailable()) {
expectedIntrinsicCount = 0;
}
break;
@@ -114,7 +114,11 @@
}
}
- protected abstract boolean isIntrinsicSupported();
+ // An intrinsic is available if:
+ // - the intrinsic is enabled (by using the appropriate command-line flag) and
+ // - the intrinsic is supported by the VM (i.e., the platform on which the VM is
+ // running provides the instructions necessary for the VM to generate the intrinsic).
+ protected abstract boolean isIntrinsicAvailable();
protected abstract String getIntrinsicId();
@@ -123,14 +127,20 @@
}
static class IntTest extends IntrinsicBase {
+
+ protected boolean isIntrinsicAvailable; // The tested intrinsic is available on the current platform.
+
protected IntTest(MathIntrinsic.IntIntrinsic testCase) {
super(testCase);
+ // Only the C2 compiler intrinsifies exact math methods
+ // so check if the intrinsics are available with C2.
+ isIntrinsicAvailable = WHITE_BOX.isIntrinsicAvailable(testCase.getTestMethod(),
+ COMP_LEVEL_FULL_OPTIMIZATION);
}
@Override
- protected boolean isIntrinsicSupported() {
- return isServerVM() && Boolean.valueOf(useMathExactIntrinsics)
- && (Platform.isX86() || Platform.isX64() || Platform.isAArch64());
+ protected boolean isIntrinsicAvailable() {
+ return isIntrinsicAvailable;
}
@Override
@@ -140,14 +150,20 @@
}
static class LongTest extends IntrinsicBase {
+
+ protected boolean isIntrinsicAvailable; // The tested intrinsic is available on the current platform.
+
protected LongTest(MathIntrinsic.LongIntrinsic testCase) {
super(testCase);
+ // Only the C2 compiler intrinsifies exact math methods
+ // so check if the intrinsics are available with C2.
+ isIntrinsicAvailable = WHITE_BOX.isIntrinsicAvailable(testCase.getTestMethod(),
+ COMP_LEVEL_FULL_OPTIMIZATION);
}
@Override
- protected boolean isIntrinsicSupported() {
- return isServerVM() && Boolean.valueOf(useMathExactIntrinsics) &&
- (Platform.isX64() || Platform.isPPC() || Platform.isAArch64());
+ protected boolean isIntrinsicAvailable() {
+ return isIntrinsicAvailable;
}
@Override
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MathIntrinsic.java Wed Jul 05 20:44:51 2017 +0200
@@ -29,11 +29,21 @@
enum IntIntrinsic implements CompilerWhiteBoxTest.TestCase {
Add {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("addExact", int.class, int.class);
+ }
+
+ @Override
Object execMathMethod() {
return intR = Math.addExact(int1, int2);
}
},
- Subtract {
+ Subtract {
+ @Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("subtractExact", int.class, int.class);
+ }
+
@Override
Object execMathMethod() {
return intR = Math.subtractExact(int1, int2);
@@ -41,34 +51,66 @@
},
Multiply {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("multiplyExact", int.class, int.class);
+ }
+
+ @Override
Object execMathMethod() {
return intR = Math.multiplyExact(int1, int2);
}
},
Increment {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("incrementExact", int.class);
+ }
+
+ @Override
Object execMathMethod() {
return intR = Math.incrementExact(int1);
}
},
Decrement {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("decrementExact", int.class);
+ }
+
+ @Override
Object execMathMethod() {
return intR = Math.decrementExact(int1);
}
},
Negate {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("negateExact", int.class);
+ }
+
+ @Override
Object execMathMethod() {
return intR = Math.negateExact(int1);
}
};
+
protected int int1;
protected int int2;
protected int intR;
+ abstract Executable testMethod() throws NoSuchMethodException, ClassNotFoundException;
abstract Object execMathMethod();
+ public Executable getTestMethod() {
+ try {
+ return testMethod();
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException("Test bug, no such method: " + e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Test bug, no such class: " + e);
+ }
+ }
+
@Override
public Executable getExecutable() {
try {
@@ -93,36 +135,66 @@
enum LongIntrinsic implements CompilerWhiteBoxTest.TestCase {
Add {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("addExact", long.class, long.class);
+ }
+
+ @Override
Object execMathMethod() {
return longR = Math.addExact(long1, long2);
}
},
Subtract {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("subtractExact", long.class, long.class);
+ }
+
+ @Override
Object execMathMethod() {
return longR = Math.subtractExact(long1, long2);
}
},
Multiply {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("multiplyExact", long.class, long.class);
+ }
+
+ @Override
Object execMathMethod() {
return longR = Math.multiplyExact(long1, long2);
}
},
Increment {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("incrementExact", long.class);
+ }
+
+ @Override
Object execMathMethod() {
return longR = Math.incrementExact(long1);
}
},
Decrement {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("decrementExact", long.class);
+ }
+
+ @Override
Object execMathMethod() {
return longR = Math.decrementExact(long1);
}
},
Negate {
@Override
+ Executable testMethod() throws NoSuchMethodException, ClassNotFoundException {
+ return Class.forName("java.lang.Math").getDeclaredMethod("negateExact", long.class);
+ }
+
+ @Override
Object execMathMethod() {
return longR = Math.negateExact(long1);
}
@@ -131,8 +203,19 @@
protected long long2;
protected long longR;
+ abstract Executable testMethod() throws NoSuchMethodException, ClassNotFoundException;
abstract Object execMathMethod();
+ public Executable getTestMethod() {
+ try {
+ return testMethod();
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException("Test bug, no such method: " + e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Test bug, no such class: " + e);
+ }
+ }
+
@Override
public Executable getExecutable() {
try {
--- a/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java Wed Jul 05 20:44:51 2017 +0200
@@ -94,29 +94,47 @@
output.shouldHaveExitValue(0);
}
+ private static long gcd(long x, long y) {
+ while (x > 0) {
+ long t = x;
+ x = y % x;
+ y = t;
+ }
+ return y;
+ }
+
+ private static long lcm(long x, long y) {
+ return x * (y / gcd(x, y));
+ }
+
public static void main(String[] args) throws Exception {
if (!Platform.isDebugBuild()) {
System.out.println("Skip tests on non-debug builds because the required option TracePageSizes is a debug-only option.");
return;
}
+ // Size that a single card covers.
+ final int cardSize = 512;
WhiteBox wb = WhiteBox.getWhiteBox();
smallPageSize = wb.getVMPageSize();
largePageSize = wb.getVMLargePageSize();
allocGranularity = wb.getVMAllocationGranularity();
+ final long heapAlignment = lcm(cardSize * smallPageSize, largePageSize);
if (largePageSize == 0) {
System.out.println("Skip tests because large page support does not seem to be available on this platform.");
return;
}
+ if (largePageSize == smallPageSize) {
+ System.out.println("Skip tests because large page support does not seem to be available on this platform." +
+ "Small and large page size are the same.");
+ return;
+ }
// To get large pages for the card table etc. we need at least a 1G heap (with 4k page size).
// 32 bit systems will have problems reserving such an amount of contiguous space, so skip the
// test there.
if (!Platform.is32bit()) {
- // Size that a single card covers.
- final int cardSize = 512;
-
final long heapSizeForCardTableUsingLargePages = largePageSize * cardSize;
final long heapSizeDiffForCardTable = Math.max(Math.max(allocGranularity * cardSize, HEAP_REGION_SIZE), largePageSize);
@@ -131,7 +149,8 @@
// everywhere.
final int bitmapTranslationFactor = 8 * 8; // ObjectAlignmentInBytes * BitsPerByte
final long heapSizeForBitmapUsingLargePages = largePageSize * bitmapTranslationFactor;
- final long heapSizeDiffForBitmap = Math.max(Math.max(allocGranularity * bitmapTranslationFactor, HEAP_REGION_SIZE), largePageSize);
+ final long heapSizeDiffForBitmap = Math.max(Math.max(allocGranularity * bitmapTranslationFactor, HEAP_REGION_SIZE),
+ Math.max(largePageSize, heapAlignment));
Asserts.assertGT(heapSizeForBitmapUsingLargePages, heapSizeDiffForBitmap,
"To test we would require to use an invalid heap size");
--- a/hotspot/test/runtime/CompressedOops/ObjectAlignment.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/runtime/CompressedOops/ObjectAlignment.java Wed Jul 05 20:44:51 2017 +0200
@@ -48,7 +48,6 @@
.shouldHaveExitValue(1);
testObjectAlignment(-1)
- .shouldContain("must be power of 2")
.shouldContain("outside the allowed range")
.shouldHaveExitValue(1);
@@ -75,4 +74,4 @@
"-version");
return new OutputAnalyzer(pb.start());
}
-}
\ No newline at end of file
+}
--- a/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,7 +38,7 @@
public class CreateCoredumpOnCrash {
private static class Crasher {
public static void main(String[] args) {
- Utils.getUnsafe().getInt(0);
+ Utils.getUnsafe().putInt(0L, 0);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2015, 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 8087315
+ * @summary Get old method's stack trace elements after GC
+ * @library /testlibrary
+ * @modules java.compiler
+ * java.instrument
+ * jdk.jartool/sun.tools.jar
+ * @build RedefineClassHelper
+ * @run main RedefineClassHelper
+ * @run main/othervm -javaagent:redefineagent.jar RedefineRunningMethodsWithBacktrace
+ */
+
+import static jdk.test.lib.Asserts.*;
+
+public class RedefineRunningMethodsWithBacktrace {
+
+ public static String newB =
+ "class RedefineRunningMethodsWithBacktrace$B {" +
+ " static int count1 = 0;" +
+ " static int count2 = 0;" +
+ " public static volatile boolean stop = false;" +
+ " static void localSleep() { " +
+ " try{ " +
+ " Thread.currentThread().sleep(10);" +
+ " } catch(InterruptedException ie) { " +
+ " } " +
+ " } " +
+ " public static void infinite() { " +
+ " System.out.println(\"infinite called\");" +
+ " }" +
+ " public static void throwable() { " +
+ " throw new RuntimeException(\"throwable called\");" +
+ " }" +
+ "}";
+
+ public static String evenNewerB =
+ "class RedefineRunningMethodsWithBacktrace$B {" +
+ " static int count1 = 0;" +
+ " static int count2 = 0;" +
+ " public static volatile boolean stop = false;" +
+ " static void localSleep() { " +
+ " try{ " +
+ " Thread.currentThread().sleep(1);" +
+ " } catch(InterruptedException ie) { " +
+ " } " +
+ " } " +
+ " public static void infinite() { }" +
+ " public static void throwable() { " +
+ " throw new RuntimeException(\"throwable called\");" +
+ " }" +
+ "}";
+
+ static class B {
+ static int count1 = 0;
+ static int count2 = 0;
+ public static volatile boolean stop = false;
+ static void localSleep() {
+ try {
+ Thread.currentThread().sleep(10);//sleep for 10 ms
+ } catch(InterruptedException ie) {
+ }
+ }
+
+ public static void infinite() {
+ while (!stop) { count1++; localSleep(); }
+ }
+ public static void throwable() {
+ // add some stuff to the original constant pool
+ String s1 = new String ("string1");
+ String s2 = new String ("string2");
+ String s3 = new String ("string3");
+ String s4 = new String ("string4");
+ String s5 = new String ("string5");
+ String s6 = new String ("string6");
+ String s7 = new String ("string7");
+ String s8 = new String ("string8");
+ String s9 = new String ("string9");
+ String s10 = new String ("string10");
+ String s11 = new String ("string11");
+ String s12 = new String ("string12");
+ String s13 = new String ("string13");
+ String s14 = new String ("string14");
+ String s15 = new String ("string15");
+ String s16 = new String ("string16");
+ String s17 = new String ("string17");
+ String s18 = new String ("string18");
+ String s19 = new String ("string19");
+ throw new RuntimeException("throwable called");
+ }
+ }
+
+ private static void touchRedefinedMethodInBacktrace(Throwable throwable) {
+ System.out.println("touchRedefinedMethodInBacktrace: ");
+ throwable.printStackTrace(); // this actually crashes with the bug in
+ // java_lang_StackTraceElement::create()
+
+ // Make sure that we can convert the backtrace, which is referring to
+ // the redefined method, to a StrackTraceElement[] without crashing.
+ StackTraceElement[] stackTrace = throwable.getStackTrace();
+ for (int i = 0; i < stackTrace.length; i++) {
+ StackTraceElement frame = stackTrace[i];
+ assertNotNull(frame.getClassName(),
+ "\nTest failed: trace[" + i + "].getClassName() returned null");
+ assertNotNull(frame.getMethodName(),
+ "\nTest failed: trace[" + i + "].getMethodName() returned null");
+ }
+ }
+
+ private static Throwable getThrowableInB() {
+ Throwable t = null;
+ try {
+ B.throwable();
+ } catch (Exception e) {
+ t = e;
+ // Don't print here because Throwable will cache the constructed stacktrace
+ // e.printStackTrace();
+ }
+ return t;
+ }
+
+
+ public static void main(String[] args) throws Exception {
+
+ new Thread() {
+ public void run() {
+ B.infinite();
+ }
+ }.start();
+
+ Throwable t1 = getThrowableInB();
+
+ RedefineClassHelper.redefineClass(B.class, newB);
+
+ System.gc();
+
+ Throwable t2 = getThrowableInB();
+
+ B.infinite();
+
+ for (int i = 0; i < 20 ; i++) {
+ String s = new String("some garbage");
+ System.gc();
+ }
+
+ RedefineClassHelper.redefineClass(B.class, evenNewerB);
+ System.gc();
+
+ Throwable t3 = getThrowableInB();
+
+ for (int i = 0; i < 20 ; i++) {
+ B.infinite();
+ String s = new String("some garbage");
+ System.gc();
+ }
+
+ touchRedefinedMethodInBacktrace(t1);
+ touchRedefinedMethodInBacktrace(t2);
+ touchRedefinedMethodInBacktrace(t3);
+
+ // purge should clean everything up.
+ B.stop = true;
+
+ for (int i = 0; i < 20 ; i++) {
+ B.infinite();
+ String s = new String("some garbage");
+ System.gc();
+ }
+ }
+}
--- a/hotspot/test/runtime/contended/Options.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/runtime/contended/Options.java Wed Jul 05 20:44:51 2017 +0200
@@ -55,7 +55,6 @@
output = new OutputAnalyzer(pb.start());
output.shouldContain("ContendedPaddingWidth");
output.shouldContain("outside the allowed range");
- output.shouldContain("must be a multiple of 8");
output.shouldHaveExitValue(1);
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=0", "-version");
@@ -90,7 +89,6 @@
output = new OutputAnalyzer(pb.start());
output.shouldContain("ContendedPaddingWidth");
output.shouldContain("outside the allowed range");
- output.shouldContain("must be a multiple of 8");
output.shouldHaveExitValue(1);
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8200", "-version"); // 8192+8 = 8200
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/verifier/PrimIntArray.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2015, 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 8129895
+ * @summary Throw VerifyError when checking assignability of primitive arrays
+ * that are not identical. For example, [I is not assignable to [B.
+ * @compile primArray.jasm
+ * @compile primArray49.jasm
+ * @run main/othervm -Xverify:all PrimIntArray
+ */
+
+// Test that an int[] is not assignable to byte[].
+public class PrimIntArray {
+
+ public static void main(String args[]) throws Throwable {
+ System.out.println("Regression test for bug 8129895");
+
+ try {
+ Class newClass = Class.forName("primArray");
+ throw new RuntimeException("Expected VerifyError exception not thrown with new verifier");
+ } catch (java.lang.VerifyError e) {
+ System.out.println("Test PrimIntArray passed with new verifier");
+ }
+
+ try {
+ Class newClass = Class.forName("primArray49");
+ throw new RuntimeException("Expected VerifyError exception not thrown by old verifier");
+ } catch (java.lang.VerifyError e) {
+ System.out.println("Test PrimIntArray passed with old verifier");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/verifier/primArray.jasm Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+// Method castToByteArray() tries to return an array of ints when an array
+// of bytes is expected.
+super class primArray
+version 52:0
+{
+
+ public Method "<init>":"()V"
+ stack 1 locals 1
+ {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public static Method castToByteArray:"([I)[B"
+ stack 1 locals 1
+ {
+ aload_0;
+ areturn;
+ }
+
+} // end Class primArray
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/verifier/primArray49.jasm Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ */
+
+// Method castToByteArray() tries to return an array of ints when an array
+// of bytes is expected.
+super class primArray49
+version 49:0
+{
+
+ public Method "<init>":"()V"
+ stack 1 locals 1
+ {
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+ }
+
+ public static Method castToByteArray:"([I)[B"
+ stack 1 locals 1
+ {
+ aload_0;
+ areturn;
+ }
+
+} // end Class primArray49
--- a/hotspot/test/serviceability/sa/TestStackTrace.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/serviceability/sa/TestStackTrace.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,7 +34,6 @@
* @test
* @library /../../test/lib/share/classes
* @library /testlibrary
- * @ignore 8129971
* @build jdk.test.lib.*
* @build jdk.test.lib.apps.*
* @run main TestStackTrace
--- a/hotspot/test/testlibrary/jdk/test/lib/InMemoryJavaCompiler.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/testlibrary/jdk/test/lib/InMemoryJavaCompiler.java Wed Jul 05 20:44:51 2017 +0200
@@ -31,11 +31,9 @@
import java.util.Arrays;
import javax.tools.ForwardingJavaFileManager;
-import javax.tools.ForwardingJavaFileManager;
import javax.tools.FileObject;
import javax.tools.JavaCompiler;
import javax.tools.JavaCompiler.CompilationTask;
-import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;
import javax.tools.SimpleJavaFileObject;
--- a/hotspot/test/testlibrary/jdk/test/lib/Platform.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/testlibrary/jdk/test/lib/Platform.java Wed Jul 05 20:44:51 2017 +0200
@@ -24,7 +24,6 @@
package jdk.test.lib;
import java.util.regex.Pattern;
-import jdk.test.lib.Utils;
public class Platform {
private static final String osName = System.getProperty("os.name");
--- a/hotspot/test/testlibrary/jdk/test/lib/ProcessTools.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/testlibrary/jdk/test/lib/ProcessTools.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,8 +27,6 @@
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
--- a/hotspot/test/testlibrary/jdk/test/lib/Utils.java Thu Aug 06 11:17:57 2015 -0700
+++ b/hotspot/test/testlibrary/jdk/test/lib/Utils.java Wed Jul 05 20:44:51 2017 +0200
@@ -24,9 +24,6 @@
package jdk.test.lib;
import static jdk.test.lib.Asserts.assertTrue;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetAddress;
@@ -58,12 +55,12 @@
public static final String NEW_LINE = System.getProperty("line.separator");
/**
- * Returns the value of 'test.vm.opts'system property.
+ * Returns the value of 'test.vm.opts' system property.
*/
public static final String VM_OPTIONS = System.getProperty("test.vm.opts", "").trim();
/**
- * Returns the value of 'test.java.opts'system property.
+ * Returns the value of 'test.java.opts' system property.
*/
public static final String JAVA_OPTIONS = System.getProperty("test.java.opts", "").trim();
@@ -129,7 +126,7 @@
/**
* Returns the default JTReg arguments for a jvm running a test.
* This is the combination of JTReg arguments test.vm.opts and test.java.opts.
- * @return An array of options, or an empty array if no opptions.
+ * @return An array of options, or an empty array if no options.
*/
public static String[] getTestJavaOpts() {
List<String> opts = new ArrayList<String>();
@@ -276,7 +273,7 @@
* 12254 /tmp/jdk8/tl/jdk/JTwork/classes/com/sun/tools/attach/Application.jar
*
* @param key A regular expression to search for.
- * @return The found pid, or -1 if Enot found.
+ * @return The found pid, or -1 if not found.
* @throws Exception If multiple matching jvms are found.
*/
public static int tryFindJvmPid(String key) throws Throwable {
@@ -392,7 +389,7 @@
* @param condition, a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true
* specifying -1 will wait forever
- * @return condition value, to determine if wait was successfull
+ * @return condition value, to determine if wait was successful
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout) {
@@ -406,7 +403,7 @@
* @param timeout a time in milliseconds to wait for condition to be true,
* specifying -1 will wait forever
* @param sleepTime a time to sleep value in milliseconds
- * @return condition value, to determine if wait was successfull
+ * @return condition value, to determine if wait was successful
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout, long sleepTime) {
--- a/jdk/.hgtags Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/.hgtags Wed Jul 05 20:44:51 2017 +0200
@@ -318,3 +318,4 @@
1c8bca2ebba13948199de33a1b71e2d6f1c7a8a6 jdk9-b73
6dd82d2e4a104f4d204b2890f33ef11ec3e3f8d0 jdk9-b74
4dd09cb5f7c2a2a23a9958ea7a602dd74d5709b2 jdk9-b75
+4526c0da8fb362eebd7e88f4d44e86858cf9b80b jdk9-b76
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/CopyInterimCLDRConverter.gmk Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2015, 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. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# 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.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+##########################################################################################
+
+### CLDRConverter needs the JRE time zone names from the java.base source.
+
+define cldrconverter_copytznames
+ $(MKDIR) -p '$(@D)'
+ $(RM) '$@'
+ $(SED) -e "s/package sun.util.resources/package build.tools.cldrconverter/" \
+ -e "s/extends TimeZoneNamesBundle//" \
+ -e "s/protected final/static final/" \
+ < $(<) > $@
+endef
+
+$(eval $(call SetupCopyFiles,COPY_INTERIM_CLDRCONVERTER, \
+ SRC := $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/resources, \
+ DEST := $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes/build/tools/cldrconverter, \
+ FILES := TimeZoneNames.java, \
+ MACRO := cldrconverter_copytznames))
+
+##########################################################################################
+
+all: $(COPY_INTERIM_CLDRCONVERTER)
--- a/jdk/make/Tools.gmk Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/make/Tools.gmk Wed Jul 05 20:44:51 2017 +0200
@@ -38,8 +38,8 @@
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
SETUP := GENERATE_OLDBYTECODE, \
- ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes", \
- SRC := $(JDK_TOPDIR)/make/src/classes, \
+ ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes", \
+ SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
COPY := boot.modules ext.modules))
--- a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,10 @@
$(eval $(call SetupLauncher,jsadebugd, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.jdi.SADebugServer"$(COMMA) }' \
- -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
,,,,,,,,,Info-privileged.plist))
+
+$(eval $(call SetupLauncher,jhsdb, \
+ -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.jvm.hotspot.SALauncher"$(COMMA) }' \
+ ,,,,,,,,,Info-privileged.plist))
+
--- a/jdk/make/mapfiles/libnio/mapfile-linux Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/make/mapfiles/libnio/mapfile-linux Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2015, 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
@@ -135,9 +135,7 @@
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
- Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
- Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
- Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
+ Java_sun_nio_fs_GnomeFileTypeDetector_probeGio;
Java_sun_nio_fs_MagicFileTypeDetector_initialize0;
Java_sun_nio_fs_MagicFileTypeDetector_probe0;
Java_sun_nio_fs_LinuxWatchService_eventSize;
--- a/jdk/make/mapfiles/libnio/mapfile-solaris Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/make/mapfiles/libnio/mapfile-solaris Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2015, 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
@@ -130,9 +130,7 @@
Java_sun_nio_ch_SolarisEventPort_port_1getn;
Java_sun_nio_ch_SolarisEventPort_port_1send;
Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
- Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
- Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
- Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
+ Java_sun_nio_fs_GnomeFileTypeDetector_probeGio;
Java_sun_nio_fs_UnixNativeDispatcher_init;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
--- a/jdk/make/src/classes/build/tools/cldrconverter/Bundle.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/make/src/classes/build/tools/cldrconverter/Bundle.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,12 +27,15 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Enumeration;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Objects;
+import java.util.ResourceBundle;
class Bundle {
static enum Type {
@@ -145,6 +148,13 @@
return id;
}
+ String getJavaID() {
+ // Tweak ISO compatibility for bundle generation
+ return id.replaceFirst("^he", "iw")
+ .replaceFirst("^id", "in")
+ .replaceFirst("^yi", "ji");
+ }
+
boolean isRoot() {
return "root".equals(id);
}
@@ -298,8 +308,8 @@
continue;
}
- if (id.startsWith("en")) {
- fillInAbbrs(key, nameMap);
+ if (id.equals("en")) {
+ fillInJREs(key, nameMap);
}
}
}
@@ -381,7 +391,8 @@
if (Objects.nonNull(parentsMap)) {
for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
String key = it.next();
- if (Objects.deepEquals(parentsMap.get(key), myMap.get(key))) {
+ if (!key.equals("numberingScripts") && // real body "NumberElements" may differ
+ Objects.deepEquals(parentsMap.get(key), myMap.get(key))) {
it.remove();
}
}
@@ -621,78 +632,41 @@
return null;
}
- private void fillInAbbrs(String key, Map<String, String> map) {
- fillInAbbrs(TZ_STD_LONG_KEY, TZ_STD_SHORT_KEY, map);
- fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
- fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
+ static Object[][] jreTimeZoneNames = TimeZoneNames.getContents();
+ private void fillInJREs(String key, Map<String, String> map) {
+ String tzid = null;
- // If the standard std is "Standard Time" and daylight std is "Summer Time",
- // replace the standard std with the generic std to avoid using
- // the same abbrivation except for Australia time zone names.
- String std = map.get(TZ_STD_SHORT_KEY);
- String dst = map.get(TZ_DST_SHORT_KEY);
- String gen = map.get(TZ_GEN_SHORT_KEY);
- if (std != null) {
- if (dst == null) {
- // if dst is null, create long and short names from the standard
- // std. ("Something Standard Time" to "Something Daylight Time",
- // or "Something Time" to "Something Summer Time")
- String name = map.get(TZ_STD_LONG_KEY);
- if (name != null) {
- if (name.contains("Standard Time")) {
- name = name.replace("Standard Time", "Daylight Time");
- } else if (name.endsWith("Mean Time")) {
- if (!name.startsWith("Greenwich ")) {
- name = name.replace("Mean Time", "Summer Time");
+ if (key.startsWith(CLDRConverter.METAZONE_ID_PREFIX)) {
+ // Look for tzid
+ String meta = key.substring(CLDRConverter.METAZONE_ID_PREFIX.length());
+ if (meta.equals("GMT")) {
+ tzid = meta;
+ } else {
+ for (String tz : CLDRConverter.handlerMetaZones.keySet()) {
+ if (CLDRConverter.handlerMetaZones.get(tz).equals(meta)) {
+ tzid = tz;
+ break;
}
- } else if (name.endsWith(" Time")) {
- name = name.replace(" Time", " Summer Time");
}
- map.put(TZ_DST_LONG_KEY, name);
- fillInAbbrs(TZ_DST_LONG_KEY, TZ_DST_SHORT_KEY, map);
+ }
+ } else {
+ tzid = key.substring(CLDRConverter.TIMEZONE_ID_PREFIX.length());
+ }
+
+ if (tzid != null) {
+ for (Object[] jreZone : jreTimeZoneNames) {
+ if (jreZone[0].equals(tzid)) {
+ for (int i = 0; i < ZONE_NAME_KEYS.length; i++) {
+ if (map.get(ZONE_NAME_KEYS[i]) == null) {
+ String[] jreNames = (String[])jreZone[1];
+ map.put(ZONE_NAME_KEYS[i], jreNames[i]);
}
}
- if (gen == null) {
- String name = map.get(TZ_STD_LONG_KEY);
- if (name != null) {
- if (name.endsWith("Standard Time")) {
- name = name.replace("Standard Time", "Time");
- } else if (name.endsWith("Mean Time")) {
- if (!name.startsWith("Greenwich ")) {
- name = name.replace("Mean Time", "Time");
- }
- }
- map.put(TZ_GEN_LONG_KEY, name);
- fillInAbbrs(TZ_GEN_LONG_KEY, TZ_GEN_SHORT_KEY, map);
- }
- }
+ break;
}
}
-
- private void fillInAbbrs(String longKey, String shortKey, Map<String, String> map) {
- String abbr = map.get(shortKey);
- if (abbr == null) {
- String name = map.get(longKey);
- if (name != null) {
- abbr = toAbbr(name);
- if (abbr != null) {
- map.put(shortKey, abbr);
- }
}
}
- }
-
- private String toAbbr(String name) {
- String[] substrs = name.split("\\s+");
- StringBuilder sb = new StringBuilder();
- for (String s : substrs) {
- char c = s.charAt(0);
- if (c >= 'A' && c <= 'Z') {
- sb.append(c);
- }
- }
- return sb.length() > 0 ? sb.toString() : null;
- }
private void convert(CalendarType calendarType, char cldrLetter, int count, StringBuilder sb) {
switch (cldrLetter) {
--- a/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java Wed Jul 05 20:44:51 2017 +0200
@@ -433,35 +433,35 @@
Map<String, Object> localeNamesMap = extractLocaleNames(targetMap, bundle.getID());
if (!localeNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("LocaleNames").add(toLanguageTag(bundle.getID()));
- bundleGenerator.generateBundle("util", "LocaleNames", bundle.getID(), true, localeNamesMap, BundleType.OPEN);
+ bundleGenerator.generateBundle("util", "LocaleNames", bundle.getJavaID(), true, localeNamesMap, BundleType.OPEN);
}
}
if (bundleTypes.contains(Bundle.Type.CURRENCYNAMES)) {
Map<String, Object> currencyNamesMap = extractCurrencyNames(targetMap, bundle.getID(), bundle.getCurrencies());
if (!currencyNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CurrencyNames").add(toLanguageTag(bundle.getID()));
- bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getID(), true, currencyNamesMap, BundleType.OPEN);
+ bundleGenerator.generateBundle("util", "CurrencyNames", bundle.getJavaID(), true, currencyNamesMap, BundleType.OPEN);
}
}
if (bundleTypes.contains(Bundle.Type.TIMEZONENAMES)) {
Map<String, Object> zoneNamesMap = extractZoneNames(targetMap, bundle.getID());
if (!zoneNamesMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("TimeZoneNames").add(toLanguageTag(bundle.getID()));
- bundleGenerator.generateBundle("util", "TimeZoneNames", bundle.getID(), true, zoneNamesMap, BundleType.TIMEZONE);
+ bundleGenerator.generateBundle("util", "TimeZoneNames", bundle.getJavaID(), true, zoneNamesMap, BundleType.TIMEZONE);
}
}
if (bundleTypes.contains(Bundle.Type.CALENDARDATA)) {
Map<String, Object> calendarDataMap = extractCalendarData(targetMap, bundle.getID());
if (!calendarDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("CalendarData").add(toLanguageTag(bundle.getID()));
- bundleGenerator.generateBundle("util", "CalendarData", bundle.getID(), true, calendarDataMap, BundleType.PLAIN);
+ bundleGenerator.generateBundle("util", "CalendarData", bundle.getJavaID(), true, calendarDataMap, BundleType.PLAIN);
}
}
if (bundleTypes.contains(Bundle.Type.FORMATDATA)) {
Map<String, Object> formatDataMap = extractFormatData(targetMap, bundle.getID());
if (!formatDataMap.isEmpty() || bundle.isRoot()) {
metaInfo.get("FormatData").add(toLanguageTag(bundle.getID()));
- bundleGenerator.generateBundle("text", "FormatData", bundle.getID(), true, formatDataMap, BundleType.PLAIN);
+ bundleGenerator.generateBundle("text", "FormatData", bundle.getJavaID(), true, formatDataMap, BundleType.PLAIN);
}
}
--- a/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/make/src/classes/build/tools/cldrconverter/LDMLParseHandler.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
import java.io.File;
import java.io.IOException;
+import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -900,6 +901,12 @@
Entry<?> entry = (Entry<?>) currentContainer;
Object value = entry.getValue();
if (value != null) {
+ String key = entry.getKey();
+ // Tweak for MonthNames for the root locale, Needed for
+ // SimpleDateFormat.format()/parse() roundtrip.
+ if (id.equals("root") && key.startsWith("MonthNames")) {
+ value = new DateFormatSymbols(Locale.US).getShortMonths();
+ }
put(entry.getKey(), value);
}
}
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/BlowfishCipher.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/BlowfishCipher.java Wed Jul 05 20:44:51 2017 +0200
@@ -82,7 +82,7 @@
/**
* Sets the padding mechanism of this cipher.
*
- * @param padding the padding mechanism
+ * @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* does not exist
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESCipher.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESCipher.java Wed Jul 05 20:44:51 2017 +0200
@@ -77,7 +77,7 @@
/**
* Sets the padding mechanism of this cipher.
*
- * @param padding the padding mechanism
+ * @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* does not exist
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeCipher.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeCipher.java Wed Jul 05 20:44:51 2017 +0200
@@ -74,7 +74,7 @@
/**
* Sets the padding mechanism of this cipher.
*
- * @param padding the padding mechanism
+ * @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* does not exist
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DESedeWrapCipher.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,7 +32,7 @@
/**
* This class implements the CMS DESede KeyWrap algorithm as defined
- * in <a href=http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap>
+ * in <a href=http://www.w3.org/TR/xmlenc-core/#sec-Alg-SymmetricKeyWrap></a>
* "XML Encryption Syntax and Processing" section 5.6.2
* "CMS Triple DES Key Wrap".
* Note: only <code>CBC</code> mode and <code>NoPadding</code> padding
@@ -159,9 +159,8 @@
/**
* Initializes this cipher with a key and a source of randomness.
*
- * <p>The cipher only supports the following two operation modes:<b>
- * Cipher.WRAP_MODE, and <b>
- * Cipher.UNWRAP_MODE.
+ * <p>The cipher only supports the following two operation modes:
+ * {@code Cipher.WRAP_MODE}, and {@code Cipher.UNWRAP_MODE}.
* <p>For modes other than the above two, UnsupportedOperationException
* will be thrown.
* <p>If this cipher requires an initialization vector (IV), it will get
@@ -192,9 +191,8 @@
* Initializes this cipher with a key, a set of algorithm parameters,
* and a source of randomness.
*
- * <p>The cipher only supports the following two operation modes:<b>
- * Cipher.WRAP_MODE, and <b>
- * Cipher.UNWRAP_MODE.
+ * <p>The cipher only supports the following two operation modes:
+ * {@code Cipher.WRAP_MODE}, and {@code Cipher.UNWRAP_MODE}.
* <p>For modes other than the above two, UnsupportedOperationException
* will be thrown.
* <p>If this cipher requires an initialization vector (IV), it will get
@@ -252,9 +250,8 @@
* Initializes this cipher with a key, a set of algorithm parameters,
* and a source of randomness.
*
- * <p>The cipher only supports the following two operation modes:<b>
- * Cipher.WRAP_MODE, and <b>
- * Cipher.UNWRAP_MODE.
+ * <p>The cipher only supports the following two operation modes:
+ * {@code Cipher.WRAP_MODE}, and {@code Cipher.UNWRAP_MODE}.
* <p>For modes other than the above two, UnsupportedOperationException
* will be thrown.
* <p>If this cipher requires an initialization vector (IV), it will get
@@ -360,15 +357,15 @@
* current Cipher.engineInit(...) implementation,
* IllegalStateException will always be thrown upon invocation.
*
- * @param in the input buffer.
- * @param inOffset the offset in <code>in</code> where the input
+ * @param input the input buffer.
+ * @param inputOffset the offset in {@code input} where the input
* starts.
- * @param inLen the input length.
- * @param out the buffer for the result.
- * @param outOffset the ofset in <code>out</code> where the result
+ * @param inputLen the input length.
+ * @param output the buffer for the result.
+ * @param outputOffset the ofset in {@code output} where the result
* is stored.
*
- * @return the number of bytes stored in <code>out</code>.
+ * @return the number of bytes stored in {@code out}.
*
* @exception IllegalStateException upon invocation of this method.
*/
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java Wed Jul 05 20:44:51 2017 +0200
@@ -100,7 +100,7 @@
* generator, and optionally the requested size in bits of the random
* exponent (private value).
*
- * @param params the parameter set used to generate the key pair
+ * @param algParams the parameter set used to generate the key pair
* @param random the source of randomness
*
* @exception InvalidAlgorithmParameterException if the given parameters
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/DHParameterGenerator.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/DHParameterGenerator.java Wed Jul 05 20:44:51 2017 +0200
@@ -92,7 +92,7 @@
* generation values, which specify the size of the prime modulus and
* the size of the random exponent, both in bits.
*
- * @param params the set of parameter generation values
+ * @param genParamSpec the set of parameter generation values
* @param random the source of randomness
*
* @exception InvalidAlgorithmParameterException if the given parameter
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEWithMD5AndDESCipher.java Wed Jul 05 20:44:51 2017 +0200
@@ -80,7 +80,7 @@
* Sets the padding mechanism of this cipher. This algorithm only uses
* PKCS #5 padding.
*
- * @param padding the padding mechanism
+ * @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* is invalid
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBEWithMD5AndTripleDESCipher.java Wed Jul 05 20:44:51 2017 +0200
@@ -92,7 +92,7 @@
* Sets the padding mechanism of this cipher. This algorithm only uses
* PKCS #5 padding.
*
- * @param padding the padding mechanism
+ * @param paddingScheme the padding mechanism
*
* @exception NoSuchPaddingException if the requested padding mechanism
* is invalid
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java Wed Jul 05 20:44:51 2017 +0200
@@ -75,7 +75,7 @@
*
* @param key the key
*
- * @param keySpec the requested format in which the key material shall be
+ * @param keySpecCl the requested format in which the key material shall be
* returned
*
* @return the underlying key specification (key material) in the
--- a/jdk/src/java.base/share/classes/java/io/BufferedOutputStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/BufferedOutputStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -42,8 +42,8 @@
/**
* The number of valid bytes in the buffer. This value is always
- * in the range <tt>0</tt> through <tt>buf.length</tt>; elements
- * <tt>buf[0]</tt> through <tt>buf[count-1]</tt> contain valid
+ * in the range {@code 0} through {@code buf.length}; elements
+ * {@code buf[0]} through {@code buf[count-1]} contain valid
* byte data.
*/
protected int count;
--- a/jdk/src/java.base/share/classes/java/io/BufferedReader.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/BufferedReader.java Wed Jul 05 20:44:51 2017 +0200
@@ -170,7 +170,7 @@
* Reads a single character.
*
* @return The character read, as an integer in the range
- * 0 to 65535 (<tt>0x00-0xffff</tt>), or -1 if the
+ * 0 to 65535 ({@code 0x00-0xffff}), or -1 if the
* end of the stream has been reached
* @exception IOException If an I/O error occurs
*/
--- a/jdk/src/java.base/share/classes/java/io/BufferedWriter.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/BufferedWriter.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,7 +34,7 @@
* The default is large enough for most purposes.
*
* <p> A newLine() method is provided, which uses the platform's own notion of
- * line separator as defined by the system property <tt>line.separator</tt>.
+ * line separator as defined by the system property {@code line.separator}.
* Not all platforms use the newline character ('\n') to terminate lines.
* Calling this method to terminate each output line is therefore preferred to
* writing a newline character directly.
@@ -195,7 +195,7 @@
/**
* Writes a portion of a String.
*
- * <p> If the value of the <tt>len</tt> parameter is negative then no
+ * <p> If the value of the {@code len} parameter is negative then no
* characters are written. This is contrary to the specification of this
* method in the {@linkplain java.io.Writer#write(java.lang.String,int,int)
* superclass}, which requires that an {@link IndexOutOfBoundsException} be
@@ -225,7 +225,7 @@
/**
* Writes a line separator. The line separator string is defined by the
- * system property <tt>line.separator</tt>, and is not necessarily a single
+ * system property {@code line.separator}, and is not necessarily a single
* newline ('\n') character.
*
* @exception IOException If an I/O error occurs
--- a/jdk/src/java.base/share/classes/java/io/ByteArrayInputStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/ByteArrayInputStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,9 +32,9 @@
* counter keeps track of the next byte to
* be supplied by the <code>read</code> method.
* <p>
- * Closing a <tt>ByteArrayInputStream</tt> has no effect. The methods in
+ * Closing a {@code ByteArrayInputStream} has no effect. The methods in
* this class can be called after the stream has been closed without
- * generating an <tt>IOException</tt>.
+ * generating an {@code IOException}.
*
* @author Arthur van Hoff
* @see java.io.StringBufferInputStream
@@ -272,9 +272,9 @@
}
/**
- * Closing a <tt>ByteArrayInputStream</tt> has no effect. The methods in
+ * Closing a {@code ByteArrayInputStream} has no effect. The methods in
* this class can be called after the stream has been closed without
- * generating an <tt>IOException</tt>.
+ * generating an {@code IOException}.
*/
public void close() throws IOException {
}
--- a/jdk/src/java.base/share/classes/java/io/ByteArrayOutputStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/ByteArrayOutputStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -31,12 +31,12 @@
* This class implements an output stream in which the data is
* written into a byte array. The buffer automatically grows as data
* is written to it.
- * The data can be retrieved using <code>toByteArray()</code> and
- * <code>toString()</code>.
+ * The data can be retrieved using {@code toByteArray()} and
+ * {@code toString()}.
* <p>
- * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
+ * Closing a {@code ByteArrayOutputStream} has no effect. The methods in
* this class can be called after the stream has been closed without
- * generating an <tt>IOException</tt>.
+ * generating an {@code IOException}.
*
* @author Arthur van Hoff
* @since 1.0
@@ -138,8 +138,8 @@
}
/**
- * Writes <code>len</code> bytes from the specified byte array
- * starting at offset <code>off</code> to this byte array output stream.
+ * Writes {@code len} bytes from the specified byte array
+ * starting at offset {@code off} to this byte array output stream.
*
* @param b the data.
* @param off the start offset in the data.
@@ -158,7 +158,7 @@
/**
* Writes the complete contents of this byte array output stream to
* the specified output stream argument, as if by calling the output
- * stream's write method using <code>out.write(buf, 0, count)</code>.
+ * stream's write method using {@code out.write(buf, 0, count)}.
*
* @param out the output stream to which to write the data.
* @exception IOException if an I/O error occurs.
@@ -168,7 +168,7 @@
}
/**
- * Resets the <code>count</code> field of this byte array output
+ * Resets the {@code count} field of this byte array output
* stream to zero, so that all currently accumulated output in the
* output stream is discarded. The output stream can be used again,
* reusing the already allocated buffer space.
@@ -194,7 +194,7 @@
/**
* Returns the current size of the buffer.
*
- * @return the value of the <code>count</code> field, which is the number
+ * @return the value of the {@code count} field, which is the number
* of valid bytes in this output stream.
* @see java.io.ByteArrayOutputStream#count
*/
@@ -204,7 +204,7 @@
/**
* Converts the buffer's contents into a string decoding bytes using the
- * platform's default character set. The length of the new <tt>String</tt>
+ * platform's default character set. The length of the new {@code String}
* is a function of the character set, and hence may not be equal to the
* size of the buffer.
*
@@ -224,7 +224,7 @@
/**
* Converts the buffer's contents into a string by decoding the bytes using
* the named {@link java.nio.charset.Charset charset}. The length of the new
- * <tt>String</tt> is a function of the charset, and hence may not be equal
+ * {@code String} is a function of the charset, and hence may not be equal
* to the length of the byte array.
*
* <p> This method always replaces malformed-input and unmappable-character
@@ -251,14 +251,14 @@
* copied into it. Each character <i>c</i> in the resulting string is
* constructed from the corresponding element <i>b</i> in the byte
* array such that:
- * <blockquote><pre>
- * c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))
- * </pre></blockquote>
+ * <blockquote><pre>{@code
+ * c == (char)(((hibyte & 0xff) << 8) | (b & 0xff))
+ * }</pre></blockquote>
*
* @deprecated This method does not properly convert bytes into characters.
* As of JDK 1.1, the preferred way to do this is via the
- * <code>toString(String enc)</code> method, which takes an encoding-name
- * argument, or the <code>toString()</code> method, which uses the
+ * {@code toString(String enc)} method, which takes an encoding-name
+ * argument, or the {@code toString()} method, which uses the
* platform's default character encoding.
*
* @param hibyte the high byte of each resulting Unicode character.
@@ -273,9 +273,9 @@
}
/**
- * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
+ * Closing a {@code ByteArrayOutputStream} has no effect. The methods in
* this class can be called after the stream has been closed without
- * generating an <tt>IOException</tt>.
+ * generating an {@code IOException}.
*/
public void close() throws IOException {
}
--- a/jdk/src/java.base/share/classes/java/io/CharArrayReader.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/CharArrayReader.java Wed Jul 05 20:44:51 2017 +0200
@@ -62,13 +62,13 @@
* Creates a CharArrayReader from the specified array of chars.
*
* <p> The resulting reader will start reading at the given
- * <tt>offset</tt>. The total number of <tt>char</tt> values that can be
- * read from this reader will be either <tt>length</tt> or
- * <tt>buf.length-offset</tt>, whichever is smaller.
+ * {@code offset}. The total number of {@code char} values that can be
+ * read from this reader will be either {@code length} or
+ * {@code buf.length-offset}, whichever is smaller.
*
* @throws IllegalArgumentException
- * If <tt>offset</tt> is negative or greater than
- * <tt>buf.length</tt>, or if <tt>length</tt> is negative, or if
+ * If {@code offset} is negative or greater than
+ * {@code buf.length}, or if {@code length} is negative, or if
* the sum of these two values is negative.
*
* @param buf Input buffer (not copied)
--- a/jdk/src/java.base/share/classes/java/io/CharArrayWriter.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/CharArrayWriter.java Wed Jul 05 20:44:51 2017 +0200
@@ -141,21 +141,21 @@
/**
* Appends the specified character sequence to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(csq)</tt>
+ * <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.write(csq.toString()) </pre>
*
- * <p> Depending on the specification of <tt>toString</tt> for the
- * character sequence <tt>csq</tt>, the entire sequence may not be
- * appended. For instance, invoking the <tt>toString</tt> method of a
+ * <p> Depending on the specification of {@code toString} for the
+ * character sequence {@code csq}, the entire sequence may not be
+ * appended. For instance, invoking the {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
- * The character sequence to append. If <tt>csq</tt> is
- * <tt>null</tt>, then the four characters <tt>"null"</tt> are
+ * The character sequence to append. If {@code csq} is
+ * {@code null}, then the four characters "{@code null}" are
* appended to this writer.
*
* @return This writer
@@ -171,8 +171,9 @@
/**
* Appends a subsequence of the specified character sequence to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(csq, start,
- * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
+ * <p> An invocation of this method of the form
+ * {@code out.append(csq, start, end)} when
+ * {@code csq} is not {@code null}, behaves in
* exactly the same way as the invocation
*
* <pre>
@@ -180,9 +181,9 @@
*
* @param csq
* The character sequence from which a subsequence will be
- * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
- * will be appended as if <tt>csq</tt> contained the four
- * characters <tt>"null"</tt>.
+ * appended. If {@code csq} is {@code null}, then characters
+ * will be appended as if {@code csq} contained the four
+ * characters "{@code null}".
*
* @param start
* The index of the first character in the subsequence
@@ -194,9 +195,9 @@
* @return This writer
*
* @throws IndexOutOfBoundsException
- * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
- * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
- * <tt>csq.length()</tt>
+ * If {@code start} or {@code end} are negative, {@code start}
+ * is greater than {@code end}, or {@code end} is greater than
+ * {@code csq.length()}
*
* @since 1.5
*/
@@ -209,7 +210,7 @@
/**
* Appends the specified character to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(c)</tt>
+ * <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
* <pre>
--- a/jdk/src/java.base/share/classes/java/io/Console.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/Console.java Wed Jul 05 20:44:51 2017 +0200
@@ -47,7 +47,7 @@
* If this virtual machine has a console then it is represented by a
* unique instance of this class which can be obtained by invoking the
* {@link java.lang.System#console()} method. If no console device is
- * available then an invocation of that method will return <tt>null</tt>.
+ * available then an invocation of that method will return {@code null}.
* <p>
* Read and write operations are synchronized to guarantee the atomic
* completion of critical operations; therefore invoking methods
@@ -56,17 +56,17 @@
* on the objects returned by {@link #reader()} and {@link #writer()} may
* block in multithreaded scenarios.
* <p>
- * Invoking <tt>close()</tt> on the objects returned by the {@link #reader()}
+ * Invoking {@code close()} on the objects returned by the {@link #reader()}
* and the {@link #writer()} will not close the underlying stream of those
* objects.
* <p>
- * The console-read methods return <tt>null</tt> when the end of the
+ * The console-read methods return {@code null} when the end of the
* console input stream is reached, for example by typing control-D on
* Unix or control-Z on Windows. Subsequent read operations will succeed
* if additional characters are later entered on the console's input
* device.
* <p>
- * Unless otherwise specified, passing a <tt>null</tt> argument to any method
+ * Unless otherwise specified, passing a {@code null} argument to any method
* in this class will cause a {@link NullPointerException} to be thrown.
* <p>
* <b>Security note:</b>
@@ -107,7 +107,7 @@
* <p>
* This method is intended to be used by sophisticated applications, for
* example, a {@link java.util.Scanner} object which utilizes the rich
- * parsing/scanning functionality provided by the <tt>Scanner</tt>:
+ * parsing/scanning functionality provided by the {@code Scanner}:
* <blockquote><pre>
* Console con = System.console();
* if (con != null) {
@@ -117,7 +117,7 @@
* </pre></blockquote>
* <p>
* For simple applications requiring only line-oriented reading, use
- * <tt>{@link #readLine}</tt>.
+ * {@link #readLine}.
* <p>
* The bulk read operations {@link java.io.Reader#read(char[]) read(char[]) },
* {@link java.io.Reader#read(char[], int, int) read(char[], int, int) } and
@@ -126,8 +126,8 @@
* bound for each invocation, even if the destination buffer has space for
* more characters. The {@code Reader}'s {@code read} methods may block if a
* line bound has not been entered or reached on the console's input device.
- * A line bound is considered to be any one of a line feed (<tt>'\n'</tt>),
- * a carriage return (<tt>'\r'</tt>), a carriage return followed immediately
+ * A line bound is considered to be any one of a line feed ({@code '\n'}),
+ * a carriage return ({@code '\r'}), a carriage return followed immediately
* by a linefeed, or an end of stream.
*
* @return The reader associated with this console
@@ -152,7 +152,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws IllegalFormatException
@@ -175,8 +175,9 @@
* A convenience method to write a formatted string to this console's
* output stream using the specified format string and arguments.
*
- * <p> An invocation of this method of the form <tt>con.printf(format,
- * args)</tt> behaves in exactly the same way as the invocation of
+ * <p> An invocation of this method of the form
+ * {@code con.printf(format, args)} behaves in exactly the same way
+ * as the invocation of
* <pre>con.format(format, args)</pre>.
*
* @param format
@@ -191,7 +192,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws IllegalFormatException
@@ -237,7 +238,7 @@
* If an I/O error occurs.
*
* @return A string containing the line read from the console, not
- * including any line-termination characters, or <tt>null</tt>
+ * including any line-termination characters, or {@code null}
* if an end of stream has been reached.
*/
public String readLine(String fmt, Object ... args) {
@@ -265,7 +266,7 @@
* If an I/O error occurs.
*
* @return A string containing the line read from the console, not
- * including any line-termination characters, or <tt>null</tt>
+ * including any line-termination characters, or {@code null}
* if an end of stream has been reached.
*/
public String readLine() {
@@ -302,7 +303,7 @@
*
* @return A character array containing the password or passphrase read
* from the console, not including any line-termination characters,
- * or <tt>null</tt> if an end of stream has been reached.
+ * or {@code null} if an end of stream has been reached.
*/
public char[] readPassword(String fmt, Object ... args) {
char[] passwd = null;
@@ -346,7 +347,7 @@
*
* @return A character array containing the password or passphrase read
* from the console, not including any line-termination characters,
- * or <tt>null</tt> if an end of stream has been reached.
+ * or {@code null} if an end of stream has been reached.
*/
public char[] readPassword() {
return readPassword("");
--- a/jdk/src/java.base/share/classes/java/io/File.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/File.java Wed Jul 05 20:44:51 2017 +0200
@@ -63,8 +63,8 @@
* pathname string, each name is separated from the next by a single copy of
* the default <em>separator character</em>. The default name-separator
* character is defined by the system property <code>file.separator</code>, and
- * is made available in the public static fields <code>{@link
- * #separator}</code> and <code>{@link #separatorChar}</code> of this class.
+ * is made available in the public static fields {@link
+ * #separator} and {@link #separatorChar} of this class.
* When a pathname string is converted into an abstract pathname, the names
* within it may be separated by the default name-separator character or by any
* other name-separator character that is supported by the underlying system.
@@ -82,11 +82,11 @@
* <p> The <em>parent</em> of an abstract pathname may be obtained by invoking
* the {@link #getParent} method of this class and consists of the pathname's
* prefix and each name in the pathname's name sequence except for the last.
- * Each directory's absolute pathname is an ancestor of any <tt>File</tt>
+ * Each directory's absolute pathname is an ancestor of any {@code File}
* object with an absolute abstract pathname which begins with the directory's
* absolute pathname. For example, the directory denoted by the abstract
- * pathname <tt>"/usr"</tt> is an ancestor of the directory denoted by the
- * pathname <tt>"/usr/local/bin"</tt>.
+ * pathname {@code "/usr"} is an ancestor of the directory denoted by the
+ * pathname {@code "/usr/local/bin"}.
*
* <p> The prefix concept is used to handle root directories on UNIX platforms,
* and drive specifiers, root directories and UNC pathnames on Microsoft Windows platforms,
@@ -217,7 +217,7 @@
/**
* The system-dependent default name-separator character, represented as a
* string for convenience. This string contains a single character, namely
- * <code>{@link #separatorChar}</code>.
+ * {@link #separatorChar}.
*/
public static final String separator = "" + separatorChar;
@@ -236,7 +236,7 @@
/**
* The system-dependent path-separator character, represented as a string
* for convenience. This string contains a single character, namely
- * <code>{@link #pathSeparatorChar}</code>.
+ * {@link #pathSeparatorChar}.
*/
public static final String pathSeparator = "" + pathSeparatorChar;
@@ -374,33 +374,34 @@
}
/**
- * Creates a new <tt>File</tt> instance by converting the given
- * <tt>file:</tt> URI into an abstract pathname.
+ * Creates a new {@code File} instance by converting the given
+ * {@code file:} URI into an abstract pathname.
*
- * <p> The exact form of a <tt>file:</tt> URI is system-dependent, hence
+ * <p> The exact form of a {@code file:} URI is system-dependent, hence
* the transformation performed by this constructor is also
* system-dependent.
*
* <p> For a given abstract pathname <i>f</i> it is guaranteed that
*
- * <blockquote><tt>
- * new File(</tt><i> f</i><tt>.{@link #toURI() toURI}()).equals(</tt><i> f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}())
- * </tt></blockquote>
+ * <blockquote><code>
+ * new File(</code><i> f</i><code>.{@link #toURI()
+ * toURI}()).equals(</code><i> f</i><code>.{@link #getAbsoluteFile() getAbsoluteFile}())
+ * </code></blockquote>
*
* so long as the original abstract pathname, the URI, and the new abstract
* pathname are all created in (possibly different invocations of) the same
* Java virtual machine. This relationship typically does not hold,
- * however, when a <tt>file:</tt> URI that is created in a virtual machine
+ * however, when a {@code file:} URI that is created in a virtual machine
* on one operating system is converted into an abstract pathname in a
* virtual machine on a different operating system.
*
* @param uri
* An absolute, hierarchical URI with a scheme equal to
- * <tt>"file"</tt>, a non-empty path component, and undefined
+ * {@code "file"}, a non-empty path component, and undefined
* authority, query, and fragment components
*
* @throws NullPointerException
- * If <tt>uri</tt> is <tt>null</tt>
+ * If {@code uri} is {@code null}
*
* @throws IllegalArgumentException
* If the preconditions on the parameter do not hold
@@ -533,7 +534,7 @@
* Returns the absolute pathname string of this abstract pathname.
*
* <p> If this abstract pathname is already absolute, then the pathname
- * string is simply returned as if by the <code>{@link #getPath}</code>
+ * string is simply returned as if by the {@link #getPath}
* method. If this abstract pathname is the empty abstract pathname then
* the pathname string of the current user directory, which is named by the
* system property <code>user.dir</code>, is returned. Otherwise this
@@ -581,7 +582,7 @@
* converts this pathname to absolute form if necessary, as if by invoking the
* {@link #getAbsolutePath} method, and then maps it to its unique form in a
* system-dependent way. This typically involves removing redundant names
- * such as <tt>"."</tt> and <tt>".."</tt> from the pathname, resolving
+ * such as {@code "."} and {@code ".."} from the pathname, resolving
* symbolic links (on UNIX platforms), and converting drive letters to a
* standard case (on Microsoft Windows platforms).
*
@@ -604,8 +605,8 @@
*
* @throws SecurityException
* If a required system property value cannot be accessed, or
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead}</code> method denies
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead} method denies
* read access to the file
*
* @since 1.1
@@ -632,8 +633,8 @@
*
* @throws SecurityException
* If a required system property value cannot be accessed, or
- * if a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead}</code> method denies
+ * if a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead} method denies
* read access to the file
*
* @since 1.2
@@ -687,7 +688,7 @@
}
/**
- * Constructs a <tt>file:</tt> URI that represents this abstract pathname.
+ * Constructs a {@code file:} URI that represents this abstract pathname.
*
* <p> The exact form of the URI is system-dependent. If it can be
* determined that the file denoted by this abstract pathname is a
@@ -695,15 +696,16 @@
*
* <p> For a given abstract pathname <i>f</i>, it is guaranteed that
*
- * <blockquote><tt>
- * new {@link #File(java.net.URI) File}(</tt><i> f</i><tt>.toURI()).equals(</tt><i> f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}())
- * </tt></blockquote>
+ * <blockquote><code>
+ * new {@link #File(java.net.URI) File}(</code><i> f</i><code>.toURI()).equals(
+ * </code><i> f</i><code>.{@link #getAbsoluteFile() getAbsoluteFile}())
+ * </code></blockquote>
*
* so long as the original abstract pathname, the URI, and the new abstract
* pathname are all created in (possibly different invocations of) the same
* Java virtual machine. Due to the system-dependent nature of abstract
* pathnames, however, this relationship typically does not hold when a
- * <tt>file:</tt> URI that is created in a virtual machine on one operating
+ * {@code file:} URI that is created in a virtual machine on one operating
* system is converted into an abstract pathname in a virtual machine on a
* different operating system.
*
@@ -716,7 +718,7 @@
* may be used to obtain a {@code Path} representing this abstract pathname.
*
* @return An absolute, hierarchical URI with a scheme equal to
- * <tt>"file"</tt>, a path representing this abstract pathname,
+ * {@code "file"}, a path representing this abstract pathname,
* and undefined authority, query, and fragment components
* @throws SecurityException If a required system property value cannot
* be accessed.
@@ -753,8 +755,8 @@
* application; <code>false</code> otherwise
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public boolean canRead() {
@@ -781,8 +783,8 @@
* <code>false</code> otherwise.
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*/
public boolean canWrite() {
@@ -804,8 +806,8 @@
* by this abstract pathname exists; <code>false</code> otherwise
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file or directory
*/
public boolean exists() {
@@ -834,8 +836,8 @@
* <code>false</code> otherwise
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public boolean isDirectory() {
@@ -867,8 +869,8 @@
* <code>false</code> otherwise
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public boolean isFile() {
@@ -894,8 +896,8 @@
* underlying platform
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*
* @since 1.2
@@ -928,8 +930,8 @@
* file does not exist or if an I/O error occurs
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public long lastModified() {
@@ -959,8 +961,8 @@
* denoting system-dependent entities such as devices or pipes.
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}
* method denies read access to the file
*/
public long length() {
@@ -997,8 +999,8 @@
* If an I/O error occurred
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.2
@@ -1026,8 +1028,8 @@
* successfully deleted; <code>false</code> otherwise
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkDelete}</code> method denies
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkDelete} method denies
* delete access to the file
*/
public boolean delete() {
@@ -1060,8 +1062,8 @@
* facility should be used instead.
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkDelete}</code> method denies
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkDelete} method denies
* delete access to the file
*
* @see #delete
@@ -1301,8 +1303,8 @@
* created; <code>false</code> otherwise
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method does not permit the named directory to be created
*/
public boolean mkdir() {
@@ -1327,12 +1329,12 @@
* otherwise
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkRead(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkRead(java.lang.String)}
* method does not permit verification of the existence of the
* named directory and all necessary parent directories; or if
- * the <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * the {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method does not permit the named directory and all necessary
* parent directories to be created
*/
@@ -1375,8 +1377,8 @@
* <code>false</code> otherwise
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to either the old or new pathnames
*
* @throws NullPointerException
@@ -1405,7 +1407,7 @@
* but some provide more precision. The argument will be truncated to fit
* the supported precision. If the operation succeeds and no intervening
* operations on the file take place, then the next invocation of the
- * <code>{@link #lastModified}</code> method will return the (possibly
+ * {@link #lastModified} method will return the (possibly
* truncated) <code>time</code> argument that was passed to this method.
*
* @param time The new last-modified time, measured in milliseconds since
@@ -1417,8 +1419,8 @@
* @throws IllegalArgumentException If the argument is negative
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the named file
*
* @since 1.2
@@ -1448,8 +1450,8 @@
* <code>false</code> otherwise
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the named file
*
* @since 1.2
@@ -1491,8 +1493,8 @@
* the access permissions of this abstract pathname.
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the named file
*
* @since 1.6
@@ -1514,11 +1516,12 @@
* machine with special privileges that allow it to modify files that
* disallow write operations.
*
- * <p> An invocation of this method of the form <tt>file.setWritable(arg)</tt>
+ * <p> An invocation of this method of the form {@code file.setWritable(arg)}
* behaves in exactly the same way as the invocation
*
- * <pre>
- * file.setWritable(arg, true) </pre>
+ * <pre>{@code
+ * file.setWritable(arg, true)
+ * }</pre>
*
* @param writable
* If <code>true</code>, sets the access permission to allow write
@@ -1529,8 +1532,8 @@
* change the access permissions of this abstract pathname.
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@@ -1568,8 +1571,8 @@
* operation will fail.
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@@ -1591,11 +1594,12 @@
* machine with special privileges that allow it to read files that are
* marked as unreadable.
*
- * <p>An invocation of this method of the form <tt>file.setReadable(arg)</tt>
+ * <p>An invocation of this method of the form {@code file.setReadable(arg)}
* behaves in exactly the same way as the invocation
*
- * <pre>
- * file.setReadable(arg, true) </pre>
+ * <pre>{@code
+ * file.setReadable(arg, true)
+ * }</pre>
*
* @param readable
* If <code>true</code>, sets the access permission to allow read
@@ -1609,8 +1613,8 @@
* operation will fail.
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@@ -1648,8 +1652,8 @@
* operation will fail.
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@@ -1671,11 +1675,12 @@
* virtual machine with special privileges that allow it to execute files
* that are not marked executable.
*
- * <p>An invocation of this method of the form <tt>file.setExcutable(arg)</tt>
+ * <p>An invocation of this method of the form {@code file.setExcutable(arg)}
* behaves in exactly the same way as the invocation
*
- * <pre>
- * file.setExecutable(arg, true) </pre>
+ * <pre>{@code
+ * file.setExecutable(arg, true)
+ * }</pre>
*
* @param executable
* If <code>true</code>, sets the access permission to allow execute
@@ -1689,8 +1694,8 @@
* operation will fail.
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method denies write access to the file
*
* @since 1.6
@@ -1710,8 +1715,8 @@
* <em>and</em> the application is allowed to execute the file
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkExec(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkExec(java.lang.String)}
* method denies execute access to the file
*
* @since 1.6
@@ -1783,12 +1788,12 @@
* Returns the size of the partition <a href="#partName">named</a> by this
* abstract pathname.
*
- * @return The size, in bytes, of the partition or <tt>0L</tt> if this
+ * @return The size, in bytes, of the partition or {@code 0L} if this
* abstract pathname does not name a partition
*
* @throws SecurityException
* If a security manager has been installed and it denies
- * {@link RuntimePermission}<tt>("getFileSystemAttributes")</tt>
+ * {@link RuntimePermission}{@code ("getFileSystemAttributes")}
* or its {@link SecurityManager#checkRead(String)} method denies
* read access to the file named by this abstract pathname
*
@@ -1819,14 +1824,14 @@
* makes no guarantee that write operations to this file system
* will succeed.
*
- * @return The number of unallocated bytes on the partition or <tt>0L</tt>
+ * @return The number of unallocated bytes on the partition or {@code 0L}
* if the abstract pathname does not name a partition. This
* value will be less than or equal to the total file system size
* returned by {@link #getTotalSpace}.
*
* @throws SecurityException
* If a security manager has been installed and it denies
- * {@link RuntimePermission}<tt>("getFileSystemAttributes")</tt>
+ * {@link RuntimePermission}{@code ("getFileSystemAttributes")}
* or its {@link SecurityManager#checkRead(String)} method denies
* read access to the file named by this abstract pathname
*
@@ -1860,14 +1865,14 @@
* virtual machine. This method makes no guarantee that write operations
* to this file system will succeed.
*
- * @return The number of available bytes on the partition or <tt>0L</tt>
+ * @return The number of available bytes on the partition or {@code 0L}
* if the abstract pathname does not name a partition. On
* systems where this information is not available, this method
* will be equivalent to a call to {@link #getFreeSpace}.
*
* @throws SecurityException
* If a security manager has been installed and it denies
- * {@link RuntimePermission}<tt>("getFileSystemAttributes")</tt>
+ * {@link RuntimePermission}{@code ("getFileSystemAttributes")}
* or its {@link SecurityManager#checkRead(String)} method denies
* read access to the file named by this abstract pathname
*
@@ -1939,7 +1944,7 @@
*
* This method provides only part of a temporary-file facility. To arrange
* for a file created by this method to be deleted automatically, use the
- * <code>{@link #deleteOnExit}</code> method.
+ * {@link #deleteOnExit} method.
*
* <p> The <code>prefix</code> argument must be at least three characters
* long. It is recommended that the prefix be a short, meaningful string
@@ -1987,8 +1992,8 @@
* @throws IOException If a file could not be created
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method does not allow a file to be created
*
* @since 1.2
@@ -2032,9 +2037,9 @@
/**
* Creates an empty file in the default temporary-file directory, using
* the given prefix and suffix to generate its name. Invoking this method
- * is equivalent to invoking <code>{@link #createTempFile(java.lang.String,
+ * is equivalent to invoking {@link #createTempFile(java.lang.String,
* java.lang.String, java.io.File)
- * createTempFile(prefix, suffix, null)}</code>.
+ * createTempFile(prefix, suffix, null)}.
*
* <p> The {@link
* java.nio.file.Files#createTempFile(String,String,java.nio.file.attribute.FileAttribute[])
@@ -2059,8 +2064,8 @@
* @throws IOException If a file could not be created
*
* @throws SecurityException
- * If a security manager exists and its <code>{@link
- * java.lang.SecurityManager#checkWrite(java.lang.String)}</code>
+ * If a security manager exists and its {@link
+ * java.lang.SecurityManager#checkWrite(java.lang.String)}
* method does not allow a file to be created
*
* @since 1.2
@@ -2136,7 +2141,7 @@
/**
* Returns the pathname string of this abstract pathname. This is just the
- * string returned by the <code>{@link #getPath}</code> method.
+ * string returned by the {@link #getPath} method.
*
* @return The string form of this abstract pathname
*/
--- a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -37,7 +37,7 @@
* <code>File</code> or to a <code>FileDescriptor</code>. Whether or not
* a file is available or may be created depends upon the underlying
* platform. Some platforms, in particular, allow a file to be opened
- * for writing by only one <tt>FileOutputStream</tt> (or other
+ * for writing by only one {@code FileOutputStream} (or other
* file-writing object) at a time. In such situations the constructors in
* this class will fail if the file involved is already open.
*
--- a/jdk/src/java.base/share/classes/java/io/FileReader.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/FileReader.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,9 +32,9 @@
* size are appropriate. To specify these values yourself, construct an
* InputStreamReader on a FileInputStream.
*
- * <p><code>FileReader</code> is meant for reading streams of characters.
+ * <p>{@code FileReader} is meant for reading streams of characters.
* For reading streams of raw bytes, consider using a
- * <code>FileInputStream</code>.
+ * {@code FileInputStream}.
*
* @see InputStreamReader
* @see FileInputStream
@@ -45,7 +45,7 @@
public class FileReader extends InputStreamReader {
/**
- * Creates a new <tt>FileReader</tt>, given the name of the
+ * Creates a new {@code FileReader}, given the name of the
* file to read from.
*
* @param fileName the name of the file to read from
@@ -59,10 +59,10 @@
}
/**
- * Creates a new <tt>FileReader</tt>, given the <tt>File</tt>
+ * Creates a new {@code FileReader}, given the {@code File}
* to read from.
*
- * @param file the <tt>File</tt> to read from
+ * @param file the {@code File} to read from
* @exception FileNotFoundException if the file does not exist,
* is a directory rather than a regular file,
* or for some other reason cannot be opened for
@@ -73,8 +73,8 @@
}
/**
- * Creates a new <tt>FileReader</tt>, given the
- * <tt>FileDescriptor</tt> to read from.
+ * Creates a new {@code FileReader}, given the
+ * {@code FileDescriptor} to read from.
*
* @param fd the FileDescriptor to read from
*/
--- a/jdk/src/java.base/share/classes/java/io/FileWriter.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/FileWriter.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,13 +34,13 @@
*
* <p>Whether or not a file is available or may be created depends upon the
* underlying platform. Some platforms, in particular, allow a file to be
- * opened for writing by only one <tt>FileWriter</tt> (or other file-writing
+ * opened for writing by only one {@code FileWriter} (or other file-writing
* object) at a time. In such situations the constructors in this class
* will fail if the file involved is already open.
*
- * <p><code>FileWriter</code> is meant for writing streams of characters.
+ * <p>{@code FileWriter} is meant for writing streams of characters.
* For writing streams of raw bytes, consider using a
- * <code>FileOutputStream</code>.
+ * {@code FileOutputStream}.
*
* @see OutputStreamWriter
* @see FileOutputStream
@@ -68,7 +68,7 @@
* indicating whether or not to append the data written.
*
* @param fileName String The system-dependent filename.
- * @param append boolean if <code>true</code>, then data will be written
+ * @param append boolean if {@code true}, then data will be written
* to the end of the file rather than the beginning.
* @throws IOException if the named file exists but is a directory rather
* than a regular file, does not exist but cannot be
@@ -92,11 +92,11 @@
/**
* Constructs a FileWriter object given a File object. If the second
- * argument is <code>true</code>, then bytes will be written to the end
+ * argument is {@code true}, then bytes will be written to the end
* of the file rather than the beginning.
*
* @param file a File object to write to
- * @param append if <code>true</code>, then bytes will be written
+ * @param append if {@code true}, then bytes will be written
* to the end of the file rather than the beginning
* @throws IOException if the file exists but is a directory rather than
* a regular file, does not exist but cannot be created,
--- a/jdk/src/java.base/share/classes/java/io/FilterOutputStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/FilterOutputStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -57,7 +57,7 @@
* underlying output stream.
*
* @param out the underlying output stream to be assigned to
- * the field <tt>this.out</tt> for later use, or
+ * the field {@code this.out} for later use, or
* <code>null</code> if this instance is to be
* created without an underlying stream.
*/
@@ -70,9 +70,9 @@
* <p>
* The <code>write</code> method of <code>FilterOutputStream</code>
* calls the <code>write</code> method of its underlying output stream,
- * that is, it performs <tt>out.write(b)</tt>.
+ * that is, it performs {@code out.write(b)}.
* <p>
- * Implements the abstract <tt>write</tt> method of <tt>OutputStream</tt>.
+ * Implements the abstract {@code write} method of {@code OutputStream}.
*
* @param b the <code>byte</code>.
* @exception IOException if an I/O error occurs.
--- a/jdk/src/java.base/share/classes/java/io/Flushable.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/Flushable.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,7 +28,7 @@
import java.io.IOException;
/**
- * A <tt>Flushable</tt> is a destination of data that can be flushed. The
+ * A {@code Flushable} is a destination of data that can be flushed. The
* flush method is invoked to write any buffered output to the underlying
* stream.
*
--- a/jdk/src/java.base/share/classes/java/io/IOError.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/IOError.java Wed Jul 05 20:44:51 2017 +0200
@@ -35,11 +35,11 @@
/**
* Constructs a new instance of IOError with the specified cause. The
* IOError is created with the detail message of
- * <tt>(cause==null ? null : cause.toString())</tt> (which typically
+ * {@code (cause==null ? null : cause.toString())} (which typically
* contains the class and detail message of cause).
*
* @param cause
- * The cause of this error, or <tt>null</tt> if the cause
+ * The cause of this error, or {@code null} if the cause
* is not known
*/
public IOError(Throwable cause) {
--- a/jdk/src/java.base/share/classes/java/io/LineNumberReader.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/LineNumberReader.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,10 +34,10 @@
*
* <p> By default, line numbering begins at 0. This number increments at every
* <a href="#lt">line terminator</a> as the data is read, and can be changed
- * with a call to <tt>setLineNumber(int)</tt>. Note however, that
- * <tt>setLineNumber(int)</tt> does not actually change the current position in
+ * with a call to {@code setLineNumber(int)}. Note however, that
+ * {@code setLineNumber(int)} does not actually change the current position in
* the stream; it only changes the value that will be returned by
- * <tt>getLineNumber()</tt>.
+ * {@code getLineNumber()}.
*
* <p> A line is considered to be <a name="lt">terminated</a> by any one of a
* line feed ('\n'), a carriage return ('\r'), or a carriage return followed
@@ -193,7 +193,7 @@
*
* @return A String containing the contents of the line, not including
* any <a href="#lt">line termination characters</a>, or
- * <tt>null</tt> if the end of the stream has been reached
+ * {@code null} if the end of the stream has been reached
*
* @throws IOException
* If an I/O error occurs
@@ -226,7 +226,7 @@
* If an I/O error occurs
*
* @throws IllegalArgumentException
- * If <tt>n</tt> is negative
+ * If {@code n} is negative
*/
public long skip(long n) throws IOException {
if (n < 0)
--- a/jdk/src/java.base/share/classes/java/io/OutputStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/OutputStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -94,7 +94,7 @@
* <p>
* If <code>off</code> is negative, or <code>len</code> is negative, or
* <code>off+len</code> is greater than the length of the array
- * <code>b</code>, then an <tt>IndexOutOfBoundsException</tt> is thrown.
+ * {@code b}, then an {@code IndexOutOfBoundsException} is thrown.
*
* @param b the data.
* @param off the start offset in the data.
--- a/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java Wed Jul 05 20:44:51 2017 +0200
@@ -53,7 +53,7 @@
* </pre>
*
* <p> A <i>surrogate pair</i> is a character represented by a sequence of two
- * <tt>char</tt> values: A <i>high</i> surrogate in the range '\uD800' to
+ * {@code char} values: A <i>high</i> surrogate in the range '\uD800' to
* '\uDBFF' followed by a <i>low</i> surrogate in the range '\uDC00' to
* '\uDFFF'.
*
@@ -161,7 +161,7 @@
* <p> If this instance was created with the {@link
* #OutputStreamWriter(OutputStream, String)} constructor then the returned
* name, being unique for the encoding, may differ from the name passed to
- * the constructor. This method may return <tt>null</tt> if the stream has
+ * the constructor. This method may return {@code null} if the stream has
* been closed. </p>
*
* @return The historical name of this encoding, or possibly
--- a/jdk/src/java.base/share/classes/java/io/PrintStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/PrintStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,22 +32,22 @@
import java.nio.charset.UnsupportedCharsetException;
/**
- * A <code>PrintStream</code> adds functionality to another output stream,
+ * A {@code PrintStream} adds functionality to another output stream,
* namely the ability to print representations of various data values
* conveniently. Two other features are provided as well. Unlike other output
- * streams, a <code>PrintStream</code> never throws an
- * <code>IOException</code>; instead, exceptional situations merely set an
- * internal flag that can be tested via the <code>checkError</code> method.
- * Optionally, a <code>PrintStream</code> can be created so as to flush
- * automatically; this means that the <code>flush</code> method is
+ * streams, a {@code PrintStream} never throws an
+ * {@code IOException}; instead, exceptional situations merely set an
+ * internal flag that can be tested via the {@code checkError} method.
+ * Optionally, a {@code PrintStream} can be created so as to flush
+ * automatically; this means that the {@code flush} method is
* automatically invoked after a byte array is written, one of the
- * <code>println</code> methods is invoked, or a newline character or byte
- * (<code>'\n'</code>) is written.
+ * {@code println} methods is invoked, or a newline character or byte
+ * ({@code '\n'}) is written.
*
- * <p> All characters printed by a <code>PrintStream</code> are converted into
- * bytes using the platform's default character encoding. The <code>{@link
- * PrintWriter}</code> class should be used in situations that require writing
- * characters rather than bytes.
+ * <p> All characters printed by a {@code PrintStream} are converted into
+ * bytes using the platform's default character encoding.
+ * The {@link PrintWriter} class should be used in situations that require
+ * writing characters rather than bytes.
*
* @author Frank Yellin
* @author Mark Reinhold
@@ -142,8 +142,8 @@
* printed
* @param autoFlush A boolean; if true, the output buffer will be flushed
* whenever a byte array is written, one of the
- * <code>println</code> methods is invoked, or a newline
- * character or byte (<code>'\n'</code>) is written
+ * {@code println} methods is invoked, or a newline
+ * character or byte ({@code '\n'}) is written
*
* @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean)
*/
@@ -158,8 +158,8 @@
* printed
* @param autoFlush A boolean; if true, the output buffer will be flushed
* whenever a byte array is written, one of the
- * <code>println</code> methods is invoked, or a newline
- * character or byte (<code>'\n'</code>) is written
+ * {@code println} methods is invoked, or a newline
+ * character or byte ({@code '\n'}) is written
* @param encoding The name of a supported
* <a href="../lang/package-summary.html#charenc">
* character encoding</a>
@@ -371,21 +371,21 @@
/**
* Flushes the stream and checks its error state. The internal error state
- * is set to <code>true</code> when the underlying output stream throws an
- * <code>IOException</code> other than <code>InterruptedIOException</code>,
- * and when the <code>setError</code> method is invoked. If an operation
+ * is set to {@code true} when the underlying output stream throws an
+ * {@code IOException} other than {@code InterruptedIOException},
+ * and when the {@code setError} method is invoked. If an operation
* on the underlying output stream throws an
- * <code>InterruptedIOException</code>, then the <code>PrintStream</code>
+ * {@code InterruptedIOException}, then the {@code PrintStream}
* converts the exception back into an interrupt by doing:
- * <pre>
+ * <pre>{@code
* Thread.currentThread().interrupt();
- * </pre>
+ * }</pre>
* or the equivalent.
*
- * @return <code>true</code> if and only if this stream has encountered an
- * <code>IOException</code> other than
- * <code>InterruptedIOException</code>, or the
- * <code>setError</code> method has been invoked
+ * @return {@code true} if and only if this stream has encountered an
+ * {@code IOException} other than
+ * {@code InterruptedIOException}, or the
+ * {@code setError} method has been invoked
*/
public boolean checkError() {
if (out != null)
@@ -398,11 +398,11 @@
}
/**
- * Sets the error state of the stream to <code>true</code>.
+ * Sets the error state of the stream to {@code true}.
*
* <p> This method will cause subsequent invocations of {@link
- * #checkError()} to return <tt>true</tt> until {@link
- * #clearError()} is invoked.
+ * #checkError()} to return {@code true} until
+ * {@link #clearError()} is invoked.
*
* @since 1.1
*/
@@ -414,7 +414,7 @@
* Clears the internal error state of this stream.
*
* <p> This method will cause subsequent invocations of {@link
- * #checkError()} to return <tt>false</tt> until another write
+ * #checkError()} to return {@code false} until another write
* operation fails and invokes {@link #setError()}.
*
* @since 1.6
@@ -430,12 +430,12 @@
/**
* Writes the specified byte to this stream. If the byte is a newline and
- * automatic flushing is enabled then the <code>flush</code> method will be
+ * automatic flushing is enabled then the {@code flush} method will be
* invoked.
*
* <p> Note that the byte is written as given; to write a character that
* will be translated according to the platform's default character
- * encoding, use the <code>print(char)</code> or <code>println(char)</code>
+ * encoding, use the {@code print(char)} or {@code println(char)}
* methods.
*
* @param b The byte to be written
@@ -460,13 +460,13 @@
}
/**
- * Writes <code>len</code> bytes from the specified byte array starting at
- * offset <code>off</code> to this stream. If automatic flushing is
- * enabled then the <code>flush</code> method will be invoked.
+ * Writes {@code len} bytes from the specified byte array starting at
+ * offset {@code off} to this stream. If automatic flushing is
+ * enabled then the {@code flush} method will be invoked.
*
* <p> Note that the bytes will be written as given; to write characters
* that will be translated according to the platform's default character
- * encoding, use the <code>print(char)</code> or <code>println(char)</code>
+ * encoding, use the {@code print(char)} or {@code println(char)}
* methods.
*
* @param buf A byte array
@@ -559,13 +559,13 @@
/* Methods that do not terminate lines */
/**
- * Prints a boolean value. The string produced by <code>{@link
- * java.lang.String#valueOf(boolean)}</code> is translated into bytes
+ * Prints a boolean value. The string produced by {@link
+ * java.lang.String#valueOf(boolean)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * {@link #write(int)} method.
*
- * @param b The <code>boolean</code> to be printed
+ * @param b The {@code boolean} to be printed
*/
public void print(boolean b) {
write(b ? "true" : "false");
@@ -575,22 +575,22 @@
* Prints a character. The character is translated into one or more bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * {@link #write(int)} method.
*
- * @param c The <code>char</code> to be printed
+ * @param c The {@code char} to be printed
*/
public void print(char c) {
write(String.valueOf(c));
}
/**
- * Prints an integer. The string produced by <code>{@link
- * java.lang.String#valueOf(int)}</code> is translated into bytes
+ * Prints an integer. The string produced by {@link
+ * java.lang.String#valueOf(int)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * {@link #write(int)} method.
*
- * @param i The <code>int</code> to be printed
+ * @param i The {@code int} to be printed
* @see java.lang.Integer#toString(int)
*/
public void print(int i) {
@@ -598,13 +598,13 @@
}
/**
- * Prints a long integer. The string produced by <code>{@link
- * java.lang.String#valueOf(long)}</code> is translated into bytes
+ * Prints a long integer. The string produced by {@link
+ * java.lang.String#valueOf(long)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * {@link #write(int)} method.
*
- * @param l The <code>long</code> to be printed
+ * @param l The {@code long} to be printed
* @see java.lang.Long#toString(long)
*/
public void print(long l) {
@@ -612,13 +612,13 @@
}
/**
- * Prints a floating-point number. The string produced by <code>{@link
- * java.lang.String#valueOf(float)}</code> is translated into bytes
+ * Prints a floating-point number. The string produced by {@link
+ * java.lang.String#valueOf(float)} is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * {@link #write(int)} method.
*
- * @param f The <code>float</code> to be printed
+ * @param f The {@code float} to be printed
* @see java.lang.Float#toString(float)
*/
public void print(float f) {
@@ -627,12 +627,12 @@
/**
* Prints a double-precision floating-point number. The string produced by
- * <code>{@link java.lang.String#valueOf(double)}</code> is translated into
+ * {@link java.lang.String#valueOf(double)} is translated into
* bytes according to the platform's default character encoding, and these
- * bytes are written in exactly the manner of the <code>{@link
- * #write(int)}</code> method.
+ * bytes are written in exactly the manner of the {@link
+ * #write(int)} method.
*
- * @param d The <code>double</code> to be printed
+ * @param d The {@code double} to be printed
* @see java.lang.Double#toString(double)
*/
public void print(double d) {
@@ -643,24 +643,24 @@
* Prints an array of characters. The characters are converted into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * {@link #write(int)} method.
*
* @param s The array of chars to be printed
*
- * @throws NullPointerException If <code>s</code> is <code>null</code>
+ * @throws NullPointerException If {@code s} is {@code null}
*/
public void print(char s[]) {
write(s);
}
/**
- * Prints a string. If the argument is <code>null</code> then the string
- * <code>"null"</code> is printed. Otherwise, the string's characters are
+ * Prints a string. If the argument is {@code null} then the string
+ * {@code "null"} is printed. Otherwise, the string's characters are
* converted into bytes according to the platform's default character
* encoding, and these bytes are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * {@link #write(int)} method.
*
- * @param s The <code>String</code> to be printed
+ * @param s The {@code String} to be printed
*/
public void print(String s) {
if (s == null) {
@@ -670,13 +670,13 @@
}
/**
- * Prints an object. The string produced by the <code>{@link
- * java.lang.String#valueOf(Object)}</code> method is translated into bytes
+ * Prints an object. The string produced by the {@link
+ * java.lang.String#valueOf(Object)} method is translated into bytes
* according to the platform's default character encoding, and these bytes
* are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * {@link #write(int)} method.
*
- * @param obj The <code>Object</code> to be printed
+ * @param obj The {@code Object} to be printed
* @see java.lang.Object#toString()
*/
public void print(Object obj) {
@@ -689,8 +689,8 @@
/**
* Terminates the current line by writing the line separator string. The
* line separator string is defined by the system property
- * <code>line.separator</code>, and is not necessarily a single newline
- * character (<code>'\n'</code>).
+ * {@code line.separator}, and is not necessarily a single newline
+ * character ({@code '\n'}).
*/
public void println() {
newLine();
@@ -698,10 +698,10 @@
/**
* Prints a boolean and then terminate the line. This method behaves as
- * though it invokes <code>{@link #print(boolean)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(boolean)} and then
+ * {@link #println()}.
*
- * @param x The <code>boolean</code> to be printed
+ * @param x The {@code boolean} to be printed
*/
public void println(boolean x) {
synchronized (this) {
@@ -712,10 +712,10 @@
/**
* Prints a character and then terminate the line. This method behaves as
- * though it invokes <code>{@link #print(char)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(char)} and then
+ * {@link #println()}.
*
- * @param x The <code>char</code> to be printed.
+ * @param x The {@code char} to be printed.
*/
public void println(char x) {
synchronized (this) {
@@ -726,10 +726,10 @@
/**
* Prints an integer and then terminate the line. This method behaves as
- * though it invokes <code>{@link #print(int)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(int)} and then
+ * {@link #println()}.
*
- * @param x The <code>int</code> to be printed.
+ * @param x The {@code int} to be printed.
*/
public void println(int x) {
synchronized (this) {
@@ -740,10 +740,10 @@
/**
* Prints a long and then terminate the line. This method behaves as
- * though it invokes <code>{@link #print(long)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(long)} and then
+ * {@link #println()}.
*
- * @param x a The <code>long</code> to be printed.
+ * @param x a The {@code long} to be printed.
*/
public void println(long x) {
synchronized (this) {
@@ -754,10 +754,10 @@
/**
* Prints a float and then terminate the line. This method behaves as
- * though it invokes <code>{@link #print(float)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(float)} and then
+ * {@link #println()}.
*
- * @param x The <code>float</code> to be printed.
+ * @param x The {@code float} to be printed.
*/
public void println(float x) {
synchronized (this) {
@@ -768,10 +768,10 @@
/**
* Prints a double and then terminate the line. This method behaves as
- * though it invokes <code>{@link #print(double)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(double)} and then
+ * {@link #println()}.
*
- * @param x The <code>double</code> to be printed.
+ * @param x The {@code double} to be printed.
*/
public void println(double x) {
synchronized (this) {
@@ -782,8 +782,8 @@
/**
* Prints an array of characters and then terminate the line. This method
- * behaves as though it invokes <code>{@link #print(char[])}</code> and
- * then <code>{@link #println()}</code>.
+ * behaves as though it invokes {@link #print(char[])} and
+ * then {@link #println()}.
*
* @param x an array of chars to print.
*/
@@ -796,10 +796,10 @@
/**
* Prints a String and then terminate the line. This method behaves as
- * though it invokes <code>{@link #print(String)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(String)} and then
+ * {@link #println()}.
*
- * @param x The <code>String</code> to be printed.
+ * @param x The {@code String} to be printed.
*/
public void println(String x) {
synchronized (this) {
@@ -812,10 +812,10 @@
* Prints an Object and then terminate the line. This method calls
* at first String.valueOf(x) to get the printed object's string value,
* then behaves as
- * though it invokes <code>{@link #print(String)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(String)} and then
+ * {@link #println()}.
*
- * @param x The <code>Object</code> to be printed.
+ * @param x The {@code Object} to be printed.
*/
public void println(Object x) {
String s = String.valueOf(x);
@@ -830,11 +830,13 @@
* A convenience method to write a formatted string to this output stream
* using the specified format string and arguments.
*
- * <p> An invocation of this method of the form <tt>out.printf(format,
- * args)</tt> behaves in exactly the same way as the invocation
+ * <p> An invocation of this method of the form
+ * {@code out.printf(format, args)} behaves
+ * in exactly the same way as the invocation
*
- * <pre>
- * out.format(format, args) </pre>
+ * <pre>{@code
+ * out.format(format, args)
+ * }</pre>
*
* @param format
* A format string as described in <a
@@ -848,7 +850,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@@ -861,7 +863,7 @@
* formatter class specification.
*
* @throws NullPointerException
- * If the <tt>format</tt> is <tt>null</tt>
+ * If the {@code format} is {@code null}
*
* @return This output stream
*
@@ -875,15 +877,17 @@
* A convenience method to write a formatted string to this output stream
* using the specified format string and arguments.
*
- * <p> An invocation of this method of the form <tt>out.printf(l, format,
- * args)</tt> behaves in exactly the same way as the invocation
+ * <p> An invocation of this method of the form
+ * {@code out.printf(l, format, args)} behaves
+ * in exactly the same way as the invocation
*
- * <pre>
- * out.format(l, format, args) </pre>
+ * <pre>{@code
+ * out.format(l, format, args)
+ * }</pre>
*
* @param l
* The {@linkplain java.util.Locale locale} to apply during
- * formatting. If <tt>l</tt> is <tt>null</tt> then no localization
+ * formatting. If {@code l} is {@code null} then no localization
* is applied.
*
* @param format
@@ -898,7 +902,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@@ -911,7 +915,7 @@
* formatter class specification.
*
* @throws NullPointerException
- * If the <tt>format</tt> is <tt>null</tt>
+ * If the {@code format} is {@code null}
*
* @return This output stream
*
@@ -941,7 +945,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@@ -954,7 +958,7 @@
* formatter class specification.
*
* @throws NullPointerException
- * If the <tt>format</tt> is <tt>null</tt>
+ * If the {@code format} is {@code null}
*
* @return This output stream
*
@@ -983,7 +987,7 @@
*
* @param l
* The {@linkplain java.util.Locale locale} to apply during
- * formatting. If <tt>l</tt> is <tt>null</tt> then no localization
+ * formatting. If {@code l} is {@code null} then no localization
* is applied.
*
* @param format
@@ -998,7 +1002,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@@ -1011,7 +1015,7 @@
* formatter class specification.
*
* @throws NullPointerException
- * If the <tt>format</tt> is <tt>null</tt>
+ * If the {@code format} is {@code null}
*
* @return This output stream
*
@@ -1037,21 +1041,22 @@
/**
* Appends the specified character sequence to this output stream.
*
- * <p> An invocation of this method of the form <tt>out.append(csq)</tt>
+ * <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
- * <pre>
- * out.print(csq.toString()) </pre>
+ * <pre>{@code
+ * out.print(csq.toString())
+ * }</pre>
*
- * <p> Depending on the specification of <tt>toString</tt> for the
- * character sequence <tt>csq</tt>, the entire sequence may not be
- * appended. For instance, invoking then <tt>toString</tt> method of a
+ * <p> Depending on the specification of {@code toString} for the
+ * character sequence {@code csq}, the entire sequence may not be
+ * appended. For instance, invoking then {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
- * The character sequence to append. If <tt>csq</tt> is
- * <tt>null</tt>, then the four characters <tt>"null"</tt> are
+ * The character sequence to append. If {@code csq} is
+ * {@code null}, then the four characters {@code "null"} are
* appended to this output stream.
*
* @return This output stream
@@ -1070,18 +1075,20 @@
* Appends a subsequence of the specified character sequence to this output
* stream.
*
- * <p> An invocation of this method of the form <tt>out.append(csq, start,
- * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
+ * <p> An invocation of this method of the form
+ * {@code out.append(csq, start, end)} when
+ * {@code csq} is not {@code null}, behaves in
* exactly the same way as the invocation
*
- * <pre>
- * out.print(csq.subSequence(start, end).toString()) </pre>
+ * <pre>{@code
+ * out.print(csq.subSequence(start, end).toString())
+ * }</pre>
*
* @param csq
* The character sequence from which a subsequence will be
- * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
- * will be appended as if <tt>csq</tt> contained the four
- * characters <tt>"null"</tt>.
+ * appended. If {@code csq} is {@code null}, then characters
+ * will be appended as if {@code csq} contained the four
+ * characters {@code "null"}.
*
* @param start
* The index of the first character in the subsequence
@@ -1093,9 +1100,9 @@
* @return This output stream
*
* @throws IndexOutOfBoundsException
- * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
- * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
- * <tt>csq.length()</tt>
+ * If {@code start} or {@code end} are negative, {@code start}
+ * is greater than {@code end}, or {@code end} is greater than
+ * {@code csq.length()}
*
* @since 1.5
*/
@@ -1108,11 +1115,12 @@
/**
* Appends the specified character to this output stream.
*
- * <p> An invocation of this method of the form <tt>out.append(c)</tt>
+ * <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
- * <pre>
- * out.print(c) </pre>
+ * <pre>{@code
+ * out.print(c)
+ * }</pre>
*
* @param c
* The 16-bit character to append
--- a/jdk/src/java.base/share/classes/java/io/PrintWriter.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/PrintWriter.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,13 +34,13 @@
/**
* Prints formatted representations of objects to a text-output stream. This
- * class implements all of the <tt>print</tt> methods found in {@link
+ * class implements all of the {@code print} methods found in {@link
* PrintStream}. It does not contain methods for writing raw bytes, for which
* a program should use unencoded byte streams.
*
* <p> Unlike the {@link PrintStream} class, if automatic flushing is enabled
- * it will be done only when one of the <tt>println</tt>, <tt>printf</tt>, or
- * <tt>format</tt> methods is invoked, rather than whenever a newline character
+ * it will be done only when one of the {@code println}, {@code printf}, or
+ * {@code format} methods is invoked, rather than whenever a newline character
* happens to be output. These methods use the platform's own notion of line
* separator rather than the newline character.
*
@@ -57,7 +57,7 @@
/**
* The underlying character-output stream of this
- * <code>PrintWriter</code>.
+ * {@code PrintWriter}.
*
* @since 1.2
*/
@@ -98,8 +98,8 @@
* Creates a new PrintWriter.
*
* @param out A character-output stream
- * @param autoFlush A boolean; if true, the <tt>println</tt>,
- * <tt>printf</tt>, or <tt>format</tt> methods will
+ * @param autoFlush A boolean; if true, the {@code println},
+ * {@code printf}, or {@code format} methods will
* flush the output buffer
*/
public PrintWriter(Writer out,
@@ -130,8 +130,8 @@
* default character encoding.
*
* @param out An output stream
- * @param autoFlush A boolean; if true, the <tt>println</tt>,
- * <tt>printf</tt>, or <tt>format</tt> methods will
+ * @param autoFlush A boolean; if true, the {@code println},
+ * {@code printf}, or {@code format} methods will
* flush the output buffer
*
* @see java.io.OutputStreamWriter#OutputStreamWriter(java.io.OutputStream)
@@ -340,7 +340,7 @@
/**
* Flushes the stream if it's not closed and checks its error state.
*
- * @return <code>true</code> if the print stream has encountered an error,
+ * @return {@code true} if the print stream has encountered an error,
* either on the underlying output stream or during a format
* conversion.
*/
@@ -361,7 +361,7 @@
* Indicates that an error has occurred.
*
* <p> This method will cause subsequent invocations of {@link
- * #checkError()} to return <tt>true</tt> until {@link
+ * #checkError()} to return {@code true} until {@link
* #clearError()} is invoked.
*/
protected void setError() {
@@ -372,7 +372,7 @@
* Clears the error state of this stream.
*
* <p> This method will cause subsequent invocations of {@link
- * #checkError()} to return <tt>false</tt> until another write
+ * #checkError()} to return {@code false} until another write
* operation fails and invokes {@link #setError()}.
*
* @since 1.6
@@ -485,13 +485,13 @@
/* Methods that do not terminate lines */
/**
- * Prints a boolean value. The string produced by <code>{@link
- * java.lang.String#valueOf(boolean)}</code> is translated into bytes
+ * Prints a boolean value. The string produced by {@link
+ * java.lang.String#valueOf(boolean)} is translated into bytes
* according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link
- * #write(int)}</code> method.
+ * are written in exactly the manner of the {@link
+ * #write(int)} method.
*
- * @param b The <code>boolean</code> to be printed
+ * @param b The {@code boolean} to be printed
*/
public void print(boolean b) {
write(b ? "true" : "false");
@@ -500,23 +500,23 @@
/**
* Prints a character. The character is translated into one or more bytes
* according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link
- * #write(int)}</code> method.
+ * are written in exactly the manner of the {@link
+ * #write(int)} method.
*
- * @param c The <code>char</code> to be printed
+ * @param c The {@code char} to be printed
*/
public void print(char c) {
write(c);
}
/**
- * Prints an integer. The string produced by <code>{@link
- * java.lang.String#valueOf(int)}</code> is translated into bytes according
+ * Prints an integer. The string produced by {@link
+ * java.lang.String#valueOf(int)} is translated into bytes according
* to the platform's default character encoding, and these bytes are
- * written in exactly the manner of the <code>{@link #write(int)}</code>
+ * written in exactly the manner of the {@link #write(int)}
* method.
*
- * @param i The <code>int</code> to be printed
+ * @param i The {@code int} to be printed
* @see java.lang.Integer#toString(int)
*/
public void print(int i) {
@@ -524,13 +524,13 @@
}
/**
- * Prints a long integer. The string produced by <code>{@link
- * java.lang.String#valueOf(long)}</code> is translated into bytes
+ * Prints a long integer. The string produced by {@link
+ * java.lang.String#valueOf(long)} is translated into bytes
* according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link #write(int)}</code>
+ * are written in exactly the manner of the {@link #write(int)}
* method.
*
- * @param l The <code>long</code> to be printed
+ * @param l The {@code long} to be printed
* @see java.lang.Long#toString(long)
*/
public void print(long l) {
@@ -538,13 +538,13 @@
}
/**
- * Prints a floating-point number. The string produced by <code>{@link
- * java.lang.String#valueOf(float)}</code> is translated into bytes
+ * Prints a floating-point number. The string produced by {@link
+ * java.lang.String#valueOf(float)} is translated into bytes
* according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link #write(int)}</code>
+ * are written in exactly the manner of the {@link #write(int)}
* method.
*
- * @param f The <code>float</code> to be printed
+ * @param f The {@code float} to be printed
* @see java.lang.Float#toString(float)
*/
public void print(float f) {
@@ -553,12 +553,12 @@
/**
* Prints a double-precision floating-point number. The string produced by
- * <code>{@link java.lang.String#valueOf(double)}</code> is translated into
+ * {@link java.lang.String#valueOf(double)} is translated into
* bytes according to the platform's default character encoding, and these
- * bytes are written in exactly the manner of the <code>{@link
- * #write(int)}</code> method.
+ * bytes are written in exactly the manner of the {@link
+ * #write(int)} method.
*
- * @param d The <code>double</code> to be printed
+ * @param d The {@code double} to be printed
* @see java.lang.Double#toString(double)
*/
public void print(double d) {
@@ -568,25 +568,25 @@
/**
* Prints an array of characters. The characters are converted into bytes
* according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link #write(int)}</code>
+ * are written in exactly the manner of the {@link #write(int)}
* method.
*
* @param s The array of chars to be printed
*
- * @throws NullPointerException If <code>s</code> is <code>null</code>
+ * @throws NullPointerException If {@code s} is {@code null}
*/
public void print(char s[]) {
write(s);
}
/**
- * Prints a string. If the argument is <code>null</code> then the string
- * <code>"null"</code> is printed. Otherwise, the string's characters are
+ * Prints a string. If the argument is {@code null} then the string
+ * {@code "null"} is printed. Otherwise, the string's characters are
* converted into bytes according to the platform's default character
* encoding, and these bytes are written in exactly the manner of the
- * <code>{@link #write(int)}</code> method.
+ * {@link #write(int)} method.
*
- * @param s The <code>String</code> to be printed
+ * @param s The {@code String} to be printed
*/
public void print(String s) {
if (s == null) {
@@ -596,13 +596,13 @@
}
/**
- * Prints an object. The string produced by the <code>{@link
- * java.lang.String#valueOf(Object)}</code> method is translated into bytes
+ * Prints an object. The string produced by the {@link
+ * java.lang.String#valueOf(Object)} method is translated into bytes
* according to the platform's default character encoding, and these bytes
- * are written in exactly the manner of the <code>{@link #write(int)}</code>
+ * are written in exactly the manner of the {@link #write(int)}
* method.
*
- * @param obj The <code>Object</code> to be printed
+ * @param obj The {@code Object} to be printed
* @see java.lang.Object#toString()
*/
public void print(Object obj) {
@@ -614,8 +614,8 @@
/**
* Terminates the current line by writing the line separator string. The
* line separator string is defined by the system property
- * <code>line.separator</code>, and is not necessarily a single newline
- * character (<code>'\n'</code>).
+ * {@code line.separator}, and is not necessarily a single newline
+ * character ({@code '\n'}).
*/
public void println() {
newLine();
@@ -623,10 +623,10 @@
/**
* Prints a boolean value and then terminates the line. This method behaves
- * as though it invokes <code>{@link #print(boolean)}</code> and then
- * <code>{@link #println()}</code>.
+ * as though it invokes {@link #print(boolean)} and then
+ * {@link #println()}.
*
- * @param x the <code>boolean</code> value to be printed
+ * @param x the {@code boolean} value to be printed
*/
public void println(boolean x) {
synchronized (lock) {
@@ -637,10 +637,10 @@
/**
* Prints a character and then terminates the line. This method behaves as
- * though it invokes <code>{@link #print(char)}</code> and then <code>{@link
- * #println()}</code>.
+ * though it invokes {@link #print(char)} and then {@link
+ * #println()}.
*
- * @param x the <code>char</code> value to be printed
+ * @param x the {@code char} value to be printed
*/
public void println(char x) {
synchronized (lock) {
@@ -651,10 +651,10 @@
/**
* Prints an integer and then terminates the line. This method behaves as
- * though it invokes <code>{@link #print(int)}</code> and then <code>{@link
- * #println()}</code>.
+ * though it invokes {@link #print(int)} and then {@link
+ * #println()}.
*
- * @param x the <code>int</code> value to be printed
+ * @param x the {@code int} value to be printed
*/
public void println(int x) {
synchronized (lock) {
@@ -665,10 +665,10 @@
/**
* Prints a long integer and then terminates the line. This method behaves
- * as though it invokes <code>{@link #print(long)}</code> and then
- * <code>{@link #println()}</code>.
+ * as though it invokes {@link #print(long)} and then
+ * {@link #println()}.
*
- * @param x the <code>long</code> value to be printed
+ * @param x the {@code long} value to be printed
*/
public void println(long x) {
synchronized (lock) {
@@ -679,10 +679,10 @@
/**
* Prints a floating-point number and then terminates the line. This method
- * behaves as though it invokes <code>{@link #print(float)}</code> and then
- * <code>{@link #println()}</code>.
+ * behaves as though it invokes {@link #print(float)} and then
+ * {@link #println()}.
*
- * @param x the <code>float</code> value to be printed
+ * @param x the {@code float} value to be printed
*/
public void println(float x) {
synchronized (lock) {
@@ -693,10 +693,10 @@
/**
* Prints a double-precision floating-point number and then terminates the
- * line. This method behaves as though it invokes <code>{@link
- * #print(double)}</code> and then <code>{@link #println()}</code>.
+ * line. This method behaves as though it invokes {@link
+ * #print(double)} and then {@link #println()}.
*
- * @param x the <code>double</code> value to be printed
+ * @param x the {@code double} value to be printed
*/
public void println(double x) {
synchronized (lock) {
@@ -707,10 +707,10 @@
/**
* Prints an array of characters and then terminates the line. This method
- * behaves as though it invokes <code>{@link #print(char[])}</code> and then
- * <code>{@link #println()}</code>.
+ * behaves as though it invokes {@link #print(char[])} and then
+ * {@link #println()}.
*
- * @param x the array of <code>char</code> values to be printed
+ * @param x the array of {@code char} values to be printed
*/
public void println(char x[]) {
synchronized (lock) {
@@ -721,10 +721,10 @@
/**
* Prints a String and then terminates the line. This method behaves as
- * though it invokes <code>{@link #print(String)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(String)} and then
+ * {@link #println()}.
*
- * @param x the <code>String</code> value to be printed
+ * @param x the {@code String} value to be printed
*/
public void println(String x) {
synchronized (lock) {
@@ -737,10 +737,10 @@
* Prints an Object and then terminates the line. This method calls
* at first String.valueOf(x) to get the printed object's string value,
* then behaves as
- * though it invokes <code>{@link #print(String)}</code> and then
- * <code>{@link #println()}</code>.
+ * though it invokes {@link #print(String)} and then
+ * {@link #println()}.
*
- * @param x The <code>Object</code> to be printed.
+ * @param x The {@code Object} to be printed.
*/
public void println(Object x) {
String s = String.valueOf(x);
@@ -755,11 +755,13 @@
* the specified format string and arguments. If automatic flushing is
* enabled, calls to this method will flush the output buffer.
*
- * <p> An invocation of this method of the form <tt>out.printf(format,
- * args)</tt> behaves in exactly the same way as the invocation
+ * <p> An invocation of this method of the form
+ * {@code out.printf(format, args)}
+ * behaves in exactly the same way as the invocation
*
- * <pre>
- * out.format(format, args) </pre>
+ * <pre>{@code
+ * out.format(format, args)
+ * }</pre>
*
* @param format
* A format string as described in <a
@@ -773,7 +775,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@@ -786,7 +788,7 @@
* formatter class specification.
*
* @throws NullPointerException
- * If the <tt>format</tt> is <tt>null</tt>
+ * If the {@code format} is {@code null}
*
* @return This writer
*
@@ -801,15 +803,17 @@
* the specified format string and arguments. If automatic flushing is
* enabled, calls to this method will flush the output buffer.
*
- * <p> An invocation of this method of the form <tt>out.printf(l, format,
- * args)</tt> behaves in exactly the same way as the invocation
+ * <p> An invocation of this method of the form
+ * {@code out.printf(l, format, args)}
+ * behaves in exactly the same way as the invocation
*
- * <pre>
- * out.format(l, format, args) </pre>
+ * <pre>{@code
+ * out.format(l, format, args)
+ * }</pre>
*
* @param l
* The {@linkplain java.util.Locale locale} to apply during
- * formatting. If <tt>l</tt> is <tt>null</tt> then no localization
+ * formatting. If {@code l} is {@code null} then no localization
* is applied.
*
* @param format
@@ -824,7 +828,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@@ -837,7 +841,7 @@
* formatter class specification.
*
* @throws NullPointerException
- * If the <tt>format</tt> is <tt>null</tt>
+ * If the {@code format} is {@code null}
*
* @return This writer
*
@@ -868,7 +872,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@@ -881,7 +885,7 @@
* Formatter class specification.
*
* @throws NullPointerException
- * If the <tt>format</tt> is <tt>null</tt>
+ * If the {@code format} is {@code null}
*
* @return This writer
*
@@ -913,7 +917,7 @@
*
* @param l
* The {@linkplain java.util.Locale locale} to apply during
- * formatting. If <tt>l</tt> is <tt>null</tt> then no localization
+ * formatting. If {@code l} is {@code null} then no localization
* is applied.
*
* @param format
@@ -928,7 +932,7 @@
* limited by the maximum dimension of a Java array as defined by
* <cite>The Java™ Virtual Machine Specification</cite>.
* The behaviour on a
- * <tt>null</tt> argument depends on the <a
+ * {@code null} argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws java.util.IllegalFormatException
@@ -941,7 +945,7 @@
* formatter class specification.
*
* @throws NullPointerException
- * If the <tt>format</tt> is <tt>null</tt>
+ * If the {@code format} is {@code null}
*
* @return This writer
*
@@ -968,21 +972,22 @@
/**
* Appends the specified character sequence to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(csq)</tt>
+ * <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
- * <pre>
- * out.write(csq.toString()) </pre>
+ * <pre>{@code
+ * out.write(csq.toString())
+ * }</pre>
*
- * <p> Depending on the specification of <tt>toString</tt> for the
- * character sequence <tt>csq</tt>, the entire sequence may not be
- * appended. For instance, invoking the <tt>toString</tt> method of a
+ * <p> Depending on the specification of {@code toString} for the
+ * character sequence {@code csq}, the entire sequence may not be
+ * appended. For instance, invoking the {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
- * The character sequence to append. If <tt>csq</tt> is
- * <tt>null</tt>, then the four characters <tt>"null"</tt> are
+ * The character sequence to append. If {@code csq} is
+ * {@code null}, then the four characters {@code "null"} are
* appended to this writer.
*
* @return This writer
@@ -1000,18 +1005,20 @@
/**
* Appends a subsequence of the specified character sequence to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(csq, start,
- * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
+ * <p> An invocation of this method of the form
+ * {@code out.append(csq, start, end)}
+ * when {@code csq} is not {@code null}, behaves in
* exactly the same way as the invocation
*
- * <pre>
- * out.write(csq.subSequence(start, end).toString()) </pre>
+ * <pre>{@code
+ * out.write(csq.subSequence(start, end).toString())
+ * }</pre>
*
* @param csq
* The character sequence from which a subsequence will be
- * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
- * will be appended as if <tt>csq</tt> contained the four
- * characters <tt>"null"</tt>.
+ * appended. If {@code csq} is {@code null}, then characters
+ * will be appended as if {@code csq} contained the four
+ * characters {@code "null"}.
*
* @param start
* The index of the first character in the subsequence
@@ -1023,9 +1030,9 @@
* @return This writer
*
* @throws IndexOutOfBoundsException
- * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
- * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
- * <tt>csq.length()</tt>
+ * If {@code start} or {@code end} are negative, {@code start}
+ * is greater than {@code end}, or {@code end} is greater than
+ * {@code csq.length()}
*
* @since 1.5
*/
@@ -1038,11 +1045,12 @@
/**
* Appends the specified character to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(c)</tt>
+ * <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
- * <pre>
- * out.write(c) </pre>
+ * <pre>{@code
+ * out.write(c)
+ * }</pre>
*
* @param c
* The 16-bit character to append
--- a/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java Wed Jul 05 20:44:51 2017 +0200
@@ -82,10 +82,10 @@
* {@link FileDescriptor} object is created to represent the
* connection to the file.
*
- * <p> The <tt>mode</tt> argument specifies the access mode with which the
+ * <p> The {@code mode} argument specifies the access mode with which the
* file is to be opened. The permitted values and their meanings are as
* specified for the <a
- * href="#mode"><tt>RandomAccessFile(File,String)</tt></a> constructor.
+ * href="#mode">{@code RandomAccessFile(File,String)}</a> constructor.
*
* <p>
* If there is a security manager, its {@code checkRead} method
@@ -99,19 +99,19 @@
* @param name the system-dependent filename
* @param mode the access <a href="#mode">mode</a>
* @exception IllegalArgumentException if the mode argument is not equal
- * to one of <tt>"r"</tt>, <tt>"rw"</tt>, <tt>"rws"</tt>, or
- * <tt>"rwd"</tt>
+ * to one of {@code "r"}, {@code "rw"}, {@code "rws"}, or
+ * {@code "rwd"}
* @exception FileNotFoundException
- * if the mode is <tt>"r"</tt> but the given string does not
+ * if the mode is {@code "r"} but the given string does not
* denote an existing regular file, or if the mode begins with
- * <tt>"rw"</tt> but the given string does not denote an
+ * {@code "rw"} but the given string does not denote an
* existing, writable regular file and a new regular file of
* that name cannot be created, or if some other error occurs
* while opening or creating the file
- * @exception SecurityException if a security manager exists and its
- * {@code checkRead} method denies read access to the file
- * or the mode is "rw" and the security manager's
- * {@code checkWrite} method denies write access to the file
+ * @exception SecurityException if a security manager exists and its
+ * {@code checkRead} method denies read access to the file
+ * or the mode is {@code "rw"} and the security manager's
+ * {@code checkWrite} method denies write access to the file
* @see java.lang.SecurityException
* @see java.lang.SecurityManager#checkRead(java.lang.String)
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
@@ -129,33 +129,33 @@
* write to, the file specified by the {@link File} argument. A new {@link
* FileDescriptor} object is created to represent this file connection.
*
- * <p>The <a name="mode"><tt>mode</tt></a> argument specifies the access mode
+ * <p>The <a name="mode">{@code mode}</a> argument specifies the access mode
* in which the file is to be opened. The permitted values and their
* meanings are:
*
* <table summary="Access mode permitted values and meanings">
* <tr><th align="left">Value</th><th align="left">Meaning</th></tr>
- * <tr><td valign="top"><tt>"r"</tt></td>
- * <td> Open for reading only. Invoking any of the <tt>write</tt>
- * methods of the resulting object will cause an {@link
- * java.io.IOException} to be thrown. </td></tr>
- * <tr><td valign="top"><tt>"rw"</tt></td>
+ * <tr><td valign="top">{@code "r"}</td>
+ * <td> Open for reading only. Invoking any of the {@code write}
+ * methods of the resulting object will cause an
+ * {@link java.io.IOException} to be thrown.</td></tr>
+ * <tr><td valign="top">{@code "rw"}</td>
* <td> Open for reading and writing. If the file does not already
- * exist then an attempt will be made to create it. </td></tr>
- * <tr><td valign="top"><tt>"rws"</tt></td>
- * <td> Open for reading and writing, as with <tt>"rw"</tt>, and also
+ * exist then an attempt will be made to create it.</td></tr>
+ * <tr><td valign="top">{@code "rws"}</td>
+ * <td> Open for reading and writing, as with {@code "rw"}, and also
* require that every update to the file's content or metadata be
- * written synchronously to the underlying storage device. </td></tr>
- * <tr><td valign="top"><tt>"rwd" </tt></td>
- * <td> Open for reading and writing, as with <tt>"rw"</tt>, and also
+ * written synchronously to the underlying storage device.</td></tr>
+ * <tr><td valign="top">{@code "rwd"}</td>
+ * <td> Open for reading and writing, as with {@code "rw"}, and also
* require that every update to the file's content be written
- * synchronously to the underlying storage device. </td></tr>
+ * synchronously to the underlying storage device.</td></tr>
* </table>
*
- * The <tt>"rws"</tt> and <tt>"rwd"</tt> modes work much like the {@link
+ * The {@code "rws"} and {@code "rwd"} modes work much like the {@link
* java.nio.channels.FileChannel#force(boolean) force(boolean)} method of
* the {@link java.nio.channels.FileChannel} class, passing arguments of
- * <tt>true</tt> and <tt>false</tt>, respectively, except that they always
+ * {@code true} and {@code false}, respectively, except that they always
* apply to every I/O operation and are therefore often more efficient. If
* the file resides on a local storage device then when an invocation of a
* method of this class returns it is guaranteed that all changes made to
@@ -164,9 +164,9 @@
* event of a system crash. If the file does not reside on a local device
* then no such guarantee is made.
*
- * <p>The <tt>"rwd"</tt> mode can be used to reduce the number of I/O
- * operations performed. Using <tt>"rwd"</tt> only requires updates to the
- * file's content to be written to storage; using <tt>"rws"</tt> requires
+ * <p>The {@code "rwd"} mode can be used to reduce the number of I/O
+ * operations performed. Using {@code "rwd"} only requires updates to the
+ * file's content to be written to storage; using {@code "rws"} requires
* updates to both the file's content and its metadata to be written, which
* generally requires at least one more low-level I/O operation.
*
@@ -181,19 +181,19 @@
* @param mode the access mode, as described
* <a href="#mode">above</a>
* @exception IllegalArgumentException if the mode argument is not equal
- * to one of <tt>"r"</tt>, <tt>"rw"</tt>, <tt>"rws"</tt>, or
- * <tt>"rwd"</tt>
+ * to one of {@code "r"}, {@code "rw"}, {@code "rws"}, or
+ * {@code "rwd"}
* @exception FileNotFoundException
- * if the mode is <tt>"r"</tt> but the given file object does
+ * if the mode is {@code "r"} but the given file object does
* not denote an existing regular file, or if the mode begins
- * with <tt>"rw"</tt> but the given file object does not denote
+ * with {@code "rw"} but the given file object does not denote
* an existing, writable regular file and a new regular file of
* that name cannot be created, or if some other error occurs
* while opening or creating the file
- * @exception SecurityException if a security manager exists and its
- * {@code checkRead} method denies read access to the file
- * or the mode is "rw" and the security manager's
- * {@code checkWrite} method denies write access to the file
+ * @exception SecurityException if a security manager exists and its
+ * {@code checkRead} method denies read access to the file
+ * or the mode is {@code "rw"} and the security manager's
+ * {@code checkWrite} method denies write access to the file
* @see java.lang.SecurityManager#checkRead(java.lang.String)
* @see java.lang.SecurityManager#checkWrite(java.lang.String)
* @see java.nio.channels.FileChannel#force(boolean)
--- a/jdk/src/java.base/share/classes/java/io/Reader.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/Reader.java Wed Jul 05 20:44:51 2017 +0200
@@ -54,7 +54,7 @@
* The object used to synchronize operations on this stream. For
* efficiency, a character-stream object may use an object other than
* itself to protect critical sections. A subclass should therefore use
- * the object in this field rather than <tt>this</tt> or a synchronized
+ * the object in this field rather than {@code this} or a synchronized
* method.
*/
protected Object lock;
@@ -111,7 +111,7 @@
* should override this method.
*
* @return The character read, as an integer in the range 0 to 65535
- * (<tt>0x00-0xffff</tt>), or -1 if the end of the stream has
+ * ({@code 0x00-0xffff}), or -1 if the end of the stream has
* been reached
*
* @exception IOException If an I/O error occurs
--- a/jdk/src/java.base/share/classes/java/io/StringWriter.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/StringWriter.java Wed Jul 05 20:44:51 2017 +0200
@@ -30,9 +30,9 @@
* A character stream that collects its output in a string buffer, which can
* then be used to construct a string.
* <p>
- * Closing a <tt>StringWriter</tt> has no effect. The methods in this class
+ * Closing a {@code StringWriter} has no effect. The methods in this class
* can be called after the stream has been closed without generating an
- * <tt>IOException</tt>.
+ * {@code IOException}.
*
* @author Mark Reinhold
* @since 1.1
@@ -56,11 +56,11 @@
* size.
*
* @param initialSize
- * The number of <tt>char</tt> values that will fit into this buffer
+ * The number of {@code char} values that will fit into this buffer
* before it is automatically expanded
*
* @throws IllegalArgumentException
- * If <tt>initialSize</tt> is negative
+ * If {@code initialSize} is negative
*/
public StringWriter(int initialSize) {
if (initialSize < 0) {
@@ -115,21 +115,21 @@
/**
* Appends the specified character sequence to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(csq)</tt>
+ * <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.write(csq.toString()) </pre>
*
- * <p> Depending on the specification of <tt>toString</tt> for the
- * character sequence <tt>csq</tt>, the entire sequence may not be
- * appended. For instance, invoking the <tt>toString</tt> method of a
+ * <p> Depending on the specification of {@code toString} for the
+ * character sequence {@code csq}, the entire sequence may not be
+ * appended. For instance, invoking the {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
- * The character sequence to append. If <tt>csq</tt> is
- * <tt>null</tt>, then the four characters <tt>"null"</tt> are
+ * The character sequence to append. If {@code csq} is
+ * {@code null}, then the four characters "{@code null}" are
* appended to this writer.
*
* @return This writer
@@ -147,18 +147,20 @@
/**
* Appends a subsequence of the specified character sequence to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(csq, start,
- * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
+ * <p> An invocation of this method of the form
+ * {@code out.append(csq, start, end)} when {@code csq}
+ * is not {@code null}, behaves in
* exactly the same way as the invocation
*
- * <pre>
- * out.write(csq.subSequence(start, end).toString()) </pre>
+ * <pre>{@code
+ * out.write(csq.subSequence(start, end).toString())
+ * }</pre>
*
* @param csq
* The character sequence from which a subsequence will be
- * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
- * will be appended as if <tt>csq</tt> contained the four
- * characters <tt>"null"</tt>.
+ * appended. If {@code csq} is {@code null}, then characters
+ * will be appended as if {@code csq} contained the four
+ * characters "{@code null}".
*
* @param start
* The index of the first character in the subsequence
@@ -170,9 +172,9 @@
* @return This writer
*
* @throws IndexOutOfBoundsException
- * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
- * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
- * <tt>csq.length()</tt>
+ * If {@code start} or {@code end} are negative, {@code start}
+ * is greater than {@code end}, or {@code end} is greater than
+ * {@code csq.length()}
*
* @since 1.5
*/
@@ -185,7 +187,7 @@
/**
* Appends the specified character to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(c)</tt>
+ * <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
* <pre>
@@ -226,9 +228,9 @@
}
/**
- * Closing a <tt>StringWriter</tt> has no effect. The methods in this
+ * Closing a {@code StringWriter} has no effect. The methods in this
* class can be called after the stream has been closed without generating
- * an <tt>IOException</tt>.
+ * an {@code IOException}.
*/
public void close() throws IOException {
}
--- a/jdk/src/java.base/share/classes/java/io/Writer.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/Writer.java Wed Jul 05 20:44:51 2017 +0200
@@ -63,7 +63,7 @@
* The object used to synchronize operations on this stream. For
* efficiency, a character-stream object may use an object other than
* itself to protect critical sections. A subclass should therefore use
- * the object in this field rather than <tt>this</tt> or a synchronized
+ * the object in this field rather than {@code this} or a synchronized
* method.
*/
protected Object lock;
@@ -170,8 +170,8 @@
* Number of characters to write
*
* @throws IndexOutOfBoundsException
- * If <tt>off</tt> is negative, or <tt>len</tt> is negative,
- * or <tt>off+len</tt> is negative or greater than the length
+ * If {@code off} is negative, or {@code len} is negative,
+ * or {@code off+len} is negative or greater than the length
* of the given string
*
* @throws IOException
@@ -196,21 +196,21 @@
/**
* Appends the specified character sequence to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(csq)</tt>
+ * <p> An invocation of this method of the form {@code out.append(csq)}
* behaves in exactly the same way as the invocation
*
* <pre>
* out.write(csq.toString()) </pre>
*
- * <p> Depending on the specification of <tt>toString</tt> for the
- * character sequence <tt>csq</tt>, the entire sequence may not be
- * appended. For instance, invoking the <tt>toString</tt> method of a
+ * <p> Depending on the specification of {@code toString} for the
+ * character sequence {@code csq}, the entire sequence may not be
+ * appended. For instance, invoking the {@code toString} method of a
* character buffer will return a subsequence whose content depends upon
* the buffer's position and limit.
*
* @param csq
- * The character sequence to append. If <tt>csq</tt> is
- * <tt>null</tt>, then the four characters <tt>"null"</tt> are
+ * The character sequence to append. If {@code csq} is
+ * {@code null}, then the four characters "{@code null}" are
* appended to this writer.
*
* @return This writer
@@ -230,20 +230,22 @@
/**
* Appends a subsequence of the specified character sequence to this writer.
- * <tt>Appendable</tt>.
+ * {@code Appendable}.
*
- * <p> An invocation of this method of the form <tt>out.append(csq, start,
- * end)</tt> when <tt>csq</tt> is not <tt>null</tt> behaves in exactly the
+ * <p> An invocation of this method of the form
+ * {@code out.append(csq, start, end)} when {@code csq}
+ * is not {@code null} behaves in exactly the
* same way as the invocation
*
- * <pre>
- * out.write(csq.subSequence(start, end).toString()) </pre>
+ * <pre>{@code
+ * out.write(csq.subSequence(start, end).toString())
+ * }</pre>
*
* @param csq
* The character sequence from which a subsequence will be
- * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
- * will be appended as if <tt>csq</tt> contained the four
- * characters <tt>"null"</tt>.
+ * appended. If {@code csq} is {@code null}, then characters
+ * will be appended as if {@code csq} contained the four
+ * characters "{@code null}".
*
* @param start
* The index of the first character in the subsequence
@@ -255,9 +257,9 @@
* @return This writer
*
* @throws IndexOutOfBoundsException
- * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
- * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
- * <tt>csq.length()</tt>
+ * If {@code start} or {@code end} are negative, {@code start}
+ * is greater than {@code end}, or {@code end} is greater than
+ * {@code csq.length()}
*
* @throws IOException
* If an I/O error occurs
@@ -273,7 +275,7 @@
/**
* Appends the specified character to this writer.
*
- * <p> An invocation of this method of the form <tt>out.append(c)</tt>
+ * <p> An invocation of this method of the form {@code out.append(c)}
* behaves in exactly the same way as the invocation
*
* <pre>
--- a/jdk/src/java.base/share/classes/java/lang/Appendable.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Appendable.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,15 +28,15 @@
import java.io.IOException;
/**
- * An object to which <tt>char</tt> sequences and values can be appended. The
- * <tt>Appendable</tt> interface must be implemented by any class whose
+ * An object to which {@code char} sequences and values can be appended. The
+ * {@code Appendable} interface must be implemented by any class whose
* instances are intended to receive formatted output from a {@link
* java.util.Formatter}.
*
* <p> The characters to be appended should be valid Unicode characters as
* described in <a href="Character.html#unicode">Unicode Character
* Representation</a>. Note that supplementary characters may be composed of
- * multiple 16-bit <tt>char</tt> values.
+ * multiple 16-bit {@code char} values.
*
* <p> Appendables are not necessarily safe for multithreaded access. Thread
* safety is the responsibility of classes that extend and implement this
@@ -51,19 +51,19 @@
public interface Appendable {
/**
- * Appends the specified character sequence to this <tt>Appendable</tt>.
+ * Appends the specified character sequence to this {@code Appendable}.
*
* <p> Depending on which class implements the character sequence
- * <tt>csq</tt>, the entire sequence may not be appended. For
- * instance, if <tt>csq</tt> is a {@link java.nio.CharBuffer} then
+ * {@code csq}, the entire sequence may not be appended. For
+ * instance, if {@code csq} is a {@link java.nio.CharBuffer} then
* the subsequence to append is defined by the buffer's position and limit.
*
* @param csq
- * The character sequence to append. If <tt>csq</tt> is
- * <tt>null</tt>, then the four characters <tt>"null"</tt> are
+ * The character sequence to append. If {@code csq} is
+ * {@code null}, then the four characters {@code "null"} are
* appended to this Appendable.
*
- * @return A reference to this <tt>Appendable</tt>
+ * @return A reference to this {@code Appendable}
*
* @throws IOException
* If an I/O error occurs
@@ -72,10 +72,10 @@
/**
* Appends a subsequence of the specified character sequence to this
- * <tt>Appendable</tt>.
+ * {@code Appendable}.
*
- * <p> An invocation of this method of the form <tt>out.append(csq, start,
- * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
+ * <p> An invocation of this method of the form {@code out.append(csq, start, end)}
+ * when {@code csq} is not {@code null}, behaves in
* exactly the same way as the invocation
*
* <pre>
@@ -83,9 +83,9 @@
*
* @param csq
* The character sequence from which a subsequence will be
- * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
- * will be appended as if <tt>csq</tt> contained the four
- * characters <tt>"null"</tt>.
+ * appended. If {@code csq} is {@code null}, then characters
+ * will be appended as if {@code csq} contained the four
+ * characters {@code "null"}.
*
* @param start
* The index of the first character in the subsequence
@@ -94,12 +94,12 @@
* The index of the character following the last character in the
* subsequence
*
- * @return A reference to this <tt>Appendable</tt>
+ * @return A reference to this {@code Appendable}
*
* @throws IndexOutOfBoundsException
- * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
- * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
- * <tt>csq.length()</tt>
+ * If {@code start} or {@code end} are negative, {@code start}
+ * is greater than {@code end}, or {@code end} is greater than
+ * {@code csq.length()}
*
* @throws IOException
* If an I/O error occurs
@@ -107,12 +107,12 @@
Appendable append(CharSequence csq, int start, int end) throws IOException;
/**
- * Appends the specified character to this <tt>Appendable</tt>.
+ * Appends the specified character to this {@code Appendable}.
*
* @param c
* The character to append
*
- * @return A reference to this <tt>Appendable</tt>
+ * @return A reference to this {@code Appendable}
*
* @throws IOException
* If an I/O error occurs
--- a/jdk/src/java.base/share/classes/java/lang/ApplicationShutdownHooks.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ApplicationShutdownHooks.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,7 +28,7 @@
/*
* Class to track and run user level shutdown hooks registered through
- * <tt>{@link Runtime#addShutdownHook Runtime.addShutdownHook}</tt>.
+ * {@link Runtime#addShutdownHook Runtime.addShutdownHook}.
*
* @see java.lang.Runtime#addShutdownHook
* @see java.lang.Runtime#removeShutdownHook
--- a/jdk/src/java.base/share/classes/java/lang/AssertionStatusDirectives.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/AssertionStatusDirectives.java Wed Jul 05 20:44:51 2017 +0200
@@ -29,8 +29,8 @@
* A collection of assertion status directives (such as "enable assertions
* in package p" or "disable assertions in class c"). This class is used by
* the JVM to communicate the assertion status directives implied by
- * the <tt>java</tt> command line flags <tt>-enableassertions</tt>
- * (<tt>-ea</tt>) and <tt>-disableassertions</tt> (<tt>-da</tt>).
+ * the {@code java} command line flags {@code -enableassertions}
+ * ({@code -ea}) and {@code -disableassertions} ({@code -da}).
*
* @since 1.4
* @author Josh Bloch
@@ -44,19 +44,19 @@
String[] classes;
/**
- * A parallel array to <tt>classes</tt>, indicating whether each class
- * is to have assertions enabled or disabled. A value of <tt>true</tt>
- * for <tt>classEnabled[i]</tt> indicates that the class named by
- * <tt>classes[i]</tt> should have assertions enabled; a value of
- * <tt>false</tt> indicates that it should have classes disabled.
- * This array must have the same number of elements as <tt>classes</tt>.
+ * A parallel array to {@code classes}, indicating whether each class
+ * is to have assertions enabled or disabled. A value of {@code true}
+ * for {@code classEnabled[i]} indicates that the class named by
+ * {@code classes[i]} should have assertions enabled; a value of
+ * {@code false} indicates that it should have classes disabled.
+ * This array must have the same number of elements as {@code classes}.
*
* <p>In the case of conflicting directives for the same class, the
* last directive for a given class wins. In other words, if a string
- * <tt>s</tt> appears multiple times in the <tt>classes</tt> array
- * and <tt>i</tt> is the highest integer for which
- * <tt>classes[i].equals(s)</tt>, then <tt>classEnabled[i]</tt>
- * indicates whether assertions are to be enabled in class <tt>s</tt>.
+ * {@code s} appears multiple times in the {@code classes} array
+ * and {@code i} is the highest integer for which
+ * {@code classes[i].equals(s)}, then {@code classEnabled[i]}
+ * indicates whether assertions are to be enabled in class {@code s}.
*/
boolean[] classEnabled;
@@ -68,21 +68,21 @@
String[] packages;
/**
- * A parallel array to <tt>packages</tt>, indicating whether each
+ * A parallel array to {@code packages}, indicating whether each
* package-tree is to have assertions enabled or disabled. A value of
- * <tt>true</tt> for <tt>packageEnabled[i]</tt> indicates that the
- * package-tree named by <tt>packages[i]</tt> should have assertions
- * enabled; a value of <tt>false</tt> indicates that it should have
+ * {@code true} for {@code packageEnabled[i]} indicates that the
+ * package-tree named by {@code packages[i]} should have assertions
+ * enabled; a value of {@code false} indicates that it should have
* assertions disabled. This array must have the same number of
- * elements as <tt>packages</tt>.
+ * elements as {@code packages}.
*
* In the case of conflicting directives for the same package-tree, the
* last directive for a given package-tree wins. In other words, if a
- * string <tt>s</tt> appears multiple times in the <tt>packages</tt> array
- * and <tt>i</tt> is the highest integer for which
- * <tt>packages[i].equals(s)</tt>, then <tt>packageEnabled[i]</tt>
+ * string {@code s} appears multiple times in the {@code packages} array
+ * and {@code i} is the highest integer for which
+ * {@code packages[i].equals(s)}, then {@code packageEnabled[i]}
* indicates whether assertions are to be enabled in package-tree
- * <tt>s</tt>.
+ * {@code s}.
*/
boolean[] packageEnabled;
--- a/jdk/src/java.base/share/classes/java/lang/CharSequence.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/CharSequence.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,21 +34,21 @@
import java.util.stream.StreamSupport;
/**
- * A <tt>CharSequence</tt> is a readable sequence of <code>char</code> values. This
+ * A {@code CharSequence} is a readable sequence of {@code char} values. This
* interface provides uniform, read-only access to many different kinds of
- * <code>char</code> sequences.
- * A <code>char</code> value represents a character in the <i>Basic
+ * {@code char} sequences.
+ * A {@code char} value represents a character in the <i>Basic
* Multilingual Plane (BMP)</i> or a surrogate. Refer to <a
* href="Character.html#unicode">Unicode Character Representation</a> for details.
*
* <p> This interface does not refine the general contracts of the {@link
* java.lang.Object#equals(java.lang.Object) equals} and {@link
* java.lang.Object#hashCode() hashCode} methods. The result of comparing two
- * objects that implement <tt>CharSequence</tt> is therefore, in general,
+ * objects that implement {@code CharSequence} is therefore, in general,
* undefined. Each object may be implemented by a different class, and there
* is no guarantee that each class will be capable of testing its instances
* for equality with those of the other. It is therefore inappropriate to use
- * arbitrary <tt>CharSequence</tt> instances as elements in a set or as keys in
+ * arbitrary {@code CharSequence} instances as elements in a set or as keys in
* a map. </p>
*
* @author Mike McCloskey
@@ -60,38 +60,38 @@
/**
* Returns the length of this character sequence. The length is the number
- * of 16-bit <code>char</code>s in the sequence.
+ * of 16-bit {@code char}s in the sequence.
*
- * @return the number of <code>char</code>s in this sequence
+ * @return the number of {@code char}s in this sequence
*/
int length();
/**
- * Returns the <code>char</code> value at the specified index. An index ranges from zero
- * to <tt>length() - 1</tt>. The first <code>char</code> value of the sequence is at
+ * Returns the {@code char} value at the specified index. An index ranges from zero
+ * to {@code length() - 1}. The first {@code char} value of the sequence is at
* index zero, the next at index one, and so on, as for array
* indexing.
*
- * <p>If the <code>char</code> value specified by the index is a
+ * <p>If the {@code char} value specified by the index is a
* <a href="{@docRoot}/java/lang/Character.html#unicode">surrogate</a>, the surrogate
* value is returned.
*
- * @param index the index of the <code>char</code> value to be returned
+ * @param index the index of the {@code char} value to be returned
*
- * @return the specified <code>char</code> value
+ * @return the specified {@code char} value
*
* @throws IndexOutOfBoundsException
- * if the <tt>index</tt> argument is negative or not less than
- * <tt>length()</tt>
+ * if the {@code index} argument is negative or not less than
+ * {@code length()}
*/
char charAt(int index);
/**
- * Returns a <code>CharSequence</code> that is a subsequence of this sequence.
- * The subsequence starts with the <code>char</code> value at the specified index and
- * ends with the <code>char</code> value at index <tt>end - 1</tt>. The length
- * (in <code>char</code>s) of the
- * returned sequence is <tt>end - start</tt>, so if <tt>start == end</tt>
+ * Returns a {@code CharSequence} that is a subsequence of this sequence.
+ * The subsequence starts with the {@code char} value at the specified index and
+ * ends with the {@code char} value at index {@code end - 1}. The length
+ * (in {@code char}s) of the
+ * returned sequence is {@code end - start}, so if {@code start == end}
* then an empty sequence is returned.
*
* @param start the start index, inclusive
@@ -100,9 +100,9 @@
* @return the specified subsequence
*
* @throws IndexOutOfBoundsException
- * if <tt>start</tt> or <tt>end</tt> are negative,
- * if <tt>end</tt> is greater than <tt>length()</tt>,
- * or if <tt>start</tt> is greater than <tt>end</tt>
+ * if {@code start} or {@code end} are negative,
+ * if {@code end} is greater than {@code length()},
+ * or if {@code start} is greater than {@code end}
*/
CharSequence subSequence(int start, int end);
--- a/jdk/src/java.base/share/classes/java/lang/Character.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Character.java Wed Jul 05 20:44:51 2017 +0200
@@ -3502,7 +3502,7 @@
/**
* Returns the UnicodeBlock with the given name. Block
* names are determined by The Unicode Standard. The file
- * Blocks-<version>.txt defines blocks for a particular
+ * {@code Blocks-<version>.txt} defines blocks for a particular
* version of the standard. The {@link Character} class specifies
* the version of the standard that it supports.
* <p>
@@ -7195,8 +7195,8 @@
/**
* Returns the UnicodeScript constant with the given Unicode script
* name or the script name alias. Script names and their aliases are
- * determined by The Unicode Standard. The files Scripts<version>.txt
- * and PropertyValueAliases<version>.txt define script names
+ * determined by The Unicode Standard. The files {@code Scripts<version>.txt}
+ * and {@code PropertyValueAliases<version>.txt} define script names
* and the script name aliases for a particular version of the
* standard. The {@link Character} class specifies the version of
* the standard that it supports.
@@ -7255,9 +7255,9 @@
}
/**
- * Returns a <tt>Character</tt> instance representing the specified
- * <tt>char</tt> value.
- * If a new <tt>Character</tt> instance is not required, this method
+ * Returns a {@code Character} instance representing the specified
+ * {@code char} value.
+ * If a new {@code Character} instance is not required, this method
* should generally be used in preference to the constructor
* {@link #Character(char)}, as this method is likely to yield
* significantly better space and time performance by caching
@@ -7268,7 +7268,7 @@
* cache other values outside of this range.
*
* @param c a char value.
- * @return a <tt>Character</tt> instance representing <tt>c</tt>.
+ * @return a {@code Character} instance representing {@code c}.
* @since 1.5
*/
@HotSpotIntrinsicCandidate
@@ -9871,7 +9871,7 @@
}
/**
- * The number of bits used to represent a <tt>char</tt> value in unsigned
+ * The number of bits used to represent a {@code char} value in unsigned
* binary form, constant {@code 16}.
*
* @since 1.5
@@ -9888,11 +9888,11 @@
/**
* Returns the value obtained by reversing the order of the bytes in the
- * specified <tt>char</tt> value.
+ * specified {@code char} value.
*
* @param ch The {@code char} of which to reverse the byte order.
* @return the value obtained by reversing (or, equivalently, swapping)
- * the bytes in the specified <tt>char</tt> value.
+ * the bytes in the specified {@code char} value.
* @since 1.5
*/
@HotSpotIntrinsicCandidate
--- a/jdk/src/java.base/share/classes/java/lang/ClassNotFoundException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ClassNotFoundException.java Wed Jul 05 20:44:51 2017 +0200
@@ -98,7 +98,7 @@
/**
* Returns the exception that was raised if an error occurred while
- * attempting to load the class. Otherwise, returns <tt>null</tt>.
+ * attempting to load the class. Otherwise, returns {@code null}.
*
* <p>This method predates the general-purpose exception chaining facility.
* The {@link Throwable#getCause()} method is now the preferred means of
@@ -114,7 +114,7 @@
/**
* Returns the cause of this exception (the exception that was raised
* if an error occurred while attempting to load the class; otherwise
- * <tt>null</tt>).
+ * {@code null}).
*
* @return the cause of this exception.
* @since 1.4
--- a/jdk/src/java.base/share/classes/java/lang/Cloneable.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Cloneable.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,11 +36,11 @@
* <code>CloneNotSupportedException</code> being thrown.
* <p>
* By convention, classes that implement this interface should override
- * <tt>Object.clone</tt> (which is protected) with a public method.
+ * {@code Object.clone} (which is protected) with a public method.
* See {@link java.lang.Object#clone()} for details on overriding this
* method.
* <p>
- * Note that this interface does <i>not</i> contain the <tt>clone</tt> method.
+ * Note that this interface does <i>not</i> contain the {@code clone} method.
* Therefore, it is not possible to clone an object merely by virtue of the
* fact that it implements this interface. Even if the clone method is invoked
* reflectively, there is no guarantee that it will succeed.
--- a/jdk/src/java.base/share/classes/java/lang/Comparable.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Comparable.java Wed Jul 05 20:44:51 2017 +0200
@@ -29,7 +29,7 @@
/**
* This interface imposes a total ordering on the objects of each class that
* implements it. This ordering is referred to as the class's <i>natural
- * ordering</i>, and the class's <tt>compareTo</tt> method is referred to as
+ * ordering</i>, and the class's {@code compareTo} method is referred to as
* its <i>natural comparison method</i>.<p>
*
* Lists (and arrays) of objects that implement this interface can be sorted
@@ -39,45 +39,45 @@
* elements in a {@linkplain SortedSet sorted set}, without the need to
* specify a {@linkplain Comparator comparator}.<p>
*
- * The natural ordering for a class <tt>C</tt> is said to be <i>consistent
- * with equals</i> if and only if <tt>e1.compareTo(e2) == 0</tt> has
- * the same boolean value as <tt>e1.equals(e2)</tt> for every
- * <tt>e1</tt> and <tt>e2</tt> of class <tt>C</tt>. Note that <tt>null</tt>
- * is not an instance of any class, and <tt>e.compareTo(null)</tt> should
- * throw a <tt>NullPointerException</tt> even though <tt>e.equals(null)</tt>
- * returns <tt>false</tt>.<p>
+ * The natural ordering for a class {@code C} is said to be <i>consistent
+ * with equals</i> if and only if {@code e1.compareTo(e2) == 0} has
+ * the same boolean value as {@code e1.equals(e2)} for every
+ * {@code e1} and {@code e2} of class {@code C}. Note that {@code null}
+ * is not an instance of any class, and {@code e.compareTo(null)} should
+ * throw a {@code NullPointerException} even though {@code e.equals(null)}
+ * returns {@code false}.<p>
*
* It is strongly recommended (though not required) that natural orderings be
* consistent with equals. This is so because sorted sets (and sorted maps)
* without explicit comparators behave "strangely" when they are used with
* elements (or keys) whose natural ordering is inconsistent with equals. In
* particular, such a sorted set (or sorted map) violates the general contract
- * for set (or map), which is defined in terms of the <tt>equals</tt>
+ * for set (or map), which is defined in terms of the {@code equals}
* method.<p>
*
- * For example, if one adds two keys <tt>a</tt> and <tt>b</tt> such that
+ * For example, if one adds two keys {@code a} and {@code b} such that
* {@code (!a.equals(b) && a.compareTo(b) == 0)} to a sorted
- * set that does not use an explicit comparator, the second <tt>add</tt>
+ * set that does not use an explicit comparator, the second {@code add}
* operation returns false (and the size of the sorted set does not increase)
- * because <tt>a</tt> and <tt>b</tt> are equivalent from the sorted set's
+ * because {@code a} and {@code b} are equivalent from the sorted set's
* perspective.<p>
*
- * Virtually all Java core classes that implement <tt>Comparable</tt> have natural
+ * Virtually all Java core classes that implement {@code Comparable} have natural
* orderings that are consistent with equals. One exception is
- * <tt>java.math.BigDecimal</tt>, whose natural ordering equates
- * <tt>BigDecimal</tt> objects with equal values and different precisions
+ * {@code java.math.BigDecimal}, whose natural ordering equates
+ * {@code BigDecimal} objects with equal values and different precisions
* (such as 4.0 and 4.00).<p>
*
* For the mathematically inclined, the <i>relation</i> that defines
- * the natural ordering on a given class C is:<pre>
- * {(x, y) such that x.compareTo(y) <= 0}.
- * </pre> The <i>quotient</i> for this total order is: <pre>
+ * the natural ordering on a given class C is:<pre>{@code
+ * {(x, y) such that x.compareTo(y) <= 0}.
+ * }</pre> The <i>quotient</i> for this total order is: <pre>{@code
* {(x, y) such that x.compareTo(y) == 0}.
- * </pre>
+ * }</pre>
*
- * It follows immediately from the contract for <tt>compareTo</tt> that the
- * quotient is an <i>equivalence relation</i> on <tt>C</tt>, and that the
- * natural ordering is a <i>total order</i> on <tt>C</tt>. When we say that a
+ * It follows immediately from the contract for {@code compareTo} that the
+ * quotient is an <i>equivalence relation</i> on {@code C}, and that the
+ * natural ordering is a <i>total order</i> on {@code C}. When we say that a
* class's natural ordering is <i>consistent with equals</i>, we mean that the
* quotient for the natural ordering is the equivalence relation defined by
* the class's {@link Object#equals(Object) equals(Object)} method:<pre>
@@ -99,30 +99,31 @@
* negative integer, zero, or a positive integer as this object is less
* than, equal to, or greater than the specified object.
*
- * <p>The implementor must ensure <tt>sgn(x.compareTo(y)) ==
- * -sgn(y.compareTo(x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This
- * implies that <tt>x.compareTo(y)</tt> must throw an exception iff
- * <tt>y.compareTo(x)</tt> throws an exception.)
+ * <p>The implementor must ensure
+ * {@code sgn(x.compareTo(y)) == -sgn(y.compareTo(x))}
+ * for all {@code x} and {@code y}. (This
+ * implies that {@code x.compareTo(y)} must throw an exception iff
+ * {@code y.compareTo(x)} throws an exception.)
*
* <p>The implementor must also ensure that the relation is transitive:
- * <tt>(x.compareTo(y)>0 && y.compareTo(z)>0)</tt> implies
- * <tt>x.compareTo(z)>0</tt>.
+ * {@code (x.compareTo(y) > 0 && y.compareTo(z) > 0)} implies
+ * {@code x.compareTo(z) > 0}.
*
- * <p>Finally, the implementor must ensure that <tt>x.compareTo(y)==0</tt>
- * implies that <tt>sgn(x.compareTo(z)) == sgn(y.compareTo(z))</tt>, for
- * all <tt>z</tt>.
+ * <p>Finally, the implementor must ensure that {@code x.compareTo(y)==0}
+ * implies that {@code sgn(x.compareTo(z)) == sgn(y.compareTo(z))}, for
+ * all {@code z}.
*
* <p>It is strongly recommended, but <i>not</i> strictly required that
- * <tt>(x.compareTo(y)==0) == (x.equals(y))</tt>. Generally speaking, any
- * class that implements the <tt>Comparable</tt> interface and violates
+ * {@code (x.compareTo(y)==0) == (x.equals(y))}. Generally speaking, any
+ * class that implements the {@code Comparable} interface and violates
* this condition should clearly indicate this fact. The recommended
* language is "Note: this class has a natural ordering that is
* inconsistent with equals."
*
* <p>In the foregoing description, the notation
- * <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical
- * <i>signum</i> function, which is defined to return one of <tt>-1</tt>,
- * <tt>0</tt>, or <tt>1</tt> according to whether the value of
+ * {@code sgn(}<i>expression</i>{@code )} designates the mathematical
+ * <i>signum</i> function, which is defined to return one of {@code -1},
+ * {@code 0}, or {@code 1} according to whether the value of
* <i>expression</i> is negative, zero or positive.
*
* @param o the object to be compared.
--- a/jdk/src/java.base/share/classes/java/lang/EnumConstantNotPresentException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/EnumConstantNotPresentException.java Wed Jul 05 20:44:51 2017 +0200
@@ -51,7 +51,7 @@
private String constantName;
/**
- * Constructs an <tt>EnumConstantNotPresentException</tt> for the
+ * Constructs an {@code EnumConstantNotPresentException} for the
* specified constant.
*
* @param enumType the type of the missing enum constant
--- a/jdk/src/java.base/share/classes/java/lang/Exception.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Exception.java Wed Jul 05 20:44:51 2017 +0200
@@ -75,7 +75,7 @@
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
+ * {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
@@ -86,14 +86,14 @@
/**
* Constructs a new exception with the specified cause and a detail
- * message of <tt>(cause==null ? null : cause.toString())</tt> (which
- * typically contains the class and detail message of <tt>cause</tt>).
+ * message of {@code (cause==null ? null : cause.toString())} (which
+ * typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
+ * {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
--- a/jdk/src/java.base/share/classes/java/lang/IllegalArgumentException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/IllegalArgumentException.java Wed Jul 05 20:44:51 2017 +0200
@@ -63,7 +63,7 @@
* @param message the detail message (which is saved for later retrieval
* by the {@link Throwable#getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link Throwable#getCause()} method). (A <tt>null</tt> value
+ * {@link Throwable#getCause()} method). (A {@code null} value
* is permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5
@@ -74,14 +74,14 @@
/**
* Constructs a new exception with the specified cause and a detail
- * message of <tt>(cause==null ? null : cause.toString())</tt> (which
- * typically contains the class and detail message of <tt>cause</tt>).
+ * message of {@code (cause==null ? null : cause.toString())} (which
+ * typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link Throwable#getCause()} method). (A <tt>null</tt> value is
+ * {@link Throwable#getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5
--- a/jdk/src/java.base/share/classes/java/lang/IllegalStateException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/IllegalStateException.java Wed Jul 05 20:44:51 2017 +0200
@@ -66,7 +66,7 @@
* @param message the detail message (which is saved for later retrieval
* by the {@link Throwable#getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link Throwable#getCause()} method). (A <tt>null</tt> value
+ * {@link Throwable#getCause()} method). (A {@code null} value
* is permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5
@@ -77,14 +77,14 @@
/**
* Constructs a new exception with the specified cause and a detail
- * message of <tt>(cause==null ? null : cause.toString())</tt> (which
- * typically contains the class and detail message of <tt>cause</tt>).
+ * message of {@code (cause==null ? null : cause.toString())} (which
+ * typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link Throwable#getCause()} method). (A <tt>null</tt> value is
+ * {@link Throwable#getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5
--- a/jdk/src/java.base/share/classes/java/lang/InheritableThreadLocal.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/InheritableThreadLocal.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,12 +27,12 @@
import java.lang.ref.*;
/**
- * This class extends <tt>ThreadLocal</tt> to provide inheritance of values
+ * This class extends {@code ThreadLocal} to provide inheritance of values
* from parent thread to child thread: when a child thread is created, the
* child receives initial values for all inheritable thread-local variables
* for which the parent has values. Normally the child's values will be
* identical to the parent's; however, the child's value can be made an
- * arbitrary function of the parent's by overriding the <tt>childValue</tt>
+ * arbitrary function of the parent's by overriding the {@code childValue}
* method in this class.
*
* <p>Inheritable thread-local variables are used in preference to
--- a/jdk/src/java.base/share/classes/java/lang/Readable.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Readable.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,8 +28,8 @@
import java.io.IOException;
/**
- * A <tt>Readable</tt> is a source of characters. Characters from
- * a <tt>Readable</tt> are made available to callers of the read
+ * A {@code Readable} is a source of characters. Characters from
+ * a {@code Readable} are made available to callers of the read
* method via a {@link java.nio.CharBuffer CharBuffer}.
*
* @since 1.5
--- a/jdk/src/java.base/share/classes/java/lang/RuntimeException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/RuntimeException.java Wed Jul 05 20:44:51 2017 +0200
@@ -71,7 +71,7 @@
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
+ * {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
@@ -81,13 +81,13 @@
}
/** Constructs a new runtime exception with the specified cause and a
- * detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>). This constructor is useful for runtime exceptions
+ * {@code cause}). This constructor is useful for runtime exceptions
* that are little more than wrappers for other throwables.
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is
+ * {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
--- a/jdk/src/java.base/share/classes/java/lang/RuntimePermission.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/RuntimePermission.java Wed Jul 05 20:44:51 2017 +0200
@@ -172,9 +172,8 @@
* <tr>
* <td>modifyThread</td>
* <td>Modification of threads, e.g., via calls to Thread
- * <tt>interrupt</tt>, <tt>stop</tt>, <tt>suspend</tt>,
- * <tt>resume</tt>, <tt>setDaemon</tt>, <tt>setPriority</tt>,
- * <tt>setName</tt> and <tt>setUncaughtExceptionHandler</tt>
+ * {@code interrupt, stop, suspend, resume, setDaemon, setPriority,
+ * setName} and {@code setUncaughtExceptionHandler}
* methods</td>
* <td>This allows an attacker to modify the behaviour of
* any thread in the system.</td>
--- a/jdk/src/java.base/share/classes/java/lang/SecurityException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/SecurityException.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,14 +36,14 @@
private static final long serialVersionUID = 6878364983674394167L;
/**
- * Constructs a <code>SecurityException</code> with no detail message.
+ * Constructs a {@code SecurityException} with no detail message.
*/
public SecurityException() {
super();
}
/**
- * Constructs a <code>SecurityException</code> with the specified
+ * Constructs a {@code SecurityException} with the specified
* detail message.
*
* @param s the detail message.
@@ -53,13 +53,13 @@
}
/**
- * Creates a <code>SecurityException</code> with the specified
+ * Creates a {@code SecurityException} with the specified
* detail message and cause.
*
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
@@ -68,13 +68,13 @@
}
/**
- * Creates a <code>SecurityException</code> with the specified cause
- * and a detail message of <tt>(cause==null ? null : cause.toString())</tt>
+ * Creates a {@code SecurityException} with the specified cause
+ * and a detail message of {@code (cause==null ? null : cause.toString())}
* (which typically contains the class and detail message of
- * <tt>cause</tt>).
+ * {@code cause}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * {@link #getCause()} method). (A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.)
* @since 1.5
*/
--- a/jdk/src/java.base/share/classes/java/lang/String.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/String.java Wed Jul 05 20:44:51 2017 +0200
@@ -87,7 +87,7 @@
* string concatenation and conversion, see Gosling, Joy, and Steele,
* <i>The Java Language Specification</i>.
*
- * <p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
+ * <p> Unless otherwise noted, passing a {@code null} argument to a constructor
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
*
@@ -1135,7 +1135,7 @@
* or both. If they have different characters at one or more index
* positions, let <i>k</i> be the smallest such index; then the string
* whose character at position <i>k</i> has the smaller value, as
- * determined by using the < operator, lexicographically precedes the
+ * determined by using the {@code <} operator, lexicographically precedes the
* other string. In this case, {@code compareTo} returns the
* difference of the two character values at position {@code k} in
* the two string -- that is, the value:
--- a/jdk/src/java.base/share/classes/java/lang/System.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/System.java Wed Jul 05 20:44:51 2017 +0200
@@ -205,7 +205,7 @@
* Returns the unique {@link java.io.Console Console} object associated
* with the current Java virtual machine, if any.
*
- * @return The system console, if any, otherwise <tt>null</tt>.
+ * @return The system console, if any, otherwise {@code null}.
*
* @since 1.6
*/
@@ -232,7 +232,7 @@
* inheritedChannel}, this method may return other kinds of
* channels in the future.
*
- * @return The inherited channel, if any, otherwise <tt>null</tt>.
+ * @return The inherited channel, if any, otherwise {@code null}.
*
* @throws IOException
* If an I/O error occurs
--- a/jdk/src/java.base/share/classes/java/lang/Thread.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java Wed Jul 05 20:44:51 2017 +0200
@@ -616,7 +616,7 @@
* Similarly, specifying a lower value may allow a greater number of
* threads to exist concurrently without throwing an {@link
* OutOfMemoryError} (or other internal error). The details of
- * the relationship between the value of the <tt>stackSize</tt> parameter
+ * the relationship between the value of the {@code stackSize} parameter
* and the maximum recursion depth and concurrency level are
* platform-dependent. <b>On some platforms, the value of the
* {@code stackSize} parameter may have no effect whatsoever.</b>
@@ -1476,7 +1476,7 @@
}
/**
- * Returns <tt>true</tt> if and only if the current thread holds the
+ * Returns {@code true} if and only if the current thread holds the
* monitor lock on the specified object.
*
* <p>This method is designed to allow a program to assert that
@@ -1486,8 +1486,8 @@
* </pre>
*
* @param obj the object on which to test lock ownership
- * @throws NullPointerException if obj is <tt>null</tt>
- * @return <tt>true</tt> if the current thread holds the monitor lock on
+ * @throws NullPointerException if obj is {@code null}
+ * @return {@code true} if the current thread holds the monitor lock on
* the specified object.
* @since 1.4
*/
@@ -1509,8 +1509,8 @@
*
* <p>If there is a security manager, and this thread is not
* the current thread, then the security manager's
- * <tt>checkPermission</tt> method is called with a
- * <tt>RuntimePermission("getStackTrace")</tt> permission
+ * {@code checkPermission} method is called with a
+ * {@code RuntimePermission("getStackTrace")} permission
* to see if it's ok to get the stack trace.
*
* <p>Some virtual machines may, under some circumstances, omit one
@@ -1519,12 +1519,12 @@
* this thread is permitted to return a zero-length array from this
* method.
*
- * @return an array of <tt>StackTraceElement</tt>,
+ * @return an array of {@code StackTraceElement},
* each represents one stack frame.
*
* @throws SecurityException
* if a security manager exists and its
- * <tt>checkPermission</tt> method doesn't allow
+ * {@code checkPermission} method doesn't allow
* getting the stack trace of thread.
* @see SecurityManager#checkPermission
* @see RuntimePermission
@@ -1562,8 +1562,8 @@
/**
* Returns a map of stack traces for all live threads.
* The map keys are threads and each map value is an array of
- * <tt>StackTraceElement</tt> that represents the stack dump
- * of the corresponding <tt>Thread</tt>.
+ * {@code StackTraceElement} that represents the stack dump
+ * of the corresponding {@code Thread}.
* The returned stack traces are in the format specified for
* the {@link #getStackTrace getStackTrace} method.
*
@@ -1574,18 +1574,18 @@
* no stack trace information about a thread.
*
* <p>If there is a security manager, then the security manager's
- * <tt>checkPermission</tt> method is called with a
- * <tt>RuntimePermission("getStackTrace")</tt> permission as well as
- * <tt>RuntimePermission("modifyThreadGroup")</tt> permission
+ * {@code checkPermission} method is called with a
+ * {@code RuntimePermission("getStackTrace")} permission as well as
+ * {@code RuntimePermission("modifyThreadGroup")} permission
* to see if it is ok to get the stack trace of all threads.
*
- * @return a <tt>Map</tt> from <tt>Thread</tt> to an array of
- * <tt>StackTraceElement</tt> that represents the stack trace of
+ * @return a {@code Map} from {@code Thread} to an array of
+ * {@code StackTraceElement} that represents the stack trace of
* the corresponding thread.
*
* @throws SecurityException
* if a security manager exists and its
- * <tt>checkPermission</tt> method doesn't allow
+ * {@code checkPermission} method doesn't allow
* getting the stack trace of thread.
* @see #getStackTrace
* @see SecurityManager#checkPermission
@@ -1693,7 +1693,7 @@
/**
* Returns the identifier of this Thread. The thread ID is a positive
- * <tt>long</tt> number generated when this thread was created.
+ * {@code long} number generated when this thread was created.
* The thread ID is unique and remains unchanged during its lifetime.
* When a thread is terminated, this thread ID may be reused.
*
@@ -1774,10 +1774,10 @@
* <p>A thread in the waiting state is waiting for another thread to
* perform a particular action.
*
- * For example, a thread that has called <tt>Object.wait()</tt>
+ * For example, a thread that has called {@code Object.wait()}
* on an object is waiting for another thread to call
- * <tt>Object.notify()</tt> or <tt>Object.notifyAll()</tt> on
- * that object. A thread that has called <tt>Thread.join()</tt>
+ * {@code Object.notify()} or {@code Object.notifyAll()} on
+ * that object. A thread that has called {@code Thread.join()}
* is waiting for a specified thread to terminate.
*/
WAITING,
@@ -1819,17 +1819,17 @@
// Added in JSR-166
/**
- * Interface for handlers invoked when a <tt>Thread</tt> abruptly
+ * Interface for handlers invoked when a {@code Thread} abruptly
* terminates due to an uncaught exception.
* <p>When a thread is about to terminate due to an uncaught exception
* the Java Virtual Machine will query the thread for its
- * <tt>UncaughtExceptionHandler</tt> using
+ * {@code UncaughtExceptionHandler} using
* {@link #getUncaughtExceptionHandler} and will invoke the handler's
- * <tt>uncaughtException</tt> method, passing the thread and the
+ * {@code uncaughtException} method, passing the thread and the
* exception as arguments.
- * If a thread has not had its <tt>UncaughtExceptionHandler</tt>
- * explicitly set, then its <tt>ThreadGroup</tt> object acts as its
- * <tt>UncaughtExceptionHandler</tt>. If the <tt>ThreadGroup</tt> object
+ * If a thread has not had its {@code UncaughtExceptionHandler}
+ * explicitly set, then its {@code ThreadGroup} object acts as its
+ * {@code UncaughtExceptionHandler}. If the {@code ThreadGroup} object
* has no
* special requirements for dealing with the exception, it can forward
* the invocation to the {@linkplain #getDefaultUncaughtExceptionHandler
@@ -1869,8 +1869,8 @@
* uncaught exception handler. If the thread does not have an explicit
* uncaught exception handler set, and the thread's thread group
* (including parent thread groups) does not specialize its
- * <tt>uncaughtException</tt> method, then the default handler's
- * <tt>uncaughtException</tt> method will be invoked.
+ * {@code uncaughtException} method, then the default handler's
+ * {@code uncaughtException} method will be invoked.
* <p>By setting the default uncaught exception handler, an application
* can change the way in which uncaught exceptions are handled (such as
* logging to a specific device, or file) for those threads that would
@@ -1878,15 +1878,14 @@
* provided.
*
* <p>Note that the default uncaught exception handler should not usually
- * defer to the thread's <tt>ThreadGroup</tt> object, as that could cause
+ * defer to the thread's {@code ThreadGroup} object, as that could cause
* infinite recursion.
*
* @param eh the object to use as the default uncaught exception handler.
- * If <tt>null</tt> then there is no default handler.
+ * If {@code null} then there is no default handler.
*
- * @throws SecurityException if a security manager is present and it
- * denies <tt>{@link RuntimePermission}
- * ("setDefaultUncaughtExceptionHandler")</tt>
+ * @throws SecurityException if a security manager is present and it denies
+ * {@link RuntimePermission}{@code ("setDefaultUncaughtExceptionHandler")}
*
* @see #setUncaughtExceptionHandler
* @see #getUncaughtExceptionHandler
@@ -1906,7 +1905,7 @@
/**
* Returns the default handler invoked when a thread abruptly terminates
- * due to an uncaught exception. If the returned value is <tt>null</tt>,
+ * due to an uncaught exception. If the returned value is {@code null},
* there is no default.
* @since 1.5
* @see #setDefaultUncaughtExceptionHandler
@@ -1920,8 +1919,8 @@
* Returns the handler invoked when this thread abruptly terminates
* due to an uncaught exception. If this thread has not had an
* uncaught exception handler explicitly set then this thread's
- * <tt>ThreadGroup</tt> object is returned, unless this thread
- * has terminated, in which case <tt>null</tt> is returned.
+ * {@code ThreadGroup} object is returned, unless this thread
+ * has terminated, in which case {@code null} is returned.
* @since 1.5
* @return the uncaught exception handler for this thread
*/
@@ -1935,10 +1934,10 @@
* due to an uncaught exception.
* <p>A thread can take full control of how it responds to uncaught
* exceptions by having its uncaught exception handler explicitly set.
- * If no such handler is set then the thread's <tt>ThreadGroup</tt>
+ * If no such handler is set then the thread's {@code ThreadGroup}
* object acts as its handler.
* @param eh the object to use as this thread's uncaught exception
- * handler. If <tt>null</tt> then this thread has no explicit handler.
+ * handler. If {@code null} then this thread has no explicit handler.
* @throws SecurityException if the current thread is not allowed to
* modify this thread.
* @see #setDefaultUncaughtExceptionHandler
--- a/jdk/src/java.base/share/classes/java/lang/ThreadGroup.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ThreadGroup.java Wed Jul 05 20:44:51 2017 +0200
@@ -728,7 +728,7 @@
* @see java.lang.ThreadGroup#checkAccess()
* @since 1.0
* @deprecated This method is used solely in conjunction with
- * <tt>Thread.suspend</tt> and <tt>ThreadGroup.suspend</tt>,
+ * {@code Thread.suspend} and {@code ThreadGroup.suspend},
* both of which have been deprecated, as they are inherently
* deadlock-prone. See {@link Thread#suspend} for details.
*/
--- a/jdk/src/java.base/share/classes/java/lang/TypeNotPresentException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/TypeNotPresentException.java Wed Jul 05 20:44:51 2017 +0200
@@ -29,7 +29,7 @@
* Thrown when an application tries to access a type using a string
* representing the type's name, but no definition for the type with
* the specified name can be found. This exception differs from
- * {@link ClassNotFoundException} in that <tt>ClassNotFoundException</tt> is a
+ * {@link ClassNotFoundException} in that {@code ClassNotFoundException} is a
* checked exception, whereas this exception is unchecked.
*
* <p>Note that this exception may be used when undefined type variables
@@ -49,12 +49,12 @@
private String typeName;
/**
- * Constructs a <tt>TypeNotPresentException</tt> for the named type
+ * Constructs a {@code TypeNotPresentException} for the named type
* with the specified cause.
*
* @param typeName the fully qualified name of the unavailable type
* @param cause the exception that was thrown when the system attempted to
- * load the named type, or <tt>null</tt> if unavailable or inapplicable
+ * load the named type, or {@code null} if unavailable or inapplicable
*/
public TypeNotPresentException(String typeName, Throwable cause) {
super("Type " + typeName + " not present", cause);
--- a/jdk/src/java.base/share/classes/java/lang/UnsupportedOperationException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/UnsupportedOperationException.java Wed Jul 05 20:44:51 2017 +0200
@@ -63,7 +63,7 @@
* @param message the detail message (which is saved for later retrieval
* by the {@link Throwable#getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link Throwable#getCause()} method). (A <tt>null</tt> value
+ * {@link Throwable#getCause()} method). (A {@code null} value
* is permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5
@@ -74,14 +74,14 @@
/**
* Constructs a new exception with the specified cause and a detail
- * message of <tt>(cause==null ? null : cause.toString())</tt> (which
- * typically contains the class and detail message of <tt>cause</tt>).
+ * message of {@code (cause==null ? null : cause.toString())} (which
+ * typically contains the class and detail message of {@code cause}).
* This constructor is useful for exceptions that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link Throwable#getCause()} method). (A <tt>null</tt> value is
+ * {@link Throwable#getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.5
--- a/jdk/src/java.base/share/classes/java/lang/annotation/Annotation.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/annotation/Annotation.java Wed Jul 05 20:44:51 2017 +0200
@@ -50,28 +50,28 @@
* to the corresponding member of this annotation, as defined below:
* <ul>
* <li>Two corresponding primitive typed members whose values are
- * <tt>x</tt> and <tt>y</tt> are considered equal if <tt>x == y</tt>,
- * unless their type is <tt>float</tt> or <tt>double</tt>.
+ * {@code x} and {@code y} are considered equal if {@code x == y},
+ * unless their type is {@code float} or {@code double}.
*
- * <li>Two corresponding <tt>float</tt> members whose values
- * are <tt>x</tt> and <tt>y</tt> are considered equal if
- * <tt>Float.valueOf(x).equals(Float.valueOf(y))</tt>.
- * (Unlike the <tt>==</tt> operator, NaN is considered equal
- * to itself, and <tt>0.0f</tt> unequal to <tt>-0.0f</tt>.)
+ * <li>Two corresponding {@code float} members whose values
+ * are {@code x} and {@code y} are considered equal if
+ * {@code Float.valueOf(x).equals(Float.valueOf(y))}.
+ * (Unlike the {@code ==} operator, NaN is considered equal
+ * to itself, and {@code 0.0f} unequal to {@code -0.0f}.)
*
- * <li>Two corresponding <tt>double</tt> members whose values
- * are <tt>x</tt> and <tt>y</tt> are considered equal if
- * <tt>Double.valueOf(x).equals(Double.valueOf(y))</tt>.
- * (Unlike the <tt>==</tt> operator, NaN is considered equal
- * to itself, and <tt>0.0</tt> unequal to <tt>-0.0</tt>.)
+ * <li>Two corresponding {@code double} members whose values
+ * are {@code x} and {@code y} are considered equal if
+ * {@code Double.valueOf(x).equals(Double.valueOf(y))}.
+ * (Unlike the {@code ==} operator, NaN is considered equal
+ * to itself, and {@code 0.0} unequal to {@code -0.0}.)
*
- * <li>Two corresponding <tt>String</tt>, <tt>Class</tt>, enum, or
- * annotation typed members whose values are <tt>x</tt> and <tt>y</tt>
- * are considered equal if <tt>x.equals(y)</tt>. (Note that this
+ * <li>Two corresponding {@code String}, {@code Class}, enum, or
+ * annotation typed members whose values are {@code x} and {@code y}
+ * are considered equal if {@code x.equals(y)}. (Note that this
* definition is recursive for annotation typed members.)
*
- * <li>Two corresponding array typed members <tt>x</tt> and <tt>y</tt>
- * are considered equal if <tt>Arrays.equals(x, y)</tt>, for the
+ * <li>Two corresponding array typed members {@code x} and {@code y}
+ * are considered equal if {@code Arrays.equals(x, y)}, for the
* appropriate overloading of {@link java.util.Arrays#equals}.
* </ul>
*
@@ -93,16 +93,16 @@
*
* <p>The hash code of a member-value depends on its type:
* <ul>
- * <li>The hash code of a primitive value <tt><i>v</i></tt> is equal to
- * <tt><i>WrapperType</i>.valueOf(<i>v</i>).hashCode()</tt>, where
- * <tt><i>WrapperType</i></tt> is the wrapper type corresponding
- * to the primitive type of <tt><i>v</i></tt> ({@link Byte},
+ * <li>The hash code of a primitive value <i>{@code v}</i> is equal to
+ * <code><i>WrapperType</i>.valueOf(<i>v</i>).hashCode()</code>, where
+ * <i>{@code WrapperType}</i> is the wrapper type corresponding
+ * to the primitive type of <i>{@code v}</i> ({@link Byte},
* {@link Character}, {@link Double}, {@link Float}, {@link Integer},
* {@link Long}, {@link Short}, or {@link Boolean}).
*
* <li>The hash code of a string, enum, class, or annotation member-value
- I <tt><i>v</i></tt> is computed as by calling
- * <tt><i>v</i>.hashCode()</tt>. (In the case of annotation
+ I <i>{@code v}</i> is computed as by calling
+ * <code><i>v</i>.hashCode()</code>. (In the case of annotation
* member values, this is a recursive definition.)
*
* <li>The hash code of an array member-value is computed by calling
--- a/jdk/src/java.base/share/classes/java/lang/annotation/AnnotationFormatError.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/annotation/AnnotationFormatError.java Wed Jul 05 20:44:51 2017 +0200
@@ -40,7 +40,7 @@
private static final long serialVersionUID = -4256701562333669892L;
/**
- * Constructs a new <tt>AnnotationFormatError</tt> with the specified
+ * Constructs a new {@code AnnotationFormatError} with the specified
* detail message.
*
* @param message the detail message.
@@ -50,13 +50,13 @@
}
/**
- * Constructs a new <tt>AnnotationFormatError</tt> with the specified
+ * Constructs a new {@code AnnotationFormatError} with the specified
* detail message and cause. Note that the detail message associated
- * with <code>cause</code> is <i>not</i> automatically incorporated in
+ * with {@code cause} is <i>not</i> automatically incorporated in
* this error's detail message.
*
* @param message the detail message
- * @param cause the cause (A <tt>null</tt> value is permitted, and
+ * @param cause the cause (A {@code null} value is permitted, and
* indicates that the cause is nonexistent or unknown.)
*/
public AnnotationFormatError(String message, Throwable cause) {
@@ -65,12 +65,12 @@
/**
- * Constructs a new <tt>AnnotationFormatError</tt> with the specified
+ * Constructs a new {@code AnnotationFormatError} with the specified
* cause and a detail message of
- * <tt>(cause == null ? null : cause.toString())</tt> (which
- * typically contains the class and detail message of <tt>cause</tt>).
+ * {@code (cause == null ? null : cause.toString())} (which
+ * typically contains the class and detail message of {@code cause}).
*
- * @param cause the cause (A <tt>null</tt> value is permitted, and
+ * @param cause the cause (A {@code null} value is permitted, and
* indicates that the cause is nonexistent or unknown.)
*/
public AnnotationFormatError(Throwable cause) {
--- a/jdk/src/java.base/share/classes/java/lang/annotation/AnnotationTypeMismatchException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/annotation/AnnotationTypeMismatchException.java Wed Jul 05 20:44:51 2017 +0200
@@ -42,7 +42,7 @@
private static final long serialVersionUID = 8125925355765570191L;
/**
- * The <tt>Method</tt> object for the annotation element.
+ * The {@code Method} object for the annotation element.
*/
private final Method element;
@@ -57,7 +57,7 @@
* Constructs an AnnotationTypeMismatchException for the specified
* annotation type element and found data type.
*
- * @param element the <tt>Method</tt> object for the annotation element
+ * @param element the {@code Method} object for the annotation element
* @param foundType the (erroneous) type of data found in the annotation.
* This string may, but is not required to, contain the value
* as well. The exact format of the string is unspecified.
@@ -70,9 +70,9 @@
}
/**
- * Returns the <tt>Method</tt> object for the incorrectly typed element.
+ * Returns the {@code Method} object for the incorrectly typed element.
*
- * @return the <tt>Method</tt> object for the incorrectly typed element
+ * @return the {@code Method} object for the incorrectly typed element
*/
public Method element() {
return this.element;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodType.java Wed Jul 05 20:44:51 2017 +0200
@@ -746,7 +746,7 @@
/**
* Compares the specified object with this type for equality.
- * That is, it returns <tt>true</tt> if and only if the specified object
+ * That is, it returns {@code true} if and only if the specified object
* is also a method type with exactly the same parameters and return type.
* @param x object to compare
* @see Object#equals(Object)
--- a/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ref/PhantomReference.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,8 +38,8 @@
* time or at some later time it will enqueue the reference.
*
* <p> In order to ensure that a reclaimable object remains so, the referent of
- * a phantom reference may not be retrieved: The <code>get</code> method of a
- * phantom reference always returns <code>null</code>.
+ * a phantom reference may not be retrieved: The {@code get} method of a
+ * phantom reference always returns {@code null}.
*
* <p> Unlike soft and weak references, phantom references are not
* automatically cleared by the garbage collector as they are enqueued. An
@@ -55,9 +55,9 @@
/**
* Returns this reference object's referent. Because the referent of a
* phantom reference is always inaccessible, this method always returns
- * <code>null</code>.
+ * {@code null}.
*
- * @return <code>null</code>
+ * @return {@code null}
*/
public T get() {
return null;
@@ -67,14 +67,14 @@
* Creates a new phantom reference that refers to the given object and
* is registered with the given queue.
*
- * <p> It is possible to create a phantom reference with a <tt>null</tt>
- * queue, but such a reference is completely useless: Its <tt>get</tt>
+ * <p> It is possible to create a phantom reference with a {@code null}
+ * queue, but such a reference is completely useless: Its {@code get}
* method will always return null and, since it does not have a queue, it
* will never be enqueued.
*
* @param referent the object the new phantom reference will refer to
* @param q the queue with which the reference is to be registered,
- * or <tt>null</tt> if registration is not required
+ * or {@code null} if registration is not required
*/
public PhantomReference(T referent, ReferenceQueue<? super T> q) {
super(referent, q);
--- a/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java Wed Jul 05 20:44:51 2017 +0200
@@ -96,10 +96,10 @@
/**
* Polls this queue to see if a reference object is available. If one is
* available without further delay then it is removed from the queue and
- * returned. Otherwise this method immediately returns <tt>null</tt>.
+ * returned. Otherwise this method immediately returns {@code null}.
*
* @return A reference object, if one was immediately available,
- * otherwise <code>null</code>
+ * otherwise {@code null}
*/
public Reference<? extends T> poll() {
if (head == null)
@@ -116,12 +116,12 @@
* <p> This method does not offer real-time guarantees: It schedules the
* timeout as if by invoking the {@link Object#wait(long)} method.
*
- * @param timeout If positive, block for up to <code>timeout</code>
+ * @param timeout If positive, block for up to {@code timeout}
* milliseconds while waiting for a reference to be
* added to this queue. If zero, block indefinitely.
*
* @return A reference object, if one was available within the specified
- * timeout period, otherwise <code>null</code>
+ * timeout period, otherwise {@code null}
*
* @throws IllegalArgumentException
* If the value of the timeout argument is negative
--- a/jdk/src/java.base/share/classes/java/lang/ref/SoftReference.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ref/SoftReference.java Wed Jul 05 20:44:51 2017 +0200
@@ -42,7 +42,7 @@
*
* <p> All soft references to softly-reachable objects are guaranteed to have
* been cleared before the virtual machine throws an
- * <code>OutOfMemoryError</code>. Otherwise no constraints are placed upon the
+ * {@code OutOfMemoryError}. Otherwise no constraints are placed upon the
* time at which a soft reference will be cleared or the order in which a set
* of such references to different objects will be cleared. Virtual machine
* implementations are, however, encouraged to bias against clearing
@@ -92,7 +92,7 @@
*
* @param referent object the new soft reference will refer to
* @param q the queue with which the reference is to be registered,
- * or <tt>null</tt> if registration is not required
+ * or {@code null} if registration is not required
*
*/
public SoftReference(T referent, ReferenceQueue<? super T> q) {
@@ -103,10 +103,10 @@
/**
* Returns this reference object's referent. If this reference object has
* been cleared, either by the program or by the garbage collector, then
- * this method returns <code>null</code>.
+ * this method returns {@code null}.
*
* @return The object to which this reference refers, or
- * <code>null</code> if this reference object has been cleared
+ * {@code null} if this reference object has been cleared
*/
public T get() {
T o = super.get();
--- a/jdk/src/java.base/share/classes/java/lang/ref/WeakReference.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ref/WeakReference.java Wed Jul 05 20:44:51 2017 +0200
@@ -63,7 +63,7 @@
*
* @param referent object the new weak reference will refer to
* @param q the queue with which the reference is to be registered,
- * or <tt>null</tt> if registration is not required
+ * or {@code null} if registration is not required
*/
public WeakReference(T referent, ReferenceQueue<? super T> q) {
super(referent, q);
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java Wed Jul 05 20:44:51 2017 +0200
@@ -286,9 +286,9 @@
* followed by the fully-qualified name of the declaring class,
* followed by a parenthesized, comma-separated list of the
* constructor's formal parameter types. For example:
- * <pre>
+ * <pre>{@code
* public java.util.Hashtable(int,float)
- * </pre>
+ * }</pre>
*
* <p>The only possible modifiers for constructors are the access
* modifiers {@code public}, {@code protected} or
@@ -322,8 +322,8 @@
*
* If this constructor was declared to take a variable number of
* arguments, instead of denoting the last parameter as
- * "<tt><i>Type</i>[]</tt>", it is denoted as
- * "<tt><i>Type</i>...</tt>".
+ * "<code><i>Type</i>[]</code>", it is denoted as
+ * "<code><i>Type</i>...</code>".
*
* A space is used to separate access modifiers from one another
* and from the type parameters or return type. If there are no
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Method.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Method.java Wed Jul 05 20:44:51 2017 +0200
@@ -387,8 +387,8 @@
*
* If this method was declared to take a variable number of
* arguments, instead of denoting the last parameter as
- * "<tt><i>Type</i>[]</tt>", it is denoted as
- * "<tt><i>Type</i>...</tt>".
+ * "<code><i>Type</i>[]</code>", it is denoted as
+ * "<code><i>Type</i>...</code>".
*
* A space is used to separate access modifiers from one another
* and from the type parameters or return type. If there are no
--- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java Wed Jul 05 20:44:51 2017 +0200
@@ -40,7 +40,7 @@
* decimal point. If negative, the unscaled value of the number is
* multiplied by ten to the power of the negation of the scale. The
* value of the number represented by the {@code BigDecimal} is
- * therefore <tt>(unscaledValue × 10<sup>-scale</sup>)</tt>.
+ * therefore <code>(unscaledValue × 10<sup>-scale</sup>)</code>.
*
* <p>The {@code BigDecimal} class provides operations for
* arithmetic, scale manipulation, rounding, comparison, hashing, and
@@ -709,8 +709,8 @@
/**
* Translates the string representation of a {@code BigDecimal}
* into a {@code BigDecimal}. The string representation consists
- * of an optional sign, {@code '+'} (<tt> '\u002B'</tt>) or
- * {@code '-'} (<tt>'\u002D'</tt>), followed by a sequence of
+ * of an optional sign, {@code '+'} (<code> '\u002B'</code>) or
+ * {@code '-'} (<code>'\u002D'</code>), followed by a sequence of
* zero or more decimal digits ("the integer"), optionally
* followed by a fraction, optionally followed by an exponent.
*
@@ -721,7 +721,7 @@
* <i>significand</i>.
*
* <p>The exponent consists of the character {@code 'e'}
- * (<tt>'\u0065'</tt>) or {@code 'E'} (<tt>'\u0045'</tt>)
+ * (<code>'\u0065'</code>) or {@code 'E'} (<code>'\u0045'</code>)
* followed by one or more decimal digits. The value of the
* exponent must lie between -{@link Integer#MAX_VALUE} ({@link
* Integer#MIN_VALUE}+1) and {@link Integer#MAX_VALUE}, inclusive.
@@ -834,7 +834,7 @@
* is the exact decimal representation of the {@code double}'s
* binary floating-point value. The scale of the returned
* {@code BigDecimal} is the smallest value such that
- * <tt>(10<sup>scale</sup> × val)</tt> is an integer.
+ * <code>(10<sup>scale</sup> × val)</code> is an integer.
* <p>
* <b>Notes:</b>
* <ol>
@@ -857,7 +857,7 @@
* creates a {@code BigDecimal} which is <i>exactly</i> equal to
* 0.1, as one would expect. Therefore, it is generally
* recommended that the {@linkplain #BigDecimal(String)
- * <tt>String</tt> constructor} be used in preference to this one.
+ * String constructor} be used in preference to this one.
*
* <li>
* When a {@code double} must be used as a source for a
@@ -881,7 +881,7 @@
* Translates a {@code double} into a {@code BigDecimal}, with
* rounding according to the context settings. The scale of the
* {@code BigDecimal} is the smallest value such that
- * <tt>(10<sup>scale</sup> × val)</tt> is an integer.
+ * <code>(10<sup>scale</sup> × val)</code> is an integer.
*
* <p>The results of this constructor can be somewhat unpredictable
* and its use is generally not recommended; see the notes under
@@ -1010,7 +1010,7 @@
* Translates a {@code BigInteger} unscaled value and an
* {@code int} scale into a {@code BigDecimal}. The value of
* the {@code BigDecimal} is
- * <tt>(unscaledVal × 10<sup>-scale</sup>)</tt>.
+ * <code>(unscaledVal × 10<sup>-scale</sup>)</code>.
*
* @param unscaledVal unscaled value of the {@code BigDecimal}.
* @param scale scale of the {@code BigDecimal}.
@@ -1026,8 +1026,8 @@
* Translates a {@code BigInteger} unscaled value and an
* {@code int} scale into a {@code BigDecimal}, with rounding
* according to the context settings. The value of the
- * {@code BigDecimal} is <tt>(unscaledVal ×
- * 10<sup>-scale</sup>)</tt>, rounded according to the
+ * {@code BigDecimal} is <code>(unscaledVal ×
+ * 10<sup>-scale</sup>)</code>, rounded according to the
* {@code precision} and rounding mode settings.
*
* @param unscaledVal unscaled value of the {@code BigDecimal}.
@@ -1196,7 +1196,7 @@
* @param unscaledVal unscaled value of the {@code BigDecimal}.
* @param scale scale of the {@code BigDecimal}.
* @return a {@code BigDecimal} whose value is
- * <tt>(unscaledVal × 10<sup>-scale</sup>)</tt>.
+ * <code>(unscaledVal × 10<sup>-scale</sup>)</code>.
*/
public static BigDecimal valueOf(long unscaledVal, int scale) {
if (scale == 0)
@@ -1476,8 +1476,8 @@
}
/**
- * Returns a {@code BigDecimal} whose value is <tt>(this ×
- * multiplicand)</tt>, and whose scale is {@code (this.scale() +
+ * Returns a {@code BigDecimal} whose value is <code>(this ×
+ * multiplicand)</code>, and whose scale is {@code (this.scale() +
* multiplicand.scale())}.
*
* @param multiplicand value to be multiplied by this {@code BigDecimal}.
@@ -1501,8 +1501,8 @@
}
/**
- * Returns a {@code BigDecimal} whose value is <tt>(this ×
- * multiplicand)</tt>, with rounding according to the context settings.
+ * Returns a {@code BigDecimal} whose value is <code>(this ×
+ * multiplicand)</code>, with rounding according to the context settings.
*
* @param multiplicand value to be multiplied by this {@code BigDecimal}.
* @param mc the context to use.
@@ -1995,7 +1995,7 @@
/**
* Returns a {@code BigDecimal} whose value is
- * <tt>(this<sup>n</sup>)</tt>, The power is computed exactly, to
+ * <code>(this<sup>n</sup>)</code>, The power is computed exactly, to
* unlimited precision.
*
* <p>The parameter {@code n} must be in the range 0 through
@@ -2006,7 +2006,7 @@
* range of this method.
*
* @param n power to raise this {@code BigDecimal} to.
- * @return <tt>this<sup>n</sup></tt>
+ * @return <code>this<sup>n</sup></code>
* @throws ArithmeticException if {@code n} is out of range.
* @since 1.5
*/
@@ -2022,7 +2022,7 @@
/**
* Returns a {@code BigDecimal} whose value is
- * <tt>(this<sup>n</sup>)</tt>. The current implementation uses
+ * <code>(this<sup>n</sup>)</code>. The current implementation uses
* the core algorithm defined in ANSI standard X3.274-1996 with
* rounding according to the context settings. In general, the
* returned numerical value is within two ulps of the exact
@@ -2063,7 +2063,7 @@
*
* @param n power to raise this {@code BigDecimal} to.
* @param mc the context to use.
- * @return <tt>this<sup>n</sup></tt> using the ANSI standard X3.274-1996
+ * @return <code>this<sup>n</sup></code> using the ANSI standard X3.274-1996
* algorithm
* @throws ArithmeticException if the result is inexact but the
* rounding mode is {@code UNNECESSARY}, or {@code n} is out
@@ -2251,8 +2251,8 @@
/**
* Returns a {@code BigInteger} whose value is the <i>unscaled
- * value</i> of this {@code BigDecimal}. (Computes <tt>(this *
- * 10<sup>this.scale()</sup>)</tt>.)
+ * value</i> of this {@code BigDecimal}. (Computes <code>(this *
+ * 10<sup>this.scale()</sup>)</code>.)
*
* @return the unscaled value of this {@code BigDecimal}.
* @since 1.2
@@ -2371,7 +2371,7 @@
* <p>Note that since BigDecimal objects are immutable, calls of
* this method do <i>not</i> result in the original object being
* modified, contrary to the usual convention of having methods
- * named <tt>set<i>X</i></tt> mutate field <i>{@code X}</i>.
+ * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
* Instead, {@code setScale} returns an object with the proper
* scale; the returned object may or may not be newly allocated.
*
@@ -2404,7 +2404,7 @@
* <p>Note that since BigDecimal objects are immutable, calls of
* this method do <i>not</i> result in the original object being
* modified, contrary to the usual convention of having methods
- * named <tt>set<i>X</i></tt> mutate field <i>{@code X}</i>.
+ * named <code>set<i>X</i></code> mutate field <i>{@code X}</i>.
* Instead, {@code setScale} returns an object with the proper
* scale; the returned object may or may not be newly allocated.
*
@@ -2498,7 +2498,7 @@
* <p>Note that since {@code BigDecimal} objects are immutable,
* calls of this method do <i>not</i> result in the original
* object being modified, contrary to the usual convention of
- * having methods named <tt>set<i>X</i></tt> mutate field
+ * having methods named <code>set<i>X</i></code> mutate field
* <i>{@code X}</i>. Instead, {@code setScale} returns an
* object with the proper scale; the returned object may or may
* not be newly allocated.
@@ -2525,8 +2525,8 @@
* {@code n} is non-negative, the call merely adds {@code n} to
* the scale. If {@code n} is negative, the call is equivalent
* to {@code movePointRight(-n)}. The {@code BigDecimal}
- * returned by this call has value <tt>(this ×
- * 10<sup>-n</sup>)</tt> and scale {@code max(this.scale()+n,
+ * returned by this call has value <code>(this ×
+ * 10<sup>-n</sup>)</code> and scale {@code max(this.scale()+n,
* 0)}.
*
* @param n number of places to move the decimal point to the left.
@@ -2547,8 +2547,8 @@
* If {@code n} is non-negative, the call merely subtracts
* {@code n} from the scale. If {@code n} is negative, the call
* is equivalent to {@code movePointLeft(-n)}. The
- * {@code BigDecimal} returned by this call has value <tt>(this
- * × 10<sup>n</sup>)</tt> and scale {@code max(this.scale()-n,
+ * {@code BigDecimal} returned by this call has value <code>(this
+ * × 10<sup>n</sup>)</code> and scale {@code max(this.scale()-n,
* 0)}.
*
* @param n number of places to move the decimal point to the right.
@@ -2825,12 +2825,12 @@
* adjusted exponent converted to a character form. The latter is
* in base ten, using the characters {@code '0'} through
* {@code '9'} with no leading zeros, and is always prefixed by a
- * sign character {@code '-'} (<tt>'\u002D'</tt>) if the
+ * sign character {@code '-'} (<code>'\u002D'</code>) if the
* adjusted exponent is negative, {@code '+'}
- * (<tt>'\u002B'</tt>) otherwise).
+ * (<code>'\u002B'</code>) otherwise).
*
* <p>Finally, the entire string is prefixed by a minus sign
- * character {@code '-'} (<tt>'\u002D'</tt>) if the unscaled
+ * character {@code '-'} (<code>'\u002D'</code>) if the unscaled
* value is less than zero. No sign character is prefixed if the
* unscaled value is zero or positive.
*
@@ -2930,7 +2930,7 @@
* in the result.
*
* The entire string is prefixed by a minus sign character '-'
- * (<tt>'\u002D'</tt>) if the unscaled value is less than
+ * (<code>'\u002D'</code>) if the unscaled value is less than
* zero. No sign character is prefixed if the unscaled value is
* zero or positive.
*
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java Wed Jul 05 20:44:51 2017 +0200
@@ -2289,11 +2289,11 @@
}
/**
- * Returns a BigInteger whose value is <tt>(this<sup>exponent</sup>)</tt>.
+ * Returns a BigInteger whose value is <code>(this<sup>exponent</sup>)</code>.
* Note that {@code exponent} is an integer rather than a BigInteger.
*
* @param exponent exponent to which this BigInteger is to be raised.
- * @return <tt>this<sup>exponent</sup></tt>
+ * @return <code>this<sup>exponent</sup></code>
* @throws ArithmeticException {@code exponent} is negative. (This would
* cause the operation to yield a non-integer value.)
*/
@@ -2552,12 +2552,12 @@
/**
* Returns a BigInteger whose value is
- * <tt>(this<sup>exponent</sup> mod m)</tt>. (Unlike {@code pow}, this
+ * <code>(this<sup>exponent</sup> mod m)</code>. (Unlike {@code pow}, this
* method permits negative exponents.)
*
* @param exponent the exponent.
* @param m the modulus.
- * @return <tt>this<sup>exponent</sup> mod m</tt>
+ * @return <code>this<sup>exponent</sup> mod m</code>
* @throws ArithmeticException {@code m} ≤ 0 or the exponent is
* negative and this BigInteger is not <i>relatively
* prime</i> to {@code m}.
@@ -3152,7 +3152,7 @@
* Returns a BigInteger whose value is {@code (this << n)}.
* The shift distance, {@code n}, may be negative, in which case
* this method performs a right shift.
- * (Computes <tt>floor(this * 2<sup>n</sup>)</tt>.)
+ * (Computes <code>floor(this * 2<sup>n</sup>)</code>.)
*
* @param n shift distance, in bits.
* @return {@code this << n}
@@ -3175,7 +3175,7 @@
/**
* Returns a magnitude array whose value is {@code (mag << n)}.
* The shift distance, {@code n}, is considered unnsigned.
- * (Computes <tt>this * 2<sup>n</sup></tt>.)
+ * (Computes <code>this * 2<sup>n</sup></code>.)
*
* @param mag magnitude, the most-significant int ({@code mag[0]}) must be non-zero.
* @param n unsigned shift distance, in bits.
@@ -3212,7 +3212,7 @@
* Returns a BigInteger whose value is {@code (this >> n)}. Sign
* extension is performed. The shift distance, {@code n}, may be
* negative, in which case this method performs a left shift.
- * (Computes <tt>floor(this / 2<sup>n</sup>)</tt>.)
+ * (Computes <code>floor(this / 2<sup>n</sup>)</code>.)
*
* @param n shift distance, in bits.
* @return {@code this >> n}
@@ -3235,7 +3235,7 @@
/**
* Returns a BigInteger whose value is {@code (this >> n)}. The shift
* distance, {@code n}, is considered unsigned.
- * (Computes <tt>floor(this * 2<sup>-n</sup>)</tt>.)
+ * (Computes <code>floor(this * 2<sup>-n</sup>)</code>.)
*
* @param n unsigned shift distance, in bits.
* @return {@code this >> n}
--- a/jdk/src/java.base/share/classes/java/math/MathContext.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/math/MathContext.java Wed Jul 05 20:44:51 2017 +0200
@@ -268,7 +268,7 @@
* Returns the string representation of this {@code MathContext}.
* The {@code String} returned represents the settings of the
* {@code MathContext} object as two space-delimited words
- * (separated by a single space character, <tt>'\u0020'</tt>,
+ * (separated by a single space character, <code>'\u0020'</code>,
* and with no leading or trailing white space), as follows:
* <ol>
* <li>
--- a/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/math/MutableBigInteger.java Wed Jul 05 20:44:51 2017 +0200
@@ -254,7 +254,7 @@
/**
* Compare the magnitude of two MutableBigIntegers. Returns -1, 0 or 1
* as this MutableBigInteger is numerically less than, equal to, or
- * greater than <tt>b</tt>.
+ * greater than {@code b}.
*/
final int compare(MutableBigInteger b) {
int blen = b.intLen;
--- a/jdk/src/java.base/share/classes/java/security/KeyStoreSpi.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/KeyStoreSpi.java Wed Jul 05 20:44:51 2017 +0200
@@ -360,6 +360,22 @@
* that specifies how to load the keystore,
* which may be {@code null}
*
+ * @implSpec
+ * The default implementation examines {@code KeyStore.LoadStoreParameter}
+ * to extract its password and pass it to
+ * {@link KeyStoreSpi#engineLoad(InputStream, char[])} along with a
+ * {@code null} {@code InputStream}.
+ * <p>
+ * If {@code KeyStore.LoadStoreParameter} is {@code null} then
+ * the password parameter will also be {@code null}.
+ * Otherwise the {@code KeyStore.ProtectionParameter} of
+ * {@code KeyStore.LoadStoreParameter} must be either a
+ * {@code KeyStore.PasswordProtection} or a
+ * {@code KeyStore.CallbackHandlerProtection} that supports
+ * {@code PasswordCallback} so that the password parameter can be
+ * extracted. If the {@code KeyStore.ProtectionParameter} is neither
+ * of those classes then a {@code NoSuchAlgorithmException} is thrown.
+ *
* @exception IllegalArgumentException if the given
* {@code KeyStore.LoadStoreParameter}
* input is not recognized
@@ -385,37 +401,32 @@
return;
}
- if (param instanceof KeyStore.SimpleLoadStoreParameter) {
- ProtectionParameter protection = param.getProtectionParameter();
- char[] password;
- if (protection instanceof PasswordProtection) {
- password = ((PasswordProtection)protection).getPassword();
- } else if (protection instanceof CallbackHandlerProtection) {
- CallbackHandler handler =
- ((CallbackHandlerProtection)protection).getCallbackHandler();
- PasswordCallback callback =
- new PasswordCallback("Password: ", false);
- try {
- handler.handle(new Callback[] {callback});
- } catch (UnsupportedCallbackException e) {
- throw new NoSuchAlgorithmException
- ("Could not obtain password", e);
- }
- password = callback.getPassword();
- callback.clearPassword();
- if (password == null) {
- throw new NoSuchAlgorithmException
- ("No password provided");
- }
- } else {
- throw new NoSuchAlgorithmException("ProtectionParameter must"
- + " be PasswordProtection or CallbackHandlerProtection");
+ ProtectionParameter protection = param.getProtectionParameter();
+ char[] password;
+ if (protection instanceof PasswordProtection) {
+ password = ((PasswordProtection)protection).getPassword();
+ } else if (protection instanceof CallbackHandlerProtection) {
+ CallbackHandler handler =
+ ((CallbackHandlerProtection)protection).getCallbackHandler();
+ PasswordCallback callback =
+ new PasswordCallback("Password: ", false);
+ try {
+ handler.handle(new Callback[] {callback});
+ } catch (UnsupportedCallbackException e) {
+ throw new NoSuchAlgorithmException
+ ("Could not obtain password", e);
}
- engineLoad(null, password);
- return;
+ password = callback.getPassword();
+ callback.clearPassword();
+ if (password == null) {
+ throw new NoSuchAlgorithmException("No password provided");
+ }
+ } else {
+ throw new NoSuchAlgorithmException("ProtectionParameter must"
+ + " be PasswordProtection or CallbackHandlerProtection");
}
-
- throw new UnsupportedOperationException();
+ engineLoad(null, password);
+ return;
}
/**
--- a/jdk/src/java.base/share/classes/java/time/Instant.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/time/Instant.java Wed Jul 05 20:44:51 2017 +0200
@@ -1232,10 +1232,10 @@
if (seconds < 0 && nanos > 0) {
long millis = Math.multiplyExact(seconds+1, 1000);
long adjustment = nanos / 1000_000 - 1000;
- return millis + adjustment;
+ return Math.addExact(millis, adjustment);
} else {
long millis = Math.multiplyExact(seconds, 1000);
- return millis + nanos / 1000_000;
+ return Math.addExact(millis, nanos / 1000_000);
}
}
--- a/jdk/src/java.base/share/classes/java/util/Formatter.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Formatter.java Wed Jul 05 20:44:51 2017 +0200
@@ -1772,7 +1772,7 @@
*
* <tr><td valign="top">{@code 'n'}
* <td> the platform-specific line separator as returned by {@link
- * System#getProperty System.getProperty("line.separator")}.
+ * System#lineSeparator()}.
*
* </table>
*
--- a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java Wed Jul 05 20:44:51 2017 +0200
@@ -526,7 +526,7 @@
}
/**
- * <code>Name</code> object for <code>Manifest-Version</code>
+ * {@code Name} object for {@code Manifest-Version}
* manifest attribute. This attribute indicates the version number
* of the manifest standard to which a JAR file's manifest conforms.
* @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
@@ -535,7 +535,7 @@
public static final Name MANIFEST_VERSION = new Name("Manifest-Version");
/**
- * <code>Name</code> object for <code>Signature-Version</code>
+ * {@code Name} object for {@code Signature-Version}
* manifest attribute used when signing JAR files.
* @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
* Manifest and Signature Specification</a>
@@ -543,13 +543,13 @@
public static final Name SIGNATURE_VERSION = new Name("Signature-Version");
/**
- * <code>Name</code> object for <code>Content-Type</code>
+ * {@code Name} object for {@code Content-Type}
* manifest attribute.
*/
public static final Name CONTENT_TYPE = new Name("Content-Type");
/**
- * <code>Name</code> object for <code>Class-Path</code>
+ * {@code Name} object for {@code Class-Path}
* manifest attribute.
* @see <a href="../../../../technotes/guides/jar/jar.html#classpath">
* JAR file specification</a>
@@ -557,16 +557,16 @@
public static final Name CLASS_PATH = new Name("Class-Path");
/**
- * <code>Name</code> object for <code>Main-Class</code> manifest
+ * {@code Name} object for {@code Main-Class} manifest
* attribute used for launching applications packaged in JAR files.
- * The <code>Main-Class</code> attribute is used in conjunction
- * with the <code>-jar</code> command-line option of the
- * <tt>java</tt> application launcher.
+ * The {@code Main-Class} attribute is used in conjunction
+ * with the {@code -jar} command-line option of the
+ * {@code java} application launcher.
*/
public static final Name MAIN_CLASS = new Name("Main-Class");
/**
- * <code>Name</code> object for <code>Sealed</code> manifest attribute
+ * {@code Name} object for {@code Sealed} manifest attribute
* used for sealing.
* @see <a href="../../../../technotes/guides/jar/jar.html#sealing">
* Package Sealing</a>
@@ -574,19 +574,19 @@
public static final Name SEALED = new Name("Sealed");
/**
- * <code>Name</code> object for <code>Extension-List</code> manifest attribute
+ * {@code Name} object for {@code Extension-List} manifest attribute
* used for the extension mechanism that is no longer supported.
*/
public static final Name EXTENSION_LIST = new Name("Extension-List");
/**
- * <code>Name</code> object for <code>Extension-Name</code> manifest attribute.
+ * {@code Name} object for {@code Extension-Name} manifest attribute.
* used for the extension mechanism that is no longer supported.
*/
public static final Name EXTENSION_NAME = new Name("Extension-Name");
/**
- * <code>Name</code> object for <code>Extension-Installation</code> manifest attribute.
+ * {@code Name} object for {@code Extension-Installation} manifest attribute.
*
* @deprecated Extension mechanism is no longer supported.
*/
@@ -594,25 +594,25 @@
public static final Name EXTENSION_INSTALLATION = new Name("Extension-Installation");
/**
- * <code>Name</code> object for <code>Implementation-Title</code>
+ * {@code Name} object for {@code Implementation-Title}
* manifest attribute used for package versioning.
*/
public static final Name IMPLEMENTATION_TITLE = new Name("Implementation-Title");
/**
- * <code>Name</code> object for <code>Implementation-Version</code>
+ * {@code Name} object for {@code Implementation-Version}
* manifest attribute used for package versioning.
*/
public static final Name IMPLEMENTATION_VERSION = new Name("Implementation-Version");
/**
- * <code>Name</code> object for <code>Implementation-Vendor</code>
+ * {@code Name} object for {@code Implementation-Vendor}
* manifest attribute used for package versioning.
*/
public static final Name IMPLEMENTATION_VENDOR = new Name("Implementation-Vendor");
/**
- * <code>Name</code> object for <code>Implementation-Vendor-Id</code>
+ * {@code Name} object for {@code Implementation-Vendor-Id}
* manifest attribute.
*
* @deprecated Extension mechanism is no longer supported.
@@ -621,7 +621,7 @@
public static final Name IMPLEMENTATION_VENDOR_ID = new Name("Implementation-Vendor-Id");
/**
- * <code>Name</code> object for <code>Implementation-URL</code>
+ * {@code Name} object for {@code Implementation-URL}
* manifest attribute.
*
* @deprecated Extension mechanism is no longer supported.
@@ -630,19 +630,19 @@
public static final Name IMPLEMENTATION_URL = new Name("Implementation-URL");
/**
- * <code>Name</code> object for <code>Specification-Title</code>
+ * {@code Name} object for {@code Specification-Title}
* manifest attribute used for package versioning.
*/
public static final Name SPECIFICATION_TITLE = new Name("Specification-Title");
/**
- * <code>Name</code> object for <code>Specification-Version</code>
+ * {@code Name} object for {@code Specification-Version}
* manifest attribute used for package versioning.
*/
public static final Name SPECIFICATION_VERSION = new Name("Specification-Version");
/**
- * <code>Name</code> object for <code>Specification-Vendor</code>
+ * {@code Name} object for {@code Specification-Vendor}
* manifest attribute used for package versioning.
*/
public static final Name SPECIFICATION_VENDOR = new Name("Specification-Vendor");
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Wed Jul 05 20:44:51 2017 +0200
@@ -43,14 +43,14 @@
import sun.security.util.SignatureFileVerifier;
/**
- * The <code>JarFile</code> class is used to read the contents of a jar file
- * from any file that can be opened with <code>java.io.RandomAccessFile</code>.
- * It extends the class <code>java.util.zip.ZipFile</code> with support
- * for reading an optional <code>Manifest</code> entry. The
- * <code>Manifest</code> can be used to specify meta-information about the
+ * The {@code JarFile} class is used to read the contents of a jar file
+ * from any file that can be opened with {@code java.io.RandomAccessFile}.
+ * It extends the class {@code java.util.zip.ZipFile} with support
+ * for reading an optional {@code Manifest} entry. The
+ * {@code Manifest} can be used to specify meta-information about the
* jar file and its entries.
*
- * <p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
+ * <p> Unless otherwise noted, passing a {@code null} argument to a constructor
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
*
@@ -91,8 +91,8 @@
public static final String MANIFEST_NAME = "META-INF/MANIFEST.MF";
/**
- * Creates a new <code>JarFile</code> to read from the specified
- * file <code>name</code>. The <code>JarFile</code> will be verified if
+ * Creates a new {@code JarFile} to read from the specified
+ * file {@code name}. The {@code JarFile} will be verified if
* it is signed.
* @param name the name of the jar file to be opened for reading
* @throws IOException if an I/O error has occurred
@@ -104,8 +104,8 @@
}
/**
- * Creates a new <code>JarFile</code> to read from the specified
- * file <code>name</code>.
+ * Creates a new {@code JarFile} to read from the specified
+ * file {@code name}.
* @param name the name of the jar file to be opened for reading
* @param verify whether or not to verify the jar file if
* it is signed.
@@ -118,8 +118,8 @@
}
/**
- * Creates a new <code>JarFile</code> to read from the specified
- * <code>File</code> object. The <code>JarFile</code> will be verified if
+ * Creates a new {@code JarFile} to read from the specified
+ * {@code File} object. The {@code JarFile} will be verified if
* it is signed.
* @param file the jar file to be opened for reading
* @throws IOException if an I/O error has occurred
@@ -132,8 +132,8 @@
/**
- * Creates a new <code>JarFile</code> to read from the specified
- * <code>File</code> object.
+ * Creates a new {@code JarFile} to read from the specified
+ * {@code File} object.
* @param file the jar file to be opened for reading
* @param verify whether or not to verify the jar file if
* it is signed.
@@ -147,9 +147,9 @@
/**
- * Creates a new <code>JarFile</code> to read from the specified
- * <code>File</code> object in the specified mode. The mode argument
- * must be either <tt>OPEN_READ</tt> or <tt>OPEN_READ | OPEN_DELETE</tt>.
+ * Creates a new {@code JarFile} to read from the specified
+ * {@code File} object in the specified mode. The mode argument
+ * must be either {@code OPEN_READ} or {@code OPEN_READ | OPEN_DELETE}.
*
* @param file the jar file to be opened for reading
* @param verify whether or not to verify the jar file if
@@ -157,7 +157,7 @@
* @param mode the mode in which the file is to be opened
* @throws IOException if an I/O error has occurred
* @throws IllegalArgumentException
- * if the <tt>mode</tt> argument is invalid
+ * if the {@code mode} argument is invalid
* @throws SecurityException if access to the file is denied
* by the SecurityManager
* @since 1.3
@@ -168,9 +168,9 @@
}
/**
- * Returns the jar file manifest, or <code>null</code> if none.
+ * Returns the jar file manifest, or {@code null} if none.
*
- * @return the jar file manifest, or <code>null</code> if none
+ * @return the jar file manifest, or {@code null} if none
*
* @throws IllegalStateException
* may be thrown if the jar file has been closed
@@ -207,12 +207,12 @@
private native String[] getMetaInfEntryNames();
/**
- * Returns the <code>JarEntry</code> for the given entry name or
- * <code>null</code> if not found.
+ * Returns the {@code JarEntry} for the given entry name or
+ * {@code null} if not found.
*
* @param name the jar file entry name
- * @return the <code>JarEntry</code> for the given entry name or
- * <code>null</code> if not found.
+ * @return the {@code JarEntry} for the given entry name or
+ * {@code null} if not found.
*
* @throws IllegalStateException
* may be thrown if the jar file has been closed
@@ -224,12 +224,12 @@
}
/**
- * Returns the <code>ZipEntry</code> for the given entry name or
- * <code>null</code> if not found.
+ * Returns the {@code ZipEntry} for the given entry name or
+ * {@code null} if not found.
*
* @param name the jar file entry name
- * @return the <code>ZipEntry</code> for the given entry name or
- * <code>null</code> if not found
+ * @return the {@code ZipEntry} for the given entry name or
+ * {@code null} if not found
*
* @throws IllegalStateException
* may be thrown if the jar file has been closed
--- a/jdk/src/java.base/share/classes/java/util/jar/Pack200.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/Pack200.java Wed Jul 05 20:44:51 2017 +0200
@@ -95,7 +95,7 @@
* the file encoded with Pack200 and further compressed with gzip. Please
* refer to the Java Deployment Guide for techniques and details.
* <p>
- * Unless otherwise noted, passing a <tt>null</tt> argument to a constructor or
+ * Unless otherwise noted, passing a {@code null} argument to a constructor or
* method in this class will cause a {@link NullPointerException} to be thrown.
*
* @author John Rose
@@ -109,7 +109,7 @@
/**
* Obtain new instance of a class that implements Packer.
* <ul>
- * <li><p>If the system property <tt>java.util.jar.Pack200.Packer</tt>
+ * <li><p>If the system property {@code java.util.jar.Pack200.Packer}
* is defined, then the value is taken to be the fully-qualified name
* of a concrete implementation class, which must implement Packer.
* This class is loaded and instantiated. If this process fails
@@ -135,7 +135,7 @@
/**
* Obtain new instance of a class that implements Unpacker.
* <ul>
- * <li><p>If the system property <tt>java.util.jar.Pack200.Unpacker</tt>
+ * <li><p>If the system property {@code java.util.jar.Pack200.Unpacker}
* is defined, then the value is taken to be the fully-qualified
* name of a concrete implementation class, which must implement Unpacker.
* The class is loaded and instantiated. If this process fails
@@ -220,7 +220,7 @@
* If the input JAR-files contains a 1.6 class file, then the pack file
* version will be set to 1.6.
* <p>
- * Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
+ * Note: Unless otherwise noted, passing a {@code null} argument to a
* constructor or method in this class will cause a {@link NullPointerException}
* to be thrown.
*
@@ -367,7 +367,7 @@
* {@link #STRIP}, and {@link #PASS}.
* <p>
* The string {@link #ERROR} means that the pack operation
- * as a whole will fail, with an exception of type <code>IOException</code>.
+ * as a whole will fail, with an exception of type {@code IOException}.
* The string
* {@link #STRIP} means that the attribute will be dropped.
* The string
@@ -391,7 +391,7 @@
* using the layout language specified in the JSR 200 specification.
* <p>
* For example, the effect of this option is built in:
- * <code>pack.class.attribute.SourceFile=RUH</code>.
+ * {@code pack.class.attribute.SourceFile=RUH}.
* <p>
* The special strings {@link #ERROR}, {@link #STRIP}, and {@link #PASS} are
* also allowed, with the same meaning as {@link #UNKNOWN_ATTRIBUTE}.
@@ -399,21 +399,21 @@
* refused, stripped, or passed bitwise (with no class compression).
* <p>
* Code like this might be used to support attributes for JCOV:
- * <pre><code>
+ * <pre>{@code
* Map p = packer.properties();
* p.put(CODE_ATTRIBUTE_PFX+"CoverageTable", "NH[PHHII]");
* p.put(CODE_ATTRIBUTE_PFX+"CharacterRangeTable", "NH[PHPOHIIH]");
* p.put(CLASS_ATTRIBUTE_PFX+"SourceID", "RUH");
* p.put(CLASS_ATTRIBUTE_PFX+"CompilationID", "RUH");
- * </code></pre>
+ * }</pre>
* <p>
* Code like this might be used to strip debugging attributes:
- * <pre><code>
+ * <pre>{@code
* Map p = packer.properties();
* p.put(CODE_ATTRIBUTE_PFX+"LineNumberTable", STRIP);
* p.put(CODE_ATTRIBUTE_PFX+"LocalVariableTable", STRIP);
* p.put(CLASS_ATTRIBUTE_PFX+"SourceFile", STRIP);
- * </code></pre>
+ * }</pre>
*/
String CLASS_ATTRIBUTE_PFX = "pack.class.attribute.";
@@ -421,7 +421,7 @@
* When concatenated with a field attribute name,
* indicates the format of that attribute.
* For example, the effect of this option is built in:
- * <code>pack.field.attribute.Deprecated=</code>.
+ * {@code pack.field.attribute.Deprecated=}.
* The special strings {@link #ERROR}, {@link #STRIP}, and
* {@link #PASS} are also allowed.
* @see #CLASS_ATTRIBUTE_PFX
@@ -432,7 +432,7 @@
* When concatenated with a method attribute name,
* indicates the format of that attribute.
* For example, the effect of this option is built in:
- * <code>pack.method.attribute.Exceptions=NH[RCH]</code>.
+ * {@code pack.method.attribute.Exceptions=NH[RCH]}.
* The special strings {@link #ERROR}, {@link #STRIP}, and {@link #PASS}
* are also allowed.
* @see #CLASS_ATTRIBUTE_PFX
@@ -443,7 +443,7 @@
* When concatenated with a code attribute name,
* indicates the format of that attribute.
* For example, the effect of this option is built in:
- * <code>pack.code.attribute.LocalVariableTable=NH[PHOHRUHRSHH]</code>.
+ * {@code pack.code.attribute.LocalVariableTable=NH[PHOHRUHRSHH]}.
* The special strings {@link #ERROR}, {@link #STRIP}, and {@link #PASS}
* are also allowed.
* @see #CLASS_ATTRIBUTE_PFX
@@ -527,9 +527,9 @@
* <p>
* Implementation specific properties are prefixed with a
* package name associated with the implementor, beginning
- * with <tt>com.</tt> or a similar prefix.
- * All property names beginning with <tt>pack.</tt> and
- * <tt>unpack.</tt> are reserved for use by this API.
+ * with {@code com.} or a similar prefix.
+ * All property names beginning with {@code pack.} and
+ * {@code unpack.} are reserved for use by this API.
* <p>
* Unknown properties may be ignored or rejected with an
* unspecified error, and invalid entries may cause an
@@ -575,10 +575,10 @@
* using {@link #newUnpacker}.
* <p>
* Every JAR file produced by this engine will include the string
- * "<tt>PACK200</tt>" as a zip file comment.
+ * "{@code PACK200}" as a zip file comment.
* This allows a deployer to detect if a JAR archive was packed and unpacked.
* <p>
- * Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
+ * Note: Unless otherwise noted, passing a {@code null} argument to a
* constructor or method in this class will cause a {@link NullPointerException}
* to be thrown.
* <p>
@@ -641,9 +641,9 @@
* <p>
* Implementation specific properties are prefixed with a
* package name associated with the implementor, beginning
- * with <tt>com.</tt> or a similar prefix.
- * All property names beginning with <tt>pack.</tt> and
- * <tt>unpack.</tt> are reserved for use by this API.
+ * with {@code com.} or a similar prefix.
+ * All property names beginning with {@code pack.} and
+ * {@code unpack.} are reserved for use by this API.
* <p>
* Unknown properties may be ignored or rejected with an
* unspecified error, and invalid entries may cause an
--- a/jdk/src/java.base/share/classes/java/util/regex/Matcher.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/regex/Matcher.java Wed Jul 05 20:44:51 2017 +0200
@@ -63,7 +63,7 @@
*
* <p> A matcher finds matches in a subset of its input called the
* <i>region</i>. By default, the region contains all of the matcher's input.
- * The region can be modified via the{@link #region region} method and queried
+ * The region can be modified via the {@link #region region} method and queried
* via the {@link #regionStart regionStart} and {@link #regionEnd regionEnd}
* methods. The way that the region boundaries interact with some pattern
* constructs can be changed. See {@link #useAnchoringBounds
@@ -1639,15 +1639,15 @@
*/
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append("java.util.regex.Matcher");
- sb.append("[pattern=" + pattern());
- sb.append(" region=");
- sb.append(regionStart() + "," + regionEnd());
- sb.append(" lastmatch=");
+ sb.append("java.util.regex.Matcher")
+ .append("[pattern=").append(pattern())
+ .append(" region=")
+ .append(regionStart()).append(',').append(regionEnd())
+ .append(" lastmatch=");
if ((first >= 0) && (group() != null)) {
sb.append(group());
}
- sb.append("]");
+ sb.append(']');
return sb.toString();
}
--- a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java Wed Jul 05 20:44:51 2017 +0200
@@ -565,7 +565,7 @@
* <p>
* <b><a name="usc">Scripts</a></b> are specified either with the prefix {@code Is}, as in
* {@code IsHiragana}, or by using the {@code script} keyword (or its short
- * form {@code sc})as in {@code script=Hiragana} or {@code sc=Hiragana}.
+ * form {@code sc}) as in {@code script=Hiragana} or {@code sc=Hiragana}.
* <p>
* The script names supported by <code>Pattern</code> are the valid script names
* accepted and defined by
@@ -1299,18 +1299,22 @@
if (slashEIndex == -1)
return "\\Q" + s + "\\E";
- StringBuilder sb = new StringBuilder(s.length() * 2);
+ int lenHint = s.length();
+ lenHint = (lenHint < Integer.MAX_VALUE - 8 - lenHint) ?
+ (lenHint << 1) : (Integer.MAX_VALUE - 8);
+
+ StringBuilder sb = new StringBuilder(lenHint);
sb.append("\\Q");
- slashEIndex = 0;
int current = 0;
- while ((slashEIndex = s.indexOf("\\E", current)) != -1) {
- sb.append(s.substring(current, slashEIndex));
+ do {
+ sb.append(s, current, slashEIndex)
+ .append("\\E\\\\E\\Q");
current = slashEIndex + 2;
- sb.append("\\E\\\\E\\Q");
- }
- sb.append(s.substring(current, s.length()));
- sb.append("\\E");
- return sb.toString();
+ } while ((slashEIndex = s.indexOf("\\E", current)) != -1);
+
+ return sb.append(s, current, s.length())
+ .append("\\E")
+ .toString();
}
/**
@@ -1367,14 +1371,16 @@
}
/**
- * The pattern is converted to normalizedD form and then a pure group
- * is constructed to match canonical equivalences of the characters.
+ * The pattern is converted to normalized form ({@linkplain
+ * java.text.Normalizer.Form.NFD NFD}, canonical decomposition)
+ * and then a pure group is constructed to match canonical
+ * equivalences of the characters.
*/
private void normalize() {
boolean inCharClass = false;
int lastCodePoint = -1;
- // Convert pattern into normalizedD form
+ // Convert pattern into normalized form
normalizedPattern = Normalizer.normalize(pattern, Normalizer.Form.NFD);
patternLength = normalizedPattern.length();
--- a/jdk/src/java.base/share/classes/java/util/stream/Collector.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/stream/Collector.java Wed Jul 05 20:44:51 2017 +0200
@@ -223,7 +223,7 @@
* Perform the final transformation from the intermediate accumulation type
* {@code A} to the final result type {@code R}.
*
- * <p>If the characteristic {@code IDENTITY_TRANSFORM} is
+ * <p>If the characteristic {@code IDENTITY_FINISH} is
* set, this function may be presumed to be an identity transform with an
* unchecked cast from {@code A} to {@code R}.
*
--- a/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -293,7 +293,7 @@
*
* <p>Independent of whether this stream is ordered or unordered if all
* elements of this stream match the given predicate then this operation
- * takes all elements (the result is the same is the input), or if no
+ * takes all elements (the result is the same as the input), or if no
* elements of the stream match the given predicate then no elements are
* taken (the result is an empty stream).
*
@@ -329,6 +329,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
+ * @since 1.9
*/
default DoubleStream takeWhile(DoublePredicate predicate) {
Objects.requireNonNull(predicate);
@@ -361,7 +362,7 @@
* elements of this stream match the given predicate then this operation
* drops all elements (the result is an empty stream), or if no elements of
* the stream match the given predicate then no elements are dropped (the
- * result is the same is the input).
+ * result is the same as the input).
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
@@ -395,6 +396,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
+ * @since 1.9
*/
default DoubleStream dropWhile(DoublePredicate predicate) {
Objects.requireNonNull(predicate);
--- a/jdk/src/java.base/share/classes/java/util/stream/IntStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/stream/IntStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -291,7 +291,7 @@
*
* <p>Independent of whether this stream is ordered or unordered if all
* elements of this stream match the given predicate then this operation
- * takes all elements (the result is the same is the input), or if no
+ * takes all elements (the result is the same as the input), or if no
* elements of the stream match the given predicate then no elements are
* taken (the result is an empty stream).
*
@@ -326,6 +326,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
+ * @since 1.9
*/
default IntStream takeWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);
@@ -358,7 +359,7 @@
* elements of this stream match the given predicate then this operation
* drops all elements (the result is an empty stream), or if no elements of
* the stream match the given predicate then no elements are dropped (the
- * result is the same is the input).
+ * result is the same as the input).
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
@@ -391,6 +392,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
+ * @since 1.9
*/
default IntStream dropWhile(IntPredicate predicate) {
Objects.requireNonNull(predicate);
--- a/jdk/src/java.base/share/classes/java/util/stream/LongStream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/stream/LongStream.java Wed Jul 05 20:44:51 2017 +0200
@@ -291,7 +291,7 @@
*
* <p>Independent of whether this stream is ordered or unordered if all
* elements of this stream match the given predicate then this operation
- * takes all elements (the result is the same is the input), or if no
+ * takes all elements (the result is the same as the input), or if no
* elements of the stream match the given predicate then no elements are
* taken (the result is an empty stream).
*
@@ -327,6 +327,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
+ * @since 1.9
*/
default LongStream takeWhile(LongPredicate predicate) {
Objects.requireNonNull(predicate);
@@ -359,7 +360,7 @@
* elements of this stream match the given predicate then this operation
* drops all elements (the result is an empty stream), or if no elements of
* the stream match the given predicate then no elements are dropped (the
- * result is the same is the input).
+ * result is the same as the input).
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
@@ -393,6 +394,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
+ * @since 1.9
*/
default LongStream dropWhile(LongPredicate predicate) {
Objects.requireNonNull(predicate);
--- a/jdk/src/java.base/share/classes/java/util/stream/SliceOps.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/stream/SliceOps.java Wed Jul 05 20:44:51 2017 +0200
@@ -138,7 +138,7 @@
skip, limit, size);
}
else {
- // @@@ OOMEs will occur for LongStream.longs().filter(i -> true).limit(n)
+ // @@@ OOMEs will occur for LongStream.range(0, Long.MAX_VALUE).filter(i -> true).limit(n)
// regardless of the value of n
// Need to adjust the target size of splitting for the
// SliceTask from say (size / k) to say min(size / k, 1 << 14)
--- a/jdk/src/java.base/share/classes/java/util/stream/Stream.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/stream/Stream.java Wed Jul 05 20:44:51 2017 +0200
@@ -498,7 +498,7 @@
*
* <p>Independent of whether this stream is ordered or unordered if all
* elements of this stream match the given predicate then this operation
- * takes all elements (the result is the same is the input), or if no
+ * takes all elements (the result is the same as the input), or if no
* elements of the stream match the given predicate then no elements are
* taken (the result is an empty stream).
*
@@ -533,6 +533,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
+ * @since 1.9
*/
default Stream<T> takeWhile(Predicate<? super T> predicate) {
Objects.requireNonNull(predicate);
@@ -565,7 +566,7 @@
* elements of this stream match the given predicate then this operation
* drops all elements (the result is an empty stream), or if no elements of
* the stream match the given predicate then no elements are dropped (the
- * result is the same is the input).
+ * result is the same as the input).
*
* <p>This is a <a href="package-summary.html#StreamOps">stateful
* intermediate operation</a>.
@@ -598,6 +599,7 @@
* predicate to apply to elements to determine the longest
* prefix of elements.
* @return the new stream
+ * @since 1.9
*/
default Stream<T> dropWhile(Predicate<? super T> predicate) {
Objects.requireNonNull(predicate);
@@ -1230,6 +1232,9 @@
* Accessing an element of a deeply concatenated stream can result in deep
* call chains, or even {@code StackOverflowError}.
*
+ * <p>Subsequent changes to the sequential/parallel execution mode of the
+ * returned stream are not guaranteed to be propagated to the input streams.
+ *
* @param <T> The type of stream elements
* @param a the first stream
* @param b the second stream
--- a/jdk/src/java.base/share/classes/java/util/stream/Streams.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/stream/Streams.java Wed Jul 05 20:44:51 2017 +0200
@@ -156,10 +156,9 @@
* than a balanced tree at the expense of a higher-depth for the right
* side of the range.
*
- * <p>This is optimized for cases such as IntStream.ints() that is
- * implemented as range of 0 to Integer.MAX_VALUE but is likely to be
- * augmented with a limit operation that limits the number of elements
- * to a count lower than this threshold.
+ * <p>This is optimized for cases such as IntStream.range(0, Integer.MAX_VALUE)
+ * that is likely to be augmented with a limit operation that limits the
+ * number of elements to a count lower than this threshold.
*/
private static final int BALANCED_SPLIT_THRESHOLD = 1 << 24;
@@ -280,10 +279,9 @@
* than a balanced tree at the expense of a higher-depth for the right
* side of the range.
*
- * <p>This is optimized for cases such as LongStream.longs() that is
- * implemented as range of 0 to Long.MAX_VALUE but is likely to be
- * augmented with a limit operation that limits the number of elements
- * to a count lower than this threshold.
+ * <p>This is optimized for cases such as LongStream.range(0, Long.MAX_VALUE)
+ * that is likely to be augmented with a limit operation that limits the
+ * number of elements to a count lower than this threshold.
*/
private static final long BALANCED_SPLIT_THRESHOLD = 1 << 24;
--- a/jdk/src/java.base/share/classes/java/util/stream/package-info.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/stream/package-info.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -159,7 +159,7 @@
* is a necessary, but not sufficient, condition for the processing of an infinite
* stream to terminate normally in finite time.
*
- * <h3>Parallelism</h3>
+ * <h3><a name="Parallelism">Parallelism</a></h3>
*
* <p>Processing elements with an explicit {@code for-}loop is inherently serial.
* Streams facilitate parallel execution by reframing the computation as a pipeline of
@@ -184,15 +184,15 @@
*
* <p>The only difference between the serial and parallel versions of this
* example is the creation of the initial stream, using "{@code parallelStream()}"
- * instead of "{@code stream()}". When the terminal operation is initiated,
- * the stream pipeline is executed sequentially or in parallel depending on the
- * orientation of the stream on which it is invoked. Whether a stream will execute in serial or
- * parallel can be determined with the {@code isParallel()} method, and the
- * orientation of a stream can be modified with the
+ * instead of "{@code stream()}". The stream pipeline is executed sequentially or
+ * in parallel depending on the mode of the stream on which the terminal operation
+ * is invoked. The sequential or parallel mode of a stream can be determined with the
+ * {@link java.util.stream.BaseStream#isParallel()} method, and the
+ * stream's mode can be modified with the
* {@link java.util.stream.BaseStream#sequential()} and
- * {@link java.util.stream.BaseStream#parallel()} operations. When the terminal
- * operation is initiated, the stream pipeline is executed sequentially or in
- * parallel depending on the mode of the stream on which it is invoked.
+ * {@link java.util.stream.BaseStream#parallel()} operations.
+ * The most recent sequential or parallel mode setting applies to the
+ * execution of the entire stream pipeline.
*
* <p>Except for operations identified as explicitly nondeterministic, such
* as {@code findAny()}, whether a stream executes sequentially or in parallel
@@ -280,7 +280,7 @@
* parameters to stream operations entirely; there is usually a way to
* restructure the stream pipeline to avoid statefulness.
*
- * <h3>Side-effects</h3>
+ * <h3><a name="SideEffects">Side-effects</a></h3>
*
* Side-effects in behavioral parameters to stream operations are, in general,
* discouraged, as they can often lead to unwitting violations of the
--- a/jdk/src/java.base/share/classes/java/util/zip/Deflater.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/zip/Deflater.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,8 +34,8 @@
* package description</a>.
*
* <p>The following code fragment demonstrates a trivial compression
- * and decompression of a string using <tt>Deflater</tt> and
- * <tt>Inflater</tt>.
+ * and decompression of a string using {@code Deflater} and
+ * {@code Inflater}.
*
* <blockquote><pre>
* try {
--- a/jdk/src/java.base/share/classes/java/util/zip/Inflater.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/zip/Inflater.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,8 +34,8 @@
* package description</a>.
*
* <p>The following code fragment demonstrates a trivial compression
- * and decompression of a string using <tt>Deflater</tt> and
- * <tt>Inflater</tt>.
+ * and decompression of a string using {@code Deflater} and
+ * {@code Inflater}.
*
* <blockquote><pre>
* try {
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java Wed Jul 05 20:44:51 2017 +0200
@@ -50,7 +50,7 @@
/**
* This class is used to read entries from a zip file.
*
- * <p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
+ * <p> Unless otherwise noted, passing a {@code null} argument to a constructor
* or method in this class will cause a {@link NullPointerException} to be
* thrown.
*
@@ -76,7 +76,7 @@
* Mode flag to open a zip file and mark it for deletion. The file will be
* deleted some time between the moment that it is opened and the moment
* that it is closed, but its contents will remain accessible via the
- * <tt>ZipFile</tt> object until either the close method is invoked or the
+ * {@code ZipFile} object until either the close method is invoked or the
* virtual machine exits.
*/
public static final int OPEN_DELETE = 0x4;
@@ -101,8 +101,8 @@
/**
* Opens a zip file for reading.
*
- * <p>First, if there is a security manager, its <code>checkRead</code>
- * method is called with the <code>name</code> argument as its argument
+ * <p>First, if there is a security manager, its {@code checkRead}
+ * method is called with the {@code name} argument as its argument
* to ensure the read is allowed.
*
* <p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
@@ -112,7 +112,7 @@
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException if a security manager exists and its
- * <code>checkRead</code> method doesn't allow read access to the file.
+ * {@code checkRead} method doesn't allow read access to the file.
*
* @see SecurityManager#checkRead(java.lang.String)
*/
@@ -121,12 +121,12 @@
}
/**
- * Opens a new <code>ZipFile</code> to read from the specified
- * <code>File</code> object in the specified mode. The mode argument
- * must be either <tt>OPEN_READ</tt> or <tt>OPEN_READ | OPEN_DELETE</tt>.
+ * Opens a new {@code ZipFile} to read from the specified
+ * {@code File} object in the specified mode. The mode argument
+ * must be either {@code OPEN_READ} or {@code OPEN_READ | OPEN_DELETE}.
*
- * <p>First, if there is a security manager, its <code>checkRead</code>
- * method is called with the <code>name</code> argument as its argument to
+ * <p>First, if there is a security manager, its {@code checkRead}
+ * method is called with the {@code name} argument as its argument to
* ensure the read is allowed.
*
* <p>The UTF-8 {@link java.nio.charset.Charset charset} is used to
@@ -137,11 +137,11 @@
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException if a security manager exists and
- * its <code>checkRead</code> method
+ * its {@code checkRead} method
* doesn't allow read access to the file,
- * or its <code>checkDelete</code> method doesn't allow deleting
- * the file when the <tt>OPEN_DELETE</tt> flag is set.
- * @throws IllegalArgumentException if the <tt>mode</tt> argument is invalid
+ * or its {@code checkDelete} method doesn't allow deleting
+ * the file when the {@code OPEN_DELETE} flag is set.
+ * @throws IllegalArgumentException if the {@code mode} argument is invalid
* @see SecurityManager#checkRead(java.lang.String)
* @since 1.3
*/
@@ -166,12 +166,12 @@
private ZipCoder zc;
/**
- * Opens a new <code>ZipFile</code> to read from the specified
- * <code>File</code> object in the specified mode. The mode argument
- * must be either <tt>OPEN_READ</tt> or <tt>OPEN_READ | OPEN_DELETE</tt>.
+ * Opens a new {@code ZipFile} to read from the specified
+ * {@code File} object in the specified mode. The mode argument
+ * must be either {@code OPEN_READ} or {@code OPEN_READ | OPEN_DELETE}.
*
- * <p>First, if there is a security manager, its <code>checkRead</code>
- * method is called with the <code>name</code> argument as its argument to
+ * <p>First, if there is a security manager, its {@code checkRead}
+ * method is called with the {@code name} argument as its argument to
* ensure the read is allowed.
*
* @param file the ZIP file to be opened for reading
@@ -186,12 +186,12 @@
* @throws IOException if an I/O error has occurred
*
* @throws SecurityException
- * if a security manager exists and its <code>checkRead</code>
+ * if a security manager exists and its {@code checkRead}
* method doesn't allow read access to the file,or its
- * <code>checkDelete</code> method doesn't allow deleting the
- * file when the <tt>OPEN_DELETE</tt> flag is set
+ * {@code checkDelete} method doesn't allow deleting the
+ * file when the {@code OPEN_DELETE} flag is set
*
- * @throws IllegalArgumentException if the <tt>mode</tt> argument is invalid
+ * @throws IllegalArgumentException if the {@code mode} argument is invalid
*
* @see SecurityManager#checkRead(java.lang.String)
*
@@ -227,8 +227,8 @@
/**
* Opens a zip file for reading.
*
- * <p>First, if there is a security manager, its <code>checkRead</code>
- * method is called with the <code>name</code> argument as its argument
+ * <p>First, if there is a security manager, its {@code checkRead}
+ * method is called with the {@code name} argument as its argument
* to ensure the read is allowed.
*
* @param name the name of the zip file
@@ -241,7 +241,7 @@
* @throws ZipException if a ZIP format error has occurred
* @throws IOException if an I/O error has occurred
* @throws SecurityException
- * if a security manager exists and its <code>checkRead</code>
+ * if a security manager exists and its {@code checkRead}
* method doesn't allow read access to the file
*
* @see SecurityManager#checkRead(java.lang.String)
@@ -654,8 +654,8 @@
*
* <p>
* Since the time when GC would invoke this method is undetermined,
- * it is strongly recommended that applications invoke the <code>close</code>
- * method as soon they have finished accessing this <code>ZipFile</code>.
+ * it is strongly recommended that applications invoke the {@code close}
+ * method as soon they have finished accessing this {@code ZipFile}.
* This will prevent holding up system resources for an undetermined
* length of time.
*
--- a/jdk/src/java.base/share/classes/javax/net/ssl/ExtendedSSLSession.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/ExtendedSSLSession.java Wed Jul 05 20:44:51 2017 +0200
@@ -115,4 +115,45 @@
public List<SNIServerName> getRequestedServerNames() {
throw new UnsupportedOperationException();
}
+
+ /**
+ * Returns a {@link List} containing DER-encoded OCSP responses
+ * (using the ASN.1 type OCSPResponse defined in RFC 6960) for
+ * the client to verify status of the server's certificate during
+ * handshaking.
+ *
+ * <P>
+ * This method only applies to certificate-based server
+ * authentication. An {@link X509ExtendedTrustManager} will use the
+ * returned value for server certificate validation.
+ *
+ * @implSpec This method throws UnsupportedOperationException by default.
+ * Classes derived from ExtendedSSLSession must implement
+ * this method.
+ *
+ * @return a non-null unmodifiable list of byte arrays, each entry
+ * containing a DER-encoded OCSP response (using the
+ * ASN.1 type OCSPResponse defined in RFC 6960). The order
+ * of the responses must match the order of the certificates
+ * presented by the server in its Certificate message (See
+ * {@link SSLSession#getLocalCertificates()} for server mode,
+ * and {@link SSLSession#getPeerCertificates()} for client mode).
+ * It is possible that fewer response entries may be returned than
+ * the number of presented certificates. If an entry in the list
+ * is a zero-length byte array, it should be treated by the
+ * caller as if the OCSP entry for the corresponding certificate
+ * is missing. The returned list may be empty if no OCSP responses
+ * were presented during handshaking or if OCSP stapling is not
+ * supported by either endpoint for this handshake.
+ *
+ * @throws UnsupportedOperationException if the underlying provider
+ * does not implement the operation
+ *
+ * @see X509ExtendedTrustManager
+ *
+ * @since 9
+ */
+ public List<byte[]> getStatusResponses() {
+ throw new UnsupportedOperationException();
+ }
}
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java Wed Jul 05 20:44:51 2017 +0200
@@ -42,14 +42,13 @@
import java.util.List;
import java.util.Map;
-import static sun.security.provider.certpath.OCSPResponse.*;
import sun.security.action.GetIntegerAction;
import sun.security.util.Debug;
-import sun.security.util.ObjectIdentifier;
import sun.security.x509.AccessDescription;
import sun.security.x509.AuthorityInfoAccessExtension;
import sun.security.x509.GeneralName;
import sun.security.x509.GeneralNameInterface;
+import sun.security.x509.PKIXExtensions;
import sun.security.x509.URIName;
import sun.security.x509.X509CertImpl;
@@ -65,9 +64,6 @@
*/
public final class OCSP {
- static final ObjectIdentifier NONCE_EXTENSION_OID =
- ObjectIdentifier.newInternal(new int[]{ 1, 3, 6, 1, 5, 5, 7, 48, 1, 2});
-
private static final Debug debug = Debug.getInstance("certpath");
private static final int DEFAULT_CONNECT_TIMEOUT = 15000;
@@ -184,12 +180,15 @@
/**
* Checks the revocation status of a list of certificates using OCSP.
*
- * @param certs the CertIds to be checked
+ * @param certIds the CertIds to be checked
* @param responderURI the URI of the OCSP responder
* @param issuerCert the issuer's certificate
* @param responderCert the OCSP responder's certificate
* @param date the time the validity of the OCSP responder's certificate
* should be checked against. If null, the current time is used.
+ * @param extensions zero or more OCSP extensions to be included in the
+ * request. If no extensions are requested, an empty {@code List} must
+ * be used. A {@code null} value is not allowed.
* @return the OCSPResponse
* @throws IOException if there is an exception connecting to or
* communicating with the OCSP responder
@@ -202,19 +201,54 @@
List<Extension> extensions)
throws IOException, CertPathValidatorException
{
- byte[] bytes = null;
- OCSPRequest request = null;
+ byte[] nonce = null;
+ for (Extension ext : extensions) {
+ if (ext.getId().equals(PKIXExtensions.OCSPNonce_Id.toString())) {
+ nonce = ext.getValue();
+ }
+ }
+
+ OCSPResponse ocspResponse = null;
try {
- request = new OCSPRequest(certIds, extensions);
- bytes = request.encodeBytes();
+ byte[] response = getOCSPBytes(certIds, responderURI, extensions);
+ ocspResponse = new OCSPResponse(response);
+
+ // verify the response
+ ocspResponse.verify(certIds, issuerCert, responderCert, date,
+ nonce);
} catch (IOException ioe) {
- throw new CertPathValidatorException
- ("Exception while encoding OCSPRequest", ioe);
+ throw new CertPathValidatorException(
+ "Unable to determine revocation status due to network error",
+ ioe, null, -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
}
+ return ocspResponse;
+ }
+
+
+ /**
+ * Send an OCSP request, then read and return the OCSP response bytes.
+ *
+ * @param certIds the CertIds to be checked
+ * @param responderURI the URI of the OCSP responder
+ * @param extensions zero or more OCSP extensions to be included in the
+ * request. If no extensions are requested, an empty {@code List} must
+ * be used. A {@code null} value is not allowed.
+ *
+ * @return the OCSP response bytes
+ *
+ * @throws IOException if there is an exception connecting to or
+ * communicating with the OCSP responder
+ */
+ public static byte[] getOCSPBytes(List<CertId> certIds, URI responderURI,
+ List<Extension> extensions) throws IOException {
+ OCSPRequest request = new OCSPRequest(certIds, extensions);
+ byte[] bytes = request.encodeBytes();
+
InputStream in = null;
OutputStream out = null;
byte[] response = null;
+
try {
URL url = responderURI.toURL();
if (debug != null) {
@@ -257,10 +291,6 @@
}
}
response = Arrays.copyOf(response, total);
- } catch (IOException ioe) {
- throw new CertPathValidatorException(
- "Unable to determine revocation status due to network error",
- ioe, null, -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
} finally {
if (in != null) {
try {
@@ -277,20 +307,7 @@
}
}
}
-
- OCSPResponse ocspResponse = null;
- try {
- ocspResponse = new OCSPResponse(response);
- } catch (IOException ioe) {
- // response decoding exception
- throw new CertPathValidatorException(ioe);
- }
-
- // verify the response
- ocspResponse.verify(certIds, issuerCert, responderCert, date,
- request.getNonce());
-
- return ocspResponse;
+ return response;
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSPNonceExtension.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.provider.certpath;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.security.SecureRandom;
+
+import sun.security.x509.AttributeNameEnumeration;
+import sun.security.x509.CertAttrSet;
+import sun.security.x509.Extension;
+import sun.security.x509.PKIXExtensions;
+import sun.security.util.*;
+
+/**
+ * Represent the OCSP Nonce Extension.
+ * This extension, if present, provides a nonce value in OCSP requests
+ * and responses. This will cryptographically bind requests and responses
+ * and help to prevent replay attacks (see RFC 6960, section 4.4.1).
+ *
+ * @see Extension
+ * @see CertAttrSet
+ */
+public class OCSPNonceExtension extends Extension
+implements CertAttrSet<String> {
+
+ /**
+ * Attribute name.
+ */
+ public static final String NAME = "OCSPNonce";
+ public static final String NONCE = "nonce";
+
+ private byte[] nonceData = null;
+ private String extensionName;
+
+ /**
+ * Encode this extension value to DER and assign it to the
+ * {@code extensionName} data member.
+ *
+ * @throws IOException if any errors occur during DER encoding
+ */
+ private void encodeInternal() throws IOException {
+ if (nonceData == null) {
+ this.extensionValue = null;
+ return;
+ }
+ DerOutputStream os = new DerOutputStream();
+ os.putOctetString(this.nonceData);
+ this.extensionValue = os.toByteArray();
+ }
+
+ /**
+ * Create a {@code OCSPNonceExtension} by providing the nonce length.
+ * The criticality is set to false. The random bytes will be generated
+ * using the SUN provider.
+ *
+ * @param length the number of random bytes composing the nonce
+ *
+ * @throws IOException if any errors happen during encoding of the
+ * extension.
+ */
+ public OCSPNonceExtension(int length) throws IOException {
+ this(PKIXExtensions.OCSPNonce_Id, false, length, NAME);
+ }
+
+ /**
+ * Creates the extension (also called by the subclass).
+ *
+ * @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
+ * extension
+ * @param isCritical a boolean flag indicating if the criticality bit
+ * is to be set for this extension
+ * @param length the length of the nonce in bytes
+ * @param extensionName the name of the extension
+ *
+ * @throws IOException if any errors happen during encoding of the
+ * extension.
+ */
+ protected OCSPNonceExtension(ObjectIdentifier extensionId,
+ boolean isCritical, int length, String extensionName)
+ throws IOException {
+ SecureRandom rng = new SecureRandom();
+ this.nonceData = new byte[length];
+ rng.nextBytes(nonceData);
+ this.extensionId = extensionId;
+ this.critical = isCritical;
+ this.extensionName = extensionName;
+ encodeInternal();
+ }
+
+ /**
+ * Create the extension using the provided criticality bit setting and
+ * DER encoding.
+ *
+ * @param critical true if the extension is to be treated as critical.
+ * @param value an array of DER encoded bytes of the extnValue for the
+ * extension. It must not include the encapsulating OCTET STRING
+ * tag and length. For an {@code OCSPNonceExtension} the data value
+ * should be a simple OCTET STRING containing random bytes
+ * (see RFC 6960, section 4.4.1).
+ *
+ * @throws ClassCastException if value is not an array of bytes
+ * @throws IOException if any errors happen during encoding of the
+ * extension
+ */
+ public OCSPNonceExtension(Boolean critical, Object value)
+ throws IOException {
+ this(PKIXExtensions.OCSPNonce_Id, critical, value, NAME);
+ }
+
+ /**
+ * Creates the extension (also called by the subclass).
+ *
+ * @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
+ * extension
+ * @param critical a boolean flag indicating if the criticality bit
+ * is to be set for this extension
+ * @param value an array of DER encoded bytes of the extnValue for the
+ * extension. It must not include the encapsulating OCTET STRING
+ * tag and length. For an {@code OCSPNonceExtension} the data value
+ * should be a simple OCTET STRING containing random bytes
+ * (see RFC 6960, section 4.4.1).
+ * @param extensionName the name of the extension
+ *
+ * @throws ClassCastException if value is not an array of bytes
+ * @throws IOException if any errors happen during encoding of the
+ * extension
+ */
+ protected OCSPNonceExtension(ObjectIdentifier extensionId,
+ Boolean critical, Object value, String extensionName)
+ throws IOException {
+ this.extensionId = extensionId;
+ this.critical = critical;
+ this.extensionValue = (byte[]) value;
+ DerValue val = new DerValue(this.extensionValue);
+ this.nonceData = val.getOctetString();
+ this.extensionName = extensionName;
+ }
+
+ /**
+ * Set the attribute value.
+ *
+ * @param name the name of the attribute.
+ * @param obj an array of nonce bytes for the extension. It must not
+ * contain any DER tags or length.
+ *
+ * @throws IOException if an unsupported name is provided or the supplied
+ * {@code obj} is not a byte array
+ */
+ @Override
+ public void set(String name, Object obj) throws IOException {
+ if (name.equalsIgnoreCase(NONCE)) {
+ if (!(obj instanceof byte[])) {
+ throw new IOException("Attribute must be of type byte[].");
+ }
+ nonceData = (byte[])obj;
+ } else {
+ throw new IOException("Attribute name not recognized by"
+ + " CertAttrSet:" + extensionName + ".");
+ }
+ encodeInternal();
+ }
+
+ /**
+ * Get the attribute value.
+ *
+ * @param name the name of the attribute to retrieve. Only "OCSPNonce"
+ * is currently supported.
+ *
+ * @return an array of bytes that are the nonce data. It will not contain
+ * any DER tags or length, only the random nonce bytes.
+ *
+ * @throws IOException if an unsupported name is provided.
+ */
+ @Override
+ public Object get(String name) throws IOException {
+ if (name.equalsIgnoreCase(NONCE)) {
+ return nonceData;
+ } else {
+ throw new IOException("Attribute name not recognized by"
+ + " CertAttrSet:" + extensionName + ".");
+ }
+ }
+
+ /**
+ * Delete the attribute value.
+ *
+ * @param name the name of the attribute to retrieve. Only "OCSPNonce"
+ * is currently supported.
+ *
+ * @throws IOException if an unsupported name is provided or an error
+ * occurs during re-encoding of the extension.
+ */
+ @Override
+ public void delete(String name) throws IOException {
+ if (name.equalsIgnoreCase(NONCE)) {
+ nonceData = null;
+ } else {
+ throw new IOException("Attribute name not recognized by"
+ + " CertAttrSet:" + extensionName + ".");
+ }
+ encodeInternal();
+ }
+
+ /**
+ * Returns a printable representation of the {@code OCSPNonceExtension}.
+ */
+ @Override
+ public String toString() {
+ String s = super.toString() + extensionName + ": " +
+ ((nonceData == null) ? "" : Debug.toString(nonceData))
+ + "\n";
+ return (s);
+ }
+
+ /**
+ * Write the extension to an {@code OutputStream}
+ *
+ * @param out the {@code OutputStream} to write the extension to.
+ *
+ * @throws IOException on encoding errors.
+ */
+ @Override
+ public void encode(OutputStream out) throws IOException {
+ encode(out, PKIXExtensions.OCSPNonce_Id, this.critical);
+ }
+
+ /**
+ * Write the extension to the DerOutputStream.
+ *
+ * @param out the {@code OutputStream} to write the extension to.
+ * @param extensionId the {@code ObjectIdentifier} used for this extension
+ * @param isCritical a flag indicating if the criticality bit is set for
+ * this extension.
+ *
+ * @throws IOException on encoding errors.
+ */
+ protected void encode(OutputStream out, ObjectIdentifier extensionId,
+ boolean isCritical) throws IOException {
+
+ DerOutputStream tmp = new DerOutputStream();
+
+ if (this.extensionValue == null) {
+ this.extensionId = extensionId;
+ this.critical = isCritical;
+ encodeInternal();
+ }
+ super.encode(tmp);
+ out.write(tmp.toByteArray());
+ }
+
+ /**
+ * Return an enumeration of names of attributes existing within this
+ * attribute.
+ */
+ @Override
+ public Enumeration<String> getElements() {
+ AttributeNameEnumeration elements = new AttributeNameEnumeration();
+ elements.addElement(NONCE);
+ return (elements.elements());
+ }
+
+ /**
+ * Return the name of this attribute.
+ */
+ @Override
+ public String getName() {
+ return (extensionName);
+ }
+}
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSPRequest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSPRequest.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -32,10 +32,11 @@
import sun.misc.HexDumpEncoder;
import sun.security.util.*;
+import sun.security.x509.PKIXExtensions;
/**
* This class can be used to generate an OCSP request and send it over
- * an outputstream. Currently we do not support signing requests
+ * an output stream. Currently we do not support signing requests.
* The OCSP Request is specified in RFC 2560 and
* the ASN.1 definition is as follows:
* <pre>
@@ -118,7 +119,8 @@
DerOutputStream extOut = new DerOutputStream();
for (Extension ext : extensions) {
ext.encode(extOut);
- if (ext.getId().equals(OCSP.NONCE_EXTENSION_OID.toString())) {
+ if (ext.getId().equals(
+ PKIXExtensions.OCSPNonce_Id.toString())) {
nonce = ext.getValue();
}
}
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSPResponse.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSPResponse.java Wed Jul 05 20:44:51 2017 +0200
@@ -41,6 +41,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.security.auth.x500.X500Principal;
import sun.misc.HexDumpEncoder;
@@ -129,7 +130,7 @@
SIG_REQUIRED, // Must sign the request
UNAUTHORIZED // Request unauthorized
};
- private static ResponseStatus[] rsvalues = ResponseStatus.values();
+ private static final ResponseStatus[] rsvalues = ResponseStatus.values();
private static final Debug debug = Debug.getInstance("certpath");
private static final boolean dump = debug != null && Debug.isOn("ocsp");
@@ -173,7 +174,7 @@
}
// an array of all of the CRLReasons (used in SingleResponse)
- private static CRLReason[] values = CRLReason.values();
+ private static final CRLReason[] values = CRLReason.values();
private final ResponseStatus responseStatus;
private final Map<CertId, SingleResponse> singleResponseMap;
@@ -183,13 +184,16 @@
private final byte[] responseNonce;
private List<X509CertImpl> certs;
private X509CertImpl signerCert = null;
- private X500Principal responderName = null;
- private KeyIdentifier responderKeyId = null;
+ private final ResponderId respId;
+ private Date producedAtDate = null;
+ private final Map<String, java.security.cert.Extension> responseExtensions;
/*
* Create an OCSP response from its ASN.1 DER encoding.
+ *
+ * @param bytes The DER-encoded bytes for an OCSP response
*/
- OCSPResponse(byte[] bytes) throws IOException {
+ public OCSPResponse(byte[] bytes) throws IOException {
if (dump) {
HexDumpEncoder hexEnc = new HexDumpEncoder();
debug.println("OCSPResponse bytes...\n\n" +
@@ -221,6 +225,8 @@
signature = null;
tbsResponseData = null;
responseNonce = null;
+ responseExtensions = Collections.emptyMap();
+ respId = null;
return;
}
@@ -239,7 +245,7 @@
// responseType
derIn = tmp.data;
ObjectIdentifier responseType = derIn.getOID();
- if (responseType.equals(OCSP_BASIC_RESPONSE_OID)) {
+ if (responseType.equals((Object)OCSP_BASIC_RESPONSE_OID)) {
if (debug != null) {
debug.println("OCSP response type: basic");
}
@@ -289,27 +295,15 @@
}
// responderID
- short tag = (byte)(seq.tag & 0x1f);
- if (tag == NAME_TAG) {
- responderName = new X500Principal(seq.getData().toByteArray());
- if (debug != null) {
- debug.println("Responder's name: " + responderName);
- }
- } else if (tag == KEY_TAG) {
- responderKeyId = new KeyIdentifier(seq.getData().getOctetString());
- if (debug != null) {
- debug.println("Responder's key ID: " +
- Debug.toString(responderKeyId.getIdentifier()));
- }
- } else {
- throw new IOException("Bad encoding in responderID element of " +
- "OCSP response: expected ASN.1 context specific tag 0 or 1");
+ respId = new ResponderId(seq.toByteArray());
+ if (debug != null) {
+ debug.println("Responder ID: " + respId);
}
// producedAt
seq = seqDerIn.getDerValue();
+ producedAtDate = seq.getGeneralizedTime();
if (debug != null) {
- Date producedAtDate = seq.getGeneralizedTime();
debug.println("OCSP response produced at: " + producedAtDate);
}
@@ -320,36 +314,29 @@
debug.println("OCSP number of SingleResponses: "
+ singleResponseDer.length);
}
- for (int i = 0; i < singleResponseDer.length; i++) {
- SingleResponse singleResponse =
- new SingleResponse(singleResponseDer[i]);
+ for (DerValue srDer : singleResponseDer) {
+ SingleResponse singleResponse = new SingleResponse(srDer);
singleResponseMap.put(singleResponse.getCertId(), singleResponse);
}
// responseExtensions
- byte[] nonce = null;
+ Map<String, java.security.cert.Extension> tmpExtMap = new HashMap<>();
if (seqDerIn.available() > 0) {
seq = seqDerIn.getDerValue();
if (seq.isContextSpecific((byte)1)) {
- DerValue[] responseExtDer = seq.data.getSequence(3);
- for (int i = 0; i < responseExtDer.length; i++) {
- Extension ext = new Extension(responseExtDer[i]);
- if (debug != null) {
- debug.println("OCSP extension: " + ext);
- }
- // Only the NONCE extension is recognized
- if (ext.getExtensionId().equals(OCSP.NONCE_EXTENSION_OID))
- {
- nonce = ext.getExtensionValue();
- } else if (ext.isCritical()) {
- throw new IOException(
- "Unsupported OCSP critical extension: " +
- ext.getExtensionId());
- }
- }
+ tmpExtMap = parseExtensions(seq);
}
}
- responseNonce = nonce;
+ responseExtensions = tmpExtMap;
+
+ // Attach the nonce value if found in the extension map
+ Extension nonceExt = (Extension)tmpExtMap.get(
+ PKIXExtensions.OCSPNonce_Id.toString());
+ responseNonce = (nonceExt != null) ?
+ nonceExt.getExtensionValue() : null;
+ if (debug != null && responseNonce != null) {
+ debug.println("Response nonce: " + Arrays.toString(responseNonce));
+ }
// signatureAlgorithmId
sigAlgId = AlgorithmId.parse(seqTmp[1]);
@@ -436,20 +423,22 @@
"Invalid issuer or trusted responder certificate", ce);
}
- if (responderName != null) {
+ if (respId.getType() == ResponderId.Type.BY_NAME) {
+ X500Principal rName = respId.getResponderName();
for (X509CertImpl cert : certs) {
- if (cert.getSubjectX500Principal().equals(responderName)) {
+ if (cert.getSubjectX500Principal().equals(rName)) {
signerCert = cert;
break;
}
}
- } else if (responderKeyId != null) {
+ } else if (respId.getType() == ResponderId.Type.BY_KEY) {
+ KeyIdentifier ridKeyId = respId.getKeyIdentifier();
for (X509CertImpl cert : certs) {
// Match responder's key identifier against the cert's SKID
// This will match if the SKID is encoded using the 160-bit
// SHA-1 hash method as defined in RFC 5280.
KeyIdentifier certKeyId = cert.getSubjectKeyId();
- if (certKeyId != null && responderKeyId.equals(certKeyId)) {
+ if (certKeyId != null && ridKeyId.equals(certKeyId)) {
signerCert = cert;
break;
} else {
@@ -463,7 +452,7 @@
} catch (IOException e) {
// ignore
}
- if (responderKeyId.equals(certKeyId)) {
+ if (ridKeyId.equals(certKeyId)) {
signerCert = cert;
break;
}
@@ -592,7 +581,6 @@
}
// Check freshness of OCSPResponse
-
long now = (date == null) ? System.currentTimeMillis() : date.getTime();
Date nowPlusSkew = new Date(now + MAX_CLOCK_SKEW);
Date nowMinusSkew = new Date(now - MAX_CLOCK_SKEW);
@@ -603,16 +591,16 @@
until = " until " + sr.nextUpdate;
}
debug.println("OCSP response validity interval is from " +
- sr.thisUpdate + until);
+ sr.thisUpdate + until);
debug.println("Checking validity of OCSP response on: " +
- new Date(now));
+ new Date(now));
}
// Check that the test date is within the validity interval:
// [ thisUpdate - MAX_CLOCK_SKEW,
// MAX(thisUpdate, nextUpdate) + MAX_CLOCK_SKEW ]
if (nowPlusSkew.before(sr.thisUpdate) ||
- nowMinusSkew.after(
+ nowMinusSkew.after(
sr.nextUpdate != null ? sr.nextUpdate : sr.thisUpdate))
{
throw new CertPathValidatorException(
@@ -624,8 +612,10 @@
/**
* Returns the OCSP ResponseStatus.
+ *
+ * @return the {@code ResponseStatus} for this OCSP response
*/
- ResponseStatus getResponseStatus() {
+ public ResponseStatus getResponseStatus() {
return responseStatus;
}
@@ -663,11 +653,27 @@
/**
* Returns the SingleResponse of the specified CertId, or null if
* there is no response for that CertId.
+ *
+ * @param certId the {@code CertId} for a {@code SingleResponse} to be
+ * searched for in the OCSP response.
+ *
+ * @return the {@code SingleResponse} for the provided {@code CertId},
+ * or {@code null} if it is not found.
*/
- SingleResponse getSingleResponse(CertId certId) {
+ public SingleResponse getSingleResponse(CertId certId) {
return singleResponseMap.get(certId);
}
+ /**
+ * Return a set of all CertIds in this {@code OCSPResponse}
+ *
+ * @return an unmodifiable set containing every {@code CertId} in this
+ * response.
+ */
+ public Set<CertId> getCertIds() {
+ return Collections.unmodifiableSet(singleResponseMap.keySet());
+ }
+
/*
* Returns the certificate for the authority that signed the OCSP response.
*/
@@ -676,11 +682,52 @@
}
/**
+ * Get the {@code ResponderId} from this {@code OCSPResponse}
+ *
+ * @return the {@code ResponderId} from this response or {@code null}
+ * if no responder ID is in the body of the response (e.g. a
+ * response with a status other than SUCCESS.
+ */
+ public ResponderId getResponderId() {
+ return respId;
+ }
+
+ /**
+ * Provide a String representation of an OCSPResponse
+ *
+ * @return a human-readable representation of the OCSPResponse
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("OCSP Response:\n");
+ sb.append("Response Status: ").append(responseStatus).append("\n");
+ sb.append("Responder ID: ").append(respId).append("\n");
+ sb.append("Produced at: ").append(producedAtDate).append("\n");
+ int count = singleResponseMap.size();
+ sb.append(count).append(count == 1 ?
+ " response:\n" : " responses:\n");
+ for (SingleResponse sr : singleResponseMap.values()) {
+ sb.append(sr).append("\n");
+ }
+ if (responseExtensions != null && responseExtensions.size() > 0) {
+ count = responseExtensions.size();
+ sb.append(count).append(count == 1 ?
+ " extension:\n" : " extensions:\n");
+ for (String extId : responseExtensions.keySet()) {
+ sb.append(responseExtensions.get(extId)).append("\n");
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
* Build a String-Extension map from DER encoded data.
* @param derVal A {@code DerValue} object built from a SEQUENCE of
* extensions
*
- * @return A {@code Map} using the OID in string form as the keys. If no
+ * @return a {@code Map} using the OID in string form as the keys. If no
* extensions are found or an empty SEQUENCE is passed in, then
* an empty {@code Map} will be returned.
*
@@ -694,6 +741,9 @@
for (DerValue extDerVal : extDer) {
Extension ext = new Extension(extDerVal);
+ if (debug != null) {
+ debug.println("Extension: " + ext);
+ }
// We don't support any extensions yet. Therefore, if it
// is critical we must throw an exception because we
// don't know how to process it.
@@ -710,7 +760,7 @@
/*
* A class representing a single OCSP response.
*/
- final static class SingleResponse implements OCSP.RevocationStatus {
+ public final static class SingleResponse implements OCSP.RevocationStatus {
private final CertId certId;
private final CertStatus certStatus;
private final Date thisUpdate;
@@ -825,23 +875,72 @@
/*
* Return the certificate's revocation status code
*/
- @Override public CertStatus getCertStatus() {
+ @Override
+ public CertStatus getCertStatus() {
return certStatus;
}
- private CertId getCertId() {
+ /**
+ * Get the Cert ID that this SingleResponse is for.
+ *
+ * @return the {@code CertId} for this {@code SingleResponse}
+ */
+ public CertId getCertId() {
return certId;
}
- @Override public Date getRevocationTime() {
+ /**
+ * Get the {@code thisUpdate} field from this {@code SingleResponse}.
+ *
+ * @return a {@link Date} object containing the thisUpdate date
+ */
+ public Date getThisUpdate() {
+ return (thisUpdate != null ? (Date) thisUpdate.clone() : null);
+ }
+
+ /**
+ * Get the {@code nextUpdate} field from this {@code SingleResponse}.
+ *
+ * @return a {@link Date} object containing the nexUpdate date or
+ * {@code null} if a nextUpdate field is not present in the response.
+ */
+ public Date getNextUpdate() {
+ return (nextUpdate != null ? (Date) nextUpdate.clone() : null);
+ }
+
+ /**
+ * Get the {@code revocationTime} field from this
+ * {@code SingleResponse}.
+ *
+ * @return a {@link Date} object containing the revocationTime date or
+ * {@code null} if the {@code SingleResponse} does not have a status
+ * of {@code REVOKED}.
+ */
+ @Override
+ public Date getRevocationTime() {
return (revocationTime != null ? (Date) revocationTime.clone() :
null);
}
- @Override public CRLReason getRevocationReason() {
+ /**
+ * Get the {@code revocationReason} field for the
+ * {@code SingleResponse}.
+ *
+ * @return a {@link CRLReason} containing the revocation reason, or
+ * {@code null} if a revocation reason was not provided or the
+ * response status is not {@code REVOKED}.
+ */
+ @Override
+ public CRLReason getRevocationReason() {
return revocationReason;
}
+ /**
+ * Get the {@code singleExtensions} for this {@code SingleResponse}.
+ *
+ * @return a {@link Map} of {@link Extension} objects, keyed by
+ * their OID value in string form.
+ */
@Override
public Map<String, java.security.cert.Extension> getSingleExtensions() {
return Collections.unmodifiableMap(singleExtensions);
@@ -852,19 +951,22 @@
*/
@Override public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append("SingleResponse: \n");
+ sb.append("SingleResponse:\n");
sb.append(certId);
- sb.append("\nCertStatus: "+ certStatus + "\n");
+ sb.append("\nCertStatus: ").append(certStatus).append("\n");
if (certStatus == CertStatus.REVOKED) {
- sb.append("revocationTime is " + revocationTime + "\n");
- sb.append("revocationReason is " + revocationReason + "\n");
+ sb.append("revocationTime is ");
+ sb.append(revocationTime).append("\n");
+ sb.append("revocationReason is ");
+ sb.append(revocationReason).append("\n");
}
- sb.append("thisUpdate is " + thisUpdate + "\n");
+ sb.append("thisUpdate is ").append(thisUpdate).append("\n");
if (nextUpdate != null) {
- sb.append("nextUpdate is " + nextUpdate + "\n");
+ sb.append("nextUpdate is ").append(nextUpdate).append("\n");
}
for (java.security.cert.Extension ext : singleExtensions.values()) {
- sb.append("singleExtension: " + ext + "\n");
+ sb.append("singleExtension: ");
+ sb.append(ext.toString()).append("\n");
}
return sb.toString();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/ResponderId.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.provider.certpath;
+
+import java.util.Arrays;
+import java.io.IOException;
+import java.security.PublicKey;
+import javax.security.auth.x500.X500Principal;
+import sun.security.x509.KeyIdentifier;
+import sun.security.util.DerValue;
+
+/**
+ * Class for ResponderId entities as described in RFC6960. ResponderId objects
+ * are used to uniquely identify OCSP responders.
+ * <p>
+ * The RFC 6960 defines a ResponderID structure as:
+ * <pre>
+ * ResponderID ::= CHOICE {
+ * byName [1] Name,
+ * byKey [2] KeyHash }
+ *
+ * KeyHash ::= OCTET STRING -- SHA-1 hash of responder's public key
+ * (excluding the tag and length fields)
+ *
+ * Name is defined in RFC 5280.
+ * </pre>
+ *
+ * @see ResponderId.Type
+ * @since 1.9
+ */
+public final class ResponderId {
+
+ /**
+ * A {@code ResponderId} enumeration describing the accepted forms for a
+ * {@code ResponderId}.
+ *
+ * @see ResponderId
+ * @since 1.9
+ */
+ public static enum Type {
+ /**
+ * A BY_NAME {@code ResponderId} will be built from a subject name,
+ * either as an {@code X500Principal} or a DER-encoded byte array.
+ */
+ BY_NAME(1, "byName"),
+
+ /**
+ * A BY_KEY {@code ResponderId} will be built from a public key
+ * identifier, either derived from a {@code PublicKey} or directly
+ * from a DER-encoded byte array containing the key identifier.
+ */
+ BY_KEY(2, "byKey");
+
+ private final int tagNumber;
+ private final String ridTypeName;
+
+ private Type(int value, String name) {
+ this.tagNumber = value;
+ this.ridTypeName = name;
+ }
+
+ public int value() {
+ return tagNumber;
+ }
+
+ @Override
+ public String toString() {
+ return ridTypeName;
+ }
+ }
+
+ private Type type;
+ private X500Principal responderName;
+ private KeyIdentifier responderKeyId;
+ private byte[] encodedRid;
+
+ /**
+ * Constructs a {@code ResponderId} object using an {@code X500Principal}.
+ * When encoded in DER this object will use the BY_NAME option.
+ *
+ * @param subjectName the subject name of the certificate used
+ * to sign OCSP responses.
+ *
+ * @throws IOException if the internal DER-encoding of the
+ * {@code X500Principal} fails.
+ */
+ public ResponderId(X500Principal subjectName) throws IOException {
+ responderName = subjectName;
+ responderKeyId = null;
+ encodedRid = principalToBytes();
+ type = Type.BY_NAME;
+ }
+
+ /**
+ * Constructs a {@code ResponderId} object using a {@code PublicKey}.
+ * When encoded in DER this object will use the byKey option, a
+ * SHA-1 hash of the responder's public key.
+ *
+ * @param pubKey the the OCSP responder's public key
+ *
+ * @throws IOException if the internal DER-encoding of the
+ * {@code KeyIdentifier} fails.
+ */
+ public ResponderId(PublicKey pubKey) throws IOException {
+ responderKeyId = new KeyIdentifier(pubKey);
+ responderName = null;
+ encodedRid = keyIdToBytes();
+ type = Type.BY_KEY;
+ }
+
+ /**
+ * Constructs a {@code ResponderId} object from its DER-encoding.
+ *
+ * @param encodedData the DER-encoded bytes
+ *
+ * @throws IOException if the encodedData is not properly DER encoded
+ */
+ public ResponderId(byte[] encodedData) throws IOException {
+ DerValue outer = new DerValue(encodedData);
+
+ if (outer.isContextSpecific((byte)Type.BY_NAME.value())
+ && outer.isConstructed()) {
+ // Use the X500Principal constructor as a way to sanity
+ // check the incoming data.
+ responderName = new X500Principal(outer.getDataBytes());
+ encodedRid = principalToBytes();
+ type = Type.BY_NAME;
+ } else if (outer.isContextSpecific((byte)Type.BY_KEY.value())
+ && outer.isConstructed()) {
+ // Use the KeyIdentifier constructor as a way to sanity
+ // check the incoming data.
+ responderKeyId =
+ new KeyIdentifier(new DerValue(outer.getDataBytes()));
+ encodedRid = keyIdToBytes();
+ type = Type.BY_KEY;
+ } else {
+ throw new IOException("Invalid ResponderId content");
+ }
+ }
+
+ /**
+ * Encode a {@code ResponderId} in DER form
+ *
+ * @return a byte array containing the DER-encoded representation for this
+ * {@code ResponderId}
+ */
+ public byte[] getEncoded() {
+ return encodedRid.clone();
+ }
+
+ /**
+ * Return the type of {@ResponderId}
+ *
+ * @return a number corresponding to the context-specific tag number
+ * used in the DER-encoding for a {@code ResponderId}
+ */
+ public ResponderId.Type getType() {
+ return type;
+ }
+
+ /**
+ * Get the length of the encoded {@code ResponderId} (including the tag and
+ * length of the explicit tagging from the outer ASN.1 CHOICE).
+ *
+ * @return the length of the encoded {@code ResponderId}
+ */
+ public int length() {
+ return encodedRid.length;
+ }
+
+ /**
+ * Obtain the underlying {@code X500Principal} from a {@code ResponderId}
+ *
+ * @return the {@code X500Principal} for this {@code ResponderId} if it
+ * is a BY_NAME variant. If the {@code ResponderId} is a BY_KEY
+ * variant, this routine will return {@code null}.
+ */
+ public X500Principal getResponderName() {
+ return responderName;
+ }
+
+ /**
+ * Obtain the underlying key identifier from a {@code ResponderId}
+ *
+ * @return the {@code KeyIdentifier} for this {@code ResponderId} if it
+ * is a BY_KEY variant. If the {@code ResponderId} is a BY_NAME
+ * variant, this routine will return {@code null}.
+ */
+ public KeyIdentifier getKeyIdentifier() {
+ return responderKeyId;
+ }
+
+ /**
+ * Compares the specified object with this {@code ResponderId} for equality.
+ * A ResponderId will only be considered equivalent if both the type and
+ * data value are equal. Two ResponderIds initialized by name and
+ * key ID, respectively, will not be equal even if the
+ * ResponderId objects are created from the same source certificate.
+ *
+ * @param obj the object to be compared against
+ *
+ * @return true if the specified object is equal to this {@code Responderid}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj instanceof ResponderId) {
+ ResponderId respObj = (ResponderId)obj;
+ return Arrays.equals(encodedRid, respObj.getEncoded());
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the hash code value for this {@code ResponderId}
+ *
+ * @return the hash code value for this {@code ResponderId}
+ */
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(encodedRid);
+ }
+
+ /**
+ * Create a String representation of this {@code ResponderId}
+ *
+ * @return a String representation of this {@code ResponderId}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ switch (type) {
+ case BY_NAME:
+ sb.append(type).append(": ").append(responderName);
+ break;
+ case BY_KEY:
+ sb.append(type).append(": ");
+ for (byte keyIdByte : responderKeyId.getIdentifier()) {
+ sb.append(String.format("%02X", keyIdByte));
+ }
+ break;
+ default:
+ sb.append("Unknown ResponderId Type: ").append(type);
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Convert the responderName data member into its DER-encoded form
+ *
+ * @return the DER encoding for a responder ID byName option, including
+ * explicit context-specific tagging.
+ *
+ * @throws IOException if any encoding error occurs
+ */
+ private byte[] principalToBytes() throws IOException {
+ DerValue dv = new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT,
+ true, (byte)Type.BY_NAME.value()),
+ responderName.getEncoded());
+ return dv.toByteArray();
+ }
+
+ /**
+ * Convert the responderKeyId data member into its DER-encoded form
+ *
+ * @return the DER encoding for a responder ID byKey option, including
+ * explicit context-specific tagging.
+ *
+ * @throws IOException if any encoding error occurs
+ */
+ private byte[] keyIdToBytes() throws IOException {
+ // Place the KeyIdentifier bytes into an OCTET STRING
+ DerValue inner = new DerValue(DerValue.tag_OctetString,
+ responderKeyId.getIdentifier());
+
+ // Mark the OCTET STRING-wrapped KeyIdentifier bytes
+ // as EXPLICIT CONTEXT 2
+ DerValue outer = new DerValue(DerValue.createTag(DerValue.TAG_CONTEXT,
+ true, (byte)Type.BY_KEY.value()), inner.toByteArray());
+
+ return outer.toByteArray();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/CertStatusReqExtension.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.ssl;
+
+import java.io.IOException;
+import java.util.Objects;
+
+/*
+ * RFC6066 defines the TLS extension,"status_request" (type 0x5),
+ * which allows the client to request that the server perform OCSP
+ * on the client's behalf.
+ * The "extension data" field of this extension contains a
+ * "CertificateStatusRequest" structure:
+ *
+ * struct {
+ * CertificateStatusType status_type;
+ * select (status_type) {
+ * case ocsp: OCSPStatusRequest;
+ * } request;
+ * } CertificateStatusRequest;
+ *
+ * enum { ocsp(1), (255) } CertificateStatusType;
+ *
+ * struct {
+ * ResponderID responder_id_list<0..2^16-1>;
+ * Extensions request_extensions;
+ * } OCSPStatusRequest;
+ *
+ * opaque ResponderID<1..2^16-1>;
+ * opaque Extensions<0..2^16-1>;
+ */
+
+final class CertStatusReqExtension extends HelloExtension {
+
+ private final StatusRequestType statReqType;
+ private final StatusRequest request;
+
+
+ /**
+ * Construct the default status request extension object. The default
+ * object results in a status_request extension where the extension
+ * data segment is zero-length. This is used primarily in ServerHello
+ * messages where the server asserts it can do RFC 6066 status stapling.
+ */
+ CertStatusReqExtension() {
+ super(ExtensionType.EXT_STATUS_REQUEST);
+ statReqType = null;
+ request = null;
+ }
+
+ /**
+ * Construct the status request extension object given a request type
+ * and {@code StatusRequest} object.
+ *
+ * @param reqType a {@code StatusRequestExtType object correspoding
+ * to the underlying {@code StatusRequest} object. A value of
+ * {@code null} is not allowed.
+ * @param statReq the {@code StatusRequest} object used to provide the
+ * encoding for the TLS extension. A value of {@code null} is not
+ * allowed.
+ *
+ * @throws IllegalArgumentException if the provided {@code StatusRequest}
+ * does not match the type.
+ * @throws NullPointerException if either the {@code reqType} or
+ * {@code statReq} arguments are {@code null}.
+ */
+ CertStatusReqExtension(StatusRequestType reqType, StatusRequest statReq) {
+ super(ExtensionType.EXT_STATUS_REQUEST);
+
+ statReqType = Objects.requireNonNull(reqType,
+ "Unallowed null value for status_type");
+ request = Objects.requireNonNull(statReq,
+ "Unallowed null value for request");
+
+ // There is currently only one known status type (OCSP)
+ // We can add more clauses to cover other types in the future
+ if (statReqType == StatusRequestType.OCSP) {
+ if (!(statReq instanceof OCSPStatusRequest)) {
+ throw new IllegalArgumentException("StatusRequest not " +
+ "of type OCSPStatusRequest");
+ }
+ }
+ }
+
+ /**
+ * Construct the {@code CertStatusReqExtension} object from data read from
+ * a {@code HandshakeInputStream}
+ *
+ * @param s the {@code HandshakeInputStream} providing the encoded data
+ * @param len the length of the extension data
+ *
+ * @throws IOException if any decoding errors happen during object
+ * construction.
+ */
+ CertStatusReqExtension(HandshakeInStream s, int len) throws IOException {
+ super(ExtensionType.EXT_STATUS_REQUEST);
+
+ if (len > 0) {
+ // Obtain the status type (first byte)
+ statReqType = StatusRequestType.get(s.getInt8());
+ if (statReqType == StatusRequestType.OCSP) {
+ request = new OCSPStatusRequest(s);
+ } else {
+ // This is a status_type we don't understand. Create
+ // an UnknownStatusRequest in order to preserve the data
+ request = new UnknownStatusRequest(s, len - 1);
+ }
+ } else {
+ // Treat this as a zero-length extension (i.e. from a ServerHello
+ statReqType = null;
+ request = null;
+ }
+ }
+
+ /**
+ * Return the length of the encoded extension, including extension type,
+ * extension length and status_type fields.
+ *
+ * @return the length in bytes, including the extension type and
+ * length fields.
+ */
+ @Override
+ int length() {
+ return (statReqType != null ? 5 + request.length() : 4);
+ }
+
+ /**
+ * Send the encoded TLS extension through a {@code HandshakeOutputStream}
+ *
+ * @param s the {@code HandshakeOutputStream} used to send the encoded data
+ *
+ * @throws IOException tf any errors occur during the encoding process
+ */
+ @Override
+ void send(HandshakeOutStream s) throws IOException {
+ s.putInt16(type.id);
+ s.putInt16(this.length() - 4);
+
+ if (statReqType != null) {
+ s.putInt8(statReqType.id);
+ request.send(s);
+ }
+ }
+
+ /**
+ * Create a string representation of this {@code CertStatusReqExtension}
+ *
+ * @return the string representation of this {@code CertStatusReqExtension}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("Extension ").append(type);
+ if (statReqType != null) {
+ sb.append(": ").append(statReqType).append(", ").append(request);
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Return the type field for this {@code CertStatusReqExtension}
+ *
+ * @return the {@code StatusRequestType} for this extension. {@code null}
+ * will be returned if the default constructor is used to create
+ * a zero length status_request extension (found in ServerHello
+ * messages)
+ */
+ StatusRequestType getType() {
+ return statReqType;
+ }
+
+ /**
+ * Get the underlying {@code StatusRequest} for this
+ * {@code CertStatusReqExtension}
+ *
+ * @return the {@code StatusRequest} or {@code null} if the default
+ * constructor was used to create this extension.
+ */
+ StatusRequest getRequest() {
+ return request;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/CertStatusReqItemV2.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.ssl;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+import javax.net.ssl.SSLException;
+
+/*
+ * RFC6961 defines the TLS extension,"status_request_v2" (type 0x5),
+ * which allows the client to request that the server perform OCSP
+ * on the client's behalf.
+ *
+ * The RFC defines an CertStatusReqItemV2 structure:
+ *
+ * struct {
+ * CertificateStatusType status_type;
+ * uint16 request_length;
+ * select (status_type) {
+ * case ocsp: OCSPStatusRequest;
+ * case ocsp_multi: OCSPStatusRequest;
+ * } request;
+ * } CertificateStatusRequestItemV2;
+ *
+ * enum { ocsp(1), ocsp_multi(2), (255) } CertificateStatusType;
+ */
+
+final class CertStatusReqItemV2 implements StatusRequest {
+
+ private final StatusRequestType statReqType;
+ private final StatusRequest request;
+
+ /**
+ * Construct a {@code CertStatusReqItemV2} object using a type value
+ * and empty ResponderId and Extension lists.
+ *
+ * @param reqType the type of request (e.g. ocsp). A {@code null} value
+ * is not allowed.
+ * @param statReq the {@code StatusRequest} object used to provide the
+ * encoding for this {@code CertStatusReqItemV2}. A {@code null}
+ * value is not allowed.
+ *
+ * @throws IllegalArgumentException if the provided {@code StatusRequest}
+ * does not match the type.
+ * @throws NullPointerException if either the reqType or statReq arguments
+ * are {@code null}.
+ */
+ CertStatusReqItemV2(StatusRequestType reqType, StatusRequest statReq) {
+ statReqType = Objects.requireNonNull(reqType,
+ "Unallowed null value for status_type");
+ request = Objects.requireNonNull(statReq,
+ "Unallowed null value for request");
+
+ // There is currently only one known status type (OCSP)
+ // We can add more clauses to cover other types in the future
+ if (statReqType.equals(StatusRequestType.OCSP) ||
+ statReqType.equals(StatusRequestType.OCSP_MULTI)) {
+ if (!(statReq instanceof OCSPStatusRequest)) {
+ throw new IllegalArgumentException("StatusRequest not " +
+ "of type OCSPStatusRequest");
+ }
+ }
+ }
+
+ /**
+ * Construct a {@code CertStatusReqItemV2} object from encoded bytes
+ *
+ * @param requestBytes the encoded bytes for the {@code CertStatusReqItemV2}
+ *
+ * @throws IOException if any decoding errors take place
+ * @throws IllegalArgumentException if the parsed reqType value is not a
+ * supported status request type.
+ */
+ CertStatusReqItemV2(byte[] reqItemBytes) throws IOException {
+ ByteBuffer reqBuf = ByteBuffer.wrap(reqItemBytes);
+ statReqType = StatusRequestType.get(reqBuf.get());
+ int requestLength = Short.toUnsignedInt(reqBuf.getShort());
+
+ if (requestLength == reqBuf.remaining()) {
+ byte[] statReqBytes = new byte[requestLength];
+ reqBuf.get(statReqBytes);
+ if (statReqType == StatusRequestType.OCSP ||
+ statReqType == StatusRequestType.OCSP_MULTI) {
+ request = new OCSPStatusRequest(statReqBytes);
+ } else {
+ request = new UnknownStatusRequest(statReqBytes);
+ }
+ } else {
+ throw new SSLException("Incorrect request_length: " +
+ "Expected " + reqBuf.remaining() + ", got " +
+ requestLength);
+ }
+ }
+
+ /**
+ * Construct an {@code CertStatusReqItemV2} object from data read from
+ * a {@code HandshakeInputStream}
+ *
+ * @param s the {@code HandshakeInputStream} providing the encoded data
+ *
+ * @throws IOException if any decoding errors happen during object
+ * construction.
+ * @throws IllegalArgumentException if the parsed reqType value is not a
+ * supported status request type.
+ */
+ CertStatusReqItemV2(HandshakeInStream in) throws IOException {
+ statReqType = StatusRequestType.get(in.getInt8());
+ int requestLength = in.getInt16();
+
+ if (statReqType == StatusRequestType.OCSP ||
+ statReqType == StatusRequestType.OCSP_MULTI) {
+ request = new OCSPStatusRequest(in);
+ } else {
+ request = new UnknownStatusRequest(in, requestLength);
+ }
+ }
+
+ /**
+ * Return the length of this {@code CertStatusReqItemV2} in its encoded form
+ *
+ * @return the encoded length of this {@code CertStatusReqItemV2}
+ */
+ @Override
+ public int length() {
+ // The length is the the status type (1 byte) + the request length
+ // field (2 bytes) + the StatusRequest data length.
+ return request.length() + 3;
+ }
+
+ /**
+ * Send the encoded {@code CertStatusReqItemV2} through a
+ * {@code HandshakeOutputStream}
+ *
+ * @param s the {@code HandshakeOutputStream} used to send the encoded data
+ *
+ * @throws IOException if any errors occur during the encoding process
+ */
+ @Override
+ public void send(HandshakeOutStream s) throws IOException {
+ s.putInt8(statReqType.id);
+ s.putInt16(request.length());
+ request.send(s);
+ }
+
+ /**
+ * Create a string representation of this {@code CertStatusReqItemV2}
+ *
+ * @return the string representation of this {@code CertStatusReqItemV2}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("CertStatusReqItemV2: ").append(statReqType).append(", ");
+ sb.append(request.toString());
+
+ return sb.toString();
+ }
+
+ /**
+ * Return the type field for this {@code CertStatusReqItemV2}
+ *
+ * @return the {@code StatusRequestType} for this extension.
+ */
+ StatusRequestType getType() {
+ return statReqType;
+ }
+
+ /**
+ * Get the underlying {@code StatusRequest} for this
+ * {@code CertStatusReqItemV2}
+ *
+ * @return the {@code StatusRequest}
+ */
+ StatusRequest getRequest() {
+ return request;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/CertStatusReqListV2Extension.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.ssl;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.util.Objects;
+import javax.net.ssl.SSLException;
+
+/*
+ * RFC6066 defines the TLS extension,"status_request" (type 0x5),
+ * which allows the client to request that the server perform OCSP
+ * on the client's behalf.
+ * The "extension data" field of this extension contains a
+ * "CertificateStatusRequest" structure:
+ *
+ * struct {
+ * CertificateStatusType status_type;
+ * select (status_type) {
+ * case ocsp: OCSPStatusRequest;
+ * } request;
+ * } CertificateStatusRequest;
+ *
+ * enum { ocsp(1), (255) } CertificateStatusType;
+ *
+ * struct {
+ * ResponderID responder_id_list<0..2^16-1>;
+ * Extensions request_extensions;
+ * } OCSPStatusRequest;
+ *
+ * opaque ResponderID<1..2^16-1>;
+ * opaque Extensions<0..2^16-1>;
+ */
+
+final class CertStatusReqListV2Extension extends HelloExtension {
+
+ private final List<CertStatusReqItemV2> itemList;
+ private final int itemListLength;
+
+ /**
+ * Construct a default {@code CertStatusReqListV2Extension}. The default
+ * object results in a status_request_v2 extension where the extension
+ * data segment is zero-length. This is used primarily in ServerHello
+ * messages where the server asserts it can do RFC 6961 status stapling.
+ */
+ CertStatusReqListV2Extension() {
+ super(ExtensionType.EXT_STATUS_REQUEST_V2);
+ itemList = Collections.emptyList();
+ itemListLength = 0;
+ }
+
+ /**
+ * Construct a {@code CertStatusReqListV2Extension} from a provided list
+ * of {@code CertStatusReqItemV2} objects.
+ *
+ * @param reqList a {@code List} containing one or more
+ * {@code CertStatusReqItemV2} objects to be included in this TLS
+ * Hello extension. Passing an empty list will result in the encoded
+ * extension having a zero-length extension_data segment, and is
+ * the same as using the default constructor.
+ *
+ * @throws NullPointerException if reqList is {@code null}
+ */
+ CertStatusReqListV2Extension(List<CertStatusReqItemV2> reqList) {
+ super(ExtensionType.EXT_STATUS_REQUEST_V2);
+ Objects.requireNonNull(reqList,
+ "Unallowed null value for certificate_status_req_list");
+ itemList = Collections.unmodifiableList(new ArrayList<>(reqList));
+ itemListLength = calculateListLength();
+ }
+
+ /**
+ * Construct the {@code CertStatusReqListV2Extension} object from data
+ * read from a {@code HandshakeInputStream}
+ *
+ * @param s the {@code HandshakeInputStream} providing the encoded data
+ * @param len the length of the extension data
+ *
+ * @throws IOException if any decoding errors happen during object
+ * construction.
+ */
+ CertStatusReqListV2Extension(HandshakeInStream s, int len)
+ throws IOException {
+ super(ExtensionType.EXT_STATUS_REQUEST_V2);
+
+ if (len <= 0) {
+ // Handle the empty extension data case (from a ServerHello)
+ itemList = Collections.emptyList();
+ itemListLength = 0;
+ } else {
+ List<CertStatusReqItemV2> workingList = new ArrayList<>();
+
+ itemListLength = s.getInt16();
+ if (itemListLength <= 0) {
+ throw new SSLException("certificate_status_req_list length " +
+ "must be greater than zero (received length: " +
+ itemListLength + ")");
+ }
+
+ int totalRead = 0;
+ CertStatusReqItemV2 reqItem;
+ do {
+ reqItem = new CertStatusReqItemV2(s);
+ totalRead += reqItem.length();
+ } while (workingList.add(reqItem) && totalRead < itemListLength);
+
+ // If for some reason the add returns false, we may not have read
+ // all the necessary bytes from the stream. Check this and throw
+ // an exception if we terminated the loop early.
+ if (totalRead != itemListLength) {
+ throw new SSLException("Not all certificate_status_req_list " +
+ "bytes were read: expected " + itemListLength +
+ ", read " + totalRead);
+ }
+
+ itemList = Collections.unmodifiableList(workingList);
+ }
+ }
+
+ /**
+ * Get the list of {@code CertStatusReqItemV2} objects for this extension
+ *
+ * @return an unmodifiable list of {@code CertStatusReqItemV2} objects
+ */
+ List<CertStatusReqItemV2> getRequestItems() {
+ return itemList;
+ }
+
+ /**
+ * Return the length of the encoded extension, including extension type
+ * and extension length fields.
+ *
+ * @return the length in bytes, including the extension type and
+ * extension_data length.
+ */
+ @Override
+ int length() {
+ return (itemList.isEmpty() ? 4 : itemListLength + 6);
+ }
+
+ /**
+ * Send the encoded {@code CertStatusReqListV2Extension} through a
+ * {@code HandshakeOutputStream}
+ *
+ * @param s the {@code HandshakeOutputStream} used to send the encoded data
+ *
+ * @throws IOException if any errors occur during the encoding process
+ */
+ @Override
+ void send(HandshakeOutStream s) throws IOException {
+ s.putInt16(type.id);
+ s.putInt16(this.length() - 4);
+ if (itemListLength > 0) {
+ s.putInt16(itemListLength);
+ for (CertStatusReqItemV2 item : itemList) {
+ item.send(s);
+ }
+ }
+ }
+
+ /**
+ * Create a string representation of this
+ * {@code CertStatusReqListV2Extension}
+ *
+ * @return the string representation of this
+ * {@code CertStatusReqListV2Extension}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("Extension ").append(type);
+ for (CertStatusReqItemV2 item : itemList) {
+ sb.append("\n").append(item);
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Determine the length of the certificate_status_req_list field in
+ * the status_request_v2 extension.
+ *
+ * @return the total encoded length of all items in the list, or 0 if the
+ * encapsulating extension_data is zero-length (from a ServerHello)
+ */
+ private int calculateListLength() {
+ int listLen = 0;
+
+ for (CertStatusReqItemV2 item : itemList) {
+ listLen += item.length();
+ }
+
+ return listLen;
+ }
+
+}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Wed Jul 05 20:44:51 2017 +0200
@@ -37,10 +37,12 @@
import java.security.cert.X509Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateParsingException;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorException.Reason;
+import java.security.cert.CertPathValidatorException.BasicReason;
import javax.security.auth.x500.X500Principal;
import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.*;
@@ -79,6 +81,12 @@
private boolean serverKeyExchangeReceived;
+ private final boolean enableStatusRequestExtension =
+ Debug.getBooleanProperty(
+ "jdk.tls.client.enableStatusRequestExtension", true);
+ private boolean staplingActive = false;
+ private X509Certificate[] deferredCerts;
+
/*
* The RSA PreMasterSecret needs to know the version of
* ClientHello that was used on this handshake. This represents
@@ -200,7 +208,16 @@
@Override
void processMessage(byte type, int messageLen) throws IOException {
// check the handshake state
- handshakeState.check(type);
+ List<Byte> ignoredOptStates = handshakeState.check(type);
+
+ // If the state machine has skipped over certificate status
+ // and stapling was enabled, we need to check the chain immediately
+ // because it was deferred, waiting for CertificateStatus.
+ if (staplingActive && ignoredOptStates.contains(
+ HandshakeMessage.ht_certificate_status)) {
+ checkServerCerts(deferredCerts);
+ serverKey = session.getPeerCertificates()[0].getPublicKey();
+ }
switch (type) {
case HandshakeMessage.ht_hello_request:
@@ -241,8 +258,19 @@
CertificateMsg certificateMsg = new CertificateMsg(input);
handshakeState.update(certificateMsg, resumingSession);
this.serverCertificate(certificateMsg);
- serverKey =
- session.getPeerCertificates()[0].getPublicKey();
+ if (!staplingActive) {
+ // If we are not doing stapling, we can set serverKey right
+ // away. Otherwise, we will wait until verification of the
+ // chain has completed after CertificateStatus;
+ serverKey = session.getPeerCertificates()[0].getPublicKey();
+ }
+ break;
+
+ case HandshakeMessage.ht_certificate_status:
+ CertificateStatus certStatusMsg = new CertificateStatus(input);
+ handshakeState.update(certStatusMsg, resumingSession);
+ this.certificateStatus(certStatusMsg);
+ serverKey = session.getPeerCertificates()[0].getPublicKey();
break;
case HandshakeMessage.ht_server_key_exchange:
@@ -685,10 +713,22 @@
ExtensionType type = ext.type;
if (type == ExtensionType.EXT_SERVER_NAME) {
serverNamesAccepted = true;
+ } else if (type == ExtensionType.EXT_STATUS_REQUEST ||
+ type == ExtensionType.EXT_STATUS_REQUEST_V2) {
+ // Only enable the stapling feature if the client asserted
+ // these extensions.
+ if (enableStatusRequestExtension) {
+ staplingActive = true;
+ } else {
+ fatalSE(Alerts.alert_unexpected_message, "Server set " +
+ type + " extension when not requested by client");
+ }
} else if ((type != ExtensionType.EXT_ELLIPTIC_CURVES)
&& (type != ExtensionType.EXT_EC_POINT_FORMATS)
&& (type != ExtensionType.EXT_SERVER_NAME)
- && (type != ExtensionType.EXT_RENEGOTIATION_INFO)) {
+ && (type != ExtensionType.EXT_RENEGOTIATION_INFO)
+ && (type != ExtensionType.EXT_STATUS_REQUEST)
+ && (type != ExtensionType.EXT_STATUS_REQUEST_V2)) {
fatalSE(Alerts.alert_unsupported_extension,
"Server sent an unsupported extension: " + type);
}
@@ -1476,6 +1516,12 @@
}
}
+ // Add status_request and status_request_v2 extensions
+ if (enableStatusRequestExtension) {
+ clientHelloMessage.addCertStatusReqListV2Extension();
+ clientHelloMessage.addCertStatusRequestExtension();
+ }
+
// reset the client random cookie
clnt_random = clientHelloMessage.clnt_random;
@@ -1545,40 +1591,36 @@
}
// ask the trust manager to verify the chain
- X509TrustManager tm = sslContext.getX509TrustManager();
- try {
- // find out the key exchange algorithm used
- // use "RSA" for non-ephemeral "RSA_EXPORT"
- String keyExchangeString;
- if (keyExchange == K_RSA_EXPORT && !serverKeyExchangeReceived) {
- keyExchangeString = K_RSA.name;
- } else {
- keyExchangeString = keyExchange.name;
- }
+ if (staplingActive) {
+ // Defer the certificate check until after we've received the
+ // CertificateStatus message. If that message doesn't come in
+ // immediately following this message we will execute the check
+ // directly from processMessage before any other SSL/TLS processing.
+ deferredCerts = peerCerts;
+ } else {
+ // We're not doing stapling, so perform the check right now
+ checkServerCerts(peerCerts);
+ }
+ }
- if (tm instanceof X509ExtendedTrustManager) {
- if (conn != null) {
- ((X509ExtendedTrustManager)tm).checkServerTrusted(
- peerCerts.clone(),
- keyExchangeString,
- conn);
- } else {
- ((X509ExtendedTrustManager)tm).checkServerTrusted(
- peerCerts.clone(),
- keyExchangeString,
- engine);
- }
- } else {
- // Unlikely to happen, because we have wrapped the old
- // X509TrustManager with the new X509ExtendedTrustManager.
- throw new CertificateException(
- "Improper X509TrustManager implementation");
- }
- } catch (CertificateException e) {
- // This will throw an exception, so include the original error.
- fatalSE(Alerts.alert_certificate_unknown, e);
+ /**
+ * If certificate status stapling has been enabled, the server will send
+ * one or more status messages to the client.
+ *
+ * @param mesg a {@code CertificateStatus} object built from the data
+ * sent by the server.
+ *
+ * @throws IOException if any parsing errors occur.
+ */
+ private void certificateStatus(CertificateStatus mesg) throws IOException {
+ if (debug != null && Debug.isOn("handshake")) {
+ mesg.print(System.out);
}
- session.setPeerCertificates(peerCerts);
+
+ // Perform the certificate check using the deferred certificates
+ // and responses that we have obtained.
+ session.setStatusResponses(mesg.getResponses());
+ checkServerCerts(deferredCerts);
}
/*
@@ -1700,4 +1742,88 @@
return false;
}
+
+ /**
+ * Perform client-side checking of server certificates.
+ *
+ * @param certs an array of {@code X509Certificate} objects presented
+ * by the server in the ServerCertificate message.
+ *
+ * @throws IOException if a failure occurs during validation or
+ * the trust manager associated with the {@code SSLContext} is not
+ * an {@code X509ExtendedTrustManager}.
+ */
+ private void checkServerCerts(X509Certificate[] certs)
+ throws IOException {
+ X509TrustManager tm = sslContext.getX509TrustManager();
+
+ // find out the key exchange algorithm used
+ // use "RSA" for non-ephemeral "RSA_EXPORT"
+ String keyExchangeString;
+ if (keyExchange == K_RSA_EXPORT && !serverKeyExchangeReceived) {
+ keyExchangeString = K_RSA.name;
+ } else {
+ keyExchangeString = keyExchange.name;
+ }
+
+ try {
+ if (tm instanceof X509ExtendedTrustManager) {
+ if (conn != null) {
+ ((X509ExtendedTrustManager)tm).checkServerTrusted(
+ certs.clone(),
+ keyExchangeString,
+ conn);
+ } else {
+ ((X509ExtendedTrustManager)tm).checkServerTrusted(
+ certs.clone(),
+ keyExchangeString,
+ engine);
+ }
+ } else {
+ // Unlikely to happen, because we have wrapped the old
+ // X509TrustManager with the new X509ExtendedTrustManager.
+ throw new CertificateException(
+ "Improper X509TrustManager implementation");
+ }
+
+ // Once the server certificate chain has been validated, set
+ // the certificate chain in the TLS session.
+ session.setPeerCertificates(certs);
+ } catch (CertificateException ce) {
+ fatalSE(getCertificateAlert(ce), ce);
+ }
+ }
+
+ /**
+ * When a failure happens during certificate checking from an
+ * {@link X509TrustManager}, determine what TLS alert description to use.
+ *
+ * @param cexc The exception thrown by the {@link X509TrustManager}
+ *
+ * @return A byte value corresponding to a TLS alert description number.
+ */
+ private byte getCertificateAlert(CertificateException cexc) {
+ // The specific reason for the failure will determine how to
+ // set the alert description value
+ byte alertDesc = Alerts.alert_certificate_unknown;
+
+ Throwable baseCause = cexc.getCause();
+ if (baseCause instanceof CertPathValidatorException) {
+ CertPathValidatorException cpve =
+ (CertPathValidatorException)baseCause;
+ Reason reason = cpve.getReason();
+ if (reason == BasicReason.REVOKED) {
+ alertDesc = staplingActive ?
+ Alerts.alert_bad_certificate_status_response :
+ Alerts.alert_certificate_revoked;
+ } else if (reason == BasicReason.UNDETERMINED_REVOCATION_STATUS) {
+ alertDesc = staplingActive ?
+ Alerts.alert_bad_certificate_status_response :
+ Alerts.alert_certificate_unknown;
+ }
+ }
+
+ return alertDesc;
+ }
}
+
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ExtensionType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ExtensionType.java Wed Jul 05 20:44:51 2017 +0200
@@ -44,7 +44,7 @@
}
static List<ExtensionType> knownExtensions =
- new ArrayList<ExtensionType>(13);
+ new ArrayList<ExtensionType>(14);
static ExtensionType get(int id) {
for (ExtensionType ext : knownExtensions) {
@@ -97,6 +97,10 @@
final static ExtensionType EXT_SIGNATURE_ALGORITHMS =
e(0x000D, "signature_algorithms"); // IANA registry value: 13
+ // extensions defined in RFC 6961
+ final static ExtensionType EXT_STATUS_REQUEST_V2 =
+ e(0x0011, "status_request_v2"); // IANA registry value: 17
+
// extensions defined in RFC 5746
final static ExtensionType EXT_RENEGOTIATION_INFO =
e(0xff01, "renegotiation_info"); // IANA registry value: 65281
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java Wed Jul 05 20:44:51 2017 +0200
@@ -49,6 +49,7 @@
import sun.security.ssl.CipherSuite.*;
import static sun.security.ssl.CipherSuite.PRF.*;
import sun.security.util.KeyUtil;
+import sun.security.provider.certpath.OCSPResponse;
/**
* Many data structures are involved in the handshake messages. These
@@ -393,6 +394,24 @@
cookieDigest.update(hos.toByteArray());
}
+ // Add status_request extension type
+ void addCertStatusRequestExtension() {
+ extensions.add(new CertStatusReqExtension(StatusRequestType.OCSP,
+ new OCSPStatusRequest()));
+ }
+
+ // Add status_request_v2 extension type
+ void addCertStatusReqListV2Extension() {
+ // Create a default OCSPStatusRequest that we can use for both
+ // OCSP_MULTI and OCSP request list items.
+ OCSPStatusRequest osr = new OCSPStatusRequest();
+ List<CertStatusReqItemV2> itemList = new ArrayList<>(2);
+ itemList.add(new CertStatusReqItemV2(StatusRequestType.OCSP_MULTI,
+ osr));
+ itemList.add(new CertStatusReqItemV2(StatusRequestType.OCSP, osr));
+ extensions.add(new CertStatusReqListV2Extension(itemList));
+ }
+
@Override
int messageType() { return ht_client_hello; }
@@ -636,6 +655,240 @@
}
/*
+ * CertificateStatus ... SERVER --> CLIENT
+ *
+ * When a ClientHello asserting the status_request or status_request_v2
+ * extensions is accepted by the server, it will fetch and return one
+ * or more status responses in this handshake message.
+ *
+ * NOTE: Like the Certificate handshake message, this can potentially
+ * be a very large message both due to the size of multiple status
+ * responses and the certificate chains that are often attached to them.
+ * Up to 2^24 bytes of status responses may be sent, possibly fragmented
+ * over multiple TLS records.
+ */
+static final class CertificateStatus extends HandshakeMessage
+{
+ private final StatusRequestType statusType;
+ private int encodedResponsesLen;
+ private int messageLength = -1;
+ private List<byte[]> encodedResponses;
+
+ @Override
+ int messageType() { return ht_certificate_status; }
+
+ /**
+ * Create a CertificateStatus message from the certificates and their
+ * respective OCSP responses
+ *
+ * @param type an indication of the type of response (OCSP or OCSP_MULTI)
+ * @param responses a {@code List} of OCSP responses in DER-encoded form.
+ * For the OCSP type, only the first entry in the response list is
+ * used, and must correspond to the end-entity certificate sent to the
+ * peer. Zero-length or null values for the response data are not
+ * allowed for the OCSP type. For the OCSP_MULTI type, each entry in
+ * the list should match its corresponding certificate sent in the
+ * Server Certificate message. Where an OCSP response does not exist,
+ * either a zero-length array or a null value should be used.
+ *
+ * @throws SSLException if an unsupported StatusRequestType or invalid
+ * OCSP response data is provided.
+ */
+ CertificateStatus(StatusRequestType type, X509Certificate[] chain,
+ Map<X509Certificate, byte[]> responses) throws SSLException {
+ statusType = type;
+ encodedResponsesLen = 0;
+ encodedResponses = new ArrayList<>(chain.length);
+
+ Objects.requireNonNull(chain, "Null chain not allowed");
+ Objects.requireNonNull(responses, "Null responses not allowed");
+
+ if (statusType == StatusRequestType.OCSP) {
+ // Just get the response for the end-entity certificate
+ byte[] respDER = responses.get(chain[0]);
+ if (respDER != null && respDER.length > 0) {
+ encodedResponses.add(respDER);
+ encodedResponsesLen = 3 + respDER.length;
+ } else {
+ throw new SSLHandshakeException("Zero-length or null " +
+ "OCSP Response");
+ }
+ } else if (statusType == StatusRequestType.OCSP_MULTI) {
+ for (X509Certificate cert : chain) {
+ byte[] respDER = responses.get(cert);
+ if (respDER != null) {
+ encodedResponses.add(respDER);
+ encodedResponsesLen += (respDER.length + 3);
+ } else {
+ // If we cannot find a response for a given certificate
+ // then use a zero-length placeholder.
+ encodedResponses.add(new byte[0]);
+ encodedResponsesLen += 3;
+ }
+ }
+ } else {
+ throw new SSLHandshakeException("Unsupported StatusResponseType: " +
+ statusType);
+ }
+ }
+
+ /**
+ * Decode the CertificateStatus handshake message coming from a
+ * {@code HandshakeInputStream}.
+ *
+ * @param input the {@code HandshakeInputStream} containing the
+ * CertificateStatus message bytes.
+ *
+ * @throws SSLHandshakeException if a zero-length response is found in the
+ * OCSP response type, or an unsupported response type is detected.
+ * @throws IOException if a decoding error occurs.
+ */
+ CertificateStatus(HandshakeInStream input) throws IOException {
+ encodedResponsesLen = 0;
+ encodedResponses = new ArrayList<>();
+
+ statusType = StatusRequestType.get(input.getInt8());
+ if (statusType == StatusRequestType.OCSP) {
+ byte[] respDER = input.getBytes24();
+ // Convert the incoming bytes to a OCSPResponse strucutre
+ if (respDER.length > 0) {
+ encodedResponses.add(respDER);
+ encodedResponsesLen = 3 + respDER.length;
+ } else {
+ throw new SSLHandshakeException("Zero-length OCSP Response");
+ }
+ } else if (statusType == StatusRequestType.OCSP_MULTI) {
+ int respListLen = input.getInt24();
+ encodedResponsesLen = respListLen;
+
+ // Add each OCSP reponse into the array list in the order
+ // we receive them off the wire. A zero-length array is
+ // allowed for ocsp_multi, and means that a response for
+ // a given certificate is not available.
+ while (respListLen > 0) {
+ byte[] respDER = input.getBytes24();
+ encodedResponses.add(respDER);
+ respListLen -= (respDER.length + 3);
+ }
+
+ if (respListLen != 0) {
+ throw new SSLHandshakeException(
+ "Bad OCSP response list length");
+ }
+ } else {
+ throw new SSLHandshakeException("Unsupported StatusResponseType: " +
+ statusType);
+ }
+ }
+
+ /**
+ * Get the length of the CertificateStatus message.
+ *
+ * @return the length of the message in bytes.
+ */
+ @Override
+ int messageLength() {
+ int len = 1; // Length + Status type
+
+ if (messageLength == -1) {
+ if (statusType == StatusRequestType.OCSP) {
+ len += encodedResponsesLen;
+ } else if (statusType == StatusRequestType.OCSP_MULTI) {
+ len += 3 + encodedResponsesLen;
+ }
+ messageLength = len;
+ }
+
+ return messageLength;
+ }
+
+ /**
+ * Encode the CertificateStatus handshake message and place it on a
+ * {@code HandshakeOutputStream}.
+ *
+ * @param s the HandshakeOutputStream that will the message bytes.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ @Override
+ void send(HandshakeOutStream s) throws IOException {
+ s.putInt8(statusType.id);
+ if (statusType == StatusRequestType.OCSP) {
+ s.putBytes24(encodedResponses.get(0));
+ } else if (statusType == StatusRequestType.OCSP_MULTI) {
+ s.putInt24(encodedResponsesLen);
+ for (byte[] respBytes : encodedResponses) {
+ if (respBytes != null) {
+ s.putBytes24(respBytes);
+ } else {
+ s.putBytes24(null);
+ }
+ }
+ } else {
+ // It is highly unlikely that we will fall into this section of
+ // the code.
+ throw new SSLHandshakeException("Unsupported status_type: " +
+ statusType.id);
+ }
+ }
+
+ /**
+ * Display a human-readable representation of the CertificateStatus message.
+ *
+ * @param s the PrintStream used to display the message data.
+ *
+ * @throws IOException if any errors occur while parsing the OCSP response
+ * bytes into a readable form.
+ */
+ @Override
+ void print(PrintStream s) throws IOException {
+ s.println("*** CertificateStatus");
+ if (debug != null && Debug.isOn("verbose")) {
+ s.println("Type: " + statusType);
+ if (statusType == StatusRequestType.OCSP) {
+ OCSPResponse oResp = new OCSPResponse(encodedResponses.get(0));
+ s.println(oResp);
+ } else if (statusType == StatusRequestType.OCSP_MULTI) {
+ int numResponses = encodedResponses.size();
+ s.println(numResponses +
+ (numResponses == 1 ? " entry:" : " entries:"));
+ for (byte[] respDER : encodedResponses) {
+ if (respDER.length > 0) {
+ OCSPResponse oResp = new OCSPResponse(respDER);
+ s.println(oResp);
+ } else {
+ s.println("<Zero-length entry>");
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the type of CertificateStatus message
+ *
+ * @return the {@code StatusRequestType} for this CertificateStatus
+ * message.
+ */
+ StatusRequestType getType() {
+ return statusType;
+ }
+
+ /**
+ * Get the list of non-zero length OCSP responses.
+ * The responses returned in this list can be used to map to
+ * {@code X509Certificate} objects provided by the peer and
+ * provided to a {@code PKIXRevocationChecker}.
+ *
+ * @return an unmodifiable List of zero or more byte arrays, each one
+ * consisting of a single status response.
+ */
+ List<byte[]> getResponses() {
+ return Collections.unmodifiableList(encodedResponses);
+ }
+}
+
+/*
* ServerKeyExchange ... SERVER --> CLIENT
*
* The cipher suite selected, when combined with the certificate exchanged,
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeStateManager.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeStateManager.java Wed Jul 05 20:44:51 2017 +0200
@@ -25,12 +25,12 @@
package sun.security.ssl;
+import java.util.Collections;
+import java.util.List;
import java.util.LinkedList;
import java.util.HashMap;
import javax.net.ssl.SSLProtocolException;
-import sun.security.ssl.HandshakeMessage.*;
-
import static sun.security.ssl.CipherSuite.KeyExchange;
import static sun.security.ssl.CipherSuite.KeyExchange.*;
import static sun.security.ssl.HandshakeStateManager.HandshakeState.*;
@@ -311,7 +311,7 @@
HS_SERVER_CHANGE_CIPHER_SPEC(
"server change_cipher_spec",
HandshakeMessage.ht_not_applicable),
- HS_SERVER_FINISHDE(
+ HS_SERVER_FINISHED(
"server finished",
HandshakeMessage.ht_finished);
@@ -343,7 +343,8 @@
return upcomingStates.isEmpty();
}
- void check(byte handshakeType) throws SSLProtocolException {
+ List<Byte> check(byte handshakeType) throws SSLProtocolException {
+ List<Byte> ignoredOptional = new LinkedList<>();
String exceptionMsg =
"Handshake message sequence violation, " + handshakeType;
@@ -362,27 +363,28 @@
}
// It is a kickstart message.
- return;
+ return Collections.emptyList();
}
- // Ignore the checking for HelloRequest messages as they are
+ // Ignore the checking for HelloRequest messages as they
// may be sent by the server at any time.
if (handshakeType == HandshakeMessage.ht_hello_request) {
- return;
+ return Collections.emptyList();
}
for (HandshakeState handshakeState : upcomingStates) {
if (handshakeState.handshakeType == handshakeType) {
// It's the expected next handshake type.
- return;
+ return ignoredOptional;
}
if (handshakeState.isOptional) {
+ ignoredOptional.add(handshakeState.handshakeType);
continue;
} else {
for (HandshakeState alternative : alternatives) {
if (alternative.handshakeType == handshakeType) {
- return;
+ return ignoredOptional;
}
if (alternative.isOptional) {
@@ -541,7 +543,7 @@
// (Server Finished Flight)
// HS_NEW_SESSION_TICKET
// --> HS_SERVER_CHANGE_CIPHER_SPEC
- // --> HS_SERVER_FINISHDE
+ // --> HS_SERVER_FINISHED
// (Client Finished Flight)
// --> HS_CLIENT_CHANGE_CIPHER_SPEC
// --> HS_CLEINT_FINISHED
@@ -587,7 +589,7 @@
// Mandatory server ChangeCipherSpec and Finished messages
upcomingStates.add(HS_SERVER_CHANGE_CIPHER_SPEC);
- upcomingStates.add(HS_SERVER_FINISHDE);
+ upcomingStates.add(HS_SERVER_FINISHED);
// Mandatory client ChangeCipherSpec and Finished messages
upcomingStates.add(HS_CLIENT_CHANGE_CIPHER_SPEC);
@@ -598,15 +600,11 @@
// boolean hasSupplementalDataExt =
// (hes.get(HandshakeMessage.ht_supplemental_data) != null);
- // Not support CertificateStatus extension yet.
- //
- // boolean hasCertificateStatusExt =
- // (hes.get(HandshakeMessage.ht_certificate_status) != null);
-
// Not support CertificateURL extension yet.
//
// boolean hasCertificateUrlExt =
- // (hes.get(HandshakeMessage.ht_certificate_url) != null);
+ // (hes.get(ExtensionType EXT_CLIENT_CERTIFICATE_URL)
+ // != null);
// Not support SupplementalData extension yet.
//
@@ -625,12 +623,11 @@
upcomingStates.add(HS_SERVER_CERTIFICATE);
}
- // Not support CertificateStatus extension yet.
- //
- // // Optional CertificateStatus message
- // if (hasCertificateStatusExt) {
- // upcomingStates.add(HS_CERTIFICATE_STATUS);
- // }
+ // Optional CertificateStatus message
+ if (hes.get(ExtensionType.EXT_STATUS_REQUEST) != null ||
+ hes.get(ExtensionType.EXT_STATUS_REQUEST_V2) != null) {
+ upcomingStates.add(HS_CERTIFICATE_STATUS);
+ }
// Need ServerKeyExchange message or not?
if ((keyExchange == K_RSA_EXPORT) ||
@@ -690,7 +687,7 @@
// Mandatory server ChangeCipherSpec and Finished messages
upcomingStates.add(HS_SERVER_CHANGE_CIPHER_SPEC);
- upcomingStates.add(HS_SERVER_FINISHDE);
+ upcomingStates.add(HS_SERVER_FINISHED);
}
break;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HelloExtensions.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HelloExtensions.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2015, 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
@@ -87,6 +87,10 @@
extension = new RenegotiationInfoExtension(s, extlen);
} else if (extType == ExtensionType.EXT_MAX_FRAGMENT_LENGTH) {
extension = new MaxFragmentLengthExtension(s, extlen);
+ } else if (extType == ExtensionType.EXT_STATUS_REQUEST) {
+ extension = new CertStatusReqExtension(s, extlen);
+ } else if (extType == ExtensionType.EXT_STATUS_REQUEST_V2) {
+ extension = new CertStatusReqListV2Extension(s, extlen);
} else {
extension = new UnknownExtension(s, extlen, extType);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/OCSPStatusRequest.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,358 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.ssl;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.security.cert.Extension;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+import javax.net.ssl.SSLException;
+import sun.security.util.DerValue;
+import sun.security.util.DerInputStream;
+import sun.security.util.DerOutputStream;
+import sun.security.provider.certpath.ResponderId;
+
+/*
+ * RFC6066 defines the TLS extension,"status_request" (type 0x5),
+ * which allows the client to request that the server perform OCSP
+ * on the client's behalf.
+ *
+ * The RFC defines an OCSPStatusRequest structure:
+ *
+ * struct {
+ * ResponderID responder_id_list<0..2^16-1>;
+ * Extensions request_extensions;
+ * } OCSPStatusRequest;
+ */
+final class OCSPStatusRequest implements StatusRequest {
+
+ private final List<ResponderId> responderIds;
+ private final List<Extension> extensions;
+ private int encodedLen;
+ private int ridListLen;
+ private int extListLen;
+
+ /**
+ * Construct a default {@code OCSPStatusRequest} object with empty
+ * responder ID and code extension list fields.
+ */
+ OCSPStatusRequest() {
+ responderIds = new ArrayList<>();
+ extensions = new ArrayList<>();
+ encodedLen = this.length();
+ }
+
+ /**
+ * Construct an {@code OCSPStatusRequest} object using the provided
+ * {@code ResponderId} and {@code Extension} lists.
+ *
+ * @param respIds the list of {@code ResponderId} objects to be placed
+ * into the {@code OCSPStatusRequest}. If the user wishes to place
+ * no {@code ResponderId} objects in the request, either an empty
+ * {@code List} or {@code null} is acceptable.
+ * @param exts the list of {@code Extension} objects to be placed into
+ * the {@code OCSPStatusRequest} If the user wishes to place
+ * no {@code Extension} objects in the request, either an empty
+ * {@code List} or {@code null} is acceptable.
+ */
+ OCSPStatusRequest(List<ResponderId> respIds, List<Extension> exts) {
+ responderIds = new ArrayList<>(respIds != null ? respIds :
+ Collections.emptyList());
+ extensions = new ArrayList<>(exts != null ? exts :
+ Collections.emptyList());
+ encodedLen = this.length();
+ }
+
+ /**
+ * Construct an {@code OCSPStatusRequest} object from data read from
+ * a {@code HandshakeInputStream}
+ *
+ * @param s the {@code HandshakeInputStream} providing the encoded data
+ *
+ * @throws IOException if any decoding errors happen during object
+ * construction.
+ */
+ OCSPStatusRequest(HandshakeInStream in) throws IOException {
+ responderIds = new ArrayList<>();
+ extensions = new ArrayList<>();
+
+ int ridListBytesRemaining = in.getInt16();
+ while (ridListBytesRemaining != 0) {
+ byte[] ridBytes = in.getBytes16();
+ responderIds.add(new ResponderId(ridBytes));
+ ridListBytesRemaining -= (ridBytes.length + 2);
+ // Make sure that no individual responder ID's length caused an
+ // overrun relative to the outer responder ID list length
+ if (ridListBytesRemaining < 0) {
+ throw new SSLException("Responder ID length overflow: " +
+ "current rid = " + ridBytes.length + ", remaining = " +
+ ridListBytesRemaining);
+ }
+ }
+
+ int extensionLength = in.getInt16();
+ if (extensionLength > 0) {
+ byte[] extensionData = new byte[extensionLength];
+ in.read(extensionData);
+ DerInputStream dis = new DerInputStream(extensionData);
+ DerValue[] extSeqContents = dis.getSequence(extensionData.length);
+ for (DerValue extDerVal : extSeqContents) {
+ extensions.add(new sun.security.x509.Extension(extDerVal));
+ }
+ }
+ }
+
+ /**
+ * Construct an {@code OCSPStatusRequest} from its encoded form
+ *
+ * @param requestBytes the status request extension bytes
+ *
+ * @throws IOException if any error occurs during decoding
+ */
+ OCSPStatusRequest(byte[] requestBytes) throws IOException {
+ responderIds = new ArrayList<>();
+ extensions = new ArrayList<>();
+ ByteBuffer reqBuf = ByteBuffer.wrap(requestBytes);
+
+ // Get the ResponderId list length
+ encodedLen = requestBytes.length;
+ ridListLen = Short.toUnsignedInt(reqBuf.getShort());
+ int endOfRidList = reqBuf.position() + ridListLen;
+
+ // The end position of the ResponderId list in the ByteBuffer
+ // should be at least 2 less than the end of the buffer. This
+ // 2 byte defecit is the minimum length required to encode a
+ // zero-length extensions segment.
+ if (reqBuf.limit() - endOfRidList < 2) {
+ throw new SSLException
+ ("ResponderId List length exceeds provided buffer - Len: "
+ + ridListLen + ", Buffer: " + reqBuf.remaining());
+ }
+
+ while (reqBuf.position() < endOfRidList) {
+ int ridLength = Short.toUnsignedInt(reqBuf.getShort());
+ // Make sure an individual ResponderId length doesn't
+ // run past the end of the ResponderId list portion of the
+ // provided buffer.
+ if (reqBuf.position() + ridLength > endOfRidList) {
+ throw new SSLException
+ ("ResponderId length exceeds list length - Off: "
+ + reqBuf.position() + ", Length: " + ridLength
+ + ", End offset: " + endOfRidList);
+ }
+
+ // Consume/add the ResponderId
+ if (ridLength > 0) {
+ byte[] ridData = new byte[ridLength];
+ reqBuf.get(ridData);
+ responderIds.add(new ResponderId(ridData));
+ }
+ }
+
+ // Get the Extensions length
+ int extensionsLen = Short.toUnsignedInt(reqBuf.getShort());
+
+ // The end of the extensions should also be the end of the
+ // encoded OCSPStatusRequest
+ if (extensionsLen != reqBuf.remaining()) {
+ throw new SSLException("Incorrect extensions length: Read "
+ + extensionsLen + ", Data length: " + reqBuf.remaining());
+ }
+
+ // Extensions are a SEQUENCE of Extension
+ if (extensionsLen > 0) {
+ byte[] extensionData = new byte[extensionsLen];
+ reqBuf.get(extensionData);
+ DerInputStream dis = new DerInputStream(extensionData);
+ DerValue[] extSeqContents = dis.getSequence(extensionData.length);
+ for (DerValue extDerVal : extSeqContents) {
+ extensions.add(new sun.security.x509.Extension(extDerVal));
+ }
+ }
+ }
+
+ /**
+ * Obtain the length of the {@code OCSPStatusRequest} object in its
+ * encoded form
+ *
+ * @return the length of the {@code OCSPStatusRequest} object in its
+ * encoded form
+ */
+ @Override
+ public int length() {
+ // If we've previously calculated encodedLen simply return it
+ if (encodedLen != 0) {
+ return encodedLen;
+ }
+
+ ridListLen = 0;
+ for (ResponderId rid : responderIds) {
+ ridListLen += rid.length() + 2;
+ }
+
+ extListLen = 0;
+ if (!extensions.isEmpty()) {
+ try {
+ DerOutputStream extSequence = new DerOutputStream();
+ DerOutputStream extEncoding = new DerOutputStream();
+ for (Extension ext : extensions) {
+ ext.encode(extEncoding);
+ }
+ extSequence.write(DerValue.tag_Sequence, extEncoding);
+ extListLen = extSequence.size();
+ } catch (IOException ioe) {
+ // Not sure what to do here
+ }
+ }
+
+ // Total length is the responder ID list length and extensions length
+ // plus each lists' 2-byte length fields.
+ encodedLen = ridListLen + extListLen + 4;
+
+ return encodedLen;
+ }
+
+ /**
+ * Send the encoded {@code OCSPStatusRequest} out through the provided
+ * {@code HandshakeOutputStream}
+ *
+ * @param s the {@code HandshakeOutputStream} on which to send the encoded
+ * data
+ *
+ * @throws IOException if any encoding errors occur
+ */
+ @Override
+ public void send(HandshakeOutStream s) throws IOException {
+ s.putInt16(ridListLen);
+ for (ResponderId rid : responderIds) {
+ s.putBytes16(rid.getEncoded());
+ }
+
+ DerOutputStream seqOut = new DerOutputStream();
+ DerOutputStream extBytes = new DerOutputStream();
+
+ if (extensions.size() > 0) {
+ for (Extension ext : extensions) {
+ ext.encode(extBytes);
+ }
+ seqOut.write(DerValue.tag_Sequence, extBytes);
+ }
+ s.putBytes16(seqOut.toByteArray());
+ }
+
+ /**
+ * Determine if a provided {@code OCSPStatusRequest} objects is equal to
+ * this one.
+ *
+ * @param obj an {@code OCSPStatusRequest} object to be compared against
+ *
+ * @return {@code true} if the objects are equal, {@code false} otherwise.
+ * Equivalence is established if the lists of responder IDs and
+ * extensions between the two objects are also equal.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ } else if (this == obj) {
+ return true;
+ } else if (obj instanceof OCSPStatusRequest) {
+ OCSPStatusRequest respObj = (OCSPStatusRequest)obj;
+ return responderIds.equals(respObj.getResponderIds()) &&
+ extensions.equals(respObj.getExtensions());
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the hash code value for this {@code OCSPStatusRequest}
+ *
+ * @return the hash code value for this {@code OCSPStatusRequest}
+ */
+ @Override
+ public int hashCode() {
+ int result = 17;
+
+ result = 31 * result + responderIds.hashCode();
+ result = 31 * result + extensions.hashCode();
+
+ return result;
+ }
+
+ /**
+ * Create a string representation of this {@code OCSPStatusRequest}
+ *
+ * @return a string representation of this {@code OCSPStatusRequest}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("OCSPStatusRequest\n");
+ sb.append(" ResponderIds:");
+
+ if (responderIds.isEmpty()) {
+ sb.append(" <EMPTY>");
+ } else {
+ for (ResponderId rid : responderIds) {
+ sb.append("\n ").append(rid.toString());
+ }
+ }
+
+ sb.append("\n").append(" Extensions:");
+ if (extensions.isEmpty()) {
+ sb.append(" <EMPTY>");
+ } else {
+ for (Extension ext : extensions) {
+ sb.append("\n ").append(ext.toString());
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Get the list of {@code ResponderId} objects for this
+ * {@code OCSPStatusRequest}
+ *
+ * @return an unmodifiable {@code List} of {@code ResponderId} objects
+ */
+ List<ResponderId> getResponderIds() {
+ return Collections.unmodifiableList(responderIds);
+ }
+
+ /**
+ * Get the list of {@code Extension} objects for this
+ * {@code OCSPStatusRequest}
+ *
+ * @return an unmodifiable {@code List} of {@code Extension} objects
+ */
+ List<Extension> getExtensions() {
+ return Collections.unmodifiableList(extensions);
+ }
+}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -65,6 +65,8 @@
// DTLS cookie exchange manager
private HelloCookieManager helloCookieManager;
+ private StatusResponseManager statusResponseManager;
+
SSLContextImpl() {
ephemeralKeyManager = new EphemeralKeyManager();
clientCache = new SSLSessionContextImpl();
@@ -88,6 +90,7 @@
}
}
trustManager = chooseTrustManager(tm);
+ statusResponseManager = new StatusResponseManager();
if (sr == null) {
secureRandom = JsseJce.getSecureRandom();
@@ -256,6 +259,10 @@
"Cookie exchange applies to DTLS only");
}
+ StatusResponseManager getStatusResponseManager() {
+ return statusResponseManager;
+ }
+
abstract SSLParameters getDefaultServerSSLParams();
abstract SSLParameters getDefaultClientSSLParams();
abstract SSLParameters getSupportedSSLParams();
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Wed Jul 05 20:44:51 2017 +0200
@@ -108,6 +108,7 @@
private String[] localSupportedSignAlgs;
private String[] peerSupportedSignAlgs;
private List<SNIServerName> requestedServerNames;
+ private List<byte[]> statusResponses;
private int negotiatedMaxFragLen;
private int maximumPacketSize;
@@ -180,6 +181,7 @@
localSupportedSignAlgs =
SignatureAndHashAlgorithm.getAlgorithmNames(algorithms);
negotiatedMaxFragLen = -1;
+ statusResponses = null;
if (debug != null && Debug.isOn("session")) {
System.out.println("%% Initialized: " + this);
@@ -226,6 +228,19 @@
}
/**
+ * Provide status response data obtained during the SSL handshake.
+ *
+ * @param responses a {@link List} of responses in binary form.
+ */
+ void setStatusResponses(List<byte[]> responses) {
+ if (responses != null && !responses.isEmpty()) {
+ statusResponses = responses;
+ } else {
+ statusResponses = Collections.emptyList();
+ }
+ }
+
+ /**
* Set the peer principal.
*/
void setPeerPrincipal(Principal principal) {
@@ -532,6 +547,30 @@
}
/**
+ * Return a List of status responses presented by the peer.
+ * Note: This method can be used only when using certificate-based
+ * server authentication; otherwise an empty {@code List} will be returned.
+ *
+ * @return an unmodifiable {@code List} of byte arrays, each consisting
+ * of a DER-encoded OCSP response (see RFC 6960). If no responses have
+ * been presented by the server or non-certificate based server
+ * authentication is used then an empty {@code List} is returned.
+ */
+ @Override
+ public List<byte[]> getStatusResponses() {
+ if (statusResponses == null || statusResponses.isEmpty()) {
+ return Collections.emptyList();
+ } else {
+ // Clone both the list and the contents
+ List<byte[]> responses = new ArrayList<>(statusResponses.size());
+ for (byte[] respBytes : statusResponses) {
+ responses.add(respBytes.clone());
+ }
+ return Collections.unmodifiableList(responses);
+ }
+ }
+
+ /**
* Returns the identity of the peer which was established as part of
* defining the session.
*
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,6 +28,7 @@
import java.io.*;
import java.util.*;
+import java.util.concurrent.TimeUnit;
import java.security.*;
import java.security.cert.*;
import java.security.interfaces.*;
@@ -36,9 +37,9 @@
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
-
import javax.net.ssl.*;
+import sun.security.action.GetLongAction;
import sun.security.util.KeyUtil;
import sun.security.util.LegacyAlgorithmConstraints;
import sun.security.action.GetPropertyAction;
@@ -57,11 +58,16 @@
*/
final class ServerHandshaker extends Handshaker {
+ // The default number of milliseconds the handshaker will wait for
+ // revocation status responses.
+ private static final long DEFAULT_STATUS_RESP_DELAY = 5000;
+
// is the server going to require the client to authenticate?
private ClientAuthType doClientAuth;
// our authentication info
private X509Certificate[] certs;
+ private Map<X509Certificate, byte[]> responseMap;
private PrivateKey privateKey;
private Object serviceCreds;
@@ -112,6 +118,13 @@
LegacyAlgorithmConstraints.PROPERTY_TLS_LEGACY_ALGS,
new SSLAlgorithmDecomposer());
+ // To switch off the status_request[_v2] extensions
+ private final static boolean enableStatusRequestExtension =
+ Debug.getBooleanProperty(
+ "jdk.tls.server.enableStatusRequestExtension", false);
+ private boolean staplingActive = false;
+ private long statusRespTimeout;
+
static {
String property = AccessController.doPrivileged(
new GetPropertyAction("jdk.tls.ephemeralDHKeySize"));
@@ -159,6 +172,11 @@
activeProtocolVersion, isInitialHandshake, secureRenegotiation,
clientVerifyData, serverVerifyData);
doClientAuth = clientAuth;
+ statusRespTimeout = AccessController.doPrivileged(
+ new GetLongAction("jdk.tls.stapling.responseTimeout",
+ DEFAULT_STATUS_RESP_DELAY));
+ statusRespTimeout = statusRespTimeout >= 0 ? statusRespTimeout :
+ DEFAULT_STATUS_RESP_DELAY;
}
/*
@@ -176,6 +194,11 @@
activeProtocolVersion, isInitialHandshake, secureRenegotiation,
clientVerifyData, serverVerifyData, isDTLS);
doClientAuth = clientAuth;
+ statusRespTimeout = AccessController.doPrivileged(
+ new GetLongAction("jdk.tls.stapling.responseTimeout",
+ DEFAULT_STATUS_RESP_DELAY));
+ statusRespTimeout = statusRespTimeout >= 0 ? statusRespTimeout :
+ DEFAULT_STATUS_RESP_DELAY;
}
/*
@@ -529,6 +552,16 @@
}
}
+ // Check if the client has asserted the status_request[_v2] extension(s)
+ CertStatusReqExtension statReqExt = (CertStatusReqExtension)
+ mesg.extensions.get(ExtensionType.EXT_STATUS_REQUEST);
+ CertStatusReqListV2Extension statReqExtV2 =
+ (CertStatusReqListV2Extension)mesg.extensions.get(
+ ExtensionType.EXT_STATUS_REQUEST_V2);
+ // Keep stapling active if at least one of the extensions has been set
+ staplingActive = enableStatusRequestExtension &&
+ (statReqExt != null || statReqExtV2 != null);
+
/*
* FIRST, construct the ServerHello using the options and priorities
* from the ClientHello. Update the (pending) cipher spec as we do
@@ -825,6 +858,69 @@
m1.extensions.add(maxFragLenExt);
}
+ StatusRequestType statReqType = null;
+ StatusRequest statReqData = null;
+ if (staplingActive && !resumingSession) {
+ ExtensionType statusRespExt = ExtensionType.EXT_STATUS_REQUEST;
+
+ // Determine which type of stapling we are doing and assert the
+ // proper extension in the server hello.
+ // Favor status_request_v2 over status_request and ocsp_multi
+ // over ocsp.
+ // If multiple ocsp or ocsp_multi types exist, select the first
+ // instance of a given type
+ if (statReqExtV2 != null) { // RFC 6961 stapling
+ statusRespExt = ExtensionType.EXT_STATUS_REQUEST_V2;
+ List<CertStatusReqItemV2> reqItems =
+ statReqExtV2.getRequestItems();
+ int ocspIdx = -1;
+ int ocspMultiIdx = -1;
+ for (int pos = 0; pos < reqItems.size(); pos++) {
+ CertStatusReqItemV2 item = reqItems.get(pos);
+ if (ocspIdx < 0 && item.getType() ==
+ StatusRequestType.OCSP) {
+ ocspIdx = pos;
+ } else if (ocspMultiIdx < 0 && item.getType() ==
+ StatusRequestType.OCSP_MULTI) {
+ ocspMultiIdx = pos;
+ }
+ }
+ if (ocspMultiIdx >= 0) {
+ statReqType = reqItems.get(ocspMultiIdx).getType();
+ statReqData = reqItems.get(ocspMultiIdx).getRequest();
+ } else if (ocspIdx >= 0) {
+ statReqType = reqItems.get(ocspIdx).getType();
+ statReqData = reqItems.get(ocspIdx).getRequest();
+ } else {
+ // Some unknown type. We will not do stapling for
+ // this connection since we cannot understand the
+ // requested type.
+ staplingActive = false;
+ }
+ } else { // RFC 6066 stapling
+ statReqType = StatusRequestType.OCSP;
+ statReqData = statReqExt.getRequest();
+ }
+
+ if (statReqType != null && statReqData != null) {
+ // Next, attempt to obtain status responses
+ StatusResponseManager statRespMgr =
+ sslContext.getStatusResponseManager();
+ responseMap = statRespMgr.get(statReqType, statReqData, certs,
+ statusRespTimeout, TimeUnit.MILLISECONDS);
+ if (!responseMap.isEmpty()) {
+ // We now can safely assert status_request[_v2] in our
+ // ServerHello, and know for certain that we can provide
+ // responses back to this client for this connection.
+ if (statusRespExt == ExtensionType.EXT_STATUS_REQUEST) {
+ m1.extensions.add(new CertStatusReqExtension());
+ } else if (statusRespExt == ExtensionType.EXT_STATUS_REQUEST_V2) {
+ m1.extensions.add(new CertStatusReqListV2Extension());
+ }
+ }
+ }
+ }
+
if (debug != null && Debug.isOn("handshake")) {
m1.print(System.out);
System.out.println("Cipher suite: " + session.getSuite());
@@ -886,6 +982,32 @@
}
}
+ /**
+ * The CertificateStatus message ... only if it is needed.
+ * This would only be needed if we've established that this handshake
+ * supports status stapling and there is at least one response to
+ * return to the client.
+ */
+ if (staplingActive && !responseMap.isEmpty()) {
+ try {
+ CertificateStatus csMsg = new CertificateStatus(statReqType,
+ certs, responseMap);
+ if (debug != null && Debug.isOn("handshake")) {
+ csMsg.print(System.out);
+ }
+ csMsg.write(output);
+ handshakeState.update(csMsg, resumingSession);
+ responseMap = null;
+ } catch (SSLException ssle) {
+ // We don't want the exception to be fatal, we just won't
+ // send the message if we fail on construction.
+ if (debug != null && Debug.isOn("handshake")) {
+ System.out.println("Failed during CertificateStatus " +
+ "construction: " + ssle);
+ }
+ }
+ }
+
/*
* THIRD, the ServerKeyExchange message ... iff it's needed.
*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/StatusRequest.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.ssl;
+
+import java.io.IOException;
+
+/*
+ * RFC 6066 defines the TLS extension,"status_request" (type 0x5),
+ * which allows the client to request that the server perform OCSP
+ * on the client's behalf.
+ *
+ * This class is an interface for multiple types of StatusRequests
+ * (e.g. OCSPStatusRequest).
+ */
+interface StatusRequest {
+
+ /**
+ * Obtain the length of the {@code StatusRequest} object in encoded form
+ *
+ * @return the length of the {@code StatusRequest} object in encoded form
+ */
+ int length();
+
+ /**
+ * Place the encoded {@code StatusRequest} bytes into the
+ * {@code HandshakeOutputStream}
+ *
+ * @param s the target {@code HandshakeOutputStream}
+ *
+ * @throws IOException if any encoding error occurs
+ */
+ void send(HandshakeOutStream s) throws IOException;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/StatusRequestType.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.ssl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+final class StatusRequestType {
+
+ final int id;
+ final String name;
+ static List<StatusRequestType> knownTypes = new ArrayList<>(4);
+
+ private StatusRequestType(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ static StatusRequestType get(int id) {
+ for (StatusRequestType ext : knownTypes) {
+ if (ext.id == id) {
+ return ext;
+ }
+ }
+ return new StatusRequestType(id, "type_" + id);
+ }
+
+ private static StatusRequestType e(int id, String name) {
+ StatusRequestType ext = new StatusRequestType(id, name);
+ knownTypes.add(ext);
+ return ext;
+ }
+
+ @Override
+ public String toString() {
+ return (name == null || name.isEmpty()) ?
+ String.format("Unknown (0x%04X", id) : name;
+ }
+
+ // Status request types defined in RFC 6066 and 6961
+ final static StatusRequestType OCSP = e(0x01, "ocsp");
+ final static StatusRequestType OCSP_MULTI = e(0x02, "ocsp_multi");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,669 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.ssl;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.security.AccessController;
+import java.security.cert.X509Certificate;
+import java.security.cert.Extension;
+import java.util.*;
+import java.util.concurrent.*;
+
+import sun.security.provider.certpath.CertId;
+import sun.security.provider.certpath.OCSP;
+import sun.security.provider.certpath.OCSPResponse;
+import sun.security.provider.certpath.ResponderId;
+import sun.security.util.Cache;
+import sun.security.x509.PKIXExtensions;
+import sun.security.x509.SerialNumber;
+import sun.security.action.GetBooleanAction;
+import sun.security.action.GetIntegerAction;
+import sun.security.action.GetPropertyAction;
+
+final class StatusResponseManager {
+ private static final int DEFAULT_CORE_THREADS = 8;
+ private static final int DEFAULT_CACHE_SIZE = 256;
+ private static final int DEFAULT_CACHE_LIFETIME = 3600; // seconds
+ private static final Debug debug = Debug.getInstance("ssl");
+
+ private final ScheduledThreadPoolExecutor threadMgr;
+ private final Cache<CertId, ResponseCacheEntry> responseCache;
+ private final URI defaultResponder;
+ private final boolean respOverride;
+ private final int cacheCapacity;
+ private final int cacheLifetime;
+ private final boolean ignoreExtensions;
+
+ /**
+ * Create a StatusResponseManager with default parameters.
+ */
+ StatusResponseManager() {
+ int cap = AccessController.doPrivileged(
+ new GetIntegerAction("jdk.tls.stapling.cacheSize",
+ DEFAULT_CACHE_SIZE));
+ cacheCapacity = cap > 0 ? cap : 0;
+
+ int life = AccessController.doPrivileged(
+ new GetIntegerAction("jdk.tls.stapling.cacheLifetime",
+ DEFAULT_CACHE_LIFETIME));
+ cacheLifetime = life > 0 ? life : 0;
+
+ String uriStr = AccessController.doPrivileged(
+ new GetPropertyAction("jdk.tls.stapling.responderURI"));
+ URI tmpURI;
+ try {
+ tmpURI = ((uriStr != null && !uriStr.isEmpty()) ?
+ new URI(uriStr) : null);
+ } catch (URISyntaxException urise) {
+ tmpURI = null;
+ }
+ defaultResponder = tmpURI;
+
+ respOverride = AccessController.doPrivileged(
+ new GetBooleanAction("jdk.tls.stapling.responderOverride"));
+ ignoreExtensions = AccessController.doPrivileged(
+ new GetBooleanAction("jdk.tls.stapling.ignoreExtensions"));
+
+ threadMgr = new ScheduledThreadPoolExecutor(DEFAULT_CORE_THREADS,
+ new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = Executors.defaultThreadFactory().newThread(r);
+ t.setDaemon(true);
+ return t;
+ }
+ });
+ threadMgr.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
+ threadMgr.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
+ threadMgr.setKeepAliveTime(5000, TimeUnit.MILLISECONDS);
+ responseCache = Cache.newSoftMemoryCache(cacheCapacity, cacheLifetime);
+ }
+
+ /**
+ * Get the current cache lifetime setting
+ *
+ * @return the current cache lifetime value
+ */
+ int getCacheLifetime() {
+ return cacheLifetime;
+ }
+
+ /**
+ * Get the current maximum cache size.
+ *
+ * @return the current maximum cache size
+ */
+ int getCacheCapacity() {
+ return cacheCapacity;
+ }
+
+ /**
+ * Get the default OCSP responder URI, if previously set.
+ *
+ * @return the current default OCSP responder URI, or {@code null} if
+ * it has not been set.
+ */
+ URI getDefaultResponder() {
+ return defaultResponder;
+ }
+
+ /**
+ * Get the URI override setting
+ *
+ * @return {@code true} if URI override has been set, {@code false}
+ * otherwise.
+ */
+ boolean getURIOverride() {
+ return respOverride;
+ }
+
+ /**
+ * Get the ignore extensions setting.
+ *
+ * @return {@code true} if the {@code StatusResponseManager} will not
+ * pass OCSP Extensions in the TLS {@code status_request[_v2]} extensions,
+ * {@code false} if extensions will be passed (the default).
+ */
+ boolean getIgnoreExtensions() {
+ return ignoreExtensions;
+ }
+
+ /**
+ * Clear the status response cache
+ */
+ void clear() {
+ debugLog("Clearing response cache");
+ responseCache.clear();
+ }
+
+ /**
+ * Returns the number of currently valid objects in the response cache.
+ *
+ * @return the number of valid objects in the response cache.
+ */
+ int size() {
+ return responseCache.size();
+ }
+
+ /**
+ * Obtain the URI use by the {@code StatusResponseManager} during lookups.
+ * This method takes into account not only the AIA extension from a
+ * certificate to be checked, but also any default URI and possible
+ * override settings for the response manager.
+ *
+ * @param cert the subject to get the responder URI from
+ *
+ * @return a {@code URI} containing the address to the OCSP responder, or
+ * {@code null} if no AIA extension exists in the certificate and no
+ * default responder has been configured.
+ *
+ * @throws NullPointerException if {@code cert} is {@code null}.
+ */
+ URI getURI(X509Certificate cert) {
+ Objects.requireNonNull(cert);
+
+ if (cert.getExtensionValue(
+ PKIXExtensions.OCSPNoCheck_Id.toString()) != null) {
+ debugLog("OCSP NoCheck extension found. OCSP will be skipped");
+ return null;
+ } else if (defaultResponder != null && respOverride) {
+ debugLog("Responder override: URI is " + defaultResponder);
+ return defaultResponder;
+ } else {
+ URI certURI = OCSP.getResponderURI(cert);
+ return (certURI != null ? certURI : defaultResponder);
+ }
+ }
+
+ /**
+ * Shutdown the thread pool
+ */
+ void shutdown() {
+ debugLog("Shutting down " + threadMgr.getActiveCount() +
+ " active threads");
+ threadMgr.shutdown();
+ }
+
+ /**
+ * Get a list of responses for a chain of certificates.
+ * This will find OCSP responses from the cache, or failing that, directly
+ * contact the OCSP responder. It is assumed that the certificates in
+ * the provided chain are in their proper order (from end-entity to
+ * trust anchor).
+ *
+ * @param type the type of request being made of the
+ * {@code StatusResponseManager}
+ * @param request the {@code StatusRequest} from the status_request or
+ * status_request_v2 ClientHello extension. A value of {@code null}
+ * is interpreted as providing no responder IDs or extensions.
+ * @param chain an array of 2 or more certificates. Each certificate must
+ * be issued by the next certificate in the chain.
+ * @param delay the number of time units to delay before returning
+ * responses.
+ * @param unit the unit of time applied to the {@code delay} parameter
+ *
+ * @return an unmodifiable {@code Map} containing the certificate and
+ * its usually
+ *
+ * @throws SSLHandshakeException if an unsupported {@code StatusRequest}
+ * is provided.
+ */
+ Map<X509Certificate, byte[]> get(StatusRequestType type,
+ StatusRequest request, X509Certificate[] chain, long delay,
+ TimeUnit unit) {
+ Map<X509Certificate, byte[]> responseMap = new HashMap<>();
+ List<OCSPFetchCall> requestList = new ArrayList<>();
+
+ debugLog("Beginning check: Type = " + type + ", Chain length = " +
+ chain.length);
+
+ // It is assumed that the caller has ordered the certs in the chain
+ // in the proper order (each certificate is issued by the next entry
+ // in the provided chain).
+ if (chain.length < 2) {
+ return Collections.emptyMap();
+ }
+
+ if (type == StatusRequestType.OCSP) {
+ try {
+ // For type OCSP, we only check the end-entity certificate
+ OCSPStatusRequest ocspReq = (OCSPStatusRequest)request;
+ CertId cid = new CertId(chain[1],
+ new SerialNumber(chain[0].getSerialNumber()));
+ ResponseCacheEntry cacheEntry = getFromCache(cid, ocspReq);
+ if (cacheEntry != null) {
+ responseMap.put(chain[0], cacheEntry.ocspBytes);
+ } else {
+ StatusInfo sInfo = new StatusInfo(chain[0], cid);
+ requestList.add(new OCSPFetchCall(sInfo, ocspReq));
+ }
+ } catch (IOException exc) {
+ debugLog("Exception during CertId creation: " + exc);
+ }
+ } else if (type == StatusRequestType.OCSP_MULTI) {
+ // For type OCSP_MULTI, we check every cert in the chain that
+ // has a direct issuer at the next index. We won't have an issuer
+ // certificate for the last certificate in the chain and will
+ // not be able to create a CertId because of that.
+ OCSPStatusRequest ocspReq = (OCSPStatusRequest)request;
+ int ctr;
+ for (ctr = 0; ctr < chain.length - 1; ctr++) {
+ try {
+ // The cert at "ctr" is the subject cert, "ctr + 1" is the
+ // issuer certificate.
+ CertId cid = new CertId(chain[ctr + 1],
+ new SerialNumber(chain[ctr].getSerialNumber()));
+ ResponseCacheEntry cacheEntry = getFromCache(cid, ocspReq);
+ if (cacheEntry != null) {
+ responseMap.put(chain[ctr], cacheEntry.ocspBytes);
+ } else {
+ StatusInfo sInfo = new StatusInfo(chain[ctr], cid);
+ requestList.add(new OCSPFetchCall(sInfo, ocspReq));
+ }
+ } catch (IOException exc) {
+ debugLog("Exception during CertId creation: " + exc);
+ }
+ }
+ } else {
+ debugLog("Unsupported status request type: " + type);
+ }
+
+ // If we were able to create one or more Fetches, go and run all
+ // of them in separate threads. For all the threads that completed
+ // in the allotted time, put those status responses into the returned
+ // Map.
+ if (!requestList.isEmpty()) {
+ try {
+ // Set a bunch of threads to go do the fetching
+ List<Future<StatusInfo>> resultList =
+ threadMgr.invokeAll(requestList, delay, unit);
+
+ // Go through the Futures and from any non-cancelled task,
+ // get the bytes and attach them to the responseMap.
+ for (Future<StatusInfo> task : resultList) {
+ if (task.isDone()) {
+ if (!task.isCancelled()) {
+ StatusInfo info = task.get();
+ if (info != null && info.responseData != null) {
+ responseMap.put(info.cert,
+ info.responseData.ocspBytes);
+ } else {
+ debugLog("Completed task had no response data");
+ }
+ } else {
+ debugLog("Found cancelled task");
+ }
+ }
+ }
+ } catch (InterruptedException | ExecutionException exc) {
+ // Not sure what else to do here
+ debugLog("Exception when getting data: " + exc);
+ }
+ }
+
+ return Collections.unmodifiableMap(responseMap);
+ }
+
+ /**
+ * Check the cache for a given {@code CertId}.
+ *
+ * @param cid the CertId of the response to look up
+ * @param ocspRequest the OCSP request structure sent by the client
+ * in the TLS status_request[_v2] hello extension.
+ *
+ * @return the {@code ResponseCacheEntry} for a specific CertId, or
+ * {@code null} if it is not found or a nonce extension has been
+ * requested by the caller.
+ */
+ private ResponseCacheEntry getFromCache(CertId cid,
+ OCSPStatusRequest ocspRequest) {
+ // Determine if the nonce extension is present in the request. If
+ // so, then do not attempt to retrieve the response from the cache.
+ for (Extension ext : ocspRequest.getExtensions()) {
+ if (ext.getId().equals(PKIXExtensions.OCSPNonce_Id.toString())) {
+ debugLog("Nonce extension found, skipping cache check");
+ return null;
+ }
+ }
+
+ ResponseCacheEntry respEntry = responseCache.get(cid);
+
+ // If the response entry has a nextUpdate and it has expired
+ // before the cache expiration, purge it from the cache
+ // and do not return it as a cache hit.
+ if (respEntry != null && respEntry.nextUpdate != null &&
+ respEntry.nextUpdate.before(new Date())) {
+ debugLog("nextUpdate threshold exceeded, purging from cache");
+ respEntry = null;
+ }
+
+ debugLog("Check cache for SN" + cid.getSerialNumber() + ": " +
+ (respEntry != null ? "HIT" : "MISS"));
+ return respEntry;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("StatusResponseManager: ");
+
+ sb.append("Core threads: ").append(threadMgr.getCorePoolSize());
+ sb.append(", Cache timeout: ");
+ if (cacheLifetime > 0) {
+ sb.append(cacheLifetime).append(" seconds");
+ } else {
+ sb.append(" indefinite");
+ }
+
+ sb.append(", Cache MaxSize: ");
+ if (cacheCapacity > 0) {
+ sb.append(cacheCapacity).append(" items");
+ } else {
+ sb.append(" unbounded");
+ }
+
+ sb.append(", Default URI: ");
+ if (defaultResponder != null) {
+ sb.append(defaultResponder);
+ } else {
+ sb.append("NONE");
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Log messages through the SSL Debug facility.
+ *
+ * @param message the message to be displayed
+ */
+ static void debugLog(String message) {
+ if (debug != null && Debug.isOn("respmgr")) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("[").append(Thread.currentThread().getName());
+ sb.append("] ").append(message);
+ System.out.println(sb.toString());
+ }
+ }
+
+ /**
+ * Inner class used to group request and response data.
+ */
+ class StatusInfo {
+ final X509Certificate cert;
+ final CertId cid;
+ final URI responder;
+ ResponseCacheEntry responseData;
+
+ /**
+ * Create a StatusInfo object from certificate data.
+ *
+ * @param subjectCert the certificate to be checked for revocation
+ * @param issuerCert the issuer of the {@code subjectCert}
+ *
+ * @throws IOException if CertId creation from the certificates fails
+ */
+ StatusInfo(X509Certificate subjectCert, X509Certificate issuerCert)
+ throws IOException {
+ this(subjectCert, new CertId(issuerCert,
+ new SerialNumber(subjectCert.getSerialNumber())));
+ }
+
+ /**
+ * Create a StatusInfo object from an existing subject certificate
+ * and its corresponding CertId.
+ *
+ * @param subjectCert the certificate to be checked for revocation
+ * @param cid the CertId for {@code subjectCert}
+ */
+ StatusInfo(X509Certificate subjectCert, CertId certId) {
+ cert = subjectCert;
+ cid = certId;
+ responder = getURI(cert);
+ responseData = null;
+ }
+
+ /**
+ * Copy constructor (used primarily for rescheduling).
+ * This will do a member-wise copy with the exception of the
+ * responseData and extensions fields, which should not persist
+ * in a rescheduled fetch.
+ *
+ * @param orig the original {@code StatusInfo}
+ */
+ StatusInfo(StatusInfo orig) {
+ this.cert = orig.cert;
+ this.cid = orig.cid;
+ this.responder = orig.responder;
+ this.responseData = null;
+ }
+
+ /**
+ * Return a String representation of the {@code StatusInfo}
+ *
+ * @return a {@code String} representation of this object
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("StatusInfo:");
+ sb.append("\n\tCert: ").append(this.cert.getSubjectX500Principal());
+ sb.append("\n\tSerial: ").append(this.cert.getSerialNumber());
+ sb.append("\n\tResponder: ").append(this.responder);
+ sb.append("\n\tResponse data: ").append(this.responseData != null ?
+ (this.responseData.ocspBytes.length + " bytes") : "<NULL>");
+ return sb.toString();
+ }
+ }
+
+ /**
+ * Static nested class used as the data kept in the response cache.
+ */
+ static class ResponseCacheEntry {
+ final OCSPResponse.ResponseStatus status;
+ final byte[] ocspBytes;
+ final Date nextUpdate;
+ final OCSPResponse.SingleResponse singleResp;
+ final ResponderId respId;
+
+ /**
+ * Create a new cache entry from the raw bytes of the response
+ *
+ * @param responseBytes the DER encoding for the OCSP response
+ *
+ * @throws IOException if an {@code OCSPResponse} cannot be created from
+ * the encoded bytes.
+ */
+ ResponseCacheEntry(byte[] responseBytes, CertId cid)
+ throws IOException {
+ Objects.requireNonNull(responseBytes,
+ "Non-null responseBytes required");
+ Objects.requireNonNull(cid, "Non-null Cert ID required");
+
+ ocspBytes = responseBytes.clone();
+ OCSPResponse oResp = new OCSPResponse(ocspBytes);
+ status = oResp.getResponseStatus();
+ respId = oResp.getResponderId();
+ singleResp = oResp.getSingleResponse(cid);
+ if (status == OCSPResponse.ResponseStatus.SUCCESSFUL) {
+ if (singleResp != null) {
+ // Pull out the nextUpdate field in advance because the
+ // Date is cloned.
+ nextUpdate = singleResp.getNextUpdate();
+ } else {
+ throw new IOException("Unable to find SingleResponse for " +
+ "SN " + cid.getSerialNumber());
+ }
+ } else {
+ nextUpdate = null;
+ }
+ }
+ }
+
+ /**
+ * Inner Callable class that does the actual work of looking up OCSP
+ * responses, first looking at the cache and doing OCSP requests if
+ * a cache miss occurs.
+ */
+ class OCSPFetchCall implements Callable<StatusInfo> {
+ StatusInfo statInfo;
+ OCSPStatusRequest ocspRequest;
+ List<Extension> extensions;
+ List<ResponderId> responderIds;
+
+ /**
+ * A constructor that builds the OCSPFetchCall from the provided
+ * StatusInfo and information from the status_request[_v2] extension.
+ *
+ * @param info the {@code StatusInfo} containing the subject
+ * certificate, CertId, and other supplemental info.
+ * @param request the {@code OCSPStatusRequest} containing any
+ * responder IDs and extensions.
+ */
+ public OCSPFetchCall(StatusInfo info, OCSPStatusRequest request) {
+ statInfo = Objects.requireNonNull(info,
+ "Null StatusInfo not allowed");
+ ocspRequest = Objects.requireNonNull(request,
+ "Null OCSPStatusRequest not allowed");
+ extensions = ocspRequest.getExtensions();
+ responderIds = ocspRequest.getResponderIds();
+ }
+
+ /**
+ * Get an OCSP response, either from the cache or from a responder.
+ *
+ * @return The StatusInfo object passed into the {@code OCSPFetchCall}
+ * constructor, with the {@code responseData} field filled in with the
+ * response or {@code null} if no response can be obtained.
+ */
+ @Override
+ public StatusInfo call() {
+ debugLog("Starting fetch for SN " + statInfo.cid.getSerialNumber());
+ try {
+ ResponseCacheEntry cacheEntry;
+ List<Extension> extsToSend;
+
+ if (statInfo.responder == null) {
+ // If we have no URI then there's nothing to do but return
+ debugLog("Null URI detected, OCSP fetch aborted.");
+ return statInfo;
+ } else {
+ debugLog("Attempting fetch from " + statInfo.responder);
+ }
+
+ // If the StatusResponseManager has been configured to not
+ // forward extensions, then set extensions to an empty list.
+ // We will forward the extensions unless one of two conditions
+ // occur: (1) The jdk.tls.stapling.ignoreExtensions property is
+ // true or (2) There is a non-empty ResponderId list.
+ // ResponderId selection is a feature that will be
+ // supported in the future.
+ extsToSend = (ignoreExtensions || !responderIds.isEmpty()) ?
+ Collections.emptyList() : extensions;
+
+ byte[] respBytes = OCSP.getOCSPBytes(
+ Collections.singletonList(statInfo.cid),
+ statInfo.responder, extsToSend);
+
+ if (respBytes != null) {
+ // Place the data into the response cache
+ cacheEntry = new ResponseCacheEntry(respBytes,
+ statInfo.cid);
+
+ // Get the response status and act on it appropriately
+ debugLog("OCSP Status: " + cacheEntry.status +
+ " (" + respBytes.length + " bytes)");
+ if (cacheEntry.status ==
+ OCSPResponse.ResponseStatus.SUCCESSFUL) {
+ // Set the response in the returned StatusInfo
+ statInfo.responseData = cacheEntry;
+
+ // Add the response to the cache (if applicable)
+ addToCache(statInfo.cid, cacheEntry);
+ }
+ } else {
+ debugLog("No data returned from OCSP Responder");
+ }
+ } catch (IOException ioe) {
+ debugLog("Caught exception: " + ioe);
+ }
+
+ return statInfo;
+ }
+
+ /**
+ * Add a response to the cache.
+ *
+ * @param certId The {@code CertId} for the OCSP response
+ * @param entry A cache entry containing the response bytes and
+ * the {@code OCSPResponse} built from those bytes.
+ */
+ private void addToCache(CertId certId, ResponseCacheEntry entry) {
+ // If no cache lifetime has been set on entries then
+ // don't cache this response if there is no nextUpdate field
+ if (entry.nextUpdate == null && cacheLifetime == 0) {
+ debugLog("Not caching this OCSP response");
+ } else {
+ responseCache.put(certId, entry);
+ debugLog("Added response for SN " + certId.getSerialNumber() +
+ " to cache");
+ }
+ }
+
+ /**
+ * Determine the delay to use when scheduling the task that will
+ * update the OCSP response. This is the shorter time between the
+ * cache lifetime and the nextUpdate. If no nextUpdate is present in
+ * the response, then only the cache lifetime is used.
+ * If cache timeouts are disabled (a zero value) and there's no
+ * nextUpdate, then the entry is not cached and no rescheduling will
+ * take place.
+ *
+ * @param nextUpdate a {@code Date} object corresponding to the
+ * next update time from a SingleResponse.
+ *
+ * @return the number of seconds of delay before the next fetch
+ * should be executed. A zero value means that the fetch
+ * should happen immediately, while a value less than zero
+ * indicates no rescheduling should be done.
+ */
+ private long getNextTaskDelay(Date nextUpdate) {
+ long delaySec;
+ int lifetime = getCacheLifetime();
+
+ if (nextUpdate != null) {
+ long nuDiffSec = (nextUpdate.getTime() -
+ System.currentTimeMillis()) / 1000;
+ delaySec = lifetime > 0 ? Long.min(nuDiffSec, lifetime) :
+ nuDiffSec;
+ } else {
+ delaySec = lifetime > 0 ? lifetime : -1;
+ }
+
+ return delaySec;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/UnknownStatusRequest.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.ssl;
+
+import java.io.IOException;
+
+final class UnknownStatusRequest implements StatusRequest {
+
+ private final byte[] data;
+
+ UnknownStatusRequest(HandshakeInStream s, int len) throws IOException {
+ data = new byte[len];
+ if (len > 0) {
+ s.read(data);
+ }
+ }
+
+ UnknownStatusRequest(byte[] requestBytes) {
+ data = requestBytes;
+ }
+
+ @Override
+ public int length() {
+ return data.length;
+ }
+
+ @Override
+ public void send(HandshakeOutStream s) throws IOException {
+ // A raw write of the data
+ s.write(data);
+ }
+
+ @Override
+ public String toString() {
+ return "Unsupported StatusRequest, data: " +
+ Debug.toString(data);
+ }
+}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -184,6 +184,7 @@
Validator v = checkTrustedInit(chain, authType, isClient);
AlgorithmConstraints constraints = null;
+ List<byte[]> responseList = Collections.emptyList();
if ((socket != null) && socket.isConnected() &&
(socket instanceof SSLSocket)) {
@@ -195,7 +196,7 @@
// check endpoint identity
String identityAlg = sslSocket.getSSLParameters().
- getEndpointIdentificationAlgorithm();
+ getEndpointIdentificationAlgorithm();
if (identityAlg != null && identityAlg.length() != 0) {
checkIdentity(session, chain[0], identityAlg, isClient,
getRequestedServerNames(socket));
@@ -204,7 +205,7 @@
// create the algorithm constraints
ProtocolVersion protocolVersion =
ProtocolVersion.valueOf(session.getProtocol());
- if (protocolVersion.useTLS12PlusSpec()) {
+ if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
if (session instanceof ExtendedSSLSession) {
ExtendedSSLSession extSession =
(ExtendedSSLSession)session;
@@ -220,13 +221,21 @@
} else {
constraints = new SSLAlgorithmConstraints(sslSocket, false);
}
+
+ // Grab any stapled OCSP responses for use in validation
+ if (session instanceof ExtendedSSLSession) {
+ responseList =
+ ((ExtendedSSLSession)session).getStatusResponses();
+ }
}
X509Certificate[] trustedChain = null;
if (isClient) {
- trustedChain = validate(v, chain, constraints, null);
+ trustedChain = validate(v, chain, Collections.emptyList(),
+ constraints, null);
} else {
- trustedChain = validate(v, chain, constraints, authType);
+ trustedChain = validate(v, chain, responseList, constraints,
+ authType);
}
if (debug != null && Debug.isOn("trustmanager")) {
System.out.println("Found trusted certificate:");
@@ -239,6 +248,7 @@
Validator v = checkTrustedInit(chain, authType, isClient);
AlgorithmConstraints constraints = null;
+ List<byte[]> responseList = Collections.emptyList();
if (engine != null) {
SSLSession session = engine.getHandshakeSession();
if (session == null) {
@@ -247,7 +257,7 @@
// check endpoint identity
String identityAlg = engine.getSSLParameters().
- getEndpointIdentificationAlgorithm();
+ getEndpointIdentificationAlgorithm();
if (identityAlg != null && identityAlg.length() != 0) {
checkIdentity(session, chain[0], identityAlg, isClient,
getRequestedServerNames(engine));
@@ -256,7 +266,7 @@
// create the algorithm constraints
ProtocolVersion protocolVersion =
ProtocolVersion.valueOf(session.getProtocol());
- if (protocolVersion.useTLS12PlusSpec()) {
+ if (protocolVersion.v >= ProtocolVersion.TLS12.v) {
if (session instanceof ExtendedSSLSession) {
ExtendedSSLSession extSession =
(ExtendedSSLSession)session;
@@ -272,13 +282,21 @@
} else {
constraints = new SSLAlgorithmConstraints(engine, false);
}
+
+ // Grab any stapled OCSP responses for use in validation
+ if (session instanceof ExtendedSSLSession) {
+ responseList =
+ ((ExtendedSSLSession)session).getStatusResponses();
+ }
}
X509Certificate[] trustedChain = null;
if (isClient) {
- trustedChain = validate(v, chain, constraints, null);
+ trustedChain = validate(v, chain, Collections.emptyList(),
+ constraints, null);
} else {
- trustedChain = validate(v, chain, constraints, authType);
+ trustedChain = validate(v, chain, responseList, constraints,
+ authType);
}
if (debug != null && Debug.isOn("trustmanager")) {
System.out.println("Found trusted certificate:");
@@ -317,11 +335,12 @@
}
private static X509Certificate[] validate(Validator v,
- X509Certificate[] chain, AlgorithmConstraints constraints,
- String authType) throws CertificateException {
+ X509Certificate[] chain, List<byte[]> responseList,
+ AlgorithmConstraints constraints, String authType)
+ throws CertificateException {
Object o = JsseJce.beginFipsProvider();
try {
- return v.validate(chain, null, constraints, authType);
+ return v.validate(chain, null, responseList, constraints, authType);
} finally {
JsseJce.endFipsProvider(o);
}
--- a/jdk/src/java.base/share/classes/sun/security/validator/PKIXValidator.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/validator/PKIXValidator.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, 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
@@ -186,6 +186,7 @@
@Override
X509Certificate[] engineValidate(X509Certificate[] chain,
Collection<X509Certificate> otherCerts,
+ List<byte[]> responseList,
AlgorithmConstraints constraints,
Object parameter) throws CertificateException {
if ((chain == null) || (chain.length == 0)) {
@@ -193,7 +194,7 @@
("null or zero-length certificate chain");
}
- // add new algorithm constraints checker
+ // add new algorithm constraints checker
PKIXBuilderParameters pkixParameters =
(PKIXBuilderParameters) parameterTemplate.clone();
AlgorithmChecker algorithmChecker = null;
@@ -202,6 +203,11 @@
pkixParameters.addCertPathChecker(algorithmChecker);
}
+ // attach it to the PKIXBuilderParameters.
+ if (!responseList.isEmpty()) {
+ addResponses(pkixParameters, chain, responseList);
+ }
+
// check that chain is in correct order and check if chain contains
// trust anchor
X500Principal prevIssuer = null;
@@ -369,4 +375,70 @@
("PKIX path building failed: " + e.toString(), e);
}
}
+
+ /**
+ * For OCSP Stapling, add responses that came in during the handshake
+ * into a {@code PKIXRevocationChecker} so we can evaluate them.
+ *
+ * @param pkixParams the pkixParameters object that will be used in
+ * path validation.
+ * @param chain the chain of certificates to verify
+ * @param responseList a {@code List} of zero or more byte arrays, each
+ * one being a DER-encoded OCSP response (per RFC 6960). Entries
+ * in the List must match the order of the certificates in the
+ * chain parameter.
+ */
+ private static void addResponses(PKIXBuilderParameters pkixParams,
+ X509Certificate[] chain, List<byte[]> responseList) {
+
+ if (pkixParams.isRevocationEnabled()) {
+ try {
+ // Make a modifiable copy of the CertPathChecker list
+ PKIXRevocationChecker revChecker = null;
+ List<PKIXCertPathChecker> checkerList =
+ new ArrayList<>(pkixParams.getCertPathCheckers());
+
+ // Find the first PKIXRevocationChecker in the list
+ for (PKIXCertPathChecker checker : checkerList) {
+ if (checker instanceof PKIXRevocationChecker) {
+ revChecker = (PKIXRevocationChecker)checker;
+ break;
+ }
+ }
+
+ // If we still haven't found one, make one
+ if (revChecker == null) {
+ revChecker = (PKIXRevocationChecker)CertPathValidator.
+ getInstance("PKIX").getRevocationChecker();
+ checkerList.add(revChecker);
+ }
+
+ // Each response in the list should be in parallel with
+ // the certificate list. If there is a zero-length response
+ // treat it as being absent. If the user has provided their
+ // own PKIXRevocationChecker with pre-populated responses, do
+ // not overwrite them with the ones from the handshake.
+ Map<X509Certificate, byte[]> responseMap =
+ revChecker.getOcspResponses();
+ int limit = Integer.min(chain.length, responseList.size());
+ for (int idx = 0; idx < limit; idx++) {
+ byte[] respBytes = responseList.get(idx);
+ if (respBytes != null && respBytes.length > 0 &&
+ !responseMap.containsKey(chain[idx])) {
+ responseMap.put(chain[idx], respBytes);
+ }
+ }
+
+ // Add the responses and push it all back into the
+ // PKIXBuilderParameters
+ revChecker.setOcspResponses(responseMap);
+ pkixParams.setCertPathCheckers(checkerList);
+ } catch (NoSuchAlgorithmException exc) {
+ // This should not occur, but if it does happen then
+ // stapled OCSP responses won't be part of revocation checking.
+ // Clients can still fall back to other means of revocation
+ // checking.
+ }
+ }
+ }
}
--- a/jdk/src/java.base/share/classes/sun/security/validator/SimpleValidator.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/validator/SimpleValidator.java Wed Jul 05 20:44:51 2017 +0200
@@ -122,6 +122,7 @@
@Override
X509Certificate[] engineValidate(X509Certificate[] chain,
Collection<X509Certificate> otherCerts,
+ List<byte[]> responseList,
AlgorithmConstraints constraints,
Object parameter) throws CertificateException {
if ((chain == null) || (chain.length == 0)) {
--- a/jdk/src/java.base/share/classes/sun/security/validator/Validator.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/validator/Validator.java Wed Jul 05 20:44:51 2017 +0200
@@ -235,7 +235,8 @@
public final X509Certificate[] validate(X509Certificate[] chain,
Collection<X509Certificate> otherCerts, Object parameter)
throws CertificateException {
- return validate(chain, otherCerts, null, parameter);
+ return validate(chain, otherCerts, Collections.emptyList(), null,
+ parameter);
}
/**
@@ -244,6 +245,13 @@
* @param chain the target certificate chain
* @param otherCerts a Collection of additional X509Certificates that
* could be helpful for path building (or null)
+ * @param responseList a List of zero or more byte arrays, each
+ * one being a DER-encoded OCSP response (per RFC 6960). Entries
+ * in the List must match the order of the certificates in the
+ * chain parameter. It is possible that fewer responses may be
+ * in the list than are elements in {@code chain} and a missing
+ * response for a matching element in {@code chain} can be
+ * represented with a zero-length byte array.
* @param constraints algorithm constraints for certification path
* processing
* @param parameter an additional parameter with variant specific meaning.
@@ -257,9 +265,11 @@
*/
public final X509Certificate[] validate(X509Certificate[] chain,
Collection<X509Certificate> otherCerts,
+ List<byte[]> responseList,
AlgorithmConstraints constraints,
Object parameter) throws CertificateException {
- chain = engineValidate(chain, otherCerts, constraints, parameter);
+ chain = engineValidate(chain, otherCerts, responseList, constraints,
+ parameter);
// omit EE extension check if EE cert is also trust anchor
if (chain.length > 1) {
@@ -280,6 +290,7 @@
abstract X509Certificate[] engineValidate(X509Certificate[] chain,
Collection<X509Certificate> otherCerts,
+ List<byte[]> responseList,
AlgorithmConstraints constraints,
Object parameter) throws CertificateException;
--- a/jdk/src/java.base/share/classes/sun/security/x509/PKIXExtensions.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/x509/PKIXExtensions.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -77,6 +77,11 @@
private static final int[] OCSPNoCheck_data = { 1, 3, 6, 1, 5, 5, 7,
48, 1, 5};
+ // Additional extensions under the PKIX arc that are not necessarily
+ // used in X.509 Certificates or CRLs.
+ private static final int OCSPNonce_data [] = { 1, 3, 6, 1, 5, 5, 7,
+ 48, 1, 2};
+
/**
* Identifies the particular public key used to sign the certificate.
*/
@@ -104,18 +109,20 @@
public static final ObjectIdentifier CertificatePolicies_Id;
/**
- * Lists pairs of objectidentifiers of policies considered equivalent by the
- * issuing CA to the subject CA.
+ * Lists pairs of object identifiers of policies considered equivalent by
+ * the issuing CA to the subject CA.
*/
public static final ObjectIdentifier PolicyMappings_Id;
/**
- * Allows additional identities to be bound to the subject of the certificate.
+ * Allows additional identities to be bound to the subject of the
+ * certificate.
*/
public static final ObjectIdentifier SubjectAlternativeName_Id;
/**
- * Allows additional identities to be associated with the certificate issuer.
+ * Allows additional identities to be associated with the certificate
+ * issuer.
*/
public static final ObjectIdentifier IssuerAlternativeName_Id;
@@ -224,6 +231,12 @@
*/
public static final ObjectIdentifier OCSPNoCheck_Id;
+ /**
+ * This extension is used to provide nonce data for OCSP requests
+ * or responses.
+ */
+ public static final ObjectIdentifier OCSPNonce_Id;
+
static {
AuthorityKey_Id = ObjectIdentifier.newInternal(AuthorityKey_data);
SubjectKey_Id = ObjectIdentifier.newInternal(SubjectKey_data);
@@ -266,5 +279,6 @@
ObjectIdentifier.newInternal(SubjectInfoAccess_data);
FreshestCRL_Id = ObjectIdentifier.newInternal(FreshestCRL_data);
OCSPNoCheck_Id = ObjectIdentifier.newInternal(OCSPNoCheck_data);
+ OCSPNonce_Id = ObjectIdentifier.newInternal(OCSPNonce_data);
}
}
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java Wed Jul 05 20:44:51 2017 +0200
@@ -80,7 +80,17 @@
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(TimeZoneNameProvider.class, locale);
TimeZoneNameProvider provider = adapter.getTimeZoneNameProvider();
if (provider instanceof TimeZoneNameProviderImpl) {
- return ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale);
+ String[][] zoneStrings = ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale);
+
+ if (zoneStrings.length == 0 && locale.equals(Locale.ROOT)) {
+ // Unlike other *Name provider, zoneStrings search won't do the fallback
+ // name search. If the ResourceBundle found for the root locale contains no
+ // zoneStrings, just use the one for English, assuming English bundle
+ // contains all the tzids and their names.
+ zoneStrings= getZoneStrings(Locale.ENGLISH);
+ }
+
+ return zoneStrings;
}
// Performs per-ID retrieval.
--- a/jdk/src/java.base/share/native/libverify/check_code.c Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/share/native/libverify/check_code.c Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2015, 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
@@ -159,11 +159,12 @@
ITEM_InitObject, /* "this" is init method, before call
to super() */
ITEM_ReturnAddress, /* Extra info gives instr # of start pc */
- /* The following three are only used within array types.
+ /* The following four are only used within array types.
* Normally, we use ITEM_Integer, instead. */
ITEM_Byte,
ITEM_Short,
- ITEM_Char
+ ITEM_Char,
+ ITEM_Boolean
};
@@ -1446,7 +1447,9 @@
full_info = MAKE_FULLINFO(ITEM_Float, 1, 0); break;
case JVM_T_DOUBLE:
full_info = MAKE_FULLINFO(ITEM_Double, 1, 0); break;
- case JVM_T_BYTE: case JVM_T_BOOLEAN:
+ case JVM_T_BOOLEAN:
+ full_info = MAKE_FULLINFO(ITEM_Boolean, 1, 0); break;
+ case JVM_T_BYTE:
full_info = MAKE_FULLINFO(ITEM_Byte, 1, 0); break;
case JVM_T_CHAR:
full_info = MAKE_FULLINFO(ITEM_Char, 1, 0); break;
@@ -2250,10 +2253,11 @@
break;
}
- case 'B': /* array of bytes */
- if (top_type != MAKE_FULLINFO(ITEM_Byte, 1, 0))
+ case 'B': /* array of bytes or booleans */
+ if (top_type != MAKE_FULLINFO(ITEM_Byte, 1, 0) &&
+ top_type != MAKE_FULLINFO(ITEM_Boolean, 1, 0))
CCerror(context,
- "Expecting to find array of bytes on stack");
+ "Expecting to find array of bytes or Booleans on stack");
break;
case 'C': /* array of characters */
@@ -2403,7 +2407,6 @@
CCerror(context, "Call to wrong initialization method");
}
if (this_idata->protected
- && context->major_version > LDC_CLASS_MAJOR_VERSION
&& !isAssignableTo(context, object_type,
context->currentclass_info)) {
CCerror(context, "Bad access to protected data");
@@ -3728,7 +3731,14 @@
result = 0;
break;
- case JVM_SIGNATURE_BOOLEAN: case JVM_SIGNATURE_BYTE:
+ case JVM_SIGNATURE_BOOLEAN:
+ full_info = (array_depth > 0)
+ ? MAKE_FULLINFO(ITEM_Boolean, 0, 0)
+ : MAKE_FULLINFO(ITEM_Integer, 0, 0);
+ result = 'I';
+ break;
+
+ case JVM_SIGNATURE_BYTE:
full_info = (array_depth > 0)
? MAKE_FULLINFO(ITEM_Byte, 0, 0)
: MAKE_FULLINFO(ITEM_Integer, 0, 0);
@@ -3831,7 +3841,7 @@
int indirection = GET_INDIRECTION(array_info) - 1;
int extra_info = GET_EXTRA_INFO(array_info);
if ( (indirection == 0)
- && ((type == ITEM_Short || type == ITEM_Byte || type == ITEM_Char)))
+ && ((type == ITEM_Short || type == ITEM_Byte || type == ITEM_Boolean || type == ITEM_Char)))
type = ITEM_Integer;
return MAKE_FULLINFO(type, indirection, extra_info);
}
@@ -4286,6 +4296,8 @@
jio_fprintf(stdout, "C"); break;
case ITEM_Short:
jio_fprintf(stdout, "S"); break;
+ case ITEM_Boolean:
+ jio_fprintf(stdout, "Z"); break;
case ITEM_Byte:
jio_fprintf(stdout, "B"); break;
case ITEM_NewObject:
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/GnomeFileTypeDetector.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/GnomeFileTypeDetector.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, 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
@@ -31,34 +31,23 @@
import java.security.PrivilegedAction;
/**
- * File type detector that uses the GNOME I/O library or the deprecated
- * GNOME VFS to guess the MIME type of a file.
+ * File type detector that uses the GNOME I/O library to guess the
+ * MIME type of a file.
*/
public class GnomeFileTypeDetector
extends AbstractFileTypeDetector
{
- private static final String GNOME_VFS_MIME_TYPE_UNKNOWN =
- "application/octet-stream";
-
- // true if GIO available
+ // true if GIO is available
private final boolean gioAvailable;
- // true if GNOME VFS available and GIO is not available
- private final boolean gnomeVfsAvailable;
-
public GnomeFileTypeDetector() {
gioAvailable = initializeGio();
- if (gioAvailable) {
- gnomeVfsAvailable = false;
- } else {
- gnomeVfsAvailable = initializeGnomeVfs();
- }
}
@Override
public String implProbeContentType(Path obj) throws IOException {
- if (!gioAvailable && !gnomeVfsAvailable)
+ if (!gioAvailable)
return null;
if (!(obj instanceof UnixPath))
return null;
@@ -66,18 +55,10 @@
UnixPath path = (UnixPath)obj;
NativeBuffer buffer = NativeBuffers.asNativeBuffer(path.getByteArrayForSysCalls());
try {
- if (gioAvailable) {
- // GIO may access file so need permission check
- path.checkRead();
- byte[] type = probeUsingGio(buffer.address());
- return (type == null) ? null : Util.toString(type);
- } else {
- byte[] type = probeUsingGnomeVfs(buffer.address());
- if (type == null)
- return null;
- String s = Util.toString(type);
- return s.equals(GNOME_VFS_MIME_TYPE_UNKNOWN) ? null : s;
- }
+ // GIO may access file so need permission check
+ path.checkRead();
+ byte[] type = probeGio(buffer.address());
+ return (type == null) ? null : Util.toString(type);
} finally {
buffer.release();
}
@@ -86,11 +67,7 @@
// GIO
private static native boolean initializeGio();
- private static native byte[] probeUsingGio(long pathAddress);
-
- // GNOME VFS
- private static native boolean initializeGnomeVfs();
- private static native byte[] probeUsingGnomeVfs(long pathAddress);
+ private static native byte[] probeGio(long pathAddress);
static {
AccessController.doPrivileged(new PrivilegedAction<>() {
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileStore.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixFileStore.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, 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
@@ -186,7 +186,8 @@
return false;
UnixFileStore other = (UnixFileStore)ob;
return (this.dev == other.dev) &&
- Arrays.equals(this.entry.dir(), other.entry.dir());
+ Arrays.equals(this.entry.dir(), other.entry.dir()) &&
+ this.entry.name().equals(other.entry.name());
}
@Override
--- a/jdk/src/java.base/unix/native/libnio/ch/Net.c Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/unix/native/libnio/ch/Net.c Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, 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
@@ -29,6 +29,7 @@
#include <string.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
+#include <limits.h>
#include "jni.h"
#include "jni_util.h"
@@ -186,7 +187,7 @@
#endif
}
-JNIEXPORT int JNICALL
+JNIEXPORT jint JNICALL
Java_sun_nio_ch_Net_socket0(JNIEnv *env, jclass cl, jboolean preferIPv6,
jboolean stream, jboolean reuse, jboolean ignored)
{
@@ -709,7 +710,12 @@
int rv;
pfd.fd = fdval(env, fdo);
pfd.events = events;
- rv = poll(&pfd, 1, timeout);
+ if (timeout < -1) {
+ timeout = -1;
+ } else if (timeout > INT_MAX) {
+ timeout = INT_MAX;
+ }
+ rv = poll(&pfd, 1, (int)timeout);
if (rv >= 0) {
return pfd.revents;
--- a/jdk/src/java.base/unix/native/libnio/fs/GnomeFileTypeDetector.c Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.base/unix/native/libnio/fs/GnomeFileTypeDetector.c Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, 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
@@ -39,6 +39,11 @@
#include <string.h>
#endif
+/*
+ * For reference see for example the GFileInfo section at
+ * https://developer.gnome.org/gio/unstable/.
+ */
+
/* Definitions for GIO */
#define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "standard::content-type"
@@ -68,18 +73,6 @@
static g_file_info_get_content_type_func g_file_info_get_content_type;
-/* Definitions for GNOME VFS */
-
-typedef int gboolean;
-
-typedef gboolean (*gnome_vfs_init_function)(void);
-typedef const char* (*gnome_vfs_mime_type_from_name_function)
- (const char* filename);
-
-static gnome_vfs_init_function gnome_vfs_init;
-static gnome_vfs_mime_type_from_name_function gnome_vfs_mime_type_from_name;
-
-
#include "sun_nio_fs_GnomeFileTypeDetector.h"
@@ -127,7 +120,7 @@
}
JNIEXPORT jbyteArray JNICALL
-Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio
+Java_sun_nio_fs_GnomeFileTypeDetector_probeGio
(JNIEnv* env, jclass this, jlong pathAddress)
{
char* path = (char*)jlong_to_ptr(pathAddress);
@@ -153,52 +146,3 @@
return result;
}
-
-JNIEXPORT jboolean JNICALL
-Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs
- (JNIEnv* env, jclass this)
-{
- void* vfs_handle;
-
- vfs_handle = dlopen("libgnomevfs-2.so", RTLD_LAZY);
- if (vfs_handle == NULL) {
- vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY);
- }
- if (vfs_handle == NULL) {
- return JNI_FALSE;
- }
-
- gnome_vfs_init = (gnome_vfs_init_function)dlsym(vfs_handle, "gnome_vfs_init");
- gnome_vfs_mime_type_from_name = (gnome_vfs_mime_type_from_name_function)
- dlsym(vfs_handle, "gnome_vfs_mime_type_from_name");
-
- if (gnome_vfs_init == NULL ||
- gnome_vfs_mime_type_from_name == NULL)
- {
- dlclose(vfs_handle);
- return JNI_FALSE;
- }
-
- (*gnome_vfs_init)();
- return JNI_TRUE;
-}
-
-JNIEXPORT jbyteArray JNICALL
-Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs
- (JNIEnv* env, jclass this, jlong pathAddress)
-{
- char* path = (char*)jlong_to_ptr(pathAddress);
- const char* mime = (*gnome_vfs_mime_type_from_name)(path);
-
- if (mime == NULL) {
- return NULL;
- } else {
- jbyteArray result;
- jsize len = strlen(mime);
- result = (*env)->NewByteArray(env, len);
- if (result != NULL) {
- (*env)->SetByteArrayRegion(env, result, 0, len, (jbyte*)mime);
- }
- return result;
- }
-}
--- a/jdk/src/java.logging/share/classes/java/util/logging/ConsoleHandler.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/ConsoleHandler.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,25 +27,25 @@
package java.util.logging;
/**
- * This <tt>Handler</tt> publishes log records to <tt>System.err</tt>.
- * By default the <tt>SimpleFormatter</tt> is used to generate brief summaries.
+ * This {@code Handler} publishes log records to {@code System.err}.
+ * By default the {@code SimpleFormatter} is used to generate brief summaries.
* <p>
* <b>Configuration:</b>
- * By default each <tt>ConsoleHandler</tt> is initialized using the following
- * <tt>LogManager</tt> configuration properties where {@code <handler-name>}
+ * By default each {@code ConsoleHandler} is initialized using the following
+ * {@code LogManager} configuration properties where {@code <handler-name>}
* refers to the fully-qualified class name of the handler.
* If properties are not defined
* (or have invalid values) then the specified default values are used.
* <ul>
* <li> <handler-name>.level
- * specifies the default level for the <tt>Handler</tt>
- * (defaults to <tt>Level.INFO</tt>). </li>
+ * specifies the default level for the {@code Handler}
+ * (defaults to {@code Level.INFO}). </li>
* <li> <handler-name>.filter
- * specifies the name of a <tt>Filter</tt> class to use
- * (defaults to no <tt>Filter</tt>). </li>
+ * specifies the name of a {@code Filter} class to use
+ * (defaults to no {@code Filter}). </li>
* <li> <handler-name>.formatter
- * specifies the name of a <tt>Formatter</tt> class to use
- * (defaults to <tt>java.util.logging.SimpleFormatter</tt>). </li>
+ * specifies the name of a {@code Formatter} class to use
+ * (defaults to {@code java.util.logging.SimpleFormatter}). </li>
* <li> <handler-name>.encoding
* the name of the character set encoding to use (defaults to
* the default platform encoding). </li>
@@ -68,10 +68,10 @@
public class ConsoleHandler extends StreamHandler {
/**
- * Create a <tt>ConsoleHandler</tt> for <tt>System.err</tt>.
+ * Create a {@code ConsoleHandler} for {@code System.err}.
* <p>
- * The <tt>ConsoleHandler</tt> is configured based on
- * <tt>LogManager</tt> properties (or their default values).
+ * The {@code ConsoleHandler} is configured based on
+ * {@code LogManager} properties (or their default values).
*
*/
public ConsoleHandler() {
@@ -82,10 +82,10 @@
}
/**
- * Publish a <tt>LogRecord</tt>.
+ * Publish a {@code LogRecord}.
* <p>
- * The logging request was made initially to a <tt>Logger</tt> object,
- * which initialized the <tt>LogRecord</tt> and forwarded it here.
+ * The logging request was made initially to a {@code Logger} object,
+ * which initialized the {@code LogRecord} and forwarded it here.
*
* @param record description of the log event. A null record is
* silently ignored and is not published
@@ -97,9 +97,9 @@
}
/**
- * Override <tt>StreamHandler.close</tt> to do a flush but not
+ * Override {@code StreamHandler.close} to do a flush but not
* to close the output stream. That is, we do <b>not</b>
- * close <tt>System.err</tt>.
+ * close {@code System.err}.
*/
@Override
public void close() {
--- a/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/FileHandler.java Wed Jul 05 20:44:51 2017 +0200
@@ -48,9 +48,9 @@
import java.util.Set;
/**
- * Simple file logging <tt>Handler</tt>.
+ * Simple file logging {@code Handler}.
* <p>
- * The <tt>FileHandler</tt> can either write to a specified file,
+ * The {@code FileHandler} can either write to a specified file,
* or it can write to a rotating set of files.
* <p>
* For a rotating set of files, as each file reaches a given size
@@ -61,24 +61,24 @@
* By default buffering is enabled in the IO libraries but each log
* record is flushed out when it is complete.
* <p>
- * By default the <tt>XMLFormatter</tt> class is used for formatting.
+ * By default the {@code XMLFormatter} class is used for formatting.
* <p>
* <b>Configuration:</b>
- * By default each <tt>FileHandler</tt> is initialized using the following
- * <tt>LogManager</tt> configuration properties where <tt><handler-name></tt>
+ * By default each {@code FileHandler} is initialized using the following
+ * {@code LogManager} configuration properties where {@code <handler-name>}
* refers to the fully-qualified class name of the handler.
* If properties are not defined
* (or have invalid values) then the specified default values are used.
* <ul>
* <li> <handler-name>.level
- * specifies the default level for the <tt>Handler</tt>
- * (defaults to <tt>Level.ALL</tt>). </li>
+ * specifies the default level for the {@code Handler}
+ * (defaults to {@code Level.ALL}). </li>
* <li> <handler-name>.filter
- * specifies the name of a <tt>Filter</tt> class to use
- * (defaults to no <tt>Filter</tt>). </li>
+ * specifies the name of a {@code Filter} class to use
+ * (defaults to no {@code Filter}). </li>
* <li> <handler-name>.formatter
- * specifies the name of a <tt>Formatter</tt> class to use
- * (defaults to <tt>java.util.logging.XMLFormatter</tt>) </li>
+ * specifies the name of a {@code Formatter} class to use
+ * (defaults to {@code java.util.logging.XMLFormatter}) </li>
* <li> <handler-name>.encoding
* the name of the character set encoding to use (defaults to
* the default platform encoding). </li>
@@ -129,10 +129,10 @@
* <p>
* Generation numbers follow the sequence 0, 1, 2, etc.
* <p>
- * Normally the "%u" unique field is set to 0. However, if the <tt>FileHandler</tt>
+ * Normally the "%u" unique field is set to 0. However, if the {@code FileHandler}
* tries to open the filename and finds the file is currently in use by
* another process it will increment the unique number field and try
- * again. This will be repeated until <tt>FileHandler</tt> finds a file name that
+ * again. This will be repeated until {@code FileHandler} finds a file name that
* is not currently in use. If there is a conflict and no "%u" field has
* been specified, it will be added at the end of the filename after a dot.
* (This will be after any automatically added generation number.)
@@ -249,12 +249,12 @@
/**
- * Construct a default <tt>FileHandler</tt>. This will be configured
- * entirely from <tt>LogManager</tt> properties (or their default values).
+ * Construct a default {@code FileHandler}. This will be configured
+ * entirely from {@code LogManager} properties (or their default values).
*
* @exception IOException if there are IO problems opening the files.
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control"))</tt>.
+ * the caller does not have {@code LoggingPermission("control"))}.
* @exception NullPointerException if pattern property is an empty String.
*/
public FileHandler() throws IOException, SecurityException {
@@ -269,9 +269,9 @@
}
/**
- * Initialize a <tt>FileHandler</tt> to write to the given filename.
+ * Initialize a {@code FileHandler} to write to the given filename.
* <p>
- * The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt>
+ * The {@code FileHandler} is configured based on {@code LogManager}
* properties (or their default values) except that the given pattern
* argument is used as the filename pattern, the file limit is
* set to no limit, and the file count is set to one.
@@ -282,7 +282,7 @@
* @param pattern the name of the output file
* @exception IOException if there are IO problems opening the files.
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
* @exception IllegalArgumentException if pattern is an empty string
*/
public FileHandler(String pattern) throws IOException, SecurityException {
@@ -298,14 +298,14 @@
}
/**
- * Initialize a <tt>FileHandler</tt> to write to the given filename,
+ * Initialize a {@code FileHandler} to write to the given filename,
* with optional append.
* <p>
- * The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt>
+ * The {@code FileHandler} is configured based on {@code LogManager}
* properties (or their default values) except that the given pattern
* argument is used as the filename pattern, the file limit is
* set to no limit, the file count is set to one, and the append
- * mode is set to the given <tt>append</tt> argument.
+ * mode is set to the given {@code append} argument.
* <p>
* There is no limit on the amount of data that may be written,
* so use this with care.
@@ -314,7 +314,7 @@
* @param append specifies append mode
* @exception IOException if there are IO problems opening the files.
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
* @exception IllegalArgumentException if pattern is an empty string
*/
public FileHandler(String pattern, boolean append) throws IOException,
@@ -332,12 +332,12 @@
}
/**
- * Initialize a <tt>FileHandler</tt> to write to a set of files. When
+ * Initialize a {@code FileHandler} to write to a set of files. When
* (approximately) the given limit has been written to one file,
* another file will be opened. The output will cycle through a set
* of count files.
* <p>
- * The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt>
+ * The {@code FileHandler} is configured based on {@code LogManager}
* properties (or their default values) except that the given pattern
* argument is used as the filename pattern, the file limit is
* set to the limit argument, and the file count is set to the
@@ -350,7 +350,7 @@
* @param count the number of files to use
* @exception IOException if there are IO problems opening the files.
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
* @exception IllegalArgumentException if {@code limit < 0}, or {@code count < 1}.
* @exception IllegalArgumentException if pattern is an empty string
*/
@@ -368,17 +368,17 @@
}
/**
- * Initialize a <tt>FileHandler</tt> to write to a set of files
+ * Initialize a {@code FileHandler} to write to a set of files
* with optional append. When (approximately) the given limit has
* been written to one file, another file will be opened. The
* output will cycle through a set of count files.
* <p>
- * The <tt>FileHandler</tt> is configured based on <tt>LogManager</tt>
+ * The {@code FileHandler} is configured based on {@code LogManager}
* properties (or their default values) except that the given pattern
* argument is used as the filename pattern, the file limit is
* set to the limit argument, and the file count is set to the
* given count argument, and the append mode is set to the given
- * <tt>append</tt> argument.
+ * {@code append} argument.
* <p>
* The count must be at least 1.
*
@@ -388,7 +388,7 @@
* @param append specifies append mode
* @exception IOException if there are IO problems opening the files.
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
* @exception IllegalArgumentException if {@code limit < 0}, or {@code count < 1}.
* @exception IllegalArgumentException if pattern is an empty string
*
@@ -711,7 +711,7 @@
}
/**
- * Format and publish a <tt>LogRecord</tt>.
+ * Format and publish a {@code LogRecord}.
*
* @param record description of the log event. A null record is
* silently ignored and is not published
@@ -743,7 +743,7 @@
* Close all the files.
*
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
@Override
public synchronized void close() throws SecurityException {
--- a/jdk/src/java.logging/share/classes/java/util/logging/Handler.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Handler.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,18 +32,18 @@
import java.security.PrivilegedAction;
/**
- * A <tt>Handler</tt> object takes log messages from a <tt>Logger</tt> and
+ * A {@code Handler} object takes log messages from a {@code Logger} and
* exports them. It might for example, write them to a console
* or write them to a file, or send them to a network logging service,
* or forward them to an OS log, or whatever.
* <p>
- * A <tt>Handler</tt> can be disabled by doing a <tt>setLevel(Level.OFF)</tt>
- * and can be re-enabled by doing a <tt>setLevel</tt> with an appropriate level.
+ * A {@code Handler} can be disabled by doing a {@code setLevel(Level.OFF)}
+ * and can be re-enabled by doing a {@code setLevel} with an appropriate level.
* <p>
- * <tt>Handler</tt> classes typically use <tt>LogManager</tt> properties to set
- * default values for the <tt>Handler</tt>'s <tt>Filter</tt>, <tt>Formatter</tt>,
- * and <tt>Level</tt>. See the specific documentation for each concrete
- * <tt>Handler</tt> class.
+ * {@code Handler} classes typically use {@code LogManager} properties to set
+ * default values for the {@code Handler}'s {@code Filter}, {@code Formatter},
+ * and {@code Level}. See the specific documentation for each concrete
+ * {@code Handler} class.
*
*
* @since 1.4
@@ -67,10 +67,10 @@
private volatile String encoding;
/**
- * Default constructor. The resulting <tt>Handler</tt> has a log
- * level of <tt>Level.ALL</tt>, no <tt>Formatter</tt>, and no
- * <tt>Filter</tt>. A default <tt>ErrorManager</tt> instance is installed
- * as the <tt>ErrorManager</tt>.
+ * Default constructor. The resulting {@code Handler} has a log
+ * level of {@code Level.ALL}, no {@code Formatter}, and no
+ * {@code Filter}. A default {@code ErrorManager} instance is installed
+ * as the {@code ErrorManager}.
*/
protected Handler() {
}
@@ -122,12 +122,12 @@
}
/**
- * Publish a <tt>LogRecord</tt>.
+ * Publish a {@code LogRecord}.
* <p>
- * The logging request was made initially to a <tt>Logger</tt> object,
- * which initialized the <tt>LogRecord</tt> and forwarded it here.
+ * The logging request was made initially to a {@code Logger} object,
+ * which initialized the {@code LogRecord} and forwarded it here.
* <p>
- * The <tt>Handler</tt> is responsible for formatting the message, when and
+ * The {@code Handler} is responsible for formatting the message, when and
* if necessary. The formatting should include localization.
*
* @param record description of the log event. A null record is
@@ -141,28 +141,28 @@
public abstract void flush();
/**
- * Close the <tt>Handler</tt> and free all associated resources.
+ * Close the {@code Handler} and free all associated resources.
* <p>
- * The close method will perform a <tt>flush</tt> and then close the
- * <tt>Handler</tt>. After close has been called this <tt>Handler</tt>
+ * The close method will perform a {@code flush} and then close the
+ * {@code Handler}. After close has been called this {@code Handler}
* should no longer be used. Method calls may either be silently
* ignored or may throw runtime exceptions.
*
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
public abstract void close() throws SecurityException;
/**
- * Set a <tt>Formatter</tt>. This <tt>Formatter</tt> will be used
- * to format <tt>LogRecords</tt> for this <tt>Handler</tt>.
+ * Set a {@code Formatter}. This {@code Formatter} will be used
+ * to format {@code LogRecords} for this {@code Handler}.
* <p>
- * Some <tt>Handlers</tt> may not use <tt>Formatters</tt>, in
- * which case the <tt>Formatter</tt> will be remembered, but not used.
+ * Some {@code Handlers} may not use {@code Formatters}, in
+ * which case the {@code Formatter} will be remembered, but not used.
*
- * @param newFormatter the <tt>Formatter</tt> to use (may not be null)
+ * @param newFormatter the {@code Formatter} to use (may not be null)
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
public synchronized void setFormatter(Formatter newFormatter) throws SecurityException {
checkPermission();
@@ -170,23 +170,23 @@
}
/**
- * Return the <tt>Formatter</tt> for this <tt>Handler</tt>.
- * @return the <tt>Formatter</tt> (may be null).
+ * Return the {@code Formatter} for this {@code Handler}.
+ * @return the {@code Formatter} (may be null).
*/
public Formatter getFormatter() {
return formatter;
}
/**
- * Set the character encoding used by this <tt>Handler</tt>.
+ * Set the character encoding used by this {@code Handler}.
* <p>
- * The encoding should be set before any <tt>LogRecords</tt> are written
- * to the <tt>Handler</tt>.
+ * The encoding should be set before any {@code LogRecords} are written
+ * to the {@code Handler}.
*
* @param encoding The name of a supported character encoding.
* May be null, to indicate the default platform encoding.
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
* @exception UnsupportedEncodingException if the named encoding is
* not supported.
*/
@@ -206,7 +206,7 @@
}
/**
- * Return the character encoding for this <tt>Handler</tt>.
+ * Return the character encoding for this {@code Handler}.
*
* @return The encoding name. May be null, which indicates the
* default encoding should be used.
@@ -216,15 +216,15 @@
}
/**
- * Set a <tt>Filter</tt> to control output on this <tt>Handler</tt>.
+ * Set a {@code Filter} to control output on this {@code Handler}.
* <P>
- * For each call of <tt>publish</tt> the <tt>Handler</tt> will call
- * this <tt>Filter</tt> (if it is non-null) to check if the
- * <tt>LogRecord</tt> should be published or discarded.
+ * For each call of {@code publish} the {@code Handler} will call
+ * this {@code Filter} (if it is non-null) to check if the
+ * {@code LogRecord} should be published or discarded.
*
- * @param newFilter a <tt>Filter</tt> object (may be null)
+ * @param newFilter a {@code Filter} object (may be null)
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
public synchronized void setFilter(Filter newFilter) throws SecurityException {
checkPermission();
@@ -232,9 +232,9 @@
}
/**
- * Get the current <tt>Filter</tt> for this <tt>Handler</tt>.
+ * Get the current {@code Filter} for this {@code Handler}.
*
- * @return a <tt>Filter</tt> object (may be null)
+ * @return a {@code Filter} object (may be null)
*/
public Filter getFilter() {
return filter;
@@ -248,7 +248,7 @@
*
* @param em the new ErrorManager
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
public synchronized void setErrorManager(ErrorManager em) {
checkPermission();
@@ -263,7 +263,7 @@
*
* @return the ErrorManager for this Handler
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
public ErrorManager getErrorManager() {
checkPermission();
@@ -291,16 +291,16 @@
/**
* Set the log level specifying which message levels will be
- * logged by this <tt>Handler</tt>. Message levels lower than this
+ * logged by this {@code Handler}. Message levels lower than this
* value will be discarded.
* <p>
* The intention is to allow developers to turn on voluminous
* logging, but to limit the messages that are sent to certain
- * <tt>Handlers</tt>.
+ * {@code Handlers}.
*
* @param newLevel the new value for the log level
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
public synchronized void setLevel(Level newLevel) throws SecurityException {
if (newLevel == null) {
@@ -312,7 +312,7 @@
/**
* Get the log level specifying which messages will be
- * logged by this <tt>Handler</tt>. Message levels lower
+ * logged by this {@code Handler}. Message levels lower
* than this level will be discarded.
* @return the level of messages being logged.
*/
@@ -321,16 +321,16 @@
}
/**
- * Check if this <tt>Handler</tt> would actually log a given <tt>LogRecord</tt>.
+ * Check if this {@code Handler} would actually log a given {@code LogRecord}.
* <p>
- * This method checks if the <tt>LogRecord</tt> has an appropriate
- * <tt>Level</tt> and whether it satisfies any <tt>Filter</tt>. It also
- * may make other <tt>Handler</tt> specific checks that might prevent a
- * handler from logging the <tt>LogRecord</tt>. It will return false if
- * the <tt>LogRecord</tt> is null.
+ * This method checks if the {@code LogRecord} has an appropriate
+ * {@code Level} and whether it satisfies any {@code Filter}. It also
+ * may make other {@code Handler} specific checks that might prevent a
+ * handler from logging the {@code LogRecord}. It will return false if
+ * the {@code LogRecord} is null.
*
- * @param record a <tt>LogRecord</tt>
- * @return true if the <tt>LogRecord</tt> would be logged.
+ * @param record a {@code LogRecord}
+ * @return true if the {@code LogRecord} would be logged.
*
*/
public boolean isLoggable(LogRecord record) {
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java Wed Jul 05 20:44:51 2017 +0200
@@ -72,7 +72,7 @@
* loaded, an object will be instantiated, and that object's constructor
* is responsible for reading in the initial configuration. (That object
* may use other system properties to control its configuration.) The
- * alternate configuration class can use <tt>readConfiguration(InputStream)</tt>
+ * alternate configuration class can use {@code readConfiguration(InputStream)}
* to define properties in the LogManager.
* <p>
* If "java.util.logging.config.class" property is <b>not</b> set,
@@ -353,7 +353,8 @@
// see that initializationDone is still false, and perform the
// initialization.
//
- synchronized(this) {
+ configurationLock.lock();
+ try {
// If initializedCalled is true it means that we're already in
// the process of initializing the LogManager in this thread.
// There has been a recursive call to ensureLogManagerInitialized().
@@ -409,6 +410,8 @@
} finally {
initializationDone = true;
}
+ } finally {
+ configurationLock.unlock();
}
}
@@ -423,33 +426,22 @@
return manager;
}
- private void readPrimordialConfiguration() {
+ private void readPrimordialConfiguration() { // must be called while holding configurationLock
if (!readPrimordialConfiguration) {
- synchronized (this) {
- if (!readPrimordialConfiguration) {
- // If System.in/out/err are null, it's a good
- // indication that we're still in the
- // bootstrapping phase
- if (System.out == null) {
- return;
- }
- readPrimordialConfiguration = true;
+ // If System.in/out/err are null, it's a good
+ // indication that we're still in the
+ // bootstrapping phase
+ if (System.out == null) {
+ return;
+ }
+ readPrimordialConfiguration = true;
+ try {
+ readConfiguration();
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() {
- @Override
- public Void run() throws Exception {
- readConfiguration();
-
- // Platform loggers begin to delegate to java.util.logging.Logger
- sun.util.logging.PlatformLogger.redirectPlatformLoggers();
- return null;
- }
- });
- } catch (Exception ex) {
- assert false : "Exception raised while reading logging configuration: " + ex;
- }
- }
+ // Platform loggers begin to delegate to java.util.logging.Logger
+ sun.util.logging.PlatformLogger.redirectPlatformLoggers();
+ } catch (Exception ex) {
+ assert false : "Exception raised while reading logging configuration: " + ex;
}
}
}
@@ -1808,7 +1800,7 @@
= "java.util.logging:type=Logging";
/**
- * Returns <tt>LoggingMXBean</tt> for managing loggers.
+ * Returns {@code LoggingMXBean} for managing loggers.
* An alternative way to manage loggers is through the
* {@link java.lang.management.PlatformLoggingMXBean} interface
* that can be obtained by calling:
--- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java Wed Jul 05 20:44:51 2017 +0200
@@ -65,7 +65,7 @@
* <p>
* Each Logger has a "Level" associated with it. This reflects
* a minimum Level that this logger cares about. If a Logger's
- * level is set to <tt>null</tt>, then its effective level is inherited
+ * level is set to {@code null}, then its effective level is inherited
* from its parent, which may in turn obtain it recursively from its
* parent, and so on up the tree.
* <p>
@@ -74,7 +74,7 @@
* of the LogManager class. However it may also be dynamically changed
* by calls on the Logger.setLevel method. If a logger's level is
* changed the change may also affect child loggers, since any child
- * logger that has <tt>null</tt> as its level will inherit its
+ * logger that has {@code null} as its level will inherit its
* effective level from its parent.
* <p>
* On each logging call the Logger initially performs a cheap
@@ -116,25 +116,25 @@
* unnecessary message construction. For example, if the developer wants to
* log system health status for diagnosis, with the String-accepting version,
* the code would look like:
- <pre><code>
-
- class DiagnosisMessages {
- static String systemHealthStatus() {
- // collect system health information
- ...
- }
- }
- ...
- logger.log(Level.FINER, DiagnosisMessages.systemHealthStatus());
-</code></pre>
+ * <pre>{@code
+ *
+ * class DiagnosisMessages {
+ * static String systemHealthStatus() {
+ * // collect system health information
+ * ...
+ * }
+ * }
+ * ...
+ * logger.log(Level.FINER, DiagnosisMessages.systemHealthStatus());
+ * }</pre>
* With the above code, the health status is collected unnecessarily even when
* the log level FINER is disabled. With the Supplier-accepting version as
* below, the status will only be collected when the log level FINER is
* enabled.
- <pre><code>
-
- logger.log(Level.FINER, DiagnosisMessages::systemHealthStatus);
-</code></pre>
+ * <pre>{@code
+ *
+ * logger.log(Level.FINER, DiagnosisMessages::systemHealthStatus);
+ * }</pre>
* <p>
* When looking for a {@code ResourceBundle}, the logger will first look at
* whether a bundle was specified using {@link
@@ -345,11 +345,11 @@
* which may cause deadlocks with the LogManager class initialization.
* In such cases two class initialization wait for each other to complete.
* The preferred way to get the global logger object is via the call
- * <code>Logger.getGlobal()</code>.
+ * {@code Logger.getGlobal()}.
* For compatibility with old JDK versions where the
- * <code>Logger.getGlobal()</code> is not available use the call
- * <code>Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)</code>
- * or <code>Logger.getLogger("global")</code>.
+ * {@code Logger.getGlobal()} is not available use the call
+ * {@code Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)}
+ * or {@code Logger.getLogger("global")}.
*/
@Deprecated
public static final Logger global = new Logger(GLOBAL_LOGGER_NAME);
--- a/jdk/src/java.logging/share/classes/java/util/logging/Logging.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Logging.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,7 +32,7 @@
/**
* Logging is the implementation class of LoggingMXBean.
*
- * The <tt>LoggingMXBean</tt> interface provides a standard
+ * The {@code LoggingMXBean} interface provides a standard
* method for management access to the individual
* {@code Logger} objects available at runtime.
*
--- a/jdk/src/java.logging/share/classes/java/util/logging/LoggingMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LoggingMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,12 +36,12 @@
* the {@code PlatformLoggingMXBean} object representing the management
* interface for logging.
*
- * <p>There is a single global instance of the <tt>LoggingMXBean</tt>.
+ * <p>There is a single global instance of the {@code LoggingMXBean}.
* This instance is an {@link javax.management.MXBean MXBean} that
* can be obtained by calling the {@link LogManager#getLoggingMXBean}
* method or from the
* {@linkplain java.lang.management.ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>}.
+ * platform MBeanServer}.
* <p>
* The {@link javax.management.ObjectName ObjectName} that uniquely identifies
* the management interface for logging within the {@code MBeanServer} is:
@@ -65,14 +65,14 @@
* calls {@link LogManager#getLoggerNames} and returns a list
* of the logger names.
*
- * @return A list of <tt>String</tt> each of which is a
- * currently registered <tt>Logger</tt> name.
+ * @return A list of {@code String} each of which is a
+ * currently registered {@code Logger} name.
*/
public java.util.List<String> getLoggerNames();
/**
* Gets the name of the log level associated with the specified logger.
- * If the specified logger does not exist, <tt>null</tt>
+ * If the specified logger does not exist, {@code null}
* is returned.
* This method first finds the logger of the given name and
* then returns the name of the log level by calling:
@@ -81,16 +81,16 @@
* </blockquote>
*
* <p>
- * If the <tt>Level</tt> of the specified logger is <tt>null</tt>,
+ * If the {@code Level} of the specified logger is {@code null},
* which means that this logger's effective level is inherited
* from its parent, an empty string will be returned.
*
- * @param loggerName The name of the <tt>Logger</tt> to be retrieved.
+ * @param loggerName The name of the {@code Logger} to be retrieved.
*
* @return The name of the log level of the specified logger; or
* an empty string if the log level of the specified logger
- * is <tt>null</tt>. If the specified logger does not
- * exist, <tt>null</tt> is returned.
+ * is {@code null}. If the specified logger does not
+ * exist, {@code null} is returned.
*
* @see Logger#getLevel
*/
@@ -98,22 +98,22 @@
/**
* Sets the specified logger to the specified new level.
- * If the <tt>levelName</tt> is not <tt>null</tt>, the level
- * of the specified logger is set to the parsed <tt>Level</tt>
- * matching the <tt>levelName</tt>.
- * If the <tt>levelName</tt> is <tt>null</tt>, the level
- * of the specified logger is set to <tt>null</tt> and
+ * If the {@code levelName} is not {@code null}, the level
+ * of the specified logger is set to the parsed {@code Level}
+ * matching the {@code levelName}.
+ * If the {@code levelName} is {@code null}, the level
+ * of the specified logger is set to {@code null} and
* the effective level of the logger is inherited from
* its nearest ancestor with a specific (non-null) level value.
*
- * @param loggerName The name of the <tt>Logger</tt> to be set.
+ * @param loggerName The name of the {@code Logger} to be set.
* Must be non-null.
* @param levelName The name of the level to set on the specified logger,
- * or <tt>null</tt> if setting the level to inherit
+ * or {@code null} if setting the level to inherit
* from its nearest ancestor.
*
* @throws IllegalArgumentException if the specified logger
- * does not exist, or <tt>levelName</tt> is not a valid level name.
+ * does not exist, or {@code levelName} is not a valid level name.
*
* @throws SecurityException if a security manager exists and if
* the caller does not have LoggingPermission("control").
@@ -124,15 +124,15 @@
/**
* Returns the name of the parent for the specified logger.
- * If the specified logger does not exist, <tt>null</tt> is returned.
- * If the specified logger is the root <tt>Logger</tt> in the namespace,
+ * If the specified logger does not exist, {@code null} is returned.
+ * If the specified logger is the root {@code Logger} in the namespace,
* the result will be an empty string.
*
- * @param loggerName The name of a <tt>Logger</tt>.
+ * @param loggerName The name of a {@code Logger}.
*
* @return the name of the nearest existing parent logger;
* an empty string if the specified logger is the root logger.
- * If the specified logger does not exist, <tt>null</tt>
+ * If the specified logger does not exist, {@code null}
* is returned.
*/
public String getParentLoggerName(String loggerName);
--- a/jdk/src/java.logging/share/classes/java/util/logging/MemoryHandler.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/MemoryHandler.java Wed Jul 05 20:44:51 2017 +0200
@@ -26,48 +26,48 @@
package java.util.logging;
/**
- * <tt>Handler</tt> that buffers requests in a circular buffer in memory.
+ * {@code Handler} that buffers requests in a circular buffer in memory.
* <p>
- * Normally this <tt>Handler</tt> simply stores incoming <tt>LogRecords</tt>
+ * Normally this {@code Handler} simply stores incoming {@code LogRecords}
* into its memory buffer and discards earlier records. This buffering
* is very cheap and avoids formatting costs. On certain trigger
- * conditions, the <tt>MemoryHandler</tt> will push out its current buffer
- * contents to a target <tt>Handler</tt>, which will typically publish
+ * conditions, the {@code MemoryHandler} will push out its current buffer
+ * contents to a target {@code Handler}, which will typically publish
* them to the outside world.
* <p>
* There are three main models for triggering a push of the buffer:
* <ul>
* <li>
- * An incoming <tt>LogRecord</tt> has a type that is greater than
- * a pre-defined level, the <tt>pushLevel</tt>. </li>
+ * An incoming {@code LogRecord} has a type that is greater than
+ * a pre-defined level, the {@code pushLevel}. </li>
* <li>
- * An external class calls the <tt>push</tt> method explicitly. </li>
+ * An external class calls the {@code push} method explicitly. </li>
* <li>
- * A subclass overrides the <tt>log</tt> method and scans each incoming
- * <tt>LogRecord</tt> and calls <tt>push</tt> if a record matches some
+ * A subclass overrides the {@code log} method and scans each incoming
+ * {@code LogRecord} and calls {@code push} if a record matches some
* desired criteria. </li>
* </ul>
* <p>
* <b>Configuration:</b>
- * By default each <tt>MemoryHandler</tt> is initialized using the following
- * <tt>LogManager</tt> configuration properties where <tt><handler-name></tt>
+ * By default each {@code MemoryHandler} is initialized using the following
+ * {@code LogManager} configuration properties where {@code <handler-name>}
* refers to the fully-qualified class name of the handler.
* If properties are not defined
* (or have invalid values) then the specified default values are used.
* If no default value is defined then a RuntimeException is thrown.
* <ul>
* <li> <handler-name>.level
- * specifies the level for the <tt>Handler</tt>
- * (defaults to <tt>Level.ALL</tt>). </li>
+ * specifies the level for the {@code Handler}
+ * (defaults to {@code Level.ALL}). </li>
* <li> <handler-name>.filter
- * specifies the name of a <tt>Filter</tt> class to use
- * (defaults to no <tt>Filter</tt>). </li>
+ * specifies the name of a {@code Filter} class to use
+ * (defaults to no {@code Filter}). </li>
* <li> <handler-name>.size
* defines the buffer size (defaults to 1000). </li>
* <li> <handler-name>.push
- * defines the <tt>pushLevel</tt> (defaults to <tt>level.SEVERE</tt>). </li>
+ * defines the {@code pushLevel} (defaults to {@code level.SEVERE}). </li>
* <li> <handler-name>.target
- * specifies the name of the target <tt>Handler </tt> class.
+ * specifies the name of the target {@code Handler } class.
* (no default). </li>
* </ul>
* <p>
@@ -95,8 +95,8 @@
int start, count;
/**
- * Create a <tt>MemoryHandler</tt> and configure it based on
- * <tt>LogManager</tt> configuration properties.
+ * Create a {@code MemoryHandler} and configure it based on
+ * {@code LogManager} configuration properties.
*/
public MemoryHandler() {
// configure with specific defaults for MemoryHandler
@@ -132,10 +132,10 @@
}
/**
- * Create a <tt>MemoryHandler</tt>.
+ * Create a {@code MemoryHandler}.
* <p>
- * The <tt>MemoryHandler</tt> is configured based on <tt>LogManager</tt>
- * properties (or their default values) except that the given <tt>pushLevel</tt>
+ * The {@code MemoryHandler} is configured based on {@code LogManager}
+ * properties (or their default values) except that the given {@code pushLevel}
* argument and buffer size argument are used.
*
* @param target the Handler to which to publish output.
@@ -161,16 +161,16 @@
}
/**
- * Store a <tt>LogRecord</tt> in an internal buffer.
+ * Store a {@code LogRecord} in an internal buffer.
* <p>
- * If there is a <tt>Filter</tt>, its <tt>isLoggable</tt>
+ * If there is a {@code Filter}, its {@code isLoggable}
* method is called to check if the given log record is loggable.
* If not we return. Otherwise the given record is copied into
* an internal circular buffer. Then the record's level property is
- * compared with the <tt>pushLevel</tt>. If the given level is
- * greater than or equal to the <tt>pushLevel</tt> then <tt>push</tt>
+ * compared with the {@code pushLevel}. If the given level is
+ * greater than or equal to the {@code pushLevel} then {@code push}
* is called to write all buffered records to the target output
- * <tt>Handler</tt>.
+ * {@code Handler}.
*
* @param record description of the log event. A null record is
* silently ignored and is not published
@@ -194,7 +194,7 @@
}
/**
- * Push any buffered output to the target <tt>Handler</tt>.
+ * Push any buffered output to the target {@code Handler}.
* <p>
* The buffer is then cleared.
*/
@@ -210,9 +210,9 @@
}
/**
- * Causes a flush on the target <tt>Handler</tt>.
+ * Causes a flush on the target {@code Handler}.
* <p>
- * Note that the current contents of the <tt>MemoryHandler</tt>
+ * Note that the current contents of the {@code MemoryHandler}
* buffer are <b>not</b> written out. That requires a "push".
*/
@Override
@@ -221,11 +221,11 @@
}
/**
- * Close the <tt>Handler</tt> and free all associated resources.
- * This will also close the target <tt>Handler</tt>.
+ * Close the {@code Handler} and free all associated resources.
+ * This will also close the target {@code Handler}.
*
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
@Override
public void close() throws SecurityException {
@@ -234,13 +234,13 @@
}
/**
- * Set the <tt>pushLevel</tt>. After a <tt>LogRecord</tt> is copied
+ * Set the {@code pushLevel}. After a {@code LogRecord} is copied
* into our internal buffer, if its level is greater than or equal to
- * the <tt>pushLevel</tt>, then <tt>push</tt> will be called.
+ * the {@code pushLevel}, then {@code push} will be called.
*
- * @param newLevel the new value of the <tt>pushLevel</tt>
+ * @param newLevel the new value of the {@code pushLevel}
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
public synchronized void setPushLevel(Level newLevel) throws SecurityException {
if (newLevel == null) {
@@ -251,25 +251,25 @@
}
/**
- * Get the <tt>pushLevel</tt>.
+ * Get the {@code pushLevel}.
*
- * @return the value of the <tt>pushLevel</tt>
+ * @return the value of the {@code pushLevel}
*/
public Level getPushLevel() {
return pushLevel;
}
/**
- * Check if this <tt>Handler</tt> would actually log a given
- * <tt>LogRecord</tt> into its internal buffer.
+ * Check if this {@code Handler} would actually log a given
+ * {@code LogRecord} into its internal buffer.
* <p>
- * This method checks if the <tt>LogRecord</tt> has an appropriate level and
- * whether it satisfies any <tt>Filter</tt>. However it does <b>not</b>
- * check whether the <tt>LogRecord</tt> would result in a "push" of the
- * buffer contents. It will return false if the <tt>LogRecord</tt> is null.
+ * This method checks if the {@code LogRecord} has an appropriate level and
+ * whether it satisfies any {@code Filter}. However it does <b>not</b>
+ * check whether the {@code LogRecord} would result in a "push" of the
+ * buffer contents. It will return false if the {@code LogRecord} is null.
*
- * @param record a <tt>LogRecord</tt>
- * @return true if the <tt>LogRecord</tt> would be logged.
+ * @param record a {@code LogRecord}
+ * @return true if the {@code LogRecord} would be logged.
*
*/
@Override
--- a/jdk/src/java.logging/share/classes/java/util/logging/SocketHandler.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/SocketHandler.java Wed Jul 05 20:44:51 2017 +0200
@@ -30,27 +30,27 @@
import java.net.*;
/**
- * Simple network logging <tt>Handler</tt>.
+ * Simple network logging {@code Handler}.
* <p>
- * <tt>LogRecords</tt> are published to a network stream connection. By default
- * the <tt>XMLFormatter</tt> class is used for formatting.
+ * {@code LogRecords} are published to a network stream connection. By default
+ * the {@code XMLFormatter} class is used for formatting.
* <p>
* <b>Configuration:</b>
- * By default each <tt>SocketHandler</tt> is initialized using the following
- * <tt>LogManager</tt> configuration properties where <tt><handler-name></tt>
+ * By default each {@code SocketHandler} is initialized using the following
+ * {@code LogManager} configuration properties where {@code <handler-name>}
* refers to the fully-qualified class name of the handler.
* If properties are not defined
* (or have invalid values) then the specified default values are used.
* <ul>
* <li> <handler-name>.level
- * specifies the default level for the <tt>Handler</tt>
- * (defaults to <tt>Level.ALL</tt>). </li>
+ * specifies the default level for the {@code Handler}
+ * (defaults to {@code Level.ALL}). </li>
* <li> <handler-name>.filter
- * specifies the name of a <tt>Filter</tt> class to use
- * (defaults to no <tt>Filter</tt>). </li>
+ * specifies the name of a {@code Filter} class to use
+ * (defaults to no {@code Filter}). </li>
* <li> <handler-name>.formatter
- * specifies the name of a <tt>Formatter</tt> class to use
- * (defaults to <tt>java.util.logging.XMLFormatter</tt>). </li>
+ * specifies the name of a {@code Formatter} class to use
+ * (defaults to {@code java.util.logging.XMLFormatter}). </li>
* <li> <handler-name>.encoding
* the name of the character set encoding to use (defaults to
* the default platform encoding). </li>
@@ -73,7 +73,7 @@
* </ul>
* <p>
* The output IO stream is buffered, but is flushed after each
- * <tt>LogRecord</tt> is written.
+ * {@code LogRecord} is written.
*
* @since 1.4
*/
@@ -84,7 +84,7 @@
private int port;
/**
- * Create a <tt>SocketHandler</tt>, using only <tt>LogManager</tt> properties
+ * Create a {@code SocketHandler}, using only {@code LogManager} properties
* (or their defaults).
* @throws IllegalArgumentException if the host or port are invalid or
* are not specified as LogManager properties.
@@ -109,9 +109,9 @@
}
/**
- * Construct a <tt>SocketHandler</tt> using a specified host and port.
+ * Construct a {@code SocketHandler} using a specified host and port.
*
- * The <tt>SocketHandler</tt> is configured based on <tt>LogManager</tt>
+ * The {@code SocketHandler} is configured based on {@code LogManager}
* properties (or their default values) except that the given target host
* and port arguments are used. If the host argument is empty, but not
* null String then the localhost is used.
@@ -153,7 +153,7 @@
* Close this output stream.
*
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
@Override
public synchronized void close() throws SecurityException {
@@ -169,7 +169,7 @@
}
/**
- * Format and publish a <tt>LogRecord</tt>.
+ * Format and publish a {@code LogRecord}.
*
* @param record description of the log event. A null record is
* silently ignored and is not published
--- a/jdk/src/java.logging/share/classes/java/util/logging/StreamHandler.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/StreamHandler.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,29 +32,29 @@
import java.util.Objects;
/**
- * Stream based logging <tt>Handler</tt>.
+ * Stream based logging {@code Handler}.
* <p>
* This is primarily intended as a base class or support class to
- * be used in implementing other logging <tt>Handlers</tt>.
+ * be used in implementing other logging {@code Handlers}.
* <p>
- * <tt>LogRecords</tt> are published to a given <tt>java.io.OutputStream</tt>.
+ * {@code LogRecords} are published to a given {@code java.io.OutputStream}.
* <p>
* <b>Configuration:</b>
- * By default each <tt>StreamHandler</tt> is initialized using the following
- * <tt>LogManager</tt> configuration properties where <tt><handler-name></tt>
+ * By default each {@code StreamHandler} is initialized using the following
+ * {@code LogManager} configuration properties where {@code <handler-name>}
* refers to the fully-qualified class name of the handler.
* If properties are not defined
* (or have invalid values) then the specified default values are used.
* <ul>
* <li> <handler-name>.level
- * specifies the default level for the <tt>Handler</tt>
- * (defaults to <tt>Level.INFO</tt>). </li>
+ * specifies the default level for the {@code Handler}
+ * (defaults to {@code Level.INFO}). </li>
* <li> <handler-name>.filter
- * specifies the name of a <tt>Filter</tt> class to use
- * (defaults to no <tt>Filter</tt>). </li>
+ * specifies the name of a {@code Filter} class to use
+ * (defaults to no {@code Filter}). </li>
* <li> <handler-name>.formatter
- * specifies the name of a <tt>Formatter</tt> class to use
- * (defaults to <tt>java.util.logging.SimpleFormatter</tt>). </li>
+ * specifies the name of a {@code Formatter} class to use
+ * (defaults to {@code java.util.logging.SimpleFormatter}). </li>
* <li> <handler-name>.encoding
* the name of the character set encoding to use (defaults to
* the default platform encoding). </li>
@@ -81,7 +81,7 @@
private volatile Writer writer;
/**
- * Create a <tt>StreamHandler</tt>, with no current output stream.
+ * Create a {@code StreamHandler}, with no current output stream.
*/
public StreamHandler() {
// configure with specific defaults for StreamHandler
@@ -89,7 +89,7 @@
}
/**
- * Create a <tt>StreamHandler</tt> with a given <tt>Formatter</tt>
+ * Create a {@code StreamHandler} with a given {@code Formatter}
* and output stream.
*
* @param out the target output stream
@@ -114,13 +114,13 @@
/**
* Change the output stream.
* <P>
- * If there is a current output stream then the <tt>Formatter</tt>'s
+ * If there is a current output stream then the {@code Formatter}'s
* tail string is written and the stream is flushed and closed.
* Then the output stream is replaced with the new output stream.
*
* @param out New output stream. May not be null.
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
*/
protected synchronized void setOutputStream(OutputStream out) throws SecurityException {
if (out == null) {
@@ -144,15 +144,15 @@
}
/**
- * Set (or change) the character encoding used by this <tt>Handler</tt>.
+ * Set (or change) the character encoding used by this {@code Handler}.
* <p>
- * The encoding should be set before any <tt>LogRecords</tt> are written
- * to the <tt>Handler</tt>.
+ * The encoding should be set before any {@code LogRecords} are written
+ * to the {@code Handler}.
*
* @param encoding The name of a supported character encoding.
* May be null, to indicate the default platform encoding.
* @exception SecurityException if a security manager exists and if
- * the caller does not have <tt>LoggingPermission("control")</tt>.
+ * the caller does not have {@code LoggingPermission("control")}.
* @exception UnsupportedEncodingException if the named encoding is
* not supported.
*/
@@ -173,18 +173,18 @@
}
/**
- * Format and publish a <tt>LogRecord</tt>.
+ * Format and publish a {@code LogRecord}.
* <p>
- * The <tt>StreamHandler</tt> first checks if there is an <tt>OutputStream</tt>
- * and if the given <tt>LogRecord</tt> has at least the required log level.
+ * The {@code StreamHandler} first checks if there is an {@code OutputStream}
+ * and if the given {@code LogRecord} has at least the required log level.
* If not it silently returns. If so, it calls any associated
- * <tt>Filter</tt> to check if the record should be published. If so,
- * it calls its <tt>Formatter</tt> to format the record and then writes
+ * {@code Filter} to check if the record should be published. If so,
+ * it calls its {@code Formatter} to format the record and then writes
* the result to the current output stream.
* <p>
- * If this is the first <tt>LogRecord</tt> to be written to a given
- * <tt>OutputStream</tt>, the <tt>Formatter</tt>'s "head" string is
- * written to the stream before the <tt>LogRecord</tt> is written.
+ * If this is the first {@code LogRecord} to be written to a given
+ * {@code OutputStream}, the {@code Formatter}'s "head" string is
+ * written to the stream before the {@code LogRecord} is written.
*
* @param record description of the log event. A null record is
* silently ignored and is not published
@@ -219,14 +219,14 @@
/**
- * Check if this <tt>Handler</tt> would actually log a given <tt>LogRecord</tt>.
+ * Check if this {@code Handler} would actually log a given {@code LogRecord}.
* <p>
- * This method checks if the <tt>LogRecord</tt> has an appropriate level and
- * whether it satisfies any <tt>Filter</tt>. It will also return false if
+ * This method checks if the {@code LogRecord} has an appropriate level and
+ * whether it satisfies any {@code Filter}. It will also return false if
* no output stream has been assigned yet or the LogRecord is null.
*
- * @param record a <tt>LogRecord</tt>
- * @return true if the <tt>LogRecord</tt> would be logged.
+ * @param record a {@code LogRecord}
+ * @return true if the {@code LogRecord} would be logged.
*
*/
@Override
@@ -277,8 +277,8 @@
/**
* Close the current output stream.
* <p>
- * The <tt>Formatter</tt>'s "tail" string is written to the stream before it
- * is closed. In addition, if the <tt>Formatter</tt>'s "head" string has not
+ * The {@code Formatter}'s "tail" string is written to the stream before it
+ * is closed. In addition, if the {@code Formatter}'s "head" string has not
* yet been written to the stream, it will be written before the
* "tail" string.
*
--- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/GetPropertyAction.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/GetPropertyAction.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,7 +28,7 @@
import java.security.PrivilegedAction;
/**
- * Utility class to be used by the method <tt>AccessControler.doPrivileged</tt>
+ * Utility class to be used by the method {@code AccessControler.doPrivileged}
* to get a system property.
*
* @since 1.5
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/util/EnvHelp.java Wed Jul 05 20:44:51 2017 +0200
@@ -177,7 +177,7 @@
* The ClassLoader object found in <var>env</var> for
* <code>jmx.remote.default.class.loader</code>, if any.
* </li>
- * <li>The <tt>Thread.currentThread().getContextClassLoader()</tt>
+ * <li>The {@code Thread.currentThread().getContextClassLoader()}
* otherwise.
* </li>
* </ul>
--- a/jdk/src/java.management/share/classes/java/lang/management/ClassLoadingMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/ClassLoadingMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -35,13 +35,13 @@
* that can be obtained by calling
* the {@link ManagementFactory#getClassLoadingMXBean} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>}.
+ * platform MBeanServer}.
*
- * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
- * the class loading system within an <tt>MBeanServer</tt> is:
+ * <p>The {@code ObjectName} for uniquely identifying the MXBean for
+ * the class loading system within an {@code MBeanServer} is:
* <blockquote>
* {@link ManagementFactory#CLASS_LOADING_MXBEAN_NAME
- * <tt>java.lang:type=ClassLoading</tt>}
+ * java.lang:type=ClassLoading}
* </blockquote>
*
* It can be obtained by calling the
@@ -86,8 +86,8 @@
/**
* Tests if the verbose output for the class loading system is enabled.
*
- * @return <tt>true</tt> if the verbose output for the class loading
- * system is enabled; <tt>false</tt> otherwise.
+ * @return {@code true} if the verbose output for the class loading
+ * system is enabled; {@code false} otherwise.
*/
public boolean isVerbose();
@@ -102,8 +102,8 @@
* Each invocation of this method enables or disables the verbose
* output globally.
*
- * @param value <tt>true</tt> to enable the verbose output;
- * <tt>false</tt> to disable.
+ * @param value {@code true} to enable the verbose output;
+ * {@code false} to disable.
*
* @exception java.lang.SecurityException if a security manager
* exists and the caller does not have
--- a/jdk/src/java.management/share/classes/java/lang/management/CompilationMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/CompilationMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -35,13 +35,13 @@
* that can be obtained by calling
* the {@link ManagementFactory#getCompilationMXBean} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>} method.
+ * platform MBeanServer} method.
*
- * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
+ * <p>The {@code ObjectName} for uniquely identifying the MXBean for
* the compilation system within an MBeanServer is:
* <blockquote>
* {@link ManagementFactory#COMPILATION_MXBEAN_NAME
- * <tt>java.lang:type=Compilation</tt>}
+ * java.lang:type=Compilation}
* </blockquote>
*
* It can be obtained by calling the
@@ -68,8 +68,8 @@
* Tests if the Java virtual machine supports the monitoring of
* compilation time.
*
- * @return <tt>true</tt> if the monitoring of compilation time is
- * supported ; <tt>false</tt> otherwise.
+ * @return {@code true} if the monitoring of compilation time is
+ * supported; {@code false} otherwise.
*/
public boolean isCompilationTimeMonitoringSupported();
--- a/jdk/src/java.management/share/classes/java/lang/management/GarbageCollectorMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/GarbageCollectorMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,13 +39,13 @@
* that can be obtained by calling
* the {@link ManagementFactory#getGarbageCollectorMXBeans} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>} method.
+ * platform MBeanServer} method.
*
- * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
+ * <p>The {@code ObjectName} for uniquely identifying the MXBean for
* a garbage collector within an MBeanServer is:
* <blockquote>
* {@link ManagementFactory#GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE
- * <tt>java.lang:type=GarbageCollector</tt>}<tt>,name=</tt><i>collector's name</i>
+ * java.lang:type=GarbageCollector}{@code ,name=}<i>collector's name</i>
* </blockquote>
*
* It can be obtained by calling the
@@ -68,7 +68,7 @@
public interface GarbageCollectorMXBean extends MemoryManagerMXBean {
/**
* Returns the total number of collections that have occurred.
- * This method returns <tt>-1</tt> if the collection count is undefined for
+ * This method returns {@code -1} if the collection count is undefined for
* this collector.
*
* @return the total number of collections that have occurred.
@@ -77,7 +77,7 @@
/**
* Returns the approximate accumulated collection elapsed time
- * in milliseconds. This method returns <tt>-1</tt> if the collection
+ * in milliseconds. This method returns {@code -1} if the collection
* elapsed time is undefined for this collector.
* <p>
* The Java virtual machine implementation may use a high resolution
--- a/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/LockInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -43,7 +43,7 @@
* two examples of ownable synchronizers provided by the platform.
*
* <h3><a name="MappedType">MXBean Mapping</a></h3>
- * <tt>LockInfo</tt> is mapped to a {@link CompositeData CompositeData}
+ * {@code LockInfo} is mapped to a {@link CompositeData CompositeData}
* as specified in the {@link #from from} method.
*
* @see java.util.concurrent.locks.AbstractOwnableSynchronizer
@@ -59,7 +59,7 @@
private int identityHashCode;
/**
- * Constructs a <tt>LockInfo</tt> object.
+ * Constructs a {@code LockInfo} object.
*
* @param className the fully qualified name of the class of the lock object.
* @param identityHashCode the {@link System#identityHashCode
@@ -112,11 +112,11 @@
* </tr>
* <tr>
* <td>className</td>
- * <td><tt>java.lang.String</tt></td>
+ * <td>{@code java.lang.String}</td>
* </tr>
* <tr>
* <td>identityHashCode</td>
- * <td><tt>java.lang.Integer</tt></td>
+ * <td>{@code java.lang.Integer}</td>
* </tr>
* </table>
* </blockquote>
@@ -154,7 +154,7 @@
* <pre>
* lock.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(lock))
* </pre></blockquote>
- * where <tt>lock</tt> is the lock object.
+ * where {@code lock} is the lock object.
*
* @return the string representation of a lock.
*/
--- a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java Wed Jul 05 20:44:51 2017 +0200
@@ -116,7 +116,7 @@
* <h4>2. Indirect access to an MXBean interface via MBeanServer</h4>
* <ul>
* <li>Go through the platform {@code MBeanServer} to access MXBeans
- * locally or a specific <tt>MBeanServerConnection</tt> to access
+ * locally or a specific {@code MBeanServerConnection} to access
* MXBeans remotely.
* The attributes and operations of an MXBean use only
* <em>JMX open types</em> which include basic data types,
@@ -209,17 +209,17 @@
* <tr>
* <td> {@link GarbageCollectorMXBean} </td>
* <td> {@link #GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE
- * java.lang:type=GarbageCollector}<tt>,name=</tt><i>collector's name</i></td>
+ * java.lang:type=GarbageCollector}{@code ,name=}<i>collector's name</i></td>
* </tr>
* <tr>
* <td> {@link MemoryManagerMXBean} </td>
* <td> {@link #MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
- * java.lang:type=MemoryManager}<tt>,name=</tt><i>manager's name</i></td>
+ * java.lang:type=MemoryManager}{@code ,name=}<i>manager's name</i></td>
* </tr>
* <tr>
* <td> {@link MemoryPoolMXBean} </td>
* <td> {@link #MEMORY_POOL_MXBEAN_DOMAIN_TYPE
- * java.lang:type=MemoryPool}<tt>,name=</tt><i>pool's name</i></td>
+ * java.lang:type=MemoryPool}{@code ,name=}<i>pool's name</i></td>
* </tr>
* <tr>
* <td> {@link BufferPoolMXBean} </td>
@@ -243,72 +243,72 @@
/**
* String representation of the
- * <tt>ObjectName</tt> for the {@link ClassLoadingMXBean}.
+ * {@code ObjectName} for the {@link ClassLoadingMXBean}.
*/
public final static String CLASS_LOADING_MXBEAN_NAME =
"java.lang:type=ClassLoading";
/**
* String representation of the
- * <tt>ObjectName</tt> for the {@link CompilationMXBean}.
+ * {@code ObjectName} for the {@link CompilationMXBean}.
*/
public final static String COMPILATION_MXBEAN_NAME =
"java.lang:type=Compilation";
/**
* String representation of the
- * <tt>ObjectName</tt> for the {@link MemoryMXBean}.
+ * {@code ObjectName} for the {@link MemoryMXBean}.
*/
public final static String MEMORY_MXBEAN_NAME =
"java.lang:type=Memory";
/**
* String representation of the
- * <tt>ObjectName</tt> for the {@link OperatingSystemMXBean}.
+ * {@code ObjectName} for the {@link OperatingSystemMXBean}.
*/
public final static String OPERATING_SYSTEM_MXBEAN_NAME =
"java.lang:type=OperatingSystem";
/**
* String representation of the
- * <tt>ObjectName</tt> for the {@link RuntimeMXBean}.
+ * {@code ObjectName} for the {@link RuntimeMXBean}.
*/
public final static String RUNTIME_MXBEAN_NAME =
"java.lang:type=Runtime";
/**
* String representation of the
- * <tt>ObjectName</tt> for the {@link ThreadMXBean}.
+ * {@code ObjectName} for the {@link ThreadMXBean}.
*/
public final static String THREAD_MXBEAN_NAME =
"java.lang:type=Threading";
/**
* The domain name and the type key property in
- * the <tt>ObjectName</tt> for a {@link GarbageCollectorMXBean}.
- * The unique <tt>ObjectName</tt> for a <tt>GarbageCollectorMXBean</tt>
+ * the {@code ObjectName} for a {@link GarbageCollectorMXBean}.
+ * The unique {@code ObjectName} for a {@code GarbageCollectorMXBean}
* can be formed by appending this string with
- * "<tt>,name=</tt><i>collector's name</i>".
+ * "{@code ,name=}<i>collector's name</i>".
*/
public final static String GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE =
"java.lang:type=GarbageCollector";
/**
* The domain name and the type key property in
- * the <tt>ObjectName</tt> for a {@link MemoryManagerMXBean}.
- * The unique <tt>ObjectName</tt> for a <tt>MemoryManagerMXBean</tt>
+ * the {@code ObjectName} for a {@link MemoryManagerMXBean}.
+ * The unique {@code ObjectName} for a {@code MemoryManagerMXBean}
* can be formed by appending this string with
- * "<tt>,name=</tt><i>manager's name</i>".
+ * "{@code ,name=}<i>manager's name</i>".
*/
public final static String MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE=
"java.lang:type=MemoryManager";
/**
* The domain name and the type key property in
- * the <tt>ObjectName</tt> for a {@link MemoryPoolMXBean}.
- * The unique <tt>ObjectName</tt> for a <tt>MemoryPoolMXBean</tt>
+ * the {@code ObjectName} for a {@link MemoryPoolMXBean}.
+ * The unique {@code ObjectName} for a {@code MemoryPoolMXBean}
* can be formed by appending this string with
- * <tt>,name=</tt><i>pool's name</i>.
+ * {@code ,name=}<i>pool's name</i>.
*/
public final static String MEMORY_POOL_MXBEAN_DOMAIN_TYPE=
"java.lang:type=MemoryPool";
@@ -357,11 +357,11 @@
/**
* Returns the managed bean for the compilation system of
- * the Java virtual machine. This method returns <tt>null</tt>
+ * the Java virtual machine. This method returns {@code null}
* if the Java virtual machine has no compilation system.
*
* @return a {@link CompilationMXBean} object for the Java virtual
- * machine or <tt>null</tt> if the Java virtual machine has
+ * machine or {@code null} if the Java virtual machine has
* no compilation system.
*/
public static CompilationMXBean getCompilationMXBean() {
@@ -385,7 +385,7 @@
* The Java virtual machine can have one or more memory pools.
* It may add or remove memory pools during execution.
*
- * @return a list of <tt>MemoryPoolMXBean</tt> objects.
+ * @return a list of {@code MemoryPoolMXBean} objects.
*
*/
public static List<MemoryPoolMXBean> getMemoryPoolMXBeans() {
@@ -398,7 +398,7 @@
* The Java virtual machine can have one or more memory managers.
* It may add or remove memory managers during execution.
*
- * @return a list of <tt>MemoryManagerMXBean</tt> objects.
+ * @return a list of {@code MemoryManagerMXBean} objects.
*
*/
public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() {
@@ -410,11 +410,11 @@
* Returns a list of {@link GarbageCollectorMXBean} objects
* in the Java virtual machine.
* The Java virtual machine may have one or more
- * <tt>GarbageCollectorMXBean</tt> objects.
- * It may add or remove <tt>GarbageCollectorMXBean</tt>
+ * {@code GarbageCollectorMXBean} objects.
+ * It may add or remove {@code GarbageCollectorMXBean}
* during execution.
*
- * @return a list of <tt>GarbageCollectorMXBean</tt> objects.
+ * @return a list of {@code GarbageCollectorMXBean} objects.
*
*/
public static List<GarbageCollectorMXBean> getGarbageCollectorMXBeans() {
@@ -485,21 +485,21 @@
* Returns a proxy for a platform MXBean interface of a
* given <a href="#MXBeanNames">MXBean name</a>
* that forwards its method calls through the given
- * <tt>MBeanServerConnection</tt>.
+ * {@code MBeanServerConnection}.
*
* <p>This method is equivalent to:
* <blockquote>
* {@link java.lang.reflect.Proxy#newProxyInstance
- * Proxy.newProxyInstance}<tt>(mxbeanInterface.getClassLoader(),
- * new Class[] { mxbeanInterface }, handler)</tt>
+ * Proxy.newProxyInstance}{@code (mxbeanInterface.getClassLoader(),
+ * new Class[] { mxbeanInterface }, handler)}
* </blockquote>
*
- * where <tt>handler</tt> is an {@link java.lang.reflect.InvocationHandler
+ * where {@code handler} is an {@link java.lang.reflect.InvocationHandler
* InvocationHandler} to which method invocations to the MXBean interface
- * are dispatched. This <tt>handler</tt> converts an input parameter
+ * are dispatched. This {@code handler} converts an input parameter
* from an MXBean data type to its mapped open type before forwarding
- * to the <tt>MBeanServer</tt> and converts a return value from
- * an MXBean method call through the <tt>MBeanServer</tt>
+ * to the {@code MBeanServer} and converts a return value from
+ * an MXBean method call through the {@code MBeanServer}
* from an open type to the corresponding return type declared in
* the MXBean interface.
*
@@ -507,7 +507,7 @@
* If the MXBean is a notification emitter (i.e.,
* it implements
* {@link javax.management.NotificationEmitter NotificationEmitter}),
- * both the <tt>mxbeanInterface</tt> and <tt>NotificationEmitter</tt>
+ * both the {@code mxbeanInterface} and {@code NotificationEmitter}
* will be implemented by this proxy.
*
* <p>
@@ -516,12 +516,12 @@
* <li>Using an MXBean proxy is a convenience remote access to
* a platform MXBean of a running virtual machine. All method
* calls to the MXBean proxy are forwarded to an
- * <tt>MBeanServerConnection</tt> where
+ * {@code MBeanServerConnection} where
* {@link java.io.IOException IOException} may be thrown
* when the communication problem occurs with the connector server.
* An application remotely accesses the platform MXBeans using
- * proxy should prepare to catch <tt>IOException</tt> as if
- * accessing with the <tt>MBeanServerConnector</tt> interface.</li>
+ * proxy should prepare to catch {@code IOException} as if
+ * accessing with the {@code MBeanServerConnector} interface.</li>
*
* <li>When a client application is designed to remotely access MXBeans
* for a running virtual machine whose version is different than
@@ -537,15 +537,15 @@
* {@link javax.management.MBeanServerInvocationHandler#newProxyInstance
* newProxyInstance} method cannot be used to create
* a proxy for a platform MXBean. The proxy object created
- * by <tt>MBeanServerInvocationHandler</tt> does not handle
+ * by {@code MBeanServerInvocationHandler} does not handle
* the properties of the platform MXBeans described in
* the <a href="#MXBean">class specification</a>.
*</li>
* </ol>
*
- * @param connection the <tt>MBeanServerConnection</tt> to forward to.
+ * @param connection the {@code MBeanServerConnection} to forward to.
* @param mxbeanName the name of a platform MXBean within
- * <tt>connection</tt> to forward to. <tt>mxbeanName</tt> must be
+ * {@code connection} to forward to. {@code mxbeanName} must be
* in the format of {@link ObjectName ObjectName}.
* @param mxbeanInterface the MXBean interface to be implemented
* by the proxy.
@@ -554,22 +554,22 @@
* @return a proxy for a platform MXBean interface of a
* given <a href="#MXBeanNames">MXBean name</a>
* that forwards its method calls through the given
- * <tt>MBeanServerConnection</tt>, or {@code null} if not exist.
+ * {@code MBeanServerConnection}, or {@code null} if not exist.
*
* @throws IllegalArgumentException if
* <ul>
- * <li><tt>mxbeanName</tt> is not with a valid
+ * <li>{@code mxbeanName} is not with a valid
* {@link ObjectName ObjectName} format, or</li>
- * <li>the named MXBean in the <tt>connection</tt> is
+ * <li>the named MXBean in the {@code connection} is
* not a MXBean provided by the platform, or</li>
* <li>the named MXBean is not registered in the
- * <tt>MBeanServerConnection</tt>, or</li>
+ * {@code MBeanServerConnection}, or</li>
* <li>the named MXBean is not an instance of the given
- * <tt>mxbeanInterface</tt></li>
+ * {@code mxbeanInterface}</li>
* </ul>
*
* @throws java.io.IOException if a communication problem
- * occurred when accessing the <tt>MBeanServerConnection</tt>.
+ * occurred when accessing the {@code MBeanServerConnection}.
*/
public static <T> T
newPlatformMXBeanProxy(MBeanServerConnection connection,
--- a/jdk/src/java.management/share/classes/java/lang/management/MemoryMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/MemoryMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -37,13 +37,13 @@
* that can be obtained by calling
* the {@link ManagementFactory#getMemoryMXBean} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>} method.
+ * platform MBeanServer} method.
*
- * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
+ * <p>The {@code ObjectName} for uniquely identifying the MXBean for
* the memory system within an MBeanServer is:
* <blockquote>
* {@link ManagementFactory#MEMORY_MXBEAN_NAME
- * <tt>java.lang:type=Memory</tt>}
+ * java.lang:type=Memory}
* </blockquote>
*
* It can be obtained by calling the
@@ -133,7 +133,7 @@
*
* <h3>Notifications</h3>
*
- * <p>This <tt>MemoryMXBean</tt> is a
+ * <p>This {@code MemoryMXBean} is a
* {@link javax.management.NotificationEmitter NotificationEmitter}
* that emits two types of memory {@link javax.management.Notification
* notifications} if any one of the memory pools
@@ -164,20 +164,20 @@
* user data} is set to a {@link CompositeData CompositeData}
* that represents a {@link MemoryNotificationInfo} object
* containing information about the memory pool when the notification
- * was constructed. The <tt>CompositeData</tt> contains the attributes
+ * was constructed. The {@code CompositeData} contains the attributes
* as described in {@link MemoryNotificationInfo#from
* MemoryNotificationInfo}.
*
* <hr>
* <h3>NotificationEmitter</h3>
- * The <tt>MemoryMXBean</tt> object returned by
+ * The {@code MemoryMXBean} object returned by
* {@link ManagementFactory#getMemoryMXBean} implements
* the {@link javax.management.NotificationEmitter NotificationEmitter}
* interface that allows a listener to be registered within the
- * <tt>MemoryMXBean</tt> as a notification listener.
+ * {@code MemoryMXBean} as a notification listener.
*
- * Below is an example code that registers a <tt>MyListener</tt> to handle
- * notification emitted by the <tt>MemoryMXBean</tt>.
+ * Below is an example code that registers a {@code MyListener} to handle
+ * notification emitted by the {@code MemoryMXBean}.
*
* <blockquote><pre>
* class MyListener implements javax.management.NotificationListener {
@@ -215,10 +215,10 @@
/**
* Returns the current memory usage of the heap that
* is used for object allocation. The heap consists
- * of one or more memory pools. The <tt>used</tt>
- * and <tt>committed</tt> size of the returned memory
+ * of one or more memory pools. The {@code used}
+ * and {@code committed} size of the returned memory
* usage is the sum of those values of all heap memory pools
- * whereas the <tt>init</tt> and <tt>max</tt> size of the
+ * whereas the {@code init} and {@code max} size of the
* returned memory usage represents the setting of the heap
* memory which may not be the sum of those of all heap
* memory pools.
@@ -229,8 +229,8 @@
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>MemoryUsage</tt> is
- * <tt>CompositeData</tt> with attributes as specified in
+ * The mapped type of {@code MemoryUsage} is
+ * {@code CompositeData} with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
* @return a {@link MemoryUsage} object representing
@@ -242,18 +242,18 @@
* Returns the current memory usage of non-heap memory that
* is used by the Java virtual machine.
* The non-heap memory consists of one or more memory pools.
- * The <tt>used</tt> and <tt>committed</tt> size of the
+ * The {@code used} and {@code committed} size of the
* returned memory usage is the sum of those values of
- * all non-heap memory pools whereas the <tt>init</tt>
- * and <tt>max</tt> size of the returned memory usage
+ * all non-heap memory pools whereas the {@code init}
+ * and {@code max} size of the returned memory usage
* represents the setting of the non-heap
* memory which may not be the sum of those of all non-heap
* memory pools.
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>MemoryUsage</tt> is
- * <tt>CompositeData</tt> with attributes as specified in
+ * The mapped type of {@code MemoryUsage} is
+ * {@code CompositeData} with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
* @return a {@link MemoryUsage} object representing
@@ -264,8 +264,8 @@
/**
* Tests if verbose output for the memory system is enabled.
*
- * @return <tt>true</tt> if verbose output for the memory
- * system is enabled; <tt>false</tt> otherwise.
+ * @return {@code true} if verbose output for the memory
+ * system is enabled; {@code false} otherwise.
*/
public boolean isVerbose();
@@ -280,8 +280,8 @@
* Each invocation of this method enables or disables verbose
* output globally.
*
- * @param value <tt>true</tt> to enable verbose output;
- * <tt>false</tt> to disable.
+ * @param value {@code true} to enable verbose output;
+ * {@code false} to disable.
*
* @exception java.lang.SecurityException if a security manager
* exists and the caller does not have
--- a/jdk/src/java.management/share/classes/java/lang/management/MemoryManagerMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/MemoryManagerMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,13 +36,13 @@
* that can be obtained by calling
* the {@link ManagementFactory#getMemoryManagerMXBeans} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>} method.
+ * platform MBeanServer} method.
*
- * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
+ * <p>The {@code ObjectName} for uniquely identifying the MXBean for
* a memory manager within an MBeanServer is:
* <blockquote>
* {@link ManagementFactory#MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
- * <tt>java.lang:type=MemoryManager</tt>}<tt>,name=</tt><i>manager's name</i>
+ * java.lang:type=MemoryManager}{@code ,name=}<i>manager's name</i>
* </blockquote>
*
* It can be obtained by calling the
@@ -72,16 +72,16 @@
* machine. A memory manager becomes invalid once the Java virtual
* machine removes it from the memory system.
*
- * @return <tt>true</tt> if the memory manager is valid in the
+ * @return {@code true} if the memory manager is valid in the
* Java virtual machine;
- * <tt>false</tt> otherwise.
+ * {@code false} otherwise.
*/
public boolean isValid();
/**
* Returns the name of memory pools that this memory manager manages.
*
- * @return an array of <tt>String</tt> objects, each is
+ * @return an array of {@code String} objects, each is
* the name of a memory pool that this memory manager manages.
*/
public String[] getMemoryPoolNames();
--- a/jdk/src/java.management/share/classes/java/lang/management/MemoryNotificationInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/MemoryNotificationInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -53,12 +53,12 @@
*
* <p>
* A {@link CompositeData CompositeData} representing
- * the <tt>MemoryNotificationInfo</tt> object
+ * the {@code MemoryNotificationInfo} object
* is stored in the
* {@link javax.management.Notification#setUserData user data}
* of a {@link javax.management.Notification notification}.
* The {@link #from from} method is provided to convert from
- * a <tt>CompositeData</tt> to a <tt>MemoryNotificationInfo</tt>
+ * a {@code CompositeData} to a {@code MemoryNotificationInfo}
* object. For example:
*
* <blockquote><pre>
@@ -78,7 +78,7 @@
* </pre></blockquote>
*
* <p>
- * The types of notifications emitted by <tt>MemoryMXBean</tt> are:
+ * The types of notifications emitted by {@code MemoryMXBean} are:
* <ul>
* <li>A {@link #MEMORY_THRESHOLD_EXCEEDED
* usage threshold exceeded notification}.
@@ -119,7 +119,7 @@
* further notification until the memory usage has returned
* to become less than the usage threshold value.
* The value of this notification type is
- * <tt>java.management.memory.threshold.exceeded</tt>.
+ * {@code java.management.memory.threshold.exceeded}.
*/
public static final String MEMORY_THRESHOLD_EXCEEDED =
"java.management.memory.threshold.exceeded";
@@ -133,13 +133,13 @@
* memory pool.
* This notification is emitted by {@link MemoryMXBean}.
* The value of this notification type is
- * <tt>java.management.memory.collection.threshold.exceeded</tt>.
+ * {@code java.management.memory.collection.threshold.exceeded}.
*/
public static final String MEMORY_COLLECTION_THRESHOLD_EXCEEDED =
"java.management.memory.collection.threshold.exceeded";
/**
- * Constructs a <tt>MemoryNotificationInfo</tt> object.
+ * Constructs a {@code MemoryNotificationInfo} object.
*
* @param poolName The name of the memory pool which triggers this notification.
* @param usage Memory usage of the memory pool.
@@ -207,9 +207,9 @@
}
/**
- * Returns a <tt>MemoryNotificationInfo</tt> object represented by the
- * given <tt>CompositeData</tt>.
- * The given <tt>CompositeData</tt> must contain
+ * Returns a {@code MemoryNotificationInfo} object represented by the
+ * given {@code CompositeData}.
+ * The given {@code CompositeData} must contain
* the following attributes:
* <blockquote>
* <table border summary="The attributes and the types the given CompositeData contains">
@@ -219,28 +219,28 @@
* </tr>
* <tr>
* <td>poolName</td>
- * <td><tt>java.lang.String</tt></td>
+ * <td>{@code java.lang.String}</td>
* </tr>
* <tr>
* <td>usage</td>
- * <td><tt>javax.management.openmbean.CompositeData</tt></td>
+ * <td>{@code javax.management.openmbean.CompositeData}</td>
* </tr>
* <tr>
* <td>count</td>
- * <td><tt>java.lang.Long</tt></td>
+ * <td>{@code java.lang.Long}</td>
* </tr>
* </table>
* </blockquote>
*
- * @param cd <tt>CompositeData</tt> representing a
- * <tt>MemoryNotificationInfo</tt>
+ * @param cd {@code CompositeData} representing a
+ * {@code MemoryNotificationInfo}
*
- * @throws IllegalArgumentException if <tt>cd</tt> does not
- * represent a <tt>MemoryNotificationInfo</tt> object.
+ * @throws IllegalArgumentException if {@code cd} does not
+ * represent a {@code MemoryNotificationInfo} object.
*
- * @return a <tt>MemoryNotificationInfo</tt> object represented
- * by <tt>cd</tt> if <tt>cd</tt> is not <tt>null</tt>;
- * <tt>null</tt> otherwise.
+ * @return a {@code MemoryNotificationInfo} object represented
+ * by {@code cd} if {@code cd} is not {@code null};
+ * {@code null} otherwise.
*/
public static MemoryNotificationInfo from(CompositeData cd) {
if (cd == null) {
--- a/jdk/src/java.management/share/classes/java/lang/management/MemoryPoolMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/MemoryPoolMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -37,13 +37,13 @@
* that can be obtained by calling
* the {@link ManagementFactory#getMemoryPoolMXBeans} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>} method.
+ * platform MBeanServer} method.
*
- * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
- * a memory pool within an <tt>MBeanServer</tt> is:
+ * <p>The {@code ObjectName} for uniquely identifying the MXBean for
+ * a memory pool within an {@code MBeanServer} is:
* <blockquote>
* {@link ManagementFactory#MEMORY_POOL_MXBEAN_DOMAIN_TYPE
- * <tt>java.lang:type=MemoryPool</tt>}<tt>,name=</tt><i>pool's name</i>
+ * java.lang:type=MemoryPool}{@code ,name=}<i>pool's name</i>
* </blockquote>
*
* It can be obtained by calling the
@@ -236,7 +236,7 @@
* Usage threshold notification will be emitted by {@link MemoryMXBean}.
* When the Java virtual machine detects that the memory usage of
* a memory pool has reached or exceeded the usage threshold
- * the virtual machine will trigger the <tt>MemoryMXBean</tt> to emit an
+ * the virtual machine will trigger the {@code MemoryMXBean} to emit an
* {@link MemoryNotificationInfo#MEMORY_THRESHOLD_EXCEEDED
* usage threshold exceeded notification}.
* Another usage threshold exceeded notification will not be
@@ -250,7 +250,7 @@
* listener notifies another thread to perform the actual action
* such as to redistribute outstanding tasks, stop receiving tasks,
* or resume receiving tasks.
- * The <tt>handleNotification</tt> method should be designed to
+ * The {@code handleNotification} method should be designed to
* do a very minimal amount of work and return without delay to avoid
* causing delay in delivering subsequent notifications. Time-consuming
* actions should be performed by a separate thread.
@@ -290,7 +290,7 @@
* </pre>
* <hr>
* <p>
- * There is no guarantee about when the <tt>MemoryMXBean</tt> will emit
+ * There is no guarantee about when the {@code MemoryMXBean} will emit
* a threshold notification and when the notification will be delivered.
* When a notification listener is invoked, the memory usage of
* the memory pool may have crossed the usage threshold more
@@ -374,8 +374,8 @@
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>MemoryType</tt> is <tt>String</tt>
- * and the value is the name of the <tt>MemoryType</tt>.
+ * The mapped type of {@code MemoryType} is {@code String}
+ * and the value is the name of the {@code MemoryType}.
*
* @return the type of this memory pool.
*/
@@ -383,7 +383,7 @@
/**
* Returns an estimate of the memory usage of this memory pool.
- * This method returns <tt>null</tt>
+ * This method returns {@code null}
* if this memory pool is not valid (i.e. no longer exists).
*
* <p>
@@ -399,11 +399,11 @@
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>MemoryUsage</tt> is
- * <tt>CompositeData</tt> with attributes as specified in
+ * The mapped type of {@code MemoryUsage} is
+ * {@code CompositeData} with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
- * @return a {@link MemoryUsage} object; or <tt>null</tt> if
+ * @return a {@link MemoryUsage} object; or {@code null} if
* this pool not valid.
*/
public MemoryUsage getUsage();
@@ -411,17 +411,17 @@
/**
* Returns the peak memory usage of this memory pool since the
* Java virtual machine was started or since the peak was reset.
- * This method returns <tt>null</tt>
+ * This method returns {@code null}
* if this memory pool is not valid (i.e. no longer exists).
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>MemoryUsage</tt> is
- * <tt>CompositeData</tt> with attributes as specified in
+ * The mapped type of {@code MemoryUsage} is
+ * {@code CompositeData} with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
* @return a {@link MemoryUsage} object representing the peak
- * memory usage; or <tt>null</tt> if this pool is not valid.
+ * memory usage; or {@code null} if this pool is not valid.
*
*/
public MemoryUsage getPeakUsage();
@@ -441,9 +441,9 @@
* machine. A memory pool becomes invalid once the Java virtual
* machine removes it from the memory system.
*
- * @return <tt>true</tt> if the memory pool is valid in the running
+ * @return {@code true} if the memory pool is valid in the running
* Java virtual machine;
- * <tt>false</tt> otherwise.
+ * {@code false} otherwise.
*/
public boolean isValid();
@@ -451,7 +451,7 @@
* Returns the name of memory managers that manages this memory pool.
* Each memory pool will be managed by at least one memory manager.
*
- * @return an array of <tt>String</tt> objects, each is the name of
+ * @return an array of {@code String} objects, each is the name of
* a memory manager managing this memory pool.
*/
public String[] getMemoryManagerNames();
@@ -472,7 +472,7 @@
public long getUsageThreshold();
/**
- * Sets the threshold of this memory pool to the given <tt>threshold</tt>
+ * Sets the threshold of this memory pool to the given {@code threshold}
* value if this memory pool supports the usage threshold.
* The usage threshold crossing checking is enabled in this memory pool
* if the threshold is set to a positive value.
@@ -481,7 +481,7 @@
*
* @param threshold the new threshold value in bytes. Must be non-negative.
*
- * @throws IllegalArgumentException if <tt>threshold</tt> is negative
+ * @throws IllegalArgumentException if {@code threshold} is negative
* or greater than the maximum amount of memory for
* this memory pool if defined.
*
@@ -501,9 +501,9 @@
* Tests if the memory usage of this memory pool
* reaches or exceeds its usage threshold value.
*
- * @return <tt>true</tt> if the memory usage of
+ * @return {@code true} if the memory usage of
* this memory pool reaches or exceeds the threshold value;
- * <tt>false</tt> otherwise.
+ * {@code false} otherwise.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a usage threshold.
@@ -525,8 +525,8 @@
/**
* Tests if this memory pool supports usage threshold.
*
- * @return <tt>true</tt> if this memory pool supports usage threshold;
- * <tt>false</tt> otherwise.
+ * @return {@code true} if this memory pool supports usage threshold;
+ * {@code false} otherwise.
*/
public boolean isUsageThresholdSupported();
@@ -547,7 +547,7 @@
/**
* Sets the collection usage threshold of this memory pool to
- * the given <tt>threshold</tt> value.
+ * the given {@code threshold} value.
* When this threshold is set to positive, the Java virtual machine
* will check the memory usage at its best appropriate time after it has
* expended effort in recycling unused objects in this memory pool.
@@ -560,7 +560,7 @@
* @param threshold the new collection usage threshold value in bytes.
* Must be non-negative.
*
- * @throws IllegalArgumentException if <tt>threshold</tt> is negative
+ * @throws IllegalArgumentException if {@code threshold} is negative
* or greater than the maximum amount of memory for
* this memory pool if defined.
*
@@ -585,10 +585,10 @@
* machine to perform any garbage collection other than its normal
* automatic memory management.
*
- * @return <tt>true</tt> if the memory usage of this memory pool
+ * @return {@code true} if the memory usage of this memory pool
* reaches or exceeds the collection usage threshold value
* in the most recent collection;
- * <tt>false</tt> otherwise.
+ * {@code false} otherwise.
*
* @throws UnsupportedOperationException if this memory pool
* does not support a usage threshold.
@@ -617,27 +617,27 @@
* This method does not request the Java virtual
* machine to perform any garbage collection other than its normal
* automatic memory management.
- * This method returns <tt>null</tt> if the Java virtual
+ * This method returns {@code null} if the Java virtual
* machine does not support this method.
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>MemoryUsage</tt> is
- * <tt>CompositeData</tt> with attributes as specified in
+ * The mapped type of {@code MemoryUsage} is
+ * {@code CompositeData} with attributes as specified in
* {@link MemoryUsage#from MemoryUsage}.
*
* @return a {@link MemoryUsage} representing the memory usage of
* this memory pool after the Java virtual machine most recently
* expended effort in recycling unused objects;
- * <tt>null</tt> if this method is not supported.
+ * {@code null} if this method is not supported.
*/
public MemoryUsage getCollectionUsage();
/**
* Tests if this memory pool supports a collection usage threshold.
*
- * @return <tt>true</tt> if this memory pool supports the
- * collection usage threshold; <tt>false</tt> otherwise.
+ * @return {@code true} if this memory pool supports the
+ * collection usage threshold; {@code false} otherwise.
*/
public boolean isCollectionUsageThresholdSupported();
}
--- a/jdk/src/java.management/share/classes/java/lang/management/MemoryType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/MemoryType.java Wed Jul 05 20:44:51 2017 +0200
@@ -62,8 +62,8 @@
}
/**
- * Returns the string representation of this <tt>MemoryType</tt>.
- * @return the string representation of this <tt>MemoryType</tt>.
+ * Returns the string representation of this {@code MemoryType}.
+ * @return the string representation of this {@code MemoryType}.
*/
public String toString() {
return description;
--- a/jdk/src/java.management/share/classes/java/lang/management/MemoryUsage.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/MemoryUsage.java Wed Jul 05 20:44:51 2017 +0200
@@ -29,50 +29,50 @@
import sun.management.MemoryUsageCompositeData;
/**
- * A <tt>MemoryUsage</tt> object represents a snapshot of memory usage.
- * Instances of the <tt>MemoryUsage</tt> class are usually constructed
+ * A {@code MemoryUsage} object represents a snapshot of memory usage.
+ * Instances of the {@code MemoryUsage} class are usually constructed
* by methods that are used to obtain memory usage
* information about individual memory pool of the Java virtual machine or
* the heap or non-heap memory of the Java virtual machine as a whole.
*
- * <p> A <tt>MemoryUsage</tt> object contains four values:
+ * <p> A {@code MemoryUsage} object contains four values:
* <table summary="Describes the MemoryUsage object content">
* <tr>
- * <td valign=top> <tt>init</tt> </td>
+ * <td valign=top> {@code init} </td>
* <td valign=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
* may request additional memory from the operating system and
* may also release memory to the system over time.
- * The value of <tt>init</tt> may be undefined.
+ * The value of {@code init} may be undefined.
* </td>
* </tr>
* <tr>
- * <td valign=top> <tt>used</tt> </td>
+ * <td valign=top> {@code used} </td>
* <td valign=top> represents the amount of memory currently used (in bytes).
* </td>
* </tr>
* <tr>
- * <td valign=top> <tt>committed</tt> </td>
+ * <td valign=top> {@code committed} </td>
* <td valign=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
* or decrease). The Java virtual machine may release memory to
- * the system and <tt>committed</tt> could be less than <tt>init</tt>.
- * <tt>committed</tt> will always be greater than
- * or equal to <tt>used</tt>.
+ * the system and {@code committed} could be less than {@code init}.
+ * {@code committed} will always be greater than
+ * or equal to {@code used}.
* </td>
* </tr>
* <tr>
- * <td valign=top> <tt>max</tt> </td>
+ * <td valign=top> {@code max} </td>
* <td valign=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.
* The amount of used and committed memory will always be less than
- * or equal to <tt>max</tt> if <tt>max</tt> is defined.
+ * or equal to {@code max} if {@code max} is defined.
* A memory allocation may fail if it attempts to increase the
- * used memory such that <tt>used > committed</tt> even
- * if <tt>used <= max</tt> would still be true (for example,
+ * used memory such that {@code used > committed} even
+ * if {@code used <= max} would still be true (for example,
* when the system is low on virtual memory).
* </td>
* </tr>
@@ -97,7 +97,7 @@
* </pre>
*
* <h3>MXBean Mapping</h3>
- * <tt>MemoryUsage</tt> is mapped to a {@link CompositeData CompositeData}
+ * {@code MemoryUsage} is mapped to a {@link CompositeData CompositeData}
* with attributes as specified in the {@link #from from} method.
*
* @author Mandy Chung
@@ -110,26 +110,26 @@
private final long max;
/**
- * Constructs a <tt>MemoryUsage</tt> object.
+ * Constructs a {@code MemoryUsage} object.
*
* @param init the initial amount of memory in bytes that
* the Java virtual machine allocates;
- * or <tt>-1</tt> if undefined.
+ * or {@code -1} if undefined.
* @param used the amount of used memory in bytes.
* @param committed the amount of committed memory in bytes.
* @param max the maximum amount of memory in bytes that
- * can be used; or <tt>-1</tt> if undefined.
+ * can be used; or {@code -1} if undefined.
*
* @throws IllegalArgumentException if
* <ul>
- * <li> the value of <tt>init</tt> or <tt>max</tt> is negative
- * but not <tt>-1</tt>; or</li>
- * <li> the value of <tt>used</tt> or <tt>committed</tt> is negative;
+ * <li> the value of {@code init} or {@code max} is negative
+ * but not {@code -1}; or</li>
+ * <li> the value of {@code used} or {@code committed} is negative;
* or</li>
- * <li> <tt>used</tt> is greater than the value of <tt>committed</tt>;
+ * <li> {@code used} is greater than the value of {@code committed};
* or</li>
- * <li> <tt>committed</tt> is greater than the value of <tt>max</tt>
- * <tt>max</tt> if defined.</li>
+ * <li> {@code committed} is greater than the value of {@code max}
+ * {@code max} if defined.</li>
* </ul>
*/
public MemoryUsage(long init,
@@ -168,7 +168,7 @@
}
/**
- * Constructs a <tt>MemoryUsage</tt> object from a
+ * Constructs a {@code MemoryUsage} object from a
* {@link CompositeData CompositeData}.
*/
private MemoryUsage(CompositeData cd) {
@@ -184,10 +184,10 @@
/**
* Returns the amount of memory in bytes that the Java virtual machine
* initially requests from the operating system for memory management.
- * This method returns <tt>-1</tt> if the initial memory size is undefined.
+ * This method returns {@code -1} if the initial memory size is undefined.
*
* @return the initial size of memory in bytes;
- * <tt>-1</tt> if undefined.
+ * {@code -1} if undefined.
*/
public long getInit() {
return init;
@@ -217,7 +217,7 @@
/**
* Returns the maximum amount of memory in bytes that can be
- * used for memory management. This method returns <tt>-1</tt>
+ * used for memory management. This method returns {@code -1}
* if the maximum memory size is undefined.
*
* <p> This amount of memory is not guaranteed to be available
@@ -227,7 +227,7 @@
* maximum size.
*
* @return the maximum amount of memory in bytes;
- * <tt>-1</tt> if undefined.
+ * {@code -1} if undefined.
*/
public long getMax() {
return max;
@@ -247,8 +247,8 @@
}
/**
- * Returns a <tt>MemoryUsage</tt> object represented by the
- * given <tt>CompositeData</tt>. The given <tt>CompositeData</tt>
+ * Returns a {@code MemoryUsage} object represented by the
+ * given {@code CompositeData}. The given {@code CompositeData}
* must contain the following attributes:
*
* <blockquote>
@@ -259,32 +259,32 @@
* </tr>
* <tr>
* <td>init</td>
- * <td><tt>java.lang.Long</tt></td>
+ * <td>{@code java.lang.Long}</td>
* </tr>
* <tr>
* <td>used</td>
- * <td><tt>java.lang.Long</tt></td>
+ * <td>{@code java.lang.Long}</td>
* </tr>
* <tr>
* <td>committed</td>
- * <td><tt>java.lang.Long</tt></td>
+ * <td>{@code java.lang.Long}</td>
* </tr>
* <tr>
* <td>max</td>
- * <td><tt>java.lang.Long</tt></td>
+ * <td>{@code java.lang.Long}</td>
* </tr>
* </table>
* </blockquote>
*
- * @param cd <tt>CompositeData</tt> representing a <tt>MemoryUsage</tt>
+ * @param cd {@code CompositeData} representing a {@code MemoryUsage}
*
- * @throws IllegalArgumentException if <tt>cd</tt> does not
- * represent a <tt>MemoryUsage</tt> with the attributes described
+ * @throws IllegalArgumentException if {@code cd} does not
+ * represent a {@code MemoryUsage} with the attributes described
* above.
*
- * @return a <tt>MemoryUsage</tt> object represented by <tt>cd</tt>
- * if <tt>cd</tt> is not <tt>null</tt>;
- * <tt>null</tt> otherwise.
+ * @return a {@code MemoryUsage} object represented by {@code cd}
+ * if {@code cd} is not {@code null};
+ * {@code null} otherwise.
*/
public static MemoryUsage from(CompositeData cd) {
if (cd == null) {
--- a/jdk/src/java.management/share/classes/java/lang/management/MonitorInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/MonitorInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -33,7 +33,7 @@
* when entering a synchronization block or method on that object.
*
* <h3>MXBean Mapping</h3>
- * <tt>MonitorInfo</tt> is mapped to a {@link CompositeData CompositeData}
+ * {@code MonitorInfo} is mapped to a {@link CompositeData CompositeData}
* with attributes as specified in
* the {@link #from from} method.
*
@@ -46,7 +46,7 @@
private StackTraceElement stackFrame;
/**
- * Construct a <tt>MonitorInfo</tt> object.
+ * Construct a {@code MonitorInfo} object.
*
* @param className the fully qualified name of the class of the lock object.
* @param identityHashCode the {@link System#identityHashCode
@@ -55,9 +55,9 @@
* was locked.
* @param stackFrame the stack frame that locked the object monitor.
* @throws IllegalArgumentException if
- * <tt>stackDepth</tt> ≥ 0 but <tt>stackFrame</tt> is <tt>null</tt>,
- * or <tt>stackDepth</tt> < 0 but <tt>stackFrame</tt> is not
- * <tt>null</tt>.
+ * {@code stackDepth} ≥ 0 but {@code stackFrame} is {@code null},
+ * or {@code stackDepth} < 0 but {@code stackFrame} is not
+ * {@code null}.
*/
public MonitorInfo(String className,
int identityHashCode,
@@ -78,7 +78,7 @@
/**
* Returns the depth in the stack trace where the object monitor
- * was locked. The depth is the index to the <tt>StackTraceElement</tt>
+ * was locked. The depth is the index to the {@code StackTraceElement}
* array returned in the {@link ThreadInfo#getStackTrace} method.
*
* @return the depth in the stack trace where the object monitor
@@ -91,17 +91,17 @@
/**
* Returns the stack frame that locked the object monitor.
*
- * @return <tt>StackTraceElement</tt> that locked the object monitor,
- * or <tt>null</tt> if not available.
+ * @return {@code StackTraceElement} that locked the object monitor,
+ * or {@code null} if not available.
*/
public StackTraceElement getLockedStackFrame() {
return stackFrame;
}
/**
- * Returns a <tt>MonitorInfo</tt> object represented by the
- * given <tt>CompositeData</tt>.
- * The given <tt>CompositeData</tt> must contain the following attributes
+ * Returns a {@code MonitorInfo} object represented by the
+ * given {@code CompositeData}.
+ * The given {@code CompositeData} must contain the following attributes
* as well as the attributes specified in the
* <a href="LockInfo.html#MappedType">
* mapped type</a> for the {@link LockInfo} class:
@@ -113,28 +113,28 @@
* </tr>
* <tr>
* <td>lockedStackFrame</td>
- * <td><tt>CompositeData as specified in the
+ * <td><code>CompositeData as specified in the
* <a href="ThreadInfo.html#StackTrace">stackTrace</a>
* attribute defined in the {@link ThreadInfo#from
* ThreadInfo.from} method.
- * </tt></td>
+ * </code></td>
* </tr>
* <tr>
* <td>lockedStackDepth</td>
- * <td><tt>java.lang.Integer</tt></td>
+ * <td>{@code java.lang.Integer}</td>
* </tr>
* </table>
* </blockquote>
*
- * @param cd <tt>CompositeData</tt> representing a <tt>MonitorInfo</tt>
+ * @param cd {@code CompositeData} representing a {@code MonitorInfo}
*
- * @throws IllegalArgumentException if <tt>cd</tt> does not
- * represent a <tt>MonitorInfo</tt> with the attributes described
+ * @throws IllegalArgumentException if {@code cd} does not
+ * represent a {@code MonitorInfo} with the attributes described
* above.
- * @return a <tt>MonitorInfo</tt> object represented
- * by <tt>cd</tt> if <tt>cd</tt> is not <tt>null</tt>;
- * <tt>null</tt> otherwise.
+ * @return a {@code MonitorInfo} object represented
+ * by {@code cd} if {@code cd} is not {@code null};
+ * {@code null} otherwise.
*/
public static MonitorInfo from(CompositeData cd) {
if (cd == null) {
--- a/jdk/src/java.management/share/classes/java/lang/management/OperatingSystemMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/OperatingSystemMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -35,13 +35,13 @@
* that can be obtained by calling
* the {@link ManagementFactory#getOperatingSystemMXBean} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>} method.
+ * platform MBeanServer} method.
*
- * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
+ * <p>The {@code ObjectName} for uniquely identifying the MXBean for
* the operating system within an MBeanServer is:
* <blockquote>
* {@link ManagementFactory#OPERATING_SYSTEM_MXBEAN_NAME
- * <tt>java.lang:type=OperatingSystem</tt>}
+ * java.lang:type=OperatingSystem}
* </blockquote>
*
* It can be obtained by calling the
@@ -63,7 +63,7 @@
public interface OperatingSystemMXBean extends PlatformManagedObject {
/**
* Returns the operating system name.
- * This method is equivalent to <tt>System.getProperty("os.name")</tt>.
+ * This method is equivalent to {@code System.getProperty("os.name")}.
*
* @return the operating system name.
*
@@ -78,7 +78,7 @@
/**
* Returns the operating system architecture.
- * This method is equivalent to <tt>System.getProperty("os.arch")</tt>.
+ * This method is equivalent to {@code System.getProperty("os.arch")}.
*
* @return the operating system architecture.
*
@@ -93,7 +93,7 @@
/**
* Returns the operating system version.
- * This method is equivalent to <tt>System.getProperty("os.version")</tt>.
+ * This method is equivalent to {@code System.getProperty("os.version")}.
*
* @return the operating system version.
*
--- a/jdk/src/java.management/share/classes/java/lang/management/PlatformLoggingMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/PlatformLoggingMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,7 +28,7 @@
/**
* The management interface for the {@linkplain java.util.logging logging} facility.
*
- * <p>There is a single global instance of the <tt>PlatformLoggingMXBean</tt>.
+ * <p>There is a single global instance of the {@code PlatformLoggingMXBean}.
* The {@link java.lang.management.ManagementFactory#getPlatformMXBean(Class)
* ManagementFactory.getPlatformMXBean} method can be used to obtain
* the {@code PlatformLoggingMXBean} object as follows:
@@ -44,7 +44,7 @@
* {@link java.util.logging.LogManager#LOGGING_MXBEAN_NAME java.util.logging:type=Logging}
* </pre>
*
- * <p>The instance registered in the platform <tt>MBeanServer</tt> with
+ * <p>The instance registered in the platform {@code MBeanServer} with
* this {@code ObjectName} implements all attributes defined by
* {@link java.util.logging.LoggingMXBean}.
*
--- a/jdk/src/java.management/share/classes/java/lang/management/RuntimeMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/RuntimeMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -35,13 +35,13 @@
* that can be obtained by calling
* the {@link ManagementFactory#getRuntimeMXBean} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>} method.
+ * platform MBeanServer} method.
*
- * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
+ * <p>The {@code ObjectName} for uniquely identifying the MXBean for
* the runtime system within an MBeanServer is:
* <blockquote>
* {@link ManagementFactory#RUNTIME_MXBEAN_NAME
- * <tt>java.lang:type=Runtime</tt>}
+ * java.lang:type=Runtime}
* </blockquote>
*
* It can be obtained by calling the
@@ -81,7 +81,7 @@
*
* @throws java.lang.SecurityException
* if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow access
+ * {@code checkPropertiesAccess} method doesn't allow access
* to this system property.
* @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
* @see java.lang.System#getProperty
@@ -97,7 +97,7 @@
*
* @throws java.lang.SecurityException
* if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow access
+ * {@code checkPropertiesAccess} method doesn't allow access
* to this system property.
* @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
* @see java.lang.System#getProperty
@@ -113,7 +113,7 @@
*
* @throws java.lang.SecurityException
* if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow access
+ * {@code checkPropertiesAccess} method doesn't allow access
* to this system property.
* @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
* @see java.lang.System#getProperty
@@ -129,7 +129,7 @@
*
* @throws java.lang.SecurityException
* if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow access
+ * {@code checkPropertiesAccess} method doesn't allow access
* to this system property.
* @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
* @see java.lang.System#getProperty
@@ -145,7 +145,7 @@
*
* @throws java.lang.SecurityException
* if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow access
+ * {@code checkPropertiesAccess} method doesn't allow access
* to this system property.
* @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
* @see java.lang.System#getProperty
@@ -161,7 +161,7 @@
*
* @throws java.lang.SecurityException
* if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow access
+ * {@code checkPropertiesAccess} method doesn't allow access
* to this system property.
* @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
* @see java.lang.System#getProperty
@@ -192,7 +192,7 @@
*
* @throws java.lang.SecurityException
* if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow access
+ * {@code checkPropertiesAccess} method doesn't allow access
* to this system property.
* @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
* @see java.lang.System#getProperty
@@ -212,7 +212,7 @@
*
* @throws java.lang.SecurityException
* if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow access
+ * {@code checkPropertiesAccess} method doesn't allow access
* to this system property.
* @see java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
* @see java.lang.System#getProperty
@@ -224,8 +224,8 @@
* mechanism used by the bootstrap class loader to search for class
* files.
*
- * @return <tt>true</tt> if the Java virtual machine supports the
- * class path mechanism; <tt>false</tt> otherwise.
+ * @return {@code true} if the Java virtual machine supports the
+ * class path mechanism; {@code false} otherwise.
*/
public boolean isBootClassPathSupported();
@@ -256,7 +256,7 @@
/**
* Returns the input arguments passed to the Java virtual machine
- * which does not include the arguments to the <tt>main</tt> method.
+ * which does not include the arguments to the {@code main} method.
* This method returns an empty list if there is no input argument
* to the Java virtual machine.
* <p>
@@ -272,9 +272,9 @@
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of {@code List<String>} is <tt>String[]</tt>.
+ * The mapped type of {@code List<String>} is {@code String[]}.
*
- * @return a list of <tt>String</tt> objects; each element
+ * @return a list of {@code String} objects; each element
* is an argument passed to the Java virtual machine.
*
* @throws java.lang.SecurityException
@@ -304,7 +304,7 @@
* Returns a map of names and values of all system properties.
* This method calls {@link System#getProperties} to get all
* system properties. Properties whose name or value is not
- * a <tt>String</tt> are omitted.
+ * a {@code String} are omitted.
*
* <p>
* <b>MBeanServer access</b>:<br>
@@ -318,12 +318,12 @@
* <th>Item Type</th>
* </tr>
* <tr>
- * <td><tt>key</tt></td>
- * <td><tt>String</tt></td>
+ * <td>{@code key}</td>
+ * <td>{@code String}</td>
* </tr>
* <tr>
- * <td><tt>value</tt></td>
- * <td><tt>String</tt></td>
+ * <td>{@code value}</td>
+ * <td>{@code String}</td>
* </tr>
* </table>
* </blockquote>
@@ -332,7 +332,7 @@
*
* @throws java.lang.SecurityException
* if a security manager exists and its
- * <code>checkPropertiesAccess</code> method doesn't allow access
+ * {@code checkPropertiesAccess} method doesn't allow access
* to the system properties.
*/
public java.util.Map<String, String> getSystemProperties();
--- a/jdk/src/java.management/share/classes/java/lang/management/ThreadMXBean.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadMXBean.java Wed Jul 05 20:44:51 2017 +0200
@@ -37,13 +37,13 @@
* that can be obtained by calling
* the {@link ManagementFactory#getThreadMXBean} method or
* from the {@link ManagementFactory#getPlatformMBeanServer
- * platform <tt>MBeanServer</tt>} method.
+ * platform MBeanServer} method.
*
- * <p>The <tt>ObjectName</tt> for uniquely identifying the MXBean for
+ * <p>The {@code ObjectName} for uniquely identifying the MXBean for
* the thread system within an MBeanServer is:
* <blockquote>
* {@link ManagementFactory#THREAD_MXBEAN_NAME
- * <tt>java.lang:type=Threading</tt>}
+ * java.lang:type=Threading}
* </blockquote>
*
* It can be obtained by calling the
@@ -88,7 +88,7 @@
* When thread contention monitoring is enabled, the accumulated elapsed
* time that the thread has blocked for synchronization or waited for
* notification will be collected and returned in the
- * <a href="ThreadInfo.html#SyncStats"><tt>ThreadInfo</tt></a> object.
+ * <a href="ThreadInfo.html#SyncStats">{@code ThreadInfo}</a> object.
* <p>
* The {@link #isThreadContentionMonitoringSupported} method can be used to
* determine if a Java virtual machine supports thread contention monitoring.
@@ -106,7 +106,7 @@
* {@linkplain LockInfo <i>lock</i>} a thread is blocked to
* acquire or waiting on and which locks the thread currently owns.
* <p>
- * The <tt>ThreadMXBean</tt> interface provides the
+ * The {@code ThreadMXBean} interface provides the
* {@link #findMonitorDeadlockedThreads} and
* {@link #findDeadlockedThreads} methods to find deadlocks in
* the running application.
@@ -158,7 +158,7 @@
* Some threads included in the returned array
* may have been terminated when this method returns.
*
- * @return an array of <tt>long</tt>, each is a thread ID.
+ * @return an array of {@code long}, each is a thread ID.
*
* @throws java.lang.SecurityException if a security manager
* exists and the caller does not have
@@ -168,34 +168,34 @@
/**
* Returns the thread info for a thread of the specified
- * <tt>id</tt> with no stack trace.
+ * {@code id} with no stack trace.
* This method is equivalent to calling:
* <blockquote>
* {@link #getThreadInfo(long, int) getThreadInfo(id, 0);}
* </blockquote>
*
* <p>
- * This method returns a <tt>ThreadInfo</tt> object representing
+ * This method returns a {@code ThreadInfo} object representing
* the thread information for the thread of the specified ID.
* The stack trace, locked monitors, and locked synchronizers
- * in the returned <tt>ThreadInfo</tt> object will
+ * in the returned {@code ThreadInfo} object will
* be empty.
*
* If a thread of the given ID is not alive or does not exist,
- * this method will return <tt>null</tt>. A thread is alive if
+ * this method will return {@code null}. A thread is alive if
* it has been started and has not yet died.
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>ThreadInfo</tt> is
- * <tt>CompositeData</tt> with attributes as specified in the
+ * The mapped type of {@code ThreadInfo} is
+ * {@code CompositeData} with attributes as specified in the
* {@link ThreadInfo#from ThreadInfo.from} method.
*
* @param id the thread ID of the thread. Must be positive.
*
* @return a {@link ThreadInfo} object for the thread of the given ID
* with no stack trace, no locked monitor and no synchronizer info;
- * <tt>null</tt> if the thread of the given ID is not alive or
+ * {@code null} if the thread of the given ID is not alive or
* it does not exist.
*
* @throws IllegalArgumentException if {@code id <= 0}.
@@ -207,26 +207,26 @@
/**
* Returns the thread info for each thread
- * whose ID is in the input array <tt>ids</tt> with no stack trace.
+ * whose ID is in the input array {@code ids} with no stack trace.
* This method is equivalent to calling:
* <blockquote><pre>
* {@link #getThreadInfo(long[], int) getThreadInfo}(ids, 0);
* </pre></blockquote>
*
* <p>
- * This method returns an array of the <tt>ThreadInfo</tt> objects.
+ * This method returns an array of the {@code ThreadInfo} objects.
* The stack trace, locked monitors, and locked synchronizers
- * in each <tt>ThreadInfo</tt> object will be empty.
+ * in each {@code ThreadInfo} object will be empty.
*
* If a thread of a given ID is not alive or does not exist,
* the corresponding element in the returned array will
- * contain <tt>null</tt>. A thread is alive if
+ * contain {@code null}. A thread is alive if
* it has been started and has not yet died.
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>ThreadInfo</tt> is
- * <tt>CompositeData</tt> with attributes as specified in the
+ * The mapped type of {@code ThreadInfo} is
+ * {@code CompositeData} with attributes as specified in the
* {@link ThreadInfo#from ThreadInfo.from} method.
*
* @param ids an array of thread IDs.
@@ -236,7 +236,7 @@
* with no stack trace, no locked monitor and no synchronizer info.
*
* @throws IllegalArgumentException if any element in the input array
- * <tt>ids</tt> is {@code <= 0}.
+ * {@code ids} is {@code <= 0}.
* @throws java.lang.SecurityException if a security manager
* exists and the caller does not have
* ManagementPermission("monitor").
@@ -244,46 +244,46 @@
public ThreadInfo[] getThreadInfo(long[] ids);
/**
- * Returns a thread info for a thread of the specified <tt>id</tt>,
+ * Returns a thread info for a thread of the specified {@code id},
* with stack trace of a specified number of stack trace elements.
- * The <tt>maxDepth</tt> parameter indicates the maximum number of
+ * The {@code maxDepth} parameter indicates the maximum number of
* {@link StackTraceElement} to be retrieved from the stack trace.
- * If <tt>maxDepth == Integer.MAX_VALUE</tt>, the entire stack trace of
+ * If {@code maxDepth == Integer.MAX_VALUE}, the entire stack trace of
* the thread will be dumped.
- * If <tt>maxDepth == 0</tt>, no stack trace of the thread
+ * If {@code maxDepth == 0}, no stack trace of the thread
* will be dumped.
* This method does not obtain the locked monitors and locked
* synchronizers of the thread.
* <p>
* When the Java virtual machine has no stack trace information
- * about a thread or <tt>maxDepth == 0</tt>,
+ * about a thread or {@code maxDepth == 0},
* the stack trace in the
- * <tt>ThreadInfo</tt> object will be an empty array of
- * <tt>StackTraceElement</tt>.
+ * {@code ThreadInfo} object will be an empty array of
+ * {@code StackTraceElement}.
*
* <p>
* If a thread of the given ID is not alive or does not exist,
- * this method will return <tt>null</tt>. A thread is alive if
+ * this method will return {@code null}. A thread is alive if
* it has been started and has not yet died.
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>ThreadInfo</tt> is
- * <tt>CompositeData</tt> with attributes as specified in the
+ * The mapped type of {@code ThreadInfo} is
+ * {@code CompositeData} with attributes as specified in the
* {@link ThreadInfo#from ThreadInfo.from} method.
*
* @param id the thread ID of the thread. Must be positive.
* @param maxDepth the maximum number of entries in the stack trace
- * to be dumped. <tt>Integer.MAX_VALUE</tt> could be used to request
+ * to be dumped. {@code Integer.MAX_VALUE} could be used to request
* the entire stack to be dumped.
*
* @return a {@link ThreadInfo} of the thread of the given ID
* with no locked monitor and synchronizer info.
- * <tt>null</tt> if the thread of the given ID is not alive or
+ * {@code null} if the thread of the given ID is not alive or
* it does not exist.
*
* @throws IllegalArgumentException if {@code id <= 0}.
- * @throws IllegalArgumentException if <tt>maxDepth is negative</tt>.
+ * @throws IllegalArgumentException if {@code maxDepth is negative}.
* @throws java.lang.SecurityException if a security manager
* exists and the caller does not have
* ManagementPermission("monitor").
@@ -293,40 +293,40 @@
/**
* Returns the thread info for each thread
- * whose ID is in the input array <tt>ids</tt>,
+ * whose ID is in the input array {@code ids},
* with stack trace of a specified number of stack trace elements.
- * The <tt>maxDepth</tt> parameter indicates the maximum number of
+ * The {@code maxDepth} parameter indicates the maximum number of
* {@link StackTraceElement} to be retrieved from the stack trace.
- * If <tt>maxDepth == Integer.MAX_VALUE</tt>, the entire stack trace of
+ * If {@code maxDepth == Integer.MAX_VALUE}, the entire stack trace of
* the thread will be dumped.
- * If <tt>maxDepth == 0</tt>, no stack trace of the thread
+ * If {@code maxDepth == 0}, no stack trace of the thread
* will be dumped.
* This method does not obtain the locked monitors and locked
* synchronizers of the threads.
* <p>
* When the Java virtual machine has no stack trace information
- * about a thread or <tt>maxDepth == 0</tt>,
+ * about a thread or {@code maxDepth == 0},
* the stack trace in the
- * <tt>ThreadInfo</tt> object will be an empty array of
- * <tt>StackTraceElement</tt>.
+ * {@code ThreadInfo} object will be an empty array of
+ * {@code StackTraceElement}.
* <p>
- * This method returns an array of the <tt>ThreadInfo</tt> objects,
+ * This method returns an array of the {@code ThreadInfo} objects,
* each is the thread information about the thread with the same index
- * as in the <tt>ids</tt> array.
+ * as in the {@code ids} array.
* If a thread of the given ID is not alive or does not exist,
- * <tt>null</tt> will be set in the corresponding element
+ * {@code null} will be set in the corresponding element
* in the returned array. A thread is alive if
* it has been started and has not yet died.
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>ThreadInfo</tt> is
- * <tt>CompositeData</tt> with attributes as specified in the
+ * The mapped type of {@code ThreadInfo} is
+ * {@code CompositeData} with attributes as specified in the
* {@link ThreadInfo#from ThreadInfo.from} method.
*
* @param ids an array of thread IDs
* @param maxDepth the maximum number of entries in the stack trace
- * to be dumped. <tt>Integer.MAX_VALUE</tt> could be used to request
+ * to be dumped. {@code Integer.MAX_VALUE} could be used to request
* the entire stack to be dumped.
*
* @return an array of the {@link ThreadInfo} objects, each containing
@@ -334,9 +334,9 @@
* element of the input array of IDs with no locked monitor and
* synchronizer info.
*
- * @throws IllegalArgumentException if <tt>maxDepth is negative</tt>.
+ * @throws IllegalArgumentException if {@code maxDepth is negative}.
* @throws IllegalArgumentException if any element in the input array
- * <tt>ids</tt> is {@code <= 0}.
+ * {@code ids} is {@code <= 0}.
* @throws java.lang.SecurityException if a security manager
* exists and the caller does not have
* ManagementPermission("monitor").
@@ -348,17 +348,17 @@
* Tests if the Java virtual machine supports thread contention monitoring.
*
* @return
- * <tt>true</tt>
+ * {@code true}
* if the Java virtual machine supports thread contention monitoring;
- * <tt>false</tt> otherwise.
+ * {@code false} otherwise.
*/
public boolean isThreadContentionMonitoringSupported();
/**
* Tests if thread contention monitoring is enabled.
*
- * @return <tt>true</tt> if thread contention monitoring is enabled;
- * <tt>false</tt> otherwise.
+ * @return {@code true} if thread contention monitoring is enabled;
+ * {@code false} otherwise.
*
* @throws java.lang.UnsupportedOperationException if the Java virtual
* machine does not support thread contention monitoring.
@@ -371,8 +371,8 @@
* Enables or disables thread contention monitoring.
* Thread contention monitoring is disabled by default.
*
- * @param enable <tt>true</tt> to enable;
- * <tt>false</tt> to disable.
+ * @param enable {@code true} to enable;
+ * {@code false} to disable.
*
* @throws java.lang.UnsupportedOperationException if the Java
* virtual machine does not support thread contention monitoring.
@@ -401,7 +401,7 @@
* </pre></blockquote>
*
* @return the total CPU time for the current thread if CPU time
- * measurement is enabled; <tt>-1</tt> otherwise.
+ * measurement is enabled; {@code -1} otherwise.
*
* @throws java.lang.UnsupportedOperationException if the Java
* virtual machine does not support CPU time measurement for
@@ -428,7 +428,7 @@
* </pre></blockquote>
*
* @return the user-level CPU time for the current thread if CPU time
- * measurement is enabled; <tt>-1</tt> otherwise.
+ * measurement is enabled; {@code -1} otherwise.
*
* @throws java.lang.UnsupportedOperationException if the Java
* virtual machine does not support CPU time measurement for
@@ -451,8 +451,8 @@
*
* <p>
* If the thread of the specified ID is not alive or does not exist,
- * this method returns <tt>-1</tt>. If CPU time measurement
- * is disabled, this method returns <tt>-1</tt>.
+ * this method returns {@code -1}. If CPU time measurement
+ * is disabled, this method returns {@code -1}.
* A thread is alive if it has been started and has not yet died.
* <p>
* If CPU time measurement is enabled after the thread has started,
@@ -464,7 +464,7 @@
* @return the total CPU time for a thread of the specified ID
* if the thread of the specified ID exists, the thread is alive,
* and CPU time measurement is enabled;
- * <tt>-1</tt> otherwise.
+ * {@code -1} otherwise.
*
* @throws IllegalArgumentException if {@code id <= 0}.
* @throws java.lang.UnsupportedOperationException if the Java
@@ -486,8 +486,8 @@
*
* <p>
* If the thread of the specified ID is not alive or does not exist,
- * this method returns <tt>-1</tt>. If CPU time measurement
- * is disabled, this method returns <tt>-1</tt>.
+ * this method returns {@code -1}. If CPU time measurement
+ * is disabled, this method returns {@code -1}.
* A thread is alive if it has been started and has not yet died.
* <p>
* If CPU time measurement is enabled after the thread has started,
@@ -499,7 +499,7 @@
* @return the user-level CPU time for a thread of the specified ID
* if the thread of the specified ID exists, the thread is alive,
* and CPU time measurement is enabled;
- * <tt>-1</tt> otherwise.
+ * {@code -1} otherwise.
*
* @throws IllegalArgumentException if {@code id <= 0}.
* @throws java.lang.UnsupportedOperationException if the Java
@@ -521,32 +521,32 @@
* measurement for the current thread.
*
* @return
- * <tt>true</tt>
+ * {@code true}
* if the Java virtual machine supports CPU time
* measurement for any thread;
- * <tt>false</tt> otherwise.
+ * {@code false} otherwise.
*/
public boolean isThreadCpuTimeSupported();
/**
* Tests if the Java virtual machine supports CPU time
* measurement for the current thread.
- * This method returns <tt>true</tt> if {@link #isThreadCpuTimeSupported}
- * returns <tt>true</tt>.
+ * This method returns {@code true} if {@link #isThreadCpuTimeSupported}
+ * returns {@code true}.
*
* @return
- * <tt>true</tt>
+ * {@code true}
* if the Java virtual machine supports CPU time
* measurement for current thread;
- * <tt>false</tt> otherwise.
+ * {@code false} otherwise.
*/
public boolean isCurrentThreadCpuTimeSupported();
/**
* Tests if thread CPU time measurement is enabled.
*
- * @return <tt>true</tt> if thread CPU time measurement is enabled;
- * <tt>false</tt> otherwise.
+ * @return {@code true} if thread CPU time measurement is enabled;
+ * {@code false} otherwise.
*
* @throws java.lang.UnsupportedOperationException if the Java virtual
* machine does not support CPU time measurement for other threads
@@ -561,8 +561,8 @@
* Enables or disables thread CPU time measurement. The default
* is platform dependent.
*
- * @param enable <tt>true</tt> to enable;
- * <tt>false</tt> to disable.
+ * @param enable {@code true} to enable;
+ * {@code false} to disable.
*
* @throws java.lang.UnsupportedOperationException if the Java
* virtual machine does not support CPU time measurement for
@@ -602,7 +602,7 @@
* should be used.
*
* @return an array of IDs of the threads that are monitor
- * deadlocked, if any; <tt>null</tt> otherwise.
+ * deadlocked, if any; {@code null} otherwise.
*
* @throws java.lang.SecurityException if a security manager
* exists and the caller does not have
@@ -640,7 +640,7 @@
*
* @return an array of IDs of the threads that are
* deadlocked waiting for object monitors or ownable synchronizers, if any;
- * <tt>null</tt> otherwise.
+ * {@code null} otherwise.
*
* @throws java.lang.SecurityException if a security manager
* exists and the caller does not have
@@ -659,10 +659,10 @@
* object monitor usage.
*
* @return
- * <tt>true</tt>
+ * {@code true}
* if the Java virtual machine supports monitoring of
* object monitor usage;
- * <tt>false</tt> otherwise.
+ * {@code false} otherwise.
*
* @see #dumpAllThreads
* @since 1.6
@@ -675,10 +675,10 @@
* ownable synchronizer</a> usage.
*
* @return
- * <tt>true</tt>
+ * {@code true}
* if the Java virtual machine supports monitoring of ownable
* synchronizer usage;
- * <tt>false</tt> otherwise.
+ * {@code false} otherwise.
*
* @see #dumpAllThreads
* @since 1.6
@@ -687,7 +687,7 @@
/**
* Returns the thread info for each thread
- * whose ID is in the input array <tt>ids</tt>, with stack trace
+ * whose ID is in the input array {@code ids}, with stack trace
* and synchronization information.
*
* <p>
@@ -696,30 +696,30 @@
* <ul>
* <li>the entire stack trace,</li>
* <li>the object monitors currently locked by the thread
- * if <tt>lockedMonitors</tt> is <tt>true</tt>, and</li>
+ * if {@code lockedMonitors} is {@code true}, and</li>
* <li>the <a href="LockInfo.html#OwnableSynchronizer">
* ownable synchronizers</a> currently locked by the thread
- * if <tt>lockedSynchronizers</tt> is <tt>true</tt>.</li>
+ * if {@code lockedSynchronizers} is {@code true}.</li>
* </ul>
* <p>
- * This method returns an array of the <tt>ThreadInfo</tt> objects,
+ * This method returns an array of the {@code ThreadInfo} objects,
* each is the thread information about the thread with the same index
- * as in the <tt>ids</tt> array.
+ * as in the {@code ids} array.
* If a thread of the given ID is not alive or does not exist,
- * <tt>null</tt> will be set in the corresponding element
+ * {@code null} will be set in the corresponding element
* in the returned array. A thread is alive if
* it has been started and has not yet died.
* <p>
- * If a thread does not lock any object monitor or <tt>lockedMonitors</tt>
- * is <tt>false</tt>, the returned <tt>ThreadInfo</tt> object will have an
- * empty <tt>MonitorInfo</tt> array. Similarly, if a thread does not
- * lock any synchronizer or <tt>lockedSynchronizers</tt> is <tt>false</tt>,
- * the returned <tt>ThreadInfo</tt> object
- * will have an empty <tt>LockInfo</tt> array.
+ * If a thread does not lock any object monitor or {@code lockedMonitors}
+ * is {@code false}, the returned {@code ThreadInfo} object will have an
+ * empty {@code MonitorInfo} array. Similarly, if a thread does not
+ * lock any synchronizer or {@code lockedSynchronizers} is {@code false},
+ * the returned {@code ThreadInfo} object
+ * will have an empty {@code LockInfo} array.
*
* <p>
- * When both <tt>lockedMonitors</tt> and <tt>lockedSynchronizers</tt>
- * parameters are <tt>false</tt>, it is equivalent to calling:
+ * When both {@code lockedMonitors} and {@code lockedSynchronizers}
+ * parameters are {@code false}, it is equivalent to calling:
* <blockquote><pre>
* {@link #getThreadInfo(long[], int) getThreadInfo(ids, Integer.MAX_VALUE)}
* </pre></blockquote>
@@ -730,13 +730,13 @@
*
* <p>
* <b>MBeanServer access</b>:<br>
- * The mapped type of <tt>ThreadInfo</tt> is
- * <tt>CompositeData</tt> with attributes as specified in the
+ * The mapped type of {@code ThreadInfo} is
+ * {@code CompositeData} with attributes as specified in the
* {@link ThreadInfo#from ThreadInfo.from} method.
*
* @param ids an array of thread IDs.
- * @param lockedMonitors if <tt>true</tt>, retrieves all locked monitors.
- * @param lockedSynchronizers if <tt>true</tt>, retrieves all locked
+ * @param lockedMonitors if {@code true}, retrieves all locked monitors.
+ * @param lockedSynchronizers if {@code true}, retrieves all locked
* ownable synchronizers.
*
* @return an array of the {@link ThreadInfo} objects, each containing
@@ -748,11 +748,11 @@
* ManagementPermission("monitor").
* @throws java.lang.UnsupportedOperationException
* <ul>
- * <li>if <tt>lockedMonitors</tt> is <tt>true</tt> but
+ * <li>if {@code lockedMonitors} is {@code true} but
* the Java virtual machine does not support monitoring
* of {@linkplain #isObjectMonitorUsageSupported
* object monitor usage}; or</li>
- * <li>if <tt>lockedSynchronizers</tt> is <tt>true</tt> but
+ * <li>if {@code lockedSynchronizers} is {@code true} but
* the Java virtual machine does not support monitoring
* of {@linkplain #isSynchronizerUsageSupported
* ownable synchronizer usage}.</li>
@@ -776,8 +776,8 @@
* as specified in the {@link #getThreadInfo(long[], boolean, boolean)}
* method.
*
- * @param lockedMonitors if <tt>true</tt>, dump all locked monitors.
- * @param lockedSynchronizers if <tt>true</tt>, dump all locked
+ * @param lockedMonitors if {@code true}, dump all locked monitors.
+ * @param lockedSynchronizers if {@code true}, dump all locked
* ownable synchronizers.
*
* @return an array of {@link ThreadInfo} for all live threads.
@@ -787,11 +787,11 @@
* ManagementPermission("monitor").
* @throws java.lang.UnsupportedOperationException
* <ul>
- * <li>if <tt>lockedMonitors</tt> is <tt>true</tt> but
+ * <li>if {@code lockedMonitors} is {@code true} but
* the Java virtual machine does not support monitoring
* of {@linkplain #isObjectMonitorUsageSupported
* object monitor usage}; or</li>
- * <li>if <tt>lockedSynchronizers</tt> is <tt>true</tt> but
+ * <li>if {@code lockedSynchronizers} is {@code true} but
* the Java virtual machine does not support monitoring
* of {@linkplain #isSynchronizerUsageSupported
* ownable synchronizer usage}.</li>
--- a/jdk/src/java.management/share/classes/java/lang/management/package.html Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/java/lang/management/package.html Wed Jul 05 20:44:51 2017 +0200
@@ -169,7 +169,7 @@
the management interface by defining platform-dependent
interfaces that extend the standard management interfaces to include
platform-specific metrics and management operations.
-The static factory methods in the <tt>ManagementFactory</tt> class will
+The static factory methods in the <code>ManagementFactory</code> class will
return the MXBeans with the platform extension.
<p>
@@ -205,7 +205,7 @@
</blockquote>
<p>
-2) Access the Oracle-specific MXBean interface via <tt>MBeanServer</tt>
+2) Access the Oracle-specific MXBean interface via <code>MBeanServer</code>
through proxy
<blockquote><pre>
@@ -228,7 +228,7 @@
}
</pre></blockquote>
-<p> Unless otherwise noted, passing a <tt>null</tt> argument to a constructor
+<p> Unless otherwise noted, passing a <code>null</code> argument to a constructor
or method in any class or interface in this package will cause a {@link
java.lang.NullPointerException NullPointerException} to be thrown.
--- a/jdk/src/java.management/share/classes/javax/management/MBeanAttributeInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanAttributeInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -92,7 +92,7 @@
/**
- * Constructs an <CODE>MBeanAttributeInfo</CODE> object.
+ * Constructs an {@code MBeanAttributeInfo} object.
*
* @param name The name of the attribute.
* @param type The type or class name of the attribute.
@@ -118,7 +118,7 @@
}
/**
- * Constructs an <CODE>MBeanAttributeInfo</CODE> object.
+ * Constructs an {@code MBeanAttributeInfo} object.
*
* @param name The name of the attribute.
* @param type The type or class name of the attribute.
@@ -193,9 +193,9 @@
/**
* <p>Returns a shallow clone of this instance.
- * The clone is obtained by simply calling <tt>super.clone()</tt>,
+ * The clone is obtained by simply calling {@code super.clone()},
* thus calling the default native shallow cloning mechanism
- * implemented by <tt>Object.clone()</tt>.
+ * implemented by {@code Object.clone()}.
* No deeper cloning of any internal field is made.</p>
*
* <p>Since this class is immutable, cloning is chiefly of
@@ -274,7 +274,7 @@
*
* @param o the object to compare to.
*
- * @return true if and only if <code>o</code> is an MBeanAttributeInfo such
+ * @return true if and only if {@code o} is an MBeanAttributeInfo such
* that its {@link #getName()}, {@link #getType()}, {@link
* #getDescription()}, {@link #isReadable()}, {@link
* #isWritable()}, and {@link #isIs()} values are equal (not
--- a/jdk/src/java.management/share/classes/javax/management/MBeanConstructorInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanConstructorInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -55,14 +55,14 @@
private final MBeanParameterInfo[] signature;
/**
- * Constructs an <CODE>MBeanConstructorInfo</CODE> object. The
+ * Constructs an {@code MBeanConstructorInfo} object. The
* {@link Descriptor} of the constructed object will include
* fields contributed by any annotations on the {@code
* Constructor} object that contain the {@link DescriptorKey}
* meta-annotation.
*
* @param description A human readable description of the operation.
- * @param constructor The <CODE>java.lang.reflect.Constructor</CODE>
+ * @param constructor The {@code java.lang.reflect.Constructor}
* object describing the MBean constructor.
*/
public MBeanConstructorInfo(String description, Constructor<?> constructor) {
@@ -72,10 +72,10 @@
}
/**
- * Constructs an <CODE>MBeanConstructorInfo</CODE> object.
+ * Constructs an {@code MBeanConstructorInfo} object.
*
* @param name The name of the constructor.
- * @param signature <CODE>MBeanParameterInfo</CODE> objects
+ * @param signature {@code MBeanParameterInfo} objects
* describing the parameters(arguments) of the constructor. This
* may be null with the same effect as a zero-length array.
* @param description A human readable description of the constructor.
@@ -87,10 +87,10 @@
}
/**
- * Constructs an <CODE>MBeanConstructorInfo</CODE> object.
+ * Constructs an {@code MBeanConstructorInfo} object.
*
* @param name The name of the constructor.
- * @param signature <CODE>MBeanParameterInfo</CODE> objects
+ * @param signature {@code MBeanParameterInfo} objects
* describing the parameters(arguments) of the constructor. This
* may be null with the same effect as a zero-length array.
* @param description A human readable description of the constructor.
@@ -118,9 +118,9 @@
/**
* <p>Returns a shallow clone of this instance. The clone is
- * obtained by simply calling <tt>super.clone()</tt>, thus calling
+ * obtained by simply calling {@code super.clone()}, thus calling
* the default native shallow cloning mechanism implemented by
- * <tt>Object.clone()</tt>. No deeper cloning of any internal
+ * {@code Object.clone()}. No deeper cloning of any internal
* field is made.</p>
*
* <p>Since this class is immutable, cloning is chiefly of
@@ -137,16 +137,16 @@
/**
* <p>Returns the list of parameters for this constructor. Each
- * parameter is described by an <CODE>MBeanParameterInfo</CODE>
+ * parameter is described by an {@code MBeanParameterInfo}
* object.</p>
*
* <p>The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the <CODE>MBeanParameterInfo</CODE> objects but
- * that each referenced <CODE>MBeanParameterInfo</CODE> object is
+ * references to the {@code MBeanParameterInfo} objects but
+ * that each referenced {@code MBeanParameterInfo} object is
* not copied.</p>
*
- * @return An array of <CODE>MBeanParameterInfo</CODE> objects.
+ * @return An array of {@code MBeanParameterInfo} objects.
*/
public MBeanParameterInfo[] getSignature() {
if (signature.length == 0)
@@ -177,7 +177,7 @@
*
* @param o the object to compare to.
*
- * @return true if and only if <code>o</code> is an MBeanConstructorInfo such
+ * @return true if and only if {@code o} is an MBeanConstructorInfo such
* that its {@link #getName()}, {@link #getDescription()},
* {@link #getSignature()}, and {@link #getDescriptor()}
* values are equal (not necessarily
--- a/jdk/src/java.management/share/classes/javax/management/MBeanInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -57,12 +57,12 @@
* <a href="Descriptor.html#infoTimeout">infoTimeout</a> fields in the {@code
* MBeanInfo} {@link Descriptor}.</p>
*
- * <p>The contents of the <code>MBeanInfo</code> for a Dynamic MBean
+ * <p>The contents of the {@code MBeanInfo} for a Dynamic MBean
* are determined by its {@link DynamicMBean#getMBeanInfo
* getMBeanInfo()} method. This includes Open MBeans and Model
* MBeans, which are kinds of Dynamic MBeans.</p>
*
- * <p>The contents of the <code>MBeanInfo</code> for a Standard MBean
+ * <p>The contents of the {@code MBeanInfo} for a Standard MBean
* are determined by the MBean server as follows:</p>
*
* <ul>
@@ -96,7 +96,7 @@
* <p>The description returned by {@link #getDescription()} and the
* descriptions of the contained attributes and operations are not specified.</p>
*
- * <p>The remaining details of the <code>MBeanInfo</code> for a
+ * <p>The remaining details of the {@code MBeanInfo} for a
* Standard MBean are not specified. This includes the description of
* any contained constructors, and notifications; the names
* of parameters to constructors and operations; and the descriptions of
@@ -161,10 +161,10 @@
private final transient boolean arrayGettersSafe;
/**
- * Constructs an <CODE>MBeanInfo</CODE>.
+ * Constructs an {@code MBeanInfo}.
*
* @param className The name of the Java class of the MBean described
- * by this <CODE>MBeanInfo</CODE>. This value may be any
+ * by this {@code MBeanInfo}. This value may be any
* syntactically legal Java class name. It does not have to be a
* Java class known to the MBean server or to the MBean's
* ClassLoader. If it is a Java class known to the MBean's
@@ -195,10 +195,10 @@
}
/**
- * Constructs an <CODE>MBeanInfo</CODE>.
+ * Constructs an {@code MBeanInfo}.
*
* @param className The name of the Java class of the MBean described
- * by this <CODE>MBeanInfo</CODE>. This value may be any
+ * by this {@code MBeanInfo}. This value may be any
* syntactically legal Java class name. It does not have to be a
* Java class known to the MBean server or to the MBean's
* ClassLoader. If it is a Java class known to the MBean's
@@ -260,9 +260,9 @@
/**
* <p>Returns a shallow clone of this instance.
- * The clone is obtained by simply calling <tt>super.clone()</tt>,
+ * The clone is obtained by simply calling {@code super.clone()},
* thus calling the default native shallow cloning mechanism
- * implemented by <tt>Object.clone()</tt>.
+ * implemented by {@code Object.clone()}.
* No deeper cloning of any internal field is made.</p>
*
* <p>Since this class is immutable, the clone method is chiefly of
@@ -281,7 +281,7 @@
/**
* Returns the name of the Java class of the MBean described by
- * this <CODE>MBeanInfo</CODE>.
+ * this {@code MBeanInfo}.
*
* @return the class name.
*/
@@ -300,14 +300,14 @@
/**
* Returns the list of attributes exposed for management.
- * Each attribute is described by an <CODE>MBeanAttributeInfo</CODE> object.
+ * Each attribute is described by an {@code MBeanAttributeInfo} object.
*
* The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the <CODE>MBeanAttributeInfo</CODE> objects
- * but that each referenced <CODE>MBeanAttributeInfo</CODE> object is not copied.
+ * references to the {@code MBeanAttributeInfo} objects
+ * but that each referenced {@code MBeanAttributeInfo} object is not copied.
*
- * @return An array of <CODE>MBeanAttributeInfo</CODE> objects.
+ * @return An array of {@code MBeanAttributeInfo} objects.
*/
public MBeanAttributeInfo[] getAttributes() {
MBeanAttributeInfo[] as = nonNullAttributes();
@@ -342,14 +342,14 @@
/**
* Returns the list of operations of the MBean.
- * Each operation is described by an <CODE>MBeanOperationInfo</CODE> object.
+ * Each operation is described by an {@code MBeanOperationInfo} object.
*
* The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the <CODE>MBeanOperationInfo</CODE> objects
- * but that each referenced <CODE>MBeanOperationInfo</CODE> object is not copied.
+ * references to the {@code MBeanOperationInfo} objects
+ * but that each referenced {@code MBeanOperationInfo} object is not copied.
*
- * @return An array of <CODE>MBeanOperationInfo</CODE> objects.
+ * @return An array of {@code MBeanOperationInfo} objects.
*/
public MBeanOperationInfo[] getOperations() {
MBeanOperationInfo[] os = nonNullOperations();
@@ -374,12 +374,12 @@
/**
* <p>Returns the list of the public constructors of the MBean.
* Each constructor is described by an
- * <CODE>MBeanConstructorInfo</CODE> object.</p>
+ * {@code MBeanConstructorInfo} object.</p>
*
* <p>The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the <CODE>MBeanConstructorInfo</CODE> objects but
- * that each referenced <CODE>MBeanConstructorInfo</CODE> object
+ * references to the {@code MBeanConstructorInfo} objects but
+ * that each referenced {@code MBeanConstructorInfo} object
* is not copied.</p>
*
* <p>The returned list is not necessarily exhaustive. That is,
@@ -388,7 +388,7 @@
* instance of this MBean's class using that constructor, even
* though it is not listed here.</p>
*
- * @return An array of <CODE>MBeanConstructorInfo</CODE> objects.
+ * @return An array of {@code MBeanConstructorInfo} objects.
*/
public MBeanConstructorInfo[] getConstructors() {
MBeanConstructorInfo[] cs = nonNullConstructors();
@@ -412,14 +412,14 @@
/**
* Returns the list of the notifications emitted by the MBean.
- * Each notification is described by an <CODE>MBeanNotificationInfo</CODE> object.
+ * Each notification is described by an {@code MBeanNotificationInfo} object.
*
* The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the <CODE>MBeanNotificationInfo</CODE> objects
- * but that each referenced <CODE>MBeanNotificationInfo</CODE> object is not copied.
+ * references to the {@code MBeanNotificationInfo} objects
+ * but that each referenced {@code MBeanNotificationInfo} object is not copied.
*
- * @return An array of <CODE>MBeanNotificationInfo</CODE> objects.
+ * @return An array of {@code MBeanNotificationInfo} objects.
*/
public MBeanNotificationInfo[] getNotifications() {
MBeanNotificationInfo[] ns = nonNullNotifications();
@@ -482,7 +482,7 @@
*
* @param o the object to compare to.
*
- * @return true if and only if <code>o</code> is an MBeanInfo that is equal
+ * @return true if and only if {@code o} is an MBeanInfo that is equal
* to this one according to the rules above.
*/
@Override
@@ -534,12 +534,12 @@
new WeakHashMap<Class<?>, Boolean>();
/**
- * Return true if <code>subclass</code> is known to preserve the
- * immutability of <code>immutableClass</code>. The class
- * <code>immutableClass</code> is a reference class that is known
- * to be immutable. The subclass <code>subclass</code> is
+ * Return true if {@code subclass} is known to preserve the
+ * immutability of {@code immutableClass}. The class
+ * {@code immutableClass} is a reference class that is known
+ * to be immutable. The subclass {@code subclass} is
* considered immutable if it does not override any public method
- * of <code>immutableClass</code> whose name begins with "get".
+ * of {@code immutableClass} whose name begins with "get".
* This is obviously not an infallible test for immutability,
* but it works for the public interfaces of the MBean*Info classes.
*/
--- a/jdk/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanNotificationInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,29 +32,29 @@
import java.util.Objects;
/**
- * <p>The <CODE>MBeanNotificationInfo</CODE> class is used to describe the
+ * <p>The {@code MBeanNotificationInfo} class is used to describe the
* characteristics of the different notification instances
* emitted by an MBean, for a given Java class of notification.
* If an MBean emits notifications that can be instances of different Java classes,
- * then the metadata for that MBean should provide an <CODE>MBeanNotificationInfo</CODE>
+ * then the metadata for that MBean should provide an {@code MBeanNotificationInfo}
* object for each of these notification Java classes.</p>
*
* <p>Instances of this class are immutable. Subclasses may be
* mutable but this is not recommended.</p>
*
- * <p>This class extends <CODE>javax.management.MBeanFeatureInfo</CODE>
- * and thus provides <CODE>name</CODE> and <CODE>description</CODE> fields.
- * The <CODE>name</CODE> field should be the fully qualified Java class name of
+ * <p>This class extends {@code javax.management.MBeanFeatureInfo}
+ * and thus provides {@code name} and {@code description} fields.
+ * The {@code name} field should be the fully qualified Java class name of
* the notification objects described by this class.</p>
*
- * <p>The <CODE>getNotifTypes</CODE> method returns an array of
+ * <p>The {@code getNotifTypes} method returns an array of
* strings containing the notification types that the MBean may
* emit. The notification type is a dot-notation string which
* describes what the emitted notification is about, not the Java
* class of the notification. A single generic notification class can
* be used to send notifications of several types. All of these types
* are returned in the string array result of the
- * <CODE>getNotifTypes</CODE> method.
+ * {@code getNotifTypes} method.
*
* @since 1.5
*/
@@ -77,7 +77,7 @@
private final transient boolean arrayGettersSafe;
/**
- * Constructs an <CODE>MBeanNotificationInfo</CODE> object.
+ * Constructs an {@code MBeanNotificationInfo} object.
*
* @param notifTypes The array of strings (in dot notation)
* containing the notification types that the MBean may emit.
@@ -93,7 +93,7 @@
}
/**
- * Constructs an <CODE>MBeanNotificationInfo</CODE> object.
+ * Constructs an {@code MBeanNotificationInfo} object.
*
* @param notifTypes The array of strings (in dot notation)
* containing the notification types that the MBean may emit.
@@ -128,9 +128,9 @@
/**
* Returns a shallow clone of this instance.
- * The clone is obtained by simply calling <tt>super.clone()</tt>,
+ * The clone is obtained by simply calling {@code super.clone()},
* thus calling the default native shallow cloning mechanism
- * implemented by <tt>Object.clone()</tt>.
+ * implemented by {@code Object.clone()}.
* No deeper cloning of any internal field is made.
*/
public Object clone () {
@@ -179,7 +179,7 @@
*
* @param o the object to compare to.
*
- * @return true if and only if <code>o</code> is an MBeanNotificationInfo
+ * @return true if and only if {@code o} is an MBeanNotificationInfo
* such that its {@link #getName()}, {@link #getDescription()},
* {@link #getDescriptor()},
* and {@link #getNotifTypes()} values are equal (not necessarily
--- a/jdk/src/java.management/share/classes/javax/management/MBeanOperationInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanOperationInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -83,10 +83,7 @@
/**
* @serial The impact of the method, one of
- * <CODE>INFO</CODE>,
- * <CODE>ACTION</CODE>,
- * <CODE>ACTION_INFO</CODE>,
- * <CODE>UNKNOWN</CODE>
+ * {@code INFO, ACTION, ACTION_INFO, UNKNOWN}.
*/
private final int impact;
@@ -95,12 +92,12 @@
/**
- * Constructs an <CODE>MBeanOperationInfo</CODE> object. The
+ * Constructs an {@code MBeanOperationInfo} object. The
* {@link Descriptor} of the constructed object will include
* fields contributed by any annotations on the {@code Method}
* object that contain the {@link DescriptorKey} meta-annotation.
*
- * @param method The <CODE>java.lang.reflect.Method</CODE> object
+ * @param method The {@code java.lang.reflect.Method} object
* describing the MBean operation.
* @param description A human readable description of the operation.
*/
@@ -114,11 +111,11 @@
}
/**
- * Constructs an <CODE>MBeanOperationInfo</CODE> object.
+ * Constructs an {@code MBeanOperationInfo} object.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
- * @param signature <CODE>MBeanParameterInfo</CODE> objects
+ * @param signature {@code MBeanParameterInfo} objects
* describing the parameters(arguments) of the method. This may be
* null with the same effect as a zero-length array.
* @param type The type of the method's return value.
@@ -135,11 +132,11 @@
}
/**
- * Constructs an <CODE>MBeanOperationInfo</CODE> object.
+ * Constructs an {@code MBeanOperationInfo} object.
*
* @param name The name of the method.
* @param description A human readable description of the operation.
- * @param signature <CODE>MBeanParameterInfo</CODE> objects
+ * @param signature {@code MBeanParameterInfo} objects
* describing the parameters(arguments) of the method. This may be
* null with the same effect as a zero-length array.
* @param type The type of the method's return value.
@@ -174,9 +171,9 @@
/**
* <p>Returns a shallow clone of this instance.
- * The clone is obtained by simply calling <tt>super.clone()</tt>,
+ * The clone is obtained by simply calling {@code super.clone()},
* thus calling the default native shallow cloning mechanism
- * implemented by <tt>Object.clone()</tt>.
+ * implemented by {@code Object.clone()}.
* No deeper cloning of any internal field is made.</p>
*
* <p>Since this class is immutable, cloning is chiefly of interest
@@ -203,16 +200,16 @@
/**
* <p>Returns the list of parameters for this operation. Each
- * parameter is described by an <CODE>MBeanParameterInfo</CODE>
+ * parameter is described by an {@code MBeanParameterInfo}
* object.</p>
*
* <p>The returned array is a shallow copy of the internal array,
* which means that it is a copy of the internal array of
- * references to the <CODE>MBeanParameterInfo</CODE> objects but
- * that each referenced <CODE>MBeanParameterInfo</CODE> object is
+ * references to the {@code MBeanParameterInfo} objects but
+ * that each referenced {@code MBeanParameterInfo} object is
* not copied.</p>
*
- * @return An array of <CODE>MBeanParameterInfo</CODE> objects.
+ * @return An array of {@code MBeanParameterInfo} objects.
*/
public MBeanParameterInfo[] getSignature() {
// If MBeanOperationInfo was created in our implementation,
@@ -247,7 +244,7 @@
/**
* Returns the impact of the method, one of
- * <CODE>INFO</CODE>, <CODE>ACTION</CODE>, <CODE>ACTION_INFO</CODE>, <CODE>UNKNOWN</CODE>.
+ * {@code INFO, ACTION, ACTION_INFO, UNKNOWN}.
*
* @return the impact code.
*/
@@ -280,7 +277,7 @@
*
* @param o the object to compare to.
*
- * @return true if and only if <code>o</code> is an MBeanOperationInfo such
+ * @return true if and only if {@code o} is an MBeanOperationInfo such
* that its {@link #getName()}, {@link #getReturnType()}, {@link
* #getDescription()}, {@link #getImpact()}, {@link #getDescriptor()}
* and {@link #getSignature()} values are equal (not necessarily identical)
--- a/jdk/src/java.management/share/classes/javax/management/MBeanParameterInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanParameterInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -50,7 +50,7 @@
/**
- * Constructs an <CODE>MBeanParameterInfo</CODE> object.
+ * Constructs an {@code MBeanParameterInfo} object.
*
* @param name The name of the data
* @param type The type or class name of the data
@@ -63,7 +63,7 @@
}
/**
- * Constructs an <CODE>MBeanParameterInfo</CODE> object.
+ * Constructs an {@code MBeanParameterInfo} object.
*
* @param name The name of the data
* @param type The type or class name of the data
@@ -85,9 +85,9 @@
/**
* <p>Returns a shallow clone of this instance.
- * The clone is obtained by simply calling <tt>super.clone()</tt>,
+ * The clone is obtained by simply calling {@code super.clone()},
* thus calling the default native shallow cloning mechanism
- * implemented by <tt>Object.clone()</tt>.
+ * implemented by {@code Object.clone()}.
* No deeper cloning of any internal field is made.</p>
*
* <p>Since this class is immutable, cloning is chiefly of
@@ -126,7 +126,7 @@
*
* @param o the object to compare to.
*
- * @return true if and only if <code>o</code> is an MBeanParameterInfo such
+ * @return true if and only if {@code o} is an MBeanParameterInfo such
* that its {@link #getName()}, {@link #getType()},
* {@link #getDescriptor()}, and {@link
* #getDescription()} values are equal (not necessarily identical)
--- a/jdk/src/java.management/share/classes/javax/management/monitor/package.html Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/monitor/package.html Wed Jul 05 20:44:51 2017 +0200
@@ -41,20 +41,20 @@
<p id="complex">The value being monitored can be a simple value
contained within a complex type. For example, the {@link
java.lang.management.MemoryMXBean MemoryMXBean} defined in
- <tt>java.lang.management</tt> has an attribute
- <tt>HeapMemoryUsage</tt> of type {@link
+ {@code java.lang.management} has an attribute
+ {@code HeapMemoryUsage} of type {@link
java.lang.management.MemoryUsage MemoryUsage}. To monitor the
- amount of <i>used</i> memory, described by the <tt>used</tt>
- property of <tt>MemoryUsage</tt>, you could monitor
- "<tt>HeapMemoryUsage.used</tt>". That string would be the
+ amount of <i>used</i> memory, described by the {@code used}
+ property of {@code MemoryUsage}, you could monitor
+ "{@code HeapMemoryUsage.used}". That string would be the
argument to {@link
javax.management.monitor.MonitorMBean#setObservedAttribute(String)
setObservedAttribute}.</p>
- <p>The rules used to interpret an <tt>ObservedAttribute</tt> like
- <tt>"HeapMemoryUsage.used"</tt> are as follows. Suppose the string is
- <i>A.e</i> (so <i>A</i> would be <tt>"HeapMemoryUsage"</tt> and <i>e</i>
- would be <tt>"used"</tt> in the example).</p>
+ <p>The rules used to interpret an {@code ObservedAttribute} like
+ {@code "HeapMemoryUsage.used"} are as follows. Suppose the string is
+ <i>A.e</i> (so <i>A</i> would be {@code "HeapMemoryUsage"} and <i>e</i>
+ would be {@code "used"} in the example).</p>
<p>First the value of the attribute <i>A</i> is obtained. Call it
<i>v</i>. A value <i>x</i> is extracted from <i>v</i> as follows:</p>
@@ -65,49 +65,49 @@
CompositeData} and if <i>v</i>.{@link
javax.management.openmbean.CompositeData#get(String) get}(<i>e</i>)
returns a value then <i>x</i> is that value.</li>
- <li>If <i>v</i> is an array and <i>e</i> is the string <tt>"length"</tt>
+ <li>If <i>v</i> is an array and <i>e</i> is the string {@code "length"}
then <i>x</i> is the length of the array.</li>
<li>If the above rules do not produce a value, and if introspection, as
if by calling {@link java.beans.Introspector#getBeanInfo(Class)
Introspector.getBeanInfo}, for the class of <i>v</i>
- (<i>v</i>.<tt>getClass()</tt>) identifies a property with the name
+ (<i>v</i>.{@code getClass()}) identifies a property with the name
<i>e</i>, then <i>x</i> is the result of reading the property value. </li>
</ul>
<p>The third rule means for example that if the attribute
- <tt>HeapMemoryUsage</tt> is a <tt>MemoryUsage</tt>, monitoring
- <tt>"HeapMemoryUsage.used"</tt> will obtain the observed value by
- calling <tt>MemoryUsage.getUsed()</tt>.</p>
+ {@code HeapMemoryUsage} is a {@code MemoryUsage}, monitoring
+ {@code "HeapMemoryUsage.used"} will obtain the observed value by
+ calling {@code MemoryUsage.getUsed()}.</p>
- <p>If the <tt>ObservedAttribute</tt> contains more than one period,
- for example <tt>"ConnectionPool.connectionStats.length"</tt>, then the
+ <p>If the {@code ObservedAttribute} contains more than one period,
+ for example {@code "ConnectionPool.connectionStats.length"}, then the
above rules are applied iteratively. Here, <i>v</i> would initially be
- the value of the attribute <tt>ConnectionPool</tt>, and <i>x</i> would
+ the value of the attribute {@code ConnectionPool}, and <i>x</i> would
be derived by applying the above rules with <i>e</i> equal to
- <tt>"connectionStats"</tt>. Then <i>v</i> would be set to this <i>x</i>
+ {@code "connectionStats"}. Then <i>v</i> would be set to this <i>x</i>
and a new <i>x</i> derived by applying the rules again with <i>e</i>
- equal to <tt>"length"</tt>.</p>
+ equal to {@code "length"}.</p>
<p>Although it is recommended that attribute names be valid Java
identifiers, it is possible for an attribute to be called
- <tt>HeapMemoryUsage.used</tt>. This means that an
- <tt>ObservedAttribute</tt> that is <tt>HeapMemoryUsage.used</tt>
+ {@code HeapMemoryUsage.used}. This means that an
+ {@code ObservedAttribute} that is {@code HeapMemoryUsage.used}
could mean that the value to observe is either an attribute of that
- name, or the property <tt>used</tt> within an attribute called
- <tt>HeapMemoryUsage</tt>. So for compatibility reasons, when the
- <tt>ObservedAttribute</tt> contains a period (<tt>.</tt>), the monitor
+ name, or the property {@code used} within an attribute called
+ {@code HeapMemoryUsage}. So for compatibility reasons, when the
+ {@code ObservedAttribute} contains a period ({@code .}), the monitor
will check whether an attribute exists whose name is the full
- <tt>ObservedAttribute</tt> string (<tt>HeapMemoryUsage.used</tt> in the
+ {@code ObservedAttribute} string ({@code HeapMemoryUsage.used} in the
example). It does this by calling {@link
javax.management.MBeanServer#getMBeanInfo(javax.management.ObjectName)
getMBeanInfo} for the observed MBean and looking for a contained {@link
javax.management.MBeanAttributeInfo MBeanAttributeInfo} with the given
name. If one is found, then that is what is monitored. If more than one
MBean is being observed, the behavior is unspecified if some of them have
- a <tt>HeapMemoryUsage.used</tt> attribute and others do not. An
- implementation may therefore call <tt>getMBeanInfo</tt> on just one of
+ a {@code HeapMemoryUsage.used} attribute and others do not. An
+ implementation may therefore call {@code getMBeanInfo} on just one of
the MBeans in this case. The behavior is also unspecified if the result
of the check changes while the monitor is active.</p>
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java Wed Jul 05 20:44:51 2017 +0200
@@ -29,7 +29,7 @@
import java.lang.reflect.Array;
/**
- * The <code>ArrayType</code> class is the <i>open type</i> class whose instances describe
+ * The {@code ArrayType} class is the <i>open type</i> class whose instances describe
* all <i>open data</i> values which are n-dimensional arrays of <i>open data</i> values.
* <p>
* Examples of valid {@code ArrayType} instances are:
@@ -222,22 +222,31 @@
/* *** Constructor *** */
/**
- * Constructs an <tt>ArrayType</tt> instance describing <i>open data</i> values which are
- * arrays with dimension <var>dimension</var> of elements whose <i>open type</i> is <var>elementType</var>.
+ * Constructs an {@code ArrayType} instance describing <i>open data</i> values which are
+ * arrays with dimension <var>dimension</var> of elements
+ * whose <i>open type</i> is <var>elementType</var>.
* <p>
- * When invoked on an <tt>ArrayType</tt> instance, the {@link OpenType#getClassName() getClassName} method
- * returns the class name of the array instances it describes (following the rules defined by the
- * {@link Class#getName() getName} method of <code>java.lang.Class</code>), not the class name of the array elements
- * (which is returned by a call to <tt>getElementOpenType().getClassName()</tt>).
+ * When invoked on an {@code ArrayType} instance,
+ * the {@link OpenType#getClassName() getClassName} method
+ * returns the class name of the array instances it describes
+ * (following the rules defined by the
+ * {@link Class#getName() getName} method of {@code java.lang.Class}),
+ * not the class name of the array elements
+ * (which is returned by a call to {@code getElementOpenType().getClassName()}).
* <p>
- * The internal field corresponding to the type name of this <code>ArrayType</code> instance is also set to
+ * The internal field corresponding to the type name of this
+ * {@code ArrayType} instance is also set to
* the class name of the array instances it describes.
- * In other words, the methods <code>getClassName</code> and <code>getTypeName</code> return the same string value.
- * The internal field corresponding to the description of this <code>ArrayType</code> instance is set to a string value
+ * In other words, the methods {@code getClassName} and
+ * {@code getTypeName} return the same string value.
+ * The internal field corresponding to the description of this
+ * {@code ArrayType} instance is set to a string value
* which follows the following template:
* <ul>
- * <li>if non-primitive array: <tt><i><dimension></i>-dimension array of <i><element_class_name></i></tt></li>
- * <li>if primitive array: <tt><i><dimension></i>-dimension array of <i><primitive_type_of_the_element_class_name></i></tt></li>
+ * <li>if non-primitive array: <code><i><dimension></i>-dimension array
+ * of <i><element_class_name></i></code></li>
+ * <li>if primitive array: <code><i><dimension></i>-dimension array
+ * of <i><primitive_type_of_the_element_class_name></i></code></li>
* </ul>
* <p>
* As an example, the following piece of code:
@@ -267,16 +276,16 @@
* System.out.println("array type description = " + t3.getDescription());
* }</pre>
*
- * @param dimension the dimension of arrays described by this <tt>ArrayType</tt> instance;
+ * @param dimension the dimension of arrays described by this {@code ArrayType} instance;
* must be greater than or equal to 1.
*
* @param elementType the <i>open type</i> of element values contained
- * in the arrays described by this <tt>ArrayType</tt>
+ * in the arrays described by this {@code ArrayType}
* instance; must be an instance of either
- * <tt>SimpleType</tt>, <tt>CompositeType</tt>,
- * <tt>TabularType</tt> or another <tt>ArrayType</tt>
- * with a <tt>SimpleType</tt>, <tt>CompositeType</tt>
- * or <tt>TabularType</tt> as its <tt>elementType</tt>.
+ * {@code SimpleType}, {@code CompositeType},
+ * {@code TabularType} or another {@code ArrayType}
+ * with a {@code SimpleType}, {@code CompositeType}
+ * or {@code TabularType} as its {@code elementType}.
*
* @throws IllegalArgumentException if {@code dimension} is not a positive
* integer.
@@ -318,19 +327,27 @@
* returns the {@link SimpleType} corresponding to the wrapper
* type of the primitive type of the array.
* <p>
- * When invoked on an <tt>ArrayType</tt> instance, the {@link OpenType#getClassName() getClassName} method
- * returns the class name of the array instances it describes (following the rules defined by the
- * {@link Class#getName() getName} method of <code>java.lang.Class</code>), not the class name of the array elements
- * (which is returned by a call to <tt>getElementOpenType().getClassName()</tt>).
+ * When invoked on an {@code ArrayType} instance,
+ * the {@link OpenType#getClassName() getClassName} method
+ * returns the class name of the array instances it describes
+ * (following the rules defined by the
+ * {@link Class#getName() getName} method of {@code java.lang.Class}),
+ * not the class name of the array elements
+ * (which is returned by a call to {@code getElementOpenType().getClassName()}).
* <p>
- * The internal field corresponding to the type name of this <code>ArrayType</code> instance is also set to
+ * The internal field corresponding to the type name of this
+ * {@code ArrayType} instance is also set to
* the class name of the array instances it describes.
- * In other words, the methods <code>getClassName</code> and <code>getTypeName</code> return the same string value.
- * The internal field corresponding to the description of this <code>ArrayType</code> instance is set to a string value
+ * In other words, the methods {@code getClassName} and
+ * {@code getTypeName} return the same string value.
+ * The internal field corresponding to the description
+ * of this {@code ArrayType} instance is set to a string value
* which follows the following template:
* <ul>
- * <li>if non-primitive array: <tt>1-dimension array of <i><element_class_name></i></tt></li>
- * <li>if primitive array: <tt>1-dimension array of <i><primitive_type_of_the_element_class_name></i></tt></li>
+ * <li>if non-primitive array: <code>1-dimension array
+ * of <i><element_class_name></i></code></li>
+ * <li>if primitive array: <code>1-dimension array
+ * of <i><primitive_type_of_the_element_class_name></i></code></li>
* </ul>
* <p>
* As an example, the following piece of code:
@@ -483,7 +500,7 @@
/* *** ArrayType specific information methods *** */
/**
- * Returns the dimension of arrays described by this <tt>ArrayType</tt> instance.
+ * Returns the dimension of arrays described by this {@code ArrayType} instance.
*
* @return the dimension.
*/
@@ -493,7 +510,8 @@
}
/**
- * Returns the <i>open type</i> of element values contained in the arrays described by this <tt>ArrayType</tt> instance.
+ * Returns the <i>open type</i> of element values contained
+ * in the arrays described by this {@code ArrayType} instance.
*
* @return the element type.
*/
@@ -503,8 +521,8 @@
}
/**
- * Returns <code>true</code> if the open data values this open
- * type describes are primitive arrays, <code>false</code> otherwise.
+ * Returns {@code true} if the open data values this open
+ * type describes are primitive arrays, {@code false} otherwise.
*
* @return true if this is a primitive array type.
*
@@ -516,32 +534,32 @@
}
/**
- * Tests whether <var>obj</var> is a value for this <code>ArrayType</code>
+ * Tests whether <var>obj</var> is a value for this {@code ArrayType}
* instance.
* <p>
- * This method returns <code>true</code> if and only if <var>obj</var>
+ * This method returns {@code true} if and only if <var>obj</var>
* is not null, <var>obj</var> is an array and any one of the following
- * is <tt>true</tt>:
+ * is {@code true}:
*
* <ul>
- * <li>if this <code>ArrayType</code> instance describes an array of
- * <tt>SimpleType</tt> elements or their corresponding primitive types,
+ * <li>if this {@code ArrayType} instance describes an array of
+ * {@code SimpleType} elements or their corresponding primitive types,
* <var>obj</var>'s class name is the same as the className field defined
- * for this <code>ArrayType</code> instance (i.e. the class name returned
+ * for this {@code ArrayType} instance (i.e. the class name returned
* by the {@link OpenType#getClassName() getClassName} method, which
* includes the dimension information),<br> </li>
- * <li>if this <code>ArrayType</code> instance describes an array of
+ * <li>if this {@code ArrayType} instance describes an array of
* classes implementing the {@code TabularData} interface or the
* {@code CompositeData} interface, <var>obj</var> is assignable to
* such a declared array, and each element contained in {<var>obj</var>
* is either null or a valid value for the element's open type specified
- * by this <code>ArrayType</code> instance.</li>
+ * by this {@code ArrayType} instance.</li>
* </ul>
*
* @param obj the object to be tested.
*
- * @return <code>true</code> if <var>obj</var> is a value for this
- * <code>ArrayType</code> instance.
+ * @return {@code true} if <var>obj</var> is a value for this
+ * {@code ArrayType} instance.
*/
public boolean isValue(Object obj) {
@@ -649,21 +667,21 @@
/* *** Methods overriden from class Object *** */
/**
- * Compares the specified <code>obj</code> parameter with this
- * <code>ArrayType</code> instance for equality.
+ * Compares the specified {@code obj} parameter with this
+ * {@code ArrayType} instance for equality.
* <p>
- * Two <code>ArrayType</code> instances are equal if and only if they
+ * Two {@code ArrayType} instances are equal if and only if they
* describe array instances which have the same dimension, elements'
* open type and primitive array flag.
*
* @param obj the object to be compared for equality with this
- * <code>ArrayType</code> instance; if <var>obj</var>
- * is <code>null</code> or is not an instance of the
- * class <code>ArrayType</code> this method returns
- * <code>false</code>.
+ * {@code ArrayType} instance; if <var>obj</var>
+ * is {@code null} or is not an instance of the
+ * class {@code ArrayType} this method returns
+ * {@code false}.
*
- * @return <code>true</code> if the specified object is equal to
- * this <code>ArrayType</code> instance.
+ * @return {@code true} if the specified object is equal to
+ * this {@code ArrayType} instance.
*/
public boolean equals(Object obj) {
@@ -697,25 +715,25 @@
}
/**
- * Returns the hash code value for this <code>ArrayType</code> instance.
+ * Returns the hash code value for this {@code ArrayType} instance.
* <p>
- * The hash code of an <code>ArrayType</code> instance is the sum of the
- * hash codes of all the elements of information used in <code>equals</code>
+ * The hash code of an {@code ArrayType} instance is the sum of the
+ * hash codes of all the elements of information used in {@code equals}
* comparisons (i.e. dimension, elements' open type and primitive array flag).
* The hashcode for a primitive value is the hashcode of the corresponding boxed
- * object (e.g. the hashcode for <tt>true</tt> is <tt>Boolean.TRUE.hashCode()</tt>).
- * This ensures that <code> t1.equals(t2) </code> implies that
- * <code> t1.hashCode()==t2.hashCode() </code> for any two
- * <code>ArrayType</code> instances <code>t1</code> and <code>t2</code>,
+ * object (e.g. the hashcode for {@code true} is {@code Boolean.TRUE.hashCode()}).
+ * This ensures that {@code t1.equals(t2)} implies that
+ * {@code t1.hashCode()==t2.hashCode()} for any two
+ * {@code ArrayType} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
* <p>
- * As <code>ArrayType</code> instances are immutable, the hash
+ * As {@code ArrayType} instances are immutable, the hash
* code for this instance is calculated once, on the first call
- * to <code>hashCode</code>, and then the same value is returned
+ * to {@code hashCode}, and then the same value is returned
* for subsequent calls.
*
- * @return the hash code value for this <code>ArrayType</code> instance
+ * @return the hash code value for this {@code ArrayType} instance
*/
public int hashCode() {
@@ -735,19 +753,19 @@
}
/**
- * Returns a string representation of this <code>ArrayType</code> instance.
+ * Returns a string representation of this {@code ArrayType} instance.
* <p>
* The string representation consists of the name of this class (i.e.
- * <code>javax.management.openmbean.ArrayType</code>), the type name,
+ * {@code javax.management.openmbean.ArrayType}), the type name,
* the dimension, the elements' open type and the primitive array flag
* defined for this instance.
* <p>
- * As <code>ArrayType</code> instances are immutable, the
+ * As {@code ArrayType} instances are immutable, the
* string representation for this instance is calculated
- * once, on the first call to <code>toString</code>, and
+ * once, on the first call to {@code toString}, and
* then the same value is returned for subsequent calls.
*
- * @return a string representation of this <code>ArrayType</code> instance
+ * @return a string representation of this {@code ArrayType} instance
*/
public String toString() {
@@ -795,12 +813,12 @@
*
* @param <E> the Java type that described instances must have
* @param elementType the <i>open type</i> of element values contained
- * in the arrays described by this <tt>ArrayType</tt>
+ * in the arrays described by this {@code ArrayType}
* instance; must be an instance of either
- * <tt>SimpleType</tt>, <tt>CompositeType</tt>,
- * <tt>TabularType</tt> or another <tt>ArrayType</tt>
- * with a <tt>SimpleType</tt>, <tt>CompositeType</tt>
- * or <tt>TabularType</tt> as its <tt>elementType</tt>.
+ * {@code SimpleType}, {@code CompositeType},
+ * {@code TabularType} or another {@code ArrayType}
+ * with a {@code SimpleType}, {@code CompositeType}
+ * or {@code TabularType} as its {@code elementType}.
* @return an {@code ArrayType} instance
* @throws OpenDataException if <var>elementType's className</var> is not
* one of the allowed Java class names for open
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeData.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeData.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,7 +36,8 @@
/**
- * The <tt>CompositeData</tt> interface specifies the behavior of a specific type of complex <i>open data</i> objects
+ * The {@code CompositeData} interface specifies
+ * the behavior of a specific type of complex <i>open data</i> objects
* which represent <i>composite data</i> structures.
*
*
@@ -53,55 +54,60 @@
public CompositeType getCompositeType();
/**
- * Returns the value of the item whose name is <tt>key</tt>.
+ * Returns the value of the item whose name is {@code key}.
*
* @param key the name of the item.
*
* @return the value associated with this key.
*
- * @throws IllegalArgumentException if <tt>key</tt> is a null or empty String.
+ * @throws IllegalArgumentException if {@code key} is a null or empty String.
*
- * @throws InvalidKeyException if <tt>key</tt> is not an existing item name for this <tt>CompositeData</tt> instance.
+ * @throws InvalidKeyException if {@code key} is not an
+ * existing item name for this {@code CompositeData} instance.
*/
public Object get(String key) ;
/**
- * Returns an array of the values of the items whose names are specified by <tt>keys</tt>, in the same order as <tt>keys</tt>.
+ * Returns an array of the values of the items whose names
+ * are specified by {@code keys}, in the same order as {@code keys}.
*
* @param keys the names of the items.
*
* @return the values corresponding to the keys.
*
- * @throws IllegalArgumentException if an element in <tt>keys</tt> is a null or empty String.
+ * @throws IllegalArgumentException if an element in {@code keys} is a null or empty String.
*
- * @throws InvalidKeyException if an element in <tt>keys</tt> is not an existing item name for this <tt>CompositeData</tt> instance.
+ * @throws InvalidKeyException if an element in {@code keys}
+ * is not an existing item name for this {@code CompositeData} instance.
*/
public Object[] getAll(String[] keys) ;
/**
- * Returns <tt>true</tt> if and only if this <tt>CompositeData</tt> instance contains
- * an item whose name is <tt>key</tt>.
- * If <tt>key</tt> is a null or empty String, this method simply returns false.
+ * Returns {@code true} if and only if this {@code CompositeData} instance contains
+ * an item whose name is {@code key}.
+ * If {@code key} is a null or empty String, this method simply returns false.
*
* @param key the key to be tested.
*
- * @return true if this <tt>CompositeData</tt> contains the key.
+ * @return true if this {@code CompositeData} contains the key.
*/
public boolean containsKey(String key) ;
/**
- * Returns <tt>true</tt> if and only if this <tt>CompositeData</tt> instance contains an item
- * whose value is <tt>value</tt>.
+ * Returns {@code true} if and only if this {@code CompositeData} instance contains an item
+ * whose value is {@code value}.
*
* @param value the value to be tested.
*
- * @return true if this <tt>CompositeData</tt> contains the value.
+ * @return true if this {@code CompositeData} contains the value.
*/
public boolean containsValue(Object value) ;
/**
- * Returns an unmodifiable Collection view of the item values contained in this <tt>CompositeData</tt> instance.
- * The returned collection's iterator will return the values in the ascending lexicographic order of the corresponding
+ * Returns an unmodifiable Collection view of the item values
+ * contained in this {@code CompositeData} instance.
+ * The returned collection's iterator will return the values
+ * in the ascending lexicographic order of the corresponding
* item names.
*
* @return the values.
@@ -110,12 +116,12 @@
/**
* Compares the specified <var>obj</var> parameter with this
- * <code>CompositeData</code> instance for equality.
+ * {@code CompositeData} instance for equality.
* <p>
- * Returns <tt>true</tt> if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
* <ul>
* <li><var>obj</var> is non null,</li>
- * <li><var>obj</var> also implements the <code>CompositeData</code> interface,</li>
+ * <li><var>obj</var> also implements the {@code CompositeData} interface,</li>
* <li>their composite types are equal</li>
* <li>their contents, i.e. (name, value) pairs are equal. If a value contained in
* the content is an array, the value comparison is done as if by calling
@@ -124,28 +130,28 @@
* {@code Arrays.equals(e1,e2)} for arrays of primitive types</li>
* </ul>
* <p>
- * This ensures that this <tt>equals</tt> method works properly for
+ * This ensures that this {@code equals} method works properly for
* <var>obj</var> parameters which are different implementations of the
- * <code>CompositeData</code> interface, with the restrictions mentioned in the
+ * {@code CompositeData} interface, with the restrictions mentioned in the
* {@link java.util.Collection#equals(Object) equals}
- * method of the <tt>java.util.Collection</tt> interface.
+ * method of the {@code java.util.Collection} interface.
*
* @param obj the object to be compared for equality with this
- * <code>CompositeData</code> instance.
- * @return <code>true</code> if the specified object is equal to this
- * <code>CompositeData</code> instance.
+ * {@code CompositeData} instance.
+ * @return {@code true} if the specified object is equal to this
+ * {@code CompositeData} instance.
*/
public boolean equals(Object obj) ;
/**
- * Returns the hash code value for this <code>CompositeData</code> instance.
+ * Returns the hash code value for this {@code CompositeData} instance.
* <p>
- * The hash code of a <code>CompositeData</code> instance is the sum of the hash codes
- * of all elements of information used in <code>equals</code> comparisons
+ * The hash code of a {@code CompositeData} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its <i>composite type</i> and all the item values).
* <p>
- * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
- * for any two <code>CompositeData</code> instances <code>t1</code> and <code>t2</code>,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code CompositeData} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
* <p>
@@ -156,18 +162,19 @@
* for arrays of object reference types or the appropriate overloading
* of {@code Arrays.hashCode(e)} for arrays of primitive types.
*
- * @return the hash code value for this <code>CompositeData</code> instance
+ * @return the hash code value for this {@code CompositeData} instance
*/
public int hashCode() ;
/**
- * Returns a string representation of this <code>CompositeData</code> instance.
+ * Returns a string representation of this {@code CompositeData} instance.
* <p>
* The string representation consists of the name of the implementing class,
- * the string representation of the composite type of this instance, and the string representation of the contents
+ * the string representation of the composite type of this instance,
+ * and the string representation of the contents
* (ie list the itemName=itemValue mappings).
*
- * @return a string representation of this <code>CompositeData</code> instance
+ * @return a string representation of this {@code CompositeData} instance
*/
public String toString() ;
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeDataSupport.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/CompositeDataSupport.java Wed Jul 05 20:44:51 2017 +0200
@@ -45,8 +45,8 @@
/**
- * The <tt>CompositeDataSupport</tt> class is the <i>open data</i> class which
- * implements the <tt>CompositeData</tt> interface.
+ * The {@code CompositeDataSupport} class is the <i>open data</i> class which
+ * implements the {@code CompositeData} interface.
*
*
* @since 1.5
@@ -70,15 +70,15 @@
private final CompositeType compositeType;
/**
- * <p>Constructs a <tt>CompositeDataSupport</tt> instance with the specified
- * <tt>compositeType</tt>, whose item values
- * are specified by <tt>itemValues[]</tt>, in the same order as in
- * <tt>itemNames[]</tt>.
- * As a <tt>CompositeType</tt> does not specify any order on its items,
- * the <tt>itemNames[]</tt> parameter is used
- * to specify the order in which the values are given in <tt>itemValues[]</tt>.
- * The items contained in this <tt>CompositeDataSupport</tt> instance are
- * internally stored in a <tt>TreeMap</tt>,
+ * <p>Constructs a {@code CompositeDataSupport} instance with the specified
+ * {@code compositeType}, whose item values
+ * are specified by {@code itemValues[]}, in the same order as in
+ * {@code itemNames[]}.
+ * As a {@code CompositeType} does not specify any order on its items,
+ * the {@code itemNames[]} parameter is used
+ * to specify the order in which the values are given in {@code itemValues[]}.
+ * The items contained in this {@code CompositeDataSupport} instance are
+ * internally stored in a {@code TreeMap},
* thus sorted in ascending lexicographic order of their names, for faster
* retrieval of individual item values.</p>
*
@@ -89,28 +89,28 @@
* @param compositeType the <i>composite type </i> of this <i>composite
* data</i> instance; must not be null.
*
- * @param itemNames <tt>itemNames</tt> must list, in any order, all the
- * item names defined in <tt>compositeType</tt>; the order in which the
- * names are listed, is used to match values in <tt>itemValues[]</tt>; must
+ * @param itemNames {@code itemNames} must list, in any order, all the
+ * item names defined in {@code compositeType}; the order in which the
+ * names are listed, is used to match values in {@code itemValues[]}; must
* not be null or empty.
*
* @param itemValues the values of the items, listed in the same order as
- * their respective names in <tt>itemNames</tt>; each item value can be
+ * their respective names in {@code itemNames}; each item value can be
* null, but if it is non-null it must be a valid value for the open type
- * defined in <tt>compositeType</tt> for the corresponding item; must be of
- * the same size as <tt>itemNames</tt>; must not be null or empty.
+ * defined in {@code compositeType} for the corresponding item; must be of
+ * the same size as {@code itemNames}; must not be null or empty.
*
- * @throws IllegalArgumentException <tt>compositeType</tt> is null, or
- * <tt>itemNames[]</tt> or <tt>itemValues[]</tt> is null or empty, or one
- * of the elements in <tt>itemNames[]</tt> is a null or empty string, or
- * <tt>itemNames[]</tt> and <tt>itemValues[]</tt> are not of the same size.
+ * @throws IllegalArgumentException {@code compositeType} is null, or
+ * {@code itemNames[]} or {@code itemValues[]} is null or empty, or one
+ * of the elements in {@code itemNames[]} is a null or empty string, or
+ * {@code itemNames[]} and {@code itemValues[]} are not of the same size.
*
- * @throws OpenDataException <tt>itemNames[]</tt> or
- * <tt>itemValues[]</tt>'s size differs from the number of items defined in
- * <tt>compositeType</tt>, or one of the elements in <tt>itemNames[]</tt>
- * does not exist as an item name defined in <tt>compositeType</tt>, or one
- * of the elements in <tt>itemValues[]</tt> is not a valid value for the
- * corresponding item as defined in <tt>compositeType</tt>.
+ * @throws OpenDataException {@code itemNames[]} or
+ * {@code itemValues[]}'s size differs from the number of items defined in
+ * {@code compositeType}, or one of the elements in {@code itemNames[]}
+ * does not exist as an item name defined in {@code compositeType}, or one
+ * of the elements in {@code itemValues[]} is not a valid value for the
+ * corresponding item as defined in {@code compositeType}.
*/
public CompositeDataSupport(
CompositeType compositeType, String[] itemNames, Object[] itemValues)
@@ -147,28 +147,29 @@
/**
* <p>
- * Constructs a <tt>CompositeDataSupport</tt> instance with the specified <tt>compositeType</tt>, whose item names and corresponding values
- * are given by the mappings in the map <tt>items</tt>.
+ * Constructs a {@code CompositeDataSupport} instance with the specified {@code compositeType},
+ * whose item names and corresponding values
+ * are given by the mappings in the map {@code items}.
* This constructor converts the keys to a string array and the values to an object array and calls
- * <tt>CompositeDataSupport(javax.management.openmbean.CompositeType, java.lang.String[], java.lang.Object[])</tt>.
+ * {@code CompositeDataSupport(javax.management.openmbean.CompositeType, java.lang.String[], java.lang.Object[])}.
*
* @param compositeType the <i>composite type </i> of this <i>composite data</i> instance;
* must not be null.
* @param items the mappings of all the item names to their values;
- * <tt>items</tt> must contain all the item names defined in <tt>compositeType</tt>;
+ * {@code items} must contain all the item names defined in {@code compositeType};
* must not be null or empty.
*
- * @throws IllegalArgumentException <tt>compositeType</tt> is null, or
- * <tt>items</tt> is null or empty, or one of the keys in <tt>items</tt> is a null
+ * @throws IllegalArgumentException {@code compositeType} is null, or
+ * {@code items} is null or empty, or one of the keys in {@code items} is a null
* or empty string.
- * @throws OpenDataException <tt>items</tt>' size differs from the
- * number of items defined in <tt>compositeType</tt>, or one of the
- * keys in <tt>items</tt> does not exist as an item name defined in
- * <tt>compositeType</tt>, or one of the values in <tt>items</tt>
+ * @throws OpenDataException {@code items}' size differs from the
+ * number of items defined in {@code compositeType}, or one of the
+ * keys in {@code items} does not exist as an item name defined in
+ * {@code compositeType}, or one of the values in {@code items}
* is not a valid value for the corresponding item as defined in
- * <tt>compositeType</tt>.
- * @throws ArrayStoreException one or more keys in <tt>items</tt> is not of
- * the class <tt>java.lang.String</tt>.
+ * {@code compositeType}.
+ * @throws ArrayStoreException one or more keys in {@code items} is not of
+ * the class {@code java.lang.String}.
*/
public CompositeDataSupport(CompositeType compositeType,
Map<String,?> items)
@@ -253,12 +254,12 @@
}
/**
- * Returns the value of the item whose name is <tt>key</tt>.
+ * Returns the value of the item whose name is {@code key}.
*
- * @throws IllegalArgumentException if <tt>key</tt> is a null or empty String.
+ * @throws IllegalArgumentException if {@code key} is a null or empty String.
*
- * @throws InvalidKeyException if <tt>key</tt> is not an existing item name for
- * this <tt>CompositeData</tt> instance.
+ * @throws InvalidKeyException if {@code key} is not an existing item name for
+ * this {@code CompositeData} instance.
*/
public Object get(String key) {
@@ -273,13 +274,13 @@
/**
* Returns an array of the values of the items whose names are specified by
- * <tt>keys</tt>, in the same order as <tt>keys</tt>.
+ * {@code keys}, in the same order as {@code keys}.
*
- * @throws IllegalArgumentException if an element in <tt>keys</tt> is a null
+ * @throws IllegalArgumentException if an element in {@code keys} is a null
* or empty String.
*
- * @throws InvalidKeyException if an element in <tt>keys</tt> is not an existing
- * item name for this <tt>CompositeData</tt> instance.
+ * @throws InvalidKeyException if an element in {@code keys} is not an existing
+ * item name for this {@code CompositeData} instance.
*/
public Object[] getAll(String[] keys) {
@@ -294,9 +295,9 @@
}
/**
- * Returns <tt>true</tt> if and only if this <tt>CompositeData</tt> instance contains
- * an item whose name is <tt>key</tt>.
- * If <tt>key</tt> is a null or empty String, this method simply returns false.
+ * Returns {@code true} if and only if this {@code CompositeData} instance contains
+ * an item whose name is {@code key}.
+ * If {@code key} is a null or empty String, this method simply returns false.
*/
public boolean containsKey(String key) {
@@ -307,9 +308,9 @@
}
/**
- * Returns <tt>true</tt> if and only if this <tt>CompositeData</tt> instance
+ * Returns {@code true} if and only if this {@code CompositeData} instance
* contains an item
- * whose value is <tt>value</tt>.
+ * whose value is {@code value}.
*/
public boolean containsValue(Object value) {
@@ -318,7 +319,7 @@
/**
* Returns an unmodifiable Collection view of the item values contained in this
- * <tt>CompositeData</tt> instance.
+ * {@code CompositeData} instance.
* The returned collection's iterator will return the values in the ascending
* lexicographic order of the corresponding
* item names.
@@ -332,7 +333,7 @@
* Compares the specified <var>obj</var> parameter with this
* <code>CompositeDataSupport</code> instance for equality.
* <p>
- * Returns <tt>true</tt> if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
* <ul>
* <li><var>obj</var> is non null,</li>
* <li><var>obj</var> also implements the <code>CompositeData</code> interface,</li>
@@ -344,11 +345,11 @@
* {@code Arrays.equals(e1,e2)} for arrays of primitive types</li>
* </ul>
* <p>
- * This ensures that this <tt>equals</tt> method works properly for
+ * This ensures that this {@code equals} method works properly for
* <var>obj</var> parameters which are different implementations of the
* <code>CompositeData</code> interface, with the restrictions mentioned in the
* {@link java.util.Collection#equals(Object) equals}
- * method of the <tt>java.util.Collection</tt> interface.
+ * method of the {@code java.util.Collection} interface.
*
* @param obj the object to be compared for equality with this
* <code>CompositeDataSupport</code> instance.
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -53,27 +53,28 @@
// (these will be removed when MBeanAttributeInfo is made a parent interface of this interface)
/**
- * Returns <tt>true</tt> if the attribute described by this <tt>OpenMBeanAttributeInfo</tt> instance is readable,
- * <tt>false</tt> otherwise.
+ * Returns {@code true} if the attribute described by this {@code OpenMBeanAttributeInfo}
+ * instance is readable, {@code false} otherwise.
*
* @return true if the attribute is readable.
*/
public boolean isReadable() ;
/**
- * Returns <tt>true</tt> if the attribute described by this <tt>OpenMBeanAttributeInfo</tt> instance is writable,
- * <tt>false</tt> otherwise.
+ * Returns {@code true} if the attribute described by this {@code OpenMBeanAttributeInfo}
+ * instance is writable, {@code false} otherwise.
*
* @return true if the attribute is writable.
*/
public boolean isWritable() ;
/**
- * Returns <tt>true</tt> if the attribute described by this <tt>OpenMBeanAttributeInfo</tt> instance
- * is accessed through a <tt>is<i>XXX</i></tt> getter (applies only to <tt>boolean</tt> and <tt>Boolean</tt> values),
- * <tt>false</tt> otherwise.
+ * Returns {@code true} if the attribute described by this {@code OpenMBeanAttributeInfo} instance
+ * is accessed through a <code>is<i>XXX</i></code> getter
+ * (applies only to {@code boolean} and {@code Boolean} values),
+ * {@code false} otherwise.
*
- * @return true if the attribute is accessed through <tt>is<i>XXX</i></tt>.
+ * @return true if the attribute is accessed through <code>is<i>XXX</i></code>.
*/
public boolean isIs() ;
@@ -82,50 +83,52 @@
//
/**
- * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanAttributeInfo</code> instance for equality.
+ * Compares the specified <var>obj</var> parameter with this
+ * {@code OpenMBeanAttributeInfo} instance for equality.
* <p>
- * Returns <tt>true</tt> if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
* <ul>
* <li><var>obj</var> is non null,</li>
- * <li><var>obj</var> also implements the <code>OpenMBeanAttributeInfo</code> interface,</li>
+ * <li><var>obj</var> also implements the {@code OpenMBeanAttributeInfo} interface,</li>
* <li>their names are equal</li>
* <li>their open types are equal</li>
* <li>their access properties (isReadable, isWritable and isIs) are equal</li>
* <li>their default, min, max and legal values are equal.</li>
* </ul>
- * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
- * different implementations of the <code>OpenMBeanAttributeInfo</code> interface.
+ * This ensures that this {@code equals} method works properly for <var>obj</var> parameters which are
+ * different implementations of the {@code OpenMBeanAttributeInfo} interface.
* <br>
- * @param obj the object to be compared for equality with this <code>OpenMBeanAttributeInfo</code> instance;
+ * @param obj the object to be compared for equality with this {@code OpenMBeanAttributeInfo} instance;
*
- * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanAttributeInfo</code> instance.
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanAttributeInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this <code>OpenMBeanAttributeInfo</code> instance.
+ * Returns the hash code value for this {@code OpenMBeanAttributeInfo} instance.
* <p>
- * The hash code of an <code>OpenMBeanAttributeInfo</code> instance is the sum of the hash codes
- * of all elements of information used in <code>equals</code> comparisons
+ * The hash code of an {@code OpenMBeanAttributeInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its name, its <i>open type</i>, and its default, min, max and legal values).
* <p>
- * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
- * for any two <code>OpenMBeanAttributeInfo</code> instances <code>t1</code> and <code>t2</code>,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanAttributeInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this <code>OpenMBeanAttributeInfo</code> instance
+ * @return the hash code value for this {@code OpenMBeanAttributeInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this <code>OpenMBeanAttributeInfo</code> instance.
+ * Returns a string representation of this {@code OpenMBeanAttributeInfo} instance.
* <p>
- * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanAttributeInfo</code>),
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.OpenMBeanAttributeInfo}),
* the string representation of the name and open type of the described attribute,
* and the string representation of its default, min, max and legal values.
*
- * @return a string representation of this <code>OpenMBeanAttributeInfo</code> instance
+ * @return a string representation of this {@code OpenMBeanAttributeInfo} instance
*/
public String toString();
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java Wed Jul 05 20:44:51 2017 +0200
@@ -114,7 +114,7 @@
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form <tt>is<i>XXX</i></tt>.
+ * form <code>is<i>XXX</i></code>.
*
* @throws IllegalArgumentException if {@code name} or {@code
* description} are null or empty string, or {@code openType} is
@@ -154,7 +154,7 @@
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form <tt>is<i>XXX</i></tt>.
+ * form <code>is<i>XXX</i></code>.
*
* @param descriptor The descriptor for the attribute. This may be null
* which is equivalent to an empty descriptor.
@@ -221,7 +221,7 @@
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form <tt>is<i>XXX</i></tt>.
+ * form <code>is<i>XXX</i></code>.
*
* @param defaultValue must be a valid value for the {@code
* openType} specified for this attribute; default value not
@@ -278,7 +278,7 @@
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form <tt>is<i>XXX</i></tt>.
+ * form <code>is<i>XXX</i></code>.
*
* @param defaultValue must be a valid value
* for the {@code
@@ -345,7 +345,7 @@
* exposed for management.
*
* @param isIs {@code true} if the attribute's getter is of the
- * form <tt>is<i>XXX</i></tt>.
+ * form <code>is<i>XXX</i></code>.
*
* @param defaultValue must be a valid value for the {@code
* openType} specified for this attribute; default value not
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -60,7 +60,7 @@
/**
* Returns a human readable description of the constructor
- * described by this <tt>OpenMBeanConstructorInfo</tt> instance.
+ * described by this {@code OpenMBeanConstructorInfo} instance.
*
* @return the description.
*/
@@ -68,16 +68,16 @@
/**
* Returns the name of the constructor
- * described by this <tt>OpenMBeanConstructorInfo</tt> instance.
+ * described by this {@code OpenMBeanConstructorInfo} instance.
*
* @return the name.
*/
public String getName() ;
/**
- * Returns an array of <tt>OpenMBeanParameterInfo</tt> instances
+ * Returns an array of {@code OpenMBeanParameterInfo} instances
* describing each parameter in the signature of the constructor
- * described by this <tt>OpenMBeanConstructorInfo</tt> instance.
+ * described by this {@code OpenMBeanConstructorInfo} instance.
*
* @return the signature.
*/
@@ -88,48 +88,49 @@
//
/**
- * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanConstructorInfo</code> instance for equality.
+ * Compares the specified <var>obj</var> parameter with this {@code OpenMBeanConstructorInfo} instance for equality.
* <p>
- * Returns <tt>true</tt> if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
* <ul>
* <li><var>obj</var> is non null,</li>
- * <li><var>obj</var> also implements the <code>OpenMBeanConstructorInfo</code> interface,</li>
+ * <li><var>obj</var> also implements the {@code OpenMBeanConstructorInfo} interface,</li>
* <li>their names are equal</li>
* <li>their signatures are equal.</li>
* </ul>
- * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
- * different implementations of the <code>OpenMBeanConstructorInfo</code> interface.
+ * This ensures that this {@code equals} method works properly for <var>obj</var> parameters which are
+ * different implementations of the {@code OpenMBeanConstructorInfo} interface.
* <br>
- * @param obj the object to be compared for equality with this <code>OpenMBeanConstructorInfo</code> instance;
+ * @param obj the object to be compared for equality with this {@code OpenMBeanConstructorInfo} instance;
*
- * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanConstructorInfo</code> instance.
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanConstructorInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this <code>OpenMBeanConstructorInfo</code> instance.
+ * Returns the hash code value for this {@code OpenMBeanConstructorInfo} instance.
* <p>
- * The hash code of an <code>OpenMBeanConstructorInfo</code> instance is the sum of the hash codes
- * of all elements of information used in <code>equals</code> comparisons
+ * The hash code of an {@code OpenMBeanConstructorInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its name and signature, where the signature hashCode is calculated by a call to
- * <tt>java.util.Arrays.asList(this.getSignature).hashCode()</tt>).
+ * {@code java.util.Arrays.asList(this.getSignature).hashCode()}).
* <p>
- * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
- * for any two <code>OpenMBeanConstructorInfo</code> instances <code>t1</code> and <code>t2</code>,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanConstructorInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this <code>OpenMBeanConstructorInfo</code> instance
+ * @return the hash code value for this {@code OpenMBeanConstructorInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this <code>OpenMBeanConstructorInfo</code> instance.
+ * Returns a string representation of this {@code OpenMBeanConstructorInfo} instance.
* <p>
- * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanConstructorInfo</code>),
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.OpenMBeanConstructorInfo}),
* and the name and signature of the described constructor.
*
- * @return a string representation of this <code>OpenMBeanConstructorInfo</code> instance
+ * @return a string representation of this {@code OpenMBeanConstructorInfo} instance
*/
public String toString();
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -70,7 +70,7 @@
/**
* Returns the fully qualified Java class name of the open MBean
- * instances this <tt>OpenMBeanInfo</tt> describes.
+ * instances this {@code OpenMBeanInfo} describes.
*
* @return the class name.
*/
@@ -78,19 +78,19 @@
/**
* Returns a human readable description of the type of open MBean
- * instances this <tt>OpenMBeanInfo</tt> describes.
+ * instances this {@code OpenMBeanInfo} describes.
*
* @return the description.
*/
public String getDescription() ;
/**
- * Returns an array of <tt>OpenMBeanAttributeInfo</tt> instances
+ * Returns an array of {@code OpenMBeanAttributeInfo} instances
* describing each attribute in the open MBean described by this
- * <tt>OpenMBeanInfo</tt> instance. Each instance in the returned
+ * {@code OpenMBeanInfo} instance. Each instance in the returned
* array should actually be a subclass of
- * <tt>MBeanAttributeInfo</tt> which implements the
- * <tt>OpenMBeanAttributeInfo</tt> interface (typically {@link
+ * {@code MBeanAttributeInfo} which implements the
+ * {@code OpenMBeanAttributeInfo} interface (typically {@link
* OpenMBeanAttributeInfoSupport}).
*
* @return the attribute array.
@@ -98,12 +98,12 @@
public MBeanAttributeInfo[] getAttributes() ;
/**
- * Returns an array of <tt>OpenMBeanOperationInfo</tt> instances
+ * Returns an array of {@code OpenMBeanOperationInfo} instances
* describing each operation in the open MBean described by this
- * <tt>OpenMBeanInfo</tt> instance. Each instance in the returned
+ * {@code OpenMBeanInfo} instance. Each instance in the returned
* array should actually be a subclass of
- * <tt>MBeanOperationInfo</tt> which implements the
- * <tt>OpenMBeanOperationInfo</tt> interface (typically {@link
+ * {@code MBeanOperationInfo} which implements the
+ * {@code OpenMBeanOperationInfo} interface (typically {@link
* OpenMBeanOperationInfoSupport}).
*
* @return the operation array.
@@ -111,12 +111,12 @@
public MBeanOperationInfo[] getOperations() ;
/**
- * Returns an array of <tt>OpenMBeanConstructorInfo</tt> instances
+ * Returns an array of {@code OpenMBeanConstructorInfo} instances
* describing each constructor in the open MBean described by this
- * <tt>OpenMBeanInfo</tt> instance. Each instance in the returned
+ * {@code OpenMBeanInfo} instance. Each instance in the returned
* array should actually be a subclass of
- * <tt>MBeanConstructorInfo</tt> which implements the
- * <tt>OpenMBeanConstructorInfo</tt> interface (typically {@link
+ * {@code MBeanConstructorInfo} which implements the
+ * {@code OpenMBeanConstructorInfo} interface (typically {@link
* OpenMBeanConstructorInfoSupport}).
*
* @return the constructor array.
@@ -124,9 +124,9 @@
public MBeanConstructorInfo[] getConstructors() ;
/**
- * Returns an array of <tt>MBeanNotificationInfo</tt> instances
+ * Returns an array of {@code MBeanNotificationInfo} instances
* describing each notification emitted by the open MBean
- * described by this <tt>OpenMBeanInfo</tt> instance.
+ * described by this {@code OpenMBeanInfo} instance.
*
* @return the notification array.
*/
@@ -137,50 +137,51 @@
//
/**
- * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanInfo</code> instance for equality.
+ * Compares the specified <var>obj</var> parameter with this {@code OpenMBeanInfo} instance for equality.
* <p>
- * Returns <tt>true</tt> if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
* <ul>
* <li><var>obj</var> is non null,</li>
- * <li><var>obj</var> also implements the <code>OpenMBeanInfo</code> interface,</li>
+ * <li><var>obj</var> also implements the {@code OpenMBeanInfo} interface,</li>
* <li>their class names are equal</li>
* <li>their infos on attributes, constructors, operations and notifications are equal</li>
* </ul>
- * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
- * different implementations of the <code>OpenMBeanInfo</code> interface.
- * <br>
- * @param obj the object to be compared for equality with this <code>OpenMBeanInfo</code> instance;
+ * This ensures that this {@code equals} method works properly for <var>obj</var> parameters which are
+ * different implementations of the {@code OpenMBeanInfo} interface.
*
- * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanInfo</code> instance.
+ * @param obj the object to be compared for equality with this {@code OpenMBeanInfo} instance;
+ *
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this <code>OpenMBeanInfo</code> instance.
+ * Returns the hash code value for this {@code OpenMBeanInfo} instance.
* <p>
- * The hash code of an <code>OpenMBeanInfo</code> instance is the sum of the hash codes
- * of all elements of information used in <code>equals</code> comparisons
+ * The hash code of an {@code OpenMBeanInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its class name, and its infos on attributes, constructors, operations and notifications,
* where the hashCode of each of these arrays is calculated by a call to
- * <tt>new java.util.HashSet(java.util.Arrays.asList(this.getSignature)).hashCode()</tt>).
+ * {@code new java.util.HashSet(java.util.Arrays.asList(this.getSignature)).hashCode()}).
* <p>
- * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
- * for any two <code>OpenMBeanInfo</code> instances <code>t1</code> and <code>t2</code>,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this <code>OpenMBeanInfo</code> instance
+ * @return the hash code value for this {@code OpenMBeanInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this <code>OpenMBeanInfo</code> instance.
+ * Returns a string representation of this {@code OpenMBeanInfo} instance.
* <p>
- * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanInfo</code>),
- * the MBean class name,
- * and the string representation of infos on attributes, constructors, operations and notifications of the described MBean.
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.OpenMBeanInfo}), the MBean class name,
+ * and the string representation of infos on attributes, constructors,
+ * operations and notifications of the described MBean.
*
- * @return a string representation of this <code>OpenMBeanInfo</code> instance
+ * @return a string representation of this {@code OpenMBeanInfo} instance
*/
public String toString();
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -58,7 +58,7 @@
/**
* Returns a human readable description of the operation
- * described by this <tt>OpenMBeanOperationInfo</tt> instance.
+ * described by this {@code OpenMBeanOperationInfo} instance.
*
* @return the description.
*/
@@ -66,19 +66,19 @@
/**
* Returns the name of the operation
- * described by this <tt>OpenMBeanOperationInfo</tt> instance.
+ * described by this {@code OpenMBeanOperationInfo} instance.
*
* @return the name.
*/
public String getName() ;
/**
- * Returns an array of <tt>OpenMBeanParameterInfo</tt> instances
+ * Returns an array of {@code OpenMBeanParameterInfo} instances
* describing each parameter in the signature of the operation
- * described by this <tt>OpenMBeanOperationInfo</tt> instance.
+ * described by this {@code OpenMBeanOperationInfo} instance.
* Each instance in the returned array should actually be a
- * subclass of <tt>MBeanParameterInfo</tt> which implements the
- * <tt>OpenMBeanParameterInfo</tt> interface (typically {@link
+ * subclass of {@code MBeanParameterInfo} which implements the
+ * {@code OpenMBeanParameterInfo} interface (typically {@link
* OpenMBeanParameterInfoSupport}).
*
* @return the signature.
@@ -86,8 +86,8 @@
public MBeanParameterInfo[] getSignature() ;
/**
- * Returns an <tt>int</tt> constant qualifying the impact of the
- * operation described by this <tt>OpenMBeanOperationInfo</tt>
+ * Returns an {@code int} constant qualifying the impact of the
+ * operation described by this {@code OpenMBeanOperationInfo}
* instance.
*
* The returned constant is one of {@link
@@ -103,9 +103,9 @@
/**
* Returns the fully qualified Java class name of the values
* returned by the operation described by this
- * <tt>OpenMBeanOperationInfo</tt> instance. This method should
+ * {@code OpenMBeanOperationInfo} instance. This method should
* return the same value as a call to
- * <tt>getReturnOpenType().getClassName()</tt>.
+ * {@code getReturnOpenType().getClassName()}.
*
* @return the return type.
*/
@@ -117,7 +117,7 @@
/**
* Returns the <i>open type</i> of the values returned by the
- * operation described by this <tt>OpenMBeanOperationInfo</tt>
+ * operation described by this {@code OpenMBeanOperationInfo}
* instance.
*
* @return the return type.
@@ -129,51 +129,53 @@
//
/**
- * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanOperationInfo</code> instance for equality.
+ * Compares the specified <var>obj</var> parameter with this {@code OpenMBeanOperationInfo} instance for equality.
* <p>
- * Returns <tt>true</tt> if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
* <ul>
* <li><var>obj</var> is non null,</li>
- * <li><var>obj</var> also implements the <code>OpenMBeanOperationInfo</code> interface,</li>
+ * <li><var>obj</var> also implements the {@code OpenMBeanOperationInfo} interface,</li>
* <li>their names are equal</li>
* <li>their signatures are equal</li>
* <li>their return open types are equal</li>
* <li>their impacts are equal</li>
* </ul>
- * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
- * different implementations of the <code>OpenMBeanOperationInfo</code> interface.
+ * This ensures that this {@code equals} method works properly for <var>obj</var> parameters which are
+ * different implementations of the {@code OpenMBeanOperationInfo} interface.
* <br>
- * @param obj the object to be compared for equality with this <code>OpenMBeanOperationInfo</code> instance;
+ * @param obj the object to be compared for equality with this {@code OpenMBeanOperationInfo} instance;
*
- * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanOperationInfo</code> instance.
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanOperationInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this <code>OpenMBeanOperationInfo</code> instance.
+ * Returns the hash code value for this {@code OpenMBeanOperationInfo} instance.
* <p>
- * The hash code of an <code>OpenMBeanOperationInfo</code> instance is the sum of the hash codes
- * of all elements of information used in <code>equals</code> comparisons
- * (ie: its name, return open type, impact and signature, where the signature hashCode is calculated by a call to
- * <tt>java.util.Arrays.asList(this.getSignature).hashCode()</tt>).
+ * The hash code of an {@code OpenMBeanOperationInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
+ * (ie: its name, return open type, impact and signature,
+ * where the signature hashCode is calculated by a call to
+ * {@code java.util.Arrays.asList(this.getSignature).hashCode()}).
* <p>
- * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
- * for any two <code>OpenMBeanOperationInfo</code> instances <code>t1</code> and <code>t2</code>,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanOperationInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
*
- * @return the hash code value for this <code>OpenMBeanOperationInfo</code> instance
+ * @return the hash code value for this {@code OpenMBeanOperationInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this <code>OpenMBeanOperationInfo</code> instance.
+ * Returns a string representation of this {@code OpenMBeanOperationInfo} instance.
* <p>
- * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanOperationInfo</code>),
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.OpenMBeanOperationInfo}),
* and the name, signature, return open type and impact of the described operation.
*
- * @return a string representation of this <code>OpenMBeanOperationInfo</code> instance
+ * @return a string representation of this {@code OpenMBeanOperationInfo} instance
*/
public String toString();
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -57,7 +57,7 @@
/**
* Returns a human readable description of the parameter
- * described by this <tt>OpenMBeanParameterInfo</tt> instance.
+ * described by this {@code OpenMBeanParameterInfo} instance.
*
* @return the description.
*/
@@ -65,7 +65,7 @@
/**
* Returns the name of the parameter
- * described by this <tt>OpenMBeanParameterInfo</tt> instance.
+ * described by this {@code OpenMBeanParameterInfo} instance.
*
* @return the name.
*/
@@ -77,7 +77,7 @@
/**
* Returns the <i>open type</i> of the values of the parameter
- * described by this <tt>OpenMBeanParameterInfo</tt> instance.
+ * described by this {@code OpenMBeanParameterInfo} instance.
*
* @return the open type.
*/
@@ -85,7 +85,7 @@
/**
* Returns the default value for this parameter, if it has one, or
- * <tt>null</tt> otherwise.
+ * {@code null} otherwise.
*
* @return the default value.
*/
@@ -93,7 +93,7 @@
/**
* Returns the set of legal values for this parameter, if it has
- * one, or <tt>null</tt> otherwise.
+ * one, or {@code null} otherwise.
*
* @return the set of legal values.
*/
@@ -101,7 +101,7 @@
/**
* Returns the minimal value for this parameter, if it has one, or
- * <tt>null</tt> otherwise.
+ * {@code null} otherwise.
*
* @return the minimum value.
*/
@@ -109,39 +109,39 @@
/**
* Returns the maximal value for this parameter, if it has one, or
- * <tt>null</tt> otherwise.
+ * {@code null} otherwise.
*
* @return the maximum value.
*/
public Comparable<?> getMaxValue() ;
/**
- * Returns <tt>true</tt> if this parameter has a specified default
- * value, or <tt>false</tt> otherwise.
+ * Returns {@code true} if this parameter has a specified default
+ * value, or {@code false} otherwise.
*
* @return true if there is a default value.
*/
public boolean hasDefaultValue() ;
/**
- * Returns <tt>true</tt> if this parameter has a specified set of
- * legal values, or <tt>false</tt> otherwise.
+ * Returns {@code true} if this parameter has a specified set of
+ * legal values, or {@code false} otherwise.
*
* @return true if there is a set of legal values.
*/
public boolean hasLegalValues() ;
/**
- * Returns <tt>true</tt> if this parameter has a specified minimal
- * value, or <tt>false</tt> otherwise.
+ * Returns {@code true} if this parameter has a specified minimal
+ * value, or {@code false} otherwise.
*
* @return true if there is a minimum value.
*/
public boolean hasMinValue() ;
/**
- * Returns <tt>true</tt> if this parameter has a specified maximal
- * value, or <tt>false</tt> otherwise.
+ * Returns {@code true} if this parameter has a specified maximal
+ * value, or {@code false} otherwise.
*
* @return true if there is a maximum value.
*/
@@ -149,62 +149,62 @@
/**
* Tests whether <var>obj</var> is a valid value for the parameter
- * described by this <code>OpenMBeanParameterInfo</code> instance.
+ * described by this {@code OpenMBeanParameterInfo} instance.
*
* @param obj the object to be tested.
*
- * @return <code>true</code> if <var>obj</var> is a valid value
+ * @return {@code true} if <var>obj</var> is a valid value
* for the parameter described by this
- * <code>OpenMBeanParameterInfo</code> instance,
- * <code>false</code> otherwise.
+ * {@code OpenMBeanParameterInfo} instance,
+ * {@code false} otherwise.
*/
public boolean isValue(Object obj) ;
/**
- * Compares the specified <var>obj</var> parameter with this <code>OpenMBeanParameterInfo</code> instance for equality.
+ * Compares the specified <var>obj</var> parameter with this {@code OpenMBeanParameterInfo} instance for equality.
* <p>
- * Returns <tt>true</tt> if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
* <ul>
* <li><var>obj</var> is non null,</li>
- * <li><var>obj</var> also implements the <code>OpenMBeanParameterInfo</code> interface,</li>
+ * <li><var>obj</var> also implements the {@code OpenMBeanParameterInfo} interface,</li>
* <li>their names are equal</li>
* <li>their open types are equal</li>
* <li>their default, min, max and legal values are equal.</li>
* </ul>
- * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
- * different implementations of the <code>OpenMBeanParameterInfo</code> interface.
+ * This ensures that this {@code equals} method works properly for <var>obj</var> parameters which are
+ * different implementations of the {@code OpenMBeanParameterInfo} interface.
* <br>
- * @param obj the object to be compared for equality with this <code>OpenMBeanParameterInfo</code> instance;
+ * @param obj the object to be compared for equality with this {@code OpenMBeanParameterInfo} instance;
*
- * @return <code>true</code> if the specified object is equal to this <code>OpenMBeanParameterInfo</code> instance.
+ * @return {@code true} if the specified object is equal to this {@code OpenMBeanParameterInfo} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this <code>OpenMBeanParameterInfo</code> instance.
+ * Returns the hash code value for this {@code OpenMBeanParameterInfo} instance.
* <p>
- * The hash code of an <code>OpenMBeanParameterInfo</code> instance is the sum of the hash codes
- * of all elements of information used in <code>equals</code> comparisons
+ * The hash code of an {@code OpenMBeanParameterInfo} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its name, its <i>open type</i>, and its default, min, max and legal values).
* <p>
- * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
- * for any two <code>OpenMBeanParameterInfo</code> instances <code>t1</code> and <code>t2</code>,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code OpenMBeanParameterInfo} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this <code>OpenMBeanParameterInfo</code> instance
+ * @return the hash code value for this {@code OpenMBeanParameterInfo} instance
*/
public int hashCode();
/**
- * Returns a string representation of this <code>OpenMBeanParameterInfo</code> instance.
+ * Returns a string representation of this {@code OpenMBeanParameterInfo} instance.
* <p>
- * The string representation consists of the name of this class (ie <code>javax.management.openmbean.OpenMBeanParameterInfo</code>),
+ * The string representation consists of the name of this class (ie {@code javax.management.openmbean.OpenMBeanParameterInfo}),
* the string representation of the name and open type of the described parameter,
* and the string representation of its default, min, max and legal values.
*
- * @return a string representation of this <code>OpenMBeanParameterInfo</code> instance
+ * @return a string representation of this {@code OpenMBeanParameterInfo} instance
*/
public String toString();
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/TabularData.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/TabularData.java Wed Jul 05 20:44:51 2017 +0200
@@ -37,7 +37,7 @@
/**
- * The <tt>TabularData</tt> interface specifies the behavior of a specific type of complex <i>open data</i> objects
+ * The {@code TabularData} interface specifies the behavior of a specific type of complex <i>open data</i> objects
* which represent <i>tabular data</i> structures.
*
* @since 1.5
@@ -50,7 +50,7 @@
/**
* Returns the <i>tabular type</i> describing this
- * <tt>TabularData</tt> instance.
+ * {@code TabularData} instance.
*
* @return the tabular type.
*/
@@ -58,21 +58,21 @@
/**
- * Calculates the index that would be used in this <tt>TabularData</tt> instance to refer to the specified
+ * Calculates the index that would be used in this {@code TabularData} instance to refer to the specified
* composite data <var>value</var> parameter if it were added to this instance.
* This method checks for the type validity of the specified <var>value</var>,
- * but does not check if the calculated index is already used to refer to a value in this <tt>TabularData</tt> instance.
+ * but does not check if the calculated index is already used to refer to a value in this {@code TabularData} instance.
*
* @param value the composite data value whose index in this
- * <tt>TabularData</tt> instance is to be calculated;
+ * {@code TabularData} instance is to be calculated;
* must be of the same composite type as this instance's row type;
* must not be null.
*
- * @return the index that the specified <var>value</var> would have in this <tt>TabularData</tt> instance.
+ * @return the index that the specified <var>value</var> would have in this {@code TabularData} instance.
*
- * @throws NullPointerException if <var>value</var> is <tt>null</tt>
+ * @throws NullPointerException if <var>value</var> is {@code null}
*
- * @throws InvalidOpenTypeException if <var>value</var> does not conform to this <tt>TabularData</tt> instance's
+ * @throws InvalidOpenTypeException if <var>value</var> does not conform to this {@code TabularData} instance's
* row type definition.
*/
public Object[] calculateIndex(CompositeData value) ;
@@ -83,8 +83,8 @@
/* *** Content information query methods *** */
/**
- * Returns the number of <tt>CompositeData</tt> values (ie the
- * number of rows) contained in this <tt>TabularData</tt>
+ * Returns the number of {@code CompositeData} values (ie the
+ * number of rows) contained in this {@code TabularData}
* instance.
*
* @return the number of values contained.
@@ -92,50 +92,50 @@
public int size() ;
/**
- * Returns <tt>true</tt> if the number of <tt>CompositeData</tt>
+ * Returns {@code true} if the number of {@code CompositeData}
* values (ie the number of rows) contained in this
- * <tt>TabularData</tt> instance is zero.
+ * {@code TabularData} instance is zero.
*
- * @return true if this <tt>TabularData</tt> is empty.
+ * @return true if this {@code TabularData} is empty.
*/
public boolean isEmpty() ;
/**
- * Returns <tt>true</tt> if and only if this <tt>TabularData</tt> instance contains a <tt>CompositeData</tt> value
- * (ie a row) whose index is the specified <var>key</var>. If <var>key</var> is <tt>null</tt> or does not conform to
- * this <tt>TabularData</tt> instance's <tt>TabularType</tt> definition, this method simply returns <tt>false</tt>.
+ * Returns {@code true} if and only if this {@code TabularData} instance contains a {@code CompositeData} value
+ * (ie a row) whose index is the specified <var>key</var>. If <var>key</var> is {@code null} or does not conform to
+ * this {@code TabularData} instance's {@code TabularType} definition, this method simply returns {@code false}.
*
- * @param key the index value whose presence in this <tt>TabularData</tt> instance is to be tested.
+ * @param key the index value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return <tt>true</tt> if this <tt>TabularData</tt> indexes a row value with the specified key.
+ * @return {@code true} if this {@code TabularData} indexes a row value with the specified key.
*/
public boolean containsKey(Object[] key) ;
/**
- * Returns <tt>true</tt> if and only if this <tt>TabularData</tt> instance contains the specified
- * <tt>CompositeData</tt> value. If <var>value</var> is <tt>null</tt> or does not conform to
- * this <tt>TabularData</tt> instance's row type definition, this method simply returns <tt>false</tt>.
+ * Returns {@code true} if and only if this {@code TabularData} instance contains the specified
+ * {@code CompositeData} value. If <var>value</var> is {@code null} or does not conform to
+ * this {@code TabularData} instance's row type definition, this method simply returns {@code false}.
*
- * @param value the row value whose presence in this <tt>TabularData</tt> instance is to be tested.
+ * @param value the row value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return <tt>true</tt> if this <tt>TabularData</tt> instance contains the specified row value.
+ * @return {@code true} if this {@code TabularData} instance contains the specified row value.
*/
public boolean containsValue(CompositeData value) ;
/**
- * Returns the <tt>CompositeData</tt> value whose index is
- * <var>key</var>, or <tt>null</tt> if there is no value mapping
- * to <var>key</var>, in this <tt>TabularData</tt> instance.
+ * Returns the {@code CompositeData} value whose index is
+ * <var>key</var>, or {@code null} if there is no value mapping
+ * to <var>key</var>, in this {@code TabularData} instance.
*
* @param key the key of the row to return.
*
* @return the value corresponding to <var>key</var>.
*
* @throws NullPointerException if the <var>key</var> is
- * <tt>null</tt>
+ * {@code null}
* @throws InvalidKeyException if the <var>key</var> does not
- * conform to this <tt>TabularData</tt> instance's *
- * <tt>TabularType</tt> definition
+ * conform to this {@code TabularData} instance's *
+ * {@code TabularType} definition
*/
public CompositeData get(Object[] key) ;
@@ -146,45 +146,45 @@
/**
- * Adds <var>value</var> to this <tt>TabularData</tt> instance.
+ * Adds <var>value</var> to this {@code TabularData} instance.
* The composite type of <var>value</var> must be the same as this
* instance's row type (ie the composite type returned by
- * <tt>this.getTabularType().{@link TabularType#getRowType
- * getRowType()}</tt>), and there must not already be an existing
- * value in this <tt>TabularData</tt> instance whose index is the
+ * <code>this.getTabularType().{@link TabularType#getRowType
+ * getRowType()}</code>), and there must not already be an existing
+ * value in this {@code TabularData} instance whose index is the
* same as the one calculated for the <var>value</var> to be
* added. The index for <var>value</var> is calculated according
- * to this <tt>TabularData</tt> instance's <tt>TabularType</tt>
- * definition (see <tt>TabularType.{@link
- * TabularType#getIndexNames getIndexNames()}</tt>).
+ * to this {@code TabularData} instance's {@code TabularType}
+ * definition (see <code>TabularType.{@link
+ * TabularType#getIndexNames getIndexNames()}</code>).
*
- * @param value the composite data value to be added as a new row to this <tt>TabularData</tt> instance;
+ * @param value the composite data value to be added as a new row to this {@code TabularData} instance;
* must be of the same composite type as this instance's row type;
* must not be null.
*
- * @throws NullPointerException if <var>value</var> is <tt>null</tt>
- * @throws InvalidOpenTypeException if <var>value</var> does not conform to this <tt>TabularData</tt> instance's
+ * @throws NullPointerException if <var>value</var> is {@code null}
+ * @throws InvalidOpenTypeException if <var>value</var> does not conform to this {@code TabularData} instance's
* row type definition.
* @throws KeyAlreadyExistsException if the index for <var>value</var>, calculated according to
- * this <tt>TabularData</tt> instance's <tt>TabularType</tt> definition
+ * this {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value in the underlying HashMap.
*/
public void put(CompositeData value) ;
/**
- * Removes the <tt>CompositeData</tt> value whose index is <var>key</var> from this <tt>TabularData</tt> instance,
- * and returns the removed value, or returns <tt>null</tt> if there is no value whose index is <var>key</var>.
+ * Removes the {@code CompositeData} value whose index is <var>key</var> from this {@code TabularData} instance,
+ * and returns the removed value, or returns {@code null} if there is no value whose index is <var>key</var>.
*
- * @param key the index of the value to get in this <tt>TabularData</tt> instance;
- * must be valid with this <tt>TabularData</tt> instance's row type definition;
+ * @param key the index of the value to get in this {@code TabularData} instance;
+ * must be valid with this {@code TabularData} instance's row type definition;
* must not be null.
*
- * @return previous value associated with specified key, or <tt>null</tt>
+ * @return previous value associated with specified key, or {@code null}
* if there was no mapping for key.
*
- * @throws NullPointerException if the <var>key</var> is <tt>null</tt>
- * @throws InvalidKeyException if the <var>key</var> does not conform to this <tt>TabularData</tt> instance's
- * <tt>TabularType</tt> definition
+ * @throws NullPointerException if the <var>key</var> is {@code null}
+ * @throws InvalidKeyException if the <var>key</var> does not conform to this {@code TabularData} instance's
+ * {@code TabularType} definition
*/
public CompositeData remove(Object[] key) ;
@@ -195,27 +195,27 @@
/**
- * Add all the elements in <var>values</var> to this <tt>TabularData</tt> instance.
- * If any element in <var>values</var> does not satisfy the constraints defined in {@link #put(CompositeData) <tt>put</tt>},
- * or if any two elements in <var>values</var> have the same index calculated according to this <tt>TabularData</tt>
- * instance's <tt>TabularType</tt> definition, then an exception describing the failure is thrown
- * and no element of <var>values</var> is added, thus leaving this <tt>TabularData</tt> instance unchanged.
+ * Add all the elements in <var>values</var> to this {@code TabularData} instance.
+ * If any element in <var>values</var> does not satisfy the constraints defined in {@link #put(CompositeData) put},
+ * or if any two elements in <var>values</var> have the same index calculated according to this {@code TabularData}
+ * instance's {@code TabularType} definition, then an exception describing the failure is thrown
+ * and no element of <var>values</var> is added, thus leaving this {@code TabularData} instance unchanged.
*
- * @param values the array of composite data values to be added as new rows to this <tt>TabularData</tt> instance;
- * if <var>values</var> is <tt>null</tt> or empty, this method returns without doing anything.
+ * @param values the array of composite data values to be added as new rows to this {@code TabularData} instance;
+ * if <var>values</var> is {@code null} or empty, this method returns without doing anything.
*
- * @throws NullPointerException if an element of <var>values</var> is <tt>null</tt>
+ * @throws NullPointerException if an element of <var>values</var> is {@code null}
* @throws InvalidOpenTypeException if an element of <var>values</var> does not conform to
- * this <tt>TabularData</tt> instance's row type definition
+ * this {@code TabularData} instance's row type definition
* @throws KeyAlreadyExistsException if the index for an element of <var>values</var>, calculated according to
- * this <tt>TabularData</tt> instance's <tt>TabularType</tt> definition
+ * this {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value in this instance,
* or two elements of <var>values</var> have the same index.
*/
public void putAll(CompositeData[] values) ;
/**
- * Removes all <tt>CompositeData</tt> values (ie rows) from this <tt>TabularData</tt> instance.
+ * Removes all {@code CompositeData} values (ie rows) from this {@code TabularData} instance.
*/
public void clear();
@@ -257,47 +257,47 @@
/**
- * Compares the specified <var>obj</var> parameter with this <code>TabularData</code> instance for equality.
+ * Compares the specified <var>obj</var> parameter with this {@code TabularData} instance for equality.
* <p>
- * Returns <tt>true</tt> if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
* <ul>
* <li><var>obj</var> is non null,</li>
- * <li><var>obj</var> also implements the <code>TabularData</code> interface,</li>
+ * <li><var>obj</var> also implements the {@code TabularData} interface,</li>
* <li>their row types are equal</li>
* <li>their contents (ie index to value mappings) are equal</li>
* </ul>
- * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
- * different implementations of the <code>TabularData</code> interface.
+ * This ensures that this {@code equals} method works properly for <var>obj</var> parameters which are
+ * different implementations of the {@code TabularData} interface.
* <br>
- * @param obj the object to be compared for equality with this <code>TabularData</code> instance;
+ * @param obj the object to be compared for equality with this {@code TabularData} instance;
*
- * @return <code>true</code> if the specified object is equal to this <code>TabularData</code> instance.
+ * @return {@code true} if the specified object is equal to this {@code TabularData} instance.
*/
public boolean equals(Object obj);
/**
- * Returns the hash code value for this <code>TabularData</code> instance.
+ * Returns the hash code value for this {@code TabularData} instance.
* <p>
- * The hash code of a <code>TabularData</code> instance is the sum of the hash codes
- * of all elements of information used in <code>equals</code> comparisons
+ * The hash code of a {@code TabularData} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its <i>tabular type</i> and its content, where the content is defined as all the index to value mappings).
* <p>
- * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
- * for any two <code>TabularDataSupport</code> instances <code>t1</code> and <code>t2</code>,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code TabularDataSupport} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
*
- * @return the hash code value for this <code>TabularDataSupport</code> instance
+ * @return the hash code value for this {@code TabularDataSupport} instance
*/
public int hashCode();
/**
- * Returns a string representation of this <code>TabularData</code> instance.
+ * Returns a string representation of this {@code TabularData} instance.
* <p>
* The string representation consists of the name of the implementing class,
* and the tabular type of this instance.
*
- * @return a string representation of this <code>TabularData</code> instance
+ * @return a string representation of this {@code TabularData} instance
*/
public String toString();
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java Wed Jul 05 20:44:51 2017 +0200
@@ -51,8 +51,9 @@
/**
- * The <tt>TabularDataSupport</tt> class is the <i>open data</i> class which implements the <tt>TabularData</tt>
- * and the <tt>Map</tt> interfaces, and which is internally based on a hash map data structure.
+ * The {@code TabularDataSupport} class is the <i>open data</i>
+ * class which implements the {@code TabularData}
+ * and the {@code Map} interfaces, and which is internally based on a hash map data structure.
*
* @since 1.5
*/
@@ -102,13 +103,15 @@
/**
- * Creates an empty <tt>TabularDataSupport</tt> instance whose open-type is <var>tabularType</var>,
- * and whose underlying <tt>HashMap</tt> has a default initial capacity (101) and default load factor (0.75).
+ * Creates an empty {@code TabularDataSupport} instance
+ * whose open-type is <var>tabularType</var>,
+ * and whose underlying {@code HashMap} has a default
+ * initial capacity (101) and default load factor (0.75).
* <p>
- * This constructor simply calls <tt>this(tabularType, 101, 0.75f);</tt>
+ * This constructor simply calls {@code this(tabularType, 101, 0.75f);}
*
- * @param tabularType the <i>tabular type</i> describing this <tt>TabularData</tt> instance;
- * cannot be null.
+ * @param tabularType the <i>tabular type</i> describing this
+ * {@code TabularData} instance; cannot be null.
*
* @throws IllegalArgumentException if the tabular type is null.
*/
@@ -118,10 +121,10 @@
}
/**
- * Creates an empty <tt>TabularDataSupport</tt> instance whose open-type is <var>tabularType</var>,
- * and whose underlying <tt>HashMap</tt> has the specified initial capacity and load factor.
+ * Creates an empty {@code TabularDataSupport} instance whose open-type is <var>tabularType</var>,
+ * and whose underlying {@code HashMap} has the specified initial capacity and load factor.
*
- * @param tabularType the <i>tabular type</i> describing this <tt>TabularData</tt> instance;
+ * @param tabularType the <i>tabular type</i> describing this {@code TabularData} instance;
* cannot be null.
*
* @param initialCapacity the initial capacity of the HashMap.
@@ -167,7 +170,7 @@
/**
- * Returns the <i>tabular type</i> describing this <tt>TabularData</tt> instance.
+ * Returns the <i>tabular type</i> describing this {@code TabularData} instance.
*/
public TabularType getTabularType() {
@@ -175,21 +178,22 @@
}
/**
- * Calculates the index that would be used in this <tt>TabularData</tt> instance to refer to the specified
- * composite data <var>value</var> parameter if it were added to this instance.
+ * Calculates the index that would be used in this {@code TabularData} instance to refer
+ * to the specified composite data <var>value</var> parameter if it were added to this instance.
* This method checks for the type validity of the specified <var>value</var>,
- * but does not check if the calculated index is already used to refer to a value in this <tt>TabularData</tt> instance.
+ * but does not check if the calculated index is already used
+ * to refer to a value in this {@code TabularData} instance.
*
* @param value the composite data value whose index in this
- * <tt>TabularData</tt> instance is to be calculated;
+ * {@code TabularData} instance is to be calculated;
* must be of the same composite type as this instance's row type;
* must not be null.
*
- * @return the index that the specified <var>value</var> would have in this <tt>TabularData</tt> instance.
+ * @return the index that the specified <var>value</var> would have in this {@code TabularData} instance.
*
- * @throws NullPointerException if <var>value</var> is <tt>null</tt>.
+ * @throws NullPointerException if <var>value</var> is {@code null}.
*
- * @throws InvalidOpenTypeException if <var>value</var> does not conform to this <tt>TabularData</tt> instance's
+ * @throws InvalidOpenTypeException if <var>value</var> does not conform to this {@code TabularData} instance's
* row type definition.
*/
public Object[] calculateIndex(CompositeData value) {
@@ -210,14 +214,14 @@
/**
- * Returns <tt>true</tt> if and only if this <tt>TabularData</tt> instance contains a <tt>CompositeData</tt> value
+ * Returns {@code true} if and only if this {@code TabularData} instance contains a {@code CompositeData} value
* (ie a row) whose index is the specified <var>key</var>. If <var>key</var> cannot be cast to a one dimension array
- * of Object instances, this method simply returns <tt>false</tt>; otherwise it returns the result of the call to
- * <tt>this.containsKey((Object[]) key)</tt>.
+ * of Object instances, this method simply returns {@code false}; otherwise it returns the result of the call to
+ * {@code this.containsKey((Object[]) key)}.
*
- * @param key the index value whose presence in this <tt>TabularData</tt> instance is to be tested.
+ * @param key the index value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return <tt>true</tt> if this <tt>TabularData</tt> indexes a row value with the specified key.
+ * @return {@code true} if this {@code TabularData} indexes a row value with the specified key.
*/
public boolean containsKey(Object key) {
@@ -234,13 +238,13 @@
}
/**
- * Returns <tt>true</tt> if and only if this <tt>TabularData</tt> instance contains a <tt>CompositeData</tt> value
- * (ie a row) whose index is the specified <var>key</var>. If <var>key</var> is <tt>null</tt> or does not conform to
- * this <tt>TabularData</tt> instance's <tt>TabularType</tt> definition, this method simply returns <tt>false</tt>.
+ * Returns {@code true} if and only if this {@code TabularData} instance contains a {@code CompositeData} value
+ * (ie a row) whose index is the specified <var>key</var>. If <var>key</var> is {@code null} or does not conform to
+ * this {@code TabularData} instance's {@code TabularType} definition, this method simply returns {@code false}.
*
- * @param key the index value whose presence in this <tt>TabularData</tt> instance is to be tested.
+ * @param key the index value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return <tt>true</tt> if this <tt>TabularData</tt> indexes a row value with the specified key.
+ * @return {@code true} if this {@code TabularData} indexes a row value with the specified key.
*/
public boolean containsKey(Object[] key) {
@@ -248,13 +252,13 @@
}
/**
- * Returns <tt>true</tt> if and only if this <tt>TabularData</tt> instance contains the specified
- * <tt>CompositeData</tt> value. If <var>value</var> is <tt>null</tt> or does not conform to
- * this <tt>TabularData</tt> instance's row type definition, this method simply returns <tt>false</tt>.
+ * Returns {@code true} if and only if this {@code TabularData} instance contains the specified
+ * {@code CompositeData} value. If <var>value</var> is {@code null} or does not conform to
+ * this {@code TabularData} instance's row type definition, this method simply returns {@code false}.
*
- * @param value the row value whose presence in this <tt>TabularData</tt> instance is to be tested.
+ * @param value the row value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return <tt>true</tt> if this <tt>TabularData</tt> instance contains the specified row value.
+ * @return {@code true} if this {@code TabularData} instance contains the specified row value.
*/
public boolean containsValue(CompositeData value) {
@@ -262,12 +266,12 @@
}
/**
- * Returns <tt>true</tt> if and only if this <tt>TabularData</tt> instance contains the specified
+ * Returns {@code true} if and only if this {@code TabularData} instance contains the specified
* value.
*
- * @param value the row value whose presence in this <tt>TabularData</tt> instance is to be tested.
+ * @param value the row value whose presence in this {@code TabularData} instance is to be tested.
*
- * @return <tt>true</tt> if this <tt>TabularData</tt> instance contains the specified row value.
+ * @return {@code true} if this {@code TabularData} instance contains the specified row value.
*/
public boolean containsValue(Object value) {
@@ -275,12 +279,13 @@
}
/**
- * This method simply calls <tt>get((Object[]) key)</tt>.
+ * This method simply calls {@code get((Object[]) key)}.
*
- * @throws NullPointerException if the <var>key</var> is <tt>null</tt>
- * @throws ClassCastException if the <var>key</var> is not of the type <tt>Object[]</tt>
- * @throws InvalidKeyException if the <var>key</var> does not conform to this <tt>TabularData</tt> instance's
- * <tt>TabularType</tt> definition
+ * @throws NullPointerException if the <var>key</var> is {@code null}
+ * @throws ClassCastException if the <var>key</var> is not of the type {@code Object[]}
+ * @throws InvalidKeyException if the <var>key</var> does not conform
+ * to this {@code TabularData} instance's
+ * {@code TabularType} definition
*/
public Object get(Object key) {
@@ -288,20 +293,21 @@
}
/**
- * Returns the <tt>CompositeData</tt> value whose index is
- * <var>key</var>, or <tt>null</tt> if there is no value mapping
- * to <var>key</var>, in this <tt>TabularData</tt> instance.
+ * Returns the {@code CompositeData} value whose index is
+ * <var>key</var>, or {@code null} if there is no value mapping
+ * to <var>key</var>, in this {@code TabularData} instance.
*
* @param key the index of the value to get in this
- * <tt>TabularData</tt> instance; * must be valid with this
- * <tt>TabularData</tt> instance's row type definition; * must not
+ * {@code TabularData} instance; must be valid with this
+ * {@code TabularData} instance's row type definition; must not
* be null.
*
* @return the value corresponding to <var>key</var>.
*
- * @throws NullPointerException if the <var>key</var> is <tt>null</tt>
- * @throws InvalidKeyException if the <var>key</var> does not conform to this <tt>TabularData</tt> instance's
- * <tt>TabularType</tt> type definition.
+ * @throws NullPointerException if the <var>key</var> is {@code null}
+ * @throws InvalidKeyException if the <var>key</var> does not conform
+ * to this {@code TabularData} instance's
+ * {@code TabularType} type definition.
*/
public CompositeData get(Object[] key) {
@@ -322,23 +328,23 @@
/**
- * This method simply calls <tt>put((CompositeData) value)</tt> and
- * therefore ignores its <var>key</var> parameter which can be <tt>null</tt>.
+ * This method simply calls {@code put((CompositeData) value)} and
+ * therefore ignores its <var>key</var> parameter which can be {@code null}.
*
* @param key an ignored parameter.
* @param value the {@link CompositeData} to put.
*
* @return the value which is put
*
- * @throws NullPointerException if the <var>value</var> is <tt>null</tt>
+ * @throws NullPointerException if the <var>value</var> is {@code null}
* @throws ClassCastException if the <var>value</var> is not of
- * the type <tt>CompositeData</tt>
+ * the type {@code CompositeData}
* @throws InvalidOpenTypeException if the <var>value</var> does
- * not conform to this <tt>TabularData</tt> instance's
- * <tt>TabularType</tt> definition
+ * not conform to this {@code TabularData} instance's
+ * {@code TabularType} definition
* @throws KeyAlreadyExistsException if the key for the
* <var>value</var> parameter, calculated according to this
- * <tt>TabularData</tt> instance's <tt>TabularType</tt> definition
+ * {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value
*/
public Object put(Object key, Object value) {
@@ -363,17 +369,17 @@
}
/**
- * This method simply calls <tt>remove((Object[]) key)</tt>.
+ * This method simply calls {@code remove((Object[]) key)}.
*
- * @param key an <tt>Object[]</tt> representing the key to remove.
+ * @param key an {@code Object[]} representing the key to remove.
*
- * @return previous value associated with specified key, or <tt>null</tt>
+ * @return previous value associated with specified key, or {@code null}
* if there was no mapping for key.
*
- * @throws NullPointerException if the <var>key</var> is <tt>null</tt>
- * @throws ClassCastException if the <var>key</var> is not of the type <tt>Object[]</tt>
- * @throws InvalidKeyException if the <var>key</var> does not conform to this <tt>TabularData</tt> instance's
- * <tt>TabularType</tt> definition
+ * @throws NullPointerException if the <var>key</var> is {@code null}
+ * @throws ClassCastException if the <var>key</var> is not of the type {@code Object[]}
+ * @throws InvalidKeyException if the <var>key</var> does not conform to this {@code TabularData} instance's
+ * {@code TabularType} definition
*/
public Object remove(Object key) {
@@ -381,19 +387,19 @@
}
/**
- * Removes the <tt>CompositeData</tt> value whose index is <var>key</var> from this <tt>TabularData</tt> instance,
- * and returns the removed value, or returns <tt>null</tt> if there is no value whose index is <var>key</var>.
+ * Removes the {@code CompositeData} value whose index is <var>key</var> from this {@code TabularData} instance,
+ * and returns the removed value, or returns {@code null} if there is no value whose index is <var>key</var>.
*
- * @param key the index of the value to get in this <tt>TabularData</tt> instance;
- * must be valid with this <tt>TabularData</tt> instance's row type definition;
+ * @param key the index of the value to get in this {@code TabularData} instance;
+ * must be valid with this {@code TabularData} instance's row type definition;
* must not be null.
*
- * @return previous value associated with specified key, or <tt>null</tt>
+ * @return previous value associated with specified key, or {@code null}
* if there was no mapping for key.
*
- * @throws NullPointerException if the <var>key</var> is <tt>null</tt>
- * @throws InvalidKeyException if the <var>key</var> does not conform to this <tt>TabularData</tt> instance's
- * <tt>TabularType</tt> definition
+ * @throws NullPointerException if the <var>key</var> is {@code null}
+ * @throws InvalidKeyException if the <var>key</var> does not conform to this {@code TabularData} instance's
+ * {@code TabularType} definition
*/
public CompositeData remove(Object[] key) {
@@ -414,30 +420,30 @@
/**
* Add all the values contained in the specified map <var>t</var>
- * to this <tt>TabularData</tt> instance. This method converts
+ * to this {@code TabularData} instance. This method converts
* the collection of values contained in this map into an array of
- * <tt>CompositeData</tt> values, if possible, and then call the
- * method <tt>putAll(CompositeData[])</tt>. Note that the keys
+ * {@code CompositeData} values, if possible, and then call the
+ * method {@code putAll(CompositeData[])}. Note that the keys
* used in the specified map <var>t</var> are ignored. This method
* allows, for example to add the content of another
- * <tt>TabularData</tt> instance with the same row type (but
+ * {@code TabularData} instance with the same row type (but
* possibly different index names) into this instance.
*
* @param t the map whose values are to be added as new rows to
- * this <tt>TabularData</tt> instance; if <var>t</var> is
- * <tt>null</tt> or empty, this method returns without doing
+ * this {@code TabularData} instance; if <var>t</var> is
+ * {@code null} or empty, this method returns without doing
* anything.
*
* @throws NullPointerException if a value in <var>t</var> is
- * <tt>null</tt>.
+ * {@code null}.
* @throws ClassCastException if a value in <var>t</var> is not an
- * instance of <tt>CompositeData</tt>.
+ * instance of {@code CompositeData}.
* @throws InvalidOpenTypeException if a value in <var>t</var>
- * does not conform to this <tt>TabularData</tt> instance's row
+ * does not conform to this {@code TabularData} instance's row
* type definition.
* @throws KeyAlreadyExistsException if the index for a value in
* <var>t</var>, calculated according to this
- * <tt>TabularData</tt> instance's <tt>TabularType</tt> definition
+ * {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value in this instance, or two
* values in <var>t</var> have the same index.
*/
@@ -449,14 +455,14 @@
return;
}
- // Convert the values in t into an array of <tt>CompositeData</tt>
+ // Convert the values in t into an array of {@code CompositeData}
//
CompositeData[] values;
try {
values =
t.values().toArray(new CompositeData[t.size()]);
} catch (java.lang.ArrayStoreException e) {
- throw new ClassCastException("Map argument t contains values which are not instances of <tt>CompositeData</tt>");
+ throw new ClassCastException("Map argument t contains values which are not instances of {@code CompositeData}");
}
// Add the array of values
@@ -466,30 +472,30 @@
/**
* Add all the elements in <var>values</var> to this
- * <tt>TabularData</tt> instance. If any element in
+ * {@code TabularData} instance. If any element in
* <var>values</var> does not satisfy the constraints defined in
- * {@link #put(CompositeData) <tt>put</tt>}, or if any two
+ * {@link #put(CompositeData) put}, or if any two
* elements in <var>values</var> have the same index calculated
- * according to this <tt>TabularData</tt> instance's
- * <tt>TabularType</tt> definition, then an exception describing
+ * according to this {@code TabularData} instance's
+ * {@code TabularType} definition, then an exception describing
* the failure is thrown and no element of <var>values</var> is
- * added, thus leaving this <tt>TabularData</tt> instance
+ * added, thus leaving this {@code TabularData} instance
* unchanged.
*
* @param values the array of composite data values to be added as
- * new rows to this <tt>TabularData</tt> instance; if
- * <var>values</var> is <tt>null</tt> or empty, this method
+ * new rows to this {@code TabularData} instance; if
+ * <var>values</var> is {@code null} or empty, this method
* returns without doing anything.
*
* @throws NullPointerException if an element of <var>values</var>
- * is <tt>null</tt>
+ * is {@code null}
* @throws InvalidOpenTypeException if an element of
* <var>values</var> does not conform to this
- * <tt>TabularData</tt> instance's row type definition (ie its
- * <tt>TabularType</tt> definition)
+ * {@code TabularData} instance's row type definition (ie its
+ * {@code TabularType} definition)
* @throws KeyAlreadyExistsException if the index for an element
* of <var>values</var>, calculated according to this
- * <tt>TabularData</tt> instance's <tt>TabularType</tt> definition
+ * {@code TabularData} instance's {@code TabularType} definition
* already maps to an existing value in this instance, or two
* elements of <var>values</var> have the same index
*/
@@ -529,7 +535,7 @@
}
/**
- * Removes all rows from this <code>TabularDataSupport</code> instance.
+ * Removes all rows from this {@code TabularDataSupport} instance.
*/
public void clear() {
@@ -541,9 +547,9 @@
/* *** Informational methods from java.util.Map *** */
/**
- * Returns the number of rows in this <code>TabularDataSupport</code> instance.
+ * Returns the number of rows in this {@code TabularDataSupport} instance.
*
- * @return the number of rows in this <code>TabularDataSupport</code> instance.
+ * @return the number of rows in this {@code TabularDataSupport} instance.
*/
public int size() {
@@ -551,9 +557,9 @@
}
/**
- * Returns <tt>true</tt> if this <code>TabularDataSupport</code> instance contains no rows.
+ * Returns {@code true} if this {@code TabularDataSupport} instance contains no rows.
*
- * @return <tt>true</tt> if this <code>TabularDataSupport</code> instance contains no rows.
+ * @return {@code true} if this {@code TabularDataSupport} instance contains no rows.
*/
public boolean isEmpty() {
@@ -656,9 +662,10 @@
/**
- * Returns a clone of this <code>TabularDataSupport</code> instance:
- * the clone is obtained by calling <tt>super.clone()</tt>, and then cloning the underlying map.
- * Only a shallow clone of the underlying map is made, i.e. no cloning of the indexes and row values is made as they are immutable.
+ * Returns a clone of this {@code TabularDataSupport} instance:
+ * the clone is obtained by calling {@code super.clone()}, and then cloning the underlying map.
+ * Only a shallow clone of the underlying map is made, i.e.
+ * no cloning of the indexes and row values is made as they are immutable.
*/
/* We cannot use covariance here and return TabularDataSupport
because this would fail with existing code that subclassed
@@ -677,21 +684,21 @@
/**
- * Compares the specified <var>obj</var> parameter with this <code>TabularDataSupport</code> instance for equality.
+ * Compares the specified <var>obj</var> parameter with this {@code TabularDataSupport} instance for equality.
* <p>
- * Returns <tt>true</tt> if and only if all of the following statements are true:
+ * Returns {@code true} if and only if all of the following statements are true:
* <ul>
* <li><var>obj</var> is non null,</li>
- * <li><var>obj</var> also implements the <code>TabularData</code> interface,</li>
+ * <li><var>obj</var> also implements the {@code TabularData} interface,</li>
* <li>their tabular types are equal</li>
* <li>their contents (ie all CompositeData values) are equal.</li>
* </ul>
- * This ensures that this <tt>equals</tt> method works properly for <var>obj</var> parameters which are
- * different implementations of the <code>TabularData</code> interface.
+ * This ensures that this {@code equals} method works properly for <var>obj</var> parameters which are
+ * different implementations of the {@code TabularData} interface.
* <br>
- * @param obj the object to be compared for equality with this <code>TabularDataSupport</code> instance;
+ * @param obj the object to be compared for equality with this {@code TabularDataSupport} instance;
*
- * @return <code>true</code> if the specified object is equal to this <code>TabularDataSupport</code> instance.
+ * @return {@code true} if the specified object is equal to this {@code TabularDataSupport} instance.
*/
public boolean equals(Object obj) {
@@ -738,22 +745,22 @@
}
/**
- * Returns the hash code value for this <code>TabularDataSupport</code> instance.
+ * Returns the hash code value for this {@code TabularDataSupport} instance.
* <p>
- * The hash code of a <code>TabularDataSupport</code> instance is the sum of the hash codes
- * of all elements of information used in <code>equals</code> comparisons
+ * The hash code of a {@code TabularDataSupport} instance is the sum of the hash codes
+ * of all elements of information used in {@code equals} comparisons
* (ie: its <i>tabular type</i> and its content, where the content is defined as all the CompositeData values).
* <p>
- * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
- * for any two <code>TabularDataSupport</code> instances <code>t1</code> and <code>t2</code>,
+ * This ensures that {@code t1.equals(t2)} implies that {@code t1.hashCode()==t2.hashCode()}
+ * for any two {@code TabularDataSupport} instances {@code t1} and {@code t2},
* as required by the general contract of the method
* {@link Object#hashCode() Object.hashCode()}.
* <p>
- * However, note that another instance of a class implementing the <code>TabularData</code> interface
- * may be equal to this <code>TabularDataSupport</code> instance as defined by {@link #equals},
+ * However, note that another instance of a class implementing the {@code TabularData} interface
+ * may be equal to this {@code TabularDataSupport} instance as defined by {@link #equals},
* but may have a different hash code if it is calculated differently.
*
- * @return the hash code value for this <code>TabularDataSupport</code> instance
+ * @return the hash code value for this {@code TabularDataSupport} instance
*/
public int hashCode() {
@@ -768,14 +775,15 @@
}
/**
- * Returns a string representation of this <code>TabularDataSupport</code> instance.
+ * Returns a string representation of this {@code TabularDataSupport} instance.
* <p>
- * The string representation consists of the name of this class (ie <code>javax.management.openmbean.TabularDataSupport</code>),
+ * The string representation consists of the name of this class
+ * (ie {@code javax.management.openmbean.TabularDataSupport}),
* the string representation of the tabular type of this instance, and the string representation of the contents
* (ie list the key=value mappings as returned by a call to
- * <tt>dataMap.</tt>{@link java.util.HashMap#toString() toString()}).
+ * {@code dataMap.}{@link java.util.HashMap#toString() toString()}).
*
- * @return a string representation of this <code>TabularDataSupport</code> instance
+ * @return a string representation of this {@code TabularDataSupport} instance
*/
public String toString() {
@@ -796,14 +804,17 @@
/**
- * Returns the index for value, assuming value is valid for this <tt>TabularData</tt> instance
+ * Returns the index for value, assuming value is valid for this {@code TabularData} instance
* (ie value is not null, and its composite type is equal to row type).
*
- * The index is a List, and not an array, so that an index.equals(otherIndex) call will actually compare contents,
+ * The index is a List, and not an array, so that an
+ * index.equals(otherIndex) call will actually compare contents,
* not just the objects references as is done for an array object.
*
- * The returned List is unmodifiable so that once a row has been put into the dataMap, its index cannot be modified,
- * for example by a user that would attempt to modify an index contained in the Set returned by keySet().
+ * The returned List is unmodifiable so that once a row has been put
+ * into the dataMap, its index cannot be modified,
+ * for example by a user that would attempt to modify an
+ * index contained in the Set returned by keySet().
*/
private List<?> internalCalculateIndex(CompositeData value) {
@@ -811,7 +822,7 @@
}
/**
- * Checks if the specified key is valid for this <tt>TabularData</tt> instance.
+ * Checks if the specified key is valid for this {@code TabularData} instance.
*
* @throws NullPointerException
* @throws InvalidOpenTypeException
@@ -848,7 +859,7 @@
}
/**
- * Checks the specified value's type is valid for this <tt>TabularData</tt> instance
+ * Checks the specified value's type is valid for this {@code TabularData} instance
* (ie value is not null, and its composite type is equal to row type).
*
* @throws NullPointerException
@@ -872,7 +883,7 @@
}
/**
- * Checks if the specified value can be put (ie added) in this <tt>TabularData</tt> instance
+ * Checks if the specified value can be put (ie added) in this {@code TabularData} instance
* (ie value is not null, its composite type is equal to row type, and its index is not already used),
* and returns the index calculated for this value.
*
--- a/jdk/src/java.management/share/classes/javax/management/relation/RoleInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/relation/RoleInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -42,7 +42,7 @@
/**
* A RoleInfo object summarises a role in a relation type.
*
- * <p>The <b>serialVersionUID</b> of this class is <code>2504952983494636987L</code>.
+ * <p>The <b>serialVersionUID</b> of this class is {@code 2504952983494636987L}.
*
* @since 1.5
*/
@@ -89,8 +89,8 @@
private static final long serialVersionUID;
/**
* @serialField name String Role name
- * @serialField isReadable boolean Read access mode: <code>true</code> if role is readable
- * @serialField isWritable boolean Write access mode: <code>true</code> if role is writable
+ * @serialField isReadable boolean Read access mode: {@code true} if role is readable
+ * @serialField isWritable boolean Write access mode: {@code true} if role is writable
* @serialField description String Role description
* @serialField minDegree int Minimum degree (i.e. minimum number of referenced MBeans in corresponding role)
* @serialField maxDegree int Maximum degree (i.e. maximum number of referenced MBeans in corresponding role)
@@ -136,12 +136,12 @@
private String name = null;
/**
- * @serial Read access mode: <code>true</code> if role is readable
+ * @serial Read access mode: {@code true} if role is readable
*/
private boolean isReadable;
/**
- * @serial Write access mode: <code>true</code> if role is writable
+ * @serial Write access mode: {@code true} if role is writable
*/
private boolean isWritable;
@@ -183,11 +183,11 @@
* can be set
* @param min minimum degree for role, i.e. minimum number of
* MBeans to provide in corresponding role
- * Must be less than or equal to <tt>max</tt>.
+ * Must be less than or equal to {@code max}.
* (ROLE_CARDINALITY_INFINITY for unlimited)
* @param max maximum degree for role, i.e. maximum number of
* MBeans to provide in corresponding role
- * Must be greater than or equal to <tt>min</tt>
+ * Must be greater than or equal to {@code min}
* (ROLE_CARDINALITY_INFINITY for unlimited)
* @param descr description of the role (can be null)
*
@@ -316,7 +316,7 @@
/**
* Copy constructor.
*
- * @param roleInfo the <tt>RoleInfo</tt> instance to be copied.
+ * @param roleInfo the {@code RoleInfo} instance to be copied.
*
* @exception IllegalArgumentException if null parameter
*/
@@ -413,7 +413,7 @@
}
/**
- * Returns true if the <tt>value</tt> parameter is greater than or equal to
+ * Returns true if the {@code value} parameter is greater than or equal to
* the expected minimum degree, false otherwise.
*
* @param value the value to be checked
@@ -431,7 +431,7 @@
}
/**
- * Returns true if the <tt>value</tt> parameter is lower than or equal to
+ * Returns true if the {@code value} parameter is lower than or equal to
* the expected maximum degree, false otherwise.
*
* @param value the value to be checked
--- a/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java Wed Jul 05 20:44:51 2017 +0200
@@ -142,7 +142,7 @@
}
/**
- * <p>Constructs an <code>RMIConnector</code> that will connect
+ * <p>Constructs an {@code RMIConnector} that will connect
* the RMI connector server with the given address.</p>
*
* <p>The address can refer directly to the connector server,
@@ -153,7 +153,7 @@
* service:jmx:iiop://<em>[host[:port]]</em>/ior/<em>encoded-IOR</em>
* </pre>
*
- * <p>(Here, the square brackets <code>[]</code> are not part of the
+ * <p>(Here, the square brackets {@code []} are not part of the
* address but indicate that the host and port are optional.)</p>
*
* <p>The address can instead indicate where to find an RMI stub
@@ -179,7 +179,7 @@
* InitialContext#InitialContext(Hashtable) InitialContext}. This
* parameter can be null, which is equivalent to an empty Map.
*
- * @exception IllegalArgumentException if <code>url</code>
+ * @exception IllegalArgumentException if {@code url}
* is null.
*/
public RMIConnector(JMXServiceURL url, Map<String,?> environment) {
@@ -187,14 +187,14 @@
}
/**
- * <p>Constructs an <code>RMIConnector</code> using the given RMI stub.
+ * <p>Constructs an {@code RMIConnector} using the given RMI stub.
*
* @param rmiServer an RMI stub representing the RMI connector server.
* @param environment additional attributes specifying how to make
* the connection. This parameter can be null, which is
* equivalent to an empty Map.
*
- * @exception IllegalArgumentException if <code>rmiServer</code>
+ * @exception IllegalArgumentException if {@code rmiServer}
* is null.
*/
public RMIConnector(RMIServer rmiServer, Map<String,?> environment) {
@@ -203,7 +203,7 @@
/**
* <p>Returns a string representation of this object. In general,
- * the <code>toString</code> method returns a string that
+ * the {@code toString} method returns a string that
* "textually represents" this object. The result should be a
* concise but informative representation that is easy for a
* person to read.</p>
@@ -1732,7 +1732,7 @@
* @param environment An environment map, possibly containing an ORB.
* @return the given stub.
* @exception IllegalArgumentException if the
- * <tt>java.naming.corba.orb</tt> property is specified and
+ * {@code java.naming.corba.orb} property is specified and
* does not point to an {@link org.omg.CORBA.ORB ORB}.
* @exception IOException if the connection to the ORB failed.
**/
@@ -1767,7 +1767,7 @@
* @param environment An environment map, possibly containing an ORB.
* @return An ORB.
* @exception IllegalArgumentException if the
- * <tt>java.naming.corba.orb</tt> property is specified and
+ * {@code java.naming.corba.orb} property is specified and
* does not point to an {@link org.omg.CORBA.ORB ORB}.
* @exception IOException if the ORB initialization failed.
**/
@@ -1793,7 +1793,7 @@
/**
* Read RMIConnector fields from an {@link java.io.ObjectInputStream
* ObjectInputStream}.
- * Calls <code>s.defaultReadObject()</code> and then initializes
+ * Calls {@code s.defaultReadObject()} and then initializes
* all transient variables that need initializing.
* @param s The ObjectInputStream to read from.
* @exception InvalidObjectException if none of <var>rmiServer</var> stub
@@ -1818,7 +1818,7 @@
* before serializing it. This is done using the environment
* map that was provided to the constructor, if any, and as documented
* in {@link javax.management.remote.rmi}.</p>
- * <p>This method then calls <code>s.defaultWriteObject()</code>.
+ * <p>This method then calls {@code s.defaultWriteObject()}.
* Usually, <var>rmiServer</var> is null if this object
* was constructed with a JMXServiceURL, and <var>jmxServiceURL</var>
* is null if this object is constructed with a RMIServer stub.
@@ -1939,9 +1939,9 @@
* Lookup the RMIServer stub in a directory.
* @param jndiURL A JNDI URL indicating the location of the Stub
* (see {@link javax.management.remote.rmi}), e.g.:
- * <ul><li><tt>rmi://registry-host:port/rmi-stub-name</tt></li>
- * <li>or <tt>iiop://cosnaming-host:port/iiop-stub-name</tt></li>
- * <li>or <tt>ldap://ldap-host:port/java-container-dn</tt></li>
+ * <ul><li>{@code rmi://registry-host:port/rmi-stub-name}</li>
+ * <li>or {@code iiop://cosnaming-host:port/iiop-stub-name}</li>
+ * <li>or {@code ldap://ldap-host:port/java-container-dn}</li>
* </ul>
* @param env the environment Map passed to the connector.
* @param isIiop true if the stub is expected to be an IIOP stub.
--- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java Wed Jul 05 20:44:51 2017 +0200
@@ -137,7 +137,7 @@
* context (never null). This is based on the environment
* parameter, the system properties, and all application resource files.
*
- * <p> This method will modify <tt>env</tt> and save
+ * <p> This method will modify {@code env} and save
* a reference to it. The caller may no longer modify it.
*
* @param env environment passed to initial context constructor.
@@ -195,7 +195,7 @@
* may in turn contain values that come from system properties,
* or application resource files.
*
- * If <tt>concat</tt> is true and both the environment and the provider
+ * If {@code concat} is true and both the environment and the provider
* resource file contain the property, the two values are concatenated
* (with a ':' separator).
*
--- a/jdk/src/java.naming/share/classes/javax/naming/Binding.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/Binding.java Wed Jul 05 20:44:51 2017 +0200
@@ -49,7 +49,7 @@
/**
* Contains this binding's object.
* It is initialized by the constructor and can be updated using
- * <tt>setObject</tt>.
+ * {@code setObject}.
* @serial
* @see #getObject
* @see #setObject
@@ -59,9 +59,9 @@
/**
* Constructs an instance of a Binding given its name and object.
*<p>
- * <tt>getClassName()</tt> will return
- * the class name of <tt>obj</tt> (or null if <tt>obj</tt> is null)
- * unless the class name has been explicitly set using <tt>setClassName()</tt>
+ * {@code getClassName()} will return
+ * the class name of {@code obj} (or null if {@code obj} is null)
+ * unless the class name has been explicitly set using {@code setClassName()}
*
* @param name The non-null name of the object. It is relative
* to the <em>target context</em> (which is
@@ -78,9 +78,9 @@
* Constructs an instance of a Binding given its name, object, and whether
* the name is relative.
*<p>
- * <tt>getClassName()</tt> will return the class name of <tt>obj</tt>
- * (or null if <tt>obj</tt> is null) unless the class name has been
- * explicitly set using <tt>setClassName()</tt>
+ * {@code getClassName()} will return the class name of {@code obj}
+ * (or null if {@code obj} is null) unless the class name has been
+ * explicitly set using {@code setClassName()}
*
* @param name The non-null string name of the object.
* @param obj The possibly null object bound to name.
@@ -104,9 +104,9 @@
* to the <em>target context</em> (which is
* named by the first parameter of the <code>listBindings()</code> method)
* @param className The possibly null class name of the object
- * bound to <tt>name</tt>. If null, the class name of <tt>obj</tt> is
- * returned by <tt>getClassName()</tt>. If <tt>obj</tt> is also
- * null, <tt>getClassName()</tt> will return null.
+ * bound to {@code name}. If null, the class name of {@code obj} is
+ * returned by {@code getClassName()}. If {@code obj} is also
+ * null, {@code getClassName()} will return null.
* @param obj The possibly null object bound to name.
* @see NameClassPair#setClassName
*/
@@ -121,9 +121,9 @@
*
* @param name The non-null string name of the object.
* @param className The possibly null class name of the object
- * bound to <tt>name</tt>. If null, the class name of <tt>obj</tt> is
- * returned by <tt>getClassName()</tt>. If <tt>obj</tt> is also
- * null, <tt>getClassName()</tt> will return null.
+ * bound to {@code name}. If null, the class name of {@code obj} is
+ * returned by {@code getClassName()}. If {@code obj} is also
+ * null, {@code getClassName()} will return null.
* @param obj The possibly null object bound to name.
* @param isRelative true if <code>name</code> is a name relative
* to the target context (which is named by
--- a/jdk/src/java.naming/share/classes/javax/naming/CannotProceedException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/CannotProceedException.java Wed Jul 05 20:44:51 2017 +0200
@@ -93,9 +93,9 @@
/**
* Contains the name of the resolved object, relative
- * to the context <code>altNameCtx</code>. It is a composite name.
+ * to the context {@code altNameCtx}. It is a composite name.
* If null, then no name is specified.
- * See the <code>javax.naming.spi.ObjectFactory.getObjectInstance</code>
+ * See the {@code javax.naming.spi.ObjectFactory.getObjectInstance}
* method for details on how this is used.
* <p>
* This field is initialized to null.
@@ -112,9 +112,9 @@
/**
* Contains the context relative to which
- * <code>altName</code> is specified. If null, then the default initial
+ * {@code altName} is specified. If null, then the default initial
* context is implied.
- * See the <code>javax.naming.spi.ObjectFactory.getObjectInstance</code>
+ * See the {@code javax.naming.spi.ObjectFactory.getObjectInstance}
* method for details on how this is used.
* <p>
* This field is initialized to null.
@@ -189,16 +189,16 @@
/**
* Sets the "remaining new name" field of this exception.
- * This is the value returned by <code>getRemainingNewName()</code>.
+ * This is the value returned by {@code getRemainingNewName()}.
*<p>
- * <tt>newName</tt> is a composite name. If the intent is to set
+ * {@code newName} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
* invoke this method using the resulting composite name.
*<p>
- * A copy of <code>newName</code> is made and stored.
- * Subsequent changes to <code>name</code> does not
+ * A copy of {@code newName} is made and stored.
+ * Subsequent changes to {@code name} does not
* affect the copy in this NamingException and vice versa.
*
* @param newName The possibly null name to set the "remaining new name" to.
@@ -214,13 +214,13 @@
}
/**
- * Retrieves the <code>altName</code> field of this exception.
+ * Retrieves the {@code altName} field of this exception.
* This is the name of the resolved object, relative to the context
- * <code>altNameCtx</code>. It will be used during a subsequent call to the
- * <code>javax.naming.spi.ObjectFactory.getObjectInstance</code> method.
+ * {@code altNameCtx}. It will be used during a subsequent call to the
+ * {@code javax.naming.spi.ObjectFactory.getObjectInstance} method.
*
* @return The name of the resolved object, relative to
- * <code>altNameCtx</code>.
+ * {@code altNameCtx}.
* It is a composite name. If null, then no name is specified.
*
* @see #setAltName
@@ -232,10 +232,10 @@
}
/**
- * Sets the <code>altName</code> field of this exception.
+ * Sets the {@code altName} field of this exception.
*
* @param altName The name of the resolved object, relative to
- * <code>altNameCtx</code>.
+ * {@code altNameCtx}.
* It is a composite name.
* If null, then no name is specified.
*
@@ -247,12 +247,12 @@
}
/**
- * Retrieves the <code>altNameCtx</code> field of this exception.
- * This is the context relative to which <code>altName</code> is named.
+ * Retrieves the {@code altNameCtx} field of this exception.
+ * This is the context relative to which {@code altName} is named.
* It will be used during a subsequent call to the
- * <code>javax.naming.spi.ObjectFactory.getObjectInstance</code> method.
+ * {@code javax.naming.spi.ObjectFactory.getObjectInstance} method.
*
- * @return The context relative to which <code>altName</code> is named.
+ * @return The context relative to which {@code altName} is named.
* If null, then the default initial context is implied.
*
* @see #setAltNameCtx
@@ -264,10 +264,10 @@
}
/**
- * Sets the <code>altNameCtx</code> field of this exception.
+ * Sets the {@code altNameCtx} field of this exception.
*
* @param altNameCtx
- * The context relative to which <code>altName</code>
+ * The context relative to which {@code altName}
* is named. If null, then the default initial context
* is implied.
*
--- a/jdk/src/java.naming/share/classes/javax/naming/CompositeName.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/CompositeName.java Wed Jul 05 20:44:51 2017 +0200
@@ -76,7 +76,7 @@
*<h1>Composite Name Examples</h1>
*This table shows examples of some composite names. Each row shows
*the string form of a composite name and its corresponding structural form
- *(<tt>CompositeName</tt>).
+ *({@code CompositeName}).
*
<table border="1" cellpadding=3 summary="examples showing string form of composite name and its corresponding structural form (CompositeName)">
@@ -140,7 +140,7 @@
*<h1>Composition Examples</h1>
* Here are some composition examples. The right column shows composing
* string composite names while the left column shows composing the
- * corresponding <tt>CompositeName</tt>s. Notice that composing the
+ * corresponding {@code CompositeName}s. Notice that composing the
* string forms of two composite names simply involves concatenating
* their string forms together.
@@ -190,9 +190,9 @@
</table>
*
*<h1>Multithreaded Access</h1>
- * A <tt>CompositeName</tt> instance is not synchronized against concurrent
+ * A {@code CompositeName} instance is not synchronized against concurrent
* multithreaded access. Multiple threads trying to access and modify a
- * <tt>CompositeName</tt> should lock the object.
+ * {@code CompositeName} should lock the object.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -557,8 +557,8 @@
/**
* Overridden to avoid implementation dependency.
- * @serialData The number of components (an <tt>int</tt>) followed by
- * the individual components (each a <tt>String</tt>).
+ * @serialData The number of components (an {@code int}) followed by
+ * the individual components (each a {@code String}).
*/
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
--- a/jdk/src/java.naming/share/classes/javax/naming/CompoundName.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/CompoundName.java Wed Jul 05 20:44:51 2017 +0200
@@ -137,9 +137,9 @@
* of the original compound name.
*
*<h1>Multithreaded Access</h1>
- * A <tt>CompoundName</tt> instance is not synchronized against concurrent
+ * A {@code CompoundName} instance is not synchronized against concurrent
* multithreaded access. Multiple threads trying to access and modify a
- * <tt>CompoundName</tt> should lock the object.
+ * {@code CompoundName} should lock the object.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -194,7 +194,7 @@
* this compound name. See class description for
* contents of properties.
* @exception InvalidNameException If 'n' violates the syntax specified
- * by <code>syntax</code>.
+ * by {@code syntax}.
*/
public CompoundName(String n, Properties syntax) throws InvalidNameException {
if (syntax == null) {
@@ -549,9 +549,9 @@
/**
* Overridden to avoid implementation dependency.
- * @serialData The syntax <tt>Properties</tt>, followed by
- * the number of components (an <tt>int</tt>), and the individual
- * components (each a <tt>String</tt>).
+ * @serialData The syntax {@code Properties}, followed by
+ * the number of components (an {@code int}), and the individual
+ * components (each a {@code String}).
*/
private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
--- a/jdk/src/java.naming/share/classes/javax/naming/Context.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/Context.java Wed Jul 05 20:44:51 2017 +0200
@@ -33,7 +33,7 @@
* It contains methods for examining and updating these bindings.
*
* <h1>Names</h1>
- * Each name passed as an argument to a <tt>Context</tt> method is relative
+ * Each name passed as an argument to a {@code Context} method is relative
* to that context. The empty name is used to name the context itself.
* A name parameter may never be null.
* <p>
@@ -47,31 +47,31 @@
* The second version instead has a link to the first: the same
* documentation applies to both.
* <p>
- * For systems that support federation, <tt>String</tt> name arguments to
- * <tt>Context</tt> methods are composite names. Name arguments that are
- * instances of <tt>CompositeName</tt> are treated as composite names,
- * while <tt>Name</tt> arguments that are not instances of
- * <tt>CompositeName</tt> are treated as compound names (which might be
- * instances of <tt>CompoundName</tt> or other implementations of compound
- * names). This allows the results of <tt>NameParser.parse()</tt> to be used as
- * arguments to the <tt>Context</tt> methods.
+ * For systems that support federation, {@code String} name arguments to
+ * {@code Context} methods are composite names. Name arguments that are
+ * instances of {@code CompositeName} are treated as composite names,
+ * while {@code Name} arguments that are not instances of
+ * {@code CompositeName} are treated as compound names (which might be
+ * instances of {@code CompoundName} or other implementations of compound
+ * names). This allows the results of {@code NameParser.parse()} to be used as
+ * arguments to the {@code Context} methods.
* Prior to JNDI 1.2, all name arguments were treated as composite names.
*<p>
* Furthermore, for systems that support federation, all names returned
- * in a <tt>NamingEnumeration</tt>
- * from <tt>list()</tt> and <tt>listBindings()</tt> are composite names
+ * in a {@code NamingEnumeration}
+ * from {@code list()} and {@code listBindings()} are composite names
* represented as strings.
- * See <tt>CompositeName</tt> for the string syntax of names.
+ * See {@code CompositeName} for the string syntax of names.
*<p>
* For systems that do not support federation, the name arguments (in
- * either <tt>Name</tt> or <tt>String</tt> forms) and the names returned in
- * <tt>NamingEnumeration</tt> may be names in their own namespace rather than
+ * either {@code Name} or {@code String} forms) and the names returned in
+ * {@code NamingEnumeration} may be names in their own namespace rather than
* names in a composite namespace, at the discretion of the service
* provider.
*
*<h1>Exceptions</h1>
- * All the methods in this interface can throw a <tt>NamingException</tt> or
- * any of its subclasses. See <tt>NamingException</tt> and their subclasses
+ * All the methods in this interface can throw a {@code NamingException} or
+ * any of its subclasses. See {@code NamingException} and their subclasses
* for details on each exception.
*
*<h1>Concurrent Access</h1>
@@ -80,26 +80,26 @@
* a single Context instance concurrently should synchronize amongst
* themselves and provide the necessary locking. Multiple threads
* each manipulating a different Context instance need not
- * synchronize. Note that the {@link #lookup(Name) <tt>lookup</tt>}
+ * synchronize. Note that the {@link #lookup(Name) lookup}
* method, when passed an empty name, will return a new Context instance
* representing the same naming context.
*<p>
* For purposes of concurrency control,
- * a Context operation that returns a <tt>NamingEnumeration</tt> is
+ * a Context operation that returns a {@code NamingEnumeration} is
* not considered to have completed while the enumeration is still in
* use, or while any referrals generated by that operation are still
* being followed.
*
*
*<h1>Parameters</h1>
- * A <tt>Name</tt> parameter passed to any method of the
- * <tt>Context</tt> interface or one of its subinterfaces
+ * A {@code Name} parameter passed to any method of the
+ * {@code Context} interface or one of its subinterfaces
* will not be modified by the service provider.
* The service provider may keep a reference to it
* for the duration of the operation, including any enumeration of the
* method's results and the processing of any referrals generated.
* The caller should not modify the object during this time.
- * A <tt>Name</tt> returned by any such method is owned by the caller.
+ * A {@code Name} returned by any such method is owned by the caller.
* The caller may subsequently modify it; the service provider may not.
*
*
@@ -111,7 +111,7 @@
* require specification of security credentials in order to access
* the service. Another context might require that server configuration
* information be supplied. These are referred to as the <em>environment</em>
- * of a context. The <tt>Context</tt> interface provides methods for
+ * of a context. The {@code Context} interface provides methods for
* retrieving and updating this environment.
*<p>
* The environment is inherited from the parent context as
@@ -145,7 +145,7 @@
* application components and service providers may be distributed
* along with <em>resource files.</em>
* A JNDI resource file is a file in the properties file format (see
- * {@link java.util.Properties#load <tt>java.util.Properties</tt>}),
+ * {@link java.util.Properties#load java.util.Properties}),
* containing a list of key/value pairs.
* The key is the name of the property (e.g. "java.naming.factory.object")
* and the value is a string in the format defined
@@ -170,18 +170,18 @@
* Each service provider has an optional resource that lists properties
* specific to that provider. The name of this resource is:
* <blockquote>
- * [<em>prefix</em>/]<tt>jndiprovider.properties</tt>
+ * [<em>prefix</em>/]{@code jndiprovider.properties}
* </blockquote>
* where <em>prefix</em> is
* the package name of the provider's context implementation(s),
* with each period (".") converted to a slash ("/").
*
* For example, suppose a service provider defines a context
- * implementation with class name <tt>com.sun.jndi.ldap.LdapCtx</tt>.
+ * implementation with class name {@code com.sun.jndi.ldap.LdapCtx}.
* The provider resource for this provider is named
- * <tt>com/sun/jndi/ldap/jndiprovider.properties</tt>. If the class is
+ * {@code com/sun/jndi/ldap/jndiprovider.properties}. If the class is
* not in a package, the resource's name is simply
- * <tt>jndiprovider.properties</tt>.
+ * {@code jndiprovider.properties}.
*
* <p>
* <a name=LISTPROPS></a>
@@ -204,11 +204,11 @@
*
* When an application is deployed, it will generally have several
* codebase directories and JARs in its classpath. JNDI locates (using
- * {@link ClassLoader#getResources <tt>ClassLoader.getResources()</tt>})
- * all <em>application resource files</em> named <tt>jndi.properties</tt>
+ * {@link ClassLoader#getResources ClassLoader.getResources()})
+ * all <em>application resource files</em> named {@code jndi.properties}
* in the classpath.
* In addition, if the Java installation directory contains a built-in
- * properties file, typically <tt>conf/jndi.properties</tt>,
+ * properties file, typically {@code conf/jndi.properties},
* JNDI treats it as an additional application resource file.
* All of the properties contained in these files are placed
* into the environment of the initial context. This environment
@@ -220,7 +220,7 @@
* sense to do so, it concatenates all of the values (details are given
* below).
* For example, if the "java.naming.factory.object" property is found in
- * three <tt>jndi.properties</tt> resource files, the
+ * three {@code jndi.properties} resource files, the
* list of object factories is a concatenation of the property
* values from all three files.
* Using this scheme, each deployable component is responsible for
@@ -234,7 +234,7 @@
* is initialized with properties defined in the environment parameter
* passed to the constructor, the system properties,
* and the application resource files. See
- * <a href=InitialContext.html#ENVIRONMENT><tt>InitialContext</tt></a>
+ * <a href=InitialContext.html#ENVIRONMENT>{@code InitialContext}</a>
* for details.
* This initial environment is then inherited by other context instances.
*
@@ -244,7 +244,7 @@
* the values from the following two sources, in order:
* <ol>
* <li>The environment of the context being operated on.
- * <li>The provider resource file (<tt>jndiprovider.properties</tt>)
+ * <li>The provider resource file ({@code jndiprovider.properties})
* for the context being operated on.
* </ol>
* For each property found in both of these two sources,
@@ -278,14 +278,14 @@
/**
* Retrieves the named object.
- * If <tt>name</tt> is empty, returns a new instance of this context
+ * If {@code name} is empty, returns a new instance of this context
* (which represents the same naming context as this context, but its
* environment may be modified independently and it may be accessed
* concurrently).
*
* @param name
* the name of the object to look up
- * @return the object bound to <tt>name</tt>
+ * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
*
* @see #lookup(String)
@@ -298,7 +298,7 @@
* See {@link #lookup(Name)} for details.
* @param name
* the name of the object to look up
- * @return the object bound to <tt>name</tt>
+ * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
*/
public Object lookup(String name) throws NamingException;
@@ -344,7 +344,7 @@
* All intermediate contexts and the target context (that named by all
* but terminal atomic component of the name) must already exist.
*
- * <p> If the object is a <tt>DirContext</tt>, any existing attributes
+ * <p> If the object is a {@code DirContext}, any existing attributes
* associated with the name are replaced with those of the object.
* Otherwise, any existing attributes associated with the name remain
* unchanged.
@@ -388,7 +388,7 @@
* <p> This method is idempotent.
* It succeeds even if the terminal atomic name
* is not bound in the target context, but throws
- * <tt>NameNotFoundException</tt>
+ * {@code NameNotFoundException}
* if any of the intermediate contexts do not exist.
*
* <p> Any attributes associated with the name are removed.
@@ -424,7 +424,7 @@
* the name of the existing binding; may not be empty
* @param newName
* the name of the new binding; may not be empty
- * @throws NameAlreadyBoundException if <tt>newName</tt> is already bound
+ * @throws NameAlreadyBoundException if {@code newName} is already bound
* @throws NamingException if a naming exception is encountered
*
* @see #rename(String, String)
@@ -442,7 +442,7 @@
* the name of the existing binding; may not be empty
* @param newName
* the name of the new binding; may not be empty
- * @throws NameAlreadyBoundException if <tt>newName</tt> is already bound
+ * @throws NameAlreadyBoundException if {@code newName} is already bound
* @throws NamingException if a naming exception is encountered
*/
public void rename(String oldName, String newName) throws NamingException;
@@ -459,7 +459,7 @@
* the name of the context to list
* @return an enumeration of the names and class names of the
* bindings in this context. Each element of the
- * enumeration is of type <tt>NameClassPair</tt>.
+ * enumeration is of type {@code NameClassPair}.
* @throws NamingException if a naming exception is encountered
*
* @see #list(String)
@@ -478,7 +478,7 @@
* the name of the context to list
* @return an enumeration of the names and class names of the
* bindings in this context. Each element of the
- * enumeration is of type <tt>NameClassPair</tt>.
+ * enumeration is of type {@code NameClassPair}.
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration<NameClassPair> list(String name)
@@ -496,7 +496,7 @@
* the name of the context to list
* @return an enumeration of the bindings in this context.
* Each element of the enumeration is of type
- * <tt>Binding</tt>.
+ * {@code Binding}.
* @throws NamingException if a naming exception is encountered
*
* @see #listBindings(String)
@@ -515,7 +515,7 @@
* the name of the context to list
* @return an enumeration of the bindings in this context.
* Each element of the enumeration is of type
- * <tt>Binding</tt>.
+ * {@code Binding}.
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration<Binding> listBindings(String name)
@@ -529,7 +529,7 @@
* <p> This method is idempotent.
* It succeeds even if the terminal atomic name
* is not bound in the target context, but throws
- * <tt>NameNotFoundException</tt>
+ * {@code NameNotFoundException}
* if any of the intermediate contexts do not exist.
*
* <p> In a federated naming system, a context from one naming system
@@ -537,11 +537,11 @@
* look up and perform operations on the foreign context using a
* composite name. However, an attempt destroy the context using
* this composite name will fail with
- * <tt>NotContextException</tt>, because the foreign context is not
+ * {@code NotContextException}, because the foreign context is not
* a "subcontext" of the context in which it is bound.
- * Instead, use <tt>unbind()</tt> to remove the
+ * Instead, use {@code unbind()} to remove the
* binding of the foreign context. Destroying the foreign context
- * requires that the <tt>destroySubcontext()</tt> be performed
+ * requires that the {@code destroySubcontext()} be performed
* on a context from the foreign context's "native" naming system.
*
* @param name
@@ -611,12 +611,12 @@
/**
* Retrieves the named object, following links except
* for the terminal atomic component of the name.
- * If the object bound to <tt>name</tt> is not a link,
+ * If the object bound to {@code name} is not a link,
* returns the object itself.
*
* @param name
* the name of the object to look up
- * @return the object bound to <tt>name</tt>, not following the
+ * @return the object bound to {@code name}, not following the
* terminal link (if any).
* @throws NamingException if a naming exception is encountered
*
@@ -631,7 +631,7 @@
*
* @param name
* the name of the object to look up
- * @return the object bound to <tt>name</tt>, not following the
+ * @return the object bound to {@code name}, not following the
* terminal link (if any)
* @throws NamingException if a naming exception is encountered
*/
@@ -643,8 +643,8 @@
* parse names differently. This method allows an application
* to get a parser for parsing names into their atomic components
* using the naming convention of a particular naming system.
- * Within any single naming system, <tt>NameParser</tt> objects
- * returned by this method must be equal (using the <tt>equals()</tt>
+ * Within any single naming system, {@code NameParser} objects
+ * returned by this method must be equal (using the {@code equals()}
* test).
*
* @param name
@@ -765,7 +765,7 @@
* <p> The caller should not make any changes to the object returned:
* their effect on the context is undefined.
* The environment of this context may be changed using
- * <tt>addToEnvironment()</tt> and <tt>removeFromEnvironment()</tt>.
+ * {@code addToEnvironment()} and {@code removeFromEnvironment()}.
*
* @return the environment of this context; never null
* @throws NamingException if a naming exception is encountered
@@ -798,7 +798,7 @@
* The string returned by this method is not a JNDI composite name
* and should not be passed directly to context methods.
* In naming systems for which the notion of full name does not
- * make sense, <tt>OperationNotSupportedException</tt> is thrown.
+ * make sense, {@code OperationNotSupportedException} is thrown.
*
* @return this context's name in its own namespace; never null
* @throws OperationNotSupportedException if the naming system does
@@ -821,7 +821,7 @@
* passed to the initial context constructor,
* a system property, or an application resource file.
* If it is not specified in any of these sources,
- * <tt>NoInitialContextException</tt> is thrown when an initial
+ * {@code NoInitialContextException} is thrown when an initial
* context is required to complete an operation.
*
* <p> The value of this constant is "java.naming.factory.initial".
@@ -882,7 +882,7 @@
* a URL context factory.
* This property may be specified in the environment, a system property,
* or one or more resource files.
- * The prefix <tt>com.sun.jndi.url</tt> is always appended to
+ * The prefix {@code com.sun.jndi.url} is always appended to
* the possibly empty list of package prefixes.
*
* <p> The value of this constant is "java.naming.factory.url.pkgs".
@@ -920,7 +920,7 @@
* or a resource file.
* If it is not specified in any of these sources
* and the program attempts to use a JNDI URL containing a DNS name,
- * a <tt>ConfigurationException</tt> will be thrown.
+ * a {@code ConfigurationException} will be thrown.
*
* <p> The value of this constant is "java.naming.dns.url".
*
@@ -974,7 +974,7 @@
* <dt>"ignore"
* <dd>ignore referrals
* <dt>"throw"
- * <dd>throw <tt>ReferralException</tt> when a referral is encountered.
+ * <dd>throw {@code ReferralException} when a referral is encountered.
* </dl>
* If this property is not specified, the default is
* determined by the provider.
--- a/jdk/src/java.naming/share/classes/javax/naming/InitialContext.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/InitialContext.java Wed Jul 05 20:44:51 2017 +0200
@@ -49,13 +49,13 @@
* The first occurrence of the property from the constructor's
* environment parameter and system properties.
* <li>
- * The application resource files (<tt>jndi.properties</tt>).
+ * The application resource files ({@code jndi.properties}).
* </ol>
* For each property found in both of these two sources, or in
* more than one application resource file, the property's value
* is determined as follows. If the property is
* one of the standard JNDI properties that specify a list of JNDI
- * factories (see <a href=Context.html#LISTPROPS><tt>Context</tt></a>),
+ * factories (see <a href=Context.html#LISTPROPS>{@code Context}</a>),
* all of the values are
* concatenated into a single colon-separated list. For other
* properties, only the first value found is used.
@@ -68,23 +68,23 @@
* An exception to this policy is made when resolving URL strings, as described
* below.
*<p>
- * When a URL string (a <tt>String</tt> of the form
+ * When a URL string (a {@code String} of the form
* <em>scheme_id:rest_of_name</em>) is passed as a name parameter to
* any method, a URL context factory for handling that scheme is
* located and used to resolve the URL. If no such factory is found,
* the initial context specified by
- * <tt>"java.naming.factory.initial"</tt> is used. Similarly, when a
- * <tt>CompositeName</tt> object whose first component is a URL string is
+ * {@code "java.naming.factory.initial"} is used. Similarly, when a
+ * {@code CompositeName} object whose first component is a URL string is
* passed as a name parameter to any method, a URL context factory is
* located and used to resolve the first name component.
* See {@link NamingManager#getURLContext
- * <tt>NamingManager.getURLContext()</tt>} for a description of how URL
+ * NamingManager.getURLContext()} for a description of how URL
* context factories are located.
*<p>
* This default policy of locating the initial context and URL context
* factories may be overridden
* by calling
- * <tt>NamingManager.setInitialContextFactoryBuilder()</tt>.
+ * {@code NamingManager.setInitialContextFactoryBuilder()}.
*<p>
* NoInitialContextException is thrown when an initial context cannot
* be instantiated. This exception can be thrown during any interaction
@@ -125,7 +125,7 @@
/**
* The environment associated with this InitialContext.
* It is initialized to null and is updated by the constructor
- * that accepts an environment or by the <tt>init()</tt> method.
+ * that accepts an environment or by the {@code init()} method.
* @see #addToEnvironment
* @see #removeFromEnvironment
* @see #getEnvironment
@@ -152,14 +152,14 @@
* Constructs an initial context with the option of not
* initializing it. This may be used by a constructor in
* a subclass when the value of the environment parameter
- * is not yet known at the time the <tt>InitialContext</tt>
+ * is not yet known at the time the {@code InitialContext}
* constructor is called. The subclass's constructor will
* call this constructor, compute the value of the environment,
- * and then call <tt>init()</tt> before returning.
+ * and then call {@code init()} before returning.
*
* @param lazy
* true means do not initialize the initial context; false
- * is equivalent to calling <tt>new InitialContext()</tt>
+ * is equivalent to calling {@code new InitialContext()}
* @throws NamingException if a naming exception is encountered
*
* @see #init(Hashtable)
@@ -174,7 +174,7 @@
/**
* Constructs an initial context.
* No environment properties are supplied.
- * Equivalent to <tt>new InitialContext(null)</tt>.
+ * Equivalent to {@code new InitialContext(null)}.
*
* @throws NamingException if a naming exception is encountered
*
@@ -188,10 +188,10 @@
* Constructs an initial context using the supplied environment.
* Environment properties are discussed in the class description.
*
- * <p> This constructor will not modify <tt>environment</tt>
+ * <p> This constructor will not modify {@code environment}
* or save a reference to it, but may save a clone.
* Caller should not modify mutable keys and values in
- * <tt>environment</tt> after it has been passed to the constructor.
+ * {@code environment} after it has been passed to the constructor.
*
* @param environment
* environment used to create the initial context.
@@ -212,7 +212,7 @@
* Initializes the initial context using the supplied environment.
* Environment properties are discussed in the class description.
*
- * <p> This method will modify <tt>environment</tt> and save
+ * <p> This method will modify {@code environment} and save
* a reference to it. The caller may no longer modify it.
*
* @param environment
@@ -245,7 +245,7 @@
* InitialContext ic = new InitialContext();
* Object obj = ic.lookup();
* </code>
- * <p> If <tt>name</tt> is empty, returns a new instance of this context
+ * <p> If {@code name} is empty, returns a new instance of this context
* (which represents the same naming context as this context, but its
* environment may be modified independently and it may be accessed
* concurrently).
@@ -253,7 +253,7 @@
* @param <T> the type of the returned object
* @param name
* the name of the object to look up
- * @return the object bound to <tt>name</tt>
+ * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
*
* @see #doLookup(String)
@@ -272,7 +272,7 @@
* @param <T> the type of the returned object
* @param name
* the name of the object to look up
- * @return the object bound to <tt>name</tt>
+ * @return the object bound to {@code name}
* @throws NamingException if a naming exception is encountered
* @since 1.6
*/
@@ -506,7 +506,7 @@
* this context.
* Since an initial context may never be named relative
* to any context other than itself, the value of the
- * <tt>prefix</tt> parameter must be an empty name (<tt>""</tt>).
+ * {@code prefix} parameter must be an empty name ({@code ""}).
*/
public String composeName(String name, String prefix)
throws NamingException {
@@ -518,7 +518,7 @@
* this context.
* Since an initial context may never be named relative
* to any context other than itself, the value of the
- * <tt>prefix</tt> parameter must be an empty name.
+ * {@code prefix} parameter must be an empty name.
*/
public Name composeName(Name name, Name prefix)
throws NamingException
--- a/jdk/src/java.naming/share/classes/javax/naming/LinkException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/LinkException.java Wed Jul 05 20:44:51 2017 +0200
@@ -204,7 +204,7 @@
/**
* Sets the resolved link name field of this exception.
*<p>
- * <tt>name</tt> is a composite name. If the intent is to set
+ * {@code name} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
@@ -230,7 +230,7 @@
/**
* Sets the remaining link name field of this exception.
*<p>
- * <tt>name</tt> is a composite name. If the intent is to set
+ * {@code name} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
--- a/jdk/src/java.naming/share/classes/javax/naming/Name.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/Name.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,12 +28,12 @@
import java.util.Enumeration;
/**
- * The <tt>Name</tt> interface represents a generic name -- an ordered
+ * The {@code Name} interface represents a generic name -- an ordered
* sequence of components. It can be a composite name (names that
* span multiple namespaces), or a compound name (names that are
* used within individual hierarchical naming systems).
*
- * <p> There can be different implementations of <tt>Name</tt>; for example,
+ * <p> There can be different implementations of {@code Name}; for example,
* composite names, URLs, or namespace-specific compound names.
*
* <p> The components of a name are numbered. The indexes of a name
@@ -46,7 +46,7 @@
* value for a parameter that is a name or a name component.
* Likewise, methods that return a name or name component never return null.
*
- * <p> An instance of a <tt>Name</tt> may not be synchronized against
+ * <p> An instance of a {@code Name} may not be synchronized against
* concurrent multithreaded access if that access is not read-only.
*
* @author Rosanna Lee
@@ -82,7 +82,7 @@
* Returns a negative integer, zero, or a positive integer as this
* name is less than, equal to, or greater than the given name.
*
- * <p> As with <tt>Object.equals()</tt>, the notion of ordering for names
+ * <p> As with {@code Object.equals()}, the notion of ordering for names
* depends on the class that implements this interface.
* For example, the ordering may be
* based on lexicographical ordering of the name components.
@@ -93,7 +93,7 @@
* @param obj the non-null object to compare against.
* @return a negative integer, zero, or a positive integer as this name
* is less than, equal to, or greater than the given name
- * @throws ClassCastException if obj is not a <tt>Name</tt> of a
+ * @throws ClassCastException if obj is not a {@code Name} of a
* type that may be compared with this name
*
* @see Comparable#compareTo(Object)
@@ -170,23 +170,23 @@
/**
* Determines whether this name starts with a specified prefix.
- * A name <tt>n</tt> is a prefix if it is equal to
- * <tt>getPrefix(n.size())</tt>.
+ * A name {@code n} is a prefix if it is equal to
+ * {@code getPrefix(n.size())}.
*
* @param n
* the name to check
- * @return true if <tt>n</tt> is a prefix of this name, false otherwise
+ * @return true if {@code n} is a prefix of this name, false otherwise
*/
public boolean startsWith(Name n);
/**
* Determines whether this name ends with a specified suffix.
- * A name <tt>n</tt> is a suffix if it is equal to
- * <tt>getSuffix(size()-n.size())</tt>.
+ * A name {@code n} is a suffix if it is equal to
+ * {@code getSuffix(size()-n.size())}.
*
* @param n
* the name to check
- * @return true if <tt>n</tt> is a suffix of this name, false otherwise
+ * @return true if {@code n} is a suffix of this name, false otherwise
*/
public boolean endsWith(Name n);
@@ -197,7 +197,7 @@
* the components to add
* @return the updated name (not a new one)
*
- * @throws InvalidNameException if <tt>suffix</tt> is not a valid name,
+ * @throws InvalidNameException if {@code suffix} is not a valid name,
* or if the addition of the components would violate the syntax
* rules of this name
*/
@@ -219,7 +219,7 @@
*
* @throws ArrayIndexOutOfBoundsException
* if posn is outside the specified range
- * @throws InvalidNameException if <tt>n</tt> is not a valid name,
+ * @throws InvalidNameException if {@code n} is not a valid name,
* or if the addition of the components would violate the syntax
* rules of this name
*/
@@ -232,7 +232,7 @@
* the component to add
* @return the updated name (not a new one)
*
- * @throws InvalidNameException if adding <tt>comp</tt> would violate
+ * @throws InvalidNameException if adding {@code comp} would violate
* the syntax rules of this name
*/
public Name add(String comp) throws InvalidNameException;
@@ -252,7 +252,7 @@
*
* @throws ArrayIndexOutOfBoundsException
* if posn is outside the specified range
- * @throws InvalidNameException if adding <tt>comp</tt> would violate
+ * @throws InvalidNameException if adding {@code comp} would violate
* the syntax rules of this name
*/
public Name add(int posn, String comp) throws InvalidNameException;
--- a/jdk/src/java.naming/share/classes/javax/naming/NameClassPair.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/NameClassPair.java Wed Jul 05 20:44:51 2017 +0200
@@ -60,7 +60,7 @@
/**
* Contains the name of this NameClassPair.
* It is initialized by the constructor and can be updated using
- * <tt>setName()</tt>.
+ * {@code setName()}.
* @serial
* @see #getName
* @see #setName
@@ -70,7 +70,7 @@
/**
*Contains the class name contained in this NameClassPair.
* It is initialized by the constructor and can be updated using
- * <tt>setClassName()</tt>.
+ * {@code setClassName()}.
* @serial
* @see #getClassName
* @see #setClassName
@@ -80,7 +80,7 @@
/**
* Contains the full name of this NameClassPair within its
* own namespace.
- * It is initialized using <tt>setNameInNamespace()</tt>
+ * It is initialized using {@code setNameInNamespace()}
* @serial
* @see #getNameInNamespace
* @see #setNameInNamespace
@@ -89,10 +89,10 @@
/**
- * Records whether the name of this <tt>NameClassPair</tt>
+ * Records whether the name of this {@code NameClassPair}
* is relative to the target context.
* It is initialized by the constructor and can be updated using
- * <tt>setRelative()</tt>.
+ * {@code setRelative()}.
* @serial
* @see #isRelative
* @see #setRelative
@@ -148,7 +148,7 @@
* Retrieves the class name of the object bound to the name of this binding.
* If a reference or some other indirect information is bound,
* retrieves the class name of the eventual object that
- * will be returned by <tt>Binding.getObject()</tt>.
+ * will be returned by {@code Binding.getObject()}.
*
* @return The possibly null class name of object bound.
* It is null if the object bound is null.
@@ -162,10 +162,10 @@
/**
* Retrieves the name of this binding.
- * If <tt>isRelative()</tt> is true, this name is relative to the
+ * If {@code isRelative()} is true, this name is relative to the
* target context (which is named by the first parameter of the
- * <tt>list()</tt>).
- * If <tt>isRelative()</tt> is false, this name is a URL string.
+ * {@code list()}).
+ * If {@code isRelative()} is false, this name is a URL string.
*
* @return The non-null name of this binding.
* @see #isRelative
@@ -190,7 +190,7 @@
* Sets the class name of this binding.
*
* @param name the possibly null string to use as the class name.
- * If null, <tt>Binding.getClassName()</tt> will return
+ * If null, {@code Binding.getClassName()} will return
* the actual class name of the object in the binding.
* The class name will be null if the object bound is null.
* @see #getClassName
@@ -236,7 +236,7 @@
* <p>
*
* In naming systems for which the notion of full name does not
- * apply to this binding an <tt>UnsupportedOperationException</tt>
+ * apply to this binding an {@code UnsupportedOperationException}
* is thrown.
* This exception is also thrown when a service provider written before
* the introduction of the method is in use.
@@ -261,11 +261,11 @@
/**
* Sets the full name of this binding.
* This method must be called to set the full name whenever a
- * <tt>NameClassPair</tt> is created and a full name is
+ * {@code NameClassPair} is created and a full name is
* applicable to this binding.
* <p>
* Setting the full name to null, or not setting it at all, will
- * cause <tt>getNameInNamespace()</tt> to throw an exception.
+ * cause {@code getNameInNamespace()} to throw an exception.
*
* @param fullName The full name to use.
* @since 1.5
--- a/jdk/src/java.naming/share/classes/javax/naming/NamingEnumeration.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/NamingEnumeration.java Wed Jul 05 20:44:51 2017 +0200
@@ -85,7 +85,7 @@
* retrieving the next element to be caught and handled
* by the application.
* <p>
- * Note that <tt>next()</tt> can also throw the runtime exception
+ * Note that {@code next()} can also throw the runtime exception
* NoSuchElementException to indicate that the caller is
* attempting to enumerate beyond the end of the enumeration.
* This is different from a NamingException, which indicates
@@ -128,16 +128,16 @@
* its methods will yield undefined results.
* This method is intended for aborting an enumeration to free up resources.
* If an enumeration proceeds to the end--that is, until
- * <tt>hasMoreElements()</tt> or <tt>hasMore()</tt> returns <tt>false</tt>--
+ * {@code hasMoreElements()} or {@code hasMore()} returns {@code false}--
* resources will be freed up automatically and there is no need to
- * explicitly call <tt>close()</tt>.
+ * explicitly call {@code close()}.
*<p>
* This method indicates to the service provider that it is free
* to release resources associated with the enumeration, and can
- * notify servers to cancel any outstanding requests. The <tt>close()</tt>
+ * notify servers to cancel any outstanding requests. The {@code close()}
* method is a hint to implementations for managing their resources.
* Implementations are encouraged to use appropriate algorithms to
- * manage their resources when client omits the <tt>close()</tt> calls.
+ * manage their resources when client omits the {@code close()} calls.
*
* @exception NamingException If a naming exception is encountered
* while closing the enumeration.
--- a/jdk/src/java.naming/share/classes/javax/naming/NamingException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/NamingException.java Wed Jul 05 20:44:51 2017 +0200
@@ -194,14 +194,14 @@
/**
* Sets the resolved name field of this exception.
*<p>
- * <tt>name</tt> is a composite name. If the intent is to set
+ * {@code name} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
* invoke this method using the resulting composite name.
*<p>
- * A copy of <code>name</code> is made and stored.
- * Subsequent changes to <code>name</code> do not
+ * A copy of {@code name} is made and stored.
+ * Subsequent changes to {@code name} do not
* affect the copy in this NamingException and vice versa.
*
* @param name The possibly null name to set resolved name to.
@@ -218,14 +218,14 @@
/**
* Sets the remaining name field of this exception.
*<p>
- * <tt>name</tt> is a composite name. If the intent is to set
+ * {@code name} is a composite name. If the intent is to set
* this field using a compound name or string, you must
* "stringify" the compound name, and create a composite
* name with a single component using the string. You can then
* invoke this method using the resulting composite name.
*<p>
- * A copy of <code>name</code> is made and stored.
- * Subsequent changes to <code>name</code> do not
+ * A copy of {@code name} is made and stored.
+ * Subsequent changes to {@code name} do not
* affect the copy in this NamingException and vice versa.
* @param name The possibly null name to set remaining name to.
* If null, it sets the remaining name field to null.
@@ -275,11 +275,11 @@
* Add components from 'name' as the last components in
* remaining name.
*<p>
- * <tt>name</tt> is a composite name. If the intent is to append
+ * {@code name} is a composite name. If the intent is to append
* a compound name, you should "stringify" the compound name
* then invoke the overloaded form that accepts a String parameter.
*<p>
- * Subsequent changes to <code>name</code> do not
+ * Subsequent changes to {@code name} do not
* affect the remaining name field in this NamingException and vice versa.
* @param name The possibly null name containing ordered components to add.
* If name is null, this method does not do anything.
@@ -326,7 +326,7 @@
/**
* Records the root cause of this NamingException.
- * If <tt>e</tt> is <tt>this</tt>, this method does not do anything.
+ * If {@code e} is {@code this}, this method does not do anything.
*<p>
* This method predates the general-purpose exception chaining facility.
* The {@link #initCause(Throwable)} method is now the preferred means
@@ -348,10 +348,10 @@
/**
* Returns the cause of this exception. The cause is the
* throwable that caused this naming exception to be thrown.
- * Returns <code>null</code> if the cause is nonexistent or
+ * Returns {@code null} if the cause is nonexistent or
* unknown.
*
- * @return the cause of this exception, or <code>null</code> if the
+ * @return the cause of this exception, or {@code null} if the
* cause is nonexistent or unknown.
* @see #initCause(Throwable)
* @since 1.4
@@ -368,10 +368,10 @@
* This method may be called at most once.
*
* @param cause the cause, which is saved for later retrieval by
- * the {@link #getCause()} method. A <tt>null</tt> value
+ * the {@link #getCause()} method. A {@code null} value
* indicates that the cause is nonexistent or unknown.
- * @return a reference to this <code>NamingException</code> instance.
- * @throws IllegalArgumentException if <code>cause</code> is this
+ * @return a reference to this {@code NamingException} instance.
+ * @throws IllegalArgumentException if {@code cause} is this
* exception. (A throwable cannot be its own cause.)
* @throws IllegalStateException if this method has already
* been called on this exception.
--- a/jdk/src/java.naming/share/classes/javax/naming/Reference.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/Reference.java Wed Jul 05 20:44:51 2017 +0200
@@ -250,7 +250,7 @@
* its effects on this enumeration are undefined.
*
* @return An non-null enumeration of the addresses
- * (<tt>RefAddr</tt>) in this reference.
+ * ({@code RefAddr}) in this reference.
* If this reference has zero addresses, an enumeration with
* zero elements is returned.
*/
--- a/jdk/src/java.naming/share/classes/javax/naming/ReferralException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ReferralException.java Wed Jul 05 20:44:51 2017 +0200
@@ -33,12 +33,12 @@
* such as that returned by LDAP v3 servers.
* <p>
* A service provider provides
- * a subclass of <tt>ReferralException</tt> by providing implementations
- * for <tt>getReferralInfo()</tt> and <tt>getReferralContext()</tt> (and appropriate
+ * a subclass of {@code ReferralException} by providing implementations
+ * for {@code getReferralInfo()} and {@code getReferralContext()} (and appropriate
* constructors and/or corresponding "set" methods).
* <p>
- * The following code sample shows how <tt>ReferralException</tt> can be used.
- * <blockquote>{@code
+ * The following code sample shows how {@code ReferralException} can be used.
+ * <blockquote><pre>{@code
* while (true) {
* try {
* bindings = ctx.listBindings(name);
@@ -51,12 +51,12 @@
* ctx = e.getReferralContext();
* }
* }
- * }</blockquote>
+ * }</pre></blockquote>
*<p>
- * <tt>ReferralException</tt> is an abstract class. Concrete implementations
+ * {@code ReferralException} is an abstract class. Concrete implementations
* determine its synchronization and serialization properties.
*<p>
- * An environment parameter passed to the <tt>getReferralContext()</tt>
+ * An environment parameter passed to the {@code getReferralContext()}
* method is owned by the caller.
* The service provider will not modify the object or keep a reference to it,
* but may keep a reference to a clone of it.
@@ -114,7 +114,7 @@
*
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context getReferralContext() throws NamingException;
@@ -127,7 +127,7 @@
* enumeration, the referral exception should provide a context
* at which to continue the operation.
*<p>
- * The referral context is created using <tt>env</tt> as its environment
+ * The referral context is created using {@code env} as its environment
* properties.
* This method should be used instead of the no-arg overloaded form
* when the caller needs to use different environment properties for
@@ -143,7 +143,7 @@
*
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context
@@ -153,7 +153,7 @@
/**
* Discards the referral about to be processed.
* A call to this method should be followed by a call to
- * <code>getReferralContext</code> to allow the processing of
+ * {@code getReferralContext} to allow the processing of
* other referrals to continue.
* The following code fragment shows a typical usage pattern.
* <blockquote><pre>
@@ -174,7 +174,7 @@
/**
* Retries the referral currently being processed.
* A call to this method should be followed by a call to
- * <code>getReferralContext</code> to allow the current
+ * {@code getReferralContext} to allow the current
* referral to be retried.
* The following code fragment shows a typical usage pattern.
* <blockquote><pre>
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/Attribute.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/Attribute.java Wed Jul 05 20:44:51 2017 +0200
@@ -37,34 +37,34 @@
* This interface represents an attribute associated with a named object.
*<p>
* In a directory, named objects can have associated with them
- * attributes. The <tt>Attribute</tt> interface represents an attribute associated
+ * attributes. The {@code Attribute} interface represents an attribute associated
* with a named object. An attribute contains 0 or more, possibly null, values.
- * The attribute values can be ordered or unordered (see <tt>isOrdered()</tt>).
+ * The attribute values can be ordered or unordered (see {@code isOrdered()}).
* If the values are unordered, no duplicates are allowed.
* If the values are ordered, duplicates are allowed.
*<p>
* The content and representation of an attribute and its values is defined by
* the attribute's <em>schema</em>. The schema contains information
* about the attribute's syntax and other properties about the attribute.
- * See <tt>getAttributeDefinition()</tt> and
- * <tt>getAttributeSyntaxDefinition()</tt>
+ * See {@code getAttributeDefinition()} and
+ * {@code getAttributeSyntaxDefinition()}
* for details regarding how to get schema information about an attribute
* if the underlying directory service supports schemas.
*<p>
* Equality of two attributes is determined by the implementation class.
- * A simple implementation can use <tt>Object.equals()</tt> to determine equality
+ * A simple implementation can use {@code Object.equals()} to determine equality
* of attribute values, while a more sophisticated implementation might
* make use of schema information to determine equality.
* Similarly, one implementation might provide a static storage
* structure which simply returns the values passed to its
- * constructor, while another implementation might define <tt>get()</tt> and
- * <tt>getAll()</tt>.
+ * constructor, while another implementation might define {@code get()} and
+ * {@code getAll()}.
* to get the values dynamically from the directory.
*<p>
- * Note that updates to <tt>Attribute</tt> (such as adding or removing a
+ * Note that updates to {@code Attribute} (such as adding or removing a
* value) do not affect the corresponding representation of the attribute
* in the directory. Updates to the directory can only be effected
- * using operations in the <tt>DirContext</tt> interface.
+ * using operations in the {@code DirContext} interface.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -129,7 +129,7 @@
/**
* Determines whether a value is in the attribute.
* Equality is determined by the implementation, which may use
- * <tt>Object.equals()</tt> or schema information to determine equality.
+ * {@code Object.equals()} or schema information to determine equality.
*
* @param attrVal The possibly null value to check. If null, check
* whether the attribute has an attribute value whose value is null.
@@ -141,12 +141,12 @@
/**
* Adds a new value to the attribute.
* If the attribute values are unordered and
- * <tt>attrVal</tt> is already in the attribute, this method does nothing.
- * If the attribute values are ordered, <tt>attrVal</tt> is added to the end of
+ * {@code attrVal} is already in the attribute, this method does nothing.
+ * If the attribute values are ordered, {@code attrVal} is added to the end of
* the list of attribute values.
*<p>
* Equality is determined by the implementation, which may use
- * <tt>Object.equals()</tt> or schema information to determine equality.
+ * {@code Object.equals()} or schema information to determine equality.
*
* @param attrVal The new possibly null value to add. If null, null
* is added as an attribute value.
@@ -156,15 +156,15 @@
/**
* Removes a specified value from the attribute.
- * If <tt>attrval</tt> is not in the attribute, this method does nothing.
+ * If {@code attrval} is not in the attribute, this method does nothing.
* If the attribute values are ordered, the first occurrence of
- * <tt>attrVal</tt> is removed and attribute values at indices greater
+ * {@code attrVal} is removed and attribute values at indices greater
* than the removed
* value are shifted up towards the head of the list (and their indices
* decremented by one).
*<p>
* Equality is determined by the implementation, which may use
- * <tt>Object.equals()</tt> or schema information to determine equality.
+ * {@code Object.equals()} or schema information to determine equality.
*
* @param attrval The possibly null value to remove from this attribute.
* If null, remove the attribute value that is null.
@@ -260,66 +260,66 @@
/**
* Retrieves the attribute value from the ordered list of attribute values.
- * This method returns the value at the <tt>ix</tt> index of the list of
+ * This method returns the value at the {@code ix} index of the list of
* attribute values.
* If the attribute values are unordered,
* this method returns the value that happens to be at that index.
* @param ix The index of the value in the ordered list of attribute values.
* {@code 0 <= ix < size()}.
- * @return The possibly null attribute value at index <tt>ix</tt>;
+ * @return The possibly null attribute value at index {@code ix};
* null if the attribute value is null.
* @exception NamingException If a naming exception was encountered while
* retrieving the value.
- * @exception IndexOutOfBoundsException If <tt>ix</tt> is outside the specified range.
+ * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
*/
Object get(int ix) throws NamingException;
/**
* Removes an attribute value from the ordered list of attribute values.
- * This method removes the value at the <tt>ix</tt> index of the list of
+ * This method removes the value at the {@code ix} index of the list of
* attribute values.
* If the attribute values are unordered,
* this method removes the value that happens to be at that index.
- * Values located at indices greater than <tt>ix</tt> are shifted up towards
+ * Values located at indices greater than {@code ix} are shifted up towards
* the front of the list (and their indices decremented by one).
*
* @param ix The index of the value to remove.
* {@code 0 <= ix < size()}.
- * @return The possibly null attribute value at index <tt>ix</tt> that was removed;
+ * @return The possibly null attribute value at index {@code ix} that was removed;
* null if the attribute value is null.
- * @exception IndexOutOfBoundsException If <tt>ix</tt> is outside the specified range.
+ * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
*/
Object remove(int ix);
/**
* Adds an attribute value to the ordered list of attribute values.
- * This method adds <tt>attrVal</tt> to the list of attribute values at
- * index <tt>ix</tt>.
- * Values located at indices at or greater than <tt>ix</tt> are
+ * This method adds {@code attrVal} to the list of attribute values at
+ * index {@code ix}.
+ * Values located at indices at or greater than {@code ix} are
* shifted down towards the end of the list (and their indices incremented
* by one).
- * If the attribute values are unordered and already have <tt>attrVal</tt>,
- * <tt>IllegalStateException</tt> is thrown.
+ * If the attribute values are unordered and already have {@code attrVal},
+ * {@code IllegalStateException} is thrown.
*
* @param ix The index in the ordered list of attribute values to add the new value.
* {@code 0 <= ix <= size()}.
* @param attrVal The possibly null attribute value to add; if null, null is
* the value added.
- * @exception IndexOutOfBoundsException If <tt>ix</tt> is outside the specified range.
+ * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
* @exception IllegalStateException If the attribute values are unordered and
- * <tt>attrVal</tt> is one of those values.
+ * {@code attrVal} is one of those values.
*/
void add(int ix, Object attrVal);
/**
* Sets an attribute value in the ordered list of attribute values.
- * This method sets the value at the <tt>ix</tt> index of the list of
- * attribute values to be <tt>attrVal</tt>. The old value is removed.
+ * This method sets the value at the {@code ix} index of the list of
+ * attribute values to be {@code attrVal}. The old value is removed.
* If the attribute values are unordered,
* this method sets the value that happens to be at that index
- * to <tt>attrVal</tt>, unless <tt>attrVal</tt> is already one of the values.
- * In that case, <tt>IllegalStateException</tt> is thrown.
+ * to {@code attrVal}, unless {@code attrVal} is already one of the values.
+ * In that case, {@code IllegalStateException} is thrown.
*
* @param ix The index of the value in the ordered list of attribute values.
* {@code 0 <= ix < size()}.
@@ -327,8 +327,8 @@
* If null, 'null' replaces the old value.
* @return The possibly null attribute value at index ix that was replaced.
* Null if the attribute value was null.
- * @exception IndexOutOfBoundsException If <tt>ix</tt> is outside the specified range.
- * @exception IllegalStateException If <tt>attrVal</tt> already exists and the
+ * @exception IndexOutOfBoundsException If {@code ix} is outside the specified range.
+ * @exception IllegalStateException If {@code attrVal} already exists and the
* attribute values are unordered.
*/
Object set(int ix, Object attrVal);
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/Attributes.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/Attributes.java Wed Jul 05 20:44:51 2017 +0200
@@ -103,7 +103,7 @@
* are undefined.
*
* @return A non-null enumeration of the attributes in this attribute set.
- * Each element of the enumeration is of class <tt>Attribute</tt>.
+ * Each element of the enumeration is of class {@code Attribute}.
* If attribute set has zero attributes, an empty enumeration
* is returned.
*/
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttribute.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttribute.java Wed Jul 05 20:44:51 2017 +0200
@@ -35,35 +35,35 @@
import javax.naming.OperationNotSupportedException;
/**
- * This class provides a basic implementation of the <tt>Attribute</tt> interface.
+ * This class provides a basic implementation of the {@code Attribute} interface.
*<p>
* This implementation does not support the schema methods
- * <tt>getAttributeDefinition()</tt> and <tt>getAttributeSyntaxDefinition()</tt>.
- * They simply throw <tt>OperationNotSupportedException</tt>.
- * Subclasses of <tt>BasicAttribute</tt> should override these methods if they
+ * {@code getAttributeDefinition()} and {@code getAttributeSyntaxDefinition()}.
+ * They simply throw {@code OperationNotSupportedException}.
+ * Subclasses of {@code BasicAttribute} should override these methods if they
* support them.
*<p>
- * The <tt>BasicAttribute</tt> class by default uses <tt>Object.equals()</tt> to
+ * The {@code BasicAttribute} class by default uses {@code Object.equals()} to
* determine equality of attribute values when testing for equality or
* when searching for values, <em>except</em> when the value is an array.
- * For an array, each element of the array is checked using <tt>Object.equals()</tt>.
- * Subclasses of <tt>BasicAttribute</tt> can make use of schema information
+ * For an array, each element of the array is checked using {@code Object.equals()}.
+ * Subclasses of {@code BasicAttribute} can make use of schema information
* when doing similar equality checks by overriding methods
* in which such use of schema is meaningful.
- * Similarly, the <tt>BasicAttribute</tt> class by default returns the values passed to its
+ * Similarly, the {@code BasicAttribute} class by default returns the values passed to its
* constructor and/or manipulated using the add/remove methods.
- * Subclasses of <tt>BasicAttribute</tt> can override <tt>get()</tt> and <tt>getAll()</tt>
+ * Subclasses of {@code BasicAttribute} can override {@code get()} and {@code getAll()}
* to get the values dynamically from the directory (or implement
- * the <tt>Attribute</tt> interface directly instead of subclassing <tt>BasicAttribute</tt>).
+ * the {@code Attribute} interface directly instead of subclassing {@code BasicAttribute}).
*<p>
- * Note that updates to <tt>BasicAttribute</tt> (such as adding or removing a value)
+ * Note that updates to {@code BasicAttribute} (such as adding or removing a value)
* does not affect the corresponding representation of the attribute
* in the directory. Updates to the directory can only be effected
- * using operations in the <tt>DirContext</tt> interface.
+ * using operations in the {@code DirContext} interface.
*<p>
- * A <tt>BasicAttribute</tt> instance is not synchronized against concurrent
+ * A {@code BasicAttribute} instance is not synchronized against concurrent
* multithreaded access. Multiple threads trying to access and modify a
- * <tt>BasicAttribute</tt> should lock the object.
+ * {@code BasicAttribute} should lock the object.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -112,16 +112,16 @@
* order the values must match.
* If obj is null or not an Attribute, false is returned.
*<p>
- * By default <tt>Object.equals()</tt> is used when comparing the attribute
+ * By default {@code Object.equals()} is used when comparing the attribute
* id and its values except when a value is an array. For an array,
- * each element of the array is checked using <tt>Object.equals()</tt>.
+ * each element of the array is checked using {@code Object.equals()}.
* A subclass may override this to make
* use of schema syntax information and matching rules,
* which define what it means for two attributes to be equal.
* How and whether a subclass makes
* use of the schema information is determined by the subclass.
- * If a subclass overrides <tt>equals()</tt>, it should also override
- * <tt>hashCode()</tt>
+ * If a subclass overrides {@code equals()}, it should also override
+ * {@code hashCode()}
* such that two attributes that are equal have the same hash code.
*
* @param obj The possibly null object to check.
@@ -172,8 +172,8 @@
* the attribute's id and that of all of its values except for
* values that are arrays.
* For an array, the hash code of each element of the array is summed.
- * If a subclass overrides <tt>hashCode()</tt>, it should override
- * <tt>equals()</tt>
+ * If a subclass overrides {@code hashCode()}, it should override
+ * {@code equals()}
* as well so that two attributes that are equal have the same hash code.
*
* @return an int representing the hash code of this attribute.
@@ -315,10 +315,10 @@
* Determines whether a value is in this attribute.
*<p>
* By default,
- * <tt>Object.equals()</tt> is used when comparing <tt>attrVal</tt>
- * with this attribute's values except when <tt>attrVal</tt> is an array.
+ * {@code Object.equals()} is used when comparing {@code attrVal}
+ * with this attribute's values except when {@code attrVal} is an array.
* For an array, each element of the array is checked using
- * <tt>Object.equals()</tt>.
+ * {@code Object.equals()}.
* A subclass may use schema information to determine equality.
*/
public boolean contains(Object attrVal) {
@@ -352,7 +352,7 @@
/**
* Determines whether two attribute values are equal.
- * Use arrayEquals for arrays and <tt>Object.equals()</tt> otherwise.
+ * Use arrayEquals for arrays and {@code Object.equals()} otherwise.
*/
private static boolean valueEquals(Object obj1, Object obj2) {
if (obj1 == obj2) {
@@ -370,7 +370,7 @@
/**
* Determines whether two arrays are equal by comparing each of their
- * elements using <tt>Object.equals()</tt>.
+ * elements using {@code Object.equals()}.
*/
private static boolean arrayEquals(Object a1, Object a2) {
int len;
@@ -393,10 +393,10 @@
/**
* Adds a new value to this attribute.
*<p>
- * By default, <tt>Object.equals()</tt> is used when comparing <tt>attrVal</tt>
- * with this attribute's values except when <tt>attrVal</tt> is an array.
+ * By default, {@code Object.equals()} is used when comparing {@code attrVal}
+ * with this attribute's values except when {@code attrVal} is an array.
* For an array, each element of the array is checked using
- * <tt>Object.equals()</tt>.
+ * {@code Object.equals()}.
* A subclass may use schema information to determine equality.
*/
public boolean add(Object attrVal) {
@@ -411,10 +411,10 @@
/**
* Removes a specified value from this attribute.
*<p>
- * By default, <tt>Object.equals()</tt> is used when comparing <tt>attrVal</tt>
- * with this attribute's values except when <tt>attrVal</tt> is an array.
+ * By default, {@code Object.equals()} is used when comparing {@code attrVal}
+ * with this attribute's values except when {@code attrVal} is an array.
* For an array, each element of the array is checked using
- * <tt>Object.equals()</tt>.
+ * {@code Object.equals()}.
* A subclass may use schema information to determine equality.
*/
public boolean remove(Object attrval) {
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java Wed Jul 05 20:44:51 2017 +0200
@@ -207,17 +207,17 @@
}
/**
- * Determines whether this <tt>BasicAttributes</tt> is equal to another
- * <tt>Attributes</tt>
- * Two <tt>Attributes</tt> are equal if they are both instances of
- * <tt>Attributes</tt>,
+ * Determines whether this {@code BasicAttributes} is equal to another
+ * {@code Attributes}
+ * Two {@code Attributes} are equal if they are both instances of
+ * {@code Attributes},
* treat the case of attribute IDs the same way, and contain the
- * same attributes. Each <tt>Attribute</tt> in this <tt>BasicAttributes</tt>
- * is checked for equality using <tt>Object.equals()</tt>, which may have
- * be overridden by implementations of <tt>Attribute</tt>).
- * If a subclass overrides <tt>equals()</tt>,
- * it should override <tt>hashCode()</tt>
- * as well so that two <tt>Attributes</tt> instances that are equal
+ * same attributes. Each {@code Attribute} in this {@code BasicAttributes}
+ * is checked for equality using {@code Object.equals()}, which may have
+ * be overridden by implementations of {@code Attribute}).
+ * If a subclass overrides {@code equals()},
+ * it should override {@code hashCode()}
+ * as well so that two {@code Attributes} instances that are equal
* have the same hash code.
* @param obj the possibly null object to compare against.
*
@@ -259,9 +259,9 @@
* The hash code is computed by adding the hash code of
* the attributes of this object. If this BasicAttributes
* ignores case of its attribute IDs, one is added to the hash code.
- * If a subclass overrides <tt>hashCode()</tt>,
- * it should override <tt>equals()</tt>
- * as well so that two <tt>Attributes</tt> instances that are equal
+ * If a subclass overrides {@code hashCode()},
+ * it should override {@code equals()}
+ * as well so that two {@code Attributes} instances that are equal
* have the same hash code.
*
* @return an int representing the hash code of this BasicAttributes instance.
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/DirContext.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/DirContext.java Wed Jul 05 20:44:51 2017 +0200
@@ -33,7 +33,7 @@
* associated with objects, and for searching the directory.
*
* <h1>Names</h1>
- * Each name passed as an argument to a <tt>DirContext</tt> method is relative
+ * Each name passed as an argument to a {@code DirContext} method is relative
* to that context. The empty name is used to name the context itself.
* The name parameter may never be null.
* <p>
@@ -47,9 +47,9 @@
* The second version instead has a link to the first: the same
* documentation applies to both.
* <p>
- * See <tt>Context</tt> for a discussion on the interpretation of the
- * name argument to the <tt>Context</tt> methods. These same rules
- * apply to the name argument to the <tt>DirContext</tt> methods.
+ * See {@code Context} for a discussion on the interpretation of the
+ * name argument to the {@code Context} methods. These same rules
+ * apply to the name argument to the {@code DirContext} methods.
*
* <h1>Attribute Models</h1>
* There are two basic models of what attributes should be
@@ -82,7 +82,7 @@
* within the parent object and associated with the object's name.
*
* <h1>Attribute Type Names</h1>
- * In the <tt>getAttributes()</tt> and <tt>search()</tt> methods,
+ * In the {@code getAttributes()} and {@code search()} methods,
* you can supply the attributes to return by supplying a list of
* attribute names (strings).
* The attributes that you get back might not have the same names as the
@@ -120,9 +120,9 @@
* purposes. An example of operational attributes is the access control
* list for an object.
* <p>
- * In the <tt>getAttributes()</tt> and <tt>search()</tt> methods,
+ * In the {@code getAttributes()} and {@code search()} methods,
* you can specify that all attributes associated with the requested objects
- * be returned by supply <tt>null</tt> as the list of attributes to return.
+ * be returned by supply {@code null} as the list of attributes to return.
* The attributes returned do <em>not</em> include operational attributes.
* In order to retrieve operational attributes, you must name them explicitly.
*
@@ -140,13 +140,13 @@
*
*<h1>Parameters</h1>
*<p>
- * An <tt>Attributes</tt>, <tt>SearchControls</tt>, or array object
+ * An {@code Attributes}, {@code SearchControls}, or array object
* passed as a parameter to any method will not be modified by the
* service provider. The service provider may keep a reference to it
* for the duration of the operation, including any enumeration of the
* method's results and the processing of any referrals generated.
* The caller should not modify the object during this time.
- * An <tt>Attributes</tt> object returned by any method is owned by
+ * An {@code Attributes} object returned by any method is owned by
* the caller. The caller may subsequently modify it; the service
* provider will not.
*
@@ -254,7 +254,7 @@
* If attempting to add more than one value to a single-valued attribute,
* throws <code>InvalidAttributeValueException</code>.
* <p>
- * The value of this constant is <tt>1</tt>.
+ * The value of this constant is {@code 1}.
*
* @see ModificationItem
* @see #modifyAttributes
@@ -273,7 +273,7 @@
* attempting to add more than one value to a single-valued attribute,
* throws <code>InvalidAttributeValueException</code>.
* <p>
- * The value of this constant is <tt>2</tt>.
+ * The value of this constant is {@code 2}.
*
* @see ModificationItem
* @see #modifyAttributes
@@ -294,7 +294,7 @@
* Removal of the last value will remove the attribute if the
* attribute is required to have at least one value.
* <p>
- * The value of this constant is <tt>3</tt>.
+ * The value of this constant is {@code 3}.
*
* @see ModificationItem
* @see #modifyAttributes
@@ -391,12 +391,12 @@
/**
* Binds a name to an object, along with associated attributes.
- * If <tt>attrs</tt> is null, the resulting binding will have
- * the attributes associated with <tt>obj</tt> if <tt>obj</tt> is a
- * <tt>DirContext</tt>, and no attributes otherwise.
- * If <tt>attrs</tt> is non-null, the resulting binding will have
- * <tt>attrs</tt> as its attributes; any attributes associated with
- * <tt>obj</tt> are ignored.
+ * If {@code attrs} is null, the resulting binding will have
+ * the attributes associated with {@code obj} if {@code obj} is a
+ * {@code DirContext}, and no attributes otherwise.
+ * If {@code attrs} is non-null, the resulting binding will have
+ * {@code attrs} as its attributes; any attributes associated with
+ * {@code obj} are ignored.
*
* @param name
* the name to bind; may not be empty
@@ -438,16 +438,16 @@
/**
* Binds a name to an object, along with associated attributes,
* overwriting any existing binding.
- * If <tt>attrs</tt> is null and <tt>obj</tt> is a <tt>DirContext</tt>,
- * the attributes from <tt>obj</tt> are used.
- * If <tt>attrs</tt> is null and <tt>obj</tt> is not a <tt>DirContext</tt>,
+ * If {@code attrs} is null and {@code obj} is a {@code DirContext},
+ * the attributes from {@code obj} are used.
+ * If {@code attrs} is null and {@code obj} is not a {@code DirContext},
* any existing attributes associated with the object already bound
* in the directory remain unchanged.
- * If <tt>attrs</tt> is non-null, any existing attributes associated with
- * the object already bound in the directory are removed and <tt>attrs</tt>
- * is associated with the named object. If <tt>obj</tt> is a
- * <tt>DirContext</tt> and <tt>attrs</tt> is non-null, the attributes
- * of <tt>obj</tt> are ignored.
+ * If {@code attrs} is non-null, any existing attributes associated with
+ * the object already bound in the directory are removed and {@code attrs}
+ * is associated with the named object. If {@code obj} is a
+ * {@code DirContext} and {@code attrs} is non-null, the attributes
+ * of {@code obj} are ignored.
*
* @param name
* the name to bind; may not be empty
@@ -492,8 +492,8 @@
* component of the name), and associates the supplied attributes
* with the newly created object.
* All intermediate and target contexts must already exist.
- * If <tt>attrs</tt> is null, this method is equivalent to
- * <tt>Context.createSubcontext()</tt>.
+ * If {@code attrs} is null, this method is equivalent to
+ * {@code Context.createSubcontext()}.
*
* @param name
* the name of the context to create; may not be empty
@@ -579,8 +579,8 @@
* "object class" being referred to here is in the directory sense
* rather than in the Java sense.
* For example, if the named object is a directory object of
- * "Person" class, <tt>getSchemaClassDefinition()</tt> would return a
- * <tt>DirContext</tt> representing the (directory's) object class
+ * "Person" class, {@code getSchemaClassDefinition()} would return a
+ * {@code DirContext} representing the (directory's) object class
* definition of "Person".
*<p>
* The information that can be retrieved from an object class definition
@@ -589,13 +589,13 @@
* Prior to JNDI 1.2, this method
* returned a single schema object representing the class definition of
* the named object.
- * Since JNDI 1.2, this method returns a <tt>DirContext</tt> containing
+ * Since JNDI 1.2, this method returns a {@code DirContext} containing
* all of the named object's class definitions.
*
* @param name
* the name of the object whose object class
* definition is to be retrieved
- * @return the <tt>DirContext</tt> containing the named
+ * @return the {@code DirContext} containing the named
* object's class definitions; never null
*
* @throws OperationNotSupportedException if schema not supported
@@ -612,7 +612,7 @@
* @param name
* the name of the object whose object class
* definition is to be retrieved
- * @return the <tt>DirContext</tt> containing the named
+ * @return the {@code DirContext} containing the named
* object's class definitions; never null
*
* @throws OperationNotSupportedException if schema not supported
@@ -656,7 +656,7 @@
* substring comparison) use the version of the <code>search</code>
* method that takes a filter argument.
* <p>
- * When changes are made to this <tt>DirContext</tt>,
+ * When changes are made to this {@code DirContext},
* the effect on enumerations returned by prior calls to this method
* is undefined.
*<p>
@@ -681,8 +681,8 @@
* all attributes are to be returned;
* an empty array indicates that none are to be returned.
* @return
- * a non-null enumeration of <tt>SearchResult</tt> objects.
- * Each <tt>SearchResult</tt> contains the attributes
+ * a non-null enumeration of {@code SearchResult} objects.
+ * Each {@code SearchResult} contains the attributes
* identified by <code>attributesToReturn</code>
* and the name of the corresponding object, named relative
* to the context named by <code>name</code>.
@@ -709,7 +709,7 @@
* the attributes to search for
* @param attributesToReturn
* the attributes to return
- * @return a non-null enumeration of <tt>SearchResult</tt> objects
+ * @return a non-null enumeration of {@code SearchResult} objects
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration<SearchResult>
@@ -723,7 +723,7 @@
* specified set of attributes.
* This method returns all the attributes of such objects.
* It is equivalent to supplying null as
- * the <tt>attributesToReturn</tt> parameter to the method
+ * the {@code attributesToReturn} parameter to the method
* <code>search(Name, Attributes, String[])</code>.
* <br>
* See {@link #search(Name, Attributes, String[])} for a full description.
@@ -732,7 +732,7 @@
* the name of the context to search
* @param matchingAttributes
* the attributes to search for
- * @return an enumeration of <tt>SearchResult</tt> objects
+ * @return an enumeration of {@code SearchResult} objects
* @throws NamingException if a naming exception is encountered
*
* @see #search(Name, Attributes, String[])
@@ -750,7 +750,7 @@
* the name of the context to search
* @param matchingAttributes
* the attributes to search for
- * @return an enumeration of <tt>SearchResult</tt> objects
+ * @return an enumeration of {@code SearchResult} objects
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration<SearchResult>
@@ -807,8 +807,8 @@
* attributes. When an operator is not applicable, the exception
* <code>InvalidSearchFilterException</code> is thrown.
* <p>
- * The result is returned in an enumeration of <tt>SearchResult</tt>s.
- * Each <tt>SearchResult</tt> contains the name of the object
+ * The result is returned in an enumeration of {@code SearchResult}s.
+ * Each {@code SearchResult} contains the name of the object
* and other information about the object (see SearchResult).
* The name is either relative to the target context of the search
* (which is named by the <code>name</code> parameter), or
@@ -817,8 +817,8 @@
* <code>cons</code> specifies a search scope of
* <code>SearchControls.OBJECT_SCOPE</code> or
* <code>SearchControls.SUBSTREE_SCOPE</code>), its name is the empty
- * string. The <tt>SearchResult</tt> may also contain attributes of the
- * matching object if the <tt>cons</tt> argument specified that attributes
+ * string. The {@code SearchResult} may also contain attributes of the
+ * matching object if the {@code cons} argument specified that attributes
* be returned.
*<p>
* If the object does not have a requested attribute, that
@@ -839,8 +839,8 @@
* @param cons
* the search controls that control the search. If null,
* the default search controls are used (equivalent
- * to <tt>(new SearchControls())</tt>).
- * @return an enumeration of <tt>SearchResult</tt>s of
+ * to {@code (new SearchControls())}).
+ * @return an enumeration of {@code SearchResult}s of
* the objects that satisfy the filter; never null
*
* @throws InvalidSearchFilterException if the search filter specified is
@@ -872,9 +872,9 @@
* @param cons
* the search controls that control the search. If null,
* the default search controls are used (equivalent
- * to <tt>(new SearchControls())</tt>).
+ * to {@code (new SearchControls())}).
*
- * @return an enumeration of <tt>SearchResult</tt>s for
+ * @return an enumeration of {@code SearchResult}s for
* the objects that satisfy the filter.
* @throws InvalidSearchFilterException if the search filter specified is
* not supported or understood by the underlying directory
@@ -935,8 +935,8 @@
* <code>SearchControls.SUBSTREE_SCOPE</code>),
* its name is the empty string.
*<p>
- * The <tt>SearchResult</tt> may also contain attributes of the matching
- * object if the <tt>cons</tt> argument specifies that attributes be
+ * The {@code SearchResult} may also contain attributes of the matching
+ * object if the {@code cons} argument specifies that attributes be
* returned.
*<p>
* If the object does not have a requested attribute, that
@@ -972,17 +972,17 @@
* @param cons
* the search controls that control the search. If null,
* the default search controls are used (equivalent
- * to <tt>(new SearchControls())</tt>).
- * @return an enumeration of <tt>SearchResult</tt>s of the objects
+ * to {@code (new SearchControls())}).
+ * @return an enumeration of {@code SearchResult}s of the objects
* that satisfy the filter; never null
*
- * @throws ArrayIndexOutOfBoundsException if <tt>filterExpr</tt> contains
+ * @throws ArrayIndexOutOfBoundsException if {@code filterExpr} contains
* <code>{i}</code> expressions where <code>i</code> is outside
* the bounds of the array <code>filterArgs</code>
- * @throws InvalidSearchControlsException if <tt>cons</tt> contains
+ * @throws InvalidSearchControlsException if {@code cons} contains
* invalid settings
- * @throws InvalidSearchFilterException if <tt>filterExpr</tt> with
- * <tt>filterArgs</tt> represents an invalid search filter
+ * @throws InvalidSearchFilterException if {@code filterExpr} with
+ * {@code filterArgs} represents an invalid search filter
* @throws NamingException if a naming exception is encountered
*
* @see #search(Name, Attributes, String[])
@@ -1017,17 +1017,17 @@
* @param cons
* the search controls that control the search. If null,
* the default search controls are used (equivalent
- * to <tt>(new SearchControls())</tt>).
- * @return an enumeration of <tt>SearchResult</tt>s of the objects
+ * to {@code (new SearchControls())}).
+ * @return an enumeration of {@code SearchResult}s of the objects
* that satisfy the filter; never null
*
- * @throws ArrayIndexOutOfBoundsException if <tt>filterExpr</tt> contains
+ * @throws ArrayIndexOutOfBoundsException if {@code filterExpr} contains
* <code>{i}</code> expressions where <code>i</code> is outside
* the bounds of the array <code>filterArgs</code>
- * @throws InvalidSearchControlsException if <tt>cons</tt> contains
+ * @throws InvalidSearchControlsException if {@code cons} contains
* invalid settings
- * @throws InvalidSearchFilterException if <tt>filterExpr</tt> with
- * <tt>filterArgs</tt> represents an invalid search filter
+ * @throws InvalidSearchFilterException if {@code filterExpr} with
+ * {@code filterArgs} represents an invalid search filter
* @throws NamingException if a naming exception is encountered
*/
public NamingEnumeration<SearchResult>
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/InitialDirContext.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/InitialDirContext.java Wed Jul 05 20:44:51 2017 +0200
@@ -49,14 +49,14 @@
* Constructs an initial DirContext with the option of not
* initializing it. This may be used by a constructor in
* a subclass when the value of the environment parameter
- * is not yet known at the time the <tt>InitialDirContext</tt>
+ * is not yet known at the time the {@code InitialDirContext}
* constructor is called. The subclass's constructor will
* call this constructor, compute the value of the environment,
- * and then call <tt>init()</tt> before returning.
+ * and then call {@code init()} before returning.
*
* @param lazy
* true means do not initialize the initial DirContext; false
- * is equivalent to calling <tt>new InitialDirContext()</tt>
+ * is equivalent to calling {@code new InitialDirContext()}
* @throws NamingException if a naming exception is encountered
*
* @see InitialContext#init(Hashtable)
@@ -69,7 +69,7 @@
/**
* Constructs an initial DirContext.
* No environment properties are supplied.
- * Equivalent to <tt>new InitialDirContext(null)</tt>.
+ * Equivalent to {@code new InitialDirContext(null)}.
*
* @throws NamingException if a naming exception is encountered
*
@@ -82,12 +82,12 @@
/**
* Constructs an initial DirContext using the supplied environment.
* Environment properties are discussed in the
- * <tt>javax.naming.InitialContext</tt> class description.
+ * {@code javax.naming.InitialContext} class description.
*
- * <p> This constructor will not modify <tt>environment</tt>
+ * <p> This constructor will not modify {@code environment}
* or save a reference to it, but may save a clone.
* Caller should not modify mutable keys and values in
- * <tt>environment</tt> after it has been passed to the constructor.
+ * {@code environment} after it has been passed to the constructor.
*
* @param environment
* environment used to create the initial DirContext.
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/SearchControls.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/SearchControls.java Wed Jul 05 20:44:51 2017 +0200
@@ -54,7 +54,7 @@
* It contains zero element if the named object does not satisfy
* the search filter specified in search().
* <p>
- * The value of this constant is <tt>0</tt>.
+ * The value of this constant is {@code 0}.
*/
public final static int OBJECT_SCOPE = 0;
@@ -68,7 +68,7 @@
* The names of elements in the NamingEnumeration are atomic names
* relative to the named context.
* <p>
- * The value of this constant is <tt>1</tt>.
+ * The value of this constant is {@code 1}.
*/
public final static int ONELEVEL_SCOPE = 1;
/**
@@ -90,14 +90,14 @@
* included in the enumeration with the empty string as
* its name.
* <p>
- * The value of this constant is <tt>2</tt>.
+ * The value of this constant is {@code 2}.
*/
public final static int SUBTREE_SCOPE = 2;
/**
* Contains the scope with which to apply the search. One of
- * <tt>ONELEVEL_SCOPE</tt>, <tt>OBJECT_SCOPE</tt>, or
- * <tt>SUBTREE_SCOPE</tt>.
+ * {@code ONELEVEL_SCOPE}, {@code OBJECT_SCOPE}, or
+ * {@code SUBTREE_SCOPE}.
* @serial
*/
private int searchScope;
@@ -117,7 +117,7 @@
private boolean derefLink;
/**
- * Indicates whether object is returned in <tt>SearchResult</tt>.
+ * Indicates whether object is returned in {@code SearchResult}.
* @serial
*/
private boolean returnObj;
@@ -130,7 +130,7 @@
/**
* Contains the list of attributes to be returned in
- * <tt>SearchResult</tt> for each matching entry of search. <tt>null</tt>
+ * {@code SearchResult} for each matching entry of search. {@code null}
* indicates that all attributes are to be returned.
* @serial
*/
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/SearchResult.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/SearchResult.java Wed Jul 05 20:44:51 2017 +0200
@@ -53,9 +53,9 @@
* Constructs a search result using the result's name, its bound object, and
* its attributes.
*<p>
- * <tt>getClassName()</tt> will return the class name of <tt>obj</tt>
- * (or null if <tt>obj</tt> is null) unless the class name has been
- * explicitly set using <tt>setClassName()</tt>.
+ * {@code getClassName()} will return the class name of {@code obj}
+ * (or null if {@code obj} is null) unless the class name has been
+ * explicitly set using {@code setClassName()}.
*
* @param name The non-null name of the search item. It is relative
* to the <em>target context</em> of the search (which is
@@ -76,9 +76,9 @@
* Constructs a search result using the result's name, its bound object, and
* its attributes, and whether the name is relative.
*<p>
- * <tt>getClassName()</tt> will return the class name of <tt>obj</tt>
- * (or null if <tt>obj</tt> is null) unless the class name has been
- * explicitly set using <tt>setClassName()</tt>
+ * {@code getClassName()} will return the class name of {@code obj}
+ * (or null if {@code obj} is null) unless the class name has been
+ * explicitly set using {@code setClassName()}
*
* @param name The non-null name of the search item.
* @param obj The object bound to name. Can be null.
@@ -106,9 +106,9 @@
* named by the first parameter of the <code>search()</code> method)
*
* @param className The possibly null class name of the object
- * bound to <tt>name</tt>. If null, the class name of <tt>obj</tt> is
- * returned by <tt>getClassName()</tt>. If <tt>obj</tt> is also null,
- * <tt>getClassName()</tt> will return null.
+ * bound to {@code name}. If null, the class name of {@code obj} is
+ * returned by {@code getClassName()}. If {@code obj} is also null,
+ * {@code getClassName()} will return null.
* @param obj The object bound to name. Can be null.
* @param attrs The attributes that were requested to be returned with
* this search item. Cannot be null.
@@ -127,9 +127,9 @@
*
* @param name The non-null name of the search item.
* @param className The possibly null class name of the object
- * bound to <tt>name</tt>. If null, the class name of <tt>obj</tt> is
- * returned by <tt>getClassName()</tt>. If <tt>obj</tt> is also null,
- * <tt>getClassName()</tt> will return null.
+ * bound to {@code name}. If null, the class name of {@code obj} is
+ * returned by {@code getClassName()}. If {@code obj} is also null,
+ * {@code getClassName()} will return null.
* @param obj The object bound to name. Can be null.
* @param attrs The attributes that were requested to be returned with
* this search item. Cannot be null.
--- a/jdk/src/java.naming/share/classes/javax/naming/directory/package.html Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/directory/package.html Wed Jul 05 20:44:51 2017 +0200
@@ -28,7 +28,7 @@
</head>
<body bgcolor="white">
-Extends the <tt>javax.naming</tt> package to provide functionality
+Extends the <code>javax.naming</code> package to provide functionality
for accessing directory services.
<p>
@@ -47,20 +47,20 @@
<h4>The Directory Context</h4>
-The <tt>DirContext</tt>
+The <code>DirContext</code>
interface represents a <em>directory context</em>.
It defines methods for examining and updating attributes associated with a
<em>directory object</em>, or <em>directory entry</em> as it is sometimes
called.
<p>
-You use <tt>getAttributes()</tt> to retrieve the attributes
+You use <code>getAttributes()</code> to retrieve the attributes
associated with a directory object (for which you supply the name).
-Attributes are modified using <tt>modifyAttributes()</tt>.
+Attributes are modified using <code>modifyAttributes()</code>.
You can add, replace, or remove attributes and/or attribute values
using this operation.
<p>
-<tt>DirContext</tt> also behaves as a naming context
-by extending the <tt>Context</tt> interface in the <tt>javax.naming</tt> package.
+<code>DirContext</code> also behaves as a naming context
+by extending the <code>Context</code> interface in the <code>javax.naming</code> package.
This means that any directory object can also provide
a naming context.
For example, the directory object for a person might contain
@@ -69,13 +69,13 @@
such as his printers and home directory.
<h4>Searches</h4>
-<tt>DirContext</tt> contains methods for
+<code>DirContext</code> contains methods for
performing content-based searching of the directory.
In the simplest and most common form of usage, the application
-specifies a set of attributes--possibly with specific
-values--to match, and submits this attribute set, to the
-<tt>search()</tt> method.
-There are other overloaded forms of <tt>search()</tt>
+specifies a set of attributes--possibly with specific
+values--to match, and submits this attribute set, to the
+<code>search()</code> method.
+There are other overloaded forms of <code>search()</code>
that support more sophisticated <em>search filters</em>.
--- a/jdk/src/java.naming/share/classes/javax/naming/event/EventContext.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/EventContext.java Wed Jul 05 20:44:51 2017 +0200
@@ -35,7 +35,7 @@
* events fired when objects named in a context changes.
*
*<h1>Target</h1>
- * The name parameter in the <tt>addNamingListener()</tt> methods is referred
+ * The name parameter in the {@code addNamingListener()} methods is referred
* to as the <em>target</em>. The target, along with the scope, identify
* the object(s) that the listener is interested in.
* It is possible to register interest in a target that does not exist, but
@@ -44,23 +44,23 @@
*<p>
* If a service only supports registration for existing
* targets, an attempt to register for a nonexistent target
- * results in a <tt>NameNotFoundException</tt> being thrown as early as possible,
- * preferably at the time <tt>addNamingListener()</tt> is called, or if that is
+ * results in a {@code NameNotFoundException} being thrown as early as possible,
+ * preferably at the time {@code addNamingListener()} is called, or if that is
* not possible, the listener will receive the exception through the
- * <tt>NamingExceptionEvent</tt>.
+ * {@code NamingExceptionEvent}.
*<p>
* Also, for service providers that only support registration for existing
* targets, when the target that a listener has registered for is
* subsequently removed from the namespace, the listener is notified
- * via a <tt>NamingExceptionEvent</tt> (containing a
- *<tt>NameNotFoundException</tt>).
+ * via a {@code NamingExceptionEvent} (containing a
+ *{@code NameNotFoundException}).
*<p>
- * An application can use the method <tt>targetMustExist()</tt> to check
- * whether a <tt>EventContext</tt> supports registration
+ * An application can use the method {@code targetMustExist()} to check
+ * whether a {@code EventContext} supports registration
* of nonexistent targets.
*
*<h1>Event Source</h1>
- * The <tt>EventContext</tt> instance on which you invoke the
+ * The {@code EventContext} instance on which you invoke the
* registration methods is the <em>event source</em> of the events that are
* (potentially) generated.
* The source is <em>not necessarily</em> the object named by the target.
@@ -69,7 +69,7 @@
* In other words, the target,
* along with the scope parameter, are used to identify
* the object(s) that the listener is interested in, but the event source
- * is the <tt>EventContext</tt> instance with which the listener
+ * is the {@code EventContext} instance with which the listener
* has registered.
*<p>
* For example, suppose a listener makes the following registration:
@@ -78,52 +78,52 @@
* src.addNamingListener("x", SUBTREE_SCOPE, listener);
*</pre></blockquote>
* When an object named "x/y" is subsequently deleted, the corresponding
- * <tt>NamingEvent</tt> (<tt>evt</tt>) must contain:
+ * {@code NamingEvent} ({@code evt}) must contain:
*<blockquote><pre>
* evt.getEventContext() == src
* evt.getOldBinding().getName().equals("x/y")
*</pre></blockquote>
*<p>
* Furthermore, listener registration/deregistration is with
- * the <tt>EventContext</tt>
+ * the {@code EventContext}
* <em>instance</em>, and not with the corresponding object in the namespace.
* If the program intends at some point to remove a listener, then it needs to
- * keep a reference to the <tt>EventContext</tt> instance on
- * which it invoked <tt>addNamingListener()</tt> (just as
+ * keep a reference to the {@code EventContext} instance on
+ * which it invoked {@code addNamingListener()} (just as
* it needs to keep a reference to the listener in order to remove it
- * later). It cannot expect to do a <tt>lookup()</tt> and get another instance of
- * a <tt>EventContext</tt> on which to perform the deregistration.
+ * later). It cannot expect to do a {@code lookup()} and get another instance of
+ * a {@code EventContext} on which to perform the deregistration.
*<h1>Lifetime of Registration</h1>
* A registered listener becomes deregistered when:
*<ul>
- *<li>It is removed using <tt>removeNamingListener()</tt>.
+ *<li>It is removed using {@code removeNamingListener()}.
*<li>An exception is thrown while collecting information about the events.
- * That is, when the listener receives a <tt>NamingExceptionEvent</tt>.
- *<li><tt>Context.close()</tt> is invoked on the <tt>EventContext</tt>
+ * That is, when the listener receives a {@code NamingExceptionEvent}.
+ *<li>{@code Context.close()} is invoked on the {@code EventContext}
* instance with which it has registered.
</ul>
- * Until that point, a <tt>EventContext</tt> instance that has outstanding
+ * Until that point, a {@code EventContext} instance that has outstanding
* listeners will continue to exist and be maintained by the service provider.
*
*<h1>Listener Implementations</h1>
* The registration/deregistration methods accept an instance of
- * <tt>NamingListener</tt>. There are subinterfaces of <tt>NamingListener</tt>
- * for different of event types of <tt>NamingEvent</tt>.
- * For example, the <tt>ObjectChangeListener</tt>
- * interface is for the <tt>NamingEvent.OBJECT_CHANGED</tt> event type.
+ * {@code NamingListener}. There are subinterfaces of {@code NamingListener}
+ * for different of event types of {@code NamingEvent}.
+ * For example, the {@code ObjectChangeListener}
+ * interface is for the {@code NamingEvent.OBJECT_CHANGED} event type.
* To register interest in multiple event types, the listener implementation
- * should implement multiple <tt>NamingListener</tt> subinterfaces and use a
- * single invocation of <tt>addNamingListener()</tt>.
+ * should implement multiple {@code NamingListener} subinterfaces and use a
+ * single invocation of {@code addNamingListener()}.
* In addition to reducing the number of method calls and possibly the code size
* of the listeners, this allows some service providers to optimize the
* registration.
*
*<h1>Threading Issues</h1>
*
- * Like <tt>Context</tt> instances in general, instances of
- * <tt>EventContext</tt> are not guaranteed to be thread-safe.
+ * Like {@code Context} instances in general, instances of
+ * {@code EventContext} are not guaranteed to be thread-safe.
* Care must be taken when multiple threads are accessing the same
- * <tt>EventContext</tt> concurrently.
+ * {@code EventContext} concurrently.
* See the
* <a href=package-summary.html#THREADING>package description</a>
* for more information on threading issues.
@@ -138,7 +138,7 @@
* Constant for expressing interest in events concerning the object named
* by the target.
*<p>
- * The value of this constant is <tt>0</tt>.
+ * The value of this constant is {@code 0}.
*/
public final static int OBJECT_SCOPE = 0;
@@ -147,7 +147,7 @@
* in the context named by the target,
* excluding the context named by the target.
*<p>
- * The value of this constant is <tt>1</tt>.
+ * The value of this constant is {@code 1}.
*/
public final static int ONELEVEL_SCOPE = 1;
@@ -156,7 +156,7 @@
* in the subtree of the object named by the target, including the object
* named by the target.
*<p>
- * The value of this constant is <tt>2</tt>.
+ * The value of this constant is {@code 2}.
*/
public final static int SUBTREE_SCOPE = 2;
@@ -167,31 +167,31 @@
*
* The event source of those events is this context. See the
* class description for a discussion on event source and target.
- * See the descriptions of the constants <tt>OBJECT_SCOPE</tt>,
- * <tt>ONELEVEL_SCOPE</tt>, and <tt>SUBTREE_SCOPE</tt> to see how
- * <tt>scope</tt> affects the registration.
+ * See the descriptions of the constants {@code OBJECT_SCOPE},
+ * {@code ONELEVEL_SCOPE}, and {@code SUBTREE_SCOPE} to see how
+ * {@code scope} affects the registration.
*<p>
- * <tt>target</tt> needs to name a context only when <tt>scope</tt> is
- * <tt>ONELEVEL_SCOPE</tt>.
- * <tt>target</tt> may name a non-context if <tt>scope</tt> is either
- * <tt>OBJECT_SCOPE</tt> or <tt>SUBTREE_SCOPE</tt>. Using
- * <tt>SUBTREE_SCOPE</tt> for a non-context might be useful,
- * for example, if the caller does not know in advance whether <tt>target</tt>
+ * {@code target} needs to name a context only when {@code scope} is
+ * {@code ONELEVEL_SCOPE}.
+ * {@code target} may name a non-context if {@code scope} is either
+ * {@code OBJECT_SCOPE} or {@code SUBTREE_SCOPE}. Using
+ * {@code SUBTREE_SCOPE} for a non-context might be useful,
+ * for example, if the caller does not know in advance whether {@code target}
* is a context and just wants to register interest in the (possibly
- * degenerate subtree) rooted at <tt>target</tt>.
+ * degenerate subtree) rooted at {@code target}.
*<p>
* When the listener is notified of an event, the listener may
* in invoked in a thread other than the one in which
- * <tt>addNamingListener()</tt> is executed.
+ * {@code addNamingListener()} is executed.
* Care must be taken when multiple threads are accessing the same
- * <tt>EventContext</tt> concurrently.
+ * {@code EventContext} concurrently.
* See the
* <a href=package-summary.html#THREADING>package description</a>
* for more information on threading issues.
*
* @param target A nonnull name to be resolved relative to this context.
- * @param scope One of <tt>OBJECT_SCOPE</tt>, <tt>ONELEVEL_SCOPE</tt>, or
- * <tt>SUBTREE_SCOPE</tt>.
+ * @param scope One of {@code OBJECT_SCOPE}, {@code ONELEVEL_SCOPE}, or
+ * {@code SUBTREE_SCOPE}.
* @param l The nonnull listener.
* @exception NamingException If a problem was encountered while
* adding the listener.
@@ -204,12 +204,12 @@
* Adds a listener for receiving naming events fired
* when the object named by the string target name and scope changes.
*
- * See the overload that accepts a <tt>Name</tt> for details.
+ * See the overload that accepts a {@code Name} for details.
*
* @param target The nonnull string name of the object resolved relative
* to this context.
- * @param scope One of <tt>OBJECT_SCOPE</tt>, <tt>ONELEVEL_SCOPE</tt>, or
- * <tt>SUBTREE_SCOPE</tt>.
+ * @param scope One of {@code OBJECT_SCOPE}, {@code ONELEVEL_SCOPE}, or
+ * {@code SUBTREE_SCOPE}.
* @param l The nonnull listener.
* @exception NamingException If a problem was encountered while
* adding the listener.
@@ -220,15 +220,15 @@
/**
* Removes a listener from receiving naming events fired
- * by this <tt>EventContext</tt>.
+ * by this {@code EventContext}.
* The listener may have registered more than once with this
- * <tt>EventContext</tt>, perhaps with different target/scope arguments.
+ * {@code EventContext}, perhaps with different target/scope arguments.
* After this method is invoked, the listener will no longer
- * receive events with this <tt>EventContext</tt> instance
+ * receive events with this {@code EventContext} instance
* as the event source (except for those events already in the process of
* being dispatched).
* If the listener was not, or is no longer, registered with
- * this <tt>EventContext</tt> instance, this method does not do anything.
+ * this {@code EventContext} instance, this method does not do anything.
*
* @param l The nonnull listener.
* @exception NamingException If a problem was encountered while
--- a/jdk/src/java.naming/share/classes/javax/naming/event/EventDirContext.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/EventDirContext.java Wed Jul 05 20:44:51 2017 +0200
@@ -42,17 +42,17 @@
* satisfy the filter. However, there might be limitations in the extent
* to which this can be supported by the service provider and underlying
* protocol/service. If the caller submits a filter that cannot be
- * supported in this way, <tt>addNamingListener()</tt> throws an
- * <tt>InvalidSearchFilterException</tt>.
+ * supported in this way, {@code addNamingListener()} throws an
+ * {@code InvalidSearchFilterException}.
*<p>
- * See <tt>EventContext</tt> for a description of event source
+ * See {@code EventContext} for a description of event source
* and target, and information about listener registration/deregistration
* that are also applicable to methods in this interface.
* See the
* <a href=package-summary.html#THREADING>package description</a>
* for information on threading issues.
*<p>
- * A <tt>SearchControls</tt> or array object
+ * A {@code SearchControls} or array object
* passed as a parameter to any method is owned by the caller.
* The service provider will not modify the object or keep a reference to it.
*
@@ -64,15 +64,15 @@
public interface EventDirContext extends EventContext, DirContext {
/**
* Adds a listener for receiving naming events fired
- * when objects identified by the search filter <tt>filter</tt> at
+ * when objects identified by the search filter {@code filter} at
* the object named by target are modified.
* <p>
* The scope, returningObj flag, and returningAttributes flag from
- * the search controls <tt>ctls</tt> are used to control the selection
+ * the search controls {@code ctls} are used to control the selection
* of objects that the listener is interested in,
* and determines what information is returned in the eventual
- * <tt>NamingEvent</tt> object. Note that the requested
- * information to be returned might not be present in the <tt>NamingEvent</tt>
+ * {@code NamingEvent} object. Note that the requested
+ * information to be returned might not be present in the {@code NamingEvent}
* object if they are unavailable or could not be obtained by the
* service provider or service.
*
@@ -91,9 +91,9 @@
/**
* Adds a listener for receiving naming events fired when
- * objects identified by the search filter <tt>filter</tt> at the
+ * objects identified by the search filter {@code filter} at the
* object named by the string target name are modified.
- * See the overload that accepts a <tt>Name</tt> for details of
+ * See the overload that accepts a {@code Name} for details of
* how this method behaves.
*
* @param target The nonnull string name of the object resolved relative to this context.
@@ -111,14 +111,14 @@
/**
* Adds a listener for receiving naming events fired
- * when objects identified by the search filter <tt>filter</tt> and
+ * when objects identified by the search filter {@code filter} and
* filter arguments at the object named by the target are modified.
* The scope, returningObj flag, and returningAttributes flag from
- * the search controls <tt>ctls</tt> are used to control the selection
+ * the search controls {@code ctls} are used to control the selection
* of objects that the listener is interested in,
* and determines what information is returned in the eventual
- * <tt>NamingEvent</tt> object. Note that the requested
- * information to be returned might not be present in the <tt>NamingEvent</tt>
+ * {@code NamingEvent} object. Note that the requested
+ * information to be returned might not be present in the {@code NamingEvent}
* object if they are unavailable or could not be obtained by the
* service provider or service.
*
@@ -138,10 +138,10 @@
/**
* Adds a listener for receiving naming events fired when
- * objects identified by the search filter <tt>filter</tt>
+ * objects identified by the search filter {@code filter}
* and filter arguments at the
* object named by the string target name are modified.
- * See the overload that accepts a <tt>Name</tt> for details of
+ * See the overload that accepts a {@code Name} for details of
* how this method behaves.
*
* @param target The nonnull string name of the object resolved relative to this context.
--- a/jdk/src/java.naming/share/classes/javax/naming/event/NamespaceChangeListener.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/NamespaceChangeListener.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,21 +28,21 @@
/**
* Specifies the methods that a listener interested in namespace changes
* must implement.
- * Specifically, the listener is interested in <tt>NamingEvent</tt>s
- * with event types of <tt>OBJECT_ADDED</TT>, <TT>OBJECT_RENAMED</TT>, or
- * <TT>OBJECT_REMOVED</TT>.
+ * Specifically, the listener is interested in {@code NamingEvent}s
+ * with event types of {@code OBJECT_ADDED, OBJECT_RENAMED}, or
+ * {@code OBJECT_REMOVED}.
*<p>
* Such a listener must:
*<ol>
*<li>Implement this interface and its methods.
- *<li>Implement <tt>NamingListener.namingExceptionThrown()</tt> so that
+ *<li>Implement {@code NamingListener.namingExceptionThrown()} so that
* it will be notified of exceptions thrown while attempting to
* collect information about the events.
- *<li>Register with the source using the source's <tt>addNamingListener()</tt>
+ *<li>Register with the source using the source's {@code addNamingListener()}
* method.
*</ol>
- * A listener that wants to be notified of <tt>OBJECT_CHANGED</tt> event types
- * should also implement the <tt>ObjectChangeListener</tt>
+ * A listener that wants to be notified of {@code OBJECT_CHANGED} event types
+ * should also implement the {@code ObjectChangeListener}
* interface.
*
* @author Rosanna Lee
@@ -60,7 +60,7 @@
* Called when an object has been added.
*<p>
* The binding of the newly added object can be obtained using
- * <tt>evt.getNewBinding()</tt>.
+ * {@code evt.getNewBinding()}.
* @param evt The nonnull event.
* @see NamingEvent#OBJECT_ADDED
*/
@@ -70,7 +70,7 @@
* Called when an object has been removed.
*<p>
* The binding of the newly removed object can be obtained using
- * <tt>evt.getOldBinding()</tt>.
+ * {@code evt.getOldBinding()}.
* @param evt The nonnull event.
* @see NamingEvent#OBJECT_REMOVED
*/
@@ -80,8 +80,8 @@
* Called when an object has been renamed.
*<p>
* The binding of the renamed object can be obtained using
- * <tt>evt.getNewBinding()</tt>. Its old binding (before the rename)
- * can be obtained using <tt>evt.getOldBinding()</tt>.
+ * {@code evt.getNewBinding()}. Its old binding (before the rename)
+ * can be obtained using {@code evt.getOldBinding()}.
* One of these may be null if the old/new binding was outside the
* scope in which the listener has registered interest.
* @param evt The nonnull event.
--- a/jdk/src/java.naming/share/classes/javax/naming/event/NamingEvent.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/NamingEvent.java Wed Jul 05 20:44:51 2017 +0200
@@ -30,9 +30,9 @@
/**
* This class represents an event fired by a naming/directory service.
*<p>
- * The <tt>NamingEvent</tt>'s state consists of
+ * The {@code NamingEvent}'s state consists of
* <ul>
- * <li>The event source: the <tt>EventContext</tt> which fired this event.
+ * <li>The event source: the {@code EventContext} which fired this event.
* <li>The event type.
* <li>The new binding: information about the object after the change.
* <li>The old binding: information about the object before the change.
@@ -41,24 +41,24 @@
* information.
* </ul>
* <p>
- * Note that the event source is always the same <tt>EventContext</tt>
+ * Note that the event source is always the same {@code EventContext}
* <em>instance</em> that the listener has registered with.
* Furthermore, the names of the bindings in
- * the <tt>NamingEvent</tt> are always relative to that instance.
+ * the {@code NamingEvent} are always relative to that instance.
* For example, suppose a listener makes the following registration:
*<blockquote><pre>
* NamespaceChangeListener listener = ...;
* src.addNamingListener("x", SUBTREE_SCOPE, listener);
*</pre></blockquote>
* When an object named "x/y" is subsequently deleted, the corresponding
- * <tt>NamingEvent</tt> (<tt>evt</tt>) must contain:
+ * {@code NamingEvent} ({@code evt}) must contain:
*<blockquote><pre>
* evt.getEventContext() == src
* evt.getOldBinding().getName().equals("x/y")
*</pre></blockquote>
*
* Care must be taken when multiple threads are accessing the same
- * <tt>EventContext</tt> concurrently.
+ * {@code EventContext} concurrently.
* See the
* <a href=package-summary.html#THREADING>package description</a>
* for more information on threading issues.
@@ -73,13 +73,13 @@
public class NamingEvent extends java.util.EventObject {
/**
* Naming event type for indicating that a new object has been added.
- * The value of this constant is <tt>0</tt>.
+ * The value of this constant is {@code 0}.
*/
public static final int OBJECT_ADDED = 0;
/**
* Naming event type for indicating that an object has been removed.
- * The value of this constant is <tt>1</tt>.
+ * The value of this constant is {@code 1}.
*/
public static final int OBJECT_REMOVED = 1;
@@ -90,7 +90,7 @@
* be implemented by adding a binding with the new name and removing
* the old binding.
*<p>
- * The old/new binding in <tt>NamingEvent</tt> may be null if the old
+ * The old/new binding in {@code NamingEvent} may be null if the old
* name or new name is outside of the scope for which the listener
* has registered.
*<p>
@@ -102,7 +102,7 @@
* corresponding provider might not be able to prevent those
* notifications from being propagated to the listeners.
*<p>
- * The value of this constant is <tt>2</tt>.
+ * The value of this constant is {@code 2}.
*/
public static final int OBJECT_RENAMED = 2;
@@ -114,7 +114,7 @@
* be implemented by first removing the old binding and adding
* a new binding containing the same name but a different object.
*<p>
- * The value of this constant is <tt>3</tt>.
+ * The value of this constant is {@code 3}.
*/
public static final int OBJECT_CHANGED = 3;
@@ -147,16 +147,16 @@
protected Binding newBinding;
/**
- * Constructs an instance of <tt>NamingEvent</tt>.
+ * Constructs an instance of {@code NamingEvent}.
*<p>
- * The names in <tt>newBd</tt> and <tt>oldBd</tt> are to be resolved relative
- * to the event source <tt>source</tt>.
+ * The names in {@code newBd} and {@code oldBd} are to be resolved relative
+ * to the event source {@code source}.
*
- * For an <tt>OBJECT_ADDED</tt> event type, <tt>newBd</tt> must not be null.
- * For an <tt>OBJECT_REMOVED</tt> event type, <tt>oldBd</tt> must not be null.
- * For an <tt>OBJECT_CHANGED</tt> event type, <tt>newBd</tt> and
- * <tt>oldBd</tt> must not be null. For an <tt>OBJECT_RENAMED</tt> event type,
- * one of <tt>newBd</tt> or <tt>oldBd</tt> may be null if the new or old
+ * For an {@code OBJECT_ADDED} event type, {@code newBd} must not be null.
+ * For an {@code OBJECT_REMOVED} event type, {@code oldBd} must not be null.
+ * For an {@code OBJECT_CHANGED} event type, {@code newBd} and
+ * {@code oldBd} must not be null. For an {@code OBJECT_RENAMED} event type,
+ * one of {@code newBd} or {@code oldBd} may be null if the new or old
* binding is outside of the scope for which the listener has registered.
*
* @param source The non-null context that fired this event.
@@ -192,13 +192,13 @@
/**
* Retrieves the event source that fired this event.
- * This returns the same object as <tt>EventObject.getSource()</tt>.
+ * This returns the same object as {@code EventObject.getSource()}.
*<p>
* If the result of this method is used to access the
* event source, for example, to look up the object or get its attributes,
- * then it needs to be locked because implementations of <tt>Context</tt>
+ * then it needs to be locked because implementations of {@code Context}
* are not guaranteed to be thread-safe
- * (and <tt>EventContext</tt> is a subinterface of <tt>Context</tt>).
+ * (and {@code EventContext} is a subinterface of {@code Context}).
* See the
* <a href=package-summary.html#THREADING>package description</a>
* for more information on threading issues.
@@ -213,16 +213,16 @@
* Retrieves the binding of the object before the change.
*<p>
* The binding must be nonnull if the object existed before the change
- * relative to the source context (<tt>getEventContext()</tt>).
- * That is, it must be nonnull for <tt>OBJECT_REMOVED</tt> and
- * <tt>OBJECT_CHANGED</tt>.
- * For <tt>OBJECT_RENAMED</tt>, it is null if the object before the rename
+ * relative to the source context ({@code getEventContext()}).
+ * That is, it must be nonnull for {@code OBJECT_REMOVED} and
+ * {@code OBJECT_CHANGED}.
+ * For {@code OBJECT_RENAMED}, it is null if the object before the rename
* is outside of the scope for which the listener has registered interest;
* it is nonnull if the object is inside the scope before the rename.
*<p>
* The name in the binding is to be resolved relative
- * to the event source <tt>getEventContext()</tt>.
- * The object returned by <tt>Binding.getObject()</tt> may be null if
+ * to the event source {@code getEventContext()}.
+ * The object returned by {@code Binding.getObject()} may be null if
* such information is unavailable.
*
* @return The possibly null binding of the object before the change.
@@ -235,16 +235,16 @@
* Retrieves the binding of the object after the change.
*<p>
* The binding must be nonnull if the object existed after the change
- * relative to the source context (<tt>getEventContext()</tt>).
- * That is, it must be nonnull for <tt>OBJECT_ADDED</tt> and
- * <tt>OBJECT_CHANGED</tt>. For <tt>OBJECT_RENAMED</tt>,
+ * relative to the source context ({@code getEventContext()}).
+ * That is, it must be nonnull for {@code OBJECT_ADDED} and
+ * {@code OBJECT_CHANGED}. For {@code OBJECT_RENAMED},
* it is null if the object after the rename is outside the scope for
* which the listener registered interest; it is nonnull if the object
* is inside the scope after the rename.
*<p>
* The name in the binding is to be resolved relative
- * to the event source <tt>getEventContext()</tt>.
- * The object returned by <tt>Binding.getObject()</tt> may be null if
+ * to the event source {@code getEventContext()}.
+ * The object returned by {@code Binding.getObject()} may be null if
* such information is unavailable.
*
* @return The possibly null binding of the object after the change.
@@ -268,8 +268,8 @@
* Invokes the appropriate listener method on this event.
* The default implementation of
* this method handles the following event types:
- * <tt>OBJECT_ADDED</TT>, <TT>OBJECT_REMOVED</TT>,
- * <TT>OBJECT_RENAMED</TT>, <TT>OBJECT_CHANGED</TT>.
+ * {@code OBJECT_ADDED, OBJECT_REMOVED,
+ * OBJECT_RENAMED, OBJECT_CHANGED}.
*<p>
* The listener method is executed in the same thread
* as this method. See the
--- a/jdk/src/java.naming/share/classes/javax/naming/event/NamingExceptionEvent.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/NamingExceptionEvent.java Wed Jul 05 20:44:51 2017 +0200
@@ -30,9 +30,9 @@
/**
* This class represents an event fired when the procedures/processes
* used to collect information for notifying listeners of
- * <tt>NamingEvent</tt>s threw a <tt>NamingException</tt>.
+ * {@code NamingEvent}s threw a {@code NamingException}.
* This can happen, for example, if the server which the listener is using
- * aborts subsequent to the <tt>addNamingListener()</tt> call.
+ * aborts subsequent to the {@code addNamingListener()} call.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -50,12 +50,12 @@
private NamingException exception;
/**
- * Constructs an instance of <tt>NamingExceptionEvent</tt> using
- * the context in which the <tt>NamingException</tt> was thrown and the exception
+ * Constructs an instance of {@code NamingExceptionEvent} using
+ * the context in which the {@code NamingException} was thrown and the exception
* that was thrown.
*
* @param source The non-null context in which the exception was thrown.
- * @param exc The non-null <tt>NamingException</tt> that was thrown.
+ * @param exc The non-null {@code NamingException} that was thrown.
*
*/
public NamingExceptionEvent(EventContext source, NamingException exc) {
@@ -72,16 +72,16 @@
}
/**
- * Retrieves the <tt>EventContext</tt> that fired this event.
- * This returns the same object as <tt>EventObject.getSource()</tt>.
- * @return The non-null <tt>EventContext</tt> that fired this event.
+ * Retrieves the {@code EventContext} that fired this event.
+ * This returns the same object as {@code EventObject.getSource()}.
+ * @return The non-null {@code EventContext} that fired this event.
*/
public EventContext getEventContext() {
return (EventContext)getSource();
}
/**
- * Invokes the <tt>namingExceptionThrown()</tt> method on
+ * Invokes the {@code namingExceptionThrown()} method on
* a listener using this event.
* @param listener The non-null naming listener on which to invoke
* the method.
--- a/jdk/src/java.naming/share/classes/javax/naming/event/NamingListener.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/NamingListener.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,22 +27,22 @@
/**
* This interface is the root of listener interfaces that
- * handle <tt>NamingEvent</tt>s.
+ * handle {@code NamingEvent}s.
* It does not make sense for a listener to implement just this interface.
- * A listener typically implements a subinterface of <tt>NamingListener</tt>,
- * such as <tt>ObjectChangeListener</tt> or <tt>NamespaceChangeListener</tt>.
+ * A listener typically implements a subinterface of {@code NamingListener},
+ * such as {@code ObjectChangeListener} or {@code NamespaceChangeListener}.
*<p>
- * This interface contains a single method, <tt>namingExceptionThrown()</tt>,
+ * This interface contains a single method, {@code namingExceptionThrown()},
* that must be implemented so that the listener can be notified of
* exceptions that are thrown (by the service provider) while gathering
* information about the events that they're interested in.
* When this method is invoked, the listener has been automatically deregistered
- * from the <tt>EventContext</tt> with which it has registered.
+ * from the {@code EventContext} with which it has registered.
*<p>
- * For example, suppose a listener implements <tt>ObjectChangeListener</tt> and
- * registers with a <tt>EventContext</tt>.
+ * For example, suppose a listener implements {@code ObjectChangeListener} and
+ * registers with a {@code EventContext}.
* Then, if the connection to the server is subsequently broken,
- * the listener will receive a <tt>NamingExceptionEvent</tt> and may
+ * the listener will receive a {@code NamingExceptionEvent} and may
* take some corrective action, such as notifying the user of the application.
*
* @author Rosanna Lee
@@ -57,7 +57,7 @@
public interface NamingListener extends java.util.EventListener {
/**
* Called when a naming exception is thrown while attempting
- * to fire a <tt>NamingEvent</tt>.
+ * to fire a {@code NamingEvent}.
*
* @param evt The nonnull event.
*/
--- a/jdk/src/java.naming/share/classes/javax/naming/event/ObjectChangeListener.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/ObjectChangeListener.java Wed Jul 05 20:44:51 2017 +0200
@@ -26,27 +26,27 @@
package javax.naming.event;
/**
- * Specifies the method that a listener of a <tt>NamingEvent</tt>
- * with event type of <tt>OBJECT_CHANGED</tt> must implement.
+ * Specifies the method that a listener of a {@code NamingEvent}
+ * with event type of {@code OBJECT_CHANGED} must implement.
*<p>
- * An <tt>OBJECT_CHANGED</tt> event type is fired when (the contents of)
+ * An {@code OBJECT_CHANGED} event type is fired when (the contents of)
* an object has changed. This might mean that its attributes have been modified,
* added, or removed, and/or that the object itself has been replaced.
* How the object has changed can be determined by examining the
- * <tt>NamingEvent</tt>'s old and new bindings.
+ * {@code NamingEvent}'s old and new bindings.
*<p>
- * A listener interested in <tt>OBJECT_CHANGED</tt> event types must:
+ * A listener interested in {@code OBJECT_CHANGED} event types must:
*<ol>
*
- *<li>Implement this interface and its method (<tt>objectChanged()</tt>)
- *<li>Implement <tt>NamingListener.namingExceptionThrown()</tt> so that
+ *<li>Implement this interface and its method ({@code objectChanged()})
+ *<li>Implement {@code NamingListener.namingExceptionThrown()} so that
* it will be notified of exceptions thrown while attempting to
* collect information about the events.
- *<li>Register with the source using the source's <tt>addNamingListener()</tt>
+ *<li>Register with the source using the source's {@code addNamingListener()}
* method.
*</ol>
* A listener that wants to be notified of namespace change events
- * should also implement the <tt>NamespaceChangeListener</tt>
+ * should also implement the {@code NamespaceChangeListener}
* interface.
*
* @author Rosanna Lee
@@ -64,8 +64,8 @@
* Called when an object has been changed.
*<p>
* The binding of the changed object can be obtained using
- * <tt>evt.getNewBinding()</tt>. Its old binding (before the change)
- * can be obtained using <tt>evt.getOldBinding()</tt>.
+ * {@code evt.getNewBinding()}. Its old binding (before the change)
+ * can be obtained using {@code evt.getOldBinding()}.
* @param evt The nonnull naming event.
* @see NamingEvent#OBJECT_CHANGED
*/
--- a/jdk/src/java.naming/share/classes/javax/naming/event/package.html Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/event/package.html Wed Jul 05 20:44:51 2017 +0200
@@ -42,21 +42,21 @@
<h4>Naming Events</h4>
<p>
-This package defines a <tt>NamingEvent</tt> class to represent an event
+This package defines a <code>NamingEvent</code> class to represent an event
that is generated by a naming/directory service.
-It also defines subinterfaces of <tt>Context</tt> and <tt>DirContext</tt>,
-called <tt>EventContext</tt> and <tt>EventDirContext</tt>,
+It also defines subinterfaces of <code>Context</code> and <code>DirContext</code>,
+called <code>EventContext</code> and <code>EventDirContext</code>,
through which applications can register their interest in events
fired by the context.
<p>
-<tt>NamingEvent</tt> represents an event that occurs in a
+<code>NamingEvent</code> represents an event that occurs in a
naming or directory service. There are two categories of naming events:
<ul>
<li>Those that affect the namespace (add/remove/rename an object)
<li>Those that affect the objects' contents.
</ul>
Each category of events is handled by a corresponding listener:
-<tt>NamespaceChangeListener</tt>, <tt>ObjectChangeListener</tt>.
+<code>NamespaceChangeListener</code>, <code>ObjectChangeListener</code>.
<p>
An application, for example, can register its interest in changes to
objects in a context as follows:
@@ -82,19 +82,19 @@
<h4>Threading Issues</h4>
When an event is dispatched to a listener, the listener method (such
-as <tt>objectChanged()</tt>) may be executed in a thread other than the
-one in which the call to <tt>addNamingListener()</tt> was executed.
+as <code>objectChanged()</code>) may be executed in a thread other than the
+one in which the call to <code>addNamingListener()</code> was executed.
The choice of which thread to use is made by the service provider.
When an event is dispatched to multiple listeners, the service provider
may choose (and is generally encouraged) to execute the listener methods
concurrently in separate threads.
<p>
-When a listener instance invokes <tt>NamingEvent.getEventContext()</tt>,
+When a listener instance invokes <code>NamingEvent.getEventContext()</code>,
it must take into account the possibility that other threads will be
working with that context concurrently. Likewise, when a listener is
-registered via <tt>addNamingListener()</tt>, the registering thread
+registered via <code>addNamingListener()</code>, the registering thread
must take into account the likely possibility that the service provider
-will later invoke the listeners in newly-created threads. As <tt>Context</tt>
+will later invoke the listeners in newly-created threads. As <code>Context</code>
instances are not guaranteed to be thread-safe in general, all context
operations must be synchronized as needed.
@@ -107,9 +107,9 @@
on the server that will eventually be translated into events.
If an exception occurs that prevents information about the events from
being collected, the listener will never be notified of the events.
-When such an exception occurs, a <tt>NamingExceptionEvent</tt> is
+When such an exception occurs, a <code>NamingExceptionEvent</code> is
fired to notify the listener. The listener's
-<tt>namingExceptionThrown()</tt> method is invoked, as shown in the
+<code>namingExceptionThrown()</code> method is invoked, as shown in the
sample code above,
and the listener is automatically deregistered.
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/BasicControl.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/BasicControl.java Wed Jul 05 20:44:51 2017 +0200
@@ -26,7 +26,7 @@
package javax.naming.ldap;
/**
- * This class provides a basic implementation of the <tt>Control</tt>
+ * This class provides a basic implementation of the {@code Control}
* interface. It represents an LDAPv3 Control as defined in
* <a href="http://www.ietf.org/rfc/rfc2251.txt">RFC 2251</a>.
*
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/Control.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/Control.java Wed Jul 05 20:44:51 2017 +0200
@@ -52,13 +52,13 @@
public interface Control extends java.io.Serializable {
/**
* Indicates a critical control.
- * The value of this constant is <tt>true</tt>.
+ * The value of this constant is {@code true}.
*/
public static final boolean CRITICAL = true;
/**
* Indicates a non-critical control.
- * The value of this constant is <tt>false</tt>.
+ * The value of this constant is {@code false}.
*/
public static final boolean NONCRITICAL = false;
@@ -75,7 +75,7 @@
* In other words, if the server receives a critical control
* that it does not support, regardless of whether the control
* makes sense for the operation, the operation will not be performed
- * and an <tt>OperationNotSupportedException</tt> will be thrown.
+ * and an {@code OperationNotSupportedException} will be thrown.
* @return true if this control is critical; false otherwise.
*/
public boolean isCritical();
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/ControlFactory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/ControlFactory.java Wed Jul 05 20:44:51 2017 +0200
@@ -65,7 +65,7 @@
* Without this mechanism, the provider would be returning
* controls that only contained data in BER encoded format.
*<p>
- * Typically, <tt>ctl</tt> is a "basic" control containing
+ * Typically, {@code ctl} is a "basic" control containing
* BER encoded data. The factory is used to create a specialized
* control implementation, usually by decoding the BER encoded data,
* that provides methods to access that data in a type-safe and friendly
@@ -80,14 +80,14 @@
* it is the only intended factory and that no other control factories
* should be tried. This might happen, for example, if the BER data
* in the control does not match what is expected of a control with
- * the given OID. Since this method throws <tt>NamingException</tt>,
+ * the given OID. Since this method throws {@code NamingException},
* any other internally generated exception that should be propagated
- * must be wrapped inside a <tt>NamingException</tt>.
+ * must be wrapped inside a {@code NamingException}.
*
* @param ctl A non-null control.
*
* @return A possibly null Control.
- * @exception NamingException If <tt>ctl</tt> contains invalid data that prevents it
+ * @exception NamingException If {@code ctl} contains invalid data that prevents it
* from being used to create a control. A factory should only throw
* an exception if it knows how to produce the control (identified by the OID)
* but is unable to because of, for example invalid BER data.
@@ -100,14 +100,14 @@
* The following rule is used to create the control:
*<ul>
* <li> Use the control factories specified in
- * the <tt>LdapContext.CONTROL_FACTORIES</tt> property of the
+ * the {@code LdapContext.CONTROL_FACTORIES} property of the
* environment, and of the provider resource file associated with
- * <tt>ctx</tt>, in that order.
+ * {@code ctx}, in that order.
* The value of this property is a colon-separated list of factory
* class names that are tried in order, and the first one that succeeds
* in creating the control is the one used.
* If none of the factories can be loaded,
- * return <code>ctl</code>.
+ * return {@code ctl}.
* If an exception is encountered while creating the control, the
* exception is passed up to the caller.
*</ul>
@@ -119,9 +119,9 @@
* @param ctx The possibly null context in which the control is being created.
* If null, no such information is available.
* @param env The possibly null environment of the context. This is used
- * to find the value of the <tt>LdapContext.CONTROL_FACTORIES</tt> property.
- * @return A control object created using <code>ctl</code>; or
- * <code>ctl</code> if a control object cannot be created using
+ * to find the value of the {@code LdapContext.CONTROL_FACTORIES} property.
+ * @return A control object created using {@code ctl}; or
+ * {@code ctl} if a control object cannot be created using
* the algorithm described above.
* @exception NamingException if a naming exception was encountered
* while attempting to create the control object.
@@ -129,7 +129,7 @@
* exception, it is propagated up to the caller.
* If an error was encountered while loading
* and instantiating the factory and object classes, the exception
- * is wrapped inside a <tt>NamingException</tt> and then rethrown.
+ * is wrapped inside a {@code NamingException} and then rethrown.
*/
public static Control getControlInstance(Control ctl, Context ctx,
Hashtable<?,?> env)
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedRequest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedRequest.java Wed Jul 05 20:44:51 2017 +0200
@@ -43,7 +43,7 @@
* the classes that implement this interface, supplying them with
* any information required for a particular extended operation request.
* It would then pass such a class as an argument to the
- * <tt>LdapContext.extendedOperation()</tt> method for performing the
+ * {@code LdapContext.extendedOperation()} method for performing the
* LDAPv3 extended operation.
*<p>
* For example, suppose the LDAP server supported a 'get time' extended operation.
@@ -90,7 +90,7 @@
* Retrieves the object identifier of the request.
*
* @return The non-null object identifier string representing the LDAP
- * <tt>ExtendedRequest.requestName</tt> component.
+ * {@code ExtendedRequest.requestName} component.
*/
public String getID();
@@ -104,7 +104,7 @@
* put into the extended operation to be sent to the LDAP server.
*
* @return A possibly null byte array representing the ASN.1 BER encoded
- * contents of the LDAP <tt>ExtendedRequest.requestValue</tt>
+ * contents of the LDAP {@code ExtendedRequest.requestValue}
* component.
* @exception IllegalStateException If the encoded value cannot be retrieved
* because the request contains insufficient or invalid data/state.
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedResponse.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/ExtendedResponse.java Wed Jul 05 20:44:51 2017 +0200
@@ -78,7 +78,7 @@
* If the server does not send it, the response will contain no ID (i.e. null).
*
* @return A possibly null object identifier string representing the LDAP
- * <tt>ExtendedResponse.responseName</tt> component.
+ * {@code ExtendedResponse.responseName} component.
*/
public String getID();
@@ -90,7 +90,7 @@
* the response value. It does not include the response OID.
*
* @return A possibly null byte array representing the ASN.1 BER encoded
- * contents of the LDAP <tt>ExtendedResponse.response</tt>
+ * contents of the LDAP {@code ExtendedResponse.response}
* component.
*/
public byte[] getEncodedValue();
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/HasControls.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/HasControls.java Wed Jul 05 20:44:51 2017 +0200
@@ -60,10 +60,10 @@
public interface HasControls {
/**
- * Retrieves an array of <tt>Control</tt>s from the object that
+ * Retrieves an array of {@code Control}s from the object that
* implements this interface. It is null if there are no controls.
*
- * @return A possibly null array of <tt>Control</tt> objects.
+ * @return A possibly null array of {@code Control} objects.
* @throws NamingException If cannot return controls due to an error.
*/
public Control[] getControls() throws NamingException;
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/InitialLdapContext.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/InitialLdapContext.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,24 +34,24 @@
* This class is the starting context for performing
* LDAPv3-style extended operations and controls.
*<p>
- * See <tt>javax.naming.InitialContext</tt> and
- * <tt>javax.naming.InitialDirContext</tt> for details on synchronization,
+ * See {@code javax.naming.InitialContext} and
+ * {@code javax.naming.InitialDirContext} for details on synchronization,
* and the policy for how an initial context is created.
*
* <h1>Request Controls</h1>
- * When you create an initial context (<tt>InitialLdapContext</tt>),
+ * When you create an initial context ({@code InitialLdapContext}),
* you can specify a list of request controls.
* These controls will be used as the request controls for any
* implicit LDAP "bind" operation performed by the context or contexts
* derived from the context. These are called <em>connection request controls</em>.
- * Use <tt>getConnectControls()</tt> to get a context's connection request
+ * Use {@code getConnectControls()} to get a context's connection request
* controls.
*<p>
* The request controls supplied to the initial context constructor
* are <em>not</em> used as the context request controls
* for subsequent context operations such as searches and lookups.
* Context request controls are set and updated by using
- * <tt>setRequestControls()</tt>.
+ * {@code setRequestControls()}.
*<p>
* As shown, there can be two different sets of request controls
* associated with a context: connection request controls and context
@@ -67,14 +67,14 @@
* Controls[] respCtls = lctx.getResponseControls();
*</pre></blockquote>
* It specifies first the critical controls for creating the initial context
- * (<tt>critConnCtls</tt>), and then sets the context's request controls
- * (<tt>critModCtls</tt>) for the context operation. If for some reason
- * <tt>lctx</tt> needs to reconnect to the server, it will use
- * <tt>critConnCtls</tt>. See the <tt>LdapContext</tt> interface for
+ * ({@code critConnCtls}), and then sets the context's request controls
+ * ({@code critModCtls}) for the context operation. If for some reason
+ * {@code lctx} needs to reconnect to the server, it will use
+ * {@code critConnCtls}. See the {@code LdapContext} interface for
* more discussion about request controls.
*<p>
* Service provider implementors should read the "Service Provider" section
- * in the <tt>LdapContext</tt> class description for implementation details.
+ * in the {@code LdapContext} class description for implementation details.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -94,7 +94,7 @@
/**
* Constructs an initial context using no environment properties or
* connection request controls.
- * Equivalent to <tt>new InitialLdapContext(null, null)</tt>.
+ * Equivalent to {@code new InitialLdapContext(null, null)}.
*
* @throws NamingException if a naming exception is encountered
*/
@@ -105,15 +105,15 @@
/**
* Constructs an initial context
* using environment properties and connection request controls.
- * See <tt>javax.naming.InitialContext</tt> for a discussion of
+ * See {@code javax.naming.InitialContext} for a discussion of
* environment properties.
*
* <p> This constructor will not modify its parameters or
* save references to them, but may save a clone or copy.
* Caller should not modify mutable keys and values in
- * <tt>environment</tt> after it has been passed to the constructor.
+ * {@code environment} after it has been passed to the constructor.
*
- * <p> <tt>connCtls</tt> is used as the underlying context instance's
+ * <p> {@code connCtls} is used as the underlying context instance's
* connection request controls. See the class description
* for details.
*
@@ -159,7 +159,7 @@
*
* @return The non-null cached initial context.
* @exception NotContextException If the initial context is not an
- * instance of <tt>LdapContext</tt>.
+ * instance of {@code LdapContext}.
* @exception NamingException If a naming exception was encountered.
*/
private LdapContext getDefaultLdapInitCtx() throws NamingException{
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapContext.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapContext.java Wed Jul 05 20:44:51 2017 +0200
@@ -35,7 +35,7 @@
* extended operations.
*
* For applications that do not require such controls or extended
- * operations, the more generic <tt>javax.naming.directory.DirContext</tt>
+ * operations, the more generic {@code javax.naming.directory.DirContext}
* should be used instead.
*
* <h3>Usage Details About Controls</h3>
@@ -44,7 +44,7 @@
* At a high level, this support allows a user
* program to set request controls for LDAP operations that are executed
* in the course of the user program's invocation of
- * <tt>Context</tt>/<tt>DirContext</tt>
+ * {@code Context}/{@code DirContext}
* methods, and read response controls resulting from LDAP operations.
* At the implementation level, there are some details that developers of
* both the user program and service providers need to understand in order
@@ -78,60 +78,60 @@
* <h4>Context Request Controls</h4>
* There are two ways in which a context instance gets its request controls:
* <ol>
- * <li><tt>ldapContext.newInstance(<strong>reqCtls</strong>)</tt>
- * <li><tt>ldapContext.setRequestControls(<strong>reqCtls</strong>)</tt>
+ * <li><code>ldapContext.newInstance(<strong>reqCtls</strong>)</code>
+ * <li><code>ldapContext.setRequestControls(<strong>reqCtls</strong>)</code>
* </ol>
- * where <tt>ldapContext</tt> is an instance of <tt>LdapContext</tt>.
- * Specifying <tt>null</tt> or an empty array for <tt>reqCtls</tt>
+ * where {@code ldapContext} is an instance of {@code LdapContext}.
+ * Specifying {@code null} or an empty array for {@code reqCtls}
* means no request controls.
- * <tt>newInstance()</tt> creates a new instance of a context using
- * <tt>reqCtls</tt>, while <tt>setRequestControls()</tt>
- * updates an existing context instance's request controls to <tt>reqCtls</tt>.
+ * {@code newInstance()} creates a new instance of a context using
+ * {@code reqCtls}, while {@code setRequestControls()}
+ * updates an existing context instance's request controls to {@code reqCtls}.
* <p>
* Unlike environment properties, request controls of a context instance
* <em>are not inherited</em> by context instances that are derived from
- * it. Derived context instances have <tt>null</tt> as their context
+ * it. Derived context instances have {@code null} as their context
* request controls. You must set the request controls of a derived context
- * instance explicitly using <tt>setRequestControls()</tt>.
+ * instance explicitly using {@code setRequestControls()}.
* <p>
* A context instance's request controls are retrieved using
- * the method <tt>getRequestControls()</tt>.
+ * the method {@code getRequestControls()}.
*
* <h4>Connection Request Controls</h4>
* There are three ways in which connection request controls are set:
* <ol>
- * <li><tt>
- * new InitialLdapContext(env, <strong>connCtls</strong>)</tt>
- * <li><tt>refException.getReferralContext(env, <strong>connCtls</strong>)</tt>
- * <li><tt>ldapContext.reconnect(<strong>connCtls</strong>);</tt>
+ * <li><code>
+ * new InitialLdapContext(env, <strong>connCtls</strong>)</code>
+ * <li><code>refException.getReferralContext(env, <strong>connCtls</strong>)</code>
+ * <li><code>ldapContext.reconnect(<strong>connCtls</strong>);</code>
* </ol>
- * where <tt>refException</tt> is an instance of
- * <tt>LdapReferralException</tt>, and <tt>ldapContext</tt> is an
- * instance of <tt>LdapContext</tt>.
- * Specifying <tt>null</tt> or an empty array for <tt>connCtls</tt>
+ * where {@code refException} is an instance of
+ * {@code LdapReferralException}, and {@code ldapContext} is an
+ * instance of {@code LdapContext}.
+ * Specifying {@code null} or an empty array for {@code connCtls}
* means no connection request controls.
* <p>
* Like environment properties, connection request controls of a context
* <em>are inherited</em> by contexts that are derived from it.
* Typically, you initialize the connection request controls using the
- * <tt>InitialLdapContext</tt> constructor or
- * <tt>LdapReferralContext.getReferralContext()</tt>. These connection
+ * {@code InitialLdapContext} constructor or
+ * {@code LdapReferralContext.getReferralContext()}. These connection
* request controls are inherited by contexts that share the same
* connection--that is, contexts derived from the initial or referral
* contexts.
* <p>
- * Use <tt>reconnect()</tt> to change the connection request controls of
+ * Use {@code reconnect()} to change the connection request controls of
* a context.
- * Invoking <tt>ldapContext.reconnect()</tt> affects only the
- * connection used by <tt>ldapContext</tt> and any new contexts instances that are
- * derived form <tt>ldapContext</tt>. Contexts that previously shared the
- * connection with <tt>ldapContext</tt> remain unchanged. That is, a context's
+ * Invoking {@code ldapContext.reconnect()} affects only the
+ * connection used by {@code ldapContext} and any new contexts instances that are
+ * derived form {@code ldapContext}. Contexts that previously shared the
+ * connection with {@code ldapContext} remain unchanged. That is, a context's
* connection request controls must be explicitly changed and is not
* affected by changes to another context's connection request
* controls.
* <p>
* A context instance's connection request controls are retrieved using
- * the method <tt>getConnectControls()</tt>.
+ * the method {@code getConnectControls()}.
*
* <h4>Service Provider Requirements</h4>
*
@@ -145,22 +145,22 @@
*
* <h3>Response Controls</h3>
*
- * The method <tt>LdapContext.getResponseControls()</tt> is used to
+ * The method {@code LdapContext.getResponseControls()} is used to
* retrieve the response controls generated by LDAP operations executed
- * as the result of invoking a <tt>Context</tt>/<tt>DirContext</tt>
+ * as the result of invoking a {@code Context}/{@code DirContext}
* operation. The result is all of the responses controls generated
* by the underlying LDAP operations, including any implicit reconnection.
* To get only the reconnection response controls,
- * use <tt>reconnect()</tt> followed by <tt>getResponseControls()</tt>.
+ * use {@code reconnect()} followed by {@code getResponseControls()}.
*
* <h3>Parameters</h3>
*
- * A <tt>Control[]</tt> array
+ * A {@code Control[]} array
* passed as a parameter to any method is owned by the caller.
* The service provider will not modify the array or keep a reference to it,
- * although it may keep references to the individual <tt>Control</tt> objects
+ * although it may keep references to the individual {@code Control} objects
* in the array.
- * A <tt>Control[]</tt> array returned by any method is immutable, and may
+ * A {@code Control[]} array returned by any method is immutable, and may
* not subsequently be modified by either the caller or the service provider.
*
* @author Rosanna Lee
@@ -207,7 +207,7 @@
* to use for the new context.
* If null, the context is initialized with no request controls.
*
- * @return A non-null <tt>LdapContext</tt> instance.
+ * @return A non-null {@code LdapContext} instance.
* @exception NamingException If an error occurred while creating
* the new instance.
* @see InitialLdapContext
@@ -224,16 +224,16 @@
* the LDAP "bind" operation, or to explicitly connect to the server
* to get response controls returned by the LDAP "bind" operation.
*<p>
- * This method sets this context's <tt>connCtls</tt>
+ * This method sets this context's {@code connCtls}
* to be its new connection request controls. This context's
* context request controls are not affected.
* After this method has been invoked, any subsequent
- * implicit reconnections will be done using <tt>connCtls</tt>.
- * <tt>connCtls</tt> are also used as
+ * implicit reconnections will be done using {@code connCtls}.
+ * {@code connCtls} are also used as
* connection request controls for new context instances derived from this
* context.
* These connection request controls are not
- * affected by <tt>setRequestControls()</tt>.
+ * affected by {@code setRequestControls()}.
*<p>
* Service provider implementors should read the "Service Provider" section
* in the class description for implementation details.
@@ -266,17 +266,17 @@
* caller.
* <p>
* This removes any previous request controls and adds
- * <tt>requestControls</tt>
+ * {@code requestControls}
* for use by subsequent methods invoked on this context.
* This method does not affect this context's connection request controls.
*<p>
- * Note that <tt>requestControls</tt> will be in effect until the next
- * invocation of <tt>setRequestControls()</tt>. You need to explicitly
- * invoke <tt>setRequestControls()</tt> with <tt>null</tt> or an empty
+ * Note that {@code requestControls} will be in effect until the next
+ * invocation of {@code setRequestControls()}. You need to explicitly
+ * invoke {@code setRequestControls()} with {@code null} or an empty
* array to clear the controls if you don't want them to affect the
* context methods any more.
* To check what request controls are in effect for this context, use
- * <tt>getRequestControls()</tt>.
+ * {@code getRequestControls()}.
* @param requestControls The possibly null controls to use. If null, no
* controls are used.
* @exception NamingException If an error occurred while setting the
@@ -312,10 +312,10 @@
*<p>
* When a context method that may return response controls is invoked,
* response controls from the previous method invocation are cleared.
- * <tt>getResponseControls()</tt> returns all of the response controls
+ * {@code getResponseControls()} returns all of the response controls
* generated by LDAP operations used by the context method in the order
* received from the LDAP server.
- * Invoking <tt>getResponseControls()</tt> does not
+ * Invoking {@code getResponseControls()} does not
* clear the response controls. You can call it many times (and get
* back the same controls) until the next context method that may return
* controls is invoked.
@@ -333,7 +333,7 @@
* of the property should be a colon-separated list of the fully
* qualified class names of factory classes that will create a control
* given another control. See
- * <tt>ControlFactory.getControlInstance()</tt> for details.
+ * {@code ControlFactory.getControlInstance()} for details.
* This property may be specified in the environment, a system property,
* or one or more resource files.
*<p>
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapName.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapName.java Wed Jul 05 20:44:51 2017 +0200
@@ -59,7 +59,7 @@
* characters (unescaped) are accepted.
* </ul>
*<p>
- * String names passed to <code>LdapName</code> or returned by it
+ * String names passed to {@code LdapName} or returned by it
* use the full Unicode character set. They may also contain
* characters encoded into UTF-8 with each octet represented by a
* three-character substring such as "\\B4".
@@ -67,7 +67,7 @@
* each octet represented by a single character in the string: the
* meaning would be ambiguous.
*<p>
- * <code>LdapName</code> will properly parse all valid names, but
+ * {@code LdapName} will properly parse all valid names, but
* does not attempt to detect all possible violations when parsing
* invalid names. It is "generous" in accepting invalid names.
* The "validity" of a name is determined ultimately when it
@@ -92,7 +92,7 @@
* empty LDAP name is represented by an empty RDN list.
*<p>
* Concurrent multithreaded read-only access of an instance of
- * <tt>LdapName</tt> need not be synchronized.
+ * {@code LdapName} need not be synchronized.
*<p>
* Unless otherwise noted, the behavior of passing a null argument
* to a constructor or method in this class will cause a
@@ -129,7 +129,7 @@
* The indexing of RDNs in the list follows the numbering of
* RDNs described in the class description.
*
- * @param rdns The non-null list of <tt>Rdn</tt>s forming this LDAP name.
+ * @param rdns The non-null list of {@code Rdn}s forming this LDAP name.
*/
public LdapName(List<Rdn> rdns) {
@@ -240,7 +240,7 @@
* that is returned and vice versa.
* @param posn The 0-based index of the component at which to stop.
* Must be in the range [0,size()].
- * @return An instance of <tt>LdapName</tt> consisting of the
+ * @return An instance of {@code LdapName} consisting of the
* components at indexes in the range [0,posn).
* If posn is zero, an empty LDAP name is returned.
* @exception IndexOutOfBoundsException
@@ -263,7 +263,7 @@
*
* @param posn The 0-based index of the component at which to start.
* Must be in the range [0,size()].
- * @return An instance of <tt>LdapName</tt> consisting of the
+ * @return An instance of {@code LdapName} consisting of the
* components at indexes in the range [posn,size()).
* If posn is equal to size(), an empty LDAP name is
* returned.
@@ -282,13 +282,13 @@
/**
* Determines whether this LDAP name starts with a specified LDAP name
* prefix.
- * A name <tt>n</tt> is a prefix if it is equal to
- * <tt>getPrefix(n.size())</tt>--in other words this LDAP
+ * A name {@code n} is a prefix if it is equal to
+ * {@code getPrefix(n.size())}--in other words this LDAP
* name starts with 'n'. If n is null or not a RFC2253 formatted name
* as described in the class description, false is returned.
*
* @param n The LDAP name to check.
- * @return true if <tt>n</tt> is a prefix of this LDAP name,
+ * @return true if {@code n} is a prefix of this LDAP name,
* false otherwise.
* @see #getPrefix(int posn)
*/
@@ -309,8 +309,8 @@
* getRdn(p) matches rdns.get(p). Returns false otherwise. If rdns is
* null, false is returned.
*
- * @param rdns The sequence of <tt>Rdn</tt>s to check.
- * @return true if <tt>rdns</tt> form a prefix of this LDAP name,
+ * @param rdns The sequence of {@code Rdn}s to check.
+ * @return true if {@code rdns} form a prefix of this LDAP name,
* false otherwise.
*/
public boolean startsWith(List<Rdn> rdns) {
@@ -326,13 +326,13 @@
/**
* Determines whether this LDAP name ends with a specified
* LDAP name suffix.
- * A name <tt>n</tt> is a suffix if it is equal to
- * <tt>getSuffix(size()-n.size())</tt>--in other words this LDAP
+ * A name {@code n} is a suffix if it is equal to
+ * {@code getSuffix(size()-n.size())}--in other words this LDAP
* name ends with 'n'. If n is null or not a RFC2253 formatted name
* as described in the class description, false is returned.
*
* @param n The LDAP name to check.
- * @return true if <tt>n</tt> is a suffix of this name, false otherwise.
+ * @return true if {@code n} is a suffix of this name, false otherwise.
* @see #getSuffix(int posn)
*/
public boolean endsWith(Name n) {
@@ -352,8 +352,8 @@
* the component getRdn(p) matches rdns.get(p). Returns false otherwise.
* If rdns is null, false is returned.
*
- * @param rdns The sequence of <tt>Rdn</tt>s to check.
- * @return true if <tt>rdns</tt> form a suffix of this LDAP name,
+ * @param rdns The sequence of {@code Rdn}s to check.
+ * @return true if {@code rdns} form a suffix of this LDAP name,
* false otherwise.
*/
public boolean endsWith(List<Rdn> rdns) {
@@ -409,7 +409,7 @@
* @param suffix The non-null components to add.
* @return The updated name (not a new instance).
*
- * @throws InvalidNameException if <tt>suffix</tt> is not a valid LDAP
+ * @throws InvalidNameException if {@code suffix} is not a valid LDAP
* name, or if the addition of the components would violate the
* syntax rules of this LDAP name.
*/
@@ -421,7 +421,7 @@
/**
* Adds the RDNs of a name -- in order -- to the end of this name.
*
- * @param suffixRdns The non-null suffix <tt>Rdn</tt>s to add.
+ * @param suffixRdns The non-null suffix {@code Rdn}s to add.
* @return The updated name (not a new instance).
*/
public Name addAll(List<Rdn> suffixRdns) {
@@ -440,7 +440,7 @@
*
* @return The updated name (not a new instance).
*
- * @throws InvalidNameException if <tt>suffix</tt> is not a valid LDAP
+ * @throws InvalidNameException if {@code suffix} is not a valid LDAP
* name, or if the addition of the components would violate the
* syntax rules of this LDAP name.
* @throws IndexOutOfBoundsException
@@ -469,7 +469,7 @@
* index (if any) of the first new RDN are shifted up (away from index 0) to
* accommodate the new RDNs.
*
- * @param suffixRdns The non-null suffix <tt>Rdn</tt>s to add.
+ * @param suffixRdns The non-null suffix {@code Rdn}s to add.
* @param posn The index at which to add the suffix RDNs.
* Must be in the range [0,size()].
*
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapReferralException.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/LdapReferralException.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,15 +32,15 @@
/**
* This abstract class is used to represent an LDAP referral exception.
- * It extends the base <tt>ReferralException</tt> by providing a
- * <tt>getReferralContext()</tt> method that accepts request controls.
+ * It extends the base {@code ReferralException} by providing a
+ * {@code getReferralContext()} method that accepts request controls.
* LdapReferralException is an abstract class. Concrete implementations of it
* determine its synchronization and serialization properties.
*<p>
- * A <tt>Control[]</tt> array passed as a parameter to
- * the <tt>getReferralContext()</tt> method is owned by the caller.
+ * A {@code Control[]} array passed as a parameter to
+ * the {@code getReferralContext()} method is owned by the caller.
* The service provider will not modify the array or keep a reference to it,
- * although it may keep references to the individual <tt>Control</tt> objects
+ * although it may keep references to the individual {@code Control} objects
* in the array.
*
* @author Rosanna Lee
@@ -73,20 +73,20 @@
* Retrieves the context at which to continue the method using the
* context's environment and no controls.
* The referral context is created using the environment properties of
- * the context that threw the <tt>ReferralException</tt> and no controls.
+ * the context that threw the {@code ReferralException} and no controls.
*<p>
* This method is equivalent to
*<blockquote><pre>
* getReferralContext(ctx.getEnvironment(), null);
*</pre></blockquote>
- * where <tt>ctx</tt> is the context that threw the <tt>ReferralException.</tt>
+ * where {@code ctx} is the context that threw the {@code ReferralException.}
*<p>
* It is overridden in this class for documentation purposes only.
- * See <tt>ReferralException</tt> for how to use this method.
+ * See {@code ReferralException} for how to use this method.
*
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context getReferralContext() throws NamingException;
@@ -94,7 +94,7 @@
/**
* Retrieves the context at which to continue the method using
* environment properties and no controls.
- * The referral context is created using <tt>env</tt> as its environment
+ * The referral context is created using {@code env} as its environment
* properties and no controls.
*<p>
* This method is equivalent to
@@ -103,14 +103,14 @@
*</pre></blockquote>
*<p>
* It is overridden in this class for documentation purposes only.
- * See <tt>ReferralException</tt> for how to use this method.
+ * See {@code ReferralException} for how to use this method.
*
* @param env The possibly null environment to use when retrieving the
* referral context. If null, no environment properties will be used.
*
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context
@@ -127,12 +127,12 @@
* To continue the operation, the client program should re-invoke
* the method using the same arguments as the original invocation.
*<p>
- * <tt>reqCtls</tt> is used when creating the connection to the referred
+ * {@code reqCtls} is used when creating the connection to the referred
* server. These controls will be used as the connection request controls for
* the context and context instances
* derived from the context.
- * <tt>reqCtls</tt> will also be the context's request controls for
- * subsequent context operations. See the <tt>LdapContext</tt> class
+ * {@code reqCtls} will also be the context's request controls for
+ * subsequent context operations. See the {@code LdapContext} class
* description for details.
*<p>
* This method should be used instead of the other two overloaded forms
@@ -141,7 +141,7 @@
* it needs to supply special controls relating to authentication.
*<p>
* Service provider implementors should read the "Service Provider" section
- * in the <tt>LdapContext</tt> class description for implementation details.
+ * in the {@code LdapContext} class description for implementation details.
*
* @param reqCtls The possibly null request controls to use for the new context.
* If null or the empty array means use no request controls.
@@ -150,7 +150,7 @@
* properties.
* @return The non-null context at which to continue the method.
* @exception NamingException If a naming exception was encountered.
- * Call either <tt>retryReferral()</tt> or <tt>skipReferral()</tt>
+ * Call either {@code retryReferral()} or {@code skipReferral()}
* to continue processing referrals.
*/
public abstract Context
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/Rdn.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/Rdn.java Wed Jul 05 20:44:51 2017 +0200
@@ -50,7 +50,7 @@
* An example of an RDN is "OU=Sales+CN=J.Smith". In this example,
* the RDN consist of multiple attribute type/value pairs. The
* RDN is parsed as described in the class description for
- * {@link javax.naming.ldap.LdapName <tt>LdapName</tt>}.
+ * {@link javax.naming.ldap.LdapName LdapName}.
* <p>
* The Rdn class represents an RDN as attribute type/value mappings,
* which can be viewed using
@@ -79,11 +79,11 @@
* Rdn rdn = new Rdn("cn", "Juicy, Fruit");
* System.out.println(rdn.toString());
* </pre>
- * The last line will print <tt>cn=Juicy\, Fruit</tt>. The
- * {@link #unescapeValue(String) <tt>unescapeValue()</tt>} method can be
+ * The last line will print {@code cn=Juicy\, Fruit}. The
+ * {@link #unescapeValue(String) unescapeValue()} method can be
* used to unescape the escaped comma resulting in the original
- * value <tt>"Juicy, Fruit"</tt>. The {@link #escapeValue(Object)
- * <tt>escapeValue()</tt>} method adds the escape back preceding the comma.
+ * value {@code "Juicy, Fruit"}. The {@link #escapeValue(Object)
+ * escapeValue()} method adds the escape back preceding the comma.
* <p>
* This class can be instantiated by a string representation
* of the RDN defined in RFC 2253 as shown in the following code example:
@@ -91,10 +91,10 @@
* Rdn rdn = new Rdn("cn=Juicy\\, Fruit");
* System.out.println(rdn.toString());
* </pre>
- * The last line will print <tt>cn=Juicy\, Fruit</tt>.
+ * The last line will print {@code cn=Juicy\, Fruit}.
* <p>
* Concurrent multithreaded read-only access of an instance of
- * <tt>Rdn</tt> need not be synchronized.
+ * {@code Rdn} need not be synchronized.
* <p>
* Unless otherwise noted, the behavior of passing a null argument
* to a constructor or method in this class will cause NullPointerException
@@ -123,7 +123,7 @@
*
* @param attrSet The non-null and non-empty attributes containing
* type/value mappings.
- * @throws InvalidNameException If contents of <tt>attrSet</tt> cannot
+ * @throws InvalidNameException If contents of {@code attrSet} cannot
* be used to construct a valid RDN.
*/
public Rdn(Attributes attrSet) throws InvalidNameException {
@@ -166,8 +166,8 @@
}
/**
- * Constructs an Rdn from the given <tt>rdn</tt>.
- * The contents of the <tt>rdn</tt> are simply copied into the newly
+ * Constructs an Rdn from the given {@code rdn}.
+ * The contents of the {@code rdn} are simply copied into the newly
* created Rdn.
* @param rdn The non-null Rdn to be copied.
*/
@@ -583,7 +583,7 @@
* This method is generous in accepting the values and does not
* catch all illegal values.
* Therefore, passing in an illegal value might not necessarily
- * trigger an <tt>IllegalArgumentException</tt>.
+ * trigger an {@code IllegalArgumentException}.
*
* @param val The non-null string to be unescaped.
* @return Unescaped value.
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsRequest.java Wed Jul 05 20:44:51 2017 +0200
@@ -43,9 +43,9 @@
* The object identifier for StartTLS is 1.3.6.1.4.1.1466.20037
* and no extended request value is defined.
*<p>
- * <tt>StartTlsRequest</tt>/<tt>StartTlsResponse</tt> are used to establish
+ * {@code StartTlsRequest}/{@code StartTlsResponse} are used to establish
* a TLS connection over the existing LDAP connection associated with
- * the JNDI context on which <tt>extendedOperation()</tt> is invoked.
+ * the JNDI context on which {@code extendedOperation()} is invoked.
* Typically, a JNDI program uses these classes as follows.
* <blockquote><pre>
* import javax.naming.ldap.*;
@@ -127,16 +127,16 @@
* <p>
* This method locates the implementation class by locating
* configuration files that have the name:
- * <blockquote><tt>
+ * <blockquote>{@code
* META-INF/services/javax.naming.ldap.StartTlsResponse
- * </tt></blockquote>
+ * }</blockquote>
* The configuration files and their corresponding implementation classes must
* be accessible to the calling thread's context class loader.
* <p>
* Each configuration file should contain a list of fully-qualified class
* names, one per line. Space and tab characters surrounding each name, as
- * well as blank lines, are ignored. The comment character is <tt>'#'</tt>
- * (<tt>0x23</tt>); on each line all characters following the first comment
+ * well as blank lines, are ignored. The comment character is {@code '#'}
+ * ({@code 0x23}); on each line all characters following the first comment
* character are ignored. The file must be encoded in UTF-8.
* <p>
* This method will return an instance of the first implementation
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsResponse.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/StartTlsResponse.java Wed Jul 05 20:44:51 2017 +0200
@@ -42,7 +42,7 @@
*<p>
* The Start TLS extended request and response are used to establish
* a TLS connection over the existing LDAP connection associated with
- * the JNDI context on which <tt>extendedOperation()</tt> is invoked.
+ * the JNDI context on which {@code extendedOperation()} is invoked.
* Typically, a JNDI program uses the StartTLS extended request and response
* classes as follows.
* <blockquote><pre>
@@ -122,7 +122,7 @@
/**
* Overrides the default list of cipher suites enabled for use on the
* TLS connection. The cipher suites must have already been listed by
- * <tt>SSLSocketFactory.getSupportedCipherSuites()</tt> as being supported.
+ * {@code SSLSocketFactory.getSupportedCipherSuites()} as being supported.
* Even if a suite has been enabled, it still might not be used because
* the peer does not support it, or because the requisite certificates
* (and private keys) are not available.
@@ -134,13 +134,13 @@
public abstract void setEnabledCipherSuites(String[] suites);
/**
- * Sets the hostname verifier used by <tt>negotiate()</tt>
+ * Sets the hostname verifier used by {@code negotiate()}
* after the TLS handshake has completed and the default hostname
* verification has failed.
- * <tt>setHostnameVerifier()</tt> must be called before
- * <tt>negotiate()</tt> is invoked for it to have effect.
+ * {@code setHostnameVerifier()} must be called before
+ * {@code negotiate()} is invoked for it to have effect.
* If called after
- * <tt>negotiate()</tt>, this method does not do anything.
+ * {@code negotiate()}, this method does not do anything.
*
* @param verifier The non-null hostname verifier callback.
* @see #negotiate
@@ -150,7 +150,7 @@
/**
* Negotiates a TLS session using the default SSL socket factory.
* <p>
- * This method is equivalent to <tt>negotiate(null)</tt>.
+ * This method is equivalent to {@code negotiate(null)}.
*
* @return The negotiated SSL session
* @throws IOException If an IO error was encountered while establishing
@@ -167,16 +167,16 @@
* attaches it to the existing connection. Performs the TLS handshake
* and returns the negotiated session information.
* <p>
- * If cipher suites have been set via <tt>setEnabledCipherSuites</tt>
+ * If cipher suites have been set via {@code setEnabledCipherSuites}
* then they are enabled before the TLS handshake begins.
* <p>
* Hostname verification is performed after the TLS handshake completes.
* The default hostname verification performs a match of the server's
* hostname against the hostname information found in the server's certificate.
* If this verification fails and no callback has been set via
- * <tt>setHostnameVerifier</tt> then the negotiation fails.
+ * {@code setHostnameVerifier} then the negotiation fails.
* If this verification fails and a callback has been set via
- * <tt>setHostnameVerifier</tt>, then the callback is used to determine whether
+ * {@code setHostnameVerifier}, then the callback is used to determine whether
* the negotiation succeeds.
* <p>
* If an error occurs then the SSL socket is closed and an IOException
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotification.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotification.java Wed Jul 05 20:44:51 2017 +0200
@@ -32,7 +32,7 @@
* <A HREF="http://www.ietf.org/rfc/rfc2251.txt">RFC 2251</A>.
* An unsolicited notification is sent by the LDAP server to the LDAP
* client without any provocation from the client.
- * Its format is that of an extended response (<tt>ExtendedResponse</tt>).
+ * Its format is that of an extended response ({@code ExtendedResponse}).
*
* @author Rosanna Lee
* @author Scott Seligman
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationEvent.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationEvent.java Wed Jul 05 20:44:51 2017 +0200
@@ -49,7 +49,7 @@
private UnsolicitedNotification notice;
/**
- * Constructs a new instance of <tt>UnsolicitedNotificationEvent</tt>.
+ * Constructs a new instance of {@code UnsolicitedNotificationEvent}.
*
* @param src The non-null source that fired the event.
* @param notice The non-null unsolicited notification.
@@ -71,10 +71,10 @@
}
/**
- * Invokes the <tt>notificationReceived()</tt> method on
+ * Invokes the {@code notificationReceived()} method on
* a listener using this event.
* @param listener The non-null listener on which to invoke
- * <tt>notificationReceived</tt>.
+ * {@code notificationReceived}.
*/
public void dispatch(UnsolicitedNotificationListener listener) {
listener.notificationReceived(this);
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationListener.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/UnsolicitedNotificationListener.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,20 +28,20 @@
import javax.naming.event.NamingListener;
/**
- * This interface is for handling <tt>UnsolicitedNotificationEvent</tt>.
+ * This interface is for handling {@code UnsolicitedNotificationEvent}.
* "Unsolicited notification" is defined in
* <A HREF="http://www.ietf.org/rfc/rfc2251.txt">RFC 2251</A>.
* It allows the server to send unsolicited notifications to the client.
- * A <tt>UnsolicitedNotificationListener</tt> must:
+ * A {@code UnsolicitedNotificationListener} must:
*<ol>
* <li>Implement this interface and its method
- * <li>Implement <tt>NamingListener.namingExceptionThrown()</tt> so
+ * <li>Implement {@code NamingListener.namingExceptionThrown()} so
* that it will be notified of exceptions thrown while attempting to
* collect unsolicited notification events.
- * <li>Register with the context using one of the <tt>addNamingListener()</tt>
- * methods from <tt>EventContext</tt> or <tt>EventDirContext</tt>.
- * Only the <tt>NamingListener</tt> argument of these methods are applicable;
- * the rest are ignored for a <tt>UnsolicitedNotificationListener</tt>.
+ * <li>Register with the context using one of the {@code addNamingListener()}
+ * methods from {@code EventContext} or {@code EventDirContext}.
+ * Only the {@code NamingListener} argument of these methods are applicable;
+ * the rest are ignored for a {@code UnsolicitedNotificationListener}.
* (These arguments might be applicable to the listener if it implements
* other listener interfaces).
*</ol>
--- a/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/ldap/package.html Wed Jul 05 20:44:51 2017 +0200
@@ -44,15 +44,15 @@
This package is for applications and service providers that deal with
LDAPv3 extended operations and controls, as defined by
<a href=http://www.ietf.org/rfc/rfc2251.txt>RFC 2251</a>.
-The core interface in this package is <tt>LdapContext</tt>, which defines
+The core interface in this package is <code>LdapContext</code>, which defines
methods on a context for performing extended operations and handling
controls.
<h4>Extended Operations</h4>
<p>
-This package defines the interface <tt>ExtendedRequest</tt>
+This package defines the interface <code>ExtendedRequest</code>
to represent the argument to an extended operation,
-and the interface <tt>ExtendedResponse</tt> to represent the result
+and the interface <code>ExtendedResponse</code> to represent the result
of the extended operation.
An extended response is always paired with an extended request
but not necessarily vice versa. That is, you can have an extended request
@@ -73,7 +73,7 @@
<p>
For example, suppose an LDAP server supports a "get time" extended operation.
It would supply classes such as
-<tt>GetTimeRequest</tt> and <tt>GetTimeResponse</tt>,
+<code>GetTimeRequest</code> and <code>GetTimeResponse</code>,
so that applications can use this feature.
An application would use these classes as follows:
<blockquote><pre>
@@ -82,7 +82,7 @@
long time = resp.getTime();
</pre></blockquote>
<p>
-The <tt>GetTimeRequest</tt> and <tt>GetTimeResponse</tt> classes might
+The <code>GetTimeRequest</code> and <code>GetTimeResponse</code> classes might
be defined as follows:
<blockquote><pre>
public class GetTimeRequest implements ExtendedRequest {
@@ -105,7 +105,7 @@
public class GetTimeResponse() implements ExtendedResponse {
long time;
// called by GetTimeRequest.createExtendedResponse()
- public GetTimeResponse(String id, byte[] berValue, int offset, int length)
+ public GetTimeResponse(String id, byte[] berValue, int offset, int length)
throws NamingException {
// check validity of id
long time = ... // decode berValue to get time
@@ -127,7 +127,7 @@
<h4>Controls</h4>
-This package defines the interface <tt>Control</tt> to represent an LDAPv3
+This package defines the interface <code>Control</code> to represent an LDAPv3
control. It can be a control that is sent to an LDAP server
(<em>request control</em>) or a control returned by an LDAP server
(<em>response control</em>). Unlike extended requests and responses,
@@ -149,8 +149,8 @@
<p>
For example, suppose an LDAP server supports a "signed results"
request control, which when sent with a request, asks the
-server to digitally sign the results of an operation.
-It would supply a class <tt>SignedResultsControl</tt> so that applications
+server to digitally sign the results of an operation.
+It would supply a class <code>SignedResultsControl</code> so that applications
can use this feature.
An application would use this class as follows:
<blockquote>
@@ -160,7 +160,7 @@
NamingEnumeration enum = ectx.search(...);
</pre>
</blockquote>
-The <tt>SignedResultsControl</tt> class might be defined as follows:
+The <code>SignedResultsControl</code> class might be defined as follows:
<blockquote><pre>
public class SignedResultsControl implements Control {
// User-friendly constructor
@@ -180,19 +180,19 @@
</pre></blockquote>
<p>
When a service provider receives response controls, it uses
-the <tt>ControlFactory</tt> class to produce specific classes
-that implement the <tt>Control</tt> interface.
+the <code>ControlFactory</code> class to produce specific classes
+that implement the <code>Control</code> interface.
<p>
An LDAP server can send back response controls with an LDAP operation
and also with enumeration results, such as those returned
by a list or search operation.
-The <tt>LdapContext</tt> provides a method (<tt>getResponseControls()</tt>)
+The <code>LdapContext</code> provides a method (<code>getResponseControls()</code>)
for getting the response controls sent with an LDAP operation,
-while the <tt>HasControls</tt> interface is used to retrieve
+while the <code>HasControls</code> interface is used to retrieve
response controls associated with enumeration results.
<p>
For example, suppose an LDAP server sends back a "change ID" control in response
-to a successful modification. It would supply a class <tt>ChangeIDControl</tt>
+to a successful modification. It would supply a class <code>ChangeIDControl</code>
so that the application can use this feature.
An application would perform an update, and then try to get the change ID.
<blockquote><pre>
@@ -211,8 +211,8 @@
}
}
</pre></blockquote>
-The vendor might supply the following <tt>ChangeIDControl</tt> and
-<tt>VendorXControlFactory</tt> classes. The <tt>VendorXControlFactory</tt>
+The vendor might supply the following <code>ChangeIDControl</code> and
+<code>VendorXControlFactory</code> classes. The <code>VendorXControlFactory</code>
will be used by the service provider when the provider receives response
controls from the LDAP server.
<blockquote><pre>
@@ -245,7 +245,7 @@
public Control getControlInstance(Control orig) throws NamingException {
if (isOneOfMyControls(orig.getID())) {
- ...
+ ...
// determine which of ours it is and call its constructor
return (new ChangeIDControl(orig.getID(), orig.getEncodedValue()));
--- a/jdk/src/java.naming/share/classes/javax/naming/package.html Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/package.html Wed Jul 05 20:44:51 2017 +0200
@@ -43,13 +43,13 @@
<h4>Context</h4>
<p>
This package defines the notion of a <em>context</em>, represented
-by the <tt>Context</tt> interface.
+by the <code>Context</code> interface.
A context consists of a set of name-to-object <em>bindings</em>.
-<tt>Context</tt> is the core interface for looking up, binding, unbinding,
+<code>Context</code> is the core interface for looking up, binding, unbinding,
and renaming objects, and for creating and destroying subcontexts.
<p>
-<tt>lookup()</tt> is the most commonly used operation.
-You supply <tt>lookup()</tt>
+<code>lookup()</code> is the most commonly used operation.
+You supply <code>lookup()</code>
the name of the object you want
to look up, and it returns the object bound to that name.
For example, the following code fragment looks up
@@ -65,17 +65,17 @@
<h4>Names</h4>
<p>
-Every naming method in the <tt>Context</tt>
+Every naming method in the <code>Context</code>
interface has two
overloads: one that accepts a
-<tt>Name</tt> argument and one that accepts a string name.
-<tt>Name</tt> is an interface that represents a generic
+<code>Name</code> argument and one that accepts a string name.
+<code>Name</code> is an interface that represents a generic
name--an ordered sequence of zero of more components.
-For these methods, <tt>Name</tt> can be used to represent a
-<em>composite name</em> (<tt>CompositeName</tt>)
+For these methods, <code>Name</code> can be used to represent a
+<em>composite name</em> (<code>CompositeName</code>)
so that you can name an object using a name which spans multiple namespaces.
<p>
-The overloads that accept <tt>Name</tt>
+The overloads that accept <code>Name</code>
are useful for applications that need to manipulate names: composing
them, comparing components, and so on.
The overloads that accept string names are likely to be more useful
@@ -84,14 +84,14 @@
<h4>Bindings</h4>
-The <tt>Binding</tt> class represents a name-to-object binding.
+The <code>Binding</code> class represents a name-to-object binding.
It is a tuple containing the name of the bound object,
the name of the object's class, and the object itself.
<p>
-The <tt>Binding</tt> class is actually a subclass of
-<tt>NameClassPair</tt>, which consists
+The <code>Binding</code> class is actually a subclass of
+<code>NameClassPair</code>, which consists
simply of the object's name and the object's class name.
-The <tt>NameClassPair</tt> is useful when you only want
+The <code>NameClassPair</code> is useful when you only want
information about the object's class and do not want to
pay the extra cost of getting the object.
@@ -104,7 +104,7 @@
objects in the directory, Java programs are but one group of applications
that access them. In this case, a serialized Java object might
not be the most appropriate representation.
-JNDI defines a <em>reference</em>, represented by the <tt>Reference</tt>
+JNDI defines a <em>reference</em>, represented by the <code>Reference</code>
class, which contains information on how to construct a copy of the object.
JNDI will attempt to turn references looked up from the directory
into the Java objects they represent, so that
@@ -117,7 +117,7 @@
In JNDI, all naming and directory operations are performed relative
to a context. There are no absolute roots.
Therefore JNDI defines an <em>initial context</em>,
-<tt>InitialContext</tt>,
+<code>InitialContext</code>,
which provides a starting point for naming and directory operations.
Once you have an initial context, you can use it to
look up other contexts and objects.
@@ -126,10 +126,10 @@
JNDI defines a class hierarchy for exceptions that can be thrown in
the course of performing naming and directory operations. The root of
-this class hierarchy is <tt>NamingException</tt>.
+this class hierarchy is <code>NamingException</code>.
Programs interested in dealing with a particular exception
can catch the corresponding subclass of the exception.
-Otherwise, programs should catch <tt>NamingException</tt>.
+Otherwise, programs should catch <code>NamingException</code>.
<h2>Package Specification</h2>
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/DirObjectFactory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/DirObjectFactory.java Wed Jul 05 20:44:51 2017 +0200
@@ -35,12 +35,12 @@
*<p>
* The JNDI framework allows for object implementations to
* be loaded in dynamically via <em>object factories</em>. See
- * <tt>ObjectFactory</tt> for details.
+ * {@code ObjectFactory} for details.
* <p>
- * A <tt>DirObjectFactory</tt> extends <tt>ObjectFactory</tt> by allowing
- * an <tt>Attributes</tt> instance
- * to be supplied to the <tt>getObjectInstance()</tt> method.
- * <tt>DirObjectFactory</tt> implementations are intended to be used by <tt>DirContext</tt>
+ * A {@code DirObjectFactory} extends {@code ObjectFactory} by allowing
+ * an {@code Attributes} instance
+ * to be supplied to the {@code getObjectInstance()} method.
+ * {@code DirObjectFactory} implementations are intended to be used by {@code DirContext}
* service providers. The service provider, in addition reading an
* object from the directory, might already have attributes that
* are useful for the object factory to check to see whether the
@@ -71,34 +71,34 @@
* An example of such an environment property is user identity
* information.
*<p>
- * <tt>DirectoryManager.getObjectInstance()</tt>
- * successively loads in object factories. If it encounters a <tt>DirObjectFactory</tt>,
- * it will invoke <tt>DirObjectFactory.getObjectInstance()</tt>;
+ * {@code DirectoryManager.getObjectInstance()}
+ * successively loads in object factories. If it encounters a {@code DirObjectFactory},
+ * it will invoke {@code DirObjectFactory.getObjectInstance()};
* otherwise, it invokes
- * <tt>ObjectFactory.getObjectInstance()</tt>. It does this until a factory
+ * {@code ObjectFactory.getObjectInstance()}. It does this until a factory
* produces a non-null answer.
* <p> When an exception
* is thrown by an object factory, the exception is passed on to the caller
- * of <tt>DirectoryManager.getObjectInstance()</tt>. The search for other factories
+ * of {@code DirectoryManager.getObjectInstance()}. The search for other factories
* that may produce a non-null answer is halted.
* An object factory should only throw an exception if it is sure that
* it is the only intended factory and that no other object factories
* should be tried.
* If this factory cannot create an object using the arguments supplied,
* it should return null.
- *<p>Since <tt>DirObjectFactory</tt> extends <tt>ObjectFactory</tt>, it
+ *<p>Since {@code DirObjectFactory} extends {@code ObjectFactory}, it
* effectively
- * has two <tt>getObjectInstance()</tt> methods, where one differs from the other by
- * the attributes argument. Given a factory that implements <tt>DirObjectFactory</tt>,
- * <tt>DirectoryManager.getObjectInstance()</tt> will only
+ * has two {@code getObjectInstance()} methods, where one differs from the other by
+ * the attributes argument. Given a factory that implements {@code DirObjectFactory},
+ * {@code DirectoryManager.getObjectInstance()} will only
* use the method that accepts the attributes argument, while
- * <tt>NamingManager.getObjectInstance()</tt> will only use the one that does not accept
+ * {@code NamingManager.getObjectInstance()} will only use the one that does not accept
* the attributes argument.
*<p>
- * See <tt>ObjectFactory</tt> for a description URL context factories and other
- * properties of object factories that apply equally to <tt>DirObjectFactory</tt>.
+ * See {@code ObjectFactory} for a description URL context factories and other
+ * properties of object factories that apply equally to {@code DirObjectFactory}.
*<p>
- * The <tt>name</tt>, <tt>attrs</tt>, and <tt>environment</tt> parameters
+ * The {@code name}, {@code attrs}, and {@code environment} parameters
* are owned by the caller.
* The implementation will not modify these objects or keep references
* to them, although it may keep references to clones or copies.
@@ -112,10 +112,10 @@
* relative to the default initial context.
* @param environment The possibly null environment that is used in
* creating the object.
- * @param attrs The possibly null attributes containing some of <tt>obj</tt>'s
- * attributes. <tt>attrs</tt> might not necessarily have all of <tt>obj</tt>'s
+ * @param attrs The possibly null attributes containing some of {@code obj}'s
+ * attributes. {@code attrs} might not necessarily have all of {@code obj}'s
* attributes. If the object factory requires more attributes, it needs
- * to get it, either using <tt>obj</tt>, or <tt>name</tt> and <tt>nameCtx</tt>.
+ * to get it, either using {@code obj}, or {@code name} and {@code nameCtx}.
* The factory must not modify attrs.
* @return The object created; null if an object cannot be created.
* @exception Exception If this object factory encountered an exception
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/DirStateFactory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/DirStateFactory.java Wed Jul 05 20:44:51 2017 +0200
@@ -33,17 +33,17 @@
* object and corresponding attributes for binding.
*<p>
* The JNDI framework allows for object implementations to
- * be loaded in dynamically via <tt>object factories</tt>.
+ * be loaded in dynamically via {@code object factories}.
* <p>
- * A <tt>DirStateFactory</tt> extends <tt>StateFactory</tt>
- * by allowing an <tt>Attributes</tt> instance
- * to be supplied to and be returned by the <tt>getStateToBind()</tt> method.
- * <tt>DirStateFactory</tt> implementations are intended to be used by
- * <tt>DirContext</tt> service providers.
- * When a caller binds an object using <tt>DirContext.bind()</tt>,
+ * A {@code DirStateFactory} extends {@code StateFactory}
+ * by allowing an {@code Attributes} instance
+ * to be supplied to and be returned by the {@code getStateToBind()} method.
+ * {@code DirStateFactory} implementations are intended to be used by
+ * {@code DirContext} service providers.
+ * When a caller binds an object using {@code DirContext.bind()},
* he might also specify a set of attributes to be bound with the object.
* The object and attributes to be bound are passed to
- * the <tt>getStateToBind()</tt> method of a factory.
+ * the {@code getStateToBind()} method of a factory.
* If the factory processes the object and attributes, it returns
* a corresponding pair of object and attributes to be bound.
* If the factory does not process the object, it must return null.
@@ -53,23 +53,23 @@
*<blockquote><pre>
* ctx.rebind("inky", printer, printerAttrs);
*</pre></blockquote>
- * An LDAP service provider for <tt>ctx</tt> uses a <tt>DirStateFactory</tt>
- * (indirectly via <tt>DirectoryManager.getStateToBind()</tt>)
- * and gives it <tt>printer</tt> and <tt>printerAttrs</tt>. A factory for
- * an LDAP directory might turn <tt>printer</tt> into a set of attributes
- * and merge that with <tt>printerAttrs</tt>. The service provider then
+ * An LDAP service provider for {@code ctx} uses a {@code DirStateFactory}
+ * (indirectly via {@code DirectoryManager.getStateToBind()})
+ * and gives it {@code printer} and {@code printerAttrs}. A factory for
+ * an LDAP directory might turn {@code printer} into a set of attributes
+ * and merge that with {@code printerAttrs}. The service provider then
* uses the resulting attributes to create an LDAP entry and updates
* the directory.
*
- * <p> Since <tt>DirStateFactory</tt> extends <tt>StateFactory</tt>, it
- * has two <tt>getStateToBind()</tt> methods, where one
+ * <p> Since {@code DirStateFactory} extends {@code StateFactory}, it
+ * has two {@code getStateToBind()} methods, where one
* differs from the other by the attributes
- * argument. <tt>DirectoryManager.getStateToBind()</tt> will only use
+ * argument. {@code DirectoryManager.getStateToBind()} will only use
* the form that accepts the attributes argument, while
- * <tt>NamingManager.getStateToBind()</tt> will only use the form that
+ * {@code NamingManager.getStateToBind()} will only use the form that
* does not accept the attributes argument.
*
- * <p> Either form of the <tt>getStateToBind()</tt> method of a
+ * <p> Either form of the {@code getStateToBind()} method of a
* DirStateFactory may be invoked multiple times, possibly using different
* parameters. The implementation is thread-safe.
*
@@ -85,15 +85,15 @@
* Retrieves the state of an object for binding given the object and attributes
* to be transformed.
*<p>
- * <tt>DirectoryManager.getStateToBind()</tt>
+ * {@code DirectoryManager.getStateToBind()}
* successively loads in state factories. If a factory implements
- * <tt>DirStateFactory</tt>, <tt>DirectoryManager</tt> invokes this method;
- * otherwise, it invokes <tt>StateFactory.getStateToBind()</tt>.
+ * {@code DirStateFactory}, {@code DirectoryManager} invokes this method;
+ * otherwise, it invokes {@code StateFactory.getStateToBind()}.
* It does this until a factory produces a non-null answer.
*<p>
* When an exception is thrown by a factory,
* the exception is passed on to the caller
- * of <tt>DirectoryManager.getStateToBind()</tt>. The search for other factories
+ * of {@code DirectoryManager.getStateToBind()}. The search for other factories
* that may produce a non-null answer is halted.
* A factory should only throw an exception if it is sure that
* it is the only intended factory and that no other factories
@@ -101,36 +101,36 @@
* If this factory cannot create an object using the arguments supplied,
* it should return null.
* <p>
- * The <code>name</code> and <code>nameCtx</code> parameters may
+ * The {@code name} and {@code nameCtx} parameters may
* optionally be used to specify the name of the object being created.
* See the description of "Name and Context Parameters" in
* {@link ObjectFactory#getObjectInstance ObjectFactory.getObjectInstance()}
* for details.
- * If a factory uses <code>nameCtx</code> it should synchronize its use
+ * If a factory uses {@code nameCtx} it should synchronize its use
* against concurrent access, since context implementations are not
* guaranteed to be thread-safe.
*<p>
- * The <tt>name</tt>, <tt>inAttrs</tt>, and <tt>environment</tt> parameters
+ * The {@code name}, {@code inAttrs}, and {@code environment} parameters
* are owned by the caller.
* The implementation will not modify these objects or keep references
* to them, although it may keep references to clones or copies.
* The object returned by this method is owned by the caller.
* The implementation will not subsequently modify it.
- * It will contain either a new <tt>Attributes</tt> object that is
+ * It will contain either a new {@code Attributes} object that is
* likewise owned by the caller, or a reference to the original
- * <tt>inAttrs</tt> parameter.
+ * {@code inAttrs} parameter.
*
* @param obj A possibly null object whose state is to be retrieved.
- * @param name The name of this object relative to <code>nameCtx</code>,
+ * @param name The name of this object relative to {@code nameCtx},
* or null if no name is specified.
- * @param nameCtx The context relative to which the <code>name</code>
- * parameter is specified, or null if <code>name</code> is
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified, or null if {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the object's state.
* @param inAttrs The possibly null attributes to be bound with the object.
- * The factory must not modify <tt>inAttrs</tt>.
- * @return A <tt>Result</tt> containing the object's state for binding
+ * The factory must not modify {@code inAttrs}.
+ * @return A {@code Result} containing the object's state for binding
* and the corresponding
* attributes to be bound; null if the object don't use this factory.
* @exception NamingException If this factory encountered an exception
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/DirectoryManager.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/DirectoryManager.java Wed Jul 05 20:44:51 2017 +0200
@@ -41,18 +41,18 @@
/**
- * This class contains methods for supporting <tt>DirContext</tt>
+ * This class contains methods for supporting {@code DirContext}
* implementations.
*<p>
- * This class is an extension of <tt>NamingManager</tt>. It contains methods
+ * This class is an extension of {@code NamingManager}. It contains methods
* for use by service providers for accessing object factories and
* state factories, and for getting continuation contexts for
* supporting federation.
*<p>
- * <tt>DirectoryManager</tt> is safe for concurrent access by multiple threads.
+ * {@code DirectoryManager} is safe for concurrent access by multiple threads.
*<p>
* Except as otherwise noted,
- * a <tt>Name</tt>, <tt>Attributes</tt>, or environment parameter
+ * a {@code Name}, {@code Attributes}, or environment parameter
* passed to any method is owned by the caller.
* The implementation will not modify the object or keep a reference
* to it, although it may keep a reference to a clone or copy.
@@ -73,13 +73,13 @@
DirectoryManager() {}
/**
- * Creates a context in which to continue a <tt>DirContext</tt> operation.
- * Operates just like <tt>NamingManager.getContinuationContext()</tt>,
- * only the continuation context returned is a <tt>DirContext</tt>.
+ * Creates a context in which to continue a {@code DirContext} operation.
+ * Operates just like {@code NamingManager.getContinuationContext()},
+ * only the continuation context returned is a {@code DirContext}.
*
* @param cpe
* The non-null exception that triggered this continuation.
- * @return A non-null <tt>DirContext</tt> object for continuing the operation.
+ * @return A non-null {@code DirContext} object for continuing the operation.
* @exception NamingException If a naming exception occurred.
*
* @see NamingManager#getContinuationContext(CannotProceedException)
@@ -104,37 +104,37 @@
* Creates an instance of an object for the specified object,
* attributes, and environment.
* <p>
- * This method is the same as <tt>NamingManager.getObjectInstance</tt>
+ * This method is the same as {@code NamingManager.getObjectInstance}
* except for the following differences:
*<ul>
*<li>
- * It accepts an <tt>Attributes</tt> parameter that contains attributes
- * associated with the object. The <tt>DirObjectFactory</tt> might use these
+ * It accepts an {@code Attributes} parameter that contains attributes
+ * associated with the object. The {@code DirObjectFactory} might use these
* attributes to save having to look them up from the directory.
*<li>
* The object factories tried must implement either
- * <tt>ObjectFactory</tt> or <tt>DirObjectFactory</tt>.
- * If it implements <tt>DirObjectFactory</tt>,
- * <tt>DirObjectFactory.getObjectInstance()</tt> is used, otherwise,
- * <tt>ObjectFactory.getObjectInstance()</tt> is used.
+ * {@code ObjectFactory} or {@code DirObjectFactory}.
+ * If it implements {@code DirObjectFactory},
+ * {@code DirObjectFactory.getObjectInstance()} is used, otherwise,
+ * {@code ObjectFactory.getObjectInstance()} is used.
*</ul>
- * Service providers that implement the <tt>DirContext</tt> interface
- * should use this method, not <tt>NamingManager.getObjectInstance()</tt>.
+ * Service providers that implement the {@code DirContext} interface
+ * should use this method, not {@code NamingManager.getObjectInstance()}.
*
* @param refInfo The possibly null object for which to create an object.
- * @param name The name of this object relative to <code>nameCtx</code>.
+ * @param name The name of this object relative to {@code nameCtx}.
* Specifying a name is optional; if it is
- * omitted, <code>name</code> should be null.
- * @param nameCtx The context relative to which the <code>name</code>
- * parameter is specified. If null, <code>name</code> is
+ * omitted, {@code name} should be null.
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified. If null, {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the object factory and the object.
* @param attrs The possibly null attributes associated with refInfo.
* This might not be the complete set of attributes for refInfo;
* you might be able to read more attributes from the directory.
- * @return An object created using <code>refInfo</code> and <tt>attrs</tt>; or
- * <code>refInfo</code> if an object cannot be created by
+ * @return An object created using {@code refInfo} and {@code attrs}; or
+ * {@code refInfo} if an object cannot be created by
* a factory.
* @exception NamingException If a naming exception was encountered
* while attempting to get a URL context, or if one of the
@@ -144,7 +144,7 @@
* and instantiating the factory and object classes.
* A factory should only throw an exception if it does not want
* other factories to be used in an attempt to create an object.
- * See <tt>DirObjectFactory.getObjectInstance()</tt>.
+ * See {@code DirObjectFactory.getObjectInstance()}.
* @see NamingManager#getURLContext
* @see DirObjectFactory
* @see DirObjectFactory#getObjectInstance
@@ -246,39 +246,39 @@
* Retrieves the state of an object for binding when given the original
* object and its attributes.
* <p>
- * This method is like <tt>NamingManager.getStateToBind</tt> except
+ * This method is like {@code NamingManager.getStateToBind} except
* for the following differences:
*<ul>
- *<li>It accepts an <tt>Attributes</tt> parameter containing attributes
- * that were passed to the <tt>DirContext.bind()</tt> method.
- *<li>It returns a non-null <tt>DirStateFactory.Result</tt> instance
+ *<li>It accepts an {@code Attributes} parameter containing attributes
+ * that were passed to the {@code DirContext.bind()} method.
+ *<li>It returns a non-null {@code DirStateFactory.Result} instance
* containing the object to be bound, and the attributes to
* accompany the binding. Either the object or the attributes may be null.
*<li>
* The state factories tried must each implement either
- * <tt>StateFactory</tt> or <tt>DirStateFactory</tt>.
- * If it implements <tt>DirStateFactory</tt>, then
- * <tt>DirStateFactory.getStateToBind()</tt> is called; otherwise,
- * <tt>StateFactory.getStateToBind()</tt> is called.
+ * {@code StateFactory} or {@code DirStateFactory}.
+ * If it implements {@code DirStateFactory}, then
+ * {@code DirStateFactory.getStateToBind()} is called; otherwise,
+ * {@code StateFactory.getStateToBind()} is called.
*</ul>
*
- * Service providers that implement the <tt>DirContext</tt> interface
- * should use this method, not <tt>NamingManager.getStateToBind()</tt>.
+ * Service providers that implement the {@code DirContext} interface
+ * should use this method, not {@code NamingManager.getStateToBind()}.
*<p>
* See NamingManager.getStateToBind() for a description of how
* the list of state factories to be tried is determined.
*<p>
* The object returned by this method is owned by the caller.
* The implementation will not subsequently modify it.
- * It will contain either a new <tt>Attributes</tt> object that is
+ * It will contain either a new {@code Attributes} object that is
* likewise owned by the caller, or a reference to the original
- * <tt>attrs</tt> parameter.
+ * {@code attrs} parameter.
*
* @param obj The non-null object for which to get state to bind.
- * @param name The name of this object relative to <code>nameCtx</code>,
+ * @param name The name of this object relative to {@code nameCtx},
* or null if no name is specified.
- * @param nameCtx The context relative to which the <code>name</code>
- * parameter is specified, or null if <code>name</code> is
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified, or null if {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the state factory and
@@ -288,12 +288,12 @@
* @return A non-null DirStateFactory.Result containing
* the object and attributes to be bound.
* If no state factory returns a non-null answer, the result will contain
- * the object (<tt>obj</tt>) itself with the original attributes.
+ * the object ({@code obj}) itself with the original attributes.
* @exception NamingException If a naming exception was encountered
* while using the factories.
* A factory should only throw an exception if it does not want
* other factories to be used in an attempt to create an object.
- * See <tt>DirStateFactory.getStateToBind()</tt>.
+ * See {@code DirStateFactory.getStateToBind()}.
* @see DirStateFactory
* @see DirStateFactory#getStateToBind
* @see NamingManager#getStateToBind
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/NamingManager.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/NamingManager.java Wed Jul 05 20:44:51 2017 +0200
@@ -49,7 +49,7 @@
* NamingManager is safe for concurrent access by multiple threads.
*<p>
* Except as otherwise noted,
- * a <tt>Name</tt> or environment parameter
+ * a {@code Name} or environment parameter
* passed to any method is owned by the caller.
* The implementation will not modify the object or keep a reference
* to it, although it may keep a reference to a clone or copy.
@@ -164,8 +164,8 @@
/**
* Creates an object using the factories specified in the
- * <tt>Context.OBJECT_FACTORIES</tt> property of the environment
- * or of the provider resource file associated with <tt>nameCtx</tt>.
+ * {@code Context.OBJECT_FACTORIES} property of the environment
+ * or of the provider resource file associated with {@code nameCtx}.
*
* @return factory created; null if cannot create
*/
@@ -205,69 +205,69 @@
* create a factory for creating the object.
* Otherwise, the following rules are used to create the object:
*<ol>
- * <li>If <code>refInfo</code> is a <code>Reference</code>
- * or <code>Referenceable</code> containing a factory class name,
+ * <li>If {@code refInfo} is a {@code Reference}
+ * or {@code Referenceable} containing a factory class name,
* use the named factory to create the object.
- * Return <code>refInfo</code> if the factory cannot be created.
+ * Return {@code refInfo} if the factory cannot be created.
* Under JDK 1.1, if the factory class must be loaded from a location
- * specified in the reference, a <tt>SecurityManager</tt> must have
+ * specified in the reference, a {@code SecurityManager} must have
* been installed or the factory creation will fail.
* If an exception is encountered while creating the factory,
* it is passed up to the caller.
- * <li>If <tt>refInfo</tt> is a <tt>Reference</tt> or
- * <tt>Referenceable</tt> with no factory class name,
- * and the address or addresses are <tt>StringRefAddr</tt>s with
+ * <li>If {@code refInfo} is a {@code Reference} or
+ * {@code Referenceable} with no factory class name,
+ * and the address or addresses are {@code StringRefAddr}s with
* address type "URL",
* try the URL context factory corresponding to each URL's scheme id
- * to create the object (see <tt>getURLContext()</tt>).
+ * to create the object (see {@code getURLContext()}).
* If that fails, continue to the next step.
* <li> Use the object factories specified in
- * the <tt>Context.OBJECT_FACTORIES</tt> property of the environment,
+ * the {@code Context.OBJECT_FACTORIES} property of the environment,
* and of the provider resource file associated with
- * <tt>nameCtx</tt>, in that order.
+ * {@code nameCtx}, in that order.
* The value of this property is a colon-separated list of factory
* class names that are tried in order, and the first one that succeeds
* in creating an object is the one used.
* If none of the factories can be loaded,
- * return <code>refInfo</code>.
+ * return {@code refInfo}.
* If an exception is encountered while creating the object, the
* exception is passed up to the caller.
*</ol>
*<p>
- * Service providers that implement the <tt>DirContext</tt>
+ * Service providers that implement the {@code DirContext}
* interface should use
- * <tt>DirectoryManager.getObjectInstance()</tt>, not this method.
- * Service providers that implement only the <tt>Context</tt>
+ * {@code DirectoryManager.getObjectInstance()}, not this method.
+ * Service providers that implement only the {@code Context}
* interface should use this method.
* <p>
* Note that an object factory (an object that implements the ObjectFactory
* interface) must be public and must have a public constructor that
* accepts no arguments.
* <p>
- * The <code>name</code> and <code>nameCtx</code> parameters may
+ * The {@code name} and {@code nameCtx} parameters may
* optionally be used to specify the name of the object being created.
- * <code>name</code> is the name of the object, relative to context
- * <code>nameCtx</code>. This information could be useful to the object
+ * {@code name} is the name of the object, relative to context
+ * {@code nameCtx}. This information could be useful to the object
* factory or to the object implementation.
* If there are several possible contexts from which the object
* could be named -- as will often be the case -- it is up to
* the caller to select one. A good rule of thumb is to select the
* "deepest" context available.
- * If <code>nameCtx</code> is null, <code>name</code> is relative
+ * If {@code nameCtx} is null, {@code name} is relative
* to the default initial context. If no name is being specified, the
- * <code>name</code> parameter should be null.
+ * {@code name} parameter should be null.
*
* @param refInfo The possibly null object for which to create an object.
- * @param name The name of this object relative to <code>nameCtx</code>.
+ * @param name The name of this object relative to {@code nameCtx}.
* Specifying a name is optional; if it is
- * omitted, <code>name</code> should be null.
- * @param nameCtx The context relative to which the <code>name</code>
- * parameter is specified. If null, <code>name</code> is
+ * omitted, {@code name} should be null.
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified. If null, {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the object factory and the object.
- * @return An object created using <code>refInfo</code>; or
- * <code>refInfo</code> if an object cannot be created using
+ * @return An object created using {@code refInfo}; or
+ * {@code refInfo} if an object cannot be created using
* the algorithm described above.
* @exception NamingException if a naming exception was encountered
* while attempting to get a URL context, or if one of the
@@ -404,23 +404,23 @@
/**
- * Retrieves a context identified by <code>obj</code>, using the specified
+ * Retrieves a context identified by {@code obj}, using the specified
* environment.
* Used by ContinuationContext.
*
* @param obj The object identifying the context.
* @param name The name of the context being returned, relative to
- * <code>nameCtx</code>, or null if no name is being
+ * {@code nameCtx}, or null if no name is being
* specified.
- * See the <code>getObjectInstance</code> method for
+ * See the {@code getObjectInstance} method for
* details.
- * @param nameCtx The context relative to which <code>name</code> is
+ * @param nameCtx The context relative to which {@code name} is
* specified, or null for the default initial context.
- * See the <code>getObjectInstance</code> method for
+ * See the {@code getObjectInstance} method for
* details.
* @param environment Environment specifying characteristics of the
* resulting context.
- * @return A context identified by <code>obj</code>.
+ * @return A context identified by {@code obj}.
*
* @see #getObjectInstance
*/
@@ -480,7 +480,7 @@
* Creates a context for the given URL scheme id.
* <p>
* The resulting context is for resolving URLs of the
- * scheme <code>scheme</code>. The resulting context is not tied
+ * scheme {@code scheme}. The resulting context is not tied
* to a specific URL. It is able to handle arbitrary URLs with
* the specified scheme.
*<p>
@@ -488,7 +488,7 @@
* has the naming convention <i>scheme-id</i>URLContextFactory
* (e.g. "ftpURLContextFactory" for the "ftp" scheme-id),
* in the package specified as follows.
- * The <tt>Context.URL_PKG_PREFIXES</tt> environment property (which
+ * The {@code Context.URL_PKG_PREFIXES} environment property (which
* may contain values taken from system properties,
* or application resource files)
* contains a colon-separated list of package prefixes.
@@ -500,7 +500,7 @@
* concatenated with the scheme id.
*<p>
* For example, if the scheme id is "ldap", and the
- * <tt>Context.URL_PKG_PREFIXES</tt> property
+ * {@code Context.URL_PKG_PREFIXES} property
* contains "com.widget:com.wiz.jndi",
* the naming manager would attempt to load the following classes
* until one is successfully instantiated:
@@ -514,7 +514,7 @@
* If a factory is instantiated, it is invoked with the following
* parameters to produce the resulting context.
* <p>
- * <code>factory.getObjectInstance(null, environment);</code>
+ * {@code factory.getObjectInstance(null, environment);}
* <p>
* For example, invoking getObjectInstance() as shown above
* on a LDAP URL context factory would return a
@@ -530,8 +530,8 @@
* @param environment The possibly null environment properties to be
* used in the creation of the object factory and the context.
* @return A context for resolving URLs with the
- * scheme id <code>scheme</code>;
- * <code>null</code> if the factory for creating the
+ * scheme id {@code scheme};
+ * {@code null} if the factory for creating the
* context is not found.
* @exception NamingException If a naming exception occurs while creating
* the context.
@@ -575,7 +575,7 @@
* context factory for the URL scheme.
* @param scheme the URL scheme id for the context
* @param urlInfo information used to create the context
- * @param name name of this object relative to <code>nameCtx</code>
+ * @param name name of this object relative to {@code nameCtx}
* @param nameCtx Context whose provider resource file will be searched
* for package prefix values (or null if none)
* @param environment Environment properties for creating the context
@@ -630,7 +630,7 @@
* it is used to create the factory for creating the initial
* context</li>
* <li>Otherwise, the class specified in the
- * <tt>Context.INITIAL_CONTEXT_FACTORY</tt> environment property
+ * {@code Context.INITIAL_CONTEXT_FACTORY} environment property
* is used
* <ul>
* <li>First, the {@linkplain java.util.ServiceLoader ServiceLoader}
@@ -649,7 +649,7 @@
* creating the context.
* @return A non-null initial context.
* @exception NoInitialContextException If the
- * <tt>Context.INITIAL_CONTEXT_FACTORY</tt> property
+ * {@code Context.INITIAL_CONTEXT_FACTORY} property
* is not found or names a nonexistent
* class or a class that cannot be instantiated,
* or if the initial context could not be created for some other
@@ -764,8 +764,8 @@
/**
* Constant that holds the name of the environment property into
- * which <tt>getContinuationContext()</tt> stores the value of its
- * <tt>CannotProceedException</tt> parameter.
+ * which {@code getContinuationContext()} stores the value of its
+ * {@code CannotProceedException} parameter.
* This property is inherited by the continuation context, and may
* be used by that context's service provider to inspect the
* fields of the exception.
@@ -784,18 +784,18 @@
* namespaces, a context from one naming system may need to pass
* the operation on to the next naming system. The context
* implementation does this by first constructing a
- * <code>CannotProceedException</code> containing information
+ * {@code CannotProceedException} containing information
* pinpointing how far it has proceeded. It then obtains a
* continuation context from JNDI by calling
- * <code>getContinuationContext</code>. The context
+ * {@code getContinuationContext}. The context
* implementation should then resume the context operation by
* invoking the same operation on the continuation context, using
* the remainder of the name that has not yet been resolved.
*<p>
- * Before making use of the <tt>cpe</tt> parameter, this method
+ * Before making use of the {@code cpe} parameter, this method
* updates the environment associated with that object by setting
- * the value of the property <a href="#CPE"><tt>CPE</tt></a>
- * to <tt>cpe</tt>. This property will be inherited by the
+ * the value of the property <a href="#CPE">{@code CPE}</a>
+ * to {@code cpe}. This property will be inherited by the
* continuation context, and may be used by that context's
* service provider to inspect the fields of this exception.
*
@@ -826,15 +826,15 @@
/**
* Retrieves the state of an object for binding.
* <p>
- * Service providers that implement the <tt>DirContext</tt> interface
- * should use <tt>DirectoryManager.getStateToBind()</tt>, not this method.
- * Service providers that implement only the <tt>Context</tt> interface
+ * Service providers that implement the {@code DirContext} interface
+ * should use {@code DirectoryManager.getStateToBind()}, not this method.
+ * Service providers that implement only the {@code Context} interface
* should use this method.
*<p>
* This method uses the specified state factories in
- * the <tt>Context.STATE_FACTORIES</tt> property from the environment
+ * the {@code Context.STATE_FACTORIES} property from the environment
* properties, and from the provider resource file associated with
- * <tt>nameCtx</tt>, in that order.
+ * {@code nameCtx}, in that order.
* The value of this property is a colon-separated list of factory
* class names that are tried in order, and the first one that succeeds
* in returning the object's state is the one used.
@@ -848,35 +848,35 @@
* interface) must be public and must have a public constructor that
* accepts no arguments.
* <p>
- * The <code>name</code> and <code>nameCtx</code> parameters may
+ * The {@code name} and {@code nameCtx} parameters may
* optionally be used to specify the name of the object being created.
* See the description of "Name and Context Parameters" in
* {@link ObjectFactory#getObjectInstance
* ObjectFactory.getObjectInstance()}
* for details.
* <p>
- * This method may return a <tt>Referenceable</tt> object. The
+ * This method may return a {@code Referenceable} object. The
* service provider obtaining this object may choose to store it
* directly, or to extract its reference (using
- * <tt>Referenceable.getReference()</tt>) and store that instead.
+ * {@code Referenceable.getReference()}) and store that instead.
*
* @param obj The non-null object for which to get state to bind.
- * @param name The name of this object relative to <code>nameCtx</code>,
+ * @param name The name of this object relative to {@code nameCtx},
* or null if no name is specified.
- * @param nameCtx The context relative to which the <code>name</code>
- * parameter is specified, or null if <code>name</code> is
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified, or null if {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment to
* be used in the creation of the state factory and
* the object's state.
- * @return The non-null object representing <tt>obj</tt>'s state for
- * binding. It could be the object (<tt>obj</tt>) itself.
+ * @return The non-null object representing {@code obj}'s state for
+ * binding. It could be the object ({@code obj}) itself.
* @exception NamingException If one of the factories accessed throws an
* exception, or if an error was encountered while loading
* and instantiating the factory and object classes.
* A factory should only throw an exception if it does not want
* other factories to be used in an attempt to create an object.
- * See <tt>StateFactory.getStateToBind()</tt>.
+ * See {@code StateFactory.getStateToBind()}.
* @see StateFactory
* @see StateFactory#getStateToBind
* @see DirectoryManager#getStateToBind
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactory.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,15 +39,15 @@
* Reference could be used to create a printer object, so that
* the caller of lookup can directly operate on the printer object
* after the lookup.
- * <p>An <tt>ObjectFactory</tt> is responsible
+ * <p>An {@code ObjectFactory} is responsible
* for creating objects of a specific type. In the above example,
* you may have a PrinterObjectFactory for creating Printer objects.
*<p>
- * An object factory must implement the <tt>ObjectFactory</tt> interface.
+ * An object factory must implement the {@code ObjectFactory} interface.
* In addition, the factory class must be public and must have a
* public constructor that accepts no parameters.
*<p>
- * The <tt>getObjectInstance()</tt> method of an object factory may
+ * The {@code getObjectInstance()} method of an object factory may
* be invoked multiple times, possibly using different parameters.
* The implementation is thread-safe.
*<p>
@@ -73,15 +73,15 @@
* specified.
* <p>
* Special requirements of this object are supplied
- * using <code>environment</code>.
+ * using {@code environment}.
* An example of such an environment property is user identity
* information.
*<p>
- * <tt>NamingManager.getObjectInstance()</tt>
+ * {@code NamingManager.getObjectInstance()}
* successively loads in object factories and invokes this method
* on them until one produces a non-null answer. When an exception
* is thrown by an object factory, the exception is passed on to the caller
- * of <tt>NamingManager.getObjectInstance()</tt>
+ * of {@code NamingManager.getObjectInstance()}
* (and no search is made for other factories
* that may produce a non-null answer).
* An object factory should only throw an exception if it is sure that
@@ -92,27 +92,27 @@
*<p>
* A <em>URL context factory</em> is a special ObjectFactory that
* creates contexts for resolving URLs or objects whose locations
- * are specified by URLs. The <tt>getObjectInstance()</tt> method
+ * are specified by URLs. The {@code getObjectInstance()} method
* of a URL context factory will obey the following rules.
* <ol>
- * <li>If <code>obj</code> is null, create a context for resolving URLs of the
+ * <li>If {@code obj} is null, create a context for resolving URLs of the
* scheme associated with this factory. The resulting context is not tied
* to a specific URL: it is able to handle arbitrary URLs with this factory's
- * scheme id. For example, invoking <tt>getObjectInstance()</tt> with
- * <code>obj</code> set to null on an LDAP URL context factory would return a
+ * scheme id. For example, invoking {@code getObjectInstance()} with
+ * {@code obj} set to null on an LDAP URL context factory would return a
* context that can resolve LDAP URLs
* such as "ldap://ldap.wiz.com/o=wiz,c=us" and
* "ldap://ldap.umich.edu/o=umich,c=us".
* <li>
- * If <code>obj</code> is a URL string, create an object (typically a context)
+ * If {@code obj} is a URL string, create an object (typically a context)
* identified by the URL. For example, suppose this is an LDAP URL context
- * factory. If <code>obj</code> is "ldap://ldap.wiz.com/o=wiz,c=us",
+ * factory. If {@code obj} is "ldap://ldap.wiz.com/o=wiz,c=us",
* getObjectInstance() would return the context named by the distinguished
* name "o=wiz, c=us" at the LDAP server ldap.wiz.com. This context can
* then be used to resolve LDAP names (such as "cn=George")
* relative to that context.
* <li>
- * If <code>obj</code> is an array of URL strings, the assumption is that the
+ * If {@code obj} is an array of URL strings, the assumption is that the
* URLs are equivalent in terms of the context to which they refer.
* Verification of whether the URLs are, or need to be, equivalent is up
* to the context factory. The order of the URLs in the array is
@@ -120,13 +120,13 @@
* The object returned by getObjectInstance() is like that of the single
* URL case. It is the object named by the URLs.
* <li>
- * If <code>obj</code> is of any other type, the behavior of
- * <tt>getObjectInstance()</tt> is determined by the context factory
+ * If {@code obj} is of any other type, the behavior of
+ * {@code getObjectInstance()} is determined by the context factory
* implementation.
* </ol>
*
* <p>
- * The <tt>name</tt> and <tt>environment</tt> parameters
+ * The {@code name} and {@code environment} parameters
* are owned by the caller.
* The implementation will not modify these objects or keep references
* to them, although it may keep references to clones or copies.
@@ -135,27 +135,27 @@
* <b>Name and Context Parameters.</b>
* <a name=NAMECTX></a>
*
- * The <code>name</code> and <code>nameCtx</code> parameters may
+ * The {@code name} and {@code nameCtx} parameters may
* optionally be used to specify the name of the object being created.
- * <code>name</code> is the name of the object, relative to context
- * <code>nameCtx</code>.
+ * {@code name} is the name of the object, relative to context
+ * {@code nameCtx}.
* If there are several possible contexts from which the object
* could be named -- as will often be the case -- it is up to
* the caller to select one. A good rule of thumb is to select the
* "deepest" context available.
- * If <code>nameCtx</code> is null, <code>name</code> is relative
+ * If {@code nameCtx} is null, {@code name} is relative
* to the default initial context. If no name is being specified, the
- * <code>name</code> parameter should be null.
- * If a factory uses <code>nameCtx</code> it should synchronize its use
+ * {@code name} parameter should be null.
+ * If a factory uses {@code nameCtx} it should synchronize its use
* against concurrent access, since context implementations are not
* guaranteed to be thread-safe.
*
* @param obj The possibly null object containing location or reference
* information that can be used in creating an object.
- * @param name The name of this object relative to <code>nameCtx</code>,
+ * @param name The name of this object relative to {@code nameCtx},
* or null if no name is specified.
- * @param nameCtx The context relative to which the <code>name</code>
- * parameter is specified, or null if <code>name</code> is
+ * @param nameCtx The context relative to which the {@code name}
+ * parameter is specified, or null if {@code name} is
* relative to the default initial context.
* @param environment The possibly null environment that is used in
* creating the object.
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactoryBuilder.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/ObjectFactoryBuilder.java Wed Jul 05 20:44:51 2017 +0200
@@ -40,10 +40,10 @@
* after the lookup. An ObjectFactory is responsible for creating
* objects of a specific type. JNDI uses a default policy for using
* and loading object factories. You can override this default policy
- * by calling <tt>NamingManager.setObjectFactoryBuilder()</tt> with an ObjectFactoryBuilder,
+ * by calling {@code NamingManager.setObjectFactoryBuilder()} with an ObjectFactoryBuilder,
* which contains the program-defined way of creating/loading
* object factories.
- * Any <tt>ObjectFactoryBuilder</tt> implementation must implement this
+ * Any {@code ObjectFactoryBuilder} implementation must implement this
* interface that for creating object factories.
*
* @author Rosanna Lee
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/Resolver.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/Resolver.java Wed Jul 05 20:44:51 2017 +0200
@@ -37,10 +37,10 @@
* that do not support subtypes of Context, but which can act as
* intermediate contexts for resolution purposes.
*<p>
- * A <tt>Name</tt> parameter passed to any method is owned
+ * A {@code Name} parameter passed to any method is owned
* by the caller. The service provider will not modify the object
* or keep a reference to it.
- * A <tt>ResolveResult</tt> object returned by any
+ * A {@code ResolveResult} object returned by any
* method is owned by the caller. The caller may subsequently modify it;
* the service provider may not.
*
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/StateFactory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/StateFactory.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,14 +34,14 @@
* The JNDI framework allows for object implementations to
* be loaded in dynamically via <em>object factories</em>.
* For example, when looking up a printer bound in the name space,
- * if the print service binds printer names to <tt>Reference</tt>s, the printer
- * <tt>Reference</tt> could be used to create a printer object, so that
+ * if the print service binds printer names to {@code Reference}s, the printer
+ * {@code Reference} could be used to create a printer object, so that
* the caller of lookup can directly operate on the printer object
* after the lookup.
- * <p>An <tt>ObjectFactory</tt> is responsible
+ * <p>An {@code ObjectFactory} is responsible
* for creating objects of a specific type. In the above example,
- * you may have a <tt>PrinterObjectFactory</tt> for creating
- * <tt>Printer</tt> objects.
+ * you may have a {@code PrinterObjectFactory} for creating
+ * {@code Printer} objects.
* <p>
* For the reverse process, when an object is bound into the namespace,
* JNDI provides <em>state factories</em>.
@@ -50,23 +50,23 @@
* <blockquote><pre>
* ctx.rebind("inky", printer);
* </pre></blockquote>
- * The service provider for <tt>ctx</tt> uses a state factory
- * to obtain the state of <tt>printer</tt> for binding into its namespace.
- * A state factory for the <tt>Printer</tt> type object might return
+ * The service provider for {@code ctx} uses a state factory
+ * to obtain the state of {@code printer} for binding into its namespace.
+ * A state factory for the {@code Printer} type object might return
* a more compact object for storage in the naming system.
*<p>
- * A state factory must implement the <tt>StateFactory</tt> interface.
+ * A state factory must implement the {@code StateFactory} interface.
* In addition, the factory class must be public and must have a
* public constructor that accepts no parameters.
*<p>
- * The <tt>getStateToBind()</tt> method of a state factory may
+ * The {@code getStateToBind()} method of a state factory may
* be invoked multiple times, possibly using different parameters.
* The implementation is thread-safe.
*<p>
- * <tt>StateFactory</tt> is intended for use with service providers
- * that implement only the <tt>Context</tt> interface.
- * <tt>DirStateFactory</tt> is intended for use with service providers
- * that implement the <tt>DirContext</tt> interface.
+ * {@code StateFactory} is intended for use with service providers
+ * that implement only the {@code Context} interface.
+ * {@code DirStateFactory} is intended for use with service providers
+ * that implement the {@code DirContext} interface.
*
* @author Rosanna Lee
* @author Scott Seligman
@@ -81,18 +81,18 @@
/**
* Retrieves the state of an object for binding.
*<p>
- * <tt>NamingManager.getStateToBind()</tt>
+ * {@code NamingManager.getStateToBind()}
* successively loads in state factories and invokes this method
* on them until one produces a non-null answer.
- * <tt>DirectoryManager.getStateToBind()</tt>
+ * {@code DirectoryManager.getStateToBind()}
* successively loads in state factories. If a factory implements
- * <tt>DirStateFactory</tt>, then <tt>DirectoryManager</tt>
- * invokes <tt>DirStateFactory.getStateToBind()</tt>; otherwise
- * it invokes <tt>StateFactory.getStateToBind()</tt>.
+ * {@code DirStateFactory}, then {@code DirectoryManager}
+ * invokes {@code DirStateFactory.getStateToBind()}; otherwise
+ * it invokes {@code StateFactory.getStateToBind()}.
*<p> When an exception
* is thrown by a factory, the exception is passed on to the caller
- * of <tt>NamingManager.getStateToBind()</tt> and
- * <tt>DirectoryManager.getStateToBind()</tt>.
+ * of {@code NamingManager.getStateToBind()} and
+ * {@code DirectoryManager.getStateToBind()}.
* The search for other factories
* that may produce a non-null answer is halted.
* A factory should only throw an exception if it is sure that
@@ -110,7 +110,7 @@
* against concurrent access, since context implementations are not
* guaranteed to be thread-safe.
* <p>
- * The <tt>name</tt> and <tt>environment</tt> parameters
+ * The {@code name} and {@code environment} parameters
* are owned by the caller.
* The implementation will not modify these objects or keep references
* to them, although it may keep references to clones or copies.
--- a/jdk/src/java.naming/share/classes/javax/naming/spi/package.html Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.naming/share/classes/javax/naming/spi/package.html Wed Jul 05 20:44:51 2017 +0200
@@ -29,7 +29,7 @@
<body bgcolor="white">
Provides the means for dynamically plugging in support for accessing
-naming and directory services through the <tt>javax.naming</tt>
+naming and directory services through the <code>javax.naming</code>
and related packages.
<p>
@@ -58,9 +58,9 @@
<h4>Java Object Support</h4>
-The service provider package provides support
+The service provider package provides support
for implementors of the
-<tt>javax.naming.Context.lookup()</tt>
+<code>javax.naming.Context.lookup()</code>
method and related methods to return Java objects that are natural
and intuitive for the Java programmer.
For example, when looking up a printer name from the directory,
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java Wed Jul 05 20:44:51 2017 +0200
@@ -40,8 +40,8 @@
* This class provides a skeletal implementation of the {@link Preferences}
* class, greatly easing the task of implementing it.
*
- * <p><strong>This class is for <tt>Preferences</tt> implementers only.
- * Normal users of the <tt>Preferences</tt> facility should have no need to
+ * <p><strong>This class is for {@code Preferences} implementers only.
+ * Normal users of the {@code Preferences} facility should have no need to
* consult this documentation. The {@link Preferences} documentation
* should suffice.</strong>
*
@@ -56,11 +56,11 @@
* performance.
*
* <p>The SPI methods fall into three groups concerning exception
- * behavior. The <tt>getSpi</tt> method should never throw exceptions, but it
+ * behavior. The {@code getSpi} method should never throw exceptions, but it
* doesn't really matter, as any exception thrown by this method will be
* intercepted by {@link #get(String,String)}, which will return the specified
- * default value to the caller. The <tt>removeNodeSpi, keysSpi,
- * childrenNamesSpi, syncSpi</tt> and <tt>flushSpi</tt> methods are specified
+ * default value to the caller. The {@code removeNodeSpi, keysSpi,
+ * childrenNamesSpi, syncSpi} and {@code flushSpi} methods are specified
* to throw {@link BackingStoreException}, and the implementation is required
* to throw this checked exception if it is unable to perform the operation.
* The exception propagates outward, causing the corresponding API method
@@ -69,7 +69,7 @@
* <p>The remaining SPI methods {@link #putSpi(String,String)}, {@link
* #removeSpi(String)} and {@link #childSpi(String)} have more complicated
* exception behavior. They are not specified to throw
- * <tt>BackingStoreException</tt>, as they can generally obey their contracts
+ * {@code BackingStoreException}, as they can generally obey their contracts
* even if the backing store is unavailable. This is true because they return
* no information and their effects are not required to become permanent until
* a subsequent call to {@link Preferences#flush()} or
@@ -79,11 +79,11 @@
* later processing. Even under these circumstances it is generally better to
* simply ignore the invocation and return, rather than throwing an
* exception. Under these circumstances, however, subsequently invoking
- * <tt>flush()</tt> or <tt>sync</tt> would not imply that all previous
+ * {@code flush()} or {@code sync} would not imply that all previous
* operations had successfully been made permanent.
*
- * <p>There is one circumstance under which <tt>putSpi, removeSpi and
- * childSpi</tt> <i>should</i> throw an exception: if the caller lacks
+ * <p>There is one circumstance under which {@code putSpi, removeSpi and
+ * childSpi} <i>should</i> throw an exception: if the caller lacks
* sufficient privileges on the underlying operating system to perform the
* requested operation. This will, for instance, occur on most systems
* if a non-privileged user attempts to modify system preferences.
@@ -103,18 +103,18 @@
* backing store. It is the implementation's responsibility to recreate the
* node if it has been deleted.
*
- * <p>Implementation note: In Sun's default <tt>Preferences</tt>
+ * <p>Implementation note: In Sun's default {@code Preferences}
* implementations, the user's identity is inherited from the underlying
* operating system and does not change for the lifetime of the virtual
- * machine. It is recognized that server-side <tt>Preferences</tt>
+ * machine. It is recognized that server-side {@code Preferences}
* implementations may have the user identity change from request to request,
- * implicitly passed to <tt>Preferences</tt> methods via the use of a
+ * implicitly passed to {@code Preferences} methods via the use of a
* static {@link ThreadLocal} instance. Authors of such implementations are
* <i>strongly</i> encouraged to determine the user at the time preferences
* are accessed (for example by the {@link #get(String,String)} or {@link
* #put(String,String)} method) rather than permanently associating a user
- * with each <tt>Preferences</tt> instance. The latter behavior conflicts
- * with normal <tt>Preferences</tt> usage and would lead to great confusion.
+ * with each {@code Preferences} instance. The latter behavior conflicts
+ * with normal {@code Preferences} usage and would lead to great confusion.
*
* @author Josh Bloch
* @see Preferences
@@ -149,7 +149,7 @@
private final AbstractPreferences root; // Relative to this node
/**
- * This field should be <tt>true</tt> if this node did not exist in the
+ * This field should be {@code true} if this node did not exist in the
* backing store prior to the creation of this object. The field
* is initialized to false, but may be set to true by a subclass
* constructor (and should not be modified thereafter). This field
@@ -197,10 +197,10 @@
* @param parent the parent of this preference node, or null if this
* is the root.
* @param name the name of this preference node, relative to its parent,
- * or <tt>""</tt> if this is the root.
- * @throws IllegalArgumentException if <tt>name</tt> contains a slash
- * (<tt>'/'</tt>), or <tt>parent</tt> is <tt>null</tt> and
- * name isn't <tt>""</tt>.
+ * or {@code ""} if this is the root.
+ * @throws IllegalArgumentException if {@code name} contains a slash
+ * ({@code '/'}), or {@code parent} is {@code null} and
+ * name isn't {@code ""}.
*/
protected AbstractPreferences(AbstractPreferences parent, String name) {
if (parent==null) {
@@ -225,7 +225,7 @@
}
/**
- * Implements the <tt>put</tt> method as per the specification in
+ * Implements the {@code put} method as per the specification in
* {@link Preferences#put(String,String)}.
*
* <p>This implementation checks that the key and value are legal,
@@ -236,10 +236,10 @@
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
- * @throws NullPointerException if key or value is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt> or if <tt>value.length</tt> exceeds
- * <tt>MAX_VALUE_LENGTH</tt>.
+ * @throws NullPointerException if key or value is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH} or if {@code value.length} exceeds
+ * {@code MAX_VALUE_LENGTH}.
* @throws IllegalArgumentException if either key or value contain
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -267,26 +267,26 @@
}
/**
- * Implements the <tt>get</tt> method as per the specification in
+ * Implements the {@code get} method as per the specification in
* {@link Preferences#get(String,String)}.
*
- * <p>This implementation first checks to see if <tt>key</tt> is
- * <tt>null</tt> throwing a <tt>NullPointerException</tt> if this is
+ * <p>This implementation first checks to see if {@code key} is
+ * {@code null} throwing a {@code NullPointerException} if this is
* the case. Then it obtains this preference node's lock,
* checks that the node has not been removed, invokes {@link
- * #getSpi(String)}, and returns the result, unless the <tt>getSpi</tt>
- * invocation returns <tt>null</tt> or throws an exception, in which case
- * this invocation returns <tt>def</tt>.
+ * #getSpi(String)}, and returns the result, unless the {@code getSpi}
+ * invocation returns {@code null} or throws an exception, in which case
+ * this invocation returns {@code def}.
*
* @param key key whose associated value is to be returned.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>.
- * @return the value associated with <tt>key</tt>, or <tt>def</tt>
- * if no value is associated with <tt>key</tt>.
+ * preference node has no value associated with {@code key}.
+ * @return the value associated with {@code key}, or {@code def}
+ * if no value is associated with {@code key}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if key is <tt>null</tt>. (A
- * <tt>null</tt> default <i>is</i> permitted.)
+ * @throws NullPointerException if key is {@code null}. (A
+ * {@code null} default <i>is</i> permitted.)
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -310,7 +310,7 @@
}
/**
- * Implements the <tt>remove(String)</tt> method as per the specification
+ * Implements the {@code remove(String)} method as per the specification
* in {@link Preferences#remove(String)}.
*
* <p>This implementation obtains this preference node's lock,
@@ -340,7 +340,7 @@
}
/**
- * Implements the <tt>clear</tt> method as per the specification in
+ * Implements the {@code clear} method as per the specification in
* {@link Preferences#clear()}.
*
* <p>This implementation obtains this preference node's lock,
@@ -361,18 +361,18 @@
}
/**
- * Implements the <tt>putInt</tt> method as per the specification in
+ * Implements the {@code putInt} method as per the specification in
* {@link Preferences#putInt(String,int)}.
*
- * <p>This implementation translates <tt>value</tt> to a string with
+ * <p>This implementation translates {@code value} to a string with
* {@link Integer#toString(int)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -383,26 +383,26 @@
}
/**
- * Implements the <tt>getInt</tt> method as per the specification in
+ * Implements the {@code getInt} method as per the specification in
* {@link Preferences#getInt(String,int)}.
*
- * <p>This implementation invokes {@link #get(String,String) <tt>get(key,
- * null)</tt>}. If the return value is non-null, the implementation
- * attempts to translate it to an <tt>int</tt> with
+ * <p>This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, the implementation
+ * attempts to translate it to an {@code int} with
* {@link Integer#parseInt(String)}. If the attempt succeeds, the return
- * value is returned by this method. Otherwise, <tt>def</tt> is returned.
+ * value is returned by this method. Otherwise, {@code def} is returned.
*
* @param key key whose associated value is to be returned as an int.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as an int.
* @return the int value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* an int.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -420,18 +420,18 @@
}
/**
- * Implements the <tt>putLong</tt> method as per the specification in
+ * Implements the {@code putLong} method as per the specification in
* {@link Preferences#putLong(String,long)}.
*
- * <p>This implementation translates <tt>value</tt> to a string with
+ * <p>This implementation translates {@code value} to a string with
* {@link Long#toString(long)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -442,26 +442,26 @@
}
/**
- * Implements the <tt>getLong</tt> method as per the specification in
+ * Implements the {@code getLong} method as per the specification in
* {@link Preferences#getLong(String,long)}.
*
- * <p>This implementation invokes {@link #get(String,String) <tt>get(key,
- * null)</tt>}. If the return value is non-null, the implementation
- * attempts to translate it to a <tt>long</tt> with
+ * <p>This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, the implementation
+ * attempts to translate it to a {@code long} with
* {@link Long#parseLong(String)}. If the attempt succeeds, the return
- * value is returned by this method. Otherwise, <tt>def</tt> is returned.
+ * value is returned by this method. Otherwise, {@code def} is returned.
*
* @param key key whose associated value is to be returned as a long.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a long.
* @return the long value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a long.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -479,18 +479,18 @@
}
/**
- * Implements the <tt>putBoolean</tt> method as per the specification in
+ * Implements the {@code putBoolean} method as per the specification in
* {@link Preferences#putBoolean(String,boolean)}.
*
- * <p>This implementation translates <tt>value</tt> to a string with
+ * <p>This implementation translates {@code value} to a string with
* {@link String#valueOf(boolean)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -501,29 +501,29 @@
}
/**
- * Implements the <tt>getBoolean</tt> method as per the specification in
+ * Implements the {@code getBoolean} method as per the specification in
* {@link Preferences#getBoolean(String,boolean)}.
*
- * <p>This implementation invokes {@link #get(String,String) <tt>get(key,
- * null)</tt>}. If the return value is non-null, it is compared with
- * <tt>"true"</tt> using {@link String#equalsIgnoreCase(String)}. If the
- * comparison returns <tt>true</tt>, this invocation returns
- * <tt>true</tt>. Otherwise, the original return value is compared with
- * <tt>"false"</tt>, again using {@link String#equalsIgnoreCase(String)}.
- * If the comparison returns <tt>true</tt>, this invocation returns
- * <tt>false</tt>. Otherwise, this invocation returns <tt>def</tt>.
+ * <p>This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, it is compared with
+ * {@code "true"} using {@link String#equalsIgnoreCase(String)}. If the
+ * comparison returns {@code true}, this invocation returns
+ * {@code true}. Otherwise, the original return value is compared with
+ * {@code "false"}, again using {@link String#equalsIgnoreCase(String)}.
+ * If the comparison returns {@code true}, this invocation returns
+ * {@code false}. Otherwise, this invocation returns {@code def}.
*
* @param key key whose associated value is to be returned as a boolean.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a boolean.
* @return the boolean value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a boolean.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -541,18 +541,18 @@
}
/**
- * Implements the <tt>putFloat</tt> method as per the specification in
+ * Implements the {@code putFloat} method as per the specification in
* {@link Preferences#putFloat(String,float)}.
*
- * <p>This implementation translates <tt>value</tt> to a string with
+ * <p>This implementation translates {@code value} to a string with
* {@link Float#toString(float)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -563,26 +563,26 @@
}
/**
- * Implements the <tt>getFloat</tt> method as per the specification in
+ * Implements the {@code getFloat} method as per the specification in
* {@link Preferences#getFloat(String,float)}.
*
- * <p>This implementation invokes {@link #get(String,String) <tt>get(key,
- * null)</tt>}. If the return value is non-null, the implementation
- * attempts to translate it to an <tt>float</tt> with
+ * <p>This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, the implementation
+ * attempts to translate it to an {@code float} with
* {@link Float#parseFloat(String)}. If the attempt succeeds, the return
- * value is returned by this method. Otherwise, <tt>def</tt> is returned.
+ * value is returned by this method. Otherwise, {@code def} is returned.
*
* @param key key whose associated value is to be returned as a float.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a float.
* @return the float value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a float.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -600,18 +600,18 @@
}
/**
- * Implements the <tt>putDouble</tt> method as per the specification in
+ * Implements the {@code putDouble} method as per the specification in
* {@link Preferences#putDouble(String,double)}.
*
- * <p>This implementation translates <tt>value</tt> to a string with
+ * <p>This implementation translates {@code value} to a string with
* {@link Double#toString(double)} and invokes {@link #put(String,String)}
* on the result.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if key is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalArgumentException if key contains
* the null control character, code point U+0000.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -622,26 +622,26 @@
}
/**
- * Implements the <tt>getDouble</tt> method as per the specification in
+ * Implements the {@code getDouble} method as per the specification in
* {@link Preferences#getDouble(String,double)}.
*
- * <p>This implementation invokes {@link #get(String,String) <tt>get(key,
- * null)</tt>}. If the return value is non-null, the implementation
- * attempts to translate it to an <tt>double</tt> with
+ * <p>This implementation invokes {@link #get(String,String) get(key,
+ * null)}. If the return value is non-null, the implementation
+ * attempts to translate it to an {@code double} with
* {@link Double#parseDouble(String)}. If the attempt succeeds, the return
- * value is returned by this method. Otherwise, <tt>def</tt> is returned.
+ * value is returned by this method. Otherwise, {@code def} is returned.
*
* @param key key whose associated value is to be returned as a double.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a double.
* @return the double value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a double.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -659,12 +659,12 @@
}
/**
- * Implements the <tt>putByteArray</tt> method as per the specification in
+ * Implements the {@code putByteArray} method as per the specification in
* {@link Preferences#putByteArray(String,byte[])}.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key or value is <tt>null</tt>.
+ * @throws NullPointerException if key or value is {@code null}.
* @throws IllegalArgumentException if key.length() exceeds MAX_KEY_LENGTH
* or if value.length exceeds MAX_VALUE_LENGTH*3/4.
* @throws IllegalArgumentException if key contains
@@ -677,21 +677,21 @@
}
/**
- * Implements the <tt>getByteArray</tt> method as per the specification in
+ * Implements the {@code getByteArray} method as per the specification in
* {@link Preferences#getByteArray(String,byte[])}.
*
* @param key key whose associated value is to be returned as a byte array.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a byte array.
* @return the byte array value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a byte array.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>. (A
- * <tt>null</tt> value for <tt>def</tt> <i>is</i> permitted.)
+ * @throws NullPointerException if {@code key} is {@code null}. (A
+ * {@code null} value for {@code def} <i>is</i> permitted.)
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -710,7 +710,7 @@
}
/**
- * Implements the <tt>keys</tt> method as per the specification in
+ * Implements the {@code keys} method as per the specification in
* {@link Preferences#keys()}.
*
* <p>This implementation obtains this preference node's lock, checks that
@@ -734,15 +734,15 @@
}
/**
- * Implements the <tt>children</tt> method as per the specification in
+ * Implements the {@code children} method as per the specification in
* {@link Preferences#childrenNames()}.
*
* <p>This implementation obtains this preference node's lock, checks that
- * the node has not been removed, constructs a <tt>TreeSet</tt> initialized
+ * the node has not been removed, constructs a {@code TreeSet} initialized
* to the names of children already cached (the children in this node's
* "child-cache"), invokes {@link #childrenNamesSpi()}, and adds all of the
* returned child-names into the set. The elements of the tree set are
- * dumped into a <tt>String</tt> array using the <tt>toArray</tt> method,
+ * dumped into a {@code String} array using the {@code toArray} method,
* and this array is returned.
*
* @return the names of the children of this preference node.
@@ -780,7 +780,7 @@
= new AbstractPreferences[0];
/**
- * Implements the <tt>parent</tt> method as per the specification in
+ * Implements the {@code parent} method as per the specification in
* {@link Preferences#parent()}.
*
* <p>This implementation obtains this preference node's lock, checks that
@@ -801,35 +801,35 @@
}
/**
- * Implements the <tt>node</tt> method as per the specification in
+ * Implements the {@code node} method as per the specification in
* {@link Preferences#node(String)}.
*
* <p>This implementation obtains this preference node's lock and checks
- * that the node has not been removed. If <tt>path</tt> is <tt>""</tt>,
- * this node is returned; if <tt>path</tt> is <tt>"/"</tt>, this node's
- * root is returned. If the first character in <tt>path</tt> is
- * not <tt>'/'</tt>, the implementation breaks <tt>path</tt> into
+ * that the node has not been removed. If {@code path} is {@code ""},
+ * this node is returned; if {@code path} is {@code "/"}, this node's
+ * root is returned. If the first character in {@code path} is
+ * not {@code '/'}, the implementation breaks {@code path} into
* tokens and recursively traverses the path from this node to the
- * named node, "consuming" a name and a slash from <tt>path</tt> at
+ * named node, "consuming" a name and a slash from {@code path} at
* each step of the traversal. At each step, the current node is locked
* and the node's child-cache is checked for the named node. If it is
* not found, the name is checked to make sure its length does not
- * exceed <tt>MAX_NAME_LENGTH</tt>. Then the {@link #childSpi(String)}
+ * exceed {@code MAX_NAME_LENGTH}. Then the {@link #childSpi(String)}
* method is invoked, and the result stored in this node's child-cache.
- * If the newly created <tt>Preferences</tt> object's {@link #newNode}
- * field is <tt>true</tt> and there are any node change listeners,
+ * If the newly created {@code Preferences} object's {@link #newNode}
+ * field is {@code true} and there are any node change listeners,
* a notification event is enqueued for processing by the event dispatch
* thread.
*
* <p>When there are no more tokens, the last value found in the
- * child-cache or returned by <tt>childSpi</tt> is returned by this
- * method. If during the traversal, two <tt>"/"</tt> tokens occur
- * consecutively, or the final token is <tt>"/"</tt> (rather than a name),
- * an appropriate <tt>IllegalArgumentException</tt> is thrown.
+ * child-cache or returned by {@code childSpi} is returned by this
+ * method. If during the traversal, two {@code "/"} tokens occur
+ * consecutively, or the final token is {@code "/"} (rather than a name),
+ * an appropriate {@code IllegalArgumentException} is thrown.
*
- * <p> If the first character of <tt>path</tt> is <tt>'/'</tt>
+ * <p> If the first character of {@code path} is {@code '/'}
* (indicating an absolute path name) this preference node's
- * lock is dropped prior to breaking <tt>path</tt> into tokens, and
+ * lock is dropped prior to breaking {@code path} into tokens, and
* this method recursively traverses the path starting from the root
* (rather than starting from this node). The traversal is otherwise
* identical to the one described for relative path names. Dropping
@@ -889,7 +889,7 @@
}
/**
- * Implements the <tt>nodeExists</tt> method as per the specification in
+ * Implements the {@code nodeExists} method as per the specification in
* {@link Preferences#nodeExists(String)}.
*
* <p>This implementation is very similar to {@link #node(String)},
@@ -906,7 +906,7 @@
* with a slash character and is more than one character long).
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method and
- * <tt>pathname</tt> is not the empty string (<tt>""</tt>).
+ * {@code pathname} is not the empty string ({@code ""}).
*/
public boolean nodeExists(String path)
throws BackingStoreException
@@ -953,7 +953,7 @@
/**
- * Implements the <tt>removeNode()</tt> method as per the specification in
+ * Implements the {@code removeNode()} method as per the specification in
* {@link Preferences#removeNode()}.
*
* <p>This implementation checks to see that this node is the root; if so,
@@ -964,7 +964,7 @@
* of its children are cached: The {@link #childrenNamesSpi()} method is
* invoked and each returned child name is checked for containment in the
* child-cache. If a child is not already cached, the {@link
- * #childSpi(String)} method is invoked to create a <tt>Preferences</tt>
+ * #childSpi(String)} method is invoked to create a {@code Preferences}
* instance for it, and this instance is put into the child-cache. Then
* the helper method calls itself recursively on each node contained in its
* child-cache. Next, it invokes {@link #removeNodeSpi()}, marks itself
@@ -1024,7 +1024,7 @@
}
/**
- * Implements the <tt>name</tt> method as per the specification in
+ * Implements the {@code name} method as per the specification in
* {@link Preferences#name()}.
*
* <p>This implementation merely returns the name that was
@@ -1037,7 +1037,7 @@
}
/**
- * Implements the <tt>absolutePath</tt> method as per the specification in
+ * Implements the {@code absolutePath} method as per the specification in
* {@link Preferences#absolutePath()}.
*
* <p>This implementation merely returns the absolute path name that
@@ -1052,7 +1052,7 @@
}
/**
- * Implements the <tt>isUserNode</tt> method as per the specification in
+ * Implements the {@code isUserNode} method as per the specification in
* {@link Preferences#isUserNode()}.
*
* <p>This implementation compares this node's root node (which is stored
@@ -1060,8 +1060,8 @@
* {@link Preferences#userRoot()}. If the two object references are
* identical, this method returns true.
*
- * @return <tt>true</tt> if this preference node is in the user
- * preference tree, <tt>false</tt> if it's in the system
+ * @return {@code true} if this preference node is in the user
+ * preference tree, {@code false} if it's in the system
* preference tree.
*/
public boolean isUserNode() {
@@ -1160,7 +1160,7 @@
/**
* Put the given key-value association into this preference node. It is
- * guaranteed that <tt>key</tt> and <tt>value</tt> are non-null and of
+ * guaranteed that {@code key} and {@code value} are non-null and of
* legal length. Also, it is guaranteed that this node has not been
* removed. (The implementor needn't check for any of these things.)
*
@@ -1172,29 +1172,29 @@
/**
* Return the value associated with the specified key at this preference
- * node, or <tt>null</tt> if there is no association for this key, or the
+ * node, or {@code null} if there is no association for this key, or the
* association cannot be determined at this time. It is guaranteed that
- * <tt>key</tt> is non-null. Also, it is guaranteed that this node has
+ * {@code key} is non-null. Also, it is guaranteed that this node has
* not been removed. (The implementor needn't check for either of these
* things.)
*
* <p> Generally speaking, this method should not throw an exception
* under any circumstances. If, however, if it does throw an exception,
- * the exception will be intercepted and treated as a <tt>null</tt>
+ * the exception will be intercepted and treated as a {@code null}
* return value.
*
* <p>This method is invoked with the lock on this node held.
*
* @param key the key
* @return the value associated with the specified key at this preference
- * node, or <tt>null</tt> if there is no association for this
+ * node, or {@code null} if there is no association for this
* key, or the association cannot be determined at this time.
*/
protected abstract String getSpi(String key);
/**
* Remove the association (if any) for the specified key at this
- * preference node. It is guaranteed that <tt>key</tt> is non-null.
+ * preference node. It is guaranteed that {@code key} is non-null.
* Also, it is guaranteed that this node has not been removed.
* (The implementor needn't check for either of these things.)
*
@@ -1215,9 +1215,9 @@
* result of a single invocation to {@link Preferences#removeNode()}).
*
* <p>The removal of a node needn't become persistent until the
- * <tt>flush</tt> method is invoked on this node (or an ancestor).
+ * {@code flush} method is invoked on this node (or an ancestor).
*
- * <p>If this node throws a <tt>BackingStoreException</tt>, the exception
+ * <p>If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #removeNode()}
* invocation.
*
@@ -1235,7 +1235,7 @@
*
* <p>This method is invoked with the lock on this node held.
*
- * <p>If this node throws a <tt>BackingStoreException</tt>, the exception
+ * <p>If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #keys()} invocation.
*
* @return an array of the keys that have an associated value in this
@@ -1254,7 +1254,7 @@
*
* <p>This method is invoked with the lock on this node held.
*
- * <p>If this node throws a <tt>BackingStoreException</tt>, the exception
+ * <p>If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #childrenNames()}
* invocation.
*
@@ -1268,8 +1268,8 @@
throws BackingStoreException;
/**
- * Returns the named child if it exists, or <tt>null</tt> if it does not.
- * It is guaranteed that <tt>nodeName</tt> is non-null, non-empty,
+ * Returns the named child if it exists, or {@code null} if it does not.
+ * It is guaranteed that {@code nodeName} is non-null, non-empty,
* does not contain the slash character ('/'), and is no longer than
* {@link #MAX_NAME_LENGTH} characters. Also, it is guaranteed
* that this node has not been removed. (The implementor needn't check
@@ -1288,7 +1288,7 @@
* with the specified node name. If a child node has the correct name,
* the {@link #childSpi(String)} method is invoked and the resulting
* node is returned. If the iteration completes without finding the
- * specified name, <tt>null</tt> is returned.
+ * specified name, {@code null} is returned.
*
* @param nodeName name of the child to be searched for.
* @return the named child if it exists, or null if it does not.
@@ -1310,7 +1310,7 @@
/**
* Returns the named child of this preference node, creating it if it does
- * not already exist. It is guaranteed that <tt>name</tt> is non-null,
+ * not already exist. It is guaranteed that {@code name} is non-null,
* non-empty, does not contain the slash character ('/'), and is no longer
* than {@link #MAX_NAME_LENGTH} characters. Also, it is guaranteed that
* this node has not been removed. (The implementor needn't check for any
@@ -1325,12 +1325,12 @@
*
* <p>The implementer must ensure that the returned node has not been
* removed. If a like-named child of this node was previously removed, the
- * implementer must return a newly constructed <tt>AbstractPreferences</tt>
- * node; once removed, an <tt>AbstractPreferences</tt> node
+ * implementer must return a newly constructed {@code AbstractPreferences}
+ * node; once removed, an {@code AbstractPreferences} node
* cannot be "resuscitated."
*
* <p>If this method causes a node to be created, this node is not
- * guaranteed to be persistent until the <tt>flush</tt> method is
+ * guaranteed to be persistent until the {@code flush} method is
* invoked on this node or one of its ancestors (or descendants).
*
* <p>This method is invoked with the lock on this node held.
@@ -1350,7 +1350,7 @@
}
/**
- * Implements the <tt>sync</tt> method as per the specification in
+ * Implements the {@code sync} method as per the specification in
* {@link Preferences#sync()}.
*
* <p>This implementation calls a recursive helper method that locks this
@@ -1398,7 +1398,7 @@
* entire subtree at once, the implementer is encouraged to override
* sync(), rather than merely overriding this method.
*
- * <p>If this node throws a <tt>BackingStoreException</tt>, the exception
+ * <p>If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #sync()} invocation.
*
* @throws BackingStoreException if this operation cannot be completed
@@ -1408,7 +1408,7 @@
protected abstract void syncSpi() throws BackingStoreException;
/**
- * Implements the <tt>flush</tt> method as per the specification in
+ * Implements the {@code flush} method as per the specification in
* {@link Preferences#flush()}.
*
* <p>This implementation calls a recursive helper method that locks this
@@ -1459,7 +1459,7 @@
* encouraged to override flush(), rather than merely overriding this
* method.
*
- * <p>If this node throws a <tt>BackingStoreException</tt>, the exception
+ * <p>If this node throws a {@code BackingStoreException}, the exception
* will propagate out beyond the enclosing {@link #flush()} invocation.
*
* @throws BackingStoreException if this operation cannot be completed
@@ -1469,12 +1469,12 @@
protected abstract void flushSpi() throws BackingStoreException;
/**
- * Returns <tt>true</tt> iff this node (or an ancestor) has been
+ * Returns {@code true} iff this node (or an ancestor) has been
* removed with the {@link #removeNode()} method. This method
* locks this node prior to returning the contents of the private
* field used to track this state.
*
- * @return <tt>true</tt> iff this node (or an ancestor) has been
+ * @return {@code true} iff this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
*/
protected boolean isRemoved() {
@@ -1630,12 +1630,12 @@
}
/**
- * Implements the <tt>exportNode</tt> method as per the specification in
+ * Implements the {@code exportNode} method as per the specification in
* {@link Preferences#exportNode(OutputStream)}.
*
* @param os the output stream on which to emit the XML document.
* @throws IOException if writing to the specified output stream
- * results in an <tt>IOException</tt>.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
*/
@@ -1646,12 +1646,12 @@
}
/**
- * Implements the <tt>exportSubtree</tt> method as per the specification in
+ * Implements the {@code exportSubtree} method as per the specification in
* {@link Preferences#exportSubtree(OutputStream)}.
*
* @param os the output stream on which to emit the XML document.
* @throws IOException if writing to the specified output stream
- * results in an <tt>IOException</tt>.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
*/
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/Base64.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/Base64.java Wed Jul 05 20:44:51 2017 +0200
@@ -124,7 +124,7 @@
* Translates the specified Base64 string (as per Preferences.get(byte[]))
* into a byte array.
*
- * @throw IllegalArgumentException if <tt>s</tt> is not a valid Base64
+ * @throw IllegalArgumentException if {@code s} is not a valid Base64
* string.
*/
static byte[] base64ToByteArray(String s) {
@@ -136,7 +136,7 @@
* into a byte array.
*
* @throw IllegalArgumentException or ArrayOutOfBoundsException
- * if <tt>s</tt> is not a valid alternate representation
+ * if {@code s} is not a valid alternate representation
* Base64 string.
*/
static byte[] altBase64ToByteArray(String s) {
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/NodeChangeEvent.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/NodeChangeEvent.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,7 +28,7 @@
import java.io.NotSerializableException;
/**
- * An event emitted by a <tt>Preferences</tt> node to indicate that
+ * An event emitted by a {@code Preferences} node to indicate that
* a child of that node has been added or removed.<p>
*
* Note, that although NodeChangeEvent inherits Serializable interface from
@@ -52,7 +52,7 @@
private Preferences child;
/**
- * Constructs a new <code>NodeChangeEvent</code> instance.
+ * Constructs a new {@code NodeChangeEvent} instance.
*
* @param parent The parent of the node that was added or removed.
* @param child The node that was added or removed.
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/PreferenceChangeEvent.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/PreferenceChangeEvent.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,7 +28,7 @@
import java.io.NotSerializableException;
/**
- * An event emitted by a <tt>Preferences</tt> node to indicate that
+ * An event emitted by a {@code Preferences} node to indicate that
* a preference has been added, removed or has had its value changed.<p>
*
* Note, that although PreferenceChangeEvent inherits Serializable interface
@@ -52,18 +52,18 @@
private String key;
/**
- * New value for preference, or <tt>null</tt> if it was removed.
+ * New value for preference, or {@code null} if it was removed.
*
* @serial
*/
private String newValue;
/**
- * Constructs a new <code>PreferenceChangeEvent</code> instance.
+ * Constructs a new {@code PreferenceChangeEvent} instance.
*
* @param node The Preferences node that emitted the event.
* @param key The key of the preference that was changed.
- * @param newValue The new value of the preference, or <tt>null</tt>
+ * @param newValue The new value of the preference, or {@code null}
* if the preference is being removed.
*/
public PreferenceChangeEvent(Preferences node, String key,
@@ -94,7 +94,7 @@
/**
* Returns the new value for the preference.
*
- * @return The new value for the preference, or <tt>null</tt> if the
+ * @return The new value for the preference, or {@code null} if the
* preference was removed.
*/
public String getNewValue() {
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/Preferences.java Wed Jul 05 20:44:51 2017 +0200
@@ -72,10 +72,10 @@
* only restrictions on this name are that it cannot be the empty string, and
* it cannot contain the slash character ('/').
*
- * <p>The root node has an absolute path name of <tt>"/"</tt>. Children of
- * the root node have absolute path names of <tt>"/" + </tt><i><node
+ * <p>The root node has an absolute path name of {@code "/"}. Children of
+ * the root node have absolute path names of {@code "/" + }<i><node
* name></i>. All other nodes have absolute path names of <i><parent's
- * absolute path name></i><tt> + "/" + </tt><i><node name></i>.
+ * absolute path name></i>{@code + "/" + }<i><node name></i>.
* Note that all absolute path names begin with the slash character.
*
* <p>A node <i>n</i>'s path name relative to its ancestor <i>a</i>
@@ -102,18 +102,18 @@
* <p>All of the methods that modify preferences data are permitted to operate
* asynchronously; they may return immediately, and changes will eventually
* propagate to the persistent backing store with an implementation-dependent
- * delay. The <tt>flush</tt> method may be used to synchronously force
+ * delay. The {@code flush} method may be used to synchronously force
* updates to the backing store. Normal termination of the Java Virtual
* Machine will <i>not</i> result in the loss of pending updates -- an explicit
- * <tt>flush</tt> invocation is <i>not</i> required upon termination to ensure
+ * {@code flush} invocation is <i>not</i> required upon termination to ensure
* that pending updates are made persistent.
*
- * <p>All of the methods that read preferences from a <tt>Preferences</tt>
+ * <p>All of the methods that read preferences from a {@code Preferences}
* object require the invoker to provide a default value. The default value is
* returned if no value has been previously set <i>or if the backing store is
* unavailable</i>. The intent is to allow applications to operate, albeit
* with slightly degraded functionality, even if the backing store becomes
- * unavailable. Several methods, like <tt>flush</tt>, have semantics that
+ * unavailable. Several methods, like {@code flush}, have semantics that
* prevent them from operating if the backing store is unavailable. Ordinary
* applications should have no need to invoke any of these methods, which can
* be identified by the fact that they are declared to throw {@link
@@ -181,31 +181,31 @@
* value CDATA #REQUIRED >
* }</pre>
*
- * Every <tt>Preferences</tt> implementation must have an associated {@link
+ * Every {@code Preferences} implementation must have an associated {@link
* PreferencesFactory} implementation. Every Java(TM) SE implementation must provide
- * some means of specifying which <tt>PreferencesFactory</tt> implementation
+ * some means of specifying which {@code PreferencesFactory} implementation
* is used to generate the root preferences nodes. This allows the
* administrator to replace the default preferences implementation with an
* alternative implementation.
*
- * <p>Implementation note: In Sun's JRE, the <tt>PreferencesFactory</tt>
+ * <p>Implementation note: In Sun's JRE, the {@code PreferencesFactory}
* implementation is located as follows:
*
* <ol>
*
* <li><p>If the system property
- * <tt>java.util.prefs.PreferencesFactory</tt> is defined, then it is
+ * {@code java.util.prefs.PreferencesFactory} is defined, then it is
* taken to be the fully-qualified name of a class implementing the
- * <tt>PreferencesFactory</tt> interface. The class is loaded and
+ * {@code PreferencesFactory} interface. The class is loaded and
* instantiated; if this process fails then an unspecified error is
* thrown.</p></li>
*
- * <li><p> If a <tt>PreferencesFactory</tt> implementation class file
+ * <li><p> If a {@code PreferencesFactory} implementation class file
* has been installed in a jar file that is visible to the
* {@link java.lang.ClassLoader#getSystemClassLoader system class loader},
* and that jar file contains a provider-configuration file named
- * <tt>java.util.prefs.PreferencesFactory</tt> in the resource
- * directory <tt>META-INF/services</tt>, then the first class name
+ * {@code java.util.prefs.PreferencesFactory} in the resource
+ * directory {@code META-INF/services}, then the first class name
* specified in that file is taken. If more than one such jar file is
* provided, the first one found will be used. The class is loaded
* and instantiated; if this process fails then an unspecified error
@@ -213,7 +213,7 @@
*
* <li><p>Finally, if neither the above-mentioned system property nor
* an extension jar file is provided, then the system-wide default
- * <tt>PreferencesFactory</tt> implementation for the underlying
+ * {@code PreferencesFactory} implementation for the underlying
* platform is loaded and instantiated.</p></li>
*
* </ol>
@@ -328,19 +328,19 @@
* Returns the preference node from the calling user's preference tree
* that is associated (by convention) with the specified class's package.
* The convention is as follows: the absolute path name of the node is the
- * fully qualified package name, preceded by a slash (<tt>'/'</tt>), and
- * with each period (<tt>'.'</tt>) replaced by a slash. For example the
+ * fully qualified package name, preceded by a slash ({@code '/'}), and
+ * with each period ({@code '.'}) replaced by a slash. For example the
* absolute path name of the node associated with the class
- * <tt>com.acme.widget.Foo</tt> is <tt>/com/acme/widget</tt>.
+ * {@code com.acme.widget.Foo} is {@code /com/acme/widget}.
*
* <p>This convention does not apply to the unnamed package, whose
- * associated preference node is <tt><unnamed></tt>. This node
+ * associated preference node is {@code <unnamed>}. This node
* is not intended for long term use, but for convenience in the early
* development of programs that do not yet belong to a package, and
* for "throwaway" programs. <i>Valuable data should not be stored
* at this node as it is shared by all programs that use it.</i>
*
- * <p>A class <tt>Foo</tt> wishing to access preferences pertaining to its
+ * <p>A class {@code Foo} wishing to access preferences pertaining to its
* package can obtain a preference node as follows: <pre>
* static Preferences prefs = Preferences.userNodeForPackage(Foo.class);
* </pre>
@@ -353,15 +353,15 @@
* node and its ancestors if they do not already exist. If the returned
* node did not exist prior to this call, this node and any ancestors that
* were created by this call are not guaranteed to become permanent until
- * the <tt>flush</tt> method is called on the returned node (or one of its
+ * the {@code flush} method is called on the returned node (or one of its
* ancestors or descendants).
*
* @param c the class for whose package a user preference node is desired.
* @return the user preference node associated with the package of which
- * <tt>c</tt> is a member.
- * @throws NullPointerException if <tt>c</tt> is <tt>null</tt>.
+ * {@code c} is a member.
+ * @throws NullPointerException if {@code c} is {@code null}.
* @throws SecurityException if a security manager is present and
- * it denies <tt>RuntimePermission("preferences")</tt>.
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static Preferences userNodeForPackage(Class<?> c) {
@@ -372,19 +372,19 @@
* Returns the preference node from the system preference tree that is
* associated (by convention) with the specified class's package. The
* convention is as follows: the absolute path name of the node is the
- * fully qualified package name, preceded by a slash (<tt>'/'</tt>), and
- * with each period (<tt>'.'</tt>) replaced by a slash. For example the
+ * fully qualified package name, preceded by a slash ({@code '/'}), and
+ * with each period ({@code '.'}) replaced by a slash. For example the
* absolute path name of the node associated with the class
- * <tt>com.acme.widget.Foo</tt> is <tt>/com/acme/widget</tt>.
+ * {@code com.acme.widget.Foo} is {@code /com/acme/widget}.
*
* <p>This convention does not apply to the unnamed package, whose
- * associated preference node is <tt><unnamed></tt>. This node
+ * associated preference node is {@code <unnamed>}. This node
* is not intended for long term use, but for convenience in the early
* development of programs that do not yet belong to a package, and
* for "throwaway" programs. <i>Valuable data should not be stored
* at this node as it is shared by all programs that use it.</i>
*
- * <p>A class <tt>Foo</tt> wishing to access preferences pertaining to its
+ * <p>A class {@code Foo} wishing to access preferences pertaining to its
* package can obtain a preference node as follows: <pre>
* static Preferences prefs = Preferences.systemNodeForPackage(Foo.class);
* </pre>
@@ -397,15 +397,15 @@
* node and its ancestors if they do not already exist. If the returned
* node did not exist prior to this call, this node and any ancestors that
* were created by this call are not guaranteed to become permanent until
- * the <tt>flush</tt> method is called on the returned node (or one of its
+ * the {@code flush} method is called on the returned node (or one of its
* ancestors or descendants).
*
* @param c the class for whose package a system preference node is desired.
* @return the system preference node associated with the package of which
- * <tt>c</tt> is a member.
- * @throws NullPointerException if <tt>c</tt> is <tt>null</tt>.
+ * {@code c} is a member.
+ * @throws NullPointerException if {@code c} is {@code null}.
* @throws SecurityException if a security manager is present and
- * it denies <tt>RuntimePermission("preferences")</tt>.
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static Preferences systemNodeForPackage(Class<?> c) {
@@ -443,7 +443,7 @@
*
* @return the root preference node for the calling user.
* @throws SecurityException If a security manager is present and
- * it denies <tt>RuntimePermission("preferences")</tt>.
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static Preferences userRoot() {
@@ -459,7 +459,7 @@
*
* @return the root preference node for the system.
* @throws SecurityException If a security manager is present and
- * it denies <tt>RuntimePermission("preferences")</tt>.
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static Preferences systemRoot() {
@@ -483,10 +483,10 @@
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
- * @throws NullPointerException if key or value is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt> or if <tt>value.length</tt> exceeds
- * <tt>MAX_VALUE_LENGTH</tt>.
+ * @throws NullPointerException if key or value is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH} or if {@code value.length} exceeds
+ * {@code MAX_VALUE_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if either key or value contain
@@ -506,14 +506,14 @@
*
* @param key key whose associated value is to be returned.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>.
- * @return the value associated with <tt>key</tt>, or <tt>def</tt>
- * if no value is associated with <tt>key</tt>, or the backing
+ * preference node has no value associated with {@code key}.
+ * @return the value associated with {@code key}, or {@code def}
+ * if no value is associated with {@code key}, or the backing
* store is inaccessible.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>. (A
- * <tt>null</tt> value for <tt>def</tt> <i>is</i> permitted.)
+ * @throws NullPointerException if {@code key} is {@code null}. (A
+ * {@code null} value for {@code def} <i>is</i> permitted.)
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
*/
@@ -526,10 +526,10 @@
* <p>If this implementation supports <i>stored defaults</i>, and there is
* such a default for the specified preference, the stored default will be
* "exposed" by this call, in the sense that it will be returned
- * by a succeeding call to <tt>get</tt>.
+ * by a succeeding call to {@code get}.
*
* @param key key whose mapping is to be removed from the preference node.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains the null control
@@ -545,7 +545,7 @@
* <p>If this implementation supports <i>stored defaults</i>, and this
* node in the preferences hierarchy contains any such defaults,
* the stored defaults will be "exposed" by this call, in the sense that
- * they will be returned by succeeding calls to <tt>get</tt>.
+ * they will be returned by succeeding calls to {@code get}.
*
* @throws BackingStoreException if this operation cannot be completed
* due to a failure in the backing store, or inability to
@@ -565,9 +565,9 @@
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -582,27 +582,27 @@
* an integer as by {@link Integer#parseInt(String)}. Returns the
* specified default if there is no value associated with the key,
* the backing store is inaccessible, or if
- * <tt>Integer.parseInt(String)</tt> would throw a {@link
+ * {@code Integer.parseInt(String)} would throw a {@link
* NumberFormatException} if the associated value were passed. This
* method is intended for use in conjunction with {@link #putInt}.
*
* <p>If the implementation supports <i>stored defaults</i> and such a
* default exists, is accessible, and could be converted to an int
- * with <tt>Integer.parseInt</tt>, this int is returned in preference to
+ * with {@code Integer.parseInt}, this int is returned in preference to
* the specified default.
*
* @param key key whose associated value is to be returned as an int.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as an int,
* or the backing store is inaccessible.
* @return the int value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* an int.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #putInt(String,int)
@@ -619,9 +619,9 @@
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -636,27 +636,27 @@
* a long as by {@link Long#parseLong(String)}. Returns the
* specified default if there is no value associated with the key,
* the backing store is inaccessible, or if
- * <tt>Long.parseLong(String)</tt> would throw a {@link
+ * {@code Long.parseLong(String)} would throw a {@link
* NumberFormatException} if the associated value were passed. This
* method is intended for use in conjunction with {@link #putLong}.
*
* <p>If the implementation supports <i>stored defaults</i> and such a
* default exists, is accessible, and could be converted to a long
- * with <tt>Long.parseLong</tt>, this long is returned in preference to
+ * with {@code Long.parseLong}, this long is returned in preference to
* the specified default.
*
* @param key key whose associated value is to be returned as a long.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a long,
* or the backing store is inaccessible.
* @return the long value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a long.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #putLong(String,long)
@@ -667,15 +667,15 @@
/**
* Associates a string representing the specified boolean value with the
* specified key in this preference node. The associated string is
- * <tt>"true"</tt> if the value is true, and <tt>"false"</tt> if it is
+ * {@code "true"} if the value is true, and {@code "false"} if it is
* false. This method is intended for use in conjunction with
* {@link #getBoolean}.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -688,34 +688,34 @@
/**
* Returns the boolean value represented by the string associated with the
* specified key in this preference node. Valid strings
- * are <tt>"true"</tt>, which represents true, and <tt>"false"</tt>, which
- * represents false. Case is ignored, so, for example, <tt>"TRUE"</tt>
- * and <tt>"False"</tt> are also valid. This method is intended for use in
+ * are {@code "true"}, which represents true, and {@code "false"}, which
+ * represents false. Case is ignored, so, for example, {@code "TRUE"}
+ * and {@code "False"} are also valid. This method is intended for use in
* conjunction with {@link #putBoolean}.
*
* <p>Returns the specified default if there is no value
* associated with the key, the backing store is inaccessible, or if the
- * associated value is something other than <tt>"true"</tt> or
- * <tt>"false"</tt>, ignoring case.
+ * associated value is something other than {@code "true"} or
+ * {@code "false"}, ignoring case.
*
* <p>If the implementation supports <i>stored defaults</i> and such a
* default exists and is accessible, it is used in preference to the
* specified default, unless the stored default is something other than
- * <tt>"true"</tt> or <tt>"false"</tt>, ignoring case, in which case the
+ * {@code "true"} or {@code "false"}, ignoring case, in which case the
* specified default is used.
*
* @param key key whose associated value is to be returned as a boolean.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a boolean,
* or the backing store is inaccessible.
* @return the boolean value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a boolean.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #get(String,String)
@@ -732,9 +732,9 @@
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -748,27 +748,27 @@
* specified key in this preference node. The string is converted to an
* integer as by {@link Float#parseFloat(String)}. Returns the specified
* default if there is no value associated with the key, the backing store
- * is inaccessible, or if <tt>Float.parseFloat(String)</tt> would throw a
+ * is inaccessible, or if {@code Float.parseFloat(String)} would throw a
* {@link NumberFormatException} if the associated value were passed.
* This method is intended for use in conjunction with {@link #putFloat}.
*
* <p>If the implementation supports <i>stored defaults</i> and such a
* default exists, is accessible, and could be converted to a float
- * with <tt>Float.parseFloat</tt>, this float is returned in preference to
+ * with {@code Float.parseFloat}, this float is returned in preference to
* the specified default.
*
* @param key key whose associated value is to be returned as a float.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a float,
* or the backing store is inaccessible.
* @return the float value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a float.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #putFloat(String,float)
@@ -785,9 +785,9 @@
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
- * @throws IllegalArgumentException if <tt>key.length()</tt> exceeds
- * <tt>MAX_KEY_LENGTH</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
+ * @throws IllegalArgumentException if {@code key.length()} exceeds
+ * {@code MAX_KEY_LENGTH}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @throws IllegalArgumentException if key contains
@@ -801,27 +801,27 @@
* specified key in this preference node. The string is converted to an
* integer as by {@link Double#parseDouble(String)}. Returns the specified
* default if there is no value associated with the key, the backing store
- * is inaccessible, or if <tt>Double.parseDouble(String)</tt> would throw a
+ * is inaccessible, or if {@code Double.parseDouble(String)} would throw a
* {@link NumberFormatException} if the associated value were passed.
* This method is intended for use in conjunction with {@link #putDouble}.
*
* <p>If the implementation supports <i>stored defaults</i> and such a
* default exists, is accessible, and could be converted to a double
- * with <tt>Double.parseDouble</tt>, this double is returned in preference
+ * with {@code Double.parseDouble}, this double is returned in preference
* to the specified default.
*
* @param key key whose associated value is to be returned as a double.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a double,
* or the backing store is inaccessible.
* @return the double value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a double.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>.
+ * @throws NullPointerException if {@code key} is {@code null}.
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #putDouble(String,double)
@@ -837,14 +837,14 @@
* with one minor change: the string will consist solely of characters
* from the <i>Base64 Alphabet</i>; it will not contain any newline
* characters. Note that the maximum length of the byte array is limited
- * to three quarters of <tt>MAX_VALUE_LENGTH</tt> so that the length
- * of the Base64 encoded String does not exceed <tt>MAX_VALUE_LENGTH</tt>.
+ * to three quarters of {@code MAX_VALUE_LENGTH} so that the length
+ * of the Base64 encoded String does not exceed {@code MAX_VALUE_LENGTH}.
* This method is intended for use in conjunction with
* {@link #getByteArray}.
*
* @param key key with which the string form of value is to be associated.
* @param value value whose string form is to be associated with key.
- * @throws NullPointerException if key or value is <tt>null</tt>.
+ * @throws NullPointerException if key or value is {@code null}.
* @throws IllegalArgumentException if key.length() exceeds MAX_KEY_LENGTH
* or if value.length exceeds MAX_VALUE_LENGTH*3/4.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -879,17 +879,17 @@
*
* @param key key whose associated value is to be returned as a byte array.
* @param def the value to be returned in the event that this
- * preference node has no value associated with <tt>key</tt>
+ * preference node has no value associated with {@code key}
* or the associated value cannot be interpreted as a byte array,
* or the backing store is inaccessible.
* @return the byte array value represented by the string associated with
- * <tt>key</tt> in this preference node, or <tt>def</tt> if the
+ * {@code key} in this preference node, or {@code def} if the
* associated value does not exist or cannot be interpreted as
* a byte array.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
- * @throws NullPointerException if <tt>key</tt> is <tt>null</tt>. (A
- * <tt>null</tt> value for <tt>def</tt> <i>is</i> permitted.)
+ * @throws NullPointerException if {@code key} is {@code null}. (A
+ * {@code null} value for {@code def} <i>is</i> permitted.)
* @throws IllegalArgumentException if key contains the null control
* character, code point U+0000.
* @see #get(String,String)
@@ -932,7 +932,7 @@
public abstract String[] childrenNames() throws BackingStoreException;
/**
- * Returns the parent of this preference node, or <tt>null</tt> if this is
+ * Returns the parent of this preference node, or {@code null} if this is
* the root.
*
* @return the parent of this preference node.
@@ -945,12 +945,12 @@
* Returns the named preference node in the same tree as this node,
* creating it and any of its ancestors if they do not already exist.
* Accepts a relative or absolute path name. Relative path names
- * (which do not begin with the slash character <tt>('/')</tt>) are
+ * (which do not begin with the slash character {@code ('/')}) are
* interpreted relative to this preference node.
*
* <p>If the returned node did not exist prior to this call, this node and
* any ancestors that were created by this call are not guaranteed
- * to become permanent until the <tt>flush</tt> method is called on
+ * to become permanent until the {@code flush} method is called on
* the returned node (or one of its ancestors or descendants).
*
* @param pathName the path name of the preference node to return.
@@ -958,7 +958,7 @@
* @throws IllegalArgumentException if the path name is invalid (i.e.,
* it contains multiple consecutive slash characters, or ends
* with a slash character and is more than one character long).
- * @throws NullPointerException if path name is <tt>null</tt>.
+ * @throws NullPointerException if path name is {@code null}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @see #flush()
@@ -968,14 +968,14 @@
/**
* Returns true if the named preference node exists in the same tree
* as this node. Relative path names (which do not begin with the slash
- * character <tt>('/')</tt>) are interpreted relative to this preference
+ * character {@code ('/')}) are interpreted relative to this preference
* node.
*
* <p>If this node (or an ancestor) has already been removed with the
* {@link #removeNode()} method, it <i>is</i> legal to invoke this method,
- * but only with the path name <tt>""</tt>; the invocation will return
- * <tt>false</tt>. Thus, the idiom <tt>p.nodeExists("")</tt> may be
- * used to test whether <tt>p</tt> has been removed.
+ * but only with the path name {@code ""}; the invocation will return
+ * {@code false}. Thus, the idiom {@code p.nodeExists("")} may be
+ * used to test whether {@code p} has been removed.
*
* @param pathName the path name of the node whose existence
* is to be checked.
@@ -986,10 +986,10 @@
* @throws IllegalArgumentException if the path name is invalid (i.e.,
* it contains multiple consecutive slash characters, or ends
* with a slash character and is more than one character long).
- * @throws NullPointerException if path name is <tt>null</tt>.
+ * @throws NullPointerException if path name is {@code null}.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method and
- * <tt>pathName</tt> is not the empty string (<tt>""</tt>).
+ * {@code pathName} is not the empty string ({@code ""}).
*/
public abstract boolean nodeExists(String pathName)
throws BackingStoreException;
@@ -1000,19 +1000,19 @@
* removed, attempting any method other than {@link #name()},
* {@link #absolutePath()}, {@link #isUserNode()}, {@link #flush()} or
* {@link #node(String) nodeExists("")} on the corresponding
- * <tt>Preferences</tt> instance will fail with an
- * <tt>IllegalStateException</tt>. (The methods defined on {@link Object}
+ * {@code Preferences} instance will fail with an
+ * {@code IllegalStateException}. (The methods defined on {@link Object}
* can still be invoked on a node after it has been removed; they will not
- * throw <tt>IllegalStateException</tt>.)
+ * throw {@code IllegalStateException}.)
*
* <p>The removal is not guaranteed to be persistent until the
- * <tt>flush</tt> method is called on this node (or an ancestor).
+ * {@code flush} method is called on this node (or an ancestor).
*
* <p>If this implementation supports <i>stored defaults</i>, removing a
* node exposes any stored defaults at or below this node. Thus, a
- * subsequent call to <tt>nodeExists</tt> on this node's path name may
- * return <tt>true</tt>, and a subsequent call to <tt>node</tt> on this
- * path name may return a (different) <tt>Preferences</tt> instance
+ * subsequent call to {@code nodeExists} on this node's path name may
+ * return {@code true}, and a subsequent call to {@code node} on this
+ * path name may return a (different) {@code Preferences} instance
* representing a non-empty collection of preferences and/or children.
*
* @throws BackingStoreException if this operation cannot be completed
@@ -1041,19 +1041,19 @@
public abstract String absolutePath();
/**
- * Returns <tt>true</tt> if this preference node is in the user
- * preference tree, <tt>false</tt> if it's in the system preference tree.
+ * Returns {@code true} if this preference node is in the user
+ * preference tree, {@code false} if it's in the system preference tree.
*
- * @return <tt>true</tt> if this preference node is in the user
- * preference tree, <tt>false</tt> if it's in the system
+ * @return {@code true} if this preference node is in the user
+ * preference tree, {@code false} if it's in the system
* preference tree.
*/
public abstract boolean isUserNode();
/**
* Returns a string representation of this preferences node,
- * as if computed by the expression:<tt>(this.isUserNode() ? "User" :
- * "System") + " Preference Node: " + this.absolutePath()</tt>.
+ * as if computed by the expression:{@code (this.isUserNode() ? "User" :
+ * "System") + " Preference Node: " + this.absolutePath()}.
*/
public abstract String toString();
@@ -1086,9 +1086,9 @@
/**
* Ensures that future reads from this preference node and its
* descendants reflect any changes that were committed to the persistent
- * store (from any VM) prior to the <tt>sync</tt> invocation. As a
+ * store (from any VM) prior to the {@code sync} invocation. As a
* side-effect, forces any changes in the contents of this preference node
- * and its descendants to the persistent store, as if the <tt>flush</tt>
+ * and its descendants to the persistent store, as if the {@code flush}
* method had been invoked on this node.
*
* @throws BackingStoreException if this operation cannot be completed
@@ -1107,7 +1107,7 @@
* node, or when the value associated with a preference is changed.
* (Preference change events are <i>not</i> generated by the {@link
* #removeNode()} method, which generates a <i>node change event</i>.
- * Preference change events <i>are</i> generated by the <tt>clear</tt>
+ * Preference change events <i>are</i> generated by the {@code clear}
* method.)
*
* <p>Events are only guaranteed for changes made within the same JVM
@@ -1118,7 +1118,7 @@
* desiring such events must register with each descendant.
*
* @param pcl The preference change listener to add.
- * @throws NullPointerException if <tt>pcl</tt> is null.
+ * @throws NullPointerException if {@code pcl} is null.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @see #removePreferenceChangeListener(PreferenceChangeListener)
@@ -1132,7 +1132,7 @@
* receives preference change events.
*
* @param pcl The preference change listener to remove.
- * @throws IllegalArgumentException if <tt>pcl</tt> was not a registered
+ * @throws IllegalArgumentException if {@code pcl} was not a registered
* preference change listener on this node.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
@@ -1163,8 +1163,8 @@
* circumstances, implementations are neither required to generate node
* change events nor prohibited from doing so.
*
- * @param ncl The <tt>NodeChangeListener</tt> to add.
- * @throws NullPointerException if <tt>ncl</tt> is null.
+ * @param ncl The {@code NodeChangeListener} to add.
+ * @throws NullPointerException if {@code ncl} is null.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @see #removeNodeChangeListener(NodeChangeListener)
@@ -1173,12 +1173,12 @@
public abstract void addNodeChangeListener(NodeChangeListener ncl);
/**
- * Removes the specified <tt>NodeChangeListener</tt>, so it no longer
+ * Removes the specified {@code NodeChangeListener}, so it no longer
* receives change events.
*
- * @param ncl The <tt>NodeChangeListener</tt> to remove.
- * @throws IllegalArgumentException if <tt>ncl</tt> was not a registered
- * <tt>NodeChangeListener</tt> on this node.
+ * @param ncl The {@code NodeChangeListener} to remove.
+ * @throws IllegalArgumentException if {@code ncl} was not a registered
+ * {@code NodeChangeListener} on this node.
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* @see #addNodeChangeListener(NodeChangeListener)
@@ -1206,7 +1206,7 @@
*
* @param os the output stream on which to emit the XML document.
* @throws IOException if writing to the specified output stream
- * results in an <tt>IOException</tt>.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
* @see #importPreferences(InputStream)
@@ -1237,7 +1237,7 @@
*
* @param os the output stream on which to emit the XML document.
* @throws IOException if writing to the specified output stream
- * results in an <tt>IOException</tt>.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -1273,11 +1273,11 @@
*
* @param is the input stream from which to read the XML document.
* @throws IOException if reading from the specified input stream
- * results in an <tt>IOException</tt>.
+ * results in an {@code IOException}.
* @throws InvalidPreferencesFormatException Data on input stream does not
* constitute a valid XML document with the mandated document type.
* @throws SecurityException If a security manager is present and
- * it denies <tt>RuntimePermission("preferences")</tt>.
+ * it denies {@code RuntimePermission("preferences")}.
* @see RuntimePermission
*/
public static void importPreferences(InputStream is)
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/PreferencesFactory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/PreferencesFactory.java Wed Jul 05 20:44:51 2017 +0200
@@ -29,12 +29,12 @@
/**
* A factory object that generates Preferences objects. Providers of
* new {@link Preferences} implementations should provide corresponding
- * <tt>PreferencesFactory</tt> implementations so that the new
- * <tt>Preferences</tt> implementation can be installed in place of the
+ * {@code PreferencesFactory} implementations so that the new
+ * {@code Preferences} implementation can be installed in place of the
* platform-specific default implementation.
*
- * <p><strong>This class is for <tt>Preferences</tt> implementers only.
- * Normal users of the <tt>Preferences</tt> facility should have no need to
+ * <p><strong>This class is for {@code Preferences} implementers only.
+ * Normal users of the {@code Preferences} facility should have no need to
* consult this documentation.</strong>
*
* @author Josh Bloch
--- a/jdk/src/java.prefs/share/classes/java/util/prefs/XmlSupport.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.prefs/share/classes/java/util/prefs/XmlSupport.java Wed Jul 05 20:44:51 2017 +0200
@@ -88,7 +88,7 @@
* an XML document conforming to the definition in the Preferences spec.
*
* @throws IOException if writing to the specified output stream
- * results in an <tt>IOException</tt>.
+ * results in an {@code IOException}.
* @throws BackingStoreException if preference data cannot be read from
* backing store.
* @throws IllegalStateException if this node (or an ancestor) has been
@@ -188,7 +188,7 @@
* spec.
*
* @throws IOException if reading from the specified output stream
- * results in an <tt>IOException</tt>.
+ * results in an {@code IOException}.
* @throws InvalidPreferencesFormatException Data on input stream does not
* constitute a valid XML document with the mandated document type.
*/
@@ -337,7 +337,7 @@
* as the internal (undocumented) format for FileSystemPrefs.
*
* @throws IOException if writing to the specified output stream
- * results in an <tt>IOException</tt>.
+ * results in an {@code IOException}.
*/
static void exportMap(OutputStream os, Map<String, String> map) throws IOException {
Document doc = createPrefsDoc("map");
@@ -363,7 +363,7 @@
* the key-value pairs int the XML-document when this method returns.)
*
* @throws IOException if reading from the specified output stream
- * results in an <tt>IOException</tt>.
+ * results in an {@code IOException}.
* @throws InvalidPreferencesFormatException Data on input stream does not
* constitute a valid XML document with the mandated document type.
*/
--- a/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java Wed Jul 05 20:44:51 2017 +0200
@@ -33,10 +33,10 @@
import sun.util.logging.PlatformLogger;
/**
- * Windows registry based implementation of <tt>Preferences</tt>.
- * <tt>Preferences</tt>' <tt>systemRoot</tt> and <tt>userRoot</tt> are stored in
- * <tt>HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs</tt> and
- * <tt>HKEY_CURRENT_USER\Software\JavaSoft\Prefs</tt> correspondingly.
+ * Windows registry based implementation of {@code Preferences}.
+ * {@code Preferences}' {@code systemRoot} and {@code userRoot} are stored in
+ * {@code HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Prefs} and
+ * {@code HKEY_CURRENT_USER\Software\JavaSoft\Prefs} correspondingly.
*
* @author Konstantin Kladko
* @see Preferences
@@ -60,31 +60,31 @@
private static PlatformLogger logger;
/**
- * Windows registry path to <tt>Preferences</tt>'s root nodes.
+ * Windows registry path to {@code Preferences}'s root nodes.
*/
private static final byte[] WINDOWS_ROOT_PATH =
stringToByteArray("Software\\JavaSoft\\Prefs");
/**
- * Windows handles to <tt>HKEY_CURRENT_USER</tt> and
- * <tt>HKEY_LOCAL_MACHINE</tt> hives.
+ * Windows handles to {@code HKEY_CURRENT_USER} and
+ * {@code HKEY_LOCAL_MACHINE} hives.
*/
private static final int HKEY_CURRENT_USER = 0x80000001;
private static final int HKEY_LOCAL_MACHINE = 0x80000002;
/**
- * Mount point for <tt>Preferences</tt>' user root.
+ * Mount point for {@code Preferences}' user root.
*/
private static final int USER_ROOT_NATIVE_HANDLE = HKEY_CURRENT_USER;
/**
- * Mount point for <tt>Preferences</tt>' system root.
+ * Mount point for {@code Preferences}' system root.
*/
private static final int SYSTEM_ROOT_NATIVE_HANDLE = HKEY_LOCAL_MACHINE;
/**
* Maximum byte-encoded path length for Windows native functions,
- * ending <tt>null</tt> character not included.
+ * ending {@code null} character not included.
*/
private static final int MAX_WINDOWS_PATH_LENGTH = 256;
@@ -388,7 +388,7 @@
}
/**
- * Constructs a <tt>WindowsPreferences</tt> node, creating underlying
+ * Constructs a {@code WindowsPreferences} node, creating underlying
* Windows registry node and all its Windows parents, if they are not yet
* created.
* Logs a warning message, if Windows Registry is unavailable.
@@ -617,7 +617,7 @@
}
/**
- * Implements <tt>AbstractPreferences</tt> <tt>putSpi()</tt> method.
+ * Implements {@code AbstractPreferences} {@code putSpi()} method.
* Puts name-value pair into the underlying Windows registry node.
* Logs a warning, if Windows registry is unavailable.
* @see #getSpi(String)
@@ -645,7 +645,7 @@
}
/**
- * Implements <tt>AbstractPreferences</tt> <tt>getSpi()</tt> method.
+ * Implements {@code AbstractPreferences} {@code getSpi()} method.
* Gets a string value from the underlying Windows registry node.
* Logs a warning, if Windows registry is unavailable.
* @see #putSpi(String, String)
@@ -666,7 +666,7 @@
}
/**
- * Implements <tt>AbstractPreferences</tt> <tt>removeSpi()</tt> method.
+ * Implements {@code AbstractPreferences} {@code removeSpi()} method.
* Deletes a string name-value pair from the underlying Windows registry
* node, if this value still exists.
* Logs a warning, if Windows registry is unavailable or key has already
@@ -692,7 +692,7 @@
}
/**
- * Implements <tt>AbstractPreferences</tt> <tt>keysSpi()</tt> method.
+ * Implements {@code AbstractPreferences} {@code keysSpi()} method.
* Gets value names from the underlying Windows registry node.
* Throws a BackingStoreException and logs a warning, if
* Windows registry is unavailable.
@@ -744,7 +744,7 @@
}
/**
- * Implements <tt>AbstractPreferences</tt> <tt>childrenNamesSpi()</tt> method.
+ * Implements {@code AbstractPreferences} {@code childrenNamesSpi()} method.
* Calls Windows registry to retrive children of this node.
* Throws a BackingStoreException and logs a warning message,
* if Windows registry is not available.
@@ -798,7 +798,7 @@
}
/**
- * Implements <tt>Preferences</tt> <tt>flush()</tt> method.
+ * Implements {@code Preferences} {@code flush()} method.
* Flushes Windows registry changes to disk.
* Throws a BackingStoreException and logs a warning message if Windows
* registry is not available.
@@ -837,7 +837,7 @@
/**
- * Implements <tt>Preferences</tt> <tt>sync()</tt> method.
+ * Implements {@code Preferences} {@code sync()} method.
* Flushes Windows registry changes to disk. Equivalent to flush().
* @see flush()
*/
@@ -848,7 +848,7 @@
}
/**
- * Implements <tt>AbstractPreferences</tt> <tt>childSpi()</tt> method.
+ * Implements {@code AbstractPreferences} {@code childSpi()} method.
* Constructs a child node with a
* given name and creates its underlying Windows registry node,
* if it does not exist.
@@ -859,7 +859,7 @@
}
/**
- * Implements <tt>AbstractPreferences</tt> <tt>removeNodeSpi()</tt> method.
+ * Implements {@code AbstractPreferences} {@code removeNodeSpi()} method.
* Deletes underlying Windows registry node.
* Throws a BackingStoreException and logs a warning, if Windows registry
* is not available.
@@ -956,7 +956,7 @@
* "A" is encoded as "/A". Character '\' is encoded as '//',
* '/' is encoded as '\'.
* The constructed string is converted to byte array by truncating the
- * highest byte and adding the terminating <tt>null</tt> character.
+ * highest byte and adding the terminating {@code null} character.
* <p>
* <i>altBase64</i> encoding is used, if java string does contain at least
* one character less, than 0x0020, or greater, than 0x007f.
--- a/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferencesFactory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferencesFactory.java Wed Jul 05 20:44:51 2017 +0200
@@ -25,7 +25,7 @@
package java.util.prefs;
/**
- * Implementation of <tt>PreferencesFactory</tt> to return
+ * Implementation of {@code PreferencesFactory} to return
* WindowsPreferences objects.
*
* @author Konstantin Kladko
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSCredentialImpl.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSCredentialImpl.java Wed Jul 05 20:44:51 2017 +0200
@@ -547,8 +547,8 @@
/**
* Returns the specified mechanism's credential-element.
*
- * @param mechOid - the oid for mechanism to retrieve
- * @param throwExcep - boolean indicating if the function is
+ * @param mechOid the oid for mechanism to retrieve
+ * @param initiate boolean indicating if the function is
* to throw exception or return null when element is not
* found.
* @return mechanism credential object
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSToken.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/GSSToken.java Wed Jul 05 20:44:51 2017 +0200
@@ -84,7 +84,7 @@
*
* @param data the array containing the bytes of the integer value
* @param pos the offset in the array
- * @size the number of bytes to read from the array.
+ * @param size the number of bytes to read from the array.
* @return the integer value
*/
public static final int readLittleEndian(byte[] data, int pos, int size) {
@@ -141,7 +141,7 @@
* Reads a two byte integer value from an InputStream.
*
* @param is the InputStream to read from
- * @returns the integer value
+ * @return the integer value
* @throws IOException if some errors occurs while reading the integer
* bytes.
*/
@@ -155,7 +155,7 @@
*
* @param src the byte arra to read from
* @param pos the offset to start reading from
- * @returns the integer value
+ * @return the integer value
*/
public static final int readInt(byte[] src, int pos) {
return ((0xFF & src[pos])<<8 | (0xFF & src[pos+1]));
@@ -167,8 +167,8 @@
*
* @param is the InputStream to read from
* @param buffer the buffer to store the bytes into
- * @param throws EOFException if EOF is reached before all bytes are
- * read.
+ * @throws EOFException if EOF is reached before all bytes are
+ * read.
* @throws IOException is an error occurs while reading
*/
public static final void readFully(InputStream is, byte[] buffer)
@@ -184,8 +184,8 @@
* @param buffer the buffer to store the bytes into
* @param offset the offset to start storing at
* @param len the number of bytes to read
- * @param throws EOFException if EOF is reached before all bytes are
- * read.
+ * @throws EOFException if EOF is reached before all bytes are
+ * read.
* @throws IOException is an error occurs while reading
*/
public static final void readFully(InputStream is,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/LoginConfigImpl.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/LoginConfigImpl.java Wed Jul 05 20:44:51 2017 +0200
@@ -48,7 +48,7 @@
* A new instance of LoginConfigImpl must be created for each login request
* since it's only used by a single (caller, mech) pair
* @param caller defined in GSSUtil as CALLER_XXX final fields
- * @param oid defined in GSSUtil as XXX_MECH_OID final fields
+ * @param mech defined in GSSUtil as XXX_MECH_OID final fields
*/
public LoginConfigImpl(GSSCaller caller, Oid mech) {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/ProviderList.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/ProviderList.java Wed Jul 05 20:44:51 2017 +0200
@@ -46,7 +46,7 @@
* queries this class whenever it needs a mechanism's factory.<p>
*
* This class stores an ordered list of pairs of the form
- * <provider, oid>. When it attempts to instantiate a mechanism
+ * {@code <provider, oid>}. When it attempts to instantiate a mechanism
* defined by oid o, it steps through the list looking for an entry
* with oid=o, or with oid=null. (An entry with oid=null matches all
* mechanisms.) When it finds such an entry, the corresponding
@@ -74,12 +74,12 @@
* the system ones don't suffice.<p>
*
* If a mechanism's factory is being obtained from a provider as a
- * result of encountering a entryof the form <provider, oid> where
+ * result of encountering a entryof the form {@code <provider, oid>} where
* oid is non-null, then the assumption is that the application added
* this entry and it wants this mechanism to be obtained from this
* provider. Thus is the provider does not actually contain the
* requested mechanism, an exception will be thrown. However, if the
- * entry were of the form <provider, null>, then it is viewed more
+ * entry were of the form {@code <provider, null>}, then it is viewed more
* liberally and is simply skipped over if the provider does not claim to
* support the requested mechanism.
*/
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/krb5/Krb5NameElement.java Wed Jul 05 20:44:51 2017 +0200
@@ -198,8 +198,8 @@
* If either name denotes an anonymous principal, the call should
* return false.
*
- * @param name to be compared with
- * @returns true if they both refer to the same entity, else false
+ * @param other to be compared with
+ * @return true if they both refer to the same entity, else false
* @exception GSSException with major codes of BAD_NAMETYPE,
* BAD_NAME, FAILURE
*/
@@ -224,7 +224,7 @@
* situation where an error occurs.
*
* @param another the object to be compared to
- * @returns true if they both refer to the same entity, else false
+ * @return true if they both refer to the same entity, else false
* @see #equals(GSSNameSpi)
*/
public boolean equals(Object another) {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSContextSpi.java Wed Jul 05 20:44:51 2017 +0200
@@ -51,14 +51,14 @@
* and the context flags before the context is fully established. The
* isProtReady method is used to indicate that these services are
* available.
- *<p>
+ * <p>
* <strong>
* Context establishment tokens are defined in a mechanism independent
* format in section 3.1 of RFC 2743. The GSS-Framework will add
* and remove the mechanism independent header portion of this token format
* depending on whether a token is received or is being sent. The mechanism
- * should only generate or expect to read the inner-context token portion..
- * <p>
+ * should only generate or expect to read the inner-context token portion.
+ * <br>
* On the other hands, tokens used for per-message calls are generated
* entirely by the mechanism. It is possible that the mechanism chooses to
* encase inner-level per-message tokens in a header similar to that used
@@ -239,7 +239,7 @@
* asked to provide.
* @param confReq a flag indicating whether confidentiality will be
* requested or not
- * @param outputSize the maximum size of the output token
+ * @param maxTokSize the maximum size of the output token
* @return the maximum size for the input message that can be
* provided to the wrap() method in order to guarantee that these
* requirements are met.
@@ -254,7 +254,7 @@
* @param is the user-provided message to be protected
* @param os the token to be sent to the peer. It includes
* the message from <i>is</i> with the requested protection.
- * @param msgPro on input it contains the requested qop and
+ * @param msgProp on input it contains the requested qop and
* confidentiality state, on output, the applied values
* @exception GSSException may be thrown
* @see unwrap
@@ -365,7 +365,7 @@
*
* @param is token generated by getMIC
* @param msgStr the message to check integrity for
- * @param msgProp will contain the applied QOP and confidentiality
+ * @param mProp will contain the applied QOP and confidentiality
* states of the token as well as any informatory status codes
* @exception GSSException may be thrown
*/
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSNameSpi.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/GSSNameSpi.java Wed Jul 05 20:44:51 2017 +0200
@@ -46,7 +46,7 @@
* return false.
*
* @param name to be compared with
- * @returns true if they both refer to the same entity, else false
+ * @return true if they both refer to the same entity, else false
* @exception GSSException with major codes of BAD_NAMETYPE,
* BAD_NAME, FAILURE
*/
@@ -60,7 +60,7 @@
* situation where an error occurs.
*
* @param another the object to be compared to
- * @returns true if they both refer to the same entity, else false
+ * @return true if they both refer to the same entity, else false
* @see #equals(GSSNameSpi)
*/
public boolean equals(Object another);
--- a/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/MechanismFactory.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/jgss/spi/MechanismFactory.java Wed Jul 05 20:44:51 2017 +0200
@@ -147,7 +147,7 @@
* <p>
* An exported name will generally be passed in using this method.
*
- * @param nameBytes the bytes describing this entity to the mechanism
+ * @param name the bytes describing this entity to the mechanism
* @param nameType an Oid serving as a clue as to how the mechanism should
* interpret the nameStr
* @throws GSSException if any of the errors described in RFC 2743 for
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java Wed Jul 05 20:44:51 2017 +0200
@@ -128,8 +128,8 @@
/**
* Constructs a new Checksum using the raw data and type.
- * @data the byte array of checksum.
- * @new_cksumType the type of checksum.
+ * @param data the byte array of checksum.
+ * @param new_cksumType the type of checksum.
*
*/
// used in InitialToken
@@ -141,8 +141,8 @@
/**
* Constructs a new Checksum by calculating the checksum over the data
* using specified checksum type.
- * @new_cksumType the type of checksum.
- * @data the data that needs to be performed a checksum calculation on.
+ * @param new_cksumType the type of checksum.
+ * @param data the data that needs to be performed a checksum calculation on.
*/
public Checksum(int new_cksumType, byte[] data)
throws KdcErrException, KrbCryptoException {
@@ -159,8 +159,8 @@
/**
* Constructs a new Checksum by calculating the keyed checksum
* over the data using specified checksum type.
- * @new_cksumType the type of checksum.
- * @data the data that needs to be performed a checksum calculation on.
+ * @param new_cksumType the type of checksum.
+ * @param data the data that needs to be performed a checksum calculation on.
*/
// KrbSafe, KrbTgsReq
public Checksum(int new_cksumType, byte[] data,
@@ -238,12 +238,12 @@
/**
* Encodes a Checksum object.
- * <xmp>
+ * <pre>{@code
* Checksum ::= SEQUENCE {
* cksumtype [0] Int32,
* checksum [1] OCTET STRING
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Wed Jul 05 20:44:51 2017 +0200
@@ -330,7 +330,7 @@
*
* @param s the string duration
* @return time in seconds
- * @throw KrbException if format is illegal
+ * @throws KrbException if format is illegal
*/
public static int duration(String s) throws KrbException {
@@ -392,7 +392,7 @@
* @param keys the keys
* @return the int value, Integer.MIN_VALUE is returned if it cannot be
* found or the value is not a legal integer.
- * @throw IllegalArgumentException if any of the keys is illegal
+ * @throws IllegalArgumentException if any of the keys is illegal
* @see #get(java.lang.String[])
*/
public int getIntValue(String... keys) {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java Wed Jul 05 20:44:51 2017 +0200
@@ -279,7 +279,7 @@
* @param ticketCache the path to the tickets file. A value
* of null will be accepted to indicate that the default
* path should be searched
- * @returns the TGT credentials or null if none were found. If the tgt
+ * @return the TGT credentials or null if none were found. If the tgt
* expired, it is the responsibility of the caller to determine this.
*/
public static Credentials acquireTGTFromCache(PrincipalName princ,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptedData.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptedData.java Wed Jul 05 20:44:51 2017 +0200
@@ -259,20 +259,20 @@
/**
* Returns an ASN.1 encoded EncryptedData type.
*
- * <xmp>
+ * <pre>{@code
* EncryptedData ::= SEQUENCE {
* etype [0] Int32 -- EncryptionType --,
* kvno [1] UInt32 OPTIONAL,
* cipher [2] OCTET STRING -- ciphertext
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
* specification available at
* <a href="http://www.ietf.org/rfc/rfc4120.txt">
* http://www.ietf.org/rfc/rfc4120.txt</a>.
- * <p>
+ *
* @return byte array of encoded EncryptedData object.
* @exception Asn1Exception if an error occurs while decoding an
* ASN1 encoded data.
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java Wed Jul 05 20:44:51 2017 +0200
@@ -101,11 +101,11 @@
* Obtains all versions of the secret key of the principal from a
* keytab.
*
- * @Param princ the principal whose secret key is desired
+ * @param princ the principal whose secret key is desired
* @param keytab the path to the keytab file. A value of null
* will be accepted to indicate that the default path should be
* searched.
- * @returns an array of secret keys or null if none were found.
+ * @return an array of secret keys or null if none were found.
*/
public static EncryptionKey[] acquireSecretKeys(PrincipalName princ,
String keytab) {
@@ -127,7 +127,7 @@
* @param password NOT null
* @param etype
* @param snp can be NULL
- * @returns never null
+ * @return never null
*/
public static EncryptionKey acquireSecretKey(PrincipalName cname,
char[] password, int etype, PAData.SaltAndParams snp)
@@ -150,7 +150,7 @@
* @param salt NOT null
* @param etype
* @param s2kparams can be NULL
- * @returns never null
+ * @return never null
*/
public static EncryptionKey acquireSecretKey(char[] password,
String salt, int etype, byte[] s2kparams)
@@ -388,11 +388,11 @@
/**
* Returns the ASN.1 encoding of this EncryptionKey.
*
- * <xmp>
+ * <pre>{@code
* EncryptionKey ::= SEQUENCE {
* keytype[0] INTEGER,
* keyvalue[1] OCTET STRING }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java Wed Jul 05 20:44:51 2017 +0200
@@ -110,7 +110,7 @@
* realm, where default realm will be used. This realm will be the target
* realm for AS-REQ. I believe a client should only get initial TGT from
* its own realm.
- * @param keys must not be null. if empty, might be quite useless.
+ * @param ktab must not be null. If empty, might be quite useless.
* This argument will neither be modified nor stored by the method.
* @throws KrbException
*/
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbCred.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbCred.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,8 +34,6 @@
import sun.security.krb5.internal.*;
import sun.security.krb5.internal.crypto.KeyUsage;
import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import sun.security.util.DerValue;
@@ -65,7 +63,6 @@
PrincipalName client = tgt.getClient();
PrincipalName tgService = tgt.getServer();
- PrincipalName server = serviceTicket.getServer();
if (!serviceTicket.getClient().equals(client))
throw new KrbException(Krb5.KRB_ERR_GENERIC,
"Client principal does not match");
@@ -78,28 +75,10 @@
options.set(KDCOptions.FORWARDED, true);
options.set(KDCOptions.FORWARDABLE, true);
- HostAddresses sAddrs = null;
-
- // GSSName.NT_HOSTBASED_SERVICE should display with KRB_NT_SRV_HST
- if (server.getNameType() == PrincipalName.KRB_NT_SRV_HST) {
- sAddrs = new HostAddresses(server);
- } else if (server.getNameType() == PrincipalName.KRB_NT_UNKNOWN) {
- // Sometimes this is also a server
- if (server.getNameStrings().length >= 2) {
- String host = server.getNameStrings()[1];
- try {
- InetAddress[] addr = InetAddress.getAllByName(host);
- if (addr != null && addr.length > 0) {
- sAddrs = new HostAddresses(addr);
- }
- } catch (UnknownHostException ioe) {
- // maybe we guessed wrong, let sAddrs be null
- }
- }
- }
-
KrbTgsReq tgsReq = new KrbTgsReq(options, tgt, tgService,
- null, null, null, null, sAddrs, null, null, null);
+ null, null, null, null,
+ null, // No easy way to get addresses right
+ null, null, null);
credMessg = createMessage(tgsReq.sendAndGetCreds(), key);
obuf = credMessg.asn1Encode();
@@ -111,7 +90,6 @@
EncryptionKey sessionKey
= delegatedCreds.getSessionKey();
PrincipalName princ = delegatedCreds.getClient();
- Realm realm = princ.getRealm();
PrincipalName tgService = delegatedCreds.getServer();
KrbCredInfo credInfo = new KrbCredInfo(sessionKey,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/PrincipalName.java Wed Jul 05 20:44:51 2017 +0200
@@ -45,14 +45,14 @@
/**
* Implements the ASN.1 PrincipalName type and its realm in a single class.
- * <xmp>
+ * <pre>{@code
* Realm ::= KerberosString
*
* PrincipalName ::= SEQUENCE {
* name-type [0] Int32,
* name-string [1] SEQUENCE OF KerberosString
* }
- * </xmp>
+ * }</pre>
* This class is immutable.
* @see Realm
*/
@@ -211,14 +211,14 @@
/**
* Returns the ASN.1 encoding of the
- * <xmp>
+ * <pre>{@code
* PrincipalName ::= SEQUENCE {
* name-type [0] Int32,
* name-string [1] SEQUENCE OF KerberosString
* }
*
* KerberosString ::= GeneralString (IA5String)
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
@@ -638,7 +638,8 @@
* name, the second component is returned.
* Null is returned if there are not two or more
* components in the name.
- * @returns instance component of a multi-component name.
+ *
+ * @return instance component of a multi-component name.
*/
public String getInstanceComponent()
{
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Realm.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Realm.java Wed Jul 05 20:44:51 2017 +0200
@@ -41,9 +41,8 @@
/**
* Implements the ASN.1 Realm type.
*
- * <xmp>
- * Realm ::= GeneralString
- * </xmp>
+ * {@code Realm ::= GeneralString}
+ *
* This class is immutable.
*/
public class Realm implements Cloneable {
@@ -244,8 +243,8 @@
*
* @param cRealm the initiating realm, not null
* @param sRealm the target realm, not null, not equals to cRealm
- * @returns array of realms including at least cRealm as the first
- * element
+ * @return array of realms including at least cRealm as the first
+ * element
*/
public static String[] getRealmsList(String cRealm, String sRealm) {
try {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APOptions.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APOptions.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,17 +38,17 @@
/**
* Implements the ASN.1 APOptions type.
*
- * <xmp>
+ * <pre>{@code
* APOptions ::= KerberosFlags
* -- reserved(0),
* -- use-session-key(1),
* -- mutual-required(2)
- * </xmp>
*
* KerberosFlags ::= BIT STRING (SIZE (32..MAX))
* -- minimum number of bits shall be sent,
* -- but no fewer than 32
*
+ * }</pre>
* <p>
* This definition reflects the Network Working Group RFC4120
* specification available at
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APRep.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APRep.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,13 +39,13 @@
/**
* Implements the ASN.1 AP-REP type.
*
- * <xmp>
+ * <pre>{@code
* AP-REP ::= [APPLICATION 15] SEQUENCE {
* pvno [0] INTEGER (5),
* msg-type [1] INTEGER (15),
* enc-part [2] EncryptedData -- EncAPRepPart
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APReq.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/APReq.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,7 +38,7 @@
/**
* Implements the ASN.1 AP-REQ type.
*
- * <xmp>
+ * <pre>{@code
* AP-REQ ::= [APPLICATION 14] SEQUENCE {
* pvno [0] INTEGER (5),
* msg-type [1] INTEGER (14),
@@ -46,7 +46,7 @@
* ticket [3] Ticket,
* authenticator [4] EncryptedData -- Authenticator
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/Authenticator.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/Authenticator.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,7 +38,7 @@
/**
* Implements the ASN.1 Authenticator type.
*
- * <xmp>
+ * <pre>{@code
* Authenticator ::= [APPLICATION 2] SEQUENCE {
* authenticator-vno [0] INTEGER (5),
* crealm [1] Realm,
@@ -50,7 +50,7 @@
* seq-number [7] UInt32 OPTIONAL,
* authorization-data [8] AuthorizationData OPTIONAL
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncAPRepPart.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncAPRepPart.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,14 +39,14 @@
/**
* Implements the ASN.1 EncAPRepPart type.
*
- * <xmp>
+ * <pre>{@code
* EncAPRepPart ::= [APPLICATION 27] SEQUENCE {
* ctime [0] KerberosTime,
* cusec [1] Microseconds,
* subkey [2] EncryptionKey OPTIONAL,
* seq-number [3] UInt32 OPTIONAL
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncKDCRepPart.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncKDCRepPart.java Wed Jul 05 20:44:51 2017 +0200
@@ -40,7 +40,7 @@
/**
* Implements the ASN.1 EncKDCRepPart type.
*
- * <xmp>
+ * <pre>{@code
* EncKDCRepPart ::= SEQUENCE {
* key [0] EncryptionKey,
* last-req [1] LastReq,
@@ -55,7 +55,7 @@
* sname [10] PrincipalName,
* caddr [11] HostAddresses OPTIONAL
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncKrbCredPart.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncKrbCredPart.java Wed Jul 05 20:44:51 2017 +0200
@@ -40,7 +40,7 @@
/**
* Implements the ASN.1 EncKrbCredPart type.
*
- * <xmp>
+ * <pre>{@code
* EncKrbCredPart ::= [APPLICATION 29] SEQUENCE {
* ticket-info [0] SEQUENCE OF KrbCredInfo,
* nonce [1] UInt32 OPTIONAL,
@@ -49,7 +49,7 @@
* s-address [4] HostAddress OPTIONAL,
* r-address [5] HostAddress OPTIONAL
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncKrbPrivPart.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncKrbPrivPart.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,7 +38,7 @@
/**
* Implements the ASN.1 EncKrbPrivPart type.
*
- * <xmp>
+ * <pre>{@code
* EncKrbPrivPart ::= [APPLICATION 28] SEQUENCE {
* user-data [0] OCTET STRING,
* timestamp [1] KerberosTime OPTIONAL,
@@ -47,7 +47,7 @@
* s-address [4] HostAddress -- sender's addr --,
* r-address [5] HostAddress OPTIONAL -- recip's addr
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncTicketPart.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/EncTicketPart.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,7 +39,7 @@
/**
* Implements the ASN.1 EncTicketPart type.
*
- * <xmp>
+ * <pre>{@code
* EncTicketPart ::= [APPLICATION 3] SEQUENCE {
* flags [0] TicketFlags,
* key [1] EncryptionKey,
@@ -53,7 +53,7 @@
* caddr [9] HostAddresses OPTIONAL,
* authorization-data [10] AuthorizationData OPTIONAL
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddress.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddress.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,16 +39,17 @@
import java.net.Inet6Address;
import java.net.UnknownHostException;
import java.io.IOException;
+import java.util.Arrays;
/**
* Implements the ASN.1 HostAddress type.
*
- * <xmp>
+ * <pre>{@code
* HostAddress ::= SEQUENCE {
* addr-type [0] Int32,
* address [1] OCTET STRING
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
@@ -131,7 +132,7 @@
/**
* Gets the InetAddress of this HostAddress.
* @return the IP address for this specified host.
- * @exception if no IP address for the host could be found.
+ * @exception UnknownHostException if no IP address for the host could be found.
*
*/
public InetAddress getInetAddress() throws UnknownHostException {
@@ -295,4 +296,11 @@
}
}
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(Arrays.toString(address));
+ sb.append('(').append(addrType).append(')');
+ return sb.toString();
+ }
}
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java Wed Jul 05 20:44:51 2017 +0200
@@ -45,7 +45,7 @@
/**
* Implements the ASN.1 HostAddresses type.
*
- * <xmp>
+ * <pre>{@code
* HostAddresses -- NOTE: subtly different from rfc1510,
* -- but has a value mapping and encodes the same
* ::= SEQUENCE OF HostAddress
@@ -54,7 +54,7 @@
* addr-type [0] Int32,
* address [1] OCTET STRING
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
@@ -338,4 +338,9 @@
for (int i = 0; i < inetAddresses.length; i++)
addresses[i] = new HostAddress(inetAddresses[i]);
}
+
+ @Override
+ public String toString() {
+ return Arrays.toString(addresses);
+ }
}
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCOptions.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCOptions.java Wed Jul 05 20:44:51 2017 +0200
@@ -40,7 +40,7 @@
/**
* Implements the ASN.1 KDCOptions type.
*
- * <xmp>
+ * <pre>{@code
* KDCOptions ::= KerberosFlags
* -- reserved(0),
* -- forwardable(1),
@@ -69,7 +69,7 @@
* -- minimum number of bits shall be sent,
* -- but no fewer than 32
*
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
@@ -115,7 +115,7 @@
* in the addresses field of the request.
* <li>FORWARDED, PROXY, ENC_TKT_IN_SKEY, RENEW, VALIDATE are used only in
* subsequent requests.
- * </ol><p>
+ * </ol>
*/
public class KDCOptions extends KerberosFlags {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCRep.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCRep.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,7 +38,7 @@
/**
* Implements the ASN.1 KDC-REP type.
*
- * <xmp>
+ * <pre>{@code
* KDC-REP ::= SEQUENCE {
* pvno [0] INTEGER (5),
* msg-type [1] INTEGER (11 -- AS -- | 13 -- TGS --),
@@ -51,7 +51,7 @@
* -- EncASRepPart or EncTGSRepPart,
* -- as appropriate
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCReq.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCReq.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,7 +39,7 @@
/**
* Implements the ASN.1 KRB_KDC_REQ type.
*
- * <xmp>
+ * <pre>{@code
* KDC-REQ ::= SEQUENCE {
* -- NOTE: first tag is [1], not [0]
* pvno [1] INTEGER (5) ,
@@ -48,7 +48,7 @@
* -- NOTE: not empty --,
* req-body [4] KDC-REQ-BODY
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
@@ -95,7 +95,7 @@
* @param req_type a encoded asn1 type value.
* @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
* @exception IOException if an I/O error occurs while reading encoded data.
- * @exceptoin KrbErrException
+ * @exception KrbErrException
*/
public KDCReq(DerValue der, int req_type) throws Asn1Exception,
IOException, KrbException {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCReqBody.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KDCReqBody.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,7 +39,7 @@
/**
* Implements the ASN.1 KDC-REQ-BODY type.
*
- * <xmp>
+ * <pre>{@code
* KDC-REQ-BODY ::= SEQUENCE {
* kdc-options [0] KDCOptions,
* cname [1] PrincipalName OPTIONAL
@@ -60,7 +60,7 @@
* additional-tickets [11] SEQUENCE OF Ticket OPTIONAL
* -- NOTE: not empty
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBCred.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBCred.java Wed Jul 05 20:44:51 2017 +0200
@@ -41,14 +41,14 @@
/**
* Implements the ASN.1 Authenticator type.
*
- * <xmp>
+ * <pre>{@code
* KRB-CRED ::= [APPLICATION 22] SEQUENCE {
* pvno [0] INTEGER (5),
* msg-type [1] INTEGER (22),
* tickets [2] SEQUENCE OF Ticket,
* enc-part [3] EncryptedData -- EncKrbCredPart
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBError.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBError.java Wed Jul 05 20:44:51 2017 +0200
@@ -48,7 +48,7 @@
/**
* Implements the ASN.1 KRBError type.
*
- * <xmp>
+ * <pre>{@code
* KRB-ERROR ::= [APPLICATION 30] SEQUENCE {
* pvno [0] INTEGER (5),
* msg-type [1] INTEGER (30),
@@ -71,7 +71,7 @@
* data-type [0] Int32,
* data-value [1] OCTET STRING OPTIONAL
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBPriv.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBPriv.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,14 +39,14 @@
/**
* Implements the ASN.1 KRB-PRIV type.
*
- * <xmp>
+ * <pre>{@code
* KRB-PRIV ::= [APPLICATION 21] SEQUENCE {
* pvno [0] INTEGER (5),
* msg-type [1] INTEGER (21),
* -- NOTE: there is no [2] tag
* enc-part [3] EncryptedData -- EncKrbPrivPart
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBSafe.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBSafe.java Wed Jul 05 20:44:51 2017 +0200
@@ -40,14 +40,14 @@
/**
* Implements the ASN.1 KRBSafe type.
*
- * <xmp>
+ * <pre>{@code
* KRB-SAFE ::= [APPLICATION 20] SEQUENCE {
* pvno [0] INTEGER (5),
* msg-type [1] INTEGER (20),
* safe-body [2] KRB-SAFE-BODY,
* cksum [3] Checksum
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBSafeBody.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KRBSafeBody.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,7 +39,7 @@
/**
* Implements the ASN.1 KRBSafeBody type.
*
- * <xmp>
+ * <pre>{@code
* KRB-SAFE-BODY ::= SEQUENCE {
* user-data [0] OCTET STRING,
* timestamp [1] KerberosTime OPTIONAL,
@@ -48,7 +48,7 @@
* s-address [4] HostAddress,
* r-address [5] HostAddress OPTIONAL
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java Wed Jul 05 20:44:51 2017 +0200
@@ -46,9 +46,7 @@
/**
* Implements the ASN.1 KerberosTime type. This is an immutable class.
*
- * <xmp>
- * KerberosTime ::= GeneralizedTime -- with no fractional seconds
- * </xmp>
+ * {@code KerberosTime ::= GeneralizedTime} -- with no fractional seconds
*
* The timestamps used in Kerberos are encoded as GeneralizedTimes. A
* KerberosTime value shall not include any fractional portions of the
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KrbCredInfo.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KrbCredInfo.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,7 +38,7 @@
/**
* Implements the ASN.1 KrbCredInfo type.
*
- * <xmp>
+ * <pre>{@code
* KrbCredInfo ::= SEQUENCE {
* key [0] EncryptionKey,
* prealm [1] Realm OPTIONAL,
@@ -52,7 +52,7 @@
* sname [9] PrincipalName OPTIONAL,
* caddr [10] HostAddresses OPTIONAL
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/LastReq.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/LastReq.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,12 +38,12 @@
/**
* Implements the ASN.1 LastReq type.
*
- * <xmp>
+ * <pre>{@code
* LastReq ::= SEQUENCE OF SEQUENCE {
* lr-type [0] Int32,
* lr-value [1] KerberosTime
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/LoginOptions.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/LoginOptions.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,7 +36,7 @@
/**
* Implements the ASN.1 KDCOptions type.
*
- * <xmp>
+ * <pre>{@code
* KDCOptions ::= KerberosFlags
* -- reserved(0),
* -- forwardable(1),
@@ -64,7 +64,7 @@
* KerberosFlags ::= BIT STRING (SIZE (32..MAX))
* -- minimum number of bits shall be sent,
* -- but no fewer than 32
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/MethodData.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/MethodData.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,12 +38,12 @@
/**
* Implements the ASN.1 EncKrbPrivPart type.
*
- * <xmp>
+ * <pre>{@code
* METHOD-DATA ::= SEQUENCE {
* method-type[0] INTEGER,
* method-data[1] OCTET STRING OPTIONAL
* }
- * </xmp>
+ * }</pre>
*/
public class MethodData {
private int methodType;
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAData.java Wed Jul 05 20:44:51 2017 +0200
@@ -39,13 +39,13 @@
/**
* Implements the ASN.1 PA-DATA type.
*
- * <xmp>
+ * <pre>{@code
* PA-DATA ::= SEQUENCE {
* -- NOTE: first tag is [1], not [0]
* padata-type [1] Int32,
* padata-value [2] OCTET STRING -- might be encoded AP-REQ
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
@@ -140,11 +140,14 @@
/**
* Gets the preferred etype from the PAData array.
- * 1. ETYPE-INFO2-ENTRY with unknown s2kparams ignored
- * 2. ETYPE-INFO2 preferred to ETYPE-INFO
- * 3. multiple entries for same etype in one PA-DATA, use the first one.
- * 4. Multiple PA-DATA with same type, choose the last one
+ * <ol>
+ * <li>ETYPE-INFO2-ENTRY with unknown s2kparams ignored</li>
+ * <li>ETYPE-INFO2 preferred to ETYPE-INFO</li>
+ * <li>Multiple entries for same etype in one PA-DATA, use the first one.</li>
+ * <li>Multiple PA-DATA with same type, choose the last one.</li>
+ * </ol>
* (This is useful when PA-DATAs from KRB-ERROR and AS-REP are combined).
+ *
* @return the etype, or defaultEType if not enough info
* @throws Asn1Exception|IOException if there is an encoding error
*/
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAEncTSEnc.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAEncTSEnc.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,12 +38,12 @@
/**
* Implements the ASN.1 PAEncTSEnc type.
*
- * <xmp>
+ * <pre>{@code
* PA-ENC-TS-ENC ::= SEQUENCE {
* patimestamp [0] KerberosTime -- client's time --,
* pausec [1] Microseconds OPTIONAL
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAForUserEnc.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/PAForUserEnc.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,7 +36,7 @@
/**
* Implements the ASN.1 PA-FOR-USER type.
*
- * <xmp>
+ * <pre>{@code
* padata-type ::= PA-FOR-USER
* -- value 129
* padata-value ::= EncryptedData
@@ -47,7 +47,7 @@
* cksum[2] Checksum,
* auth-package[3] KerberosString
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects MS-SFU.
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/Ticket.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/Ticket.java Wed Jul 05 20:44:51 2017 +0200
@@ -42,14 +42,14 @@
/**
* Implements the ASN.1 Ticket type.
*
- * <xmp>
+ * <pre>{@code
* Ticket ::= [APPLICATION 1] SEQUENCE {
* tkt-vno [0] INTEGER (5),
* realm [1] Realm,
* sname [2] PrincipalName,
* enc-part [3] EncryptedData -- EncTicketPart
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/TransitedEncoding.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/TransitedEncoding.java Wed Jul 05 20:44:51 2017 +0200
@@ -38,12 +38,12 @@
/**
* Implements the ASN.1 TransitedEncoding type.
*
- * <xmp>
+ * <pre>{@code
* TransitedEncoding ::= SEQUENCE {
* tr-type [0] Int32 -- must be registered --,
* contents [1] OCTET STRING
* }
- * </xmp>
+ * }</pre>
*
* <p>
* This definition reflects the Network Working Group RFC 4120
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Des.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Des.java Wed Jul 05 20:44:51 2017 +0200
@@ -226,7 +226,7 @@
/**
* Generates DES key from the password.
- * @param password a char[] used to create the key.
+ * @param passwdChars a char[] used to create the key.
* @return DES key.
*
* @modified by Yanni Zhang, Dec 6, 99
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/DesMacCksumType.java Wed Jul 05 20:44:51 2017 +0200
@@ -125,7 +125,7 @@
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*
* @modified by Yanni Zhang, 12/08/99.
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacMd5ArcFourCksumType.java Wed Jul 05 20:44:51 2017 +0200
@@ -95,7 +95,7 @@
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*/
public boolean verifyKeyedChecksum(byte[] data, int size,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes128CksumType.java Wed Jul 05 20:44:51 2017 +0200
@@ -95,7 +95,7 @@
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*/
public boolean verifyKeyedChecksum(byte[] data, int size,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Aes256CksumType.java Wed Jul 05 20:44:51 2017 +0200
@@ -95,7 +95,7 @@
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*/
public boolean verifyKeyedChecksum(byte[] data, int size,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha1Des3KdCksumType.java Wed Jul 05 20:44:51 2017 +0200
@@ -89,7 +89,7 @@
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*/
public boolean verifyKeyedChecksum(byte[] data, int size,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/RsaMd5DesCksumType.java Wed Jul 05 20:44:51 2017 +0200
@@ -120,7 +120,7 @@
* @param data the data.
* @param size the length of data.
* @param key the key used to encrypt the checksum.
- * @param checksum
+ * @param checksum the checksum.
* @return true if verification is successful.
*
* @modified by Yanni Zhang, 12/08/99.
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTab.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTab.java Wed Jul 05 20:44:51 2017 +0200
@@ -513,7 +513,7 @@
/**
* Creates key table file version.
* @param file the key table file.
- * @exception IOException.
+ * @exception IOException
*/
public synchronized void createVersion(File file) throws IOException {
try (KeyTabOutputStream kos =
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthList.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/rcache/AuthList.java Wed Jul 05 20:44:51 2017 +0200
@@ -45,7 +45,7 @@
* self-cleanup of expired items in the cache.
*
* AuthTimeWithHash objects inside a cache are always sorted from big (new) to
- * small (old) as determined by {@see AuthTimeWithHash#compareTo}. In the most
+ * small (old) as determined by {@link AuthTimeWithHash#compareTo}. In the most
* common case a newcomer should be newer than the first element.
*
* @author Yanni Zhang
--- a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java Wed Jul 05 20:44:51 2017 +0200
@@ -59,26 +59,25 @@
* We currently support only file-based credentials cache to
* store the tickets obtained from the KDC.
* By default, for all Unix platforms a cache file named
- * /tmp/krb5cc_<uid> will be generated. The <uid> is the
+ * {@code /tmp/krb5cc_<uid>} will be generated. The {@code <uid>} is the
* numeric user identifier.
* For all other platforms, a cache file named
- * <USER_HOME>/krb5cc_<USER_NAME> would be generated.
+ * {@code <USER_HOME>/krb5cc_<USER_NAME>} would be generated.
* <p>
- * <USER_HOME> is obtained from <code>java.lang.System</code>
+ * {@code <USER_HOME>} is obtained from {@code java.lang.System}
* property <i>user.home</i>.
- * <USER_NAME> is obtained from <code>java.lang.System</code>
+ * {@code <USER_NAME>} is obtained from {@code java.lang.System}
* property <i>user.name</i>.
- * If <USER_HOME> is null the cache file would be stored in
+ * If {@code <USER_HOME>} is null the cache file would be stored in
* the current directory that the program is running from.
- * <USER_NAME> is operating system's login username.
+ * {@code <USER_NAME>} is operating system's login username.
* It could be different from user's principal name.
- *</p>
- *<p>
+ * <p>
* For instance, on Windows NT, it could be
- * c:\winnt\profiles\duke\krb5cc_duke, in
- * which duke is the <USER_NAME>, and c:\winnt\profile\duke is the
- * <USER_HOME>.
- *<p>
+ * {@code c:\winnt\profiles\duke\krb5cc_duke}, in
+ * which duke is the {@code <USER_NAME>} and {@code c:\winnt\profile\duke} is the
+ * {@code <USER_HOME>}.
+ * <p>
* A single user could have multiple principal names,
* but the primary principal of the credentials cache could only be one,
* which means one cache file could only store tickets for one
@@ -88,10 +87,8 @@
* To avoid overwriting, you need to specify
* a different cache file name when you request a
* new ticket.
- *</p>
- *<p>
+ * <p>
* You can specify the location of the cache file by using the -c option
- *
*/
public static void main(String[] args) {
--- a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Klist.java Wed Jul 05 20:44:51 2017 +0200
@@ -69,8 +69,10 @@
* <li><b>-n</b> do not reverse-resolve addresses
* </ul>
* available options for keytabs:
+ * <ul>
* <li><b>-t</b> shows keytab entry timestamps
* <li><b>-K</b> shows keytab entry DES keys
+ * </ul>
*/
public static void main(String[] args) {
Klist klist = new Klist();
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/FactoryImpl.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/FactoryImpl.java Wed Jul 05 20:44:51 2017 +0200
@@ -60,7 +60,7 @@
*
* @throws SaslException If there is an error creating the DigestMD5
* SASL client.
- * @returns a new SaslClient ; otherwise null if unsuccessful.
+ * @return a new SaslClient; otherwise null if unsuccessful.
*/
public SaslClient createSaslClient(String[] mechs,
String authorizationId, String protocol, String serverName,
@@ -90,7 +90,7 @@
*
* @throws SaslException If there is an error creating the DigestMD5
* SASL server.
- * @returns a new SaslServer ; otherwise null if unsuccessful.
+ * @return a new SaslServer; otherwise null if unsuccessful.
*/
public SaslServer createSaslServer(String mech,
String protocol, String serverName, Map<String,?> props, CallbackHandler cbh)
@@ -114,7 +114,7 @@
/**
* Returns the authentication mechanisms that this factory can produce.
*
- * @returns String[] {"DigestMD5"} if policies in env match those of this
+ * @return String[] {"DigestMD5"} if policies in env match those of this
* factory.
*/
public String[] getMechanismNames(Map<String,?> env) {
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/ntlm/FactoryImpl.java Wed Jul 05 20:44:51 2017 +0200
@@ -57,7 +57,7 @@
/**
* Returns a new instance of the NTLM SASL client mechanism.
* Argument checks are performed in SaslClient's constructor.
- * @returns a new SaslClient ; otherwise null if unsuccessful.
+ * @return a new SaslClient; otherwise null if unsuccessful.
* @throws SaslException If there is an error creating the NTLM
* SASL client.
*/
@@ -86,7 +86,7 @@
/**
* Returns a new instance of the NTLM SASL server mechanism.
* Argument checks are performed in SaslServer's constructor.
- * @returns a new SaslServer ; otherwise null if unsuccessful.
+ * @return a new SaslServer; otherwise null if unsuccessful.
* @throws SaslException If there is an error creating the NTLM
* SASL server.
*/
@@ -116,7 +116,7 @@
/**
* Returns the authentication mechanisms that this factory can produce.
*
- * @returns String[] {"NTLM"} if policies in env match those of this
+ * @return String[] {"NTLM"} if policies in env match those of this
* factory.
*/
public String[] getMechanismNames(Map<String,?> env) {
--- a/jdk/src/java.sql/share/classes/javax/sql/RowSet.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.sql/share/classes/javax/sql/RowSet.java Wed Jul 05 20:44:51 2017 +0200
@@ -1477,7 +1477,7 @@
/**
* Sets the designated parameter to a <code>InputStream</code> object.
- * The "{@code InputStream} must contain the number
+ * The {@code InputStream} must contain the number
* of characters specified by length, otherwise a <code>SQLException</code> will be
* generated when the <code>CallableStatement</code> is executed.
* This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java Wed Jul 05 20:44:51 2017 +0200
@@ -41,12 +41,12 @@
* as defined in the W3C specification for XML-Signature Syntax and Processing.
* The XML Schema Definition is defined as:
*
- * <xmp>
+ * <pre>{@code
* <simpleType name="CryptoBinary">
* <restriction base = "base64Binary">
* </restriction>
* </simpleType>
- * </xmp>
+ * }</pre>
*
* @author Sean Mullan
*/
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java Wed Jul 05 20:44:51 2017 +0200
@@ -57,7 +57,7 @@
* and optional list of external elements.
*
* @param keyPacket a PGP Key Material Packet as defined in section 5.5 of
- * <a href="http://www.ietf.org/rfc/rfc2440.txt"/>RFC 2440</a>. The
+ * <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>. The
* array is cloned to prevent subsequent modification.
* @param other a list of {@link XMLStructure}s representing elements from
* an external namespace. The list is defensively copied to prevent
@@ -90,10 +90,10 @@
* optional key packet and list of external elements.
*
* @param keyId a PGP public key id as defined in section 11.2 of
- * <a href="http://www.ietf.org/rfc/rfc2440.txt"/>RFC 2440</a>. The
+ * <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>. The
* array is cloned to prevent subsequent modification.
* @param keyPacket a PGP Key Material Packet as defined in section 5.5 of
- * <a href="http://www.ietf.org/rfc/rfc2440.txt"/>RFC 2440</a> (may
+ * <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a> (may
* be <code>null</code>). The array is cloned to prevent subsequent
* modification.
* @param other a list of {@link XMLStructure}s representing elements from
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java Wed Jul 05 20:44:51 2017 +0200
@@ -118,7 +118,6 @@
* is defensively copied to protect against subsequent modification.
* May be <code>null</code> or empty.
* @param id the reference ID (may be <code>null</code>)
- * @return a <code>Reference</code>
* @throws NullPointerException if <code>dm</code> is <code>null</code>
* @throws ClassCastException if any of the <code>transforms</code> are
* not of type <code>Transform</code>
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java Wed Jul 05 20:44:51 2017 +0200
@@ -58,7 +58,6 @@
* @param properties a list of one or more {@link SignatureProperty}s. The
* list is defensively copied to protect against subsequent modification.
* @param id the Id (may be <code>null</code>)
- * @return a <code>DOMSignatureProperties</code>
* @throws ClassCastException if <code>properties</code> contains any
* entries that are not of type {@link SignatureProperty}
* @throws IllegalArgumentException if <code>properties</code> is empty
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java Wed Jul 05 20:44:51 2017 +0200
@@ -59,7 +59,6 @@
* is defensively copied to protect against subsequent modification.
* @param target the target URI
* @param id the Id (may be <code>null</code>)
- * @return a <code>SignatureProperty</code>
* @throws ClassCastException if <code>content</code> contains any
* entries that are not of type {@link XMLStructure}
* @throws IllegalArgumentException if <code>content</code> is empty
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java Wed Jul 05 20:44:51 2017 +0200
@@ -53,7 +53,7 @@
protected TransformService spi;
/**
- * Creates a <code>DOMTransform</code>.
+ * Creates a {@code DOMTransform}.
*
* @param spi the TransformService
*/
@@ -62,7 +62,7 @@
}
/**
- * Creates a <code>DOMTransform</code> from an element. This constructor
+ * Creates a {@code DOMTransform} from an element. This constructor
* invokes the abstract {@link #unmarshalParams unmarshalParams} method to
* unmarshal any algorithm-specific input parameters.
*
@@ -138,12 +138,12 @@
* Transforms the specified data using the underlying transform algorithm.
*
* @param data the data to be transformed
- * @param sc the <code>XMLCryptoContext</code> containing
- * additional context (may be <code>null</code> if not applicable)
+ * @param xc the {@code XMLCryptoContext} containing
+ * additional context (may be {@code null} if not applicable)
* @return the transformed data
- * @throws NullPointerException if <code>data</code> is <code>null</code>
+ * @throws NullPointerException if {@code data} is {@code null}
* @throws XMLSignatureException if an unexpected error occurs while
- * executing the transform
+ * executing the transform
*/
public Data transform(Data data, XMLCryptoContext xc)
throws TransformException
@@ -155,14 +155,14 @@
* Transforms the specified data using the underlying transform algorithm.
*
* @param data the data to be transformed
- * @param sc the <code>XMLCryptoContext</code> containing
- * additional context (may be <code>null</code> if not applicable)
- * @param os the <code>OutputStream</code> that should be used to write
- * the transformed data to
+ * @param xc the {@code XMLCryptoContext} containing
+ * additional context (may be {@code null} if not applicable)
+ * @param os the {@code OutputStream} that should be used to write
+ * the transformed data to
* @return the transformed data
- * @throws NullPointerException if <code>data</code> is <code>null</code>
+ * @throws NullPointerException if {@code data} is {@code null}
* @throws XMLSignatureException if an unexpected error occurs while
- * executing the transform
+ * executing the transform
*/
public Data transform(Data data, XMLCryptoContext xc, OutputStream os)
throws TransformException
@@ -201,16 +201,16 @@
/**
* Transforms the specified data using the underlying transform algorithm.
* This method invokes the {@link #marshal marshal} method and passes it
- * the specified <code>DOMSignContext</code> before transforming the data.
+ * the specified {@code DOMSignContext} before transforming the data.
*
* @param data the data to be transformed
- * @param sc the <code>XMLCryptoContext</code> containing
- * additional context (may be <code>null</code> if not applicable)
+ * @param sc the {@code XMLCryptoContext} containing
+ * additional context (may be {@code null} if not applicable)
* @param context the marshalling context
* @return the transformed data
* @throws MarshalException if an exception occurs while marshalling
- * @throws NullPointerException if <code>data</code> or <code>context</code>
- * is <code>null</code>
+ * @throws NullPointerException if {@code data} or {@code context}
+ * is {@code null}
* @throws XMLSignatureException if an unexpected error occurs while
* executing the transform
*/
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java Wed Jul 05 20:44:51 2017 +0200
@@ -65,7 +65,6 @@
* or {@link javax.xml.dsig.XMLStructure} ({@link X509IssuerSerial}
* objects or elements from an external namespace). The list is
* defensively copied to protect against subsequent modification.
- * @return a <code>X509Data</code>
* @throws NullPointerException if <code>content</code> is <code>null</code>
* @throws IllegalArgumentException if <code>content</code> is empty
* @throws ClassCastException if <code>content</code> contains any entries
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java Wed Jul 05 20:44:51 2017 +0200
@@ -63,7 +63,6 @@
* @param id the Id (may be <code>null</code>)
* @param mimeType the mime type (may be <code>null</code>)
* @param encoding the encoding (may be <code>null</code>)
- * @return an <code>XMLObject</code>
* @throws ClassCastException if <code>content</code> contains any
* entries that are not of type {@link XMLStructure}
*/
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/JISAutoDetect.java Wed Jul 05 20:44:51 2017 +0200
@@ -79,32 +79,6 @@
throw new UnsupportedOperationException();
}
- /**
- * accessor methods used to share byte masking tables
- * with the sun.io JISAutoDetect implementation
- */
-
- public static byte[] getByteMask1() {
- return Decoder.maskTable1;
- }
-
- public static byte[] getByteMask2() {
- return Decoder.maskTable2;
- }
-
- public final static boolean canBeSJIS1B(int mask) {
- return (mask & SJIS1B_MASK) != 0;
- }
-
- public final static boolean canBeEUCJP(int mask) {
- return (mask & EUCJP_MASK) != 0;
- }
-
- public final static boolean canBeEUCKana(int mask1, int mask2) {
- return ((mask1 & EUCJP_KANA1_MASK) != 0)
- && ((mask2 & EUCJP_KANA2_MASK) != 0);
- }
-
// A heuristic algorithm for guessing if EUC-decoded text really
// might be Japanese text. Better heuristics are possible...
private static boolean looksLikeJapanese(CharBuffer cb) {
@@ -144,9 +118,10 @@
src.position(p);
}
- private CoderResult decodeLoop(Charset cs,
+ private CoderResult decodeLoop(DelegatableDecoder decoder,
ByteBuffer src, CharBuffer dst) {
- detectedDecoder = (DelegatableDecoder) cs.newDecoder();
+ ((CharsetDecoder)decoder).reset();
+ detectedDecoder = decoder;
return detectedDecoder.decodeLoop(src, dst);
}
@@ -157,7 +132,9 @@
// All ASCII?
if (! src.hasRemaining())
return CoderResult.UNDERFLOW;
- if (! dst.hasRemaining())
+ // Overflow only if there is still ascii but no out buffer.
+ if (!dst.hasRemaining() &&
+ isPlainASCII(src.get(src.position())))
return CoderResult.OVERFLOW;
// We need to perform double, not float, arithmetic; otherwise
@@ -172,7 +149,7 @@
ByteBuffer src2022 = src.asReadOnlyBuffer();
CoderResult res2022 = dd2022.decodeLoop(src2022, sandbox);
if (! res2022.isError())
- return decodeLoop(cs2022, src, dst);
+ return decodeLoop(dd2022, src, dst);
// We must choose between EUC and SJIS
Charset csEUCJ = Charset.forName(EUCJPName);
@@ -180,30 +157,30 @@
DelegatableDecoder ddEUCJ
= (DelegatableDecoder) csEUCJ.newDecoder();
+ DelegatableDecoder ddSJIS
+ = (DelegatableDecoder) csSJIS.newDecoder();
+
ByteBuffer srcEUCJ = src.asReadOnlyBuffer();
sandbox.clear();
CoderResult resEUCJ = ddEUCJ.decodeLoop(srcEUCJ, sandbox);
// If EUC decoding fails, must be SJIS
if (resEUCJ.isError())
- return decodeLoop(csSJIS, src, dst);
-
- DelegatableDecoder ddSJIS
- = (DelegatableDecoder) csSJIS.newDecoder();
+ return decodeLoop(ddSJIS, src, dst);
ByteBuffer srcSJIS = src.asReadOnlyBuffer();
CharBuffer sandboxSJIS = CharBuffer.allocate(cbufsiz);
CoderResult resSJIS = ddSJIS.decodeLoop(srcSJIS, sandboxSJIS);
// If SJIS decoding fails, must be EUC
if (resSJIS.isError())
- return decodeLoop(csEUCJ, src, dst);
+ return decodeLoop(ddEUCJ, src, dst);
// From here on, we have some ambiguity, and must guess.
// We prefer input that does not appear to end mid-character.
if (srcEUCJ.position() > srcSJIS.position())
- return decodeLoop(csEUCJ, src, dst);
+ return decodeLoop(ddEUCJ, src, dst);
if (srcEUCJ.position() < srcSJIS.position())
- return decodeLoop(csSJIS, src, dst);
+ return decodeLoop(ddSJIS, src, dst);
// end-of-input is after the first byte of the first char?
if (src.position() == srcEUCJ.position())
@@ -211,8 +188,8 @@
// Use heuristic knowledge of typical Japanese text
sandbox.flip();
- Charset guess = looksLikeJapanese(sandbox) ? csEUCJ : csSJIS;
- return decodeLoop(guess, src, dst);
+ return decodeLoop(looksLikeJapanese(sandbox) ? ddEUCJ : ddSJIS,
+ src, dst);
}
return detectedDecoder.decodeLoop(src, dst);
@@ -267,140 +244,5 @@
return("EUC_JP");
}
- // Mask tables - each entry indicates possibility of first or
- // second byte being SJIS or EUC_JP
- private static final byte maskTable1[] = {
- 0, 0, 0, 0, // 0x00 - 0x03
- 0, 0, 0, 0, // 0x04 - 0x07
- 0, 0, 0, 0, // 0x08 - 0x0b
- 0, 0, 0, 0, // 0x0c - 0x0f
- 0, 0, 0, 0, // 0x10 - 0x13
- 0, 0, 0, 0, // 0x14 - 0x17
- 0, 0, 0, 0, // 0x18 - 0x1b
- 0, 0, 0, 0, // 0x1c - 0x1f
- 0, 0, 0, 0, // 0x20 - 0x23
- 0, 0, 0, 0, // 0x24 - 0x27
- 0, 0, 0, 0, // 0x28 - 0x2b
- 0, 0, 0, 0, // 0x2c - 0x2f
- 0, 0, 0, 0, // 0x30 - 0x33
- 0, 0, 0, 0, // 0x34 - 0x37
- 0, 0, 0, 0, // 0x38 - 0x3b
- 0, 0, 0, 0, // 0x3c - 0x3f
- 0, 0, 0, 0, // 0x40 - 0x43
- 0, 0, 0, 0, // 0x44 - 0x47
- 0, 0, 0, 0, // 0x48 - 0x4b
- 0, 0, 0, 0, // 0x4c - 0x4f
- 0, 0, 0, 0, // 0x50 - 0x53
- 0, 0, 0, 0, // 0x54 - 0x57
- 0, 0, 0, 0, // 0x58 - 0x5b
- 0, 0, 0, 0, // 0x5c - 0x5f
- 0, 0, 0, 0, // 0x60 - 0x63
- 0, 0, 0, 0, // 0x64 - 0x67
- 0, 0, 0, 0, // 0x68 - 0x6b
- 0, 0, 0, 0, // 0x6c - 0x6f
- 0, 0, 0, 0, // 0x70 - 0x73
- 0, 0, 0, 0, // 0x74 - 0x77
- 0, 0, 0, 0, // 0x78 - 0x7b
- 0, 0, 0, 0, // 0x7c - 0x7f
- 0, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x80 - 0x83
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x84 - 0x87
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x88 - 0x8b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0x8c - 0x8f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x90 - 0x93
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x94 - 0x97
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x98 - 0x9b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x9c - 0x9f
- 0, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xa0 - 0xa3
- SJIS1B_MASK|EUCJP_MASK|EUCJP_KANA1_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xa4 - 0xa7
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xa8 - 0xab
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xac - 0xaf
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xb0 - 0xb3
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xb4 - 0xb7
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xb8 - 0xbb
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xbc - 0xbf
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xc0 - 0xc3
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xc4 - 0xc7
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xc8 - 0xcb
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xcc - 0xcf
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xd0 - 0xd3
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xd4 - 0xd7
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xd8 - 0xdb
- SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, SJIS1B_MASK|EUCJP_MASK, // 0xdc - 0xdf
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xe0 - 0xe3
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xe4 - 0xe7
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xe8 - 0xeb
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xec - 0xef
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf0 - 0xf3
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf4 - 0xf7
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf8 - 0xfb
- SJIS2B_MASK|EUCJP_MASK, EUCJP_MASK, EUCJP_MASK, 0 // 0xfc - 0xff
- };
-
- private static final byte maskTable2[] = {
- 0, 0, 0, 0, // 0x00 - 0x03
- 0, 0, 0, 0, // 0x04 - 0x07
- 0, 0, 0, 0, // 0x08 - 0x0b
- 0, 0, 0, 0, // 0x0c - 0x0f
- 0, 0, 0, 0, // 0x10 - 0x13
- 0, 0, 0, 0, // 0x14 - 0x17
- 0, 0, 0, 0, // 0x18 - 0x1b
- 0, 0, 0, 0, // 0x1c - 0x1f
- 0, 0, 0, 0, // 0x20 - 0x23
- 0, 0, 0, 0, // 0x24 - 0x27
- 0, 0, 0, 0, // 0x28 - 0x2b
- 0, 0, 0, 0, // 0x2c - 0x2f
- 0, 0, 0, 0, // 0x30 - 0x33
- 0, 0, 0, 0, // 0x34 - 0x37
- 0, 0, 0, 0, // 0x38 - 0x3b
- 0, 0, 0, 0, // 0x3c - 0x3f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x40 - 0x43
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x44 - 0x47
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x48 - 0x4b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x4c - 0x4f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x50 - 0x53
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x54 - 0x57
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x58 - 0x5b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x5c - 0x5f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x60 - 0x63
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x64 - 0x67
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x68 - 0x6b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x6c - 0x6f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x70 - 0x73
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x74 - 0x77
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x78 - 0x7b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, 0, // 0x7c - 0x7f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x80 - 0x83
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x84 - 0x87
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x88 - 0x8b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x8c - 0x8f
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x90 - 0x93
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x94 - 0x97
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x98 - 0x9b
- SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, SJIS2B_MASK, // 0x9c - 0x9f
- SJIS2B_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xa0 - 0xa3
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xa4 - 0xa7
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xa8 - 0xab
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xac - 0xaf
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xb0 - 0xb3
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xb4 - 0xb7
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xb8 - 0xbb
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xbc - 0xbf
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xc0 - 0xc3
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xc4 - 0xc7
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xc8 - 0xcb
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xcc - 0xcf
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xd0 - 0xd3
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xd4 - 0xd7
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xd8 - 0xdb
- SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS1B_MASK|SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xdc - 0xdf
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xe0 - 0xe3
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xe4 - 0xe7
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xe8 - 0xeb
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xec - 0xef
- SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, SJIS2B_MASK|EUCJP_MASK|EUCJP_KANA2_MASK, // 0xf0 - 0xf3
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf4 - 0xf7
- SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, SJIS2B_MASK|EUCJP_MASK, // 0xf8 - 0xfb
- SJIS2B_MASK|EUCJP_MASK, EUCJP_MASK, EUCJP_MASK, 0 // 0xfc - 0xff
- };
}
}
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/wrapper/CK_CREATEMUTEX.java Wed Jul 05 20:44:51 2017 +0200
@@ -50,17 +50,16 @@
/**
- * interface CK_CREATEMUTEX.<p>
+ * interface CK_CREATEMUTEX.
*
- * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
- * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
+ * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
+ * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
*/
public interface CK_CREATEMUTEX {
/**
* Method CK_CREATEMUTEX
*
- * @param ppMutex
* @return The mutex (lock) object.
* @exception PKCS11Exception
*/
--- a/jdk/test/ProblemList.txt Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/ProblemList.txt Wed Jul 05 20:44:51 2017 +0200
@@ -379,7 +379,7 @@
# 8057732
sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java generic-all
-# 8064572 8060736 8062938
-sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
+# 8132648
+sun/tools/jhsdb/BasicLauncherTest.java generic-all
############################################################################
--- a/jdk/test/TEST.groups Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/TEST.groups Wed Jul 05 20:44:51 2017 +0200
@@ -28,14 +28,20 @@
tier1 = \
:jdk_lang \
:jdk_util \
+ sun/nio/cs/ISO8859x.java \
+ java/nio/Buffer \
+ com/sun/crypto/provider/Cipher \
:jdk_math
tier2 = \
:jdk_io \
:jdk_nio \
+ -sun/nio/cs/ISO8859x.java \
+ -java/nio/Buffer \
:jdk_net \
:jdk_time \
:jdk_security \
+ -com/sun/crypto/provider/Cipher \
:jdk_text \
:core_tools \
:jdk_other \
@@ -43,7 +49,8 @@
tier3 = \
:jdk_rmi \
- :jdk_beans
+ :jdk_beans \
+ :jdk_imageio
###############################################################################
#
--- a/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/ArrayLengthDumpTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -30,6 +30,7 @@
# TTY: dump <ArrayReference> command not implemented.
# @author Tim Bell
#
+# @key intermittent
# @run shell ArrayLengthDumpTest.sh
#
classname=ArrayLengthDumpTarg
--- a/jdk/test/com/sun/jdi/BreakpointTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/BreakpointTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,6 +28,7 @@
*
* @author jjh
*
+ * @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g BreakpointTest.java
@@ -45,7 +46,7 @@
// the debuggee, waits a bit, and enables the bkpt again.
class BreakpointTarg {
- public final static int BKPT_LINE = 55;
+ public final static int BKPT_LINE = 56;
// LINE NUMBER SENSITIVE
public static long count;
--- a/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/BreakpointWithFullGC.sh Wed Jul 05 20:44:51 2017 +0200
@@ -29,6 +29,7 @@
# @author dcubed (based on the test program posted to the following
# Eclipse thread https://bugs.eclipse.org/bugs/show_bug.cgi?id=279137)
#
+# @key intermittent
# @run shell BreakpointWithFullGC.sh
compileOptions=-g
--- a/jdk/test/com/sun/jdi/CatchAllTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/CatchAllTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -29,6 +29,7 @@
# @summary REGRESSION: jdb rejects the syntax catch java.lang.IndexOutOfBoundsException
# @author Tim Bell
#
+# @key intermittent
# @run shell CatchAllTest.sh
#
classname=CatchAllTestTarg
--- a/jdk/test/com/sun/jdi/CatchCaughtTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/CatchCaughtTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -29,6 +29,7 @@
# @summary TTY: 'catch caught' with no class pattern throws NullPointerException
# @author Tim Bell
#
+# @key intermittent
# @run shell CatchCaughtTest.sh
#
classname=CatchCaughtTestTarg
--- a/jdk/test/com/sun/jdi/CatchPatternTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/CatchPatternTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -28,6 +28,7 @@
# @summary TTY: surprising ExceptionSpec.resolveEventRequest() wildcard results
# @author Tim Bell
#
+# @key intermittent
# @run shell CatchPatternTest.sh
classname=CatchPatternTestTarg
createJavaFile()
--- a/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/CommandCommentDelimiter.sh Wed Jul 05 20:44:51 2017 +0200
@@ -28,6 +28,7 @@
# @bug 4507088
# @summary TTY: Add a comment delimiter to the jdb command set
# @author Tim Bell
+# @key intermittent
# @run shell CommandCommentDelimiter.sh
#
--- a/jdk/test/com/sun/jdi/DeoptimizeWalk.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/DeoptimizeWalk.sh Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
# @bug 4525714
# @summary jtreg test PopAsynchronousTest fails in build 85 with -Xcomp
# @author Jim Holmlund/Swamy Venkataramanappa
+# @key intermittent
# @run shell DeoptimizeWalk.sh
# This is another test of the same bug. The bug occurs when trying
--- a/jdk/test/com/sun/jdi/ExceptionEvents.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/ExceptionEvents.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,6 +28,7 @@
*
* @author Robert Field
*
+ * @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection
* @run compile -g ExceptionEvents.java
--- a/jdk/test/com/sun/jdi/JdbExprTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/JdbExprTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -26,6 +26,7 @@
# @test
# @bug 4660158
# @author Staffan Larsen
+# @key intermittent
# @run shell JdbExprTest.sh
# These are variables that can be set to control execution
--- a/jdk/test/com/sun/jdi/JdbMissStep.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/JdbMissStep.sh Wed Jul 05 20:44:51 2017 +0200
@@ -28,6 +28,7 @@
# @summary REGRESSION: jdb / jdi not stopping at some breakpoints and steps in j2sdk1.4.
# @author Jim Holmlund
#
+# @key intermittent
# @run shell JdbMissStep.sh
# These are variables that can be set to control execution
--- a/jdk/test/com/sun/jdi/JdbVarargsTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/JdbVarargsTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -29,6 +29,7 @@
#
# @author jjh
#
+# @key intermittent
# @run shell JdbVarargsTest.sh
classname=JdbVarargsTest
--- a/jdk/test/com/sun/jdi/MixedSuspendTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/MixedSuspendTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -29,6 +29,7 @@
#
# @author Jim Holmlund
#
+# @key intermittent
# @modules jdk.jdi
# @run build TestScaffold VMConnection TargetListener TargetAdapter
# @run shell MixedSuspendTest.sh
--- a/jdk/test/com/sun/jdi/NotAField.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/NotAField.sh Wed Jul 05 20:44:51 2017 +0200
@@ -29,6 +29,7 @@
# @summary TTY: NullPointerException at
# com.sun.tools.jdi.MirrorImpl.validateMirrors
# @author Tim Bell
+# @key intermittent
# @run shell NotAField.sh
#
--- a/jdk/test/com/sun/jdi/RedefineAbstractClass.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/RedefineAbstractClass.sh Wed Jul 05 20:44:51 2017 +0200
@@ -31,6 +31,7 @@
# methods are called.
# @author Daniel D. Daugherty
#
+# @key intermittent
# @run shell RedefineAbstractClass.sh
compileOptions=-g
--- a/jdk/test/com/sun/jdi/RedefineAnnotation.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/RedefineAnnotation.sh Wed Jul 05 20:44:51 2017 +0200
@@ -28,6 +28,7 @@
# @summary Redefine a class that has an annotation and verify that the
# new annotation is returned.
#
+# @key intermittent
# @run shell RedefineAnnotation.sh
compileOptions=-g
--- a/jdk/test/com/sun/jdi/RedefineClearBreakpoint.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/RedefineClearBreakpoint.sh Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
# @bug 4705330
# @summary Netbeans Fix and Continue crashes JVM
# @author Jim Holmlund/Swamy Venkataramanappa
+# @key intermittent
# @run shell RedefineClearBreakpoint.sh
# The failure occurs after a bkpt is set and then cleared
--- a/jdk/test/com/sun/jdi/RedefineException.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/RedefineException.sh Wed Jul 05 20:44:51 2017 +0200
@@ -28,6 +28,7 @@
# @summary The VM crashes when a method in a redefined class throws an exception.
# @author Jim Holmlund
#
+# @key intermittent
# @run shell RedefineException.sh
# This is another symptomm of 4559100
--- a/jdk/test/com/sun/jdi/RedefineFinal.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/RedefineFinal.sh Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
# @bug 4788344
# @summary RedefineClasses is an apparent no-op if instance method is final
#
+# @key intermittent
# @run shell RedefineFinal.sh
compileOptions=-g
--- a/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/RedefineIntConstantToLong.sh Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
# @bug 6394084
# @summary Redefine class can't handle addition of 64 bit constants in JDK1.5.0_05
#
+# @key intermittent
# @run shell RedefineIntConstantToLong.sh
compileOptions=-g
--- a/jdk/test/com/sun/jdi/RedefinePop.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/RedefinePop.sh Wed Jul 05 20:44:51 2017 +0200
@@ -30,6 +30,7 @@
#
# The failure occurs with debug java when the pop deletes the
# line that called the method which is being popped.
+# @key intermittent
# @run shell RedefinePop.sh
--- a/jdk/test/com/sun/jdi/RedefineStep.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/RedefineStep.sh Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
# @bug 4689395
# @summary "step over" after a class is redefined acts like "step out"
# @author Jim Holmlund
+# @key intermittent
# @run shell RedefineStep.sh
#
--- a/jdk/test/com/sun/jdi/RedefineTTYLineNumber.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/RedefineTTYLineNumber.sh Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
# @bug 4660756
# @summary TTY: Need to clear source cache after doing a redefine class
# @author Jim Holmlund
+# @key intermittent
# @run shell/timeout=240 RedefineTTYLineNumber.sh
#set -x
--- a/jdk/test/com/sun/jdi/SimulResumerTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/SimulResumerTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,6 +28,7 @@
*
* @author jjh
*
+ * @key intermittent
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g SimulResumerTest.java
--- a/jdk/test/com/sun/jdi/StringConvertTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/StringConvertTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -29,6 +29,7 @@
# 2. TTY: run on expression evaluation
# @author jim/suvasis mukherjee
#
+# @key intermittent
# @run shell StringConvertTest.sh
# Run this script to see the bug. See comments at the end
--- a/jdk/test/com/sun/jdi/sde/FilterMangleTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jdi/sde/FilterMangleTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -5,6 +5,7 @@
*
* @author Robert Field / Jim Holmlund
*
+ * @key intermittent
* @library ..
* @modules jdk.jdi
* @run build TestScaffold VMConnection TargetListener TargetAdapter InstallSDE
--- a/jdk/test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/jndi/dns/IPv6NameserverPlatformParsingTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -31,25 +31,12 @@
import com.sun.jndi.dns.DnsContext;
/**
- * @test
* @bug 6991580
* @summary IPv6 Nameservers in resolv.conf throws NumberFormatException
- * @run main/manual IPv6NameserverPlatformParsingTest
- *
- * In order to run this test be sure to place, for example, the following
- * snippet into your platform's {@code /etc/resolv.conf}:
- * <pre>
- * nameserver 127.0.0.1
- * nameserver 2001:4860:4860::8888
- * nameserver [::1]:5353
- * nameserver 127.0.0.1:5353
- * </pre>
- *
- * Then, run this test as manual jtreg test.
*
* @author Severin Gehwolf
- *
*/
+
public class IPv6NameserverPlatformParsingTest {
private static boolean foundIPv6 = false;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jndi/dns/Test6991580.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,358 @@
+
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+import java.awt.Button;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.TextArea;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * @test
+ * @bug 6991580 8080108
+ * @requires os.family != "windows"
+ * @summary IPv6 Nameservers in resolv.conf throws NumberFormatException
+ * @build IPv6NameserverPlatformParsingTest
+ * @run main/manual Test6991580
+ */
+
+
+public class Test6991580 {
+
+ private static void init() throws Exception {
+ //*** Create instructions for the user here ***
+
+ String[] instructions =
+ {
+ "This test should only be run on non-Windows systems.",
+ "If your system doesn't meet this condition, press PASS.",
+ "To run the test follow these instructions:",
+ "1. Open a terminal window.",
+ "2. Make sure you have, for example, the following snippet "
+ + "into your platform's /etc/resolv.conf:",
+ "nameserver 127.0.0.1",
+ "nameserver 2001:4860:4860::8888",
+ "nameserver [::1]:5353",
+ "nameserver 127.0.0.1:5353",
+ "Modify the /etc/resolv.conf file if needed. "
+ + "Don't forget to save the original content of the file.",
+ "3. Type \"cd " + System.getProperty("test.classes") + "\".",
+ "4. Type \"" + System.getProperty("java.home") +
+ "/bin/java IPv6NameserverPlatformParsingTest\".",
+ "5. If you see",
+ "\"PASS: Found IPv6 address and DnsClient parsed it correctly.\"",
+ ", press PASS else press FAIL.",
+ "6. If you modified /etc/resolv.conf on the step #2, "
+ + "please, restore the original content of the file."
+ };
+
+ Sysout.createDialog( );
+ Sysout.printInstructions( instructions );
+ }
+
+ /*****************************************************
+ Standard Test Machinery Section
+ DO NOT modify anything in this section -- it's a
+ standard chunk of code which has all of the
+ synchronisation necessary for the test harness.
+ By keeping it the same in all tests, it is easier
+ to read and understand someone else's test, as
+ well as insuring that all tests behave correctly
+ with the test harness.
+ There is a section following this for test-defined
+ classes
+ ******************************************************/
+ private static boolean theTestPassed = false;
+ private static boolean testGeneratedInterrupt = false;
+ private static String failureMessage = "";
+
+ private static Thread mainThread = null;
+
+ private static int sleepTime = 300000;
+
+ public static void main( String args[] ) throws Exception
+ {
+ mainThread = Thread.currentThread();
+ try
+ {
+ init();
+ }
+ catch( TestPassedException e )
+ {
+ //The test passed, so just return from main and harness will
+ // interepret this return as a pass
+ return;
+ }
+ //At this point, neither test passed nor test failed has been
+ // called -- either would have thrown an exception and ended the
+ // test, so we know we have multiple threads.
+
+ //Test involves other threads, so sleep and wait for them to
+ // called pass() or fail()
+ try
+ {
+ Thread.sleep( sleepTime );
+ //Timed out, so fail the test
+ throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+ }
+ catch (InterruptedException e)
+ {
+ if( ! testGeneratedInterrupt ) throw e;
+
+ //reset flag in case hit this code more than once for some reason (just safety)
+ testGeneratedInterrupt = false;
+ if ( theTestPassed == false )
+ {
+ throw new RuntimeException( failureMessage );
+ }
+ }
+
+ }//main
+
+ public static synchronized void setTimeoutTo( int seconds )
+ {
+ sleepTime = seconds * 1000;
+ }
+
+ public static synchronized void pass()
+ {
+ Sysout.println( "The test passed." );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //first check if this is executing in main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //Still in the main thread, so set the flag just for kicks,
+ // and throw a test passed exception which will be caught
+ // and end the test.
+ theTestPassed = true;
+ throw new TestPassedException();
+ }
+ //pass was called from a different thread, so set the flag and interrupt
+ // the main thead.
+ theTestPassed = true;
+ testGeneratedInterrupt = true;
+ mainThread.interrupt();
+ }//pass()
+
+ public static synchronized void fail()
+ {
+ //test writer didn't specify why test failed, so give generic
+ fail( "it just plain failed! :-)" );
+ }
+
+ public static synchronized void fail( String whyFailed )
+ {
+ Sysout.println( "The test failed: " + whyFailed );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //check if this called from main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //If main thread, fail now 'cause not sleeping
+ throw new RuntimeException( whyFailed );
+ }
+ theTestPassed = false;
+ testGeneratedInterrupt = true;
+ failureMessage = whyFailed;
+ mainThread.interrupt();
+ }//fail()
+
+ }
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+ {
+ }
+
+//*********** End Standard Test Machinery Section **********
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+ chunk of code whose purpose is to make user
+ interaction uniform, and thereby make it simpler
+ to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method. Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout
+ {
+ private static TestDialog dialog;
+
+ public static void createDialogWithInstructions( String[] instructions )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ dialog.printInstructions( instructions );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+ public static void createDialog( )
+ {
+ dialog = new TestDialog( new Frame(), "Instructions" );
+ String[] defInstr = { "Instructions will appear here. ", "" } ;
+ dialog.printInstructions( defInstr );
+ dialog.show();
+ println( "Any messages for the tester will display here." );
+ }
+
+
+ public static void printInstructions( String[] instructions )
+ {
+ dialog.printInstructions( instructions );
+ }
+
+
+ public static void println( String messageIn )
+ {
+ dialog.displayMessage( messageIn );
+ }
+
+ }// Sysout class
+
+/**
+ This is part of the standard test machinery. It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog implements ActionListener
+ {
+
+ TextArea instructionsText;
+ TextArea messageText;
+ int maxStringLength = 120;
+ Panel buttonP = new Panel();
+ Button passB = new Button( "pass" );
+ Button failB = new Button( "fail" );
+
+ //DO NOT call this directly, go through Sysout
+ public TestDialog( Frame frame, String name )
+ {
+ super( frame, name );
+ int scrollBoth = TextArea.SCROLLBARS_BOTH;
+ instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+ add( "North", instructionsText );
+
+ messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+ add("Center", messageText);
+
+ passB = new Button( "pass" );
+ passB.setActionCommand( "pass" );
+ passB.addActionListener( this );
+ buttonP.add( "East", passB );
+
+ failB = new Button( "fail" );
+ failB.setActionCommand( "fail" );
+ failB.addActionListener( this );
+ buttonP.add( "West", failB );
+
+ add( "South", buttonP );
+ pack();
+
+ show();
+ }// TestDialog()
+
+ //DO NOT call this directly, go through Sysout
+ public void printInstructions( String[] instructions )
+ {
+ //Clear out any current instructions
+ instructionsText.setText( "" );
+
+ //Go down array of instruction strings
+
+ String printStr, remainingStr;
+ for( int i=0; i < instructions.length; i++ )
+ {
+ //chop up each into pieces maxSringLength long
+ remainingStr = instructions[ i ];
+ while( remainingStr.length() > 0 )
+ {
+ //if longer than max then chop off first max chars to print
+ if( remainingStr.length() >= maxStringLength )
+ {
+ //Try to chop on a word boundary
+ int posOfSpace = remainingStr.
+ lastIndexOf( ' ', maxStringLength - 1 );
+
+ if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+ printStr = remainingStr.substring( 0, posOfSpace + 1 );
+ remainingStr = remainingStr.substring( posOfSpace + 1 );
+ }
+ //else just print
+ else
+ {
+ printStr = remainingStr;
+ remainingStr = "";
+ }
+
+ instructionsText.append( printStr + "\n" );
+
+ }// while
+
+ }// for
+
+ }//printInstructions()
+
+ //DO NOT call this directly, go through Sysout
+ public void displayMessage( String messageIn )
+ {
+ messageText.append( messageIn + "\n" );
+ }
+
+ //catch presses of the passed and failed buttons.
+ //simply call the standard pass() or fail() static methods of
+ //DialogOrient
+ @Override
+ public void actionPerformed( ActionEvent e )
+ {
+ if( "pass".equals(e.getActionCommand()) )
+ {
+ Test6991580.pass();
+ }
+ else
+ {
+ Test6991580.fail();
+ }
+ }
+
+ }
--- a/jdk/test/com/sun/tools/attach/BasicTests.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java Wed Jul 05 20:44:51 2017 +0200
@@ -41,7 +41,7 @@
* @test
* @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
* @summary Basic unit tests for the VM attach mechanism.
- * @modules jdk.jartool/sun.tools.jar
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.instrument
* java.management
--- a/jdk/test/java/lang/ClassLoader/Assert.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/lang/ClassLoader/Assert.java Wed Jul 05 20:44:51 2017 +0200
@@ -28,7 +28,7 @@
* @run main/othervm Assert
* @summary Test the assertion facility
* @author Mike McCloskey
- * @key randomness
+ * @key randomness intermittent
*/
import package1.*;
--- a/jdk/test/java/lang/instrument/BootClassPath/BootClassPathTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/lang/instrument/BootClassPath/BootClassPathTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -26,6 +26,7 @@
# @summary Test non US-ASCII characters in the value of the Boot-Class-Path
# attribute.
#
+# @key intermittent
# @modules java.instrument
# @run shell/timeout=240 BootClassPathTest.sh
--- a/jdk/test/java/lang/instrument/ManifestTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/lang/instrument/ManifestTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -26,6 +26,7 @@
# @summary JLI JAR manifest processing should ignore leading and trailing white space.
# @author Daniel D. Daugherty
#
+# @key intermittent
# @modules java.instrument
# @run build ManifestTestApp ExampleForBootClassPath
# @run shell/timeout=900 ManifestTest.sh
--- a/jdk/test/java/lang/instrument/PremainClass/InheritAgent0101.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/lang/instrument/PremainClass/InheritAgent0101.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
* @summary test config (0,1,0,1): inherited 1-arg and declared 1-arg in agent class
* @author Daniel D. Daugherty, Sun Microsystems
*
+ * @key intermittent
* @run shell ../MakeJAR3.sh InheritAgent0101
* @run main/othervm -javaagent:InheritAgent0101.jar DummyMain
*/
--- a/jdk/test/java/lang/instrument/RedefineBigClass.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/lang/instrument/RedefineBigClass.sh Wed Jul 05 20:44:51 2017 +0200
@@ -26,6 +26,7 @@
# @summary Redefine a big class.
# @author Daniel D. Daugherty
#
+# @key intermittent
# @modules java.instrument
# @run shell MakeJAR3.sh RedefineBigClassAgent 'Can-Redefine-Classes: true'
# @run build BigClass RedefineBigClassApp NMTHelper
--- a/jdk/test/java/lang/instrument/RetransformBigClass.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/lang/instrument/RetransformBigClass.sh Wed Jul 05 20:44:51 2017 +0200
@@ -26,6 +26,7 @@
# @summary Retransform a big class.
# @author Daniel D. Daugherty
#
+# @key intermittent
# @modules java.instrument
# @run shell MakeJAR4.sh RetransformBigClassAgent SimpleIdentityTransformer 'Can-Retransform-Classes: true'
# @run build BigClass RetransformBigClassApp NMTHelper
--- a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
* @summary Basic unit test of ThreadMXBean.getAllThreadIds()
* @author Alexei Guibadoulline and Mandy Chung
*
+ * @key intermittent
* @modules java.management
* @run main/othervm AllThreadIds
*/
--- a/jdk/test/java/nio/Buffer/Basic.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/nio/Buffer/Basic.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, 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
@@ -25,7 +25,7 @@
* @summary Unit test for buffers
* @bug 4413135 4414911 4416536 4416562 4418782 4471053 4472779 4490253 4523725
* 4526177 4463011 4660660 4661219 4663521 4782970 4804304 4938424 6231529
- * 6221101 6234263 6535542 6591971 6593946 6795561 7190219 7199551
+ * 6221101 6234263 6535542 6591971 6593946 6795561 7190219 7199551 8065556
* @author Mark Reinhold
*/
--- a/jdk/test/java/nio/file/FileStore/Basic.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/nio/file/FileStore/Basic.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, 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
@@ -116,9 +116,15 @@
store.type());
// check space attributes are accessible
- store.getTotalSpace();
- store.getUnallocatedSpace();
- store.getUsableSpace();
+ try {
+ store.getTotalSpace();
+ store.getUnallocatedSpace();
+ store.getUsableSpace();
+ } catch (NoSuchFileException nsfe) {
+ // ignore exception as the store could have been
+ // deleted since the iterator was instantiated
+ System.err.format("%s was not found\n", store);
+ }
// two distinct FileStores should not be equal
assertTrue(!store.equals(prev));
--- a/jdk/test/java/nio/file/Files/probeContentType/Basic.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/nio/file/Files/probeContentType/Basic.java Wed Jul 05 20:44:51 2017 +0200
@@ -22,7 +22,7 @@
*/
/* @test
- * @bug 4313887 8129632
+ * @bug 4313887 8129632 8129633
* @summary Unit test for probeContentType method
* @library ../..
* @build Basic SimpleFileTypeDetector
--- a/jdk/test/java/security/KeyStore/EntryMethods.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/security/KeyStore/EntryMethods.java Wed Jul 05 20:44:51 2017 +0200
@@ -23,7 +23,7 @@
/*
* @test 1.5, 03/06/24
- * @bug 4850376
+ * @bug 4850376 8130850
* @summary Provide generic storage KeyStore storage facilities
*/
@@ -50,6 +50,20 @@
}
}
+ public static class MyLoadStoreParameter
+ implements KeyStore.LoadStoreParameter {
+
+ private KeyStore.ProtectionParameter protection;
+
+ MyLoadStoreParameter(KeyStore.ProtectionParameter protection) {
+ this.protection = protection;
+ }
+
+ public KeyStore.ProtectionParameter getProtectionParameter() {
+ return protection;
+ }
+ }
+
public static class FooEntry implements KeyStore.Entry { }
public EntryMethods() throws Exception {
@@ -103,9 +117,17 @@
throw new SecurityException("[Pre1.5] test " + tNum + " failed");
} catch (UnsupportedOperationException uoe) {
System.out.println("[Pre1.5] test " + tNum++ + " passed");
+ } catch (NoSuchAlgorithmException nsae) {
+ System.out.println("[Pre1.5] test " + tNum++ + " passed");
}
+ // TEST load custom param
+ ks.load(new MyLoadStoreParameter(
+ new KeyStore.PasswordProtection(password)));
+ System.out.println("[Pre1.5] test " + tNum++ + " passed");
+
+
// TEST store random param
ks.load(pre15fis, password);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/testlibrary/CertificateBuilder.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,539 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.testlibrary;
+
+import java.io.*;
+import java.util.*;
+import java.security.*;
+import java.security.cert.X509Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.Extension;
+import javax.security.auth.x500.X500Principal;
+import java.math.BigInteger;
+
+import sun.security.util.DerOutputStream;
+import sun.security.util.DerValue;
+import sun.security.util.ObjectIdentifier;
+import sun.security.x509.AccessDescription;
+import sun.security.x509.AlgorithmId;
+import sun.security.x509.AuthorityInfoAccessExtension;
+import sun.security.x509.AuthorityKeyIdentifierExtension;
+import sun.security.x509.SubjectKeyIdentifierExtension;
+import sun.security.x509.BasicConstraintsExtension;
+import sun.security.x509.ExtendedKeyUsageExtension;
+import sun.security.x509.DNSName;
+import sun.security.x509.GeneralName;
+import sun.security.x509.GeneralNames;
+import sun.security.x509.KeyUsageExtension;
+import sun.security.x509.SerialNumber;
+import sun.security.x509.SubjectAlternativeNameExtension;
+import sun.security.x509.URIName;
+import sun.security.x509.KeyIdentifier;
+
+/**
+ * Helper class that builds and signs X.509 certificates.
+ *
+ * A CertificateBuilder is created with a default constructor, and then
+ * uses additional public methods to set the public key, desired validity
+ * dates, serial number and extensions. It is expected that the caller will
+ * have generated the necessary key pairs prior to using a CertificateBuilder
+ * to generate certificates.
+ *
+ * The following methods are mandatory before calling build():
+ * <UL>
+ * <LI>{@link #setSubjectName(java.lang.String)}
+ * <LI>{@link #setPublicKey(java.security.PublicKey)}
+ * <LI>{@link #setNotBefore(java.util.Date)} and
+ * {@link #setNotAfter(java.util.Date)}, or
+ * {@link #setValidity(java.util.Date, java.util.Date)}
+ * <LI>{@link #setSerialNumber(java.math.BigInteger)}
+ * </UL><BR>
+ *
+ * Additionally, the caller can either provide a {@link List} of
+ * {@link Extension} objects, or use the helper classes to add specific
+ * extension types.
+ *
+ * When all required and desired parameters are set, the
+ * {@link #build(java.security.cert.X509Certificate, java.security.PrivateKey,
+ * java.lang.String)} method can be used to create the {@link X509Certificate}
+ * object.
+ *
+ * Multiple certificates may be cut from the same settings using subsequent
+ * calls to the build method. Settings may be cleared using the
+ * {@link #reset()} method.
+ */
+public class CertificateBuilder {
+ private final CertificateFactory factory;
+
+ private X500Principal subjectName = null;
+ private BigInteger serialNumber = null;
+ private PublicKey publicKey = null;
+ private Date notBefore = null;
+ private Date notAfter = null;
+ private final Map<String, Extension> extensions = new HashMap<>();
+ private byte[] tbsCertBytes;
+ private byte[] signatureBytes;
+
+ /**
+ * Default constructor for a {@code CertificateBuilder} object.
+ *
+ * @throws CertificateException if the underlying {@link CertificateFactory}
+ * cannot be instantiated.
+ */
+ public CertificateBuilder() throws CertificateException {
+ factory = CertificateFactory.getInstance("X.509");
+ }
+
+ /**
+ * Set the subject name for the certificate.
+ *
+ * @param name An {@link X500Principal} to be used as the subject name
+ * on this certificate.
+ */
+ public void setSubjectName(X500Principal name) {
+ subjectName = name;
+ }
+
+ /**
+ * Set the subject name for the certificate.
+ *
+ * @param name The subject name in RFC 2253 format
+ */
+ public void setSubjectName(String name) {
+ subjectName = new X500Principal(name);
+ }
+
+ /**
+ * Set the public key for this certificate.
+ *
+ * @param pubKey The {@link PublicKey} to be used on this certificate.
+ */
+ public void setPublicKey(PublicKey pubKey) {
+ publicKey = Objects.requireNonNull(pubKey, "Caught null public key");
+ }
+
+ /**
+ * Set the NotBefore date on the certificate.
+ *
+ * @param nbDate A {@link Date} object specifying the start of the
+ * certificate validity period.
+ */
+ public void setNotBefore(Date nbDate) {
+ Objects.requireNonNull(nbDate, "Caught null notBefore date");
+ notBefore = (Date)nbDate.clone();
+ }
+
+ /**
+ * Set the NotAfter date on the certificate.
+ *
+ * @param naDate A {@link Date} object specifying the end of the
+ * certificate validity period.
+ */
+ public void setNotAfter(Date naDate) {
+ Objects.requireNonNull(naDate, "Caught null notAfter date");
+ notAfter = (Date)naDate.clone();
+ }
+
+ /**
+ * Set the validity period for the certificate
+ *
+ * @param nbDate A {@link Date} object specifying the start of the
+ * certificate validity period.
+ * @param naDate A {@link Date} object specifying the end of the
+ * certificate validity period.
+ */
+ public void setValidity(Date nbDate, Date naDate) {
+ setNotBefore(nbDate);
+ setNotAfter(naDate);
+ }
+
+ /**
+ * Set the serial number on the certificate.
+ *
+ * @param serial A serial number in {@link BigInteger} form.
+ */
+ public void setSerialNumber(BigInteger serial) {
+ Objects.requireNonNull(serial, "Caught null serial number");
+ serialNumber = serial;
+ }
+
+
+ /**
+ * Add a single extension to the certificate.
+ *
+ * @param ext The extension to be added.
+ */
+ public void addExtension(Extension ext) {
+ Objects.requireNonNull(ext, "Caught null extension");
+ extensions.put(ext.getId(), ext);
+ }
+
+ /**
+ * Add multiple extensions contained in a {@code List}.
+ *
+ * @param extList The {@link List} of extensions to be added to
+ * the certificate.
+ */
+ public void addExtensions(List<Extension> extList) {
+ Objects.requireNonNull(extList, "Caught null extension list");
+ for (Extension ext : extList) {
+ extensions.put(ext.getId(), ext);
+ }
+ }
+
+ /**
+ * Helper method to add DNSName types for the SAN extension
+ *
+ * @param dnsNames A {@code List} of names to add as DNSName types
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addSubjectAltNameDNSExt(List<String> dnsNames) throws IOException {
+ if (!dnsNames.isEmpty()) {
+ GeneralNames gNames = new GeneralNames();
+ for (String name : dnsNames) {
+ gNames.add(new GeneralName(new DNSName(name)));
+ }
+ addExtension(new SubjectAlternativeNameExtension(false,
+ gNames));
+ }
+ }
+
+ /**
+ * Helper method to add one or more OCSP URIs to the Authority Info Access
+ * certificate extension.
+ *
+ * @param locations A list of one or more OCSP responder URIs as strings
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addAIAExt(List<String> locations)
+ throws IOException {
+ if (!locations.isEmpty()) {
+ List<AccessDescription> acDescList = new ArrayList<>();
+ for (String ocspUri : locations) {
+ acDescList.add(new AccessDescription(
+ AccessDescription.Ad_OCSP_Id,
+ new GeneralName(new URIName(ocspUri))));
+ }
+ addExtension(new AuthorityInfoAccessExtension(acDescList));
+ }
+ }
+
+ /**
+ * Set a Key Usage extension for the certificate. The extension will
+ * be marked critical.
+ *
+ * @param bitSettings Boolean array for all nine bit settings in the order
+ * documented in RFC 5280 section 4.2.1.3.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addKeyUsageExt(boolean[] bitSettings) throws IOException {
+ addExtension(new KeyUsageExtension(bitSettings));
+ }
+
+ /**
+ * Set the Basic Constraints Extension for a certificate.
+ *
+ * @param crit {@code true} if critical, {@code false} otherwise
+ * @param isCA {@code true} if the extension will be on a CA certificate,
+ * {@code false} otherwise
+ * @param maxPathLen The maximum path length issued by this CA. Values
+ * less than zero will omit this field from the resulting extension and
+ * no path length constraint will be asserted.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addBasicConstraintsExt(boolean crit, boolean isCA,
+ int maxPathLen) throws IOException {
+ addExtension(new BasicConstraintsExtension(crit, isCA, maxPathLen));
+ }
+
+ /**
+ * Add the Authority Key Identifier extension.
+ *
+ * @param authorityCert The certificate of the issuing authority.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addAuthorityKeyIdExt(X509Certificate authorityCert)
+ throws IOException {
+ addAuthorityKeyIdExt(authorityCert.getPublicKey());
+ }
+
+ /**
+ * Add the Authority Key Identifier extension.
+ *
+ * @param authorityKey The public key of the issuing authority.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addAuthorityKeyIdExt(PublicKey authorityKey) throws IOException {
+ KeyIdentifier kid = new KeyIdentifier(authorityKey);
+ addExtension(new AuthorityKeyIdentifierExtension(kid, null, null));
+ }
+
+ /**
+ * Add the Subject Key Identifier extension.
+ *
+ * @param subjectKey The public key to be used in the resulting certificate
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addSubjectKeyIdExt(PublicKey subjectKey) throws IOException {
+ byte[] keyIdBytes = new KeyIdentifier(subjectKey).getIdentifier();
+ addExtension(new SubjectKeyIdentifierExtension(keyIdBytes));
+ }
+
+ /**
+ * Add the Extended Key Usage extension.
+ *
+ * @param ekuOids A {@link List} of object identifiers in string form.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void addExtendedKeyUsageExt(List<String> ekuOids)
+ throws IOException {
+ if (!ekuOids.isEmpty()) {
+ Vector<ObjectIdentifier> oidVector = new Vector<>();
+ for (String oid : ekuOids) {
+ oidVector.add(new ObjectIdentifier(oid));
+ }
+ addExtension(new ExtendedKeyUsageExtension(oidVector));
+ }
+ }
+
+ /**
+ * Clear all settings and return the {@code CertificateBuilder} to
+ * its default state.
+ */
+ public void reset() {
+ extensions.clear();
+ subjectName = null;
+ notBefore = null;
+ notAfter = null;
+ serialNumber = null;
+ publicKey = null;
+ signatureBytes = null;
+ tbsCertBytes = null;
+ }
+
+ /**
+ * Build the certificate.
+ *
+ * @param issuerCert The certificate of the issuing authority, or
+ * {@code null} if the resulting certificate is self-signed.
+ * @param issuerKey The private key of the issuing authority
+ * @param algName The signature algorithm name
+ *
+ * @return The resulting {@link X509Certificate}
+ *
+ * @throws IOException if an encoding error occurs.
+ * @throws CertificateException If the certificate cannot be generated
+ * by the underlying {@link CertificateFactory}
+ * @throws NoSuchAlgorithmException If an invalid signature algorithm
+ * is provided.
+ */
+ public X509Certificate build(X509Certificate issuerCert,
+ PrivateKey issuerKey, String algName)
+ throws IOException, CertificateException, NoSuchAlgorithmException {
+ // TODO: add some basic checks (key usage, basic constraints maybe)
+
+ AlgorithmId signAlg = AlgorithmId.get(algName);
+ byte[] encodedCert = encodeTopLevel(issuerCert, issuerKey, signAlg);
+ ByteArrayInputStream bais = new ByteArrayInputStream(encodedCert);
+ return (X509Certificate)factory.generateCertificate(bais);
+ }
+
+ /**
+ * Encode the contents of the outer-most ASN.1 SEQUENCE:
+ *
+ * <PRE>
+ * Certificate ::= SEQUENCE {
+ * tbsCertificate TBSCertificate,
+ * signatureAlgorithm AlgorithmIdentifier,
+ * signatureValue BIT STRING }
+ * </PRE>
+ *
+ * @param issuerCert The certificate of the issuing authority, or
+ * {@code null} if the resulting certificate is self-signed.
+ * @param issuerKey The private key of the issuing authority
+ * @param signAlg The signature algorithm object
+ *
+ * @return The DER-encoded X.509 certificate
+ *
+ * @throws CertificateException If an error occurs during the
+ * signing process.
+ * @throws IOException if an encoding error occurs.
+ */
+ private byte[] encodeTopLevel(X509Certificate issuerCert,
+ PrivateKey issuerKey, AlgorithmId signAlg)
+ throws CertificateException, IOException {
+ DerOutputStream outerSeq = new DerOutputStream();
+ DerOutputStream topLevelItems = new DerOutputStream();
+
+ tbsCertBytes = encodeTbsCert(issuerCert, signAlg);
+ topLevelItems.write(tbsCertBytes);
+ try {
+ signatureBytes = signCert(issuerKey, signAlg);
+ } catch (GeneralSecurityException ge) {
+ throw new CertificateException(ge);
+ }
+ signAlg.derEncode(topLevelItems);
+ topLevelItems.putBitString(signatureBytes);
+ outerSeq.write(DerValue.tag_Sequence, topLevelItems);
+
+ return outerSeq.toByteArray();
+ }
+
+ /**
+ * Encode the bytes for the TBSCertificate structure:
+ * <PRE>
+ * TBSCertificate ::= SEQUENCE {
+ * version [0] EXPLICIT Version DEFAULT v1,
+ * serialNumber CertificateSerialNumber,
+ * signature AlgorithmIdentifier,
+ * issuer Name,
+ * validity Validity,
+ * subject Name,
+ * subjectPublicKeyInfo SubjectPublicKeyInfo,
+ * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
+ * -- If present, version MUST be v2 or v3
+ * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
+ * -- If present, version MUST be v2 or v3
+ * extensions [3] EXPLICIT Extensions OPTIONAL
+ * -- If present, version MUST be v3
+ * }
+ *
+ * @param issuerCert The certificate of the issuing authority, or
+ * {@code null} if the resulting certificate is self-signed.
+ * @param signAlg The signature algorithm object
+ *
+ * @return The DER-encoded bytes for the TBSCertificate structure
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ private byte[] encodeTbsCert(X509Certificate issuerCert,
+ AlgorithmId signAlg) throws IOException {
+ DerOutputStream tbsCertSeq = new DerOutputStream();
+ DerOutputStream tbsCertItems = new DerOutputStream();
+
+ // Hardcode to V3
+ byte[] v3int = {0x02, 0x01, 0x02};
+ tbsCertItems.write(DerValue.createTag(DerValue.TAG_CONTEXT, true,
+ (byte)0), v3int);
+
+ // Serial Number
+ SerialNumber sn = new SerialNumber(serialNumber);
+ sn.encode(tbsCertItems);
+
+ // Algorithm ID
+ signAlg.derEncode(tbsCertItems);
+
+ // Issuer Name
+ if (issuerCert != null) {
+ tbsCertItems.write(
+ issuerCert.getSubjectX500Principal().getEncoded());
+ } else {
+ // Self-signed
+ tbsCertItems.write(subjectName.getEncoded());
+ }
+
+ // Validity period (set as UTCTime)
+ DerOutputStream valSeq = new DerOutputStream();
+ valSeq.putUTCTime(notBefore);
+ valSeq.putUTCTime(notAfter);
+ tbsCertItems.write(DerValue.tag_Sequence, valSeq);
+
+ // Subject Name
+ tbsCertItems.write(subjectName.getEncoded());
+
+ // SubjectPublicKeyInfo
+ tbsCertItems.write(publicKey.getEncoded());
+
+ // TODO: Extensions!
+ encodeExtensions(tbsCertItems);
+
+ // Wrap it all up in a SEQUENCE and return the bytes
+ tbsCertSeq.write(DerValue.tag_Sequence, tbsCertItems);
+ return tbsCertSeq.toByteArray();
+ }
+
+ /**
+ * Encode the extensions segment for an X.509 Certificate:
+ *
+ * <PRE>
+ * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
+ *
+ * Extension ::= SEQUENCE {
+ * extnID OBJECT IDENTIFIER,
+ * critical BOOLEAN DEFAULT FALSE,
+ * extnValue OCTET STRING
+ * -- contains the DER encoding of an ASN.1 value
+ * -- corresponding to the extension type identified
+ * -- by extnID
+ * }
+ * </PRE>
+ *
+ * @param tbsStream The {@code DerOutputStream} that holds the
+ * TBSCertificate contents.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ private void encodeExtensions(DerOutputStream tbsStream)
+ throws IOException {
+ DerOutputStream extSequence = new DerOutputStream();
+ DerOutputStream extItems = new DerOutputStream();
+
+ for (Extension ext : extensions.values()) {
+ ext.encode(extItems);
+ }
+ extSequence.write(DerValue.tag_Sequence, extItems);
+ tbsStream.write(DerValue.createTag(DerValue.TAG_CONTEXT, true,
+ (byte)3), extSequence);
+ }
+
+ /**
+ * Digitally sign the X.509 certificate.
+ *
+ * @param issuerKey The private key of the issuing authority
+ * @param signAlg The signature algorithm object
+ *
+ * @return The digital signature bytes.
+ *
+ * @throws GeneralSecurityException If any errors occur during the
+ * digital signature process.
+ */
+ private byte[] signCert(PrivateKey issuerKey, AlgorithmId signAlg)
+ throws GeneralSecurityException {
+ Signature sig = Signature.getInstance(signAlg.getName());
+ sig.initSign(issuerKey);
+ sig.update(tbsCertBytes);
+ return sig.sign();
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/testlibrary/SimpleOCSPServer.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,1540 @@
+/*
+ * Copyright (c) 2015, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+package sun.security.testlibrary;
+
+import java.io.*;
+import java.net.*;
+import java.security.*;
+import java.security.cert.CRLReason;
+import java.security.cert.X509Certificate;
+import java.security.cert.Extension;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateEncodingException;
+import java.security.Signature;
+import java.util.*;
+import java.util.concurrent.*;
+import java.text.SimpleDateFormat;
+import java.math.BigInteger;
+
+import sun.security.x509.*;
+import sun.security.x509.PKIXExtensions;
+import sun.security.provider.certpath.ResponderId;
+import sun.security.provider.certpath.CertId;
+import sun.security.provider.certpath.OCSPResponse;
+import sun.security.provider.certpath.OCSPResponse.ResponseStatus;
+import sun.security.util.Debug;
+import sun.security.util.DerInputStream;
+import sun.security.util.DerOutputStream;
+import sun.security.util.DerValue;
+import sun.security.util.ObjectIdentifier;
+
+
+/**
+ * This is a simple OCSP server designed to listen and respond to incoming
+ * requests.
+ */
+public class SimpleOCSPServer {
+ private final Debug debug = Debug.getInstance("oserv");
+ private static final ObjectIdentifier OCSP_BASIC_RESPONSE_OID =
+ ObjectIdentifier.newInternal(
+ new int[] { 1, 3, 6, 1, 5, 5, 7, 48, 1, 1});
+ private static final SimpleDateFormat utcDateFmt =
+ new SimpleDateFormat("MMM dd yyyy, HH:mm:ss z");
+
+ // CertStatus values
+ public static enum CertStatus {
+ CERT_STATUS_GOOD,
+ CERT_STATUS_REVOKED,
+ CERT_STATUS_UNKNOWN,
+ }
+
+ // Fields used for the networking portion of the responder
+ private ServerSocket servSocket;
+ private InetAddress listenAddress;
+ private int listenPort;
+
+ // Keystore information (certs, keys, etc.)
+ private KeyStore keystore;
+ private X509Certificate issuerCert;
+ private X509Certificate signerCert;
+ private PrivateKey signerKey;
+
+ // Fields used for the operational portions of the server
+ private boolean logEnabled = false;
+ private ExecutorService threadPool;
+ private volatile boolean started = false;
+ private volatile boolean receivedShutdown = false;
+ private long delayMsec = 0;
+
+ // Fields used in the generation of responses
+ private long nextUpdateInterval = -1;
+ private Date nextUpdate = null;
+ private ResponderId respId;
+ private AlgorithmId sigAlgId;
+ private Map<CertId, CertStatusInfo> statusDb =
+ Collections.synchronizedMap(new HashMap<>());
+
+ /**
+ * Construct a SimpleOCSPServer using keystore, password, and alias
+ * parameters.
+ *
+ * @param ks the keystore to be used
+ * @param password the password to access key material in the keystore
+ * @param issuerAlias the alias of the issuer certificate
+ * @param signerAlias the alias of the signer certificate and key. A
+ * value of {@code null} means that the {@code issuerAlias} will be used
+ * to look up the signer key.
+ *
+ * @throws GeneralSecurityException if there are problems accessing the
+ * keystore or finding objects within the keystore.
+ * @throws IOException if a {@code ResponderId} cannot be generated from
+ * the signer certificate.
+ */
+ public SimpleOCSPServer(KeyStore ks, String password, String issuerAlias,
+ String signerAlias) throws GeneralSecurityException, IOException {
+ this(null, 0, ks, password, issuerAlias, signerAlias);
+ }
+
+ /**
+ * Construct a SimpleOCSPServer using specific network parameters,
+ * keystore, password, and alias.
+ *
+ * @param addr the address to bind the server to. A value of {@code null}
+ * means the server will bind to all interfaces.
+ * @param port the port to listen on. A value of {@code 0} will mean that
+ * the server will randomly pick an open ephemeral port to bind to.
+ * @param ks the keystore to be used
+ * @param password the password to access key material in the keystore
+ * @param issuerAlias the alias of the issuer certificate
+ * @param signerAlias the alias of the signer certificate and key. A
+ * value of {@code null} means that the {@code issuerAlias} will be used
+ * to look up the signer key.
+ *
+ * @throws GeneralSecurityException if there are problems accessing the
+ * keystore or finding objects within the keystore.
+ * @throws IOException if a {@code ResponderId} cannot be generated from
+ * the signer certificate.
+ */
+ public SimpleOCSPServer(InetAddress addr, int port, KeyStore ks,
+ String password, String issuerAlias, String signerAlias)
+ throws GeneralSecurityException, IOException {
+ Objects.requireNonNull(ks, "Null keystore provided");
+ Objects.requireNonNull(issuerAlias, "Null issuerName provided");
+
+ utcDateFmt.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+ keystore = ks;
+ issuerCert = (X509Certificate)ks.getCertificate(issuerAlias);
+ if (issuerCert == null) {
+ throw new IllegalArgumentException("Certificate for alias " +
+ issuerAlias + " not found");
+ }
+
+ if (signerAlias != null) {
+ signerCert = (X509Certificate)ks.getCertificate(signerAlias);
+ if (signerCert == null) {
+ throw new IllegalArgumentException("Certificate for alias " +
+ signerAlias + " not found");
+ }
+ signerKey = (PrivateKey)ks.getKey(signerAlias,
+ password.toCharArray());
+ if (signerKey == null) {
+ throw new IllegalArgumentException("PrivateKey for alias " +
+ signerAlias + " not found");
+ }
+ } else {
+ signerCert = issuerCert;
+ signerKey = (PrivateKey)ks.getKey(issuerAlias,
+ password.toCharArray());
+ if (signerKey == null) {
+ throw new IllegalArgumentException("PrivateKey for alias " +
+ issuerAlias + " not found");
+ }
+ }
+
+ sigAlgId = AlgorithmId.get("Sha256withRSA");
+ respId = new ResponderId(signerCert.getSubjectX500Principal());
+ listenAddress = addr;
+ listenPort = port;
+ }
+
+ /**
+ * Start the server. The server will bind to the specified network
+ * address and begin listening for incoming connections.
+ *
+ * @throws IOException if any number of things go wonky.
+ */
+ public synchronized void start() throws IOException {
+ // You cannot start the server twice.
+ if (started) {
+ log("Server has already been started");
+ return;
+ } else {
+ started = true;
+ }
+
+ // Create and start the thread pool
+ threadPool = Executors.newFixedThreadPool(32, new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = Executors.defaultThreadFactory().newThread(r);
+ t.setDaemon(true);
+ return t;
+ }
+ });
+
+ threadPool.submit(new Runnable() {
+ @Override
+ public void run() {
+ try (ServerSocket sSock = new ServerSocket()) {
+ servSocket = sSock;
+ servSocket.setReuseAddress(true);
+ servSocket.setSoTimeout(500);
+ servSocket.bind(new InetSocketAddress(listenAddress,
+ listenPort), 128);
+ log("Listening on " + servSocket.getLocalSocketAddress());
+
+ // Update the listenPort with the new port number. If
+ // the server is restarted, it will bind to the same
+ // port rather than picking a new one.
+ listenPort = servSocket.getLocalPort();
+
+ // Main dispatch loop
+ while (!receivedShutdown) {
+ try {
+ Socket newConnection = servSocket.accept();
+ threadPool.submit(new OcspHandler(newConnection));
+ } catch (SocketTimeoutException timeout) {
+ // Nothing to do here. If receivedShutdown
+ // has changed to true then the loop will
+ // exit on its own.
+ } catch (IOException ioe) {
+ // Something bad happened, log and force a shutdown
+ log("Unexpected Exception: " + ioe);
+ stop();
+ }
+ }
+
+ log("Shutting down...");
+ threadPool.shutdown();
+ } catch (IOException ioe) {
+ err(ioe);
+ }
+
+ // Reset state variables so the server can be restarted
+ receivedShutdown = false;
+ started = false;
+ }
+ });
+ }
+
+ /**
+ * Stop the OCSP server.
+ */
+ public synchronized void stop() {
+ if (started) {
+ receivedShutdown = true;
+ log("Received shutdown notification");
+ }
+ }
+
+ /**
+ * Print {@code SimpleOCSPServer} operating parameters.
+ *
+ * @return the {@code SimpleOCSPServer} operating parameters in
+ * {@code String} form.
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("OCSP Server:\n");
+ sb.append("----------------------------------------------\n");
+ sb.append("issuer: ").append(issuerCert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("signer: ").append(signerCert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("ResponderId: ").append(respId).append("\n");
+ sb.append("----------------------------------------------");
+
+ return sb.toString();
+ }
+
+ /**
+ * Helpful debug routine to hex dump byte arrays.
+ *
+ * @param data the array of bytes to dump to stdout.
+ *
+ * @return the hexdump of the byte array
+ */
+ private static String dumpHexBytes(byte[] data) {
+ return dumpHexBytes(data, 16, "\n", " ");
+ }
+
+ /**
+ *
+ * @param data the array of bytes to dump to stdout.
+ * @param itemsPerLine the number of bytes to display per line
+ * if the {@code lineDelim} character is blank then all bytes will be
+ * printed on a single line.
+ * @param lineDelim the delimiter between lines
+ * @param itemDelim the delimiter between bytes
+ *
+ * @return The hexdump of the byte array
+ */
+ private static String dumpHexBytes(byte[] data, int itemsPerLine,
+ String lineDelim, String itemDelim) {
+ StringBuilder sb = new StringBuilder();
+ if (data != null) {
+ for (int i = 0; i < data.length; i++) {
+ if (i % itemsPerLine == 0 && i != 0) {
+ sb.append(lineDelim);
+ }
+ sb.append(String.format("%02X", data[i])).append(itemDelim);
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Enable or disable the logging feature.
+ *
+ * @param enable {@code true} to enable logging, {@code false} to
+ * disable it. The setting must be activated before the server calls
+ * its start method. Any calls after that have no effect.
+ */
+ public void enableLog(boolean enable) {
+ if (!started) {
+ logEnabled = enable;
+ }
+ }
+
+ /**
+ * Sets the nextUpdate interval. Intervals will be calculated relative
+ * to the server startup time. When first set, the nextUpdate date is
+ * calculated based on the current time plus the interval. After that,
+ * calls to getNextUpdate() will return this date if it is still
+ * later than current time. If not, the Date will be updated to the
+ * next interval that is later than current time. This value must be set
+ * before the server has had its start method called. Calls made after
+ * the server has been started have no effect.
+ *
+ * @param interval the recurring time interval in seconds used to
+ * calculate nextUpdate times. A value less than or equal to 0 will
+ * disable the nextUpdate feature.
+ */
+ public synchronized void setNextUpdateInterval(long interval) {
+ if (!started) {
+ if (interval <= 0) {
+ nextUpdateInterval = -1;
+ nextUpdate = null;
+ log("nexUpdate support has been disabled");
+ } else {
+ nextUpdateInterval = interval * 1000;
+ nextUpdate = new Date(System.currentTimeMillis() +
+ nextUpdateInterval);
+ log("nextUpdate set to " + nextUpdate);
+ }
+ }
+ }
+
+ /**
+ * Return the nextUpdate {@code Date} object for this server. If the
+ * nextUpdate date has already passed, set a new nextUpdate based on
+ * the nextUpdate interval and return that date.
+ *
+ * @return a {@code Date} object set to the nextUpdate field for OCSP
+ * responses.
+ */
+ private synchronized Date getNextUpdate() {
+ if (nextUpdate != null && nextUpdate.before(new Date())) {
+ long nuEpochTime = nextUpdate.getTime();
+ long currentTime = System.currentTimeMillis();
+
+ // Keep adding nextUpdate intervals until you reach a date
+ // that is later than current time.
+ while (currentTime >= nuEpochTime) {
+ nuEpochTime += nextUpdateInterval;
+ }
+
+ // Set the nextUpdate for future threads
+ nextUpdate = new Date(nuEpochTime);
+ log("nextUpdate updated to new value: " + nextUpdate);
+ }
+ return nextUpdate;
+ }
+
+ /**
+ * Add entries into the responder's status database.
+ *
+ * @param newEntries a map of {@code CertStatusInfo} objects, keyed on
+ * their serial number (as a {@code BigInteger}). All serial numbers
+ * are assumed to have come from this responder's issuer certificate.
+ *
+ * @throws IOException if a CertId cannot be generated.
+ */
+ public void updateStatusDb(Map<BigInteger, CertStatusInfo> newEntries)
+ throws IOException {
+ if (newEntries != null) {
+ for (BigInteger serial : newEntries.keySet()) {
+ CertStatusInfo info = newEntries.get(serial);
+ if (info != null) {
+ CertId cid = new CertId(issuerCert,
+ new SerialNumber(serial));
+ statusDb.put(cid, info);
+ log("Added entry for serial " + serial + "(" +
+ info.getType() + ")");
+ }
+ }
+ }
+ }
+
+ /**
+ * Check the status database for revocation information one one or more
+ * certificates.
+ *
+ * @param reqList the list of {@code LocalSingleRequest} objects taken
+ * from the incoming OCSP request.
+ *
+ * @return a {@code Map} of {@code CertStatusInfo} objects keyed by their
+ * {@code CertId} values, for each single request passed in. Those
+ * CertIds not found in the statusDb will have returned List members with
+ * a status of UNKNOWN.
+ */
+ private Map<CertId, CertStatusInfo> checkStatusDb(
+ List<LocalOcspRequest.LocalSingleRequest> reqList) {
+ // TODO figure out what, if anything to do with request extensions
+ Map<CertId, CertStatusInfo> returnMap = new HashMap<>();
+
+ for (LocalOcspRequest.LocalSingleRequest req : reqList) {
+ CertId cid = req.getCertId();
+ CertStatusInfo info = statusDb.get(cid);
+ if (info != null) {
+ log("Status for SN " + cid.getSerialNumber() + ": " +
+ info.getType());
+ returnMap.put(cid, info);
+ } else {
+ log("Status for SN " + cid.getSerialNumber() +
+ " not found, using CERT_STATUS_UNKNOWN");
+ returnMap.put(cid,
+ new CertStatusInfo(CertStatus.CERT_STATUS_UNKNOWN));
+ }
+ }
+
+ return Collections.unmodifiableMap(returnMap);
+ }
+
+ /**
+ * Set the digital signature algorithm used to sign OCSP responses.
+ *
+ * @param algName The algorithm name
+ *
+ * @throws NoSuchAlgorithmException if the algorithm name is invalid.
+ */
+ public void setSignatureAlgorithm(String algName)
+ throws NoSuchAlgorithmException {
+ if (!started) {
+ sigAlgId = AlgorithmId.get(algName);
+ }
+ }
+
+ /**
+ * Get the port the OCSP server is running on.
+ *
+ * @return the port that the OCSP server is running on, or -1 if the
+ * server has not yet been bound to a port.
+ */
+ public int getPort() {
+ if (servSocket != null && started) {
+ InetSocketAddress inetSock =
+ (InetSocketAddress)servSocket.getLocalSocketAddress();
+ return inetSock.getPort();
+ } else {
+ return -1;
+ }
+ }
+
+ /**
+ * Set a delay between the reception of the request and production of
+ * the response.
+ *
+ * @param delayMillis the number of milliseconds to wait before acting
+ * on the incoming request.
+ */
+ public void setDelay(long delayMillis) {
+ if (!started) {
+ delayMsec = delayMillis > 0 ? delayMillis : 0;
+ if (delayMsec > 0) {
+ log("OCSP latency set to " + delayMsec + " milliseconds.");
+ } else {
+ log("OCSP latency disabled");
+ }
+ }
+ }
+
+ /**
+ * Log a message to stdout.
+ *
+ * @param message the message to log
+ */
+ private synchronized void log(String message) {
+ if (logEnabled || debug != null) {
+ System.out.println("[" + Thread.currentThread().getName() + "]: " +
+ message);
+ }
+ }
+
+ /**
+ * Log an error message on the stderr stream.
+ *
+ * @param message the message to log
+ */
+ private static synchronized void err(String message) {
+ System.out.println("[" + Thread.currentThread().getName() + "]: " +
+ message);
+ }
+
+ /**
+ * Log exception information on the stderr stream.
+ *
+ * @param exc the exception to dump information about
+ */
+ private static synchronized void err(Throwable exc) {
+ System.out.print("[" + Thread.currentThread().getName() +
+ "]: Exception: ");
+ exc.printStackTrace(System.out);
+ }
+
+ /**
+ * The {@code CertStatusInfo} class defines an object used to return
+ * information from the internal status database. The data in this
+ * object may be used to construct OCSP responses.
+ */
+ public static class CertStatusInfo {
+ private CertStatus certStatusType;
+ private CRLReason reason;
+ private Date revocationTime;
+
+ /**
+ * Create a Certificate status object by providing the status only.
+ * If the status is {@code REVOKED} then current time is assumed
+ * for the revocation time.
+ *
+ * @param statType the status for this entry.
+ */
+ public CertStatusInfo(CertStatus statType) {
+ this(statType, null, null);
+ }
+
+ /**
+ * Create a CertStatusInfo providing both type and revocation date
+ * (if applicable).
+ *
+ * @param statType the status for this entry.
+ * @param revDate if applicable, the date that revocation took place.
+ * A value of {@code null} indicates that current time should be used.
+ * If the value of {@code statType} is not {@code CERT_STATUS_REVOKED},
+ * then the {@code revDate} parameter is ignored.
+ */
+ public CertStatusInfo(CertStatus statType, Date revDate) {
+ this(statType, revDate, null);
+ }
+
+ /**
+ * Create a CertStatusInfo providing type, revocation date
+ * (if applicable) and revocation reason.
+ *
+ * @param statType the status for this entry.
+ * @param revDate if applicable, the date that revocation took place.
+ * A value of {@code null} indicates that current time should be used.
+ * If the value of {@code statType} is not {@code CERT_STATUS_REVOKED},
+ * then the {@code revDate} parameter is ignored.
+ * @param revReason the reason the certificate was revoked. A value of
+ * {@code null} means that no reason was provided.
+ */
+ public CertStatusInfo(CertStatus statType, Date revDate,
+ CRLReason revReason) {
+ Objects.requireNonNull(statType, "Cert Status must be non-null");
+ certStatusType = statType;
+ switch (statType) {
+ case CERT_STATUS_GOOD:
+ case CERT_STATUS_UNKNOWN:
+ revocationTime = null;
+ break;
+ case CERT_STATUS_REVOKED:
+ revocationTime = revDate != null ? (Date)revDate.clone() :
+ new Date();
+ break;
+ default:
+ throw new IllegalArgumentException("Unknown status type: " +
+ statType);
+ }
+ }
+
+ /**
+ * Get the cert status type
+ *
+ * @return the status applied to this object (e.g.
+ * {@code CERT_STATUS_GOOD}, {@code CERT_STATUS_UNKNOWN}, etc.)
+ */
+ public CertStatus getType() {
+ return certStatusType;
+ }
+
+ /**
+ * Get the revocation time (if applicable).
+ *
+ * @return the revocation time as a {@code Date} object, or
+ * {@code null} if not applicable (i.e. if the certificate hasn't been
+ * revoked).
+ */
+ public Date getRevocationTime() {
+ return (revocationTime != null ? (Date)revocationTime.clone() :
+ null);
+ }
+
+ /**
+ * Get the revocation reason.
+ *
+ * @return the revocation reason, or {@code null} if one was not
+ * provided.
+ */
+ public CRLReason getRevocationReason() {
+ return reason;
+ }
+ }
+
+ /**
+ * Runnable task that handles incoming OCSP Requests and returns
+ * responses.
+ */
+ private class OcspHandler implements Runnable {
+ private final Socket sock;
+ InetSocketAddress peerSockAddr;
+
+ /**
+ * Construct an {@code OcspHandler}.
+ *
+ * @param incomingSocket the socket the server created on accept()
+ */
+ private OcspHandler(Socket incomingSocket) {
+ sock = incomingSocket;
+ }
+
+ /**
+ * Run the OCSP Request parser and construct a response to be sent
+ * back to the client.
+ */
+ @Override
+ public void run() {
+ // If we have implemented a delay to simulate network latency
+ // wait out the delay here before any other processing.
+ try {
+ if (delayMsec > 0) {
+ Thread.sleep(delayMsec);
+ }
+ } catch (InterruptedException ie) {
+ // Just log the interrupted sleep
+ log("Delay of " + delayMsec + " milliseconds was interrupted");
+ }
+
+ try (Socket ocspSocket = sock;
+ InputStream in = ocspSocket.getInputStream();
+ OutputStream out = ocspSocket.getOutputStream()) {
+ peerSockAddr =
+ (InetSocketAddress)ocspSocket.getRemoteSocketAddress();
+ log("Received incoming connection from " + peerSockAddr);
+ String[] headerTokens = readLine(in).split(" ");
+ LocalOcspRequest ocspReq = null;
+ LocalOcspResponse ocspResp = null;
+ ResponseStatus respStat = ResponseStatus.INTERNAL_ERROR;
+ try {
+ if (headerTokens[0] != null) {
+ switch (headerTokens[0]) {
+ case "POST":
+ ocspReq = parseHttpOcspPost(in);
+ break;
+ case "GET":
+ // req = parseHttpOcspGet(in);
+ // TODO implement the GET parsing
+ throw new IOException("GET method unsupported");
+ default:
+ respStat = ResponseStatus.MALFORMED_REQUEST;
+ throw new IOException("Not a GET or POST");
+ }
+ } else {
+ respStat = ResponseStatus.MALFORMED_REQUEST;
+ throw new IOException("Unable to get HTTP method");
+ }
+
+ if (ocspReq != null) {
+ log(ocspReq.toString());
+ // Get responses for all CertIds in the request
+ Map<CertId, CertStatusInfo> statusMap =
+ checkStatusDb(ocspReq.getRequests());
+ if (statusMap.isEmpty()) {
+ respStat = ResponseStatus.UNAUTHORIZED;
+ } else {
+ ocspResp = new LocalOcspResponse(
+ ResponseStatus.SUCCESSFUL, statusMap,
+ ocspReq.getExtensions());
+ }
+ } else {
+ respStat = ResponseStatus.MALFORMED_REQUEST;
+ throw new IOException("Found null request");
+ }
+ } catch (IOException | RuntimeException exc) {
+ err(exc);
+ }
+ if (ocspResp == null) {
+ ocspResp = new LocalOcspResponse(respStat);
+ }
+ sendResponse(out, ocspResp);
+ } catch (IOException | CertificateException exc) {
+ err(exc);
+ }
+ }
+
+ /**
+ * Send an OCSP response on an {@code OutputStream}.
+ *
+ * @param out the {@code OutputStream} on which to send the response.
+ * @param resp the OCSP response to send.
+ *
+ * @throws IOException if an encoding error occurs.
+ */
+ public void sendResponse(OutputStream out, LocalOcspResponse resp)
+ throws IOException {
+ StringBuilder sb = new StringBuilder();
+
+ byte[] respBytes;
+ try {
+ respBytes = resp.getBytes();
+ } catch (RuntimeException re) {
+ err(re);
+ return;
+ }
+
+ sb.append("HTTP/1.0 200 OK\r\n");
+ sb.append("Content-Type: application/ocsp-response\r\n");
+ sb.append("Content-Length: ").append(respBytes.length);
+ sb.append("\r\n\r\n");
+
+ out.write(sb.toString().getBytes("UTF-8"));
+ out.write(respBytes);
+ log(resp.toString());
+ }
+
+ /**
+ * Parse the incoming HTTP POST of an OCSP Request.
+ *
+ * @param inStream the input stream from the socket bound to this
+ * {@code OcspHandler}.
+ *
+ * @return the OCSP Request as a {@code LocalOcspRequest}
+ *
+ * @throws IOException if there are network related issues or problems
+ * occur during parsing of the OCSP request.
+ * @throws CertificateException if one or more of the certificates in
+ * the OCSP request cannot be read/parsed.
+ */
+ private LocalOcspRequest parseHttpOcspPost(InputStream inStream)
+ throws IOException, CertificateException {
+ boolean endOfHeader = false;
+ boolean properContentType = false;
+ int length = -1;
+
+ while (!endOfHeader) {
+ String[] lineTokens = readLine(inStream).split(" ");
+ if (lineTokens[0].isEmpty()) {
+ endOfHeader = true;
+ } else if (lineTokens[0].equalsIgnoreCase("Content-Type:")) {
+ if (lineTokens[1] == null ||
+ !lineTokens[1].equals(
+ "application/ocsp-request")) {
+ log("Unknown Content-Type: " +
+ (lineTokens[1] != null ?
+ lineTokens[1] : "<NULL>"));
+ return null;
+ } else {
+ properContentType = true;
+ log("Content-Type = " + lineTokens[1]);
+ }
+ } else if (lineTokens[0].equalsIgnoreCase("Content-Length:")) {
+ if (lineTokens[1] != null) {
+ length = Integer.parseInt(lineTokens[1]);
+ log("Content-Length = " + length);
+ }
+ }
+ }
+
+ // Okay, make sure we got what we needed from the header, then
+ // read the remaining OCSP Request bytes
+ if (properContentType && length >= 0) {
+ byte[] ocspBytes = new byte[length];
+ inStream.read(ocspBytes);
+ return new LocalOcspRequest(ocspBytes);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Read a line of text that is CRLF-delimited.
+ *
+ * @param is the {@code InputStream} tied to the socket
+ * for this {@code OcspHandler}
+ *
+ * @return a {@code String} consisting of the line of text
+ * read from the stream with the CRLF stripped.
+ *
+ * @throws IOException if any I/O error occurs.
+ */
+ private String readLine(InputStream is) throws IOException {
+ PushbackInputStream pbis = new PushbackInputStream(is);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ boolean done = false;
+ while (!done) {
+ byte b = (byte)pbis.read();
+ if (b == '\r') {
+ byte bNext = (byte)pbis.read();
+ if (bNext == '\n' || bNext == -1) {
+ done = true;
+ } else {
+ pbis.unread(bNext);
+ bos.write(b);
+ }
+ } else if (b == -1) {
+ done = true;
+ } else {
+ bos.write(b);
+ }
+ }
+
+ return new String(bos.toByteArray(), "UTF-8");
+ }
+ }
+
+
+ /**
+ * Simple nested class to handle OCSP requests without making
+ * changes to sun.security.provider.certpath.OCSPRequest
+ */
+ public class LocalOcspRequest {
+
+ private byte[] nonce;
+ private byte[] signature = null;
+ private AlgorithmId algId = null;
+ private int version = 0;
+ private GeneralName requestorName = null;
+ private Map<String, Extension> extensions = Collections.emptyMap();
+ private final List<LocalSingleRequest> requestList = new ArrayList<>();
+ private final List<X509Certificate> certificates = new ArrayList<>();
+
+ /**
+ * Construct a {@code LocalOcspRequest} from its DER encoding.
+ *
+ * @param requestBytes the DER-encoded bytes
+ *
+ * @throws IOException if decoding errors occur
+ * @throws CertificateException if certificates are found in the
+ * OCSP request and they do not parse correctly.
+ */
+ private LocalOcspRequest(byte[] requestBytes) throws IOException,
+ CertificateException {
+ Objects.requireNonNull(requestBytes, "Received null input");
+
+ DerInputStream dis = new DerInputStream(requestBytes);
+
+ // Parse the top-level structure, it should have no more than
+ // two elements.
+ DerValue[] topStructs = dis.getSequence(2);
+ for (DerValue dv : topStructs) {
+ if (dv.tag == DerValue.tag_Sequence) {
+ parseTbsRequest(dv);
+ } else if (dv.isContextSpecific((byte)0)) {
+ parseSignature(dv);
+ } else {
+ throw new IOException("Unknown tag at top level: " +
+ dv.tag);
+ }
+ }
+ }
+
+ /**
+ * Parse the signature block from an OCSP request
+ *
+ * @param sigSequence a {@code DerValue} containing the signature
+ * block at the outer sequence datum.
+ *
+ * @throws IOException if any non-certificate-based parsing errors occur
+ * @throws CertificateException if certificates are found in the
+ * OCSP request and they do not parse correctly.
+ */
+ private void parseSignature(DerValue sigSequence)
+ throws IOException, CertificateException {
+ DerValue[] sigItems = sigSequence.data.getSequence(3);
+ if (sigItems.length != 3) {
+ throw new IOException("Invalid number of signature items: " +
+ "expected 3, got " + sigItems.length);
+ }
+
+ algId = AlgorithmId.parse(sigItems[0]);
+ signature = sigItems[1].getBitString();
+
+ if (sigItems[2].isContextSpecific((byte)0)) {
+ DerValue[] certDerItems = sigItems[2].data.getSequence(4);
+ int i = 0;
+ for (DerValue dv : certDerItems) {
+ X509Certificate xc = new X509CertImpl(dv);
+ certificates.add(xc);
+ }
+ } else {
+ throw new IOException("Invalid tag in signature block: " +
+ sigItems[2].tag);
+ }
+ }
+
+ /**
+ * Parse the to-be-signed request data
+ *
+ * @param tbsReqSeq a {@code DerValue} object containing the to-be-
+ * signed OCSP request at the outermost SEQUENCE tag.
+ * @throws IOException if any parsing errors occur
+ */
+ private void parseTbsRequest(DerValue tbsReqSeq) throws IOException {
+ while (tbsReqSeq.data.available() > 0) {
+ DerValue dv = tbsReqSeq.data.getDerValue();
+ if (dv.isContextSpecific((byte)0)) {
+ // The version was explicitly called out
+ version = dv.data.getInteger();
+ } else if (dv.isContextSpecific((byte)1)) {
+ // A GeneralName was provided
+ requestorName = new GeneralName(dv.data.getDerValue());
+ } else if (dv.isContextSpecific((byte)2)) {
+ // Parse the extensions
+ DerValue[] extItems = dv.data.getSequence(2);
+ extensions = parseExtensions(extItems);
+ } else if (dv.tag == DerValue.tag_Sequence) {
+ while (dv.data.available() > 0) {
+ requestList.add(new LocalSingleRequest(dv.data));
+ }
+ }
+ }
+ }
+
+ /**
+ * Parse a SEQUENCE of extensions. This routine is used both
+ * at the overall request level and down at the singleRequest layer.
+ *
+ * @param extDerItems an array of {@code DerValue} items, each one
+ * consisting of a DER-encoded extension.
+ *
+ * @return a {@code Map} of zero or more extensions,
+ * keyed by its object identifier in {@code String} form.
+ *
+ * @throws IOException if any parsing errors occur.
+ */
+ private Map<String, Extension> parseExtensions(DerValue[] extDerItems)
+ throws IOException {
+ Map<String, Extension> extMap = new HashMap<>();
+
+ if (extDerItems != null && extDerItems.length != 0) {
+ for (DerValue extDerVal : extDerItems) {
+ sun.security.x509.Extension ext =
+ new sun.security.x509.Extension(extDerVal);
+ extMap.put(ext.getId(), ext);
+ }
+ }
+
+ return extMap;
+ }
+
+ /**
+ * Return the list of single request objects in this OCSP request.
+ *
+ * @return an unmodifiable {@code List} of zero or more requests.
+ */
+ private List<LocalSingleRequest> getRequests() {
+ return Collections.unmodifiableList(requestList);
+ }
+
+ /**
+ * Return the list of X.509 Certificates in this OCSP request.
+ *
+ * @return an unmodifiable {@code List} of zero or more
+ * {@cpde X509Certificate} objects.
+ */
+ private List<X509Certificate> getCertificates() {
+ return Collections.unmodifiableList(certificates);
+ }
+
+ /**
+ * Return the map of OCSP request extensions.
+ *
+ * @return an unmodifiable {@code Map} of zero or more
+ * {@code Extension} objects, keyed by their object identifiers
+ * in {@code String} form.
+ */
+ private Map<String, Extension> getExtensions() {
+ return Collections.unmodifiableMap(extensions);
+ }
+
+ /**
+ * Display the {@code LocalOcspRequest} in human readable form.
+ *
+ * @return a {@code String} representation of the
+ * {@code LocalOcspRequest}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(String.format("OCSP Request: Version %d (0x%X)",
+ version + 1, version)).append("\n");
+ if (requestorName != null) {
+ sb.append("Requestor Name: ").append(requestorName).
+ append("\n");
+ }
+
+ int requestCtr = 0;
+ for (LocalSingleRequest lsr : requestList) {
+ sb.append("Request [").append(requestCtr++).append("]\n");
+ sb.append(lsr).append("\n");
+ }
+ if (!extensions.isEmpty()) {
+ sb.append("Extensions (").append(extensions.size()).
+ append(")\n");
+ for (Extension ext : extensions.values()) {
+ sb.append("\t").append(ext).append("\n");
+ }
+ }
+ if (signature != null) {
+ sb.append("Signature: ").append(algId).append("\n");
+ sb.append(dumpHexBytes(signature)).append("\n");
+ int certCtr = 0;
+ for (X509Certificate cert : certificates) {
+ sb.append("Certificate [").append(certCtr++).append("]").
+ append("\n");
+ sb.append("\tSubject: ");
+ sb.append(cert.getSubjectX500Principal()).append("\n");
+ sb.append("\tIssuer: ");
+ sb.append(cert.getIssuerX500Principal()).append("\n");
+ sb.append("\tSerial: ").append(cert.getSerialNumber());
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Inner class designed to handle the decoding/representation of
+ * single requests within a {@code LocalOcspRequest} object.
+ */
+ public class LocalSingleRequest {
+ private final CertId cid;
+ private Map<String, Extension> extensions = Collections.emptyMap();
+
+ private LocalSingleRequest(DerInputStream dis)
+ throws IOException {
+ DerValue[] srItems = dis.getSequence(2);
+
+ // There should be 1, possibly 2 DerValue items
+ if (srItems.length == 1 || srItems.length == 2) {
+ // The first parsable item should be the mandatory CertId
+ cid = new CertId(srItems[0].data);
+ if (srItems.length == 2) {
+ if (srItems[1].isContextSpecific((byte)0)) {
+ DerValue[] extDerItems = srItems[1].data.getSequence(2);
+ extensions = parseExtensions(extDerItems);
+ } else {
+ throw new IOException("Illegal tag in Request " +
+ "extensions: " + srItems[1].tag);
+ }
+ }
+ } else {
+ throw new IOException("Invalid number of items in " +
+ "Request (" + srItems.length + ")");
+ }
+ }
+
+ /**
+ * Get the {@code CertId} for this single request.
+ *
+ * @return the {@code CertId} for this single request.
+ */
+ private CertId getCertId() {
+ return cid;
+ }
+
+ /**
+ * Return the map of single request extensions.
+ *
+ * @return an unmodifiable {@code Map} of zero or more
+ * {@code Extension} objects, keyed by their object identifiers
+ * in {@code String} form.
+ */
+ private Map<String, Extension> getExtensions() {
+ return Collections.unmodifiableMap(extensions);
+ }
+
+ /**
+ * Display the {@code LocalSingleRequest} in human readable form.
+ *
+ * @return a {@code String} representation of the
+ * {@code LocalSingleRequest}
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("CertId, Algorithm = ");
+ sb.append(cid.getHashAlgorithm()).append("\n");
+ sb.append("\tIssuer Name Hash: ");
+ sb.append(dumpHexBytes(cid.getIssuerNameHash(), 256, "", ""));
+ sb.append("\n");
+ sb.append("\tIssuer Key Hash: ");
+ sb.append(dumpHexBytes(cid.getIssuerKeyHash(), 256, "", ""));
+ sb.append("\n");
+ sb.append("\tSerial Number: ").append(cid.getSerialNumber());
+ if (!extensions.isEmpty()) {
+ sb.append("Extensions (").append(extensions.size()).
+ append(")\n");
+ for (Extension ext : extensions.values()) {
+ sb.append("\t").append(ext).append("\n");
+ }
+ }
+
+ return sb.toString();
+ }
+ }
+ }
+
+ /**
+ * Simple nested class to handle OCSP requests without making
+ * changes to sun.security.provider.certpath.OCSPResponse
+ */
+ public class LocalOcspResponse {
+ private final int version = 0;
+ private final OCSPResponse.ResponseStatus responseStatus;
+ private final Map<CertId, CertStatusInfo> respItemMap;
+ private final Date producedAtDate;
+ private final List<LocalSingleResponse> singleResponseList =
+ new ArrayList<>();
+ private final Map<String, Extension> responseExtensions;
+ private byte[] signature;
+ private final List<X509Certificate> certificates;
+ private final byte[] encodedResponse;
+
+ /**
+ * Constructor for the generation of non-successful responses
+ *
+ * @param respStat the OCSP response status.
+ *
+ * @throws IOException if an error happens during encoding
+ * @throws NullPointerException if {@code respStat} is {@code null}
+ * or {@code respStat} is successful.
+ */
+ public LocalOcspResponse(OCSPResponse.ResponseStatus respStat)
+ throws IOException {
+ this(respStat, null, null);
+ }
+
+ /**
+ * Construct a response from a list of certificate
+ * status objects and extensions.
+ *
+ * @param respStat the status of the entire response
+ * @param itemMap a {@code Map} of {@code CertId} objects and their
+ * respective revocation statuses from the server's response DB.
+ * @param reqExtensions a {@code Map} of request extensions
+ *
+ * @throws IOException if an error happens during encoding
+ * @throws NullPointerException if {@code respStat} is {@code null}
+ * or {@code respStat} is successful, and a {@code null} {@code itemMap}
+ * has been provided.
+ */
+ public LocalOcspResponse(OCSPResponse.ResponseStatus respStat,
+ Map<CertId, CertStatusInfo> itemMap,
+ Map<String, Extension> reqExtensions) throws IOException {
+ responseStatus = Objects.requireNonNull(respStat,
+ "Illegal null response status");
+ if (responseStatus == ResponseStatus.SUCCESSFUL) {
+ respItemMap = Objects.requireNonNull(itemMap,
+ "SUCCESSFUL responses must have a response map");
+ producedAtDate = new Date();
+
+ // Turn the answerd from the response DB query into a list
+ // of single responses.
+ for (CertId id : itemMap.keySet()) {
+ singleResponseList.add(
+ new LocalSingleResponse(id, itemMap.get(id)));
+ }
+
+ responseExtensions = setResponseExtensions(reqExtensions);
+ certificates = new ArrayList<>();
+ if (signerCert != issuerCert) {
+ certificates.add(signerCert);
+ }
+ certificates.add(issuerCert);
+ } else {
+ respItemMap = null;
+ producedAtDate = null;
+ responseExtensions = null;
+ certificates = null;
+ }
+ encodedResponse = this.getBytes();
+ }
+
+ /**
+ * Set the response extensions based on the request extensions
+ * that were received. Right now, this is limited to the
+ * OCSP nonce extension.
+ *
+ * @param reqExts a {@code Map} of zero or more request extensions
+ *
+ * @return a {@code Map} of zero or more response extensions, keyed
+ * by the extension object identifier in {@code String} form.
+ */
+ private Map<String, Extension> setResponseExtensions(
+ Map<String, Extension> reqExts) {
+ Map<String, Extension> respExts = new HashMap<>();
+ String ocspNonceStr = PKIXExtensions.OCSPNonce_Id.toString();
+
+ if (reqExts != null) {
+ for (String id : reqExts.keySet()) {
+ if (id.equals(ocspNonceStr)) {
+ // We found a nonce, add it into the response extensions
+ Extension ext = reqExts.get(id);
+ if (ext != null) {
+ respExts.put(id, ext);
+ log("Added OCSP Nonce to response");
+ } else {
+ log("Error: Found nonce entry, but found null " +
+ "value. Skipping");
+ }
+ }
+ }
+ }
+
+ return respExts;
+ }
+
+ /**
+ * Get the DER-encoded response bytes for this response
+ *
+ * @return a byte array containing the DER-encoded bytes for
+ * the response
+ *
+ * @throws IOException if any encoding errors occur
+ */
+ private byte[] getBytes() throws IOException {
+ DerOutputStream outerSeq = new DerOutputStream();
+ DerOutputStream responseStream = new DerOutputStream();
+ responseStream.putEnumerated(responseStatus.ordinal());
+ if (responseStatus == ResponseStatus.SUCCESSFUL &&
+ respItemMap != null) {
+ encodeResponseBytes(responseStream);
+ }
+
+ // Commit the outermost sequence bytes
+ outerSeq.write(DerValue.tag_Sequence, responseStream);
+ return outerSeq.toByteArray();
+ }
+
+ private void encodeResponseBytes(DerOutputStream responseStream)
+ throws IOException {
+ DerOutputStream explicitZero = new DerOutputStream();
+ DerOutputStream respItemStream = new DerOutputStream();
+
+ respItemStream.putOID(OCSP_BASIC_RESPONSE_OID);
+
+ byte[] basicOcspBytes = encodeBasicOcspResponse();
+ respItemStream.putOctetString(basicOcspBytes);
+ explicitZero.write(DerValue.tag_Sequence, respItemStream);
+ responseStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ true, (byte)0), explicitZero);
+ }
+
+ private byte[] encodeBasicOcspResponse() throws IOException {
+ DerOutputStream outerSeq = new DerOutputStream();
+ DerOutputStream basicORItemStream = new DerOutputStream();
+
+ // Encode the tbsResponse
+ byte[] tbsResponseBytes = encodeTbsResponse();
+ basicORItemStream.write(tbsResponseBytes);
+
+ try {
+ sigAlgId.derEncode(basicORItemStream);
+
+ // Create the signature
+ Signature sig = Signature.getInstance(sigAlgId.getName());
+ sig.initSign(signerKey);
+ sig.update(tbsResponseBytes);
+ signature = sig.sign();
+ basicORItemStream.putBitString(signature);
+ } catch (GeneralSecurityException exc) {
+ err(exc);
+ throw new IOException(exc);
+ }
+
+ // Add certificates
+ try {
+ DerOutputStream certStream = new DerOutputStream();
+ ArrayList<DerValue> certList = new ArrayList<>();
+ if (signerCert != issuerCert) {
+ certList.add(new DerValue(signerCert.getEncoded()));
+ }
+ certList.add(new DerValue(issuerCert.getEncoded()));
+ DerValue[] dvals = new DerValue[certList.size()];
+ certStream.putSequence(certList.toArray(dvals));
+ basicORItemStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ true, (byte)0), certStream);
+ } catch (CertificateEncodingException cex) {
+ err(cex);
+ throw new IOException(cex);
+ }
+
+ // Commit the outermost sequence bytes
+ outerSeq.write(DerValue.tag_Sequence, basicORItemStream);
+ return outerSeq.toByteArray();
+ }
+
+ private byte[] encodeTbsResponse() throws IOException {
+ DerOutputStream outerSeq = new DerOutputStream();
+ DerOutputStream tbsStream = new DerOutputStream();
+
+ // Note: We're not going explicitly assert the version
+ tbsStream.write(respId.getEncoded());
+ tbsStream.putGeneralizedTime(producedAtDate);
+
+ // Sequence of responses
+ encodeSingleResponses(tbsStream);
+
+ // TODO: add response extension support
+ encodeExtensions(tbsStream);
+
+ outerSeq.write(DerValue.tag_Sequence, tbsStream);
+ return outerSeq.toByteArray();
+ }
+
+ private void encodeSingleResponses(DerOutputStream tbsStream)
+ throws IOException {
+ DerValue[] srDerVals = new DerValue[singleResponseList.size()];
+ int srDvCtr = 0;
+
+ for (LocalSingleResponse lsr : singleResponseList) {
+ srDerVals[srDvCtr++] = new DerValue(lsr.getBytes());
+ }
+
+ tbsStream.putSequence(srDerVals);
+ }
+
+ private void encodeExtensions(DerOutputStream tbsStream)
+ throws IOException {
+ DerOutputStream extSequence = new DerOutputStream();
+ DerOutputStream extItems = new DerOutputStream();
+
+ for (Extension ext : responseExtensions.values()) {
+ ext.encode(extItems);
+ }
+ extSequence.write(DerValue.tag_Sequence, extItems);
+ tbsStream.write(DerValue.createTag(DerValue.TAG_CONTEXT, true,
+ (byte)1), extSequence);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append("OCSP Response: ").append(responseStatus).append("\n");
+ if (responseStatus == ResponseStatus.SUCCESSFUL) {
+ sb.append("Response Type: ").
+ append(OCSP_BASIC_RESPONSE_OID.toString()).append("\n");
+ sb.append(String.format("Version: %d (0x%X)", version + 1,
+ version)).append("\n");
+ sb.append("Responder Id: ").append(respId.toString()).
+ append("\n");
+ sb.append("Produced At: ").
+ append(utcDateFmt.format(producedAtDate)).append("\n");
+
+ int srCtr = 0;
+ for (LocalSingleResponse lsr : singleResponseList) {
+ sb.append("SingleResponse [").append(srCtr++).append("]\n");
+ sb.append(lsr);
+ }
+
+ if (!responseExtensions.isEmpty()) {
+ sb.append("Extensions (").append(responseExtensions.size()).
+ append(")\n");
+ for (Extension ext : responseExtensions.values()) {
+ sb.append("\t").append(ext).append("\n");
+ }
+ } else {
+ sb.append("\n");
+ }
+
+ if (signature != null) {
+ sb.append("Signature: ").append(sigAlgId).append("\n");
+ sb.append(dumpHexBytes(signature)).append("\n");
+ int certCtr = 0;
+ for (X509Certificate cert : certificates) {
+ sb.append("Certificate [").append(certCtr++).append("]").
+ append("\n");
+ sb.append("\tSubject: ");
+ sb.append(cert.getSubjectX500Principal()).append("\n");
+ sb.append("\tIssuer: ");
+ sb.append(cert.getIssuerX500Principal()).append("\n");
+ sb.append("\tSerial: ").append(cert.getSerialNumber());
+ sb.append("\n");
+ }
+ }
+ }
+
+ return sb.toString();
+ }
+
+ private class LocalSingleResponse {
+ private final CertId certId;
+ private final CertStatusInfo csInfo;
+ private final Date thisUpdate;
+ private final Date lsrNextUpdate;
+ private final Map<String, Extension> singleExtensions;
+
+ public LocalSingleResponse(CertId cid, CertStatusInfo info) {
+ certId = Objects.requireNonNull(cid, "CertId must be non-null");
+ csInfo = Objects.requireNonNull(info,
+ "CertStatusInfo must be non-null");
+
+ // For now, we'll keep things simple and make the thisUpdate
+ // field the same as the producedAt date.
+ thisUpdate = producedAtDate;
+ lsrNextUpdate = getNextUpdate();
+
+ // TODO Add extensions support
+ singleExtensions = Collections.emptyMap();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Certificate Status: ").append(csInfo.getType());
+ sb.append("\n");
+ if (csInfo.getType() == CertStatus.CERT_STATUS_REVOKED) {
+ sb.append("Revocation Time: ");
+ sb.append(utcDateFmt.format(csInfo.getRevocationTime()));
+ sb.append("\n");
+ if (csInfo.getRevocationReason() != null) {
+ sb.append("Revocation Reason: ");
+ sb.append(csInfo.getRevocationReason()).append("\n");
+ }
+ }
+
+ sb.append("CertId, Algorithm = ");
+ sb.append(certId.getHashAlgorithm()).append("\n");
+ sb.append("\tIssuer Name Hash: ");
+ sb.append(dumpHexBytes(certId.getIssuerNameHash(), 256, "", ""));
+ sb.append("\n");
+ sb.append("\tIssuer Key Hash: ");
+ sb.append(dumpHexBytes(certId.getIssuerKeyHash(), 256, "", ""));
+ sb.append("\n");
+ sb.append("\tSerial Number: ").append(certId.getSerialNumber());
+ sb.append("\n");
+ sb.append("This Update: ");
+ sb.append(utcDateFmt.format(thisUpdate)).append("\n");
+ if (lsrNextUpdate != null) {
+ sb.append("Next Update: ");
+ sb.append(utcDateFmt.format(lsrNextUpdate)).append("\n");
+ }
+
+ if (!singleExtensions.isEmpty()) {
+ sb.append("Extensions (").append(singleExtensions.size()).
+ append(")\n");
+ for (Extension ext : singleExtensions.values()) {
+ sb.append("\t").append(ext).append("\n");
+ }
+ }
+
+ return sb.toString();
+ }
+
+ public byte[] getBytes() throws IOException {
+ byte[] nullData = { };
+ DerOutputStream responseSeq = new DerOutputStream();
+ DerOutputStream srStream = new DerOutputStream();
+
+ // Encode the CertId
+ certId.encode(srStream);
+
+ // Next, encode the CertStatus field
+ CertStatus csiType = csInfo.getType();
+ switch (csiType) {
+ case CERT_STATUS_GOOD:
+ srStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ false, (byte)0), nullData);
+ break;
+ case CERT_STATUS_REVOKED:
+ DerOutputStream revInfo = new DerOutputStream();
+ revInfo.putGeneralizedTime(csInfo.getRevocationTime());
+ CRLReason revReason = csInfo.getRevocationReason();
+ if (revReason != null) {
+ byte[] revDer = new byte[3];
+ revDer[0] = DerValue.tag_Enumerated;
+ revDer[1] = 1;
+ revDer[2] = (byte)revReason.ordinal();
+ revInfo.write(DerValue.createTag(
+ DerValue.TAG_CONTEXT, true, (byte)0),
+ revDer);
+ }
+ srStream.write(DerValue.createTag(
+ DerValue.TAG_CONTEXT, true, (byte)1),
+ revInfo);
+ break;
+ case CERT_STATUS_UNKNOWN:
+ srStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ false, (byte)2), nullData);
+ break;
+ default:
+ throw new IOException("Unknown CertStatus: " + csiType);
+ }
+
+ // Add the necessary dates
+ srStream.putGeneralizedTime(thisUpdate);
+ if (lsrNextUpdate != null) {
+ DerOutputStream nuStream = new DerOutputStream();
+ nuStream.putGeneralizedTime(lsrNextUpdate);
+ srStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
+ true, (byte)0), nuStream);
+ }
+
+ // TODO add singleResponse Extension support
+
+ // Add the single response to the response output stream
+ responseSeq.write(DerValue.tag_Sequence, srStream);
+ return responseSeq.toByteArray();
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/Format/NumberFormat/Bug8132125.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, 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 8132125
+ * @summary Checks Swiss' number elements
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class Bug8132125 {
+ public static void main(String[] args) {
+ Locale deCH = new Locale("de", "CH");
+ NumberFormat nf = NumberFormat.getInstance(deCH);
+
+ String expected = "54'839'483.142"; // i.e. "." as decimal separator, "'" as grouping separator
+ String actual = nf.format(54839483.1415);
+ if (!actual.equals(expected)) {
+ throw new RuntimeException("correct for de_CH: " + expected + " vs. actual " + actual);
+ }
+ }
+}
--- a/jdk/test/java/time/tck/java/time/TCKInstant.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/time/tck/java/time/TCKInstant.java Wed Jul 05 20:44:51 2017 +0200
@@ -112,6 +112,8 @@
/**
* Test Instant.
+ *
+ * @bug 8133022
*/
@Test
public class TCKInstant extends AbstractDateTimeTest {
@@ -1928,6 +1930,16 @@
Instant.ofEpochSecond(Long.MIN_VALUE / 1000 - 1).toEpochMilli();
}
+ @Test(expectedExceptions=ArithmeticException.class)
+ public void test_toEpochMillis_overflow() {
+ Instant.ofEpochSecond(Long.MAX_VALUE / 1000, 809_000_000).toEpochMilli();
+ }
+
+ @Test(expectedExceptions=ArithmeticException.class)
+ public void test_toEpochMillis_overflow2() {
+ Instant.ofEpochSecond(-9223372036854776L, 1).toEpochMilli();
+ }
+
//-----------------------------------------------------------------------
// compareTo()
//-----------------------------------------------------------------------
--- a/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java Wed Jul 05 20:44:51 2017 +0200
@@ -146,7 +146,7 @@
{"Asia/Macau", "China Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"Asia/Taipei", "Taipei Standard Time", preferred, Locale.ENGLISH, TextStyle.FULL},
{"America/Chicago", "CST", none, Locale.ENGLISH, TextStyle.SHORT},
- {"Asia/Taipei", "TST", preferred, Locale.ENGLISH, TextStyle.SHORT},
+ {"Asia/Taipei", "CST", preferred, Locale.ENGLISH, TextStyle.SHORT},
{"Australia/South", "ACST", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
{"America/Chicago", "CDT", none, Locale.ENGLISH, TextStyle.SHORT},
{"Asia/Shanghai", "CDT", preferred_s, Locale.ENGLISH, TextStyle.SHORT},
--- a/jdk/test/java/util/Scanner/ScanTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/util/Scanner/ScanTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -26,6 +26,7 @@
* @bug 4313885 4926319 4927634 5032610 5032622 5049968 5059533 6223711 6277261 6269946 6288823
* @summary Basic tests of java.util.Scanner methods
* @key randomness
+ * @run main/othervm ScanTest
*/
import java.util.*;
--- a/jdk/test/java/util/TimeZone/CLDRDisplayNamesTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/util/TimeZone/CLDRDisplayNamesTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, 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
@@ -23,12 +23,13 @@
/*
* @test
- * @bug 8005471 8008577
+ * @bug 8005471 8008577 8129881 8130845
* @run main/othervm -Djava.locale.providers=CLDR CLDRDisplayNamesTest
* @summary Make sure that localized time zone names of CLDR are used
* if specified.
*/
+import java.text.*;
import java.util.*;
import static java.util.TimeZone.*;
@@ -72,6 +73,8 @@
};
public static void main(String[] args) {
+ // Make sure that localized time zone names of CLDR are used
+ // if specified.
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
int errors = 0;
for (String[] data : CLDR_DATA) {
@@ -87,6 +90,35 @@
}
}
}
+
+ // for 8129881
+ tz = TimeZone.getTimeZone("Europe/Vienna");
+ String name = tz.getDisplayName(false, SHORT);
+ if (!"CET".equals(name)) {
+ System.err.printf("error: got '%s' expected 'CET' %n", name);
+ errors++;
+ }
+
+ // for 8130845
+ SimpleDateFormat fmtROOT = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy", Locale.ROOT);
+ SimpleDateFormat fmtUS = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy", Locale.US);
+ SimpleDateFormat fmtUK = new SimpleDateFormat("EEE MMM d hh:mm:ss z yyyy", Locale.UK);
+ Locale originalLocale = Locale.getDefault();
+ try {
+ Locale.setDefault(Locale.ROOT);
+ fmtROOT.parse("Thu Nov 13 04:35:51 AKST 2008");
+ fmtUS.parse("Thu Nov 13 04:35:51 AKST 2008");
+ fmtUK.parse("Thu Nov 13 04:35:51 GMT-09:00 2008");
+ String dateString = new Date().toString();
+ System.out.println("Date: "+dateString);
+ System.out.println("Parsed Date: "+new Date(Date.parse(dateString)).toString());
+ } catch (ParseException pe) {
+ System.err.println(pe);
+ errors++;
+ } finally {
+ Locale.setDefault(originalLocale);
+ }
+
if (errors > 0) {
throw new RuntimeException("test failed");
}
--- a/jdk/test/java/util/logging/LoggingDeadlock2.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/java/util/logging/LoggingDeadlock2.java Wed Jul 05 20:44:51 2017 +0200
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6467152 6716076 6829503
+ * @bug 6467152 6716076 6829503 8132550
* @summary deadlock occurs in LogManager initialization and JVM termination
* @author Serguei Spitsyn / Hitachi / Martin Buchholz
*
--- a/jdk/test/javax/management/monitor/ReflectionExceptionTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/javax/management/monitor/ReflectionExceptionTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
* @summary Test that the jmx.monitor.error.runtime monitor notification
* is emitted when getAttribute throws ReflectionException.
* @author Luis-Miguel Alventosa
+ * @key intermittent
* @modules java.management
* @run clean ReflectionExceptionTest MBeanServerBuilderImpl
* MBeanServerForwarderInvocationHandler
--- a/jdk/test/javax/management/monitor/StringMonitorDeadlockTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/javax/management/monitor/StringMonitorDeadlockTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
* @summary Test that no locks are held when a monitor attribute is sampled
* or notif delivered.
* @author Eamonn McManus
+ * @key intermittent
* @modules java.management
* @run clean StringMonitorDeadlockTest
* @run build StringMonitorDeadlockTest
--- a/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/javax/management/mxbean/GenericArrayTypeTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -26,6 +26,7 @@
* @bug 6292705
* @summary Test support for arrays in parameterized types.
* @author Luis-Miguel Alventosa
+ * @key intermittent
* @modules java.management
* @run clean GenericArrayTypeTest
* @run build GenericArrayTypeTest
--- a/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/javax/management/remote/mandatory/connection/BrokenConnectionTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -26,6 +26,7 @@
* @bug 4940957 8025205
* @summary Tests behaviour when connections break
* @author Eamonn McManus
+ * @key intermittent
* @modules java.management
* @run clean BrokenConnectionTest
* @run build BrokenConnectionTest
--- a/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/javax/management/remote/mandatory/notif/NotificationEmissionTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,7 @@
* @summary Check the emission of notifications when a Security Manager is
* installed. Test the property "jmx.remote.x.check.notification.emission".
* @author Luis-Miguel Alventosa
+ * @key intermittent
* @modules java.management
* @run clean NotificationEmissionTest
* @run build NotificationEmissionTest
--- a/jdk/test/javax/net/ssl/DTLS/NoMacInitialClientHello.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/javax/net/ssl/DTLS/NoMacInitialClientHello.java Wed Jul 05 20:44:51 2017 +0200
@@ -29,7 +29,8 @@
* @bug 8043758
* @summary Datagram Transport Layer Security (DTLS)
* @compile DTLSOverDatagram.java
- * @run main/othervm NoMacInitialClientHello
+ * @run main/othervm -Djdk.tls.client.enableStatusRequestExtension=false
+ * NoMacInitialClientHello
*/
import java.net.DatagramPacket;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/net/ssl/Stapling/HttpsUrlConnClient.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,797 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS
+ * @library ../../../../java/security/testlibrary
+ * @build CertificateBuilder SimpleOCSPServer
+ * @run main/othervm HttpsUrlConnClient
+ */
+
+import java.io.*;
+import java.math.BigInteger;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.net.Socket;
+import java.net.URL;
+import java.net.HttpURLConnection;
+import java.net.InetAddress;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.PublicKey;
+import java.security.Security;
+import java.security.GeneralSecurityException;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorException.BasicReason;
+import java.security.cert.Certificate;
+import java.security.cert.PKIXBuilderParameters;
+import java.security.cert.X509CertSelector;
+import java.security.cert.X509Certificate;
+import java.security.cert.PKIXRevocationChecker;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+import sun.security.testlibrary.SimpleOCSPServer;
+import sun.security.testlibrary.CertificateBuilder;
+import sun.security.validator.ValidatorException;
+
+public class HttpsUrlConnClient {
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ static final byte[] LINESEP = { 10 };
+ static final Base64.Encoder B64E = Base64.getMimeEncoder(64, LINESEP);
+
+ // Turn on TLS debugging
+ static boolean debug = true;
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+ Thread clientThread = null;
+ Thread serverThread = null;
+
+ static String passwd = "passphrase";
+ static String ROOT_ALIAS = "root";
+ static String INT_ALIAS = "intermediate";
+ static String SSL_ALIAS = "ssl";
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ // PKI components we will need for this test
+ static KeyStore rootKeystore; // Root CA Keystore
+ static KeyStore intKeystore; // Intermediate CA Keystore
+ static KeyStore serverKeystore; // SSL Server Keystore
+ static KeyStore trustStore; // SSL Client trust store
+ static SimpleOCSPServer rootOcsp; // Root CA OCSP Responder
+ static int rootOcspPort; // Port number for root OCSP
+ static SimpleOCSPServer intOcsp; // Intermediate CA OCSP Responder
+ static int intOcspPort; // Port number for intermed. OCSP
+
+ private static final String SIMPLE_WEB_PAGE = "<HTML>\n" +
+ "<HEAD><Title>Web Page!</Title></HEAD>\n" +
+ "<BODY><H1>Web Page!</H1></BODY>\n</HTML>";
+ private static final SimpleDateFormat utcDateFmt =
+ new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z");
+ /*
+ * If the client or server is doing some kind of object creation
+ * that the other side depends on, and that thread prematurely
+ * exits, you may experience a hang. The test harness will
+ * terminate all hung threads after its timeout has expired,
+ * currently 3 minutes by default, but you might try to be
+ * smart about it....
+ */
+ public static void main(String[] args) throws Exception {
+ if (debug) {
+ System.setProperty("javax.net.debug", "ssl");
+ }
+
+ System.setProperty("javax.net.ssl.keyStore", "");
+ System.setProperty("javax.net.ssl.keyStorePassword", "");
+ System.setProperty("javax.net.ssl.trustStore", "");
+ System.setProperty("javax.net.ssl.trustStorePassword", "");
+
+ // Create the PKI we will use for the test and start the OCSP servers
+ createPKI();
+ utcDateFmt.setTimeZone(TimeZone.getTimeZone("GMT"));
+
+ testPKIXParametersRevEnabled();
+
+ // shut down the OCSP responders before finishing the test
+ intOcsp.stop();
+ rootOcsp.stop();
+ }
+
+ /**
+ * Do a basic connection using PKIXParameters with revocation checking
+ * enabled and client-side OCSP disabled. It will only pass if all
+ * stapled responses are present, valid and have a GOOD status.
+ */
+ static void testPKIXParametersRevEnabled() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ System.out.println("=====================================");
+ System.out.println("Stapling enabled, PKIXParameters with");
+ System.out.println("Revocation checking enabled ");
+ System.out.println("=====================================");
+
+ // Set the certificate entry in the intermediate OCSP responder
+ // with a revocation date of 8 hours ago.
+ X509Certificate sslCert =
+ (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ Map<BigInteger, SimpleOCSPServer.CertStatusInfo> revInfo =
+ new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_REVOKED,
+ new Date(System.currentTimeMillis() -
+ TimeUnit.HOURS.toMillis(8))));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Set up revocation checking on the client with no client-side
+ // OCSP fall-back
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ Security.setProperty("ocsp.enable", "false");
+
+ HttpsUrlConnClient sslTest = new HttpsUrlConnClient(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (!checkClientValidationFailure(tr.clientExc, BasicReason.REVOKED)) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else {
+ throw new RuntimeException(
+ "Expected client failure, but the client succeeded");
+ }
+ }
+
+ // In this case the server should also have thrown an exception
+ // because of the client alert
+ if (tr.serverExc instanceof SSLHandshakeException) {
+ if (!tr.serverExc.getMessage().contains(
+ "alert: bad_certificate_status_response")) {
+ throw tr.serverExc;
+ }
+ }
+
+ System.out.println(" PASS");
+ System.out.println("=====================================\n");
+ }
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide(ServerParameters servParams) throws Exception {
+
+ // Selectively enable or disable the feature
+ System.setProperty("jdk.tls.server.enableStatusRequestExtension",
+ Boolean.toString(servParams.enabled));
+
+ // Set all the other operating parameters
+ System.setProperty("jdk.tls.stapling.cacheSize",
+ Integer.toString(servParams.cacheSize));
+ System.setProperty("jdk.tls.stapling.cacheLifetime",
+ Integer.toString(servParams.cacheLifetime));
+ System.setProperty("jdk.tls.stapling.responseTimeout",
+ Integer.toString(servParams.respTimeout));
+ System.setProperty("jdk.tls.stapling.responderURI", servParams.respUri);
+ System.setProperty("jdk.tls.stapling.responderOverride",
+ Boolean.toString(servParams.respOverride));
+ System.setProperty("jdk.tls.stapling.ignoreExtensions",
+ Boolean.toString(servParams.ignoreExts));
+
+ // Set keystores and trust stores for the server
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(serverKeystore, passwd.toCharArray());
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+ tmf.init(trustStore);
+
+ SSLContext sslc = SSLContext.getInstance("TLS");
+ sslc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+ SSLServerSocketFactory sslssf = sslc.getServerSocketFactory();
+ SSLServerSocket sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+
+ serverPort = sslServerSocket.getLocalPort();
+ log("Server Port is " + serverPort);
+
+ // Dump the private key in PKCS8 format, not encrypted. This
+ // key dump can be used if the traffic was captured using tcpdump
+ // or wireshark to look into the encrypted packets for debug purposes.
+ if (debug) {
+ byte[] keybytes = serverKeystore.getKey(SSL_ALIAS,
+ passwd.toCharArray()).getEncoded();
+ PKCS8EncodedKeySpec p8spec = new PKCS8EncodedKeySpec(keybytes);
+ StringBuilder keyPem = new StringBuilder();
+ keyPem.append("-----BEGIN PRIVATE KEY-----\n");
+ keyPem.append(B64E.encodeToString(p8spec.getEncoded())).append("\n");
+ keyPem.append("-----END PRIVATE KEY-----\n");
+ log("Private key is:\n" + keyPem.toString());
+ }
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ try (SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(sslSocket.getInputStream()));
+ OutputStream out = sslSocket.getOutputStream()) {
+ StringBuilder hdrBldr = new StringBuilder();
+ String line;
+ while ((line = in.readLine()) != null && !line.isEmpty()) {
+ hdrBldr.append(line).append("\n");
+ }
+ String headerText = hdrBldr.toString();
+ log("Header Received: " + headerText.length() + " bytes\n" +
+ headerText);
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("HTTP/1.0 200 OK\r\n");
+ sb.append("Date: ").append(utcDateFmt.format(new Date())).
+ append("\r\n");
+ sb.append("Content-Type: text/html\r\n");
+ sb.append("Content-Length: ").append(SIMPLE_WEB_PAGE.length());
+ sb.append("\r\n\r\n");
+ out.write(sb.toString().getBytes("UTF-8"));
+ out.write(SIMPLE_WEB_PAGE.getBytes("UTF-8"));
+ out.flush();
+ log("Server replied with:\n" + sb.toString() + SIMPLE_WEB_PAGE);
+ }
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide(ClientParameters cliParams) throws Exception {
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ // Selectively enable or disable the feature
+ System.setProperty("jdk.tls.client.enableStatusRequestExtension",
+ Boolean.toString(cliParams.enabled));
+
+ HtucSSLSocketFactory sockFac = new HtucSSLSocketFactory(cliParams);
+ HttpsURLConnection.setDefaultSSLSocketFactory(sockFac);
+ URL location = new URL("https://localhost:" + serverPort);
+ HttpsURLConnection tlsConn =
+ (HttpsURLConnection)location.openConnection();
+ tlsConn.setConnectTimeout(5000);
+ tlsConn.setReadTimeout(5000);
+ tlsConn.setDoInput(true);
+
+ try (InputStream in = tlsConn.getInputStream()) {
+ // Check the response
+ if (debug && tlsConn.getResponseCode() !=
+ HttpURLConnection.HTTP_OK) {
+ log("Received HTTP error: " + tlsConn.getResponseCode() +
+ " - " + tlsConn.getResponseMessage());
+ throw new IOException("HTTP error: " +
+ tlsConn.getResponseCode());
+ }
+
+ int contentLength = tlsConn.getContentLength();
+ if (contentLength == -1) {
+ contentLength = Integer.MAX_VALUE;
+ }
+ byte[] response = new byte[contentLength > 2048 ? 2048 : contentLength];
+ int total = 0;
+ while (total < contentLength) {
+ int count = in.read(response, total, response.length - total);
+ if (count < 0)
+ break;
+
+ total += count;
+ log("Read " + count + " bytes (" + total + " total)");
+ if (total >= response.length && total < contentLength) {
+ response = Arrays.copyOf(response, total * 2);
+ }
+ }
+ response = Arrays.copyOf(response, total);
+ String webPage = new String(response, 0, total);
+ if (debug) {
+ log("Web page:\n" + webPage);
+ }
+ }
+ }
+
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ HttpsUrlConnClient(ClientParameters cliParams,
+ ServerParameters servParams) throws Exception {
+ Exception startException = null;
+ try {
+ if (separateServerThread) {
+ startServer(servParams, true);
+ startClient(cliParams, false);
+ } else {
+ startClient(cliParams, true);
+ startServer(servParams, false);
+ }
+ } catch (Exception e) {
+ startException = e;
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ if (serverThread != null) {
+ serverThread.join();
+ }
+ } else {
+ if (clientThread != null) {
+ clientThread.join();
+ }
+ }
+ }
+
+ /**
+ * Checks a validation failure to see if it failed for the reason we think
+ * it should. This comes in as an SSLException of some sort, but it
+ * encapsulates a ValidatorException which in turn encapsulates the
+ * CertPathValidatorException we are interested in.
+ *
+ * @param e the exception thrown at the top level
+ * @param reason the underlying CertPathValidatorException BasicReason
+ * we are expecting it to have.
+ *
+ * @return true if the reason matches up, false otherwise.
+ */
+ static boolean checkClientValidationFailure(Exception e,
+ BasicReason reason) {
+ boolean result = false;
+
+ if (e instanceof SSLException) {
+ Throwable valExc = e.getCause();
+ if (valExc instanceof sun.security.validator.ValidatorException) {
+ Throwable cause = valExc.getCause();
+ if (cause instanceof CertPathValidatorException) {
+ CertPathValidatorException cpve =
+ (CertPathValidatorException)cause;
+ if (cpve.getReason() == reason) {
+ result = true;
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ TestResult getResult() {
+ TestResult tr = new TestResult();
+ tr.clientExc = clientException;
+ tr.serverExc = serverException;
+ return tr;
+ }
+
+ final void startServer(ServerParameters servParams, boolean newThread)
+ throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ doServerSide(servParams);
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ try {
+ doServerSide(servParams);
+ } catch (Exception e) {
+ serverException = e;
+ } finally {
+ serverReady = true;
+ }
+ }
+ }
+
+ final void startClient(ClientParameters cliParams, boolean newThread)
+ throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ @Override
+ public void run() {
+ try {
+ doClientSide(cliParams);
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ try {
+ doClientSide(cliParams);
+ } catch (Exception e) {
+ clientException = e;
+ }
+ }
+ }
+
+ /**
+ * Creates the PKI components necessary for this test, including
+ * Root CA, Intermediate CA and SSL server certificates, the keystores
+ * for each entity, a client trust store, and starts the OCSP responders.
+ */
+ private static void createPKI() throws Exception {
+ CertificateBuilder cbld = new CertificateBuilder();
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ keyGen.initialize(2048);
+ KeyStore.Builder keyStoreBuilder =
+ KeyStore.Builder.newInstance("PKCS12", null,
+ new KeyStore.PasswordProtection(passwd.toCharArray()));
+
+ // Generate Root, IntCA, EE keys
+ KeyPair rootCaKP = keyGen.genKeyPair();
+ log("Generated Root CA KeyPair");
+ KeyPair intCaKP = keyGen.genKeyPair();
+ log("Generated Intermediate CA KeyPair");
+ KeyPair sslKP = keyGen.genKeyPair();
+ log("Generated SSL Cert KeyPair");
+
+ // Set up the Root CA Cert
+ cbld.setSubjectName("CN=Root CA Cert, O=SomeCompany");
+ cbld.setPublicKey(rootCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("1"));
+ // Make a 3 year validity starting from 60 days ago
+ long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60);
+ long end = start + TimeUnit.DAYS.toMillis(1085);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ // Make our Root CA Cert!
+ X509Certificate rootCert = cbld.build(null, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Root CA Created:\n" + certInfo(rootCert));
+
+ // Now build a keystore and add the keys and cert
+ rootKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] rootChain = {rootCert};
+ rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
+ passwd.toCharArray(), rootChain);
+
+ // Now fire up the OCSP responder
+ rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
+ rootOcsp.enableLog(debug);
+ rootOcsp.setNextUpdateInterval(3600);
+ rootOcsp.start();
+ Thread.sleep(1000); // Give the server a second to start up
+ rootOcspPort = rootOcsp.getPort();
+ String rootRespURI = "http://localhost:" + rootOcspPort;
+ log("Root OCSP Responder URI is " + rootRespURI);
+
+ // Now that we have the root keystore and OCSP responder we can
+ // create our intermediate CA.
+ cbld.reset();
+ cbld.setSubjectName("CN=Intermediate CA Cert, O=SomeCompany");
+ cbld.setPublicKey(intCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("100"));
+ // Make a 2 year validity starting from 30 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);
+ end = start + TimeUnit.DAYS.toMillis(730);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, intCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ cbld.addAIAExt(Collections.singletonList(rootRespURI));
+ // Make our Intermediate CA Cert!
+ X509Certificate intCaCert = cbld.build(rootCert, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Intermediate CA Created:\n" + certInfo(intCaCert));
+
+ // Provide intermediate CA cert revocation info to the Root CA
+ // OCSP responder.
+ Map<BigInteger, SimpleOCSPServer.CertStatusInfo> revInfo =
+ new HashMap<>();
+ revInfo.put(intCaCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ rootOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ intKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] intChain = {intCaCert, rootCert};
+ intKeystore.setKeyEntry(INT_ALIAS, intCaKP.getPrivate(),
+ passwd.toCharArray(), intChain);
+ intKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // Now fire up the Intermediate CA OCSP responder
+ intOcsp = new SimpleOCSPServer(intKeystore, passwd,
+ INT_ALIAS, null);
+ intOcsp.enableLog(debug);
+ intOcsp.setNextUpdateInterval(3600);
+ intOcsp.start();
+ Thread.sleep(1000);
+ intOcspPort = intOcsp.getPort();
+ String intCaRespURI = "http://localhost:" + intOcspPort;
+ log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
+
+ // Last but not least, let's make our SSLCert and add it to its own
+ // Keystore
+ cbld.reset();
+ cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
+ cbld.setPublicKey(sslKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("4096"));
+ // Make a 1 year validity starting from 7 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
+ end = start + TimeUnit.DAYS.toMillis(365);
+ cbld.setValidity(new Date(start), new Date(end));
+
+ // Add extensions
+ addCommonExts(cbld, sslKP.getPublic(), intCaKP.getPublic());
+ boolean[] kuBits = {true, false, true, false, false, false,
+ false, false, false};
+ cbld.addKeyUsageExt(kuBits);
+ List<String> ekuOids = new ArrayList<>();
+ ekuOids.add("1.3.6.1.5.5.7.3.1");
+ ekuOids.add("1.3.6.1.5.5.7.3.2");
+ cbld.addExtendedKeyUsageExt(ekuOids);
+ cbld.addSubjectAltNameDNSExt(Collections.singletonList("localhost"));
+ cbld.addAIAExt(Collections.singletonList(intCaRespURI));
+ // Make our SSL Server Cert!
+ X509Certificate sslCert = cbld.build(intCaCert, intCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("SSL Certificate Created:\n" + certInfo(sslCert));
+
+ // Provide SSL server cert revocation info to the Intermeidate CA
+ // OCSP responder.
+ revInfo = new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ serverKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] sslChain = {sslCert, intCaCert, rootCert};
+ serverKeystore.setKeyEntry(SSL_ALIAS, sslKP.getPrivate(),
+ passwd.toCharArray(), sslChain);
+ serverKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // And finally a Trust Store for the client
+ trustStore = keyStoreBuilder.getKeyStore();
+ trustStore.setCertificateEntry(ROOT_ALIAS, rootCert);
+ }
+
+ private static void addCommonExts(CertificateBuilder cbld,
+ PublicKey subjKey, PublicKey authKey) throws IOException {
+ cbld.addSubjectKeyIdExt(subjKey);
+ cbld.addAuthorityKeyIdExt(authKey);
+ }
+
+ private static void addCommonCAExts(CertificateBuilder cbld)
+ throws IOException {
+ cbld.addBasicConstraintsExt(true, true, -1);
+ // Set key usage bits for digitalSignature, keyCertSign and cRLSign
+ boolean[] kuBitSettings = {true, false, false, false, false, true,
+ true, false, false};
+ cbld.addKeyUsageExt(kuBitSettings);
+ }
+
+ /**
+ * Helper routine that dumps only a few cert fields rather than
+ * the whole toString() output.
+ *
+ * @param cert an X509Certificate to be displayed
+ *
+ * @return the String output of the issuer, subject and
+ * serial number
+ */
+ private static String certInfo(X509Certificate cert) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Issuer: ").append(cert.getIssuerX500Principal()).
+ append("\n");
+ sb.append("Subject: ").append(cert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("Serial: ").append(cert.getSerialNumber()).append("\n");
+ return sb.toString();
+ }
+
+ /**
+ * Log a message on stdout
+ *
+ * @param message The message to log
+ */
+ private static void log(String message) {
+ if (debug) {
+ System.out.println(message);
+ }
+ }
+
+ // The following two classes are Simple nested class to group a handful
+ // of configuration parameters used before starting a client or server.
+ // We'll just access the data members directly for convenience.
+ static class ClientParameters {
+ boolean enabled = true;
+ PKIXBuilderParameters pkixParams = null;
+ PKIXRevocationChecker revChecker = null;
+
+ ClientParameters() { }
+ }
+
+ static class ServerParameters {
+ boolean enabled = true;
+ int cacheSize = 256;
+ int cacheLifetime = 3600;
+ int respTimeout = 5000;
+ String respUri = "";
+ boolean respOverride = false;
+ boolean ignoreExts = false;
+
+ ServerParameters() { }
+ }
+
+ static class TestResult {
+ Exception serverExc = null;
+ Exception clientExc = null;
+ }
+
+ static class HtucSSLSocketFactory extends SSLSocketFactory {
+ SSLContext sslc = SSLContext.getInstance("TLS");
+
+ HtucSSLSocketFactory(ClientParameters cliParams)
+ throws GeneralSecurityException {
+ super();
+
+ // Create the Trust Manager Factory using the PKIX variant
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+
+ // If we have a customized pkixParameters then use it
+ if (cliParams.pkixParams != null) {
+ // LIf we have a customized PKIXRevocationChecker, add
+ // it to the PKIXBuilderParameters.
+ if (cliParams.revChecker != null) {
+ cliParams.pkixParams.addCertPathChecker(
+ cliParams.revChecker);
+ }
+
+ ManagerFactoryParameters trustParams =
+ new CertPathTrustManagerParameters(
+ cliParams.pkixParams);
+ tmf.init(trustParams);
+ } else {
+ tmf.init(trustStore);
+ }
+
+ sslc.init(null, tmf.getTrustManagers(), null);
+ }
+
+ @Override
+ public Socket createSocket(Socket s, String host, int port,
+ boolean autoClose) throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(s, host, port,
+ autoClose);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public Socket createSocket(InetAddress host, int port)
+ throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(host, port);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public Socket createSocket(InetAddress host, int port,
+ InetAddress localAddress, int localPort) throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(host, port,
+ localAddress, localPort);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public Socket createSocket(String host, int port)
+ throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(host, port);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public Socket createSocket(String host, int port,
+ InetAddress localAddress, int localPort)
+ throws IOException {
+ Socket sock = sslc.getSocketFactory().createSocket(host, port,
+ localAddress, localPort);
+ setCiphers(sock);
+ return sock;
+ }
+
+ @Override
+ public String[] getDefaultCipherSuites() {
+ return sslc.getDefaultSSLParameters().getCipherSuites();
+ }
+
+ @Override
+ public String[] getSupportedCipherSuites() {
+ return sslc.getSupportedSSLParameters().getCipherSuites();
+ }
+
+ private static void setCiphers(Socket sock) {
+ if (sock instanceof SSLSocket) {
+ String[] ciphers = { "TLS_RSA_WITH_AES_128_CBC_SHA" };
+ ((SSLSocket)sock).setEnabledCipherSuites(ciphers);
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/net/ssl/Stapling/SSLEngineWithStapling.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,655 @@
+/*
+ * Copyright (c) 2003, 2013, 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS
+ * @library ../../../../java/security/testlibrary
+ * @build CertificateBuilder SimpleOCSPServer
+ * @run main/othervm SSLEngineWithStapling
+ */
+
+/**
+ * A SSLEngine usage example which simplifies the presentation
+ * by removing the I/O and multi-threading concerns.
+ *
+ * The test creates two SSLEngines, simulating a client and server.
+ * The "transport" layer consists two byte buffers: think of them
+ * as directly connected pipes.
+ *
+ * Note, this is a *very* simple example: real code will be much more
+ * involved. For example, different threading and I/O models could be
+ * used, transport mechanisms could close unexpectedly, and so on.
+ *
+ * When this application runs, notice that several messages
+ * (wrap/unwrap) pass before any application data is consumed or
+ * produced. (For more information, please see the SSL/TLS
+ * specifications.) There may several steps for a successful handshake,
+ * so it's typical to see the following series of operations:
+ *
+ * client server message
+ * ====== ====== =======
+ * wrap() ... ClientHello
+ * ... unwrap() ClientHello
+ * ... wrap() ServerHello/Certificate
+ * unwrap() ... ServerHello/Certificate
+ * wrap() ... ClientKeyExchange
+ * wrap() ... ChangeCipherSpec
+ * wrap() ... Finished
+ * ... unwrap() ClientKeyExchange
+ * ... unwrap() ChangeCipherSpec
+ * ... unwrap() Finished
+ * ... wrap() ChangeCipherSpec
+ * ... wrap() Finished
+ * unwrap() ... ChangeCipherSpec
+ * unwrap() ... Finished
+ */
+
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+import java.io.*;
+import java.math.BigInteger;
+import java.security.*;
+import java.nio.*;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.PKIXBuilderParameters;
+import java.security.cert.X509Certificate;
+import java.security.cert.X509CertSelector;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import sun.security.testlibrary.SimpleOCSPServer;
+import sun.security.testlibrary.CertificateBuilder;
+
+public class SSLEngineWithStapling {
+
+ /*
+ * Enables logging of the SSLEngine operations.
+ */
+ private static final boolean logging = true;
+
+ /*
+ * Enables the JSSE system debugging system property:
+ *
+ * -Djavax.net.debug=all
+ *
+ * This gives a lot of low-level information about operations underway,
+ * including specific handshake messages, and might be best examined
+ * after gaining some familiarity with this application.
+ */
+ private static final boolean debug = false;
+
+ private SSLEngine clientEngine; // client Engine
+ private ByteBuffer clientOut; // write side of clientEngine
+ private ByteBuffer clientIn; // read side of clientEngine
+
+ private SSLEngine serverEngine; // server Engine
+ private ByteBuffer serverOut; // write side of serverEngine
+ private ByteBuffer serverIn; // read side of serverEngine
+
+ /*
+ * For data transport, this example uses local ByteBuffers. This
+ * isn't really useful, but the purpose of this example is to show
+ * SSLEngine concepts, not how to do network transport.
+ */
+ private ByteBuffer cTOs; // "reliable" transport client->server
+ private ByteBuffer sTOc; // "reliable" transport server->client
+
+ /*
+ * The following is to set up the keystores.
+ */
+ static final String passwd = "passphrase";
+ static final String ROOT_ALIAS = "root";
+ static final String INT_ALIAS = "intermediate";
+ static final String SSL_ALIAS = "ssl";
+
+ // PKI components we will need for this test
+ static KeyStore rootKeystore; // Root CA Keystore
+ static KeyStore intKeystore; // Intermediate CA Keystore
+ static KeyStore serverKeystore; // SSL Server Keystore
+ static KeyStore trustStore; // SSL Client trust store
+ static SimpleOCSPServer rootOcsp; // Root CA OCSP Responder
+ static int rootOcspPort; // Port number for root OCSP
+ static SimpleOCSPServer intOcsp; // Intermediate CA OCSP Responder
+ static int intOcspPort; // Port number for intermed. OCSP
+
+ /*
+ * Main entry point for this test.
+ */
+ public static void main(String args[]) throws Exception {
+ if (debug) {
+ System.setProperty("javax.net.debug", "ssl");
+ }
+
+ // Create the PKI we will use for the test and start the OCSP servers
+ createPKI();
+
+ // Set the certificate entry in the intermediate OCSP responder
+ // with a revocation date of 8 hours ago.
+ X509Certificate sslCert =
+ (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ Map<BigInteger, SimpleOCSPServer.CertStatusInfo> revInfo =
+ new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_REVOKED,
+ new Date(System.currentTimeMillis() -
+ TimeUnit.HOURS.toMillis(8))));
+ intOcsp.updateStatusDb(revInfo);
+
+ SSLEngineWithStapling test = new SSLEngineWithStapling();
+ try {
+ test.runTest();
+ throw new RuntimeException("Expected failure due to revocation " +
+ "did not occur");
+ } catch (Exception e) {
+ if (!checkClientValidationFailure(e,
+ CertPathValidatorException.BasicReason.REVOKED)) {
+ System.out.println("*** Didn't find the exception we wanted");
+ throw e;
+ }
+ }
+
+ System.out.println("Test Passed.");
+ }
+
+ /*
+ * Create an initialized SSLContext to use for these tests.
+ */
+ public SSLEngineWithStapling() throws Exception {
+ System.setProperty("javax.net.ssl.keyStore", "");
+ System.setProperty("javax.net.ssl.keyStorePassword", "");
+ System.setProperty("javax.net.ssl.trustStore", "");
+ System.setProperty("javax.net.ssl.trustStorePassword", "");
+
+ // Enable OCSP Stapling on both client and server sides, but turn off
+ // client-side OCSP for revocation checking. This ensures that the
+ // revocation information from the test has to come via stapling.
+ System.setProperty("jdk.tls.client.enableStatusRequestExtension",
+ Boolean.toString(true));
+ System.setProperty("jdk.tls.server.enableStatusRequestExtension",
+ Boolean.toString(true));
+ Security.setProperty("ocsp.enable", "false");
+ }
+
+ /*
+ * Run the test.
+ *
+ * Sit in a tight loop, both engines calling wrap/unwrap regardless
+ * of whether data is available or not. We do this until both engines
+ * report back they are closed.
+ *
+ * The main loop handles all of the I/O phases of the SSLEngine's
+ * lifetime:
+ *
+ * initial handshaking
+ * application data transfer
+ * engine closing
+ *
+ * One could easily separate these phases into separate
+ * sections of code.
+ */
+ private void runTest() throws Exception {
+ boolean dataDone = false;
+
+ createSSLEngines();
+ createBuffers();
+
+ SSLEngineResult clientResult; // results from client's last operation
+ SSLEngineResult serverResult; // results from server's last operation
+
+ /*
+ * Examining the SSLEngineResults could be much more involved,
+ * and may alter the overall flow of the application.
+ *
+ * For example, if we received a BUFFER_OVERFLOW when trying
+ * to write to the output pipe, we could reallocate a larger
+ * pipe, but instead we wait for the peer to drain it.
+ */
+ while (!isEngineClosed(clientEngine) ||
+ !isEngineClosed(serverEngine)) {
+
+ log("================");
+
+ clientResult = clientEngine.wrap(clientOut, cTOs);
+ log("client wrap: ", clientResult);
+ runDelegatedTasks(clientResult, clientEngine);
+
+ serverResult = serverEngine.wrap(serverOut, sTOc);
+ log("server wrap: ", serverResult);
+ runDelegatedTasks(serverResult, serverEngine);
+
+ cTOs.flip();
+ sTOc.flip();
+
+ log("----");
+
+ clientResult = clientEngine.unwrap(sTOc, clientIn);
+ log("client unwrap: ", clientResult);
+ runDelegatedTasks(clientResult, clientEngine);
+
+ serverResult = serverEngine.unwrap(cTOs, serverIn);
+ log("server unwrap: ", serverResult);
+ runDelegatedTasks(serverResult, serverEngine);
+
+ cTOs.compact();
+ sTOc.compact();
+
+ /*
+ * After we've transfered all application data between the client
+ * and server, we close the clientEngine's outbound stream.
+ * This generates a close_notify handshake message, which the
+ * server engine receives and responds by closing itself.
+ */
+ if (!dataDone && (clientOut.limit() == serverIn.position()) &&
+ (serverOut.limit() == clientIn.position())) {
+
+ /*
+ * A sanity check to ensure we got what was sent.
+ */
+ checkTransfer(serverOut, clientIn);
+ checkTransfer(clientOut, serverIn);
+
+ log("\tClosing clientEngine's *OUTBOUND*...");
+ clientEngine.closeOutbound();
+ dataDone = true;
+ }
+ }
+ }
+
+ /*
+ * Using the SSLContext created during object creation,
+ * create/configure the SSLEngines we'll use for this test.
+ */
+ private void createSSLEngines() throws Exception {
+ // Initialize the KeyManager and TrustManager for the server
+ KeyManagerFactory servKmf = KeyManagerFactory.getInstance("PKIX");
+ servKmf.init(serverKeystore, passwd.toCharArray());
+ TrustManagerFactory servTmf =
+ TrustManagerFactory.getInstance("PKIX");
+ servTmf.init(trustStore);
+
+ // Initialize the TrustManager for the client with revocation checking
+ PKIXBuilderParameters pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ pkixParams.setRevocationEnabled(true);
+ ManagerFactoryParameters mfp =
+ new CertPathTrustManagerParameters(pkixParams);
+ TrustManagerFactory cliTmf =
+ TrustManagerFactory.getInstance("PKIX");
+ cliTmf.init(mfp);
+
+ // Create the SSLContexts from the factories
+ SSLContext servCtx = SSLContext.getInstance("TLS");
+ servCtx.init(servKmf.getKeyManagers(), servTmf.getTrustManagers(),
+ null);
+ SSLContext cliCtx = SSLContext.getInstance("TLS");
+ cliCtx.init(null, cliTmf.getTrustManagers(), null);
+
+
+ /*
+ * Configure the serverEngine to act as a server in the SSL/TLS
+ * handshake.
+ */
+ serverEngine = servCtx.createSSLEngine();
+ serverEngine.setUseClientMode(false);
+ serverEngine.setNeedClientAuth(false);
+
+ /*
+ * Similar to above, but using client mode instead.
+ */
+ clientEngine = cliCtx.createSSLEngine("client", 80);
+ clientEngine.setUseClientMode(true);
+ }
+
+ /*
+ * Create and size the buffers appropriately.
+ */
+ private void createBuffers() {
+
+ /*
+ * We'll assume the buffer sizes are the same
+ * between client and server.
+ */
+ SSLSession session = clientEngine.getSession();
+ int appBufferMax = session.getApplicationBufferSize();
+ int netBufferMax = session.getPacketBufferSize();
+
+ /*
+ * We'll make the input buffers a bit bigger than the max needed
+ * size, so that unwrap()s following a successful data transfer
+ * won't generate BUFFER_OVERFLOWS.
+ *
+ * We'll use a mix of direct and indirect ByteBuffers for
+ * tutorial purposes only. In reality, only use direct
+ * ByteBuffers when they give a clear performance enhancement.
+ */
+ clientIn = ByteBuffer.allocate(appBufferMax + 50);
+ serverIn = ByteBuffer.allocate(appBufferMax + 50);
+
+ cTOs = ByteBuffer.allocateDirect(netBufferMax);
+ sTOc = ByteBuffer.allocateDirect(netBufferMax);
+
+ clientOut = ByteBuffer.wrap("Hi Server, I'm Client".getBytes());
+ serverOut = ByteBuffer.wrap("Hello Client, I'm Server".getBytes());
+ }
+
+ /*
+ * If the result indicates that we have outstanding tasks to do,
+ * go ahead and run them in this thread.
+ */
+ private static void runDelegatedTasks(SSLEngineResult result,
+ SSLEngine engine) throws Exception {
+
+ if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+ Runnable runnable;
+ while ((runnable = engine.getDelegatedTask()) != null) {
+ log("\trunning delegated task...");
+ runnable.run();
+ }
+ HandshakeStatus hsStatus = engine.getHandshakeStatus();
+ if (hsStatus == HandshakeStatus.NEED_TASK) {
+ throw new Exception(
+ "handshake shouldn't need additional tasks");
+ }
+ log("\tnew HandshakeStatus: " + hsStatus);
+ }
+ }
+
+ private static boolean isEngineClosed(SSLEngine engine) {
+ return (engine.isOutboundDone() && engine.isInboundDone());
+ }
+
+ /*
+ * Simple check to make sure everything came across as expected.
+ */
+ private static void checkTransfer(ByteBuffer a, ByteBuffer b)
+ throws Exception {
+ a.flip();
+ b.flip();
+
+ if (!a.equals(b)) {
+ throw new Exception("Data didn't transfer cleanly");
+ } else {
+ log("\tData transferred cleanly");
+ }
+
+ a.position(a.limit());
+ b.position(b.limit());
+ a.limit(a.capacity());
+ b.limit(b.capacity());
+ }
+
+ /*
+ * Logging code
+ */
+ private static boolean resultOnce = true;
+
+ private static void log(String str, SSLEngineResult result) {
+ if (!logging) {
+ return;
+ }
+ if (resultOnce) {
+ resultOnce = false;
+ System.out.println("The format of the SSLEngineResult is: \n" +
+ "\t\"getStatus() / getHandshakeStatus()\" +\n" +
+ "\t\"bytesConsumed() / bytesProduced()\"\n");
+ }
+ HandshakeStatus hsStatus = result.getHandshakeStatus();
+ log(str +
+ result.getStatus() + "/" + hsStatus + ", " +
+ result.bytesConsumed() + "/" + result.bytesProduced() +
+ " bytes");
+ if (hsStatus == HandshakeStatus.FINISHED) {
+ log("\t...ready for application data");
+ }
+ }
+
+ private static void log(String str) {
+ if (logging) {
+ System.out.println(str);
+ }
+ }
+
+ /**
+ * Creates the PKI components necessary for this test, including
+ * Root CA, Intermediate CA and SSL server certificates, the keystores
+ * for each entity, a client trust store, and starts the OCSP responders.
+ */
+ private static void createPKI() throws Exception {
+ CertificateBuilder cbld = new CertificateBuilder();
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ keyGen.initialize(2048);
+ KeyStore.Builder keyStoreBuilder =
+ KeyStore.Builder.newInstance("PKCS12", null,
+ new KeyStore.PasswordProtection(passwd.toCharArray()));
+
+ // Generate Root, IntCA, EE keys
+ KeyPair rootCaKP = keyGen.genKeyPair();
+ log("Generated Root CA KeyPair");
+ KeyPair intCaKP = keyGen.genKeyPair();
+ log("Generated Intermediate CA KeyPair");
+ KeyPair sslKP = keyGen.genKeyPair();
+ log("Generated SSL Cert KeyPair");
+
+ // Set up the Root CA Cert
+ cbld.setSubjectName("CN=Root CA Cert, O=SomeCompany");
+ cbld.setPublicKey(rootCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("1"));
+ // Make a 3 year validity starting from 60 days ago
+ long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60);
+ long end = start + TimeUnit.DAYS.toMillis(1085);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ // Make our Root CA Cert!
+ X509Certificate rootCert = cbld.build(null, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Root CA Created:\n" + certInfo(rootCert));
+
+ // Now build a keystore and add the keys and cert
+ rootKeystore = keyStoreBuilder.getKeyStore();
+ java.security.cert.Certificate[] rootChain = {rootCert};
+ rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
+ passwd.toCharArray(), rootChain);
+
+ // Now fire up the OCSP responder
+ rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
+ rootOcsp.enableLog(logging);
+ rootOcsp.setNextUpdateInterval(3600);
+ rootOcsp.start();
+ Thread.sleep(1000); // Give the server a second to start up
+ rootOcspPort = rootOcsp.getPort();
+ String rootRespURI = "http://localhost:" + rootOcspPort;
+ log("Root OCSP Responder URI is " + rootRespURI);
+
+ // Now that we have the root keystore and OCSP responder we can
+ // create our intermediate CA.
+ cbld.reset();
+ cbld.setSubjectName("CN=Intermediate CA Cert, O=SomeCompany");
+ cbld.setPublicKey(intCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("100"));
+ // Make a 2 year validity starting from 30 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);
+ end = start + TimeUnit.DAYS.toMillis(730);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, intCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ cbld.addAIAExt(Collections.singletonList(rootRespURI));
+ // Make our Intermediate CA Cert!
+ X509Certificate intCaCert = cbld.build(rootCert, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Intermediate CA Created:\n" + certInfo(intCaCert));
+
+ // Provide intermediate CA cert revocation info to the Root CA
+ // OCSP responder.
+ Map<BigInteger, SimpleOCSPServer.CertStatusInfo> revInfo =
+ new HashMap<>();
+ revInfo.put(intCaCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ rootOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ intKeystore = keyStoreBuilder.getKeyStore();
+ java.security.cert.Certificate[] intChain = {intCaCert, rootCert};
+ intKeystore.setKeyEntry(INT_ALIAS, intCaKP.getPrivate(),
+ passwd.toCharArray(), intChain);
+ intKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // Now fire up the Intermediate CA OCSP responder
+ intOcsp = new SimpleOCSPServer(intKeystore, passwd,
+ INT_ALIAS, null);
+ intOcsp.enableLog(logging);
+ intOcsp.setNextUpdateInterval(3600);
+ intOcsp.start();
+ Thread.sleep(1000);
+ intOcspPort = intOcsp.getPort();
+ String intCaRespURI = "http://localhost:" + intOcspPort;
+ log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
+
+ // Last but not least, let's make our SSLCert and add it to its own
+ // Keystore
+ cbld.reset();
+ cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
+ cbld.setPublicKey(sslKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("4096"));
+ // Make a 1 year validity starting from 7 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
+ end = start + TimeUnit.DAYS.toMillis(365);
+ cbld.setValidity(new Date(start), new Date(end));
+
+ // Add extensions
+ addCommonExts(cbld, sslKP.getPublic(), intCaKP.getPublic());
+ boolean[] kuBits = {true, false, true, false, false, false,
+ false, false, false};
+ cbld.addKeyUsageExt(kuBits);
+ List<String> ekuOids = new ArrayList<>();
+ ekuOids.add("1.3.6.1.5.5.7.3.1");
+ ekuOids.add("1.3.6.1.5.5.7.3.2");
+ cbld.addExtendedKeyUsageExt(ekuOids);
+ cbld.addSubjectAltNameDNSExt(Collections.singletonList("localhost"));
+ cbld.addAIAExt(Collections.singletonList(intCaRespURI));
+ // Make our SSL Server Cert!
+ X509Certificate sslCert = cbld.build(intCaCert, intCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("SSL Certificate Created:\n" + certInfo(sslCert));
+
+ // Provide SSL server cert revocation info to the Intermeidate CA
+ // OCSP responder.
+ revInfo = new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ serverKeystore = keyStoreBuilder.getKeyStore();
+ java.security.cert.Certificate[] sslChain = {sslCert, intCaCert, rootCert};
+ serverKeystore.setKeyEntry(SSL_ALIAS, sslKP.getPrivate(),
+ passwd.toCharArray(), sslChain);
+ serverKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // And finally a Trust Store for the client
+ trustStore = keyStoreBuilder.getKeyStore();
+ trustStore.setCertificateEntry(ROOT_ALIAS, rootCert);
+ }
+
+ private static void addCommonExts(CertificateBuilder cbld,
+ PublicKey subjKey, PublicKey authKey) throws IOException {
+ cbld.addSubjectKeyIdExt(subjKey);
+ cbld.addAuthorityKeyIdExt(authKey);
+ }
+
+ private static void addCommonCAExts(CertificateBuilder cbld)
+ throws IOException {
+ cbld.addBasicConstraintsExt(true, true, -1);
+ // Set key usage bits for digitalSignature, keyCertSign and cRLSign
+ boolean[] kuBitSettings = {true, false, false, false, false, true,
+ true, false, false};
+ cbld.addKeyUsageExt(kuBitSettings);
+ }
+
+ /**
+ * Helper routine that dumps only a few cert fields rather than
+ * the whole toString() output.
+ *
+ * @param cert an X509Certificate to be displayed
+ *
+ * @return the String output of the issuer, subject and
+ * serial number
+ */
+ private static String certInfo(X509Certificate cert) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Issuer: ").append(cert.getIssuerX500Principal()).
+ append("\n");
+ sb.append("Subject: ").append(cert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("Serial: ").append(cert.getSerialNumber()).append("\n");
+ return sb.toString();
+ }
+
+ /**
+ * Checks a validation failure to see if it failed for the reason we think
+ * it should. This comes in as an SSLException of some sort, but it
+ * encapsulates a ValidatorException which in turn encapsulates the
+ * CertPathValidatorException we are interested in.
+ *
+ * @param e the exception thrown at the top level
+ * @param reason the underlying CertPathValidatorException BasicReason
+ * we are expecting it to have.
+ *
+ * @return true if the reason matches up, false otherwise.
+ */
+ static boolean checkClientValidationFailure(Exception e,
+ CertPathValidatorException.BasicReason reason) {
+ boolean result = false;
+
+ if (e instanceof SSLException) {
+ Throwable sslhe = e.getCause();
+ if (sslhe instanceof SSLHandshakeException) {
+ Throwable valExc = sslhe.getCause();
+ if (valExc instanceof sun.security.validator.ValidatorException) {
+ Throwable cause = valExc.getCause();
+ if (cause instanceof CertPathValidatorException) {
+ CertPathValidatorException cpve =
+ (CertPathValidatorException)cause;
+ if (cpve.getReason() == reason) {
+ result = true;
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,905 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS
+ * @library ../../../../java/security/testlibrary
+ * @build CertificateBuilder SimpleOCSPServer
+ * @run main/othervm SSLSocketWithStapling
+ */
+
+import java.io.*;
+import java.math.BigInteger;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import javax.net.ssl.*;
+import java.security.KeyStore;
+import java.security.PublicKey;
+import java.security.Security;
+import java.security.cert.CertPathValidator;
+import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorException.BasicReason;
+import java.security.cert.Certificate;
+import java.security.cert.PKIXBuilderParameters;
+import java.security.cert.X509CertSelector;
+import java.security.cert.X509Certificate;
+import java.security.cert.PKIXRevocationChecker;
+import java.security.cert.PKIXRevocationChecker.Option;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.concurrent.TimeUnit;
+
+import sun.security.testlibrary.SimpleOCSPServer;
+import sun.security.testlibrary.CertificateBuilder;
+
+public class SSLSocketWithStapling {
+
+ /*
+ * =============================================================
+ * Set the various variables needed for the tests, then
+ * specify what tests to run on each side.
+ */
+
+ // Turn on TLS debugging
+ static boolean debug = false;
+
+ /*
+ * Should we run the client or server in a separate thread?
+ * Both sides can throw exceptions, but do you have a preference
+ * as to which side should be the main thread.
+ */
+ static boolean separateServerThread = true;
+ Thread clientThread = null;
+ Thread serverThread = null;
+
+ static String passwd = "passphrase";
+ static String ROOT_ALIAS = "root";
+ static String INT_ALIAS = "intermediate";
+ static String SSL_ALIAS = "ssl";
+
+ /*
+ * Is the server ready to serve?
+ */
+ volatile static boolean serverReady = false;
+ volatile int serverPort = 0;
+
+ volatile Exception serverException = null;
+ volatile Exception clientException = null;
+
+ // PKI components we will need for this test
+ static KeyStore rootKeystore; // Root CA Keystore
+ static KeyStore intKeystore; // Intermediate CA Keystore
+ static KeyStore serverKeystore; // SSL Server Keystore
+ static KeyStore trustStore; // SSL Client trust store
+ static SimpleOCSPServer rootOcsp; // Root CA OCSP Responder
+ static int rootOcspPort; // Port number for root OCSP
+ static SimpleOCSPServer intOcsp; // Intermediate CA OCSP Responder
+ static int intOcspPort; // Port number for intermed. OCSP
+
+ /*
+ * If the client or server is doing some kind of object creation
+ * that the other side depends on, and that thread prematurely
+ * exits, you may experience a hang. The test harness will
+ * terminate all hung threads after its timeout has expired,
+ * currently 3 minutes by default, but you might try to be
+ * smart about it....
+ */
+ public static void main(String[] args) throws Exception {
+ if (debug) {
+ System.setProperty("javax.net.debug", "ssl");
+ }
+
+ // Create the PKI we will use for the test and start the OCSP servers
+ createPKI();
+
+ testAllDefault();
+ testPKIXParametersRevEnabled();
+ testRevokedCertificate();
+ testHardFailFallback();
+ testSoftFailFallback();
+ testLatencyNoStaple(false);
+ testLatencyNoStaple(true);
+
+ // shut down the OCSP responders before finishing the test
+ intOcsp.stop();
+ rootOcsp.stop();
+ }
+
+ /**
+ * Default test using no externally-configured PKIXBuilderParameters
+ */
+ static void testAllDefault() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+ Map<BigInteger, SimpleOCSPServer.CertStatusInfo> revInfo =
+ new HashMap<>();
+
+ // We will prove revocation checking is disabled by marking the SSL
+ // certificate as revoked. The test would only pass if revocation
+ // checking did not happen.
+ X509Certificate sslCert =
+ (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ Date fiveMinsAgo = new Date(System.currentTimeMillis() -
+ TimeUnit.MINUTES.toMillis(5));
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_REVOKED,
+ fiveMinsAgo));
+ intOcsp.updateStatusDb(revInfo);
+
+ System.out.println("=======================================");
+ System.out.println("Stapling enabled, default configuration");
+ System.out.println("=======================================");
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else if (tr.serverExc != null) {
+ throw tr.serverExc;
+ }
+
+ // Return the ssl certificate to non-revoked status
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ System.out.println(" PASS");
+ System.out.println("=======================================\n");
+ }
+
+ /**
+ * Do a basic connection using PKIXParameters with revocation checking
+ * enabled and client-side OCSP disabled. It will only pass if all
+ * stapled responses are present, valid and have a GOOD status.
+ */
+ static void testPKIXParametersRevEnabled() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ System.out.println("=====================================");
+ System.out.println("Stapling enabled, PKIXParameters with");
+ System.out.println("Revocation checking enabled ");
+ System.out.println("=====================================");
+
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ Security.setProperty("ocsp.enable", "false");
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else if (tr.serverExc != null) {
+ throw tr.serverExc;
+ }
+
+ System.out.println(" PASS");
+ System.out.println("=====================================\n");
+ }
+
+ /**
+ * Perform a test where the certificate is revoked and placed in the
+ * TLS handshake. Client-side OCSP is disabled, so this test will only
+ * pass if the OCSP response is found, since we will check the
+ * CertPathValidatorException reason for revoked status.
+ */
+ static void testRevokedCertificate() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+ Map<BigInteger, SimpleOCSPServer.CertStatusInfo> revInfo =
+ new HashMap<>();
+
+ // We will prove revocation checking is disabled by marking the SSL
+ // certificate as revoked. The test would only pass if revocation
+ // checking did not happen.
+ X509Certificate sslCert =
+ (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ Date fiveMinsAgo = new Date(System.currentTimeMillis() -
+ TimeUnit.MINUTES.toMillis(5));
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_REVOKED,
+ fiveMinsAgo));
+ intOcsp.updateStatusDb(revInfo);
+
+ System.out.println("=======================================");
+ System.out.println("Stapling enabled, default configuration");
+ System.out.println("=======================================");
+
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ Security.setProperty("ocsp.enable", "false");
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (!checkClientValidationFailure(tr.clientExc, BasicReason.REVOKED)) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else {
+ throw new RuntimeException(
+ "Expected client failure, but the client succeeded");
+ }
+ }
+
+ // Return the ssl certificate to non-revoked status
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ System.out.println(" PASS");
+ System.out.println("=======================================\n");
+ }
+
+ /**
+ * Test a case where client-side stapling is attempted, but does not
+ * occur because OCSP responders are unreachable. This should use a
+ * default hard-fail behavior.
+ */
+ static void testHardFailFallback() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ // Stop the OCSP responders and give a 1 second delay before
+ // running the test.
+ intOcsp.stop();
+ rootOcsp.stop();
+ Thread.sleep(1000);
+
+ System.out.println("=======================================");
+ System.out.println("Stapling enbled in client and server,");
+ System.out.println("but OCSP responders disabled.");
+ System.out.println("PKIXParameters with Revocation checking");
+ System.out.println("enabled.");
+ System.out.println("=======================================");
+
+ Security.setProperty("ocsp.enable", "true");
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (!checkClientValidationFailure(tr.clientExc,
+ BasicReason.UNDETERMINED_REVOCATION_STATUS)) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else {
+ throw new RuntimeException(
+ "Expected client failure, but the client succeeded");
+ }
+ }
+
+ System.out.println(" PASS");
+ System.out.println("=======================================\n");
+
+ // Start the OCSP responders up again
+ intOcsp.start();
+ rootOcsp.start();
+ }
+
+ /**
+ * Test a case where client-side stapling is attempted, but does not
+ * occur because OCSP responders are unreachable. Client-side OCSP
+ * checking is enabled for this, with SOFT_FAIL.
+ */
+ static void testSoftFailFallback() throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ // Stop the OCSP responders and give a 1 second delay before
+ // running the test.
+ intOcsp.stop();
+ rootOcsp.stop();
+ Thread.sleep(1000);
+
+ System.out.println("=======================================");
+ System.out.println("Stapling enbled in client and server,");
+ System.out.println("but OCSP responders disabled.");
+ System.out.println("PKIXParameters with Revocation checking");
+ System.out.println("enabled and SOFT_FAIL.");
+ System.out.println("=======================================");
+
+ Security.setProperty("ocsp.enable", "true");
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
+ cliParams.revChecker =
+ (PKIXRevocationChecker)cpv.getRevocationChecker();
+ cliParams.revChecker.setOptions(EnumSet.of(Option.SOFT_FAIL));
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else if (tr.serverExc != null) {
+ throw tr.serverExc;
+ }
+
+ System.out.println(" PASS");
+ System.out.println("=======================================\n");
+
+ // Start the OCSP responders up again
+ intOcsp.start();
+ rootOcsp.start();
+ }
+
+ /**
+ * This test initiates stapling from the client, but the server does not
+ * support OCSP stapling for this connection. In this case it happens
+ * because the latency of the OCSP responders is longer than the server
+ * is willing to wait. To keep the test streamlined, we will set the server
+ * latency to a 1 second wait, and set the responder latency to 3 seconds.
+ *
+ * @param fallback if we allow client-side OCSP fallback, which
+ * will change the result from the client failing with CPVE (no fallback)
+ * to a pass (fallback active).
+ */
+ static void testLatencyNoStaple(Boolean fallback) throws Exception {
+ ClientParameters cliParams = new ClientParameters();
+ ServerParameters servParams = new ServerParameters();
+ serverReady = false;
+
+ // Stop the OCSP responders and give a 1 second delay before
+ // running the test.
+ intOcsp.stop();
+ rootOcsp.stop();
+ Thread.sleep(1000);
+ intOcsp.setDelay(3000);
+ rootOcsp.setDelay(3000);
+ rootOcsp.start();
+ intOcsp.start();
+ Thread.sleep(1000);
+
+ System.out.println("========================================");
+ System.out.println("Stapling enbled in client. Server does");
+ System.out.println("not support stapling due to OCSP latency.");
+ System.out.println("PKIXParameters with Revocation checking");
+ System.out.println("enabled, client-side OCSP checking is.");
+ System.out.println(fallback ? "enabled" : "disabled");
+ System.out.println("========================================");
+
+ Security.setProperty("ocsp.enable", fallback.toString());
+ cliParams.pkixParams = new PKIXBuilderParameters(trustStore,
+ new X509CertSelector());
+ cliParams.pkixParams.setRevocationEnabled(true);
+ servParams.respTimeout = 1000;
+
+ SSLSocketWithStapling sslTest = new SSLSocketWithStapling(cliParams,
+ servParams);
+ TestResult tr = sslTest.getResult();
+
+ if (fallback) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else if (tr.serverExc != null) {
+ throw tr.serverExc;
+ }
+ } else {
+ if (!checkClientValidationFailure(tr.clientExc,
+ BasicReason.UNDETERMINED_REVOCATION_STATUS)) {
+ if (tr.clientExc != null) {
+ throw tr.clientExc;
+ } else {
+ throw new RuntimeException(
+ "Expected client failure, but the client succeeded");
+ }
+ }
+ }
+ System.out.println(" PASS");
+ System.out.println("========================================\n");
+
+ // Remove the OCSP responder latency
+ intOcsp.stop();
+ rootOcsp.stop();
+ Thread.sleep(1000);
+ intOcsp.setDelay(0);
+ rootOcsp.setDelay(0);
+ rootOcsp.start();
+ intOcsp.start();
+ }
+
+ /*
+ * Define the server side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doServerSide(ServerParameters servParams) throws Exception {
+
+ // Selectively enable or disable the feature
+ System.setProperty("jdk.tls.server.enableStatusRequestExtension",
+ Boolean.toString(servParams.enabled));
+
+ // Set all the other operating parameters
+ System.setProperty("jdk.tls.stapling.cacheSize",
+ Integer.toString(servParams.cacheSize));
+ System.setProperty("jdk.tls.stapling.cacheLifetime",
+ Integer.toString(servParams.cacheLifetime));
+ System.setProperty("jdk.tls.stapling.responseTimeout",
+ Integer.toString(servParams.respTimeout));
+ System.setProperty("jdk.tls.stapling.responderURI", servParams.respUri);
+ System.setProperty("jdk.tls.stapling.responderOverride",
+ Boolean.toString(servParams.respOverride));
+ System.setProperty("jdk.tls.stapling.ignoreExtensions",
+ Boolean.toString(servParams.ignoreExts));
+
+ // Set keystores and trust stores for the server
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(serverKeystore, passwd.toCharArray());
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+ tmf.init(trustStore);
+
+ SSLContext sslc = SSLContext.getInstance("TLS");
+ sslc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+ SSLServerSocketFactory sslssf = sslc.getServerSocketFactory();
+ SSLServerSocket sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort);
+
+ serverPort = sslServerSocket.getLocalPort();
+
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ try (SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ InputStream sslIS = sslSocket.getInputStream();
+ OutputStream sslOS = sslSocket.getOutputStream()) {
+ int numberIn = sslIS.read();
+ int numberSent = 85;
+ log("Server received number: " + numberIn);
+ sslOS.write(numberSent);
+ sslOS.flush();
+ log("Server sent number: " + numberSent);
+ }
+ }
+
+ /*
+ * Define the client side of the test.
+ *
+ * If the server prematurely exits, serverReady will be set to true
+ * to avoid infinite hangs.
+ */
+ void doClientSide(ClientParameters cliParams) throws Exception {
+
+ /*
+ * Wait for server to get started.
+ */
+ while (!serverReady) {
+ Thread.sleep(50);
+ }
+
+ // Selectively enable or disable the feature
+ System.setProperty("jdk.tls.client.enableStatusRequestExtension",
+ Boolean.toString(cliParams.enabled));
+
+ // Create the Trust Manager Factory using the PKIX variant
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX");
+
+ // If we have a customized pkixParameters then use it
+ if (cliParams.pkixParams != null) {
+ // LIf we have a customized PKIXRevocationChecker, add
+ // it to the PKIXBuilderParameters.
+ if (cliParams.revChecker != null) {
+ cliParams.pkixParams.addCertPathChecker(cliParams.revChecker);
+ }
+
+ ManagerFactoryParameters trustParams =
+ new CertPathTrustManagerParameters(cliParams.pkixParams);
+ tmf.init(trustParams);
+ } else {
+ tmf.init(trustStore);
+ }
+
+ SSLContext sslc = SSLContext.getInstance("TLS");
+ sslc.init(null, tmf.getTrustManagers(), null);
+
+ SSLSocketFactory sslsf = sslc.getSocketFactory();
+ try (SSLSocket sslSocket = (SSLSocket)sslsf.createSocket("localhost",
+ serverPort);
+ InputStream sslIS = sslSocket.getInputStream();
+ OutputStream sslOS = sslSocket.getOutputStream()) {
+ int numberSent = 80;
+ sslOS.write(numberSent);
+ sslOS.flush();
+ log("Client sent number: " + numberSent);
+ int numberIn = sslIS.read();
+ log("Client received number:" + numberIn);
+ }
+ }
+
+ /*
+ * Primary constructor, used to drive remainder of the test.
+ *
+ * Fork off the other side, then do your work.
+ */
+ SSLSocketWithStapling(ClientParameters cliParams,
+ ServerParameters servParams) throws Exception {
+ Exception startException = null;
+ try {
+ if (separateServerThread) {
+ startServer(servParams, true);
+ startClient(cliParams, false);
+ } else {
+ startClient(cliParams, true);
+ startServer(servParams, false);
+ }
+ } catch (Exception e) {
+ startException = e;
+ }
+
+ /*
+ * Wait for other side to close down.
+ */
+ if (separateServerThread) {
+ if (serverThread != null) {
+ serverThread.join();
+ }
+ } else {
+ if (clientThread != null) {
+ clientThread.join();
+ }
+ }
+ }
+
+ /**
+ * Checks a validation failure to see if it failed for the reason we think
+ * it should. This comes in as an SSLException of some sort, but it
+ * encapsulates a ValidatorException which in turn encapsulates the
+ * CertPathValidatorException we are interested in.
+ *
+ * @param e the exception thrown at the top level
+ * @param reason the underlying CertPathValidatorException BasicReason
+ * we are expecting it to have.
+ *
+ * @return true if the reason matches up, false otherwise.
+ */
+ static boolean checkClientValidationFailure(Exception e,
+ BasicReason reason) {
+ boolean result = false;
+
+ if (e instanceof SSLException) {
+ Throwable valExc = e.getCause();
+ if (valExc instanceof sun.security.validator.ValidatorException) {
+ Throwable cause = valExc.getCause();
+ if (cause instanceof CertPathValidatorException) {
+ CertPathValidatorException cpve =
+ (CertPathValidatorException)cause;
+ if (cpve.getReason() == reason) {
+ result = true;
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ TestResult getResult() {
+ TestResult tr = new TestResult();
+ tr.clientExc = clientException;
+ tr.serverExc = serverException;
+ return tr;
+ }
+
+ void startServer(ServerParameters servParams, boolean newThread)
+ throws Exception {
+ if (newThread) {
+ serverThread = new Thread() {
+ public void run() {
+ try {
+ doServerSide(servParams);
+ } catch (Exception e) {
+ /*
+ * Our server thread just died.
+ *
+ * Release the client, if not active already...
+ */
+ System.err.println("Server died...");
+ serverReady = true;
+ serverException = e;
+ }
+ }
+ };
+ serverThread.start();
+ } else {
+ try {
+ doServerSide(servParams);
+ } catch (Exception e) {
+ serverException = e;
+ } finally {
+ serverReady = true;
+ }
+ }
+ }
+
+ void startClient(ClientParameters cliParams, boolean newThread)
+ throws Exception {
+ if (newThread) {
+ clientThread = new Thread() {
+ public void run() {
+ try {
+ doClientSide(cliParams);
+ } catch (Exception e) {
+ /*
+ * Our client thread just died.
+ */
+ System.err.println("Client died...");
+ clientException = e;
+ }
+ }
+ };
+ clientThread.start();
+ } else {
+ try {
+ doClientSide(cliParams);
+ } catch (Exception e) {
+ clientException = e;
+ }
+ }
+ }
+
+ /**
+ * Creates the PKI components necessary for this test, including
+ * Root CA, Intermediate CA and SSL server certificates, the keystores
+ * for each entity, a client trust store, and starts the OCSP responders.
+ */
+ private static void createPKI() throws Exception {
+ CertificateBuilder cbld = new CertificateBuilder();
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ keyGen.initialize(2048);
+ KeyStore.Builder keyStoreBuilder =
+ KeyStore.Builder.newInstance("PKCS12", null,
+ new KeyStore.PasswordProtection(passwd.toCharArray()));
+
+ // Generate Root, IntCA, EE keys
+ KeyPair rootCaKP = keyGen.genKeyPair();
+ log("Generated Root CA KeyPair");
+ KeyPair intCaKP = keyGen.genKeyPair();
+ log("Generated Intermediate CA KeyPair");
+ KeyPair sslKP = keyGen.genKeyPair();
+ log("Generated SSL Cert KeyPair");
+
+ // Set up the Root CA Cert
+ cbld.setSubjectName("CN=Root CA Cert, O=SomeCompany");
+ cbld.setPublicKey(rootCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("1"));
+ // Make a 3 year validity starting from 60 days ago
+ long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60);
+ long end = start + TimeUnit.DAYS.toMillis(1085);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ // Make our Root CA Cert!
+ X509Certificate rootCert = cbld.build(null, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Root CA Created:\n" + certInfo(rootCert));
+
+ // Now build a keystore and add the keys and cert
+ rootKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] rootChain = {rootCert};
+ rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
+ passwd.toCharArray(), rootChain);
+
+ // Now fire up the OCSP responder
+ rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
+ rootOcsp.enableLog(debug);
+ rootOcsp.setNextUpdateInterval(3600);
+ rootOcsp.start();
+ Thread.sleep(1000); // Give the server a second to start up
+ rootOcspPort = rootOcsp.getPort();
+ String rootRespURI = "http://localhost:" + rootOcspPort;
+ log("Root OCSP Responder URI is " + rootRespURI);
+
+ // Now that we have the root keystore and OCSP responder we can
+ // create our intermediate CA.
+ cbld.reset();
+ cbld.setSubjectName("CN=Intermediate CA Cert, O=SomeCompany");
+ cbld.setPublicKey(intCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("100"));
+ // Make a 2 year validity starting from 30 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);
+ end = start + TimeUnit.DAYS.toMillis(730);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, intCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ cbld.addAIAExt(Collections.singletonList(rootRespURI));
+ // Make our Intermediate CA Cert!
+ X509Certificate intCaCert = cbld.build(rootCert, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Intermediate CA Created:\n" + certInfo(intCaCert));
+
+ // Provide intermediate CA cert revocation info to the Root CA
+ // OCSP responder.
+ Map<BigInteger, SimpleOCSPServer.CertStatusInfo> revInfo =
+ new HashMap<>();
+ revInfo.put(intCaCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ rootOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ intKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] intChain = {intCaCert, rootCert};
+ intKeystore.setKeyEntry(INT_ALIAS, intCaKP.getPrivate(),
+ passwd.toCharArray(), intChain);
+ intKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // Now fire up the Intermediate CA OCSP responder
+ intOcsp = new SimpleOCSPServer(intKeystore, passwd,
+ INT_ALIAS, null);
+ intOcsp.enableLog(debug);
+ intOcsp.setNextUpdateInterval(3600);
+ intOcsp.start();
+ Thread.sleep(1000);
+ intOcspPort = intOcsp.getPort();
+ String intCaRespURI = "http://localhost:" + intOcspPort;
+ log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
+
+ // Last but not least, let's make our SSLCert and add it to its own
+ // Keystore
+ cbld.reset();
+ cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
+ cbld.setPublicKey(sslKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("4096"));
+ // Make a 1 year validity starting from 7 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
+ end = start + TimeUnit.DAYS.toMillis(365);
+ cbld.setValidity(new Date(start), new Date(end));
+
+ // Add extensions
+ addCommonExts(cbld, sslKP.getPublic(), intCaKP.getPublic());
+ boolean[] kuBits = {true, false, true, false, false, false,
+ false, false, false};
+ cbld.addKeyUsageExt(kuBits);
+ List<String> ekuOids = new ArrayList<>();
+ ekuOids.add("1.3.6.1.5.5.7.3.1");
+ ekuOids.add("1.3.6.1.5.5.7.3.2");
+ cbld.addExtendedKeyUsageExt(ekuOids);
+ cbld.addSubjectAltNameDNSExt(Collections.singletonList("localhost"));
+ cbld.addAIAExt(Collections.singletonList(intCaRespURI));
+ // Make our SSL Server Cert!
+ X509Certificate sslCert = cbld.build(intCaCert, intCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("SSL Certificate Created:\n" + certInfo(sslCert));
+
+ // Provide SSL server cert revocation info to the Intermeidate CA
+ // OCSP responder.
+ revInfo = new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ serverKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] sslChain = {sslCert, intCaCert, rootCert};
+ serverKeystore.setKeyEntry(SSL_ALIAS, sslKP.getPrivate(),
+ passwd.toCharArray(), sslChain);
+ serverKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // And finally a Trust Store for the client
+ trustStore = keyStoreBuilder.getKeyStore();
+ trustStore.setCertificateEntry(ROOT_ALIAS, rootCert);
+ }
+
+ private static void addCommonExts(CertificateBuilder cbld,
+ PublicKey subjKey, PublicKey authKey) throws IOException {
+ cbld.addSubjectKeyIdExt(subjKey);
+ cbld.addAuthorityKeyIdExt(authKey);
+ }
+
+ private static void addCommonCAExts(CertificateBuilder cbld)
+ throws IOException {
+ cbld.addBasicConstraintsExt(true, true, -1);
+ // Set key usage bits for digitalSignature, keyCertSign and cRLSign
+ boolean[] kuBitSettings = {true, false, false, false, false, true,
+ true, false, false};
+ cbld.addKeyUsageExt(kuBitSettings);
+ }
+
+ /**
+ * Helper routine that dumps only a few cert fields rather than
+ * the whole toString() output.
+ *
+ * @param cert an X509Certificate to be displayed
+ *
+ * @return the String output of the issuer, subject and
+ * serial number
+ */
+ private static String certInfo(X509Certificate cert) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Issuer: ").append(cert.getIssuerX500Principal()).
+ append("\n");
+ sb.append("Subject: ").append(cert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("Serial: ").append(cert.getSerialNumber()).append("\n");
+ return sb.toString();
+ }
+
+ /**
+ * Log a message on stdout
+ *
+ * @param message The message to log
+ */
+ private static void log(String message) {
+ if (debug) {
+ System.out.println(message);
+ }
+ }
+
+ // The following two classes are Simple nested class to group a handful
+ // of configuration parameters used before starting a client or server.
+ // We'll just access the data members directly for convenience.
+ static class ClientParameters {
+ boolean enabled = true;
+ PKIXBuilderParameters pkixParams = null;
+ PKIXRevocationChecker revChecker = null;
+
+ ClientParameters() { }
+ }
+
+ static class ServerParameters {
+ boolean enabled = true;
+ int cacheSize = 256;
+ int cacheLifetime = 3600;
+ int respTimeout = 5000;
+ String respUri = "";
+ boolean respOverride = false;
+ boolean ignoreExts = false;
+
+ ServerParameters() { }
+ }
+
+ static class TestResult {
+ Exception serverExc = null;
+ Exception clientExc = null;
+ }
+
+}
--- a/jdk/test/jdk/internal/jimage/ExecutableTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/jdk/internal/jimage/ExecutableTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,7 +27,9 @@
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;
import static java.nio.file.attribute.PosixFilePermission.*;
+import java.util.Arrays;
import java.util.EnumSet;
+import java.util.HashSet;
import java.util.Set;
/*
@@ -41,6 +43,11 @@
public class ExecutableTest {
+ // The bin/ directory may contain non-executable files (see 8132704)
+ private static final String[] exclude = { "jmc.ini" };
+ private static final Set<String> excludeSet =
+ new HashSet<String>(Arrays.asList(exclude));
+
public static void main(String args[]) throws Throwable {
String JAVA_HOME = System.getProperty("java.home");
Path binPath = Paths.get(JAVA_HOME, "bin");
@@ -48,6 +55,7 @@
EnumSet<PosixFilePermission> execPerms =
EnumSet.of(GROUP_EXECUTE, OTHERS_EXECUTE, OWNER_EXECUTE);
for (Path entry : stream) {
+ if (excludeSet.contains(entry.getFileName().toString())) continue;
if (Files.isRegularFile(entry)) {
if (!Files.isExecutable(entry)) {
throw new Error(entry + " is not executable!");
--- a/jdk/test/sun/jvmstat/monitor/MonitoredVm/CR6672135.java Thu Aug 06 11:17:57 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2004, 2015, 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.
- */
-
-import java.net.URISyntaxException;
-import java.util.Set;
-import sun.jvmstat.monitor.MonitorException;
-import sun.jvmstat.monitor.MonitoredHost;
-import sun.jvmstat.monitor.MonitoredVm;
-import sun.jvmstat.monitor.VmIdentifier;
-
-/**
- *
- * @test
- * @bug 6672135
- * @summary setInterval() for local MonitoredHost and local MonitoredVm
- * @author Tomas Hurka
- * @modules jdk.jvmstat/sun.jvmstat.monitor
- * @run main/othervm -XX:+UsePerfData CR6672135
- */
-public class CR6672135 {
-
- private static final int INTERVAL = 2000;
-
- public static void main(String[] args) {
- int vmInterval;
- int hostInterval;
-
- try {
- MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
- Set vms = localHost.activeVms();
- Integer vmInt = (Integer) vms.iterator().next();
- String uriString = "//" + vmInt + "?mode=r"; // NOI18N
- VmIdentifier vmId = new VmIdentifier(uriString);
- MonitoredVm vm = localHost.getMonitoredVm(vmId);
-
- vm.setInterval(INTERVAL);
- localHost.setInterval(INTERVAL);
- vmInterval = vm.getInterval();
- hostInterval = localHost.getInterval();
- } catch (Exception ex) {
- throw new Error ("Test failed",ex);
- }
- System.out.println("VM "+vmInterval);
- if (vmInterval != INTERVAL) {
- throw new Error("Test failed");
- }
- System.out.println("Host "+hostInterval);
- if (hostInterval != INTERVAL) {
- throw new Error("Test failed");
- }
- }
-}
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2004, 2015, 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.
+ */
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+
+import jdk.testlibrary.Asserts;
+import jdk.testlibrary.Utils;
+import jdk.test.lib.apps.LingeredApp;
+import sun.jvmstat.monitor.MonitorException;
+import sun.jvmstat.monitor.MonitoredHost;
+import sun.jvmstat.monitor.MonitoredVm;
+import sun.jvmstat.monitor.MonitoredVmUtil;
+import sun.jvmstat.monitor.VmIdentifier;
+
+/**
+ *
+ * @test
+ * @bug 6672135
+ * @summary setInterval() for local MonitoredHost and local MonitoredVm
+ * @modules jdk.jvmstat/sun.jvmstat.monitor
+ * @library /lib/testlibrary
+ * @library /../../test/lib/share/classes
+ * @build jdk.testlibrary.*
+ * @build jdk.test.lib.apps.*
+ * @run main TestPollingInterval
+ */
+public class TestPollingInterval {
+
+ private static final int INTERVAL = 2000;
+
+ public static void main(String[] args) throws IOException,
+ MonitorException, URISyntaxException {
+ LingeredApp app = null;
+ try {
+ List<String> vmArgs = new ArrayList<String>();
+ vmArgs.add("-XX:+UsePerfData");
+ vmArgs.addAll(Utils.getVmOptions());
+ app = LingeredApp.startApp(vmArgs);
+
+ MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
+ String uriString = "//" + app.getPid() + "?mode=r"; // NOI18N
+ VmIdentifier vmId = new VmIdentifier(uriString);
+ MonitoredVm vm = localHost.getMonitoredVm(vmId);
+ System.out.println("Monitored vm command line: " + MonitoredVmUtil.commandLine(vm));
+
+ vm.setInterval(INTERVAL);
+ localHost.setInterval(INTERVAL);
+
+ Asserts.assertEquals(vm.getInterval(), INTERVAL, "Monitored vm interval should be equal the test value");
+ Asserts.assertEquals(localHost.getInterval(), INTERVAL, "Monitored host interval should be equal the test value");
+ } finally {
+ LingeredApp.stopApp(app);
+ }
+
+ }
+
+}
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh Wed Jul 05 20:44:51 2017 +0200
@@ -26,6 +26,7 @@
# @bug 6528083
# @summary Test RMI Bootstrap
#
+# @key intermittent
# @library /lib/testlibrary
# @modules java.management/sun.management
# java.management/sun.management.jmxremote
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -40,6 +40,7 @@
* @bug 8075926
* @summary Makes sure that the current management agent status is reflected
* in the related performance counters.
+ * @key intermittent
* @library /lib/testlibrary
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* @run testng/othervm -XX:+UsePerfData JMXStatusPerfCountersTest
--- a/jdk/test/sun/nio/cs/NIOJISAutoDetectTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/nio/cs/NIOJISAutoDetectTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4831163 5053096 5056440
+ * @bug 4831163 5053096 5056440 8022224
* @summary NIO charset basic verification of JISAutodetect decoder
* @author Martin Buchholz
*/
@@ -239,6 +239,14 @@
check(cb.position() == 2, "cb.position()");
}
+ // test #8022224
+ Charset cs = Charset.forName("x-JISAutoDetect");
+ ByteBuffer bb = ByteBuffer.wrap(new byte[] { 'a', 0x1b, 0x24, 0x40 });
+ CharBuffer cb = CharBuffer.wrap(new char[10]);
+ CoderResult cr = cs.newDecoder().decode(bb, cb, false);
+ bb.rewind();
+ cb.clear().limit(1);
+ check(cr == cs.newDecoder().decode(bb, cb, false), "#8022224");
if (failures > 0)
throw new RuntimeException(failures + " tests failed");
--- a/jdk/test/sun/security/krb5/auto/KDC.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/security/krb5/auto/KDC.java Wed Jul 05 20:44:51 2017 +0200
@@ -745,9 +745,10 @@
bFlags[Krb5.TKT_OPTS_FORWARDABLE] = true;
}
}
+ // We do not request for addresses for FORWARDED tickets
if (options.containsKey(Option.CHECK_ADDRESSES)
&& body.kdcOptions.get(KDCOptions.FORWARDED)
- && body.addresses == null) {
+ && body.addresses != null) {
throw new KrbException(Krb5.KDC_ERR_BADOPTION);
}
if (body.kdcOptions.get(KDCOptions.FORWARDED) ||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/provider/certpath/Extensions/OCSPNonceExtensionTests.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,458 @@
+/*
+ * Copyright (c) 2015, 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 8046321
+ * @summary Unit tests for OCSPNonceExtension objects
+ */
+
+import java.security.cert.Extension;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.*;
+
+import sun.security.util.DerValue;
+import sun.security.util.DerInputStream;
+import sun.security.util.ObjectIdentifier;
+import sun.security.provider.certpath.OCSPNonceExtension;
+import sun.security.x509.PKIXExtensions;
+
+public class OCSPNonceExtensionTests {
+ public static final boolean DEBUG = true;
+ public static final String OCSP_NONCE_OID = "1.3.6.1.5.5.7.48.1.2";
+ public static final String ELEMENT_NONCE = "nonce";
+ public static final String EXT_NAME = "OCSPNonce";
+
+ // DER encoding for OCSP nonce extension:
+ // OID = 1.3.6.1.5.5.7.48.1.2
+ // Critical = true
+ // 48 bytes of 0xDEADBEEF
+ public static final byte[] OCSP_NONCE_DER = {
+ 48, 66, 6, 9, 43, 6, 1, 5,
+ 5, 7, 48, 1, 2, 1, 1, -1,
+ 4, 50, 4, 48, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17,
+ };
+
+ // 16 bytes of 0xDEADBEEF
+ public static final byte[] DEADBEEF_16 = {
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ -34, -83, -66, -17, -34, -83, -66, -17,
+ };
+
+ // DER encoded extension using 16 bytes of DEADBEEF
+ public static final byte[] OCSP_NONCE_DB16 = {
+ 48, 31, 6, 9, 43, 6, 1, 5,
+ 5, 7, 48, 1, 2, 4, 18, 4,
+ 16, -34, -83, -66, -17, -34, -83, -66,
+ -17, -34, -83, -66, -17, -34, -83, -66,
+ -17
+ };
+
+ public static void main(String [] args) throws Exception {
+ Map<String, TestCase> testList =
+ new LinkedHashMap<String, TestCase>() {{
+ put("CTOR Test (provide length)", testCtorByLength);
+ put("CTOR Test (provide extension DER encoding)",
+ testCtorSuperByDerValue);
+ put("Use set() call to provide random data", testResetValue);
+ put("Test get() method", testGet);
+ put("test set() method", testSet);
+ put("Test getElements() method", testGetElements);
+ put("Test getName() method", testGetName);
+ put("Test delete() method", testDelete);
+ }};
+
+ System.out.println("============ Tests ============");
+ int testNo = 0;
+ int numberFailed = 0;
+ Map.Entry<Boolean, String> result;
+ for (String testName : testList.keySet()) {
+ System.out.println("Test " + ++testNo + ": " + testName);
+ result = testList.get(testName).runTest();
+ System.out.print("Result: " + (result.getKey() ? "PASS" : "FAIL"));
+ System.out.println(" " +
+ (result.getValue() != null ? result.getValue() : ""));
+ System.out.println("-------------------------------------------");
+ if (!result.getKey()) {
+ numberFailed++;
+ }
+ }
+ System.out.println("End Results: " + (testList.size() - numberFailed) +
+ " Passed" + ", " + numberFailed + " Failed.");
+ if (numberFailed > 0) {
+ throw new RuntimeException(
+ "One or more tests failed, see test output for details");
+ }
+ }
+
+ private static void dumpHexBytes(byte[] data) {
+ if (data != null) {
+ for (int i = 0; i < data.length; i++) {
+ if (i % 16 == 0 && i != 0) {
+ System.out.print("\n");
+ }
+ System.out.print(String.format("%02X ", data[i]));
+ }
+ System.out.print("\n");
+ }
+ }
+
+ private static void debuglog(String message) {
+ if (DEBUG) {
+ System.out.println(message);
+ }
+ }
+
+ public static void verifyExtStructure(byte[] derData) throws IOException {
+ debuglog("verifyASN1Extension() received " + derData.length + " bytes");
+ DerInputStream dis = new DerInputStream(derData);
+
+ // The sequenceItems array should be either two or three elements
+ // long. If three, then the criticality bit setting has been asserted.
+ DerValue[] sequenceItems = dis.getSequence(3);
+ debuglog("Found sequence containing " + sequenceItems.length +
+ " elements");
+ if (sequenceItems.length != 2 && sequenceItems.length != 3) {
+ throw new RuntimeException("Incorrect number of items found in " +
+ "the SEQUENCE (Got " + sequenceItems.length +
+ ", expected 2 or 3 items)");
+ }
+
+ int seqIndex = 0;
+ ObjectIdentifier extOid = sequenceItems[seqIndex++].getOID();
+ debuglog("Found OID: " + extOid.toString());
+ if (!extOid.equals((Object)PKIXExtensions.OCSPNonce_Id)) {
+ throw new RuntimeException("Incorrect OID (Got " +
+ extOid.toString() + ", expected " +
+ PKIXExtensions.OCSPNonce_Id.toString() + ")");
+ }
+
+ if (sequenceItems.length == 3) {
+ // Non-default criticality bit setting should be at index 1
+ boolean isCrit = sequenceItems[seqIndex++].getBoolean();
+ debuglog("Found BOOLEAN (critical): " + isCrit);
+ }
+
+ // The extnValue is an encapsulating OCTET STRING that contains the
+ // extension's value. For the OCSP Nonce, that value itself is also
+ // an OCTET STRING consisting of the random bytes.
+ DerValue extnValue =
+ new DerValue(sequenceItems[seqIndex++].getOctetString());
+ byte[] nonceData = extnValue.getOctetString();
+ debuglog("Found " + nonceData.length + " bytes of nonce data");
+ }
+
+ public interface TestCase {
+ Map.Entry<Boolean, String> runTest();
+ }
+
+ public static final TestCase testCtorByLength = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+ Extension nonceByLen = new OCSPNonceExtension(32);
+
+ // Verify overall encoded extension structure
+ nonceByLen.encode(baos);
+ verifyExtStructure(baos.toByteArray());
+
+ // Verify the name, elements, and data conform to
+ // expected values for this specific object.
+ boolean crit = nonceByLen.isCritical();
+ String oid = nonceByLen.getId();
+ DerValue nonceData = new DerValue(nonceByLen.getValue());
+
+ if (crit) {
+ message = "Extension incorrectly marked critical";
+ } else if (!oid.equals(OCSP_NONCE_OID)) {
+ message = "Incorrect OID (Got " + oid + ", Expected " +
+ OCSP_NONCE_OID + ")";
+ } else if (nonceData.getTag() != DerValue.tag_OctetString) {
+ message = "Incorrect nonce data tag type (Got " +
+ String.format("0x%02X", nonceData.getTag()) +
+ ", Expected 0x04)";
+ } else if (nonceData.getOctetString().length != 32) {
+ message = "Incorrect nonce byte length (Got " +
+ nonceData.getOctetString().length +
+ ", Expected 32)";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testCtorSuperByDerValue = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+ Extension nonceByDer = new sun.security.x509.Extension(
+ new DerValue(OCSP_NONCE_DER));
+
+ // Verify overall encoded extension structure
+ nonceByDer.encode(baos);
+ verifyExtStructure(baos.toByteArray());
+
+ // Verify the name, elements, and data conform to
+ // expected values for this specific object.
+ boolean crit = nonceByDer.isCritical();
+ String oid = nonceByDer.getId();
+ DerValue nonceData = new DerValue(nonceByDer.getValue());
+
+ if (!crit) {
+ message = "Extension lacks expected criticality setting";
+ } else if (!oid.equals(OCSP_NONCE_OID)) {
+ message = "Incorrect OID (Got " + oid + ", Expected " +
+ OCSP_NONCE_OID + ")";
+ } else if (nonceData.getTag() != DerValue.tag_OctetString) {
+ message = "Incorrect nonce data tag type (Got " +
+ String.format("0x%02X", nonceData.getTag()) +
+ ", Expected 0x04)";
+ } else if (nonceData.getOctetString().length != 48) {
+ message = "Incorrect nonce byte length (Got " +
+ nonceData.getOctetString().length +
+ ", Expected 48)";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testResetValue = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+ OCSPNonceExtension nonce = new OCSPNonceExtension(32);
+
+ // Reset the nonce data to reflect 16 bytes of DEADBEEF
+ nonce.set(OCSPNonceExtension.NONCE, (Object)DEADBEEF_16);
+
+ // Verify overall encoded extension content
+ nonce.encode(baos);
+ dumpHexBytes(OCSP_NONCE_DB16);
+ System.out.println();
+ dumpHexBytes(baos.toByteArray());
+
+ pass = Arrays.equals(baos.toByteArray(), OCSP_NONCE_DB16);
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testSet = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+
+ // Set the nonce data to 16 bytes of DEADBEEF
+ nonceByLen.set(ELEMENT_NONCE, DEADBEEF_16);
+ byte[] nonceData = (byte[])nonceByLen.get(ELEMENT_NONCE);
+ if (!Arrays.equals(nonceData, DEADBEEF_16)) {
+ throw new RuntimeException("Retuned nonce data does not " +
+ "match expected result");
+ }
+
+ // Now try to set a value using an object that is not a byte
+ // array
+ int[] INT_DB_16 = {
+ 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF
+ };
+ try {
+ nonceByLen.set(ELEMENT_NONCE, INT_DB_16);
+ throw new RuntimeException("Accepted get() for " +
+ "unsupported element name");
+ } catch (IOException ioe) { } // Expected result
+
+ // And try setting a value using an unknown element name
+ try {
+ nonceByLen.set("FOO", DEADBEEF_16);
+ throw new RuntimeException("Accepted get() for " +
+ "unsupported element name");
+ } catch (IOException ioe) { } // Expected result
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testGet = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+
+ // Grab the nonce data by its correct element name
+ byte[] nonceData = (byte[])nonceByLen.get(ELEMENT_NONCE);
+ if (nonceData == null || nonceData.length != 32) {
+ throw new RuntimeException("Unexpected return value from " +
+ "get() method: either null or incorrect length");
+ }
+
+ // Now try to get any kind of data using an element name that
+ // doesn't exist for this extension.
+ try {
+ nonceByLen.get("FOO");
+ throw new RuntimeException("Accepted get() for " +
+ "unsupported element name");
+ } catch (IOException ioe) { } // Expected result
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testGetElements = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+
+ int elementCount = 0;
+ boolean foundElement = false;
+
+ // There should be exactly one element and its name should
+ // be "nonce"
+ for (Enumeration<String> elements = nonceByLen.getElements();
+ elements.hasMoreElements(); elementCount++) {
+ if (elements.nextElement().equals(ELEMENT_NONCE)) {
+ foundElement = true;
+ }
+ }
+
+ if (!foundElement || elementCount != 1) {
+ throw new RuntimeException("Unexpected or missing " +
+ "Enumeration element");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testGetName = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+ pass = new Boolean(nonceByLen.getName().equals(EXT_NAME));
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testDelete = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ OCSPNonceExtension nonceByLen = new OCSPNonceExtension(32);
+
+ // First verify that there's data to begin with
+ byte[] nonceData = (byte[])nonceByLen.get(ELEMENT_NONCE);
+ if (nonceData == null || nonceData.length != 32) {
+ throw new RuntimeException("Unexpected return value from " +
+ "get() method: either null or incorrect length");
+ }
+
+ // Attempt to delete using an element name that doesn't exist
+ // for this extension.
+ try {
+ nonceByLen.delete("FOO");
+ throw new RuntimeException("Accepted delete() for " +
+ "unsupported element name");
+ } catch (IOException ioe) { } // Expected result
+
+ // Now attempt to properly delete the extension data
+ nonceByLen.delete(ELEMENT_NONCE);
+ nonceData = (byte[])nonceByLen.get(ELEMENT_NONCE);
+ if (nonceData != null) {
+ throw new RuntimeException("Unexpected non-null return");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/provider/certpath/ResponderId/ResponderIdTests.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,419 @@
+/*
+ * Copyright (c) 2015, 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 8046321
+ * @summary OCSP Stapling for TLS (ResponderId tests)
+ */
+
+import java.io.*;
+import java.security.cert.*;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.util.AbstractMap;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
+import javax.security.auth.x500.X500Principal;
+import sun.security.x509.KeyIdentifier;
+import sun.security.provider.certpath.ResponderId;
+
+/*
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class ResponderIdTests {
+
+ private static final boolean debug = true;
+
+ // Source certificate created with the following command:
+ // keytool -genkeypair -alias test1 -keyalg rsa -keysize 2048 \
+ // -validity 7300 -keystore test1.jks \
+ // -dname "CN=SelfSignedResponder, OU=Validation Services, O=FakeCompany"
+ private static final String RESP_CERT_1 =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIIDQzCCAiugAwIBAgIEXTqCCjANBgkqhkiG9w0BAQsFADBSMRQwEgYDVQQKEwtG\n" +
+ "YWtlQ29tcGFueTEcMBoGA1UECxMTVmFsaWRhdGlvbiBTZXJ2aWNlczEcMBoGA1UE\n" +
+ "AxMTU2VsZlNpZ25lZFJlc3BvbmRlcjAeFw0xNDA4MTcwNDM2MzBaFw0zNDA4MTIw\n" +
+ "NDM2MzBaMFIxFDASBgNVBAoTC0Zha2VDb21wYW55MRwwGgYDVQQLExNWYWxpZGF0\n" +
+ "aW9uIFNlcnZpY2VzMRwwGgYDVQQDExNTZWxmU2lnbmVkUmVzcG9uZGVyMIIBIjAN\n" +
+ "BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApt2Cmw2k9tviLxaxE8aWNuoosWKL\n" +
+ "h+K4mNcDGKSoiChsqRqeJEnOxijDZqyFwfkaXvpAduFqYjz+Lij2HumvAjHDTui6\n" +
+ "bGcbsndRDPjvVo1S7f1oWsg7oiA8Lzmjl452S7UNBsDX5Dt1e84Xxwi40B1J2y8D\n" +
+ "FRPfYRWRlC1Z4kzqkBBa7JhANS+W8KDstFZxL4AwWH/byNwB5dl2j04ohg/Ar54e\n" +
+ "mu08PIH3hmi0pAu5wn9ariA7UA5lFWRJzvgGXV5J+QVEFuvKmeJ/Q6tU5OBJGw98\n" +
+ "zjd7F5B0iE+rJHTNF1aGaQfIorz04onV2WjH2VZA18AaMwqlY2br1SBdTQIDAQAB\n" +
+ "oyEwHzAdBgNVHQ4EFgQUG09HasSTYaTIh/CxxV/rcJV1LvowDQYJKoZIhvcNAQEL\n" +
+ "BQADggEBAIcUomNpZxGkocIzzybLyeyC6vLF1k0/unuPAHZLDP3o2JTstPhLHOCg\n" +
+ "FYw1VG2i23pjwKK2x/o80tJAOmW6vowbAPnNmtNIYO3gB/ZGiKeORoGKBCRDNvFa\n" +
+ "6ZrWxwTzT3EpVwRe7ameES0uP8+S4q2P5LhwMIMw7vGHoOQJgkAh/NUiCli1qRnJ\n" +
+ "FYd6cHMJJK5gF2FqQ7tdbA26pS06bkIEvil2M5wyKKWOydOa/pr1LgMf9KxljJ8J\n" +
+ "XlAOO/mGZGkYmWnQaQuBIDyWunWYlhsyCXMa8AScgs0uUeQp19tO7R0f03q/JXoZ\n" +
+ "1At1gZiMS7SdQaRWP5q+FunAeFWjsFE=\n" +
+ "-----END CERTIFICATE-----";
+
+ private static final String RESP_CERT_1_SUBJ =
+ "CN=SelfSignedResponder, OU=Validation Services, O=FakeCompany";
+
+ private static X509Certificate cert = null;
+
+ // The expected DER-encoding for a byName ResponderId derived
+ // from RESP_CERT_1
+ private static final byte[] EXP_NAME_ID_BYTES = {
+ -95, 84, 48, 82, 49, 20, 48, 18,
+ 6, 3, 85, 4, 10, 19, 11, 70,
+ 97, 107, 101, 67, 111, 109, 112, 97,
+ 110, 121, 49, 28, 48, 26, 6, 3,
+ 85, 4, 11, 19, 19, 86, 97, 108,
+ 105, 100, 97, 116, 105, 111, 110, 32,
+ 83, 101, 114, 118, 105, 99, 101, 115,
+ 49, 28, 48, 26, 6, 3, 85, 4,
+ 3, 19, 19, 83, 101, 108, 102, 83,
+ 105, 103, 110, 101, 100, 82, 101, 115,
+ 112, 111, 110, 100, 101, 114
+ };
+
+ // The expected DER-encoding for a byKey ResponderId derived
+ // from RESP_CERT_1
+ private static final byte[] EXP_KEY_ID_BYTES = {
+ -94, 22, 4, 20, 27, 79, 71, 106,
+ -60, -109, 97, -92, -56, -121, -16, -79,
+ -59, 95, -21, 112, -107, 117, 46, -6
+ };
+
+ // The DER encoding of a byKey ResponderId, but using an
+ // incorrect explicit tagging (CONTEXT CONSTRUCTED 3)
+ private static final byte[] INV_EXPLICIT_TAG_KEY_ID = {
+ -93, 22, 4, 20, 27, 79, 71, 106,
+ -60, -109, 97, -92, -56, -121, -16, -79,
+ -59, 95, -21, 112, -107, 117, 46, -6
+ };
+
+ // These two ResponderId objects will have objects attached to them
+ // after the pos_CtorByName and pos_CtorByKeyId tests run. Those
+ // two tests should always be the first two that run.
+ public static ResponderId respByName;
+ public static ResponderId respByKeyId;
+
+ public static void main(String[] args) throws Exception {
+ List<TestCase> testList = new ArrayList<>();
+
+ testList.add(pos_CtorByName);
+ testList.add(pos_CtorByKeyId);
+ testList.add(pos_CtorByEncoding);
+ testList.add(neg_CtorByEncoding);
+ testList.add(pos_Equality);
+ testList.add(pos_GetEncoded);
+ testList.add(pos_GetRespName);
+ testList.add(pos_GetRespKeyId);
+
+ // Load the certificate object we can use for subsequent tests
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ cert = (X509Certificate)cf.generateCertificate(
+ new ByteArrayInputStream(RESP_CERT_1.getBytes()));
+
+ System.out.println("============ Tests ============");
+ int testNo = 0;
+ int numberFailed = 0;
+ Map.Entry<Boolean, String> result;
+ for (TestCase test : testList) {
+ System.out.println("Test " + ++testNo + ": " + test.getName());
+ result = test.runTest();
+ System.out.print("Result: " + (result.getKey() ? "PASS" : "FAIL"));
+ System.out.println(" " +
+ (result.getValue() != null ? result.getValue() : ""));
+ System.out.println("-------------------------------------------");
+ if (!result.getKey()) {
+ numberFailed++;
+ }
+ }
+ System.out.println("End Results: " + (testList.size() - numberFailed) +
+ " Passed" + ", " + numberFailed + " Failed.");
+ if (numberFailed > 0) {
+ throw new RuntimeException(
+ "One or more tests failed, see test output for details");
+ }
+ }
+
+ private static void dumpHexBytes(byte[] data) {
+ if (data != null) {
+ for (int i = 0; i < data.length; i++) {
+ if (i % 16 == 0 && i != 0) {
+ System.out.print("\n");
+ }
+ System.out.print(String.format("%02X ", data[i]));
+ }
+ System.out.print("\n");
+ }
+ }
+
+ public interface TestCase {
+ String getName();
+ Map.Entry<Boolean, String> runTest();
+ }
+
+ public static final TestCase pos_CtorByName = new TestCase() {
+ @Override
+ public String getName() {
+ return "CTOR Test (by-name)";
+ }
+
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ respByName = new ResponderId(cert.getSubjectX500Principal());
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_CtorByKeyId = new TestCase() {
+ @Override
+ public String getName() {
+ return "CTOR Test (by-keyID)";
+ }
+
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ respByKeyId = new ResponderId(cert.getPublicKey());
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_CtorByEncoding = new TestCase() {
+ @Override
+ public String getName() {
+ return "CTOR Test (encoded bytes)";
+ }
+
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ ResponderId ridByNameBytes = new ResponderId(EXP_NAME_ID_BYTES);
+ ResponderId ridByKeyIdBytes = new ResponderId(EXP_KEY_ID_BYTES);
+
+ if (!ridByNameBytes.equals(respByName)) {
+ throw new RuntimeException(
+ "Equals failed: respNameFromBytes vs. respByName");
+ } else if (!ridByKeyIdBytes.equals(respByKeyId)) {
+ throw new RuntimeException(
+ "Equals failed: respKeyFromBytes vs. respByKeyId");
+ }
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase neg_CtorByEncoding = new TestCase() {
+ @Override
+ public String getName() {
+ return "CTOR Test (by encoding, unknown explicit tag)";
+ }
+
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ ResponderId ridByKeyIdBytes =
+ new ResponderId(INV_EXPLICIT_TAG_KEY_ID);
+ throw new RuntimeException("Expected IOException not thrown");
+ } catch (IOException ioe) {
+ // Make sure it's the IOException we're looking for
+ if (ioe.getMessage().contains("Invalid ResponderId content")) {
+ pass = Boolean.TRUE;
+ } else {
+ ioe.printStackTrace(System.out);
+ message = ioe.getClass().getName();
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+
+ public static final TestCase pos_Equality = new TestCase() {
+ @Override
+ public String getName() {
+ return "Simple Equality Test";
+ }
+
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+
+ try {
+ // byName ResponderId equality test
+ ResponderId compName =
+ new ResponderId(new X500Principal(RESP_CERT_1_SUBJ));
+ if (!respByName.equals(compName)) {
+ message = "ResponderId mismatch in byName comparison";
+ } else if (respByKeyId.equals(compName)) {
+ message = "Invalid ResponderId match in byKeyId comparison";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_GetEncoded = new TestCase() {
+ @Override
+ public String getName() {
+ return "Get Encoded Value";
+ }
+
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+
+ try {
+ // Pull out byName and byKey encodings, they should match
+ // the expected values
+ if (!Arrays.equals(respByName.getEncoded(), EXP_NAME_ID_BYTES)) {
+ message = "ResponderId byName encoding did not " +
+ "match expected value";
+ } else if (!Arrays.equals(respByKeyId.getEncoded(), EXP_KEY_ID_BYTES)) {
+ message = "ResponderId byKeyId encoding did not " +
+ "match expected value";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_GetRespName = new TestCase() {
+ @Override
+ public String getName() {
+ return "Get Underlying Responder Name";
+ }
+
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+
+ try {
+ // Test methods for pulling out the underlying
+ // X500Principal object
+ X500Principal testPrincipal =
+ new X500Principal(RESP_CERT_1_SUBJ);
+ if (!respByName.getResponderName().equals(testPrincipal)) {
+ message = "ResponderId Name did not match expected value";
+ } else if (respByKeyId.getResponderName() != null) {
+ message = "Non-null responder name returned from " +
+ "ResponderId constructed byKey";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase pos_GetRespKeyId = new TestCase() {
+ @Override
+ public String getName() {
+ return "Get Underlying Responder Key ID";
+ }
+
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+
+ try {
+ // Test methods for pulling out the underlying
+ // KeyIdentifier object. Note: There is a minute chance that
+ // an RSA public key, once hashed into a key ID might collide
+ // with the one extracted from the certificate used to create
+ // respByKeyId. This is so unlikely to happen it is considered
+ // virtually impossible.
+ KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
+ kpg.initialize(2048);
+ KeyPair rsaKey = kpg.generateKeyPair();
+ KeyIdentifier testKeyId = new KeyIdentifier(rsaKey.getPublic());
+
+ if (respByKeyId.getKeyIdentifier().equals(testKeyId)) {
+ message = "Unexpected match in ResponderId Key ID";
+ } else if (respByName.getKeyIdentifier() != null) {
+ message = "Non-null key ID returned from " +
+ "ResponderId constructed byName";
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+}
--- a/jdk/test/sun/security/ssl/ExtensionType/OptimalListSize.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/security/ssl/ExtensionType/OptimalListSize.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,6 +36,6 @@
public static void main(String[] args) throws Throwable {
OptimalCapacity.ofArrayList(
Class.forName("sun.security.ssl.ExtensionType"),
- "knownExtensions", 13);
+ "knownExtensions", 14);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/StatusStapling/BogusStatusRequest.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package sun.security.ssl;
+
+import java.io.IOException;
+
+final class BogusStatusRequest implements StatusRequest {
+ BogusStatusRequest() { }
+
+ @Override
+ public int length() { return 0; }
+
+ @Override
+ public void send(HandshakeOutStream s) throws IOException { }
+
+ @Override
+ public String toString() {
+ return "BogusStatusRequest";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqExtensionTests.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (CertStatusReqExtension tests)
+ * @build CertStatusReqExtensionTests BogusStatusRequest TestCase TestUtils
+ * @run main/othervm sun.security.ssl.CertStatusReqExtensionTests
+ */
+
+import java.io.IOException;
+import java.util.*;
+import java.nio.ByteBuffer;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class CertStatusReqExtensionTests {
+
+ private static final boolean debug = false;
+
+ // Default status_request extension (type = ocsp, OCSPStatusRequest
+ // with no responder IDs or extensions
+ private static final byte[] CSRE_DEF_OSR = {1, 0, 0, 0, 0};
+
+ // A status_request extension using a user-defined type (0xFF) and
+ // an underlying no-Responder ID/no-extension OCSPStatusRequest
+ private static final byte[] CSRE_TYPE_FF = {-1, 0, 0, 0, 0};
+
+ // A CertStatusReqExtension with 5 ResponderIds and 1 Extension
+ private static final byte[] CSRE_REQ_RID_EXTS = {
+ 1, 0, -13, 0, 59, -95, 57, 48,
+ 55, 49, 16, 48, 14, 6, 3, 85,
+ 4, 10, 19, 7, 83, 111, 109, 101,
+ 73, 110, 99, 49, 16, 48, 14, 6,
+ 3, 85, 4, 11, 19, 7, 83, 111,
+ 109, 101, 80, 75, 73, 49, 17, 48,
+ 15, 6, 3, 85, 4, 3, 19, 8,
+ 83, 111, 109, 101, 79, 67, 83, 80,
+ 0, 68, -95, 66, 48, 64, 49, 13,
+ 48, 11, 6, 3, 85, 4, 10, 19,
+ 4, 79, 104, 77, 121, 49, 14, 48,
+ 12, 6, 3, 85, 4, 11, 19, 5,
+ 66, 101, 97, 114, 115, 49, 15, 48,
+ 13, 6, 3, 85, 4, 11, 19, 6,
+ 84, 105, 103, 101, 114, 115, 49, 14,
+ 48, 12, 6, 3, 85, 4, 3, 19,
+ 5, 76, 105, 111, 110, 115, 0, 58,
+ -95, 56, 48, 54, 49, 16, 48, 14,
+ 6, 3, 85, 4, 10, 19, 7, 67,
+ 111, 109, 112, 97, 110, 121, 49, 13,
+ 48, 11, 6, 3, 85, 4, 11, 19,
+ 4, 87, 101, 115, 116, 49, 19, 48,
+ 17, 6, 3, 85, 4, 3, 19, 10,
+ 82, 101, 115, 112, 111, 110, 100, 101,
+ 114, 49, 0, 24, -94, 22, 4, 20,
+ -67, -36, 114, 121, 92, -79, 116, -1,
+ 102, -107, 7, -21, 18, -113, 64, 76,
+ 96, -7, -66, -63, 0, 24, -94, 22,
+ 4, 20, -51, -69, 107, -82, -39, -87,
+ 45, 25, 41, 28, -76, -68, -11, -110,
+ -94, -97, 62, 47, 58, -125, 0, 51,
+ 48, 49, 48, 47, 6, 9, 43, 6,
+ 1, 5, 5, 7, 48, 1, 2, 4,
+ 34, 4, 32, -26, -81, -120, -61, -127,
+ -79, 0, -39, -54, 49, 3, -51, -57,
+ -85, 19, -126, 94, -2, 21, 26, 98,
+ 6, 105, -35, -37, -29, -73, 101, 53,
+ 44, 15, -19
+ };
+
+ public static void main(String[] args) throws Exception {
+ Map<String, TestCase> testList =
+ new LinkedHashMap<String, TestCase>() {{
+ put("CTOR (default)", testCtorDefault);
+ put("CTOR (int, StatusRequest)", testCtorStatReqs);
+ put("CTOR (HandshakeInStream, length, getReqType, getRequest)",
+ testCtorInStream);
+ }};
+
+ TestUtils.runTests(testList);
+ }
+
+ public static final TestCase testCtorDefault = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ CertStatusReqExtension csreDef = new CertStatusReqExtension();
+ HandshakeOutStream hsout =
+ new HandshakeOutStream(null);
+ csreDef.send(hsout);
+ TestUtils.valueCheck(wrapExtData(null), hsout.toByteArray());
+
+ // The length should be 4 (2 bytes for the type, 2 for the
+ // encoding of zero-length
+ if (csreDef.length() != 4) {
+ throw new RuntimeException("Incorrect length from " +
+ "default object. Expected 4, got " +
+ csreDef.length());
+ }
+
+ // Since there's no data, there are no status_type or request
+ // data fields defined. Both should return null in this case
+ if (csreDef.getType() != null) {
+ throw new RuntimeException("Default CSRE returned " +
+ "non-null status_type");
+ } else if (csreDef.getRequest() != null) {
+ throw new RuntimeException("Default CSRE returned " +
+ "non-null request object");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testCtorStatReqs = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ HandshakeOutStream hsout =
+ new HandshakeOutStream(null);
+ StatusRequest basicStatReq = new OCSPStatusRequest();
+
+ // Create an extension using a default-style OCSPStatusRequest
+ // (no responder IDs, no extensions).
+ CertStatusReqExtension csre1 = new CertStatusReqExtension(
+ StatusRequestType.OCSP, basicStatReq);
+ csre1.send(hsout);
+ TestUtils.valueCheck(wrapExtData(CSRE_DEF_OSR),
+ hsout.toByteArray());
+ hsout.reset();
+
+ // Create the extension using a StatusRequestType not already
+ // instantiated as a static StatusRequestType
+ // (e.g. OCSP/OCSP_MULTI)
+ CertStatusReqExtension csre2 =
+ new CertStatusReqExtension(StatusRequestType.get(-1),
+ basicStatReq);
+ csre2.send(hsout);
+ TestUtils.valueCheck(wrapExtData(CSRE_TYPE_FF),
+ hsout.toByteArray());
+
+ // Create the extension using a StatusRequest that
+ // does not match the status_type field
+ // This should throw an IllegalArgumentException
+ try {
+ CertStatusReqExtension csreBadRequest =
+ new CertStatusReqExtension(StatusRequestType.OCSP,
+ new BogusStatusRequest());
+ throw new RuntimeException("Constructor accepted a " +
+ "StatusRequest that is inconsistent with " +
+ "the status_type");
+ } catch (IllegalArgumentException iae) { }
+
+ // We don't allow a null value for the StatusRequestType
+ // parameter in this constructor.
+ try {
+ CertStatusReqExtension csreBadRequest =
+ new CertStatusReqExtension(null, basicStatReq);
+ throw new RuntimeException("Constructor accepted a " +
+ "null StatusRequestType");
+ } catch (NullPointerException npe) { }
+
+ // We also don't allow a null value for the StatusRequest
+ // parameter in this constructor.
+ try {
+ CertStatusReqExtension csreBadRequest =
+ new CertStatusReqExtension(StatusRequestType.OCSP,
+ null);
+ throw new RuntimeException("Constructor accepted a " +
+ "null StatusRequest");
+ } catch (NullPointerException npe) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor that builds the ob ject using data from
+ // a HandshakeInStream
+ // This also tests the length, getReqType and getRequest methods
+ public static final TestCase testCtorInStream = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ OCSPStatusRequest osr;
+
+ try {
+ // To simulate the extension coming in a ServerHello, the
+ // type and length would already be read by HelloExtensions
+ // and there is no extension data
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(new byte[0]));
+ CertStatusReqExtension csre =
+ new CertStatusReqExtension(hsis, hsis.available());
+ // Verify length/type/request
+ if (csre.length() != 4) {
+ throw new RuntimeException("Invalid length: received " +
+ csre.length() + ", expected 4");
+ } else if (csre.getType() != null) {
+ throw new RuntimeException("Non-null type from default " +
+ "extension");
+ } else if (csre.getRequest() != null) {
+ throw new RuntimeException("Non-null request from default " +
+ "extension");
+ }
+
+ // Try the an extension with a default OCSPStatusRequest
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRE_DEF_OSR));
+ csre = new CertStatusReqExtension(hsis, hsis.available());
+ if (csre.length() != (CSRE_DEF_OSR.length + 4)) {
+ throw new RuntimeException("Invalid length: received " +
+ csre.length() + ", expected " +
+ CSRE_DEF_OSR.length + 4);
+ } else if (!csre.getType().equals(StatusRequestType.OCSP)) {
+ throw new RuntimeException("Unknown status_type: " +
+ String.format("0x%02X", csre.getType().id));
+ } else {
+ osr = (OCSPStatusRequest)csre.getRequest();
+ if (!osr.getResponderIds().isEmpty() ||
+ !osr.getExtensions().isEmpty()) {
+ throw new RuntimeException("Non-default " +
+ "OCSPStatusRequest found in extension");
+ }
+ }
+
+ // Try with a non-default extension
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRE_REQ_RID_EXTS));
+ csre = new CertStatusReqExtension(hsis, hsis.available());
+ if (csre.length() != (CSRE_REQ_RID_EXTS.length + 4)) {
+ throw new RuntimeException("Invalid length: received " +
+ csre.length() + ", expected " +
+ CSRE_REQ_RID_EXTS.length + 4);
+ } else if (!(csre.getType().equals(StatusRequestType.OCSP))) {
+ throw new RuntimeException("Unknown status_type: " +
+ String.format("0x%02X", csre.getType().id));
+ } else {
+ osr = (OCSPStatusRequest)csre.getRequest();
+ if (osr.getResponderIds().size() != 5 ||
+ osr.getExtensions().size() != 1) {
+ throw new RuntimeException("Incorrect number of " +
+ "ResponderIds or Extensions found in " +
+ "OCSPStatusRequest");
+ }
+ }
+
+ // Create a CSRE that asserts status_request and has the
+ // proper length, but really is a bunch of random junk inside
+ // In this case, it will create an UnknownStatusRequest to
+ // handle the unparseable data.
+ byte[] junkData = new byte[48];
+ Random r = new Random(System.currentTimeMillis());
+ r.nextBytes(junkData);
+ junkData[0] = 7; // Ensure it isn't a valid status_type
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(junkData));
+ csre = new CertStatusReqExtension(hsis, hsis.available());
+ StatusRequest sr = csre.getRequest();
+ if (!(sr instanceof UnknownStatusRequest)) {
+ throw new RuntimeException("Expected returned status " +
+ "request to be of type UnknownStatusRequest but " +
+ "received " + sr.getClass().getName());
+ } else if (csre.length() != (junkData.length + 4)) {
+ throw new RuntimeException("Invalid length: received " +
+ csre.length() + ", expected " +
+ junkData.length + 4);
+ }
+
+ // Set the leading byte to 1 (OCSP type) and run again
+ // It should pass the argument check and fail trying to parse
+ // the underlying StatusRequest.
+ junkData[0] = (byte)StatusRequestType.OCSP.id;
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(junkData));
+ try {
+ csre = new CertStatusReqExtension(hsis, hsis.available());
+ throw new RuntimeException("Expected CTOR exception did " +
+ "not occur");
+ } catch (IOException ioe) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Take CSRE extension data and add extension type and length decorations
+ private static byte[] wrapExtData(byte[] extData) {
+ int bufferLen = (extData != null ? extData.length : 0) + 4;
+ ByteBuffer bb = ByteBuffer.allocate(bufferLen);
+ bb.putShort((short)ExtensionType.EXT_STATUS_REQUEST.id);
+ bb.putShort((short)(extData != null ? extData.length: 0));
+ if (extData != null) {
+ bb.put(extData);
+ }
+ return bb.array();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqItemV2Tests.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,463 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (CertStatusReqItemv2 tests)
+ * @build CertStatusReqItemV2Tests BogusStatusRequest TestCase TestUtils
+ * @run main/othervm sun.security.ssl.CertStatusReqItemV2Tests
+ */
+
+import java.security.cert.*;
+import java.util.*;
+import java.nio.ByteBuffer;
+import javax.net.ssl.SSLException;
+import javax.security.auth.x500.X500Principal;
+import sun.security.provider.certpath.ResponderId;
+import sun.security.provider.certpath.OCSPNonceExtension;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class CertStatusReqItemV2Tests {
+
+ private static final boolean debug = false;
+
+ private static final byte[] DEF_CSRIV2_OCSP_MULTI_BYTES = {
+ 2, 0, 4, 0, 0, 0, 0
+ };
+
+ private static final byte[] DEF_CSRIV2_OCSP_BYTES = {
+ 1, 0, 4, 0, 0, 0, 0
+ };
+
+ // This is a CSRIV2 (ocsp_multi) that has a single
+ // responder ID and no extensions.
+ private static final byte[] CSRIV2_1RID = {
+ 2, 0, 32, 0, 28, 0, 26, -95,
+ 24, 48, 22, 49, 20, 48, 18, 6,
+ 3, 85, 4, 3, 19, 11, 79, 67,
+ 83, 80, 32, 83, 105, 103, 110, 101,
+ 114, 0 , 0
+ };
+
+ // This is a CSRIV2 (ocsp_multi) that has a single
+ // responder ID and no extensions. The request_length
+ // field is too short in this case.
+ private static final byte[] CSRIV2_LENGTH_TOO_SHORT = {
+ 2, 0, 27, 0, 28, 0, 26, -95,
+ 24, 48, 22, 49, 20, 48, 18, 6,
+ 3, 85, 4, 3, 19, 11, 79, 67,
+ 83, 80, 32, 83, 105, 103, 110, 101,
+ 114, 0 , 0
+ };
+
+ // This is a CSRIV2 (ocsp_multi) that has a single
+ // responder ID and no extensions. The request_length
+ // field is too long in this case.
+ private static final byte[] CSRIV2_LENGTH_TOO_LONG = {
+ 2, 0, 54, 0, 28, 0, 26, -95,
+ 24, 48, 22, 49, 20, 48, 18, 6,
+ 3, 85, 4, 3, 19, 11, 79, 67,
+ 83, 80, 32, 83, 105, 103, 110, 101,
+ 114, 0 , 0
+ };
+
+ // A CSRIV2 (ocsp) with one Responder ID (byName: CN=OCSP Signer)
+ // and a nonce extension (32 bytes).
+ private static final byte[] CSRIV2_OCSP_1RID_1EXT = {
+ 1, 0, 83, 0, 28, 0, 26, -95,
+ 24, 48, 22, 49, 20, 48, 18, 6,
+ 3, 85, 4, 3, 19, 11, 79, 67,
+ 83, 80, 32, 83, 105, 103, 110, 101,
+ 114, 0, 51, 48, 49, 48, 47, 6,
+ 9, 43, 6, 1, 5, 5, 7, 48,
+ 1, 2, 4, 34, 4, 32, -34, -83,
+ -66, -17, -34, -83, -66, -17, -34, -83,
+ -66, -17, -34, -83, -66, -17, -34, -83,
+ -66, -17, -34, -83, -66, -17, -34, -83,
+ -66, -17, -34, -83, -66, -17
+ };
+
+ public static void main(String[] args) throws Exception {
+ Map<String, TestCase> testList =
+ new LinkedHashMap<String, TestCase>() {{
+ put("CTOR (Default)", testCtorTypeStatReq);
+ put("CTOR (Byte array)", testCtorByteArray);
+ put("CTOR (invalid lengths)", testCtorInvalidLengths);
+ }};
+
+ TestUtils.runTests(testList);
+ }
+
+ public static final TestCase testCtorTypeStatReq = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ // Attempt to create CSRIv2 objects using null pointers
+ // for either parameter. In either case NPE should be thrown
+ CertStatusReqItemV2 csriNull;
+ try {
+ csriNull = new CertStatusReqItemV2(null,
+ new OCSPStatusRequest());
+ throw new RuntimeException("Did not catch expected NPE " +
+ "for null status_type parameter");
+ } catch (NullPointerException npe) { }
+
+ try {
+ csriNull = new CertStatusReqItemV2(StatusRequestType.OCSP,
+ null);
+ throw new RuntimeException("Did not catch expected NPE " +
+ "for null StatusRequest parameter");
+ } catch (NullPointerException npe) { }
+
+ // Create an "ocsp_multi" type request using a default
+ // (no Responder IDs, no Extensions) OCSPStatusRequest
+ CertStatusReqItemV2 csriMulti =
+ new CertStatusReqItemV2(StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest());
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ csriMulti.send(hsout);
+ TestUtils.valueCheck(DEF_CSRIV2_OCSP_MULTI_BYTES,
+ hsout.toByteArray());
+ hsout.reset();
+
+ // Create an "ocsp" type request using a default
+ // (no Responder IDs, no Extensions) OCSPStatusRequest
+ CertStatusReqItemV2 csriSingle =
+ new CertStatusReqItemV2(StatusRequestType.OCSP,
+ new OCSPStatusRequest(new LinkedList<>(),
+ new LinkedList<>()));
+ csriSingle.send(hsout);
+ TestUtils.valueCheck(DEF_CSRIV2_OCSP_BYTES,
+ hsout.toByteArray());
+
+ // Create the CertStatusRequestItemV2 with a user-defined
+ // StatusRequestType value
+ CertStatusReqItemV2 csriNine =
+ new CertStatusReqItemV2(StatusRequestType.get(9),
+ new OCSPStatusRequest(null, null));
+ if (csriNine.getType().id != 9) {
+ throw new RuntimeException("Expected status_type = 9, " +
+ "got " + csriNine.getType().id);
+ } else {
+ StatusRequest sr = csriNine.getRequest();
+ if (!(sr instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("Expected " +
+ "OCSPStatusRequest, got " +
+ sr.getClass().getName());
+ }
+ }
+
+ // Create the CertStatusRequestItemV2 with a StatusRequest
+ // that does not match the status_type argument.
+ // We expect IllegalArgumentException in this case.
+ try {
+ CertStatusReqItemV2 csriBadSR = new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new BogusStatusRequest());
+ throw new RuntimeException("Constructor accepted a " +
+ "StatusRequest that is inconsistent with " +
+ "the status_type");
+ } catch (IllegalArgumentException iae) {
+ // The expected result...nothing to do here
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor form that takes the data from a byte array
+ public static final TestCase testCtorByteArray = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ StatusRequestType sType;
+ StatusRequest sReq;
+ ResponderId checkRid =
+ new ResponderId(new X500Principal("CN=OCSP Signer"));
+ Extension checkExt = new OCSPNonceExtension(32);
+
+ CertStatusReqItemV2 csriv =
+ new CertStatusReqItemV2(CSRIV2_OCSP_1RID_1EXT);
+ sType = csriv.getType();
+ if (sType != StatusRequestType.OCSP) {
+ throw new RuntimeException("Unexpected StatusRequestType " +
+ sType.getClass().getName());
+ }
+
+ sReq = csriv.getRequest();
+ if (sReq instanceof OCSPStatusRequest) {
+ OCSPStatusRequest osr = (OCSPStatusRequest)sReq;
+ List<ResponderId> ridList = osr.getResponderIds();
+ List<Extension> extList = osr.getExtensions();
+
+ if (ridList.size() != 1 || !ridList.contains(checkRid)) {
+ throw new RuntimeException("Responder list mismatch");
+ } else if (extList.size() != 1 ||
+ !extList.get(0).getId().equals(checkExt.getId())) {
+ throw new RuntimeException("Extension list mismatch");
+ }
+ } else {
+ throw new RuntimeException("Expected OCSPStatusRequest " +
+ "from decoded bytes, got " +
+ sReq.getClass().getName());
+ }
+
+ // Create a CSRIV2 out of random data. A non-OCSP/OCSP_MULTI
+ // type will be forcibly set and the outer length field will
+ // be correct.
+ // The constructor should create a StatusRequestType object
+ // and an UnknownStatusRequest object consisting of the
+ // data segment.
+ byte[] junkData = new byte[48];
+ Random r = new Random(System.currentTimeMillis());
+ r.nextBytes(junkData);
+ junkData[0] = 7; // status_type = 7
+ junkData[1] = 0;
+ junkData[2] = 45; // request_length = 45
+ csriv = new CertStatusReqItemV2(junkData);
+
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType.id != junkData[0]) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected 7, got " + sType.id);
+ }
+ if (sReq instanceof UnknownStatusRequest) {
+ // Verify the underlying StatusRequest bytes have been
+ // preserved correctly.
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ sReq.send(hsout);
+ byte[] srDataOut = hsout.toByteArray();
+ TestUtils.valueCheck(srDataOut, junkData, 0, 3,
+ srDataOut.length);
+ } else {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected UnknownStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ // Test the parsing of the default OCSP/OCSP_MULTI extensions
+ // and make sure the underlying StatusRequestType and
+ // StatusRequest objects are correct.
+ csriv = new CertStatusReqItemV2(DEF_CSRIV2_OCSP_MULTI_BYTES);
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType != StatusRequestType.OCSP_MULTI) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected OCSP_MULTI (2), got " + sType.id);
+ }
+ if (!(sReq instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected OCSPStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ csriv = new CertStatusReqItemV2(DEF_CSRIV2_OCSP_BYTES);
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType != StatusRequestType.OCSP) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected OCSP (1), got " + sType.id);
+ }
+ if (!(sReq instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected OCSPStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testCtorInvalidLengths = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ try {
+ CertStatusReqItemV2 csriTooShort =
+ new CertStatusReqItemV2(CSRIV2_LENGTH_TOO_SHORT);
+ throw new RuntimeException("Expected exception not thrown");
+ } catch (SSLException ssle) { }
+
+ try {
+ CertStatusReqItemV2 csriTooLong =
+ new CertStatusReqItemV2(CSRIV2_LENGTH_TOO_LONG);
+ throw new RuntimeException("Expected exception not thrown");
+ } catch (SSLException ssle) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor form that takes the data from HandshakeInputStream
+ public static final TestCase testCtorInputStream = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ StatusRequestType sType;
+ StatusRequest sReq;
+ ResponderId checkRid =
+ new ResponderId(new X500Principal("CN=OCSP Signer"));
+ Extension checkExt = new OCSPNonceExtension(32);
+
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRIV2_OCSP_1RID_1EXT));
+ CertStatusReqItemV2 csriv = new CertStatusReqItemV2(hsis);
+ sType = csriv.getType();
+ if (sType != StatusRequestType.OCSP) {
+ throw new RuntimeException("Unexpected StatusRequestType " +
+ sType.getClass().getName());
+ }
+
+ sReq = csriv.getRequest();
+ if (sReq instanceof OCSPStatusRequest) {
+ OCSPStatusRequest osr = (OCSPStatusRequest)sReq;
+ List<ResponderId> ridList = osr.getResponderIds();
+ List<Extension> extList = osr.getExtensions();
+
+ if (ridList.size() != 1 || !ridList.contains(checkRid)) {
+ throw new RuntimeException("Responder list mismatch");
+ } else if (extList.size() != 1 ||
+ !extList.get(0).getId().equals(checkExt.getId())) {
+ throw new RuntimeException("Extension list mismatch");
+ }
+ } else {
+ throw new RuntimeException("Expected OCSPStatusRequest " +
+ "from decoded bytes, got " +
+ sReq.getClass().getName());
+ }
+
+ // Create a CSRIV2 out of random data. A non-OCSP/OCSP_MULTI
+ // type will be forcibly set and the outer length field will
+ // be correct.
+ // The constructor should create a StatusRequestType object
+ // and an UnknownStatusRequest object consisting of the
+ // data segment.
+ byte[] junkData = new byte[48];
+ Random r = new Random(System.currentTimeMillis());
+ r.nextBytes(junkData);
+ junkData[0] = 7; // status_type = 7
+ junkData[1] = 0;
+ junkData[2] = 45; // request_length = 45
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(junkData));
+ csriv = new CertStatusReqItemV2(hsis);
+
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType.id != junkData[0]) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected 7, got " + sType.id);
+ }
+ if (sReq instanceof UnknownStatusRequest) {
+ // Verify the underlying StatusRequest bytes have been
+ // preserved correctly.
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ sReq.send(hsout);
+ byte[] srDataOut = hsout.toByteArray();
+ TestUtils.valueCheck(srDataOut, junkData, 0, 3,
+ srDataOut.length);
+ } else {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected UnknownStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ // Test the parsing of the default OCSP/OCSP_MULTI extensions
+ // and make sure the underlying StatusRequestType and
+ // StatusRequest objects are correct.
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(
+ ByteBuffer.wrap(DEF_CSRIV2_OCSP_MULTI_BYTES));
+ csriv = new CertStatusReqItemV2(hsis);
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType != StatusRequestType.OCSP_MULTI) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected OCSP_MULTI (2), got " + sType.id);
+ }
+ if (!(sReq instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected OCSPStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(DEF_CSRIV2_OCSP_BYTES));
+ csriv = new CertStatusReqItemV2(hsis);
+ sType = csriv.getType();
+ sReq = csriv.getRequest();
+ if (sType != StatusRequestType.OCSP) {
+ throw new RuntimeException("StatusRequestType mismatch: " +
+ "expected OCSP (1), got " + sType.id);
+ }
+ if (!(sReq instanceof OCSPStatusRequest)) {
+ throw new RuntimeException("StatusRequest mismatch: " +
+ "expected OCSPStatusRequest, got " +
+ sReq.getClass().getName());
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/StatusStapling/CertStatusReqListV2ExtensionTests.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,413 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (CertStatusReqListV2Extension tests)
+ * @build CertStatusReqListV2ExtensionTests TestCase TestUtils
+ * @run main/othervm sun.security.ssl.CertStatusReqListV2ExtensionTests
+ */
+
+import java.io.IOException;
+import java.util.*;
+import java.nio.ByteBuffer;
+import javax.net.ssl.*;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class CertStatusReqListV2ExtensionTests {
+
+ private static final boolean debug = false;
+
+ // Default status_request_v2 extension with two items
+ // 1. Type = ocsp_multi, OCSPStatusRequest is default
+ // 2. Type = ocsp, OCSPStatusRequest is default
+ private static final byte[] CSRLV2_DEF = {
+ 0, 14, 2, 0, 4, 0, 0, 0,
+ 0, 1, 0, 4, 0, 0, 0, 0
+ };
+
+ // A status_request_v2 where the item list length is
+ // longer than the provided data
+ private static final byte[] CSRLV2_LEN_TOO_LONG = {
+ 0, 18, 2, 0, 4, 0, 0, 0,
+ 0, 1, 0, 4, 0, 0, 0, 0
+ };
+
+ // A status_request_v2 where the item list length is
+ // shorter than the provided data
+ private static final byte[] CSRLV2_LEN_TOO_SHORT = {
+ 0, 11, 2, 0, 4, 0, 0, 0,
+ 0, 1, 0, 4, 0, 0, 0, 0
+ };
+
+ // A status_request_v2 extension with a zero-length
+ // certificate_status_req_list (not allowed by the spec)
+ private static final byte[] CSRLV2_INVALID_ZEROLEN = {0, 0};
+
+ // A status_request_v2 extension with two items (ocsp_multi and ocsp)
+ // using OCSPStatusRequests with 5 ResponderIds and 1 Extension each.
+ private static final byte[] CSRLV2_TWO_NON_DEF_ITEMS = {
+ 2, 90, 2, 1, 42, 0, -13, 0,
+ 59, -95, 57, 48, 55, 49, 16, 48,
+ 14, 6, 3, 85, 4, 10, 19, 7,
+ 83, 111, 109, 101, 73, 110, 99, 49,
+ 16, 48, 14, 6, 3, 85, 4, 11,
+ 19, 7, 83, 111, 109, 101, 80, 75,
+ 73, 49, 17, 48, 15, 6, 3, 85,
+ 4, 3, 19, 8, 83, 111, 109, 101,
+ 79, 67, 83, 80, 0, 68, -95, 66,
+ 48, 64, 49, 13, 48, 11, 6, 3,
+ 85, 4, 10, 19, 4, 79, 104, 77,
+ 121, 49, 14, 48, 12, 6, 3, 85,
+ 4, 11, 19, 5, 66, 101, 97, 114,
+ 115, 49, 15, 48, 13, 6, 3, 85,
+ 4, 11, 19, 6, 84, 105, 103, 101,
+ 114, 115, 49, 14, 48, 12, 6, 3,
+ 85, 4, 3, 19, 5, 76, 105, 111,
+ 110, 115, 0, 58, -95, 56, 48, 54,
+ 49, 16, 48, 14, 6, 3, 85, 4,
+ 10, 19, 7, 67, 111, 109, 112, 97,
+ 110, 121, 49, 13, 48, 11, 6, 3,
+ 85, 4, 11, 19, 4, 87, 101, 115,
+ 116, 49, 19, 48, 17, 6, 3, 85,
+ 4, 3, 19, 10, 82, 101, 115, 112,
+ 111, 110, 100, 101, 114, 49, 0, 24,
+ -94, 22, 4, 20, -67, -36, 114, 121,
+ 92, -79, 116, -1, 102, -107, 7, -21,
+ 18, -113, 64, 76, 96, -7, -66, -63,
+ 0, 24, -94, 22, 4, 20, -51, -69,
+ 107, -82, -39, -87, 45, 25, 41, 28,
+ -76, -68, -11, -110, -94, -97, 62, 47,
+ 58, -125, 0, 51, 48, 49, 48, 47,
+ 6, 9, 43, 6, 1, 5, 5, 7,
+ 48, 1, 2, 4, 34, 4, 32, -26,
+ -81, -120, -61, -127, -79, 0, -39, -54,
+ 49, 3, -51, -57, -85, 19, -126, 94,
+ -2, 21, 26, 98, 6, 105, -35, -37,
+ -29, -73, 101, 53, 44, 15, -19, 1,
+ 1, 42, 0, -13, 0, 59, -95, 57,
+ 48, 55, 49, 16, 48, 14, 6, 3,
+ 85, 4, 10, 19, 7, 83, 111, 109,
+ 101, 73, 110, 99, 49, 16, 48, 14,
+ 6, 3, 85, 4, 11, 19, 7, 83,
+ 111, 109, 101, 80, 75, 73, 49, 17,
+ 48, 15, 6, 3, 85, 4, 3, 19,
+ 8, 83, 111, 109, 101, 79, 67, 83,
+ 80, 0, 68, -95, 66, 48, 64, 49,
+ 13, 48, 11, 6, 3, 85, 4, 10,
+ 19, 4, 79, 104, 77, 121, 49, 14,
+ 48, 12, 6, 3, 85, 4, 11, 19,
+ 5, 66, 101, 97, 114, 115, 49, 15,
+ 48, 13, 6, 3, 85, 4, 11, 19,
+ 6, 84, 105, 103, 101, 114, 115, 49,
+ 14, 48, 12, 6, 3, 85, 4, 3,
+ 19, 5, 76, 105, 111, 110, 115, 0,
+ 58, -95, 56, 48, 54, 49, 16, 48,
+ 14, 6, 3, 85, 4, 10, 19, 7,
+ 67, 111, 109, 112, 97, 110, 121, 49,
+ 13, 48, 11, 6, 3, 85, 4, 11,
+ 19, 4, 87, 101, 115, 116, 49, 19,
+ 48, 17, 6, 3, 85, 4, 3, 19,
+ 10, 82, 101, 115, 112, 111, 110, 100,
+ 101, 114, 49, 0, 24, -94, 22, 4,
+ 20, -67, -36, 114, 121, 92, -79, 116,
+ -1, 102, -107, 7, -21, 18, -113, 64,
+ 76, 96, -7, -66, -63, 0, 24, -94,
+ 22, 4, 20, -51, -69, 107, -82, -39,
+ -87, 45, 25, 41, 28, -76, -68, -11,
+ -110, -94, -97, 62, 47, 58, -125, 0,
+ 51, 48, 49, 48, 47, 6, 9, 43,
+ 6, 1, 5, 5, 7, 48, 1, 2,
+ 4, 34, 4, 32, -26, -81, -120, -61,
+ -127, -79, 0, -39, -54, 49, 3, -51,
+ -57, -85, 19, -126, 94, -2, 21, 26,
+ 98, 6, 105, -35, -37, -29, -73, 101,
+ 53, 44, 15, -19
+ };
+
+ public static void main(String[] args) throws Exception {
+ Map<String, TestCase> testList =
+ new LinkedHashMap<String, TestCase>() {{
+ put("CTOR (default)", testCtorDefault);
+ put("CTOR (List<CertStatusReqItemV2)", testCtorItemList);
+ put("CTOR (HandshakeInStream, getRequestList",
+ testCtorInStream);
+ }};
+
+ TestUtils.runTests(testList);
+ }
+
+ public static final TestCase testCtorDefault = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ CertStatusReqListV2Extension csrlV2 =
+ new CertStatusReqListV2Extension();
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ csrlV2.send(hsout);
+ TestUtils.valueCheck(wrapExtData(new byte[0]),
+ hsout.toByteArray());
+
+ // The length should be 4 (2 bytes for the type, 2 for the
+ // encoding of zero-length
+ if (csrlV2.length() != 4) {
+ throw new RuntimeException("Incorrect length from " +
+ "default object. Expected 4, got " +
+ csrlV2.length());
+ }
+
+ // Since there's no data, there are no status_type or request
+ // data fields defined. An empty, unmodifiable list should be
+ // returned when obtained from the extension.
+ List<CertStatusReqItemV2> itemList = csrlV2.getRequestItems();
+ if (!itemList.isEmpty()) {
+ throw new RuntimeException("Default CSRLV2 returned " +
+ "non-empty request list");
+ } else {
+ try {
+ itemList.add(new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest()));
+ throw new RuntimeException("Returned itemList is " +
+ "modifiable!");
+ } catch (UnsupportedOperationException uoe) { }
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ public static final TestCase testCtorItemList = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ OCSPStatusRequest osr = new OCSPStatusRequest();
+ List<CertStatusReqItemV2> noItems = Collections.emptyList();
+ List<CertStatusReqItemV2> defList =
+ new ArrayList<CertStatusReqItemV2>() {{
+ add(new CertStatusReqItemV2(StatusRequestType.OCSP_MULTI, osr));
+ add(new CertStatusReqItemV2(StatusRequestType.OCSP, osr));
+ }};
+ List<CertStatusReqItemV2> unknownTypesList =
+ new ArrayList<CertStatusReqItemV2>() {{
+ add(new CertStatusReqItemV2(StatusRequestType.get(8),
+ new UnknownStatusRequest(new byte[0])));
+ add(new CertStatusReqItemV2(StatusRequestType.get(12),
+ new UnknownStatusRequest(new byte[5])));
+ }};
+
+ try {
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ StatusRequest basicStatReq = new OCSPStatusRequest();
+
+ // Create an extension using a default-style OCSPStatusRequest
+ // (no responder IDs, no extensions).
+ CertStatusReqListV2Extension csrlv2 =
+ new CertStatusReqListV2Extension(defList);
+ csrlv2.send(hsout);
+ TestUtils.valueCheck(wrapExtData(CSRLV2_DEF),
+ hsout.toByteArray());
+ hsout.reset();
+
+ // Create the extension using a StatusRequestType not already
+ // instantiated as a static StatusRequestType
+ // (e.g. OCSP/OCSP_MULTI)
+ csrlv2 = new CertStatusReqListV2Extension(unknownTypesList);
+ List<CertStatusReqItemV2> itemList = csrlv2.getRequestItems();
+ if (itemList.size() != unknownTypesList.size()) {
+ throw new RuntimeException("Custom CSRLV2 returned " +
+ "an incorrect number of items: expected " +
+ unknownTypesList.size() + ", got " +
+ itemList.size());
+ } else {
+ // Verify that the list is unmodifiable
+ try {
+ itemList.add(new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest()));
+ throw new RuntimeException("Returned itemList is " +
+ "modifiable!");
+ } catch (UnsupportedOperationException uoe) { }
+ }
+
+ // Pass a null value for the item list. This should throw
+ // an exception
+ try {
+ CertStatusReqListV2Extension csrlv2Null =
+ new CertStatusReqListV2Extension(null);
+ throw new RuntimeException("Constructor accepted a " +
+ "null request list");
+ } catch (NullPointerException npe) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor that builds the ob ject using data from
+ // a HandshakeInStream
+ // This also tests the length, getReqType and getRequest methods
+ public static final TestCase testCtorInStream = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ OCSPStatusRequest osr;
+ CertStatusReqListV2Extension csrlv2;
+
+ try {
+ // To simulate the extension coming in a ServerHello, the
+ // type and length would already be read by HelloExtensions
+ // and there is no extension data
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(new byte[0]));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+
+ // Verify length/request list
+ if (csrlv2.length() != 4) {
+ throw new RuntimeException("Invalid length: received " +
+ csrlv2.length() + ", expected 4");
+ } else {
+ List<CertStatusReqItemV2> itemList =
+ csrlv2.getRequestItems();
+ if (!itemList.isEmpty()) {
+ throw new RuntimeException("Default CSRLV2 returned " +
+ "non-empty request list");
+ } else {
+ try {
+ itemList.add(new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest()));
+ throw new RuntimeException("Returned itemList is " +
+ "modifiable!");
+ } catch (UnsupportedOperationException uoe) { }
+ }
+ }
+
+ // Try the an extension with our basic client-generated
+ // status_request_v2 (2 items, ocsp_multi and ocsp, each with
+ // a default OCSPStatusRequest
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRLV2_DEF));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+ if (csrlv2.length() != (CSRLV2_DEF.length + 4)) {
+ throw new RuntimeException("Invalid length: received " +
+ csrlv2.length() + ", expected " +
+ CSRLV2_DEF.length + 4);
+ } else {
+ List<CertStatusReqItemV2> itemList =
+ csrlv2.getRequestItems();
+ if (itemList.size() != 2) {
+ throw new RuntimeException("Unexpected number of " +
+ "items request list, expected 2, got " +
+ itemList.size());
+ } else {
+ try {
+ itemList.add(new CertStatusReqItemV2(
+ StatusRequestType.OCSP_MULTI,
+ new OCSPStatusRequest()));
+ throw new RuntimeException("Returned itemList is " +
+ "modifiable!");
+ } catch (UnsupportedOperationException uoe) { }
+ }
+ }
+
+ // Try incoming data with an illegal zero-length
+ // certificate_status_req_list
+ try {
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(
+ ByteBuffer.wrap(CSRLV2_INVALID_ZEROLEN));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+ throw new RuntimeException("Unxpected successful " +
+ "object construction");
+ } catch (SSLException ssle) { }
+
+ // Try extensions where the certificate_status_req_list length
+ // is either too long or too short
+ try {
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRLV2_LEN_TOO_LONG));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+ throw new RuntimeException("Unxpected successful " +
+ "object construction");
+ } catch (SSLException ssle) { }
+
+ try {
+ hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(CSRLV2_LEN_TOO_SHORT));
+ csrlv2 = new CertStatusReqListV2Extension(hsis,
+ hsis.available());
+ throw new RuntimeException("Unxpected successful " +
+ "object construction");
+ } catch (SSLException ssle) { }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Take CSRE extension data and add extension type and length decorations
+ private static byte[] wrapExtData(byte[] extData) {
+ int bufferLen = extData.length + 4;
+ ByteBuffer bb = ByteBuffer.allocate(bufferLen);
+
+ bb.putShort((short)ExtensionType.EXT_STATUS_REQUEST_V2.id);
+ bb.putShort((short)extData.length);
+ if (extData.length != 0) {
+ bb.put(extData);
+ }
+ return bb.array();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/StatusStapling/OCSPStatusRequestTests.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,340 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (OCSPStatusRequestTests tests)
+ * @build OCSPStatusRequestTests TestCase TestUtils
+ * @run main/othervm sun.security.ssl.OCSPStatusRequestTests
+ */
+
+import java.security.cert.*;
+import java.util.*;
+import java.nio.ByteBuffer;
+import javax.security.auth.x500.X500Principal;
+import sun.security.provider.certpath.ResponderId;
+import sun.security.provider.certpath.OCSPNonceExtension;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class OCSPStatusRequestTests {
+
+ private static final boolean debug = false;
+
+ // The default (no Responder IDs or Extensions)
+ private static final byte[] DEF_OCSPREQ_BYTES = { 0, 0, 0, 0 };
+
+ // OCSP Extension with one Responder ID (byName: CN=OCSP Signer) and
+ // a nonce extension (32 bytes).
+ private static final byte[] OCSPREQ_1RID_1EXT = {
+ 0, 28, 0, 26, -95, 24, 48, 22,
+ 49, 20, 48, 18, 6, 3, 85, 4,
+ 3, 19, 11, 79, 67, 83, 80, 32,
+ 83, 105, 103, 110, 101, 114, 0, 51,
+ 48, 49, 48, 47, 6, 9, 43, 6,
+ 1, 5, 5, 7, 48, 1, 2, 4,
+ 34, 4, 32, -34, -83, -66, -17, -34,
+ -83, -66, -17, -34, -83, -66, -17, -34,
+ -83, -66, -17, -34, -83, -66, -17, -34,
+ -83, -66, -17, -34, -83, -66, -17, -34,
+ -83, -66, -17
+ };
+
+ public static void main(String[] args) throws Exception {
+ Map<String, TestCase> testList =
+ new LinkedHashMap<String, TestCase>() {{
+ put("CTOR (default)", testCtorDefault);
+ put("CTOR (Responder Id and Extension)", testCtorRidsExts);
+ put("CTOR (HandshakeInStream)", testCtorInStream);
+ put("CTOR (byte array)", testCtorByteArray);
+ put("Length tests", testLength);
+ put("Equals tests", testEquals);
+ }};
+
+ TestUtils.runTests(testList);
+ }
+
+ // Test the default constructor and its encoding
+ public static final TestCase testCtorDefault = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ // Create a OCSPStatusRequest with a single ResponderId
+ // and Extension
+ OCSPStatusRequest osrDefault = new OCSPStatusRequest();
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ osrDefault.send(hsout);
+ System.out.println("Encoded Result:");
+ TestUtils.dumpBytes(hsout.toByteArray());
+
+ TestUtils.valueCheck(DEF_OCSPREQ_BYTES, hsout.toByteArray());
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor form that allows the user to specify zero
+ // or more ResponderId objects and/or Extensions
+ public static final TestCase testCtorRidsExts = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ List<ResponderId> ridList = new LinkedList<ResponderId>() {{
+ add(new ResponderId(new X500Principal("CN=OCSP Signer")));
+ }};
+ List<Extension> extList = new LinkedList<Extension>() {{
+ add(new OCSPNonceExtension(32));
+ }};
+
+ // Default-style OCSPStatusRequest using both empty Lists and
+ // null inputs
+ OCSPStatusRequest osrDef1 =
+ new OCSPStatusRequest(new LinkedList<ResponderId>(),
+ null);
+ OCSPStatusRequest osrDef2 =
+ new OCSPStatusRequest(null,
+ new LinkedList<Extension>());
+ HandshakeOutStream hsout = new HandshakeOutStream(null);
+ osrDef1.send(hsout);
+ System.out.println("Encoded Result:");
+ TestUtils.dumpBytes(hsout.toByteArray());
+ TestUtils.valueCheck(DEF_OCSPREQ_BYTES, hsout.toByteArray());
+
+ hsout.reset();
+ osrDef2.send(hsout);
+ System.out.println("Encoded Result:");
+ TestUtils.dumpBytes(hsout.toByteArray());
+ TestUtils.valueCheck(DEF_OCSPREQ_BYTES, hsout.toByteArray());
+
+ hsout.reset();
+ OCSPStatusRequest osrWithItems =
+ new OCSPStatusRequest(ridList, extList);
+ osrWithItems.send(hsout);
+ System.out.println("Encoded Result:");
+ byte[] encodedData = hsout.toByteArray();
+ TestUtils.dumpBytes(encodedData);
+ // Check everything except the last 32 bytes (nonce data)
+ TestUtils.valueCheck(OCSPREQ_1RID_1EXT, encodedData, 0, 0,
+ encodedData.length - 32);
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor that builds the ob ject using data from
+ // a HandshakeInStream
+ public static final TestCase testCtorInStream = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ ResponderId checkRid =
+ new ResponderId(new X500Principal("CN=OCSP Signer"));
+ Extension checkExt = new OCSPNonceExtension(32);
+
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(OCSPREQ_1RID_1EXT));
+ OCSPStatusRequest osr = new OCSPStatusRequest(hsis);
+
+ List<ResponderId> ridList = osr.getResponderIds();
+ List<Extension> extList = osr.getExtensions();
+
+ if (ridList.size() != 1 || !ridList.contains(checkRid)) {
+ throw new RuntimeException("Responder list mismatch");
+ } else if (extList.size() != 1 ||
+ !extList.get(0).getId().equals(checkExt.getId())) {
+ throw new RuntimeException("Extension list mismatch");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the constructor form that takes the data from a byte array
+ public static final TestCase testCtorByteArray = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ ResponderId checkRid =
+ new ResponderId(new X500Principal("CN=OCSP Signer"));
+ Extension checkExt = new OCSPNonceExtension(32);
+
+ OCSPStatusRequest osr =
+ new OCSPStatusRequest(OCSPREQ_1RID_1EXT);
+
+ List<ResponderId> ridList = osr.getResponderIds();
+ List<Extension> extList = osr.getExtensions();
+
+ if (ridList.size() != 1 || !ridList.contains(checkRid)) {
+ throw new RuntimeException("Responder list mismatch");
+ } else if (extList.size() != 1 ||
+ !extList.get(0).getId().equals(checkExt.getId())) {
+ throw new RuntimeException("Extension list mismatch");
+ }
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the length functions for both default and non-default
+ // OCSPStatusRequest objects
+ public static final TestCase testLength = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(OCSPREQ_1RID_1EXT));
+ OCSPStatusRequest osr = new OCSPStatusRequest(hsis);
+ OCSPStatusRequest osrDefault = new OCSPStatusRequest();
+
+ if (osrDefault.length() != DEF_OCSPREQ_BYTES.length) {
+ throw new RuntimeException("Invalid length for default: " +
+ "Expected" + DEF_OCSPREQ_BYTES.length +
+ ", received " + osrDefault.length());
+ } else if (osr.length() != OCSPREQ_1RID_1EXT.length) {
+ throw new RuntimeException("Invalid length for default: " +
+ "Expected" + OCSPREQ_1RID_1EXT.length +
+ ", received " + osr.length());
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test the equals method with default and non-default objects
+ public static final TestCase testEquals = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ try {
+ // Make two different lists with the same ResponderId values
+ // and also make a extension list
+ List<ResponderId> ridList1 = new LinkedList<ResponderId>() {{
+ add(new ResponderId(new X500Principal("CN=OCSP Signer")));
+ }};
+ List<ResponderId> ridList2 = new LinkedList<ResponderId>() {{
+ add(new ResponderId(new X500Principal("CN=OCSP Signer")));
+ }};
+ List<Extension> extList = new LinkedList<Extension>() {{
+ add(new OCSPNonceExtension(32));
+ }};
+
+ // We expect two default OCSP objects to be equal
+ OCSPStatusRequest osrDefault = new OCSPStatusRequest();
+ if (!osrDefault.equals(new OCSPStatusRequest())) {
+ throw new RuntimeException("Default OCSPStatusRequest" +
+ " equality test failed");
+ }
+
+ // null test (expect false return)
+ if (osrDefault.equals(null)) {
+ throw new RuntimeException("OCSPStatusRequest matched" +
+ " unexpectedly");
+ }
+
+ // Self-reference test
+ OCSPStatusRequest osrSelfRef = osrDefault;
+ if (!osrDefault.equals(osrSelfRef)) {
+ throw new RuntimeException("Default OCSPStatusRequest" +
+ " equality test failed");
+ }
+
+ // Two OCSPStatusRequests with matching ResponderIds should
+ // be considered equal
+ OCSPStatusRequest osrByList1 =
+ new OCSPStatusRequest(ridList1, null);
+ OCSPStatusRequest osrByList2 = new OCSPStatusRequest(ridList2,
+ Collections.emptyList());
+ if (!osrByList1.equals(osrByList2)) {
+ throw new RuntimeException("Single Responder ID " +
+ "OCSPStatusRequest equality test failed");
+ }
+
+ // We expect OCSPStatusRequests with different nonces to be
+ // considered unequal.
+ HandshakeInStream hsis = new HandshakeInStream();
+ hsis.incomingRecord(ByteBuffer.wrap(OCSPREQ_1RID_1EXT));
+ OCSPStatusRequest osrStream = new OCSPStatusRequest(hsis);
+ OCSPStatusRequest osrRidExt = new OCSPStatusRequest(ridList1,
+ extList);
+ if (osrStream.equals(osrRidExt)) {
+ throw new RuntimeException("OCSPStatusRequest matched" +
+ " unexpectedly");
+ }
+
+ pass = Boolean.TRUE;
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/StatusStapling/StatusResponseManagerTests.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,455 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package sun.security.ssl;
+
+/*
+ * @test
+ * @bug 8046321
+ * @summary OCSP Stapling for TLS (StatusResponseManager tests)
+ * @library ../../../../java/security/testlibrary
+ * @build CertificateBuilder SimpleOCSPServer
+ * @build StatusResponseManagerTests TestCase TestUtils
+ * @run main/othervm -Djavax.net.debug=ssl:respmgr
+ * sun.security.ssl.StatusResponseManagerTests
+ */
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.security.cert.*;
+import java.util.*;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.KeyStore;
+import java.security.PublicKey;
+import java.util.concurrent.TimeUnit;
+
+import sun.security.testlibrary.SimpleOCSPServer;
+import sun.security.testlibrary.CertificateBuilder;
+
+/*
+ * Checks that the hash value for a certificate's issuer name is generated
+ * correctly. Requires any certificate that is not self-signed.
+ *
+ * NOTE: this test uses Sun private classes which are subject to change.
+ */
+public class StatusResponseManagerTests {
+
+ private static final boolean debug = true;
+ private static final boolean ocspDebug = false;
+
+ // PKI components we will need for this test
+ static String passwd = "passphrase";
+ static String ROOT_ALIAS = "root";
+ static String INT_ALIAS = "intermediate";
+ static String SSL_ALIAS = "ssl";
+ static KeyStore rootKeystore; // Root CA Keystore
+ static KeyStore intKeystore; // Intermediate CA Keystore
+ static KeyStore serverKeystore; // SSL Server Keystore
+ static KeyStore trustStore; // SSL Client trust store
+ static X509Certificate rootCert;
+ static X509Certificate intCert;
+ static X509Certificate sslCert;
+ static SimpleOCSPServer rootOcsp; // Root CA OCSP Responder
+ static int rootOcspPort; // Port number for root OCSP
+ static SimpleOCSPServer intOcsp; // Intermediate CA OCSP Responder
+ static int intOcspPort; // Port number for intermed. OCSP
+
+ static X509Certificate[] chain;
+
+ public static void main(String[] args) throws Exception {
+ Map<String, TestCase> testList =
+ new LinkedHashMap<String, TestCase>() {{
+ put("Basic OCSP fetch test", testOcspFetch);
+ put("Clear StatusResponseManager cache", testClearSRM);
+ put("Basic OCSP_MULTI fetch test", testOcspMultiFetch);
+ put("Test Cache Expiration", testCacheExpiry);
+ }};
+
+ // Create the CAs and OCSP responders
+ createPKI();
+
+ // Grab the certificates and make a chain we can reuse for tests
+ sslCert = (X509Certificate)serverKeystore.getCertificate(SSL_ALIAS);
+ intCert = (X509Certificate)intKeystore.getCertificate(INT_ALIAS);
+ rootCert = (X509Certificate)rootKeystore.getCertificate(ROOT_ALIAS);
+ chain = new X509Certificate[3];
+ chain[0] = sslCert;
+ chain[1] = intCert;
+ chain[2] = rootCert;
+
+ TestUtils.runTests(testList);
+
+ intOcsp.stop();
+ rootOcsp.stop();
+ }
+
+ // Test a simple RFC 6066 server-side fetch
+ public static final TestCase testOcspFetch = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ StatusResponseManager srm = new StatusResponseManager();
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ StatusRequest oReq = new OCSPStatusRequest();
+
+ try {
+ // Get OCSP responses for non-root certs in the chain
+ Map<X509Certificate, byte[]> responseMap = srm.get(
+ StatusRequestType.OCSP, oReq, chain, 5000,
+ TimeUnit.MILLISECONDS);
+
+ // There should be one entry in the returned map and
+ // one entry in the cache when the operation is complete.
+ if (responseMap.size() != 1) {
+ message = "Incorrect number of responses: expected 1, got "
+ + responseMap.size();
+ } else if (!responseMap.containsKey(sslCert)) {
+ message = "Response map key is incorrect, expected " +
+ sslCert.getSubjectX500Principal().toString();
+ } else if (srm.size() != 1) {
+ message = "Incorrect number of cache entries: " +
+ "expected 1, got " + srm.size();
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test clearing the StatusResponseManager cache.
+ public static final TestCase testClearSRM = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ StatusResponseManager srm = new StatusResponseManager();
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ StatusRequest oReq = new OCSPStatusRequest();
+
+ try {
+ // Get OCSP responses for non-root certs in the chain
+ srm.get(StatusRequestType.OCSP_MULTI, oReq, chain, 5000,
+ TimeUnit.MILLISECONDS);
+
+ // There should be two entries in the returned map and
+ // two entries in the cache when the operation is complete.
+ if (srm.size() != 2) {
+ message = "Incorrect number of responses: expected 2, got "
+ + srm.size();
+ } else {
+ // Next, clear the SRM, then check the size again
+ srm.clear();
+ if (srm.size() != 0) {
+ message = "Incorrect number of responses: expected 0," +
+ " got " + srm.size();
+ } else {
+ pass = Boolean.TRUE;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test a simple RFC 6961 server-side fetch
+ public static final TestCase testOcspMultiFetch = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ StatusResponseManager srm = new StatusResponseManager();
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ StatusRequest oReq = new OCSPStatusRequest();
+
+ try {
+ // Get OCSP responses for non-root certs in the chain
+ Map<X509Certificate, byte[]> responseMap = srm.get(
+ StatusRequestType.OCSP_MULTI, oReq, chain, 5000,
+ TimeUnit.MILLISECONDS);
+
+ // There should be two entries in the returned map and
+ // two entries in the cache when the operation is complete.
+ if (responseMap.size() != 2) {
+ message = "Incorrect number of responses: expected 2, got "
+ + responseMap.size();
+ } else if (!responseMap.containsKey(sslCert) ||
+ !responseMap.containsKey(intCert)) {
+ message = "Response map keys are incorrect, expected " +
+ sslCert.getSubjectX500Principal().toString() +
+ " and " +
+ intCert.getSubjectX500Principal().toString();
+ } else if (srm.size() != 2) {
+ message = "Incorrect number of cache entries: " +
+ "expected 2, got " + srm.size();
+ } else {
+ pass = Boolean.TRUE;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ // Test cache expiration
+ public static final TestCase testCacheExpiry = new TestCase() {
+ @Override
+ public Map.Entry<Boolean, String> runTest() {
+ // For this test, we will set the cache expiry to 5 seconds
+ System.setProperty("jdk.tls.stapling.cacheLifetime", "5");
+ StatusResponseManager srm = new StatusResponseManager();
+ Boolean pass = Boolean.FALSE;
+ String message = null;
+ StatusRequest oReq = new OCSPStatusRequest();
+
+ try {
+ // Get OCSP responses for non-root certs in the chain
+ srm.get(StatusRequestType.OCSP_MULTI, oReq, chain, 5000,
+ TimeUnit.MILLISECONDS);
+
+ // There should be two entries in the returned map and
+ // two entries in the cache when the operation is complete.
+ if (srm.size() != 2) {
+ message = "Incorrect number of responses: expected 2, got "
+ + srm.size();
+ } else {
+ // Next, wait for more than 5 seconds so the responses
+ // in the SRM will expire.
+ Thread.sleep(7000);
+ if (srm.size() != 0) {
+ message = "Incorrect number of responses: expected 0," +
+ " got " + srm.size();
+ } else {
+ pass = Boolean.TRUE;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ message = e.getClass().getName();
+ }
+
+ // Set the cache lifetime back to the default
+ System.setProperty("jdk.tls.stapling.cacheLifetime", "");
+ return new AbstractMap.SimpleEntry<>(pass, message);
+ }
+ };
+
+ /**
+ * Creates the PKI components necessary for this test, including
+ * Root CA, Intermediate CA and SSL server certificates, the keystores
+ * for each entity, a client trust store, and starts the OCSP responders.
+ */
+ private static void createPKI() throws Exception {
+ CertificateBuilder cbld = new CertificateBuilder();
+ KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ keyGen.initialize(2048);
+ KeyStore.Builder keyStoreBuilder =
+ KeyStore.Builder.newInstance("PKCS12", null,
+ new KeyStore.PasswordProtection(passwd.toCharArray()));
+
+ // Generate Root, IntCA, EE keys
+ KeyPair rootCaKP = keyGen.genKeyPair();
+ log("Generated Root CA KeyPair");
+ KeyPair intCaKP = keyGen.genKeyPair();
+ log("Generated Intermediate CA KeyPair");
+ KeyPair sslKP = keyGen.genKeyPair();
+ log("Generated SSL Cert KeyPair");
+
+ // Set up the Root CA Cert
+ cbld.setSubjectName("CN=Root CA Cert, O=SomeCompany");
+ cbld.setPublicKey(rootCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("1"));
+ // Make a 3 year validity starting from 60 days ago
+ long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60);
+ long end = start + TimeUnit.DAYS.toMillis(1085);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, rootCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ // Make our Root CA Cert!
+ X509Certificate rootCert = cbld.build(null, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Root CA Created:\n" + certInfo(rootCert));
+
+ // Now build a keystore and add the keys and cert
+ rootKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] rootChain = {rootCert};
+ rootKeystore.setKeyEntry(ROOT_ALIAS, rootCaKP.getPrivate(),
+ passwd.toCharArray(), rootChain);
+
+ // Now fire up the OCSP responder
+ rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null);
+ rootOcsp.enableLog(ocspDebug);
+ rootOcsp.setNextUpdateInterval(3600);
+ rootOcsp.start();
+ Thread.sleep(1000); // Give the server a second to start up
+ rootOcspPort = rootOcsp.getPort();
+ String rootRespURI = "http://localhost:" + rootOcspPort;
+ log("Root OCSP Responder URI is " + rootRespURI);
+
+ // Now that we have the root keystore and OCSP responder we can
+ // create our intermediate CA.
+ cbld.reset();
+ cbld.setSubjectName("CN=Intermediate CA Cert, O=SomeCompany");
+ cbld.setPublicKey(intCaKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("100"));
+ // Make a 2 year validity starting from 30 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);
+ end = start + TimeUnit.DAYS.toMillis(730);
+ cbld.setValidity(new Date(start), new Date(end));
+ addCommonExts(cbld, intCaKP.getPublic(), rootCaKP.getPublic());
+ addCommonCAExts(cbld);
+ cbld.addAIAExt(Collections.singletonList(rootRespURI));
+ // Make our Intermediate CA Cert!
+ X509Certificate intCaCert = cbld.build(rootCert, rootCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("Intermediate CA Created:\n" + certInfo(intCaCert));
+
+ // Provide intermediate CA cert revocation info to the Root CA
+ // OCSP responder.
+ Map<BigInteger, SimpleOCSPServer.CertStatusInfo> revInfo =
+ new HashMap<>();
+ revInfo.put(intCaCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ rootOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ intKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] intChain = {intCaCert, rootCert};
+ intKeystore.setKeyEntry(INT_ALIAS, intCaKP.getPrivate(),
+ passwd.toCharArray(), intChain);
+ intKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // Now fire up the Intermediate CA OCSP responder
+ intOcsp = new SimpleOCSPServer(intKeystore, passwd,
+ INT_ALIAS, null);
+ intOcsp.enableLog(ocspDebug);
+ intOcsp.setNextUpdateInterval(3600);
+ intOcsp.start();
+ Thread.sleep(1000);
+ intOcspPort = intOcsp.getPort();
+ String intCaRespURI = "http://localhost:" + intOcspPort;
+ log("Intermediate CA OCSP Responder URI is " + intCaRespURI);
+
+ // Last but not least, let's make our SSLCert and add it to its own
+ // Keystore
+ cbld.reset();
+ cbld.setSubjectName("CN=SSLCertificate, O=SomeCompany");
+ cbld.setPublicKey(sslKP.getPublic());
+ cbld.setSerialNumber(new BigInteger("4096"));
+ // Make a 1 year validity starting from 7 days ago
+ start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7);
+ end = start + TimeUnit.DAYS.toMillis(365);
+ cbld.setValidity(new Date(start), new Date(end));
+
+ // Add extensions
+ addCommonExts(cbld, sslKP.getPublic(), intCaKP.getPublic());
+ boolean[] kuBits = {true, false, true, false, false, false,
+ false, false, false};
+ cbld.addKeyUsageExt(kuBits);
+ List<String> ekuOids = new ArrayList<>();
+ ekuOids.add("1.3.6.1.5.5.7.3.1");
+ ekuOids.add("1.3.6.1.5.5.7.3.2");
+ cbld.addExtendedKeyUsageExt(ekuOids);
+ cbld.addSubjectAltNameDNSExt(Collections.singletonList("localhost"));
+ cbld.addAIAExt(Collections.singletonList(intCaRespURI));
+ // Make our SSL Server Cert!
+ X509Certificate sslCert = cbld.build(intCaCert, intCaKP.getPrivate(),
+ "SHA256withRSA");
+ log("SSL Certificate Created:\n" + certInfo(sslCert));
+
+ // Provide SSL server cert revocation info to the Intermeidate CA
+ // OCSP responder.
+ revInfo = new HashMap<>();
+ revInfo.put(sslCert.getSerialNumber(),
+ new SimpleOCSPServer.CertStatusInfo(
+ SimpleOCSPServer.CertStatus.CERT_STATUS_GOOD));
+ intOcsp.updateStatusDb(revInfo);
+
+ // Now build a keystore and add the keys, chain and root cert as a TA
+ serverKeystore = keyStoreBuilder.getKeyStore();
+ Certificate[] sslChain = {sslCert, intCaCert, rootCert};
+ serverKeystore.setKeyEntry(SSL_ALIAS, sslKP.getPrivate(),
+ passwd.toCharArray(), sslChain);
+ serverKeystore.setCertificateEntry(ROOT_ALIAS, rootCert);
+
+ // And finally a Trust Store for the client
+ trustStore = keyStoreBuilder.getKeyStore();
+ trustStore.setCertificateEntry(ROOT_ALIAS, rootCert);
+ }
+
+ private static void addCommonExts(CertificateBuilder cbld,
+ PublicKey subjKey, PublicKey authKey) throws IOException {
+ cbld.addSubjectKeyIdExt(subjKey);
+ cbld.addAuthorityKeyIdExt(authKey);
+ }
+
+ private static void addCommonCAExts(CertificateBuilder cbld)
+ throws IOException {
+ cbld.addBasicConstraintsExt(true, true, -1);
+ // Set key usage bits for digitalSignature, keyCertSign and cRLSign
+ boolean[] kuBitSettings = {true, false, false, false, false, true,
+ true, false, false};
+ cbld.addKeyUsageExt(kuBitSettings);
+ }
+
+ /**
+ * Helper routine that dumps only a few cert fields rather than
+ * the whole toString() output.
+ *
+ * @param cert An X509Certificate to be displayed
+ *
+ * @return The {@link String} output of the issuer, subject and
+ * serial number
+ */
+ private static String certInfo(X509Certificate cert) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Issuer: ").append(cert.getIssuerX500Principal()).
+ append("\n");
+ sb.append("Subject: ").append(cert.getSubjectX500Principal()).
+ append("\n");
+ sb.append("Serial: ").append(cert.getSerialNumber()).append("\n");
+ return sb.toString();
+ }
+
+ /**
+ * Log a message on stdout
+ *
+ * @param message The message to log
+ */
+ private static void log(String message) {
+ if (debug) {
+ System.out.println(message);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/StatusStapling/TEST.properties Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,1 @@
+bootclasspath.dirs=.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/StatusStapling/TestCase.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package sun.security.ssl;
+
+import java.util.Map;
+
+public interface TestCase {
+ Map.Entry<Boolean, String> runTest();
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/ssl/StatusStapling/TestUtils.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+package sun.security.ssl;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Map;
+
+public class TestUtils {
+
+ // private constructor to prevent instantiation for this utility class
+ private TestUtils() {
+ throw new AssertionError();
+ }
+
+ public static void runTests(Map<String, TestCase> testList) {
+ int testNo = 0;
+ int numberFailed = 0;
+ Map.Entry<Boolean, String> result;
+
+ System.out.println("============ Tests ============");
+ for (String testName : testList.keySet()) {
+ System.out.println("Test " + ++testNo + ": " + testName);
+ result = testList.get(testName).runTest();
+ System.out.print("Result: " + (result.getKey() ? "PASS" : "FAIL"));
+ System.out.println(" " +
+ (result.getValue() != null ? result.getValue() : ""));
+ System.out.println("-------------------------------------------");
+ if (!result.getKey()) {
+ numberFailed++;
+ }
+ }
+
+ System.out.println("End Results: " + (testList.size() - numberFailed) +
+ " Passed" + ", " + numberFailed + " Failed.");
+ if (numberFailed > 0) {
+ throw new RuntimeException(
+ "One or more tests failed, see test output for details");
+ }
+ }
+
+ public static void dumpBytes(byte[] data) {
+ dumpBytes(ByteBuffer.wrap(data));
+ }
+
+ public static void dumpBytes(ByteBuffer data) {
+ int i = 0;
+
+ data.mark();
+ while (data.hasRemaining()) {
+ if (i % 16 == 0 && i != 0) {
+ System.out.print("\n");
+ }
+ System.out.print(String.format("%02X ", data.get()));
+ i++;
+ }
+ System.out.print("\n");
+ data.reset();
+ }
+
+ public static void valueCheck(byte[] array1, byte[] array2) {
+ if (!Arrays.equals(array1, array2)) {
+ throw new RuntimeException("Array mismatch");
+ }
+ }
+
+ // Compares a range of bytes at specific offsets in each array
+ public static void valueCheck(byte[] array1, byte[] array2, int skip1,
+ int skip2, int length) {
+ ByteBuffer buf1 = ByteBuffer.wrap(array1);
+ ByteBuffer buf2 = ByteBuffer.wrap(array2);
+
+ // Skip past however many bytes are requested in both buffers
+ buf1.position(skip1);
+ buf2.position(skip2);
+
+ // Reset the limits on each buffer to account for the length
+ buf1.limit(buf1.position() + length);
+ buf2.limit(buf2.position() + length);
+
+ if (!buf1.equals(buf2)) {
+ throw new RuntimeException("Array range mismatch");
+ }
+ }
+
+ // Concatenate 1 or more arrays
+ public static byte[] gatherBuffers(byte[]... arrays) {
+ int totalLength = 0;
+ for (byte[] ar : arrays) {
+ totalLength += ar != null ? ar.length : 0;
+ }
+
+ byte[] resultBuf = new byte[totalLength];
+ int offset = 0;
+ for (byte[] ar : arrays) {
+ if (ar != null) {
+ System.arraycopy(ar, 0, resultBuf, offset, ar.length);
+ offset += ar.length;
+ }
+ }
+ return resultBuf;
+ }
+}
+
+
--- a/jdk/test/sun/text/resources/LocaleData.cldr Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/text/resources/LocaleData.cldr Wed Jul 05 20:44:51 2017 +0200
@@ -2630,49 +2630,49 @@
LocaleNames/en_SG/VC=St. Vincent & Grenadines
LocaleNames/en_SG/WF=Wallis & Futuna
#in
-FormatData/in/MonthNames/0=M01
-FormatData/in/MonthNames/1=M02
-FormatData/in/MonthNames/2=M03
-FormatData/in/MonthNames/3=M04
-FormatData/in/MonthNames/4=M05
-FormatData/in/MonthNames/5=M06
-FormatData/in/MonthNames/6=M07
-FormatData/in/MonthNames/7=M08
-FormatData/in/MonthNames/8=M09
-FormatData/in/MonthNames/9=M10
-FormatData/in/MonthNames/10=M11
-FormatData/in/MonthNames/11=M12
+FormatData/in/MonthNames/0=Januari
+FormatData/in/MonthNames/1=Februari
+FormatData/in/MonthNames/2=Maret
+FormatData/in/MonthNames/3=April
+FormatData/in/MonthNames/4=Mei
+FormatData/in/MonthNames/5=Juni
+FormatData/in/MonthNames/6=Juli
+FormatData/in/MonthNames/7=Agustus
+FormatData/in/MonthNames/8=September
+FormatData/in/MonthNames/9=Oktober
+FormatData/in/MonthNames/10=November
+FormatData/in/MonthNames/11=Desember
FormatData/in/MonthNames/12=
-FormatData/in/MonthAbbreviations/0=M01
-FormatData/in/MonthAbbreviations/1=M02
-FormatData/in/MonthAbbreviations/2=M03
-FormatData/in/MonthAbbreviations/3=M04
-FormatData/in/MonthAbbreviations/4=M05
-FormatData/in/MonthAbbreviations/5=M06
-FormatData/in/MonthAbbreviations/6=M07
-FormatData/in/MonthAbbreviations/7=M08
-FormatData/in/MonthAbbreviations/8=M09
-FormatData/in/MonthAbbreviations/9=M10
-FormatData/in/MonthAbbreviations/10=M11
-FormatData/in/MonthAbbreviations/11=M12
-FormatData/in/DayNames/0=Sun
-FormatData/in/DayNames/1=Mon
-FormatData/in/DayNames/2=Tue
-FormatData/in/DayNames/3=Wed
-FormatData/in/DayNames/4=Thu
-FormatData/in/DayNames/5=Fri
-FormatData/in/DayNames/6=Sat
-FormatData/in/DayAbbreviations/0=Sun
-FormatData/in/DayAbbreviations/1=Mon
-FormatData/in/DayAbbreviations/2=Tue
-FormatData/in/DayAbbreviations/3=Wed
-FormatData/in/DayAbbreviations/4=Thu
-FormatData/in/DayAbbreviations/5=Fri
-FormatData/in/DayAbbreviations/6=Sat
-FormatData/in/Eras/0=BCE
-FormatData/in/Eras/1=CE
+FormatData/in/MonthAbbreviations/0=Jan
+FormatData/in/MonthAbbreviations/1=Feb
+FormatData/in/MonthAbbreviations/2=Mar
+FormatData/in/MonthAbbreviations/3=Apr
+FormatData/in/MonthAbbreviations/4=Mei
+FormatData/in/MonthAbbreviations/5=Jun
+FormatData/in/MonthAbbreviations/6=Jul
+FormatData/in/MonthAbbreviations/7=Agt
+FormatData/in/MonthAbbreviations/8=Sep
+FormatData/in/MonthAbbreviations/9=Okt
+FormatData/in/MonthAbbreviations/10=Nov
+FormatData/in/MonthAbbreviations/11=Des
+FormatData/in/DayNames/0=Minggu
+FormatData/in/DayNames/1=Senin
+FormatData/in/DayNames/2=Selasa
+FormatData/in/DayNames/3=Rabu
+FormatData/in/DayNames/4=Kamis
+FormatData/in/DayNames/5=Jumat
+FormatData/in/DayNames/6=Sabtu
+FormatData/in/DayAbbreviations/0=Min
+FormatData/in/DayAbbreviations/1=Sen
+FormatData/in/DayAbbreviations/2=Sel
+FormatData/in/DayAbbreviations/3=Rab
+FormatData/in/DayAbbreviations/4=Kam
+FormatData/in/DayAbbreviations/5=Jum
+FormatData/in/DayAbbreviations/6=Sab
+FormatData/in/Eras/0=SM
+FormatData/in/Eras/1=M
FormatData/in/NumberPatterns/0=#,##0.###
-FormatData/in/NumberPatterns/1=\u00a4\u00a0#,##0.00
+FormatData/in/NumberPatterns/1=\u00a4#,##0.00
FormatData/in/NumberPatterns/2=#,##0%
#FormatData/in/NumberElements/0=<MISSING!>
#FormatData/in/NumberElements/1=<MISSING!>
@@ -2685,14 +2685,14 @@
#FormatData/in/NumberElements/8=<MISSING!>
#FormatData/in/NumberElements/9=<MISSING!>
#FormatData/in/NumberElements/10=<MISSING!>
-FormatData/in/TimePatterns/0=HH:mm:ss zzzz
-FormatData/in/TimePatterns/1=HH:mm:ss z
-FormatData/in/TimePatterns/2=HH:mm:ss
-FormatData/in/TimePatterns/3=HH:mm
-FormatData/in/DatePatterns/0=y MMMM d, EEEE
-FormatData/in/DatePatterns/1=y MMMM d
-FormatData/in/DatePatterns/2=y MMM d
-FormatData/in/DatePatterns/3=y-MM-dd
+FormatData/in/TimePatterns/0=HH.mm.ss zzzz
+FormatData/in/TimePatterns/1=HH.mm.ss z
+FormatData/in/TimePatterns/2=HH.mm.ss
+FormatData/in/TimePatterns/3=HH.mm
+FormatData/in/DatePatterns/0=EEEE, dd MMMM y
+FormatData/in/DatePatterns/1=d MMMM y
+FormatData/in/DatePatterns/2=d MMM y
+FormatData/in/DatePatterns/3=dd/MM/yy
FormatData/in/DateTimePatterns/0={1} {0}
#LocaleNames/in/ab=<MISSING!>
#LocaleNames/in/am=<MISSING!>
@@ -2848,14 +2848,14 @@
#LocaleNames/in/YE=<MISSING!>
#LocaleNames/in/ZA=<MISSING!>
#in_ID
-FormatData/in_ID/TimePatterns/0=HH:mm:ss zzzz
-FormatData/in_ID/TimePatterns/1=HH:mm:ss z
-FormatData/in_ID/TimePatterns/2=HH:mm:ss
-FormatData/in_ID/TimePatterns/3=HH:mm
-FormatData/in_ID/DatePatterns/0=y MMMM d, EEEE
-FormatData/in_ID/DatePatterns/1=y MMMM d
-FormatData/in_ID/DatePatterns/2=y MMM d
-FormatData/in_ID/DatePatterns/3=y-MM-dd
+FormatData/in_ID/TimePatterns/0=HH.mm.ss zzzz
+FormatData/in_ID/TimePatterns/1=HH.mm.ss z
+FormatData/in_ID/TimePatterns/2=HH.mm.ss
+FormatData/in_ID/TimePatterns/3=HH.mm
+FormatData/in_ID/DatePatterns/0=EEEE, dd MMMM y
+FormatData/in_ID/DatePatterns/1=d MMMM y
+FormatData/in_ID/DatePatterns/2=d MMM y
+FormatData/in_ID/DatePatterns/3=dd/MM/yy
FormatData/in_ID/DateTimePatterns/0={1} {0}
#CurrencyNames/in_ID/IDR/0=<MISSING!>
#en_MT
@@ -5570,7 +5570,7 @@
# bug 6507067
TimeZoneNames/zh_TW/Asia\/Taipei/1=\u53f0\u5317\u6a19\u6e96\u6642\u9593
-TimeZoneNames/zh_TW/Asia\/Taipei/2=TST
+TimeZoneNames/zh_TW/Asia\/Taipei/2=CST
# bug 6645271
FormatData/hr_HR/DatePatterns/2=d. MMM y.
@@ -7316,20 +7316,20 @@
FormatData/it/DayNarrows/5=V
FormatData/it/DayNarrows/6=S
-FormatData/iw/DayNarrows/0=S
-FormatData/iw/DayNarrows/1=M
-FormatData/iw/DayNarrows/2=T
-FormatData/iw/DayNarrows/3=W
-FormatData/iw/DayNarrows/4=T
-FormatData/iw/DayNarrows/5=F
-FormatData/iw/DayNarrows/6=S
-FormatData/iw/standalone.DayNarrows/0=S
-FormatData/iw/standalone.DayNarrows/1=M
-FormatData/iw/standalone.DayNarrows/2=T
-FormatData/iw/standalone.DayNarrows/3=W
-FormatData/iw/standalone.DayNarrows/4=T
-FormatData/iw/standalone.DayNarrows/5=F
-FormatData/iw/standalone.DayNarrows/6=S
+FormatData/iw/DayNarrows/0=\u05d0\u05f3
+FormatData/iw/DayNarrows/1=\u05d1\u05f3
+FormatData/iw/DayNarrows/2=\u05d2\u05f3
+FormatData/iw/DayNarrows/3=\u05d3\u05f3
+FormatData/iw/DayNarrows/4=\u05d4\u05f3
+FormatData/iw/DayNarrows/5=\u05d5\u05f3
+FormatData/iw/DayNarrows/6=\u05e9\u05f3
+FormatData/iw/standalone.DayNarrows/0=\u05d0\u05f3
+FormatData/iw/standalone.DayNarrows/1=\u05d1\u05f3
+FormatData/iw/standalone.DayNarrows/2=\u05d2\u05f3
+FormatData/iw/standalone.DayNarrows/3=\u05d3\u05f3
+FormatData/iw/standalone.DayNarrows/4=\u05d4\u05f3
+FormatData/iw/standalone.DayNarrows/5=\u05d5\u05f3
+FormatData/iw/standalone.DayNarrows/6=\u05e9\u05f3
FormatData/ja/DayNarrows/0=\u65e5
FormatData/ja/DayNarrows/1=\u6708
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2015, 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
+ * @summary Basic test for jhsdb launcher
+ * @library /../../test/lib/share/classes
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @build jdk.test.lib.apps.*
+ * @run main BasicLauncherTest
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Arrays;
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.Utils;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.apps.LingeredApp;
+
+public class BasicLauncherTest {
+
+ private final static String toolName = "jhsdb";
+ private static LingeredApp theApp = null;
+
+ /**
+ *
+ * @return exit code of tool
+ */
+ public static int launchCLHSDB()
+ throws IOException {
+
+ System.out.println("Starting LingeredApp");
+ try {
+ theApp = LingeredApp.startApp();
+
+ System.out.println("Starting clhsdb against " + theApp.getPid());
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
+ launcher.addToolArg("clhsdb");
+ launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
+
+ ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
+ processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
+ Process toolProcess = processBuilder.start();
+ toolProcess.getOutputStream().write("quit\n".getBytes());
+ toolProcess.getOutputStream().close();
+
+ // By default child process output stream redirected to pipe, so we are reading it in foreground.
+ BufferedReader reader = new BufferedReader(new InputStreamReader(toolProcess.getInputStream()));
+
+ String line;
+ while ((line = reader.readLine()) != null) {
+ System.out.println(line.trim());
+ }
+
+ toolProcess.waitFor();
+
+ return toolProcess.exitValue();
+ } catch (Exception ex) {
+ throw new RuntimeException("Test ERROR " + ex, ex);
+ } finally {
+ LingeredApp.stopApp(theApp);
+ }
+ }
+
+ /**
+ *
+ * @param vmArgs - vm and java arguments to launch test app
+ * @return exit code of tool
+ */
+ public static void launch(String expectedMessage, List<String> toolArgs)
+ throws IOException {
+
+ System.out.println("Starting LingeredApp");
+ try {
+ theApp = LingeredApp.startApp();
+
+ System.out.println("Starting " + toolName + " " + toolArgs.get(0) + " against " + theApp.getPid());
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
+
+ for (String cmd : toolArgs) {
+ launcher.addToolArg(cmd);
+ }
+
+ launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));
+
+ ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
+ processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
+ OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
+ output.shouldContain(expectedMessage);
+ output.shouldHaveExitValue(0);
+
+ } catch (Exception ex) {
+ throw new RuntimeException("Test ERROR " + ex, ex);
+ } finally {
+ LingeredApp.stopApp(theApp);
+ }
+ }
+
+ public static void launch(String expectedMessage, String... toolArgs)
+ throws IOException {
+
+ launch(expectedMessage, Arrays.asList(toolArgs));
+ }
+
+ public static void main(String[] args)
+ throws IOException {
+
+ launchCLHSDB();
+
+ launch("No deadlocks found", "jstack");
+ launch("Server compiler detected", "jmap");
+ launch("Java System Properties", "jinfo");
+
+ // The test throws RuntimeException on error.
+ // IOException is thrown if LingeredApp can't start because of some bad
+ // environment condition
+ System.out.println("Test PASSED");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/tools/jhsdb/SAGetoptTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2015, 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
+ * @summary unit test for SAGetopt function
+ * @compile -XDignore.symbol.file SAGetoptTest.java
+ * @run main SAGetoptTest
+ */
+
+import sun.jvm.hotspot.SAGetopt;
+
+public class SAGetoptTest {
+
+ private static boolean a_opt;
+ private static boolean b_opt;
+ private static boolean c_opt;
+ private static boolean e_opt;
+ private static boolean mixed_opt;
+
+ private static String d_value;
+ private static String exe_value;
+ private static String core_value;
+
+ private static void initArgValues() {
+ a_opt = false;
+ b_opt = false;
+ c_opt = false;
+ e_opt = false;
+ mixed_opt = false;
+
+ d_value = "";
+ exe_value = "";
+ core_value = "";
+ }
+
+
+ private static void optionsTest(String[] args) {
+ initArgValues();
+
+ SAGetopt sg = new SAGetopt(args);
+
+ String[] longOpts = {"exe=","core=","mixed"};
+ String shortOpts = "abcd:e";
+ String s;
+
+ while((s = sg.next(shortOpts, longOpts)) != null) {
+ if (s.equals("a")) {
+ a_opt = true;
+ continue;
+ }
+
+ if (s.equals("b")) {
+ b_opt = true;
+ continue;
+ }
+
+ if (s.equals("c")) {
+ c_opt = true;
+ continue;
+ }
+
+ if (s.equals("e")) {
+ e_opt = true;
+ continue;
+ }
+
+ if (s.equals("mixed")) {
+ mixed_opt = true;
+ continue;
+ }
+
+ if (s.equals("d")) {
+ d_value = sg.getOptarg();
+ continue;
+ }
+
+ if (s.equals("exe")) {
+ exe_value = sg.getOptarg();
+ continue;
+ }
+
+ if (s.equals("core")) {
+ core_value = sg.getOptarg();
+ continue;
+ }
+ }
+ }
+
+ private static void badOptionsTest(int setNumber, String[] args, String expectedMessage) {
+ String msg = null;
+ try {
+ optionsTest(args);
+ } catch(RuntimeException ex) {
+ msg = ex.getMessage();
+ }
+
+ if (msg == null || !msg.equals(expectedMessage)) {
+ if (msg != null) {
+ System.err.println("Unexpected error '" + msg + "'");
+ }
+ throw new RuntimeException("Bad option test " + setNumber + " failed");
+ }
+ }
+
+ public static void main(String[] args) {
+ String[] optionSet1 = {"-abd", "bla", "-c"};
+ optionsTest(optionSet1);
+ if (!a_opt || !b_opt || !d_value.equals("bla") || !c_opt) {
+ throw new RuntimeException("Good optionSet 1 failed");
+ }
+
+ String[] optionSet2 = {"-e", "--mixed"};
+ optionsTest(optionSet2);
+ if (!e_opt || !mixed_opt) {
+ throw new RuntimeException("Good optionSet 2 failed");
+ }
+
+ String[] optionSet3 = {"--exe=bla", "--core", "bla_core", "--mixed"};
+ optionsTest(optionSet3);
+ if (!exe_value.equals("bla") || !core_value.equals("bla_core") || !mixed_opt) {
+ throw new RuntimeException("Good optionSet 3 failed");
+ }
+
+ // Bad options test
+ String[] optionSet4 = {"-abd", "-c"};
+ badOptionsTest(4, optionSet4, "Argument is expected for 'd'");
+
+ String[] optionSet5 = {"-exe", "bla", "--core"};
+ badOptionsTest(5, optionSet5, "Invalid option 'x'");
+
+ String[] optionSet6 = {"--exe", "--core", "bla_core"};
+ badOptionsTest(6, optionSet6, "Argument is expected for 'exe'");
+ }
+ }
--- a/jdk/test/sun/tools/jmap/BasicJMapTest.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/tools/jmap/BasicJMapTest.java Wed Jul 05 20:44:51 2017 +0200
@@ -36,6 +36,7 @@
* @test
* @bug 6321286
* @summary Unit test for jmap utility
+ * @key intermittent
* @library /lib/testlibrary
* @library /../../test/lib/share/classes
* @modules java.management
--- a/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java Wed Jul 05 20:44:51 2017 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
--- a/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java Wed Jul 05 20:44:51 2017 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825 7092186
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
--- a/jdk/test/sun/tools/jstatd/TestJstatdPort.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPort.java Wed Jul 05 20:44:51 2017 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
--- a/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java Wed Jul 05 20:44:51 2017 +0200
@@ -24,6 +24,7 @@
/*
* @test
* @bug 4990825
+ * @key intermittent
* @library /lib/testlibrary
* @modules java.management
* @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
--- a/jdk/test/vm/verifier/VerifyProtectedConstructor.java Thu Aug 06 11:17:57 2015 -0700
+++ b/jdk/test/vm/verifier/VerifyProtectedConstructor.java Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, 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
@@ -26,7 +26,7 @@
* @test
* @bug 6490436
- * @summary Verify that protected constructor calls are not allowed for classfile version >= 50 (but that they are allowed for lesser versions).
+ * @summary Verify that protected constructor calls are not allowed for any classfile versions in either verifier.
* @author Keith McGuigan
*/
@@ -38,9 +38,10 @@
try {
t.checkClassVersion(49); // should not throw VerifyError
+ throw new Exception("FAIL: should be a VerifyError for CF version 49");
}
catch(VerifyError e) {
- throw new Exception("FAIL: should be no VerifyError for CF version 49");
+ System.out.println("PASS for CF version 49");
}
try {
--- a/make/Main.gmk Thu Aug 06 11:17:57 2015 -0700
+++ b/make/Main.gmk Wed Jul 05 20:44:51 2017 +0200
@@ -78,11 +78,14 @@
interim-rmic:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
+interim-cldrconverter:
+ +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
+
buildtools-jdk:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
ALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
- interim-rmic buildtools-jdk
+ interim-rmic interim-cldrconverter buildtools-jdk
################################################################################
# Special targets for certain modules
@@ -345,7 +348,7 @@
interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
- buildtools-jdk: interim-langtools
+ buildtools-jdk: interim-langtools interim-cldrconverter
$(CORBA_GENSRC_TARGETS): interim-langtools
--- a/nashorn/.hgtags Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/.hgtags Wed Jul 05 20:44:51 2017 +0200
@@ -309,3 +309,4 @@
548f1eb2c3c89e024ef3805f48ceed9de503588f jdk9-b73
2e8bb16872d7b15dc0a4f8e45c6ad65f762c1b04 jdk9-b74
f884dff432a7ac349153f3d1ea1eb222f3764c6c jdk9-b75
+ab231613d7206431ba31917a02e7cedd70e88e70 jdk9-b76
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Wed Jul 05 20:44:51 2017 +0200
@@ -1480,7 +1480,7 @@
}
@Override
void consumeStack() {
- dynamicCall(2 + argsCount, flags);
+ dynamicCall(2 + argsCount, flags, ident.getName());
}
}.emit();
}
@@ -1538,7 +1538,7 @@
@Override
void consumeStack() {
// Ordinary call
- dynamicCall(2 + argsCount, flags);
+ dynamicCall(2 + argsCount, flags, "eval");
method._goto(eval_done);
method.label(invoke_direct_eval);
@@ -1610,7 +1610,7 @@
}
@Override
void consumeStack() {
- dynamicCall(2 + argCount, flags);
+ dynamicCall(2 + argCount, flags, node.toString(false));
}
}.emit();
@@ -1635,9 +1635,7 @@
@Override
void consumeStack() {
- final int flags = getCallSiteFlags();
- //assert callNodeType.equals(callee.getReturnType()) : callNodeType + " != " + callee.getReturnType();
- dynamicCall(2 + argsCount, flags);
+ dynamicCall(2 + argsCount, getCallSiteFlags(), origCallee.getName());
}
}.emit();
return false;
@@ -1666,8 +1664,7 @@
}
@Override
void consumeStack() {
- final int flags = getCallSiteFlags();
- dynamicCall(2 + argsCount, flags);
+ dynamicCall(2 + argsCount, getCallSiteFlags(), node.toString(false));
}
}.emit();
return false;
@@ -1687,7 +1684,7 @@
@Override
void consumeStack() {
final int flags = getCallSiteFlags() | CALLSITE_SCOPE;
- dynamicCall(2 + argsCount, flags);
+ dynamicCall(2 + argsCount, flags, node.toString(false));
}
}.emit();
return false;
@@ -3707,10 +3704,11 @@
final CallNode callNode = (CallNode)unaryNode.getExpression();
final List<Expression> args = callNode.getArgs();
+ final Expression func = callNode.getFunction();
// Load function reference.
- loadExpressionAsObject(callNode.getFunction()); // must detect type error
-
- method.dynamicNew(1 + loadArgs(args), getCallSiteFlags());
+ loadExpressionAsObject(func); // must detect type error
+
+ method.dynamicNew(1 + loadArgs(args), getCallSiteFlags(), func.toString(false));
}
private void loadNOT(final UnaryNode unaryNode) {
@@ -4818,11 +4816,11 @@
return method.dynamicGetIndex(resultBounds.within(expression.getType()), nonOptimisticFlags(flags), isMethod);
}
- MethodEmitter dynamicCall(final int argCount, final int flags) {
+ MethodEmitter dynamicCall(final int argCount, final int flags, final String msg) {
if (isOptimistic) {
- return method.dynamicCall(getOptimisticCoercedType(), argCount, getOptimisticFlags(flags));
- }
- return method.dynamicCall(resultBounds.within(expression.getType()), argCount, nonOptimisticFlags(flags));
+ return method.dynamicCall(getOptimisticCoercedType(), argCount, getOptimisticFlags(flags), msg);
+ }
+ return method.dynamicCall(resultBounds.within(expression.getType()), argCount, nonOptimisticFlags(flags), msg);
}
int getOptimisticFlags(final int flags) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java Wed Jul 05 20:44:51 2017 +0200
@@ -2132,10 +2132,25 @@
* @return the method emitter
*/
MethodEmitter dynamicNew(final int argCount, final int flags) {
+ return dynamicNew(argCount, flags, null);
+ }
+
+ /**
+ * Generate a dynamic new
+ *
+ * @param argCount number of arguments
+ * @param flags callsite flags
+ * @param msg additional message to be used when reporting error
+ *
+ * @return the method emitter
+ */
+ MethodEmitter dynamicNew(final int argCount, final int flags, final String msg) {
assert !isOptimistic(flags);
debug("dynamic_new", "argcount=", argCount);
final String signature = getDynamicSignature(Type.OBJECT, argCount);
- method.visitInvokeDynamicInsn("dyn:new", signature, LINKERBOOTSTRAP, flags);
+ method.visitInvokeDynamicInsn(
+ msg != null && msg.length() < LARGE_STRING_THRESHOLD? "dyn:new:" + NameCodec.encode(msg) : "dyn:new",
+ signature, LINKERBOOTSTRAP, flags);
pushType(Type.OBJECT); //TODO fix result type
return this;
}
@@ -2150,10 +2165,26 @@
* @return the method emitter
*/
MethodEmitter dynamicCall(final Type returnType, final int argCount, final int flags) {
+ return dynamicCall(returnType, argCount, flags, null);
+ }
+
+ /**
+ * Generate a dynamic call
+ *
+ * @param returnType return type
+ * @param argCount number of arguments
+ * @param flags callsite flags
+ * @param msg additional message to be used when reporting error
+ *
+ * @return the method emitter
+ */
+ MethodEmitter dynamicCall(final Type returnType, final int argCount, final int flags, final String msg) {
debug("dynamic_call", "args=", argCount, "returnType=", returnType);
final String signature = getDynamicSignature(returnType, argCount); // +1 because the function itself is the 1st parameter for dynamic calls (what you call - call target)
debug(" signature", signature);
- method.visitInvokeDynamicInsn("dyn:call", signature, LINKERBOOTSTRAP, flags);
+ method.visitInvokeDynamicInsn(
+ msg != null && msg.length() < LARGE_STRING_THRESHOLD? "dyn:call:" + NameCodec.encode(msg) : "dyn:call",
+ signature, LINKERBOOTSTRAP, flags);
pushType(returnType);
return this;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SharedScopeCall.java Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SharedScopeCall.java Wed Jul 05 20:44:51 2017 +0200
@@ -169,7 +169,7 @@
slot += type.getSlots();
}
// Shared scope calls disabled in optimistic world. TODO is this right?
- method.dynamicCall(returnType, 2 + paramTypes.length, flags);
+ method.dynamicCall(returnType, 2 + paramTypes.length, flags, symbol.getName());
}
method._return(returnType);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java Wed Jul 05 20:44:51 2017 +0200
@@ -141,9 +141,17 @@
public abstract Node accept(NodeVisitor<? extends LexicalContext> visitor);
@Override
- public String toString() {
+ public final String toString() {
+ return toString(true);
+ }
+
+ /*
+ * Return String representation of this Node.
+ * @param includeTypeInfo include type information or not
+ */
+ public final String toString(final boolean includeTypeInfo) {
final StringBuilder sb = new StringBuilder();
- toString(sb);
+ toString(sb, includeTypeInfo);
return sb.toString();
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java Wed Jul 05 20:44:51 2017 +0200
@@ -1859,7 +1859,7 @@
* @return GuardedInvocation to be invoked at call site.
*/
protected GuardedInvocation findNewMethod(final CallSiteDescriptor desc, final LinkRequest request) {
- return notAFunction();
+ return notAFunction(desc);
}
/**
@@ -1872,11 +1872,11 @@
* @return GuardedInvocation to be invoked at call site.
*/
protected GuardedInvocation findCallMethod(final CallSiteDescriptor desc, final LinkRequest request) {
- return notAFunction();
+ return notAFunction(desc);
}
- private GuardedInvocation notAFunction() {
- throw typeError("not.a.function", ScriptRuntime.safeToString(this));
+ private GuardedInvocation notAFunction(final CallSiteDescriptor desc) {
+ throw typeError("not.a.function", NashornCallSiteDescriptor.getFunctionErrorMessage(desc, this));
}
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java Wed Jul 05 20:44:51 2017 +0200
@@ -96,8 +96,12 @@
switch (operator) {
case "new":
- case "call":
- throw lookupTypeError("cant.call.undefined", desc);
+ case "call": {
+ final String name = NashornCallSiteDescriptor.getFunctionDescription(desc);
+ final String msg = name != null? "not.a.function" : "cant.call.undefined";
+ throw typeError(msg, name);
+ }
+
case "callMethod":
throw lookupTypeError("cant.read.property.of.undefined", desc);
// NOTE: we support getElem and setItem as JavaScript doesn't distinguish items from properties. Nashorn itself
@@ -125,7 +129,8 @@
}
private static ECMAException lookupTypeError(final String msg, final CallSiteDescriptor desc) {
- return typeError(msg, desc.getNameTokenCount() > 2 ? desc.getNameToken(2) : null);
+ final String name = desc.getNameToken(2);
+ return typeError(msg, name != null && !name.isEmpty()? name : null);
}
private static final MethodHandle GET_METHOD = findOwnMH("get", Object.class, Object.class);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java Wed Jul 05 20:44:51 2017 +0200
@@ -27,6 +27,8 @@
import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
+import static jdk.nashorn.internal.runtime.JSType.GET_UNDEFINED;
+import static jdk.nashorn.internal.runtime.JSType.TYPE_OBJECT_INDEX;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
import java.lang.invoke.MethodHandle;
@@ -92,7 +94,7 @@
if(BeansLinker.isDynamicMethod(self)) {
throw typeError("method.not.constructor", ScriptRuntime.safeToString(self));
}
- throw typeError("not.a.function", ScriptRuntime.safeToString(self));
+ throw typeError("not.a.function", desc.getFunctionErrorMessage(self));
case "call":
if(BeansLinker.isDynamicConstructor(self)) {
throw typeError("constructor.requires.new", ScriptRuntime.safeToString(self));
@@ -100,10 +102,12 @@
if(BeansLinker.isDynamicMethod(self)) {
throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self));
}
- throw typeError("not.a.function", ScriptRuntime.safeToString(self));
+ throw typeError("not.a.function", desc.getFunctionErrorMessage(self));
case "callMethod":
+ throw typeError("no.such.function", getArgument(linkRequest), ScriptRuntime.safeToString(self));
case "getMethod":
- throw typeError("no.such.function", getArgument(linkRequest), ScriptRuntime.safeToString(self));
+ // evaluate to undefined, later on Undefined will take care of throwing TypeError
+ return getInvocation(MH.dropArguments(GET_UNDEFINED.get(TYPE_OBJECT_INDEX), 0, Object.class), self, linkerServices, desc);
case "getProp":
case "getElem":
if(NashornCallSiteDescriptor.isOptimistic(desc)) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java Wed Jul 05 20:44:51 2017 +0200
@@ -34,6 +34,7 @@
import jdk.internal.dynalink.support.AbstractCallSiteDescriptor;
import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
import jdk.nashorn.internal.ir.debug.NashornTextifier;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
/**
* Nashorn-specific implementation of Dynalink's {@link CallSiteDescriptor}. The reason we have our own subclass is that
@@ -150,7 +151,7 @@
public static NashornCallSiteDescriptor get(final MethodHandles.Lookup lookup, final String name,
final MethodType methodType, final int flags) {
final String[] tokenizedName = CallSiteDescriptorFactory.tokenizeName(name);
- assert tokenizedName.length == 2 || tokenizedName.length == 3;
+ assert tokenizedName.length >= 2;
assert "dyn".equals(tokenizedName[0]);
assert tokenizedName[1] != null;
// TODO: see if we can move mangling/unmangling into Dynalink
@@ -248,6 +249,54 @@
}
/**
+ * If this is a dyn:call or dyn:new, this returns function description from callsite.
+ * Caller has to make sure this is a dyn:call or dyn:new call site.
+ *
+ * @return function description if available (or null)
+ */
+ public String getFunctionDescription() {
+ assert getFirstOperator().equals("call") || getFirstOperator().equals("new");
+ return getNameTokenCount() > 2? getNameToken(2) : null;
+ }
+
+ /**
+ * If this is a dyn:call or dyn:new, this returns function description from callsite.
+ * Caller has to make sure this is a dyn:call or dyn:new call site.
+ *
+ * @param desc call site descriptor
+ * @return function description if available (or null)
+ */
+ public static String getFunctionDescription(final CallSiteDescriptor desc) {
+ return desc instanceof NashornCallSiteDescriptor ?
+ ((NashornCallSiteDescriptor)desc).getFunctionDescription() : null;
+ }
+
+
+ /**
+ * Returns the error message to be used when dyn:call or dyn:new is used on a non-function.
+ *
+ * @param obj object on which dyn:call or dyn:new is used
+ * @return error message
+ */
+ public String getFunctionErrorMessage(final Object obj) {
+ final String funcDesc = getFunctionDescription();
+ return funcDesc != null? funcDesc : ScriptRuntime.safeToString(obj);
+ }
+
+ /**
+ * Returns the error message to be used when dyn:call or dyn:new is used on a non-function.
+ *
+ * @param desc call site descriptor
+ * @param obj object on which dyn:call or dyn:new is used
+ * @return error message
+ */
+ public static String getFunctionErrorMessage(final CallSiteDescriptor desc, final Object obj) {
+ return desc instanceof NashornCallSiteDescriptor ?
+ ((NashornCallSiteDescriptor)desc).getFunctionErrorMessage(obj) :
+ ScriptRuntime.safeToString(obj);
+ }
+
+ /**
* Returns the Nashorn-specific flags for this call site descriptor.
* @param desc the descriptor. It can be any kind of a call site descriptor, not necessarily a
* {@code NashornCallSiteDescriptor}. This allows for graceful interoperability when linking Nashorn with code
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties Wed Jul 05 20:44:51 2017 +0200
@@ -78,6 +78,7 @@
type.error.not.a.regexp={0} is not a RegExp
type.error.not.a.string={0} is not a String
type.error.not.a.function={0} is not a function
+type.error.not.a.function.value={0}, which has value {1}, is not a function
type.error.not.a.constructor={0} is not a constructor function
type.error.not.a.file={0} is not a File
type.error.not.a.numeric.array={0} is not a numeric array
--- a/nashorn/test/script/basic/JDK-8026016.js.EXPECTED Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8026016.js.EXPECTED Wed Jul 05 20:44:51 2017 +0200
@@ -1,182 +1,182 @@
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-TypeError: Cannot call undefined
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such method _,0
-no such method _,1
-no such method _,2
-no such method _,3
-no such method _,4
-no such method _,5
-no such method _,6
-no such method _,7
-no such method _,8
-no such method _,9
-no such method _,10
-no such method _,11
-no such method _,12
-no such method _,13
-no such method _,14
-no such method _,15
-no such method _,16
-no such method _,17
-no such method _,18
-no such method _,19
-no such method _,20
-no such method _,21
-no such method _,22
-no such method _,23
-no such method _,24
-no such method _,25
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-TypeError: Cannot call undefined
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
-no such property _
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+TypeError: o._ is not a function
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such method _,0
+no such method _,1
+no such method _,2
+no such method _,3
+no such method _,4
+no such method _,5
+no such method _,6
+no such method _,7
+no such method _,8
+no such method _,9
+no such method _,10
+no such method _,11
+no such method _,12
+no such method _,13
+no such method _,14
+no such method _,15
+no such method _,16
+no such method _,17
+no such method _,18
+no such method _,19
+no such method _,20
+no such method _,21
+no such method _,22
+no such method _,23
+no such method _,24
+no such method _,25
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+TypeError: o._ is not a function
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
--- a/nashorn/test/script/basic/JDK-8036743.js Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8036743.js Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8073733.js Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/**
+ * JDK-8073733: TypeError messages with "call" and "new" could be improved
+ *
+ * @test
+ * @run
+ */
+
+var func = undefined;
+try {
+ func();
+} catch (e) {
+ print(e);
+}
+
+var obj = {};
+try {
+ obj.foo();
+} catch (e) {
+ print(e);
+}
+
+try {
+ new func();
+} catch (e) {
+ print(e);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8073733.js.EXPECTED Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,3 @@
+TypeError: func is not a function
+TypeError: obj.foo is not a function
+TypeError: func is not a function
--- a/nashorn/test/script/basic/JDK-8114838.js Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8114838.js Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- a/nashorn/test/script/basic/JDK-8130853.js Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8130853.js Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- a/nashorn/test/script/basic/JDK-8131039.js Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/test/script/basic/JDK-8131039.js Wed Jul 05 20:44:51 2017 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8133119.js Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+/**
+ * JDK-8133119: Error message associated with TypeError for call and new should include stringified Node
+ *
+ * @test
+ * @run
+ */
+
+var obj = {}
+try {
+ obj.func();
+} catch (e) {
+ print(e);
+}
+
+var arr = [33];
+try {
+ arr[0].func();
+} catch (e) {
+ print(e);
+}
+
+try {
+ new obj.func();
+} catch (e) {
+ print(e);
+}
+
+try {
+ new arr[0].func();
+} catch (e) {
+ print(e);
+}
+
+obj.foo = {}
+try {
+ new obj.foo();
+} catch (e) {
+ print(e);
+}
+
+try {
+ obj.foo();
+} catch (e) {
+ print(e);
+}
+
+var v = new java.util.Vector();
+try {
+ v();
+} catch (e) {
+ print(e);
+}
+
+try {
+ new v();
+} catch (e) {
+ print(e);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8133119.js.EXPECTED Wed Jul 05 20:44:51 2017 +0200
@@ -0,0 +1,8 @@
+TypeError: obj.func is not a function
+TypeError: arr[0].func is not a function
+TypeError: obj.func is not a function
+TypeError: arr[0].func is not a function
+TypeError: obj.foo is not a function
+TypeError: obj.foo is not a function
+TypeError: v is not a function
+TypeError: v is not a function
--- a/nashorn/test/script/basic/NASHORN-75.js.EXPECTED Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/test/script/basic/NASHORN-75.js.EXPECTED Wed Jul 05 20:44:51 2017 +0200
@@ -1,3 +1,3 @@
-TypeError: [RegExp /a|b/g] is not a function
-TypeError: [String hello] is not a function
-TypeError: [object Object] is not a function
+TypeError: RegExp("a|b", "g") is not a function
+TypeError: new String("hello") is not a function
+TypeError: new Object() is not a function
--- a/nashorn/test/script/basic/errors.js.EXPECTED Thu Aug 06 11:17:57 2015 -0700
+++ b/nashorn/test/script/basic/errors.js.EXPECTED Wed Jul 05 20:44:51 2017 +0200
@@ -1,31 +1,31 @@
-Error is a function
-EvalError is a function
-RangeError is a function
-ReferenceError is a function
-SyntaxError is a function
-TypeError is a function
-URIError is a function
-Error.arity 1
-EvalError.arity 1
-RangeError.arity 1
-ReferenceError.arity 1
-SyntaxError.arity 1
-TypeError.arity 1
-URIError.arity 1
-true
-my error
-Error
-thrown @ 49
-true
-ReferenceError
-"foo" is not defined
-true
-TypeError
-Cannot call undefined
-Error
-EvalError
-RangeError
-ReferenceError
-SyntaxError
-TypeError
-URIError
+Error is a function
+EvalError is a function
+RangeError is a function
+ReferenceError is a function
+SyntaxError is a function
+TypeError is a function
+URIError is a function
+Error.arity 1
+EvalError.arity 1
+RangeError.arity 1
+ReferenceError.arity 1
+SyntaxError.arity 1
+TypeError.arity 1
+URIError.arity 1
+true
+my error
+Error
+thrown @ 49
+true
+ReferenceError
+"foo" is not defined
+true
+TypeError
+Object.foo_method is not a function
+Error
+EvalError
+RangeError
+ReferenceError
+SyntaxError
+TypeError
+URIError
--- a/test/lib/sun/hotspot/WhiteBox.java Thu Aug 06 11:17:57 2015 -0700
+++ b/test/lib/sun/hotspot/WhiteBox.java Wed Jul 05 20:44:51 2017 +0200
@@ -182,6 +182,30 @@
Objects.requireNonNull(method);
return isMethodQueuedForCompilation0(method);
}
+ // Determine if the compiler corresponding to the compilation level 'compLevel'
+ // and to the compilation context 'compilation_context' provides an intrinsic
+ // for the method 'method'. An intrinsic is available for method 'method' if:
+ // - the intrinsic is enabled (by using the appropriate command-line flag) and
+ // - the platform on which the VM is running provides the instructions necessary
+ // for the compiler to generate the intrinsic code.
+ //
+ // The compilation context is related to using the DisableIntrinsic flag on a
+ // per-method level, see hotspot/src/share/vm/compiler/abstractCompiler.hpp
+ // for more details.
+ public boolean isIntrinsicAvailable(Executable method,
+ Executable compilationContext,
+ int compLevel) {
+ Objects.requireNonNull(method);
+ return isIntrinsicAvailable0(method, compilationContext, compLevel);
+ }
+ // If usage of the DisableIntrinsic flag is not expected (or the usage can be ignored),
+ // use the below method that does not require the compilation context as argument.
+ public boolean isIntrinsicAvailable(Executable method, int compLevel) {
+ return isIntrinsicAvailable(method, null, compLevel);
+ }
+ private native boolean isIntrinsicAvailable0(Executable method,
+ Executable compilationContext,
+ int compLevel);
public int deoptimizeMethod(Executable method) {
return deoptimizeMethod(method, false /*not osr*/);
}