--- a/make/RunTests.gmk Wed Feb 20 11:36:02 2019 -0800
+++ b/make/RunTests.gmk Wed Feb 20 11:43:59 2019 -0800
@@ -112,6 +112,9 @@
GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, \
$(GTEST_LAUNCHER_DIRS)))
+COV_ENVIRONMENT :=
+JTREG_COV_OPTIONS :=
+
ifeq ($(TEST_OPTS_JCOV), true)
JCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/jcov-output
JCOV_GRABBER_LOG := $(JCOV_OUTPUT_DIR)/grabber.log
@@ -122,12 +125,18 @@
# Replace our normal test JDK with the JCov image.
JDK_UNDER_TEST := $(JCOV_IMAGE_DIR)
- JCOV_ENVIRONMENT := JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \
+ COV_ENVIRONMENT += JAVA_TOOL_OPTIONS="$(JCOV_MEM_OPTIONS)" \
_JAVA_OPTIONS="$(JCOV_MEM_OPTIONS)"
- JTREG_JCOV_OPTIONS := -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \
+ JTREG_COV_OPTIONS += -e:JAVA_TOOL_OPTIONS='$(JCOV_MEM_OPTIONS)' \
-e:_JAVA_OPTIONS='$(JCOV_MEM_OPTIONS)'
endif
+ifeq ($(GCOV_ENABLED), true)
+ GCOV_OUTPUT_DIR := $(TEST_RESULTS_DIR)/gcov-output
+ COV_ENVIRONMENT += GCOV_PREFIX="$(GCOV_OUTPUT_DIR)"
+ JTREG_COV_OPTIONS += -e:GCOV_PREFIX="$(GCOV_OUTPUT_DIR)"
+endif
+
################################################################################
# Optionally create AOT libraries for specified modules before running tests.
# Note, this could not be done during JDK build time.
@@ -170,6 +179,7 @@
$$(call LogWarn, Generating $$(patsubst $$(OUTPUTDIR)/%, %, $$@))
$$(call MakeTargetDir)
$$(call ExecuteWithLog, $$@, \
+ $((COV_ENVIRONMENT) \
$$(FIXPATH) $$(JDK_UNDER_TEST)/bin/jaotc \
$$($1_JAOTC_OPTS) --output $$@ --module $$($1_MODULE) \
)
@@ -907,7 +917,7 @@
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \
- $$(JCOV_ENVIRONMENT) \
+ $$(COV_ENVIRONMENT) \
$$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
-Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
$$($1_JTREG_BASIC_OPTIONS) \
@@ -917,7 +927,7 @@
-workDir:$$($1_TEST_SUPPORT_DIR) \
$$(JTREG_OPTIONS) \
$$(JTREG_FAILURE_HANDLER_OPTIONS) \
- $$(JTREG_JCOV_OPTIONS) \
+ $$(JTREG_COV_OPTIONS) \
$$($1_TEST_NAME) \
&& $$(ECHO) $$$$? > $$($1_EXITCODE) \
|| $$(ECHO) $$$$? > $$($1_EXITCODE) \
--- a/make/autoconf/jdk-options.m4 Wed Feb 20 11:36:02 2019 -0800
+++ b/make/autoconf/jdk-options.m4 Wed Feb 20 11:43:59 2019 -0800
@@ -364,7 +364,7 @@
################################################################################
#
-# Gcov coverage data for hotspot
+# Native and Java code coverage
#
AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
[
--- a/make/conf/jib-profiles.js Wed Feb 20 11:36:02 2019 -0800
+++ b/make/conf/jib-profiles.js Wed Feb 20 11:43:59 2019 -0800
@@ -521,6 +521,15 @@
profiles[maketestName].default_make_targets = [ "test-make" ];
});
+ // Generate -gcov profiles
+ [ "linux-x64", "macosx-x64" ].forEach(function (name) {
+ var gcovName = name + "-gcov";
+ profiles[gcovName] = clone(profiles[name]);
+ profiles[gcovName].default_make_targets = ["product-bundles", "test-bundles"];
+ profiles[gcovName].configure_args = concat(profiles[gcovName].configure_args,
+ ["--enable-native-coverage", "--disable-warnings-as-errors"]);
+ });
+
// Profiles for building the zero jvm variant. These are used for verification.
var zeroProfiles = {
"linux-x64-zero": {
@@ -772,6 +781,40 @@
};
});
+ // Artifacts of gcov (native-code-coverage) profiles
+ [ "linux-x64", "macosx-x64" ].forEach(function (name) {
+ var o = artifactData[name]
+ var pf = o.platform
+ var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version);
+ var jdk_suffix = (o.jdk_suffix != null ? o.jdk_suffix : "tar.gz");
+ var gcovName = name + "-gcov";
+ profiles[gcovName].artifacts = {
+ jdk: {
+ local: "bundles/\\(jdk.*bin." + jdk_suffix + "\\)",
+ remote: [
+ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov." + jdk_suffix,
+ ],
+ subdir: jdk_subdir,
+ exploded: "images/jdk",
+ },
+ test: {
+ local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
+ remote: [
+ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-tests.tar.gz",
+ ],
+ exploded: "images/test"
+ },
+ jdk_symbols: {
+ local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+ remote: [
+ "bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-gcov-symbols.tar.gz",
+ ],
+ subdir: jdk_subdir,
+ exploded: "images/jdk"
+ },
+ };
+ });
+
// Profiles used to run tests.
var testOnlyProfiles = {
"run-test": {
@@ -798,6 +841,10 @@
} else {
testedProfileTest = testedProfile + ".test";
}
+ var testOnlyMake = [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ];
+ if (testedProfile.endsWith("-gcov")) {
+ testOnlyMake = concat(testOnlyMake, "GCOV_ENABLED=true")
+ }
var testOnlyProfilesPrebuilt = {
"run-test-prebuilt": {
target_os: input.build_os,
@@ -807,7 +854,7 @@
testedProfileTest
],
src: "src.conf",
- make_args: [ "run-test-prebuilt", "LOG_CMDLINES=true", "JTREG_VERBOSE=fail,error,time" ],
+ make_args: testOnlyMake,
environment: {
"BOOT_JDK": common.boot_jdk_home,
"JDK_IMAGE_DIR": input.get(testedProfileJDK, "home_path"),
--- a/src/hotspot/share/classfile/verifier.hpp Wed Feb 20 11:36:02 2019 -0800
+++ b/src/hotspot/share/classfile/verifier.hpp Wed Feb 20 11:43:59 2019 -0800
@@ -49,7 +49,7 @@
// Return false if the class is loaded by the bootstrap loader,
// or if defineClass was called requesting skipping verification
- // -Xverify:all/none override this value
+ // -Xverify:all overrides this value
static bool should_verify_for(oop class_loader, bool should_verify_class);
// Relax certain access checks to enable some broken 1.1 apps to run on 1.2.
--- a/src/hotspot/share/runtime/arguments.cpp Wed Feb 20 11:36:02 2019 -0800
+++ b/src/hotspot/share/runtime/arguments.cpp Wed Feb 20 11:43:59 2019 -0800
@@ -555,13 +555,13 @@
{ "UseImplicitStableValues", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
#ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
+ // These entries will generate build errors. Their purpose is to test the macros.
{ "dep > obs", JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
{ "dep > exp ", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::jdk(8) },
{ "obs > exp ", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::jdk(8) },
{ "not deprecated or obsolete", JDK_Version::undefined(), JDK_Version::undefined(), JDK_Version::jdk(9) },
{ "dup option", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
{ "dup option", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
- { "BytecodeVerificationRemote", JDK_Version::undefined(), JDK_Version::jdk(9), JDK_Version::undefined() },
#endif
{ NULL, JDK_Version(0), JDK_Version(0) }
@@ -2749,6 +2749,7 @@
if (FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, false) != JVMFlag::SUCCESS) {
return JNI_EINVAL;
}
+ warning("Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.");
} else if (is_bad_option(option, args->ignoreUnrecognized, "verification")) {
return JNI_EINVAL;
}
--- a/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template Wed Feb 20 11:36:02 2019 -0800
+++ b/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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 @@
import java.io.FileDescriptor;
import java.lang.ref.Reference;
+import java.util.Objects;
import jdk.internal.misc.VM;
import jdk.internal.ref.Cleaner;
import sun.nio.ch.DirectBuffer;
@@ -325,6 +326,40 @@
#end[rw]
}
+ public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+#if[rw]
+ if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_TO_ARRAY_THRESHOLD) {
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, dst.length);
+
+ long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
+ try {
+#if[!byte]
+ if (order() != ByteOrder.nativeOrder())
+ UNSAFE.copySwapMemory(null,
+ ix(index),
+ dst,
+ dstOffset,
+ (long)length << $LG_BYTES_PER_VALUE$,
+ (long)1 << $LG_BYTES_PER_VALUE$);
+ else
+#end[!byte]
+ UNSAFE.copyMemory(null,
+ ix(index),
+ dst,
+ dstOffset,
+ (long)length << $LG_BYTES_PER_VALUE$);
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ } else {
+ super.get(index, dst, offset, length);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
#end[rw]
public $Type$Buffer put($type$ x) {
@@ -440,6 +475,42 @@
#end[rw]
}
+ public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+#if[rw]
+ if (((long)length << $LG_BYTES_PER_VALUE$) > Bits.JNI_COPY_FROM_ARRAY_THRESHOLD) {
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, src.length);
+
+
+ long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
+ try {
+#if[!byte]
+ if (order() != ByteOrder.nativeOrder())
+ UNSAFE.copySwapMemory(src,
+ srcOffset,
+ null,
+ ix(index),
+ (long)length << $LG_BYTES_PER_VALUE$,
+ (long)1 << $LG_BYTES_PER_VALUE$);
+ else
+#end[!byte]
+ UNSAFE.copyMemory(src,
+ srcOffset,
+ null,
+ ix(index),
+ (long)length << $LG_BYTES_PER_VALUE$);
+ } finally {
+ Reference.reachabilityFence(this);
+ }
+ } else {
+ super.put(index, src, offset, length);
+ }
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
public $Type$Buffer compact() {
#if[rw]
int pos = position();
--- a/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Wed Feb 20 11:36:02 2019 -0800
+++ b/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -38,6 +38,8 @@
#end[rw]
*/
+import java.util.Objects;
+
class Heap$Type$Buffer$RW$
extends {#if[ro]?Heap}$Type$Buffer
{
@@ -181,6 +183,13 @@
return this;
}
+ public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, dst.length);
+ System.arraycopy(hb, ix(index), dst, offset, length);
+ return this;
+ }
+
public boolean isDirect() {
return false;
}
@@ -250,6 +259,17 @@
#end[rw]
}
+ public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+#if[rw]
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, src.length);
+ System.arraycopy(src, offset, hb, ix(index), length);
+ return this;
+#else[rw]
+ throw new ReadOnlyBufferException();
+#end[rw]
+ }
+
public $Type$Buffer compact() {
#if[rw]
System.arraycopy(hb, ix(position()), hb, ix(0), remaining());
--- a/src/java.base/share/classes/java/nio/X-Buffer.java.template Wed Feb 20 11:36:02 2019 -0800
+++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -36,6 +36,7 @@
import java.util.stream.$Streamtype$Stream;
#end[streamableType]
+import java.util.Objects;
import jdk.internal.util.ArraysSupport;
/**
@@ -50,11 +51,11 @@
* {@link #put($type$) <i>put</i>} methods that read and write
* single $type$s; </p></li>
*
- * <li><p> Relative {@link #get($type$[]) <i>bulk get</i>}
+ * <li><p> Absolute and relative {@link #get($type$[]) <i>bulk get</i>}
* methods that transfer contiguous sequences of $type$s from this buffer
* into an array; {#if[!byte]?and}</p></li>
*
- * <li><p> Relative {@link #put($type$[]) <i>bulk put</i>}
+ * <li><p> Absolute and relative {@link #put($type$[]) <i>bulk put</i>}
* methods that transfer contiguous sequences of $type$s from $a$
* $type$ array{#if[char]?, a string,} or some other $type$
* buffer into this buffer;{#if[!byte]? and} </p></li>
@@ -436,7 +437,6 @@
* @return The number of characters added to the buffer, or
* -1 if this source of characters is at its end
* @throws IOException if an I/O error occurs
- * @throws NullPointerException if target is null
* @throws ReadOnlyBufferException if target is a read only buffer
* @since 1.5
*/
@@ -764,6 +764,89 @@
return get(dst, 0, dst.length);
}
+ /**
+ * Absolute bulk <i>get</i> method.
+ *
+ * <p> This method transfers {@code length} $type$s from this
+ * buffer into the given array, starting at the given index in this
+ * buffer and at the given offset in the array. The position of this
+ * buffer is unchanged.
+ *
+ * <p> An invocation of this method of the form
+ * <code>src.get(index, dst, offset, length)</code>
+ * has exactly the same effect as the following loop except that it first
+ * checks the consistency of the supplied parameters and it is potentially
+ * much more efficient:
+ *
+ * <pre>{@code
+ * for (int i = offset, j = index; i < offset + length; i++, j++)
+ * dst[i] = src.get(j);
+ * }</pre>
+ *
+ * @param index
+ * The index in this buffer from which the first $type$ will be
+ * read; must be non-negative and less than {@code limit()}
+ *
+ * @param dst
+ * The destination array
+ *
+ * @param offset
+ * The offset within the array of the first $type$ to be
+ * written; must be non-negative and less than
+ * {@code dst.length}
+ *
+ * @param length
+ * The number of $type$s to be written to the given array;
+ * must be non-negative and no larger than the smaller of
+ * {@code limit() - index} and {@code dst.length - offset}
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the {@code index}, {@code offset}, and
+ * {@code length} parameters do not hold
+ *
+ * @since 13
+ */
+ public $Type$Buffer get(int index, $type$[] dst, int offset, int length) {
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, dst.length);
+ int end = offset + length;
+ for (int i = offset, j = index; i < end; i++, j++)
+ dst[i] = get(j);
+ return this;
+ }
+
+ /**
+ * Absolute bulk <i>get</i> method.
+ *
+ * <p> This method transfers $type$s from this buffer into the given
+ * destination array. The position of this buffer is unchanged. An
+ * invocation of this method of the form
+ * <code>src.get(index, dst)</code> behaves in exactly the same
+ * way as the invocation:
+ *
+ * <pre>
+ * src.get(index, dst, 0, dst.length) </pre>
+ *
+ * @param index
+ * The index in this buffer from which the first $type$ will be
+ * read; must be non-negative and less than {@code limit()}
+ *
+ * @param dst
+ * The destination array
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If {@code index} is negative, not smaller than {@code limit()},
+ * or {@code limit() - index < dst.length}
+ *
+ * @since 13
+ */
+ public $Type$Buffer get(int index, $type$[] dst) {
+ return get(index, dst, 0, dst.length);
+ }
// -- Bulk put operations --
@@ -842,7 +925,7 @@
*
* <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst.put(a[i]);
+ * dst.put(src[i]);
* }</pre>
*
* except that it first checks that there is sufficient space in this
@@ -853,12 +936,12 @@
*
* @param offset
* The offset within the array of the first $type$ to be read;
- * must be non-negative and no larger than {@code array.length}
+ * must be non-negative and no larger than {@code src.length}
*
* @param length
* The number of $type$s to be read from the given array;
* must be non-negative and no larger than
- * {@code array.length - offset}
+ * {@code src.length - offset}
*
* @return This buffer
*
@@ -908,6 +991,95 @@
return put(src, 0, src.length);
}
+ /**
+ * Absolute bulk <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> This method transfers {@code length} $type$s from the given
+ * array, starting at the given offset in the array and at the given index
+ * in this buffer. The position of this buffer is unchanged.
+ *
+ * <p> An invocation of this method of the form
+ * <code>dst.put(index, src, offset, length)</code>
+ * has exactly the same effect as the following loop except that it first
+ * checks the consistency of the supplied parameters and it is potentially
+ * much more efficient:
+ *
+ * <pre>{@code
+ * for (int i = offset, j = index; i < offset + length; i++, j++)
+ * dst.put(j, src[i]);
+ * }</pre>
+ *
+ * @param index
+ * The index in this buffer at which the first $type$ will be
+ * written; must be non-negative and less than {@code limit()}
+ *
+ * @param src
+ * The array from which $type$s are to be read
+ *
+ * @param offset
+ * The offset within the array of the first $type$ to be read;
+ * must be non-negative and less than {@code src.length}
+ *
+ * @param length
+ * The number of $type$s to be read from the given array;
+ * must be non-negative and no larger than the smaller of
+ * {@code limit() - index} and {@code src.length - offset}
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the {@code index}, {@code offset}, and
+ * {@code length} parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 13
+ */
+ public $Type$Buffer put(int index, $type$[] src, int offset, int length) {
+ if (isReadOnly())
+ throw new ReadOnlyBufferException();
+ Objects.checkFromIndexSize(index, length, limit());
+ Objects.checkFromIndexSize(offset, length, src.length);
+ int end = offset + length;
+ for (int i = offset, j = index; i < end; i++, j++)
+ this.put(j, src[i]);
+ return this;
+ }
+
+ /**
+ * Absolute bulk <i>put</i> method <i>(optional operation)</i>.
+ *
+ * <p> This method copies $type$s into this buffer from the given source
+ * array. The position of this buffer is unchanged. An invocation of this
+ * method of the form <code>dst.put(index, src)</code>
+ * behaves in exactly the same way as the invocation:
+ *
+ * <pre>
+ * dst.put(index, src, 0, src.length); </pre>
+ *
+ * @param index
+ * The index in this buffer at which the first $type$ will be
+ * written; must be non-negative and less than {@code limit()}
+ *
+ * @param src
+ * The array from which $type$s are to be read
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If {@code index} is negative, not smaller than {@code limit()},
+ * or {@code limit() - index < src.length}
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 13
+ */
+ public $Type$Buffer put(int index, $type$[] src) {
+ return put(index, src, 0, src.length);
+ }
+
#if[char]
/**
--- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java Wed Feb 20 11:36:02 2019 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java Wed Feb 20 11:43:59 2019 -0800
@@ -803,13 +803,8 @@
shc.sslConfig.getEnabledExtensions(
SSLHandshake.CLIENT_HELLO);
- ClientHelloMessage chm;
- try {
- chm = new ClientHelloMessage(shc, message, enabledExtensions);
- } catch (Exception e) {
- throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
- "ClientHelloMessage failure", e);
- }
+ ClientHelloMessage chm =
+ new ClientHelloMessage(shc, message, enabledExtensions);
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
SSLLogger.fine("Consuming ClientHello handshake message", chm);
}
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java Wed Feb 20 11:36:02 2019 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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,6 +26,8 @@
package sun.security.ssl;
import java.io.IOException;
+import java.nio.BufferOverflowException;
+import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.security.AlgorithmConstraints;
import java.security.CryptoPrimitive;
@@ -443,6 +445,10 @@
throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
"Unsupported handshake message: " +
SSLHandshake.nameOf(handshakeType), unsoe);
+ } catch (BufferUnderflowException | BufferOverflowException be) {
+ throw conContext.fatal(Alert.DECODE_ERROR,
+ "Illegal handshake message: " +
+ SSLHandshake.nameOf(handshakeType), be);
}
// update handshake hash after handshake message consumption.
--- a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java Wed Feb 20 11:36:02 2019 -0800
+++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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,6 +26,8 @@
package sun.security.ssl;
import java.io.IOException;
+import java.nio.BufferOverflowException;
+import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -74,6 +76,10 @@
throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
"Unsupported post-handshake message: " +
SSLHandshake.nameOf(handshakeType), unsoe);
+ } catch (BufferUnderflowException | BufferOverflowException be) {
+ throw conContext.fatal(Alert.DECODE_ERROR,
+ "Illegal handshake message: " +
+ SSLHandshake.nameOf(handshakeType), be);
}
}
}
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java Wed Feb 20 11:36:02 2019 -0800
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -106,7 +106,7 @@
static {
PrivilegedAction<String> getKeyExtractionProp =
() -> System.getProperty(
- "sun.security.pkcs11.disableKeyExtraction", "true");
+ "sun.security.pkcs11.disableKeyExtraction", "false");
String disableKeyExtraction =
AccessController.doPrivileged(getKeyExtractionProp);
DISABLE_NATIVE_KEYS_EXTRACTION =
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c Wed Feb 20 11:36:02 2019 -0800
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -151,14 +151,14 @@
unsigned int i = 0U;
unsigned long totalDataSize = 0UL, attributesCount = 0UL;
unsigned long totalCkAttributesSize = 0UL, totalNativeKeyInfoArraySize = 0UL;
- unsigned long* wrappedKeySizePtr = NULL;
+ jbyte* wrappedKeySizePtr = NULL;
jbyte* nativeKeyInfoArrayRawCkAttributes = NULL;
jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL;
jbyte* nativeKeyInfoArrayRawDataPtr = NULL;
CK_MECHANISM ckMechanism;
char iv[16] = {0x0};
CK_ULONG ckWrappedKeyLength = 0U;
- unsigned long* wrappedKeySizeWrappedKeyArrayPtr = NULL;
+ jbyte* wrappedKeySizeWrappedKeyArrayPtr = NULL;
CK_BYTE_PTR wrappedKeyBufferPtr = NULL;
CK_FUNCTION_LIST_PTR ckpFunctions = getFunctionList(env, obj);
CK_OBJECT_CLASS class;
@@ -234,7 +234,7 @@
// * sizes are expressed in bytes and data type is unsigned long
totalCkAttributesSize = attributesCount * sizeof(CK_ATTRIBUTE);
TRACE1("DEBUG: GetNativeKeyInfo attributesCount = %lu\n", attributesCount);
- TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %lu\n", sizeof(CK_ATTRIBUTE));
+ TRACE1("DEBUG: GetNativeKeyInfo sizeof CK_ATTRIBUTE = %zu\n", sizeof(CK_ATTRIBUTE));
TRACE1("DEBUG: GetNativeKeyInfo totalCkAttributesSize = %lu\n", totalCkAttributesSize);
TRACE1("DEBUG: GetNativeKeyInfo totalDataSize = %lu\n", totalDataSize);
@@ -254,8 +254,8 @@
goto cleanup;
}
- wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw +
- sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize);
+ wrappedKeySizePtr = nativeKeyInfoArrayRaw +
+ sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize;
memcpy(nativeKeyInfoArrayRaw, &totalCkAttributesSize, sizeof(unsigned long));
memcpy(nativeKeyInfoArrayRaw + sizeof(unsigned long) + totalCkAttributesSize,
@@ -330,15 +330,15 @@
memcpy(nativeKeyInfoWrappedKeyArrayRaw, nativeKeyInfoArrayRaw,
totalNativeKeyInfoArraySize);
wrappedKeySizeWrappedKeyArrayPtr =
- (unsigned long*)(nativeKeyInfoWrappedKeyArrayRaw +
+ nativeKeyInfoWrappedKeyArrayRaw +
sizeof(unsigned long)*2 + totalCkAttributesSize +
- totalDataSize);
+ totalDataSize;
memcpy(wrappedKeySizeWrappedKeyArrayPtr, &ckWrappedKeyLength, sizeof(unsigned long));
TRACE1("DEBUG: GetNativeKeyInfo 1st C_WrapKey wrappedKeyLength = %lu\n", ckWrappedKeyLength);
wrappedKeyBufferPtr =
- (unsigned char*)wrappedKeySizeWrappedKeyArrayPtr +
- sizeof(unsigned long);
+ (CK_BYTE_PTR) (wrappedKeySizeWrappedKeyArrayPtr +
+ sizeof(unsigned long));
rv = (*ckpFunctions->C_WrapKey)(ckSessionHandle, &ckMechanism,
jLongToCKULong(jWrappingKeyHandle),ckObjectHandle,
wrappedKeyBufferPtr, &ckWrappedKeyLength);
@@ -414,7 +414,7 @@
jbyte* nativeKeyInfoArrayRawCkAttributesPtr = NULL;
jbyte* nativeKeyInfoArrayRawDataPtr = NULL;
unsigned long totalDataSize = 0UL;
- unsigned long* wrappedKeySizePtr = NULL;
+ jbyte* wrappedKeySizePtr = NULL;
unsigned int i = 0U;
CK_MECHANISM ckMechanism;
char iv[16] = {0x0};
@@ -443,8 +443,8 @@
sizeof(unsigned long));
TRACE1("DEBUG: createNativeKey totalDataSize = %lu\n", totalDataSize);
- wrappedKeySizePtr = (unsigned long*)(nativeKeyInfoArrayRaw +
- sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize);
+ wrappedKeySizePtr = nativeKeyInfoArrayRaw +
+ sizeof(unsigned long)*2 + totalCkAttributesSize + totalDataSize;
memcpy(&ckWrappedKeyLength, wrappedKeySizePtr, sizeof(unsigned long));
TRACE1("DEBUG: createNativeKey wrappedKeyLength = %lu\n", ckWrappedKeyLength);
@@ -470,7 +470,8 @@
jMechanismToCKMechanism(env, jWrappingMech, &ckMechanism);
rv = (*ckpFunctions->C_UnwrapKey)(ckSessionHandle, &ckMechanism,
jLongToCKULong(jWrappingKeyHandle),
- (CK_BYTE_PTR)(wrappedKeySizePtr + 1), ckWrappedKeyLength,
+ (CK_BYTE_PTR)(wrappedKeySizePtr + sizeof(unsigned long)),
+ ckWrappedKeyLength,
(CK_ATTRIBUTE_PTR)nativeKeyInfoArrayRawCkAttributes,
jLongToCKULong(nativeKeyInfoCkAttributesCount),
&ckObjectHandle);
--- a/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java Wed Feb 20 11:36:02 2019 -0800
+++ b/src/jdk.jdi/share/classes/com/sun/tools/example/debug/tty/TTY.java Wed Feb 20 11:43:59 2019 -0800
@@ -931,7 +931,7 @@
// Old-style options (These should remain in place as long as
// the standard VM accepts them)
token.equals("-noasyncgc") || token.equals("-prof") ||
- token.equals("-verify") || token.equals("-noverify") ||
+ token.equals("-verify") ||
token.equals("-verifyremote") ||
token.equals("-verbosegc") ||
token.startsWith("-ms") || token.startsWith("-mx") ||
--- a/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/hotspot/jtreg/compiler/linkage/TestLinkageErrorInGenerateOopMap.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -42,7 +42,9 @@
public static void main(String args[]) throws Exception {
if (args.length == 0) {
// Spawn new VM instance to execute test
- String[] flags = {"-noverify", "-XX:-TieredCompilation",
+ String[] flags = {"-XX:-BytecodeVerificationRemote",
+ "-XX:-BytecodeVerificationLocal",
+ "-XX:-TieredCompilation",
"-XX:CompileCommand=dontinline,compiler/linkage/OSRWithBadOperandStack.m*",
"compiler.linkage.TestLinkageErrorInGenerateOopMap", "run"};
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
--- a/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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,7 +32,7 @@
* MissingMethodWithSuper.jcod
* MissingNestHost.jcod
* @run main TestInvokeErrors true
- * @run main/othervm -Xverify:none TestInvokeErrors false
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestInvokeErrors false
*/
public class TestInvokeErrors {
--- a/test/hotspot/jtreg/runtime/appcds/VerifierTest.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/hotspot/jtreg/runtime/appcds/VerifierTest.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -38,7 +38,7 @@
// Test verification settings for dumping & runtime
static final String VFY_ALL = "-Xverify:all";
static final String VFY_REMOTE = "-Xverify:remote"; // default
- static final String VFY_NONE = "-Xverify:none";
+ static final String VFY_NONE = "-XX:-BytecodeVerificationRemote, -XX:-BytecodeVerificationLocal";
static final String ERR =
"ERROR: class VerifierTestC was loaded unexpectedly";
@@ -140,7 +140,7 @@
{"app", VFY_ALL, VFY_REMOTE, VFY_ERR },
{"app", VFY_ALL, VFY_ALL, VFY_ERR },
{"app", VFY_ALL, VFY_NONE, ERR },
- // Dump app/ext with -Xverify:none
+ // Dump app/ext with verifier turned off
{"app", VFY_NONE, VFY_REMOTE, VFY_ERR},
{"app", VFY_NONE, VFY_ALL, MAP_FAIL},
{"app", VFY_NONE, VFY_NONE, ERR },
@@ -152,7 +152,7 @@
{"noApp", VFY_ALL, VFY_REMOTE, VFY_ERR},
{"noApp", VFY_ALL, VFY_ALL, VFY_ERR},
{"noApp", VFY_ALL, VFY_NONE, ERR},
- // Dump sys only with -Xverify:none
+ // Dump sys only with verifier turned off
{"noApp", VFY_NONE, VFY_REMOTE, VFY_ERR},
{"noApp", VFY_NONE, VFY_ALL, VFY_ERR},
{"noApp", VFY_NONE, VFY_NONE, ERR},
@@ -186,8 +186,19 @@
" with " + dump_setting +
", run with " + runtime_setting);
if (!dump_setting.equals(prev_dump_setting)) {
+ String dump_arg1;
+ String dump_arg2;
+ // Need to break this into two separate arguments.
+ if (dump_setting.equals(VFY_NONE)) {
+ dump_arg1 = "-XX:-BytecodeVerificationRemote";
+ dump_arg2 = "-XX:-BytecodeVerificationLocal";
+ } else {
+ // Redundant args should be harmless.
+ dump_arg1 = dump_arg2 = dump_setting;
+ }
+
OutputAnalyzer dumpOutput = TestCommon.dump(
- jar, dump_list, dump_setting,
+ jar, dump_list, dump_arg1, dump_arg2,
CDS_LOGGING,
// FIXME: the following options are for working around a GC
// issue - assert failure when dumping archive with the -Xverify:all
@@ -198,8 +209,17 @@
dumpOutput.shouldContain(VFY_INFO_MESSAGE);
}
}
+ String runtime_arg1;
+ String runtime_arg2;
+ if (runtime_setting.equals(VFY_NONE)) {
+ runtime_arg1 = "-XX:-BytecodeVerificationRemote";
+ runtime_arg2 = "-XX:-BytecodeVerificationLocal";
+ } else {
+ // Redundant args should be harmless.
+ runtime_arg1 = runtime_arg2 = runtime_setting;
+ }
TestCommon.run("-cp", jar,
- runtime_setting,
+ runtime_arg1, runtime_arg2,
"VerifierTest0")
.ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str));
prev_dump_setting = dump_setting;
@@ -229,7 +249,7 @@
{"app", VFY_ALL, VFY_REMOTE, PASS_RESULT },
{"app", VFY_ALL, VFY_ALL, PASS_RESULT },
{"app", VFY_ALL, VFY_NONE, PASS_RESULT },
- // Dump app/ext with -Xverify:none
+ // Dump app/ext with verifier turned off
{"app", VFY_NONE, VFY_REMOTE, PASS_RESULT},
{"app", VFY_NONE, VFY_ALL, MAP_FAIL},
{"app", VFY_NONE, VFY_NONE, PASS_RESULT },
@@ -244,8 +264,17 @@
" with " + dump_setting +
", run with " + runtime_setting);
if (!dump_setting.equals(prev_dump_setting)) {
+ String dump_arg1;
+ String dump_arg2;
+ if (dump_setting.equals(VFY_NONE)) {
+ dump_arg1 = "-XX:-BytecodeVerificationRemote";
+ dump_arg2 = "-XX:-BytecodeVerificationLocal";
+ } else {
+ // Redundant args should be harmless.
+ dump_arg1 = dump_arg2 = dump_setting;
+ }
OutputAnalyzer dumpOutput = TestCommon.dump(
- jar, appClasses, dump_setting,
+ jar, appClasses, dump_arg1, dump_arg2,
CDS_LOGGING,
// FIXME: the following options are for working around a GC
// issue - assert failure when dumping archive with the -Xverify:all
@@ -256,8 +285,17 @@
dumpOutput.shouldContain(VFY_INFO_MESSAGE);
}
}
+ String runtime_arg1;
+ String runtime_arg2;
+ if (runtime_setting.equals(VFY_NONE)) {
+ runtime_arg1 = "-XX:-BytecodeVerificationRemote";
+ runtime_arg2 = "-XX:-BytecodeVerificationLocal";
+ } else {
+ // Redundant args should be harmless.
+ runtime_arg1 = runtime_arg2 = runtime_setting;
+ }
TestCommon.run("-cp", jar,
- runtime_setting,
+ runtime_arg1, runtime_arg2,
"Hi")
.ifNoMappingFailure(output -> checkRuntimeOutput(output, expected_output_str));
prev_dump_setting = dump_setting;
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm Wed Feb 20 11:36:02 2019 -0800
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/HasLocalClone.jasm Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -28,7 +28,7 @@
* @summary Check that invokevirtual of clone() finds the clone() method that
* is local to the calling class.
* @compile DefMethClone.jasm SuperClass.jasm I1.java HasLocalClone.jasm
- * @run main/othervm -noverify HasLocalClone
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal HasLocalClone
*/
// The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm Wed Feb 20 11:36:02 2019 -0800
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalClone.jasm Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -28,7 +28,7 @@
* @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
* even if a superinterface has a default method named clone().
* @compile DefMethClone.jasm SuperClass.jasm I1.java NoLocalClone.jasm
- * @run main/othervm -noverify NoLocalClone
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalClone
*/
// The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm Wed Feb 20 11:36:02 2019 -0800
+++ b/test/hotspot/jtreg/runtime/clone/invokevirtual/NoLocalCloneAbstr.jasm Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -28,7 +28,7 @@
* @summary Check that invokevirtual of clone() calls java.lang.Object.clone()
* even if a superinterface has an abstract method named clone().
* @compile DefMethClone.jasm SuperClass.jasm I1Abstr.java NoLocalCloneAbstr.jasm
- * @run main/othervm -noverify NoLocalCloneAbstr
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal NoLocalCloneAbstr
*/
// The below .jasm code implements the following java code:
--- a/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/hotspot/jtreg/runtime/lambda-features/TestStaticandInstance.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, 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 @@
* @bug 8087342
* @summary Test linkresolver search static, instance and overpass duplicates
* @modules java.base/jdk.internal.org.objectweb.asm
- * @run main/othervm -Xverify:none TestStaticandInstance
+ * @run main/othervm -XX:-BytecodeVerificationRemote -XX:-BytecodeVerificationLocal TestStaticandInstance
*/
@@ -94,7 +94,7 @@
default int q() { return 3; } // trigger defmeth processing: C gets AME overpass
}
-// C gets static, private and AME overpass m()I with -Xverify:none
+// C gets static, private and AME overpass m()I with the verifier turned off
class C implements I {
static int m() { return 1;} // javac with "n()" and patch to "m()"
private int m() { return 2;} // javac with public and patch to private
--- a/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2019, 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,5 +80,5 @@
# Finally we run the test
(cd "${TESTCLASSES}"; \
- $JAVA ${TESTVMOPTS} -Xverify:none -Xlog:class+unload \
+ $JAVA ${TESTVMOPTS} -Xlog:class+unload \
-javaagent:ClassUnloadTest.jar ClassUnloadTest "${OTHERDIR}" Bar.jar)
--- a/test/jdk/java/nio/Buffer/Basic-X.java.template Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/nio/Buffer/Basic-X.java.template Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,18 @@
}
}
+ private static void absBulkGet($Type$Buffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ $type$[] a = new $type$[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)(($type$)ic(i)));
+ }
+ }
+
private static void relPut($Type$Buffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray($Type$Buffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ $type$[] a = new $type$[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = ($type$)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset($Type$Buffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
#if[char]
bulkPutString(b);
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, ($type$[])null, 0, 42));
+
+ $type$[] tmpa = new $type$[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put($Type$Buffer) should not change source position
final $Type$Buffer src = $Type$Buffer.allocate(1);
@@ -903,6 +960,13 @@
b.position(6);
ck(b, b.subSequence(0,3).toString().equals("ghi"));
+ // absolute bulk get
+ char[] c = new char[end + 1 - (start - 1) + 1]; // [start - 1, end + 1]
+ b.limit(end + 2);
+ b.get(start - 1, c, 0, c.length);
+ for (int i = 0; i < c.length; i++)
+ ck(b, c[i], s.charAt(start - 1 + i));
+
// The index, relative to the position, must be non-negative and
// smaller than remaining().
catchIndexOutOfBounds(b, () -> b.charAt(-1));
--- a/test/jdk/java/nio/Buffer/Basic.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/nio/Buffer/Basic.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -24,9 +24,9 @@
/* @test
* @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 8065556
- * 8149469
+ * 4526177 4463011 4660660 4661219 4663521 4782970 4804304 4938424 5029431
+ * 6231529 6221101 6234263 6535542 6591971 6593946 6795561 7190219 7199551
+ * 8065556 8149469
* @modules java.base/java.nio:open
* java.base/jdk.internal.misc
* @author Mark Reinhold
--- a/test/jdk/java/nio/Buffer/BasicByte.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/nio/Buffer/BasicByte.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,18 @@
}
}
+ private static void absBulkGet(ByteBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ byte[] a = new byte[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((byte)ic(i)));
+ }
+ }
+
private static void relPut(ByteBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(ByteBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ byte[] a = new byte[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (byte)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(ByteBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (byte[])null, 0, 42));
+
+ byte[] tmpa = new byte[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(ByteBuffer) should not change source position
final ByteBuffer src = ByteBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final byte [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicChar.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/nio/Buffer/BasicChar.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,18 @@
}
}
+ private static void absBulkGet(CharBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ char[] a = new char[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((char)ic(i)));
+ }
+ }
+
private static void relPut(CharBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(CharBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ char[] a = new char[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (char)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(CharBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
bulkPutString(b);
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (char[])null, 0, 42));
+
+ char[] tmpa = new char[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(CharBuffer) should not change source position
final CharBuffer src = CharBuffer.allocate(1);
@@ -903,6 +960,13 @@
b.position(6);
ck(b, b.subSequence(0,3).toString().equals("ghi"));
+ // absolute bulk get
+ char[] c = new char[end + 1 - (start - 1) + 1]; // [start - 1, end + 1]
+ b.limit(end + 2);
+ b.get(start - 1, c, 0, c.length);
+ for (int i = 0; i < c.length; i++)
+ ck(b, c[i], s.charAt(start - 1 + i));
+
// The index, relative to the position, must be non-negative and
// smaller than remaining().
catchIndexOutOfBounds(b, () -> b.charAt(-1));
--- a/test/jdk/java/nio/Buffer/BasicDouble.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/nio/Buffer/BasicDouble.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,18 @@
}
}
+ private static void absBulkGet(DoubleBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ double[] a = new double[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((double)ic(i)));
+ }
+ }
+
private static void relPut(DoubleBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(DoubleBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ double[] a = new double[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (double)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(DoubleBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (double[])null, 0, 42));
+
+ double[] tmpa = new double[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(DoubleBuffer) should not change source position
final DoubleBuffer src = DoubleBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final double [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicFloat.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/nio/Buffer/BasicFloat.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,18 @@
}
}
+ private static void absBulkGet(FloatBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ float[] a = new float[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((float)ic(i)));
+ }
+ }
+
private static void relPut(FloatBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(FloatBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ float[] a = new float[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (float)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(FloatBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (float[])null, 0, 42));
+
+ float[] tmpa = new float[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(FloatBuffer) should not change source position
final FloatBuffer src = FloatBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final float [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicInt.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/nio/Buffer/BasicInt.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,18 @@
}
}
+ private static void absBulkGet(IntBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ int[] a = new int[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((int)ic(i)));
+ }
+ }
+
private static void relPut(IntBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(IntBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ int[] a = new int[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (int)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(IntBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (int[])null, 0, 42));
+
+ int[] tmpa = new int[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(IntBuffer) should not change source position
final IntBuffer src = IntBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final int [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicLong.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/nio/Buffer/BasicLong.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,18 @@
}
}
+ private static void absBulkGet(LongBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ long[] a = new long[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((long)ic(i)));
+ }
+ }
+
private static void relPut(LongBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(LongBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ long[] a = new long[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (long)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(LongBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (long[])null, 0, 42));
+
+ long[] tmpa = new long[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(LongBuffer) should not change source position
final LongBuffer src = LongBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final long [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/java/nio/Buffer/BasicShort.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/java/nio/Buffer/BasicShort.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,18 @@
}
}
+ private static void absBulkGet(ShortBuffer b) {
+ int n = b.capacity();
+ int len = n - 7*2;
+ short[] a = new short[n + 7];
+ b.position(42);
+ b.get(7, a, 7, len);
+ ck(b, b.position() == 42);
+ for (int i = 0; i < len; i++) {
+ ck(b, (long)a[i + 7], (long)((short)ic(i)));
+ }
+ }
+
private static void relPut(ShortBuffer b) {
int n = b.capacity();
b.clear();
@@ -136,6 +148,20 @@
}
}
+ private static void absBulkPutArray(ShortBuffer b) {
+ int n = b.capacity();
+ b.clear();
+ int lim = n - 7;
+ int len = lim - 7;
+ b.limit(lim);
+ short[] a = new short[len + 7];
+ for (int i = 0; i < len; i++)
+ a[i + 7] = (short)ic(i);
+ b.position(42);
+ b.put(7, a, 7, len);
+ ck(b, b.position() == 42);
+ }
+
//6231529
private static void callReset(ShortBuffer b) {
b.position(0);
@@ -452,6 +478,10 @@
fail(problem + String.format(": x=%s y=%s", x, y), xb, yb);
}
+ private static void catchNullArgument(Buffer b, Runnable thunk) {
+ tryCatch(b, NullPointerException.class, thunk);
+ }
+
private static void catchIllegalArgument(Buffer b, Runnable thunk) {
tryCatch(b, IllegalArgumentException.class, thunk);
}
@@ -476,7 +506,10 @@
if (ex.isAssignableFrom(x.getClass())) {
caught = true;
} else {
- fail(x.getMessage() + " not expected");
+ String s = x.getMessage();
+ if (s == null)
+ s = x.getClass().getName();
+ fail(s + " not expected");
}
}
if (!caught) {
@@ -513,6 +546,9 @@
bulkPutBuffer(b);
relGet(b);
+ absBulkPutArray(b);
+ absBulkGet(b);
+
@@ -612,6 +648,26 @@
}
}
+ // Exceptions in absolute bulk operations
+
+ catchNullArgument(b, () -> b.get(7, null, 0, 42));
+ catchNullArgument(b, () -> b.put(7, (short[])null, 0, 42));
+
+ short[] tmpa = new short[42];
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.get(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.get(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.get(b.limit() - 41, tmpa, 0, 42));
+
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, -1, 42));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 42, 1));
+ catchIndexOutOfBounds(b, () -> b.put(7, tmpa, 41, -1));
+ catchIndexOutOfBounds(b, () -> b.put(-1, tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit(), tmpa, 0, 1));
+ catchIndexOutOfBounds(b, () -> b.put(b.limit() - 41, tmpa, 0, 42));
+
// Values
b.clear();
@@ -819,6 +875,7 @@
catchReadOnlyBuffer(b, () -> absPut(rb));
catchReadOnlyBuffer(b, () -> bulkPutArray(rb));
catchReadOnlyBuffer(b, () -> bulkPutBuffer(rb));
+ catchReadOnlyBuffer(b, () -> absBulkPutArray(rb));
// put(ShortBuffer) should not change source position
final ShortBuffer src = ShortBuffer.allocate(1);
@@ -928,6 +985,13 @@
+
+
+
+
+
+
+
public static void test(final short [] ba) {
int offset = 47;
int length = 900;
--- a/test/jdk/javax/net/ssl/interop/ClientHelloBufferUnderflowException.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/jdk/javax/net/ssl/interop/ClientHelloBufferUnderflowException.java Wed Feb 20 11:43:59 2019 -0800
@@ -28,7 +28,7 @@
/*
* @test
- * @bug 8215790
+ * @bug 8215790 8219389
* @summary Verify exception
* @modules java.base/sun.security.util
* @run main/othervm ClientHelloBufferUnderflowException
@@ -45,12 +45,15 @@
try {
(new ClientHelloBufferUnderflowException()).run();
} catch (SSLHandshakeException e) {
- System.out.println("Correct exception thrown");
+ System.out.println("Correct exception thrown: " + e);
+ return;
} catch (Exception e) {
System.out.println("Failed: Exception not SSLHandShakeException");
System.out.println(e.getMessage());
throw e;
}
+
+ throw new Exception("No expected exception");
}
@Override
@@ -76,6 +79,7 @@
} catch (Exception e) {
// ignore
}
+
return bytes;
}
}
--- a/test/langtools/tools/javac/lambda/MethodReference66.java Wed Feb 20 11:36:02 2019 -0800
+++ b/test/langtools/tools/javac/lambda/MethodReference66.java Wed Feb 20 11:43:59 2019 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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 @@
* @test
* @bug 8009299
* @summary Javac crashes when compiling method reference to static interface method
- * @run main/othervm -Xverify:none MethodReference66
+ * @run main/othervm MethodReference66
*/
public class MethodReference66 {