Merge
This commit is contained in:
commit
bc72fc2242
2
.hgtags
2
.hgtags
@ -384,3 +384,5 @@ d273dfe9a126d3bffe92072547fef2cd1361b0eb jdk-9+138
|
|||||||
65477538bec32963dc41153d89c4417eb46c45fc jdk-9+139
|
65477538bec32963dc41153d89c4417eb46c45fc jdk-9+139
|
||||||
0875007901f7d364a08220b052f0c81003e9c8c5 jdk-9+140
|
0875007901f7d364a08220b052f0c81003e9c8c5 jdk-9+140
|
||||||
9aadd2163b568d76f8969ad2fb404a63733da359 jdk-9+141
|
9aadd2163b568d76f8969ad2fb404a63733da359 jdk-9+141
|
||||||
|
df0e03e3ca0ed1307793017dfc1a054c8726131c jdk-9+142
|
||||||
|
d62173b931bf5b6bffc6e80a9060bb2e8b8efc75 jdk-9+143
|
||||||
|
@ -384,3 +384,5 @@ d7f519b004254b19e384131d9f0d0e40e31a0fd3 jdk-9+137
|
|||||||
7dcf453eacae79ee86a6bcc75fd0b546fc99b48a jdk-9+139
|
7dcf453eacae79ee86a6bcc75fd0b546fc99b48a jdk-9+139
|
||||||
a5815c6098a241d3a1df64d22b84b3524e4a77df jdk-9+140
|
a5815c6098a241d3a1df64d22b84b3524e4a77df jdk-9+140
|
||||||
f64afae7f1a5608e438585bbf0bc23785e69cba0 jdk-9+141
|
f64afae7f1a5608e438585bbf0bc23785e69cba0 jdk-9+141
|
||||||
|
2b3e5caafe3594ea507c37675c4d3086f415dc64 jdk-9+142
|
||||||
|
1fc62b1c629fb80fdaa639d3b59452a184f0d705 jdk-9+143
|
||||||
|
@ -280,7 +280,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
|
|||||||
else
|
else
|
||||||
# Default works for linux, might work on other platforms as well.
|
# Default works for linux, might work on other platforms as well.
|
||||||
SHARED_LIBRARY_FLAGS='-shared'
|
SHARED_LIBRARY_FLAGS='-shared'
|
||||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
|
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
|
||||||
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
||||||
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
|
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
|
||||||
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
|
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
|
||||||
@ -305,7 +305,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
|
|||||||
# Default works for linux, might work on other platforms as well.
|
# Default works for linux, might work on other platforms as well.
|
||||||
PICFLAG='-fPIC'
|
PICFLAG='-fPIC'
|
||||||
SHARED_LIBRARY_FLAGS='-shared'
|
SHARED_LIBRARY_FLAGS='-shared'
|
||||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
|
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
|
||||||
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
||||||
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
|
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
|
||||||
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
|
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
|
||||||
@ -315,7 +315,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_LIBS],
|
|||||||
C_FLAG_REORDER='-xF'
|
C_FLAG_REORDER='-xF'
|
||||||
CXX_FLAG_REORDER='-xF'
|
CXX_FLAG_REORDER='-xF'
|
||||||
SHARED_LIBRARY_FLAGS="-G"
|
SHARED_LIBRARY_FLAGS="-G"
|
||||||
SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN[$]1'
|
SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN[$]1'
|
||||||
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
|
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
|
||||||
SET_SHARED_LIBRARY_NAME='-h [$]1'
|
SET_SHARED_LIBRARY_NAME='-h [$]1'
|
||||||
SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
|
SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
|
||||||
@ -759,6 +759,10 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
|||||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
||||||
;;
|
;;
|
||||||
|
s390 )
|
||||||
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
|
||||||
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
||||||
|
;;
|
||||||
* )
|
* )
|
||||||
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||||
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
$2CFLAGS_JDK="${$2CFLAGS_JDK} -fno-strict-aliasing"
|
||||||
@ -940,6 +944,10 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
|||||||
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
||||||
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=power7 -mtune=power8"
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mcpu=power7 -mtune=power8"
|
||||||
fi
|
fi
|
||||||
|
elif test "x$OPENJDK_$1_CPU" = xs390x; then
|
||||||
|
if test "x$OPENJDK_$1_OS" = xlinux; then
|
||||||
|
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -mbackchain -march=z10"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
|
if test "x$OPENJDK_$1_CPU_ENDIAN" = xlittle; then
|
||||||
@ -999,6 +1007,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
|
|||||||
|
|
||||||
# Setup some hard coded includes
|
# Setup some hard coded includes
|
||||||
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
|
$2COMMON_CCXXFLAGS_JDK="[$]$2COMMON_CCXXFLAGS_JDK \
|
||||||
|
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
||||||
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
||||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
|
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS/native/include \
|
||||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
|
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_$1_OS_TYPE/native/include \
|
||||||
|
@ -5093,7 +5093,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
|||||||
#CUSTOM_AUTOCONF_INCLUDE
|
#CUSTOM_AUTOCONF_INCLUDE
|
||||||
|
|
||||||
# Do not change or remove the following line, it is needed for consistency checks:
|
# Do not change or remove the following line, it is needed for consistency checks:
|
||||||
DATE_WHEN_GENERATED=1477108079
|
DATE_WHEN_GENERATED=1478524503
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
@ -49070,7 +49070,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
|
|||||||
else
|
else
|
||||||
# Default works for linux, might work on other platforms as well.
|
# Default works for linux, might work on other platforms as well.
|
||||||
SHARED_LIBRARY_FLAGS='-shared'
|
SHARED_LIBRARY_FLAGS='-shared'
|
||||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN$1'
|
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN$1'
|
||||||
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
||||||
SET_SHARED_LIBRARY_NAME='-Wl,-soname=$1'
|
SET_SHARED_LIBRARY_NAME='-Wl,-soname=$1'
|
||||||
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=$1'
|
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=$1'
|
||||||
@ -49095,7 +49095,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
|
|||||||
# Default works for linux, might work on other platforms as well.
|
# Default works for linux, might work on other platforms as well.
|
||||||
PICFLAG='-fPIC'
|
PICFLAG='-fPIC'
|
||||||
SHARED_LIBRARY_FLAGS='-shared'
|
SHARED_LIBRARY_FLAGS='-shared'
|
||||||
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$$$ORIGIN$1'
|
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN$1'
|
||||||
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
|
||||||
SET_SHARED_LIBRARY_NAME='-Wl,-soname=$1'
|
SET_SHARED_LIBRARY_NAME='-Wl,-soname=$1'
|
||||||
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=$1'
|
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=$1'
|
||||||
@ -49105,7 +49105,7 @@ $as_echo "$ac_cv_c_bigendian" >&6; }
|
|||||||
C_FLAG_REORDER='-xF'
|
C_FLAG_REORDER='-xF'
|
||||||
CXX_FLAG_REORDER='-xF'
|
CXX_FLAG_REORDER='-xF'
|
||||||
SHARED_LIBRARY_FLAGS="-G"
|
SHARED_LIBRARY_FLAGS="-G"
|
||||||
SET_EXECUTABLE_ORIGIN='-R\$$$$ORIGIN$1'
|
SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN$1'
|
||||||
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
|
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
|
||||||
SET_SHARED_LIBRARY_NAME='-h $1'
|
SET_SHARED_LIBRARY_NAME='-h $1'
|
||||||
SET_SHARED_LIBRARY_MAPFILE='-M$1'
|
SET_SHARED_LIBRARY_MAPFILE='-M$1'
|
||||||
@ -49840,6 +49840,10 @@ $as_echo "$supports" >&6; }
|
|||||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||||
;;
|
;;
|
||||||
|
s390 )
|
||||||
|
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
|
||||||
|
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||||
|
;;
|
||||||
* )
|
* )
|
||||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||||
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
CFLAGS_JDK="${CFLAGS_JDK} -fno-strict-aliasing"
|
||||||
@ -50122,6 +50126,10 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
|||||||
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
||||||
JVM_CFLAGS="$JVM_CFLAGS -mcpu=power7 -mtune=power8"
|
JVM_CFLAGS="$JVM_CFLAGS -mcpu=power7 -mtune=power8"
|
||||||
fi
|
fi
|
||||||
|
elif test "x$OPENJDK_TARGET_CPU" = xs390x; then
|
||||||
|
if test "x$OPENJDK_TARGET_OS" = xlinux; then
|
||||||
|
JVM_CFLAGS="$JVM_CFLAGS -mbackchain -march=z10"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
|
if test "x$OPENJDK_TARGET_CPU_ENDIAN" = xlittle; then
|
||||||
@ -50270,6 +50278,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
|||||||
|
|
||||||
# Setup some hard coded includes
|
# Setup some hard coded includes
|
||||||
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
|
COMMON_CCXXFLAGS_JDK="$COMMON_CCXXFLAGS_JDK \
|
||||||
|
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
||||||
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
||||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
|
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS/native/include \
|
||||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
|
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/include \
|
||||||
@ -50655,6 +50664,10 @@ $as_echo "$supports" >&6; }
|
|||||||
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
# on ppc we don't prevent gcc to omit frame pointer but do prevent strict aliasing
|
||||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
|
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
|
||||||
;;
|
;;
|
||||||
|
s390 )
|
||||||
|
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer -mbackchain -march=z10"
|
||||||
|
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
|
||||||
|
;;
|
||||||
* )
|
* )
|
||||||
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK -fno-omit-frame-pointer"
|
||||||
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
|
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -fno-strict-aliasing"
|
||||||
@ -50937,6 +50950,10 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
|||||||
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
|
||||||
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -mcpu=power7 -mtune=power8"
|
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -mcpu=power7 -mtune=power8"
|
||||||
fi
|
fi
|
||||||
|
elif test "x$OPENJDK_BUILD_CPU" = xs390x; then
|
||||||
|
if test "x$OPENJDK_BUILD_OS" = xlinux; then
|
||||||
|
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -mbackchain -march=z10"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$OPENJDK_BUILD_CPU_ENDIAN" = xlittle; then
|
if test "x$OPENJDK_BUILD_CPU_ENDIAN" = xlittle; then
|
||||||
@ -51085,6 +51102,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
|
|||||||
|
|
||||||
# Setup some hard coded includes
|
# Setup some hard coded includes
|
||||||
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK \
|
OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK="$OPENJDK_BUILD_COMMON_CCXXFLAGS_JDK \
|
||||||
|
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
|
||||||
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
-I${JDK_TOPDIR}/src/java.base/share/native/include \
|
||||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_BUILD_OS/native/include \
|
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_BUILD_OS/native/include \
|
||||||
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/include \
|
-I${JDK_TOPDIR}/src/java.base/$OPENJDK_BUILD_OS_TYPE/native/include \
|
||||||
|
@ -265,6 +265,10 @@ IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
|
|||||||
BUNDLES_OUTPUTDIR=$(BUILD_OUTPUT)/bundles
|
BUNDLES_OUTPUTDIR=$(BUILD_OUTPUT)/bundles
|
||||||
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make
|
TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make
|
||||||
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
|
MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
|
||||||
|
|
||||||
|
# By default, output javadoc directly into image
|
||||||
|
JAVADOC_OUTPUTDIR = $(DOCS_IMAGE_DIR)
|
||||||
|
|
||||||
# This does not get overridden in a bootcycle build
|
# This does not get overridden in a bootcycle build
|
||||||
CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
|
CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
|
||||||
BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
|
BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
|
||||||
@ -784,11 +788,12 @@ SYMBOLS_IMAGE_SUBDIR:=symbols
|
|||||||
SYMBOLS_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(SYMBOLS_IMAGE_SUBDIR)
|
SYMBOLS_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(SYMBOLS_IMAGE_SUBDIR)
|
||||||
|
|
||||||
# Interim image
|
# Interim image
|
||||||
|
INTERIM_JMODS_DIR := $(SUPPORT_OUTPUTDIR)/interim-jmods
|
||||||
INTERIM_IMAGE_DIR := $(SUPPORT_OUTPUTDIR)/interim-image
|
INTERIM_IMAGE_DIR := $(SUPPORT_OUTPUTDIR)/interim-image
|
||||||
|
|
||||||
# Docs image
|
# Docs image
|
||||||
DOCS_IMAGE_SUBDIR := docs
|
DOCS_IMAGE_SUBDIR := docs
|
||||||
DOCS_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(DOCS_IMAGE_SUBDIR)
|
DOCS_IMAGE_DIR = $(IMAGES_OUTPUTDIR)/$(DOCS_IMAGE_SUBDIR)
|
||||||
|
|
||||||
# Macosx bundles directory definitions
|
# Macosx bundles directory definitions
|
||||||
JDK_MACOSX_BUNDLE_SUBDIR=jdk-bundle
|
JDK_MACOSX_BUNDLE_SUBDIR=jdk-bundle
|
||||||
|
@ -384,3 +384,5 @@ aa053a3faf266c12b4fd5272da431a3e08e4a3e3 jdk-9+136
|
|||||||
8c9da7fc5b07c606afd571c7012441b77dda83b2 jdk-9+139
|
8c9da7fc5b07c606afd571c7012441b77dda83b2 jdk-9+139
|
||||||
9f3fc931bc230f44f2a58d75f7f6360af98bb113 jdk-9+140
|
9f3fc931bc230f44f2a58d75f7f6360af98bb113 jdk-9+140
|
||||||
b32f998da32b488ec7c4e9dbb3c750841b48e74d jdk-9+141
|
b32f998da32b488ec7c4e9dbb3c750841b48e74d jdk-9+141
|
||||||
|
408c9c621938ca028e20bced0459f815de47eba8 jdk-9+142
|
||||||
|
6211236ef15ec796806357608b1dd1b70c258ece jdk-9+143
|
||||||
|
@ -544,3 +544,5 @@ fc0956308c7a586267c5dd35dff74f773aa9c3eb jdk-9+138
|
|||||||
08492e67bf3226784dab3bf9ae967382ddbc1af5 jdk-9+139
|
08492e67bf3226784dab3bf9ae967382ddbc1af5 jdk-9+139
|
||||||
fec31089c2ef5a12dd64f401b0bf2e00f56ee0d0 jdk-9+140
|
fec31089c2ef5a12dd64f401b0bf2e00f56ee0d0 jdk-9+140
|
||||||
160a00bc6ed0af1fdf8418fc65e6bddbbc0c536d jdk-9+141
|
160a00bc6ed0af1fdf8418fc65e6bddbbc0c536d jdk-9+141
|
||||||
|
7b48d63dfd6b8e2657288de3d7b1f153dee02d7e jdk-9+142
|
||||||
|
d87d5d430c42342f0320ca7f5cbe0cbd1f9d62ba jdk-9+143
|
||||||
|
@ -135,14 +135,14 @@ TARGETS += $(JVMTI_OUTPUTDIR)/jvmtiEnvRecommended.cpp
|
|||||||
# Copy jvmti.h to include dir
|
# Copy jvmti.h to include dir
|
||||||
|
|
||||||
# The file is the same regardless of jvm variant. Only let one do the copy.
|
# The file is the same regardless of jvm variant. Only let one do the copy.
|
||||||
#ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
|
ifeq ($(JVM_VARIANT), $(firstword $(JVM_VARIANTS)))
|
||||||
# $(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
|
$(eval $(call SetupCopyFiles, COPY_JVMTI_H, \
|
||||||
# DEST := $(SUPPORT_OUTPUTDIR)/modules_include/java.base, \
|
DEST := $(SUPPORT_OUTPUTDIR)/modules_include/java.base, \
|
||||||
# FILES := $(JVMTI_OUTPUTDIR)/jvmti.h, \
|
FILES := $(JVMTI_OUTPUTDIR)/jvmti.h, \
|
||||||
# ))
|
))
|
||||||
|
|
||||||
# TARGETS += $(COPY_JVMTI_H)
|
TARGETS += $(COPY_JVMTI_H)
|
||||||
#endif
|
endif
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Create trace files in gensrc/tracefiles
|
# Create trace files in gensrc/tracefiles
|
||||||
|
@ -125,7 +125,6 @@ JVM_GetPrimitiveArrayElement
|
|||||||
JVM_GetProtectionDomain
|
JVM_GetProtectionDomain
|
||||||
JVM_GetSimpleBinaryName
|
JVM_GetSimpleBinaryName
|
||||||
JVM_GetStackAccessControlContext
|
JVM_GetStackAccessControlContext
|
||||||
JVM_GetStackTraceElements
|
|
||||||
JVM_GetSystemPackage
|
JVM_GetSystemPackage
|
||||||
JVM_GetSystemPackages
|
JVM_GetSystemPackages
|
||||||
JVM_GetTemporaryDirectory
|
JVM_GetTemporaryDirectory
|
||||||
@ -135,6 +134,8 @@ JVM_HasReferencePendingList
|
|||||||
JVM_HoldsLock
|
JVM_HoldsLock
|
||||||
JVM_IHashCode
|
JVM_IHashCode
|
||||||
JVM_InitProperties
|
JVM_InitProperties
|
||||||
|
JVM_InitStackTraceElement
|
||||||
|
JVM_InitStackTraceElementArray
|
||||||
JVM_InternString
|
JVM_InternString
|
||||||
JVM_Interrupt
|
JVM_Interrupt
|
||||||
JVM_InvokeMethod
|
JVM_InvokeMethod
|
||||||
@ -178,7 +179,6 @@ JVM_StartThread
|
|||||||
JVM_StopThread
|
JVM_StopThread
|
||||||
JVM_SupportsCX8
|
JVM_SupportsCX8
|
||||||
JVM_SuspendThread
|
JVM_SuspendThread
|
||||||
JVM_ToStackTraceElement
|
|
||||||
JVM_TotalMemory
|
JVM_TotalMemory
|
||||||
JVM_UnloadLibrary
|
JVM_UnloadLibrary
|
||||||
JVM_WaitForReferencePendingList
|
JVM_WaitForReferencePendingList
|
||||||
|
@ -2175,6 +2175,14 @@ void java_lang_StackTraceElement::fill_in(Handle element,
|
|||||||
const char* str = holder->external_name();
|
const char* str = holder->external_name();
|
||||||
oop classname = StringTable::intern((char*) str, CHECK);
|
oop classname = StringTable::intern((char*) str, CHECK);
|
||||||
java_lang_StackTraceElement::set_declaringClass(element(), classname);
|
java_lang_StackTraceElement::set_declaringClass(element(), classname);
|
||||||
|
java_lang_StackTraceElement::set_declaringClassObject(element(), holder->java_mirror());
|
||||||
|
|
||||||
|
oop loader = holder->class_loader();
|
||||||
|
if (loader != NULL) {
|
||||||
|
oop loader_name = java_lang_ClassLoader::name(loader);
|
||||||
|
if (loader_name != NULL)
|
||||||
|
java_lang_StackTraceElement::set_classLoaderName(element(), loader_name);
|
||||||
|
}
|
||||||
|
|
||||||
// The method can be NULL if the requested class version is gone
|
// The method can be NULL if the requested class version is gone
|
||||||
Symbol* sym = !method.is_null() ? method->name() : holder->constants()->symbol_at(cpref);
|
Symbol* sym = !method.is_null() ? method->name() : holder->constants()->symbol_at(cpref);
|
||||||
@ -3433,6 +3441,7 @@ oop java_security_AccessControlContext::create(objArrayHandle context, bool isPr
|
|||||||
bool java_lang_ClassLoader::offsets_computed = false;
|
bool java_lang_ClassLoader::offsets_computed = false;
|
||||||
int java_lang_ClassLoader::_loader_data_offset = -1;
|
int java_lang_ClassLoader::_loader_data_offset = -1;
|
||||||
int java_lang_ClassLoader::parallelCapable_offset = -1;
|
int java_lang_ClassLoader::parallelCapable_offset = -1;
|
||||||
|
int java_lang_ClassLoader::name_offset = -1;
|
||||||
int java_lang_ClassLoader::unnamedModule_offset = -1;
|
int java_lang_ClassLoader::unnamedModule_offset = -1;
|
||||||
|
|
||||||
ClassLoaderData** java_lang_ClassLoader::loader_data_addr(oop loader) {
|
ClassLoaderData** java_lang_ClassLoader::loader_data_addr(oop loader) {
|
||||||
@ -3453,6 +3462,9 @@ void java_lang_ClassLoader::compute_offsets() {
|
|||||||
compute_optional_offset(parallelCapable_offset,
|
compute_optional_offset(parallelCapable_offset,
|
||||||
k1, vmSymbols::parallelCapable_name(), vmSymbols::concurrenthashmap_signature());
|
k1, vmSymbols::parallelCapable_name(), vmSymbols::concurrenthashmap_signature());
|
||||||
|
|
||||||
|
compute_offset(name_offset,
|
||||||
|
k1, vmSymbols::name_name(), vmSymbols::string_signature());
|
||||||
|
|
||||||
compute_offset(unnamedModule_offset,
|
compute_offset(unnamedModule_offset,
|
||||||
k1, vmSymbols::unnamedModule_name(), vmSymbols::module_signature());
|
k1, vmSymbols::unnamedModule_name(), vmSymbols::module_signature());
|
||||||
|
|
||||||
@ -3464,6 +3476,11 @@ oop java_lang_ClassLoader::parent(oop loader) {
|
|||||||
return loader->obj_field(parent_offset);
|
return loader->obj_field(parent_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oop java_lang_ClassLoader::name(oop loader) {
|
||||||
|
assert(is_instance(loader), "loader must be oop");
|
||||||
|
return loader->obj_field(name_offset);
|
||||||
|
}
|
||||||
|
|
||||||
bool java_lang_ClassLoader::isAncestor(oop loader, oop cl) {
|
bool java_lang_ClassLoader::isAncestor(oop loader, oop cl) {
|
||||||
assert(is_instance(loader), "loader must be oop");
|
assert(is_instance(loader), "loader must be oop");
|
||||||
assert(cl == NULL || is_instance(cl), "cl argument must be oop");
|
assert(cl == NULL || is_instance(cl), "cl argument must be oop");
|
||||||
@ -3619,12 +3636,14 @@ int java_lang_System::static_in_offset;
|
|||||||
int java_lang_System::static_out_offset;
|
int java_lang_System::static_out_offset;
|
||||||
int java_lang_System::static_err_offset;
|
int java_lang_System::static_err_offset;
|
||||||
int java_lang_System::static_security_offset;
|
int java_lang_System::static_security_offset;
|
||||||
int java_lang_StackTraceElement::declaringClass_offset;
|
|
||||||
int java_lang_StackTraceElement::methodName_offset;
|
int java_lang_StackTraceElement::methodName_offset;
|
||||||
int java_lang_StackTraceElement::fileName_offset;
|
int java_lang_StackTraceElement::fileName_offset;
|
||||||
int java_lang_StackTraceElement::lineNumber_offset;
|
int java_lang_StackTraceElement::lineNumber_offset;
|
||||||
int java_lang_StackTraceElement::moduleName_offset;
|
int java_lang_StackTraceElement::moduleName_offset;
|
||||||
int java_lang_StackTraceElement::moduleVersion_offset;
|
int java_lang_StackTraceElement::moduleVersion_offset;
|
||||||
|
int java_lang_StackTraceElement::classLoaderName_offset;
|
||||||
|
int java_lang_StackTraceElement::declaringClass_offset;
|
||||||
|
int java_lang_StackTraceElement::classOrLoaderModuleClassName_offset;
|
||||||
int java_lang_StackFrameInfo::_declaringClass_offset;
|
int java_lang_StackFrameInfo::_declaringClass_offset;
|
||||||
int java_lang_StackFrameInfo::_memberName_offset;
|
int java_lang_StackFrameInfo::_memberName_offset;
|
||||||
int java_lang_StackFrameInfo::_bci_offset;
|
int java_lang_StackFrameInfo::_bci_offset;
|
||||||
@ -3669,6 +3688,14 @@ void java_lang_StackTraceElement::set_moduleVersion(oop element, oop value) {
|
|||||||
element->obj_field_put(moduleVersion_offset, value);
|
element->obj_field_put(moduleVersion_offset, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void java_lang_StackTraceElement::set_classLoaderName(oop element, oop value) {
|
||||||
|
element->obj_field_put(classLoaderName_offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void java_lang_StackTraceElement::set_declaringClassObject(oop element, oop value) {
|
||||||
|
element->obj_field_put(classOrLoaderModuleClassName_offset, value);
|
||||||
|
}
|
||||||
|
|
||||||
// Support for java_lang_StackFrameInfo
|
// Support for java_lang_StackFrameInfo
|
||||||
void java_lang_StackFrameInfo::set_declaringClass(oop element, oop value) {
|
void java_lang_StackFrameInfo::set_declaringClass(oop element, oop value) {
|
||||||
element->obj_field_put(_declaringClass_offset, value);
|
element->obj_field_put(_declaringClass_offset, value);
|
||||||
@ -3784,6 +3811,8 @@ void JavaClasses::compute_hard_coded_offsets() {
|
|||||||
java_lang_System::static_security_offset = java_lang_System::hc_static_security_offset * x;
|
java_lang_System::static_security_offset = java_lang_System::hc_static_security_offset * x;
|
||||||
|
|
||||||
// java_lang_StackTraceElement
|
// java_lang_StackTraceElement
|
||||||
|
java_lang_StackTraceElement::classOrLoaderModuleClassName_offset= java_lang_StackTraceElement::hc_classOrLoaderModuleClassName_offset* x + header;
|
||||||
|
java_lang_StackTraceElement::classLoaderName_offset = java_lang_StackTraceElement::hc_classLoaderName_offset * x + header;
|
||||||
java_lang_StackTraceElement::moduleName_offset = java_lang_StackTraceElement::hc_moduleName_offset * x + header;
|
java_lang_StackTraceElement::moduleName_offset = java_lang_StackTraceElement::hc_moduleName_offset * x + header;
|
||||||
java_lang_StackTraceElement::moduleVersion_offset = java_lang_StackTraceElement::hc_moduleVersion_offset * x + header;
|
java_lang_StackTraceElement::moduleVersion_offset = java_lang_StackTraceElement::hc_moduleVersion_offset * x + header;
|
||||||
java_lang_StackTraceElement::declaringClass_offset = java_lang_StackTraceElement::hc_declaringClass_offset * x + header;
|
java_lang_StackTraceElement::declaringClass_offset = java_lang_StackTraceElement::hc_declaringClass_offset * x + header;
|
||||||
@ -3985,10 +4014,14 @@ void JavaClasses::check_offsets() {
|
|||||||
|
|
||||||
// java.lang.StackTraceElement
|
// java.lang.StackTraceElement
|
||||||
|
|
||||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, declaringClass, "Ljava/lang/String;");
|
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, classOrLoaderModuleClassName, "Ljava/lang/Object;");
|
||||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, methodName, "Ljava/lang/String;");
|
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, classLoaderName, "Ljava/lang/String;");
|
||||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, fileName, "Ljava/lang/String;");
|
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, moduleName, "Ljava/lang/String;");
|
||||||
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, lineNumber, "I");
|
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, moduleVersion, "Ljava/lang/String;");
|
||||||
|
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, declaringClass, "Ljava/lang/String;");
|
||||||
|
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, methodName, "Ljava/lang/String;");
|
||||||
|
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, fileName, "Ljava/lang/String;");
|
||||||
|
CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, lineNumber, "I");
|
||||||
|
|
||||||
// java.lang.ref.Reference
|
// java.lang.ref.Reference
|
||||||
|
|
||||||
|
@ -1225,6 +1225,7 @@ class java_lang_ClassLoader : AllStatic {
|
|||||||
static bool offsets_computed;
|
static bool offsets_computed;
|
||||||
static int parent_offset;
|
static int parent_offset;
|
||||||
static int parallelCapable_offset;
|
static int parallelCapable_offset;
|
||||||
|
static int name_offset;
|
||||||
static int unnamedModule_offset;
|
static int unnamedModule_offset;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -1234,6 +1235,7 @@ class java_lang_ClassLoader : AllStatic {
|
|||||||
static ClassLoaderData* loader_data(oop loader);
|
static ClassLoaderData* loader_data(oop loader);
|
||||||
|
|
||||||
static oop parent(oop loader);
|
static oop parent(oop loader);
|
||||||
|
static oop name(oop loader);
|
||||||
static bool isAncestor(oop loader, oop cl);
|
static bool isAncestor(oop loader, oop cl);
|
||||||
|
|
||||||
// Support for parallelCapable field
|
// Support for parallelCapable field
|
||||||
@ -1291,14 +1293,18 @@ class java_lang_System : AllStatic {
|
|||||||
class java_lang_StackTraceElement: AllStatic {
|
class java_lang_StackTraceElement: AllStatic {
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
hc_moduleName_offset = 0,
|
hc_classOrLoaderModuleClassName_offset = 0,
|
||||||
hc_moduleVersion_offset = 1,
|
hc_classLoaderName_offset = 1,
|
||||||
hc_declaringClass_offset = 2,
|
hc_moduleName_offset = 2,
|
||||||
hc_methodName_offset = 3,
|
hc_moduleVersion_offset = 3,
|
||||||
hc_fileName_offset = 4,
|
hc_declaringClass_offset = 4,
|
||||||
hc_lineNumber_offset = 5
|
hc_methodName_offset = 5,
|
||||||
|
hc_fileName_offset = 6,
|
||||||
|
hc_lineNumber_offset = 7
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int classOrLoaderModuleClassName_offset;
|
||||||
|
static int classLoaderName_offset;
|
||||||
static int moduleName_offset;
|
static int moduleName_offset;
|
||||||
static int moduleVersion_offset;
|
static int moduleVersion_offset;
|
||||||
static int declaringClass_offset;
|
static int declaringClass_offset;
|
||||||
@ -1307,12 +1313,14 @@ class java_lang_StackTraceElement: AllStatic {
|
|||||||
static int lineNumber_offset;
|
static int lineNumber_offset;
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
|
static void set_classLoaderName(oop element, oop value);
|
||||||
static void set_moduleName(oop element, oop value);
|
static void set_moduleName(oop element, oop value);
|
||||||
static void set_moduleVersion(oop element, oop value);
|
static void set_moduleVersion(oop element, oop value);
|
||||||
static void set_declaringClass(oop element, oop value);
|
static void set_declaringClass(oop element, oop value);
|
||||||
static void set_methodName(oop element, oop value);
|
static void set_methodName(oop element, oop value);
|
||||||
static void set_fileName(oop element, oop value);
|
static void set_fileName(oop element, oop value);
|
||||||
static void set_lineNumber(oop element, int value);
|
static void set_lineNumber(oop element, int value);
|
||||||
|
static void set_declaringClassObject(oop element, oop value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Create an instance of StackTraceElement
|
// Create an instance of StackTraceElement
|
||||||
|
@ -503,16 +503,27 @@ JVM_ENTRY(void, JVM_FillInStackTrace(JNIEnv *env, jobject receiver))
|
|||||||
JVM_END
|
JVM_END
|
||||||
|
|
||||||
|
|
||||||
JVM_ENTRY(void, JVM_GetStackTraceElements(JNIEnv *env, jobject throwable, jobjectArray stackTrace))
|
// java.lang.StackTraceElement //////////////////////////////////////////////
|
||||||
JVMWrapper("JVM_GetStackTraceElements");
|
|
||||||
|
|
||||||
|
JVM_ENTRY(void, JVM_InitStackTraceElementArray(JNIEnv *env, jobjectArray elements, jobject throwable))
|
||||||
|
JVMWrapper("JVM_InitStackTraceElementArray");
|
||||||
Handle exception(THREAD, JNIHandles::resolve(throwable));
|
Handle exception(THREAD, JNIHandles::resolve(throwable));
|
||||||
objArrayOop st = objArrayOop(JNIHandles::resolve(stackTrace));
|
objArrayOop st = objArrayOop(JNIHandles::resolve(elements));
|
||||||
objArrayHandle stack_trace(THREAD, st);
|
objArrayHandle stack_trace(THREAD, st);
|
||||||
// Fill in the allocated stack trace
|
// Fill in the allocated stack trace
|
||||||
java_lang_Throwable::get_stack_trace_elements(exception, stack_trace, CHECK);
|
java_lang_Throwable::get_stack_trace_elements(exception, stack_trace, CHECK);
|
||||||
JVM_END
|
JVM_END
|
||||||
|
|
||||||
|
|
||||||
|
JVM_ENTRY(void, JVM_InitStackTraceElement(JNIEnv* env, jobject element, jobject stackFrameInfo))
|
||||||
|
JVMWrapper("JVM_InitStackTraceElement");
|
||||||
|
Handle stack_frame_info(THREAD, JNIHandles::resolve_non_null(stackFrameInfo));
|
||||||
|
Handle stack_trace_element(THREAD, JNIHandles::resolve_non_null(element));
|
||||||
|
java_lang_StackFrameInfo::to_stack_trace_element(stack_frame_info, stack_trace_element, THREAD);
|
||||||
|
JVM_END
|
||||||
|
|
||||||
|
|
||||||
// java.lang.StackWalker //////////////////////////////////////////////////////
|
// java.lang.StackWalker //////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@ -566,13 +577,6 @@ JVM_ENTRY(jint, JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode,
|
|||||||
start_index, frames_array_h, THREAD);
|
start_index, frames_array_h, THREAD);
|
||||||
JVM_END
|
JVM_END
|
||||||
|
|
||||||
JVM_ENTRY(void, JVM_ToStackTraceElement(JNIEnv *env, jobject frame, jobject stack))
|
|
||||||
JVMWrapper("JVM_ToStackTraceElement");
|
|
||||||
Handle stack_frame_info(THREAD, JNIHandles::resolve_non_null(frame));
|
|
||||||
Handle stack_trace_element(THREAD, JNIHandles::resolve_non_null(stack));
|
|
||||||
java_lang_StackFrameInfo::to_stack_trace_element(stack_frame_info, stack_trace_element, THREAD);
|
|
||||||
JVM_END
|
|
||||||
|
|
||||||
// java.lang.Object ///////////////////////////////////////////////
|
// java.lang.Object ///////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
@ -189,8 +189,14 @@ JVM_GetVmArguments(JNIEnv *env);
|
|||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
|
JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* java.lang.StackTraceElement
|
||||||
|
*/
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
JVM_GetStackTraceElements(JNIEnv *env, jobject throwable, jobjectArray elements);
|
JVM_InitStackTraceElementArray(JNIEnv *env, jobjectArray elements, jobject throwable);
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
JVM_InitStackTraceElement(JNIEnv* env, jobject element, jobject stackFrameInfo);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* java.lang.StackWalker
|
* java.lang.StackWalker
|
||||||
@ -212,9 +218,6 @@ JVM_MoreStackWalk(JNIEnv *env, jobject stackStream, jlong mode, jlong anchor,
|
|||||||
jint frame_count, jint start_index,
|
jint frame_count, jint start_index,
|
||||||
jobjectArray frames);
|
jobjectArray frames);
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
|
||||||
JVM_ToStackTraceElement(JNIEnv* env, jobject frame, jobject stackElement);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* java.lang.Thread
|
* java.lang.Thread
|
||||||
*/
|
*/
|
||||||
|
@ -384,3 +384,5 @@ a8d5fe567ae72b4931040e59dd4478363f9004f5 jdk-9+137
|
|||||||
8991d71c5316bde259e6a417c1199b008ca3cdf0 jdk-9+139
|
8991d71c5316bde259e6a417c1199b008ca3cdf0 jdk-9+139
|
||||||
8d100cb9b04819b5bd09f33c7fd5b8628d1a456f jdk-9+140
|
8d100cb9b04819b5bd09f33c7fd5b8628d1a456f jdk-9+140
|
||||||
037c095ba0c345edbeaaab52fda913a76c3930c0 jdk-9+141
|
037c095ba0c345edbeaaab52fda913a76c3930c0 jdk-9+141
|
||||||
|
bdafa0cc34a97a2f8db4847a4efd34b407943591 jdk-9+142
|
||||||
|
ce81d03ad7320dca3d673374c1a33bc0efd9136a jdk-9+143
|
||||||
|
@ -746,42 +746,18 @@ public class XMLDocumentScannerImpl
|
|||||||
// scan XMLDecl
|
// scan XMLDecl
|
||||||
try {
|
try {
|
||||||
if (fEntityScanner.skipString(xmlDecl)) {
|
if (fEntityScanner.skipString(xmlDecl)) {
|
||||||
fMarkupDepth++;
|
if (fEntityScanner.peekChar() == ' ') {
|
||||||
// NOTE: special case where document starts with a PI
|
fMarkupDepth++;
|
||||||
// whose name starts with "xml" (e.g. "xmlfoo")
|
|
||||||
if (XMLChar.isName(fEntityScanner.peekChar())) {
|
|
||||||
fStringBuffer.clear();
|
|
||||||
fStringBuffer.append("xml");
|
|
||||||
while (XMLChar.isName(fEntityScanner.peekChar())) {
|
|
||||||
fStringBuffer.append((char)fEntityScanner.scanChar(null));
|
|
||||||
}
|
|
||||||
String target = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length);
|
|
||||||
//this function should fill the data.. and set the fEvent object to this event.
|
|
||||||
fContentBuffer.clear() ;
|
|
||||||
scanPIData(target, fContentBuffer);
|
|
||||||
//REVISIT:where else we can set this value to 'true'
|
|
||||||
fEntityManager.fCurrentEntity.mayReadChunks = true;
|
|
||||||
//return PI event since PI was encountered
|
|
||||||
return XMLEvent.PROCESSING_INSTRUCTION ;
|
|
||||||
}
|
|
||||||
// standard XML declaration
|
|
||||||
else {
|
|
||||||
scanXMLDeclOrTextDecl(false);
|
scanXMLDeclOrTextDecl(false);
|
||||||
//REVISIT:where else we can set this value to 'true'
|
} else {
|
||||||
fEntityManager.fCurrentEntity.mayReadChunks = true;
|
// PI, reset position
|
||||||
return XMLEvent.START_DOCUMENT;
|
fEntityManager.fCurrentEntity.position = 0;
|
||||||
}
|
}
|
||||||
} else{
|
|
||||||
//REVISIT:where else we can set this value to 'true'
|
|
||||||
fEntityManager.fCurrentEntity.mayReadChunks = true;
|
|
||||||
//In both case return the START_DOCUMENT. ony difference is that first block will
|
|
||||||
//cosume the XML declaration if any.
|
|
||||||
return XMLEvent.START_DOCUMENT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//START_OF_THE_DOCUMENT
|
//START_OF_THE_DOCUMENT
|
||||||
|
fEntityManager.fCurrentEntity.mayReadChunks = true;
|
||||||
|
return XMLEvent.START_DOCUMENT;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,10 @@ import java.util.Iterator;
|
|||||||
*/
|
*/
|
||||||
public interface XMLEventReader extends Iterator {
|
public interface XMLEventReader extends Iterator {
|
||||||
/**
|
/**
|
||||||
* Get the next XMLEvent
|
* Gets the next XMLEvent. The initial event is
|
||||||
|
* {@link javax.xml.stream.events.StartDocument StartDocument}.
|
||||||
|
*
|
||||||
|
* @return the next XMLEvent
|
||||||
* @see XMLEvent
|
* @see XMLEvent
|
||||||
* @throws XMLStreamException if there is an error with the underlying XML.
|
* @throws XMLStreamException if there is an error with the underlying XML.
|
||||||
* @throws java.util.NoSuchElementException iteration has no more elements.
|
* @throws java.util.NoSuchElementException iteration has no more elements.
|
||||||
@ -58,12 +61,15 @@ public interface XMLEventReader extends Iterator {
|
|||||||
* Returns true if there are more events and false otherwise.
|
* Returns true if there are more events and false otherwise.
|
||||||
* @return true if the event reader has more events, false otherwise
|
* @return true if the event reader has more events, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean hasNext();
|
public boolean hasNext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the next XMLEvent without reading it from the stream.
|
* Check the next XMLEvent without reading it from the stream.
|
||||||
* Returns null if the stream is at EOF or has no more XMLEvents.
|
* Returns null if the stream is at EOF or has no more XMLEvents.
|
||||||
* A call to peek() will be equal to the next return of next().
|
* A call to peek() will be equal to the next return of next().
|
||||||
|
*
|
||||||
|
* @return the next XMLEvent
|
||||||
* @see XMLEvent
|
* @see XMLEvent
|
||||||
* @throws XMLStreamException
|
* @throws XMLStreamException
|
||||||
*/
|
*/
|
||||||
@ -73,6 +79,8 @@ public interface XMLEventReader extends Iterator {
|
|||||||
* Reads the content of a text-only element. Precondition:
|
* Reads the content of a text-only element. Precondition:
|
||||||
* the current event is START_ELEMENT. Postcondition:
|
* the current event is START_ELEMENT. Postcondition:
|
||||||
* The current event is the corresponding END_ELEMENT.
|
* The current event is the corresponding END_ELEMENT.
|
||||||
|
*
|
||||||
|
* @return the text of the element
|
||||||
* @throws XMLStreamException if the current event is not a START_ELEMENT
|
* @throws XMLStreamException if the current event is not a START_ELEMENT
|
||||||
* or if a non text element is encountered
|
* or if a non text element is encountered
|
||||||
*/
|
*/
|
||||||
@ -85,6 +93,8 @@ public interface XMLEventReader extends Iterator {
|
|||||||
* be used when processing element-only content because
|
* be used when processing element-only content because
|
||||||
* the parser is not able to recognize ignorable whitespace if
|
* the parser is not able to recognize ignorable whitespace if
|
||||||
* the DTD is missing or not interpreted.
|
* the DTD is missing or not interpreted.
|
||||||
|
*
|
||||||
|
* @return a START_ELEMENT or END_ELEMENT
|
||||||
* @throws XMLStreamException if anything other than space characters are encountered
|
* @throws XMLStreamException if anything other than space characters are encountered
|
||||||
*/
|
*/
|
||||||
public XMLEvent nextTag() throws XMLStreamException;
|
public XMLEvent nextTag() throws XMLStreamException;
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
package javax.xml.stream;
|
package javax.xml.stream;
|
||||||
|
|
||||||
import java.io.Reader;
|
|
||||||
import javax.xml.namespace.NamespaceContext;
|
import javax.xml.namespace.NamespaceContext;
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
||||||
@ -37,19 +36,26 @@ import javax.xml.namespace.QName;
|
|||||||
* It is designed to be the lowest level and most efficient way to
|
* It is designed to be the lowest level and most efficient way to
|
||||||
* read XML data.
|
* read XML data.
|
||||||
*
|
*
|
||||||
* <p> The XMLStreamReader is designed to iterate over XML using
|
* <p>
|
||||||
|
* The XMLStreamReader is designed to iterate over XML using
|
||||||
* next() and hasNext(). The data can be accessed using methods such as getEventType(),
|
* next() and hasNext(). The data can be accessed using methods such as getEventType(),
|
||||||
* getNamespaceURI(), getLocalName() and getText();
|
* getNamespaceURI(), getLocalName() and getText();
|
||||||
*
|
*
|
||||||
* <p> The <a href="#next()">next()</a> method causes the reader to read the next parse event.
|
* <p>
|
||||||
* The next() method returns an integer which identifies the type of event just read.
|
* An XMLStreamReader instance is created with an initial event type START_DOCUMENT.
|
||||||
* <p> The event type can be determined using <a href="#getEventType()">getEventType()</a>.
|
* At any moment in time, it has a current event that the methods of the interface
|
||||||
* <p> Parsing events are defined as the XML Declaration, a DTD,
|
* access and may load the next event through the {@link #next() next()} method.
|
||||||
|
* The current event type can be determined by {@link #getEventType getEventType()}, and
|
||||||
|
* the next returned by the {@link #next() next()} method.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Parsing events are defined as the XML Declaration, a DTD,
|
||||||
* start tag, character data, white space, end tag, comment,
|
* start tag, character data, white space, end tag, comment,
|
||||||
* or processing instruction. An attribute or namespace event may be encountered
|
* or processing instruction. An attribute or namespace event may be encountered
|
||||||
* at the root level of a document as the result of a query operation.
|
* at the root level of a document as the result of a query operation.
|
||||||
*
|
*
|
||||||
* <p>For XML 1.0 compliance an XML processor must pass the
|
* <p>
|
||||||
|
* For XML 1.0 compliance an XML processor must pass the
|
||||||
* identifiers of declared unparsed entities, notation declarations and their
|
* identifiers of declared unparsed entities, notation declarations and their
|
||||||
* associated identifiers to the application. This information is
|
* associated identifiers to the application. This information is
|
||||||
* provided through the property API on this interface.
|
* provided through the property API on this interface.
|
||||||
@ -63,7 +69,8 @@ import javax.xml.namespace.QName;
|
|||||||
* These properties can only be accessed during a DTD event and
|
* These properties can only be accessed during a DTD event and
|
||||||
* are defined to return null if the information is not available.
|
* are defined to return null if the information is not available.
|
||||||
*
|
*
|
||||||
* <p>The following table describes which methods are valid in what state.
|
* <p>
|
||||||
|
* The following table describes which methods are valid in what state.
|
||||||
* If a method is called in an invalid state the method will throw a
|
* If a method is called in an invalid state the method will throw a
|
||||||
* java.lang.IllegalStateException.
|
* java.lang.IllegalStateException.
|
||||||
*
|
*
|
||||||
@ -502,8 +509,10 @@ public interface XMLStreamReader extends XMLStreamConstants {
|
|||||||
// public void recycle() throws XMLStreamException;
|
// public void recycle() throws XMLStreamException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an integer code that indicates the type
|
* Returns an integer code that indicates the type of the event the cursor is
|
||||||
* of the event the cursor is pointing to.
|
* pointing to. The initial event type is {@link #START_DOCUMENT}.
|
||||||
|
*
|
||||||
|
* @return the type of the current event
|
||||||
*/
|
*/
|
||||||
public int getEventType();
|
public int getEventType();
|
||||||
|
|
||||||
@ -590,6 +599,8 @@ public interface XMLStreamReader extends XMLStreamConstants {
|
|||||||
/**
|
/**
|
||||||
* Returns the offset into the text character array where the first
|
* Returns the offset into the text character array where the first
|
||||||
* character (of this text event) is stored.
|
* character (of this text event) is stored.
|
||||||
|
*
|
||||||
|
* @return the starting position of the text in the character array
|
||||||
* @throws java.lang.IllegalStateException if this state is not
|
* @throws java.lang.IllegalStateException if this state is not
|
||||||
* a valid text state.
|
* a valid text state.
|
||||||
*/
|
*/
|
||||||
@ -598,6 +609,8 @@ public interface XMLStreamReader extends XMLStreamConstants {
|
|||||||
/**
|
/**
|
||||||
* Returns the length of the sequence of characters for this
|
* Returns the length of the sequence of characters for this
|
||||||
* Text event within the text character array.
|
* Text event within the text character array.
|
||||||
|
*
|
||||||
|
* @return the length of the text
|
||||||
* @throws java.lang.IllegalStateException if this state is not
|
* @throws java.lang.IllegalStateException if this state is not
|
||||||
* a valid text state.
|
* a valid text state.
|
||||||
*/
|
*/
|
||||||
@ -610,9 +623,11 @@ public interface XMLStreamReader extends XMLStreamConstants {
|
|||||||
public String getEncoding();
|
public String getEncoding();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the current event has text, false otherwise
|
* Return a boolean indicating whether the current event has text.
|
||||||
* The following events have text:
|
* The following events have text:
|
||||||
* CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT, SPACE
|
* CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT, SPACE
|
||||||
|
*
|
||||||
|
* @return true if the event has text, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean hasText();
|
public boolean hasText();
|
||||||
|
|
||||||
@ -623,6 +638,7 @@ public interface XMLStreamReader extends XMLStreamConstants {
|
|||||||
* location and null for the publicId and systemId.
|
* location and null for the publicId and systemId.
|
||||||
* The location information is only valid until next() is
|
* The location information is only valid until next() is
|
||||||
* called.
|
* called.
|
||||||
|
* @return the location of the cursor
|
||||||
*/
|
*/
|
||||||
public Location getLocation();
|
public Location getLocation();
|
||||||
|
|
||||||
@ -647,8 +663,10 @@ public interface XMLStreamReader extends XMLStreamConstants {
|
|||||||
public String getLocalName();
|
public String getLocalName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns true if the current event has a name (is a START_ELEMENT or END_ELEMENT)
|
* returns a boolean indicating whether the current event has a name
|
||||||
* returns false otherwise
|
* (is a START_ELEMENT or END_ELEMENT).
|
||||||
|
*
|
||||||
|
* @return true if the event has a name, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean hasName();
|
public boolean hasName();
|
||||||
|
|
||||||
|
@ -24,20 +24,16 @@
|
|||||||
package javax.xml.parsers.ptests;
|
package javax.xml.parsers.ptests;
|
||||||
|
|
||||||
import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
|
import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
|
||||||
import static jaxp.library.JAXPTestUtilities.USER_DIR;
|
|
||||||
import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
|
import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FilePermission;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.PropertyPermission;
|
import java.util.PropertyPermission;
|
||||||
|
|
||||||
import javax.xml.parsers.SAXParser;
|
import javax.xml.parsers.SAXParser;
|
||||||
import javax.xml.parsers.SAXParserFactory;
|
import javax.xml.parsers.SAXParserFactory;
|
||||||
|
|
||||||
import jaxp.library.JAXPTestUtilities;
|
|
||||||
|
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Listeners;
|
import org.testng.annotations.Listeners;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@ -189,8 +185,7 @@ public class SAXParserTest {
|
|||||||
*/
|
*/
|
||||||
@Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
|
@Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
|
||||||
public void testParse09(SAXParser saxparser) throws Exception {
|
public void testParse09(SAXParser saxparser) throws Exception {
|
||||||
JAXPTestUtilities.tryRunWithTmpPermission(() -> saxparser.parse(" ", new DefaultHandler()),
|
saxparser.parse("no-such-file", new DefaultHandler());
|
||||||
new FilePermission(USER_DIR + " ", "read"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, 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 catalog;
|
||||||
|
|
||||||
|
import javax.xml.catalog.CatalogFeatures;
|
||||||
|
|
||||||
|
import org.testng.annotations.DataProvider;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8151154
|
||||||
|
* @run testng/othervm catalog.CatalogInvalidPathTest
|
||||||
|
* @summary Verifies that the CatalogFeatures' builder throws
|
||||||
|
* IllegalArgumentException on invalid file inputs.
|
||||||
|
* This test was splitted from CatalogTest.java due to
|
||||||
|
* JDK-8168968, it has to only run without SecurityManager
|
||||||
|
* because an ACE will be thrown for invalid path.
|
||||||
|
*/
|
||||||
|
public class CatalogInvalidPathTest {
|
||||||
|
/*
|
||||||
|
DataProvider: for testing the verification of file paths by
|
||||||
|
the CatalogFeatures builder
|
||||||
|
*/
|
||||||
|
@DataProvider(name = "invalidPaths")
|
||||||
|
public Object[][] getFiles() {
|
||||||
|
return new Object[][]{
|
||||||
|
{null},
|
||||||
|
{""},
|
||||||
|
{"file:a/b\\c"},
|
||||||
|
{"file:/../../.."},
|
||||||
|
{"c:/te:t"},
|
||||||
|
{"c:/te?t"},
|
||||||
|
{"c/te*t"},
|
||||||
|
{"in|valid.txt"},
|
||||||
|
{"shema:invalid.txt"},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(dataProvider = "invalidPaths", expectedExceptions = IllegalArgumentException.class)
|
||||||
|
public void testFileInput(String file) {
|
||||||
|
CatalogFeatures features = CatalogFeatures.builder()
|
||||||
|
.with(CatalogFeatures.Feature.FILES, file)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -23,18 +23,16 @@
|
|||||||
package catalog;
|
package catalog;
|
||||||
|
|
||||||
import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
|
import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
|
||||||
import static jaxp.library.JAXPTestUtilities.getSystemProperty;
|
|
||||||
import static jaxp.library.JAXPTestUtilities.setSystemProperty;
|
import static jaxp.library.JAXPTestUtilities.setSystemProperty;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FilePermission;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.PropertyPermission;
|
|
||||||
import javax.xml.XMLConstants;
|
import javax.xml.XMLConstants;
|
||||||
import javax.xml.catalog.Catalog;
|
import javax.xml.catalog.Catalog;
|
||||||
import javax.xml.catalog.CatalogException;
|
import javax.xml.catalog.CatalogException;
|
||||||
@ -57,7 +55,6 @@ import javax.xml.transform.stream.StreamSource;
|
|||||||
import javax.xml.validation.Schema;
|
import javax.xml.validation.Schema;
|
||||||
import javax.xml.validation.SchemaFactory;
|
import javax.xml.validation.SchemaFactory;
|
||||||
import javax.xml.validation.Validator;
|
import javax.xml.validation.Validator;
|
||||||
import jaxp.library.JAXPTestUtilities;
|
|
||||||
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
@ -73,7 +70,7 @@ import org.xml.sax.ext.DefaultHandler2;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8081248 8144966 8146606 8146237 8151154 8150969 8151162 8152527 8154220 8163232
|
* @bug 8081248 8144966 8146606 8146237 8150969 8151162 8152527 8154220 8163232
|
||||||
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
|
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
|
||||||
* @run testng/othervm -DrunSecMngr=true catalog.CatalogTest
|
* @run testng/othervm -DrunSecMngr=true catalog.CatalogTest
|
||||||
* @run testng/othervm catalog.CatalogTest
|
* @run testng/othervm catalog.CatalogTest
|
||||||
@ -459,21 +456,6 @@ public class CatalogTest extends CatalogSupportBase {
|
|||||||
Catalog catalog = CatalogManager.catalog(features, catalogFile);
|
Catalog catalog = CatalogManager.catalog(features, catalogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @bug 8151154
|
|
||||||
* Verifies that the CatalogFeatures' builder throws IllegalArgumentException
|
|
||||||
* on invalid file inputs.
|
|
||||||
* @param file the file path
|
|
||||||
*/
|
|
||||||
@Test(dataProvider = "invalidPaths", expectedExceptions = IllegalArgumentException.class)
|
|
||||||
public void testFileInput(String file) {
|
|
||||||
JAXPTestUtilities.runWithTmpPermission(() -> {
|
|
||||||
CatalogFeatures features = CatalogFeatures.builder()
|
|
||||||
.with(CatalogFeatures.Feature.FILES, file)
|
|
||||||
.build();
|
|
||||||
}, new FilePermission("/../../..", "read"), new FilePermission("c:\\te:t", "read"),
|
|
||||||
new FilePermission("c:\\te?t", "read"), new PropertyPermission("user.dir", "read"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @bug 8146237
|
* @bug 8146237
|
||||||
@ -736,24 +718,6 @@ public class CatalogTest extends CatalogSupportBase {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
DataProvider: for testing the verification of file paths by
|
|
||||||
the CatalogFeatures builder
|
|
||||||
*/
|
|
||||||
@DataProvider(name = "invalidPaths")
|
|
||||||
public Object[][] getFiles() {
|
|
||||||
return new Object[][]{
|
|
||||||
{null},
|
|
||||||
{""},
|
|
||||||
{"file:a/b\\c"},
|
|
||||||
{"file:/../../.."},
|
|
||||||
{"c:/te:t"},
|
|
||||||
{"c:/te?t"},
|
|
||||||
{"c/te*t"},
|
|
||||||
{"in|valid.txt"},
|
|
||||||
{"shema:invalid.txt"},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
DataProvider: provides test name, expected string, the catalog, and XML
|
DataProvider: provides test name, expected string, the catalog, and XML
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,17 +24,20 @@
|
|||||||
package stream.XMLStreamReaderTest;
|
package stream.XMLStreamReaderTest;
|
||||||
|
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
import javax.xml.stream.XMLEventReader;
|
||||||
|
|
||||||
import javax.xml.stream.XMLInputFactory;
|
import javax.xml.stream.XMLInputFactory;
|
||||||
import javax.xml.stream.XMLStreamConstants;
|
import javax.xml.stream.XMLStreamConstants;
|
||||||
import javax.xml.stream.XMLStreamReader;
|
import javax.xml.stream.XMLStreamReader;
|
||||||
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Listeners;
|
import org.testng.annotations.Listeners;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
|
* @bug 8069098
|
||||||
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
|
* @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
|
||||||
* @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BugTest
|
* @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BugTest
|
||||||
* @run testng/othervm stream.XMLStreamReaderTest.BugTest
|
* @run testng/othervm stream.XMLStreamReaderTest.BugTest
|
||||||
@ -43,11 +46,70 @@ import org.testng.annotations.Test;
|
|||||||
@Listeners({jaxp.library.BasePolicy.class})
|
@Listeners({jaxp.library.BasePolicy.class})
|
||||||
public class BugTest {
|
public class BugTest {
|
||||||
|
|
||||||
@Test
|
/**
|
||||||
public static void test1() throws Exception {
|
* Verifies that the initial event of an XMLStreamReader instance is
|
||||||
XMLInputFactory xif = XMLInputFactory.newInstance(); // new
|
* START_DOCUMENT.
|
||||||
// com.sun.xml.stream.ZephyrParserFactory();
|
*
|
||||||
XMLStreamReader r = xif.createXMLStreamReader(new StringReader("<foo/>"));
|
* @param xml the xml input
|
||||||
Assert.assertEquals(XMLStreamConstants.START_DOCUMENT, r.getEventType());
|
* @param type1 the type of the 1st event
|
||||||
|
* @param type2 the type of the 2nd event
|
||||||
|
* @throws Exception if the test fails to run properly
|
||||||
|
*/
|
||||||
|
@Test(dataProvider = "xmls")
|
||||||
|
public static void test1(String xml, int type1, int type2) throws Exception {
|
||||||
|
XMLInputFactory factory = XMLInputFactory.newFactory();
|
||||||
|
|
||||||
|
XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(xml));
|
||||||
|
int type1stEvent = reader.getEventType();
|
||||||
|
int type2ndEvent = reader.next();
|
||||||
|
System.out.println("First event: " + type1stEvent);
|
||||||
|
System.out.println("2nd event: " + type2ndEvent);
|
||||||
|
Assert.assertEquals(type1, type1stEvent);
|
||||||
|
Assert.assertEquals(type2, type2ndEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that the initial event of an XMLEventReader instance is
|
||||||
|
* START_DOCUMENT. XMLEventReader depends on XMLStreamReader.
|
||||||
|
*
|
||||||
|
* @param xml the xml input
|
||||||
|
* @param type1 the type of the 1st event
|
||||||
|
* @param type2 the type of the 2nd event
|
||||||
|
* @throws Exception if the test fails to run properly
|
||||||
|
*/
|
||||||
|
@Test(dataProvider = "xmls")
|
||||||
|
public static void test2(String xml, int type1, int type2) throws Exception {
|
||||||
|
XMLInputFactory factory = XMLInputFactory.newFactory();
|
||||||
|
|
||||||
|
XMLEventReader reader = factory.createXMLEventReader(new StringReader(xml));
|
||||||
|
int type1stEvent = reader.nextEvent().getEventType();
|
||||||
|
int type2ndEvent = reader.nextEvent().getEventType();
|
||||||
|
System.out.println("First event: " + type1stEvent);
|
||||||
|
System.out.println("2nd event: " + type2ndEvent);
|
||||||
|
Assert.assertEquals(type1, type1stEvent);
|
||||||
|
Assert.assertEquals(type2, type2ndEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DataProvider: for testing beginning event type
|
||||||
|
Data: xml, 1st event type, 2nd event type
|
||||||
|
*/
|
||||||
|
@DataProvider(name = "xmls")
|
||||||
|
public Object[][] getXMLs() {
|
||||||
|
|
||||||
|
return new Object[][]{
|
||||||
|
{"<?xml version='1.0'?><foo/>",
|
||||||
|
XMLStreamConstants.START_DOCUMENT, XMLStreamConstants.START_ELEMENT},
|
||||||
|
{"<foo/>",
|
||||||
|
XMLStreamConstants.START_DOCUMENT, XMLStreamConstants.START_ELEMENT},
|
||||||
|
{"<?xml version='1.0'?>"
|
||||||
|
+ "<?xml-stylesheet href=\"bar.xsl\" type=\"text/xsl\"?>" +
|
||||||
|
"<foo/>",
|
||||||
|
XMLStreamConstants.START_DOCUMENT, XMLStreamConstants.PROCESSING_INSTRUCTION},
|
||||||
|
{"<?xml-stylesheet href=\"bar.xsl\" type=\"text/xsl\"?>" +
|
||||||
|
"<foo/>",
|
||||||
|
XMLStreamConstants.START_DOCUMENT, XMLStreamConstants.PROCESSING_INSTRUCTION},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,3 +387,5 @@ ab1d78d395d4cb8be426ff181211da1a4085cf01 jdk-9+134
|
|||||||
7a7aadf3c4500cc273c889aa1172d4fe3844bb6b jdk-9+139
|
7a7aadf3c4500cc273c889aa1172d4fe3844bb6b jdk-9+139
|
||||||
9004617323fe99cbe4fad48f373cb2ed4fc50aa6 jdk-9+140
|
9004617323fe99cbe4fad48f373cb2ed4fc50aa6 jdk-9+140
|
||||||
b2c18f755228d1d19a86cd7d5fa1abb6b1495dfb jdk-9+141
|
b2c18f755228d1d19a86cd7d5fa1abb6b1495dfb jdk-9+141
|
||||||
|
59101416d90160cfcb4f45dfbccaec15e2c27a29 jdk-9+142
|
||||||
|
1c988e708a06257119d54d8a57e99e3b0f37ff18 jdk-9+143
|
||||||
|
@ -384,3 +384,5 @@ e72df94364e3686e7d62059ce0d6b187b82da713 jdk-9+137
|
|||||||
5518ac2f2ead5e594bd983f2047178136aafdfd0 jdk-9+139
|
5518ac2f2ead5e594bd983f2047178136aafdfd0 jdk-9+139
|
||||||
e93b7ea559759f036c9f69fd2ddaf47bb4e98385 jdk-9+140
|
e93b7ea559759f036c9f69fd2ddaf47bb4e98385 jdk-9+140
|
||||||
8d752af5f61d41f226adf2cda72a20faa9ad620a jdk-9+141
|
8d752af5f61d41f226adf2cda72a20faa9ad620a jdk-9+141
|
||||||
|
6ce43dd8e954b452f330dd7a412df5107f7e1923 jdk-9+142
|
||||||
|
8dbc8594f9d5149bf1c22221272284609408227a jdk-9+143
|
||||||
|
@ -33,7 +33,6 @@ $(eval $(call IncludeCustomExtension, jdk, copy/Copy-java.base.gmk))
|
|||||||
#
|
#
|
||||||
TARGETS += \
|
TARGETS += \
|
||||||
$(INCLUDE_DST_DIR)/jni.h \
|
$(INCLUDE_DST_DIR)/jni.h \
|
||||||
$(INCLUDE_DST_DIR)/jvmti.h \
|
|
||||||
$(INCLUDE_DST_DIR)/jvmticmlr.h \
|
$(INCLUDE_DST_DIR)/jvmticmlr.h \
|
||||||
$(INCLUDE_DST_DIR)/classfile_constants.h \
|
$(INCLUDE_DST_DIR)/classfile_constants.h \
|
||||||
$(INCLUDE_DST_OS_DIR)/jni_md.h \
|
$(INCLUDE_DST_OS_DIR)/jni_md.h \
|
||||||
|
@ -21,4 +21,4 @@
|
|||||||
# or visit www.oracle.com if you need additional information or have any
|
# or visit www.oracle.com if you need additional information or have any
|
||||||
# questions.
|
# questions.
|
||||||
#
|
#
|
||||||
tzdata2016g
|
tzdata2016h
|
||||||
|
@ -2567,11 +2567,6 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
|
|||||||
# From Paul Eggert (2015-03-03):
|
# From Paul Eggert (2015-03-03):
|
||||||
# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
|
# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
|
||||||
# says that the fall 2014 transition was Oct 23 at 24:00.
|
# says that the fall 2014 transition was Oct 23 at 24:00.
|
||||||
# For future dates, guess the last Friday in March at 24:00 through
|
|
||||||
# the first Friday on or after October 21 at 00:00. This is consistent with
|
|
||||||
# the predictions in today's editions of the following URLs:
|
|
||||||
# http://www.timeanddate.com/time/change/gaza-strip/gaza
|
|
||||||
# http://www.timeanddate.com/time/change/west-bank/hebron
|
|
||||||
|
|
||||||
# From Hannah Kreitem (2016-03-09):
|
# From Hannah Kreitem (2016-03-09):
|
||||||
# http://www.palestinecabinet.gov.ps/WebSite/ar/ViewDetails?ID=31728
|
# http://www.palestinecabinet.gov.ps/WebSite/ar/ViewDetails?ID=31728
|
||||||
@ -2581,7 +2576,21 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
|
|||||||
#
|
#
|
||||||
# From Paul Eggert (2016-03-12):
|
# From Paul Eggert (2016-03-12):
|
||||||
# Predict spring transitions on March's last Saturday at 01:00 from now on.
|
# Predict spring transitions on March's last Saturday at 01:00 from now on.
|
||||||
# Leave fall predictions alone for now.
|
|
||||||
|
# From Sharef Mustafa (2016-10-19):
|
||||||
|
# [T]he Palestinian cabinet decision (Mar 8th 2016) published on
|
||||||
|
# http://www.palestinecabinet.gov.ps/WebSite/Upload/Decree/GOV_17/16032016134830.pdf
|
||||||
|
# states that summer time will end on Oct 29th at 01:00.
|
||||||
|
#
|
||||||
|
# From Tim Parenti (2016-10-19):
|
||||||
|
# Predict fall transitions on October's last Saturday at 01:00 from now on.
|
||||||
|
# This is consistent with the 2016 transition as well as our spring
|
||||||
|
# predictions.
|
||||||
|
#
|
||||||
|
# From Paul Eggert (2016-10-19):
|
||||||
|
# It's also consistent with predictions in the following URLs today:
|
||||||
|
# http://www.timeanddate.com/time/change/gaza-strip/gaza
|
||||||
|
# http://www.timeanddate.com/time/change/west-bank/hebron
|
||||||
|
|
||||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||||
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
|
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
|
||||||
@ -2610,9 +2619,10 @@ Rule Palestine 2011 only - Sep 30 0:00 0 -
|
|||||||
Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S
|
Rule Palestine 2012 2014 - Mar lastThu 24:00 1:00 S
|
||||||
Rule Palestine 2012 only - Sep 21 1:00 0 -
|
Rule Palestine 2012 only - Sep 21 1:00 0 -
|
||||||
Rule Palestine 2013 only - Sep Fri>=21 0:00 0 -
|
Rule Palestine 2013 only - Sep Fri>=21 0:00 0 -
|
||||||
Rule Palestine 2014 max - Oct Fri>=21 0:00 0 -
|
Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 -
|
||||||
Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S
|
Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S
|
||||||
Rule Palestine 2016 max - Mar lastSat 1:00 1:00 S
|
Rule Palestine 2016 max - Mar lastSat 1:00 1:00 S
|
||||||
|
Rule Palestine 2016 max - Oct lastSat 1:00 0 -
|
||||||
|
|
||||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||||
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
|
Zone Asia/Gaza 2:17:52 - LMT 1900 Oct
|
||||||
@ -2762,45 +2772,31 @@ Zone Asia/Singapore 6:55:25 - LMT 1901 Jan 1
|
|||||||
# People who live in regions under Tamil control can use [TZ='Asia/Kolkata'],
|
# People who live in regions under Tamil control can use [TZ='Asia/Kolkata'],
|
||||||
# as that zone has agreed with the Tamil areas since our cutoff date of 1970.
|
# as that zone has agreed with the Tamil areas since our cutoff date of 1970.
|
||||||
|
|
||||||
# From K Sethu (2006-04-25):
|
# From Sadika Sumanapala (2016-10-19):
|
||||||
# I think the abbreviation LKT originated from the world of computers at
|
# According to http://www.sltime.org (maintained by Measurement Units,
|
||||||
# the time of or subsequent to the time zone changes by SL Government
|
# Standards & Services Department, Sri Lanka) abbreviation for Sri Lanka
|
||||||
# twice in 1996 and probably SL Government or its standardization
|
# standard time is SLST.
|
||||||
# agencies never declared an abbreviation as a national standard.
|
|
||||||
#
|
#
|
||||||
# I recollect before the recent change the government announcements
|
# From Paul Eggert (2016-10-18):
|
||||||
# mentioning it as simply changing Sri Lanka Standard Time or Sri Lanka
|
# "SLST" seems to be reasonably recent and rarely-used outside time
|
||||||
# Time and no mention was made about the abbreviation.
|
# zone nerd sources. I searched Google News and found three uses of
|
||||||
#
|
# it in the International Business Times of India in February and
|
||||||
# If we look at Sri Lanka Department of Government's "Official News
|
# March of this year when discussing cricket match times, but nothing
|
||||||
# Website of Sri Lanka" ... http://www.news.lk/ we can see that they
|
# since then (though there has been a lot of cricket) and nothing in
|
||||||
# use SLT as abbreviation in time stamp at the beginning of each news
|
# other English-language news sources. Our old abbreviation "LKT" is
|
||||||
# item....
|
# even worse. For now, let's use a numeric abbreviation; we can
|
||||||
#
|
# switch to "SLST" if it catches on.
|
||||||
# Within Sri Lanka I think LKT is well known among computer users and
|
|
||||||
# administrators. In my opinion SLT may not be a good choice because the
|
|
||||||
# nation's largest telcom / internet operator Sri Lanka Telcom is well
|
|
||||||
# known by that abbreviation - simply as SLT (there IP domains are
|
|
||||||
# slt.lk and sltnet.lk).
|
|
||||||
#
|
|
||||||
# But if indeed our government has adopted SLT as standard abbreviation
|
|
||||||
# (that we have not known so far) then it is better that it be used for
|
|
||||||
# all computers.
|
|
||||||
|
|
||||||
# From Paul Eggert (2006-04-25):
|
|
||||||
# One possibility is that we wait for a bit for the dust to settle down
|
|
||||||
# and then see what people actually say in practice.
|
|
||||||
|
|
||||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||||
Zone Asia/Colombo 5:19:24 - LMT 1880
|
Zone Asia/Colombo 5:19:24 - LMT 1880
|
||||||
5:19:32 - MMT 1906 # Moratuwa Mean Time
|
5:19:32 - MMT 1906 # Moratuwa Mean Time
|
||||||
5:30 - IST 1942 Jan 5
|
5:30 - +0530 1942 Jan 5
|
||||||
5:30 0:30 IHST 1942 Sep
|
5:30 0:30 +0530/+06 1942 Sep
|
||||||
5:30 1:00 IST 1945 Oct 16 2:00
|
5:30 1:00 +0530/+0630 1945 Oct 16 2:00
|
||||||
5:30 - IST 1996 May 25 0:00
|
5:30 - +0530 1996 May 25 0:00
|
||||||
6:30 - LKT 1996 Oct 26 0:30
|
6:30 - +0630 1996 Oct 26 0:30
|
||||||
6:00 - LKT 2006 Apr 15 0:30
|
6:00 - +06 2006 Apr 15 0:30
|
||||||
5:30 - IST
|
5:30 - +0530
|
||||||
|
|
||||||
# Syria
|
# Syria
|
||||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||||
|
@ -373,7 +373,13 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
|
|||||||
# commencing at 2.00 am on Sunday 1st November, 2015 and ending at
|
# commencing at 2.00 am on Sunday 1st November, 2015 and ending at
|
||||||
# 3.00 am on Sunday 17th January, 2016.
|
# 3.00 am on Sunday 17th January, 2016.
|
||||||
|
|
||||||
# From Paul Eggert (2015-09-01):
|
# From Raymond Kumar (2016-10-04):
|
||||||
|
# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-6th-NOVEMBER,-2016.aspx
|
||||||
|
# "Fiji's daylight savings will begin on Sunday, 6 November 2016, when
|
||||||
|
# clocks go forward an hour at 2am to 3am.... Daylight Saving will
|
||||||
|
# end at 3.00am on Sunday 15th January 2017."
|
||||||
|
|
||||||
|
# From Paul Eggert (2016-10-03):
|
||||||
# For now, guess DST from 02:00 the first Sunday in November to
|
# For now, guess DST from 02:00 the first Sunday in November to
|
||||||
# 03:00 the third Sunday in January. Although ad hoc, it matches
|
# 03:00 the third Sunday in January. Although ad hoc, it matches
|
||||||
# transitions since late 2014 and seems more likely to match future
|
# transitions since late 2014 and seems more likely to match future
|
||||||
|
@ -1931,7 +1931,7 @@ Zone Europe/Monaco 0:29:32 - LMT 1891 Mar 15
|
|||||||
# Amsterdam mean time.
|
# Amsterdam mean time.
|
||||||
|
|
||||||
# The data entries before 1945 are taken from
|
# The data entries before 1945 are taken from
|
||||||
# http://www.phys.uu.nl/~vgent/wettijd/wettijd.htm
|
# http://www.staff.science.uu.nl/~gent0113/idl/idl.htm
|
||||||
|
|
||||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||||
Rule Neth 1916 only - May 1 0:00 1:00 NST # Netherlands Summer Time
|
Rule Neth 1916 only - May 1 0:00 1:00 NST # Netherlands Summer Time
|
||||||
@ -3450,22 +3450,24 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See above comment.
|
|||||||
|
|
||||||
# Turkey
|
# Turkey
|
||||||
|
|
||||||
# From Amar Devegowda (2007-01-03):
|
# From Kıvanç Yazan (2016-09-25):
|
||||||
# The time zone rules for Istanbul, Turkey have not been changed for years now.
|
# 1) For 1986-2006, DST started at 01:00 local and ended at 02:00 local, with
|
||||||
# ... The latest rules are available at:
|
# no exceptions.
|
||||||
# http://www.timeanddate.com/worldclock/timezone.html?n=107
|
# 2) 1994's lastSun was overridden with Mar 20 ...
|
||||||
# From Steffen Thorsen (2007-01-03):
|
# Here are official papers:
|
||||||
# I have been able to find press records back to 1996 which all say that
|
# http://www.resmigazete.gov.tr/arsiv/19032.pdf - page 2 for 1986
|
||||||
# DST started 01:00 local time and end at 02:00 local time. I am not sure
|
# http://www.resmigazete.gov.tr/arsiv/19400.pdf - page 4 for 1987
|
||||||
# what happened before that. One example for each year from 1996 to 2001:
|
# http://www.resmigazete.gov.tr/arsiv/19752.pdf - page 15 for 1988
|
||||||
# http://newspot.byegm.gov.tr/arsiv/1996/21/N4.htm
|
# http://www.resmigazete.gov.tr/arsiv/20102.pdf - page 6 for 1989
|
||||||
# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING97/03/97X03X25.TXT
|
# http://www.resmigazete.gov.tr/arsiv/20464.pdf - page 1 for 1990 - 1992
|
||||||
# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING98/03/98X03X02.HTM
|
# http://www.resmigazete.gov.tr/arsiv/21531.pdf - page 15 for 1993 - 1995
|
||||||
# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING99/10/99X10X26.HTM#%2016
|
# http://www.resmigazete.gov.tr/arsiv/21879.pdf - page 1 for overriding 1994
|
||||||
# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2000/03/00X03X06.HTM#%2021
|
# http://www.resmigazete.gov.tr/arsiv/22588.pdf - page 1 for 1996, 1997
|
||||||
# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2001/03/23x03x01.HTM#%2027
|
# http://www.resmigazete.gov.tr/arsiv/23286.pdf - page 10 for 1998 - 2000
|
||||||
# From Paul Eggert (2007-01-03):
|
# http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001
|
||||||
# Prefer the above source to Shanks & Pottenger for time stamps after 1990.
|
# http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006
|
||||||
|
# From Paul Eggert (2016-09-25):
|
||||||
|
# Prefer the above sources to Shanks & Pottenger for time stamps after 1985.
|
||||||
|
|
||||||
# From Steffen Thorsen (2007-03-09):
|
# From Steffen Thorsen (2007-03-09):
|
||||||
# Starting 2007 though, it seems that they are adopting EU's 1:00 UTC
|
# Starting 2007 though, it seems that they are adopting EU's 1:00 UTC
|
||||||
@ -3574,10 +3576,10 @@ Rule Turkey 1983 only - Jul 31 0:00 1:00 S
|
|||||||
Rule Turkey 1983 only - Oct 2 0:00 0 -
|
Rule Turkey 1983 only - Oct 2 0:00 0 -
|
||||||
Rule Turkey 1985 only - Apr 20 0:00 1:00 S
|
Rule Turkey 1985 only - Apr 20 0:00 1:00 S
|
||||||
Rule Turkey 1985 only - Sep 28 0:00 0 -
|
Rule Turkey 1985 only - Sep 28 0:00 0 -
|
||||||
Rule Turkey 1986 1990 - Mar lastSun 2:00s 1:00 S
|
Rule Turkey 1986 1993 - Mar lastSun 1:00s 1:00 S
|
||||||
Rule Turkey 1986 1990 - Sep lastSun 2:00s 0 -
|
Rule Turkey 1986 1995 - Sep lastSun 1:00s 0 -
|
||||||
Rule Turkey 1991 2006 - Mar lastSun 1:00s 1:00 S
|
Rule Turkey 1994 only - Mar 20 1:00s 1:00 S
|
||||||
Rule Turkey 1991 1995 - Sep lastSun 1:00s 0 -
|
Rule Turkey 1995 2006 - Mar lastSun 1:00s 1:00 S
|
||||||
Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 -
|
Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 -
|
||||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||||
Zone Europe/Istanbul 1:55:52 - LMT 1880
|
Zone Europe/Istanbul 1:55:52 - LMT 1880
|
||||||
|
@ -47,8 +47,32 @@
|
|||||||
# was the result of his proposals at the Convention of Railroad Trunk Lines
|
# was the result of his proposals at the Convention of Railroad Trunk Lines
|
||||||
# in New York City (1869-10). His 1870 proposal was based on Washington, DC,
|
# in New York City (1869-10). His 1870 proposal was based on Washington, DC,
|
||||||
# but in 1872-05 he moved the proposed origin to Greenwich.
|
# but in 1872-05 he moved the proposed origin to Greenwich.
|
||||||
# His proposal was adopted by the railroads on 1883-11-18 at 12:00,
|
|
||||||
# and the most of the country soon followed suit.
|
# From Paul Eggert (2016-09-21):
|
||||||
|
# Dowd's proposal left many details unresolved, such as where to draw
|
||||||
|
# lines between time zones. The key individual who made time zones
|
||||||
|
# work in the US was William Frederick Allen - railway engineer,
|
||||||
|
# managing editor of the Travelers' Guide, and secretary of the
|
||||||
|
# General Time Convention, a railway standardization group. Allen
|
||||||
|
# spent months in dialogs with scientific and railway leaders,
|
||||||
|
# developed a workable plan to institute time zones, and presented it
|
||||||
|
# to the General Time Convention on 1883-04-11, saying that his plan
|
||||||
|
# meant "local time would be practically abolished" - a plus for
|
||||||
|
# railway scheduling. By the next convention on 1883-10-11 nearly all
|
||||||
|
# railroads had agreed and it took effect on 1883-11-18 at 12:00.
|
||||||
|
# That Sunday was called the "day of two noons", as the eastern parts
|
||||||
|
# of the new zones observed noon twice. Allen witnessed the
|
||||||
|
# transition in New York City, writing:
|
||||||
|
#
|
||||||
|
# I heard the bells of St. Paul's strike on the old time. Four
|
||||||
|
# minutes later, obedient to the electrical signal from the Naval
|
||||||
|
# Observatory ... the time-ball made its rapid descent, the chimes
|
||||||
|
# of old Trinity rang twelve measured strokes, and local time was
|
||||||
|
# abandoned, probably forever.
|
||||||
|
#
|
||||||
|
# Most of the US soon followed suit. See:
|
||||||
|
# Bartky IR. The adoption of standard time. Technol Cult 1989 Jan;30(1):25-56.
|
||||||
|
# http://dx.doi.org/10.2307/3105430
|
||||||
|
|
||||||
# From Paul Eggert (2005-04-16):
|
# From Paul Eggert (2005-04-16):
|
||||||
# That 1883 transition occurred at 12:00 new time, not at 12:00 old time.
|
# That 1883 transition occurred at 12:00 new time, not at 12:00 old time.
|
||||||
|
@ -55,7 +55,6 @@ $(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR_BASE, \
|
|||||||
$(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR_LD, \
|
$(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR_LD, \
|
||||||
SETUP := GENERATE_OLDBYTECODE, \
|
SETUP := GENERATE_OLDBYTECODE, \
|
||||||
SRC := $(JDK_TOPDIR)/src/jdk.localedata/share/classes, \
|
SRC := $(JDK_TOPDIR)/src/jdk.localedata/share/classes, \
|
||||||
INCLUDES := $(TEXT_PKG_LD), \
|
|
||||||
INCLUDE_FILES := \
|
INCLUDE_FILES := \
|
||||||
$(TEXT_PKG_LD)/BreakIteratorRules_th.java \
|
$(TEXT_PKG_LD)/BreakIteratorRules_th.java \
|
||||||
$(TEXT_PKG_LD)/BreakIteratorInfo_th.java, \
|
$(TEXT_PKG_LD)/BreakIteratorInfo_th.java, \
|
||||||
|
@ -140,7 +140,6 @@ SUNWprivate_1.1 {
|
|||||||
Java_java_lang_Double_doubleToRawLongBits;
|
Java_java_lang_Double_doubleToRawLongBits;
|
||||||
Java_java_lang_Float_intBitsToFloat;
|
Java_java_lang_Float_intBitsToFloat;
|
||||||
Java_java_lang_Float_floatToRawIntBits;
|
Java_java_lang_Float_floatToRawIntBits;
|
||||||
Java_java_lang_StackFrameInfo_toStackTraceElement0;
|
|
||||||
Java_java_lang_StackStreamFactory_checkStackWalkModes;
|
Java_java_lang_StackStreamFactory_checkStackWalkModes;
|
||||||
Java_java_lang_StackStreamFactory_00024AbstractStackWalker_callStackWalk;
|
Java_java_lang_StackStreamFactory_00024AbstractStackWalker_callStackWalk;
|
||||||
Java_java_lang_StackStreamFactory_00024AbstractStackWalker_fetchStackFrames;
|
Java_java_lang_StackStreamFactory_00024AbstractStackWalker_fetchStackFrames;
|
||||||
@ -215,6 +214,8 @@ SUNWprivate_1.1 {
|
|||||||
Java_java_lang_SecurityManager_currentLoadedClass0;
|
Java_java_lang_SecurityManager_currentLoadedClass0;
|
||||||
Java_java_lang_SecurityManager_getClassContext;
|
Java_java_lang_SecurityManager_getClassContext;
|
||||||
Java_java_lang_Shutdown_halt0;
|
Java_java_lang_Shutdown_halt0;
|
||||||
|
Java_java_lang_StackTraceElement_initStackTraceElement;
|
||||||
|
Java_java_lang_StackTraceElement_initStackTraceElements;
|
||||||
Java_java_lang_String_intern;
|
Java_java_lang_String_intern;
|
||||||
Java_java_lang_StringCoding_err;
|
Java_java_lang_StringCoding_err;
|
||||||
Java_java_lang_StringUTF16_isBigEndian;
|
Java_java_lang_StringUTF16_isBigEndian;
|
||||||
@ -227,7 +228,6 @@ SUNWprivate_1.1 {
|
|||||||
Java_java_lang_System_setOut0;
|
Java_java_lang_System_setOut0;
|
||||||
Java_java_lang_Thread_registerNatives;
|
Java_java_lang_Thread_registerNatives;
|
||||||
Java_java_lang_Throwable_fillInStackTrace;
|
Java_java_lang_Throwable_fillInStackTrace;
|
||||||
Java_java_lang_Throwable_getStackTraceElements;
|
|
||||||
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2;
|
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2;
|
||||||
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
|
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2Ljava_security_AccessControlContext_2;
|
||||||
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
|
Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
|
||||||
|
@ -78,7 +78,7 @@ text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_Pri
|
|||||||
text: .text%JNU_GetEnv;
|
text: .text%JNU_GetEnv;
|
||||||
text: .text%Java_java_io_UnixFileSystem_checkAccess;
|
text: .text%Java_java_io_UnixFileSystem_checkAccess;
|
||||||
text: .text%Java_java_lang_reflect_Array_newArray;
|
text: .text%Java_java_lang_reflect_Array_newArray;
|
||||||
text: .text%Java_java_lang_Throwable_getStackTraceElements;
|
text: .text%Java_java_lang_StackTraceElement_initStackTraceElements;
|
||||||
text: .text%throwFileNotFoundException;
|
text: .text%throwFileNotFoundException;
|
||||||
text: .text%JNU_NotifyAll;
|
text: .text%JNU_NotifyAll;
|
||||||
# Test LoadFrame
|
# Test LoadFrame
|
||||||
|
@ -74,7 +74,7 @@ text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_Pri
|
|||||||
text: .text%JNU_GetEnv;
|
text: .text%JNU_GetEnv;
|
||||||
text: .text%Java_java_io_UnixFileSystem_checkAccess;
|
text: .text%Java_java_io_UnixFileSystem_checkAccess;
|
||||||
text: .text%Java_java_lang_reflect_Array_newArray;
|
text: .text%Java_java_lang_reflect_Array_newArray;
|
||||||
text: .text%Java_java_lang_Throwable_getStackTraceElements;
|
text: .text%Java_java_lang_StackTraceElement_initStackTraceElements;
|
||||||
text: .text%throwFileNotFoundException: OUTPUTDIR/io_util.o;
|
text: .text%throwFileNotFoundException: OUTPUTDIR/io_util.o;
|
||||||
text: .text%JNU_NotifyAll;
|
text: .text%JNU_NotifyAll;
|
||||||
# Test LoadFrame
|
# Test LoadFrame
|
||||||
|
@ -78,7 +78,7 @@ text: .text%Java_java_io_UnixFileSystem_checkAccess;
|
|||||||
text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
|
text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
|
||||||
text: .text%Java_java_io_FileInputStream_available;
|
text: .text%Java_java_io_FileInputStream_available;
|
||||||
text: .text%Java_java_lang_reflect_Array_newArray;
|
text: .text%Java_java_lang_reflect_Array_newArray;
|
||||||
text: .text%Java_java_lang_Throwable_getStackTraceElements;
|
text: .text%Java_java_lang_StackTraceElement_initStackTraceElements;
|
||||||
text: .text%Java_java_lang_System_identityHashCode;
|
text: .text%Java_java_lang_System_identityHashCode;
|
||||||
text: .text%JNU_NotifyAll;
|
text: .text%JNU_NotifyAll;
|
||||||
# Test LoadFrame
|
# Test LoadFrame
|
||||||
|
@ -44,6 +44,7 @@ SUNWprivate_1.1 {
|
|||||||
SplashSetFileJarName;
|
SplashSetFileJarName;
|
||||||
SplashSetScaleFactor;
|
SplashSetScaleFactor;
|
||||||
SplashGetScaledImageName;
|
SplashGetScaledImageName;
|
||||||
|
SplashGetScaledImgNameMaxPstfixLen;
|
||||||
local:
|
local:
|
||||||
*;
|
*;
|
||||||
};
|
};
|
||||||
|
@ -33,7 +33,7 @@ include RmicCommon.gmk
|
|||||||
#
|
#
|
||||||
|
|
||||||
$(eval $(call SetupRMICompilation,RMI_12, \
|
$(eval $(call SetupRMICompilation,RMI_12, \
|
||||||
CLASSES := sun.rmi.server.Activation$$$$ActivationSystemImpl \
|
CLASSES := sun.rmi.server.Activation$$ActivationSystemImpl \
|
||||||
java.rmi.activation.ActivationGroup, \
|
java.rmi.activation.ActivationGroup, \
|
||||||
CLASSES_DIR := $(CLASSES_DIR)/java.rmi, \
|
CLASSES_DIR := $(CLASSES_DIR)/java.rmi, \
|
||||||
STUB_CLASSES_DIR := $(STUB_CLASSES_DIR)/java.rmi, \
|
STUB_CLASSES_DIR := $(STUB_CLASSES_DIR)/java.rmi, \
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -1907,16 +1907,10 @@ public class File
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
long n = random.nextLong();
|
long n = random.nextLong();
|
||||||
if (n == Long.MIN_VALUE) {
|
|
||||||
n = 0; // corner case
|
|
||||||
} else {
|
|
||||||
n = Math.abs(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use only the file name from the supplied prefix
|
// Use only the file name from the supplied prefix
|
||||||
prefix = (new File(prefix)).getName();
|
prefix = (new File(prefix)).getName();
|
||||||
|
String name = prefix + Long.toUnsignedString(n) + suffix;
|
||||||
String name = prefix + Long.toString(n) + suffix;
|
|
||||||
File f = new File(dir, name);
|
File f = new File(dir, name);
|
||||||
if (!name.equals(f.getName()) || f.isInvalid()) {
|
if (!name.equals(f.getName()) || f.isInvalid()) {
|
||||||
if (System.getSecurityManager() != null)
|
if (System.getSecurityManager() != null)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,6 @@
|
|||||||
package java.io;
|
package java.io;
|
||||||
|
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import sun.nio.ch.FileChannelImpl;
|
import sun.nio.ch.FileChannelImpl;
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +59,9 @@ class FileInputStream extends InputStream
|
|||||||
|
|
||||||
private volatile FileChannel channel;
|
private volatile FileChannel channel;
|
||||||
|
|
||||||
private final AtomicBoolean closed = new AtomicBoolean(false);
|
private final Object closeLock = new Object();
|
||||||
|
|
||||||
|
private volatile boolean closed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a <code>FileInputStream</code> by
|
* Creates a <code>FileInputStream</code> by
|
||||||
@ -313,14 +314,21 @@ class FileInputStream extends InputStream
|
|||||||
* @spec JSR-51
|
* @spec JSR-51
|
||||||
*/
|
*/
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
if (!closed.compareAndSet(false, true)) {
|
if (closed) {
|
||||||
// if compareAndSet() returns false closed was already true
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
synchronized (closeLock) {
|
||||||
|
if (closed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
closed = true;
|
||||||
|
}
|
||||||
|
|
||||||
FileChannel fc = channel;
|
FileChannel fc = channel;
|
||||||
if (fc != null) {
|
if (fc != null) {
|
||||||
fc.close();
|
// possible race with getChannel(), benign since
|
||||||
|
// FileChannel.close is final and idempotent
|
||||||
|
fc.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
fd.closeAll(new Closeable() {
|
fd.closeAll(new Closeable() {
|
||||||
@ -370,8 +378,10 @@ class FileInputStream extends InputStream
|
|||||||
fc = this.channel;
|
fc = this.channel;
|
||||||
if (fc == null) {
|
if (fc == null) {
|
||||||
this.channel = fc = FileChannelImpl.open(fd, path, true, false, this);
|
this.channel = fc = FileChannelImpl.open(fd, path, true, false, this);
|
||||||
if (closed.get()) {
|
if (closed) {
|
||||||
try {
|
try {
|
||||||
|
// possible race with close(), benign since
|
||||||
|
// FileChannel.close is final and idempotent
|
||||||
fc.close();
|
fc.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new InternalError(ioe); // should not happen
|
throw new InternalError(ioe); // should not happen
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,7 +26,6 @@
|
|||||||
package java.io;
|
package java.io;
|
||||||
|
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import jdk.internal.misc.SharedSecrets;
|
import jdk.internal.misc.SharedSecrets;
|
||||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||||
import sun.nio.ch.FileChannelImpl;
|
import sun.nio.ch.FileChannelImpl;
|
||||||
@ -77,7 +76,9 @@ class FileOutputStream extends OutputStream
|
|||||||
*/
|
*/
|
||||||
private final String path;
|
private final String path;
|
||||||
|
|
||||||
private final AtomicBoolean closed = new AtomicBoolean(false);
|
private final Object closeLock = new Object();
|
||||||
|
|
||||||
|
private volatile boolean closed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a file output stream to write to the file with the
|
* Creates a file output stream to write to the file with the
|
||||||
@ -341,14 +342,21 @@ class FileOutputStream extends OutputStream
|
|||||||
* @spec JSR-51
|
* @spec JSR-51
|
||||||
*/
|
*/
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
if (!closed.compareAndSet(false, true)) {
|
if (closed) {
|
||||||
// if compareAndSet() returns false closed was already true
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
synchronized (closeLock) {
|
||||||
|
if (closed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
closed = true;
|
||||||
|
}
|
||||||
|
|
||||||
FileChannel fc = channel;
|
FileChannel fc = channel;
|
||||||
if (fc != null) {
|
if (fc != null) {
|
||||||
fc.close();
|
// possible race with getChannel(), benign since
|
||||||
|
// FileChannel.close is final and idempotent
|
||||||
|
fc.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
fd.closeAll(new Closeable() {
|
fd.closeAll(new Closeable() {
|
||||||
@ -399,8 +407,10 @@ class FileOutputStream extends OutputStream
|
|||||||
fc = this.channel;
|
fc = this.channel;
|
||||||
if (fc == null) {
|
if (fc == null) {
|
||||||
this.channel = fc = FileChannelImpl.open(fd, path, false, true, this);
|
this.channel = fc = FileChannelImpl.open(fd, path, false, true, this);
|
||||||
if (closed.get()) {
|
if (closed) {
|
||||||
try {
|
try {
|
||||||
|
// possible race with close(), benign since
|
||||||
|
// FileChannel.close is final and idempotent
|
||||||
fc.close();
|
fc.close();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new InternalError(ioe); // should not happen
|
throw new InternalError(ioe); // should not happen
|
||||||
|
@ -173,6 +173,7 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
private transient Path npath; // normalized dir path.
|
private transient Path npath; // normalized dir path.
|
||||||
private transient Path npath2; // alternative normalized dir path.
|
private transient Path npath2; // alternative normalized dir path.
|
||||||
private transient boolean allFiles; // whether this is <<ALL FILES>>
|
private transient boolean allFiles; // whether this is <<ALL FILES>>
|
||||||
|
private transient boolean invalid; // whether input path is invalid
|
||||||
|
|
||||||
// static Strings used by init(int mask)
|
// static Strings used by init(int mask)
|
||||||
private static final char RECURSIVE_CHAR = '-';
|
private static final char RECURSIVE_CHAR = '-';
|
||||||
@ -218,11 +219,12 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
* A private constructor like a clone, only npath2 is not touched.
|
* A private constructor like a clone, only npath2 is not touched.
|
||||||
* @param input
|
* @param input
|
||||||
*/
|
*/
|
||||||
private FilePermission(FilePermission input) {
|
private FilePermission(String name, FilePermission input) {
|
||||||
super(input.getName());
|
super(name);
|
||||||
this.npath = input.npath;
|
this.npath = input.npath;
|
||||||
this.actions = input.actions;
|
this.actions = input.actions;
|
||||||
this.allFiles = input.allFiles;
|
this.allFiles = input.allFiles;
|
||||||
|
this.invalid = input.invalid;
|
||||||
this.recursive = input.recursive;
|
this.recursive = input.recursive;
|
||||||
this.directory = input.directory;
|
this.directory = input.directory;
|
||||||
this.cpath = input.cpath;
|
this.cpath = input.cpath;
|
||||||
@ -255,7 +257,12 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
if (input.npath2 == null && !input.allFiles) {
|
if (input.npath2 == null && !input.allFiles) {
|
||||||
Path npath2 = altPath(input.npath);
|
Path npath2 = altPath(input.npath);
|
||||||
if (npath2 != null) {
|
if (npath2 != null) {
|
||||||
FilePermission np = new FilePermission(input);
|
// Please note the name of the new permission is
|
||||||
|
// different than the original so that when one is
|
||||||
|
// added to a FilePermissionCollection it will not
|
||||||
|
// be merged with the original one.
|
||||||
|
FilePermission np = new FilePermission(
|
||||||
|
input.getName()+"#plus", input);
|
||||||
np.npath2 = npath2;
|
np.npath2 = npath2;
|
||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
@ -266,7 +273,9 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
if (!input.allFiles) {
|
if (!input.allFiles) {
|
||||||
Path npath2 = altPath(input.npath);
|
Path npath2 = altPath(input.npath);
|
||||||
if (npath2 != null) {
|
if (npath2 != null) {
|
||||||
FilePermission np = new FilePermission(input);
|
// New name, see above.
|
||||||
|
FilePermission np = new FilePermission(
|
||||||
|
input.getName()+"#using", input);
|
||||||
np.npath = npath2;
|
np.npath = npath2;
|
||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
@ -318,11 +327,12 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
// Windows. Some JDK codes generate such illegal names.
|
// Windows. Some JDK codes generate such illegal names.
|
||||||
npath = builtInFS.getPath(new File(name).getPath())
|
npath = builtInFS.getPath(new File(name).getPath())
|
||||||
.normalize();
|
.normalize();
|
||||||
|
invalid = false;
|
||||||
} catch (InvalidPathException ipe) {
|
} catch (InvalidPathException ipe) {
|
||||||
// Still invalid. For compatibility reason, accept it
|
// Still invalid. For compatibility reason, accept it
|
||||||
// but make this permission useless.
|
// but make this permission useless.
|
||||||
npath = builtInFS.getPath("-u-s-e-l-e-s-s-");
|
npath = builtInFS.getPath("-u-s-e-l-e-s-s-");
|
||||||
this.mask = NONE;
|
invalid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// lastName should always be non-null now
|
// lastName should always be non-null now
|
||||||
@ -540,6 +550,12 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
*/
|
*/
|
||||||
boolean impliesIgnoreMask(FilePermission that) {
|
boolean impliesIgnoreMask(FilePermission that) {
|
||||||
if (FilePermCompat.nb) {
|
if (FilePermCompat.nb) {
|
||||||
|
if (this == that) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (this.invalid || that.invalid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (allFiles) {
|
if (allFiles) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -687,9 +703,13 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
FilePermission that = (FilePermission) obj;
|
FilePermission that = (FilePermission) obj;
|
||||||
|
|
||||||
if (FilePermCompat.nb) {
|
if (FilePermCompat.nb) {
|
||||||
|
if (this.invalid || that.invalid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return (this.mask == that.mask) &&
|
return (this.mask == that.mask) &&
|
||||||
(this.allFiles == that.allFiles) &&
|
(this.allFiles == that.allFiles) &&
|
||||||
this.npath.equals(that.npath) &&
|
this.npath.equals(that.npath) &&
|
||||||
|
Objects.equals(npath2, that.npath2) &&
|
||||||
(this.directory == that.directory) &&
|
(this.directory == that.directory) &&
|
||||||
(this.recursive == that.recursive);
|
(this.recursive == that.recursive);
|
||||||
} else {
|
} else {
|
||||||
@ -708,7 +728,8 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
if (FilePermCompat.nb) {
|
if (FilePermCompat.nb) {
|
||||||
return Objects.hash(mask, allFiles, directory, recursive, npath);
|
return Objects.hash(
|
||||||
|
mask, allFiles, directory, recursive, npath, npath2, invalid);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
* can be replaced by
|
* can be replaced by
|
||||||
*
|
*
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
* clazz.getConstructor().newInstance()
|
* clazz.getDeclaredConstructor().newInstance()
|
||||||
* }</pre>
|
* }</pre>
|
||||||
*
|
*
|
||||||
* The latter sequence of calls is inferred to be able to throw
|
* The latter sequence of calls is inferred to be able to throw
|
||||||
|
@ -104,9 +104,9 @@ import sun.security.util.SecurityConstants;
|
|||||||
* class or resource itself.
|
* class or resource itself.
|
||||||
*
|
*
|
||||||
* <p> Class loaders that support concurrent loading of classes are known as
|
* <p> Class loaders that support concurrent loading of classes are known as
|
||||||
* <em>parallel capable</em> class loaders and are required to register
|
* <em>{@linkplain #isParallelCapable() parallel capable}</em> class loaders and
|
||||||
* themselves at their class initialization time by invoking the
|
* are required to register themselves at their class initialization time by
|
||||||
* {@link
|
* invoking the {@link
|
||||||
* #registerAsParallelCapable <tt>ClassLoader.registerAsParallelCapable</tt>}
|
* #registerAsParallelCapable <tt>ClassLoader.registerAsParallelCapable</tt>}
|
||||||
* method. Note that the <tt>ClassLoader</tt> class is registered as parallel
|
* method. Note that the <tt>ClassLoader</tt> class is registered as parallel
|
||||||
* capable by default. However, its subclasses still need to register themselves
|
* capable by default. However, its subclasses still need to register themselves
|
||||||
@ -222,6 +222,9 @@ public abstract class ClassLoader {
|
|||||||
// must be added *after* it.
|
// must be added *after* it.
|
||||||
private final ClassLoader parent;
|
private final ClassLoader parent;
|
||||||
|
|
||||||
|
// class loader name
|
||||||
|
private final String name;
|
||||||
|
|
||||||
// the unnamed module for this ClassLoader
|
// the unnamed module for this ClassLoader
|
||||||
private final Module unnamedModule;
|
private final Module unnamedModule;
|
||||||
|
|
||||||
@ -331,6 +334,14 @@ public abstract class ClassLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Void checkCreateClassLoader() {
|
private static Void checkCreateClassLoader() {
|
||||||
|
return checkCreateClassLoader(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Void checkCreateClassLoader(String name) {
|
||||||
|
if (name != null && name.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("name must be non-empty or null");
|
||||||
|
}
|
||||||
|
|
||||||
SecurityManager security = System.getSecurityManager();
|
SecurityManager security = System.getSecurityManager();
|
||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkCreateClassLoader();
|
security.checkCreateClassLoader();
|
||||||
@ -338,7 +349,8 @@ public abstract class ClassLoader {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClassLoader(Void unused, ClassLoader parent) {
|
private ClassLoader(Void unused, String name, ClassLoader parent) {
|
||||||
|
this.name = name;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.unnamedModule
|
this.unnamedModule
|
||||||
= SharedSecrets.getJavaLangReflectModuleAccess()
|
= SharedSecrets.getJavaLangReflectModuleAccess()
|
||||||
@ -355,6 +367,27 @@ public abstract class ClassLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new class loader of the specified name and using the
|
||||||
|
* specified parent class loader for delegation.
|
||||||
|
*
|
||||||
|
* @param name class loader name; or {@code null} if not named
|
||||||
|
* @param parent the parent class loader
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the given name is empty.
|
||||||
|
*
|
||||||
|
* @throws SecurityException
|
||||||
|
* If a security manager exists and its
|
||||||
|
* {@link SecurityManager#checkCreateClassLoader()}
|
||||||
|
* method doesn't allow creation of a new class loader.
|
||||||
|
*
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
protected ClassLoader(String name, ClassLoader parent) {
|
||||||
|
this(checkCreateClassLoader(name), name, parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new class loader using the specified parent class loader for
|
* Creates a new class loader using the specified parent class loader for
|
||||||
* delegation.
|
* delegation.
|
||||||
@ -375,9 +408,10 @@ public abstract class ClassLoader {
|
|||||||
* @since 1.2
|
* @since 1.2
|
||||||
*/
|
*/
|
||||||
protected ClassLoader(ClassLoader parent) {
|
protected ClassLoader(ClassLoader parent) {
|
||||||
this(checkCreateClassLoader(), parent);
|
this(checkCreateClassLoader(), null, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new class loader using the <tt>ClassLoader</tt> returned by
|
* Creates a new class loader using the <tt>ClassLoader</tt> returned by
|
||||||
* the method {@link #getSystemClassLoader()
|
* the method {@link #getSystemClassLoader()
|
||||||
@ -394,7 +428,31 @@ public abstract class ClassLoader {
|
|||||||
* of a new class loader.
|
* of a new class loader.
|
||||||
*/
|
*/
|
||||||
protected ClassLoader() {
|
protected ClassLoader() {
|
||||||
this(checkCreateClassLoader(), getSystemClassLoader());
|
this(checkCreateClassLoader(), null, getSystemClassLoader());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of this class loader or {@code null} if
|
||||||
|
* this class loader is not named.
|
||||||
|
*
|
||||||
|
* @apiNote This method is non-final for compatibility. If this
|
||||||
|
* method is overridden, this method must return the same name
|
||||||
|
* as specified when this class loader was instantiated.
|
||||||
|
*
|
||||||
|
* @return name of this class loader; or {@code null} if
|
||||||
|
* this class loader is not named.
|
||||||
|
*
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// package-private used by StackTraceElement to avoid
|
||||||
|
// calling the overrideable getName method
|
||||||
|
final String name() {
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Class --
|
// -- Class --
|
||||||
@ -1437,7 +1495,7 @@ public abstract class ClassLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the caller as parallel capable.
|
* Registers the caller as {@linkplain #isParallelCapable() parallel capable}.
|
||||||
* The registration succeeds if and only if all of the following
|
* The registration succeeds if and only if all of the following
|
||||||
* conditions are met:
|
* conditions are met:
|
||||||
* <ol>
|
* <ol>
|
||||||
@ -1448,8 +1506,10 @@ public abstract class ClassLoader {
|
|||||||
* <p>Note that once a class loader is registered as parallel capable, there
|
* <p>Note that once a class loader is registered as parallel capable, there
|
||||||
* is no way to change it back.</p>
|
* is no way to change it back.</p>
|
||||||
*
|
*
|
||||||
* @return true if the caller is successfully registered as
|
* @return {@code true} if the caller is successfully registered as
|
||||||
* parallel capable and false if otherwise.
|
* parallel capable and {@code false} if otherwise.
|
||||||
|
*
|
||||||
|
* @see #isParallelCapable()
|
||||||
*
|
*
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
*/
|
*/
|
||||||
@ -1460,6 +1520,22 @@ public abstract class ClassLoader {
|
|||||||
return ParallelLoaders.register(callerClass);
|
return ParallelLoaders.register(callerClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@code true} if this class loader is
|
||||||
|
* {@linkplain #registerAsParallelCapable parallel capable}, otherwise
|
||||||
|
* {@code false}.
|
||||||
|
*
|
||||||
|
* @return {@code true} if this class loader is parallel capable,
|
||||||
|
* otherwise {@code false}.
|
||||||
|
*
|
||||||
|
* @see #registerAsParallelCapable()
|
||||||
|
*
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
public final boolean isParallelCapable() {
|
||||||
|
return ParallelLoaders.isRegistered(this.getClass());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a resource of the specified name from the search path used to load
|
* Find a resource of the specified name from the search path used to load
|
||||||
* classes. This method locates the resource through the system class
|
* classes. This method locates the resource through the system class
|
||||||
@ -1610,6 +1686,9 @@ public abstract class ClassLoader {
|
|||||||
* <a href="#builtinLoaders">platform classes</a> are visible to
|
* <a href="#builtinLoaders">platform classes</a> are visible to
|
||||||
* the platform class loader.
|
* the platform class loader.
|
||||||
*
|
*
|
||||||
|
* @implNote The name of the builtin platform class loader is
|
||||||
|
* {@code "platform"}.
|
||||||
|
*
|
||||||
* @return The platform {@code ClassLoader}.
|
* @return The platform {@code ClassLoader}.
|
||||||
*
|
*
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
@ -1663,6 +1742,16 @@ public abstract class ClassLoader {
|
|||||||
* this method during startup should take care not to cache the return
|
* this method during startup should take care not to cache the return
|
||||||
* value until the system is fully initialized.
|
* value until the system is fully initialized.
|
||||||
*
|
*
|
||||||
|
* <p> The name of the built-in system class loader is {@code "app"}.
|
||||||
|
* The class path used by the built-in system class loader is determined
|
||||||
|
* by the system property "{@code java.class.path}" during early
|
||||||
|
* initialization of the VM. If the system property is not defined,
|
||||||
|
* or its value is an empty string, then there is no class path
|
||||||
|
* when the initial module is a module on the application module path,
|
||||||
|
* i.e. <em>a named module</em>. If the initial module is not on
|
||||||
|
* the application module path then the class path defaults to
|
||||||
|
* the current working directory.
|
||||||
|
*
|
||||||
* @return The system <tt>ClassLoader</tt> for delegation
|
* @return The system <tt>ClassLoader</tt> for delegation
|
||||||
*
|
*
|
||||||
* @throws SecurityException
|
* @throws SecurityException
|
||||||
|
@ -112,11 +112,6 @@ class StackFrameInfo implements StackFrame {
|
|||||||
return toStackTraceElement().toString();
|
return toStackTraceElement().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill in the fields of the given StackTraceElement
|
|
||||||
*/
|
|
||||||
private native void toStackTraceElement0(StackTraceElement ste);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StackTraceElement toStackTraceElement() {
|
public StackTraceElement toStackTraceElement() {
|
||||||
StackTraceElement s = ste;
|
StackTraceElement s = ste;
|
||||||
@ -124,9 +119,7 @@ class StackFrameInfo implements StackFrame {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
s = ste;
|
s = ste;
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
s = new StackTraceElement();
|
ste = s = StackTraceElement.of(this);
|
||||||
toStackTraceElement0(s);
|
|
||||||
ste = s;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,18 @@
|
|||||||
|
|
||||||
package java.lang;
|
package java.lang;
|
||||||
|
|
||||||
|
import jdk.internal.loader.BuiltinClassLoader;
|
||||||
|
import jdk.internal.misc.SharedSecrets;
|
||||||
|
import jdk.internal.misc.VM;
|
||||||
|
import jdk.internal.module.ModuleHashes;
|
||||||
|
|
||||||
|
import java.lang.module.ModuleDescriptor.Version;
|
||||||
|
import java.lang.reflect.Layer;
|
||||||
|
import java.lang.reflect.Module;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An element in a stack trace, as returned by {@link
|
* An element in a stack trace, as returned by {@link
|
||||||
@ -40,7 +51,15 @@ import java.util.Objects;
|
|||||||
* @author Josh Bloch
|
* @author Josh Bloch
|
||||||
*/
|
*/
|
||||||
public final class StackTraceElement implements java.io.Serializable {
|
public final class StackTraceElement implements java.io.Serializable {
|
||||||
// Normally initialized by VM (public constructor added in 1.5)
|
// This field is set to the compacted String representation used
|
||||||
|
// by StackTraceElement::toString and stored in serial form.
|
||||||
|
//
|
||||||
|
// This field is of Object type. VM initially sets this field to
|
||||||
|
// the Class object of the declaring class to build the compacted string.
|
||||||
|
private Object classOrLoaderModuleClassName;
|
||||||
|
|
||||||
|
// Normally initialized by VM
|
||||||
|
private String classLoaderName;
|
||||||
private String moduleName;
|
private String moduleName;
|
||||||
private String moduleVersion;
|
private String moduleVersion;
|
||||||
private String declaringClass;
|
private String declaringClass;
|
||||||
@ -72,19 +91,22 @@ public final class StackTraceElement implements java.io.Serializable {
|
|||||||
*/
|
*/
|
||||||
public StackTraceElement(String declaringClass, String methodName,
|
public StackTraceElement(String declaringClass, String methodName,
|
||||||
String fileName, int lineNumber) {
|
String fileName, int lineNumber) {
|
||||||
this(null, null, declaringClass, methodName, fileName, lineNumber);
|
this(null, null, null, declaringClass, methodName, fileName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a stack trace element representing the specified execution
|
* Creates a stack trace element representing the specified execution
|
||||||
* point.
|
* point.
|
||||||
*
|
*
|
||||||
|
* @param classLoaderName the class loader name if the class loader of
|
||||||
|
* the class containing the execution point represented by
|
||||||
|
* the stack trace is named; otherwise {@code null}
|
||||||
* @param moduleName the module name if the class containing the
|
* @param moduleName the module name if the class containing the
|
||||||
* execution point represented by the stack trace is in a named
|
* execution point represented by the stack trace is in a named
|
||||||
* module; can be {@code null}
|
* module; otherwise {@code null}
|
||||||
* @param moduleVersion the module version if the class containing the
|
* @param moduleVersion the module version if the class containing the
|
||||||
* execution point represented by the stack trace is in a named
|
* execution point represented by the stack trace is in a named
|
||||||
* module that has a version; can be {@code null}
|
* module that has a version; otherwise {@code null}
|
||||||
* @param declaringClass the fully qualified name of the class containing
|
* @param declaringClass the fully qualified name of the class containing
|
||||||
* the execution point represented by the stack trace element
|
* the execution point represented by the stack trace element
|
||||||
* @param methodName the name of the method containing the execution point
|
* @param methodName the name of the method containing the execution point
|
||||||
@ -97,26 +119,30 @@ public final class StackTraceElement implements java.io.Serializable {
|
|||||||
* a negative number if this information is unavailable. A value
|
* a negative number if this information is unavailable. A value
|
||||||
* of -2 indicates that the method containing the execution point
|
* of -2 indicates that the method containing the execution point
|
||||||
* is a native method
|
* is a native method
|
||||||
|
*
|
||||||
* @throws NullPointerException if {@code declaringClass} is {@code null}
|
* @throws NullPointerException if {@code declaringClass} is {@code null}
|
||||||
* or {@code methodName} is {@code null}
|
* or {@code methodName} is {@code null}
|
||||||
|
*
|
||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
public StackTraceElement(String moduleName, String moduleVersion,
|
public StackTraceElement(String classLoaderName,
|
||||||
|
String moduleName, String moduleVersion,
|
||||||
String declaringClass, String methodName,
|
String declaringClass, String methodName,
|
||||||
String fileName, int lineNumber) {
|
String fileName, int lineNumber) {
|
||||||
this.moduleName = moduleName;
|
this.classLoaderName = classLoaderName;
|
||||||
this.moduleVersion = moduleVersion;
|
this.moduleName = moduleName;
|
||||||
this.declaringClass = Objects.requireNonNull(declaringClass, "Declaring class is null");
|
this.moduleVersion = moduleVersion;
|
||||||
this.methodName = Objects.requireNonNull(methodName, "Method name is null");
|
this.declaringClass = Objects.requireNonNull(declaringClass, "Declaring class is null");
|
||||||
this.fileName = fileName;
|
this.methodName = Objects.requireNonNull(methodName, "Method name is null");
|
||||||
this.lineNumber = lineNumber;
|
this.fileName = fileName;
|
||||||
|
this.lineNumber = lineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
/**
|
* Private constructor for the factory methods to create StackTraceElement
|
||||||
* Creates an empty stack frame element to be filled in by Throwable.
|
* for Throwable and StackFrameInfo
|
||||||
*/
|
*/
|
||||||
StackTraceElement() { }
|
private StackTraceElement() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the source file containing the execution point
|
* Returns the name of the source file containing the execution point
|
||||||
@ -177,6 +203,21 @@ public final class StackTraceElement implements java.io.Serializable {
|
|||||||
return moduleVersion;
|
return moduleVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the class loader of the class containing the
|
||||||
|
* execution point represented by this stack trace element.
|
||||||
|
*
|
||||||
|
* @return the name of the class loader of the class containing the execution
|
||||||
|
* point represented by this stack trace element; {@code null}
|
||||||
|
* if the class loader is not named.
|
||||||
|
*
|
||||||
|
* @since 9
|
||||||
|
* @see java.lang.ClassLoader#getName()
|
||||||
|
*/
|
||||||
|
public String getClassLoaderName() {
|
||||||
|
return classLoaderName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the fully qualified name of the class containing the
|
* Returns the fully qualified name of the class containing the
|
||||||
* execution point represented by this stack trace element.
|
* execution point represented by this stack trace element.
|
||||||
@ -220,38 +261,83 @@ public final class StackTraceElement implements java.io.Serializable {
|
|||||||
* examples may be regarded as typical:
|
* examples may be regarded as typical:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>
|
* <li>
|
||||||
* {@code "MyClass.mash(my.module@9.0/MyClass.java:101)"} - Here,
|
* "{@code com.foo.loader/foo@9.0/com.foo.Main.run(Main.java:101)}"
|
||||||
* {@code "MyClass"} is the <i>fully-qualified name</i> of the class
|
* - See the description below.
|
||||||
* containing the execution point represented by this stack trace element,
|
* </li>
|
||||||
* {@code "mash"} is the name of the method containing the execution
|
|
||||||
* point, {@code "my.module"} is the module name, {@code "9.0"} is the
|
|
||||||
* module version, and {@code "101"} is the line number of the source
|
|
||||||
* line containing the execution point.
|
|
||||||
* <li>
|
* <li>
|
||||||
* {@code "MyClass.mash(my.module@9.0/MyClass.java)"} - As above, but the
|
* "{@code com.foo.loader/foo@9.0/com.foo.Main.run(Main.java)}"
|
||||||
* line number is unavailable.
|
* - The line number is unavailable.
|
||||||
|
* </li>
|
||||||
* <li>
|
* <li>
|
||||||
* {@code "MyClass.mash(my.module@9.0/Unknown Source)"} - As above, but
|
* "{@code com.foo.loader/foo@9.0/com.foo.Main.run(Unknown Source)}"
|
||||||
* neither the file name nor the line number are available.
|
* - Neither the file name nor the line number is available.
|
||||||
|
* </li>
|
||||||
* <li>
|
* <li>
|
||||||
* {@code "MyClass.mash(my.module@9.0/Native Method)"} - As above, but
|
* "{@code com.foo.loader/foo@9.0/com.foo.Main.run(Native Method)}"
|
||||||
* neither the file name nor the line number are available, and the
|
* - The method containing the execution point is a native method.
|
||||||
* method containing the execution point is known to be a native method.
|
* </li>
|
||||||
|
* <li>
|
||||||
|
* "{@code com.foo.loader//com.foo.bar.App.run(App.java:12)}"
|
||||||
|
* - The class of the execution point is defined in the unnamed module of
|
||||||
|
* the class loader named {@code com.foo.loader}.
|
||||||
|
* </li>
|
||||||
|
* <li>
|
||||||
|
* "{@code acme@2.1/org.acme.Lib.test(Lib.java:80)}"
|
||||||
|
* - The class of the execution point is defined in {@code acme} module
|
||||||
|
* loaded by by a built-in class loader such as the application class loader.
|
||||||
|
* </li>
|
||||||
|
* <li>
|
||||||
|
* "{@code MyClass.mash(MyClass.java:9)}"
|
||||||
|
* - {@code MyClass} class is on the application class path.
|
||||||
|
* </li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* If the execution point is not in a named module, {@code "my.module@9.0/"}
|
*
|
||||||
* will be omitted from the above.
|
* <p> The first example shows a stack trace element consisting of
|
||||||
|
* three elements, each separated by {@code "/"} followed with
|
||||||
|
* the source file name and the line number of the source line
|
||||||
|
* containing the execution point.
|
||||||
|
*
|
||||||
|
* The first element "{@code com.foo.loader}" is
|
||||||
|
* the name of the class loader. The second element "{@code foo@9.0}"
|
||||||
|
* is the module name and version. The third element is the method
|
||||||
|
* containing the execution point; "{@code com.foo.Main"}" is the
|
||||||
|
* fully-qualified class name and "{@code run}" is the name of the method.
|
||||||
|
* "{@code Main.java}" is the source file name and "{@code 101}" is
|
||||||
|
* the line number.
|
||||||
|
*
|
||||||
|
* <p> If a class is defined in an <em>unnamed module</em>
|
||||||
|
* then the second element is omitted as shown in
|
||||||
|
* "{@code com.foo.loader//com.foo.bar.App.run(App.java:12)}".
|
||||||
|
*
|
||||||
|
* If the class loader is a <a href="ClassLoader.html#builtinLoaders">
|
||||||
|
* built-in class loader</a> or is not named then the first element
|
||||||
|
* and its following {@code "/"} are omitted as shown in
|
||||||
|
* "{@code acme@2.1/org.acme.Lib.test(Lib.java:80)}".
|
||||||
|
* If the first element is omitted and the module is an unnamed module,
|
||||||
|
* the second element and its following {@code "/"} are also omitted
|
||||||
|
* as shown in "{@code MyClass.mash(MyClass.java:9)}".
|
||||||
*
|
*
|
||||||
* @see Throwable#printStackTrace()
|
* @see Throwable#printStackTrace()
|
||||||
*/
|
*/
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String mid = "";
|
String s = buildLoaderModuleClassName();
|
||||||
if (moduleName != null) {
|
if (s == null) {
|
||||||
mid = moduleName;
|
// all elements will be included
|
||||||
if (moduleVersion != null)
|
s = "";
|
||||||
mid += "@" + moduleVersion;
|
if (classLoaderName != null && !classLoaderName.isEmpty()) {
|
||||||
mid += "/";
|
s += classLoaderName + "/";
|
||||||
|
}
|
||||||
|
if (moduleName != null && !moduleName.isEmpty()) {
|
||||||
|
s += moduleName;
|
||||||
|
|
||||||
|
if (moduleVersion != null && !moduleVersion.isEmpty()) {
|
||||||
|
s += "@" + moduleVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s = s.isEmpty() ? declaringClass : s + "/" + declaringClass;
|
||||||
}
|
}
|
||||||
return getClassName() + "." + methodName + "(" + mid +
|
|
||||||
|
return s + "." + methodName + "(" +
|
||||||
(isNativeMethod() ? "Native Method)" :
|
(isNativeMethod() ? "Native Method)" :
|
||||||
(fileName != null && lineNumber >= 0 ?
|
(fileName != null && lineNumber >= 0 ?
|
||||||
fileName + ":" + lineNumber + ")" :
|
fileName + ":" + lineNumber + ")" :
|
||||||
@ -264,12 +350,14 @@ public final class StackTraceElement implements java.io.Serializable {
|
|||||||
* point as this instance. Two stack trace elements {@code a} and
|
* point as this instance. Two stack trace elements {@code a} and
|
||||||
* {@code b} are equal if and only if:
|
* {@code b} are equal if and only if:
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
* equals(a.getFileName(), b.getFileName()) &&
|
* equals(a.getClassLoaderName(), b.getClassLoaderName()) &&
|
||||||
* a.getLineNumber() == b.getLineNumber()) &&
|
|
||||||
* equals(a.getModuleName(), b.getModuleName()) &&
|
* equals(a.getModuleName(), b.getModuleName()) &&
|
||||||
* equals(a.getModuleVersion(), b.getModuleVersion()) &&
|
* equals(a.getModuleVersion(), b.getModuleVersion()) &&
|
||||||
* equals(a.getClassName(), b.getClassName()) &&
|
* equals(a.getClassName(), b.getClassName()) &&
|
||||||
* equals(a.getMethodName(), b.getMethodName())
|
* equals(a.getMethodName(), b.getMethodName())
|
||||||
|
* equals(a.getFileName(), b.getFileName()) &&
|
||||||
|
* a.getLineNumber() == b.getLineNumber()
|
||||||
|
*
|
||||||
* }</pre>
|
* }</pre>
|
||||||
* where {@code equals} has the semantics of {@link
|
* where {@code equals} has the semantics of {@link
|
||||||
* java.util.Objects#equals(Object, Object) Objects.equals}.
|
* java.util.Objects#equals(Object, Object) Objects.equals}.
|
||||||
@ -285,9 +373,10 @@ public final class StackTraceElement implements java.io.Serializable {
|
|||||||
if (!(obj instanceof StackTraceElement))
|
if (!(obj instanceof StackTraceElement))
|
||||||
return false;
|
return false;
|
||||||
StackTraceElement e = (StackTraceElement)obj;
|
StackTraceElement e = (StackTraceElement)obj;
|
||||||
return e.declaringClass.equals(declaringClass) &&
|
return Objects.equals(classLoaderName, e.classLoaderName) &&
|
||||||
Objects.equals(moduleName, e.moduleName) &&
|
Objects.equals(moduleName, e.moduleName) &&
|
||||||
Objects.equals(moduleVersion, e.moduleVersion) &&
|
Objects.equals(moduleVersion, e.moduleVersion) &&
|
||||||
|
e.declaringClass.equals(declaringClass) &&
|
||||||
e.lineNumber == lineNumber &&
|
e.lineNumber == lineNumber &&
|
||||||
Objects.equals(methodName, e.methodName) &&
|
Objects.equals(methodName, e.methodName) &&
|
||||||
Objects.equals(fileName, e.fileName);
|
Objects.equals(fileName, e.fileName);
|
||||||
@ -298,6 +387,7 @@ public final class StackTraceElement implements java.io.Serializable {
|
|||||||
*/
|
*/
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = 31*declaringClass.hashCode() + methodName.hashCode();
|
int result = 31*declaringClass.hashCode() + methodName.hashCode();
|
||||||
|
result = 31*result + Objects.hashCode(classLoaderName);
|
||||||
result = 31*result + Objects.hashCode(moduleName);
|
result = 31*result + Objects.hashCode(moduleName);
|
||||||
result = 31*result + Objects.hashCode(moduleVersion);
|
result = 31*result + Objects.hashCode(moduleVersion);
|
||||||
result = 31*result + Objects.hashCode(fileName);
|
result = 31*result + Objects.hashCode(fileName);
|
||||||
@ -305,5 +395,157 @@ public final class StackTraceElement implements java.io.Serializable {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the compacted String representation to be returned by
|
||||||
|
* toString method from the declaring Class object.
|
||||||
|
*/
|
||||||
|
synchronized String buildLoaderModuleClassName() {
|
||||||
|
if (classOrLoaderModuleClassName == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (classOrLoaderModuleClassName instanceof Class) {
|
||||||
|
Class<?> cls = (Class<?>)classOrLoaderModuleClassName;
|
||||||
|
classOrLoaderModuleClassName = toLoaderModuleClassName(cls);
|
||||||
|
}
|
||||||
|
return (String)classOrLoaderModuleClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns <loader>/<module>/<fully-qualified-classname> string
|
||||||
|
* representation of the given class.
|
||||||
|
* <p>
|
||||||
|
* If the module is a non-upgradeable JDK module then omit
|
||||||
|
* its version string.
|
||||||
|
* <p>
|
||||||
|
* If the loader has no name, or if the loader is one of the built-in
|
||||||
|
* loaders (`boot`, `platform`, or `app`) then drop the first element
|
||||||
|
* (`<loader>/`).
|
||||||
|
* <p>
|
||||||
|
* If the first element has been dropped and the module is unnamed
|
||||||
|
* then drop the second element (`<module>/`).
|
||||||
|
* <p>
|
||||||
|
* If the first element is not dropped and the module is unnamed
|
||||||
|
* then drop `<module>`.
|
||||||
|
*/
|
||||||
|
private static String toLoaderModuleClassName(Class<?> cls) {
|
||||||
|
ClassLoader loader = cls.getClassLoader0();
|
||||||
|
Module m = cls.getModule();
|
||||||
|
|
||||||
|
// First element - class loader name
|
||||||
|
// Call package-private ClassLoader::name method
|
||||||
|
String s = "";
|
||||||
|
if (loader != null && loader.name() != null &&
|
||||||
|
!(loader instanceof BuiltinClassLoader)) {
|
||||||
|
s = loader.name() + "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Second element - module name and version
|
||||||
|
if (m != null && m.isNamed()) {
|
||||||
|
s += m.getName();
|
||||||
|
// Include version if it is a user module or upgradeable module
|
||||||
|
//
|
||||||
|
// If it is JDK non-upgradeable module which is recorded
|
||||||
|
// in the hashes in java.base, omit the version.
|
||||||
|
if (!isHashedInJavaBase(m)) {
|
||||||
|
Optional<Version> ov = m.getDescriptor().version();
|
||||||
|
if (ov.isPresent()) {
|
||||||
|
String version = "@" + ov.get().toString();
|
||||||
|
s += version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fully-qualified class name
|
||||||
|
return s.isEmpty() ? cls.getName() : s + "/" + cls.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the module is hashed with java.base.
|
||||||
|
* <p>
|
||||||
|
* This method returns false when running on the exploded image
|
||||||
|
* since JDK modules are not hashed. They have no Version attribute
|
||||||
|
* and so "@<version>" part will be omitted anyway.
|
||||||
|
*/
|
||||||
|
private static boolean isHashedInJavaBase(Module m) {
|
||||||
|
// return true if module system is not initialized as the code
|
||||||
|
// must be in java.base
|
||||||
|
if (!VM.isModuleSystemInited())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return Layer.boot() == m.getLayer() && HashedModules.contains(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Finds JDK non-upgradeable modules, i.e. the modules that are
|
||||||
|
* included in the hashes in java.base.
|
||||||
|
*/
|
||||||
|
private static class HashedModules {
|
||||||
|
static Set<String> HASHED_MODULES = hashedModules();
|
||||||
|
|
||||||
|
static Set<String> hashedModules() {
|
||||||
|
Module javaBase = Layer.boot().findModule("java.base").get();
|
||||||
|
Optional<ModuleHashes> ohashes =
|
||||||
|
SharedSecrets.getJavaLangModuleAccess()
|
||||||
|
.hashes(javaBase.getDescriptor());
|
||||||
|
|
||||||
|
if (ohashes.isPresent()) {
|
||||||
|
Set<String> names = new HashSet<>(ohashes.get().names());
|
||||||
|
names.add("java.base");
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Set.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean contains(Module m) {
|
||||||
|
return HASHED_MODULES.contains(m.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns an array of StackTraceElements of the given depth
|
||||||
|
* filled from the backtrace of a given Throwable.
|
||||||
|
*/
|
||||||
|
static StackTraceElement[] of(Throwable x, int depth) {
|
||||||
|
StackTraceElement[] stackTrace = new StackTraceElement[depth];
|
||||||
|
for (int i = 0; i < depth; i++) {
|
||||||
|
stackTrace[i] = new StackTraceElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
// VM to fill in StackTraceElement
|
||||||
|
initStackTraceElements(stackTrace, x);
|
||||||
|
|
||||||
|
// ensure the proper StackTraceElement initialization
|
||||||
|
for (StackTraceElement ste : stackTrace) {
|
||||||
|
ste.buildLoaderModuleClassName();
|
||||||
|
}
|
||||||
|
return stackTrace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a StackTraceElement from a given StackFrameInfo.
|
||||||
|
*/
|
||||||
|
static StackTraceElement of(StackFrameInfo sfi) {
|
||||||
|
StackTraceElement ste = new StackTraceElement();
|
||||||
|
initStackTraceElement(ste, sfi);
|
||||||
|
|
||||||
|
ste.buildLoaderModuleClassName();
|
||||||
|
return ste;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sets the given stack trace elements with the backtrace
|
||||||
|
* of the given Throwable.
|
||||||
|
*/
|
||||||
|
private static native void initStackTraceElements(StackTraceElement[] elements,
|
||||||
|
Throwable x);
|
||||||
|
/*
|
||||||
|
* Sets the given stack trace element with the given StackFrameInfo
|
||||||
|
*/
|
||||||
|
private static native void initStackTraceElement(StackTraceElement element,
|
||||||
|
StackFrameInfo sfi);
|
||||||
|
|
||||||
private static final long serialVersionUID = 6992337162326171013L;
|
private static final long serialVersionUID = 6992337162326171013L;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
package java.lang;
|
package java.lang;
|
||||||
import jdk.internal.misc.VM;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -826,11 +825,7 @@ public class Throwable implements Serializable {
|
|||||||
// backtrace if this is the first call to this method
|
// backtrace if this is the first call to this method
|
||||||
if (stackTrace == UNASSIGNED_STACK ||
|
if (stackTrace == UNASSIGNED_STACK ||
|
||||||
(stackTrace == null && backtrace != null) /* Out of protocol state */) {
|
(stackTrace == null && backtrace != null) /* Out of protocol state */) {
|
||||||
stackTrace = new StackTraceElement[depth];
|
stackTrace = StackTraceElement.of(this, depth);
|
||||||
for (int i = 0; i < depth; i++) {
|
|
||||||
stackTrace[i] = new StackTraceElement();
|
|
||||||
}
|
|
||||||
getStackTraceElements(stackTrace);
|
|
||||||
} else if (stackTrace == null) {
|
} else if (stackTrace == null) {
|
||||||
return UNASSIGNED_STACK;
|
return UNASSIGNED_STACK;
|
||||||
}
|
}
|
||||||
@ -881,13 +876,6 @@ public class Throwable implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the stack trace elements.
|
|
||||||
* @param elements
|
|
||||||
* @throws IndexOutOfBoundsException if {@code elements.length != depth }
|
|
||||||
*/
|
|
||||||
private native void getStackTraceElements(StackTraceElement[] elements);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a {@code Throwable} from a stream, enforcing
|
* Reads a {@code Throwable} from a stream, enforcing
|
||||||
* well-formedness constraints on fields. Null entries and
|
* well-formedness constraints on fields. Null entries and
|
||||||
|
@ -5347,7 +5347,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||||||
* {@code (V T A...)} must have at least one {@code A} type, and the default iterator
|
* {@code (V T A...)} must have at least one {@code A} type, and the default iterator
|
||||||
* handle parameter is adjusted to accept the leading {@code A} type, as if by
|
* handle parameter is adjusted to accept the leading {@code A} type, as if by
|
||||||
* the {@link MethodHandle#asType asType} conversion method.
|
* the {@link MethodHandle#asType asType} conversion method.
|
||||||
* The leading {@code A} type must be {@code Iterable} or a subtype thereof, or an array type.
|
* The leading {@code A} type must be {@code Iterable} or a subtype thereof.
|
||||||
* This conversion step, done at loop construction time, must not throw a {@code WrongMethodTypeException}.
|
* This conversion step, done at loop construction time, must not throw a {@code WrongMethodTypeException}.
|
||||||
* </ul>
|
* </ul>
|
||||||
* <p>
|
* <p>
|
||||||
@ -5374,7 +5374,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||||||
* V iteratedLoop(A... a...) {
|
* V iteratedLoop(A... a...) {
|
||||||
* Iterator<T> it = iterator(a...);
|
* Iterator<T> it = iterator(a...);
|
||||||
* V v = init(a...);
|
* V v = init(a...);
|
||||||
* for (T t : it) {
|
* while (it.hasNext()) {
|
||||||
|
* T t = it.next();
|
||||||
* v = body(v, t, a...);
|
* v = body(v, t, a...);
|
||||||
* }
|
* }
|
||||||
* return v;
|
* return v;
|
||||||
@ -5483,49 +5484,59 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
|
|||||||
Objects.requireNonNull(body);
|
Objects.requireNonNull(body);
|
||||||
MethodType bodyType = body.type();
|
MethodType bodyType = body.type();
|
||||||
Class<?> returnType = bodyType.returnType();
|
Class<?> returnType = bodyType.returnType();
|
||||||
List<Class<?>> innerList = bodyType.parameterList();
|
List<Class<?>> internalParamList = bodyType.parameterList();
|
||||||
// strip leading V value if present
|
// strip leading V value if present
|
||||||
int vsize = (returnType == void.class ? 0 : 1);
|
int vsize = (returnType == void.class ? 0 : 1);
|
||||||
if (vsize != 0 && (innerList.size() == 0 || innerList.get(0) != returnType)) {
|
if (vsize != 0 && (internalParamList.size() == 0 || internalParamList.get(0) != returnType)) {
|
||||||
// argument list has no "V" => error
|
// argument list has no "V" => error
|
||||||
MethodType expected = bodyType.insertParameterTypes(0, returnType);
|
MethodType expected = bodyType.insertParameterTypes(0, returnType);
|
||||||
throw misMatchedTypes("body function", bodyType, expected);
|
throw misMatchedTypes("body function", bodyType, expected);
|
||||||
} else if (innerList.size() <= vsize) {
|
} else if (internalParamList.size() <= vsize) {
|
||||||
// missing T type => error
|
// missing T type => error
|
||||||
MethodType expected = bodyType.insertParameterTypes(vsize, Object.class);
|
MethodType expected = bodyType.insertParameterTypes(vsize, Object.class);
|
||||||
throw misMatchedTypes("body function", bodyType, expected);
|
throw misMatchedTypes("body function", bodyType, expected);
|
||||||
}
|
}
|
||||||
//Class<?> elementType = innerList.get(vsize); // do not need this
|
List<Class<?>> externalParamList = internalParamList.subList(vsize + 1, internalParamList.size());
|
||||||
List<Class<?>> outerList = innerList.subList(vsize + 1, innerList.size());
|
Class<?> iterableType = null;
|
||||||
if (outerList.isEmpty()) {
|
|
||||||
// special case; take lists from iterator handle
|
|
||||||
outerList = ((iterator != null)
|
|
||||||
? iterator.type().parameterList()
|
|
||||||
: Arrays.asList(Iterable.class));
|
|
||||||
innerList = bodyType.insertParameterTypes(vsize + 1, outerList).parameterList();
|
|
||||||
}
|
|
||||||
if (iterator != null) {
|
if (iterator != null) {
|
||||||
|
// special case; if the body handle only declares V and T then
|
||||||
|
// the external parameter list is obtained from iterator handle
|
||||||
|
if (externalParamList.isEmpty()) {
|
||||||
|
externalParamList = iterator.type().parameterList();
|
||||||
|
}
|
||||||
MethodType itype = iterator.type();
|
MethodType itype = iterator.type();
|
||||||
if (!Iterator.class.isAssignableFrom(itype.returnType())) {
|
if (!Iterator.class.isAssignableFrom(itype.returnType())) {
|
||||||
throw newIllegalArgumentException("iteratedLoop first argument must have Iterator return type");
|
throw newIllegalArgumentException("iteratedLoop first argument must have Iterator return type");
|
||||||
}
|
}
|
||||||
if (!itype.effectivelyIdenticalParameters(0, outerList)) {
|
if (!itype.effectivelyIdenticalParameters(0, externalParamList)) {
|
||||||
MethodType expected = methodType(itype.returnType(), outerList);
|
MethodType expected = methodType(itype.returnType(), externalParamList);
|
||||||
throw misMatchedTypes("iterator parameters", itype, expected);
|
throw misMatchedTypes("iterator parameters", itype, expected);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (externalParamList.isEmpty()) {
|
||||||
|
// special case; if the iterator handle is null and the body handle
|
||||||
|
// only declares V and T then the external parameter list consists
|
||||||
|
// of Iterable
|
||||||
|
externalParamList = Arrays.asList(Iterable.class);
|
||||||
|
iterableType = Iterable.class;
|
||||||
|
} else {
|
||||||
|
// special case; if the iterator handle is null and the external
|
||||||
|
// parameter list is not empty then the first parameter must be
|
||||||
|
// assignable to Iterable
|
||||||
|
iterableType = externalParamList.get(0);
|
||||||
|
if (!Iterable.class.isAssignableFrom(iterableType)) {
|
||||||
|
throw newIllegalArgumentException(
|
||||||
|
"inferred first loop argument must inherit from Iterable: " + iterableType);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (init != null) {
|
if (init != null) {
|
||||||
MethodType initType = init.type();
|
MethodType initType = init.type();
|
||||||
if (initType.returnType() != returnType ||
|
if (initType.returnType() != returnType ||
|
||||||
!initType.effectivelyIdenticalParameters(0, outerList)) {
|
!initType.effectivelyIdenticalParameters(0, externalParamList)) {
|
||||||
throw misMatchedTypes("loop initializer", initType, methodType(returnType, outerList));
|
throw misMatchedTypes("loop initializer", initType, methodType(returnType, externalParamList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Class<?> iterableType = outerList.isEmpty() ? null : outerList.get(0);
|
|
||||||
if (iterableType != null && !Iterable.class.isAssignableFrom(iterableType) && !iterableType.isArray()) {
|
|
||||||
throw newIllegalArgumentException(
|
|
||||||
"inferred first loop argument must be an array or inherit from Iterable: " + iterableType);
|
|
||||||
}
|
|
||||||
return iterableType; // help the caller a bit
|
return iterableType; // help the caller a bit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ import java.io.PrintStream;
|
|||||||
import java.io.UncheckedIOException;
|
import java.io.UncheckedIOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -1997,6 +1998,13 @@ public class ModuleDescriptor
|
|||||||
public Optional<ModuleHashes> hashes(ModuleDescriptor descriptor) {
|
public Optional<ModuleHashes> hashes(ModuleDescriptor descriptor) {
|
||||||
return descriptor.hashes();
|
return descriptor.hashes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModuleFinder newModulePath(Runtime.Version version,
|
||||||
|
boolean isLinkPhase,
|
||||||
|
Path... entries) {
|
||||||
|
return new ModulePath(version, isLinkPhase, entries);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ public interface ModuleFinder {
|
|||||||
*
|
*
|
||||||
* <li><p> If the name matches the regular expression {@code
|
* <li><p> If the name matches the regular expression {@code
|
||||||
* "-(\\d+(\\.|$))"} then the module name will be derived from the
|
* "-(\\d+(\\.|$))"} then the module name will be derived from the
|
||||||
* subsequence proceeding the hyphen of the first occurrence. The
|
* subsequence preceding the hyphen of the first occurrence. The
|
||||||
* subsequence after the hyphen is parsed as a {@link
|
* subsequence after the hyphen is parsed as a {@link
|
||||||
* ModuleDescriptor.Version} and ignored if it cannot be parsed as
|
* ModuleDescriptor.Version} and ignored if it cannot be parsed as
|
||||||
* a {@code Version}. </p></li>
|
* a {@code Version}. </p></li>
|
||||||
@ -248,18 +248,23 @@ public interface ModuleFinder {
|
|||||||
* <li><p> It {@link ModuleDescriptor#requires() requires} {@code
|
* <li><p> It {@link ModuleDescriptor#requires() requires} {@code
|
||||||
* java.base}. </p></li>
|
* java.base}. </p></li>
|
||||||
*
|
*
|
||||||
* <li><p> All entries in the JAR file with names ending with {@code
|
* <li><p> The set of packages in the module is derived from the names
|
||||||
* .class} are assumed to be class files where the name corresponds
|
* of non-directory entries in the JAR file. A candidate package name
|
||||||
* to the fully qualified name of the class. The packages of all
|
* is derived from an entry using the characters up to, but not
|
||||||
* classes are {@link ModuleDescriptor#exports() exported}. </p></li>
|
* including, the last forward slash. All remaining forward slashes are
|
||||||
|
* replaced with dot ({@code "."}). If the resulting string is a valid
|
||||||
|
* Java identifier then it is assumed to be a package name. For example,
|
||||||
|
* if the JAR file contains an entry "{@code p/q/Foo.class}" then the
|
||||||
|
* package name derived is "{@code p.q}". All packages are {@link
|
||||||
|
* ModuleDescriptor#exports() exported}. </p></li>
|
||||||
*
|
*
|
||||||
* <li><p> The contents of all entries starting with {@code
|
* <li><p> The contents of entries starting with {@code
|
||||||
* META-INF/services/} are assumed to be service configuration files
|
* META-INF/services/} are assumed to be service configuration files
|
||||||
* (see {@link java.util.ServiceLoader}). The name of the file
|
* (see {@link java.util.ServiceLoader}). If the name of a file
|
||||||
* (that follows {@code META-INF/services/}) is assumed to be the
|
* (that follows {@code META-INF/services/}) is a legal Java identifier
|
||||||
* fully-qualified binary name of a service type. The entries in the
|
* then it is assumed to be the fully-qualified binary name of a
|
||||||
* file are assumed to be the fully-qualified binary names of
|
* service type. The entries in the file are assumed to be the
|
||||||
* provider classes. </p></li>
|
* fully-qualified binary names of provider classes. </p></li>
|
||||||
*
|
*
|
||||||
* <li><p> If the JAR file has a {@code Main-Class} attribute in its
|
* <li><p> If the JAR file has a {@code Main-Class} attribute in its
|
||||||
* main manifest then its value is the {@link
|
* main manifest then its value is the {@link
|
||||||
@ -271,8 +276,8 @@ public interface ModuleFinder {
|
|||||||
* {@link ModuleDescriptor.Builder ModuleDescriptor.Builder} API) for an
|
* {@link ModuleDescriptor.Builder ModuleDescriptor.Builder} API) for an
|
||||||
* automatic module then {@code FindException} is thrown. This can arise,
|
* automatic module then {@code FindException} is thrown. This can arise,
|
||||||
* for example, when a legal Java identifier name cannot be derived from
|
* for example, when a legal Java identifier name cannot be derived from
|
||||||
* the file name of the JAR file or where a package name derived from an
|
* the file name of the JAR file or where the JAR file contains a {@code
|
||||||
* entry ending with {@code .class} is not a legal Java identifier. </p>
|
* .class} in the top-level directory of the JAR file. </p>
|
||||||
*
|
*
|
||||||
* <p> In addition to JAR files, an implementation may also support modules
|
* <p> In addition to JAR files, an implementation may also support modules
|
||||||
* that are packaged in other implementation specific module formats. When
|
* that are packaged in other implementation specific module formats. When
|
||||||
@ -283,8 +288,10 @@ public interface ModuleFinder {
|
|||||||
*
|
*
|
||||||
* <p> As with automatic modules, the contents of a packaged or exploded
|
* <p> As with automatic modules, the contents of a packaged or exploded
|
||||||
* module may need to be <em>scanned</em> in order to determine the packages
|
* module may need to be <em>scanned</em> in order to determine the packages
|
||||||
* in the module. If a {@code .class} file that corresponds to a class in an
|
* in the module. If a {@code .class} file (other than {@code
|
||||||
* unnamed package is encountered then {@code FindException} is thrown. </p>
|
* module-info.class}) is found in the top-level directory then it is
|
||||||
|
* assumed to be a class in the unnamed package and so {@code FindException}
|
||||||
|
* is thrown. </p>
|
||||||
*
|
*
|
||||||
* <p> Finders created by this method are lazy and do not eagerly check
|
* <p> Finders created by this method are lazy and do not eagerly check
|
||||||
* that the given file paths are directories or packaged modules.
|
* that the given file paths are directories or packaged modules.
|
||||||
@ -341,7 +348,7 @@ public interface ModuleFinder {
|
|||||||
* @return A {@code ModuleFinder} that composes a sequence of module finders
|
* @return A {@code ModuleFinder} that composes a sequence of module finders
|
||||||
*/
|
*/
|
||||||
static ModuleFinder compose(ModuleFinder... finders) {
|
static ModuleFinder compose(ModuleFinder... finders) {
|
||||||
// copy the list, also checking for nulls
|
// copy the list and check for nulls
|
||||||
final List<ModuleFinder> finderList = List.of(finders);
|
final List<ModuleFinder> finderList = List.of(finders);
|
||||||
|
|
||||||
return new ModuleFinder() {
|
return new ModuleFinder() {
|
||||||
|
@ -33,10 +33,12 @@ import java.io.InputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.UncheckedIOException;
|
import java.io.UncheckedIOException;
|
||||||
import java.lang.module.ModuleDescriptor.Requires;
|
import java.lang.module.ModuleDescriptor.Requires;
|
||||||
|
import java.net.URI;
|
||||||
import java.nio.file.DirectoryStream;
|
import java.nio.file.DirectoryStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.NoSuchFileException;
|
import java.nio.file.NoSuchFileException;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -52,49 +54,53 @@ import java.util.jar.Manifest;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
import jdk.internal.jmod.JmodFile;
|
import jdk.internal.jmod.JmodFile;
|
||||||
import jdk.internal.jmod.JmodFile.Section;
|
import jdk.internal.jmod.JmodFile.Section;
|
||||||
import jdk.internal.module.ConfigurableModuleFinder;
|
import jdk.internal.module.Checks;
|
||||||
import jdk.internal.perf.PerfCounter;
|
import jdk.internal.perf.PerfCounter;
|
||||||
|
import jdk.internal.util.jar.VersionedStream;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@code ModuleFinder} that locates modules on the file system by searching
|
* A {@code ModuleFinder} that locates modules on the file system by searching
|
||||||
* a sequence of directories or packaged modules.
|
* a sequence of directories or packaged modules.
|
||||||
*
|
*
|
||||||
* The {@code ModuleFinder} can be configured to work in either the run-time
|
* The {@code ModuleFinder} can be created to work in either the run-time
|
||||||
* or link-time phases. In both cases it locates modular JAR and exploded
|
* or link-time phases. In both cases it locates modular JAR and exploded
|
||||||
* modules. When configured for link-time then it additionally locates
|
* modules. When created for link-time then it additionally locates
|
||||||
* modules in JMOD files.
|
* modules in JMOD files.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ModulePath implements ConfigurableModuleFinder {
|
class ModulePath implements ModuleFinder {
|
||||||
private static final String MODULE_INFO = "module-info.class";
|
private static final String MODULE_INFO = "module-info.class";
|
||||||
|
|
||||||
|
// the version to use for multi-release modular JARs
|
||||||
|
private final Runtime.Version releaseVersion;
|
||||||
|
|
||||||
|
// true for the link phase (supports modules packaged in JMOD format)
|
||||||
|
private final boolean isLinkPhase;
|
||||||
|
|
||||||
// the entries on this module path
|
// the entries on this module path
|
||||||
private final Path[] entries;
|
private final Path[] entries;
|
||||||
private int next;
|
private int next;
|
||||||
|
|
||||||
// true if in the link phase
|
|
||||||
private boolean isLinkPhase;
|
|
||||||
|
|
||||||
// map of module name to module reference map for modules already located
|
// map of module name to module reference map for modules already located
|
||||||
private final Map<String, ModuleReference> cachedModules = new HashMap<>();
|
private final Map<String, ModuleReference> cachedModules = new HashMap<>();
|
||||||
|
|
||||||
ModulePath(Path... entries) {
|
ModulePath(Runtime.Version version, boolean isLinkPhase, Path... entries) {
|
||||||
|
this.releaseVersion = version;
|
||||||
|
this.isLinkPhase = isLinkPhase;
|
||||||
this.entries = entries.clone();
|
this.entries = entries.clone();
|
||||||
for (Path entry : this.entries) {
|
for (Path entry : this.entries) {
|
||||||
Objects.requireNonNull(entry);
|
Objects.requireNonNull(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
ModulePath(Path... entries) {
|
||||||
public void configurePhase(Phase phase) {
|
this(JarFile.runtimeVersion(), false, entries);
|
||||||
isLinkPhase = (phase == Phase.LINK_TIME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -239,9 +245,13 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
if (mref != null) {
|
if (mref != null) {
|
||||||
// can have at most one version of a module in the directory
|
// can have at most one version of a module in the directory
|
||||||
String name = mref.descriptor().name();
|
String name = mref.descriptor().name();
|
||||||
if (nameToReference.put(name, mref) != null) {
|
ModuleReference previous = nameToReference.put(name, mref);
|
||||||
|
if (previous != null) {
|
||||||
|
String fn1 = fileName(mref);
|
||||||
|
String fn2 = fileName(previous);
|
||||||
throw new FindException("Two versions of module "
|
throw new FindException("Two versions of module "
|
||||||
+ name + " found in " + dir);
|
+ name + " found in " + dir
|
||||||
|
+ " (" + fn1 + " and " + fn2 + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -294,6 +304,25 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string with the file name of the module if possible.
|
||||||
|
* If the module location is not a file URI then return the URI
|
||||||
|
* as a string.
|
||||||
|
*/
|
||||||
|
private String fileName(ModuleReference mref) {
|
||||||
|
URI uri = mref.location().orElse(null);
|
||||||
|
if (uri != null) {
|
||||||
|
if (uri.getScheme().equalsIgnoreCase("file")) {
|
||||||
|
Path file = Paths.get(uri);
|
||||||
|
return file.getFileName().toString();
|
||||||
|
} else {
|
||||||
|
return uri.toString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return "<unknown>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -- jmod files --
|
// -- jmod files --
|
||||||
|
|
||||||
private Set<String> jmodPackages(JmodFile jf) {
|
private Set<String> jmodPackages(JmodFile jf) {
|
||||||
@ -301,7 +330,7 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
.filter(e -> e.section() == Section.CLASSES)
|
.filter(e -> e.section() == Section.CLASSES)
|
||||||
.map(JmodFile.Entry::name)
|
.map(JmodFile.Entry::name)
|
||||||
.map(this::toPackageName)
|
.map(this::toPackageName)
|
||||||
.filter(pkg -> pkg.length() > 0) // module-info
|
.flatMap(Optional::stream)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,8 +357,8 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
private static final String SERVICES_PREFIX = "META-INF/services/";
|
private static final String SERVICES_PREFIX = "META-INF/services/";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a container with the service type corresponding to the name of
|
* Returns the service type corresponding to the name of a services
|
||||||
* a services configuration file.
|
* configuration file if it is a valid Java identifier.
|
||||||
*
|
*
|
||||||
* For example, if called with "META-INF/services/p.S" then this method
|
* For example, if called with "META-INF/services/p.S" then this method
|
||||||
* returns a container with the value "p.S".
|
* returns a container with the value "p.S".
|
||||||
@ -341,7 +370,8 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
String prefix = cf.substring(0, index);
|
String prefix = cf.substring(0, index);
|
||||||
if (prefix.equals(SERVICES_PREFIX)) {
|
if (prefix.equals(SERVICES_PREFIX)) {
|
||||||
String sn = cf.substring(index);
|
String sn = cf.substring(index);
|
||||||
return Optional.of(sn);
|
if (Checks.isJavaIdentifier(sn))
|
||||||
|
return Optional.of(sn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
@ -416,28 +446,28 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
if (vs != null)
|
if (vs != null)
|
||||||
builder.version(vs);
|
builder.version(vs);
|
||||||
|
|
||||||
// scan the entries in the JAR file to locate the .class and service
|
// scan the names of the entries in the JAR file
|
||||||
// configuration file
|
Map<Boolean, Set<String>> map = VersionedStream.stream(jf)
|
||||||
Map<Boolean, Set<String>> map =
|
.filter(e -> !e.isDirectory())
|
||||||
versionedStream(jf)
|
.map(JarEntry::getName)
|
||||||
.map(JarEntry::getName)
|
.collect(Collectors.partitioningBy(e -> e.startsWith(SERVICES_PREFIX),
|
||||||
.filter(s -> (s.endsWith(".class") ^ s.startsWith(SERVICES_PREFIX)))
|
Collectors.toSet()));
|
||||||
.collect(Collectors.partitioningBy(s -> s.endsWith(".class"),
|
|
||||||
Collectors.toSet()));
|
Set<String> resources = map.get(Boolean.FALSE);
|
||||||
Set<String> classFiles = map.get(Boolean.TRUE);
|
Set<String> configFiles = map.get(Boolean.TRUE);
|
||||||
Set<String> configFiles = map.get(Boolean.FALSE);
|
|
||||||
|
|
||||||
// all packages are exported
|
// all packages are exported
|
||||||
classFiles.stream()
|
resources.stream()
|
||||||
.map(c -> toPackageName(c))
|
.map(this::toPackageName)
|
||||||
.distinct()
|
.flatMap(Optional::stream)
|
||||||
.forEach(builder::exports);
|
.distinct()
|
||||||
|
.forEach(builder::exports);
|
||||||
|
|
||||||
// map names of service configuration files to service names
|
// map names of service configuration files to service names
|
||||||
Set<String> serviceNames = configFiles.stream()
|
Set<String> serviceNames = configFiles.stream()
|
||||||
.map(this::toServiceName)
|
.map(this::toServiceName)
|
||||||
.flatMap(Optional::stream)
|
.flatMap(Optional::stream)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
// parse each service configuration file
|
// parse each service configuration file
|
||||||
for (String sn : serviceNames) {
|
for (String sn : serviceNames) {
|
||||||
@ -502,25 +532,13 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
return mn;
|
return mn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Stream<JarEntry> versionedStream(JarFile jf) {
|
|
||||||
if (jf.isMultiRelease()) {
|
|
||||||
// a stream of JarEntries whose names are base names and whose
|
|
||||||
// contents are from the corresponding versioned entries in
|
|
||||||
// a multi-release jar file
|
|
||||||
return jf.stream().map(JarEntry::getName)
|
|
||||||
.filter(name -> !name.startsWith("META-INF/versions/"))
|
|
||||||
.map(jf::getJarEntry);
|
|
||||||
} else {
|
|
||||||
return jf.stream();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Set<String> jarPackages(JarFile jf) {
|
private Set<String> jarPackages(JarFile jf) {
|
||||||
return versionedStream(jf)
|
return VersionedStream.stream(jf)
|
||||||
.filter(e -> e.getName().endsWith(".class"))
|
.filter(e -> !e.isDirectory())
|
||||||
.map(e -> toPackageName(e.getName()))
|
.map(JarEntry::getName)
|
||||||
.filter(pkg -> pkg.length() > 0) // module-info
|
.map(this::toPackageName)
|
||||||
.collect(Collectors.toSet());
|
.flatMap(Optional::stream)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -535,7 +553,7 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
try (JarFile jf = new JarFile(file.toFile(),
|
try (JarFile jf = new JarFile(file.toFile(),
|
||||||
true, // verify
|
true, // verify
|
||||||
ZipFile.OPEN_READ,
|
ZipFile.OPEN_READ,
|
||||||
JarFile.runtimeVersion()))
|
releaseVersion))
|
||||||
{
|
{
|
||||||
ModuleDescriptor md;
|
ModuleDescriptor md;
|
||||||
JarEntry entry = jf.getJarEntry(MODULE_INFO);
|
JarEntry entry = jf.getJarEntry(MODULE_INFO);
|
||||||
@ -565,11 +583,11 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
private Set<String> explodedPackages(Path dir) {
|
private Set<String> explodedPackages(Path dir) {
|
||||||
try {
|
try {
|
||||||
return Files.find(dir, Integer.MAX_VALUE,
|
return Files.find(dir, Integer.MAX_VALUE,
|
||||||
((path, attrs) -> attrs.isRegularFile() &&
|
((path, attrs) -> attrs.isRegularFile()))
|
||||||
path.toString().endsWith(".class")))
|
.map(path -> dir.relativize(path))
|
||||||
.map(path -> toPackageName(dir.relativize(path)))
|
.map(this::toPackageName)
|
||||||
.filter(pkg -> pkg.length() > 0) // module-info
|
.flatMap(Optional::stream)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
} catch (IOException x) {
|
} catch (IOException x) {
|
||||||
throw new UncheckedIOException(x);
|
throw new UncheckedIOException(x);
|
||||||
}
|
}
|
||||||
@ -595,29 +613,62 @@ class ModulePath implements ConfigurableModuleFinder {
|
|||||||
return ModuleReferences.newExplodedModule(md, dir);
|
return ModuleReferences.newExplodedModule(md, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps the name of an entry in a JAR or ZIP file to a package name.
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the name is a class file in
|
||||||
|
* the top-level directory of the JAR/ZIP file (and it's
|
||||||
|
* not module-info.class)
|
||||||
|
*/
|
||||||
|
private Optional<String> toPackageName(String name) {
|
||||||
|
assert !name.endsWith("/");
|
||||||
|
|
||||||
//
|
int index = name.lastIndexOf("/");
|
||||||
|
if (index == -1) {
|
||||||
|
if (name.endsWith(".class") && !name.equals(MODULE_INFO)) {
|
||||||
|
throw new IllegalArgumentException(name
|
||||||
|
+ " found in top-level directory:"
|
||||||
|
+ " (unnamed package not allowed in module)");
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
// p/q/T.class => p.q
|
String pn = name.substring(0, index).replace('/', '.');
|
||||||
private String toPackageName(String cn) {
|
if (Checks.isJavaIdentifier(pn)) {
|
||||||
assert cn.endsWith(".class");
|
return Optional.of(pn);
|
||||||
int start = 0;
|
|
||||||
int index = cn.lastIndexOf("/");
|
|
||||||
if (index > start) {
|
|
||||||
return cn.substring(start, index).replace('/', '.');
|
|
||||||
} else {
|
} else {
|
||||||
return "";
|
// not a valid package name
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toPackageName(Path path) {
|
/**
|
||||||
String name = path.toString();
|
* Maps the relative path of an entry in an exploded module to a package
|
||||||
assert name.endsWith(".class");
|
* name.
|
||||||
int index = name.lastIndexOf(File.separatorChar);
|
*
|
||||||
if (index != -1) {
|
* @throws IllegalArgumentException if the name is a class file in
|
||||||
return name.substring(0, index).replace(File.separatorChar, '.');
|
* the top-level directory (and it's not module-info.class)
|
||||||
|
*/
|
||||||
|
private Optional<String> toPackageName(Path file) {
|
||||||
|
assert file.getRoot() == null;
|
||||||
|
|
||||||
|
Path parent = file.getParent();
|
||||||
|
if (parent == null) {
|
||||||
|
String name = file.toString();
|
||||||
|
if (name.endsWith(".class") && !name.equals(MODULE_INFO)) {
|
||||||
|
throw new IllegalArgumentException(name
|
||||||
|
+ " found in in top-level directory"
|
||||||
|
+ " (unnamed package not allowed in module)");
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
String pn = parent.toString().replace(File.separatorChar, '.');
|
||||||
|
if (Checks.isJavaIdentifier(pn)) {
|
||||||
|
return Optional.of(pn);
|
||||||
} else {
|
} else {
|
||||||
return "";
|
// not a valid package name
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ import java.net.URI;
|
|||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,6 +45,11 @@ import java.util.Optional;
|
|||||||
* module. A module reader is also intended to be used by {@code ClassLoader}
|
* module. A module reader is also intended to be used by {@code ClassLoader}
|
||||||
* implementations that load classes and resources from modules. </p>
|
* implementations that load classes and resources from modules. </p>
|
||||||
*
|
*
|
||||||
|
* <p> A resource in a module is identified by a name that is a
|
||||||
|
* '{@code /}'-separated path string. For example, module {@code java.base} may
|
||||||
|
* have a resource "{@code java/lang/Object.class}" that, by convention, is the
|
||||||
|
* class file for {@code java.lang.Object}. </p>
|
||||||
|
*
|
||||||
* <p> A {@code ModuleReader} is {@linkplain ModuleReference#open open} upon
|
* <p> A {@code ModuleReader} is {@linkplain ModuleReference#open open} upon
|
||||||
* creation and is closed by invoking the {@link #close close} method. Failure
|
* creation and is closed by invoking the {@link #close close} method. Failure
|
||||||
* to close a module reader may result in a resource leak. The {@code
|
* to close a module reader may result in a resource leak. The {@code
|
||||||
@ -52,8 +58,8 @@ import java.util.Optional;
|
|||||||
*
|
*
|
||||||
* <p> A {@code ModuleReader} implementation may require permissions to access
|
* <p> A {@code ModuleReader} implementation may require permissions to access
|
||||||
* resources in the module. Consequently the {@link #find find}, {@link #open
|
* resources in the module. Consequently the {@link #find find}, {@link #open
|
||||||
* open} and {@link #read read} methods may throw {@code SecurityException} if
|
* open}, {@link #read read}, and {@link #list list} methods may throw {@code
|
||||||
* access is denied by the security manager. </p>
|
* SecurityException} if access is denied by the security manager. </p>
|
||||||
*
|
*
|
||||||
* @see ModuleReference
|
* @see ModuleReference
|
||||||
* @since 9
|
* @since 9
|
||||||
@ -84,6 +90,9 @@ public interface ModuleReader extends Closeable {
|
|||||||
* Opens a resource, returning an input stream to read the resource in
|
* Opens a resource, returning an input stream to read the resource in
|
||||||
* the module.
|
* the module.
|
||||||
*
|
*
|
||||||
|
* <p> The behavior of the input stream when used after the module reader
|
||||||
|
* is closed is implementation specific and therefore not specified. </p>
|
||||||
|
*
|
||||||
* @implSpec The default implementation invokes the {@link #find(String)
|
* @implSpec The default implementation invokes the {@link #find(String)
|
||||||
* find} method to get a URI to the resource. If found, then it attempts
|
* find} method to get a URI to the resource. If found, then it attempts
|
||||||
* to construct a {@link java.net.URL URL} and open a connection to the
|
* to construct a {@link java.net.URL URL} and open a connection to the
|
||||||
@ -171,18 +180,38 @@ public interface ModuleReader extends Closeable {
|
|||||||
Objects.requireNonNull(bb);
|
Objects.requireNonNull(bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists the contents of the module, returning a stream of elements that
|
||||||
|
* are the names of all resources in the module.
|
||||||
|
*
|
||||||
|
* <p> In lazy implementations then an {@code IOException} may be thrown
|
||||||
|
* when using the stream to list the module contents. If this occurs then
|
||||||
|
* the {@code IOException} will be wrapped in an {@link
|
||||||
|
* java.io.UncheckedIOException} and thrown from the method that caused the
|
||||||
|
* access to be attempted. {@code SecurityException} may also be thrown
|
||||||
|
* when using the stream to list the module contents and access is denied
|
||||||
|
* by the security manager. </p>
|
||||||
|
*
|
||||||
|
* <p> The behavior of the stream when used after the module reader is
|
||||||
|
* closed is implementation specific and therefore not specified. </p>
|
||||||
|
*
|
||||||
|
* @return A stream of elements that are the names of all resources
|
||||||
|
* in the module
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
* If an I/O error occurs or the module reader is closed
|
||||||
|
* @throws SecurityException
|
||||||
|
* If denied by the security manager
|
||||||
|
*/
|
||||||
|
Stream<String> list() throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the module reader. Once closed then subsequent calls to locate or
|
* Closes the module reader. Once closed then subsequent calls to locate or
|
||||||
* read a resource will fail by returning {@code Optional.empty()} or
|
* read a resource will fail by throwing {@code IOException}.
|
||||||
* throwing {@code IOException}.
|
|
||||||
*
|
*
|
||||||
* <p> A module reader is not required to be asynchronously closeable. If a
|
* <p> A module reader is not required to be asynchronously closeable. If a
|
||||||
* thread is reading a resource and another thread invokes the close method,
|
* thread is reading a resource and another thread invokes the close method,
|
||||||
* then the second thread may block until the read operation is complete.
|
* then the second thread may block until the read operation is complete. </p>
|
||||||
*
|
|
||||||
* <p> The behavior of {@code InputStream}s obtained using the {@link
|
|
||||||
* #open(String) open} method and used after the module reader is closed
|
|
||||||
* is implementation specific and therefore not specified.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
void close() throws IOException;
|
void close() throws IOException;
|
||||||
|
@ -35,6 +35,7 @@ import java.nio.ByteBuffer;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
@ -43,14 +44,17 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
import jdk.internal.jmod.JmodFile;
|
||||||
import jdk.internal.misc.JavaLangAccess;
|
import jdk.internal.misc.JavaLangAccess;
|
||||||
import jdk.internal.misc.SharedSecrets;
|
import jdk.internal.misc.SharedSecrets;
|
||||||
import jdk.internal.module.ModuleHashes;
|
import jdk.internal.module.ModuleHashes;
|
||||||
import jdk.internal.module.ModuleHashes.HashSupplier;
|
import jdk.internal.module.ModuleHashes.HashSupplier;
|
||||||
import jdk.internal.module.ModulePatcher;
|
import jdk.internal.module.ModulePatcher;
|
||||||
|
import jdk.internal.util.jar.VersionedStream;
|
||||||
import sun.net.www.ParseUtil;
|
import sun.net.www.ParseUtil;
|
||||||
|
|
||||||
|
|
||||||
@ -139,6 +143,13 @@ class ModuleReferences {
|
|||||||
*/
|
*/
|
||||||
abstract Optional<InputStream> implOpen(String name) throws IOException;
|
abstract Optional<InputStream> implOpen(String name) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a stream of the names of resources in the module. This
|
||||||
|
* method is invoked by the list method to do the actual work of
|
||||||
|
* creating the stream.
|
||||||
|
*/
|
||||||
|
abstract Stream<String> implList() throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the module reader. This method is invoked by close to do the
|
* Closes the module reader. This method is invoked by close to do the
|
||||||
* actual work of closing the module reader.
|
* actual work of closing the module reader.
|
||||||
@ -175,7 +186,21 @@ class ModuleReferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public final Stream<String> list() throws IOException {
|
||||||
|
readLock.lock();
|
||||||
|
try {
|
||||||
|
if (!closed) {
|
||||||
|
return implList();
|
||||||
|
} else {
|
||||||
|
throw new IOException("ModuleReader is closed");
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
readLock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final void close() throws IOException {
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
@ -240,6 +265,16 @@ class ModuleReferences {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
Stream<String> implList() throws IOException {
|
||||||
|
// take snapshot to avoid async close
|
||||||
|
List<String> names = VersionedStream.stream(jf)
|
||||||
|
.filter(e -> !e.isDirectory())
|
||||||
|
.map(JarEntry::getName)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return names.stream();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void implClose() throws IOException {
|
void implClose() throws IOException {
|
||||||
jf.close();
|
jf.close();
|
||||||
@ -251,30 +286,31 @@ class ModuleReferences {
|
|||||||
* A ModuleReader for a JMOD file.
|
* A ModuleReader for a JMOD file.
|
||||||
*/
|
*/
|
||||||
static class JModModuleReader extends SafeCloseModuleReader {
|
static class JModModuleReader extends SafeCloseModuleReader {
|
||||||
private final ZipFile zf;
|
private final JmodFile jf;
|
||||||
private final URI uri;
|
private final URI uri;
|
||||||
|
|
||||||
static ZipFile newZipFile(Path path) {
|
static JmodFile newJmodFile(Path path) {
|
||||||
try {
|
try {
|
||||||
return new ZipFile(path.toFile());
|
return new JmodFile(path);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
throw new UncheckedIOException(ioe);
|
throw new UncheckedIOException(ioe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JModModuleReader(Path path, URI uri) {
|
JModModuleReader(Path path, URI uri) {
|
||||||
this.zf = newZipFile(path);
|
this.jf = newJmodFile(path);
|
||||||
this.uri = uri;
|
this.uri = uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ZipEntry getEntry(String name) {
|
private JmodFile.Entry getEntry(String name) {
|
||||||
return zf.getEntry("classes/" + Objects.requireNonNull(name));
|
Objects.requireNonNull(name);
|
||||||
|
return jf.getEntry(JmodFile.Section.CLASSES, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Optional<URI> implFind(String name) {
|
Optional<URI> implFind(String name) {
|
||||||
ZipEntry ze = getEntry(name);
|
JmodFile.Entry je = getEntry(name);
|
||||||
if (ze != null) {
|
if (je != null) {
|
||||||
String encodedPath = ParseUtil.encodePath(name, false);
|
String encodedPath = ParseUtil.encodePath(name, false);
|
||||||
String uris = "jmod:" + uri + "!/" + encodedPath;
|
String uris = "jmod:" + uri + "!/" + encodedPath;
|
||||||
return Optional.of(URI.create(uris));
|
return Optional.of(URI.create(uris));
|
||||||
@ -285,17 +321,27 @@ class ModuleReferences {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
Optional<InputStream> implOpen(String name) throws IOException {
|
Optional<InputStream> implOpen(String name) throws IOException {
|
||||||
ZipEntry ze = getEntry(name);
|
JmodFile.Entry je = getEntry(name);
|
||||||
if (ze != null) {
|
if (je != null) {
|
||||||
return Optional.of(zf.getInputStream(ze));
|
return Optional.of(jf.getInputStream(je));
|
||||||
} else {
|
} else {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
Stream<String> implList() throws IOException {
|
||||||
|
// take snapshot to avoid async close
|
||||||
|
List<String> names = jf.stream()
|
||||||
|
.filter(e -> e.section() == JmodFile.Section.CLASSES)
|
||||||
|
.map(JmodFile.Entry::name)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return names.stream();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void implClose() throws IOException {
|
void implClose() throws IOException {
|
||||||
zf.close();
|
jf.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,6 +423,17 @@ class ModuleReferences {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<String> list() throws IOException {
|
||||||
|
ensureOpen();
|
||||||
|
// sym links not followed
|
||||||
|
return Files.find(dir, Integer.MAX_VALUE,
|
||||||
|
(path, attrs) -> attrs.isRegularFile())
|
||||||
|
.map(f -> dir.relativize(f)
|
||||||
|
.toString()
|
||||||
|
.replace(File.separatorChar, '/'));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
closed = true;
|
closed = true;
|
||||||
|
@ -32,14 +32,21 @@ import java.io.UncheckedIOException;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.ArrayDeque;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Deque;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.Spliterator;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
import jdk.internal.jimage.ImageLocation;
|
import jdk.internal.jimage.ImageLocation;
|
||||||
import jdk.internal.jimage.ImageReader;
|
import jdk.internal.jimage.ImageReader;
|
||||||
@ -62,6 +69,8 @@ import jdk.internal.perf.PerfCounter;
|
|||||||
|
|
||||||
class SystemModuleFinder implements ModuleFinder {
|
class SystemModuleFinder implements ModuleFinder {
|
||||||
|
|
||||||
|
private static final JavaNetUriAccess JNUA = SharedSecrets.getJavaNetUriAccess();
|
||||||
|
|
||||||
private static final PerfCounter initTime
|
private static final PerfCounter initTime
|
||||||
= PerfCounter.newPerfCounter("jdk.module.finder.jimage.initTime");
|
= PerfCounter.newPerfCounter("jdk.module.finder.jimage.initTime");
|
||||||
private static final PerfCounter moduleCount
|
private static final PerfCounter moduleCount
|
||||||
@ -73,8 +82,6 @@ class SystemModuleFinder implements ModuleFinder {
|
|||||||
// ImageReader used to access all modules in the image
|
// ImageReader used to access all modules in the image
|
||||||
private static final ImageReader imageReader;
|
private static final ImageReader imageReader;
|
||||||
|
|
||||||
private static final JavaNetUriAccess jnua = SharedSecrets.getJavaNetUriAccess();
|
|
||||||
|
|
||||||
// the set of modules in the run-time image
|
// the set of modules in the run-time image
|
||||||
private static final Set<ModuleReference> modules;
|
private static final Set<ModuleReference> modules;
|
||||||
|
|
||||||
@ -170,8 +177,7 @@ class SystemModuleFinder implements ModuleFinder {
|
|||||||
HashSupplier hash)
|
HashSupplier hash)
|
||||||
{
|
{
|
||||||
String mn = md.name();
|
String mn = md.name();
|
||||||
|
URI uri = JNUA.create("jrt", "/".concat(mn));
|
||||||
URI uri = jnua.create("jrt", "/".concat(mn));
|
|
||||||
|
|
||||||
Supplier<ModuleReader> readerSupplier = new Supplier<>() {
|
Supplier<ModuleReader> readerSupplier = new Supplier<>() {
|
||||||
@Override
|
@Override
|
||||||
@ -331,6 +337,15 @@ class SystemModuleFinder implements ModuleFinder {
|
|||||||
ImageReader.releaseByteBuffer(bb);
|
ImageReader.releaseByteBuffer(bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<String> list() throws IOException {
|
||||||
|
if (closed)
|
||||||
|
throw new IOException("ModuleReader is closed");
|
||||||
|
|
||||||
|
Spliterator<String> s = new ModuleContentSpliterator(module);
|
||||||
|
return StreamSupport.stream(s, false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
// nothing else to do
|
// nothing else to do
|
||||||
@ -338,4 +353,86 @@ class SystemModuleFinder implements ModuleFinder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Spliterator for traversing the resources of a module linked into the
|
||||||
|
* run-time image.
|
||||||
|
*/
|
||||||
|
static class ModuleContentSpliterator implements Spliterator<String> {
|
||||||
|
final String moduleRoot;
|
||||||
|
final Deque<ImageReader.Node> stack;
|
||||||
|
Iterator<ImageReader.Node> iterator;
|
||||||
|
|
||||||
|
ModuleContentSpliterator(String module) throws IOException {
|
||||||
|
moduleRoot = "/modules/" + module;
|
||||||
|
stack = new ArrayDeque<>();
|
||||||
|
|
||||||
|
// push the root node to the stack to get started
|
||||||
|
ImageReader.Node dir = imageReader.findNode(moduleRoot);
|
||||||
|
if (dir == null || !dir.isDirectory())
|
||||||
|
throw new IOException(moduleRoot + " not a directory");
|
||||||
|
stack.push(dir);
|
||||||
|
iterator = Collections.emptyIterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the next non-directory node or {@code null} if
|
||||||
|
* there are no remaining nodes to visit.
|
||||||
|
*/
|
||||||
|
private String next() throws IOException {
|
||||||
|
for (;;) {
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
ImageReader.Node node = iterator.next();
|
||||||
|
String name = node.getName();
|
||||||
|
if (node.isDirectory()) {
|
||||||
|
// build node
|
||||||
|
ImageReader.Node dir = imageReader.findNode(name);
|
||||||
|
assert dir.isDirectory();
|
||||||
|
stack.push(dir);
|
||||||
|
} else {
|
||||||
|
// strip /modules/$MODULE/ prefix
|
||||||
|
return name.substring(moduleRoot.length() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
ImageReader.Node dir = stack.poll();
|
||||||
|
assert dir.isDirectory();
|
||||||
|
iterator = dir.getChildren().iterator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean tryAdvance(Consumer<? super String> action) {
|
||||||
|
String next;
|
||||||
|
try {
|
||||||
|
next = next();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new UncheckedIOException(ioe);
|
||||||
|
}
|
||||||
|
if (next != null) {
|
||||||
|
action.accept(next);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Spliterator<String> trySplit() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int characteristics() {
|
||||||
|
return Spliterator.DISTINCT + Spliterator.NONNULL + Spliterator.IMMUTABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long estimateSize() {
|
||||||
|
return Long.MAX_VALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,13 +201,13 @@ class InetAddress implements java.io.Serializable {
|
|||||||
* Specify the address family: Internet Protocol, Version 4
|
* Specify the address family: Internet Protocol, Version 4
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
static final int IPv4 = 1;
|
@Native static final int IPv4 = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the address family: Internet Protocol, Version 6
|
* Specify the address family: Internet Protocol, Version 6
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
static final int IPv6 = 2;
|
@Native static final int IPv6 = 2;
|
||||||
|
|
||||||
/* Specify address family preference */
|
/* Specify address family preference */
|
||||||
static transient final int preferIPv6Address;
|
static transient final int preferIPv6Address;
|
||||||
|
@ -110,19 +110,19 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkCreateClassLoader();
|
security.checkCreateClassLoader();
|
||||||
}
|
}
|
||||||
ucp = new URLClassPath(urls);
|
this.ucp = new URLClassPath(urls);
|
||||||
this.acc = AccessController.getContext();
|
this.acc = AccessController.getContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
URLClassLoader(URL[] urls, ClassLoader parent,
|
URLClassLoader(String name, URL[] urls, ClassLoader parent,
|
||||||
AccessControlContext acc) {
|
AccessControlContext acc) {
|
||||||
super(parent);
|
super(name, parent);
|
||||||
// this is to make the stack depth consistent with 1.1
|
// this is to make the stack depth consistent with 1.1
|
||||||
SecurityManager security = System.getSecurityManager();
|
SecurityManager security = System.getSecurityManager();
|
||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkCreateClassLoader();
|
security.checkCreateClassLoader();
|
||||||
}
|
}
|
||||||
ucp = new URLClassPath(urls);
|
this.ucp = new URLClassPath(urls);
|
||||||
this.acc = acc;
|
this.acc = acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkCreateClassLoader();
|
security.checkCreateClassLoader();
|
||||||
}
|
}
|
||||||
ucp = new URLClassPath(urls);
|
this.ucp = new URLClassPath(urls);
|
||||||
this.acc = AccessController.getContext();
|
this.acc = AccessController.getContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkCreateClassLoader();
|
security.checkCreateClassLoader();
|
||||||
}
|
}
|
||||||
ucp = new URLClassPath(urls);
|
this.ucp = new URLClassPath(urls);
|
||||||
this.acc = acc;
|
this.acc = acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,8 +198,76 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
if (security != null) {
|
if (security != null) {
|
||||||
security.checkCreateClassLoader();
|
security.checkCreateClassLoader();
|
||||||
}
|
}
|
||||||
ucp = new URLClassPath(urls, factory);
|
this.ucp = new URLClassPath(urls, factory);
|
||||||
acc = AccessController.getContext();
|
this.acc = AccessController.getContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new named {@code URLClassLoader} for the specified URLs.
|
||||||
|
* The URLs will be searched in the order specified for classes
|
||||||
|
* and resources after first searching in the specified parent class loader.
|
||||||
|
* Any URL that ends with a '/' is assumed to refer to a directory.
|
||||||
|
* Otherwise, the URL is assumed to refer to a JAR file which will be
|
||||||
|
* downloaded and opened as needed.
|
||||||
|
*
|
||||||
|
* @param name class loader name; or {@code null} if not named
|
||||||
|
* @param urls the URLs from which to load classes and resources
|
||||||
|
* @param parent the parent class loader for delegation
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the given name is empty.
|
||||||
|
* @throws NullPointerException if {@code urls} is {@code null}.
|
||||||
|
*
|
||||||
|
* @throws SecurityException if a security manager exists and its
|
||||||
|
* {@link SecurityManager#checkCreateClassLoader()} method doesn't
|
||||||
|
* allow creation of a class loader.
|
||||||
|
*
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
public URLClassLoader(String name,
|
||||||
|
URL[] urls,
|
||||||
|
ClassLoader parent) {
|
||||||
|
super(name, parent);
|
||||||
|
// this is to make the stack depth consistent with 1.1
|
||||||
|
SecurityManager security = System.getSecurityManager();
|
||||||
|
if (security != null) {
|
||||||
|
security.checkCreateClassLoader();
|
||||||
|
}
|
||||||
|
this.ucp = new URLClassPath(urls);
|
||||||
|
this.acc = AccessController.getContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new named {@code URLClassLoader} for the specified URLs,
|
||||||
|
* parent class loader, and URLStreamHandlerFactory.
|
||||||
|
* The parent argument will be used as the parent class loader for delegation.
|
||||||
|
* The factory argument will be used as the stream handler factory to
|
||||||
|
* obtain protocol handlers when creating new jar URLs.
|
||||||
|
*
|
||||||
|
* @param name class loader name; or {@code null} if not named
|
||||||
|
* @param urls the URLs from which to load classes and resources
|
||||||
|
* @param parent the parent class loader for delegation
|
||||||
|
* @param factory the URLStreamHandlerFactory to use when creating URLs
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the given name is empty.
|
||||||
|
* @throws NullPointerException if {@code urls} is {@code null}.
|
||||||
|
*
|
||||||
|
* @throws SecurityException if a security manager exists and its
|
||||||
|
* {@code checkCreateClassLoader} method doesn't allow
|
||||||
|
* creation of a class loader.
|
||||||
|
*
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
public URLClassLoader(String name, URL[] urls, ClassLoader parent,
|
||||||
|
URLStreamHandlerFactory factory) {
|
||||||
|
super(name, parent);
|
||||||
|
// this is to make the stack depth consistent with 1.1
|
||||||
|
SecurityManager security = System.getSecurityManager();
|
||||||
|
if (security != null) {
|
||||||
|
security.checkCreateClassLoader();
|
||||||
|
}
|
||||||
|
this.ucp = new URLClassPath(urls, factory);
|
||||||
|
this.acc = AccessController.getContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A map (used as a set) to keep track of closeable local resources
|
/* A map (used as a set) to keep track of closeable local resources
|
||||||
@ -735,7 +803,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
URLClassLoader ucl = AccessController.doPrivileged(
|
URLClassLoader ucl = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<>() {
|
new PrivilegedAction<>() {
|
||||||
public URLClassLoader run() {
|
public URLClassLoader run() {
|
||||||
return new FactoryURLClassLoader(urls, parent, acc);
|
return new FactoryURLClassLoader(null, urls, parent, acc);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return ucl;
|
return ucl;
|
||||||
@ -785,9 +853,9 @@ final class FactoryURLClassLoader extends URLClassLoader {
|
|||||||
ClassLoader.registerAsParallelCapable();
|
ClassLoader.registerAsParallelCapable();
|
||||||
}
|
}
|
||||||
|
|
||||||
FactoryURLClassLoader(URL[] urls, ClassLoader parent,
|
FactoryURLClassLoader(String name, URL[] urls, ClassLoader parent,
|
||||||
AccessControlContext acc) {
|
AccessControlContext acc) {
|
||||||
super(urls, parent, acc);
|
super(name, urls, parent, acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
FactoryURLClassLoader(URL[] urls, AccessControlContext acc) {
|
FactoryURLClassLoader(URL[] urls, AccessControlContext acc) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -55,8 +55,8 @@ class TempFileHelper {
|
|||||||
private static final SecureRandom random = new SecureRandom();
|
private static final SecureRandom random = new SecureRandom();
|
||||||
private static Path generatePath(String prefix, String suffix, Path dir) {
|
private static Path generatePath(String prefix, String suffix, Path dir) {
|
||||||
long n = random.nextLong();
|
long n = random.nextLong();
|
||||||
n = (n == Long.MIN_VALUE) ? 0 : Math.abs(n);
|
String s = prefix + Long.toUnsignedString(n) + suffix;
|
||||||
Path name = dir.getFileSystem().getPath(prefix + Long.toString(n) + suffix);
|
Path name = dir.getFileSystem().getPath(s);
|
||||||
// the generated name should be a simple file name
|
// the generated name should be a simple file name
|
||||||
if (name.getParent() != null)
|
if (name.getParent() != null)
|
||||||
throw new IllegalArgumentException("Invalid prefix or suffix");
|
throw new IllegalArgumentException("Invalid prefix or suffix");
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package java.security;
|
package java.security;
|
||||||
|
|
||||||
import java.security.spec.AlgorithmParameterSpec;
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@code AlgorithmParameterGenerator} class is used to generate a
|
* The {@code AlgorithmParameterGenerator} class is used to generate a
|
||||||
@ -153,16 +154,19 @@ public class AlgorithmParameterGenerator {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new AlgorithmParameterGenerator object.
|
* @return the new {@code AlgorithmParameterGenerator} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports an
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports an
|
||||||
* AlgorithmParameterGeneratorSpi implementation for the
|
* {@code AlgorithmParameterGeneratorSpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static AlgorithmParameterGenerator getInstance(String algorithm)
|
public static AlgorithmParameterGenerator getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
try {
|
try {
|
||||||
Object[] objs = Security.getImpl(algorithm,
|
Object[] objs = Security.getImpl(algorithm,
|
||||||
"AlgorithmParameterGenerator",
|
"AlgorithmParameterGenerator",
|
||||||
@ -197,17 +201,20 @@ public class AlgorithmParameterGenerator {
|
|||||||
*
|
*
|
||||||
* @param provider the string name of the Provider.
|
* @param provider the string name of the Provider.
|
||||||
*
|
*
|
||||||
* @return the new AlgorithmParameterGenerator object.
|
* @return the new {@code AlgorithmParameterGenerator} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
* implementation for the specified algorithm is not
|
* or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchAlgorithmException if an
|
||||||
* registered in the security provider list.
|
* {@code AlgorithmParameterGeneratorSpi}
|
||||||
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider name is null
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
@ -215,6 +222,7 @@ public class AlgorithmParameterGenerator {
|
|||||||
String provider)
|
String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||||
{
|
{
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (provider == null || provider.length() == 0)
|
if (provider == null || provider.length() == 0)
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
Object[] objs = Security.getImpl(algorithm,
|
Object[] objs = Security.getImpl(algorithm,
|
||||||
@ -241,15 +249,19 @@ public class AlgorithmParameterGenerator {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @param provider the Provider object.
|
* @param provider the {@code Provider} object.
|
||||||
*
|
*
|
||||||
* @return the new AlgorithmParameterGenerator object.
|
* @return the new {@code AlgorithmParameterGenerator} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi
|
* @throws IllegalArgumentException if the specified provider is
|
||||||
* implementation for the specified algorithm is not available
|
* {@code null}
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified provider is null.
|
* @throws NoSuchAlgorithmException if an
|
||||||
|
* {@code AlgorithmParameterGeneratorSpi}
|
||||||
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -259,6 +271,7 @@ public class AlgorithmParameterGenerator {
|
|||||||
Provider provider)
|
Provider provider)
|
||||||
throws NoSuchAlgorithmException
|
throws NoSuchAlgorithmException
|
||||||
{
|
{
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
Object[] objs = Security.getImpl(algorithm,
|
Object[] objs = Security.getImpl(algorithm,
|
||||||
|
@ -28,6 +28,7 @@ package java.security;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.security.spec.AlgorithmParameterSpec;
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
import java.security.spec.InvalidParameterSpecException;
|
import java.security.spec.InvalidParameterSpecException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used as an opaque representation of cryptographic parameters.
|
* This class is used as an opaque representation of cryptographic parameters.
|
||||||
@ -140,16 +141,19 @@ public class AlgorithmParameters {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new parameter object.
|
* @return the new parameter object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports an
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports an
|
||||||
* AlgorithmParametersSpi implementation for the
|
* {@code AlgorithmParametersSpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static AlgorithmParameters getInstance(String algorithm)
|
public static AlgorithmParameters getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
try {
|
try {
|
||||||
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
|
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
|
||||||
(String)null);
|
(String)null);
|
||||||
@ -184,17 +188,19 @@ public class AlgorithmParameters {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new parameter object.
|
* @return the new parameter object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if an AlgorithmParametersSpi
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
* implementation for the specified algorithm is not
|
* or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchAlgorithmException if an {@code AlgorithmParametersSpi}
|
||||||
* registered in the security provider list.
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider name is null
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
@ -202,6 +208,7 @@ public class AlgorithmParameters {
|
|||||||
String provider)
|
String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||||
{
|
{
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (provider == null || provider.length() == 0)
|
if (provider == null || provider.length() == 0)
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
|
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
|
||||||
@ -231,13 +238,16 @@ public class AlgorithmParameters {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new parameter object.
|
* @return the new parameter object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if an AlgorithmParameterGeneratorSpi
|
* @throws IllegalArgumentException if the provider is {@code null}
|
||||||
* implementation for the specified algorithm is not available
|
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider is null.
|
* @throws NoSuchAlgorithmException if an
|
||||||
|
* {@code AlgorithmParameterGeneratorSpi}
|
||||||
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -247,6 +257,7 @@ public class AlgorithmParameters {
|
|||||||
Provider provider)
|
Provider provider)
|
||||||
throws NoSuchAlgorithmException
|
throws NoSuchAlgorithmException
|
||||||
{
|
{
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
|
Object[] objs = Security.getImpl(algorithm, "AlgorithmParameters",
|
||||||
|
@ -167,16 +167,19 @@ public class KeyFactory {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new KeyFactory object.
|
* @return the new {@code KeyFactory} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* KeyFactorySpi implementation for the
|
* {@code KeyFactorySpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static KeyFactory getInstance(String algorithm)
|
public static KeyFactory getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
return new KeyFactory(algorithm);
|
return new KeyFactory(algorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,22 +203,25 @@ public class KeyFactory {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new KeyFactory object.
|
* @return the new {@code KeyFactory} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a KeyFactorySpi
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
* implementation for the specified algorithm is not
|
* or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchAlgorithmException if a {@code KeyFactorySpi}
|
||||||
* registered in the security provider list.
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider name is null
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static KeyFactory getInstance(String algorithm, String provider)
|
public static KeyFactory getInstance(String algorithm, String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException {
|
throws NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("KeyFactory",
|
Instance instance = GetInstance.getInstance("KeyFactory",
|
||||||
KeyFactorySpi.class, algorithm, provider);
|
KeyFactorySpi.class, algorithm, provider);
|
||||||
return new KeyFactory((KeyFactorySpi)instance.impl,
|
return new KeyFactory((KeyFactorySpi)instance.impl,
|
||||||
@ -239,13 +245,16 @@ public class KeyFactory {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new KeyFactory object.
|
* @return the new {@code KeyFactory} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a KeyFactorySpi
|
* @throws IllegalArgumentException if the specified provider is
|
||||||
* implementation for the specified algorithm is not available
|
* {@code null}
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified provider is null.
|
* @throws NoSuchAlgorithmException if a {@code KeyFactorySpi}
|
||||||
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -253,6 +262,7 @@ public class KeyFactory {
|
|||||||
*/
|
*/
|
||||||
public static KeyFactory getInstance(String algorithm, Provider provider)
|
public static KeyFactory getInstance(String algorithm, Provider provider)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("KeyFactory",
|
Instance instance = GetInstance.getInstance("KeyFactory",
|
||||||
KeyFactorySpi.class, algorithm, provider);
|
KeyFactorySpi.class, algorithm, provider);
|
||||||
return new KeyFactory((KeyFactorySpi)instance.impl,
|
return new KeyFactory((KeyFactorySpi)instance.impl,
|
||||||
|
@ -209,16 +209,19 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new KeyPairGenerator object.
|
* @return the new {@code KeyPairGenerator} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* KeyPairGeneratorSpi implementation for the
|
* {@code KeyPairGeneratorSpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static KeyPairGenerator getInstance(String algorithm)
|
public static KeyPairGenerator getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
List<Service> list =
|
List<Service> list =
|
||||||
GetInstance.getServices("KeyPairGenerator", algorithm);
|
GetInstance.getServices("KeyPairGenerator", algorithm);
|
||||||
Iterator<Service> t = list.iterator();
|
Iterator<Service> t = list.iterator();
|
||||||
@ -267,23 +270,26 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||||||
*
|
*
|
||||||
* @param provider the string name of the provider.
|
* @param provider the string name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new KeyPairGenerator object.
|
* @return the new {@code KeyPairGenerator} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a KeyPairGeneratorSpi
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
* implementation for the specified algorithm is not
|
* or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchAlgorithmException if a {@code KeyPairGeneratorSpi}
|
||||||
* registered in the security provider list.
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider name is null
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static KeyPairGenerator getInstance(String algorithm,
|
public static KeyPairGenerator getInstance(String algorithm,
|
||||||
String provider)
|
String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException {
|
throws NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("KeyPairGenerator",
|
Instance instance = GetInstance.getInstance("KeyPairGenerator",
|
||||||
KeyPairGeneratorSpi.class, algorithm, provider);
|
KeyPairGeneratorSpi.class, algorithm, provider);
|
||||||
return getInstance(instance, algorithm);
|
return getInstance(instance, algorithm);
|
||||||
@ -306,13 +312,16 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new KeyPairGenerator object.
|
* @return the new {@code KeyPairGenerator} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a KeyPairGeneratorSpi
|
* @throws IllegalArgumentException if the specified provider is
|
||||||
* implementation for the specified algorithm is not available
|
* {@code null}
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified provider is null.
|
* @throws NoSuchAlgorithmException if a {@code KeyPairGeneratorSpi}
|
||||||
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -320,6 +329,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
|
|||||||
*/
|
*/
|
||||||
public static KeyPairGenerator getInstance(String algorithm,
|
public static KeyPairGenerator getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("KeyPairGenerator",
|
Instance instance = GetInstance.getInstance("KeyPairGenerator",
|
||||||
KeyPairGeneratorSpi.class, algorithm, provider);
|
KeyPairGeneratorSpi.class, algorithm, provider);
|
||||||
return getInstance(instance, algorithm);
|
return getInstance(instance, algorithm);
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
package java.security;
|
package java.security;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URI;
|
|
||||||
import java.security.cert.Certificate;
|
import java.security.cert.Certificate;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
@ -855,17 +854,20 @@ public class KeyStore {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard keystore types.
|
* for information about standard keystore types.
|
||||||
*
|
*
|
||||||
* @return a keystore object of the specified type.
|
* @return a keystore object of the specified type
|
||||||
*
|
*
|
||||||
* @exception KeyStoreException if no Provider supports a
|
* @throws KeyStoreException if no {@code Provider} supports a
|
||||||
* KeyStoreSpi implementation for the
|
* {@code KeyStoreSpi} implementation for the
|
||||||
* specified type.
|
* specified type
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static KeyStore getInstance(String type)
|
public static KeyStore getInstance(String type)
|
||||||
throws KeyStoreException
|
throws KeyStoreException
|
||||||
{
|
{
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
try {
|
try {
|
||||||
Object[] objs = Security.getImpl(type, "KeyStore", (String)null);
|
Object[] objs = Security.getImpl(type, "KeyStore", (String)null);
|
||||||
return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type);
|
return new KeyStore((KeyStoreSpi)objs[0], (Provider)objs[1], type);
|
||||||
@ -895,23 +897,26 @@ public class KeyStore {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return a keystore object of the specified type.
|
* @return a keystore object of the specified type
|
||||||
*
|
*
|
||||||
* @exception KeyStoreException if a KeyStoreSpi
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
* implementation for the specified type is not
|
* or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws KeyStoreException if a {@code KeyStoreSpi}
|
||||||
* registered in the security provider list.
|
* implementation for the specified type is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider name is null
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static KeyStore getInstance(String type, String provider)
|
public static KeyStore getInstance(String type, String provider)
|
||||||
throws KeyStoreException, NoSuchProviderException
|
throws KeyStoreException, NoSuchProviderException
|
||||||
{
|
{
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
if (provider == null || provider.length() == 0)
|
if (provider == null || provider.length() == 0)
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
try {
|
try {
|
||||||
@ -938,13 +943,16 @@ public class KeyStore {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return a keystore object of the specified type.
|
* @return a keystore object of the specified type
|
||||||
*
|
*
|
||||||
* @exception KeyStoreException if KeyStoreSpi
|
* @throws IllegalArgumentException if the specified provider is
|
||||||
* implementation for the specified type is not available
|
* {@code null}
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified provider is null.
|
* @throws KeyStoreException if {@code KeyStoreSpi}
|
||||||
|
* implementation for the specified type is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -953,6 +961,7 @@ public class KeyStore {
|
|||||||
public static KeyStore getInstance(String type, Provider provider)
|
public static KeyStore getInstance(String type, Provider provider)
|
||||||
throws KeyStoreException
|
throws KeyStoreException
|
||||||
{
|
{
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
try {
|
try {
|
||||||
|
@ -26,13 +26,8 @@
|
|||||||
package java.security;
|
package java.security;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.lang.*;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.security.InvalidKeyException;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import sun.security.util.Debug;
|
import sun.security.util.Debug;
|
||||||
@ -163,16 +158,20 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return a Message Digest object that implements the specified algorithm.
|
* @return a {@code MessageDigest} object that implements the
|
||||||
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* MessageDigestSpi implementation for the
|
* {@code MessageDigestSpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static MessageDigest getInstance(String algorithm)
|
public static MessageDigest getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
try {
|
try {
|
||||||
MessageDigest md;
|
MessageDigest md;
|
||||||
Object[] objs = Security.getImpl(algorithm, "MessageDigest",
|
Object[] objs = Security.getImpl(algorithm, "MessageDigest",
|
||||||
@ -216,23 +215,27 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return a MessageDigest object that implements the specified algorithm.
|
* @return a {@code MessageDigest} object that implements the
|
||||||
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a MessageDigestSpi
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
* implementation for the specified algorithm is not
|
* or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchAlgorithmException if a {@code MessageDigestSpi}
|
||||||
* registered in the security provider list.
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider name is null
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static MessageDigest getInstance(String algorithm, String provider)
|
public static MessageDigest getInstance(String algorithm, String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||||
{
|
{
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (provider == null || provider.length() == 0)
|
if (provider == null || provider.length() == 0)
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
Object[] objs = Security.getImpl(algorithm, "MessageDigest", provider);
|
Object[] objs = Security.getImpl(algorithm, "MessageDigest", provider);
|
||||||
@ -265,13 +268,17 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return a MessageDigest object that implements the specified algorithm.
|
* @return a {@code MessageDigest} object that implements the
|
||||||
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a MessageDigestSpi
|
* @throws IllegalArgumentException if the specified provider is
|
||||||
* implementation for the specified algorithm is not available
|
* {@code null}
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified provider is null.
|
* @throws NoSuchAlgorithmException if a {@code MessageDigestSpi}
|
||||||
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -281,6 +288,7 @@ public abstract class MessageDigest extends MessageDigestSpi {
|
|||||||
Provider provider)
|
Provider provider)
|
||||||
throws NoSuchAlgorithmException
|
throws NoSuchAlgorithmException
|
||||||
{
|
{
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (provider == null)
|
if (provider == null)
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
Object[] objs = Security.getImpl(algorithm, "MessageDigest", provider);
|
Object[] objs = Security.getImpl(algorithm, "MessageDigest", provider);
|
||||||
|
@ -29,6 +29,7 @@ package java.security;
|
|||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.Objects;
|
||||||
import sun.security.jca.GetInstance;
|
import sun.security.jca.GetInstance;
|
||||||
import sun.security.util.Debug;
|
import sun.security.util.Debug;
|
||||||
import sun.security.util.SecurityConstants;
|
import sun.security.util.SecurityConstants;
|
||||||
@ -372,26 +373,26 @@ public abstract class Policy {
|
|||||||
*
|
*
|
||||||
* @param params parameters for the Policy, which may be null.
|
* @param params parameters for the Policy, which may be null.
|
||||||
*
|
*
|
||||||
* @return the new Policy object.
|
* @return the new {@code Policy} object
|
||||||
*
|
*
|
||||||
* @exception SecurityException if the caller does not have permission
|
* @throws IllegalArgumentException if the specified parameters
|
||||||
* to get a Policy instance for the specified type.
|
* are not understood by the {@code PolicySpi} implementation
|
||||||
|
* from the selected {@code Provider}
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified type is null.
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports
|
||||||
|
* a {@code PolicySpi} implementation for the specified type
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified parameters
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
* are not understood by the PolicySpi implementation
|
|
||||||
* from the selected Provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a PolicySpi
|
* @throws SecurityException if the caller does not have permission
|
||||||
* implementation for the specified type.
|
* to get a {@code Policy} instance for the specified type.
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public static Policy getInstance(String type, Policy.Parameters params)
|
public static Policy getInstance(String type, Policy.Parameters params)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
checkPermission(type);
|
checkPermission(type);
|
||||||
try {
|
try {
|
||||||
GetInstance.Instance instance = GetInstance.getInstance("Policy",
|
GetInstance.Instance instance = GetInstance.getInstance("Policy",
|
||||||
@ -428,23 +429,24 @@ public abstract class Policy {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new Policy object.
|
* @return the new {@code Policy} object
|
||||||
*
|
*
|
||||||
* @exception SecurityException if the caller does not have permission
|
* @throws IllegalArgumentException if the specified provider
|
||||||
* to get a Policy instance for the specified type.
|
* is {@code null} or empty, or if the specified parameters are
|
||||||
|
* not understood by the {@code PolicySpi} implementation from
|
||||||
|
* the specified provider
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified type is null.
|
* @throws NoSuchAlgorithmException if the specified provider does not
|
||||||
|
* support a {@code PolicySpi} implementation for the specified
|
||||||
|
* type
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified provider
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* is null or empty,
|
* registered in the security provider list
|
||||||
* or if the specified parameters are not understood by
|
|
||||||
* the PolicySpi implementation from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
* registered in the security provider list.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if the specified provider does not
|
* @throws SecurityException if the caller does not have permission
|
||||||
* support a PolicySpi implementation for the specified type.
|
* to get a {@code Policy} instance for the specified type
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
@ -454,6 +456,7 @@ public abstract class Policy {
|
|||||||
String provider)
|
String provider)
|
||||||
throws NoSuchProviderException, NoSuchAlgorithmException {
|
throws NoSuchProviderException, NoSuchAlgorithmException {
|
||||||
|
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
if (provider == null || provider.length() == 0) {
|
if (provider == null || provider.length() == 0) {
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
}
|
}
|
||||||
@ -492,19 +495,21 @@ public abstract class Policy {
|
|||||||
*
|
*
|
||||||
* @param provider the Provider.
|
* @param provider the Provider.
|
||||||
*
|
*
|
||||||
* @return the new Policy object.
|
* @return the new {@code Policy} object
|
||||||
*
|
*
|
||||||
* @exception SecurityException if the caller does not have permission
|
* @throws IllegalArgumentException if the specified {@code Provider}
|
||||||
* to get a Policy instance for the specified type.
|
* is {@code null}, or if the specified parameters are not
|
||||||
|
* understood by the {@code PolicySpi} implementation from the
|
||||||
|
* specified {@code Provider}
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified type is null.
|
* @throws NoSuchAlgorithmException if the specified {@code Provider}
|
||||||
|
* does not support a {@code PolicySpi} implementation for
|
||||||
|
* the specified type
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified Provider is null,
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
* or if the specified parameters are not understood by
|
|
||||||
* the PolicySpi implementation from the specified Provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if the specified Provider does not
|
* @throws SecurityException if the caller does not have permission
|
||||||
* support a PolicySpi implementation for the specified type.
|
* to get a {@code Policy} instance for the specified type
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
@ -514,6 +519,7 @@ public abstract class Policy {
|
|||||||
Provider provider)
|
Provider provider)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
package java.security;
|
package java.security;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -113,6 +111,30 @@ public class SecureClassLoader extends ClassLoader {
|
|||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@code SecureClassLoader} of the specified name and
|
||||||
|
* using the specified parent class loader for delegation.
|
||||||
|
*
|
||||||
|
* @param name class loader name; or {@code null} if not named
|
||||||
|
* @param parent the parent class loader
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the given name is empty.
|
||||||
|
*
|
||||||
|
* @throws SecurityException if a security manager exists and its
|
||||||
|
* {@link SecurityManager#checkCreateClassLoader()} method
|
||||||
|
* doesn't allow creation of a class loader.
|
||||||
|
*
|
||||||
|
* @since 9
|
||||||
|
*/
|
||||||
|
protected SecureClassLoader(String name, ClassLoader parent) {
|
||||||
|
super(name, parent);
|
||||||
|
SecurityManager security = System.getSecurityManager();
|
||||||
|
if (security != null) {
|
||||||
|
security.checkCreateClassLoader();
|
||||||
|
}
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an array of bytes into an instance of class Class,
|
* Converts an array of bytes into an instance of class Class,
|
||||||
* with an optional CodeSource. Before the
|
* with an optional CodeSource. Before the
|
||||||
|
@ -303,11 +303,13 @@ public class SecureRandom extends java.util.Random {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard RNG algorithm names.
|
* for information about standard RNG algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new {@code SecureRandom} object.
|
* @return the new {@code SecureRandom} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* {@code SecureRandomSpi} implementation for the
|
* {@code SecureRandomSpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -315,6 +317,7 @@ public class SecureRandom extends java.util.Random {
|
|||||||
*/
|
*/
|
||||||
public static SecureRandom getInstance(String algorithm)
|
public static SecureRandom getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("SecureRandom",
|
Instance instance = GetInstance.getInstance("SecureRandom",
|
||||||
SecureRandomSpi.class, algorithm);
|
SecureRandomSpi.class, algorithm);
|
||||||
return new SecureRandom((SecureRandomSpi)instance.impl,
|
return new SecureRandom((SecureRandomSpi)instance.impl,
|
||||||
@ -341,17 +344,19 @@ public class SecureRandom extends java.util.Random {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code SecureRandom} object.
|
* @return the new {@code SecureRandom} object
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
|
* or empty
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a {@code SecureRandomSpi}
|
* @throws NoSuchAlgorithmException if a {@code SecureRandomSpi}
|
||||||
* implementation for the specified algorithm is not
|
* implementation for the specified algorithm is not
|
||||||
* available from the specified provider.
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @throws NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the provider name is null
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* or empty.
|
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -359,6 +364,7 @@ public class SecureRandom extends java.util.Random {
|
|||||||
*/
|
*/
|
||||||
public static SecureRandom getInstance(String algorithm, String provider)
|
public static SecureRandom getInstance(String algorithm, String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException {
|
throws NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("SecureRandom",
|
Instance instance = GetInstance.getInstance("SecureRandom",
|
||||||
SecureRandomSpi.class, algorithm, provider);
|
SecureRandomSpi.class, algorithm, provider);
|
||||||
return new SecureRandom((SecureRandomSpi)instance.impl,
|
return new SecureRandom((SecureRandomSpi)instance.impl,
|
||||||
@ -382,13 +388,16 @@ public class SecureRandom extends java.util.Random {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code SecureRandom} object.
|
* @return the new {@code SecureRandom} object
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the specified provider is
|
||||||
|
* {@code null}
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a {@code SecureRandomSpi}
|
* @throws NoSuchAlgorithmException if a {@code SecureRandomSpi}
|
||||||
* implementation for the specified algorithm is not available
|
* implementation for the specified algorithm is not available
|
||||||
* from the specified {@code Provider} object.
|
* from the specified {@code Provider} object
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the specified provider is null.
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -396,6 +405,7 @@ public class SecureRandom extends java.util.Random {
|
|||||||
*/
|
*/
|
||||||
public static SecureRandom getInstance(String algorithm,
|
public static SecureRandom getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("SecureRandom",
|
Instance instance = GetInstance.getInstance("SecureRandom",
|
||||||
SecureRandomSpi.class, algorithm, provider);
|
SecureRandomSpi.class, algorithm, provider);
|
||||||
return new SecureRandom((SecureRandomSpi)instance.impl,
|
return new SecureRandom((SecureRandomSpi)instance.impl,
|
||||||
@ -433,13 +443,16 @@ public class SecureRandom extends java.util.Random {
|
|||||||
* @param params the {@code SecureRandomParameters}
|
* @param params the {@code SecureRandomParameters}
|
||||||
* the newly created {@code SecureRandom} object must support.
|
* the newly created {@code SecureRandom} object must support.
|
||||||
*
|
*
|
||||||
* @return the new {@code SecureRandom} object.
|
* @return the new {@code SecureRandom} object
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the specified params is
|
||||||
|
* {@code null}
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no Provider supports a
|
||||||
* {@code SecureRandomSpi} implementation for the specified
|
* {@code SecureRandomSpi} implementation for the specified
|
||||||
* algorithm and parameters.
|
* algorithm and parameters
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the specified params is null.
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -448,6 +461,7 @@ public class SecureRandom extends java.util.Random {
|
|||||||
public static SecureRandom getInstance(
|
public static SecureRandom getInstance(
|
||||||
String algorithm, SecureRandomParameters params)
|
String algorithm, SecureRandomParameters params)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (params == null) {
|
if (params == null) {
|
||||||
throw new IllegalArgumentException("params cannot be null");
|
throw new IllegalArgumentException("params cannot be null");
|
||||||
}
|
}
|
||||||
@ -481,17 +495,19 @@ public class SecureRandom extends java.util.Random {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code SecureRandom} object.
|
* @return the new {@code SecureRandom} object
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
|
* or empty, or params is {@code null}
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if the specified provider does not
|
* @throws NoSuchAlgorithmException if the specified provider does not
|
||||||
* support a {@code SecureRandomSpi} implementation for the
|
* support a {@code SecureRandomSpi} implementation for the
|
||||||
* specified algorithm and parameters.
|
* specified algorithm and parameters
|
||||||
*
|
*
|
||||||
* @throws NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the provider name is null
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* or empty, or params is null.
|
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -500,6 +516,7 @@ public class SecureRandom extends java.util.Random {
|
|||||||
public static SecureRandom getInstance(String algorithm,
|
public static SecureRandom getInstance(String algorithm,
|
||||||
SecureRandomParameters params, String provider)
|
SecureRandomParameters params, String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException {
|
throws NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (params == null) {
|
if (params == null) {
|
||||||
throw new IllegalArgumentException("params cannot be null");
|
throw new IllegalArgumentException("params cannot be null");
|
||||||
}
|
}
|
||||||
@ -531,14 +548,16 @@ public class SecureRandom extends java.util.Random {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code SecureRandom} object.
|
* @return the new {@code SecureRandom} object
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if the specified provider or params
|
||||||
|
* is {@code null}
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if the specified provider does not
|
* @throws NoSuchAlgorithmException if the specified provider does not
|
||||||
* support a {@code SecureRandomSpi} implementation for the
|
* support a {@code SecureRandomSpi} implementation for the
|
||||||
* specified algorithm and parameters.
|
* specified algorithm and parameters
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the specified provider or params
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* is null.
|
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -547,6 +566,7 @@ public class SecureRandom extends java.util.Random {
|
|||||||
public static SecureRandom getInstance(String algorithm,
|
public static SecureRandom getInstance(String algorithm,
|
||||||
SecureRandomParameters params, Provider provider)
|
SecureRandomParameters params, Provider provider)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (params == null) {
|
if (params == null) {
|
||||||
throw new IllegalArgumentException("params cannot be null");
|
throw new IllegalArgumentException("params cannot be null");
|
||||||
}
|
}
|
||||||
|
@ -213,16 +213,19 @@ public abstract class Signature extends SignatureSpi {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new Signature object.
|
* @return the new {@code Signature} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* Signature implementation for the
|
* {@code Signature} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static Signature getInstance(String algorithm)
|
public static Signature getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
List<Service> list;
|
List<Service> list;
|
||||||
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
|
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
|
||||||
list = GetInstance.getServices(rsaIds);
|
list = GetInstance.getServices(rsaIds);
|
||||||
@ -335,22 +338,25 @@ public abstract class Signature extends SignatureSpi {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new Signature object.
|
* @return the new {@code Signature} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a SignatureSpi
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
* implementation for the specified algorithm is not
|
* or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchAlgorithmException if a {@code SignatureSpi}
|
||||||
* registered in the security provider list.
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider name is null
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*/
|
*/
|
||||||
public static Signature getInstance(String algorithm, String provider)
|
public static Signature getInstance(String algorithm, String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException {
|
throws NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
|
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
|
||||||
// exception compatibility with existing code
|
// exception compatibility with existing code
|
||||||
if ((provider == null) || (provider.length() == 0)) {
|
if ((provider == null) || (provider.length() == 0)) {
|
||||||
@ -385,13 +391,15 @@ public abstract class Signature extends SignatureSpi {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new Signature object.
|
* @return the new {@code Signature} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a SignatureSpi
|
* @throws IllegalArgumentException if the provider is {@code null}
|
||||||
* implementation for the specified algorithm is not available
|
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider is null.
|
* @throws NoSuchAlgorithmException if a {@code SignatureSpi}
|
||||||
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
*
|
*
|
||||||
@ -399,6 +407,7 @@ public abstract class Signature extends SignatureSpi {
|
|||||||
*/
|
*/
|
||||||
public static Signature getInstance(String algorithm, Provider provider)
|
public static Signature getInstance(String algorithm, Provider provider)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
|
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
|
||||||
// exception compatibility with existing code
|
// exception compatibility with existing code
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
|
@ -32,7 +32,7 @@ import java.security.NoSuchProviderException;
|
|||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
import java.security.Provider;
|
import java.security.Provider;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import sun.security.util.Debug;
|
import java.util.Objects;
|
||||||
|
|
||||||
import sun.security.jca.*;
|
import sun.security.jca.*;
|
||||||
import sun.security.jca.GetInstance.Instance;
|
import sun.security.jca.GetInstance.Instance;
|
||||||
@ -157,16 +157,19 @@ public class CertPathBuilder {
|
|||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return a {@code CertPathBuilder} object that implements the
|
* @return a {@code CertPathBuilder} object that implements the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* CertPathBuilderSpi implementation for the
|
* {@code CertPathBuilderSpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static CertPathBuilder getInstance(String algorithm)
|
public static CertPathBuilder getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("CertPathBuilder",
|
Instance instance = GetInstance.getInstance("CertPathBuilder",
|
||||||
CertPathBuilderSpi.class, algorithm);
|
CertPathBuilderSpi.class, algorithm);
|
||||||
return new CertPathBuilder((CertPathBuilderSpi)instance.impl,
|
return new CertPathBuilder((CertPathBuilderSpi)instance.impl,
|
||||||
@ -194,22 +197,25 @@ public class CertPathBuilder {
|
|||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return a {@code CertPathBuilder} object that implements the
|
* @return a {@code CertPathBuilder} object that implements the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a CertPathBuilderSpi
|
* @throws IllegalArgumentException if the {@code provider} is
|
||||||
* implementation for the specified algorithm is not
|
* {@code null} or empty
|
||||||
* available from the specified provider.
|
*
|
||||||
|
* @throws NoSuchAlgorithmException if a {@code CertPathBuilderSpi}
|
||||||
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @throws NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider} is
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* null or empty.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static CertPathBuilder getInstance(String algorithm, String provider)
|
public static CertPathBuilder getInstance(String algorithm, String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException {
|
throws NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("CertPathBuilder",
|
Instance instance = GetInstance.getInstance("CertPathBuilder",
|
||||||
CertPathBuilderSpi.class, algorithm, provider);
|
CertPathBuilderSpi.class, algorithm, provider);
|
||||||
return new CertPathBuilder((CertPathBuilderSpi)instance.impl,
|
return new CertPathBuilder((CertPathBuilderSpi)instance.impl,
|
||||||
@ -234,19 +240,22 @@ public class CertPathBuilder {
|
|||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return a {@code CertPathBuilder} object that implements the
|
* @return a {@code CertPathBuilder} object that implements the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a CertPathBuilderSpi
|
* @throws IllegalArgumentException if the {@code provider} is
|
||||||
* implementation for the specified algorithm is not available
|
* {@code null}
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider} is
|
* @throws NoSuchAlgorithmException if a {@code CertPathBuilderSpi}
|
||||||
* null.
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static CertPathBuilder getInstance(String algorithm,
|
public static CertPathBuilder getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("CertPathBuilder",
|
Instance instance = GetInstance.getInstance("CertPathBuilder",
|
||||||
CertPathBuilderSpi.class, algorithm, provider);
|
CertPathBuilderSpi.class, algorithm, provider);
|
||||||
return new CertPathBuilder((CertPathBuilderSpi)instance.impl,
|
return new CertPathBuilder((CertPathBuilderSpi)instance.impl,
|
||||||
|
@ -32,7 +32,7 @@ import java.security.NoSuchProviderException;
|
|||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
import java.security.Provider;
|
import java.security.Provider;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import sun.security.util.Debug;
|
import java.util.Objects;
|
||||||
|
|
||||||
import sun.security.jca.*;
|
import sun.security.jca.*;
|
||||||
import sun.security.jca.GetInstance.Instance;
|
import sun.security.jca.GetInstance.Instance;
|
||||||
@ -158,16 +158,19 @@ public class CertPathValidator {
|
|||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return a {@code CertPathValidator} object that implements the
|
* @return a {@code CertPathValidator} object that implements the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* CertPathValidatorSpi implementation for the
|
* {@code CertPathValidatorSpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static CertPathValidator getInstance(String algorithm)
|
public static CertPathValidator getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("CertPathValidator",
|
Instance instance = GetInstance.getInstance("CertPathValidator",
|
||||||
CertPathValidatorSpi.class, algorithm);
|
CertPathValidatorSpi.class, algorithm);
|
||||||
return new CertPathValidator((CertPathValidatorSpi)instance.impl,
|
return new CertPathValidator((CertPathValidatorSpi)instance.impl,
|
||||||
@ -195,23 +198,26 @@ public class CertPathValidator {
|
|||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return a {@code CertPathValidator} object that implements the
|
* @return a {@code CertPathValidator} object that implements the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a CertPathValidatorSpi
|
* @throws IllegalArgumentException if the {@code provider} is
|
||||||
* implementation for the specified algorithm is not
|
* {@code null} or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchAlgorithmException if a {@code CertPathValidatorSpi}
|
||||||
* registered in the security provider list.
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider} is
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* null or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static CertPathValidator getInstance(String algorithm,
|
public static CertPathValidator getInstance(String algorithm,
|
||||||
String provider) throws NoSuchAlgorithmException,
|
String provider) throws NoSuchAlgorithmException,
|
||||||
NoSuchProviderException {
|
NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("CertPathValidator",
|
Instance instance = GetInstance.getInstance("CertPathValidator",
|
||||||
CertPathValidatorSpi.class, algorithm, provider);
|
CertPathValidatorSpi.class, algorithm, provider);
|
||||||
return new CertPathValidator((CertPathValidatorSpi)instance.impl,
|
return new CertPathValidator((CertPathValidatorSpi)instance.impl,
|
||||||
@ -236,19 +242,22 @@ public class CertPathValidator {
|
|||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return a {@code CertPathValidator} object that implements the
|
* @return a {@code CertPathValidator} object that implements the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a CertPathValidatorSpi
|
* @throws IllegalArgumentException if the {@code provider} is
|
||||||
* implementation for the specified algorithm is not available
|
* {@code null}
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider} is
|
* @throws NoSuchAlgorithmException if a {@code CertPathValidatorSpi}
|
||||||
* null.
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified Provider object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static CertPathValidator getInstance(String algorithm,
|
public static CertPathValidator getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = GetInstance.getInstance("CertPathValidator",
|
Instance instance = GetInstance.getInstance("CertPathValidator",
|
||||||
CertPathValidatorSpi.class, algorithm, provider);
|
CertPathValidatorSpi.class, algorithm, provider);
|
||||||
return new CertPathValidator((CertPathValidatorSpi)instance.impl,
|
return new CertPathValidator((CertPathValidatorSpi)instance.impl,
|
||||||
|
@ -33,6 +33,7 @@ import java.security.PrivilegedAction;
|
|||||||
import java.security.Provider;
|
import java.security.Provider;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import sun.security.jca.*;
|
import sun.security.jca.*;
|
||||||
import sun.security.jca.GetInstance.Instance;
|
import sun.security.jca.GetInstance.Instance;
|
||||||
@ -218,20 +219,23 @@ public class CertStore {
|
|||||||
* @param params the initialization parameters (may be {@code null}).
|
* @param params the initialization parameters (may be {@code null}).
|
||||||
*
|
*
|
||||||
* @return a {@code CertStore} object that implements the specified
|
* @return a {@code CertStore} object that implements the specified
|
||||||
* {@code CertStore} type.
|
* {@code CertStore} type
|
||||||
*
|
|
||||||
* @throws NoSuchAlgorithmException if no Provider supports a
|
|
||||||
* CertStoreSpi implementation for the specified type.
|
|
||||||
*
|
*
|
||||||
* @throws InvalidAlgorithmParameterException if the specified
|
* @throws InvalidAlgorithmParameterException if the specified
|
||||||
* initialization parameters are inappropriate for this
|
* initialization parameters are inappropriate for this
|
||||||
* {@code CertStore}.
|
* {@code CertStore}
|
||||||
|
*
|
||||||
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
|
* {@code CertStoreSpi} implementation for the specified type
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static CertStore getInstance(String type, CertStoreParameters params)
|
public static CertStore getInstance(String type, CertStoreParameters params)
|
||||||
throws InvalidAlgorithmParameterException,
|
throws InvalidAlgorithmParameterException,
|
||||||
NoSuchAlgorithmException {
|
NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
try {
|
try {
|
||||||
Instance instance = GetInstance.getInstance("CertStore",
|
Instance instance = GetInstance.getInstance("CertStore",
|
||||||
CertStoreSpi.class, type, params);
|
CertStoreSpi.class, type, params);
|
||||||
@ -243,7 +247,8 @@ public class CertStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static CertStore handleException(NoSuchAlgorithmException e)
|
private static CertStore handleException(NoSuchAlgorithmException e)
|
||||||
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
throws NoSuchAlgorithmException,
|
||||||
|
InvalidAlgorithmParameterException {
|
||||||
Throwable cause = e.getCause();
|
Throwable cause = e.getCause();
|
||||||
if (cause instanceof InvalidAlgorithmParameterException) {
|
if (cause instanceof InvalidAlgorithmParameterException) {
|
||||||
throw (InvalidAlgorithmParameterException)cause;
|
throw (InvalidAlgorithmParameterException)cause;
|
||||||
@ -280,21 +285,23 @@ public class CertStore {
|
|||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return a {@code CertStore} object that implements the
|
* @return a {@code CertStore} object that implements the
|
||||||
* specified type.
|
* specified type
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a CertStoreSpi
|
* @throws IllegalArgumentException if the {@code provider} is
|
||||||
* implementation for the specified type is not
|
* {@code null} or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @throws InvalidAlgorithmParameterException if the specified
|
* @throws InvalidAlgorithmParameterException if the specified
|
||||||
* initialization parameters are inappropriate for this
|
* initialization parameters are inappropriate for this
|
||||||
* {@code CertStore}.
|
* {@code CertStore}
|
||||||
|
*
|
||||||
|
* @throws NoSuchAlgorithmException if a {@code CertStoreSpi}
|
||||||
|
* implementation for the specified type is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @throws NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider} is
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
* null or empty.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
@ -302,6 +309,7 @@ public class CertStore {
|
|||||||
CertStoreParameters params, String provider)
|
CertStoreParameters params, String provider)
|
||||||
throws InvalidAlgorithmParameterException,
|
throws InvalidAlgorithmParameterException,
|
||||||
NoSuchAlgorithmException, NoSuchProviderException {
|
NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
try {
|
try {
|
||||||
Instance instance = GetInstance.getInstance("CertStore",
|
Instance instance = GetInstance.getInstance("CertStore",
|
||||||
CertStoreSpi.class, type, params, provider);
|
CertStoreSpi.class, type, params, provider);
|
||||||
@ -338,24 +346,27 @@ public class CertStore {
|
|||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return a {@code CertStore} object that implements the
|
* @return a {@code CertStore} object that implements the
|
||||||
* specified type.
|
* specified type
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a CertStoreSpi
|
* @throws IllegalArgumentException if the {@code provider} is
|
||||||
* implementation for the specified type is not available
|
* null
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @throws InvalidAlgorithmParameterException if the specified
|
* @throws InvalidAlgorithmParameterException if the specified
|
||||||
* initialization parameters are inappropriate for this
|
* initialization parameters are inappropriate for this
|
||||||
* {@code CertStore}
|
* {@code CertStore}
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider} is
|
* @throws NoSuchAlgorithmException if a {@code CertStoreSpi}
|
||||||
* null.
|
* implementation for the specified type is not available
|
||||||
|
* from the specified Provider object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static CertStore getInstance(String type, CertStoreParameters params,
|
public static CertStore getInstance(String type, CertStoreParameters params,
|
||||||
Provider provider) throws NoSuchAlgorithmException,
|
Provider provider) throws NoSuchAlgorithmException,
|
||||||
InvalidAlgorithmParameterException {
|
InvalidAlgorithmParameterException {
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
try {
|
try {
|
||||||
Instance instance = GetInstance.getInstance("CertStore",
|
Instance instance = GetInstance.getInstance("CertStore",
|
||||||
CertStoreSpi.class, type, params, provider);
|
CertStoreSpi.class, type, params, provider);
|
||||||
|
@ -29,10 +29,9 @@ import java.io.InputStream;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.security.Provider;
|
import java.security.Provider;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import java.security.AccessController;
|
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.NoSuchProviderException;
|
import java.security.NoSuchProviderException;
|
||||||
|
|
||||||
@ -177,16 +176,19 @@ public class CertificateFactory {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard certificate types.
|
* for information about standard certificate types.
|
||||||
*
|
*
|
||||||
* @return a certificate factory object for the specified type.
|
* @return a certificate factory object for the specified type
|
||||||
*
|
*
|
||||||
* @exception CertificateException if no Provider supports a
|
* @throws CertificateException if no {@code Provider} supports a
|
||||||
* CertificateFactorySpi implementation for the
|
* {@code CertificateFactorySpi} implementation for the
|
||||||
* specified type.
|
* specified type
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final CertificateFactory getInstance(String type)
|
public static final CertificateFactory getInstance(String type)
|
||||||
throws CertificateException {
|
throws CertificateException {
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
try {
|
try {
|
||||||
Instance instance = GetInstance.getInstance("CertificateFactory",
|
Instance instance = GetInstance.getInstance("CertificateFactory",
|
||||||
CertificateFactorySpi.class, type);
|
CertificateFactorySpi.class, type);
|
||||||
@ -217,23 +219,26 @@ public class CertificateFactory {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return a certificate factory object for the specified type.
|
* @return a certificate factory object for the specified type
|
||||||
*
|
*
|
||||||
* @exception CertificateException if a CertificateFactorySpi
|
* @throws CertificateException if a {@code CertificateFactorySpi}
|
||||||
* implementation for the specified algorithm is not
|
* implementation for the specified algorithm is not
|
||||||
* available from the specified provider.
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
* registered in the security provider list.
|
* or empty
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the provider name is null
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final CertificateFactory getInstance(String type,
|
public static final CertificateFactory getInstance(String type,
|
||||||
String provider) throws CertificateException,
|
String provider) throws CertificateException,
|
||||||
NoSuchProviderException {
|
NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
try {
|
try {
|
||||||
Instance instance = GetInstance.getInstance("CertificateFactory",
|
Instance instance = GetInstance.getInstance("CertificateFactory",
|
||||||
CertificateFactorySpi.class, type, provider);
|
CertificateFactorySpi.class, type, provider);
|
||||||
@ -260,14 +265,16 @@ public class CertificateFactory {
|
|||||||
* for information about standard certificate types.
|
* for information about standard certificate types.
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return a certificate factory object for the specified type.
|
* @return a certificate factory object for the specified type
|
||||||
*
|
*
|
||||||
* @exception CertificateException if a CertificateFactorySpi
|
* @throws CertificateException if a {@code CertificateFactorySpi}
|
||||||
* implementation for the specified algorithm is not available
|
* implementation for the specified algorithm is not available
|
||||||
* from the specified Provider object.
|
* from the specified {@code Provider} object
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider} is
|
* @throws IllegalArgumentException if the {@code provider} is
|
||||||
* null.
|
* {@code null}
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*
|
*
|
||||||
@ -275,6 +282,7 @@ public class CertificateFactory {
|
|||||||
*/
|
*/
|
||||||
public static final CertificateFactory getInstance(String type,
|
public static final CertificateFactory getInstance(String type,
|
||||||
Provider provider) throws CertificateException {
|
Provider provider) throws CertificateException {
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
try {
|
try {
|
||||||
Instance instance = GetInstance.getInstance("CertificateFactory",
|
Instance instance = GetInstance.getInstance("CertificateFactory",
|
||||||
CertificateFactorySpi.class, type, provider);
|
CertificateFactorySpi.class, type, provider);
|
||||||
|
@ -53,7 +53,8 @@ class ImmutableCollections {
|
|||||||
*/
|
*/
|
||||||
static final int SALT;
|
static final int SALT;
|
||||||
static {
|
static {
|
||||||
SALT = new Random().nextInt();
|
long nt = System.nanoTime();
|
||||||
|
SALT = (int)((nt >>> 32) ^ nt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** No instances. */
|
/** No instances. */
|
||||||
@ -63,7 +64,7 @@ class ImmutableCollections {
|
|||||||
* The reciprocal of load factor. Given a number of elements
|
* The reciprocal of load factor. Given a number of elements
|
||||||
* to store, multiply by this factor to get the table size.
|
* to store, multiply by this factor to get the table size.
|
||||||
*/
|
*/
|
||||||
static final double EXPAND_FACTOR = 2.0;
|
static final int EXPAND_FACTOR = 2;
|
||||||
|
|
||||||
static UnsupportedOperationException uoe() { return new UnsupportedOperationException(); }
|
static UnsupportedOperationException uoe() { return new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@ -84,7 +85,14 @@ class ImmutableCollections {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static final class List0<E> extends AbstractImmutableList<E> {
|
static final class List0<E> extends AbstractImmutableList<E> {
|
||||||
List0() { }
|
private static final List0<?> INSTANCE = new List0<>();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
static <T> List0<T> instance() {
|
||||||
|
return (List0<T>) INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List0() { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
@ -214,7 +222,14 @@ class ImmutableCollections {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static final class Set0<E> extends AbstractImmutableSet<E> {
|
static final class Set0<E> extends AbstractImmutableSet<E> {
|
||||||
Set0() { }
|
private static final Set0<?> INSTANCE = new Set0<>();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
static <T> Set0<T> instance() {
|
||||||
|
return (Set0<T>) INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set0() { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
@ -351,7 +366,7 @@ class ImmutableCollections {
|
|||||||
SetN(E... input) {
|
SetN(E... input) {
|
||||||
size = input.length; // implicit nullcheck of input
|
size = input.length; // implicit nullcheck of input
|
||||||
|
|
||||||
elements = (E[])new Object[(int)Math.ceil(EXPAND_FACTOR * input.length)];
|
elements = (E[])new Object[EXPAND_FACTOR * input.length];
|
||||||
for (int i = 0; i < input.length; i++) {
|
for (int i = 0; i < input.length; i++) {
|
||||||
E e = Objects.requireNonNull(input[i]);
|
E e = Objects.requireNonNull(input[i]);
|
||||||
int idx = probe(e);
|
int idx = probe(e);
|
||||||
@ -450,7 +465,14 @@ class ImmutableCollections {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static final class Map0<K,V> extends AbstractImmutableMap<K,V> {
|
static final class Map0<K,V> extends AbstractImmutableMap<K,V> {
|
||||||
Map0() { }
|
private static final Map0<?,?> INSTANCE = new Map0<>();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
static <K,V> Map0<K,V> instance() {
|
||||||
|
return (Map0<K,V>) INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map0() { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Map.Entry<K,V>> entrySet() {
|
public Set<Map.Entry<K,V>> entrySet() {
|
||||||
@ -529,7 +551,7 @@ class ImmutableCollections {
|
|||||||
}
|
}
|
||||||
size = input.length >> 1;
|
size = input.length >> 1;
|
||||||
|
|
||||||
int len = (int)Math.ceil(EXPAND_FACTOR * input.length);
|
int len = EXPAND_FACTOR * input.length;
|
||||||
len = (len + 1) & ~1; // ensure table is even length
|
len = (len + 1) & ~1; // ensure table is even length
|
||||||
table = new Object[len];
|
table = new Object[len];
|
||||||
|
|
||||||
@ -789,7 +811,7 @@ final class CollSer implements Serializable {
|
|||||||
return Set.of(array);
|
return Set.of(array);
|
||||||
case IMM_MAP:
|
case IMM_MAP:
|
||||||
if (array.length == 0) {
|
if (array.length == 0) {
|
||||||
return new ImmutableCollections.Map0<>();
|
return ImmutableCollections.Map0.instance();
|
||||||
} else if (array.length == 2) {
|
} else if (array.length == 2) {
|
||||||
return new ImmutableCollections.Map1<>(array[0], array[1]);
|
return new ImmutableCollections.Map1<>(array[0], array[1]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -786,7 +786,7 @@ public interface List<E> extends Collection<E> {
|
|||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
static <E> List<E> of() {
|
static <E> List<E> of() {
|
||||||
return new ImmutableCollections.List0<>();
|
return ImmutableCollections.List0.instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1030,7 +1030,7 @@ public interface List<E> extends Collection<E> {
|
|||||||
Objects.requireNonNull(elements);
|
Objects.requireNonNull(elements);
|
||||||
switch (elements.length) {
|
switch (elements.length) {
|
||||||
case 0:
|
case 0:
|
||||||
return new ImmutableCollections.List0<>();
|
return ImmutableCollections.List0.instance();
|
||||||
case 1:
|
case 1:
|
||||||
return new ImmutableCollections.List1<>(elements[0]);
|
return new ImmutableCollections.List1<>(elements[0]);
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -1286,7 +1286,7 @@ public interface Map<K, V> {
|
|||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
static <K, V> Map<K, V> of() {
|
static <K, V> Map<K, V> of() {
|
||||||
return new ImmutableCollections.Map0<>();
|
return ImmutableCollections.Map0.instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1604,7 +1604,7 @@ public interface Map<K, V> {
|
|||||||
static <K, V> Map<K, V> ofEntries(Entry<? extends K, ? extends V>... entries) {
|
static <K, V> Map<K, V> ofEntries(Entry<? extends K, ? extends V>... entries) {
|
||||||
Objects.requireNonNull(entries);
|
Objects.requireNonNull(entries);
|
||||||
if (entries.length == 0) {
|
if (entries.length == 0) {
|
||||||
return new ImmutableCollections.Map0<>();
|
return ImmutableCollections.Map0.instance();
|
||||||
} else if (entries.length == 1) {
|
} else if (entries.length == 1) {
|
||||||
return new ImmutableCollections.Map1<>(entries[0].getKey(),
|
return new ImmutableCollections.Map1<>(entries[0].getKey(),
|
||||||
entries[0].getValue());
|
entries[0].getValue());
|
||||||
|
@ -1267,6 +1267,9 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
// The next operation should occur in the specified radix but
|
// The next operation should occur in the specified radix but
|
||||||
// the default is left untouched.
|
// the default is left untouched.
|
||||||
private void setRadix(int radix) {
|
private void setRadix(int radix) {
|
||||||
|
if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX))
|
||||||
|
throw new IllegalArgumentException("radix:"+radix);
|
||||||
|
|
||||||
if (this.radix != radix) {
|
if (this.radix != radix) {
|
||||||
// Force rebuilding and recompilation of radix dependent patterns
|
// Force rebuilding and recompilation of radix dependent patterns
|
||||||
integerPattern = null;
|
integerPattern = null;
|
||||||
@ -1811,10 +1814,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* interpreted as a byte value in the specified radix using the
|
* interpreted as a byte value in the specified radix using the
|
||||||
* {@link #nextByte} method. The scanner does not advance past any input.
|
* {@link #nextByte} method. The scanner does not advance past any input.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token as a byte value
|
* @param radix the radix used to interpret the token as a byte value
|
||||||
* @return true if and only if this scanner's next token is a valid
|
* @return true if and only if this scanner's next token is a valid
|
||||||
* byte value
|
* byte value
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public boolean hasNextByte(int radix) {
|
public boolean hasNextByte(int radix) {
|
||||||
setRadix(radix);
|
setRadix(radix);
|
||||||
@ -1869,6 +1877,10 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* {@link Byte#parseByte(String, int) Byte.parseByte} with the
|
* {@link Byte#parseByte(String, int) Byte.parseByte} with the
|
||||||
* specified radix.
|
* specified radix.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token as a byte value
|
* @param radix the radix used to interpret the token as a byte value
|
||||||
* @return the {@code byte} scanned from the input
|
* @return the {@code byte} scanned from the input
|
||||||
* @throws InputMismatchException
|
* @throws InputMismatchException
|
||||||
@ -1876,6 +1888,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* regular expression, or is out of range
|
* regular expression, or is out of range
|
||||||
* @throws NoSuchElementException if input is exhausted
|
* @throws NoSuchElementException if input is exhausted
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public byte nextByte(int radix) {
|
public byte nextByte(int radix) {
|
||||||
// Check cached result
|
// Check cached result
|
||||||
@ -1917,10 +1930,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* interpreted as a short value in the specified radix using the
|
* interpreted as a short value in the specified radix using the
|
||||||
* {@link #nextShort} method. The scanner does not advance past any input.
|
* {@link #nextShort} method. The scanner does not advance past any input.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token as a short value
|
* @param radix the radix used to interpret the token as a short value
|
||||||
* @return true if and only if this scanner's next token is a valid
|
* @return true if and only if this scanner's next token is a valid
|
||||||
* short value in the specified radix
|
* short value in the specified radix
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public boolean hasNextShort(int radix) {
|
public boolean hasNextShort(int radix) {
|
||||||
setRadix(radix);
|
setRadix(radix);
|
||||||
@ -1975,6 +1993,10 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* {@link Short#parseShort(String, int) Short.parseShort} with the
|
* {@link Short#parseShort(String, int) Short.parseShort} with the
|
||||||
* specified radix.
|
* specified radix.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token as a short value
|
* @param radix the radix used to interpret the token as a short value
|
||||||
* @return the {@code short} scanned from the input
|
* @return the {@code short} scanned from the input
|
||||||
* @throws InputMismatchException
|
* @throws InputMismatchException
|
||||||
@ -1982,6 +2004,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* regular expression, or is out of range
|
* regular expression, or is out of range
|
||||||
* @throws NoSuchElementException if input is exhausted
|
* @throws NoSuchElementException if input is exhausted
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public short nextShort(int radix) {
|
public short nextShort(int radix) {
|
||||||
// Check cached result
|
// Check cached result
|
||||||
@ -2023,10 +2046,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* interpreted as an int value in the specified radix using the
|
* interpreted as an int value in the specified radix using the
|
||||||
* {@link #nextInt} method. The scanner does not advance past any input.
|
* {@link #nextInt} method. The scanner does not advance past any input.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token as an int value
|
* @param radix the radix used to interpret the token as an int value
|
||||||
* @return true if and only if this scanner's next token is a valid
|
* @return true if and only if this scanner's next token is a valid
|
||||||
* int value
|
* int value
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public boolean hasNextInt(int radix) {
|
public boolean hasNextInt(int radix) {
|
||||||
setRadix(radix);
|
setRadix(radix);
|
||||||
@ -2105,6 +2133,10 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* {@link Integer#parseInt(String, int) Integer.parseInt} with the
|
* {@link Integer#parseInt(String, int) Integer.parseInt} with the
|
||||||
* specified radix.
|
* specified radix.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token as an int value
|
* @param radix the radix used to interpret the token as an int value
|
||||||
* @return the {@code int} scanned from the input
|
* @return the {@code int} scanned from the input
|
||||||
* @throws InputMismatchException
|
* @throws InputMismatchException
|
||||||
@ -2112,6 +2144,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* regular expression, or is out of range
|
* regular expression, or is out of range
|
||||||
* @throws NoSuchElementException if input is exhausted
|
* @throws NoSuchElementException if input is exhausted
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public int nextInt(int radix) {
|
public int nextInt(int radix) {
|
||||||
// Check cached result
|
// Check cached result
|
||||||
@ -2153,10 +2186,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* interpreted as a long value in the specified radix using the
|
* interpreted as a long value in the specified radix using the
|
||||||
* {@link #nextLong} method. The scanner does not advance past any input.
|
* {@link #nextLong} method. The scanner does not advance past any input.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token as a long value
|
* @param radix the radix used to interpret the token as a long value
|
||||||
* @return true if and only if this scanner's next token is a valid
|
* @return true if and only if this scanner's next token is a valid
|
||||||
* long value
|
* long value
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public boolean hasNextLong(int radix) {
|
public boolean hasNextLong(int radix) {
|
||||||
setRadix(radix);
|
setRadix(radix);
|
||||||
@ -2211,6 +2249,10 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* {@link Long#parseLong(String, int) Long.parseLong} with the
|
* {@link Long#parseLong(String, int) Long.parseLong} with the
|
||||||
* specified radix.
|
* specified radix.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token as an int value
|
* @param radix the radix used to interpret the token as an int value
|
||||||
* @return the {@code long} scanned from the input
|
* @return the {@code long} scanned from the input
|
||||||
* @throws InputMismatchException
|
* @throws InputMismatchException
|
||||||
@ -2218,6 +2260,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* regular expression, or is out of range
|
* regular expression, or is out of range
|
||||||
* @throws NoSuchElementException if input is exhausted
|
* @throws NoSuchElementException if input is exhausted
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public long nextLong(int radix) {
|
public long nextLong(int radix) {
|
||||||
// Check cached result
|
// Check cached result
|
||||||
@ -2450,10 +2493,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* the {@link #nextBigInteger} method. The scanner does not advance past
|
* the {@link #nextBigInteger} method. The scanner does not advance past
|
||||||
* any input.
|
* any input.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token as an integer
|
* @param radix the radix used to interpret the token as an integer
|
||||||
* @return true if and only if this scanner's next token is a valid
|
* @return true if and only if this scanner's next token is a valid
|
||||||
* {@code BigInteger}
|
* {@code BigInteger}
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public boolean hasNextBigInteger(int radix) {
|
public boolean hasNextBigInteger(int radix) {
|
||||||
setRadix(radix);
|
setRadix(radix);
|
||||||
@ -2504,6 +2552,10 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* java.math.BigInteger#BigInteger(java.lang.String)
|
* java.math.BigInteger#BigInteger(java.lang.String)
|
||||||
* BigInteger(String, int)} constructor with the specified radix.
|
* BigInteger(String, int)} constructor with the specified radix.
|
||||||
*
|
*
|
||||||
|
* <p>If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX}
|
||||||
|
* or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an
|
||||||
|
* {@code IllegalArgumentException} is thrown.
|
||||||
|
*
|
||||||
* @param radix the radix used to interpret the token
|
* @param radix the radix used to interpret the token
|
||||||
* @return the {@code BigInteger} scanned from the input
|
* @return the {@code BigInteger} scanned from the input
|
||||||
* @throws InputMismatchException
|
* @throws InputMismatchException
|
||||||
@ -2511,6 +2563,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
|||||||
* regular expression, or is out of range
|
* regular expression, or is out of range
|
||||||
* @throws NoSuchElementException if the input is exhausted
|
* @throws NoSuchElementException if the input is exhausted
|
||||||
* @throws IllegalStateException if this scanner is closed
|
* @throws IllegalStateException if this scanner is closed
|
||||||
|
* @throws IllegalArgumentException if the radix is out of range
|
||||||
*/
|
*/
|
||||||
public BigInteger nextBigInteger(int radix) {
|
public BigInteger nextBigInteger(int radix) {
|
||||||
// Check cached result
|
// Check cached result
|
||||||
|
@ -448,7 +448,7 @@ public interface Set<E> extends Collection<E> {
|
|||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
static <E> Set<E> of() {
|
static <E> Set<E> of() {
|
||||||
return new ImmutableCollections.Set0<>();
|
return ImmutableCollections.Set0.instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -692,7 +692,7 @@ public interface Set<E> extends Collection<E> {
|
|||||||
Objects.requireNonNull(elements);
|
Objects.requireNonNull(elements);
|
||||||
switch (elements.length) {
|
switch (elements.length) {
|
||||||
case 0:
|
case 0:
|
||||||
return new ImmutableCollections.Set0<>();
|
return ImmutableCollections.Set0.instance();
|
||||||
case 1:
|
case 1:
|
||||||
return new ImmutableCollections.Set1<>(elements[0]);
|
return new ImmutableCollections.Set1<>(elements[0]);
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -508,7 +508,7 @@ public final class Collectors {
|
|||||||
* transformation. For example, one could adapt the {@link #toList()}
|
* transformation. For example, one could adapt the {@link #toList()}
|
||||||
* collector to always produce an immutable list with:
|
* collector to always produce an immutable list with:
|
||||||
* <pre>{@code
|
* <pre>{@code
|
||||||
* List<String> people
|
* List<String> list
|
||||||
* = people.stream().collect(collectingAndThen(toList(), Collections::unmodifiableList));
|
* = people.stream().collect(collectingAndThen(toList(), Collections::unmodifiableList));
|
||||||
* }</pre>
|
* }</pre>
|
||||||
*
|
*
|
||||||
|
@ -493,21 +493,24 @@ public class Cipher {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard transformation names.
|
* for information about standard transformation names.
|
||||||
*
|
*
|
||||||
* @return a cipher that implements the requested transformation.
|
* @return a cipher that implements the requested transformation
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if {@code transformation}
|
* @throws NoSuchAlgorithmException if {@code transformation}
|
||||||
* is null, empty, in an invalid format,
|
* is {@code null}, empty, in an invalid format,
|
||||||
* or if no Provider supports a CipherSpi implementation for the
|
* or if no {@code Provider} supports a {@code CipherSpi}
|
||||||
* specified algorithm.
|
* implementation for the specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchPaddingException if {@code transformation}
|
* @throws NoSuchPaddingException if {@code transformation}
|
||||||
* contains a padding scheme that is not available.
|
* contains a padding scheme that is not available
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final Cipher getInstance(String transformation)
|
public static final Cipher getInstance(String transformation)
|
||||||
throws NoSuchAlgorithmException, NoSuchPaddingException
|
throws NoSuchAlgorithmException, NoSuchPaddingException
|
||||||
{
|
{
|
||||||
|
if ((transformation == null) || transformation.equals("")) {
|
||||||
|
throw new NoSuchAlgorithmException("Null or empty transformation");
|
||||||
|
}
|
||||||
List<Transform> transforms = getTransforms(transformation);
|
List<Transform> transforms = getTransforms(transformation);
|
||||||
List<ServiceId> cipherServices = new ArrayList<>(transforms.size());
|
List<ServiceId> cipherServices = new ArrayList<>(transforms.size());
|
||||||
for (Transform transform : transforms) {
|
for (Transform transform : transforms) {
|
||||||
@ -570,21 +573,22 @@ public class Cipher {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return a cipher that implements the requested transformation.
|
* @return a cipher that implements the requested transformation
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if {@code transformation}
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
* is null, empty, in an invalid format,
|
* is {@code null} or empty
|
||||||
* or if a CipherSpi implementation for the specified algorithm
|
|
||||||
* is not available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchAlgorithmException if {@code transformation}
|
||||||
* registered in the security provider list.
|
* is {@code null}, empty, in an invalid format,
|
||||||
|
* or if a {@code CipherSpi} implementation for the
|
||||||
|
* specified algorithm is not available from the specified
|
||||||
|
* provider
|
||||||
*
|
*
|
||||||
* @exception NoSuchPaddingException if {@code transformation}
|
* @throws NoSuchPaddingException if {@code transformation}
|
||||||
* contains a padding scheme that is not available.
|
* contains a padding scheme that is not available
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* is null or empty.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
@ -593,6 +597,9 @@ public class Cipher {
|
|||||||
throws NoSuchAlgorithmException, NoSuchProviderException,
|
throws NoSuchAlgorithmException, NoSuchProviderException,
|
||||||
NoSuchPaddingException
|
NoSuchPaddingException
|
||||||
{
|
{
|
||||||
|
if ((transformation == null) || transformation.equals("")) {
|
||||||
|
throw new NoSuchAlgorithmException("Null or empty transformation");
|
||||||
|
}
|
||||||
if ((provider == null) || (provider.length() == 0)) {
|
if ((provider == null) || (provider.length() == 0)) {
|
||||||
throw new IllegalArgumentException("Missing provider");
|
throw new IllegalArgumentException("Missing provider");
|
||||||
}
|
}
|
||||||
@ -622,18 +629,19 @@ public class Cipher {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return a cipher that implements the requested transformation.
|
* @return a cipher that implements the requested transformation
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if {@code transformation}
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
* is null, empty, in an invalid format,
|
* is {@code null}
|
||||||
* or if a CipherSpi implementation for the specified algorithm
|
|
||||||
* is not available from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchPaddingException if {@code transformation}
|
* @throws NoSuchAlgorithmException if {@code transformation}
|
||||||
* contains a padding scheme that is not available.
|
* is {@code null}, empty, in an invalid format,
|
||||||
|
* or if a {@code CipherSpi} implementation for the
|
||||||
|
* specified algorithm is not available from the specified
|
||||||
|
* {@code Provider} object
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NoSuchPaddingException if {@code transformation}
|
||||||
* is null.
|
* contains a padding scheme that is not available
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
@ -641,6 +649,9 @@ public class Cipher {
|
|||||||
Provider provider)
|
Provider provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchPaddingException
|
throws NoSuchAlgorithmException, NoSuchPaddingException
|
||||||
{
|
{
|
||||||
|
if ((transformation == null) || transformation.equals("")) {
|
||||||
|
throw new NoSuchAlgorithmException("Null or empty transformation");
|
||||||
|
}
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
throw new IllegalArgumentException("Missing provider");
|
throw new IllegalArgumentException("Missing provider");
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import java.security.NoSuchProviderException;
|
|||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
import java.security.spec.AlgorithmParameterSpec;
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import sun.security.jca.GetInstance.Instance;
|
import sun.security.jca.GetInstance.Instance;
|
||||||
|
|
||||||
@ -128,19 +129,19 @@ public class ExemptionMechanism {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard exemption mechanism names.
|
* for information about standard exemption mechanism names.
|
||||||
*
|
*
|
||||||
* @return the new <code>ExemptionMechanism</code> object.
|
* @return the new {@code ExemptionMechanism} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if <code>algorithm</code>
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports an
|
||||||
* is null.
|
* {@code ExemptionMechanismSpi} implementation for the
|
||||||
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports an
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* ExemptionMechanismSpi implementation for the
|
|
||||||
* specified algorithm.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final ExemptionMechanism getInstance(String algorithm)
|
public static final ExemptionMechanism getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance("ExemptionMechanism",
|
Instance instance = JceSecurity.getInstance("ExemptionMechanism",
|
||||||
ExemptionMechanismSpi.class, algorithm);
|
ExemptionMechanismSpi.class, algorithm);
|
||||||
return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,
|
return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,
|
||||||
@ -169,26 +170,26 @@ public class ExemptionMechanism {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new <code>ExemptionMechanism</code> object.
|
* @return the new {@code ExemptionMechanism} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if <code>algorithm</code>
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
* is null.
|
* is {@code null} or empty
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if an ExemptionMechanismSpi
|
* @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi}
|
||||||
* implementation for the specified algorithm is not
|
* implementation for the specified algorithm is not
|
||||||
* available from the specified provider.
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the <code>provider</code>
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* is null or empty.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final ExemptionMechanism getInstance(String algorithm,
|
public static final ExemptionMechanism getInstance(String algorithm,
|
||||||
String provider) throws NoSuchAlgorithmException,
|
String provider) throws NoSuchAlgorithmException,
|
||||||
NoSuchProviderException {
|
NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance("ExemptionMechanism",
|
Instance instance = JceSecurity.getInstance("ExemptionMechanism",
|
||||||
ExemptionMechanismSpi.class, algorithm, provider);
|
ExemptionMechanismSpi.class, algorithm, provider);
|
||||||
return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,
|
return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,
|
||||||
@ -213,22 +214,22 @@ public class ExemptionMechanism {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new <code>ExemptionMechanism</code> object.
|
* @return the new {@code ExemptionMechanism} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if <code>algorithm</code>
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
* is null.
|
* is null
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if an ExemptionMechanismSpi
|
* @throws NoSuchAlgorithmException if an {@code ExemptionMechanismSpi}
|
||||||
* implementation for the specified algorithm is not available
|
* implementation for the specified algorithm is not available
|
||||||
* from the specified Provider object.
|
* from the specified {@code Provider object}
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the <code>provider</code>
|
* @exception NullPointerException if {@code algorithm} is {@code null}
|
||||||
* is null.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final ExemptionMechanism getInstance(String algorithm,
|
public static final ExemptionMechanism getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance("ExemptionMechanism",
|
Instance instance = JceSecurity.getInstance("ExemptionMechanism",
|
||||||
ExemptionMechanismSpi.class, algorithm, provider);
|
ExemptionMechanismSpi.class, algorithm, provider);
|
||||||
return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,
|
return new ExemptionMechanism((ExemptionMechanismSpi)instance.impl,
|
||||||
|
@ -165,19 +165,19 @@ public class KeyAgreement {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new {@code KeyAgreement} object.
|
* @return the new {@code KeyAgreement} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified algorithm
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* is null.
|
* {@code KeyAgreementSpi} implementation for the
|
||||||
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* KeyAgreementSpi implementation for the
|
|
||||||
* specified algorithm.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final KeyAgreement getInstance(String algorithm)
|
public static final KeyAgreement getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
List<Service> services =
|
List<Service> services =
|
||||||
GetInstance.getServices("KeyAgreement", algorithm);
|
GetInstance.getServices("KeyAgreement", algorithm);
|
||||||
// make sure there is at least one service from a signed provider
|
// make sure there is at least one service from a signed provider
|
||||||
@ -214,26 +214,26 @@ public class KeyAgreement {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code KeyAgreement} object.
|
* @return the new {@code KeyAgreement} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified algorithm
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
* is null.
|
* is {@code null} or empty
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a KeyAgreementSpi
|
* @throws NoSuchAlgorithmException if a {@code KeyAgreementSpi}
|
||||||
* implementation for the specified algorithm is not
|
* implementation for the specified algorithm is not
|
||||||
* available from the specified provider.
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* is null or empty.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final KeyAgreement getInstance(String algorithm,
|
public static final KeyAgreement getInstance(String algorithm,
|
||||||
String provider) throws NoSuchAlgorithmException,
|
String provider) throws NoSuchAlgorithmException,
|
||||||
NoSuchProviderException {
|
NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance
|
Instance instance = JceSecurity.getInstance
|
||||||
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
|
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
|
||||||
return new KeyAgreement((KeyAgreementSpi)instance.impl,
|
return new KeyAgreement((KeyAgreementSpi)instance.impl,
|
||||||
@ -258,22 +258,22 @@ public class KeyAgreement {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code KeyAgreement} object.
|
* @return the new {@code KeyAgreement} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified algorithm
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
* is null.
|
* is {@code null}
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a KeyAgreementSpi
|
* @throws NoSuchAlgorithmException if a {@code KeyAgreementSpi}
|
||||||
* implementation for the specified algorithm is not available
|
* implementation for the specified algorithm is not available
|
||||||
* from the specified Provider object.
|
* from the specified Provider object
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* is null.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final KeyAgreement getInstance(String algorithm,
|
public static final KeyAgreement getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance
|
Instance instance = JceSecurity.getInstance
|
||||||
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
|
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
|
||||||
return new KeyAgreement((KeyAgreementSpi)instance.impl,
|
return new KeyAgreement((KeyAgreementSpi)instance.impl,
|
||||||
|
@ -216,18 +216,19 @@ public class KeyGenerator {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new {@code KeyGenerator} object.
|
* @return the new {@code KeyGenerator} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified algorithm is null.
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
|
* {@code KeyGeneratorSpi} implementation for the
|
||||||
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* KeyGeneratorSpi implementation for the
|
|
||||||
* specified algorithm.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final KeyGenerator getInstance(String algorithm)
|
public static final KeyGenerator getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
return new KeyGenerator(algorithm);
|
return new KeyGenerator(algorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,25 +252,26 @@ public class KeyGenerator {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code KeyGenerator} object.
|
* @return the new {@code KeyGenerator} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified algorithm is null.
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
|
* is {@code null} or empty
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a KeyGeneratorSpi
|
* @throws NoSuchAlgorithmException if a {@code KeyGeneratorSpi}
|
||||||
* implementation for the specified algorithm is not
|
* implementation for the specified algorithm is not
|
||||||
* available from the specified provider.
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* is null or empty.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final KeyGenerator getInstance(String algorithm,
|
public static final KeyGenerator getInstance(String algorithm,
|
||||||
String provider) throws NoSuchAlgorithmException,
|
String provider) throws NoSuchAlgorithmException,
|
||||||
NoSuchProviderException {
|
NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance("KeyGenerator",
|
Instance instance = JceSecurity.getInstance("KeyGenerator",
|
||||||
KeyGeneratorSpi.class, algorithm, provider);
|
KeyGeneratorSpi.class, algorithm, provider);
|
||||||
return new KeyGenerator((KeyGeneratorSpi)instance.impl,
|
return new KeyGenerator((KeyGeneratorSpi)instance.impl,
|
||||||
@ -293,21 +295,22 @@ public class KeyGenerator {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code KeyGenerator} object.
|
* @return the new {@code KeyGenerator} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified algorithm is null.
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
|
* is {@code null}
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a KeyGeneratorSpi
|
* @throws NoSuchAlgorithmException if a {@code KeyGeneratorSpi}
|
||||||
* implementation for the specified algorithm is not available
|
* implementation for the specified algorithm is not available
|
||||||
* from the specified Provider object.
|
* from the specified {@code Provider} object
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* is null.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final KeyGenerator getInstance(String algorithm,
|
public static final KeyGenerator getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance("KeyGenerator",
|
Instance instance = JceSecurity.getInstance("KeyGenerator",
|
||||||
KeyGeneratorSpi.class, algorithm, provider);
|
KeyGeneratorSpi.class, algorithm, provider);
|
||||||
return new KeyGenerator((KeyGeneratorSpi)instance.impl,
|
return new KeyGenerator((KeyGeneratorSpi)instance.impl,
|
||||||
|
@ -166,16 +166,18 @@ public class Mac implements Cloneable {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new {@code Mac} object.
|
* @return the new {@code Mac} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* MacSpi implementation for the
|
* {@code MacSpi} implementation for the specified algorithm
|
||||||
* specified algorithm.
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final Mac getInstance(String algorithm)
|
public static final Mac getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
List<Service> services = GetInstance.getServices("Mac", algorithm);
|
List<Service> services = GetInstance.getServices("Mac", algorithm);
|
||||||
// make sure there is at least one service from a signed provider
|
// make sure there is at least one service from a signed provider
|
||||||
Iterator<Service> t = services.iterator();
|
Iterator<Service> t = services.iterator();
|
||||||
@ -210,22 +212,25 @@ public class Mac implements Cloneable {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code Mac} object.
|
* @return the new {@code Mac} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a MacSpi
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
* implementation for the specified algorithm is not
|
* is {@code null} or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NoSuchAlgorithmException if a {@code MacSpi}
|
||||||
* registered in the security provider list.
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* is null or empty.
|
* registered in the security provider list
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final Mac getInstance(String algorithm, String provider)
|
public static final Mac getInstance(String algorithm, String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException {
|
throws NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance
|
Instance instance = JceSecurity.getInstance
|
||||||
("Mac", MacSpi.class, algorithm, provider);
|
("Mac", MacSpi.class, algorithm, provider);
|
||||||
return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
|
return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
|
||||||
@ -248,19 +253,22 @@ public class Mac implements Cloneable {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code Mac} object.
|
* @return the new {@code Mac} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a MacSpi
|
* @throws IllegalArgumentException if the {@code provider} is
|
||||||
* implementation for the specified algorithm is not available
|
* {@code null}
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NoSuchAlgorithmException if a {@code MacSpi}
|
||||||
* is null.
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final Mac getInstance(String algorithm, Provider provider)
|
public static final Mac getInstance(String algorithm, Provider provider)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance
|
Instance instance = JceSecurity.getInstance
|
||||||
("Mac", MacSpi.class, algorithm, provider);
|
("Mac", MacSpi.class, algorithm, provider);
|
||||||
return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
|
return new Mac((MacSpi)instance.impl, instance.provider, algorithm);
|
||||||
|
@ -152,19 +152,19 @@ public class SecretKeyFactory {
|
|||||||
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new {@code SecretKeyFactory} object.
|
* @return the new {@code SecretKeyFactory} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified algorithm
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* is null.
|
* {@code SecretKeyFactorySpi} implementation for the
|
||||||
|
* specified algorithm
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* SecretKeyFactorySpi implementation for the
|
|
||||||
* specified algorithm.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final SecretKeyFactory getInstance(String algorithm)
|
public static final SecretKeyFactory getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
return new SecretKeyFactory(algorithm);
|
return new SecretKeyFactory(algorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,26 +189,26 @@ public class SecretKeyFactory {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code SecretKeyFactory} object.
|
* @return the new {@code SecretKeyFactory} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a SecretKeyFactorySpi
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
* implementation for the specified algorithm is not
|
* is {@code null} or empty
|
||||||
* available from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified algorithm
|
* @throws NoSuchAlgorithmException if a {@code SecretKeyFactorySpi}
|
||||||
* is null.
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @throws NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* is null or empty.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final SecretKeyFactory getInstance(String algorithm,
|
public static final SecretKeyFactory getInstance(String algorithm,
|
||||||
String provider) throws NoSuchAlgorithmException,
|
String provider) throws NoSuchAlgorithmException,
|
||||||
NoSuchProviderException {
|
NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance("SecretKeyFactory",
|
Instance instance = JceSecurity.getInstance("SecretKeyFactory",
|
||||||
SecretKeyFactorySpi.class, algorithm, provider);
|
SecretKeyFactorySpi.class, algorithm, provider);
|
||||||
return new SecretKeyFactory((SecretKeyFactorySpi)instance.impl,
|
return new SecretKeyFactory((SecretKeyFactorySpi)instance.impl,
|
||||||
@ -233,22 +233,22 @@ public class SecretKeyFactory {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code SecretKeyFactory} object.
|
* @return the new {@code SecretKeyFactory} object
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified algorithm
|
* @throws IllegalArgumentException if the {@code provider}
|
||||||
* is null.
|
* is {@code null}
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if a SecretKeyFactorySpi
|
* @throws NoSuchAlgorithmException if a {@code SecretKeyFactorySpi}
|
||||||
* implementation for the specified algorithm is not available
|
* implementation for the specified algorithm is not available
|
||||||
* from the specified Provider object.
|
* from the specified {@code Provider} object
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the {@code provider}
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* is null.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final SecretKeyFactory getInstance(String algorithm,
|
public static final SecretKeyFactory getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
Instance instance = JceSecurity.getInstance("SecretKeyFactory",
|
Instance instance = JceSecurity.getInstance("SecretKeyFactory",
|
||||||
SecretKeyFactorySpi.class, algorithm, provider);
|
SecretKeyFactorySpi.class, algorithm, provider);
|
||||||
return new SecretKeyFactory((SecretKeyFactorySpi)instance.impl,
|
return new SecretKeyFactory((SecretKeyFactorySpi)instance.impl,
|
||||||
|
@ -27,6 +27,7 @@ package javax.net.ssl;
|
|||||||
|
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import sun.security.jca.GetInstance;
|
import sun.security.jca.GetInstance;
|
||||||
|
|
||||||
@ -130,17 +131,19 @@ public class KeyManagerFactory {
|
|||||||
* Java Secure Socket Extension Reference Guide </a>
|
* Java Secure Socket Extension Reference Guide </a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new <code>KeyManagerFactory</code> object.
|
* @return the new {@code KeyManagerFactory} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* KeyManagerFactorySpi implementation for the
|
* {@code KeyManagerFactorySpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
* @exception NullPointerException if <code>algorithm</code> is null.
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final KeyManagerFactory getInstance(String algorithm)
|
public static final KeyManagerFactory getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
("KeyManagerFactory", KeyManagerFactorySpi.class,
|
("KeyManagerFactory", KeyManagerFactorySpi.class,
|
||||||
algorithm);
|
algorithm);
|
||||||
@ -168,23 +171,26 @@ public class KeyManagerFactory {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new <code>KeyManagerFactory</code> object.
|
* @return the new {@code KeyManagerFactory} object
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a KeyManagerFactorySpi
|
* @throws IllegalArgumentException if the provider name is {@code null}
|
||||||
* implementation for the specified algorithm is not
|
* or empty
|
||||||
* available from the specified provider.
|
*
|
||||||
|
* @throws NoSuchAlgorithmException if a {@code KeyManagerFactorySpi}
|
||||||
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @throws NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the provider name is null or empty.
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* @throws NullPointerException if <code>algorithm</code> is null.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final KeyManagerFactory getInstance(String algorithm,
|
public static final KeyManagerFactory getInstance(String algorithm,
|
||||||
String provider) throws NoSuchAlgorithmException,
|
String provider) throws NoSuchAlgorithmException,
|
||||||
NoSuchProviderException {
|
NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
("KeyManagerFactory", KeyManagerFactorySpi.class,
|
("KeyManagerFactory", KeyManagerFactorySpi.class,
|
||||||
algorithm, provider);
|
algorithm, provider);
|
||||||
@ -209,19 +215,21 @@ public class KeyManagerFactory {
|
|||||||
*
|
*
|
||||||
* @param provider an instance of the provider.
|
* @param provider an instance of the provider.
|
||||||
*
|
*
|
||||||
* @return the new <code>KeyManagerFactory</code> object.
|
* @return the new {@code KeyManagerFactory} object
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a KeyManagerFactorySpi
|
* @throws IllegalArgumentException if provider is {@code null}
|
||||||
* implementation for the specified algorithm is not available
|
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if provider is null.
|
* @throws NoSuchAlgorithmException if a {@code @KeyManagerFactorySpi}
|
||||||
* @throws NullPointerException if <code>algorithm</code> is null.
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified Provider object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final KeyManagerFactory getInstance(String algorithm,
|
public static final KeyManagerFactory getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
("KeyManagerFactory", KeyManagerFactorySpi.class,
|
("KeyManagerFactory", KeyManagerFactorySpi.class,
|
||||||
algorithm, provider);
|
algorithm, provider);
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package javax.net.ssl;
|
package javax.net.ssl;
|
||||||
|
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import sun.security.jca.GetInstance;
|
import sun.security.jca.GetInstance;
|
||||||
|
|
||||||
@ -151,17 +152,19 @@ public class SSLContext {
|
|||||||
* Documentation</a>
|
* Documentation</a>
|
||||||
* for information about standard protocol names.
|
* for information about standard protocol names.
|
||||||
*
|
*
|
||||||
* @return the new {@code SSLContext} object.
|
* @return the new {@code SSLContext} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* SSLContextSpi implementation for the
|
* {@code SSLContextSpi} implementation for the
|
||||||
* specified protocol.
|
* specified protocol
|
||||||
* @exception NullPointerException if protocol is null.
|
*
|
||||||
|
* @throws NullPointerException if {@code protocol} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static SSLContext getInstance(String protocol)
|
public static SSLContext getInstance(String protocol)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(protocol, "null protocol name");
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
("SSLContext", SSLContextSpi.class, protocol);
|
("SSLContext", SSLContextSpi.class, protocol);
|
||||||
return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
|
return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
|
||||||
@ -189,22 +192,25 @@ public class SSLContext {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code SSLContext} object.
|
* @return the new {@code SSLContext} object
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a SSLContextSpi
|
* @throws IllegalArgumentException if the provider name is
|
||||||
* implementation for the specified protocol is not
|
* {@code null} or empty
|
||||||
* available from the specified provider.
|
*
|
||||||
|
* @throws NoSuchAlgorithmException if a {@code SSLContextSpi}
|
||||||
|
* implementation for the specified protocol is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @throws NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the provider name is null or empty.
|
* @throws NullPointerException if {@code protocol} is {@code null}
|
||||||
* @throws NullPointerException if protocol is null.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static SSLContext getInstance(String protocol, String provider)
|
public static SSLContext getInstance(String protocol, String provider)
|
||||||
throws NoSuchAlgorithmException, NoSuchProviderException {
|
throws NoSuchAlgorithmException, NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(protocol, "null protocol name");
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
("SSLContext", SSLContextSpi.class, protocol, provider);
|
("SSLContext", SSLContextSpi.class, protocol, provider);
|
||||||
return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
|
return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
|
||||||
@ -229,19 +235,21 @@ public class SSLContext {
|
|||||||
*
|
*
|
||||||
* @param provider an instance of the provider.
|
* @param provider an instance of the provider.
|
||||||
*
|
*
|
||||||
* @return the new {@code SSLContext} object.
|
* @return the new {@code SSLContext} object
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a SSLContextSpi
|
* @throws IllegalArgumentException if the provider is {@code null}
|
||||||
* implementation for the specified protocol is not available
|
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the provider is null.
|
* @throws NoSuchAlgorithmException if a {@code SSLContextSpi}
|
||||||
* @throws NullPointerException if protocol is null.
|
* implementation for the specified protocol is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code protocol} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static SSLContext getInstance(String protocol, Provider provider)
|
public static SSLContext getInstance(String protocol, Provider provider)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(protocol, "null protocol name");
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
("SSLContext", SSLContextSpi.class, protocol, provider);
|
("SSLContext", SSLContextSpi.class, protocol, provider);
|
||||||
return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
|
return new SSLContext((SSLContextSpi)instance.impl, instance.provider,
|
||||||
|
@ -27,6 +27,7 @@ package javax.net.ssl;
|
|||||||
|
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import sun.security.jca.GetInstance;
|
import sun.security.jca.GetInstance;
|
||||||
|
|
||||||
@ -144,17 +145,19 @@ public class TrustManagerFactory {
|
|||||||
* Java Secure Socket Extension Reference Guide </a>
|
* Java Secure Socket Extension Reference Guide </a>
|
||||||
* for information about standard algorithm names.
|
* for information about standard algorithm names.
|
||||||
*
|
*
|
||||||
* @return the new <code>TrustManagerFactory</code> object.
|
* @return the new {@code TrustManagerFactory} object
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
* TrustManagerFactorySpi implementation for the
|
* {@code TrustManagerFactorySpi} implementation for the
|
||||||
* specified algorithm.
|
* specified algorithm
|
||||||
* @exception NullPointerException if algorithm is null.
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final TrustManagerFactory getInstance(String algorithm)
|
public static final TrustManagerFactory getInstance(String algorithm)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
("TrustManagerFactory", TrustManagerFactorySpi.class,
|
("TrustManagerFactory", TrustManagerFactorySpi.class,
|
||||||
algorithm);
|
algorithm);
|
||||||
@ -182,23 +185,26 @@ public class TrustManagerFactory {
|
|||||||
*
|
*
|
||||||
* @param provider the name of the provider.
|
* @param provider the name of the provider.
|
||||||
*
|
*
|
||||||
* @return the new <code>TrustManagerFactory</code> object
|
* @return the new {@code TrustManagerFactory} object
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a TrustManagerFactorySpi
|
* @throws IllegalArgumentException if the provider name is
|
||||||
* implementation for the specified algorithm is not
|
* {@code null} or empty
|
||||||
* available from the specified provider.
|
*
|
||||||
|
* @throws NoSuchAlgorithmException if a {@code TrustManagerFactorySpi}
|
||||||
|
* implementation for the specified algorithm is not
|
||||||
|
* available from the specified provider
|
||||||
*
|
*
|
||||||
* @throws NoSuchProviderException if the specified provider is not
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
* registered in the security provider list.
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the provider name is null or empty.
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
* @throws NullPointerException if algorithm is null.
|
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final TrustManagerFactory getInstance(String algorithm,
|
public static final TrustManagerFactory getInstance(String algorithm,
|
||||||
String provider) throws NoSuchAlgorithmException,
|
String provider) throws NoSuchAlgorithmException,
|
||||||
NoSuchProviderException {
|
NoSuchProviderException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
("TrustManagerFactory", TrustManagerFactorySpi.class,
|
("TrustManagerFactory", TrustManagerFactorySpi.class,
|
||||||
algorithm, provider);
|
algorithm, provider);
|
||||||
@ -223,19 +229,21 @@ public class TrustManagerFactory {
|
|||||||
*
|
*
|
||||||
* @param provider an instance of the provider.
|
* @param provider an instance of the provider.
|
||||||
*
|
*
|
||||||
* @return the new <code>TrustManagerFactory</code> object.
|
* @return the new {@code TrustManagerFactory} object
|
||||||
*
|
*
|
||||||
* @throws NoSuchAlgorithmException if a TrustManagerFactorySpi
|
* @throws IllegalArgumentException if the provider is {@code null}
|
||||||
* implementation for the specified algorithm is not available
|
|
||||||
* from the specified Provider object.
|
|
||||||
*
|
*
|
||||||
* @throws IllegalArgumentException if the provider is null.
|
* @throws NoSuchAlgorithmException if a {@code TrustManagerFactorySpi}
|
||||||
* @throws NullPointerException if algorithm is null.
|
* implementation for the specified algorithm is not available
|
||||||
|
* from the specified {@code Provider} object
|
||||||
|
*
|
||||||
|
* @throws NullPointerException if {@code algorithm} is {@code null}
|
||||||
*
|
*
|
||||||
* @see java.security.Provider
|
* @see java.security.Provider
|
||||||
*/
|
*/
|
||||||
public static final TrustManagerFactory getInstance(String algorithm,
|
public static final TrustManagerFactory getInstance(String algorithm,
|
||||||
Provider provider) throws NoSuchAlgorithmException {
|
Provider provider) throws NoSuchAlgorithmException {
|
||||||
|
Objects.requireNonNull(algorithm, "null algorithm name");
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
("TrustManagerFactory", TrustManagerFactorySpi.class,
|
("TrustManagerFactory", TrustManagerFactorySpi.class,
|
||||||
algorithm, provider);
|
algorithm, provider);
|
||||||
|
@ -329,27 +329,29 @@ public abstract class Configuration {
|
|||||||
*
|
*
|
||||||
* @param params parameters for the Configuration, which may be null.
|
* @param params parameters for the Configuration, which may be null.
|
||||||
*
|
*
|
||||||
* @return the new Configuration object.
|
* @return the new {@code Configuration} object
|
||||||
*
|
*
|
||||||
* @exception SecurityException if the caller does not have permission
|
* @throws IllegalArgumentException if the specified parameters
|
||||||
* to get a Configuration instance for the specified type.
|
* are not understood by the {@code ConfigurationSpi}
|
||||||
|
* implementation from the selected {@code Provider}
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified type is null.
|
* @throws NoSuchAlgorithmException if no {@code Provider} supports a
|
||||||
|
* {@code ConfigurationSpi} implementation for the specified type
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified parameters
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
* are not understood by the ConfigurationSpi implementation
|
|
||||||
* from the selected Provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if no Provider supports a
|
* @throws SecurityException if the caller does not have permission
|
||||||
* ConfigurationSpi implementation for the specified type.
|
* to get a {@code Configuration} instance for the specified type
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public static Configuration getInstance(String type,
|
public static Configuration getInstance(String type,
|
||||||
Configuration.Parameters params)
|
Configuration.Parameters params)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
checkPermission(type);
|
checkPermission(type);
|
||||||
try {
|
try {
|
||||||
GetInstance.Instance instance = GetInstance.getInstance
|
GetInstance.Instance instance = GetInstance.getInstance
|
||||||
@ -387,24 +389,24 @@ public abstract class Configuration {
|
|||||||
*
|
*
|
||||||
* @param provider the provider.
|
* @param provider the provider.
|
||||||
*
|
*
|
||||||
* @return the new Configuration object.
|
* @return the new {@code Configuration} object
|
||||||
*
|
*
|
||||||
* @exception SecurityException if the caller does not have permission
|
* @throws IllegalArgumentException if the specified provider
|
||||||
* to get a Configuration instance for the specified type.
|
* is {@code null} or empty, or if the specified parameters
|
||||||
|
* are not understood by the {@code ConfigurationSpi}
|
||||||
|
* implementation from the specified provider
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified type is null.
|
* @throws NoSuchProviderException if the specified provider is not
|
||||||
|
* registered in the security provider list
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified provider
|
* @throws NoSuchAlgorithmException if the specified provider does not
|
||||||
* is null or empty,
|
* support a {@code ConfigurationSpi} implementation for the
|
||||||
* or if the specified parameters are not understood by
|
* specified type
|
||||||
* the ConfigurationSpi implementation from the specified provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchProviderException if the specified provider is not
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
* registered in the security provider list.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if the specified provider does not
|
* @throws SecurityException if the caller does not have permission
|
||||||
* support a ConfigurationSpi implementation for the specified
|
* to get a {@code Configuration} instance for the specified type
|
||||||
* type.
|
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
@ -414,6 +416,7 @@ public abstract class Configuration {
|
|||||||
String provider)
|
String provider)
|
||||||
throws NoSuchProviderException, NoSuchAlgorithmException {
|
throws NoSuchProviderException, NoSuchAlgorithmException {
|
||||||
|
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
if (provider == null || provider.length() == 0) {
|
if (provider == null || provider.length() == 0) {
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
}
|
}
|
||||||
@ -453,20 +456,21 @@ public abstract class Configuration {
|
|||||||
*
|
*
|
||||||
* @param provider the Provider.
|
* @param provider the Provider.
|
||||||
*
|
*
|
||||||
* @return the new Configuration object.
|
* @return the new {@code Configuration} object
|
||||||
*
|
*
|
||||||
* @exception SecurityException if the caller does not have permission
|
* @throws IllegalArgumentException if the specified {@code Provider}
|
||||||
* to get a Configuration instance for the specified type.
|
* is {@code null}, or if the specified parameters are not
|
||||||
|
* understood by the {@code ConfigurationSpi} implementation
|
||||||
|
* from the specified Provider
|
||||||
*
|
*
|
||||||
* @exception NullPointerException if the specified type is null.
|
* @throws NoSuchAlgorithmException if the specified {@code Provider}
|
||||||
|
* does not support a {@code ConfigurationSpi} implementation
|
||||||
|
* for the specified type
|
||||||
*
|
*
|
||||||
* @exception IllegalArgumentException if the specified Provider is null,
|
* @throws NullPointerException if {@code type} is {@code null}
|
||||||
* or if the specified parameters are not understood by
|
|
||||||
* the ConfigurationSpi implementation from the specified Provider.
|
|
||||||
*
|
*
|
||||||
* @exception NoSuchAlgorithmException if the specified Provider does not
|
* @throws SecurityException if the caller does not have permission
|
||||||
* support a ConfigurationSpi implementation for the specified
|
* to get a {@code Configuration} instance for the specified type
|
||||||
* type.
|
|
||||||
*
|
*
|
||||||
* @see Provider
|
* @see Provider
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
@ -476,6 +480,7 @@ public abstract class Configuration {
|
|||||||
Provider provider)
|
Provider provider)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
|
|
||||||
|
Objects.requireNonNull(type, "null type name");
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
throw new IllegalArgumentException("missing provider");
|
throw new IllegalArgumentException("missing provider");
|
||||||
}
|
}
|
||||||
|
@ -175,6 +175,16 @@ public class JmodFile implements AutoCloseable {
|
|||||||
this.zipfile = new ZipFile(file.toFile());
|
this.zipfile = new ZipFile(file.toFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@code Entry} for a resource in a JMOD file section
|
||||||
|
* or {@code null} if not found.
|
||||||
|
*/
|
||||||
|
public Entry getEntry(Section section, String name) {
|
||||||
|
String entry = section.jmodDir() + "/" + name;
|
||||||
|
ZipEntry ze = zipfile.getEntry(entry);
|
||||||
|
return (ze != null) ? new Entry(ze) : null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens an {@code InputStream} for reading the named entry of the given
|
* Opens an {@code InputStream} for reading the named entry of the given
|
||||||
* section in this jmod file.
|
* section in this jmod file.
|
||||||
@ -185,7 +195,6 @@ public class JmodFile implements AutoCloseable {
|
|||||||
public InputStream getInputStream(Section section, String name)
|
public InputStream getInputStream(Section section, String name)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
String entry = section.jmodDir() + "/" + name;
|
String entry = section.jmodDir() + "/" + name;
|
||||||
ZipEntry e = zipfile.getEntry(entry);
|
ZipEntry e = zipfile.getEntry(entry);
|
||||||
if (e == null) {
|
if (e == null) {
|
||||||
@ -194,6 +203,15 @@ public class JmodFile implements AutoCloseable {
|
|||||||
return zipfile.getInputStream(e);
|
return zipfile.getInputStream(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens an {@code InputStream} for reading an entry in the JMOD file.
|
||||||
|
*
|
||||||
|
* @throws IOException if an I/O error occurs
|
||||||
|
*/
|
||||||
|
public InputStream getInputStream(Entry entry) throws IOException {
|
||||||
|
return zipfile.getInputStream(entry.zipEntry());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a stream of non-directory entries in this jmod file.
|
* Returns a stream of non-directory entries in this jmod file.
|
||||||
*/
|
*/
|
||||||
|
@ -53,6 +53,7 @@ import java.util.Optional;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.jar.Attributes;
|
import java.util.jar.Attributes;
|
||||||
import java.util.jar.Manifest;
|
import java.util.jar.Manifest;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import jdk.internal.module.ModulePatcher.PatchedModuleReader;
|
import jdk.internal.module.ModulePatcher.PatchedModuleReader;
|
||||||
import jdk.internal.misc.VM;
|
import jdk.internal.misc.VM;
|
||||||
@ -144,9 +145,9 @@ public class BuiltinClassLoader
|
|||||||
/**
|
/**
|
||||||
* Create a new instance.
|
* Create a new instance.
|
||||||
*/
|
*/
|
||||||
BuiltinClassLoader(BuiltinClassLoader parent, URLClassPath ucp) {
|
BuiltinClassLoader(String name, BuiltinClassLoader parent, URLClassPath ucp) {
|
||||||
// ensure getParent() returns null when the parent is the boot loader
|
// ensure getParent() returns null when the parent is the boot loader
|
||||||
super(parent == null || parent == ClassLoaders.bootLoader() ? null : parent);
|
super(name, parent == null || parent == ClassLoaders.bootLoader() ? null : parent);
|
||||||
|
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.ucp = ucp;
|
this.ucp = ucp;
|
||||||
@ -749,6 +750,10 @@ public class BuiltinClassLoader
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public Stream<String> list() {
|
||||||
|
return Stream.empty();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
throw new InternalError("Should not get here");
|
throw new InternalError("Should not get here");
|
||||||
}
|
}
|
||||||
|
@ -69,16 +69,17 @@ public class ClassLoaders {
|
|||||||
bcp = toURLClassPath(s);
|
bcp = toURLClassPath(s);
|
||||||
|
|
||||||
// we have a class path if -cp is specified or -m is not specified.
|
// we have a class path if -cp is specified or -m is not specified.
|
||||||
// If neither is specified then default to -cp <working directory>.
|
// If neither is specified then default to -cp <working directory>
|
||||||
|
// If -cp is not specified and -m is specified, the value of
|
||||||
|
// java.class.path is an empty string, then no class path.
|
||||||
URLClassPath ucp = null;
|
URLClassPath ucp = null;
|
||||||
String mainMid = System.getProperty("jdk.module.main");
|
String mainMid = System.getProperty("jdk.module.main");
|
||||||
String cp = System.getProperty("java.class.path");
|
String cp = System.getProperty("java.class.path");
|
||||||
if (mainMid == null && cp == null)
|
if (cp == null)
|
||||||
cp = "";
|
cp = "";
|
||||||
if (cp != null)
|
if (mainMid == null || cp.length() > 0)
|
||||||
ucp = toURLClassPath(cp);
|
ucp = toURLClassPath(cp);
|
||||||
|
|
||||||
|
|
||||||
// create the class loaders
|
// create the class loaders
|
||||||
BOOT_LOADER = new BootClassLoader(bcp);
|
BOOT_LOADER = new BootClassLoader(bcp);
|
||||||
PLATFORM_LOADER = new PlatformClassLoader(BOOT_LOADER);
|
PLATFORM_LOADER = new PlatformClassLoader(BOOT_LOADER);
|
||||||
@ -117,7 +118,7 @@ public class ClassLoaders {
|
|||||||
*/
|
*/
|
||||||
private static class BootClassLoader extends BuiltinClassLoader {
|
private static class BootClassLoader extends BuiltinClassLoader {
|
||||||
BootClassLoader(URLClassPath bcp) {
|
BootClassLoader(URLClassPath bcp) {
|
||||||
super(null, bcp);
|
super(null, null, bcp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -137,7 +138,7 @@ public class ClassLoaders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlatformClassLoader(BootClassLoader parent) {
|
PlatformClassLoader(BootClassLoader parent) {
|
||||||
super(parent, null);
|
super("platform", parent, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,7 +165,7 @@ public class ClassLoaders {
|
|||||||
final URLClassPath ucp;
|
final URLClassPath ucp;
|
||||||
|
|
||||||
AppClassLoader(PlatformClassLoader parent, URLClassPath ucp) {
|
AppClassLoader(PlatformClassLoader parent, URLClassPath ucp) {
|
||||||
super(parent, ucp);
|
super("app", parent, ucp);
|
||||||
this.ucp = ucp;
|
this.ucp = ucp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -534,6 +535,10 @@ public final class Loader extends SecureClassLoader {
|
|||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
public Stream<String> list() {
|
||||||
|
return Stream.empty();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
throw new InternalError("Should not get here");
|
throw new InternalError("Should not get here");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -137,13 +137,20 @@ public class DefaultLoggerFinder extends LoggerFinder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSystem(Module m) {
|
public static boolean isSystem(Module m) {
|
||||||
ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<>() {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public ClassLoader run() {
|
public Boolean run() {
|
||||||
return m.getClassLoader();
|
final ClassLoader moduleCL = m.getClassLoader();
|
||||||
|
if (moduleCL == null) return true;
|
||||||
|
ClassLoader cl = ClassLoader.getPlatformClassLoader();
|
||||||
|
while (cl != null && moduleCL != cl) {
|
||||||
|
cl = cl.getParent();
|
||||||
|
}
|
||||||
|
// returns true if moduleCL is the platform class loader
|
||||||
|
// or one of its ancestors.
|
||||||
|
return moduleCL == cl;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return cl == null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,6 +39,7 @@ import java.util.Collection;
|
|||||||
import java.lang.module.ModuleReader;
|
import java.lang.module.ModuleReader;
|
||||||
import java.lang.module.ModuleReference;
|
import java.lang.module.ModuleReference;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -102,6 +103,11 @@ public interface JavaLangModuleAccess {
|
|||||||
Set<String> packages,
|
Set<String> packages,
|
||||||
ModuleHashes hashes);
|
ModuleHashes hashes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the object with the hashes of other modules
|
||||||
|
*/
|
||||||
|
Optional<ModuleHashes> hashes(ModuleDescriptor descriptor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves a collection of root modules, with service binding
|
* Resolves a collection of root modules, with service binding
|
||||||
* and the empty configuration as the parent. The post resolution
|
* and the empty configuration as the parent. The post resolution
|
||||||
@ -120,8 +126,10 @@ public interface JavaLangModuleAccess {
|
|||||||
Supplier<ModuleReader> readerSupplier);
|
Supplier<ModuleReader> readerSupplier);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the object with the hashes of other modules
|
* Creates a ModuleFinder for a module path.
|
||||||
*/
|
*/
|
||||||
Optional<ModuleHashes> hashes(ModuleDescriptor descriptor);
|
ModuleFinder newModulePath(Runtime.Version version,
|
||||||
|
boolean isLinkPhase,
|
||||||
|
Path... entries);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,15 @@ public final class ModuleInfoWriter {
|
|||||||
cw.visit(Opcodes.V1_9, ACC_MODULE, name, null, null, null);
|
cw.visit(Opcodes.V1_9, ACC_MODULE, name, null, null, null);
|
||||||
|
|
||||||
cw.visitAttribute(new ModuleAttribute(md));
|
cw.visitAttribute(new ModuleAttribute(md));
|
||||||
cw.visitAttribute(new ConcealedPackagesAttribute(md.conceals()));
|
|
||||||
|
// for tests: write the ConcealedPackages attribute when there are non-exported packages
|
||||||
|
long nExportedPackages = md.exports().stream()
|
||||||
|
.map(ModuleDescriptor.Exports::source)
|
||||||
|
.distinct()
|
||||||
|
.count();
|
||||||
|
if (md.packages().size() > nExportedPackages)
|
||||||
|
cw.visitAttribute(new ConcealedPackagesAttribute(md.packages()));
|
||||||
|
|
||||||
md.version().ifPresent(v -> cw.visitAttribute(new VersionAttribute(v)));
|
md.version().ifPresent(v -> cw.visitAttribute(new VersionAttribute(v)));
|
||||||
md.mainClass().ifPresent(mc -> cw.visitAttribute(new MainClassAttribute(mc)));
|
md.mainClass().ifPresent(mc -> cw.visitAttribute(new MainClassAttribute(mc)));
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ import java.util.Optional;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import jdk.internal.loader.Resource;
|
import jdk.internal.loader.Resource;
|
||||||
import jdk.internal.misc.JavaLangModuleAccess;
|
import jdk.internal.misc.JavaLangModuleAccess;
|
||||||
@ -159,21 +160,19 @@ public final class ModulePatcher {
|
|||||||
// is not supported by the boot class loader
|
// is not supported by the boot class loader
|
||||||
try (JarFile jf = new JarFile(file.toFile())) {
|
try (JarFile jf = new JarFile(file.toFile())) {
|
||||||
jf.stream()
|
jf.stream()
|
||||||
.filter(e -> e.getName().endsWith(".class"))
|
|
||||||
.map(e -> toPackageName(file, e))
|
.map(e -> toPackageName(file, e))
|
||||||
.filter(pn -> pn.length() > 0)
|
.filter(Checks::isJavaIdentifier)
|
||||||
.forEach(packages::add);
|
.forEach(packages::add);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (Files.isDirectory(file)) {
|
} else if (Files.isDirectory(file)) {
|
||||||
|
|
||||||
// exploded directory
|
// exploded directory without following sym links
|
||||||
Path top = file;
|
Path top = file;
|
||||||
Files.find(top, Integer.MAX_VALUE,
|
Files.find(top, Integer.MAX_VALUE,
|
||||||
((path, attrs) -> attrs.isRegularFile() &&
|
((path, attrs) -> attrs.isRegularFile()))
|
||||||
path.toString().endsWith(".class")))
|
|
||||||
.map(path -> toPackageName(top, path))
|
.map(path -> toPackageName(top, path))
|
||||||
.filter(pn -> pn.length() > 0)
|
.filter(Checks::isJavaIdentifier)
|
||||||
.forEach(packages::add);
|
.forEach(packages::add);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -380,6 +379,15 @@ public final class ModulePatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<String> list() throws IOException {
|
||||||
|
Stream<String> s = delegate().list();
|
||||||
|
for (ResourceFinder finder : finders) {
|
||||||
|
s = Stream.concat(s, finder.list());
|
||||||
|
}
|
||||||
|
return s.distinct();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
closeAll(finders);
|
closeAll(finders);
|
||||||
@ -393,6 +401,7 @@ public final class ModulePatcher {
|
|||||||
*/
|
*/
|
||||||
private static interface ResourceFinder extends Closeable {
|
private static interface ResourceFinder extends Closeable {
|
||||||
Resource find(String name) throws IOException;
|
Resource find(String name) throws IOException;
|
||||||
|
Stream<String> list() throws IOException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -453,6 +462,13 @@ public final class ModulePatcher {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<String> list() throws IOException {
|
||||||
|
return jf.stream()
|
||||||
|
.filter(e -> !e.isDirectory())
|
||||||
|
.map(JarEntry::getName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -527,6 +543,15 @@ public final class ModulePatcher {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<String> list() throws IOException {
|
||||||
|
return Files.find(dir, Integer.MAX_VALUE,
|
||||||
|
(path, attrs) -> attrs.isRegularFile())
|
||||||
|
.map(f -> dir.relativize(f)
|
||||||
|
.toString()
|
||||||
|
.replace(File.separatorChar, '/'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -537,7 +562,7 @@ public final class ModulePatcher {
|
|||||||
Path entry = top.relativize(file);
|
Path entry = top.relativize(file);
|
||||||
Path parent = entry.getParent();
|
Path parent = entry.getParent();
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
return warnUnnamedPackage(top, entry.toString());
|
return warnIfModuleInfo(top, entry.toString());
|
||||||
} else {
|
} else {
|
||||||
return parent.toString().replace(File.separatorChar, '.');
|
return parent.toString().replace(File.separatorChar, '.');
|
||||||
}
|
}
|
||||||
@ -557,14 +582,15 @@ public final class ModulePatcher {
|
|||||||
String name = entry.getName();
|
String name = entry.getName();
|
||||||
int index = name.lastIndexOf("/");
|
int index = name.lastIndexOf("/");
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
return warnUnnamedPackage(file, name);
|
return warnIfModuleInfo(file, name);
|
||||||
} else {
|
} else {
|
||||||
return name.substring(0, index).replace('/', '.');
|
return name.substring(0, index).replace('/', '.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String warnUnnamedPackage(Path file, String e) {
|
private static String warnIfModuleInfo(Path file, String e) {
|
||||||
System.err.println("WARNING: " + e + " not allowed in patch: " + file);
|
if (e.equals("module-info.class"))
|
||||||
|
System.err.println("WARNING: " + e + " ignored in patch: " + file);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,6 +364,16 @@ public class ReflectionFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final Constructor<?> newConstructorForSerialization(Class<?> cl,
|
||||||
|
Constructor<?> constructorToCall)
|
||||||
|
{
|
||||||
|
if (constructorToCall.getDeclaringClass() == cl) {
|
||||||
|
constructorToCall.setAccessible(true);
|
||||||
|
return constructorToCall;
|
||||||
|
}
|
||||||
|
return generateConstructor(cl, constructorToCall);
|
||||||
|
}
|
||||||
|
|
||||||
public final Constructor<?> newConstructorForSerialization(Class<?> cl) {
|
public final Constructor<?> newConstructorForSerialization(Class<?> cl) {
|
||||||
Class<?> initCl = cl;
|
Class<?> initCl = cl;
|
||||||
while (Serializable.class.isAssignableFrom(initCl)) {
|
while (Serializable.class.isAssignableFrom(initCl)) {
|
||||||
@ -383,6 +393,12 @@ public class ReflectionFactory {
|
|||||||
} catch (NoSuchMethodException ex) {
|
} catch (NoSuchMethodException ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
return generateConstructor(cl, constructorToCall);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Constructor<?> generateConstructor(Class<?> cl,
|
||||||
|
Constructor<?> constructorToCall) {
|
||||||
|
|
||||||
|
|
||||||
ConstructorAccessor acc = new MethodAccessorGenerator().
|
ConstructorAccessor acc = new MethodAccessorGenerator().
|
||||||
generateSerializationConstructor(cl,
|
generateSerializationConstructor(cl,
|
||||||
|
@ -196,7 +196,8 @@ module java.base {
|
|||||||
jdk.vm.ci;
|
jdk.vm.ci;
|
||||||
exports jdk.internal.util.jar to
|
exports jdk.internal.util.jar to
|
||||||
jdk.jartool,
|
jdk.jartool,
|
||||||
jdk.jdeps;
|
jdk.jdeps,
|
||||||
|
jdk.jlink;
|
||||||
exports jdk.internal.vm to
|
exports jdk.internal.vm to
|
||||||
java.management,
|
java.management,
|
||||||
jdk.jvmstat;
|
jdk.jvmstat;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,7 +31,7 @@ java.launcher.opt.header = Usage: {0} [options] class [args...]\n\
|
|||||||
\ (to execute the main class in a module)\n\
|
\ (to execute the main class in a module)\n\
|
||||||
where options include:\n
|
where options include:\n
|
||||||
|
|
||||||
java.launcher.opt.datamodel =\ -d{0}\t use a {0}-bit data model if available\n
|
java.launcher.opt.datamodel =\ -d{0}\t Deprecated, will be removed in a future release\n
|
||||||
java.launcher.opt.vmselect =\ {0}\t to select the "{1}" VM\n
|
java.launcher.opt.vmselect =\ {0}\t to select the "{1}" VM\n
|
||||||
java.launcher.opt.hotspot =\ {0}\t is a synonym for the "{1}" VM [deprecated]\n
|
java.launcher.opt.hotspot =\ {0}\t is a synonym for the "{1}" VM [deprecated]\n
|
||||||
|
|
||||||
@ -95,6 +95,12 @@ java.launcher.opt.footer =\ -cp <class search path of directories and zip
|
|||||||
\ load Java programming language agent, see java.lang.instrument\n\
|
\ load Java programming language agent, see java.lang.instrument\n\
|
||||||
\ -splash:<imagepath>\n\
|
\ -splash:<imagepath>\n\
|
||||||
\ show splash screen with specified image\n\
|
\ show splash screen with specified image\n\
|
||||||
|
\ HiDPI scaled images are automatically supported and used\n\
|
||||||
|
\ if available. The unscaled image filename, e.g. image.ext,\n\
|
||||||
|
\ should always be passed as the argument to the -splash option.\n\
|
||||||
|
\ The most appropriate scaled image provided will be picked up\n\
|
||||||
|
\ automatically.\n\
|
||||||
|
\ See the SplashScreen API documentation for more information.\n\
|
||||||
\ @<filepath> read options from the specified file\n\
|
\ @<filepath> read options from the specified file\n\
|
||||||
\To specify an argument for a long option, you can use --<name>=<value> or\n\
|
\To specify an argument for a long option, you can use --<name>=<value> or\n\
|
||||||
\--<name> <value>.\n\
|
\--<name> <value>.\n\
|
||||||
|
@ -253,20 +253,20 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String toSourceString(char c) {
|
private static String toSourceString(char c) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder(4);
|
||||||
sb.append("'");
|
sb.append('\'');
|
||||||
if (c == '\'')
|
if (c == '\'')
|
||||||
sb.append("\\'");
|
sb.append("\\'");
|
||||||
else
|
else
|
||||||
sb.append(c);
|
sb.append(c);
|
||||||
sb.append("'");
|
return sb.append('\'')
|
||||||
return sb.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String toSourceString(long ell) {
|
private static String toSourceString(long ell) {
|
||||||
return (Math.abs(ell) <= Integer.MAX_VALUE) ?
|
String str = String.valueOf(ell);
|
||||||
String.valueOf(ell) :
|
return (ell < Integer.MIN_VALUE || ell > Integer.MAX_VALUE)
|
||||||
(String.valueOf(ell) + "L");
|
? (str + 'L') : str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -278,10 +278,7 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
|||||||
sb.append('"');
|
sb.append('"');
|
||||||
// Escape embedded quote characters, if present, but don't do
|
// Escape embedded quote characters, if present, but don't do
|
||||||
// anything more heroic.
|
// anything more heroic.
|
||||||
if (s.indexOf('"') != -1) {
|
sb.append(s.replace("\"", "\\\""));
|
||||||
s = s.replace("\"", "\\\"");
|
|
||||||
}
|
|
||||||
sb.append(s);
|
|
||||||
sb.append('"');
|
sb.append('"');
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -279,6 +279,16 @@ final class DTLSOutputRecord extends OutputRecord implements DTLSRecord {
|
|||||||
fragmenter = null;
|
fragmenter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void launchRetransmission() {
|
||||||
|
// Note: Please don't retransmit if there are handshake messages
|
||||||
|
// or alerts waiting in the queue.
|
||||||
|
if (((alertMemos == null) || alertMemos.isEmpty()) &&
|
||||||
|
(fragmenter != null) && fragmenter.isRetransmittable()) {
|
||||||
|
fragmenter.setRetransmission();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// buffered record fragment
|
// buffered record fragment
|
||||||
private static class RecordMemo {
|
private static class RecordMemo {
|
||||||
byte contentType;
|
byte contentType;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -84,4 +84,18 @@ interface DTLSRecord extends Record {
|
|||||||
+ maxPadding // padding
|
+ maxPadding // padding
|
||||||
+ maxMacSize; // MAC
|
+ maxMacSize; // MAC
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Minimum record size of Certificate handshake message.
|
||||||
|
* Client sends a certificate message containing no certificates if no
|
||||||
|
* suitable certificate is available. That is, the certificate_list
|
||||||
|
* structure has a length of zero.
|
||||||
|
*
|
||||||
|
* struct {
|
||||||
|
* ASN.1Cert certificate_list<0..2^24-1>;
|
||||||
|
* } Certificate;
|
||||||
|
*/
|
||||||
|
static final int minCertPlaintextSize =
|
||||||
|
headerSize // record header
|
||||||
|
+ handshakeHeaderSize // handshake header
|
||||||
|
+ 3; // cert list length
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user