changeset 14885:d8a3d99c0350 icedtea-3.18.0

Merge jdk8u282-ga
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Wed, 03 Feb 2021 05:23:32 +0000
parents ab3a1c66dc7e (current diff) d8cb8035b8f3 (diff)
children db954ee0f1e4
files .hgtags THIRD_PARTY_README make/CompileLaunchers.gmk make/Images.gmk make/data/tzdata/VERSION make/data/tzdata/africa make/data/tzdata/antarctica make/data/tzdata/asia make/data/tzdata/australasia make/data/tzdata/europe make/data/tzdata/leapseconds make/data/tzdata/northamerica make/data/tzdata/southamerica make/gensrc/GensrcMisc.gmk make/lib/CoreLibraries.gmk make/mapfiles/libawt_xawt/mapfile-vers make/mapfiles/libjava/mapfile-vers make/mapfiles/libmanagement/mapfile-vers src/share/classes/com/sun/management/ThreadMXBean.java src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SKI.java src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java src/share/classes/java/lang/management/ThreadMXBean.java src/share/classes/java/net/URI.java src/share/classes/java/nio/X-Buffer.java.template src/share/classes/java/util/concurrent/ForkJoinPool.java src/share/classes/javax/swing/JSpinner.java src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java src/share/classes/org/jcp/xml/dsig/internal/dom/DOMHMACSignatureMethod.java src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java src/share/classes/sun/util/calendar/ZoneInfoFile.java src/share/classes/sun/util/resources/TimeZoneNames.java src/share/classes/sun/util/resources/de/TimeZoneNames_de.java src/share/classes/sun/util/resources/es/TimeZoneNames_es.java src/share/classes/sun/util/resources/fr/TimeZoneNames_fr.java src/share/classes/sun/util/resources/it/TimeZoneNames_it.java src/share/classes/sun/util/resources/ja/TimeZoneNames_ja.java src/share/classes/sun/util/resources/ko/TimeZoneNames_ko.java src/share/classes/sun/util/resources/pt/TimeZoneNames_pt_BR.java src/share/classes/sun/util/resources/sv/TimeZoneNames_sv.java src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_CN.java src/share/classes/sun/util/resources/zh/TimeZoneNames_zh_TW.java src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java src/share/javavm/export/jmm.h src/share/native/sun/java2d/cmm/lcms/cmscgats.c src/share/native/sun/java2d/cmm/lcms/cmsio0.c src/share/native/sun/java2d/cmm/lcms/cmslut.c src/share/native/sun/java2d/cmm/lcms/cmstypes.c src/share/native/sun/java2d/cmm/lcms/cmsxform.c src/solaris/bin/java_md_solinux.c src/windows/native/sun/windows/awt_DnDDS.cpp src/windows/native/sun/windows/awt_Toolkit.cpp test/ProblemList.txt test/demo/zipfs/ZipFSTester.java test/java/awt/DataFlavor/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java test/java/awt/DataFlavor/MissedHtmlAndRtfBug/DataFlavorSearcher.java test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MyTransferable.java test/java/awt/DataFlavor/MissedHtmlAndRtfBug/NextFramePositionCalculator.java test/java/awt/DataFlavor/MissedHtmlAndRtfBug/SourcePanel.java test/java/awt/DataFlavor/MissedHtmlAndRtfBug/TargetPanel.java test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java test/java/awt/Toolkit/Headless/WrappedToolkitTest/WrappedToolkitTest.sh test/java/awt/Window/TranslucentJAppletTest/TranslucentJAppletTest.java test/java/awt/datatransfer/DuplicatedNativesTest/DuplicatedNativesTest.java test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java test/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java test/java/awt/regtesthelpers/Util.java test/javax/sound/sampled/DirectAudio/bug6400879.java test/javax/swing/JComponent/6683775/bug6683775.java test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java test/javax/swing/JRadioButton/8033699/bug8033699.java test/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java test/jdk/internal/platform/docker/Dockerfile-BasicTest test/jdk/internal/platform/docker/Dockerfile-BasicTest-aarch64 test/jdk/internal/platform/docker/Dockerfile-BasicTest-ppc64le test/jdk/internal/platform/docker/Dockerfile-BasicTest-s390x test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java test/sun/security/pkcs11/PKCS11Test.java test/sun/security/pkcs11/Secmod/TestNssDbSqlite.java test/sun/text/resources/LocaleData test/sun/text/resources/LocaleDataTest.java test/sun/util/calendar/zi/tzdata/VERSION test/sun/util/calendar/zi/tzdata/africa test/sun/util/calendar/zi/tzdata/antarctica test/sun/util/calendar/zi/tzdata/asia test/sun/util/calendar/zi/tzdata/australasia test/sun/util/calendar/zi/tzdata/europe test/sun/util/calendar/zi/tzdata/leapseconds test/sun/util/calendar/zi/tzdata/northamerica test/sun/util/calendar/zi/tzdata/southamerica
diffstat 257 files changed, 7465 insertions(+), 2860 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Jan 19 17:18:23 2021 +0000
+++ b/.hgtags	Wed Feb 03 05:23:32 2021 +0000
@@ -1136,13 +1136,23 @@
 4d586f39fed361c94475772d9b638fb3cccd8e00 jdk8u272-b04
 edb84bd2f10f7a0fcc68dc5a27fc739403ce32f2 jdk8u272-b05
 4546aa3faf3776f92aaa7f70233846d0d2907068 jdk8u272-b06
+4546aa3faf3776f92aaa7f70233846d0d2907068 jdk8u282-b00
 d8bd882cfd2ae393e7dbffed7fbd455449c32d88 jdk8u272-b07
 ab2e99db67029a5505934895831561bb39a8ca31 jdk8u272-b08
 77b682e2d679a13ed7fbb8343f5b2ac1ddee1300 jdk8u272-b09
 badfd40f15ac56deecb250cc14735974c3e41611 jdk8u272-b10
 badfd40f15ac56deecb250cc14735974c3e41611 jdk8u272-ga
 efb8a0718403427e144d7586b9b94295261f76df icedtea-3.17.0
+4c5dceabd4c63b9c43b024418a5946765049d6eb jdk8u282-b01
 badfd40f15ac56deecb250cc14735974c3e41611 jdk8u275-b00
 efb922cd7ac475a882ae6d941f4f3072bec01b7a jdk8u275-b01
 efb922cd7ac475a882ae6d941f4f3072bec01b7a jdk8u275-ga
 2207d468c781d11b9135ad2008ce4b4f8af923e4 icedtea-3.17.1
+3d2b77f2c2fd2218118610cf5891d03007d24fff jdk8u282-b02
+23add259af02b0b860e990c2e2030ab52faaaf25 jdk8u282-b03
+78c875107d40690f05751ea7bf16cb7766edd51d jdk8u282-b04
+25cd39ef5b983c7199ce9954b7e2723eae097fe0 jdk8u282-b05
+ef358e4669db1e22ae8939683e6801f4a9d5369b jdk8u282-b06
+aa9f038a703421ab7e3daf7bb3190fab1ab11681 jdk8u282-b07
+6fe9792e7893a43c0718cf6d5082f62f9bc52787 jdk8u282-b08
+6fe9792e7893a43c0718cf6d5082f62f9bc52787 jdk8u282-ga
--- a/THIRD_PARTY_README	Tue Jan 19 17:18:23 2021 +0000
+++ b/THIRD_PARTY_README	Wed Feb 03 05:23:32 2021 +0000
@@ -154,12 +154,12 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to CUP Parser Generator for 
-Java 0.10k, which may be included with JRE 8, JDK 8, and OpenJDK 8.
+%% This notice is provided with respect to CUP Parser Generator for
+Java 0.10b, which may be included with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
 
-Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian
+Copyright 1996-2015 by Scott Hudson, Frank Flannery, C. Scott Ananian, Michael Petter
 
 Permission to use, copy, modify, and distribute this software and its
 documentation for any purpose and without fee is hereby granted, provided
@@ -1672,13 +1672,13 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to Little CMS 2.9, which may be
+%% This notice is provided with respect to Little CMS 2.11, which may be
 included with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
 
 Little CMS
-Copyright (c) 1998-2011 Marti Maria Saguer
+Copyright (c) 1998-2020 Marti Maria Saguer
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
@@ -3028,7 +3028,7 @@
   Apache Commons Math 3.2
   Apache Derby 10.11.1.2
   Apache Jakarta BCEL 5.1 
-  Apache Santuario XML Security for Java 2.1.1
+  Apache Santuario XML Security for Java 2.1.3
   Apache Xalan-Java 2.7.2
   Apache Xerces Java 2.10.0 
   Apache XML Resolver 1.1 
--- a/make/CompileLaunchers.gmk	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/CompileLaunchers.gmk	Wed Feb 03 05:23:32 2021 +0000
@@ -231,7 +231,29 @@
 	$(RM) $@
 	$(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
 
+ifeq ($(ZIP_DEBUGINFO_FILES), true)
+  DEBUGINFO_EXT := .diz
+else ifeq ($(OPENJDK_TARGET_OS), macosx)
+  DEBUGINFO_EXT := .dSYM
+else ifeq ($(OPENJDK_TARGET_OS), windows)
+  DEBUGINFO_EXT := .pdb
+else
+  DEBUGINFO_EXT := .debuginfo
+endif
+
+$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(DEBUGINFO_EXT): $(BUILD_LAUNCHER_java)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(CP) -R $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/java$(DEBUGINFO_EXT) $@
+
 BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)
+ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+  ifneq ($(POST_STRIP_CMD), )
+    ifneq ($(STRIP_POLICY), no_strip)
+      BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(DEBUGINFO_EXT)
+    endif
+  endif
+endif
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
   $(eval $(call SetupLauncher,javaw, \
@@ -462,6 +484,7 @@
 ifeq ($(OPENJDK_TARGET_OS), solaris)
   UNPACKEXE_LANG := C++
 endif
+UNPACKEXE_DEBUG_SYMBOLS := true
 # On windows, unpack200 is linked completely differently to all other
 # executables, using the compiler with the compiler arguments.
 # It's also linked incrementally, producing a .ilk file that needs to
@@ -470,6 +493,9 @@
   BUILD_UNPACKEXE_LDEXE := $(CC)
   EXE_OUT_OPTION_save := $(EXE_OUT_OPTION)
   EXE_OUT_OPTION := -Fe
+  # With the current way unpack200 is built, debug symbols aren't supported
+  # anyway.
+  UNPACKEXE_DEBUG_SYMBOLS :=
 endif
 
 # The linker on older SuSE distros (e.g. on SLES 10) complains with:
@@ -509,7 +535,7 @@
         -D "JDK_FNAME=unpack200.exe" \
         -D "JDK_INTERNAL_NAME=unpack200" \
         -D "JDK_FTYPE=0x1L", \
-    DEBUG_SYMBOLS := true, \
+    DEBUG_SYMBOLS := $(UNPACKEXE_DEBUG_SYMBOLS), \
     MANIFEST := $(JDK_TOPDIR)/src/windows/resource/unpack200_proto.exe.manifest))
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
@@ -529,7 +555,17 @@
 $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
 	$(call install-file)
 
+$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(DEBUGINFO_EXT): $(BUILD_UNPACKEXE)
+	$(call install-file)
+
 BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX)
+ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+  ifneq ($(POST_STRIP_CMD), )
+    ifneq ($(STRIP_POLICY), no_strip)
+      BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(DEBUGINFO_EXT)
+    endif
+  endif
+endif
 
 ##########################################################################################
 
--- a/make/Images.gmk	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/Images.gmk	Wed Feb 03 05:23:32 2021 +0000
@@ -77,6 +77,16 @@
   $4 += $2/$$($2_$3_FILE)
 endef
 
+ifeq ($(ZIP_DEBUGINFO_FILES), true)
+  DEBUGINFO_EXT := .diz
+else ifeq ($(OPENJDK_TARGET_OS), macosx)
+  DEBUGINFO_EXT := .dSYM
+else ifeq ($(OPENJDK_TARGET_OS), windows)
+  DEBUGINFO_EXT := .pdb
+else
+  DEBUGINFO_EXT := .debuginfo
+endif
+
 ################################################################################
 #
 # JRE and JDK build rules
@@ -129,6 +139,7 @@
       clhsdb$(EXE_SUFFIX) \
       hsdb$(EXE_SUFFIX) \
       jfr$(EXE_SUFFIX)
+  NOT_JRE_DEBUGINFO_FILES := $(patsubst %$(EXE_SUFFIX),%$(DEBUGINFO_EXT),$(NOT_JRE_BIN_FILES))
 endif
 
 WINDOWS_JDK_BIN_FILES = \
@@ -146,11 +157,7 @@
 # Prevent sjavac from entering the images.
 ALL_BIN_LIST := $(filter-out %/sjavac, $(ALL_BIN_LIST))
 
-# For unknown reason the debuginfo files for executables are not put into images
-# e.g filter them out
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
-else
+ifeq ($(OPENJDK_TARGET_OS), windows)
   # On windows, the libraries are in the bin dir, only filter out debuginfo files
   # for executables. "java" is both a library and executable.
   ALL_BIN_EXEC_FILES := $(filter-out java.exe, $(notdir $(filter %.exe, $(ALL_BIN_LIST))))
@@ -160,7 +167,7 @@
 endif
 
 JDKJRE_BIN_LIST := $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES)), $(ALL_BIN_LIST))
-JRE_BIN_LIST := $(filter-out $(addprefix %, $(WINDOWS_JDKJRE_BIN_FILES)), $(JDKJRE_BIN_LIST))
+JRE_BIN_LIST := $(filter-out $(addprefix %, $(WINDOWS_JDKJRE_BIN_FILES)) $(addprefix %, $(NOT_JRE_DEBUGINFO_FILES)), $(JDKJRE_BIN_LIST))
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
   JDK_BIN_LIST := $(filter $(addprefix %, $(WINDOWS_JDK_BIN_FILES)), $(ALL_BIN_LIST))
--- a/make/data/tzdata/VERSION	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/data/tzdata/VERSION	Wed Feb 03 05:23:32 2021 +0000
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2020b
+tzdata2020d
--- a/make/data/tzdata/asia	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/data/tzdata/asia	Wed Feb 03 05:23:32 2021 +0000
@@ -3244,13 +3244,40 @@
 
 # From Sharef Mustafa (2019-10-18):
 # Palestine summer time will end on midnight Oct 26th 2019 ...
-# http://www.palestinecabinet.gov.ps/website/ar/ViewDetails?ID=43948
+#
+# From Steffen Thorsen (2020-10-20):
+# Some sources such as these say, and display on clocks, that DST ended at
+# midnight last year...
+# https://www.amad.ps/ar/post/320006
+#
+# From Tim Parenti (2020-10-20):
+# The report of the Palestinian Cabinet meeting of 2019-10-14 confirms
+# a decision on (translated): "The start of the winter time in Palestine, by
+# delaying the clock by sixty minutes, starting from midnight on Friday /
+# Saturday corresponding to 26/10/2019."
+# http://www.palestinecabinet.gov.ps/portal/meeting/details/43948
+
+# From Sharef Mustafa (2020-10-20):
+# As per the palestinian cabinet announcement yesterday , the day light saving
+# shall [end] on Oct 24th 2020 at 01:00AM by delaying the clock by 60 minutes.
+# http://www.palestinecabinet.gov.ps/portal/Meeting/Details/51584
+
+# From Tim Parenti (2020-10-20):
+# Predict future fall transitions at 01:00 on the Saturday preceding October's
+# last Sunday (i.e., Sat>=24).  This is consistent with our predictions since
+# 2016, although the time of the change differed slightly in 2019.
+
+# From Pierre Cashon (2020-10-20):
+# The summer time this year started on March 28 at 00:00.
+# https://wafa.ps/ar_page.aspx?id=GveQNZa872839351758aGveQNZ
+# http://www.palestinecabinet.gov.ps/portal/meeting/details/50284
+# The winter time in 2015 started on October 23 at 01:00.
+# https://wafa.ps/ar_page.aspx?id=CgpCdYa670694628582aCgpCdY
+# http://www.palestinecabinet.gov.ps/portal/meeting/details/27583
 #
 # From Paul Eggert (2019-04-10):
-# For now, guess spring-ahead transitions are March's last Friday at 00:00.
-#
-# From Tim Parenti (2016-10-19):
-# Predict fall transitions on October's last Saturday at 01:00 from now on.
+# For now, guess spring-ahead transitions are at 00:00 on the Saturday
+# preceding March's last Sunday (i.e., Sat>=24).
 
 # Rule	NAME	FROM	TO	-	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -3266,10 +3293,10 @@
 Rule Palestine	2005	only	-	Oct	 4	2:00	0	-
 Rule Palestine	2006	2007	-	Apr	 1	0:00	1:00	S
 Rule Palestine	2006	only	-	Sep	22	0:00	0	-
-Rule Palestine	2007	only	-	Sep	Thu>=8	2:00	0	-
+Rule Palestine	2007	only	-	Sep	13	2:00	0	-
 Rule Palestine	2008	2009	-	Mar	lastFri	0:00	1:00	S
 Rule Palestine	2008	only	-	Sep	 1	0:00	0	-
-Rule Palestine	2009	only	-	Sep	Fri>=1	1:00	0	-
+Rule Palestine	2009	only	-	Sep	 4	1:00	0	-
 Rule Palestine	2010	only	-	Mar	26	0:00	1:00	S
 Rule Palestine	2010	only	-	Aug	11	0:00	0	-
 Rule Palestine	2011	only	-	Apr	 1	0:01	1:00	S
@@ -3278,12 +3305,16 @@
 Rule Palestine	2011	only	-	Sep	30	0:00	0	-
 Rule Palestine	2012	2014	-	Mar	lastThu	24:00	1:00	S
 Rule Palestine	2012	only	-	Sep	21	1:00	0	-
-Rule Palestine	2013	only	-	Sep	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	2013	only	-	Sep	27	0:00	0	-
+Rule Palestine	2014	only	-	Oct	24	0:00	0	-
+Rule Palestine	2015	only	-	Mar	28	0:00	1:00	S
+Rule Palestine	2015	only	-	Oct	23	1:00	0	-
 Rule Palestine	2016	2018	-	Mar	Sat>=24	1:00	1:00	S
-Rule Palestine	2016	max	-	Oct	lastSat	1:00	0	-
-Rule Palestine	2019	max	-	Mar	lastFri	0:00	1:00	S
+Rule Palestine	2016	2018	-	Oct	Sat>=24	1:00	0	-
+Rule Palestine	2019	only	-	Mar	29	0:00	1:00	S
+Rule Palestine	2019	only	-	Oct	Sat>=24	0:00	0	-
+Rule Palestine	2020	max	-	Mar	Sat>=24	0:00	1:00	S
+Rule Palestine	2020	max	-	Oct	Sat>=24	1:00	0	-
 
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct
--- a/make/data/tzdata/australasia	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/data/tzdata/australasia	Wed Feb 03 05:23:32 2021 +0000
@@ -404,6 +404,19 @@
 # From Michael Deckers (2019-08-06):
 # https://www.laws.gov.fj/LawsAsMade/downloadfile/848
 
+# From Raymond Kumar (2020-10-08):
+# [DST in Fiji] is from December 20th 2020, till 17th January 2021.
+# From Alan Mintz (2020-10-08):
+# https://www.laws.gov.fj/LawsAsMade/GetFile/1071
+# From Tim Parenti (2020-10-08):
+# https://www.fijivillage.com/news/Daylight-saving-from-Dec-20th-this-year-to-Jan-17th-2021-8rf4x5/
+# "Minister for Employment, Parveen Bala says they had never thought of
+# stopping daylight saving. He says it was just to decide on when it should
+# start and end.  Bala says it is a short period..."
+# Since the end date is still in line with our ongoing predictions, assume for
+# now that the later-than-usual start date is a one-time departure from the
+# recent second Sunday in November pattern.
+
 # Rule	NAME	FROM	TO	-	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	-
 Rule	Fiji	1999	2000	-	Feb	lastSun	3:00	0	-
@@ -415,7 +428,9 @@
 Rule	Fiji	2014	only	-	Jan	Sun>=18	2:00	0	-
 Rule	Fiji	2014	2018	-	Nov	Sun>=1	2:00	1:00	-
 Rule	Fiji	2015	max	-	Jan	Sun>=12	3:00	0	-
-Rule	Fiji	2019	max	-	Nov	Sun>=8	2:00	1:00	-
+Rule	Fiji	2019	only	-	Nov	Sun>=8	2:00	1:00	-
+Rule	Fiji	2020	only	-	Dec	20	2:00	1:00	-
+Rule	Fiji	2021	max	-	Nov	Sun>=8	2:00	1:00	-
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26 # Suva
 			12:00	Fiji	+12/+13
--- a/make/data/tzdata/europe	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/data/tzdata/europe	Wed Feb 03 05:23:32 2021 +0000
@@ -1052,17 +1052,16 @@
 # Denmark, Faroe Islands, and Greenland
 
 # From Jesper Nørgaard Welen (2005-04-26):
-# http://www.hum.aau.dk/~poe/tid/tine/DanskTid.htm says that the law
-# [introducing standard time] was in effect from 1894-01-01....
-# The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL
+# the law [introducing standard time] was in effect from 1894-01-01....
+# The page https://www.retsinformation.dk/eli/lta/1893/83
 # confirms this, and states that the law was put forth 1893-03-29.
 #
 # The EU [actually, EEC and Euratom] treaty with effect from 1973:
-# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL
+# https://www.retsinformation.dk/eli/lta/1972/21100
 #
 # This provoked a new law from 1974 to make possible summer time changes
 # in subsequent decrees with the law
-# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19740022330-REGL
+# https://www.retsinformation.dk/eli/lta/1974/223
 #
 # It seems however that no decree was set forward until 1980.  I have
 # not found any decree, but in another related law, the effecting DST
@@ -1074,7 +1073,7 @@
 # The law is about the management of the extra hour, concerning
 # working hours reported and effect on obligatory-rest rules (which
 # was suspended on that night):
-# http://www.retsinfo.dk/_GETDOCI_/ACCN/C19801120554-REGL
+# https://web.archive.org/web/20140104053304/https://www.retsinformation.dk/Forms/R0710.aspx?id=60267
 
 # From Jesper Nørgaard Welen (2005-06-11):
 # The Herning Folkeblad (1980-09-26) reported that the night between
@@ -1612,6 +1611,8 @@
 # https://library.hungaricana.hu/hu/view/Zala_1948_09/?pg=64
 # https://library.hungaricana.hu/hu/view/SatoraljaujhelyiLeveltar_ZempleniNepujsag_1948/?pg=53
 # https://library.hungaricana.hu/hu/view/SatoraljaujhelyiLeveltar_ZempleniNepujsag_1948/?pg=160
+# https://library.hungaricana.hu/hu/view/UjSzo_1949_01-04/?pg=102
+# https://library.hungaricana.hu/hu/view/KeletMagyarorszag_1949_03/?pg=96
 # https://library.hungaricana.hu/hu/view/Delmagyarorszag_1949_09/?pg=94
 Rule	Hungary	1947	1949	-	Apr	Sun>=4	 2:00s	1:00	S
 Rule	Hungary	1947	1949	-	Oct	Sun>=1	 2:00s	0	-
@@ -1627,9 +1628,10 @@
 # https://library.hungaricana.hu/hu/view/PestMegyeiHirlap_1957_09/?pg=143
 Rule	Hungary	1956	1957	-	Jun	Sun>=1	 2:00	1:00	S
 Rule	Hungary	1956	1957	-	Sep	lastSun	 3:00	0	-
-# https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1980/?pg=1227
+# https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1980/?pg=189
 Rule	Hungary	1980	only	-	Apr	 6	 0:00	1:00	S
 Rule	Hungary	1980	only	-	Sep	28	 1:00	0	-
+# https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1980/?pg=1227
 # https://library.hungaricana.hu/hu/view/Delmagyarorszag_1981_01/?pg=79
 # https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1982/?pg=115
 # https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1983/?pg=85
@@ -1640,6 +1642,7 @@
 Zone	Europe/Budapest	1:16:20 -	LMT	1890 Nov  1
 			1:00	C-Eur	CE%sT	1918
 # https://library.hungaricana.hu/hu/view/OGYK_RT_1941/?pg=1204
+# https://library.hungaricana.hu/hu/view/OGYK_RT_1942/?pg=3955
 			1:00	Hungary	CE%sT	1941 Apr  7 23:00
 			1:00	C-Eur	CE%sT	1945
 			1:00	Hungary	CE%sT	1984
--- a/make/lib/CoreLibraries.gmk	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/lib/CoreLibraries.gmk	Wed Feb 03 05:23:32 2021 +0000
@@ -158,7 +158,12 @@
 endif
 
 # Make it possible to override this variable
-LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers
+ifeq ($(OPENJDK_TARGET_OS), linux)
+  # Linux-only symbol Java_jdk_internal_platform_cgroupv1_Metrics_isUseContainerSupport
+  LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-linux
+else
+  LIBJAVA_MAPFILE ?= $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers
+endif
 
 LIBJAVA_CFLAGS := $(foreach dir, $(LIBJAVA_SRC_DIRS), -I$(dir)) \
     -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include \
@@ -335,16 +340,6 @@
 
 BUILD_LIBRARIES += $(BUILD_LIBUNPACK)
 
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.map: $(BUILD_LIBUNPACK)
-	$(ECHO) Copying $(@F)
-	$(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.map, $<) $@
-
-  $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.pdb: $(BUILD_LIBUNPACK)
-	$(ECHO) Copying $(@F)
-	$(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.pdb, $<) $@
-endif
-
 ##########################################################################################
 
 BUILD_LIBJLI_SRC_DIRS := $(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin
--- a/make/mapfiles/libawt_xawt/mapfile-vers	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/mapfiles/libawt_xawt/mapfile-vers	Wed Feb 03 05:23:32 2021 +0000
@@ -279,7 +279,6 @@
         Java_sun_awt_X11_XlibWrapper_XQueryPointer;
         Java_sun_awt_X11_XlibWrapper_XFreeCursor;
         Java_sun_awt_X11_XToolkit_getDefaultXColormap;
-        Java_sun_awt_X11_XToolkit_getDefaultScreenData;
         Java_sun_awt_X11_XToolkit_getEnv;
         Java_sun_awt_X11_XlibWrapper_XCreateBitmapFromData;
         Java_sun_awt_X11_XlibWrapper_XFreePixmap;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/mapfiles/libjava/mapfile-linux	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,304 @@
+#
+# Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Define public interface.
+
+SUNWprivate_1.1 {
+	global:
+		JNI_OnLoad;
+		JNU_ThrowNoSuchMethodException;
+		JNU_CallStaticMethodByName;
+		JNU_CallMethodByName;
+		JNU_CallMethodByNameV;
+		JNU_ClassClass;
+		JNU_ClassObject;
+		JNU_ClassString;
+		JNU_ClassThrowable;
+		JNU_CopyObjectArray;
+		JNU_Equals;
+		JNU_GetEnv;
+		JNU_GetFieldByName;
+		JNU_GetStaticFieldByName;
+		JNU_GetStringPlatformChars;
+		JNU_IsInstanceOfByName;
+		JNU_MonitorWait;
+		JNU_NewObjectByName;
+		JNU_NewStringPlatform;
+		JNU_Notify;
+		JNU_NotifyAll;
+		JNU_PrintClass;
+		JNU_PrintString;
+		JNU_ReleaseStringPlatformChars;
+		JNU_SetFieldByName;
+		JNU_SetStaticFieldByName;
+		JNU_ThrowArrayIndexOutOfBoundsException;
+		JNU_ThrowByName;
+		JNU_ThrowByNameWithLastError;
+                JNU_ThrowByNameWithMessageAndLastError;
+		JNU_ThrowClassNotFoundException;
+		JNU_ThrowIllegalAccessError;
+		JNU_ThrowIllegalAccessException;
+		JNU_ThrowIllegalArgumentException;
+		JNU_ThrowInstantiationException;
+		JNU_ThrowInternalError;
+		JNU_ThrowIOException;
+		JNU_ThrowIOExceptionWithLastError;
+		JNU_ThrowNoSuchFieldError;
+		JNU_ThrowNoSuchFieldException;
+		JNU_ThrowNoSuchMethodError;
+		JNU_ThrowNullPointerException;
+		JNU_ThrowNumberFormatException;
+		JNU_ThrowOutOfMemoryError;
+		JNU_ThrowStringIndexOutOfBoundsException;
+		JNU_ToString;
+
+		Java_java_io_FileDescriptor_initIDs;
+		Java_java_io_FileDescriptor_sync;
+		Java_java_io_FileInputStream_available0;
+		Java_java_io_FileInputStream_close0;
+		Java_java_io_FileInputStream_initIDs;
+		Java_java_io_FileInputStream_open0;
+		Java_java_io_FileInputStream_read0;
+		Java_java_io_FileInputStream_readBytes;
+		Java_java_io_FileInputStream_skip0;
+		Java_java_io_FileOutputStream_close0;
+		Java_java_io_FileOutputStream_initIDs;
+		Java_java_io_FileOutputStream_open0;
+		Java_java_io_FileOutputStream_write;
+		Java_java_io_FileOutputStream_writeBytes;
+		Java_java_io_ObjectInputStream_bytesToDoubles;
+		Java_java_io_ObjectInputStream_bytesToFloats;
+		Java_java_io_ObjectOutputStream_doublesToBytes;
+		Java_java_io_ObjectOutputStream_floatsToBytes;
+		Java_java_io_ObjectStreamClass_hasStaticInitializer;
+		Java_java_io_ObjectStreamClass_initNative;
+		Java_java_io_RandomAccessFile_close0;
+		Java_java_io_RandomAccessFile_getFilePointer;
+		Java_java_io_RandomAccessFile_initIDs;
+		Java_java_io_RandomAccessFile_length;
+		Java_java_io_RandomAccessFile_open0;
+		Java_java_io_RandomAccessFile_read0;
+		Java_java_io_RandomAccessFile_readBytes;
+		Java_java_io_RandomAccessFile_seek0;
+		Java_java_io_RandomAccessFile_setLength;
+		Java_java_io_RandomAccessFile_write0;
+		Java_java_io_RandomAccessFile_writeBytes;
+		Java_java_io_UnixFileSystem_canonicalize0;
+		Java_java_io_UnixFileSystem_checkAccess;
+		Java_java_io_UnixFileSystem_createDirectory;
+		Java_java_io_UnixFileSystem_createFileExclusively;
+		Java_java_io_UnixFileSystem_delete0;
+		Java_java_io_UnixFileSystem_getBooleanAttributes0;
+		Java_java_io_UnixFileSystem_getLastModifiedTime;
+		Java_java_io_UnixFileSystem_getLength;
+		Java_java_io_UnixFileSystem_getSpace;
+		Java_java_io_UnixFileSystem_initIDs;
+		Java_java_io_UnixFileSystem_list;
+		Java_java_io_UnixFileSystem_rename0;
+		Java_java_io_UnixFileSystem_setLastModifiedTime;
+		Java_java_io_UnixFileSystem_setReadOnly;
+		Java_java_io_UnixFileSystem_setPermission;
+		Java_java_lang_Class_forName0;
+		Java_java_lang_Class_getPrimitiveClass;
+		Java_java_lang_Class_isAssignableFrom;
+		Java_java_lang_Class_isInstance;
+		Java_java_lang_Class_registerNatives;
+		Java_java_lang_ClassLoader_findBootstrapClass;
+		Java_java_lang_ClassLoader_defineClass0;
+		Java_java_lang_ClassLoader_defineClass1;
+		Java_java_lang_ClassLoader_defineClass2;
+		Java_java_lang_ClassLoader_findBuiltinLib;
+		Java_java_lang_ClassLoader_findLoadedClass0;
+		Java_java_lang_ClassLoader_resolveClass0;
+		Java_java_lang_ClassLoader_00024NativeLibrary_find;
+		Java_java_lang_ClassLoader_00024NativeLibrary_load;
+		Java_java_lang_ClassLoader_00024NativeLibrary_unload;
+		Java_java_lang_ClassLoader_registerNatives;
+		Java_java_lang_Compiler_registerNatives;
+		Java_java_lang_Double_longBitsToDouble;
+		Java_java_lang_Double_doubleToRawLongBits;
+		Java_java_lang_reflect_Proxy_defineClass0;
+		Java_java_lang_Shutdown_runAllFinalizers;
+		Java_java_lang_Float_intBitsToFloat;
+		Java_java_lang_Float_floatToRawIntBits;
+		Java_java_lang_StrictMath_IEEEremainder;
+		Java_java_lang_StrictMath_acos;
+		Java_java_lang_StrictMath_asin;
+		Java_java_lang_StrictMath_atan;
+		Java_java_lang_StrictMath_atan2;
+		Java_java_lang_StrictMath_cos;
+		Java_java_lang_StrictMath_exp;
+		Java_java_lang_StrictMath_log;
+		Java_java_lang_StrictMath_log10;
+		Java_java_lang_StrictMath_pow;
+		Java_java_lang_StrictMath_sin;
+		Java_java_lang_StrictMath_sqrt;
+		Java_java_lang_StrictMath_cbrt;
+		Java_java_lang_StrictMath_tan;
+		Java_java_lang_StrictMath_cosh;
+		Java_java_lang_StrictMath_sinh;
+		Java_java_lang_StrictMath_tanh;
+		Java_java_lang_StrictMath_hypot;
+		Java_java_lang_StrictMath_log1p;
+		Java_java_lang_StrictMath_expm1;
+		Java_java_lang_Object_getClass;
+		Java_java_lang_Object_registerNatives;
+		Java_java_lang_Package_getSystemPackage0;
+		Java_java_lang_Package_getSystemPackages0;
+		Java_java_lang_ProcessEnvironment_environ;
+		Java_java_lang_reflect_Array_get;
+		Java_java_lang_reflect_Array_getBoolean;
+		Java_java_lang_reflect_Array_getByte;
+		Java_java_lang_reflect_Array_getChar;
+		Java_java_lang_reflect_Array_getDouble;
+		Java_java_lang_reflect_Array_getFloat;
+		Java_java_lang_reflect_Array_getInt;
+		Java_java_lang_reflect_Array_getLength;
+		Java_java_lang_reflect_Array_getLong;
+		Java_java_lang_reflect_Array_getShort;
+		Java_java_lang_reflect_Array_multiNewArray;
+		Java_java_lang_reflect_Array_newArray;
+		Java_java_lang_reflect_Array_set;
+		Java_java_lang_reflect_Array_setBoolean;
+		Java_java_lang_reflect_Array_setByte;
+		Java_java_lang_reflect_Array_setChar;
+		Java_java_lang_reflect_Array_setDouble;
+		Java_java_lang_reflect_Array_setFloat;
+		Java_java_lang_reflect_Array_setInt;
+		Java_java_lang_reflect_Array_setLong;
+		Java_java_lang_reflect_Array_setShort;
+		Java_java_lang_reflect_Executable_getParameters0;
+		Java_java_lang_reflect_Executable_getTypeAnnotationBytes0;
+		Java_java_lang_reflect_Field_getTypeAnnotationBytes0;
+		Java_java_lang_Runtime_freeMemory;
+                Java_java_lang_Runtime_maxMemory;
+		Java_java_lang_Runtime_gc;
+		Java_java_lang_Runtime_runFinalization0;
+		Java_java_lang_Runtime_totalMemory;
+		Java_java_lang_Runtime_traceInstructions;
+		Java_java_lang_Runtime_traceMethodCalls;
+                Java_java_lang_Runtime_availableProcessors;
+		Java_java_lang_SecurityManager_classDepth;
+		Java_java_lang_SecurityManager_classLoaderDepth0;
+		Java_java_lang_SecurityManager_currentClassLoader0;
+		Java_java_lang_SecurityManager_currentLoadedClass0;
+		Java_java_lang_SecurityManager_getClassContext;
+		Java_java_lang_Shutdown_beforeHalt;
+		Java_java_lang_Shutdown_halt0;
+		Java_java_lang_String_intern;
+		Java_java_lang_System_identityHashCode;
+		Java_java_lang_System_initProperties;
+		Java_java_lang_System_mapLibraryName;
+		Java_java_lang_System_registerNatives;
+		Java_java_lang_System_setErr0;
+		Java_java_lang_System_setIn0;
+		Java_java_lang_System_setOut0;
+		Java_java_lang_Thread_registerNatives;
+		Java_java_lang_Throwable_fillInStackTrace;
+                Java_java_lang_Throwable_getStackTraceDepth;
+                Java_java_lang_Throwable_getStackTraceElement;
+		Java_java_lang_UNIXProcess_init;
+		Java_java_lang_UNIXProcess_waitForProcessExit;
+		Java_java_lang_UNIXProcess_forkAndExec;
+		Java_java_lang_UNIXProcess_destroyProcess;
+                Java_java_nio_Bits_copySwapMemory0;
+		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_PrivilegedExceptionAction_2;
+		Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
+		Java_java_security_AccessController_getStackAccessControlContext;
+		Java_java_security_AccessController_getInheritedAccessControlContext;
+		Java_java_util_TimeZone_getSystemTimeZoneID;
+		Java_java_util_TimeZone_getSystemGMTOffsetID;
+		Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8;
+		Java_java_util_prefs_FileSystemPreferences_chmod;
+		Java_java_util_prefs_FileSystemPreferences_lockFile0;
+		Java_java_util_prefs_FileSystemPreferences_unlockFile0;
+		Java_java_util_logging_FileHandler_isSetUID;
+		Java_sun_misc_MessageUtils_toStderr;
+		Java_sun_misc_MessageUtils_toStdout;
+		Java_sun_misc_NativeSignalHandler_handle0;
+		Java_sun_misc_Signal_findSignal;
+		Java_sun_misc_Signal_handle0;
+		Java_sun_misc_Signal_raise0;
+              Java_sun_reflect_ConstantPool_getClassAt0;
+              Java_sun_reflect_ConstantPool_getClassAtIfLoaded0;
+              Java_sun_reflect_ConstantPool_getDoubleAt0;
+              Java_sun_reflect_ConstantPool_getFieldAt0;
+              Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0;
+              Java_sun_reflect_ConstantPool_getFloatAt0;
+              Java_sun_reflect_ConstantPool_getIntAt0;
+              Java_sun_reflect_ConstantPool_getLongAt0;
+              Java_sun_reflect_ConstantPool_getMemberRefInfoAt0;
+              Java_sun_reflect_ConstantPool_getMethodAt0;
+              Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0;
+              Java_sun_reflect_ConstantPool_getSize0;
+              Java_sun_reflect_ConstantPool_getStringAt0;
+              Java_sun_reflect_ConstantPool_getUTF8At0;
+		Java_java_io_Console_istty;
+		Java_java_io_Console_encoding;
+                Java_java_io_Console_echo;
+		Java_sun_misc_GC_maxObjectInspectionAge;
+		Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
+		Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
+		Java_sun_reflect_Reflection_getCallerClass__;
+		Java_sun_reflect_Reflection_getCallerClass__I;
+		Java_sun_reflect_Reflection_getClassAccessFlags;
+		Java_sun_misc_URLClassPath_knownToNotExist0;
+                Java_sun_misc_URLClassPath_getLookupCacheURLs;
+                Java_sun_misc_URLClassPath_getLookupCacheForClassLoader;
+                Java_sun_misc_Version_getJdkVersionInfo;
+                Java_sun_misc_Version_getJdkSpecialVersion;
+                Java_sun_misc_Version_getJvmVersionInfo;
+                Java_sun_misc_Version_getJvmSpecialVersion;
+                Java_sun_misc_VM_getThreadStateValues;
+		Java_sun_misc_VM_latestUserDefinedLoader0;
+                Java_sun_misc_VM_initialize;
+		Java_sun_misc_VMSupport_initAgentProperties;
+		Java_sun_misc_VMSupport_getVMTemporaryDirectory;
+		Java_jdk_internal_platform_cgroupv1_Metrics_isUseContainerSupport;
+
+                # ZipFile.c needs this one
+		throwFileNotFoundException;
+                # zip_util.c needs this
+		getErrorString;
+
+#		Java_sun_misc_VM_getState;			threads.c
+#		Java_sun_misc_VM_threadsSuspended;		threads.c
+#		Java_sun_misc_VM_unsuspendSomeThreads;		threads.c
+#		Java_sun_misc_VM_unsuspendThreads;		threads.c
+
+	# Outcalls from libjvm done using dlsym().
+
+		VerifyClassCodes;
+		VerifyClassCodesForMajorVersion;
+		NewStringPlatform;
+		GetStringPlatformChars;
+		Canonicalize;
+		JDK_GetVersionInfo0;
+
+	local:
+		*;
+};
--- a/make/mapfiles/libjava/mapfile-vers	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/mapfiles/libjava/mapfile-vers	Wed Feb 03 05:23:32 2021 +0000
@@ -278,7 +278,6 @@
                 Java_sun_misc_VM_initialize;
 		Java_sun_misc_VMSupport_initAgentProperties;
 		Java_sun_misc_VMSupport_getVMTemporaryDirectory;
-		Java_jdk_internal_platform_cgroupv1_Metrics_isUseContainerSupport;
 		
                 # ZipFile.c needs this one
 		throwFileNotFoundException;
--- a/make/mapfiles/libmanagement/mapfile-vers	Tue Jan 19 17:18:23 2021 +0000
+++ b/make/mapfiles/libmanagement/mapfile-vers	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2020, 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
@@ -85,6 +85,7 @@
 	    Java_sun_management_ThreadImpl_getThreadTotalCpuTime1;
 	    Java_sun_management_ThreadImpl_getThreadUserCpuTime0;
 	    Java_sun_management_ThreadImpl_getThreadUserCpuTime1;
+	    Java_sun_management_ThreadImpl_getThreadAllocatedMemory0;
 	    Java_sun_management_ThreadImpl_getThreadAllocatedMemory1;
 	    Java_sun_management_ThreadImpl_resetContentionTimes0;
 	    Java_sun_management_ThreadImpl_resetPeakThreadCount0;
--- a/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -150,13 +150,13 @@
     /**
      * createSubSystem objects and initialize mount points
      */
-    private static void createSubSystem(Metrics metric, String [] mountentry) {
+    private static void createSubSystem(Metrics metric, String[] mountentry) {
         if (mountentry.length < 5) return;
 
         Path p = Paths.get(mountentry[4]);
-        String subsystemName = p.getFileName().toString();
+        String[] subsystemNames = p.getFileName().toString().split(",");
 
-        if (subsystemName != null) {
+        for (String subsystemName: subsystemNames) {
             switch (subsystemName) {
                 case "memory":
                     metric.setMemorySubSystem(new SubSystem(mountentry[3], mountentry[4]));
@@ -164,11 +164,6 @@
                 case "cpuset":
                     metric.setCpuSetSubSystem(new SubSystem(mountentry[3], mountentry[4]));
                     break;
-                case "cpu,cpuacct":
-                case "cpuacct,cpu":
-                    metric.setCpuSubSystem(new SubSystem(mountentry[3], mountentry[4]));
-                    metric.setCpuAcctSubSystem(new SubSystem(mountentry[3], mountentry[4]));
-                    break;
                 case "cpuacct":
                     metric.setCpuAcctSubSystem(new SubSystem(mountentry[3], mountentry[4]));
                     break;
@@ -188,7 +183,7 @@
     /**
      * setSubSystemPath based on the contents of /proc/self/cgroup
      */
-    private static void setSubSystemPath(Metrics metric, String [] entry) {
+    private static void setSubSystemPath(Metrics metric, String[] entry) {
         String controller;
         String base;
         SubSystem subsystem = null;
--- a/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
     public void setPath(String cgroupPath) {
         if (root != null && cgroupPath != null) {
             if (root.equals("/")) {
-                if (cgroupPath.equals("/")) {
+                if (!cgroupPath.equals("/")) {
                     path = mountPoint + cgroupPath;
                 }
                 else {
@@ -62,7 +62,7 @@
                     path = mountPoint;
                 }
                 else {
-                    if (root.indexOf(cgroupPath) == 0) {
+                    if (cgroupPath.startsWith(root)) {
                         if (cgroupPath.length() > root.length()) {
                             String cgroupSubstr = cgroupPath.substring(root.length());
                             path = mountPoint + cgroupSubstr;
--- a/src/share/bin/jli_util.h	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/bin/jli_util.h	Wed Feb 03 05:23:32 2021 +0000
@@ -58,7 +58,6 @@
 #define JLI_StrSpn(p1, p2)      strspn((p1), (p2))
 #define JLI_StrCSpn(p1, p2)     strcspn((p1), (p2))
 #define JLI_StrPBrk(p1, p2)     strpbrk((p1), (p2))
-#define JLI_StrTok(p1, p2)      strtok((p1), (p2))
 
 /* On Windows lseek() is in io.h rather than the location dictated by POSIX. */
 #ifdef _WIN32
--- a/src/share/classes/com/sun/management/ThreadMXBean.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/management/ThreadMXBean.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 
 package com.sun.management;
 
+import java.lang.management.ThreadInfo;
 import java.util.Map;
 
 /**
@@ -62,7 +63,7 @@
      * @throws NullPointerException if {@code ids} is {@code null}
      * @throws IllegalArgumentException if any element in the input array
      *         {@code ids} is {@code <=} {@code 0}.
-     * @throws java.lang.UnsupportedOperationException if the Java
+     * @throws UnsupportedOperationException if the Java
      *         virtual machine implementation does not support CPU time
      *         measurement.
      *
@@ -96,7 +97,7 @@
      * @throws NullPointerException if {@code ids} is {@code null}
      * @throws IllegalArgumentException if any element in the input array
      *         {@code ids} is {@code <=} {@code 0}.
-     * @throws java.lang.UnsupportedOperationException if the Java
+     * @throws UnsupportedOperationException if the Java
      *         virtual machine implementation does not support CPU time
      *         measurement.
      *
@@ -110,13 +111,47 @@
 
     /**
      * Returns an approximation of the total amount of memory, in bytes,
-     * allocated in heap memory for the thread of the specified ID.
+     * allocated in heap memory for the current thread.
+     * The returned value is an approximation because some Java virtual machine
+     * implementations may use object allocation mechanisms that result in a
+     * delay between the time an object is allocated and the time its size is
+     * recorded.
+     *
+     * <p>
+     * This is a convenience method for local management use and is
+     * equivalent to calling:
+     * <blockquote><pre>
+     *   {@link #getThreadAllocatedBytes getThreadAllocatedBytes}(Thread.currentThread().getId());
+     * </pre></blockquote>
+     *
+     * @return an approximation of the total memory allocated, in bytes, in
+     * heap memory for the current thread
+     * if thread memory allocation measurement is enabled;
+     * {@code -1} otherwise.
+     *
+     * @throws UnsupportedOperationException if the Java virtual
+     *         machine implementation does not support thread memory allocation
+     *         measurement.
+     *
+     * @see #isThreadAllocatedMemorySupported
+     * @see #isThreadAllocatedMemoryEnabled
+     * @see #setThreadAllocatedMemoryEnabled
+     *
+     * @since 8u282
+     */
+    public default long getCurrentThreadAllocatedBytes() {
+        return getThreadAllocatedBytes(Thread.currentThread().getId());
+    }
+
+    /**
+     * Returns an approximation of the total amount of memory, in bytes,
+     * allocated in heap memory for the thread with the specified ID.
      * The returned value is an approximation because some Java virtual machine
      * implementations may use object allocation mechanisms that result in a
      * delay between the time an object is allocated and the time its size is
      * recorded.
      * <p>
-     * If the thread of the specified ID is not alive or does not exist,
+     * If the thread with the specified ID is not alive or does not exist,
      * this method returns {@code -1}. If thread memory allocation measurement
      * is disabled, this method returns {@code -1}.
      * A thread is alive if it has been started and has not yet died.
@@ -128,13 +163,13 @@
      *
      * @param id the thread ID of a thread
      * @return an approximation of the total memory allocated, in bytes, in
-     * heap memory for a thread of the specified ID
-     * if the thread of the specified ID exists, the thread is alive,
+     * heap memory for the thread with the specified ID
+     * if the thread with the specified ID exists, the thread is alive,
      * and thread memory allocation measurement is enabled;
      * {@code -1} otherwise.
      *
      * @throws IllegalArgumentException if {@code id} {@code <=} {@code 0}.
-     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     * @throws UnsupportedOperationException if the Java virtual
      *         machine implementation does not support thread memory allocation
      *         measurement.
      *
@@ -166,7 +201,7 @@
      * @throws NullPointerException if {@code ids} is {@code null}
      * @throws IllegalArgumentException if any element in the input array
      *         {@code ids} is {@code <=} {@code 0}.
-     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     * @throws UnsupportedOperationException if the Java virtual
      *         machine implementation does not support thread memory allocation
      *         measurement.
      *
@@ -195,7 +230,7 @@
      * @return {@code true} if thread memory allocation measurement is enabled;
      *         {@code false} otherwise.
      *
-     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     * @throws UnsupportedOperationException if the Java virtual
      *         machine does not support thread memory allocation measurement.
      *
      * @see #isThreadAllocatedMemorySupported
@@ -209,14 +244,158 @@
      * @param enable {@code true} to enable;
      *               {@code false} to disable.
      *
-     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     * @throws UnsupportedOperationException if the Java virtual
      *         machine does not support thread memory allocation measurement.
      *
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("control").
      *
      * @see #isThreadAllocatedMemorySupported
      */
     public void setThreadAllocatedMemoryEnabled(boolean enable);
+
+    /**
+     * Returns the thread info for each thread whose ID
+     * is in the input array <tt>ids</tt>,
+     * with stack trace of the specified maximum number of elements
+     * and synchronization information.
+     * If <tt>maxDepth == 0</tt>, no stack trace of the thread
+     * will be dumped.
+     *
+     * <p>
+     * This method obtains a snapshot of the thread information
+     * for each thread including:
+     * <ul>
+     *    <li>stack trace of the specified maximum number of elements,</li>
+     *    <li>the object monitors currently locked by the thread
+     *        if <tt>lockedMonitors</tt> is <tt>true</tt>, and</li>
+     *    <li>the <a href="{@docRoot}/../api/java/lang/management/LockInfo.html#OwnableSynchronizer">
+     *        ownable synchronizers</a> currently locked by the thread
+     *        if <tt>lockedSynchronizers</tt> is <tt>true</tt>.</li>
+     * </ul>
+     * <p>
+     * This method returns an array of the <tt>ThreadInfo</tt> objects,
+     * each is the thread information about the thread with the same index
+     * as in the <tt>ids</tt> array.
+     * If a thread of the given ID is not alive or does not exist,
+     * <tt>null</tt> will be set in the corresponding element
+     * in the returned array.  A thread is alive if
+     * it has been started and has not yet died.
+     * <p>
+     * If a thread does not lock any object monitor or <tt>lockedMonitors</tt>
+     * is <tt>false</tt>, the returned <tt>ThreadInfo</tt> object will have an
+     * empty <tt>MonitorInfo</tt> array.  Similarly, if a thread does not
+     * lock any synchronizer or <tt>lockedSynchronizers</tt> is <tt>false</tt>,
+     * the returned <tt>ThreadInfo</tt> object
+     * will have an empty <tt>LockInfo</tt> array.
+     *
+     * <p>
+     * When both <tt>lockedMonitors</tt> and <tt>lockedSynchronizers</tt>
+     * parameters are <tt>false</tt>, it is equivalent to calling:
+     * <blockquote><pre>
+     *     {@link #getThreadInfo(long[], int)  getThreadInfo(ids, maxDepth)}
+     * </pre></blockquote>
+     *
+     * <p>
+     * This method is designed for troubleshooting use, but not for
+     * synchronization control.  It might be an expensive operation.
+     *
+     * <p>
+     * <b>MBeanServer access</b>:<br>
+     * The mapped type of <tt>ThreadInfo</tt> is
+     * <tt>CompositeData</tt> with attributes as specified in the
+     * {@link ThreadInfo#from ThreadInfo.from} method.
+     *
+     * @implSpec The default implementation throws
+     * <tt>UnsupportedOperationException</tt>.
+     *
+     * @param  ids an array of thread IDs.
+     * @param  lockedMonitors if <tt>true</tt>, retrieves all locked monitors.
+     * @param  lockedSynchronizers if <tt>true</tt>, retrieves all locked
+     *             ownable synchronizers.
+     * @param  maxDepth indicates the maximum number of
+     * {@link StackTraceElement} to be retrieved from the stack trace.
+     *
+     * @return an array of the {@link ThreadInfo} objects, each containing
+     * information about a thread whose ID is in the corresponding
+     * element of the input array of IDs.
+     *
+     * @throws IllegalArgumentException if <tt>maxDepth</tt> is negative.
+     * @throws java.lang.SecurityException if a security manager
+     *         exists and the caller does not have
+     *         ManagementPermission("monitor").
+     * @throws java.lang.UnsupportedOperationException
+     *         <ul>
+     *           <li>if <tt>lockedMonitors</tt> is <tt>true</tt> but
+     *               the Java virtual machine does not support monitoring
+     *               of {@linkplain #isObjectMonitorUsageSupported
+     *               object monitor usage}; or</li>
+     *           <li>if <tt>lockedSynchronizers</tt> is <tt>true</tt> but
+     *               the Java virtual machine does not support monitoring
+     *               of {@linkplain #isSynchronizerUsageSupported
+     *               ownable synchronizer usage}.</li>
+     *         </ul>
+     *
+     * @see #isObjectMonitorUsageSupported
+     * @see #isSynchronizerUsageSupported
+     *
+     * @since 8u282
+     */
+
+    public default ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors,
+                                              boolean lockedSynchronizers, int maxDepth) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Returns the thread info for all live threads
+     * with stack trace of the specified maximum number of elements
+     * and synchronization information.
+     * if <tt>maxDepth == 0</tt>, no stack trace of the thread
+     * will be dumped.
+     * Some threads included in the returned array
+     * may have been terminated when this method returns.
+     *
+     * <p>
+     * This method returns an array of {@link ThreadInfo} objects
+     * as specified in the {@link #getThreadInfo(long[], boolean, boolean, int)}
+     * method.
+     *
+     * @implSpec The default implementation throws
+     * <tt>UnsupportedOperationException</tt>.
+     *
+     * @param  lockedMonitors if <tt>true</tt>, dump all locked monitors.
+     * @param  lockedSynchronizers if <tt>true</tt>, dump all locked
+     *             ownable synchronizers.
+     * @param  maxDepth indicates the maximum number of
+     * {@link StackTraceElement} to be retrieved from the stack trace.
+     *
+     * @return an array of {@link ThreadInfo} for all live threads.
+     *
+     * @throws IllegalArgumentException if <tt>maxDepth</tt> is negative.
+     * @throws java.lang.SecurityException if a security manager
+     *         exists and the caller does not have
+     *         ManagementPermission("monitor").
+     * @throws java.lang.UnsupportedOperationException
+     *         <ul>
+     *           <li>if <tt>lockedMonitors</tt> is <tt>true</tt> but
+     *               the Java virtual machine does not support monitoring
+     *               of {@linkplain #isObjectMonitorUsageSupported
+     *               object monitor usage}; or</li>
+     *           <li>if <tt>lockedSynchronizers</tt> is <tt>true</tt> but
+     *               the Java virtual machine does not support monitoring
+     *               of {@linkplain #isSynchronizerUsageSupported
+     *               ownable synchronizer usage}.</li>
+     *         </ul>
+     *
+     * @see #isObjectMonitorUsageSupported
+     * @see #isSynchronizerUsageSupported
+     *
+     * @since 8u282
+     */
+    public default ThreadInfo[] dumpAllThreads(boolean lockedMonitors,
+                                               boolean lockedSynchronizers, int maxDepth) {
+        throw new UnsupportedOperationException();
+    }
 }
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/IntegrityHmac.java	Wed Feb 03 05:23:32 2021 +0000
@@ -40,6 +40,7 @@
 import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 import org.w3c.dom.Text;
 
 public abstract class IntegrityHmac extends SignatureAlgorithmSpi {
@@ -325,12 +326,13 @@
             throw new IllegalArgumentException("element null");
         }
 
-        Text hmaclength =
-            XMLUtils.selectDsNodeText(element.getFirstChild(), Constants._TAG_HMACOUTPUTLENGTH, 0);
-
-        if (hmaclength != null) {
-            this.HMACOutputLength = Integer.parseInt(hmaclength.getData());
-            this.HMACOutputLengthSet = true;
+        Node n = XMLUtils.selectDsNode(element.getFirstChild(), Constants._TAG_HMACOUTPUTLENGTH, 0);
+        if (n != null) {
+            String hmacLength = XMLUtils.getFullTextChildrenFromNode(n);
+            if (hmacLength != null && !"".equals(hmacLength)) {
+                this.HMACOutputLength = Integer.parseInt(hmacLength);
+                this.HMACOutputLengthSet = true;
+            }
         }
     }
 
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java	Wed Feb 03 05:23:32 2021 +0000
@@ -33,7 +33,6 @@
 import java.security.SignatureException;
 import java.security.interfaces.DSAKey;
 import java.security.spec.AlgorithmParameterSpec;
-import java.util.Base64;
 
 import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper;
 import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithmSpi;
@@ -41,6 +40,7 @@
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
 import com.sun.org.apache.xml.internal.security.utils.Constants;
 import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
+import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 
 public class SignatureDSA extends SignatureAlgorithmSpi {
 
@@ -109,7 +109,7 @@
         throws XMLSignatureException {
         try {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Called DSA.verify() on " + Base64.getMimeEncoder().encodeToString(signature));
+                LOG.debug("Called DSA.verify() on " + XMLUtils.encodeToString(signature));
             }
 
             byte[] jcebytes = JavaUtils.convertDsaXMLDSIGtoASN1(signature,
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java	Wed Feb 03 05:23:32 2021 +0000
@@ -33,12 +33,12 @@
 import java.security.Signature;
 import java.security.SignatureException;
 import java.security.spec.AlgorithmParameterSpec;
-import java.util.Base64;
 
 import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper;
 import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithmSpi;
 import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
+import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 
 /**
  *
@@ -132,7 +132,7 @@
             byte[] jcebytes = SignatureECDSA.convertXMLDSIGtoASN1(signature);
 
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Called ECDSA.verify() on " + Base64.getMimeEncoder().encodeToString(signature));
+                LOG.debug("Called ECDSA.verify() on " + XMLUtils.encodeToString(signature));
             }
 
             return this.signatureAlgorithm.verify(jcebytes);
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315.java	Wed Feb 03 05:23:32 2021 +0000
@@ -331,7 +331,7 @@
                     ns.addMapping(NName, NValue, attribute);
                 }
             } else if (XML_LANG_URI.equals(attribute.getNamespaceURI())
-                && (!c14n11 || c14n11 && !"id".equals(NName))) {
+                && (!c14n11 || !"id".equals(NName))) {
                 xmlattrStack.addXmlnsAttr(attribute);
             }
         }
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/Canonicalizer20010315Excl.java	Wed Feb 03 05:23:32 2021 +0000
@@ -342,7 +342,7 @@
     protected void circumventBugIfNeeded(XMLSignatureInput input)
         throws CanonicalizationException, ParserConfigurationException,
                IOException, SAXException {
-        if (!input.isNeedsToBeExpanded() || inclusiveNSSet.isEmpty() || inclusiveNSSet.isEmpty()) {
+        if (!input.isNeedsToBeExpanded() || inclusiveNSSet.isEmpty()) {
             return;
         }
         Document doc = null;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java	Wed Feb 03 05:23:32 2021 +0000
@@ -50,7 +50,6 @@
 import com.sun.org.apache.xml.internal.security.transforms.Transforms;
 import com.sun.org.apache.xml.internal.security.utils.Constants;
 import com.sun.org.apache.xml.internal.security.utils.ElementProxy;
-import com.sun.org.apache.xml.internal.security.utils.EncryptionConstants;
 import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
 import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 import org.w3c.dom.Attr;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,6 +26,7 @@
 
 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
 import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue;
+import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.ECKeyValue;
 import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.RSAKeyValue;
 import com.sun.org.apache.xml.internal.security.utils.Constants;
 import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
@@ -107,9 +108,14 @@
 
             appendSelf(rsa);
             addReturnToSelf();
+        } else if (pk instanceof java.security.interfaces.ECPublicKey) {
+            ECKeyValue ec = new ECKeyValue(getDocument(), pk);
+
+            appendSelf(ec);
+            addReturnToSelf();
         } else {
             String error = "The given PublicKey type " + pk + " is not supported. Only DSAPublicKey and "
-                + "RSAPublicKey types are currently supported";
+                + "RSAPublicKey and ECPublicKey types are currently supported";
             throw new IllegalArgumentException(error);
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/ECKeyValue.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,366 @@
+/*
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
+ */
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.sun.org.apache.xml.internal.security.keys.content.keyvalues;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.security.Key;
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.PublicKey;
+import java.security.interfaces.ECPublicKey;
+import java.security.spec.ECField;
+import java.security.spec.ECFieldFp;
+import java.security.spec.ECParameterSpec;
+import java.security.spec.ECPoint;
+import java.security.spec.ECPublicKeySpec;
+import java.security.spec.EllipticCurve;
+import java.security.spec.InvalidKeySpecException;
+import java.util.Arrays;
+
+import javax.xml.crypto.MarshalException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+import com.sun.org.apache.xml.internal.security.utils.Constants;
+import com.sun.org.apache.xml.internal.security.utils.I18n;
+import com.sun.org.apache.xml.internal.security.utils.Signature11ElementProxy;
+import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+
+public class ECKeyValue extends Signature11ElementProxy implements KeyValueContent {
+
+    /* Supported curve, secp256r1 */
+    private static final Curve SECP256R1 = initializeCurve(
+        "secp256r1 [NIST P-256, X9.62 prime256v1]",
+        "1.2.840.10045.3.1.7",
+        "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF",
+        "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC",
+        "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B",
+        "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296",
+        "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",
+        "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551",
+        1
+    );
+
+    /* Supported curve secp384r1 */
+    private static final Curve SECP384R1 = initializeCurve(
+        "secp384r1 [NIST P-384]",
+        "1.3.132.0.34",
+        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF",
+        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC",
+        "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF",
+        "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7",
+        "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F",
+        "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973",
+        1
+    );
+
+    /* Supported curve secp521r1 */
+    private static final Curve SECP521R1 = initializeCurve(
+        "secp521r1 [NIST P-521]",
+        "1.3.132.0.35",
+        "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
+        "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC",
+        "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00",
+        "00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66",
+        "011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650",
+        "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409",
+        1
+    );
+
+    private static Curve initializeCurve(String name, String oid,
+            String sfield, String a, String b,
+            String x, String y, String n, int h) {
+        BigInteger p = bigInt(sfield);
+        ECField field = new ECFieldFp(p);
+        EllipticCurve curve = new EllipticCurve(field, bigInt(a),
+                                                bigInt(b));
+        ECPoint g = new ECPoint(bigInt(x), bigInt(y));
+        return new Curve(name, oid, curve, g, bigInt(n), h);
+    }
+
+
+    /**
+     * Constructor DSAKeyValue
+     *
+     * @param element
+     * @param baseURI
+     * @throws XMLSecurityException
+     */
+    public ECKeyValue(Element element, String baseURI) throws XMLSecurityException {
+        super(element, baseURI);
+    }
+
+    /**
+     * Constructor DSAKeyValue
+     *
+     * @param doc
+     * @param key
+     * @throws IllegalArgumentException
+     */
+    public ECKeyValue(Document doc, Key key) throws IllegalArgumentException {
+        super(doc);
+
+        addReturnToSelf();
+
+        if (key instanceof ECPublicKey) {
+            ECParameterSpec ecParams = ((ECPublicKey)key).getParams();
+
+            // NamedCurve
+            String oid = getCurveOid(ecParams);
+            if (oid == null) {
+                throw new IllegalArgumentException("Invalid ECParameterSpec");
+            }
+
+            Element namedCurveElement = XMLUtils.createElementInSignature11Space(getDocument(), "NamedCurve");
+            namedCurveElement.setAttributeNS(null, "URI", "urn:oid:" + oid);
+            appendSelf(namedCurveElement);
+            addReturnToSelf();
+
+            // PublicKey
+            ECPoint ecPoint = ((ECPublicKey)key).getW();
+            byte[] secPublicKey = encodePoint(ecPoint, ecParams.getCurve());
+            String encoded = XMLUtils.encodeToString(secPublicKey);
+            Element publicKeyElement = XMLUtils.createElementInSignature11Space(getDocument(), "PublicKey");
+            Text text = getDocument().createTextNode(encoded);
+
+            publicKeyElement.appendChild(text);
+
+            appendSelf(publicKeyElement);
+            addReturnToSelf();
+
+        } else {
+            Object[] exArgs = { Constants._TAG_ECKEYVALUE, key.getClass().getName() };
+
+            throw new IllegalArgumentException(I18n.translate("KeyValue.IllegalArgument", exArgs));
+        }
+    }
+
+    /** {@inheritDoc} */
+    public PublicKey getPublicKey() throws XMLSecurityException {
+        try {
+            ECParameterSpec ecParams = null;
+            Element curElem = getFirstChildElement(getElement());
+            if (curElem == null) {
+                throw new MarshalException("KeyValue must contain at least one type");
+            }
+
+            if ("ECParameters".equals(curElem.getLocalName())
+                && Constants.SignatureSpec11NS.equals(curElem.getNamespaceURI())) {
+                throw new UnsupportedOperationException
+                    ("ECParameters not supported");
+            } else if ("NamedCurve".equals(curElem.getLocalName())
+                && Constants.SignatureSpec11NS.equals(curElem.getNamespaceURI())) {
+                String uri = null;
+                if (curElem.hasAttributeNS(null, "URI")) {
+                    uri = curElem.getAttributeNS(null, "URI");
+                }
+                // strip off "urn:oid"
+                if (uri.startsWith("urn:oid:")) {
+                    String oid = uri.substring("urn:oid:".length());
+                    ecParams = getECParameterSpec(oid);
+                    if (ecParams == null) {
+                        throw new MarshalException("Invalid curve OID");
+                    }
+                } else {
+                    throw new MarshalException("Invalid NamedCurve URI");
+                }
+            } else {
+                throw new MarshalException("Invalid ECKeyValue");
+            }
+            curElem = getNextSiblingElement(curElem, "PublicKey", Constants.SignatureSpec11NS);
+            ECPoint ecPoint = null;
+
+            try {
+                String content = XMLUtils.getFullTextChildrenFromNode(curElem);
+                ecPoint = decodePoint(XMLUtils.decode(content), ecParams.getCurve());
+            } catch (IOException ioe) {
+                throw new MarshalException("Invalid EC Point", ioe);
+            }
+
+            ECPublicKeySpec spec = new ECPublicKeySpec(ecPoint, ecParams);
+            return KeyFactory.getInstance("EC").generatePublic(spec);
+        } catch (NoSuchAlgorithmException ex) {
+            throw new XMLSecurityException(ex);
+        } catch (InvalidKeySpecException ex) {
+            throw new XMLSecurityException(ex);
+        } catch (MarshalException ex) {
+            throw new XMLSecurityException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public String getBaseLocalName() {
+        return Constants._TAG_ECKEYVALUE;
+    }
+
+    private static Element getFirstChildElement(Node node) {
+        Node child = node.getFirstChild();
+        while (child != null && child.getNodeType() != Node.ELEMENT_NODE) {
+            child = child.getNextSibling();
+        }
+        return (Element)child;
+    }
+
+    private static Element getNextSiblingElement(Node node, String localName, String namespaceURI)
+        throws MarshalException
+    {
+        return verifyElement(getNextSiblingElement(node), localName, namespaceURI);
+    }
+
+    private static Element getNextSiblingElement(Node node) {
+        Node sibling = node.getNextSibling();
+        while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE) {
+            sibling = sibling.getNextSibling();
+        }
+        return (Element)sibling;
+    }
+
+    private static Element verifyElement(Element elem, String localName, String namespaceURI)
+        throws MarshalException
+    {
+        if (elem == null) {
+            throw new MarshalException("Missing " + localName + " element");
+        }
+        String name = elem.getLocalName();
+        String namespace = elem.getNamespaceURI();
+        if (!name.equals(localName) || namespace == null && namespaceURI != null
+            || namespace != null && !namespace.equals(namespaceURI)) {
+            throw new MarshalException("Invalid element name: " +
+                namespace + ":" + name + ", expected " + namespaceURI + ":" + localName);
+        }
+        return elem;
+    }
+
+    private static String getCurveOid(ECParameterSpec params) {
+        // Check that the params represent one of the supported
+        // curves. If there is a match, return the object identifier
+        // of the curve.
+        Curve match;
+        if (matchCurve(params, SECP256R1)) {
+            match = SECP256R1;
+        } else if (matchCurve(params, SECP384R1)) {
+            match = SECP384R1;
+        } else if (matchCurve(params, SECP521R1)) {
+            match = SECP521R1;
+        } else {
+            return null;
+        }
+        return match.getObjectId();
+    }
+
+    private static boolean matchCurve(ECParameterSpec params, Curve curve) {
+        int fieldSize = params.getCurve().getField().getFieldSize();
+        return curve.getCurve().getField().getFieldSize() == fieldSize
+            && curve.getCurve().equals(params.getCurve())
+            && curve.getGenerator().equals(params.getGenerator())
+            && curve.getOrder().equals(params.getOrder())
+            && curve.getCofactor() == params.getCofactor();
+    }
+
+    private static ECPoint decodePoint(byte[] data, EllipticCurve curve)
+        throws IOException {
+        if (data.length == 0 || data[0] != 4) {
+            throw new IOException("Only uncompressed point format " +
+                "supported");
+        }
+        // Per ANSI X9.62, an encoded point is a 1 byte type followed by
+        // ceiling(LOG base 2 field-size / 8) bytes of x and the same of y.
+        int n = (data.length - 1) / 2;
+        if (n != (curve.getField().getFieldSize() + 7) >> 3) {
+            throw new IOException("Point does not match field size");
+        }
+
+        byte[] xb = Arrays.copyOfRange(data, 1, 1 + n);
+        byte[] yb = Arrays.copyOfRange(data, n + 1, n + 1 + n);
+
+        return new ECPoint(new BigInteger(1, xb), new BigInteger(1, yb));
+    }
+
+    private static byte[] encodePoint(ECPoint point, EllipticCurve curve) {
+        // get field size in bytes (rounding up)
+        int n = (curve.getField().getFieldSize() + 7) >> 3;
+        byte[] xb = trimZeroes(point.getAffineX().toByteArray());
+        byte[] yb = trimZeroes(point.getAffineY().toByteArray());
+        if (xb.length > n || yb.length > n) {
+            throw new RuntimeException("Point coordinates do not " +
+                                       "match field size");
+        }
+        byte[] b = new byte[1 + (n << 1)];
+        b[0] = 4; // uncompressed
+        System.arraycopy(xb, 0, b, n - xb.length + 1, xb.length);
+        System.arraycopy(yb, 0, b, b.length - yb.length, yb.length);
+        return b;
+    }
+
+    private static byte[] trimZeroes(byte[] b) {
+        int i = 0;
+        while (i < b.length - 1 && b[i] == 0) {
+            i++;
+        }
+        if (i == 0) {
+            return b;
+        }
+        return Arrays.copyOfRange(b, i, b.length);
+    }
+
+    private static ECParameterSpec getECParameterSpec(String oid) {
+        if (oid.equals(SECP256R1.getObjectId())) {
+            return SECP256R1;
+        } else if (oid.equals(SECP384R1.getObjectId())) {
+            return SECP384R1;
+        } else if (oid.equals(SECP521R1.getObjectId())) {
+            return SECP521R1;
+        } else {
+            return null;
+        }
+    }
+
+    static final class Curve extends ECParameterSpec {
+        private final String name;
+        private final String oid;
+
+        Curve(String name, String oid, EllipticCurve curve,
+              ECPoint g, BigInteger n, int h) {
+            super(curve, g, n, h);
+            this.name = name;
+            this.oid = oid;
+        }
+
+        private String getName() {
+            return name;
+        }
+
+        private String getObjectId() {
+            return oid;
+        }
+    }
+
+    private static BigInteger bigInt(String s) {
+        return new BigInteger(s, 16);
+    }
+}
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SKI.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/content/x509/XMLX509SKI.java	Wed Feb 03 05:23:32 2021 +0000
@@ -24,18 +24,18 @@
 
 import java.security.cert.X509Certificate;
 import java.util.Arrays;
-import java.util.Base64;
 
 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
 import com.sun.org.apache.xml.internal.security.utils.Constants;
 import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
+import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 /**
  * Handles SubjectKeyIdentifier (SKI) for X.509v3.
  *
- * @see <A HREF="https://docs.oracle.com/javase/1.5.0/docs/api/java/security/cert/X509Extension.html">
+ * @see <A HREF="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Extension.html">
  * Interface X509Extension</A>
  */
 public class XMLX509SKI extends SignatureElementProxy implements XMLX509DataContent {
@@ -138,7 +138,7 @@
         System.arraycopy(extensionValue, 4, skidValue, 0, skidValue.length);
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Base64 of SKI is " + Base64.getMimeEncoder().encodeToString(skidValue));
+            LOG.debug("Base64 of SKI is " + XMLUtils.encodeToString(skidValue));
         }
 
         return skidValue;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/KeyResolver.java	Wed Feb 03 05:23:32 2021 +0000
@@ -33,6 +33,7 @@
 
 import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.DEREncodedKeyValueResolver;
 import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.DSAKeyValueResolver;
+import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.ECKeyValueResolver;
 import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.KeyInfoReferenceResolver;
 import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.RSAKeyValueResolver;
 import com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.RetrievalMethodResolver;
@@ -292,6 +293,7 @@
         keyResolverList.add(new KeyResolver(new DEREncodedKeyValueResolver()));
         keyResolverList.add(new KeyResolver(new KeyInfoReferenceResolver()));
         keyResolverList.add(new KeyResolver(new X509DigestResolver()));
+        keyResolverList.add(new KeyResolver(new ECKeyValueResolver()));
 
         resolverVector.addAll(keyResolverList);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/ECKeyValueResolver.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,97 @@
+/*
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
+ */
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations;
+
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+
+import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
+import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.ECKeyValue;
+import com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolverSpi;
+import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver;
+import com.sun.org.apache.xml.internal.security.utils.Constants;
+import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
+import org.w3c.dom.Element;
+
+public class ECKeyValueResolver extends KeyResolverSpi {
+
+    private static final com.sun.org.slf4j.internal.Logger LOG =
+        com.sun.org.slf4j.internal.LoggerFactory.getLogger(ECKeyValueResolver.class);
+
+
+    /**
+     * Method engineResolvePublicKey
+     *
+     * @param element
+     * @param baseURI
+     * @param storage
+     * @return null if no {@link PublicKey} could be obtained
+     */
+    public PublicKey engineLookupAndResolvePublicKey(
+        Element element, String baseURI, StorageResolver storage
+    ) {
+        if (element == null) {
+            return null;
+        }
+        Element ecKeyElement = null;
+        boolean isKeyValue =
+            XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
+        if (isKeyValue) {
+            ecKeyElement =
+                XMLUtils.selectDs11Node(element.getFirstChild(), Constants._TAG_ECKEYVALUE, 0);
+        } else if (XMLUtils.elementIsInSignature11Space(element, Constants._TAG_ECKEYVALUE)) {
+            // this trick is needed to allow the RetrievalMethodResolver to eat a
+            // ds:ECKeyValue directly (without KeyValue)
+            ecKeyElement = element;
+        }
+
+        if (ecKeyElement == null) {
+            return null;
+        }
+
+        try {
+            ECKeyValue ecKeyValue = new ECKeyValue(ecKeyElement, baseURI);
+            return ecKeyValue.getPublicKey();
+        } catch (XMLSecurityException ex) {
+            LOG.debug(ex.getMessage(), ex);
+            //do nothing
+        }
+
+        return null;
+    }
+
+
+    /** {@inheritDoc} */
+    public X509Certificate engineLookupResolveX509Certificate(
+        Element element, String baseURI, StorageResolver storage
+    ) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
+        Element element, String baseURI, StorageResolver storage
+    ) {
+        return null;
+    }
+}
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RSAKeyValueResolver.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RSAKeyValueResolver.java	Wed Feb 03 05:23:32 2021 +0000
@@ -44,11 +44,12 @@
     public PublicKey engineLookupAndResolvePublicKey(
         Element element, String baseURI, StorageResolver storage
     ) {
-        LOG.debug("Can I resolve {}", element.getTagName());
         if (element == null) {
             return null;
         }
 
+        LOG.debug("Can I resolve {}", element.getTagName());
+
         boolean isKeyValue = XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYVALUE);
         Element rsaKeyElement = null;
         if (isKeyValue) {
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/keys/storage/implementations/CertsInFilesystemDirectoryResolver.java	Wed Feb 03 05:23:32 2021 +0000
@@ -35,12 +35,12 @@
 import java.security.cert.CertificateNotYetValidException;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
-import java.util.Base64;
 import java.util.Iterator;
 import java.util.List;
 
 import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolverException;
 import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolverSpi;
+import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 
 /**
  * This {@link StorageResolverSpi} makes all raw (binary) {@link X509Certificate}s
@@ -207,7 +207,7 @@
 
             System.out.println();
             System.out.println("Base64(SKI())=                 \""
-                               + Base64.getMimeEncoder().encodeToString(ski) + "\"");
+                               + XMLUtils.encodeToString(ski) + "\"");
             System.out.println("cert.getSerialNumber()=        \""
                                + cert.getSerialNumber().toString() + "\"");
             System.out.println("cert.getSubjectX500Principal().getName()= \""
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml	Wed Feb 03 05:23:32 2021 +0000
@@ -604,6 +604,8 @@
                 DESCRIPTION="Uses an X509 SubjectName to retrieve a certificate from the storages" />
       <Resolver JAVACLASS="com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.X509IssuerSerialResolver"
                 DESCRIPTION="Uses an X509 IssuerName and IssuerSerial to retrieve a certificate from the storages" />
+      <Resolver JAVACLASS="com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.ECKeyValueResolver"
+                DESCRIPTION="Can extract EC public keys" />
    </KeyResolver>
  
    <PrefixMappings>
@@ -626,5 +628,7 @@
                      prefix="ec" />
       <PrefixMapping namespace="http://www.nue.et-inf.uni-siegen.de/~geuer-pollmann/#xpathFilter"
                      prefix="xx" />
+       <PrefixMapping namespace="http://www.w3.org/2009/xmldsig11#"
+                     prefix="dsig11" />
    </PrefixMappings>
 </Configuration>
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Manifest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -23,7 +23,10 @@
 package com.sun.org.apache.xml.internal.security.signature;
 
 import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -56,19 +59,24 @@
 public class Manifest extends SignatureElementProxy {
 
     /**
-     * The maximum number of references per Manifest, if secure validation is enabled.
+     * The default maximum number of references per Manifest, if secure validation is enabled.
      */
     public static final int MAXIMUM_REFERENCE_COUNT = 30;
 
     private static final com.sun.org.slf4j.internal.Logger LOG =
         com.sun.org.slf4j.internal.LoggerFactory.getLogger(Manifest.class);
 
+    private static Integer referenceCount =
+        AccessController.doPrivileged(
+            (PrivilegedAction<Integer>) () -> Integer.parseInt(System.getProperty("com.sun.org.apache.xml.internal.security.maxReferences",
+                                                                Integer.toString(MAXIMUM_REFERENCE_COUNT))));
+
     /** Field references */
     private List<Reference> references;
     private Element[] referencesEl;
 
     /** Field verificationResults[] */
-    private boolean[] verificationResults;
+    private List<VerifiedReference> verificationResults;
 
     /** Field resolverProperties */
     private Map<String, String> resolverProperties;
@@ -135,8 +143,8 @@
                                    I18n.translate("xml.WrongContent", exArgs));
         }
 
-        if (secureValidation && le > MAXIMUM_REFERENCE_COUNT) {
-            Object exArgs[] = { le, MAXIMUM_REFERENCE_COUNT };
+        if (secureValidation && le > referenceCount) {
+            Object exArgs[] = { le, referenceCount };
 
             throw new XMLSecurityException("signature.tooManyReferences", exArgs);
         }
@@ -317,13 +325,13 @@
         if (referencesEl.length == 0) {
             throw new XMLSecurityException("empty", new Object[]{"References are empty"});
         }
-        if (secureValidation && referencesEl.length > MAXIMUM_REFERENCE_COUNT) {
-            Object exArgs[] = { referencesEl.length, MAXIMUM_REFERENCE_COUNT };
+        if (secureValidation && referencesEl.length > referenceCount) {
+            Object exArgs[] = { referencesEl.length, referenceCount };
 
             throw new XMLSecurityException("signature.tooManyReferences", exArgs);
         }
 
-        this.verificationResults = new boolean[referencesEl.length];
+        this.verificationResults = new ArrayList<>(referencesEl.length);
         boolean verify = true;
         for (int i = 0; i < this.referencesEl.length; i++) {
             Reference currentRef =
@@ -335,13 +343,13 @@
             try {
                 boolean currentRefVerified = currentRef.verify();
 
-                this.setVerificationResult(i, currentRefVerified);
-
                 if (!currentRefVerified) {
                     verify = false;
                 }
                 LOG.debug("The Reference has Type {}", currentRef.getType());
 
+                List<VerifiedReference> manifestReferences = Collections.emptyList();
+
                 // was verification successful till now and do we want to verify the Manifest?
                 if (verify && followManifests && currentRef.typeIsReferenceToManifest()) {
                     LOG.debug("We have to follow a nested Manifest");
@@ -393,6 +401,8 @@
                         } else {
                             LOG.debug("The nested Manifest was valid (good)");
                         }
+
+                        manifestReferences = referencedManifest.getVerificationResults();
                     } catch (IOException ex) {
                         throw new ReferenceNotInitializedException(ex);
                     } catch (ParserConfigurationException ex) {
@@ -401,6 +411,8 @@
                         throw new ReferenceNotInitializedException(ex);
                     }
                 }
+
+                verificationResults.add(new VerifiedReference(currentRefVerified, currentRef.getURI(), manifestReferences));
             } catch (ReferenceNotInitializedException ex) {
                 Object exArgs[] = { currentRef.getURI() };
 
@@ -414,20 +426,6 @@
     }
 
     /**
-     * Method setVerificationResult
-     *
-     * @param index
-     * @param verify
-     */
-    private void setVerificationResult(int index, boolean verify) {
-        if (this.verificationResults == null) {
-            this.verificationResults = new boolean[this.getLength()];
-        }
-
-        this.verificationResults[index] = verify;
-    }
-
-    /**
      * After verifying a {@link Manifest} or a {@link SignedInfo} using the
      * {@link Manifest#verifyReferences()} or {@link SignedInfo#verify()} methods,
      * the individual results can be retrieved with this method.
@@ -455,14 +453,24 @@
             }
         }
 
-        return this.verificationResults[index];
+        return ((ArrayList<VerifiedReference>)verificationResults).get(index).isValid();
+    }
+
+    /**
+     * Get the list of verification result objects
+     */
+    public List<VerifiedReference> getVerificationResults() {
+        if (verificationResults == null) {
+            return Collections.emptyList();
+        }
+        return Collections.unmodifiableList(verificationResults);
     }
 
     /**
      * Adds Resource Resolver for retrieving resources at specified {@code URI} attribute
      * in {@code reference} element
      *
-     * @param resolver {@link ResourceResolver} can provide the implemenatin subclass of
+     * @param resolver {@link ResourceResolver} can provide the implementation subclass of
      * {@link ResourceResolverSpi} for retrieving resource.
      */
     public void addResourceResolver(ResourceResolver resolver) {
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/Reference.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,6 @@
 import java.io.OutputStream;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.Base64;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -396,7 +395,7 @@
             n = n.getNextSibling();
         }
 
-        String base64codedValue = Base64.getMimeEncoder().encodeToString(digestValue);
+        String base64codedValue = XMLUtils.encodeToString(digestValue);
         Text t = createText(base64codedValue);
 
         digestValueElement.appendChild(t);
@@ -723,12 +722,17 @@
             return getPreCalculatedDigest(input);
         }
 
+        cacheDereferencedElement(input);
+
         MessageDigestAlgorithm mda = this.getMessageDigestAlgorithm();
         mda.reset();
 
         try (DigesterOutputStream diOs = new DigesterOutputStream(mda);
             OutputStream os = new UnsyncBufferedOutputStream(diOs)) {
-            XMLSignatureInput output = this.dereferenceURIandPerformTransforms(os);
+
+            XMLSignatureInput output = this.getContentsAfterTransformation(input, os);
+            this.transformsOutput = output;
+
             // if signing and c14n11 property == true explicitly add
             // C14N11 transform if needed
             if (Reference.useC14N11 && !validating && !output.isOutputStreamSet()
@@ -772,7 +776,7 @@
             throws ReferenceNotInitializedException {
         LOG.debug("Verifying element with pre-calculated digest");
         String preCalculatedDigest = input.getPreCalculatedDigest();
-        return Base64.getMimeDecoder().decode(preCalculatedDigest);
+        return XMLUtils.decode(preCalculatedDigest);
     }
 
     /**
@@ -789,8 +793,8 @@
                 "signature.Verification.NoSignatureElement", exArgs
             );
         }
-        String content = XMLUtils.getFullTextChildrenFromElement(digestValueElement);
-        return Base64.getMimeDecoder().decode(content);
+        String content = XMLUtils.getFullTextChildrenFromNode(digestValueElement);
+        return XMLUtils.decode(content);
     }
 
 
@@ -809,8 +813,8 @@
 
         if (!equal) {
             LOG.warn("Verification failed for URI \"" + this.getURI() + "\"");
-            LOG.warn("Expected Digest: " + Base64.getMimeEncoder().encodeToString(elemDig));
-            LOG.warn("Actual Digest: " + Base64.getMimeEncoder().encodeToString(calcDig));
+            LOG.warn("Expected Digest: " + XMLUtils.encodeToString(elemDig));
+            LOG.warn("Actual Digest: " + XMLUtils.encodeToString(calcDig));
         } else {
             LOG.debug("Verification successful for URI \"{}\"", this.getURI());
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/VerifiedReference.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,64 @@
+/*
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
+ */
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.sun.org.apache.xml.internal.security.signature;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Holds the result of a Reference validation.
+ */
+public class VerifiedReference {
+
+    private final boolean valid;
+    private final String uri;
+    private final List<VerifiedReference> manifestReferences;
+
+    /**
+     * @param valid Whether this Reference was successfully validated or not
+     * @param uri The URI of this Reference
+     * @param manifestReferences If this reference is a reference to a Manifest, this holds the list
+     * of verified referenes associated with this Manifest
+     */
+    public VerifiedReference(boolean valid, String uri, List<VerifiedReference> manifestReferences) {
+        this.valid = valid;
+        this.uri = uri;
+        if (manifestReferences != null) {
+            this.manifestReferences = manifestReferences;
+        } else {
+            this.manifestReferences = Collections.emptyList();
+        }
+    }
+
+    public boolean isValid() {
+        return valid;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public List<VerifiedReference> getManifestReferences() {
+        return Collections.unmodifiableList(manifestReferences);
+    }
+}
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Wed Feb 03 05:23:32 2021 +0000
@@ -27,7 +27,6 @@
 import java.security.Key;
 import java.security.PublicKey;
 import java.security.cert.X509Certificate;
-import java.util.Base64;
 
 import javax.crypto.SecretKey;
 
@@ -488,8 +487,8 @@
      * @throws XMLSignatureException If there is no content
      */
     public byte[] getSignatureValue() throws XMLSignatureException {
-        String content = XMLUtils.getFullTextChildrenFromElement(signatureValueElement);
-        return Base64.getMimeDecoder().decode(content);
+        String content = XMLUtils.getFullTextChildrenFromNode(signatureValueElement);
+        return XMLUtils.decode(content);
     }
 
     /**
@@ -504,7 +503,7 @@
             signatureValueElement.removeChild(signatureValueElement.getFirstChild());
         }
 
-        String base64codedValue = Base64.getMimeEncoder().encodeToString(bytes);
+        String base64codedValue = XMLUtils.encodeToString(bytes);
 
         if (base64codedValue.length() > 76 && !XMLUtils.ignoreLineBreaks()) {
             base64codedValue = "\n" + base64codedValue + "\n";
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformBase64Decode.java	Wed Feb 03 05:23:32 2021 +0000
@@ -24,7 +24,6 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.Base64;
 
 import javax.xml.parsers.ParserConfigurationException;
 
@@ -109,12 +108,12 @@
             StringBuilder sb = new StringBuilder();
             traverseElement((Element)el, sb);
             if (os == null) {
-                byte[] decodedBytes = Base64.getMimeDecoder().decode(sb.toString());
+                byte[] decodedBytes = XMLUtils.decode(sb.toString());
                 XMLSignatureInput output = new XMLSignatureInput(decodedBytes);
                 output.setSecureValidation(secureValidation);
                 return output;
             }
-            byte[] bytes = Base64.getMimeDecoder().decode(sb.toString());
+            byte[] bytes = XMLUtils.decode(sb.toString());
             os.write(bytes);
             XMLSignatureInput output = new XMLSignatureInput((byte[])null);
             output.setSecureValidation(secureValidation);
@@ -125,17 +124,17 @@
         if (input.isOctetStream() || input.isNodeSet()) {
             if (os == null) {
                 byte[] base64Bytes = input.getBytes();
-                byte[] decodedBytes = Base64.getMimeDecoder().decode(base64Bytes);
+                byte[] decodedBytes = XMLUtils.decode(base64Bytes);
                 XMLSignatureInput output = new XMLSignatureInput(decodedBytes);
                 output.setSecureValidation(secureValidation);
                 return output;
             }
             if (input.isByteArray() || input.isNodeSet()) {
-                byte[] bytes = Base64.getMimeDecoder().decode(input.getBytes());
+                byte[] bytes = XMLUtils.decode(input.getBytes());
                 os.write(bytes);
             } else {
                 byte[] inputBytes = JavaUtils.getBytesFromStream(input.getOctetStreamReal());
-                byte[] bytes = Base64.getMimeDecoder().decode(inputBytes);
+                byte[] bytes = XMLUtils.decode(inputBytes);
                 os.write(bytes);
             }
             XMLSignatureInput output = new XMLSignatureInput((byte[])null);
@@ -153,7 +152,7 @@
             Element rootNode = doc.getDocumentElement();
             StringBuilder sb = new StringBuilder();
             traverseElement(rootNode, sb);
-            byte[] decodedBytes = Base64.getMimeDecoder().decode(sb.toString());
+            byte[] decodedBytes = XMLUtils.decode(sb.toString());
             XMLSignatureInput output = new XMLSignatureInput(decodedBytes);
             output.setSecureValidation(secureValidation);
             return output;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/implementations/TransformXSLT.java	Wed Feb 03 05:23:32 2021 +0000
@@ -84,7 +84,10 @@
 
             Element xsltElement =
                 XMLUtils.selectNode(transformElement.getFirstChild(), XSLTSpecNS, "stylesheet", 0);
-
+            if (xsltElement == null) {
+                xsltElement =
+                    XMLUtils.selectNode(transformElement.getFirstChild(), XSLTSpecNS, "transform", 0);
+            }
             if (xsltElement == null) {
                 Object exArgs[] = { "xslt:stylesheet", "Transform" };
 
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPathFilterCHGPContainer.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/XPathFilterCHGPContainer.java	Wed Feb 03 05:23:32 2021 +0000
@@ -30,6 +30,7 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.Text;
 
 /**
  * Implements the parameters for a custom Transform which has a better performance
@@ -204,7 +205,7 @@
                 getElement().getFirstChild(), this.getBaseNamespace(), type, 0
             );
 
-        return XMLUtils.getFullTextChildrenFromElement(xElem);
+        return XMLUtils.getFullTextChildrenFromNode(xElem);
     }
 
     /**
@@ -258,11 +259,23 @@
             return null;
         }
 
-        return XMLUtils.selectNodeText(
+        return selectNodeText(
             getFirstChild(), this.getBaseNamespace(), type, 0
         );
     }
 
+    private static Text selectNodeText(Node sibling, String uri, String nodeName, int number) {
+        Node n = XMLUtils.selectNode(sibling, uri, nodeName, number);
+        if (n == null) {
+            return null;
+        }
+        n = n.getFirstChild();
+        while (n != null && n.getNodeType() != Node.TEXT_NODE) {
+            n = n.getNextSibling();
+        }
+        return (Text)n;
+    }
+
     /**
      * Method getHereContextNodeIncludeButSearch
      *
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java	Wed Feb 03 05:23:32 2021 +0000
@@ -210,6 +210,9 @@
     /** Tag of Element J **/
     public static final String _TAG_J = "J";
 
+    /** Tag of Element ECKeyValue **/
+    public static final String _TAG_ECKEYVALUE = "ECKeyValue";
+
     /** Tag of Element Seed **/
     public static final String _TAG_SEED = "Seed";
 
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java	Wed Feb 03 05:23:32 2021 +0000
@@ -24,7 +24,6 @@
 
 import java.math.BigInteger;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.Base64;
 import java.util.Map;
 
 import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
@@ -267,7 +266,7 @@
             Element e = XMLUtils.createElementInSignatureSpace(getDocument(), localname);
 
             byte[] bytes = XMLUtils.getBytes(bi, bi.bitLength());
-            String encodedInt = Base64.getMimeEncoder().encodeToString(bytes);
+            String encodedInt = XMLUtils.encodeToString(bytes);
 
             Document doc = e.getOwnerDocument();
             Text text = doc.createTextNode(encodedInt);
@@ -292,7 +291,7 @@
     public void addBase64Element(byte[] bytes, String localname) {
         if (bytes != null) {
             Element el = XMLUtils.createElementInSignatureSpace(getDocument(), localname);
-            Text text = getDocument().createTextNode(Base64.getMimeEncoder().encodeToString(bytes));
+            Text text = getDocument().createTextNode(XMLUtils.encodeToString(bytes));
 
             el.appendChild(text);
 
@@ -326,8 +325,8 @@
     public void addBase64Text(byte[] bytes) {
         if (bytes != null) {
             Text t = XMLUtils.ignoreLineBreaks()
-                ? createText(Base64.getMimeEncoder().encodeToString(bytes))
-                : createText("\n" + Base64.getMimeEncoder().encodeToString(bytes) + "\n");
+                ? createText(XMLUtils.encodeToString(bytes))
+                : createText("\n" + XMLUtils.encodeToString(bytes) + "\n");
             appendSelf(t);
         }
     }
@@ -367,11 +366,11 @@
     public BigInteger getBigIntegerFromChildElement(
         String localname, String namespace
     ) {
-        return new BigInteger(1, Base64.getMimeDecoder().decode(
-            XMLUtils.selectNodeText(
-                getFirstChild(), namespace, localname, 0
-            ).getNodeValue()
-        ));
+        Node n = XMLUtils.selectNode(getFirstChild(), namespace, localname, 0);
+        if (n != null) {
+            return new BigInteger(1, XMLUtils.decode(XMLUtils.getFullTextChildrenFromNode(n)));
+        }
+        return null;
     }
 
     /**
@@ -396,7 +395,7 @@
      * @throws XMLSecurityException
      */
     public byte[] getBytesFromTextChild() throws XMLSecurityException {
-        return Base64.getMimeDecoder().decode(getTextFromTextChild());
+        return XMLUtils.decode(getTextFromTextChild());
     }
 
     /**
@@ -406,7 +405,7 @@
      *    element
      */
     public String getTextFromTextChild() {
-        return XMLUtils.getFullTextChildrenFromElement(getElement());
+        return XMLUtils.getFullTextChildrenFromNode(getElement());
     }
 
     /**
@@ -498,8 +497,9 @@
 
         if (Constants.SignatureSpecNS.equals(namespace)) {
             XMLUtils.setDsPrefix(prefix);
-        }
-        if (EncryptionConstants.EncryptionSpecNS.equals(namespace)) {
+        } else if (Constants.SignatureSpec11NS.equals(namespace)) {
+            XMLUtils.setDs11Prefix(prefix);
+        } else if (EncryptionConstants.EncryptionSpecNS.equals(namespace)) {
             XMLUtils.setXencPrefix(prefix);
         }
         prefixMappings.put(namespace, prefix);
@@ -519,6 +519,7 @@
         setNamespacePrefix(
             "http://www.nue.et-inf.uni-siegen.de/~geuer-pollmann/#xpathFilter", "xx"
         );
+        setNamespacePrefix("http://www.w3.org/2009/xmldsig11#", "dsig11");
     }
 
     /**
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Signature11ElementProxy.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Signature11ElementProxy.java	Wed Feb 03 05:23:32 2021 +0000
@@ -47,6 +47,13 @@
 
         setDocument(doc);
         setElement(XMLUtils.createElementInSignature11Space(doc, this.getBaseLocalName()));
+
+        String prefix = ElementProxy.getDefaultPrefix(getBaseNamespace());
+        if (prefix == null || prefix.length() == 0) {
+            getElement().setAttributeNS(Constants.NamespaceSpecNS, "xmlns", getBaseNamespace());
+        } else {
+            getElement().setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix, getBaseNamespace());
+        }
     }
 
     /**
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java	Wed Feb 03 05:23:32 2021 +0000
@@ -258,16 +258,21 @@
         }
     }
 
+    @Deprecated
+    public static String getFullTextChildrenFromElement(Element element) {
+        return getFullTextChildrenFromNode(element);
+    }
+
     /**
-     * Method getFullTextChildrenFromElement
+     * Method getFullTextChildrenFromNode
      *
-     * @param element
+     * @param node
      * @return the string of children
      */
-    public static String getFullTextChildrenFromElement(Element element) {
+    public static String getFullTextChildrenFromNode(Node node) {
         StringBuilder sb = new StringBuilder();
 
-        Node child = element.getFirstChild();
+        Node child = node.getFirstChild();
         while (child != null) {
             if (child.getNodeType() == Node.TEXT_NODE) {
                 sb.append(((Text)child).getData());
@@ -689,7 +694,7 @@
         while (sibling != null) {
             if (sibling.getNamespaceURI() != null && sibling.getNamespaceURI().equals(uri)
                 && sibling.getLocalName().equals(nodeName)) {
-                if (number == 0){
+                if (number == 0) {
                     return (Element)sibling;
                 }
                 number--;
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/ResourceResolver.java	Wed Feb 03 05:23:32 2021 +0000
@@ -96,7 +96,7 @@
 
                 LOG.debug("check resolvability by class {}", resolverTmp.getClass().getName());
 
-                if (resolverTmp != null && resolverTmp.canResolve(context)) {
+                if (resolverTmp.canResolve(context)) {
                     // Check to see whether the Resolver is allowed
                     if (context.secureValidation
                         && (resolverTmp.resolverSpi instanceof ResolverLocalFilesystem
--- a/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/com/sun/org/apache/xml/internal/security/utils/resolver/implementations/ResolverDirectHTTP.java	Wed Feb 03 05:23:32 2021 +0000
@@ -33,9 +33,9 @@
 import java.net.URL;
 import java.net.URLConnection;
 import java.nio.charset.StandardCharsets;
-import java.util.Base64;
 
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
+import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverContext;
 import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException;
 import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi;
@@ -57,7 +57,7 @@
  * </PRE>
  *
  * @see <A HREF="http://www.javaworld.com/javaworld/javatips/jw-javatip42_p.html">Java Tip 42: Write Java apps that work with proxy-based firewalls</A>
- * @see <A HREF="https://docs.oracle.com/javase/1.4.2/docs/guide/net/properties.html">SUN J2SE docs for network properties</A>
+ * @see <A HREF="https://docs.oracle.com/javase/8/docs/technotes/guides/net/properties.html">JDK docs for network properties</A>
  * @see <A HREF="http://metalab.unc.edu/javafaq/javafaq.html#proxy">The JAVA FAQ Question 9.5: How do I make Java work with a proxy server?</A>
  */
 public class ResolverDirectHTTP extends ResourceResolverSpi {
@@ -122,7 +122,7 @@
                     urlConnection = openConnection(url);
 
                     String password = user + ":" + pass;
-                    String encodedPassword = Base64.getMimeEncoder().encodeToString(password.getBytes(StandardCharsets.ISO_8859_1));
+                    String encodedPassword = XMLUtils.encodeToString(password.getBytes(StandardCharsets.ISO_8859_1));
 
                     // set authentication property in the http header
                     urlConnection.setRequestProperty("Authorization",
@@ -187,7 +187,7 @@
 
             if (proxyUser != null && proxyPass != null) {
                 String password = proxyUser + ":" + proxyPass;
-                String authString = "Basic " + Base64.getMimeEncoder().encodeToString(password.getBytes(StandardCharsets.ISO_8859_1));
+                String authString = "Basic " + XMLUtils.encodeToString(password.getBytes(StandardCharsets.ISO_8859_1));
 
                 urlConnection.setRequestProperty("Proxy-Authorization", authString);
             }
--- a/src/share/classes/java/lang/management/ThreadMXBean.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/java/lang/management/ThreadMXBean.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -160,7 +160,7 @@
      *
      * @return an array of <tt>long</tt>, each is a thread ID.
      *
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
      */
@@ -199,7 +199,7 @@
      * it does not exist.
      *
      * @throws IllegalArgumentException if {@code id <= 0}.
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
      */
@@ -237,7 +237,7 @@
      *
      * @throws IllegalArgumentException if any element in the input array
      *         <tt>ids</tt> is {@code <= 0}.
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
      */
@@ -284,7 +284,7 @@
      *
      * @throws IllegalArgumentException if {@code id <= 0}.
      * @throws IllegalArgumentException if <tt>maxDepth is negative</tt>.
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
      *
@@ -337,7 +337,7 @@
      * @throws IllegalArgumentException if <tt>maxDepth is negative</tt>.
      * @throws IllegalArgumentException if any element in the input array
      *      <tt>ids</tt> is {@code <= 0}.
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
      *
@@ -360,7 +360,7 @@
      * @return <tt>true</tt> if thread contention monitoring is enabled;
      *         <tt>false</tt> otherwise.
      *
-     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     * @throws UnsupportedOperationException if the Java virtual
      * machine does not support thread contention monitoring.
      *
      * @see #isThreadContentionMonitoringSupported
@@ -374,10 +374,10 @@
      * @param enable <tt>true</tt> to enable;
      *               <tt>false</tt> to disable.
      *
-     * @throws java.lang.UnsupportedOperationException if the Java
+     * @throws UnsupportedOperationException if the Java
      * virtual machine does not support thread contention monitoring.
      *
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("control").
      *
@@ -394,7 +394,7 @@
      * the current thread has executed in user mode or system mode.
      *
      * <p>
-     * This is a convenient method for local management use and is
+     * This is a convenience method for local management use and is
      * equivalent to calling:
      * <blockquote><pre>
      *   {@link #getThreadCpuTime getThreadCpuTime}(Thread.currentThread().getId());
@@ -403,7 +403,7 @@
      * @return the total CPU time for the current thread if CPU time
      * measurement is enabled; <tt>-1</tt> otherwise.
      *
-     * @throws java.lang.UnsupportedOperationException if the Java
+     * @throws UnsupportedOperationException if the Java
      * virtual machine does not support CPU time measurement for
      * the current thread.
      *
@@ -421,7 +421,7 @@
      * not necessarily nanoseconds accuracy.
      *
      * <p>
-     * This is a convenient method for local management use and is
+     * This is a convenience method for local management use and is
      * equivalent to calling:
      * <blockquote><pre>
      *   {@link #getThreadUserTime getThreadUserTime}(Thread.currentThread().getId());
@@ -430,7 +430,7 @@
      * @return the user-level CPU time for the current thread if CPU time
      * measurement is enabled; <tt>-1</tt> otherwise.
      *
-     * @throws java.lang.UnsupportedOperationException if the Java
+     * @throws UnsupportedOperationException if the Java
      * virtual machine does not support CPU time measurement for
      * the current thread.
      *
@@ -467,7 +467,7 @@
      * <tt>-1</tt> otherwise.
      *
      * @throws IllegalArgumentException if {@code id <= 0}.
-     * @throws java.lang.UnsupportedOperationException if the Java
+     * @throws UnsupportedOperationException if the Java
      * virtual machine does not support CPU time measurement for
      * other threads.
      *
@@ -502,7 +502,7 @@
      * <tt>-1</tt> otherwise.
      *
      * @throws IllegalArgumentException if {@code id <= 0}.
-     * @throws java.lang.UnsupportedOperationException if the Java
+     * @throws UnsupportedOperationException if the Java
      * virtual machine does not support CPU time measurement for
      * other threads.
      *
@@ -548,7 +548,7 @@
      * @return <tt>true</tt> if thread CPU time measurement is enabled;
      *         <tt>false</tt> otherwise.
      *
-     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     * @throws UnsupportedOperationException if the Java virtual
      * machine does not support CPU time measurement for other threads
      * nor for the current thread.
      *
@@ -564,11 +564,11 @@
      * @param enable <tt>true</tt> to enable;
      *               <tt>false</tt> to disable.
      *
-     * @throws java.lang.UnsupportedOperationException if the Java
+     * @throws UnsupportedOperationException if the Java
      * virtual machine does not support CPU time measurement for
      * any threads nor for the current thread.
      *
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("control").
      *
@@ -604,7 +604,7 @@
      * @return an array of IDs of the threads that are monitor
      * deadlocked, if any; <tt>null</tt> otherwise.
      *
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
      *
@@ -616,7 +616,7 @@
      * Resets the peak thread count to the current number of
      * live threads.
      *
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("control").
      *
@@ -642,10 +642,10 @@
      * deadlocked waiting for object monitors or ownable synchronizers, if any;
      * <tt>null</tt> otherwise.
      *
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
-     * @throws java.lang.UnsupportedOperationException if the Java virtual
+     * @throws UnsupportedOperationException if the Java virtual
      * machine does not support monitoring of ownable synchronizer usage.
      *
      * @see #isSynchronizerUsageSupported
@@ -743,10 +743,10 @@
      * information about a thread whose ID is in the corresponding
      * element of the input array of IDs.
      *
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
-     * @throws java.lang.UnsupportedOperationException
+     * @throws UnsupportedOperationException
      *         <ul>
      *           <li>if <tt>lockedMonitors</tt> is <tt>true</tt> but
      *               the Java virtual machine does not support monitoring
@@ -782,10 +782,10 @@
      *
      * @return an array of {@link ThreadInfo} for all live threads.
      *
-     * @throws java.lang.SecurityException if a security manager
+     * @throws SecurityException if a security manager
      *         exists and the caller does not have
      *         ManagementPermission("monitor").
-     * @throws java.lang.UnsupportedOperationException
+     * @throws UnsupportedOperationException
      *         <ul>
      *           <li>if <tt>lockedMonitors</tt> is <tt>true</tt> but
      *               the Java virtual machine does not support monitoring
--- a/src/share/classes/java/net/URI.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/java/net/URI.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1950,7 +1950,6 @@
         StringBuffer sb = new StringBuffer();
         appendSchemeSpecificPart(sb, null, getAuthority(), getUserInfo(),
                                  host, port, getPath(), getQuery());
-        if (sb.length() == 0) return;
         schemeSpecificPart = sb.toString();
     }
 
--- a/src/share/classes/java/nio/Buffer.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/java/nio/Buffer.java	Wed Feb 03 05:23:32 2021 +0000
@@ -242,8 +242,8 @@
     public final Buffer position(int newPosition) {
         if ((newPosition > limit) || (newPosition < 0))
             throw new IllegalArgumentException();
+        if (mark > newPosition) mark = -1;
         position = newPosition;
-        if (mark > position) mark = -1;
         return this;
     }
 
@@ -388,7 +388,8 @@
      * @return  The number of elements remaining in this buffer
      */
     public final int remaining() {
-        return limit - position;
+        int rem = limit - position;
+        return rem > 0 ? rem : 0;
     }
 
     /**
--- a/src/share/classes/java/nio/Heap-X-Buffer.java.template	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/java/nio/Heap-X-Buffer.java.template	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2020, 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
@@ -234,7 +234,9 @@
     public $Type$Buffer compact() {
 #if[rw]
         int pos = position();
-        int rem = limit() - pos;
+        int lim = limit();
+        assert (pos <= lim);
+        int rem = (pos <= lim ? lim - pos : 0);
         System.arraycopy(hb, ix(pos), hb, ix(0), rem);
         position(rem);
         limit(capacity());
--- a/src/share/classes/java/nio/X-Buffer.java.template	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/java/nio/X-Buffer.java.template	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2020, 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
@@ -414,15 +414,23 @@
      */
     public int read(CharBuffer target) throws IOException {
         // Determine the number of bytes n that can be transferred
+        int limit = limit();
+        int pos = position();
+        int remaining = limit - pos;
+        assert remaining >= 0;
+        if (remaining <= 0) // include equality condition when remaining == 0
+            return -1;
+
         int targetRemaining = target.remaining();
-        int limit = limit();
-        int remaining = limit - position();
-        if (remaining == 0)
-            return -1;
+        assert targetRemaining >= 0;
+        if (targetRemaining <= 0) // include condition targetRemaining == 0
+            return 0;
+
         int n = Math.min(remaining, targetRemaining);
+
         // Set source limit to prevent target overflow
         if (targetRemaining < remaining)
-            limit(position() + n);
+            limit(pos + n);
         try {
             if (n > 0)
                 target.put(this);
--- a/src/share/classes/java/util/CurrencyData.properties	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/java/util/CurrencyData.properties	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2020, 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
@@ -49,7 +49,7 @@
     LVL428-LYD434-MAD504-MDL498-MGA969-MGF450-MKD807-MMK104-MNT496-MOP446-MRO478-MRU929-\
     MTL470-MUR480-MVR462-MWK454-MXN484-MXV979-MYR458-MZM508-MZN943-NAD516-NGN566-\
     NIO558-NLG528-NOK578-NPR524-NZD554-OMR512-PAB590-PEN604-PGK598-PHP608-\
-    PKR586-PLN985-PTE620-PYG600-QAR634-ROL946-RON946-RSD941-RUB643-RUR810-RWF646-SAR682-\
+    PKR586-PLN985-PTE620-PYG600-QAR634-ROL642-RON946-RSD941-RUB643-RUR810-RWF646-SAR682-\
     SBD090-SCR690-SDD736-SDG938-SEK752-SGD702-SHP654-SIT705-SKK703-SLL694-SOS706-\
     SRD968-SRG740-SSP728-STD678-STN930-SVC222-SYP760-SZL748-THB764-TJS972-TMM795-TMT934-TND788-TOP776-\
     TPE626-TRL792-TRY949-TTD780-TWD901-TZS834-UAH980-UGX800-USD840-USN997-USS998-UYI940-\
@@ -587,7 +587,7 @@
 
 minor0=\
     ADP-BEF-BIF-BYB-BYR-CLP-DJF-ESP-GNF-\
-    GRD-ISK-ITL-JPY-KMF-KRW-LUF-MGF-PYG-PTE-RWF-\
+    GRD-ISK-ITL-JPY-KMF-KRW-LUF-MGF-PYG-PTE-ROL-RWF-\
     TPE-TRL-UGX-UYI-VND-VUV-XAF-XOF-XPF
 minor3=\
     BHD-IQD-JOD-KWD-LYD-OMR-TND
--- a/src/share/classes/java/util/concurrent/ForkJoinPool.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/java/util/concurrent/ForkJoinPool.java	Wed Feb 03 05:23:32 2021 +0000
@@ -728,7 +728,7 @@
     static final class DefaultForkJoinWorkerThreadFactory
         implements ForkJoinWorkerThreadFactory {
         public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
-            return new ForkJoinWorkerThread(pool, true);
+            return new ForkJoinWorkerThread(pool);
         }
     }
 
@@ -3427,7 +3427,7 @@
         }
         if (factory == null) {
             if (System.getSecurityManager() == null)
-                factory = defaultForkJoinWorkerThreadFactory;
+                factory = new DefaultCommonPoolForkJoinWorkerThreadFactory();
             else // use security-managed default
                 factory = new InnocuousForkJoinWorkerThreadFactory();
         }
@@ -3441,6 +3441,16 @@
     }
 
     /**
+     * Default factory for the common pool
+     */
+    static final class DefaultCommonPoolForkJoinWorkerThreadFactory
+        implements ForkJoinWorkerThreadFactory {
+        public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
+            return new ForkJoinWorkerThread(pool, true);
+        }
+    }
+
+    /**
      * Factory for innocuous worker threads
      */
     static final class InnocuousForkJoinWorkerThreadFactory
--- a/src/share/classes/jdk/jfr/internal/PlatformRecording.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/jdk/jfr/internal/PlatformRecording.java	Wed Feb 03 05:23:32 2021 +0000
@@ -318,7 +318,6 @@
         PlatformRecording clone = recorder.newTemporaryRecording();
         clone.setShouldWriteActiveRecordingEvent(false);
         clone.setName(getName());
-        clone.setDestination(this.destination);
         clone.setToDisk(true);
         // We purposely don't clone settings here, since
         // a union a == a
--- a/src/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/jdk/jfr/internal/dcmd/DCmdDump.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,6 +26,8 @@
 
 import java.io.IOException;
 import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.time.Duration;
 import java.time.Instant;
 import java.time.LocalDate;
@@ -126,26 +128,37 @@
             recording = findRecording(name);
         }
         PlatformRecorder recorder = PrivateAccess.getInstance().getPlatformRecorder();
-        synchronized (recorder) {
-            dump(recorder, recording, name, filename, maxSize, pathToGcRoots, beginTime, endTime);
+
+        try {
+            synchronized (recorder) {
+                dump(recorder, recording, name, filename, maxSize, pathToGcRoots, beginTime, endTime);
+            }
+        } catch (IOException | InvalidPathException e) {
+            throw new DCmdException("Dump failed. Could not copy recording data. %s", e.getMessage());
         }
         return getResult();
     }
 
-    public void dump(PlatformRecorder recorder, Recording recording, String name, String filename, Long maxSize, Boolean pathToGcRoots, Instant beginTime, Instant endTime) throws DCmdException {
+    public void dump(PlatformRecorder recorder, Recording recording, String name, String filename, Long maxSize, Boolean pathToGcRoots, Instant beginTime, Instant endTime) throws DCmdException, IOException {
         try (PlatformRecording r = newSnapShot(recorder, recording, pathToGcRoots)) {
             r.filter(beginTime, endTime, maxSize);
             if (r.getChunks().isEmpty()) {
                 throw new DCmdException("Dump failed. No data found in the specified interval.");
             }
-            SafePath dumpFile = resolvePath(recording, filename);
-
-            // Needed for JVM
-            Utils.touch(dumpFile.toPath());
-            r.dumpStopped(new WriteableUserPath(dumpFile.toPath()));
-            reportOperationComplete("Dumped", name, dumpFile);
-        } catch (IOException | InvalidPathException e) {
-            throw new DCmdException("Dump failed. Could not copy recording data. %s", e.getMessage());
+            // If a filename exist, use it
+            // if a filename doesn't exist, use destination set earlier
+            // if destination doesn't exist, generate a filename
+            WriteableUserPath wup = null;
+            if (recording != null) {
+                PlatformRecording pRecording = PrivateAccess.getInstance().getPlatformRecording(recording);
+                wup = pRecording.getDestination();
+            }
+            if (filename != null || (filename == null && wup == null) ) {
+                SafePath safe = resolvePath(recording, filename);
+                wup = new WriteableUserPath(safe.toPath());
+            }
+            r.dumpStopped(wup);
+            reportOperationComplete("Dumped", name, new SafePath(wup.getRealPathText()));
         }
     }
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: ApacheCanonicalizer.java 1785016 2017-03-01 18:23:48Z coheigea $
+ * $Id: ApacheCanonicalizer.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheOctetStreamData.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheOctetStreamData.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: ApacheOctetStreamData.java 1667527 2015-03-18 12:54:20Z mullan $
+ * $Id: ApacheOctetStreamData.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: ApacheTransform.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: ApacheTransform.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14NMethod.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14NMethod.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMCanonicalXMLC14NMethod.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMCanonicalXMLC14NMethod.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,3 +1,7 @@
+/*
+ * reserved comment block
+ * DO NOT REMOVE OR ALTER!
+ */
 /**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements. See the NOTICE file
@@ -17,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id$
@@ -33,16 +37,16 @@
 import org.w3c.dom.Text;
 
 /**
- * A DOM-based representation of the XML <code>CryptoBinary</code> simple type
+ * A DOM-based representation of the XML {@code CryptoBinary} simple type
  * as defined in the W3C specification for XML-Signature Syntax and Processing.
  * The XML Schema Definition is defined as:
  *
- * <xmp>
+ * <pre>{@code
  * <simpleType name="CryptoBinary">
  *   <restriction base = "base64Binary">
  *   </restriction>
  * </simpleType>
- * </xmp>
+ * }</pre>
  *
  * @author Sean Mullan
  */
@@ -52,11 +56,11 @@
     private final String value;
 
     /**
-     * Create a <code>DOMCryptoBinary</code> instance from the specified
-     * <code>BigInteger</code>
+     * Create a {@code DOMCryptoBinary} instance from the specified
+     * {@code BigInteger}
      *
      * @param bigNum the arbitrary-length integer
-     * @throws NullPointerException if <code>bigNum</code> is <code>null</code>
+     * @throws NullPointerException if {@code bigNum} is {@code null}
      */
     public DOMCryptoBinary(BigInteger bigNum) {
         if (bigNum == null) {
@@ -69,7 +73,7 @@
     }
 
     /**
-     * Creates a <code>DOMCryptoBinary</code> from a node.
+     * Creates a {@code DOMCryptoBinary} from a node.
      *
      * @param cbNode a CryptoBinary text node
      * @throws MarshalException if value cannot be decoded (invalid format)
@@ -84,9 +88,9 @@
     }
 
     /**
-     * Returns the <code>BigInteger</code> that this object contains.
+     * Returns the {@code BigInteger} that this object contains.
      *
-     * @return the <code>BigInteger</code> that this object contains
+     * @return the {@code BigInteger} that this object contains
      */
     public BigInteger getBigNum() {
         return bigNum;
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMDigestMethod.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMDigestMethod.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMDigestMethod.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMDigestMethod.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMEnvelopedTransform.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMEnvelopedTransform.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMEnvelopedTransform.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMEnvelopedTransform.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMExcC14NMethod.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMExcC14NMethod.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMHMACSignatureMethod.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMHMACSignatureMethod.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMHMACSignatureMethod.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMHMACSignatureMethod.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMKeyInfo.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMKeyInfo.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMKeyInfoFactory.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMKeyInfoFactory.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyName.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyName.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMKeyName.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMKeyName.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,18 +21,13 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMKeyValue.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMKeyValue.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
-import javax.xml.crypto.*;
-import javax.xml.crypto.dom.DOMCryptoContext;
-import javax.xml.crypto.dsig.*;
-import javax.xml.crypto.dsig.keyinfo.KeyValue;
-
 import java.io.IOException;
 import java.math.BigInteger;
 import java.security.KeyException;
@@ -55,6 +50,11 @@
 import java.security.spec.RSAPublicKeySpec;
 import java.util.Arrays;
 
+import javax.xml.crypto.MarshalException;
+import javax.xml.crypto.dom.DOMCryptoContext;
+import javax.xml.crypto.dsig.XMLSignature;
+import javax.xml.crypto.dsig.keyinfo.KeyValue;
+
 import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -500,7 +500,7 @@
                 throw new MarshalException("Invalid ECParameterSpec");
             }
             DOMUtils.setAttribute(namedCurveElem, "URI", "urn:oid:" + oid);
-            String qname = (prefix == null || prefix.length() == 0)
+            String qname = prefix == null || prefix.length() == 0
                        ? "xmlns" : "xmlns:" + prefix;
             namedCurveElem.setAttributeNS("http://www.w3.org/2000/xmlns/",
                                           qname, XMLDSIG_11_XMLNS);
@@ -554,7 +554,7 @@
             ECPoint ecPoint = null;
 
             try {
-                String content = XMLUtils.getFullTextChildrenFromElement(curElem);
+                String content = XMLUtils.getFullTextChildrenFromNode(curElem);
                 ecPoint = decodePoint(XMLUtils.decode(content),
                                       ecParams.getCurve());
             } catch (IOException ioe) {
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMManifest.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMManifest.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMPGPData.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMPGPData.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
@@ -56,7 +56,7 @@
      * and optional list of external elements.
      *
      * @param keyPacket a PGP Key Material Packet as defined in section 5.5 of
-     *    <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>. The
+     *    <a href="https://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>. The
      *    array is cloned to prevent subsequent modification.
      * @param other a list of {@link XMLStructure}s representing elements from
      *    an external namespace. The list is defensively copied to prevent
@@ -94,10 +94,10 @@
      * optional key packet and list of external elements.
      *
      * @param keyId a PGP public key id as defined in section 11.2 of
-     *    <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>. The
+     *    <a href="https://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>. The
      *    array is cloned to prevent subsequent modification.
      * @param keyPacket a PGP Key Material Packet as defined in section 5.5 of
-     *    <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a> (may
+     *    <a href="https://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a> (may
      *    be {@code null}). The array is cloned to prevent subsequent
      *    modification.
      * @param other a list of {@link XMLStructure}s representing elements from
@@ -157,10 +157,10 @@
                 String localName = childElem.getLocalName();
                 String namespace = childElem.getNamespaceURI();
                 if ("PGPKeyID".equals(localName) && XMLSignature.XMLNS.equals(namespace)) {
-                    String content = XMLUtils.getFullTextChildrenFromElement(childElem);
+                    String content = XMLUtils.getFullTextChildrenFromNode(childElem);
                     pgpKeyId = XMLUtils.decode(content);
                 } else if ("PGPKeyPacket".equals(localName) && XMLSignature.XMLNS.equals(namespace)) {
-                    String content = XMLUtils.getFullTextChildrenFromElement(childElem);
+                    String content = XMLUtils.getFullTextChildrenFromNode(childElem);
                     pgpKeyPacket = XMLUtils.decode(content);
                 } else {
                     other.add
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Portions copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Portions copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * ===========================================================================
@@ -31,7 +31,7 @@
  * ===========================================================================
  */
 /*
- * $Id: DOMReference.java 1803518 2017-07-31 11:02:52Z coheigea $
+ * $Id: DOMReference.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
@@ -56,7 +56,6 @@
 import org.jcp.xml.dsig.internal.DigesterOutputStream;
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
 import com.sun.org.apache.xml.internal.security.utils.UnsyncBufferedOutputStream;
-import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 
 /**
  * DOM-based implementation of Reference.
@@ -244,7 +243,7 @@
 
         // unmarshal DigestValue
         Element dvElem = DOMUtils.getNextSiblingElement(dmElem, "DigestValue", XMLSignature.XMLNS);
-        String content = XMLUtils.getFullTextChildrenFromElement(dvElem);
+        String content = XMLUtils.getFullTextChildrenFromNode(dvElem);
         this.digestValue = XMLUtils.decode(content);
 
         // check for extra elements
@@ -311,6 +310,7 @@
 
         refElem = DOMUtils.createElement(ownerDoc, "Reference",
                                          XMLSignature.XMLNS, dsPrefix);
+
         // set attributes
         DOMUtils.setAttributeID(refElem, "Id", id);
         DOMUtils.setAttribute(refElem, "URI", uri);
@@ -341,7 +341,6 @@
         if (digestValue != null) {
             digestValueElem.appendChild
                 (ownerDoc.createTextNode(XMLUtils.encodeToString(digestValue)));
-
         }
         refElem.appendChild(digestValueElem);
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Portions copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Portions copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * ===========================================================================
@@ -31,7 +31,7 @@
  * ===========================================================================
  */
 /*
- * $Id: DOMRetrievalMethod.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMRetrievalMethod.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMSignatureMethod.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMSignatureMethod.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMSignatureProperties.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMSignatureProperties.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMSignatureProperty.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMSignatureProperty.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMSignedInfo.java 1820179 2018-01-04 19:09:52Z mullan $
+ * $Id: DOMSignedInfo.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMStructure.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMStructure.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMStructure.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMStructure.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMTransform.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMTransform.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMURIDereferencer.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMURIDereferencer.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMUtils.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMUtils.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
@@ -92,7 +92,7 @@
     public static Element createElement(Document doc, String tag,
                                         String nsURI, String prefix)
     {
-        String qName = (prefix == null || prefix.length() == 0)
+        String qName = prefix == null || prefix.length() == 0
                        ? tag : prefix + ":" + tag;
         return doc.createElementNS(nsURI, qName);
     }
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMX509Data.java 1789702 2017-03-31 15:15:04Z coheigea $
+ * $Id: DOMX509Data.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
@@ -33,12 +33,13 @@
 import java.security.cert.*;
 import java.util.*;
 
-import javax.xml.crypto.*;
+import javax.security.auth.x500.X500Principal;
+import javax.xml.crypto.MarshalException;
+import javax.xml.crypto.XMLStructure;
 import javax.xml.crypto.dom.DOMCryptoContext;
-import javax.xml.crypto.dsig.*;
+import javax.xml.crypto.dsig.XMLSignature;
 import javax.xml.crypto.dsig.keyinfo.X509Data;
 import javax.xml.crypto.dsig.keyinfo.X509IssuerSerial;
-import javax.security.auth.x500.X500Principal;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -115,7 +116,7 @@
                 } else if ("X509SubjectName".equals(localName) && XMLSignature.XMLNS.equals(namespace)) {
                     newContent.add(childElem.getFirstChild().getNodeValue());
                 } else if ("X509SKI".equals(localName) && XMLSignature.XMLNS.equals(namespace)) {
-                    String content = XMLUtils.getFullTextChildrenFromElement(childElem);
+                    String content = XMLUtils.getFullTextChildrenFromNode(childElem);
                     newContent.add(XMLUtils.decode(content));
                 } else if ("X509CRL".equals(localName) && XMLSignature.XMLNS.equals(namespace)) {
                     newContent.add(unmarshalX509CRL(childElem));
@@ -132,6 +133,7 @@
         return content;
     }
 
+    @Override
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
         throws MarshalException
     {
@@ -241,7 +243,7 @@
             if (cf == null) {
                 cf = CertificateFactory.getInstance("X.509");
             }
-            String content = XMLUtils.getFullTextChildrenFromElement(elem);
+            String content = XMLUtils.getFullTextChildrenFromNode(elem);
             return new ByteArrayInputStream(XMLUtils.decode(content));
         } catch (CertificateException e) {
             throw new MarshalException("Cannot create CertificateFactory", e);
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMX509IssuerSerial.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMX509IssuerSerial.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMXMLObject.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMXMLObject.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Portions copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Portions copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * ===========================================================================
@@ -31,7 +31,7 @@
  * ===========================================================================
  */
 /*
- * $Id: DOMXMLSignature.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMXMLSignature.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
@@ -509,7 +509,7 @@
             throws MarshalException
         {
             // base64 decode signatureValue
-            String content = XMLUtils.getFullTextChildrenFromElement(sigValueElem);
+            String content = XMLUtils.getFullTextChildrenFromNode(sigValueElem);
             value = XMLUtils.decode(content);
 
             Attr attr = sigValueElem.getAttributeNodeNS(null, "Id");
@@ -613,6 +613,7 @@
                             DOMCryptoContext context)
             throws MarshalException
         {
+            // create SignatureValue element
             sigValueElem = DOMUtils.createElement(ownerDoc, "SignatureValue",
                                                   XMLSignature.XMLNS, dsPrefix);
             if (valueBase64 != null) {
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMXMLSignatureFactory.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMXMLSignatureFactory.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
@@ -251,8 +251,6 @@
             return new DOMSignatureMethod.SHA384withRSA(params);
         } else if (algorithm.equals(DOMSignatureMethod.RSA_SHA512)) {
             return new DOMSignatureMethod.SHA512withRSA(params);
-        } else if (algorithm.equals(DOMSignatureMethod.RSA_SHA512)) {
-            return new DOMSignatureMethod.SHA512withRSA(params);
         } else if (algorithm.equals(DOMSignatureMethod.RSA_RIPEMD160)) {
             return new DOMSignatureMethod.RIPEMD160withRSA(params);
         } else if (algorithm.equals(DOMSignatureMethod.RSA_SHA1_MGF1)) {
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java	Wed Feb 03 05:23:32 2021 +0000
@@ -28,10 +28,10 @@
  * ===========================================================================
  */
 /*
- * Portions copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Portions copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMXPathFilter2Transform.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMXPathFilter2Transform.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMXPathTransform.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMXPathTransform.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXSLTTransform.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXSLTTransform.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,10 +21,10 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: DOMXSLTTransform.java 1788465 2017-03-24 15:10:51Z coheigea $
+ * $Id: DOMXSLTTransform.java 1854026 2019-02-21 09:30:01Z coheigea $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java	Wed Feb 03 05:23:32 2021 +0000
@@ -28,10 +28,10 @@
  * ===========================================================================
  */
 /*
- * Portions copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Portions copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * $Id: XMLDSigRI.java 1804972 2017-08-14 09:59:23Z coheigea $
+ * $Id: XMLDSigRI.java 1833618 2018-06-15 17:36:20Z mullan $
  */
 package org.jcp.xml.dsig.internal.dom;
 
--- a/src/share/classes/sun/management/ThreadImpl.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/sun/management/ThreadImpl.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 import java.lang.management.ThreadInfo;
 
 import javax.management.ObjectName;
+import java.util.Objects;
 
 /**
  * Implementation class for the thread subsystem.
@@ -105,11 +106,15 @@
         return cpuTimeEnabled;
     }
 
-    public boolean isThreadAllocatedMemoryEnabled() {
+    private void ensureThreadAllocatedMemorySupported() {
         if (!isThreadAllocatedMemorySupported()) {
             throw new UnsupportedOperationException(
-                "Thread allocated memory measurement is not supported");
+                "Thread allocated memory measurement is not supported.");
         }
+    }
+
+    public boolean isThreadAllocatedMemoryEnabled() {
+        ensureThreadAllocatedMemorySupported();
         return allocatedMemoryEnabled;
     }
 
@@ -144,16 +149,18 @@
         return getThreadInfo(ids, 0);
     }
 
+    private void verifyThreadId(long id) {
+        if (id <= 0) {
+            throw new IllegalArgumentException(
+                "Invalid thread ID parameter: " + id);
+        }
+    }
+
     private void verifyThreadIds(long[] ids) {
-        if (ids == null) {
-            throw new NullPointerException("Null ids parameter.");
-        }
+        Objects.requireNonNull(ids);
 
         for (int i = 0; i < ids.length; i++) {
-            if (ids[i] <= 0) {
-                throw new IllegalArgumentException(
-                    "Invalid thread ID parameter: " + ids[i]);
-            }
+            verifyThreadId(ids[i]);
         }
     }
 
@@ -324,26 +331,41 @@
         }
     }
 
+    public long getCurrentThreadAllocatedBytes() {
+        if (isThreadAllocatedMemoryEnabled()) {
+            return getThreadAllocatedMemory0(0);
+        }
+        return -1;
+    }
+
+    private boolean verifyThreadAllocatedMemory(long id) {
+        verifyThreadId(id);
+        return isThreadAllocatedMemoryEnabled();
+    }
+
     public long getThreadAllocatedBytes(long id) {
-        long[] ids = new long[1];
-        ids[0] = id;
-        final long[] sizes = getThreadAllocatedBytes(ids);
-        return sizes[0];
+        boolean verified = verifyThreadAllocatedMemory(id);
+
+        if (verified) {
+            return getThreadAllocatedMemory0(
+                Thread.currentThread().getId() == id ? 0 : id);
+        }
+        return -1;
     }
 
     private boolean verifyThreadAllocatedMemory(long[] ids) {
         verifyThreadIds(ids);
-
-        // check if Thread allocated memory measurement is supported.
-        if (!isThreadAllocatedMemorySupported()) {
-            throw new UnsupportedOperationException(
-                "Thread allocated memory measurement is not supported.");
-        }
-
         return isThreadAllocatedMemoryEnabled();
     }
 
     public long[] getThreadAllocatedBytes(long[] ids) {
+        Objects.requireNonNull(ids);
+
+        if (ids.length == 1) {
+            long size = getThreadAllocatedBytes(ids[0]);
+            return new long[] { size };
+        }
+
         boolean verified = verifyThreadAllocatedMemory(ids);
 
         long[] sizes = new long[ids.length];
@@ -356,10 +378,7 @@
     }
 
     public void setThreadAllocatedMemoryEnabled(boolean enable) {
-        if (!isThreadAllocatedMemorySupported()) {
-            throw new UnsupportedOperationException(
-                "Thread allocated memory measurement is not supported.");
-        }
+        ensureThreadAllocatedMemorySupported();
 
         Util.checkControlAccess();
         synchronized (this) {
@@ -439,19 +458,42 @@
     public ThreadInfo[] getThreadInfo(long[] ids,
                                       boolean lockedMonitors,
                                       boolean lockedSynchronizers) {
+        return dumpThreads0(ids, lockedMonitors, lockedSynchronizers,
+                            Integer.MAX_VALUE);
+    }
+
+    public ThreadInfo[] getThreadInfo(long[] ids,
+                                      boolean lockedMonitors,
+                                      boolean lockedSynchronizers,
+                                      int maxDepth) {
+        if (maxDepth < 0) {
+            throw new IllegalArgumentException(
+                    "Invalid maxDepth parameter: " + maxDepth);
+        }
         verifyThreadIds(ids);
         // ids has been verified to be non-null
         // an empty array of ids should return an empty array of ThreadInfos
         if (ids.length == 0) return new ThreadInfo[0];
 
         verifyDumpThreads(lockedMonitors, lockedSynchronizers);
-        return dumpThreads0(ids, lockedMonitors, lockedSynchronizers);
+        return dumpThreads0(ids, lockedMonitors, lockedSynchronizers, maxDepth);
     }
 
     public ThreadInfo[] dumpAllThreads(boolean lockedMonitors,
                                        boolean lockedSynchronizers) {
+        return dumpAllThreads(lockedMonitors, lockedSynchronizers,
+                              Integer.MAX_VALUE);
+    }
+
+    public ThreadInfo[] dumpAllThreads(boolean lockedMonitors,
+                                       boolean lockedSynchronizers,
+                                       int maxDepth) {
+        if (maxDepth < 0) {
+            throw new IllegalArgumentException(
+                    "Invalid maxDepth parameter: " + maxDepth);
+        }
         verifyDumpThreads(lockedMonitors, lockedSynchronizers);
-        return dumpThreads0(null, lockedMonitors, lockedSynchronizers);
+        return dumpThreads0(null, lockedMonitors, lockedSynchronizers, maxDepth);
     }
 
     // VM support where maxDepth == -1 to request entire stack dump
@@ -463,6 +505,7 @@
     private static native void getThreadTotalCpuTime1(long[] ids, long[] result);
     private static native long getThreadUserCpuTime0(long id);
     private static native void getThreadUserCpuTime1(long[] ids, long[] result);
+    private static native long getThreadAllocatedMemory0(long id);
     private static native void getThreadAllocatedMemory1(long[] ids, long[] result);
     private static native void setThreadCpuTimeEnabled0(boolean enable);
     private static native void setThreadAllocatedMemoryEnabled0(boolean enable);
@@ -472,7 +515,8 @@
     private static native void resetPeakThreadCount0();
     private static native ThreadInfo[] dumpThreads0(long[] ids,
                                                     boolean lockedMonitors,
-                                                    boolean lockedSynchronizers);
+                                                    boolean lockedSynchronizers,
+                                                    int maxDepth);
 
     // tid == 0 to reset contention times for all threads
     private static native void resetContentionTimes0(long tid);
--- a/src/share/classes/sun/security/rsa/RSAPSSSignature.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/sun/security/rsa/RSAPSSSignature.java	Wed Feb 03 05:23:32 2021 +0000
@@ -304,11 +304,11 @@
     private static void checkKeyLength(RSAKey key, int digestLen,
             int saltLen) throws SignatureException {
         if (key != null) {
-            int keyLength = getKeyLengthInBits(key) >> 3;
+            int keyLength = (getKeyLengthInBits(key) + 7) >> 3;
             int minLength = Math.addExact(Math.addExact(digestLen, saltLen), 2);
             if (keyLength < minLength) {
                 throw new SignatureException
-                    ("Key is too short, need min " + minLength);
+                    ("Key is too short, need min " + minLength + " bytes");
             }
         }
     }
@@ -429,7 +429,7 @@
         }
         try {
             int emBits = getKeyLengthInBits(this.privKey) - 1;
-            int emLen =(emBits + 7) >> 3;
+            int emLen = (emBits + 7) >> 3;
             int hLen = this.md.getDigestLength();
             int dbLen = emLen - hLen - 1;
             int sLen = this.sigParams.getSaltLength();
@@ -472,6 +472,7 @@
             // step11: set the leftmost (8emLen - emBits) bits of the leftmost
             // octet to 0
             int numZeroBits = (emLen << 3) - emBits;
+
             if (numZeroBits != 0) {
                 byte MASK = (byte) (0xff >>> numZeroBits);
                 em[0] = (byte) (em[0] & MASK);
@@ -485,15 +486,22 @@
     }
 
     /**
-     * Decode the signature data. Verify that the object identifier matches
-     * and return the message digest.
+     * Decode the signature data as under RFC8017 sec9.1.2 EMSA-PSS-VERIFY
      */
     private boolean decodeSignature(byte[] mHash, byte[] em)
             throws IOException {
         int hLen = mHash.length;
         int sLen = this.sigParams.getSaltLength();
-        int emLen = em.length;
         int emBits = getKeyLengthInBits(this.pubKey) - 1;
+        int emLen = (emBits + 7) >> 3;
+
+        // When key length is 8N+1 bits (N+1 bytes), emBits = 8N,
+        // emLen = N which is one byte shorter than em.length.
+        // Otherwise, emLen should be same as em.length
+        int emOfs = em.length - emLen;
+        if ((emOfs == 1) && (em[0] != 0)) {
+            return false;
+        }
 
         // step3
         if (emLen < (hLen + sLen + 2)) {
@@ -501,16 +509,17 @@
         }
 
         // step4
-        if (em[emLen - 1] != (byte) 0xBC) {
+        if (em[emOfs + emLen - 1] != (byte) 0xBC) {
             return false;
         }
 
         // step6: check if the leftmost (8emLen - emBits) bits of the leftmost
         // octet are 0
         int numZeroBits = (emLen << 3) - emBits;
+
         if (numZeroBits != 0) {
             byte MASK = (byte) (0xff << (8 - numZeroBits));
-            if ((em[0] & MASK) != 0) {
+            if ((em[emOfs] & MASK) != 0) {
                 return false;
             }
         }
@@ -526,7 +535,8 @@
         int dbLen = emLen - hLen - 1;
         try {
             MGF1 mgf1 = new MGF1(mgfDigestAlgo);
-            mgf1.generateAndXor(em, dbLen, hLen, dbLen, em, 0);
+            mgf1.generateAndXor(em, emOfs + dbLen, hLen, dbLen,
+                    em, emOfs);
         } catch (NoSuchAlgorithmException nsae) {
             throw new IOException(nsae.toString());
         }
@@ -535,12 +545,12 @@
         //  octet to 0
         if (numZeroBits != 0) {
             byte MASK = (byte) (0xff >>> numZeroBits);
-            em[0] = (byte) (em[0] & MASK);
+            em[emOfs] = (byte) (em[emOfs] & MASK);
         }
 
         // step10
-        int i = 0;
-        for (; i < dbLen - sLen - 1; i++) {
+        int i = emOfs;
+        for (; i < emOfs + (dbLen - sLen - 1); i++) {
             if (em[i] != 0) {
                 return false;
             }
@@ -553,13 +563,14 @@
         digestReset = false;
         this.md.update(mHash);
         if (sLen > 0) {
-            this.md.update(em, (dbLen - sLen), sLen);
+            this.md.update(em, emOfs + (dbLen - sLen), sLen);
         }
         byte[] digest2 = this.md.digest();
         digestReset = true;
 
         // step14
-        byte[] digestInEM = Arrays.copyOfRange(em, dbLen, emLen - 1);
+        byte[] digestInEM = Arrays.copyOfRange(em, emOfs + dbLen,
+                emOfs + emLen - 1);
         return MessageDigest.isEqual(digest2, digestInEM);
     }
 
--- a/src/share/classes/sun/security/util/Cache.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/sun/security/util/Cache.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2020, 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
@@ -269,8 +269,7 @@
         else
             this.queue = null;
 
-        int buckets = (int)(maxSize / LOAD_FACTOR) + 1;
-        cacheMap = new LinkedHashMap<>(buckets, LOAD_FACTOR, true);
+        cacheMap = new LinkedHashMap<>(1, LOAD_FACTOR, true);
     }
 
     /**
--- a/src/share/classes/sun/text/resources/ar/FormatData_ar_JO.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/sun/text/resources/ar/FormatData_ar_JO.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -56,7 +56,7 @@
                     "\u0634\u0628\u0627\u0637", // february
                     "\u0622\u0630\u0627\u0631", // march
                     "\u0646\u064a\u0633\u0627\u0646", // april
-                    "\u0646\u0648\u0627\u0631", // may
+                    "\u0623\u064a\u0627\u0631", // may
                     "\u062d\u0632\u064a\u0631\u0627\u0646", // june
                     "\u062a\u0645\u0648\u0632", // july
                     "\u0622\u0628", // august
@@ -73,7 +73,7 @@
                     "\u0634\u0628\u0627\u0637", // abb february
                     "\u0622\u0630\u0627\u0631", // abb march
                     "\u0646\u064a\u0633\u0627\u0646", // abb april
-                    "\u0646\u0648\u0627\u0631", // abb may
+                    "\u0623\u064a\u0627\u0631", // abb may
                     "\u062d\u0632\u064a\u0631\u0627\u0646", // abb june
                     "\u062a\u0645\u0648\u0632", // abb july
                     "\u0622\u0628", // abb august
--- a/src/share/classes/sun/text/resources/ar/FormatData_ar_LB.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/sun/text/resources/ar/FormatData_ar_LB.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -56,7 +56,7 @@
                     "\u0634\u0628\u0627\u0637", // february
                     "\u0622\u0630\u0627\u0631", // march
                     "\u0646\u064a\u0633\u0627\u0646", // april
-                    "\u0646\u0648\u0627\u0631", // may
+                    "\u0623\u064a\u0627\u0631", // may
                     "\u062d\u0632\u064a\u0631\u0627\u0646", // june
                     "\u062a\u0645\u0648\u0632", // july
                     "\u0622\u0628", // august
@@ -73,7 +73,7 @@
                     "\u0634\u0628\u0627\u0637", // abb february
                     "\u0622\u0630\u0627\u0631", // abb march
                     "\u0646\u064a\u0633\u0627\u0646", // abb april
-                    "\u0646\u0648\u0627\u0631", // abb may
+                    "\u0623\u064a\u0627\u0631", // abb may
                     "\u062d\u0632\u064a\u0631\u0627\u0646", // abb june
                     "\u062a\u0645\u0648\u0632", // abb july
                     "\u0622\u0628", // abb august
--- a/src/share/classes/sun/text/resources/ar/FormatData_ar_SY.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/sun/text/resources/ar/FormatData_ar_SY.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2020, 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
@@ -56,8 +56,8 @@
                     "\u0634\u0628\u0627\u0637", // february
                     "\u0622\u0630\u0627\u0631", // march
                     "\u0646\u064a\u0633\u0627\u0646", // april
-                    "\u0646\u0648\u0627\u0631\u0627\u0646", // may
-                    "\u062d\u0632\u064a\u0631", // june
+                    "\u0623\u064a\u0627\u0631", // may
+                    "\u062d\u0632\u064a\u0631\u0627\u0646", // june
                     "\u062a\u0645\u0648\u0632", // july
                     "\u0622\u0628", // august
                     "\u0623\u064a\u0644\u0648\u0644", // september
@@ -73,7 +73,7 @@
                     "\u0634\u0628\u0627\u0637", // abb february
                     "\u0622\u0630\u0627\u0631", // abb march
                     "\u0646\u064a\u0633\u0627\u0646", // abb april
-                    "\u0646\u0648\u0627\u0631", // abb may
+                    "\u0623\u064a\u0627\u0631", // abb may
                     "\u062d\u0632\u064a\u0631\u0627\u0646", // abb june
                     "\u062a\u0645\u0648\u0632", // abb july
                     "\u0622\u0628", // abb august
--- a/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2020, 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
@@ -609,8 +609,12 @@
                     // we can then pass in the dom = -1, dow > 0 into ZoneInfo
                     //
                     // hacking, assume the >=24 is the result of ZRB optimization for
-                    // "last", it works for now.
-                    if (dom < 0 || dom >= 24) {
+                    // "last", it works for now. From tzdata2020d this hacking
+                    // will not work for Asia/Gaza and Asia/Hebron which follow
+                    // Palestine DST rules.
+                    if (dom < 0 || dom >= 24 &&
+                                   !(zoneId.equals("Asia/Gaza") ||
+                                     zoneId.equals("Asia/Hebron"))) {
                         params[1] = -1;
                         params[2] = toCalendarDOW[dow];
                     } else {
@@ -632,7 +636,9 @@
                     params[7] = 0;
                 } else {
                     // hacking: see comment above
-                    if (dom < 0 || dom >= 24) {
+                    if (dom < 0 || dom >= 24 &&
+                                   !(zoneId.equals("Asia/Gaza") ||
+                                     zoneId.equals("Asia/Hebron"))) {
                         params[6] = -1;
                         params[7] = toCalendarDOW[dow];
                     } else {
--- a/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/demo/nio/zipfs/src/com/sun/nio/zipfs/ZipFileSystem.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1581,6 +1581,7 @@
         private CRC32 crc;
         private Entry e;
         private long written;
+        private boolean isClosed = false;
 
         EntryOutputStream(Entry e, OutputStream os)
             throws IOException
@@ -1593,9 +1594,14 @@
         }
 
         @Override
-        public void write(byte b[], int off, int len) throws IOException {
+        public synchronized void write(byte b[], int off, int len)
+            throws IOException
+        {
             if (e.type != Entry.FILECH)    // only from sync
                 ensureOpen();
+            if (isClosed) {
+                throw new IOException("Stream closed");
+            }
             if (off < 0 || len < 0 || off > b.length - len) {
                 throw new IndexOutOfBoundsException();
             } else if (len == 0) {
@@ -1616,7 +1622,11 @@
         }
 
         @Override
-        public void close() throws IOException {
+        public synchronized void close() throws IOException {
+            if (isClosed) {
+                return;
+            }
+            isClosed = true;
             // TBD ensureOpen();
             switch (e.method) {
             case METHOD_DEFLATED:
--- a/src/share/javavm/export/jmm.h	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/javavm/export/jmm.h	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -219,7 +219,9 @@
 
 typedef struct jmmInterface_1_ {
   void*        reserved1;
-  void*        reserved2;
+  jlong        (JNICALL *GetOneThreadAllocatedMemory)
+                                                 (JNIEnv *env,
+                                                  jlong thread_id);
 
   jint         (JNICALL *GetVersion)             (JNIEnv *env);
 
@@ -317,7 +319,11 @@
   void         (JNICALL *SetVMGlobal)            (JNIEnv *env,
                                                   jstring flag_name,
                                                   jvalue  new_value);
-  void*        reserved6;
+  jobjectArray (JNICALL *DumpThreadsMaxDepth)    (JNIEnv *env,
+                                                  jlongArray ids,
+                                                  jboolean lockedMonitors,
+                                                  jboolean lockedSynchronizers,
+                                                  jint maxDepth);
   jobjectArray (JNICALL *DumpThreads)            (JNIEnv *env,
                                                   jlongArray ids,
                                                   jboolean lockedMonitors,
--- a/src/share/native/sun/java2d/cmm/lcms/cmsalpha.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsalpha.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -57,6 +57,10 @@
 
 // Alpha copy ------------------------------------------------------------------------------------------------------------------
 
+// This macro return words stored as big endian
+#define CHANGE_ENDIAN(w)    (cmsUInt16Number) ((cmsUInt16Number) ((w)<<8)|((w)>>8))
+
+
 // Floor to byte, taking care of saturation
 cmsINLINE cmsUInt8Number _cmsQuickSaturateByte(cmsFloat64Number d)
 {
@@ -104,6 +108,13 @@
 }
 
 static
+void from8to16SE(void* dst, const void* src)
+{
+    cmsUInt8Number n = *(cmsUInt8Number*)src;
+    *(cmsUInt16Number*)dst = CHANGE_ENDIAN(FROM_8_TO_16(n));
+}
+
+static
 void from8toFLT(void* dst, const void* src)
 {
        *(cmsFloat32Number*)dst = (*(cmsUInt8Number*)src) / 255.0f;
@@ -137,22 +148,50 @@
 }
 
 static
+void from16SEto8(void* dst, const void* src)
+{
+    cmsUInt16Number n = *(cmsUInt16Number*)src;
+    *(cmsUInt8Number*)dst = FROM_16_TO_8(CHANGE_ENDIAN(n));
+}
+
+static
 void copy16(void* dst, const void* src)
 {
        memmove(dst, src, 2);
 }
 
+static
+void from16to16(void* dst, const void* src)
+{
+    cmsUInt16Number n = *(cmsUInt16Number*)src;
+    *(cmsUInt16Number*)dst = CHANGE_ENDIAN(n);
+}
+
+static
 void from16toFLT(void* dst, const void* src)
 {
        *(cmsFloat32Number*)dst = (*(cmsUInt16Number*)src) / 65535.0f;
 }
 
+static
+void from16SEtoFLT(void* dst, const void* src)
+{
+    *(cmsFloat32Number*)dst = (CHANGE_ENDIAN(*(cmsUInt16Number*)src)) / 65535.0f;
+}
+
+static
 void from16toDBL(void* dst, const void* src)
 {
        *(cmsFloat64Number*)dst = (*(cmsUInt16Number*)src) / 65535.0f;
 }
 
 static
+void from16SEtoDBL(void* dst, const void* src)
+{
+    *(cmsFloat64Number*)dst = (CHANGE_ENDIAN(*(cmsUInt16Number*)src)) / 65535.0f;
+}
+
+static
 void from16toHLF(void* dst, const void* src)
 {
 #ifndef CMS_NO_HALF_SUPPORT
@@ -164,33 +203,53 @@
 #endif
 }
 
+static
+void from16SEtoHLF(void* dst, const void* src)
+{
+#ifndef CMS_NO_HALF_SUPPORT
+    cmsFloat32Number n = (CHANGE_ENDIAN(*(cmsUInt16Number*)src)) / 65535.0f;
+    *(cmsUInt16Number*)dst = _cmsFloat2Half(n);
+#else
+    cmsUNUSED_PARAMETER(dst);
+    cmsUNUSED_PARAMETER(src);
+#endif
+}
 // From Float
 
 static
 void fromFLTto8(void* dst, const void* src)
 {
-       cmsFloat32Number n = *(cmsFloat32Number*)src;
-       *(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0f);
+    cmsFloat32Number n = *(cmsFloat32Number*)src;
+    *(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0f);
 }
 
 static
 void fromFLTto16(void* dst, const void* src)
 {
-       cmsFloat32Number n = *(cmsFloat32Number*)src;
-       *(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
+    cmsFloat32Number n = *(cmsFloat32Number*)src;
+    *(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
+}
+
+static
+void fromFLTto16SE(void* dst, const void* src)
+{
+    cmsFloat32Number n = *(cmsFloat32Number*)src;
+    cmsUInt16Number i = _cmsQuickSaturateWord(n * 65535.0f);
+
+    *(cmsUInt16Number*)dst = CHANGE_ENDIAN(i);
 }
 
 static
 void copy32(void* dst, const void* src)
 {
-       memmove(dst, src, sizeof(cmsFloat32Number));
+    memmove(dst, src, sizeof(cmsFloat32Number));
 }
 
 static
 void fromFLTtoDBL(void* dst, const void* src)
 {
-       cmsFloat32Number n = *(cmsFloat32Number*)src;
-       *(cmsFloat64Number*)dst = (cmsFloat64Number)n;
+    cmsFloat32Number n = *(cmsFloat32Number*)src;
+    *(cmsFloat64Number*)dst = (cmsFloat64Number)n;
 }
 
 static
@@ -234,6 +293,19 @@
 }
 
 static
+void fromHLFto16SE(void* dst, const void* src)
+{
+#ifndef CMS_NO_HALF_SUPPORT
+    cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src);
+    cmsUInt16Number i = _cmsQuickSaturateWord(n * 65535.0f);
+    *(cmsUInt16Number*)dst = CHANGE_ENDIAN(i);
+#else
+    cmsUNUSED_PARAMETER(dst);
+    cmsUNUSED_PARAMETER(src);
+#endif
+}
+
+static
 void fromHLFtoFLT(void* dst, const void* src)
 {
 #ifndef CMS_NO_HALF_SUPPORT
@@ -271,6 +343,14 @@
 }
 
 static
+void fromDBLto16SE(void* dst, const void* src)
+{
+    cmsFloat64Number n = *(cmsFloat64Number*)src;
+    cmsUInt16Number  i = _cmsQuickSaturateWord(n * 65535.0f);
+    *(cmsUInt16Number*)dst = CHANGE_ENDIAN(i);
+}
+
+static
 void fromDBLtoFLT(void* dst, const void* src)
 {
        cmsFloat64Number n = *(cmsFloat64Number*)src;
@@ -303,37 +383,42 @@
     cmsUInt32Number  b = T_BYTES(frm);
 
     if (b == 0 && T_FLOAT(frm))
-        return 4; // DBL
+        return 5; // DBL
 #ifndef CMS_NO_HALF_SUPPORT
     if (b == 2 && T_FLOAT(frm))
-        return 2; // HLF
+        return 3; // HLF
 #endif
     if (b == 4 && T_FLOAT(frm))
-        return 3; // FLT
+        return 4; // FLT
     if (b == 2 && !T_FLOAT(frm))
-        return 1; // 16
+    {
+        if (T_ENDIAN16(frm))
+            return 2; // 16SE
+        else
+            return 1; // 16
+    }
     if (b == 1 && !T_FLOAT(frm))
         return 0; // 8
-
     return -1; // not recognized
 }
 
-// Obtains a alpha-to-alpha funmction formatter
+// Obtains an alpha-to-alpha function formatter
 static
 cmsFormatterAlphaFn _cmsGetFormatterAlpha(cmsContext id, cmsUInt32Number in, cmsUInt32Number out)
 {
-static cmsFormatterAlphaFn FormattersAlpha[5][5] = {
+static cmsFormatterAlphaFn FormattersAlpha[6][6] = {
 
-       /* from 8 */  { copy8,      from8to16,   from8toHLF,   from8toFLT,   from8toDBL   },
-       /* from 16*/  { from16to8,  copy16,      from16toHLF,  from16toFLT,  from16toDBL  },
-       /* from HLF*/ { fromHLFto8, fromHLFto16, copy16,       fromHLFtoFLT, fromHLFtoDBL },
-       /* from FLT*/ { fromFLTto8, fromFLTto16, fromFLTtoHLF, copy32,       fromFLTtoDBL },
-       /* from DBL*/ { fromDBLto8, fromDBLto16, fromDBLtoHLF, fromDBLtoFLT, copy64 }};
+       /* from 8 */  { copy8,       from8to16,   from8to16SE,   from8toHLF,   from8toFLT,    from8toDBL    },
+       /* from 16*/  { from16to8,   copy16,      from16to16,    from16toHLF,  from16toFLT,   from16toDBL   },
+       /* from 16SE*/{ from16SEto8, from16to16,  copy16,        from16SEtoHLF,from16SEtoFLT, from16SEtoDBL },
+       /* from HLF*/ { fromHLFto8,  fromHLFto16, fromHLFto16SE, copy16,       fromHLFtoFLT,  fromHLFtoDBL  },
+       /* from FLT*/ { fromFLTto8,  fromFLTto16, fromFLTto16SE, fromFLTtoHLF, copy32,        fromFLTtoDBL  },
+       /* from DBL*/ { fromDBLto8,  fromDBLto16, fromDBLto16SE, fromDBLtoHLF, fromDBLtoFLT,  copy64 }};
 
         int in_n  = FormatterPos(in);
         int out_n = FormatterPos(out);
 
-        if (in_n < 0 || out_n < 0 || in_n > 4 || out_n > 4) {
+        if (in_n < 0 || out_n < 0 || in_n > 5 || out_n > 5) {
 
                cmsSignalError(id, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized alpha channel width");
                return NULL;
@@ -515,6 +600,8 @@
 
     // Check for conversions 8, 16, half, float, dbl
     copyValueFn = _cmsGetFormatterAlpha(p->ContextID, p->InputFormat, p->OutputFormat);
+    if (copyValueFn == NULL)
+        return;
 
     if (nExtra == 1) { // Optimized routine for copying a single extra channel quickly
 
--- a/src/share/native/sun/java2d/cmm/lcms/cmscam02.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmscam02.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
--- a/src/share/native/sun/java2d/cmm/lcms/cmscgats.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmscgats.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2018 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -158,7 +158,7 @@
 
 // File stream being parsed
 typedef struct _FileContext {
-        char           FileName[cmsMAX_PATH];    // File name if being readed from file
+        char           FileName[cmsMAX_PATH];    // File name if being read from file
         FILE*          Stream;                   // File stream or NULL if holded in memory
     } FILECTX;
 
@@ -285,7 +285,7 @@
                                                    // needed.
 
         {"SAMPLE_BACKING",   WRITE_STRINGIFY},     // Identifies the backing material used behind the sample during
-                                                   // measurement. Allowed values are “black”, “white”, or {"na".
+                                                   // measurement. Allowed values are "black", "white", or {"na".
 
         {"CHISQ_DOF",        WRITE_STRINGIFY},     // Degrees of freedom associated with the Chi squared statistic
                                                    // below properties are new in recent specs:
@@ -300,7 +300,7 @@
                                                    // denote the use of filters such as none, D65, Red, Green or Blue.
 
        {"POLARIZATION",      WRITE_STRINGIFY},     // Identifies the use of a physical polarization filter during measurement. Allowed
-                                                   // values are {"yes”, “white”, “none” or “na”.
+                                                   // values are {"yes", "white", "none" or "na".
 
        {"WEIGHTING_FUNCTION", WRITE_PAIR},         // Indicates such functions as: the CIE standard observer functions used in the
                                                    // calculation of various data parameters (2 degree and 10 degree), CIE standard
@@ -712,8 +712,8 @@
 static
 void InSymbol(cmsIT8* it8)
 {
-    register char *idptr;
-    register int k;
+    CMSREGISTER char *idptr;
+    CMSREGISTER int k;
     SYMBOL key;
     int sng;
 
@@ -2195,67 +2195,49 @@
         if (cmsstrcasecmp(Fld, "SAMPLE_ID") == 0) {
 
             t -> SampleID = idField;
-
-            for (i=0; i < t -> nPatches; i++) {
-
-                char *Data = GetData(it8, i, idField);
-                if (Data) {
-                    char Buffer[256];
-
-                    strncpy(Buffer, Data, 255);
-                    Buffer[255] = 0;
-
-                    if (strlen(Buffer) <= strlen(Data))
-                        strcpy(Data, Buffer);
-                    else
-                        SetData(it8, i, idField, Buffer);
-
-                }
-            }
-
         }
 
         // "LABEL" is an extension. It keeps references to forward tables
 
-        if ((cmsstrcasecmp(Fld, "LABEL") == 0) || Fld[0] == '$' ) {
-
-                    // Search for table references...
-                    for (i=0; i < t -> nPatches; i++) {
-
-                            char *Label = GetData(it8, i, idField);
-
-                            if (Label) {
-
-                                cmsUInt32Number k;
-
-                                // This is the label, search for a table containing
-                                // this property
-
-                                for (k=0; k < it8 ->TablesCount; k++) {
-
-                                    TABLE* Table = it8 ->Tab + k;
-                                    KEYVALUE* p;
-
-                                    if (IsAvailableOnList(Table->HeaderList, Label, NULL, &p)) {
-
-                                        // Available, keep type and table
-                                        char Buffer[256];
-
-                                        char *Type  = p ->Value;
-                                        int  nTable = (int) k;
-
-                                        snprintf(Buffer, 255, "%s %d %s", Label, nTable, Type );
-
-                                        SetData(it8, i, idField, Buffer);
-                                    }
-                                }
-
-
-                            }
-
+        if ((cmsstrcasecmp(Fld, "LABEL") == 0) || Fld[0] == '$') {
+
+            // Search for table references...
+            for (i = 0; i < t->nPatches; i++) {
+
+                char* Label = GetData(it8, i, idField);
+
+                if (Label) {
+
+                    cmsUInt32Number k;
+
+                    // This is the label, search for a table containing
+                    // this property
+
+                    for (k = 0; k < it8->TablesCount; k++) {
+
+                        TABLE* Table = it8->Tab + k;
+                        KEYVALUE* p;
+
+                        if (IsAvailableOnList(Table->HeaderList, Label, NULL, &p)) {
+
+                            // Available, keep type and table
+                            char Buffer[256];
+
+                            char* Type = p->Value;
+                            int  nTable = (int)k;
+
+                            snprintf(Buffer, 255, "%s %d %s", Label, nTable, Type);
+
+                            SetData(it8, i, idField, Buffer);
+                        }
                     }
 
 
+                }
+
+            }
+
+
         }
 
     }
@@ -2349,6 +2331,11 @@
 
     it8 = (cmsIT8*) hIT8;
     it8 ->MemoryBlock = (char*) _cmsMalloc(ContextID, len + 1);
+    if (it8->MemoryBlock == NULL)
+    {
+        cmsIT8Free(hIT8);
+        return FALSE;
+    }
 
     strncpy(it8 ->MemoryBlock, (const char*) Ptr, len);
     it8 ->MemoryBlock[len] = 0;
--- a/src/share/native/sun/java2d/cmm/lcms/cmscnvrt.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmscnvrt.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -56,19 +56,6 @@
 #include "lcms2_internal.h"
 
 
-// Link several profiles to obtain a single LUT modelling the whole color transform. Intents, Black point
-// compensation and Adaptation parameters may vary across profiles. BPC and Adaptation refers to the PCS
-// after the profile. I.e, BPC[0] refers to connexion between profile(0) and profile(1)
-cmsPipeline* _cmsLinkProfiles(cmsContext     ContextID,
-                              cmsUInt32Number nProfiles,
-                              cmsUInt32Number Intents[],
-                              cmsHPROFILE     hProfiles[],
-                              cmsBool         BPC[],
-                              cmsFloat64Number AdaptationStates[],
-                              cmsUInt32Number dwFlags);
-
-//---------------------------------------------------------------------------------
-
 // This is the default routine for ICC-style intents. A user may decide to override it by using a plugin.
 // Supported intents are perceptual, relative colorimetric, saturation and ICC-absolute colorimetric
 static
@@ -739,7 +726,7 @@
 
 // Preserve black only if that is the only ink used
 static
-int BlackPreservingGrayOnlySampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
+int BlackPreservingGrayOnlySampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo)
 {
     GrayOnlyParams* bp = (GrayOnlyParams*) Cargo;
 
@@ -866,7 +853,7 @@
 
 // The CLUT will be stored at 16 bits, but calculations are performed at cmsFloat32Number precision
 static
-int BlackPreservingSampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
+int BlackPreservingSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo)
 {
     int i;
     cmsFloat32Number Inf[4], Outf[4];
@@ -891,18 +878,18 @@
     }
 
     // Try the original transform,
-    cmsPipelineEvalFloat( Inf, Outf, bp ->cmyk2cmyk);
+    cmsPipelineEvalFloat(Inf, Outf, bp ->cmyk2cmyk);
 
     // Store a copy of the floating point result into 16-bit
     for (i=0; i < 4; i++)
             Out[i] = _cmsQuickSaturateWord(Outf[i] * 65535.0);
 
     // Maybe K is already ok (mostly on K=0)
-    if ( fabs(Outf[3] - LabK[3]) < (3.0 / 65535.0) ) {
+    if (fabsf(Outf[3] - LabK[3]) < (3.0 / 65535.0)) {
         return TRUE;
     }
 
-    // K differ, mesure and keep Lab measurement for further usage
+    // K differ, measure and keep Lab measurement for further usage
     // this is done in relative colorimetric intent
     cmsDoTransform(bp->hProofOutput, Out, &ColorimetricLab, 1);
 
@@ -923,7 +910,7 @@
     Outf[3] = LabK[3];
 
     // Apply TAC if needed
-    SumCMY   = Outf[0]  + Outf[1] + Outf[2];
+    SumCMY   = (cmsFloat64Number) Outf[0]  + Outf[1] + Outf[2];
     SumCMYK  = SumCMY + Outf[3];
 
     if (SumCMYK > bp ->MaxTAC) {
--- a/src/share/native/sun/java2d/cmm/lcms/cmserr.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmserr.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -67,7 +67,7 @@
 // compare two strings ignoring case
 int CMSEXPORT cmsstrcasecmp(const char* s1, const char* s2)
 {
-    register const unsigned char *us1 = (const unsigned char *)s1,
+    CMSREGISTER const unsigned char *us1 = (const unsigned char *)s1,
                                  *us2 = (const unsigned char *)s2;
 
     while (toupper(*us1) == toupper(*us2++))
@@ -464,7 +464,7 @@
 // There is no error handling at all. When a function fails, it returns proper value.
 // For example, all create functions does return NULL on failure. Other return FALSE
 // It may be interesting, for the developer, to know why the function is failing.
-// for that reason, lcms2 does offer a logging function. This function does recive
+// for that reason, lcms2 does offer a logging function. This function does receive
 // a ENGLISH string with some clues on what is going wrong. You can show this
 // info to the end user, or just create some sort of log.
 // The logging function should NOT terminate the program, as this obviously can leave
--- a/src/share/native/sun/java2d/cmm/lcms/cmsgamma.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsgamma.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2013 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -329,7 +329,8 @@
         return p;
 
 Error:
-    if (p -> Segments) _cmsFree(ContextID, p ->Segments);
+    if (p -> SegInterp) _cmsFree(ContextID, p -> SegInterp);
+    if (p -> Segments) _cmsFree(ContextID, p -> Segments);
     if (p -> Evals) _cmsFree(ContextID, p -> Evals);
     if (p ->Table16) _cmsFree(ContextID, p ->Table16);
     _cmsFree(ContextID, p);
@@ -846,7 +847,7 @@
 //
 // Parameters goes as: Curve, a, b, c, d, e, f
 // Type is the ICC type +1
-// if type is negative, then the curve is analyticaly inverted
+// if type is negative, then the curve is analytically inverted
 cmsToneCurve* CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[])
 {
     cmsCurveSegment Seg0;
@@ -917,7 +918,7 @@
     if (Curve -> Evals)
         _cmsFree(ContextID, Curve -> Evals);
 
-    if (Curve) _cmsFree(ContextID, Curve);
+    _cmsFree(ContextID, Curve);
 }
 
 // Utility function, free 3 gamma tables
@@ -1287,7 +1288,7 @@
 }
 
 // Is a table linear? Do not use parametric since we cannot guarantee some weird parameters resulting
-// in a linear table. This way assures it is linear in 12 bits, which should be enought in most cases.
+// in a linear table. This way assures it is linear in 12 bits, which should be enough in most cases.
 cmsBool CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve)
 {
     int i;
@@ -1460,3 +1461,14 @@
 
     return (sum / n);   // The mean
 }
+
+
+// Retrieve parameters on one-segment tone curves
+
+cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t)
+{
+    _cmsAssert(t != NULL);
+
+    if (t->nSegments != 1) return NULL;
+    return t->Segments[0].Params;
+}
--- a/src/share/native/sun/java2d/cmm/lcms/cmsgmt.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsgmt.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -240,7 +240,7 @@
 
 
 static
-int GamutSampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
+int GamutSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo)
 {
     GAMUTCHAIN*  t = (GAMUTCHAIN* ) Cargo;
     cmsCIELab LabIn1, LabOut1;
@@ -453,7 +453,7 @@
 // This callback just accounts the maximum ink dropped in the given node. It does not populate any
 // memory, as the destination table is NULL. Its only purpose it to know the global maximum.
 static
-int EstimateTAC(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void * Cargo)
+int EstimateTAC(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void * Cargo)
 {
     cmsTACestimator* bp = (cmsTACestimator*) Cargo;
     cmsFloat32Number RoundTrip[cmsMAXCHANNELS];
--- a/src/share/native/sun/java2d/cmm/lcms/cmshalf.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmshalf.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -60,7 +60,7 @@
 // This code is inspired in the paper "Fast Half Float Conversions"
 // by Jeroen van der Zijp
 
-static cmsUInt32Number Mantissa[2048] = {
+static const cmsUInt32Number Mantissa[2048] = {
 
 0x00000000, 0x33800000, 0x34000000, 0x34400000, 0x34800000, 0x34a00000,
 0x34c00000, 0x34e00000, 0x35000000, 0x35100000, 0x35200000, 0x35300000,
@@ -420,7 +420,7 @@
 0x0400, 0x0400, 0x0400, 0x0400
 };
 
-static cmsUInt32Number Exponent[64] = {
+static const cmsUInt32Number Exponent[64] = {
 0x00000000, 0x00800000, 0x01000000, 0x01800000, 0x02000000, 0x02800000,
 0x03000000, 0x03800000, 0x04000000, 0x04800000, 0x05000000, 0x05800000,
 0x06000000, 0x06800000, 0x07000000, 0x07800000, 0x08000000, 0x08800000,
@@ -434,7 +434,7 @@
 0x8e000000, 0x8e800000, 0x8f000000, 0xc7800000
 };
 
-static cmsUInt16Number Base[512] = {
+static const cmsUInt16Number Base[512] = {
 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -489,7 +489,7 @@
 0xfc00, 0xfc00
 };
 
-static cmsUInt8Number  Shift[512] = {
+static const cmsUInt8Number Shift[512] = {
 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
--- a/src/share/native/sun/java2d/cmm/lcms/cmsintrp.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsintrp.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -210,7 +210,7 @@
 
 
 // Inline fixed point interpolation
-cmsINLINE cmsUInt16Number LinearInterp(cmsS15Fixed16Number a, cmsS15Fixed16Number l, cmsS15Fixed16Number h)
+cmsINLINE CMS_NO_SANITIZE cmsUInt16Number LinearInterp(cmsS15Fixed16Number a, cmsS15Fixed16Number l, cmsS15Fixed16Number h)
 {
     cmsUInt32Number dif = (cmsUInt32Number) (h - l) * a + 0x8000;
     dif = (dif >> 16) + l;
@@ -220,9 +220,9 @@
 
 //  Linear interpolation (Fixed-point optimized)
 static
-void LinLerp1D(register const cmsUInt16Number Value[],
-               register cmsUInt16Number Output[],
-               register const cmsInterpParams* p)
+void LinLerp1D(CMSREGISTER const cmsUInt16Number Value[],
+               CMSREGISTER cmsUInt16Number Output[],
+               CMSREGISTER const cmsInterpParams* p)
 {
     cmsUInt16Number y1, y0;
     int cell0, rest;
@@ -233,20 +233,20 @@
     if (Value[0] == 0xffff) {
 
         Output[0] = LutTable[p -> Domain[0]];
-        return;
     }
-
-    val3 = p -> Domain[0] * Value[0];
-    val3 = _cmsToFixedDomain(val3);    // To fixed 15.16
+    else
+    {
+        val3 = p->Domain[0] * Value[0];
+        val3 = _cmsToFixedDomain(val3);    // To fixed 15.16
 
-    cell0 = FIXED_TO_INT(val3);             // Cell is 16 MSB bits
-    rest  = FIXED_REST_TO_INT(val3);        // Rest is 16 LSB bits
+        cell0 = FIXED_TO_INT(val3);             // Cell is 16 MSB bits
+        rest = FIXED_REST_TO_INT(val3);        // Rest is 16 LSB bits
 
-    y0 = LutTable[cell0];
-    y1 = LutTable[cell0+1];
+        y0 = LutTable[cell0];
+        y1 = LutTable[cell0 + 1];
 
-
-    Output[0] = LinearInterp(rest, y0, y1);
+        Output[0] = LinearInterp(rest, y0, y1);
+    }
 }
 
 // To prevent out of bounds indexing
@@ -271,30 +271,31 @@
        // if last value...
        if (val2 == 1.0) {
            Output[0] = LutTable[p -> Domain[0]];
-           return;
        }
+       else
+       {
+           val2 *= p->Domain[0];
 
-       val2 *= p -> Domain[0];
-
-       cell0 = (int) floor(val2);
-       cell1 = (int) ceil(val2);
+           cell0 = (int)floor(val2);
+           cell1 = (int)ceil(val2);
 
-       // Rest is 16 LSB bits
-       rest = val2 - cell0;
+           // Rest is 16 LSB bits
+           rest = val2 - cell0;
 
-       y0 = LutTable[cell0] ;
-       y1 = LutTable[cell1] ;
+           y0 = LutTable[cell0];
+           y1 = LutTable[cell1];
 
-       Output[0] = y0 + (y1 - y0) * rest;
+           Output[0] = y0 + (y1 - y0) * rest;
+       }
 }
 
 
 
 // Eval gray LUT having only one input channel
-static
-void Eval1Input(register const cmsUInt16Number Input[],
-                register cmsUInt16Number Output[],
-                register const cmsInterpParams* p16)
+static CMS_NO_SANITIZE
+void Eval1Input(CMSREGISTER const cmsUInt16Number Input[],
+                CMSREGISTER cmsUInt16Number Output[],
+                CMSREGISTER const cmsInterpParams* p16)
 {
        cmsS15Fixed16Number fk;
        cmsS15Fixed16Number k0, k1, rk, K0, K1;
@@ -335,30 +336,36 @@
 
     val2 = fclamp(Value[0]);
 
-        // if last value...
-       if (val2 == 1.0) {
-           Output[0] = LutTable[p -> Domain[0]];
-           return;
-       }
+    // if last value...
+    if (val2 == 1.0) {
+
+        y0 = LutTable[p->Domain[0]];
 
-       val2 *= p -> Domain[0];
-
-       cell0 = (int) floor(val2);
-       cell1 = (int) ceil(val2);
+        for (OutChan = 0; OutChan < p->nOutputs; OutChan++) {
+            Output[OutChan] = y0;
+        }
+    }
+    else
+    {
+        val2 *= p->Domain[0];
 
-       // Rest is 16 LSB bits
-       rest = val2 - cell0;
+        cell0 = (int)floor(val2);
+        cell1 = (int)ceil(val2);
+
+        // Rest is 16 LSB bits
+        rest = val2 - cell0;
 
-       cell0 *= p -> opta[0];
-       cell1 *= p -> opta[0];
+        cell0 *= p->opta[0];
+        cell1 *= p->opta[0];
 
-       for (OutChan=0; OutChan < p->nOutputs; OutChan++) {
+        for (OutChan = 0; OutChan < p->nOutputs; OutChan++) {
 
-            y0 = LutTable[cell0 + OutChan] ;
-            y1 = LutTable[cell1 + OutChan] ;
+            y0 = LutTable[cell0 + OutChan];
+            y1 = LutTable[cell1 + OutChan];
 
             Output[OutChan] = y0 + (y1 - y0) * rest;
-       }
+        }
+    }
 }
 
 // Bilinear interpolation (16 bits) - cmsFloat32Number version
@@ -415,10 +422,10 @@
 }
 
 // Bilinear interpolation (16 bits) - optimized version
-static
-void BilinearInterp16(register const cmsUInt16Number Input[],
-                      register cmsUInt16Number Output[],
-                      register const cmsInterpParams* p)
+static CMS_NO_SANITIZE
+void BilinearInterp16(CMSREGISTER const cmsUInt16Number Input[],
+                      CMSREGISTER cmsUInt16Number Output[],
+                      CMSREGISTER const cmsInterpParams* p)
 
 {
 #define DENS(i,j) (LutTable[(i)+(j)+OutChan])
@@ -427,9 +434,9 @@
            const cmsUInt16Number* LutTable = (cmsUInt16Number*) p ->Table;
            int        OutChan, TotalOut;
            cmsS15Fixed16Number    fx, fy;
-  register int        rx, ry;
+  CMSREGISTER int        rx, ry;
            int        x0, y0;
-  register int        X0, X1, Y0, Y1;
+  CMSREGISTER int        X0, X1, Y0, Y1;
            int        d00, d01, d10, d11,
                       dx0, dx1,
                       dxy;
@@ -546,10 +553,10 @@
 }
 
 // Trilinear interpolation (16 bits) - optimized version
-static
-void TrilinearInterp16(register const cmsUInt16Number Input[],
-                       register cmsUInt16Number Output[],
-                       register const cmsInterpParams* p)
+static CMS_NO_SANITIZE
+void TrilinearInterp16(CMSREGISTER const cmsUInt16Number Input[],
+                       CMSREGISTER cmsUInt16Number Output[],
+                       CMSREGISTER const cmsInterpParams* p)
 
 {
 #define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan])
@@ -558,9 +565,9 @@
            const cmsUInt16Number* LutTable = (cmsUInt16Number*) p ->Table;
            int        OutChan, TotalOut;
            cmsS15Fixed16Number    fx, fy, fz;
-  register int        rx, ry, rz;
+  CMSREGISTER int        rx, ry, rz;
            int        x0, y0, z0;
-  register int        X0, X1, Y0, Y1, Z0, Z1;
+  CMSREGISTER int        X0, X1, Y0, Y1, Z0, Z1;
            int        d000, d001, d010, d011,
                       d100, d101, d110, d111,
                       dx00, dx01, dx10, dx11,
@@ -726,10 +733,10 @@
 
 
 
-static
-void TetrahedralInterp16(register const cmsUInt16Number Input[],
-                         register cmsUInt16Number Output[],
-                         register const cmsInterpParams* p)
+static CMS_NO_SANITIZE
+void TetrahedralInterp16(CMSREGISTER const cmsUInt16Number Input[],
+                         CMSREGISTER cmsUInt16Number Output[],
+                         CMSREGISTER const cmsInterpParams* p)
 {
     const cmsUInt16Number* LutTable = (cmsUInt16Number*) p -> Table;
     cmsS15Fixed16Number fx, fy, fz;
@@ -860,10 +867,10 @@
 
 
 #define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan])
-static
-void Eval4Inputs(register const cmsUInt16Number Input[],
-                     register cmsUInt16Number Output[],
-                     register const cmsInterpParams* p16)
+static CMS_NO_SANITIZE
+void Eval4Inputs(CMSREGISTER const cmsUInt16Number Input[],
+                     CMSREGISTER cmsUInt16Number Output[],
+                     CMSREGISTER const cmsInterpParams* p16)
 {
     const cmsUInt16Number* LutTable;
     cmsS15Fixed16Number fk;
@@ -964,9 +971,9 @@
                                 c1 = c2 = c3 = 0;
                             }
 
-                            Rest = c1 * rx + c2 * ry + c3 * rz;
+        Rest = c1 * rx + c2 * ry + c3 * rz;
 
-                            Tmp1[OutChan] = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)));
+        Tmp1[OutChan] = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)));
     }
 
 
@@ -1028,9 +1035,9 @@
                                 c1 = c2 = c3 = 0;
                             }
 
-                            Rest = c1 * rx + c2 * ry + c3 * rz;
+        Rest = c1 * rx + c2 * ry + c3 * rz;
 
-                            Tmp2[OutChan] = (cmsUInt16Number) (c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)));
+        Tmp2[OutChan] = (cmsUInt16Number) (c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest)));
     }
 
 
@@ -1089,11 +1096,11 @@
 }
 
 
-static
-void Eval5Inputs(register const cmsUInt16Number Input[],
-                 register cmsUInt16Number Output[],
+static CMS_NO_SANITIZE
+void Eval5Inputs(CMSREGISTER const cmsUInt16Number Input[],
+                 CMSREGISTER cmsUInt16Number Output[],
 
-                 register const cmsInterpParams* p16)
+                 CMSREGISTER const cmsInterpParams* p16)
 {
        const cmsUInt16Number* LutTable = (cmsUInt16Number*) p16 -> Table;
        cmsS15Fixed16Number fk;
@@ -1178,10 +1185,10 @@
 
 
 
-static
-void Eval6Inputs(register const cmsUInt16Number Input[],
-                 register cmsUInt16Number Output[],
-                 register const cmsInterpParams* p16)
+static CMS_NO_SANITIZE
+void Eval6Inputs(CMSREGISTER const cmsUInt16Number Input[],
+                 CMSREGISTER cmsUInt16Number Output[],
+                 CMSREGISTER const cmsInterpParams* p16)
 {
        const cmsUInt16Number* LutTable = (cmsUInt16Number*) p16 -> Table;
        cmsS15Fixed16Number fk;
@@ -1264,10 +1271,10 @@
 }
 
 
-static
-void Eval7Inputs(register const cmsUInt16Number Input[],
-                 register cmsUInt16Number Output[],
-                 register const cmsInterpParams* p16)
+static CMS_NO_SANITIZE
+void Eval7Inputs(CMSREGISTER const cmsUInt16Number Input[],
+                 CMSREGISTER cmsUInt16Number Output[],
+                 CMSREGISTER const cmsInterpParams* p16)
 {
        const cmsUInt16Number* LutTable = (cmsUInt16Number*) p16 -> Table;
        cmsS15Fixed16Number fk;
@@ -1350,10 +1357,10 @@
        }
 }
 
-static
-void Eval8Inputs(register const cmsUInt16Number Input[],
-                 register cmsUInt16Number Output[],
-                 register const cmsInterpParams* p16)
+static CMS_NO_SANITIZE
+void Eval8Inputs(CMSREGISTER const cmsUInt16Number Input[],
+                 CMSREGISTER cmsUInt16Number Output[],
+                 CMSREGISTER const cmsInterpParams* p16)
 {
        const cmsUInt16Number* LutTable = (cmsUInt16Number*) p16 -> Table;
        cmsS15Fixed16Number fk;
--- a/src/share/native/sun/java2d/cmm/lcms/cmsio0.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsio0.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -263,7 +263,7 @@
 
 // Create a iohandler for memory block. AccessMode=='r' assumes the iohandler is going to read, and makes
 // a copy of the memory block for letting user to free the memory after invoking open profile. In write
-// mode ("w"), Buffere points to the begin of memory block to be written.
+// mode ("w"), Buffer points to the begin of memory block to be written.
 cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buffer, cmsUInt32Number size, const char* AccessMode)
 {
     cmsIOHANDLER* iohandler = NULL;
@@ -662,7 +662,6 @@
     else  {
 
         // No, make a new one
-
         if (Icc -> TagCount >= MAX_TABLE_TAG) {
             cmsSignalError(Icc ->ContextID, cmsERROR_RANGE, "Too many tags (%d)", MAX_TABLE_TAG);
             return FALSE;
@@ -683,8 +682,6 @@
        return _cmsSearchTag(Icc, sig, FALSE) >= 0;
 }
 
-
-
 // Enforces that the profile version is per. spec.
 // Operates on the big endian bytes from the profile.
 // Called before converting to platform endianness.
@@ -1596,7 +1593,7 @@
 
     if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error;
 
-    TagSize  -= 8;       // Alredy read by the type base logic
+    TagSize  -= 8;       // Already read by the type base logic
 
     // Get type handler
     TypeHandler = _cmsGetTagTypeHandler(Icc ->ContextID, BaseType);
@@ -1631,6 +1628,7 @@
         _cmsTagSignature2String(String, sig);
         cmsSignalError(Icc ->ContextID, cmsERROR_CORRUPTION_DETECTED, "'%s' Inconsistent number of items: expected %d, got %d",
             String, TagDescriptor ->ElemCount, ElemCount);
+        goto Error;
     }
 
 
@@ -1827,7 +1825,7 @@
         return Icc ->TagSizes[i];
     }
 
-    // The data has been already read, or written. But wait!, maybe the user choosed to save as
+    // The data has been already read, or written. But wait!, maybe the user chose to save as
     // raw data. In this case, return the raw data directly
     if (Icc ->TagSaveAsRaw[i]) {
 
@@ -1847,7 +1845,7 @@
         return Icc ->TagSizes[i];
     }
 
-    // Already readed, or previously set by cmsWriteTag(). We need to serialize that
+    // Already read, or previously set by cmsWriteTag(). We need to serialize that
     // data to raw in order to maintain consistency.
 
     _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
--- a/src/share/native/sun/java2d/cmm/lcms/cmsio1.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsio1.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -230,7 +230,6 @@
     return Lut;
 
 Error:
-    cmsFreeToneCurve(GrayTRC);
     cmsPipelineFree(Lut);
     return NULL;
 }
--- a/src/share/native/sun/java2d/cmm/lcms/cmslut.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmslut.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -426,37 +426,31 @@
 
 
     NewElem = (_cmsStageMatrixData*) _cmsMallocZero(ContextID, sizeof(_cmsStageMatrixData));
-    if (NewElem == NULL) return NULL;
-
+    if (NewElem == NULL) goto Error;
+    NewMPE->Data = (void*)NewElem;
 
     NewElem ->Double = (cmsFloat64Number*) _cmsCalloc(ContextID, n, sizeof(cmsFloat64Number));
-
-    if (NewElem->Double == NULL) {
-        MatrixElemTypeFree(NewMPE);
-        return NULL;
-    }
+    if (NewElem->Double == NULL) goto Error;
 
     for (i=0; i < n; i++) {
         NewElem ->Double[i] = Matrix[i];
     }
 
-
     if (Offset != NULL) {
 
         NewElem ->Offset = (cmsFloat64Number*) _cmsCalloc(ContextID, Rows, sizeof(cmsFloat64Number));
-        if (NewElem->Offset == NULL) {
-           MatrixElemTypeFree(NewMPE);
-           return NULL;
-        }
+        if (NewElem->Offset == NULL) goto Error;
 
         for (i=0; i < Rows; i++) {
                 NewElem ->Offset[i] = Offset[i];
         }
-
     }
 
-    NewMPE ->Data  = (void*) NewElem;
     return NewMPE;
+
+Error:
+    cmsStageFree(NewMPE);
+    return NULL;
 }
 
 
@@ -729,7 +723,7 @@
 
 
 static
-int IdentitySampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void * Cargo)
+int IdentitySampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void * Cargo)
 {
     int nChan = *(int*) Cargo;
     int i;
@@ -1346,7 +1340,7 @@
 
 // Default to evaluate the LUT on 16 bit-basis. Precision is retained.
 static
-void _LUTeval16(register const cmsUInt16Number In[], register cmsUInt16Number Out[],  register const void* D)
+void _LUTeval16(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[],  CMSREGISTER const void* D)
 {
     cmsPipeline* lut = (cmsPipeline*) D;
     cmsStage *mpe;
@@ -1372,7 +1366,7 @@
 
 // Does evaluate the LUT on cmsFloat32Number-basis.
 static
-void _LUTevalFloat(register const cmsFloat32Number In[], register cmsFloat32Number Out[], const void* D)
+void _LUTevalFloat(CMSREGISTER const cmsFloat32Number In[], CMSREGISTER cmsFloat32Number Out[], const void* D)
 {
     cmsPipeline* lut = (cmsPipeline*) D;
     cmsStage *mpe;
--- a/src/share/native/sun/java2d/cmm/lcms/cmsmd5.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsmd5.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -94,10 +94,9 @@
 
 
 static
-void MD5_Transform(cmsUInt32Number buf[4], cmsUInt32Number in[16])
-
+void cmsMD5_Transform(cmsUInt32Number buf[4], cmsUInt32Number in[16])
 {
-    register cmsUInt32Number a, b, c, d;
+    CMSREGISTER cmsUInt32Number a, b, c, d;
 
     a = buf[0];
     b = buf[1];
@@ -180,8 +179,8 @@
 
 
 // Create a MD5 object
-static
-cmsHANDLE  MD5alloc(cmsContext ContextID)
+
+cmsHANDLE CMSEXPORT cmsMD5alloc(cmsContext ContextID)
 {
     _cmsMD5* ctx = (_cmsMD5*) _cmsMallocZero(ContextID, sizeof(_cmsMD5));
     if (ctx == NULL) return NULL;
@@ -199,9 +198,7 @@
     return (cmsHANDLE) ctx;
 }
 
-
-static
-void MD5add(cmsHANDLE Handle, cmsUInt8Number* buf, cmsUInt32Number len)
+void CMSEXPORT cmsMD5add(cmsHANDLE Handle, const cmsUInt8Number* buf, cmsUInt32Number len)
 {
     _cmsMD5* ctx = (_cmsMD5*) Handle;
     cmsUInt32Number t;
@@ -227,7 +224,7 @@
         memmove(p, buf, t);
         byteReverse(ctx->in, 16);
 
-        MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
+        cmsMD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
         buf += t;
         len -= t;
     }
@@ -235,7 +232,7 @@
     while (len >= 64) {
         memmove(ctx->in, buf, 64);
         byteReverse(ctx->in, 16);
-        MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
+        cmsMD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
         buf += 64;
         len -= 64;
     }
@@ -244,8 +241,7 @@
 }
 
 // Destroy the object and return the checksum
-static
-void MD5finish(cmsProfileID* ProfileID,  cmsHANDLE Handle)
+void CMSEXPORT cmsMD5finish(cmsProfileID* ProfileID,  cmsHANDLE Handle)
 {
     _cmsMD5* ctx = (_cmsMD5*) Handle;
     cmsUInt32Number count;
@@ -262,7 +258,7 @@
 
         memset(p, 0, count);
         byteReverse(ctx->in, 16);
-        MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
+        cmsMD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
 
         memset(ctx->in, 0, 56);
     } else {
@@ -273,7 +269,7 @@
     ((cmsUInt32Number *) ctx->in)[14] = ctx->bits[0];
     ((cmsUInt32Number *) ctx->in)[15] = ctx->bits[1];
 
-    MD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
+    cmsMD5_Transform(ctx->buf, (cmsUInt32Number *) ctx->in);
 
     byteReverse((cmsUInt8Number *) ctx->buf, 4);
     memmove(ProfileID ->ID8, ctx->buf, 16);
@@ -319,11 +315,11 @@
     if (!cmsSaveProfileToMem(hProfile, Mem, &BytesNeeded)) goto Error;
 
     // Create MD5 object
-    MD5 = MD5alloc(ContextID);
+    MD5 = cmsMD5alloc(ContextID);
     if (MD5 == NULL) goto Error;
 
     // Add all bytes
-    MD5add(MD5, Mem, BytesNeeded);
+    cmsMD5add(MD5, Mem, BytesNeeded);
 
     // Temp storage is no longer needed
     _cmsFree(ContextID, Mem);
@@ -332,7 +328,7 @@
     memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
 
     // And store the ID
-    MD5finish(&Icc ->ProfileID,  MD5);
+    cmsMD5finish(&Icc ->ProfileID,  MD5);
     return TRUE;
 
 Error:
--- a/src/share/native/sun/java2d/cmm/lcms/cmsmtrx.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsmtrx.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
--- a/src/share/native/sun/java2d/cmm/lcms/cmsnamed.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsnamed.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -567,7 +567,7 @@
 
     while (v -> Allocated < n) {
         if (!GrowNamedColorList(v)) {
-            _cmsFree(ContextID, (void*) v);
+            cmsFreeNamedColorList(v);
             return NULL;
         }
     }
@@ -600,7 +600,11 @@
 
     // For really large tables we need this
     while (NewNC ->Allocated < v ->Allocated){
-        if (!GrowNamedColorList(NewNC)) return NULL;
+        if (!GrowNamedColorList(NewNC))
+        {
+            cmsFreeNamedColorList(NewNC);
+            return NULL;
+        }
     }
 
     memmove(NewNC ->Prefix, v ->Prefix, sizeof(v ->Prefix));
--- a/src/share/native/sun/java2d/cmm/lcms/cmsopt.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsopt.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -317,9 +317,9 @@
 }
 
 static
-void Eval16nop1D(register const cmsUInt16Number Input[],
-                 register cmsUInt16Number Output[],
-                 register const struct _cms_interp_struc* p)
+void Eval16nop1D(CMSREGISTER const cmsUInt16Number Input[],
+                 CMSREGISTER cmsUInt16Number Output[],
+                 CMSREGISTER const struct _cms_interp_struc* p)
 {
     Output[0] = Input[0];
 
@@ -327,9 +327,9 @@
 }
 
 static
-void PrelinEval16(register const cmsUInt16Number Input[],
-                  register cmsUInt16Number Output[],
-                  register const void* D)
+void PrelinEval16(CMSREGISTER const cmsUInt16Number Input[],
+                  CMSREGISTER cmsUInt16Number Output[],
+                  CMSREGISTER const void* D)
 {
     Prelin16Data* p16 = (Prelin16Data*) D;
     cmsUInt16Number  StageABC[MAX_INPUT_DIMENSIONS];
@@ -435,7 +435,7 @@
 // Sampler implemented by another LUT. This is a clean way to precalculate the devicelink 3D CLUT for
 // almost any transform. We use floating point precision and then convert from floating point to 16 bits.
 static
-cmsInt32Number XFormSampler16(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
+cmsInt32Number XFormSampler16(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo)
 {
     cmsPipeline* Lut = (cmsPipeline*) Cargo;
     cmsFloat32Number InFloat[cmsMAXCHANNELS], OutFloat[cmsMAXCHANNELS];
@@ -552,10 +552,10 @@
                 return FALSE;
             }
 
-            for (i = 0; i < (int) nChannelsOut; i++)
-                Grid->Tab.T[index + i] = Value[i];
+    for (i = 0; i < (int) nChannelsOut; i++)
+        Grid->Tab.T[index + i] = Value[i];
 
-            return TRUE;
+    return TRUE;
 }
 
 // Auxiliary, to see if two values are equal or very different
@@ -673,7 +673,7 @@
     cmsToneCurve** DataSetOut;
     Prelin16Data* p16;
 
-    // This is a loosy optimization! does not apply in floating-point cases
+    // This is a lossy optimization! does not apply in floating-point cases
     if (_cmsFormatterIsFloat(*InputFormat) || _cmsFormatterIsFloat(*OutputFormat)) return FALSE;
 
     ColorSpace       = _cmsICCcolorSpace((int) T_COLORSPACE(*InputFormat));
@@ -937,19 +937,19 @@
 
 // A optimized interpolation for 8-bit input.
 #define DENS(i,j,k) (LutTable[(i)+(j)+(k)+OutChan])
-static
-void PrelinEval8(register const cmsUInt16Number Input[],
-                  register cmsUInt16Number Output[],
-                  register const void* D)
+static CMS_NO_SANITIZE
+void PrelinEval8(CMSREGISTER const cmsUInt16Number Input[],
+                  CMSREGISTER cmsUInt16Number Output[],
+                  CMSREGISTER const void* D)
 {
 
     cmsUInt8Number         r, g, b;
     cmsS15Fixed16Number    rx, ry, rz;
     cmsS15Fixed16Number    c0, c1, c2, c3, Rest;
     int                    OutChan;
-    register cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1;
+    CMSREGISTER cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1;
     Prelin8Data* p8 = (Prelin8Data*) D;
-    register const cmsInterpParams* p = p8 ->p;
+    CMSREGISTER const cmsInterpParams* p = p8 ->p;
     int                    TotalOut = (int) p -> nOutputs;
     const cmsUInt16Number* LutTable = (const cmsUInt16Number*) p->Table;
 
@@ -1020,8 +1020,8 @@
                                 c1 = c2 = c3 = 0;
                             }
 
-                            Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001;
-                            Output[OutChan] = (cmsUInt16Number) (c0 + ((Rest + (Rest >> 16)) >> 16));
+        Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001;
+        Output[OutChan] = (cmsUInt16Number) (c0 + ((Rest + (Rest >> 16)) >> 16));
 
     }
 }
@@ -1070,7 +1070,7 @@
     _cmsStageCLutData* OptimizedPrelinCLUT;
 
 
-    // This is a loosy optimization! does not apply in floating-point cases
+    // This is a lossy optimization! does not apply in floating-point cases
     if (_cmsFormatterIsFloat(*InputFormat) || _cmsFormatterIsFloat(*OutputFormat)) return FALSE;
 
     // Only on chunky RGB
@@ -1113,6 +1113,7 @@
     {
         cmsStage* last = cmsPipelineGetPtrToLastStage(OriginalLut);
 
+        if (last == NULL) goto Error;
         if (cmsStageType(last) == cmsSigCurveSetElemType) {
 
             _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*)cmsStageData(last);
@@ -1221,10 +1222,7 @@
         Prelin8Data* p8 = PrelinOpt8alloc(OptimizedLUT ->ContextID,
                                                 OptimizedPrelinCLUT ->Params,
                                                 OptimizedPrelinCurves);
-        if (p8 == NULL) {
-            cmsPipelineFree(OptimizedLUT);
-            return FALSE;
-        }
+        if (p8 == NULL) return FALSE;
 
         _cmsPipelineSetOptimizationParameters(OptimizedLUT, PrelinEval8, (void*) p8, Prelin8free, Prelin8dup);
 
@@ -1234,10 +1232,7 @@
         Prelin16Data* p16 = PrelinOpt16alloc(OptimizedLUT ->ContextID,
             OptimizedPrelinCLUT ->Params,
             3, OptimizedPrelinCurves, 3, NULL);
-        if (p16 == NULL) {
-            cmsPipelineFree(OptimizedLUT);
-            return FALSE;
-        }
+        if (p16 == NULL) return FALSE;
 
         _cmsPipelineSetOptimizationParameters(OptimizedLUT, PrelinEval16, (void*) p16, PrelinOpt16free, Prelin16dup);
 
@@ -1365,9 +1360,9 @@
 }
 
 static
-void FastEvaluateCurves8(register const cmsUInt16Number In[],
-                          register cmsUInt16Number Out[],
-                          register const void* D)
+void FastEvaluateCurves8(CMSREGISTER const cmsUInt16Number In[],
+                          CMSREGISTER cmsUInt16Number Out[],
+                          CMSREGISTER const void* D)
 {
     Curves16Data* Data = (Curves16Data*) D;
     int x;
@@ -1382,9 +1377,9 @@
 
 
 static
-void FastEvaluateCurves16(register const cmsUInt16Number In[],
-                          register cmsUInt16Number Out[],
-                          register const void* D)
+void FastEvaluateCurves16(CMSREGISTER const cmsUInt16Number In[],
+                          CMSREGISTER cmsUInt16Number Out[],
+                          CMSREGISTER const void* D)
 {
     Curves16Data* Data = (Curves16Data*) D;
     cmsUInt32Number i;
@@ -1396,9 +1391,9 @@
 
 
 static
-void FastIdentity16(register const cmsUInt16Number In[],
-                    register cmsUInt16Number Out[],
-                    register const void* D)
+void FastIdentity16(CMSREGISTER const cmsUInt16Number In[],
+                    CMSREGISTER cmsUInt16Number Out[],
+                    CMSREGISTER const void* D)
 {
     cmsPipeline* Lut = (cmsPipeline*) D;
     cmsUInt32Number i;
@@ -1423,7 +1418,7 @@
     cmsStage* ObtainedCurves = NULL;
 
 
-    // This is a loosy optimization! does not apply in floating-point cases
+    // This is a lossy optimization! does not apply in floating-point cases
     if (_cmsFormatterIsFloat(*InputFormat) || _cmsFormatterIsFloat(*OutputFormat)) return FALSE;
 
     //  Only curves in this LUT?
@@ -1473,14 +1468,15 @@
 
     // Maybe the curves are linear at the end
     if (!AllCurvesAreLinear(ObtainedCurves)) {
+       _cmsStageToneCurvesData* Data;
 
         if (!cmsPipelineInsertStage(Dest, cmsAT_BEGIN, ObtainedCurves))
             goto Error;
+        Data = (_cmsStageToneCurvesData*) cmsStageData(ObtainedCurves);
+        ObtainedCurves = NULL;
 
         // If the curves are to be applied in 8 bits, we can save memory
         if (_cmsFormatterIs8bit(*InputFormat)) {
-
-            _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*) ObtainedCurves ->Data;
              Curves16Data* c16 = CurvesAlloc(Dest ->ContextID, Data ->nCurves, 256, Data ->TheCurves);
 
              if (c16 == NULL) goto Error;
@@ -1489,8 +1485,6 @@
 
         }
         else {
-
-            _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*) cmsStageData(ObtainedCurves);
              Curves16Data* c16 = CurvesAlloc(Dest ->ContextID, Data ->nCurves, 65536, Data ->TheCurves);
 
              if (c16 == NULL) goto Error;
@@ -1557,9 +1551,9 @@
 // to accomplish some performance. Actually it takes 256x3 16 bits tables and 16385 x 3 tables of 8 bits,
 // in total about 50K, and the performance boost is huge!
 static
-void MatShaperEval16(register const cmsUInt16Number In[],
-                     register cmsUInt16Number Out[],
-                     register const void* D)
+void MatShaperEval16(CMSREGISTER const cmsUInt16Number In[],
+                     CMSREGISTER cmsUInt16Number Out[],
+                     CMSREGISTER const void* D)
 {
     MatShaper8Data* p = (MatShaper8Data*) D;
     cmsS1Fixed14Number l1, l2, l3, r, g, b;
@@ -1799,8 +1793,8 @@
         _cmsStageToneCurvesData* mpeC1 = (_cmsStageToneCurvesData*) cmsStageData(Curve1);
         _cmsStageToneCurvesData* mpeC2 = (_cmsStageToneCurvesData*) cmsStageData(Curve2);
 
-        // In this particular optimization, caché does not help as it takes more time to deal with
-        // the caché that with the pixel handling
+        // In this particular optimization, cache does not help as it takes more time to deal with
+        // the cache that with the pixel handling
         *dwFlags |= cmsFLAGS_NOCACHE;
 
         // Setup the optimizarion routines
--- a/src/share/native/sun/java2d/cmm/lcms/cmspack.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmspack.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -121,10 +121,10 @@
 
 // Does almost everything but is slow
 static
-cmsUInt8Number* UnrollChunkyBytes(register _cmsTRANSFORM* info,
-                                  register cmsUInt16Number wIn[],
-                                  register cmsUInt8Number* accum,
-                                  register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollChunkyBytes(CMSREGISTER _cmsTRANSFORM* info,
+                                  CMSREGISTER cmsUInt16Number wIn[],
+                                  CMSREGISTER cmsUInt8Number* accum,
+                                  CMSREGISTER cmsUInt32Number Stride)
 {
     cmsUInt32Number nChan      = T_CHANNELS(info -> InputFormat);
     cmsUInt32Number DoSwap     = T_DOSWAP(info ->InputFormat);
@@ -168,10 +168,10 @@
 
 // Extra channels are just ignored because come in the next planes
 static
-cmsUInt8Number* UnrollPlanarBytes(register _cmsTRANSFORM* info,
-                                  register cmsUInt16Number wIn[],
-                                  register cmsUInt8Number* accum,
-                                  register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollPlanarBytes(CMSREGISTER _cmsTRANSFORM* info,
+                                  CMSREGISTER cmsUInt16Number wIn[],
+                                  CMSREGISTER cmsUInt8Number* accum,
+                                  CMSREGISTER cmsUInt32Number Stride)
 {
     cmsUInt32Number nChan     = T_CHANNELS(info -> InputFormat);
     cmsUInt32Number DoSwap    = T_DOSWAP(info ->InputFormat);
@@ -198,10 +198,10 @@
 
 // Special cases, provided for performance
 static
-cmsUInt8Number* Unroll4Bytes(register _cmsTRANSFORM* info,
-                             register cmsUInt16Number wIn[],
-                             register cmsUInt8Number* accum,
-                             register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4Bytes(CMSREGISTER _cmsTRANSFORM* info,
+                             CMSREGISTER cmsUInt16Number wIn[],
+                             CMSREGISTER cmsUInt8Number* accum,
+                             CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = FROM_8_TO_16(*accum); accum++; // C
     wIn[1] = FROM_8_TO_16(*accum); accum++; // M
@@ -215,10 +215,10 @@
 }
 
 static
-cmsUInt8Number* Unroll4BytesReverse(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wIn[],
-                                    register cmsUInt8Number* accum,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4BytesReverse(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wIn[],
+                                    CMSREGISTER cmsUInt8Number* accum,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = FROM_8_TO_16(REVERSE_FLAVOR_8(*accum)); accum++; // C
     wIn[1] = FROM_8_TO_16(REVERSE_FLAVOR_8(*accum)); accum++; // M
@@ -232,10 +232,10 @@
 }
 
 static
-cmsUInt8Number* Unroll4BytesSwapFirst(register _cmsTRANSFORM* info,
-                                      register cmsUInt16Number wIn[],
-                                      register cmsUInt8Number* accum,
-                                      register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4BytesSwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                      CMSREGISTER cmsUInt16Number wIn[],
+                                      CMSREGISTER cmsUInt8Number* accum,
+                                      CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[3] = FROM_8_TO_16(*accum); accum++; // K
     wIn[0] = FROM_8_TO_16(*accum); accum++; // C
@@ -250,10 +250,10 @@
 
 // KYMC
 static
-cmsUInt8Number* Unroll4BytesSwap(register _cmsTRANSFORM* info,
-                                 register cmsUInt16Number wIn[],
-                                 register cmsUInt8Number* accum,
-                                 register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4BytesSwap(CMSREGISTER _cmsTRANSFORM* info,
+                                 CMSREGISTER cmsUInt16Number wIn[],
+                                 CMSREGISTER cmsUInt8Number* accum,
+                                 CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[3] = FROM_8_TO_16(*accum); accum++;  // K
     wIn[2] = FROM_8_TO_16(*accum); accum++;  // Y
@@ -267,10 +267,10 @@
 }
 
 static
-cmsUInt8Number* Unroll4BytesSwapSwapFirst(register _cmsTRANSFORM* info,
-                                          register cmsUInt16Number wIn[],
-                                          register cmsUInt8Number* accum,
-                                          register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4BytesSwapSwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                          CMSREGISTER cmsUInt16Number wIn[],
+                                          CMSREGISTER cmsUInt8Number* accum,
+                                          CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[2] = FROM_8_TO_16(*accum); accum++;  // K
     wIn[1] = FROM_8_TO_16(*accum); accum++;  // Y
@@ -284,10 +284,10 @@
 }
 
 static
-cmsUInt8Number* Unroll3Bytes(register _cmsTRANSFORM* info,
-                             register cmsUInt16Number wIn[],
-                             register cmsUInt8Number* accum,
-                             register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll3Bytes(CMSREGISTER _cmsTRANSFORM* info,
+                             CMSREGISTER cmsUInt16Number wIn[],
+                             CMSREGISTER cmsUInt8Number* accum,
+                             CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = FROM_8_TO_16(*accum); accum++;     // R
     wIn[1] = FROM_8_TO_16(*accum); accum++;     // G
@@ -300,10 +300,10 @@
 }
 
 static
-cmsUInt8Number* Unroll3BytesSkip1Swap(register _cmsTRANSFORM* info,
-                                      register cmsUInt16Number wIn[],
-                                      register cmsUInt8Number* accum,
-                                      register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll3BytesSkip1Swap(CMSREGISTER _cmsTRANSFORM* info,
+                                      CMSREGISTER cmsUInt16Number wIn[],
+                                      CMSREGISTER cmsUInt8Number* accum,
+                                      CMSREGISTER cmsUInt32Number Stride)
 {
     accum++; // A
     wIn[2] = FROM_8_TO_16(*accum); accum++; // B
@@ -317,10 +317,10 @@
 }
 
 static
-cmsUInt8Number* Unroll3BytesSkip1SwapSwapFirst(register _cmsTRANSFORM* info,
-                                              register cmsUInt16Number wIn[],
-                                              register cmsUInt8Number* accum,
-                                              register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll3BytesSkip1SwapSwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                              CMSREGISTER cmsUInt16Number wIn[],
+                                              CMSREGISTER cmsUInt8Number* accum,
+                                              CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[2] = FROM_8_TO_16(*accum); accum++; // B
     wIn[1] = FROM_8_TO_16(*accum); accum++; // G
@@ -334,10 +334,10 @@
 }
 
 static
-cmsUInt8Number* Unroll3BytesSkip1SwapFirst(register _cmsTRANSFORM* info,
-                                           register cmsUInt16Number wIn[],
-                                           register cmsUInt8Number* accum,
-                                           register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll3BytesSkip1SwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                           CMSREGISTER cmsUInt16Number wIn[],
+                                           CMSREGISTER cmsUInt8Number* accum,
+                                           CMSREGISTER cmsUInt32Number Stride)
 {
     accum++; // A
     wIn[0] = FROM_8_TO_16(*accum); accum++; // R
@@ -353,10 +353,10 @@
 
 // BRG
 static
-cmsUInt8Number* Unroll3BytesSwap(register _cmsTRANSFORM* info,
-                                 register cmsUInt16Number wIn[],
-                                 register cmsUInt8Number* accum,
-                                 register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll3BytesSwap(CMSREGISTER _cmsTRANSFORM* info,
+                                 CMSREGISTER cmsUInt16Number wIn[],
+                                 CMSREGISTER cmsUInt8Number* accum,
+                                 CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[2] = FROM_8_TO_16(*accum); accum++;     // B
     wIn[1] = FROM_8_TO_16(*accum); accum++;     // G
@@ -369,10 +369,10 @@
 }
 
 static
-cmsUInt8Number* UnrollLabV2_8(register _cmsTRANSFORM* info,
-                              register cmsUInt16Number wIn[],
-                              register cmsUInt8Number* accum,
-                              register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollLabV2_8(CMSREGISTER _cmsTRANSFORM* info,
+                              CMSREGISTER cmsUInt16Number wIn[],
+                              CMSREGISTER cmsUInt8Number* accum,
+                              CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = FomLabV2ToLabV4(FROM_8_TO_16(*accum)); accum++;     // L
     wIn[1] = FomLabV2ToLabV4(FROM_8_TO_16(*accum)); accum++;     // a
@@ -385,10 +385,10 @@
 }
 
 static
-cmsUInt8Number* UnrollALabV2_8(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wIn[],
-                               register cmsUInt8Number* accum,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollALabV2_8(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wIn[],
+                               CMSREGISTER cmsUInt8Number* accum,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     accum++;  // A
     wIn[0] = FomLabV2ToLabV4(FROM_8_TO_16(*accum)); accum++;     // L
@@ -402,10 +402,10 @@
 }
 
 static
-cmsUInt8Number* UnrollLabV2_16(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wIn[],
-                               register cmsUInt8Number* accum,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollLabV2_16(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wIn[],
+                               CMSREGISTER cmsUInt8Number* accum,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = FomLabV2ToLabV4(*(cmsUInt16Number*) accum); accum += 2;     // L
     wIn[1] = FomLabV2ToLabV4(*(cmsUInt16Number*) accum); accum += 2;     // a
@@ -419,10 +419,10 @@
 
 // for duplex
 static
-cmsUInt8Number* Unroll2Bytes(register _cmsTRANSFORM* info,
-                                     register cmsUInt16Number wIn[],
-                                     register cmsUInt8Number* accum,
-                                     register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll2Bytes(CMSREGISTER _cmsTRANSFORM* info,
+                                     CMSREGISTER cmsUInt16Number wIn[],
+                                     CMSREGISTER cmsUInt8Number* accum,
+                                     CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = FROM_8_TO_16(*accum); accum++;     // ch1
     wIn[1] = FROM_8_TO_16(*accum); accum++;     // ch2
@@ -438,10 +438,10 @@
 
 // Monochrome duplicates L into RGB for null-transforms
 static
-cmsUInt8Number* Unroll1Byte(register _cmsTRANSFORM* info,
-                            register cmsUInt16Number wIn[],
-                            register cmsUInt8Number* accum,
-                            register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll1Byte(CMSREGISTER _cmsTRANSFORM* info,
+                            CMSREGISTER cmsUInt16Number wIn[],
+                            CMSREGISTER cmsUInt8Number* accum,
+                            CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++;     // L
 
@@ -453,10 +453,10 @@
 
 
 static
-cmsUInt8Number* Unroll1ByteSkip1(register _cmsTRANSFORM* info,
-                                 register cmsUInt16Number wIn[],
-                                 register cmsUInt8Number* accum,
-                                 register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll1ByteSkip1(CMSREGISTER _cmsTRANSFORM* info,
+                                 CMSREGISTER cmsUInt16Number wIn[],
+                                 CMSREGISTER cmsUInt8Number* accum,
+                                 CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++;     // L
     accum += 1;
@@ -468,10 +468,10 @@
 }
 
 static
-cmsUInt8Number* Unroll1ByteSkip2(register _cmsTRANSFORM* info,
-                                 register cmsUInt16Number wIn[],
-                                 register cmsUInt8Number* accum,
-                                 register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll1ByteSkip2(CMSREGISTER _cmsTRANSFORM* info,
+                                 CMSREGISTER cmsUInt16Number wIn[],
+                                 CMSREGISTER cmsUInt8Number* accum,
+                                 CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = wIn[1] = wIn[2] = FROM_8_TO_16(*accum); accum++;     // L
     accum += 2;
@@ -483,10 +483,10 @@
 }
 
 static
-cmsUInt8Number* Unroll1ByteReversed(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wIn[],
-                                    register cmsUInt8Number* accum,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll1ByteReversed(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wIn[],
+                                    CMSREGISTER cmsUInt8Number* accum,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = wIn[1] = wIn[2] = REVERSE_FLAVOR_16(FROM_8_TO_16(*accum)); accum++;     // L
 
@@ -498,10 +498,10 @@
 
 
 static
-cmsUInt8Number* UnrollAnyWords(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wIn[],
-                               register cmsUInt8Number* accum,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollAnyWords(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wIn[],
+                               CMSREGISTER cmsUInt8Number* accum,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
    cmsUInt32Number nChan       = T_CHANNELS(info -> InputFormat);
    cmsUInt32Number SwapEndian  = T_ENDIAN16(info -> InputFormat);
@@ -547,10 +547,10 @@
 }
 
 static
-cmsUInt8Number* UnrollPlanarWords(register _cmsTRANSFORM* info,
-                                  register cmsUInt16Number wIn[],
-                                  register cmsUInt8Number* accum,
-                                  register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollPlanarWords(CMSREGISTER _cmsTRANSFORM* info,
+                                  CMSREGISTER cmsUInt16Number wIn[],
+                                  CMSREGISTER cmsUInt8Number* accum,
+                                  CMSREGISTER cmsUInt32Number Stride)
 {
     cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat);
     cmsUInt32Number DoSwap= T_DOSWAP(info ->InputFormat);
@@ -581,10 +581,10 @@
 
 
 static
-cmsUInt8Number* Unroll4Words(register _cmsTRANSFORM* info,
-                             register cmsUInt16Number wIn[],
-                             register cmsUInt8Number* accum,
-                             register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4Words(CMSREGISTER _cmsTRANSFORM* info,
+                             CMSREGISTER cmsUInt16Number wIn[],
+                             CMSREGISTER cmsUInt8Number* accum,
+                             CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = *(cmsUInt16Number*) accum; accum+= 2; // C
     wIn[1] = *(cmsUInt16Number*) accum; accum+= 2; // M
@@ -598,10 +598,10 @@
 }
 
 static
-cmsUInt8Number* Unroll4WordsReverse(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wIn[],
-                                    register cmsUInt8Number* accum,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4WordsReverse(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wIn[],
+                                    CMSREGISTER cmsUInt8Number* accum,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = REVERSE_FLAVOR_16(*(cmsUInt16Number*) accum); accum+= 2; // C
     wIn[1] = REVERSE_FLAVOR_16(*(cmsUInt16Number*) accum); accum+= 2; // M
@@ -615,10 +615,10 @@
 }
 
 static
-cmsUInt8Number* Unroll4WordsSwapFirst(register _cmsTRANSFORM* info,
-                                      register cmsUInt16Number wIn[],
-                                      register cmsUInt8Number* accum,
-                                      register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4WordsSwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                      CMSREGISTER cmsUInt16Number wIn[],
+                                      CMSREGISTER cmsUInt8Number* accum,
+                                      CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[3] = *(cmsUInt16Number*) accum; accum+= 2; // K
     wIn[0] = *(cmsUInt16Number*) accum; accum+= 2; // C
@@ -633,10 +633,10 @@
 
 // KYMC
 static
-cmsUInt8Number* Unroll4WordsSwap(register _cmsTRANSFORM* info,
-                                 register cmsUInt16Number wIn[],
-                                 register cmsUInt8Number* accum,
-                                 register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4WordsSwap(CMSREGISTER _cmsTRANSFORM* info,
+                                 CMSREGISTER cmsUInt16Number wIn[],
+                                 CMSREGISTER cmsUInt8Number* accum,
+                                 CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[3] = *(cmsUInt16Number*) accum; accum+= 2; // K
     wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // Y
@@ -650,10 +650,10 @@
 }
 
 static
-cmsUInt8Number* Unroll4WordsSwapSwapFirst(register _cmsTRANSFORM* info,
-                                          register cmsUInt16Number wIn[],
-                                          register cmsUInt8Number* accum,
-                                          register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll4WordsSwapSwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                          CMSREGISTER cmsUInt16Number wIn[],
+                                          CMSREGISTER cmsUInt8Number* accum,
+                                          CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[2] = *(cmsUInt16Number*) accum; accum+= 2; // K
     wIn[1] = *(cmsUInt16Number*) accum; accum+= 2; // Y
@@ -667,10 +667,10 @@
 }
 
 static
-cmsUInt8Number* Unroll3Words(register _cmsTRANSFORM* info,
-                             register cmsUInt16Number wIn[],
-                             register cmsUInt8Number* accum,
-                             register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll3Words(CMSREGISTER _cmsTRANSFORM* info,
+                             CMSREGISTER cmsUInt16Number wIn[],
+                             CMSREGISTER cmsUInt8Number* accum,
+                             CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = *(cmsUInt16Number*) accum; accum+= 2;  // C R
     wIn[1] = *(cmsUInt16Number*) accum; accum+= 2;  // M G
@@ -683,10 +683,10 @@
 }
 
 static
-cmsUInt8Number* Unroll3WordsSwap(register _cmsTRANSFORM* info,
-                                 register cmsUInt16Number wIn[],
-                                 register cmsUInt8Number* accum,
-                                 register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll3WordsSwap(CMSREGISTER _cmsTRANSFORM* info,
+                                 CMSREGISTER cmsUInt16Number wIn[],
+                                 CMSREGISTER cmsUInt8Number* accum,
+                                 CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[2] = *(cmsUInt16Number*) accum; accum+= 2;  // C R
     wIn[1] = *(cmsUInt16Number*) accum; accum+= 2;  // M G
@@ -699,10 +699,10 @@
 }
 
 static
-cmsUInt8Number* Unroll3WordsSkip1Swap(register _cmsTRANSFORM* info,
-                                      register cmsUInt16Number wIn[],
-                                      register cmsUInt8Number* accum,
-                                      register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll3WordsSkip1Swap(CMSREGISTER _cmsTRANSFORM* info,
+                                      CMSREGISTER cmsUInt16Number wIn[],
+                                      CMSREGISTER cmsUInt8Number* accum,
+                                      CMSREGISTER cmsUInt32Number Stride)
 {
     accum += 2; // A
     wIn[2] = *(cmsUInt16Number*) accum; accum += 2; // R
@@ -716,10 +716,10 @@
 }
 
 static
-cmsUInt8Number* Unroll3WordsSkip1SwapFirst(register _cmsTRANSFORM* info,
-                                           register cmsUInt16Number wIn[],
-                                           register cmsUInt8Number* accum,
-                                           register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll3WordsSkip1SwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                           CMSREGISTER cmsUInt16Number wIn[],
+                                           CMSREGISTER cmsUInt8Number* accum,
+                                           CMSREGISTER cmsUInt32Number Stride)
 {
     accum += 2; // A
     wIn[0] = *(cmsUInt16Number*) accum; accum += 2; // R
@@ -733,10 +733,10 @@
 }
 
 static
-cmsUInt8Number* Unroll1Word(register _cmsTRANSFORM* info,
-                            register cmsUInt16Number wIn[],
-                            register cmsUInt8Number* accum,
-                            register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll1Word(CMSREGISTER _cmsTRANSFORM* info,
+                            CMSREGISTER cmsUInt16Number wIn[],
+                            CMSREGISTER cmsUInt8Number* accum,
+                            CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum; accum+= 2;   // L
 
@@ -747,10 +747,10 @@
 }
 
 static
-cmsUInt8Number* Unroll1WordReversed(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wIn[],
-                                    register cmsUInt8Number* accum,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll1WordReversed(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wIn[],
+                                    CMSREGISTER cmsUInt8Number* accum,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = wIn[1] = wIn[2] = REVERSE_FLAVOR_16(*(cmsUInt16Number*) accum); accum+= 2;
 
@@ -761,10 +761,10 @@
 }
 
 static
-cmsUInt8Number* Unroll1WordSkip3(register _cmsTRANSFORM* info,
-                                 register cmsUInt16Number wIn[],
-                                 register cmsUInt8Number* accum,
-                                 register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll1WordSkip3(CMSREGISTER _cmsTRANSFORM* info,
+                                 CMSREGISTER cmsUInt16Number wIn[],
+                                 CMSREGISTER cmsUInt8Number* accum,
+                                 CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = wIn[1] = wIn[2] = *(cmsUInt16Number*) accum;
 
@@ -777,10 +777,10 @@
 }
 
 static
-cmsUInt8Number* Unroll2Words(register _cmsTRANSFORM* info,
-                                     register cmsUInt16Number wIn[],
-                                     register cmsUInt8Number* accum,
-                                     register cmsUInt32Number Stride)
+cmsUInt8Number* Unroll2Words(CMSREGISTER _cmsTRANSFORM* info,
+                                     CMSREGISTER cmsUInt16Number wIn[],
+                                     CMSREGISTER cmsUInt8Number* accum,
+                                     CMSREGISTER cmsUInt32Number Stride)
 {
     wIn[0] = *(cmsUInt16Number*) accum; accum += 2;    // ch1
     wIn[1] = *(cmsUInt16Number*) accum; accum += 2;    // ch2
@@ -794,10 +794,10 @@
 
 // This is a conversion of Lab double to 16 bits
 static
-cmsUInt8Number* UnrollLabDoubleTo16(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wIn[],
-                                    register cmsUInt8Number* accum,
-                                    register cmsUInt32Number  Stride)
+cmsUInt8Number* UnrollLabDoubleTo16(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wIn[],
+                                    CMSREGISTER cmsUInt8Number* accum,
+                                    CMSREGISTER cmsUInt32Number  Stride)
 {
     if (T_PLANAR(info -> InputFormat)) {
 
@@ -828,10 +828,10 @@
 
 // This is a conversion of Lab float to 16 bits
 static
-cmsUInt8Number* UnrollLabFloatTo16(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wIn[],
-                                    register cmsUInt8Number* accum,
-                                    register cmsUInt32Number  Stride)
+cmsUInt8Number* UnrollLabFloatTo16(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wIn[],
+                                    CMSREGISTER cmsUInt8Number* accum,
+                                    CMSREGISTER cmsUInt32Number  Stride)
 {
     cmsCIELab Lab;
 
@@ -866,10 +866,10 @@
 
 // This is a conversion of XYZ double to 16 bits
 static
-cmsUInt8Number* UnrollXYZDoubleTo16(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wIn[],
-                                    register cmsUInt8Number* accum,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollXYZDoubleTo16(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wIn[],
+                                    CMSREGISTER cmsUInt8Number* accum,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     if (T_PLANAR(info -> InputFormat)) {
 
@@ -902,10 +902,10 @@
 
 // This is a conversion of XYZ float to 16 bits
 static
-cmsUInt8Number* UnrollXYZFloatTo16(register _cmsTRANSFORM* info,
-                                   register cmsUInt16Number wIn[],
-                                   register cmsUInt8Number* accum,
-                                   register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollXYZFloatTo16(CMSREGISTER _cmsTRANSFORM* info,
+                                   CMSREGISTER cmsUInt16Number wIn[],
+                                   CMSREGISTER cmsUInt8Number* accum,
+                                   CMSREGISTER cmsUInt32Number Stride)
 {
     if (T_PLANAR(info -> InputFormat)) {
 
@@ -982,10 +982,10 @@
 
 // Inks does come in percentage, remaining cases are between 0..1.0, again to 16 bits
 static
-cmsUInt8Number* UnrollDoubleTo16(register _cmsTRANSFORM* info,
-                                register cmsUInt16Number wIn[],
-                                register cmsUInt8Number* accum,
-                                register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollDoubleTo16(CMSREGISTER _cmsTRANSFORM* info,
+                                CMSREGISTER cmsUInt16Number wIn[],
+                                CMSREGISTER cmsUInt8Number* accum,
+                                CMSREGISTER cmsUInt32Number Stride)
 {
 
     cmsUInt32Number nChan      = T_CHANNELS(info -> InputFormat);
@@ -1040,10 +1040,10 @@
 
 
 static
-cmsUInt8Number* UnrollFloatTo16(register _cmsTRANSFORM* info,
-                                register cmsUInt16Number wIn[],
-                                register cmsUInt8Number* accum,
-                                register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollFloatTo16(CMSREGISTER _cmsTRANSFORM* info,
+                                CMSREGISTER cmsUInt16Number wIn[],
+                                CMSREGISTER cmsUInt8Number* accum,
+                                CMSREGISTER cmsUInt32Number Stride)
 {
 
     cmsUInt32Number nChan  = T_CHANNELS(info -> InputFormat);
@@ -1099,10 +1099,10 @@
 
 // For 1 channel, we need to duplicate data (it comes in 0..1.0 range)
 static
-cmsUInt8Number* UnrollDouble1Chan(register _cmsTRANSFORM* info,
-                                  register cmsUInt16Number wIn[],
-                                  register cmsUInt8Number* accum,
-                                  register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollDouble1Chan(CMSREGISTER _cmsTRANSFORM* info,
+                                  CMSREGISTER cmsUInt16Number wIn[],
+                                  CMSREGISTER cmsUInt8Number* accum,
+                                  CMSREGISTER cmsUInt32Number Stride)
 {
     cmsFloat64Number* Inks = (cmsFloat64Number*) accum;
 
@@ -1352,10 +1352,10 @@
 // Generic chunky for byte
 
 static
-cmsUInt8Number* PackAnyBytes(register _cmsTRANSFORM* info,
-                             register cmsUInt16Number wOut[],
-                             register cmsUInt8Number* output,
-                             register cmsUInt32Number Stride)
+cmsUInt8Number* PackAnyBytes(CMSREGISTER _cmsTRANSFORM* info,
+                             CMSREGISTER cmsUInt16Number wOut[],
+                             CMSREGISTER cmsUInt8Number* output,
+                             CMSREGISTER cmsUInt32Number Stride)
 {
     cmsUInt32Number nChan  = T_CHANNELS(info -> OutputFormat);
     cmsUInt32Number DoSwap   = T_DOSWAP(info ->OutputFormat);
@@ -1404,10 +1404,10 @@
 
 
 static
-cmsUInt8Number* PackAnyWords(register _cmsTRANSFORM* info,
-                             register cmsUInt16Number wOut[],
-                             register cmsUInt8Number* output,
-                             register cmsUInt32Number Stride)
+cmsUInt8Number* PackAnyWords(CMSREGISTER _cmsTRANSFORM* info,
+                             CMSREGISTER cmsUInt16Number wOut[],
+                             CMSREGISTER cmsUInt8Number* output,
+                             CMSREGISTER cmsUInt32Number Stride)
 {
     cmsUInt32Number nChan  = T_CHANNELS(info -> OutputFormat);
     cmsUInt32Number SwapEndian = T_ENDIAN16(info -> OutputFormat);
@@ -1461,10 +1461,10 @@
 
 
 static
-cmsUInt8Number* PackPlanarBytes(register _cmsTRANSFORM* info,
-                                register cmsUInt16Number wOut[],
-                                register cmsUInt8Number* output,
-                                register cmsUInt32Number Stride)
+cmsUInt8Number* PackPlanarBytes(CMSREGISTER _cmsTRANSFORM* info,
+                                CMSREGISTER cmsUInt16Number wOut[],
+                                CMSREGISTER cmsUInt8Number* output,
+                                CMSREGISTER cmsUInt32Number Stride)
 {
     cmsUInt32Number nChan     = T_CHANNELS(info -> OutputFormat);
     cmsUInt32Number DoSwap    = T_DOSWAP(info ->OutputFormat);
@@ -1495,10 +1495,10 @@
 
 
 static
-cmsUInt8Number* PackPlanarWords(register _cmsTRANSFORM* info,
-                                register cmsUInt16Number wOut[],
-                                register cmsUInt8Number* output,
-                                register cmsUInt32Number Stride)
+cmsUInt8Number* PackPlanarWords(CMSREGISTER _cmsTRANSFORM* info,
+                                CMSREGISTER cmsUInt16Number wOut[],
+                                CMSREGISTER cmsUInt8Number* output,
+                                CMSREGISTER cmsUInt32Number Stride)
 {
     cmsUInt32Number nChan      = T_CHANNELS(info -> OutputFormat);
     cmsUInt32Number DoSwap     = T_DOSWAP(info ->OutputFormat);
@@ -1534,10 +1534,10 @@
 // CMYKcm (unrolled for speed)
 
 static
-cmsUInt8Number* Pack6Bytes(register _cmsTRANSFORM* info,
-                           register cmsUInt16Number wOut[],
-                           register cmsUInt8Number* output,
-                           register cmsUInt32Number Stride)
+cmsUInt8Number* Pack6Bytes(CMSREGISTER _cmsTRANSFORM* info,
+                           CMSREGISTER cmsUInt16Number wOut[],
+                           CMSREGISTER cmsUInt8Number* output,
+                           CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[0]);
     *output++ = FROM_16_TO_8(wOut[1]);
@@ -1555,10 +1555,10 @@
 // KCMYcm
 
 static
-cmsUInt8Number* Pack6BytesSwap(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wOut[],
-                               register cmsUInt8Number* output,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* Pack6BytesSwap(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wOut[],
+                               CMSREGISTER cmsUInt8Number* output,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[5]);
     *output++ = FROM_16_TO_8(wOut[4]);
@@ -1575,10 +1575,10 @@
 
 // CMYKcm
 static
-cmsUInt8Number* Pack6Words(register _cmsTRANSFORM* info,
-                           register cmsUInt16Number wOut[],
-                           register cmsUInt8Number* output,
-                           register cmsUInt32Number Stride)
+cmsUInt8Number* Pack6Words(CMSREGISTER _cmsTRANSFORM* info,
+                           CMSREGISTER cmsUInt16Number wOut[],
+                           CMSREGISTER cmsUInt8Number* output,
+                           CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[0];
     output+= 2;
@@ -1601,10 +1601,10 @@
 
 // KCMYcm
 static
-cmsUInt8Number* Pack6WordsSwap(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wOut[],
-                               register cmsUInt8Number* output,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* Pack6WordsSwap(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wOut[],
+                               CMSREGISTER cmsUInt8Number* output,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[5];
     output+= 2;
@@ -1627,10 +1627,10 @@
 
 
 static
-cmsUInt8Number* Pack4Bytes(register _cmsTRANSFORM* info,
-                           register cmsUInt16Number wOut[],
-                           register cmsUInt8Number* output,
-                           register cmsUInt32Number Stride)
+cmsUInt8Number* Pack4Bytes(CMSREGISTER _cmsTRANSFORM* info,
+                           CMSREGISTER cmsUInt16Number wOut[],
+                           CMSREGISTER cmsUInt8Number* output,
+                           CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[0]);
     *output++ = FROM_16_TO_8(wOut[1]);
@@ -1644,10 +1644,10 @@
 }
 
 static
-cmsUInt8Number* Pack4BytesReverse(register _cmsTRANSFORM* info,
-                                  register cmsUInt16Number wOut[],
-                                  register cmsUInt8Number* output,
-                                  register cmsUInt32Number Stride)
+cmsUInt8Number* Pack4BytesReverse(CMSREGISTER _cmsTRANSFORM* info,
+                                  CMSREGISTER cmsUInt16Number wOut[],
+                                  CMSREGISTER cmsUInt8Number* output,
+                                  CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = REVERSE_FLAVOR_8(FROM_16_TO_8(wOut[0]));
     *output++ = REVERSE_FLAVOR_8(FROM_16_TO_8(wOut[1]));
@@ -1662,10 +1662,10 @@
 
 
 static
-cmsUInt8Number* Pack4BytesSwapFirst(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wOut[],
-                                    register cmsUInt8Number* output,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* Pack4BytesSwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wOut[],
+                                    CMSREGISTER cmsUInt8Number* output,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[3]);
     *output++ = FROM_16_TO_8(wOut[0]);
@@ -1680,10 +1680,10 @@
 
 // ABGR
 static
-cmsUInt8Number* Pack4BytesSwap(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wOut[],
-                               register cmsUInt8Number* output,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* Pack4BytesSwap(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wOut[],
+                               CMSREGISTER cmsUInt8Number* output,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[3]);
     *output++ = FROM_16_TO_8(wOut[2]);
@@ -1697,10 +1697,10 @@
 }
 
 static
-cmsUInt8Number* Pack4BytesSwapSwapFirst(register _cmsTRANSFORM* info,
-                                        register cmsUInt16Number wOut[],
-                                        register cmsUInt8Number* output,
-                                        register cmsUInt32Number Stride)
+cmsUInt8Number* Pack4BytesSwapSwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                        CMSREGISTER cmsUInt16Number wOut[],
+                                        CMSREGISTER cmsUInt8Number* output,
+                                        CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[2]);
     *output++ = FROM_16_TO_8(wOut[1]);
@@ -1714,10 +1714,10 @@
 }
 
 static
-cmsUInt8Number* Pack4Words(register _cmsTRANSFORM* info,
-                           register cmsUInt16Number wOut[],
-                           register cmsUInt8Number* output,
-                           register cmsUInt32Number Stride)
+cmsUInt8Number* Pack4Words(CMSREGISTER _cmsTRANSFORM* info,
+                           CMSREGISTER cmsUInt16Number wOut[],
+                           CMSREGISTER cmsUInt8Number* output,
+                           CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[0];
     output+= 2;
@@ -1735,10 +1735,10 @@
 }
 
 static
-cmsUInt8Number* Pack4WordsReverse(register _cmsTRANSFORM* info,
-                                  register cmsUInt16Number wOut[],
-                                  register cmsUInt8Number* output,
-                                  register cmsUInt32Number Stride)
+cmsUInt8Number* Pack4WordsReverse(CMSREGISTER _cmsTRANSFORM* info,
+                                  CMSREGISTER cmsUInt16Number wOut[],
+                                  CMSREGISTER cmsUInt8Number* output,
+                                  CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = REVERSE_FLAVOR_16(wOut[0]);
     output+= 2;
@@ -1757,10 +1757,10 @@
 
 // ABGR
 static
-cmsUInt8Number* Pack4WordsSwap(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wOut[],
-                               register cmsUInt8Number* output,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* Pack4WordsSwap(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wOut[],
+                               CMSREGISTER cmsUInt8Number* output,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[3];
     output+= 2;
@@ -1779,10 +1779,10 @@
 
 // CMYK
 static
-cmsUInt8Number* Pack4WordsBigEndian(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wOut[],
-                                    register cmsUInt8Number* output,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* Pack4WordsBigEndian(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wOut[],
+                                    CMSREGISTER cmsUInt8Number* output,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = CHANGE_ENDIAN(wOut[0]);
     output+= 2;
@@ -1801,10 +1801,10 @@
 
 
 static
-cmsUInt8Number* PackLabV2_8(register _cmsTRANSFORM* info,
-                            register cmsUInt16Number wOut[],
-                            register cmsUInt8Number* output,
-                            register cmsUInt32Number Stride)
+cmsUInt8Number* PackLabV2_8(CMSREGISTER _cmsTRANSFORM* info,
+                            CMSREGISTER cmsUInt16Number wOut[],
+                            CMSREGISTER cmsUInt8Number* output,
+                            CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(FomLabV4ToLabV2(wOut[0]));
     *output++ = FROM_16_TO_8(FomLabV4ToLabV2(wOut[1]));
@@ -1817,10 +1817,10 @@
 }
 
 static
-cmsUInt8Number* PackALabV2_8(register _cmsTRANSFORM* info,
-                             register cmsUInt16Number wOut[],
-                             register cmsUInt8Number* output,
-                             register cmsUInt32Number Stride)
+cmsUInt8Number* PackALabV2_8(CMSREGISTER _cmsTRANSFORM* info,
+                             CMSREGISTER cmsUInt16Number wOut[],
+                             CMSREGISTER cmsUInt8Number* output,
+                             CMSREGISTER cmsUInt32Number Stride)
 {
     output++;
     *output++ = FROM_16_TO_8(FomLabV4ToLabV2(wOut[0]));
@@ -1834,10 +1834,10 @@
 }
 
 static
-cmsUInt8Number* PackLabV2_16(register _cmsTRANSFORM* info,
-                             register cmsUInt16Number wOut[],
-                             register cmsUInt8Number* output,
-                             register cmsUInt32Number Stride)
+cmsUInt8Number* PackLabV2_16(CMSREGISTER _cmsTRANSFORM* info,
+                             CMSREGISTER cmsUInt16Number wOut[],
+                             CMSREGISTER cmsUInt8Number* output,
+                             CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = FomLabV4ToLabV2(wOut[0]);
     output += 2;
@@ -1853,10 +1853,10 @@
 }
 
 static
-cmsUInt8Number* Pack3Bytes(register _cmsTRANSFORM* info,
-                           register cmsUInt16Number wOut[],
-                           register cmsUInt8Number* output,
-                           register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3Bytes(CMSREGISTER _cmsTRANSFORM* info,
+                           CMSREGISTER cmsUInt16Number wOut[],
+                           CMSREGISTER cmsUInt8Number* output,
+                           CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[0]);
     *output++ = FROM_16_TO_8(wOut[1]);
@@ -1869,10 +1869,10 @@
 }
 
 static
-cmsUInt8Number* Pack3BytesOptimized(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wOut[],
-                                    register cmsUInt8Number* output,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesOptimized(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wOut[],
+                                    CMSREGISTER cmsUInt8Number* output,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = (wOut[0] & 0xFFU);
     *output++ = (wOut[1] & 0xFFU);
@@ -1885,10 +1885,10 @@
 }
 
 static
-cmsUInt8Number* Pack3BytesSwap(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wOut[],
-                               register cmsUInt8Number* output,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesSwap(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wOut[],
+                               CMSREGISTER cmsUInt8Number* output,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[2]);
     *output++ = FROM_16_TO_8(wOut[1]);
@@ -1901,10 +1901,10 @@
 }
 
 static
-cmsUInt8Number* Pack3BytesSwapOptimized(register _cmsTRANSFORM* info,
-                                        register cmsUInt16Number wOut[],
-                                        register cmsUInt8Number* output,
-                                        register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesSwapOptimized(CMSREGISTER _cmsTRANSFORM* info,
+                                        CMSREGISTER cmsUInt16Number wOut[],
+                                        CMSREGISTER cmsUInt8Number* output,
+                                        CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = (wOut[2] & 0xFFU);
     *output++ = (wOut[1] & 0xFFU);
@@ -1918,10 +1918,10 @@
 
 
 static
-cmsUInt8Number* Pack3Words(register _cmsTRANSFORM* info,
-                           register cmsUInt16Number wOut[],
-                           register cmsUInt8Number* output,
-                           register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3Words(CMSREGISTER _cmsTRANSFORM* info,
+                           CMSREGISTER cmsUInt16Number wOut[],
+                           CMSREGISTER cmsUInt8Number* output,
+                           CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[0];
     output+= 2;
@@ -1937,10 +1937,10 @@
 }
 
 static
-cmsUInt8Number* Pack3WordsSwap(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wOut[],
-                               register cmsUInt8Number* output,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3WordsSwap(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wOut[],
+                               CMSREGISTER cmsUInt8Number* output,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[2];
     output+= 2;
@@ -1956,10 +1956,10 @@
 }
 
 static
-cmsUInt8Number* Pack3WordsBigEndian(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wOut[],
-                                    register cmsUInt8Number* output,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3WordsBigEndian(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wOut[],
+                                    CMSREGISTER cmsUInt8Number* output,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = CHANGE_ENDIAN(wOut[0]);
     output+= 2;
@@ -1975,10 +1975,10 @@
 }
 
 static
-cmsUInt8Number* Pack3BytesAndSkip1(register _cmsTRANSFORM* info,
-                                   register cmsUInt16Number wOut[],
-                                   register cmsUInt8Number* output,
-                                   register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesAndSkip1(CMSREGISTER _cmsTRANSFORM* info,
+                                   CMSREGISTER cmsUInt16Number wOut[],
+                                   CMSREGISTER cmsUInt8Number* output,
+                                   CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[0]);
     *output++ = FROM_16_TO_8(wOut[1]);
@@ -1992,10 +1992,10 @@
 }
 
 static
-cmsUInt8Number* Pack3BytesAndSkip1Optimized(register _cmsTRANSFORM* info,
-                                            register cmsUInt16Number wOut[],
-                                            register cmsUInt8Number* output,
-                                            register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesAndSkip1Optimized(CMSREGISTER _cmsTRANSFORM* info,
+                                            CMSREGISTER cmsUInt16Number wOut[],
+                                            CMSREGISTER cmsUInt8Number* output,
+                                            CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = (wOut[0] & 0xFFU);
     *output++ = (wOut[1] & 0xFFU);
@@ -2010,10 +2010,10 @@
 
 
 static
-cmsUInt8Number* Pack3BytesAndSkip1SwapFirst(register _cmsTRANSFORM* info,
-                                            register cmsUInt16Number wOut[],
-                                            register cmsUInt8Number* output,
-                                            register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesAndSkip1SwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                            CMSREGISTER cmsUInt16Number wOut[],
+                                            CMSREGISTER cmsUInt8Number* output,
+                                            CMSREGISTER cmsUInt32Number Stride)
 {
     output++;
     *output++ = FROM_16_TO_8(wOut[0]);
@@ -2027,10 +2027,10 @@
 }
 
 static
-cmsUInt8Number* Pack3BytesAndSkip1SwapFirstOptimized(register _cmsTRANSFORM* info,
-                                                     register cmsUInt16Number wOut[],
-                                                     register cmsUInt8Number* output,
-                                                     register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesAndSkip1SwapFirstOptimized(CMSREGISTER _cmsTRANSFORM* info,
+                                                     CMSREGISTER cmsUInt16Number wOut[],
+                                                     CMSREGISTER cmsUInt8Number* output,
+                                                     CMSREGISTER cmsUInt32Number Stride)
 {
     output++;
     *output++ = (wOut[0] & 0xFFU);
@@ -2044,10 +2044,10 @@
 }
 
 static
-cmsUInt8Number* Pack3BytesAndSkip1Swap(register _cmsTRANSFORM* info,
-                                       register cmsUInt16Number wOut[],
-                                       register cmsUInt8Number* output,
-                                       register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesAndSkip1Swap(CMSREGISTER _cmsTRANSFORM* info,
+                                       CMSREGISTER cmsUInt16Number wOut[],
+                                       CMSREGISTER cmsUInt8Number* output,
+                                       CMSREGISTER cmsUInt32Number Stride)
 {
     output++;
     *output++ = FROM_16_TO_8(wOut[2]);
@@ -2061,10 +2061,10 @@
 }
 
 static
-cmsUInt8Number* Pack3BytesAndSkip1SwapOptimized(register _cmsTRANSFORM* info,
-                                                register cmsUInt16Number wOut[],
-                                                register cmsUInt8Number* output,
-                                                register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesAndSkip1SwapOptimized(CMSREGISTER _cmsTRANSFORM* info,
+                                                CMSREGISTER cmsUInt16Number wOut[],
+                                                CMSREGISTER cmsUInt8Number* output,
+                                                CMSREGISTER cmsUInt32Number Stride)
 {
     output++;
     *output++ = (wOut[2] & 0xFFU);
@@ -2079,10 +2079,10 @@
 
 
 static
-cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirst(register _cmsTRANSFORM* info,
-                                                register cmsUInt16Number wOut[],
-                                                register cmsUInt8Number* output,
-                                                register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                                CMSREGISTER cmsUInt16Number wOut[],
+                                                CMSREGISTER cmsUInt8Number* output,
+                                                CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[2]);
     *output++ = FROM_16_TO_8(wOut[1]);
@@ -2096,10 +2096,10 @@
 }
 
 static
-cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirstOptimized(register _cmsTRANSFORM* info,
-                                                         register cmsUInt16Number wOut[],
-                                                         register cmsUInt8Number* output,
-                                                         register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3BytesAndSkip1SwapSwapFirstOptimized(CMSREGISTER _cmsTRANSFORM* info,
+                                                         CMSREGISTER cmsUInt16Number wOut[],
+                                                         CMSREGISTER cmsUInt8Number* output,
+                                                         CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = (wOut[2] & 0xFFU);
     *output++ = (wOut[1] & 0xFFU);
@@ -2113,10 +2113,10 @@
 }
 
 static
-cmsUInt8Number* Pack3WordsAndSkip1(register _cmsTRANSFORM* info,
-                                   register cmsUInt16Number wOut[],
-                                   register cmsUInt8Number* output,
-                                   register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3WordsAndSkip1(CMSREGISTER _cmsTRANSFORM* info,
+                                   CMSREGISTER cmsUInt16Number wOut[],
+                                   CMSREGISTER cmsUInt8Number* output,
+                                   CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[0];
     output+= 2;
@@ -2133,10 +2133,10 @@
 }
 
 static
-cmsUInt8Number* Pack3WordsAndSkip1Swap(register _cmsTRANSFORM* info,
-                                       register cmsUInt16Number wOut[],
-                                       register cmsUInt8Number* output,
-                                       register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3WordsAndSkip1Swap(CMSREGISTER _cmsTRANSFORM* info,
+                                       CMSREGISTER cmsUInt16Number wOut[],
+                                       CMSREGISTER cmsUInt8Number* output,
+                                       CMSREGISTER cmsUInt32Number Stride)
 {
     output+= 2;
     *(cmsUInt16Number*) output = wOut[2];
@@ -2154,10 +2154,10 @@
 
 
 static
-cmsUInt8Number* Pack3WordsAndSkip1SwapFirst(register _cmsTRANSFORM* info,
-                                            register cmsUInt16Number wOut[],
-                                            register cmsUInt8Number* output,
-                                            register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3WordsAndSkip1SwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                            CMSREGISTER cmsUInt16Number wOut[],
+                                            CMSREGISTER cmsUInt8Number* output,
+                                            CMSREGISTER cmsUInt32Number Stride)
 {
     output+= 2;
     *(cmsUInt16Number*) output = wOut[0];
@@ -2175,10 +2175,10 @@
 
 
 static
-cmsUInt8Number* Pack3WordsAndSkip1SwapSwapFirst(register _cmsTRANSFORM* info,
-                                                register cmsUInt16Number wOut[],
-                                                register cmsUInt8Number* output,
-                                                register cmsUInt32Number Stride)
+cmsUInt8Number* Pack3WordsAndSkip1SwapSwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                                CMSREGISTER cmsUInt16Number wOut[],
+                                                CMSREGISTER cmsUInt8Number* output,
+                                                CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[2];
     output+= 2;
@@ -2197,10 +2197,10 @@
 
 
 static
-cmsUInt8Number* Pack1Byte(register _cmsTRANSFORM* info,
-                          register cmsUInt16Number wOut[],
-                          register cmsUInt8Number* output,
-                          register cmsUInt32Number Stride)
+cmsUInt8Number* Pack1Byte(CMSREGISTER _cmsTRANSFORM* info,
+                          CMSREGISTER cmsUInt16Number wOut[],
+                          CMSREGISTER cmsUInt8Number* output,
+                          CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[0]);
 
@@ -2212,10 +2212,10 @@
 
 
 static
-cmsUInt8Number* Pack1ByteReversed(register _cmsTRANSFORM* info,
-                                  register cmsUInt16Number wOut[],
-                                  register cmsUInt8Number* output,
-                                  register cmsUInt32Number Stride)
+cmsUInt8Number* Pack1ByteReversed(CMSREGISTER _cmsTRANSFORM* info,
+                                  CMSREGISTER cmsUInt16Number wOut[],
+                                  CMSREGISTER cmsUInt8Number* output,
+                                  CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(REVERSE_FLAVOR_16(wOut[0]));
 
@@ -2227,10 +2227,10 @@
 
 
 static
-cmsUInt8Number* Pack1ByteSkip1(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wOut[],
-                               register cmsUInt8Number* output,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* Pack1ByteSkip1(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wOut[],
+                               CMSREGISTER cmsUInt8Number* output,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     *output++ = FROM_16_TO_8(wOut[0]);
     output++;
@@ -2243,10 +2243,10 @@
 
 
 static
-cmsUInt8Number* Pack1ByteSkip1SwapFirst(register _cmsTRANSFORM* info,
-                                        register cmsUInt16Number wOut[],
-                                        register cmsUInt8Number* output,
-                                        register cmsUInt32Number Stride)
+cmsUInt8Number* Pack1ByteSkip1SwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                        CMSREGISTER cmsUInt16Number wOut[],
+                                        CMSREGISTER cmsUInt8Number* output,
+                                        CMSREGISTER cmsUInt32Number Stride)
 {
     output++;
     *output++ = FROM_16_TO_8(wOut[0]);
@@ -2258,10 +2258,10 @@
 }
 
 static
-cmsUInt8Number* Pack1Word(register _cmsTRANSFORM* info,
-                          register cmsUInt16Number wOut[],
-                          register cmsUInt8Number* output,
-                          register cmsUInt32Number Stride)
+cmsUInt8Number* Pack1Word(CMSREGISTER _cmsTRANSFORM* info,
+                          CMSREGISTER cmsUInt16Number wOut[],
+                          CMSREGISTER cmsUInt8Number* output,
+                          CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[0];
     output+= 2;
@@ -2274,10 +2274,10 @@
 
 
 static
-cmsUInt8Number* Pack1WordReversed(register _cmsTRANSFORM* info,
-                                  register cmsUInt16Number wOut[],
-                                  register cmsUInt8Number* output,
-                                  register cmsUInt32Number Stride)
+cmsUInt8Number* Pack1WordReversed(CMSREGISTER _cmsTRANSFORM* info,
+                                  CMSREGISTER cmsUInt16Number wOut[],
+                                  CMSREGISTER cmsUInt8Number* output,
+                                  CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = REVERSE_FLAVOR_16(wOut[0]);
     output+= 2;
@@ -2289,10 +2289,10 @@
 }
 
 static
-cmsUInt8Number* Pack1WordBigEndian(register _cmsTRANSFORM* info,
-                                   register cmsUInt16Number wOut[],
-                                   register cmsUInt8Number* output,
-                                   register cmsUInt32Number Stride)
+cmsUInt8Number* Pack1WordBigEndian(CMSREGISTER _cmsTRANSFORM* info,
+                                   CMSREGISTER cmsUInt16Number wOut[],
+                                   CMSREGISTER cmsUInt8Number* output,
+                                   CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = CHANGE_ENDIAN(wOut[0]);
     output+= 2;
@@ -2305,10 +2305,10 @@
 
 
 static
-cmsUInt8Number* Pack1WordSkip1(register _cmsTRANSFORM* info,
-                               register cmsUInt16Number wOut[],
-                               register cmsUInt8Number* output,
-                               register cmsUInt32Number Stride)
+cmsUInt8Number* Pack1WordSkip1(CMSREGISTER _cmsTRANSFORM* info,
+                               CMSREGISTER cmsUInt16Number wOut[],
+                               CMSREGISTER cmsUInt8Number* output,
+                               CMSREGISTER cmsUInt32Number Stride)
 {
     *(cmsUInt16Number*) output = wOut[0];
     output+= 4;
@@ -2320,10 +2320,10 @@
 }
 
 static
-cmsUInt8Number* Pack1WordSkip1SwapFirst(register _cmsTRANSFORM* info,
-                                        register cmsUInt16Number wOut[],
-                                        register cmsUInt8Number* output,
-                                        register cmsUInt32Number Stride)
+cmsUInt8Number* Pack1WordSkip1SwapFirst(CMSREGISTER _cmsTRANSFORM* info,
+                                        CMSREGISTER cmsUInt16Number wOut[],
+                                        CMSREGISTER cmsUInt8Number* output,
+                                        CMSREGISTER cmsUInt32Number Stride)
 {
     output += 2;
     *(cmsUInt16Number*) output = wOut[0];
@@ -2338,10 +2338,10 @@
 
 // Unencoded Float values -- don't try optimize speed
 static
-cmsUInt8Number* PackLabDoubleFrom16(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wOut[],
-                                    register cmsUInt8Number* output,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* PackLabDoubleFrom16(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wOut[],
+                                    CMSREGISTER cmsUInt8Number* output,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
 
     if (T_PLANAR(info -> OutputFormat)) {
@@ -2365,10 +2365,10 @@
 
 
 static
-cmsUInt8Number* PackLabFloatFrom16(register _cmsTRANSFORM* info,
-                                    register cmsUInt16Number wOut[],
-                                    register cmsUInt8Number* output,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* PackLabFloatFrom16(CMSREGISTER _cmsTRANSFORM* info,
+                                    CMSREGISTER cmsUInt16Number wOut[],
+                                    CMSREGISTER cmsUInt8Number* output,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     cmsCIELab  Lab;
     cmsLabEncoded2Float(&Lab, wOut);
@@ -2396,10 +2396,10 @@
 }
 
 static
-cmsUInt8Number* PackXYZDoubleFrom16(register _cmsTRANSFORM* Info,
-                                    register cmsUInt16Number wOut[],
-                                    register cmsUInt8Number* output,
-                                    register cmsUInt32Number Stride)
+cmsUInt8Number* PackXYZDoubleFrom16(CMSREGISTER _cmsTRANSFORM* Info,
+                                    CMSREGISTER cmsUInt16Number wOut[],
+                                    CMSREGISTER cmsUInt8Number* output,
+                                    CMSREGISTER cmsUInt32Number Stride)
 {
     if (T_PLANAR(Info -> OutputFormat)) {
 
@@ -2425,10 +2425,10 @@
 }
 
 static
-cmsUInt8Number* PackXYZFloatFrom16(register _cmsTRANSFORM* Info,
-                                   register cmsUInt16Number wOut[],
-                                   register cmsUInt8Number* output,
-                                   register cmsUInt32Number Stride)
+cmsUInt8Number* PackXYZFloatFrom16(CMSREGISTER _cmsTRANSFORM* Info,
+                                   CMSREGISTER cmsUInt16Number wOut[],
+                                   CMSREGISTER cmsUInt8Number* output,
+                                   CMSREGISTER cmsUInt32Number Stride)
 {
     if (T_PLANAR(Info -> OutputFormat)) {
 
@@ -2460,10 +2460,10 @@
 }
 
 static
-cmsUInt8Number* PackDoubleFrom16(register _cmsTRANSFORM* info,
-                                register cmsUInt16Number wOut[],
-                                register cmsUInt8Number* output,
-                                register cmsUInt32Number Stride)
+cmsUInt8Number* PackDoubleFrom16(CMSREGISTER _cmsTRANSFORM* info,
+                                CMSREGISTER cmsUInt16Number wOut[],
+                                CMSREGISTER cmsUInt8Number* output,
+                                CMSREGISTER cmsUInt32Number Stride)
 {
     cmsUInt32Number nChan      = T_CHANNELS(info -> OutputFormat);
     cmsUInt32Number DoSwap     = T_DOSWAP(info ->OutputFormat);
@@ -2513,10 +2513,10 @@
 
 
 static
-cmsUInt8Number* PackFloatFrom16(register _cmsTRANSFORM* info,
-                                register cmsUInt16Number wOut[],
-                                register cmsUInt8Number* output,
-                                register cmsUInt32Number Stride)
+cmsUInt8Number* PackFloatFrom16(CMSREGISTER _cmsTRANSFORM* info,
+                                CMSREGISTER cmsUInt16Number wOut[],
+                                CMSREGISTER cmsUInt8Number* output,
+                                CMSREGISTER cmsUInt32Number Stride)
 {
        cmsUInt32Number nChan      = T_CHANNELS(info->OutputFormat);
        cmsUInt32Number DoSwap     = T_DOSWAP(info->OutputFormat);
@@ -2802,10 +2802,10 @@
 // Decodes an stream of half floats to wIn[] described by input format
 
 static
-cmsUInt8Number* UnrollHalfTo16(register _cmsTRANSFORM* info,
-                                register cmsUInt16Number wIn[],
-                                register cmsUInt8Number* accum,
-                                register cmsUInt32Number Stride)
+cmsUInt8Number* UnrollHalfTo16(CMSREGISTER _cmsTRANSFORM* info,
+                                CMSREGISTER cmsUInt16Number wIn[],
+                                CMSREGISTER cmsUInt8Number* accum,
+                                CMSREGISTER cmsUInt32Number Stride)
 {
 
     cmsUInt32Number nChan      = T_CHANNELS(info -> InputFormat);
@@ -2908,10 +2908,10 @@
 
 
 static
-cmsUInt8Number* PackHalfFrom16(register _cmsTRANSFORM* info,
-                                register cmsUInt16Number wOut[],
-                                register cmsUInt8Number* output,
-                                register cmsUInt32Number Stride)
+cmsUInt8Number* PackHalfFrom16(CMSREGISTER _cmsTRANSFORM* info,
+                                CMSREGISTER cmsUInt16Number wOut[],
+                                CMSREGISTER cmsUInt8Number* output,
+                                CMSREGISTER cmsUInt32Number Stride)
 {
        cmsUInt32Number nChan      = T_CHANNELS(info->OutputFormat);
        cmsUInt32Number DoSwap     = T_DOSWAP(info->OutputFormat);
--- a/src/share/native/sun/java2d/cmm/lcms/cmspcs.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmspcs.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
--- a/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsplugin.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -62,7 +62,7 @@
 
 //      Little-Endian to Big-Endian
 
-// Adjust a word value after being readed/ before being written from/to an ICC profile
+// Adjust a word value after being read/ before being written from/to an ICC profile
 cmsUInt16Number CMSEXPORT  _cmsAdjustEndianess16(cmsUInt16Number Word)
 {
 #ifndef CMS_USE_BIG_ENDIAN
@@ -128,8 +128,8 @@
     _cmsAssert(Result != NULL);
 
 #  ifdef CMS_DONT_USE_INT64
-    (*Result)[0] = QWord[0];
-    (*Result)[1] = QWord[1];
+    (*Result)[0] = (*QWord)[0];
+    (*Result)[1] = (*QWord)[1];
 #  else
     *Result = *QWord;
 #  endif
@@ -216,6 +216,8 @@
            return TRUE;
         #elif defined (__BORLANDC__)
            return TRUE;
+        #elif !defined(_MSC_VER) && (defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L)
+           return TRUE;
         #else
 
            // fpclassify() required by C99 (only provided by MSVC >= 1800, VS2013 onwards)
@@ -702,15 +704,21 @@
         return &globalContext;
 
     // Search
+    _cmsEnterCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
+
     for (ctx = _cmsContextPoolHead;
          ctx != NULL;
          ctx = ctx ->Next) {
 
             // Found it?
-            if (id == ctx)
-                return ctx; // New-style context,
+        if (id == ctx)
+        {
+            _cmsLeaveCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
+            return ctx; // New-style context
+        }
     }
 
+    _cmsLeaveCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
     return &globalContext;
 }
 
@@ -799,6 +807,7 @@
 
     // See the comments regarding locking in lcms2_internal.h
     // for an explanation of why we need the following code.
+#ifndef CMS_NO_PTHREADS
 #ifdef CMS_IS_WINDOWS_
 #ifndef CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT
     {
@@ -820,6 +829,7 @@
     }
 #endif
 #endif
+#endif
 
     _cmsInstallAllocFunctions(_cmsFindMemoryPlugin(Plugin), &fakeContext.DefaultMemoryManager);
 
@@ -943,25 +953,6 @@
 }
 
 
-/*
-static
-struct _cmsContext_struct* FindPrev(struct _cmsContext_struct* id)
-{
-    struct _cmsContext_struct* prev;
-
-    // Search for previous
-    for (prev = _cmsContextPoolHead;
-             prev != NULL;
-             prev = prev ->Next)
-    {
-        if (prev ->Next == id)
-            return prev;
-    }
-
-    return NULL;  // List is empty or only one element!
-}
-*/
-
 // Frees any resources associated with the given context,
 // and destroys the context placeholder.
 // The ContextID can no longer be used in any THR operation.
--- a/src/share/native/sun/java2d/cmm/lcms/cmsps2.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsps2.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -107,8 +107,8 @@
    Matrix-shaper based
    -------------------
 
-   This is implemented both with /CIEBasedABC or /CIEBasedDEF on dependig
-   of profile implementation. Since here there are no interpolation tables, I do
+   This is implemented both with /CIEBasedABC or /CIEBasedDEF depending on the
+   profile implementation. Since here there are no interpolation tables, I do
    the conversion directly to XYZ
 
 
@@ -324,21 +324,7 @@
 }
 
 
-// Convert to byte (using ICC2 notation)
-/*
-static
-cmsUInt8Number L2Byte(cmsUInt16Number w)
-{
-    int ww = w + 0x0080;
-
-    if (ww > 0xFFFF) return 0xFF;
-
-    return (cmsUInt8Number) ((cmsUInt16Number) (ww >> 8) & 0xFF);
-}
-*/
-
 // Write a cooked byte
-
 static
 void WriteByte(cmsIOHANDLER* m, cmsUInt8Number b)
 {
@@ -355,7 +341,8 @@
 // ----------------------------------------------------------------- PostScript generation
 
 
-// Removes offending Carriage returns
+// Removes offending carriage returns
+
 static
 char* RemoveCR(const char* txt)
 {
@@ -453,21 +440,6 @@
 //        = Yn*( L* / 116) / 7.787      if (L*) < 6 / 29
 //
 
-/*
-static
-void EmitL2Y(cmsIOHANDLER* m)
-{
-    _cmsIOPrintf(m,
-            "{ "
-                "100 mul 16 add 116 div "               // (L * 100 + 16) / 116
-                 "dup 6 29 div ge "                     // >= 6 / 29 ?
-                 "{ dup dup mul mul } "                 // yes, ^3 and done
-                 "{ 4 29 div sub 108 841 div mul } "    // no, slope limiting
-            "ifelse } bind ");
-}
-*/
-
-
 // Lab -> XYZ, see the discussion above
 
 static
@@ -488,12 +460,28 @@
     _cmsIOPrintf(m, "]\n");
 }
 
+static
+void EmitSafeGuardBegin(cmsIOHANDLER* m, const char* name)
+{
+    _cmsIOPrintf(m, "%%LCMS2: Save previous definition of %s on the operand stack\n", name);
+    _cmsIOPrintf(m, "currentdict /%s known { /%s load } { null } ifelse\n", name, name);
+}
 
+static
+void EmitSafeGuardEnd(cmsIOHANDLER* m, const char* name, int depth)
+{
+    _cmsIOPrintf(m, "%%LCMS2: Restore previous definition of %s\n", name);
+    if (depth > 1) {
+        // cycle topmost items on the stack to bring the previous definition to the front
+        _cmsIOPrintf(m, "%d -1 roll ", depth);
+    }
+    _cmsIOPrintf(m, "dup null eq { pop currentdict /%s undef } { /%s exch def } ifelse\n", name, name);
+}
 
 // Outputs a table of words. It does use 16 bits
 
 static
-void Emit1Gamma(cmsIOHANDLER* m, cmsToneCurve* Table)
+void Emit1Gamma(cmsIOHANDLER* m, cmsToneCurve* Table, const char* name)
 {
     cmsUInt32Number i;
     cmsFloat64Number gamma;
@@ -508,28 +496,33 @@
     // Check if is really an exponential. If so, emit "exp"
     gamma = cmsEstimateGamma(Table, 0.001);
      if (gamma > 0) {
-            _cmsIOPrintf(m, "{ %g exp } bind ", gamma);
+            _cmsIOPrintf(m, "/%s { %g exp } bind def\n", name, gamma);
             return;
      }
 
-    _cmsIOPrintf(m, "{ ");
+    EmitSafeGuardBegin(m, "lcms2gammatable");
+    _cmsIOPrintf(m, "/lcms2gammatable [");
+
+    for (i=0; i < Table->nEntries; i++) {
+        if (i % 10 == 0)
+            _cmsIOPrintf(m, "\n  ");
+        _cmsIOPrintf(m, "%d ", Table->Table16[i]);
+    }
+
+    _cmsIOPrintf(m, "] def\n");
+
+
+    // Emit interpolation code
+
+    // PostScript code                            Stack
+    // ===============                            ========================
+                                                  // v
+    _cmsIOPrintf(m, "/%s {\n  ", name);
 
     // Bounds check
     EmitRangeCheck(m);
 
-    // Emit intepolation code
-
-    // PostScript code                      Stack
-    // ===============                      ========================
-                                            // v
-    _cmsIOPrintf(m, " [");
-
-    for (i=0; i < Table->nEntries; i++) {
-        _cmsIOPrintf(m, "%d ", Table->Table16[i]);
-    }
-
-    _cmsIOPrintf(m, "] ");                        // v tab
-
+    _cmsIOPrintf(m, "\n  //lcms2gammatable ");    // v tab
     _cmsIOPrintf(m, "dup ");                      // v tab tab
     _cmsIOPrintf(m, "length 1 sub ");             // v tab dom
     _cmsIOPrintf(m, "3 -1 roll ");                // tab dom v
@@ -541,7 +534,7 @@
     _cmsIOPrintf(m, "ceiling cvi ");              // tab val2 cell0 cell1
     _cmsIOPrintf(m, "3 index ");                  // tab val2 cell0 cell1 tab
     _cmsIOPrintf(m, "exch ");                     // tab val2 cell0 tab cell1
-    _cmsIOPrintf(m, "get ");                      // tab val2 cell0 y1
+    _cmsIOPrintf(m, "get\n  ");                   // tab val2 cell0 y1
     _cmsIOPrintf(m, "4 -1 roll ");                // val2 cell0 y1 tab
     _cmsIOPrintf(m, "3 -1 roll ");                // val2 y1 tab cell0
     _cmsIOPrintf(m, "get ");                      // val2 y1 y0
@@ -554,9 +547,11 @@
     _cmsIOPrintf(m, "sub ");                      // y0 (y1-y0) rest
     _cmsIOPrintf(m, "mul ");                      // y0 t1
     _cmsIOPrintf(m, "add ");                      // y
-    _cmsIOPrintf(m, "65535 div ");                // result
+    _cmsIOPrintf(m, "65535 div\n");               // result
 
-    _cmsIOPrintf(m, " } bind ");
+    _cmsIOPrintf(m, "} bind def\n");
+
+    EmitSafeGuardEnd(m, "lcms2gammatable", 1);
 }
 
 
@@ -572,9 +567,10 @@
 // Does write a set of gamma curves
 
 static
-void EmitNGamma(cmsIOHANDLER* m, cmsUInt32Number n, cmsToneCurve* g[])
+void EmitNGamma(cmsIOHANDLER* m, cmsUInt32Number n, cmsToneCurve* g[], const char* nameprefix)
 {
     cmsUInt32Number i;
+    static char buffer[2048];
 
     for( i=0; i < n; i++ )
     {
@@ -582,19 +578,18 @@
 
         if (i > 0 && GammaTableEquals(g[i-1]->Table16, g[i]->Table16, g[i]->nEntries)) {
 
-            _cmsIOPrintf(m, "dup ");
+            _cmsIOPrintf(m, "/%s%d /%s%d load def\n", nameprefix, i, nameprefix, i-1);
         }
         else {
-            Emit1Gamma(m, g[i]);
+            snprintf(buffer, sizeof(buffer), "%s%d", nameprefix, i);
+            buffer[sizeof(buffer)-1] = '\0';
+            Emit1Gamma(m, g[i], buffer);
         }
     }
 
 }
 
 
-
-
-
 // Following code dumps a LUT onto memory stream
 
 
@@ -611,7 +606,7 @@
 //  component. -1 is used to mark beginning of whole block.
 
 static
-int OutputValueSampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
+int OutputValueSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo)
 {
     cmsPsSamplerCargo* sc = (cmsPsSamplerCargo*) Cargo;
     cmsUInt32Number i;
@@ -691,11 +686,11 @@
 
 static
 void WriteCLUT(cmsIOHANDLER* m, cmsStage* mpe, const char* PreMaj,
-                                             const char* PostMaj,
-                                             const char* PreMin,
-                                             const char* PostMin,
-                                             int FixWhite,
-                                             cmsColorSpaceSignature ColorSpace)
+                                               const char* PostMaj,
+                                               const char* PreMin,
+                                               const char* PostMin,
+                                               int FixWhite,
+                                               cmsColorSpaceSignature ColorSpace)
 {
     cmsUInt32Number i;
     cmsPsSamplerCargo sc;
@@ -737,11 +732,11 @@
     _cmsIOPrintf(m, "[ /CIEBasedA\n");
     _cmsIOPrintf(m, "  <<\n");
 
-    _cmsIOPrintf(m, "/DecodeA ");
+    EmitSafeGuardBegin(m, "lcms2gammaproc");
+    Emit1Gamma(m, Curve, "lcms2gammaproc");
 
-    Emit1Gamma(m, Curve);
-
-    _cmsIOPrintf(m, " \n");
+    _cmsIOPrintf(m, "/DecodeA /lcms2gammaproc load\n");
+    EmitSafeGuardEnd(m, "lcms2gammaproc", 3);
 
     _cmsIOPrintf(m, "/MatrixA [ 0.9642 1.0000 0.8249 ]\n");
     _cmsIOPrintf(m, "/RangeLMN [ 0.0 0.9642 0.0 1.0000 0.0 0.8249 ]\n");
@@ -765,11 +760,19 @@
 
     _cmsIOPrintf(m, "[ /CIEBasedABC\n");
     _cmsIOPrintf(m, "<<\n");
-    _cmsIOPrintf(m, "/DecodeABC [ ");
 
-    EmitNGamma(m, 3, CurveSet);
-
+    EmitSafeGuardBegin(m, "lcms2gammaproc0");
+    EmitSafeGuardBegin(m, "lcms2gammaproc1");
+    EmitSafeGuardBegin(m, "lcms2gammaproc2");
+    EmitNGamma(m, 3, CurveSet, "lcms2gammaproc");
+    _cmsIOPrintf(m, "/DecodeABC [\n");
+    _cmsIOPrintf(m, "   /lcms2gammaproc0 load\n");
+    _cmsIOPrintf(m, "   /lcms2gammaproc1 load\n");
+    _cmsIOPrintf(m, "   /lcms2gammaproc2 load\n");
     _cmsIOPrintf(m, "]\n");
+    EmitSafeGuardEnd(m, "lcms2gammaproc2", 3);
+    EmitSafeGuardEnd(m, "lcms2gammaproc1", 3);
+    EmitSafeGuardEnd(m, "lcms2gammaproc0", 3);
 
     _cmsIOPrintf(m, "/MatrixABC [ " );
 
@@ -801,28 +804,31 @@
 {
     const char* PreMaj;
     const char* PostMaj;
-    const char* PreMin, *PostMin;
+    const char* PreMin, * PostMin;
     cmsStage* mpe;
+    int i, numchans;
+    static char buffer[2048];
 
-    mpe = Pipeline ->Elements;
+    mpe = Pipeline->Elements;
 
     switch (cmsStageInputChannels(mpe)) {
     case 3:
+        _cmsIOPrintf(m, "[ /CIEBasedDEF\n");
+        PreMaj = "<";
+        PostMaj = ">\n";
+        PreMin = PostMin = "";
+        break;
 
-            _cmsIOPrintf(m, "[ /CIEBasedDEF\n");
-            PreMaj ="<";
-            PostMaj= ">\n";
-            PreMin = PostMin = "";
-            break;
     case 4:
-            _cmsIOPrintf(m, "[ /CIEBasedDEFG\n");
-            PreMaj = "[";
-            PostMaj = "]\n";
-            PreMin = "<";
-            PostMin = ">\n";
-            break;
+        _cmsIOPrintf(m, "[ /CIEBasedDEFG\n");
+        PreMaj = "[";
+        PostMaj = "]\n";
+        PreMin = "<";
+        PostMin = ">\n";
+        break;
+
     default:
-            return 0;
+        return 0;
 
     }
 
@@ -830,18 +836,34 @@
 
     if (cmsStageType(mpe) == cmsSigCurveSetElemType) {
 
-        _cmsIOPrintf(m, "/DecodeDEF [ ");
-        EmitNGamma(m, cmsStageOutputChannels(mpe), _cmsStageGetPtrToCurveSet(mpe));
+        numchans = cmsStageOutputChannels(mpe);
+        for (i = 0; i < numchans; ++i) {
+            snprintf(buffer, sizeof(buffer), "lcms2gammaproc%d", i);
+            buffer[sizeof(buffer) - 1] = '\0';
+            EmitSafeGuardBegin(m, buffer);
+        }
+        EmitNGamma(m, cmsStageOutputChannels(mpe), _cmsStageGetPtrToCurveSet(mpe), "lcms2gammaproc");
+        _cmsIOPrintf(m, "/DecodeDEF [\n");
+        for (i = 0; i < numchans; ++i) {
+            snprintf(buffer, sizeof(buffer), "  /lcms2gammaproc%d load\n", i);
+            buffer[sizeof(buffer) - 1] = '\0';
+            _cmsIOPrintf(m, buffer);
+        }
         _cmsIOPrintf(m, "]\n");
+        for (i = numchans - 1; i >= 0; --i) {
+            snprintf(buffer, sizeof(buffer), "lcms2gammaproc%d", i);
+            buffer[sizeof(buffer) - 1] = '\0';
+            EmitSafeGuardEnd(m, buffer, 3);
+        }
 
-        mpe = mpe ->Next;
+        mpe = mpe->Next;
     }
 
     if (cmsStageType(mpe) == cmsSigCLutElemType) {
 
-            _cmsIOPrintf(m, "/Table ");
-            WriteCLUT(m, mpe, PreMaj, PostMaj, PreMin, PostMin, FALSE, (cmsColorSpaceSignature) 0);
-            _cmsIOPrintf(m, "]\n");
+        _cmsIOPrintf(m, "/Table ");
+        WriteCLUT(m, mpe, PreMaj, PostMaj, PreMin, PostMin, FALSE, (cmsColorSpaceSignature)0);
+        _cmsIOPrintf(m, "]\n");
     }
 
     EmitLab2XYZ(m);
@@ -952,7 +974,7 @@
 
     default:
 
-        cmsSignalError(m ->ContextID, cmsERROR_COLORSPACE_CHECK, "Only 3, 4 channels supported for CSA. This profile has %d channels.", nChannels);
+        cmsSignalError(m ->ContextID, cmsERROR_COLORSPACE_CHECK, "Only 3, 4 channels are supported for CSA. This profile has %d channels.", nChannels);
         return 0;
     }
 
@@ -1011,7 +1033,7 @@
             return 0;
         }
 
-        return rc;
+    return rc;
 }
 
 
@@ -1268,8 +1290,6 @@
                     "exch pop exch pop exch pop exch pop } bind\n]\n");
 
         }
-
-
 }
 
 
@@ -1299,7 +1319,7 @@
 // Due to impedance mismatch between XYZ and almost all RGB and CMYK spaces
 // I choose to dump LUTS in Lab instead of XYZ. There is still a lot of wasted
 // space on 3D CLUT, but since space seems not to be a problem here, 33 points
-// would give a reasonable accurancy. Note also that CRD tables must operate in
+// would give a reasonable accuracy. Note also that CRD tables must operate in
 // 8 bits.
 
 static
--- a/src/share/native/sun/java2d/cmm/lcms/cmssamp.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmssamp.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
--- a/src/share/native/sun/java2d/cmm/lcms/cmssm.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmssm.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
--- a/src/share/native/sun/java2d/cmm/lcms/cmstypes.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmstypes.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -195,7 +195,7 @@
                                              cmsUInt32Number SizeOfTag);
 
 // Helper function to deal with position tables as described in ICC spec 4.3
-// A table of n elements is readed, where first comes n records containing offsets and sizes and
+// A table of n elements is read, where first comes n records containing offsets and sizes and
 // then a block containing the data itself. This allows to reuse same data in more than one entry
 static
 cmsBool ReadPositionTable(struct _cms_typehandler_struct* self,
@@ -1003,7 +1003,7 @@
     len = cmsMLUgetASCII(mlu, cmsNoLanguage, cmsNoCountry, NULL, 0);
 
     // Specification ICC.1:2001-04 (v2.4.0): It has been found that textDescriptionType can contain misaligned data
-    //(see clause 4.1 for the definition of “aligned”). Because the Unicode language
+    //(see clause 4.1 for the definition of 'aligned'). Because the Unicode language
     // code and Unicode count immediately follow the ASCII description, their
     // alignment is not correct if the ASCII count is not a multiple of four. The
     // ScriptCode code is misaligned when the ASCII count is odd. Profile reading and
@@ -1509,7 +1509,7 @@
         // True begin of the string
         BeginOfThisString = Offset - SizeOfHeader - 8;
 
-        // Ajust to wchar_t elements
+        // Adjust to wchar_t elements
         mlu ->Entries[i].Len = (Len * sizeof(wchar_t)) / sizeof(cmsUInt16Number);
         mlu ->Entries[i].StrW = (BeginOfThisString * sizeof(wchar_t)) / sizeof(cmsUInt16Number);
 
@@ -1882,7 +1882,7 @@
 static
 cmsBool  Type_LUT8_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
 {
-    cmsUInt32Number j, nTabSize;
+    cmsUInt32Number j, nTabSize, i, n;
     cmsUInt8Number  val;
     cmsPipeline* NewLUT = (cmsPipeline*) Ptr;
     cmsStage* mpe;
@@ -1931,22 +1931,19 @@
     if (!_cmsWriteUInt8Number(io, (cmsUInt8Number) clutPoints)) return FALSE;
     if (!_cmsWriteUInt8Number(io, 0)) return FALSE; // Padding
 
+        n = NewLUT->InputChannels * NewLUT->OutputChannels;
 
     if (MatMPE != NULL) {
 
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[0])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[1])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[2])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[3])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[4])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[5])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[6])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[7])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[8])) return FALSE;
-
+                for (i = 0; i < n; i++)
+                {
+                        if (!_cmsWrite15Fixed16Number(io, MatMPE->Double[i])) return FALSE;
+                }
     }
     else {
 
+                if (n != 9) return FALSE;
+
         if (!_cmsWrite15Fixed16Number(io, 1)) return FALSE;
         if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE;
         if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE;
@@ -2170,7 +2167,7 @@
 // Some empty defaults are created for missing parts
 
 static
-cmsBool  Type_LUT16_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
+cmsBool Type_LUT16_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
 {
     cmsUInt32Number nTabSize;
     cmsPipeline* NewLUT = (cmsPipeline*) Ptr;
@@ -2185,6 +2182,7 @@
     if (mpe != NULL && mpe ->Type == cmsSigMatrixElemType) {
 
         MatMPE = (_cmsStageMatrixData*) mpe ->Data;
+        if (mpe->InputChannels != 3 || mpe->OutputChannels != 3) return FALSE;
         mpe = mpe -> Next;
     }
 
@@ -2223,18 +2221,13 @@
     if (!_cmsWriteUInt8Number(io, (cmsUInt8Number) clutPoints)) return FALSE;
     if (!_cmsWriteUInt8Number(io, 0)) return FALSE; // Padding
 
-
     if (MatMPE != NULL) {
 
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[0])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[1])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[2])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[3])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[4])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[5])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[6])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[7])) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, MatMPE -> Double[8])) return FALSE;
+                for (i = 0; i < 9; i++)
+                {
+                        if (!_cmsWrite15Fixed16Number(io, MatMPE->Double[i])) return FALSE;
+                }
+
     }
     else {
 
@@ -2423,7 +2416,7 @@
             return NULL;
         }
 
-        return CLUT;
+    return CLUT;
 }
 
 static
@@ -2579,31 +2572,31 @@
 static
 cmsBool  WriteMatrix(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsStage* mpe)
 {
+        cmsUInt32Number i, n;
+
     _cmsStageMatrixData* m = (_cmsStageMatrixData*) mpe -> Data;
 
-    // Write the Matrix
-    if (!_cmsWrite15Fixed16Number(io, m -> Double[0])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Double[1])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Double[2])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Double[3])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Double[4])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Double[5])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Double[6])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Double[7])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Double[8])) return FALSE;
-
-    if (m ->Offset != NULL) {
-
-    if (!_cmsWrite15Fixed16Number(io, m -> Offset[0])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Offset[1])) return FALSE;
-    if (!_cmsWrite15Fixed16Number(io, m -> Offset[2])) return FALSE;
-    }
-    else {
-        if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE;
-        if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE;
-
-    }
+        n = mpe->InputChannels * mpe->OutputChannels;
+
+        // Write the Matrix
+        for (i = 0; i < n; i++)
+        {
+                if (!_cmsWrite15Fixed16Number(io, m->Double[i])) return FALSE;
+        }
+
+        if (m->Offset != NULL) {
+
+                for (i = 0; i < mpe->OutputChannels; i++)
+                {
+                        if (!_cmsWrite15Fixed16Number(io, m->Offset[i])) return FALSE;
+                }
+        }
+        else {
+                for (i = 0; i < mpe->OutputChannels; i++)
+                {
+                        if (!_cmsWrite15Fixed16Number(io, 0)) return FALSE;
+                }
+        }
 
 
     return TRUE;
@@ -2707,9 +2700,9 @@
             return FALSE;
         }
 
-        if (!_cmsWriteAlignment(io)) return FALSE;
-
-        return TRUE;
+    if (!_cmsWriteAlignment(io)) return FALSE;
+
+    return TRUE;
 }
 
 
@@ -3120,10 +3113,10 @@
 //The namedColor2Type is a count value and array of structures that provide color
 //coordinates for 7-bit ASCII color names. For each named color, a PCS and optional
 //device representation of the color are given. Both representations are 16-bit values.
-//The device representation corresponds to the header’s “color space of data” field.
-//This representation should be consistent with the “number of device components”
+//The device representation corresponds to the header's 'color space of data' field.
+//This representation should be consistent with the 'number of device components'
 //field in the namedColor2Type. If this field is 0, device coordinates are not provided.
-//The PCS representation corresponds to the header’s PCS field. The PCS representation
+//The PCS representation corresponds to the header's PCS field. The PCS representation
 //is always provided. Color names are fixed-length, 32-byte fields including null
 //termination. In order to maintain maximum portability, it is strongly recommended
 //that special characters of the 7-bit ASCII set not be used.
@@ -3868,7 +3861,7 @@
 // ********************************************************************************
 //
 //This type represents a set of viewing condition parameters including:
-//CIE ’absolute’ illuminant white point tristimulus values and CIE ’absolute’
+//CIE 'absolute' illuminant white point tristimulus values and CIE 'absolute'
 //surround tristimulus values.
 
 static
@@ -3955,7 +3948,7 @@
 }
 
 // Each curve is stored in one or more curve segments, with break-points specified between curve segments.
-// The first curve segment always starts at –Infinity, and the last curve segment always ends at +Infinity. The
+// The first curve segment always starts at -Infinity, and the last curve segment always ends at +Infinity. The
 // first and last curve segments shall be specified in terms of a formula, whereas the other segments shall be
 // specified either in terms of a formula, or by a sampled curve.
 
@@ -4236,7 +4229,7 @@
 // The matrix is organized as an array of PxQ+Q elements, where P is the number of input channels to the
 // matrix, and Q is the number of output channels. The matrix elements are each float32Numbers. The array
 // is organized as follows:
-// array = [e11, e12, …, e1P, e21, e22, …, e2P, …, eQ1, eQ2, …, eQP, e1, e2, …, eQ]
+// array = [e11, e12, ..., e1P, e21, e22, ..., e2P, ..., eQ1, eQ2, ..., eQP, e1, e2, ..., eQ]
 
 static
 void *Type_MPEmatrix_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
@@ -4759,10 +4752,10 @@
             // Y = cX + f             | X < d
 
             // vcgt formula is:
-            // Y = (Max – Min) * (X ^ Gamma) + Min
+            // Y = (Max - Min) * (X ^ Gamma) + Min
 
             // So, the translation is
-            // a = (Max – Min) ^ ( 1 / Gamma)
+            // a = (Max - Min) ^ ( 1 / Gamma)
             // e = Min
             // b=c=d=f=0
 
--- a/src/share/native/sun/java2d/cmm/lcms/cmsvirt.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsvirt.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -390,7 +390,7 @@
 //     K: Does not change
 
 static
-int InkLimitingSampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
+int InkLimitingSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo)
 {
     cmsFloat64Number InkLimit = *(cmsFloat64Number *) Cargo;
     cmsFloat64Number SumCMY, SumCMYK, Ratio;
@@ -641,18 +641,18 @@
 
 //sRGB Curves are defined by:
 //
-//If  R’sRGB,G’sRGB, B’sRGB < 0.04045
+//If  R'sRGB,G'sRGB, B'sRGB < 0.04045
 //
-//    R =  R’sRGB / 12.92
-//    G =  G’sRGB / 12.92
-//    B =  B’sRGB / 12.92
+//    R =  R'sRGB / 12.92
+//    G =  G'sRGB / 12.92
+//    B =  B'sRGB / 12.92
 //
 //
-//else if  R’sRGB,G’sRGB, B’sRGB >= 0.04045
+//else if  R'sRGB,G'sRGB, B'sRGB >= 0.04045
 //
-//    R = ((R’sRGB + 0.055) / 1.055)^2.4
-//    G = ((G’sRGB + 0.055) / 1.055)^2.4
-//    B = ((B’sRGB + 0.055) / 1.055)^2.4
+//    R = ((R'sRGB + 0.055) / 1.055)^2.4
+//    G = ((G'sRGB + 0.055) / 1.055)^2.4
+//    B = ((B'sRGB + 0.055) / 1.055)^2.4
 
 static
 cmsToneCurve* Build_sRGBGamma(cmsContext ContextID)
@@ -715,7 +715,7 @@
 
 
 static
-int bchswSampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
+int bchswSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUInt16Number Out[], CMSREGISTER void* Cargo)
 {
     cmsCIELab LabIn, LabOut;
     cmsCIELCh LChIn, LChOut;
@@ -1125,9 +1125,10 @@
             goto Error;
     }
 
-    // On the output side too
+    // On the output side too. Note that due to V2/V4 PCS encoding on lab we cannot fix white misalignments
     if ((xform ->ExitColorSpace) == cmsSigLabData && (Version < 4.0)) {
 
+        dwFlags |= cmsFLAGS_NOWHITEONWHITEFIXUP;
         if (!cmsPipelineInsertStage(LUT, cmsAT_END, _cmsStageAllocLabV4ToV2(ContextID)))
             goto Error;
     }
--- a/src/share/native/sun/java2d/cmm/lcms/cmswtpnt.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmswtpnt.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -104,19 +104,19 @@
             return FALSE;
         }
 
-        // Obtain y(x)
-        y = -3.000*(x*x) + 2.870*x - 0.275;
+    // Obtain y(x)
+    y = -3.000*(x*x) + 2.870*x - 0.275;
 
-        // wave factors (not used, but here for futures extensions)
+    // wave factors (not used, but here for futures extensions)
 
-        // M1 = (-1.3515 - 1.7703*x + 5.9114 *y)/(0.0241 + 0.2562*x - 0.7341*y);
-        // M2 = (0.0300 - 31.4424*x + 30.0717*y)/(0.0241 + 0.2562*x - 0.7341*y);
+    // M1 = (-1.3515 - 1.7703*x + 5.9114 *y)/(0.0241 + 0.2562*x - 0.7341*y);
+    // M2 = (0.0300 - 31.4424*x + 30.0717*y)/(0.0241 + 0.2562*x - 0.7341*y);
 
-        WhitePoint -> x = x;
-        WhitePoint -> y = y;
-        WhitePoint -> Y = 1.0;
+    WhitePoint -> x = x;
+    WhitePoint -> y = y;
+    WhitePoint -> Y = 1.0;
 
-        return TRUE;
+    return TRUE;
 }
 
 
--- a/src/share/native/sun/java2d/cmm/lcms/cmsxform.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/cmsxform.c	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -200,6 +200,23 @@
     _cmsFree(p ->ContextID, (void *) p);
 }
 
+
+static
+cmsUInt32Number PixelSize(cmsUInt32Number Format)
+{
+    cmsUInt32Number fmt_bytes = T_BYTES(Format);
+
+    // For double, the T_BYTES field is zero
+    if (fmt_bytes == 0)
+        return sizeof(cmsUInt64Number);
+
+    // Otherwise, it is already correct for all formats
+    return fmt_bytes;
+}
+
+
+
+
 // Apply transform.
 void CMSEXPORT cmsDoTransform(cmsHTRANSFORM  Transform,
                               const void* InputBuffer,
@@ -212,8 +229,8 @@
 
     stride.BytesPerLineIn = 0;  // Not used
     stride.BytesPerLineOut = 0;
-    stride.BytesPerPlaneIn = Size;
-    stride.BytesPerPlaneOut = Size;
+    stride.BytesPerPlaneIn = Size * PixelSize(p->InputFormat);
+    stride.BytesPerPlaneOut = Size * PixelSize(p->OutputFormat);
 
     p -> xform(p, InputBuffer, OutputBuffer, Size, 1, &stride);
 }
@@ -370,7 +387,7 @@
 
 // 16 bit precision -----------------------------------------------------------------------------------------------------------
 
-// Null transformation, only applies formatters. No caché
+// Null transformation, only applies formatters. No cache
 static
 void NullXFORM(_cmsTRANSFORM* p,
                const void* in,
@@ -417,8 +434,8 @@
                         cmsUInt32Number LineCount,
                         const cmsStride* Stride)
 {
-    register cmsUInt8Number* accum;
-    register cmsUInt8Number* output;
+    CMSREGISTER cmsUInt8Number* accum;
+    CMSREGISTER cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
     cmsUInt32Number i, j, strideIn, strideOut;
 
@@ -471,7 +488,7 @@
         p ->Lut ->Eval16Fn(wIn, wOut, p -> Lut->Data);
 }
 
-// Gamut check, No caché, 16 bits.
+// Gamut check, No cache, 16 bits.
 static
 void PrecalculatedXFORMGamutCheck(_cmsTRANSFORM* p,
                                   const void* in,
@@ -510,7 +527,7 @@
 }
 
 
-// No gamut check, Caché, 16 bits,
+// No gamut check, Cache, 16 bits,
 static
 void CachedXFORM(_cmsTRANSFORM* p,
                  const void* in,
@@ -809,43 +826,46 @@
        // Let's see if any plug-in want to do the transform by itself
        if (p->Lut != NULL) {
 
-              for (Plugin = ctx->TransformCollection;
-                     Plugin != NULL;
-                     Plugin = Plugin->Next) {
+           if (!(*dwFlags & cmsFLAGS_NOOPTIMIZE))
+           {
+               for (Plugin = ctx->TransformCollection;
+                   Plugin != NULL;
+                   Plugin = Plugin->Next) {
 
-                     if (Plugin->Factory(&p->xform, &p->UserData, &p->FreeUserData, &p->Lut, InputFormat, OutputFormat, dwFlags)) {
+                   if (Plugin->Factory(&p->xform, &p->UserData, &p->FreeUserData, &p->Lut, InputFormat, OutputFormat, dwFlags)) {
 
-                            // Last plugin in the declaration order takes control. We just keep
-                            // the original parameters as a logging.
-                            // Note that cmsFLAGS_CAN_CHANGE_FORMATTER is not set, so by default
-                            // an optimized transform is not reusable. The plug-in can, however, change
-                            // the flags and make it suitable.
+                       // Last plugin in the declaration order takes control. We just keep
+                       // the original parameters as a logging.
+                       // Note that cmsFLAGS_CAN_CHANGE_FORMATTER is not set, so by default
+                       // an optimized transform is not reusable. The plug-in can, however, change
+                       // the flags and make it suitable.
 
-                            p->ContextID = ContextID;
-                            p->InputFormat = *InputFormat;
-                            p->OutputFormat = *OutputFormat;
-                            p->dwOriginalFlags = *dwFlags;
+                       p->ContextID = ContextID;
+                       p->InputFormat = *InputFormat;
+                       p->OutputFormat = *OutputFormat;
+                       p->dwOriginalFlags = *dwFlags;
 
-                            // Fill the formatters just in case the optimized routine is interested.
-                            // No error is thrown if the formatter doesn't exist. It is up to the optimization
-                            // factory to decide what to do in those cases.
-                            p->FromInput = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
-                            p->ToOutput = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
-                            p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
-                            p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
+                       // Fill the formatters just in case the optimized routine is interested.
+                       // No error is thrown if the formatter doesn't exist. It is up to the optimization
+                       // factory to decide what to do in those cases.
+                       p->FromInput = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
+                       p->ToOutput = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
+                       p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
+                       p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 
-                            // Save the day? (Ignore the warning)
-                            if (Plugin->OldXform) {
-                                   p->OldXform = (_cmsTransformFn)(void*) p->xform;
-                                   p->xform = _cmsTransform2toTransformAdaptor;
-                            }
+                       // Save the day? (Ignore the warning)
+                       if (Plugin->OldXform) {
+                           p->OldXform = (_cmsTransformFn)(void*)p->xform;
+                           p->xform = _cmsTransform2toTransformAdaptor;
+                       }
 
-                            return p;
-                     }
-              }
+                       return p;
+                   }
+               }
+           }
 
-              // Not suitable for the transform plug-in, let's check  the pipeline plug-in
-              _cmsOptimizePipeline(ContextID, &p->Lut, Intent, InputFormat, OutputFormat, dwFlags);
+           // Not suitable for the transform plug-in, let's check  the pipeline plug-in
+           _cmsOptimizePipeline(ContextID, &p->Lut, Intent, InputFormat, OutputFormat, dwFlags);
        }
 
     // Check whatever this is a true floating point transform
@@ -868,7 +888,7 @@
             p ->xform = NullFloatXFORM;
         }
         else {
-            // Float transforms don't use caché, always are non-NULL
+            // Float transforms don't use cache, always are non-NULL
             p ->xform = FloatXFORM;
         }
 
@@ -907,16 +927,16 @@
             if (*dwFlags & cmsFLAGS_NOCACHE) {
 
                 if (*dwFlags & cmsFLAGS_GAMUTCHECK)
-                    p ->xform = PrecalculatedXFORMGamutCheck;  // Gamut check, no caché
+                    p ->xform = PrecalculatedXFORMGamutCheck;  // Gamut check, no cache
                 else
-                    p ->xform = PrecalculatedXFORM;  // No caché, no gamut check
+                    p ->xform = PrecalculatedXFORM;  // No cache, no gamut check
             }
             else {
 
                 if (*dwFlags & cmsFLAGS_GAMUTCHECK)
-                    p ->xform = CachedXFORMGamutCheck;    // Gamut check, caché
+                    p ->xform = CachedXFORMGamutCheck;    // Gamut check, cache
                 else
-                    p ->xform = CachedXFORM;  // No gamut check, caché
+                    p ->xform = CachedXFORM;  // No gamut check, cache
 
             }
         }
--- a/src/share/native/sun/java2d/cmm/lcms/lcms2.h	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/lcms2.h	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -52,7 +52,7 @@
 //
 //---------------------------------------------------------------------------------
 //
-// Version 2.9rc3
+// Version 2.11
 //
 
 #ifndef _lcms2_H
@@ -90,6 +90,9 @@
 // Uncomment this for special windows mutex initialization (see lcms2_internal.h)
 // #define CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT
 
+// Uncomment this to remove the "register" storage class
+// #define CMS_NO_REGISTER_KEYWORD 1
+
 // ********** End of configuration toggles ******************************
 
 // Needed for streams
@@ -107,7 +110,7 @@
 #endif
 
 // Version/release
-#define LCMS_VERSION        2090
+#define LCMS_VERSION        2100
 
 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
@@ -177,6 +180,13 @@
 #endif
 #endif
 
+// Handle "register" keyword
+#if defined(CMS_NO_REGISTER_KEYWORD) && !defined(CMS_DLL) && !defined(CMS_DLL_BUILD)
+#  define CMSREGISTER
+#else
+#  define CMSREGISTER register
+#endif
+
 // In the case 64 bit numbers are not supported by the compiler
 #ifdef CMS_DONT_USE_INT64
     typedef cmsUInt32Number      cmsUInt64Number[2];
@@ -1058,7 +1068,7 @@
 typedef struct _cmsContext_struct* cmsContext;
 
 CMSAPI cmsContext       CMSEXPORT cmsCreateContext(void* Plugin, void* UserData);
-CMSAPI void             CMSEXPORT cmsDeleteContext(cmsContext ContexID);
+CMSAPI void             CMSEXPORT cmsDeleteContext(cmsContext ContextID);
 CMSAPI cmsContext       CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData);
 CMSAPI void*            CMSEXPORT cmsGetContextUserData(cmsContext ContextID);
 
@@ -1210,6 +1220,7 @@
 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
 CMSAPI cmsInt32Number    CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
 CMSAPI cmsFloat64Number  CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
+CMSAPI cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t);
 
 // Tone curve tabular estimation
 CMSAPI cmsUInt32Number         CMSEXPORT cmsGetToneCurveEstimatedTableEntries(const cmsToneCurve* t);
@@ -1276,13 +1287,13 @@
 CMSAPI void*             CMSEXPORT cmsStageData(const cmsStage* mpe);
 
 // Sampling
-typedef cmsInt32Number (* cmsSAMPLER16)   (register const cmsUInt16Number In[],
-                                            register cmsUInt16Number Out[],
-                                            register void * Cargo);
+typedef cmsInt32Number (* cmsSAMPLER16)   (CMSREGISTER const cmsUInt16Number In[],
+                                           CMSREGISTER cmsUInt16Number Out[],
+                                           CMSREGISTER void * Cargo);
 
-typedef cmsInt32Number (* cmsSAMPLERFLOAT)(register const cmsFloat32Number In[],
-                                            register cmsFloat32Number Out[],
-                                            register void * Cargo);
+typedef cmsInt32Number (* cmsSAMPLERFLOAT)(CMSREGISTER const cmsFloat32Number In[],
+                                           CMSREGISTER cmsFloat32Number Out[],
+                                           CMSREGISTER void * Cargo);
 
 // Use this flag to prevent changes being written to destination
 #define SAMPLER_INSPECT     0x01000000
@@ -1673,7 +1684,7 @@
 // Misc
 #define cmsFLAGS_BLACKPOINTCOMPENSATION   0x2000
 #define cmsFLAGS_NOWHITEONWHITEFIXUP      0x0004    // Don't fix scum dot
-#define cmsFLAGS_HIGHRESPRECALC           0x0400    // Use more memory to give better accurancy
+#define cmsFLAGS_HIGHRESPRECALC           0x0400    // Use more memory to give better accuracy
 #define cmsFLAGS_LOWRESPRECALC            0x0800    // Use less memory to minimize resources
 
 // For devicelink creation
--- a/src/share/native/sun/java2d/cmm/lcms/lcms2_internal.h	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/lcms2_internal.h	Wed Feb 03 05:23:32 2021 +0000
@@ -27,10 +27,10 @@
 // However, the following notice accompanied the original version of this
 // file:
 //
-
+//---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -76,7 +76,7 @@
 #endif
 
 // BorlandC 5.5, VC2003 are broken on that
-#if defined(__BORLANDC__) || (_MSC_VER < 1400) // 1400 == VC++ 8.0
+#if defined(__BORLANDC__) || (defined(_MSC_VER) && (_MSC_VER < 1400)) // 1400 == VC++ 8.0
 #define sinf(x) (float)sin((float)x)
 #define sqrtf(x) (float)sqrt((float)x)
 #endif
@@ -117,6 +117,13 @@
 #   define cmsINLINE static inline
 #endif
 
+// Allow signed overflow, we know this is harmless in this particular context
+#if defined(__clang__)
+#   define CMS_NO_SANITIZE __attribute__((no_sanitize("signed-integer-overflow")))
+#else
+#   define CMS_NO_SANITIZE
+#endif
+
 // Other replacement functions
 #ifdef _MSC_VER
 # ifndef snprintf
@@ -128,12 +135,19 @@
 
 /// Properly define some macros to accommodate
 /// older MSVC versions.
-# if _MSC_VER <= 1700
+# if defined(_MSC_VER) && _MSC_VER <= 1700
         #include <float.h>
         #define isnan _isnan
         #define isinf(x) (!_finite((x)))
 # endif
 
+#if !defined(_MSC_VER) && (defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L)
+        #if !defined(isinf)
+        #define isinf(x) (!finite((x)))
+        #endif
+#endif
+
+
 #endif
 
 // A fast way to convert from/to 16 <-> 8 bits
@@ -964,6 +978,9 @@
 
 // Profile linker --------------------------------------------------------------------------------------------------
 
+// Link several profiles to obtain a single LUT modelling the whole color transform. Intents, Black point
+// compensation and Adaptation parameters may vary across profiles. BPC and Adaptation refers to the PCS
+// after the profile. I.e, BPC[0] refers to connexion between profile(0) and profile(1)
 cmsPipeline* _cmsLinkProfiles(cmsContext         ContextID,
                               cmsUInt32Number    nProfiles,
                               cmsUInt32Number    TheIntents[],
--- a/src/share/native/sun/java2d/cmm/lcms/lcms2_plugin.h	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/lcms2_plugin.h	Wed Feb 03 05:23:32 2021 +0000
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2017 Marti Maria Saguer
+//  Copyright (c) 1998-2020 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -123,6 +123,12 @@
 CMSAPI void               CMSEXPORT _cmsMAT3eval(cmsVEC3* r, const cmsMAT3* a, const cmsVEC3* v);
 
 
+// MD5 low level  -------------------------------------------------------------------------------------
+
+CMSAPI cmsHANDLE          CMSEXPORT cmsMD5alloc(cmsContext ContextID);
+CMSAPI void               CMSEXPORT cmsMD5add(cmsHANDLE Handle, const cmsUInt8Number* buf, cmsUInt32Number len);
+CMSAPI void               CMSEXPORT cmsMD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle);
+
 // Error logging  -------------------------------------------------------------------------------------
 
 CMSAPI void               CMSEXPORT  cmsSignalError(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *ErrorText, ...);
@@ -284,9 +290,9 @@
 // 16 bits forward interpolation. This function performs precision-limited linear interpolation
 // and is supposed to be quite fast. Implementation may be tetrahedral or trilinear, and plug-ins may
 // choose to implement any other interpolation algorithm.
-typedef void (* _cmsInterpFn16)(register const cmsUInt16Number Input[],
-                                register cmsUInt16Number Output[],
-                                register const struct _cms_interp_struc* p);
+typedef void (* _cmsInterpFn16)(CMSREGISTER const cmsUInt16Number Input[],
+                                CMSREGISTER cmsUInt16Number Output[],
+                                CMSREGISTER const struct _cms_interp_struc* p);
 
 // Floating point forward interpolation. Full precision interpolation using floats. This is not a
 // time critical function. Implementation may be tetrahedral or trilinear, and plug-ins may
@@ -369,10 +375,10 @@
 
 struct _cmstransform_struct;
 
-typedef cmsUInt8Number* (* cmsFormatter16)(register struct _cmstransform_struct* CMMcargo,
-                                           register cmsUInt16Number Values[],
-                                           register cmsUInt8Number* Buffer,
-                                           register cmsUInt32Number Stride);
+typedef cmsUInt8Number* (* cmsFormatter16)(CMSREGISTER struct _cmstransform_struct* CMMcargo,
+                                           CMSREGISTER cmsUInt16Number Values[],
+                                           CMSREGISTER cmsUInt8Number* Buffer,
+                                           CMSREGISTER cmsUInt32Number Stride);
 
 typedef cmsUInt8Number* (* cmsFormatterFloat)(struct _cmstransform_struct* CMMcargo,
                                               cmsFloat32Number Values[],
@@ -570,9 +576,9 @@
 // the optimization  search. Or FALSE if it is unable to optimize and want to give a chance
 // to the rest of optimizers.
 
-typedef void     (* _cmsOPTeval16Fn)(register const cmsUInt16Number In[],
-                                     register cmsUInt16Number Out[],
-                                     register const void* Data);
+typedef void     (* _cmsOPTeval16Fn)(CMSREGISTER const cmsUInt16Number In[],
+                                     CMSREGISTER cmsUInt16Number Out[],
+                                     CMSREGISTER const void* Data);
 
 
 typedef cmsBool  (* _cmsOPToptimizeFn)(cmsPipeline** Lut,
--- a/src/share/native/sun/management/ThreadImpl.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/share/native/sun/management/ThreadImpl.c	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,6 +94,13 @@
                                              JNI_FALSE /* user */);
 }
 
+JNIEXPORT jlong JNICALL
+Java_sun_management_ThreadImpl_getThreadAllocatedMemory0
+  (JNIEnv *env, jclass cls, jlong tid)
+{
+  return jmm_interface->GetOneThreadAllocatedMemory(env, tid);
+}
+
 JNIEXPORT void JNICALL
 Java_sun_management_ThreadImpl_getThreadAllocatedMemory1
   (JNIEnv *env, jclass cls, jlongArray ids, jlongArray sizeArray)
@@ -135,7 +142,9 @@
 
 JNIEXPORT jobjectArray JNICALL
 Java_sun_management_ThreadImpl_dumpThreads0
-  (JNIEnv *env, jclass cls, jlongArray ids, jboolean lockedMonitors, jboolean lockedSynchronizers)
+  (JNIEnv *env, jclass cls, jlongArray ids, jboolean lockedMonitors,
+  jboolean lockedSynchronizers, jint maxDepth)
 {
-    return jmm_interface->DumpThreads(env, ids, lockedMonitors, lockedSynchronizers);
+    return jmm_interface->DumpThreadsMaxDepth(env, ids, lockedMonitors,
+                                              lockedSynchronizers, maxDepth);
 }
--- a/src/solaris/bin/java_md_solinux.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/solaris/bin/java_md_solinux.c	Wed Feb 03 05:23:32 2021 +0000
@@ -240,6 +240,7 @@
     char serverPattern[PATH_MAX + 1];
     char *envpath;
     char *path;
+    char* save_ptr = NULL;
     jboolean clientPatternFound;
     jboolean serverPatternFound;
 
@@ -263,7 +264,7 @@
      * we have a suspicious path component, check if it contains a libjvm.so
      */
     envpath = JLI_StringDup(env);
-    for (path = JLI_StrTok(envpath, ":"); path != NULL; path = JLI_StrTok(NULL, ":")) {
+    for (path = strtok_r(envpath, ":", &save_ptr); path != NULL; path = strtok_r(NULL, ":", &save_ptr)) {
         if (clientPatternFound && JLI_StrStr(path, clientPattern) != NULL) {
             if (JvmExists(path)) {
                 JLI_MemFree(envpath);
--- a/src/solaris/classes/sun/management/OperatingSystemImpl.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/solaris/classes/sun/management/OperatingSystemImpl.java	Wed Feb 03 05:23:32 2021 +0000
@@ -66,6 +66,12 @@
             long memSwapLimit = containerMetrics.getMemoryAndSwapLimit();
             long memLimit = containerMetrics.getMemoryLimit();
             if (memSwapLimit >= 0 && memLimit >= 0) {
+                long deltaLimit = memSwapLimit - memLimit;
+                // Return 0 when memSwapLimit == memLimit, which means no swap space is allowed.
+                // And the same for memSwapLimit < memLimit.
+                if (deltaLimit <= 0) {
+                    return 0;
+                }
                 for (int attempt = 0; attempt < MAX_ATTEMPTS_NUMBER; attempt++) {
                     long memSwapUsage = containerMetrics.getMemoryAndSwapUsage();
                     long memUsage = containerMetrics.getMemoryUsage();
@@ -73,8 +79,12 @@
                         // We read "memory usage" and "memory and swap usage" not atomically,
                         // and it's possible to get the negative value when subtracting these two.
                         // If this happens just retry the loop for a few iterations.
-                        if ((memSwapUsage - memUsage) >= 0) {
-                            return memSwapLimit - memLimit - (memSwapUsage - memUsage);
+                        long deltaUsage = memSwapUsage - memUsage;
+                        if (deltaUsage >= 0) {
+                            long freeSwap = deltaLimit - deltaUsage;
+                            if (freeSwap >= 0) {
+                                return freeSwap;
+                            }
                         }
                     }
                 }
--- a/src/windows/native/java/io/WinNTFileSystem_md.c	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/windows/native/java/io/WinNTFileSystem_md.c	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, 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
@@ -35,6 +35,7 @@
 #include <direct.h>
 #include <windows.h>
 #include <io.h>
+#include <limits.h>
 
 #include "jni.h"
 #include "io_util.h"
@@ -525,13 +526,40 @@
         }
     } else {
         if (GetLastError() == ERROR_SHARING_VIOLATION) {
-            /* The error is "share violation", which means the file/dir
-               must exists. Try _wstati64, we know this at least works
-               for pagefile.sys and hiberfil.sys.
-            */
-            struct _stati64 sb;
-            if (_wstati64(pathbuf, &sb) == 0) {
-                rv = sb.st_size;
+            //
+            // The error is a "share violation", which means the file/dir
+            // must exist. Try FindFirstFile, we know this at least works
+            // for pagefile.sys.
+            //
+
+            WIN32_FIND_DATAW fileData;
+            HANDLE h = FindFirstFileW(pathbuf, &fileData);
+            if (h != INVALID_HANDLE_VALUE) {
+                if ((fileData.dwFileAttributes &
+                     FILE_ATTRIBUTE_REPARSE_POINT) == 0) {
+                    WCHAR backslash = L'\\';
+                    WCHAR *pslash = wcsrchr(pathbuf, backslash);
+                    WCHAR *fslash = wcsrchr(fileData.cFileName, backslash);
+                    if (pslash == NULL) {
+                        pslash = pathbuf;
+                    } else {
+                        pslash++;
+                    }
+                    if (fslash == NULL) {
+                        fslash = fileData.cFileName;
+                    } else {
+                        fslash++;
+                    }
+                    if (wcscmp(pslash, fslash) == 0) {
+                        ULARGE_INTEGER length;
+                        length.LowPart = fileData.nFileSizeLow;
+                        length.HighPart = fileData.nFileSizeHigh;
+                        if (length.QuadPart <= _I64_MAX) {
+                            rv = (jlong)length.QuadPart;
+                        }
+                    }
+                }
+                FindClose(h);
             }
         }
     }
--- a/src/windows/native/sun/windows/awt_DnDDS.cpp	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/windows/native/sun/windows/awt_DnDDS.cpp	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -266,11 +266,14 @@
 
     dragSource->Signal();
 
+    AwtToolkit &toolkit = AwtToolkit::GetInstance();
+    toolkit.isInDoDragDropLoop = TRUE;
     res = ::DoDragDrop(dragSource,
                        dragSource,
                        convertActionsToDROPEFFECT(dragSource->m_actions),
                        &effects
           );
+    toolkit.isInDoDragDropLoop = FALSE;
 
     if (effects == DROPEFFECT_NONE && dragSource->m_dwPerformedDropEffect != DROPEFFECT_NONE) {
         effects = dragSource->m_dwPerformedDropEffect;
@@ -626,6 +629,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::QueryContinueDrag(BOOL fEscapeKeyPressed, DWORD grfKeyState) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     JNIEnv* env       = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -681,6 +685,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::GiveFeedback(DWORD dwEffect) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     JNIEnv* env       = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -760,6 +765,7 @@
 
 HRESULT __stdcall AwtDragSource::GetData(FORMATETC __RPC_FAR *pFormatEtc,
                                          STGMEDIUM __RPC_FAR *pmedium) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
     STGMEDIUM *pPicMedia = PictureDragHelper::FindData(*pFormatEtc);
     if (NULL != pPicMedia) {
@@ -934,6 +940,7 @@
 
 HRESULT __stdcall AwtDragSource::GetDataHere(FORMATETC __RPC_FAR *pFormatEtc,
                                              STGMEDIUM __RPC_FAR *pmedium) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     if (pmedium->pUnkForRelease != (IUnknown *)NULL) {
@@ -1036,6 +1043,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::QueryGetData(FORMATETC __RPC_FAR *pFormatEtc) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     return MatchFormatEtc(pFormatEtc, (FORMATETC *)NULL);
@@ -1049,6 +1057,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::GetCanonicalFormatEtc(FORMATETC __RPC_FAR *pFormatEtcIn, FORMATETC __RPC_FAR *pFormatEtcOut) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     HRESULT   res = MatchFormatEtc(pFormatEtcIn, (FORMATETC *)NULL);
@@ -1069,6 +1078,7 @@
  */
 
 HRESULT __stdcall AwtDragSource::SetData(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease) {
+    AwtToolkit::GetInstance().eventNumber++;
     if (pFormatEtc->cfFormat == CF_PERFORMEDDROPEFFECT && pmedium->tymed == TYMED_HGLOBAL) {
         m_dwPerformedDropEffect = *(DWORD*)::GlobalLock(pmedium->hGlobal);
         ::GlobalUnlock(pmedium->hGlobal);
@@ -1091,6 +1101,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC *__RPC_FAR *ppenumFormatEtc) {
+    AwtToolkit::GetInstance().eventNumber++;
     TRY;
 
     *ppenumFormatEtc = new ADSIEnumFormatEtc(this);
@@ -1104,6 +1115,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::DAdvise(FORMATETC __RPC_FAR *pFormatEtc, DWORD advf, IAdviseSink __RPC_FAR *pAdvSink, DWORD __RPC_FAR *pdwConnection) {
+    AwtToolkit::GetInstance().eventNumber++;
     return E_NOTIMPL;
 }
 
@@ -1112,6 +1124,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::DUnadvise(DWORD dwConnection) {
+    AwtToolkit::GetInstance().eventNumber++;
     return OLE_E_ADVISENOTSUPPORTED;
 }
 
@@ -1120,6 +1133,7 @@
  */
 
 HRESULT __stdcall  AwtDragSource::EnumDAdvise(IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise) {
+    AwtToolkit::GetInstance().eventNumber++;
     return OLE_E_ADVISENOTSUPPORTED;
 }
 
@@ -1127,7 +1141,7 @@
     ::RegisterClipboardFormat(TEXT("_SUNW_JAVA_AWT_PROCESS_ID"));
 
 HRESULT __stdcall AwtDragSource::GetProcessId(FORMATETC __RPC_FAR *pFormatEtc, STGMEDIUM __RPC_FAR *pmedium) {
-
+    AwtToolkit::GetInstance().eventNumber++;
     if ((pFormatEtc->tymed & TYMED_HGLOBAL) == 0) {
         return DV_E_TYMED;
     } else if (pFormatEtc->lindex != -1) {
--- a/src/windows/native/sun/windows/awt_InputMethod.cpp	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/windows/native/sun/windows/awt_InputMethod.cpp	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
     TRY;
 
     // use special message to call ImmCreateContext() in main thread.
-    return (jint)AwtToolkit::GetInstance().SendMessage(WM_AWT_CREATECONTEXT);
+    return (jint)AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_CREATECONTEXT);
 
     CATCH_BAD_ALLOC_RET(0);
 }
@@ -74,7 +74,7 @@
     TRY_NO_VERIFY;
 
     // use special message to call ImmDestroyContext() in main thread.
-    AwtToolkit::GetInstance().SendMessage(WM_AWT_DESTROYCONTEXT, context, 0);
+    AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_DESTROYCONTEXT, context, 0);
 
     CATCH_BAD_ALLOC;
 }
@@ -101,7 +101,7 @@
     enis->context = context;
     enis->useNativeCompWindow = useNativeCompWindow;
 
-    AwtToolkit::GetInstance().SendMessage(WM_AWT_ASSOCIATECONTEXT,
+    AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_ASSOCIATECONTEXT,
                                           reinterpret_cast<WPARAM>(enis), (LPARAM)0);
     // global refs are deleted in message handler
 
@@ -128,7 +128,7 @@
     enis->context = NULL;
     enis->useNativeCompWindow = JNI_TRUE;
 
-    AwtToolkit::GetInstance().SendMessage(WM_AWT_ASSOCIATECONTEXT,
+    AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_ASSOCIATECONTEXT,
                                           reinterpret_cast<WPARAM>(enis), (LPARAM)0);
     // global refs are deleted in message handler
 
@@ -205,7 +205,7 @@
     // 10/29/98 - Changed to commit it according to the flag.
 
     // use special message to call ImmNotifyIME() in main thread.
-    AwtToolkit::GetInstance().SendMessage(WM_AWT_ENDCOMPOSITION, context,
+    AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_ENDCOMPOSITION, context,
         (LPARAM)(flag != sun_awt_windows_WInputMethod_DISCARD_INPUT));
 
     CATCH_BAD_ALLOC;
@@ -222,7 +222,7 @@
     TRY;
 
     // use special message to call ImmSetConversionStatus() in main thread.
-    AwtToolkit::GetInstance().SendMessage(WM_AWT_SETCONVERSIONSTATUS,
+    AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_SETCONVERSIONSTATUS,
                                           context,
                                           MAKELPARAM((WORD)request, (WORD)0));
 
@@ -240,7 +240,7 @@
     TRY;
 
     // use special message to call ImmSetConversionStatus() in main thread.
-    return (jint) AwtToolkit::GetInstance().SendMessage(
+    return (jint) AwtToolkit::GetInstance().InvokeInputMethodFunction(
         WM_AWT_GETCONVERSIONSTATUS, context, 0);
 
     CATCH_BAD_ALLOC_RET(0);
@@ -257,7 +257,7 @@
     TRY;
 
     // use special message to call ImmSetConversionStatus() in main thread.
-    AwtToolkit::GetInstance().SendMessage(WM_AWT_SETOPENSTATUS,
+    AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_SETOPENSTATUS,
                                           context, flag);
 
     CATCH_BAD_ALLOC;
@@ -274,7 +274,7 @@
     TRY;
 
     // use special message to call ImmSetConversionStatus() in main thread.
-    return (jboolean)(AwtToolkit::GetInstance().SendMessage(
+    return (jboolean)(AwtToolkit::GetInstance().InvokeInputMethodFunction(
                                                        WM_AWT_GETOPENSTATUS,
                                                        context, 0));
     CATCH_BAD_ALLOC_RET(0);
@@ -392,7 +392,7 @@
         jobject peerGlobalRef = env->NewGlobalRef(peer);
 
         // use special message to access pData on the toolkit thread
-        LRESULT res = AwtToolkit::GetInstance().SendMessage(WM_AWT_GET_DEFAULT_IME_HANDLER,
+        LRESULT res = AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_GET_DEFAULT_IME_HANDLER,
                                           reinterpret_cast<WPARAM>(peerGlobalRef), 0);
         // global ref is deleted in message handler
 
@@ -431,7 +431,7 @@
     // See CR 4805862, AwtToolkit::WndProc
 
     // use special message to open candidate window in main thread.
-    AwtToolkit::GetInstance().SendMessage(WM_AWT_OPENCANDIDATEWINDOW,
+    AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_OPENCANDIDATEWINDOW,
                                           (WPARAM)peerGlobalRef, MAKELONG(x, y));
     // global ref is deleted in message handler
 
--- a/src/windows/native/sun/windows/awt_Toolkit.cpp	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/windows/native/sun/windows/awt_Toolkit.cpp	Wed Feb 03 05:23:32 2021 +0000
@@ -330,6 +330,8 @@
     ::GetKeyboardState(m_lastKeyboardState);
 
     m_waitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
+    m_inputMethodWaitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
+    isInDoDragDropLoop = FALSE;
     eventNumber = 0;
 }
 
@@ -763,6 +765,7 @@
     delete tk.m_cmdIDs;
 
     ::CloseHandle(m_waitEvent);
+    ::CloseHandle(m_inputMethodWaitEvent);
 
     tk.m_isDisposed = TRUE;
 
@@ -1073,11 +1076,17 @@
       // it returs with no error. (This restriction is not documented)
       // So we must use thse messages to call these APIs in main thread.
       case WM_AWT_CREATECONTEXT: {
-        return reinterpret_cast<LRESULT>(
+          AwtToolkit& tk = AwtToolkit::GetInstance();
+          tk.m_inputMethodData = reinterpret_cast<LRESULT>(
             reinterpret_cast<void*>(ImmCreateContext()));
+          ::SetEvent(tk.m_inputMethodWaitEvent);
+          return tk.m_inputMethodData;
       }
       case WM_AWT_DESTROYCONTEXT: {
           ImmDestroyContext((HIMC)wParam);
+          AwtToolkit& tk = AwtToolkit::GetInstance();
+          tk.m_inputMethodData = 0;
+          ::SetEvent(tk.m_inputMethodWaitEvent);
           return 0;
       }
       case WM_AWT_ASSOCIATECONTEXT: {
@@ -1103,17 +1112,21 @@
           }
 
           delete data;
+          AwtToolkit& tk = AwtToolkit::GetInstance();
+          tk.m_inputMethodData = 0;
+          ::SetEvent(tk.m_inputMethodWaitEvent);
           return 0;
       }
       case WM_AWT_GET_DEFAULT_IME_HANDLER: {
           LRESULT ret = (LRESULT)FALSE;
           jobject peer = (jobject)wParam;
+          AwtToolkit& tk = AwtToolkit::GetInstance();
 
           AwtComponent* comp = (AwtComponent*)JNI_GET_PDATA(peer);
           if (comp != NULL) {
               HWND defaultIMEHandler = ImmGetDefaultIMEWnd(comp->GetHWnd());
               if (defaultIMEHandler != NULL) {
-                  AwtToolkit::GetInstance().SetInputMethodWindow(defaultIMEHandler);
+                  tk.SetInputMethodWindow(defaultIMEHandler);
                   ret = (LRESULT)TRUE;
               }
           }
@@ -1121,6 +1134,8 @@
           if (peer != NULL) {
               env->DeleteGlobalRef(peer);
           }
+          tk.m_inputMethodData = ret;
+          ::SetEvent(tk.m_inputMethodWaitEvent);
           return ret;
       }
       case WM_AWT_HANDLE_NATIVE_IME_EVENT: {
@@ -1156,6 +1171,9 @@
           Changed to commit it according to the flag 10/29/98*/
           ImmNotifyIME((HIMC)wParam, NI_COMPOSITIONSTR,
                        (lParam ? CPS_COMPLETE : CPS_CANCEL), 0);
+          AwtToolkit& tk = AwtToolkit::GetInstance();
+          tk.m_inputMethodData = 0;
+          ::SetEvent(tk.m_inputMethodWaitEvent);
           return 0;
       }
       case WM_AWT_SETCONVERSIONSTATUS: {
@@ -1163,12 +1181,18 @@
           DWORD smode;
           ImmGetConversionStatus((HIMC)wParam, (LPDWORD)&cmode, (LPDWORD)&smode);
           ImmSetConversionStatus((HIMC)wParam, (DWORD)LOWORD(lParam), smode);
+          AwtToolkit& tk = AwtToolkit::GetInstance();
+          tk.m_inputMethodData = 0;
+          ::SetEvent(tk.m_inputMethodWaitEvent);
           return 0;
       }
       case WM_AWT_GETCONVERSIONSTATUS: {
           DWORD cmode;
           DWORD smode;
           ImmGetConversionStatus((HIMC)wParam, (LPDWORD)&cmode, (LPDWORD)&smode);
+          AwtToolkit& tk = AwtToolkit::GetInstance();
+          tk.m_inputMethodData = cmode;
+          ::SetEvent(tk.m_inputMethodWaitEvent);
           return cmode;
       }
       case WM_AWT_ACTIVATEKEYBOARDLAYOUT: {
@@ -1203,6 +1227,9 @@
           // instead of LOWORD and HIWORD
           p->OpenCandidateWindow(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
           env->DeleteGlobalRef(peerObject);
+          AwtToolkit& tk = AwtToolkit::GetInstance();
+          tk.m_inputMethodData = 0;
+          ::SetEvent(tk.m_inputMethodWaitEvent);
           return 0;
       }
 
@@ -1224,10 +1251,16 @@
 
       case WM_AWT_SETOPENSTATUS: {
           ImmSetOpenStatus((HIMC)wParam, (BOOL)lParam);
+          AwtToolkit& tk = AwtToolkit::GetInstance();
+          tk.m_inputMethodData = 0;
+          ::SetEvent(tk.m_inputMethodWaitEvent);
           return 0;
       }
       case WM_AWT_GETOPENSTATUS: {
-          return (DWORD)ImmGetOpenStatus((HIMC)wParam);
+          AwtToolkit& tk = AwtToolkit::GetInstance();
+          tk.m_inputMethodData = (DWORD)ImmGetOpenStatus((HIMC)wParam);
+          ::SetEvent(tk.m_inputMethodWaitEvent);
+          return tk.m_inputMethodData;
       }
       case WM_DISPLAYCHANGE: {
           // Reinitialize screens
@@ -2910,7 +2943,12 @@
     AwtToolkit & tk = AwtToolkit::GetInstance();
     DWORD eventNumber = tk.eventNumber;
     tk.PostMessage(WM_SYNC_WAIT, 0, 0);
-    ::WaitForSingleObject(tk.m_waitEvent, INFINITE);
+    for(long t = 2; t < timeout &&
+               WAIT_TIMEOUT == ::WaitForSingleObject(tk.m_waitEvent, 2); t+=2) {
+        if (tk.isInDoDragDropLoop) {
+            break;
+        }
+    }
     DWORD newEventNumber = tk.eventNumber;
     return (newEventNumber - eventNumber) > 2;
 }
@@ -3092,3 +3130,23 @@
     }
     return m_pCloseTouchInputHandle(hTouchInput);
 }
+
+/*
+ * The fuction intended for access to an IME API. It posts IME message to the queue and
+ * waits untill the message processing is completed.
+ *
+ * On Windows 10 the IME may process the messages send via SenMessage() from other threads
+ * when the IME is called by TranslateMessage(). This may cause an reentrancy issue when
+ * the windows procedure processing the sent message call an IME function and leaves
+ * the IME functionality in an unexpected state.
+ * This function avoids reentrancy issue and must be used for sending of all IME messages
+ * instead of SendMessage().
+ */
+LRESULT AwtToolkit::InvokeInputMethodFunction(UINT msg, WPARAM wParam, LPARAM lParam) {
+    CriticalSection::Lock lock(m_inputMethodLock);
+    if (PostMessage(msg, wParam, lParam)) {
+        ::WaitForSingleObject(m_inputMethodWaitEvent, INFINITE);
+        return m_inputMethodData;
+    }
+    return 0;
+}
--- a/src/windows/native/sun/windows/awt_Toolkit.h	Tue Jan 19 17:18:23 2021 +0000
+++ b/src/windows/native/sun/windows/awt_Toolkit.h	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2020, 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
@@ -246,6 +246,8 @@
         UINT cInputs, PTOUCHINPUT pInputs, int cbSize);
     BOOL TICloseTouchInputHandle(HTOUCHINPUT hTouchInput);
 
+    LRESULT InvokeInputMethodFunction(UINT msg, WPARAM wParam=0, LPARAM lParam=0);
+
     INLINE BOOL localPump() { return m_localPump; }
     INLINE BOOL VerifyComponents() { return FALSE; } // TODO: Use new DebugHelper class to set this flag
     INLINE HWND GetHWnd() { return m_toolkitHWnd; }
@@ -440,7 +442,8 @@
     static BOOL activateKeyboardLayout(HKL hkl);
 
     HANDLE m_waitEvent;
-    DWORD eventNumber;
+    volatile DWORD eventNumber;
+    volatile BOOL isInDoDragDropLoop;
 private:
     HWND CreateToolkitWnd(LPCTSTR name);
 
@@ -499,6 +502,10 @@
     HMODULE m_dllHandle;  /* The module handle. */
 
     CriticalSection m_Sync;
+    CriticalSection m_inputMethodLock;
+
+    HANDLE m_inputMethodWaitEvent;
+    LRESULT m_inputMethodData;
 
 /* track display changes - used by palette-updating code.
    This is a workaround for a windows bug that prevents
--- a/test/ProblemList.txt	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/ProblemList.txt	Wed Feb 03 05:23:32 2021 +0000
@@ -39,15 +39,18 @@
 #
 # Shell tests are othervm by default.
 #
-# List items  are testnames followed by labels, all MUST BE commented
+# List items are testnames followed by labels, all MUST BE commented
 #   as to why they are here and use a label:
 #     generic-all   Problems on all platforms
-#     generic-ARCH  Where ARCH is one of: sparc, sparcv9, x64, i586, etc.
+#     generic-ARCH  Where ARCH is one of: sparc, sparcv9, x64, i586, ppc64,
+#                   ppc64le, s390x etc.
 #     OSNAME-all    Where OSNAME is one of: solaris, linux, windows, macosx, aix
 #     OSNAME-ARCH   Specific on to one OSNAME and ARCH, e.g. solaris-x64
 #     OSNAME-REV    Specific on to one OSNAME and REV, e.g. solaris-5.8
 #
-# More than one label is allowed but must be on the same line.
+# More than one label is allowed but must be on the same line comma seperated,
+# without spaces.
+# If there are several lines mentioning the same test, the last one is used.
 #
 #############################################################################
 #
@@ -80,7 +83,7 @@
 # Fixing the tests:
 #
 # Some tests just may need to be run with "othervm", and that can easily be
-#   done my adding a @run line (or modifying any existing @run):
+#   done by adding a @run line (or modifying any existing @run):
 #      @run main/othervm NameOfMainClass
 #   Make sure this @run follows any use of @library.
 #   Otherwise, if the test is a samevm possibility, make sure the test is
@@ -163,8 +166,11 @@
 # 7122846, 8098566
 java/net/MulticastSocket/SetLoopbackMode.java                    macosx-all,solaris-all
 
-# 8171217, 7145658
-java/net/MulticastSocket/Test.java                               macosx-all,solaris-all
+# 8171217, 7145658, 8207404
+java/net/MulticastSocket/Test.java                               macosx-all,solaris-all,aix-all
+
+# 8207404
+java/net/MulticastSocket/SetGetNetworkInterfaceTest.java         aix-all
 
 # 7143960
 java/net/DatagramSocket/SendDatagramToBadAddress.java            macosx-all
--- a/test/com/sun/jdi/EvalArraysAsList.sh	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/com/sun/jdi/EvalArraysAsList.sh	Wed Feb 03 05:23:32 2021 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
 public class $classname {
     public static void main(String[] args) {
         java.util.List<Object> l = java.util.Arrays.asList(null, "a");
-        System.out.println("java.util.Arrays.asList(null, \"a\") returns: " + l);
+        System.out.println("java.util.Arrays.asList(null, \\"a\\") returns: " + l);
         return;    // @1 breakpoint
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/management/ThreadMXBean/MaxDepthForThreadInfoTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8185003
+ * @library /java/lang/management/ThreadMXBean
+ * @build ThreadDump
+ * @run main MaxDepthForThreadInfoTest
+ * @summary verifies the functionality of ThreadMXBean.dumpAllThreads
+ * and ThreadMXBean.getThreadInfo with maxDepth argument
+ */
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+
+
+
+public class MaxDepthForThreadInfoTest {
+
+
+    public static void main(String[] Args) {
+
+        com.sun.management.ThreadMXBean tmxb =
+            (com.sun.management.ThreadMXBean)ManagementFactory.getThreadMXBean();
+
+        long[] threadIds = tmxb.getAllThreadIds();
+
+        ThreadInfo[] tinfos = tmxb.getThreadInfo(threadIds, true, true, 0);
+        for (ThreadInfo ti : tinfos) {
+            if (ti.getStackTrace().length > 0) {
+                ThreadDump.printThreadInfo(ti);
+                throw new RuntimeException("more than requested " +
+                        "number of frames dumped");
+            }
+        }
+
+        tinfos = tmxb.getThreadInfo(threadIds, true, true, 3);
+        for (ThreadInfo ti : tinfos) {
+            if (ti.getStackTrace().length > 3) {
+                ThreadDump.printThreadInfo(ti);
+                throw new RuntimeException("more than requested " +
+                        "number of frames dumped");
+            }
+        }
+
+        try {
+            tmxb.getThreadInfo(threadIds, true, true, -1);
+            throw new RuntimeException("Didn't throw IllegalArgumentException " +
+                    "for negative maxdepth value");
+        } catch (IllegalArgumentException e) {
+            System.out.println("Throwed IllegalArgumentException as expected");
+        }
+
+        tinfos = tmxb.dumpAllThreads(true, true, 0);
+        for (ThreadInfo ti : tinfos) {
+            if (ti.getStackTrace().length > 0) {
+                ThreadDump.printThreadInfo(ti);
+                throw new RuntimeException("more than requested " +
+                        "number of frames dumped");
+            }
+        }
+        tinfos = tmxb.dumpAllThreads(true, true, 2);
+        for (ThreadInfo ti : tinfos) {
+            if (ti.getStackTrace().length > 2) {
+                ThreadDump.printThreadInfo(ti);
+                throw new RuntimeException("more than requested " +
+                        "number of frames dumped");
+            }
+        }
+
+        try {
+            tmxb.dumpAllThreads(true, true, -1);
+            throw new RuntimeException("Didn't throw IllegalArgumentException " +
+                    "for negative maxdepth value");
+        } catch (IllegalArgumentException e) {
+            System.out.println("Throwed IllegalArgumentException as expected");
+        }
+
+        System.out.println("Test passed");
+    }
+}
--- a/test/com/sun/management/ThreadMXBean/ThreadAllocatedMemory.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/com/sun/management/ThreadMXBean/ThreadAllocatedMemory.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     6173675
+ * @bug     6173675 8231209
  * @summary Basic test of ThreadMXBean.getThreadAllocatedBytes
  * @author  Paul Hohensee
  */
@@ -33,9 +33,8 @@
 public class ThreadAllocatedMemory {
     private static com.sun.management.ThreadMXBean mbean =
         (com.sun.management.ThreadMXBean)ManagementFactory.getThreadMXBean();
-    private static boolean testFailed = false;
-    private static boolean done = false;
-    private static boolean done1 = false;
+    private static volatile boolean done = false;
+    private static volatile boolean done1 = false;
     private static Object obj = new Object();
     private static final int NUM_THREADS = 10;
     private static Thread[] threads = new Thread[NUM_THREADS];
@@ -44,6 +43,22 @@
     public static void main(String[] argv)
         throws Exception {
 
+        testSupportEnableDisable();
+
+        // Test current thread two ways
+        testGetCurrentThreadAllocatedBytes();
+        testCurrentThreadGetThreadAllocatedBytes();
+
+        // Test a single thread that is not this one
+        testGetThreadAllocatedBytes();
+
+        // Test many threads that are not this one
+        testGetThreadsAllocatedBytes();
+
+        System.out.println("Test passed");
+    }
+
+    private static void testSupportEnableDisable() {
         if (!mbean.isThreadAllocatedMemorySupported()) {
             return;
         }
@@ -58,10 +73,7 @@
                 "ThreadAllocatedMemory is expected to be disabled");
         }
 
-        Thread curThread = Thread.currentThread();
-        long id = curThread.getId();
-
-        long s = mbean.getThreadAllocatedBytes(id);
+        long s = mbean.getCurrentThreadAllocatedBytes();
         if (s != -1) {
             throw new RuntimeException(
                 "Invalid ThreadAllocatedBytes returned = " +
@@ -77,63 +89,106 @@
             throw new RuntimeException(
                 "ThreadAllocatedMemory is expected to be enabled");
         }
+    }
+
+    private static void testGetCurrentThreadAllocatedBytes() {
+        long size = mbean.getCurrentThreadAllocatedBytes();
+        ensureValidSize(size);
+
+        // do some more allocation
+        doit();
+
+        checkResult(Thread.currentThread(), size,
+                    mbean.getCurrentThreadAllocatedBytes());
+    }
+
+    private static void testCurrentThreadGetThreadAllocatedBytes() {
+        Thread curThread = Thread.currentThread();
+        long id = curThread.getId();
 
         long size = mbean.getThreadAllocatedBytes(id);
-        // implementation could have started measurement when
-        // measurement was enabled, in which case size can be 0
-        if (size < 0) {
-            throw new RuntimeException(
-                "Invalid allocated bytes returned = " + size);
-        }
+        ensureValidSize(size);
 
+        // do some more allocation
         doit();
 
-        // Expected to be size1 >= size
-        long size1 = mbean.getThreadAllocatedBytes(id);
-        if (size1 < size) {
-            throw new RuntimeException("Allocated bytes " + size1 +
-                " expected >= " + size);
+        checkResult(curThread, size, mbean.getThreadAllocatedBytes(id));
+    }
+
+    private static void testGetThreadAllocatedBytes()
+        throws Exception {
+
+        // start a thread
+        done = false; done1 = false;
+        Thread curThread = new MyThread("MyThread");
+        curThread.start();
+        long id = curThread.getId();
+
+        // wait for thread to block after doing some allocation
+        waitUntilThreadBlocked(curThread);
+
+        long size = mbean.getThreadAllocatedBytes(id);
+        ensureValidSize(size);
+
+        // let thread go to do some more allocation
+        synchronized (obj) {
+            done = true;
+            obj.notifyAll();
         }
-        System.out.println(curThread.getName() +
-            " Current thread allocated bytes = " + size +
-            " allocated bytes = " + size1);
+
+        // wait for thread to get going again. we don't care if we
+        // catch it in mid-execution or if it hasn't
+        // restarted after we're done sleeping.
+        goSleep(400);
+
+        checkResult(curThread, size, mbean.getThreadAllocatedBytes(id));
+
+        // let thread exit
+        synchronized (obj) {
+            done1 = true;
+            obj.notifyAll();
+        }
 
+        try {
+            curThread.join();
+        } catch (InterruptedException e) {
+            System.out.println("Unexpected exception is thrown.");
+            e.printStackTrace(System.out);
+        }
+    }
 
-        // start threads, wait for them to block
+    private static void testGetThreadsAllocatedBytes()
+        throws Exception {
+
+        // start threads
+        done = false; done1 = false;
         for (int i = 0; i < NUM_THREADS; i++) {
             threads[i] = new MyThread("MyThread-" + i);
             threads[i].start();
         }
 
-        // threads block after doing some allocation
-        waitUntilThreadBlocked();
+        // wait for threads to block after doing some allocation
+        waitUntilThreadsBlocked();
 
         for (int i = 0; i < NUM_THREADS; i++) {
             sizes[i] = mbean.getThreadAllocatedBytes(threads[i].getId());
+            ensureValidSize(sizes[i]);
         }
 
-        // let threads go and do some more allocation
+        // let threads go to do some more allocation
         synchronized (obj) {
             done = true;
             obj.notifyAll();
         }
 
-        // wait for threads to get going again.  we don't care if we
+        // wait for threads to get going again. we don't care if we
         // catch them in mid-execution or if some of them haven't
         // restarted after we're done sleeping.
         goSleep(400);
 
         for (int i = 0; i < NUM_THREADS; i++) {
-            long newSize = mbean.getThreadAllocatedBytes(threads[i].getId());
-            if (sizes[i] > newSize) {
-                throw new RuntimeException("TEST FAILED: " +
-                    threads[i].getName() +
-                    " previous allocated bytes = " + sizes[i] +
-                    " > current allocated bytes = " + newSize);
-            }
-            System.out.println(threads[i].getName() +
-                " Previous allocated bytes = " + sizes[i] +
-                " Current allocated bytes = " + newSize);
+            checkResult(threads[i], sizes[i],
+                        mbean.getThreadAllocatedBytes(threads[i].getId()));
         }
 
         // let threads exit
@@ -148,17 +203,30 @@
             } catch (InterruptedException e) {
                 System.out.println("Unexpected exception is thrown.");
                 e.printStackTrace(System.out);
-                testFailed = true;
                 break;
             }
         }
-        if (testFailed) {
-            throw new RuntimeException("TEST FAILED");
+    }
+
+    private static void ensureValidSize(long size) {
+        // implementation could have started measurement when
+        // measurement was enabled, in which case size can be 0
+        if (size < 0) {
+            throw new RuntimeException(
+                "Invalid allocated bytes returned = " + size);
         }
-
-        System.out.println("Test passed");
     }
 
+    private static void checkResult(Thread curThread,
+                                    long prev_size, long curr_size) {
+        if (curr_size < prev_size) {
+            throw new RuntimeException("Allocated bytes " + curr_size +
+                                       " expected >= " + prev_size);
+        }
+        System.out.println(curThread.getName() +
+                           " Previous allocated bytes = " + prev_size +
+                           " Current allocated bytes = " + curr_size);
+    }
 
     private static void goSleep(long ms) throws Exception {
         try {
@@ -169,7 +237,18 @@
         }
     }
 
-    private static void waitUntilThreadBlocked()
+    private static void waitUntilThreadBlocked(Thread thread)
+        throws Exception {
+        while (true) {
+            goSleep(100);
+            ThreadInfo info = mbean.getThreadInfo(thread.getId());
+            if (info.getThreadState() == Thread.State.WAITING) {
+                break;
+            }
+        }
+    }
+
+    private static void waitUntilThreadsBlocked()
         throws Exception {
         int count = 0;
         while (count != NUM_THREADS) {
@@ -210,7 +289,6 @@
                     } catch (InterruptedException e) {
                         System.out.println("Unexpected exception is thrown.");
                         e.printStackTrace(System.out);
-                        testFailed = true;
                         break;
                     }
                 }
@@ -225,7 +303,7 @@
                 " ThreadAllocatedBytes  = " + size2);
 
             if (size1 > size2) {
-                throw new RuntimeException("TEST FAILED: " + getName() +
+                throw new RuntimeException(getName() +
                     " ThreadAllocatedBytes = " + size1 +
                     " > ThreadAllocatedBytes = " + size2);
             }
@@ -237,7 +315,6 @@
                     } catch (InterruptedException e) {
                         System.out.println("Unexpected exception is thrown.");
                         e.printStackTrace(System.out);
-                        testFailed = true;
                         break;
                     }
                 }
--- a/test/demo/zipfs/ZipFSTester.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/demo/zipfs/ZipFSTester.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,7 @@
             test1(fs);
             test2(fs);   // more tests
             testTime(Paths.get(args[0]));
+            test8069211();
         }
     }
 
@@ -378,6 +379,29 @@
         Files.delete(fsPath);
     }
 
+    static void test8069211() throws Exception {
+        // create a new filesystem, copy this file into it
+        Map<String, Object> env = new HashMap<String, Object>();
+        env.put("create", "true");
+        Path fsPath = getTempPath();
+        try (FileSystem fs = newZipFileSystem(fsPath, env);) {
+            OutputStream out = Files.newOutputStream(fs.getPath("/foo"));
+            out.write("hello".getBytes());
+            out.close();
+            out.close();
+        }
+        try (FileSystem fs = newZipFileSystem(fsPath, new HashMap<String, Object>())) {
+            if (!Arrays.equals(Files.readAllBytes(fs.getPath("/foo")),
+                               "hello".getBytes())) {
+                throw new RuntimeException("entry close() failed");
+            }
+        } catch (Exception x) {
+            throw new RuntimeException("entry close() failed", x);
+        } finally {
+            Files.delete(fsPath);
+        }
+    }
+
     private static FileSystem newZipFileSystem(Path path, Map<String, ?> env)
         throws Exception
     {
--- a/test/demo/zipfs/basic.sh	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/demo/zipfs/basic.sh	Wed Feb 03 05:23:32 2021 +0000
@@ -22,7 +22,7 @@
 #
 # @test
 # @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 7007596
-# 7157656 8002390 7012868 7012856 8015728
+# 7157656 8002390 7012868 7012856 8015728 8069211
 # @summary Test ZipFileSystem demo
 # @build Basic PathOps ZipFSTester
 # @run shell basic.sh
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.*;
-
-class AbsoluteComponentCenterCalculator {
-    private AbsoluteComponentCenterCalculator() {
-    }
-
-    public static int calculateXCenterCoordinate(Component component) {
-        return (int) component.getLocationOnScreen().getX() + (component.getWidth() / 2);
-    }
-
-    public static int calculateYCenterCoordinate(Component component) {
-        return (int) component.getLocationOnScreen().getY() + (component.getHeight() / 2);
-    }
-}
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/DataFlavorSearcher.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.FlavorTable;
-import java.awt.datatransfer.SystemFlavorMap;
-import java.util.Arrays;
-
-public class DataFlavorSearcher {
-    static public String[] HTML_NAMES = new String[]{"HTML", "HTML Format"};
-    static public String[] RICH_TEXT_NAMES = new String[]{"RICH_TEXT", "Rich Text Format"};
-
-    static public DataFlavor getByteDataFlavorForNative(String[] nats) {
-        FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();
-
-        for (String nat : nats) {
-            java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
-            for (DataFlavor flavor : flavors) {
-                if (flavor != null
-                        && flavor.getRepresentationClass().equals(byte[].class)) {
-                    return flavor;
-                }
-            }
-        }
-        throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
-    }
-}
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, 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.
- */
-
-interface InterprocessMessages {
-    final static int EXECUTION_IS_SUCCESSFULL = 0;
-    final static int DATA_IS_CORRUPTED = 212;
-    final static int NO_DROP_HAPPENED = 112;
-}
-
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<!--
- Copyright (c) 2013, 2014, 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.
--->
-
-<html>
-<!--  
-  @test
-  @bug 8005932 8017456
-  @summary Java 7 on mac os x only provides text clipboard formats
-  @author mikhail.cherkasov@oracle.com
-  @library ../../regtesthelpers
-  @library ../../regtesthelpers/process
-  @build Util
-  @build ProcessResults ProcessCommunicator
-  @run applet/othervm MissedHtmlAndRtfBug.html
--->
-
-<head>
-    <title>Java 7 on mac os x only provides text clipboard formats</title>
-</head>
-<body>
-
-<h1> MissedHtmlAndRtfBug <br>Bug ID: 8005932 </h1>
-
-<p> This is an AUTOMATIC test, simply wait for completion </p>
-
-<APPLET CODE="MissedHtmlAndRtfBug.class" WIDTH=200 HEIGHT=200></APPLET>
-</body>
-</html>
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.*;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.event.*;
-import java.applet.Applet;
-import java.io.File;
-import java.util.ArrayList;
-
-import test.java.awt.regtesthelpers.process.ProcessCommunicator;
-import test.java.awt.regtesthelpers.process.ProcessResults;
-import test.java.awt.regtesthelpers.Util;
-import sun.awt.OSInfo;
-
-import static java.lang.Thread.sleep;
-
-public class MissedHtmlAndRtfBug extends Applet {
-
-    public void init() {
-        setLayout(new BorderLayout());
-    }//End  init()
-
-    public void start() {
-        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX
-                && OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
-            System.out.println("This test is for Windows and Mac only. Passed.");
-            return;
-        }
-
-        final Frame sourceFrame = new Frame("Source frame");
-        final SourcePanel sourcePanel = new SourcePanel();
-        sourceFrame.add(sourcePanel);
-        sourceFrame.pack();
-        sourceFrame.addWindowListener(new WindowAdapter() {
-            @Override
-            public void windowClosing(WindowEvent e) {
-                sourceFrame.dispose();
-            }
-        });
-        sourceFrame.setVisible(true);
-
-        Util.waitForIdle(null);
-
-        NextFramePositionCalculator positionCalculator = new NextFramePositionCalculator(sourceFrame);
-
-        ArrayList<String> args = new ArrayList<String>(5);
-        args.add(String.valueOf(positionCalculator.getNextLocationX()));
-        args.add(String.valueOf(positionCalculator.getNextLocationY()));
-        args.add(String.valueOf(AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(sourcePanel)));
-        args.add(String.valueOf(AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(sourcePanel)));
-        args.add(concatStrings(DataFlavorSearcher.RICH_TEXT_NAMES));
-
-        ProcessResults processResults =
-                ProcessCommunicator.executeChildProcess(this.getClass(),
-                        "." + File.separator + System.getProperty("java.class.path"), args.toArray(new String[]{}));
-
-        verifyTestResults(processResults);
-
-        args.set(args.size() - 1, concatStrings(DataFlavorSearcher.HTML_NAMES));
-
-        ProcessCommunicator.executeChildProcess(this.getClass(),
-                "." + File.separator + System.getProperty("java.class.path"), args.toArray(new String[]{}));
-        verifyTestResults(processResults);
-
-
-    }// start()
-
-    private String concatStrings(String[] strings) {
-        StringBuffer result = new StringBuffer("\"");
-        for (int i = 0; i < strings.length; i++) {
-            result.append(strings[i]);
-            result.append(",");
-        }
-        result.append("\"");
-        return result.toString();
-    }
-
-
-    private static void verifyTestResults(ProcessResults processResults) {
-        if (InterprocessMessages.DATA_IS_CORRUPTED ==
-                processResults.getExitValue()) {
-            processResults.printProcessErrorOutput(System.err);
-            throw new RuntimeException("TEST IS FAILED: Target has received" +
-                    " corrupted data.");
-        }
-        if (InterprocessMessages.NO_DROP_HAPPENED ==
-                processResults.getExitValue()) {
-            processResults.printProcessErrorOutput(System.err);
-            throw new RuntimeException("Error. Drop did not happen." +
-                " Target frame is possibly covered by a window of other application." +
-                " Please, rerun the test with all windows minimized.");
-        }
-        processResults.verifyStdErr(System.err);
-        processResults.verifyProcessExitValue(System.err);
-        processResults.printProcessStandartOutput(System.out);
-    }
-
-    //We cannot make an instance of the applet without the default constructor
-    public MissedHtmlAndRtfBug() {
-        super();
-    }
-
-    //We need in this constructor to pass frame position between JVMs
-    public MissedHtmlAndRtfBug(Point targetFrameLocation, Point dragSourcePoint, DataFlavor df)
-            throws InterruptedException {
-        final Frame targetFrame = new Frame("Target frame");
-        final TargetPanel targetPanel = new TargetPanel(targetFrame, df);
-        targetFrame.add(targetPanel);
-        targetFrame.addWindowListener(new WindowAdapter() {
-            @Override
-            public void windowClosing(WindowEvent e) {
-                targetFrame.dispose();
-            }
-        });
-        targetFrame.setLocation(targetFrameLocation);
-        targetFrame.pack();
-        targetFrame.setVisible(true);
-
-        doTest(dragSourcePoint, targetPanel);
-    }
-
-    private void doTest(Point dragSourcePoint, TargetPanel targetPanel) {
-        Util.waitForIdle(null);
-
-        final Robot robot = Util.createRobot();
-
-        robot.mouseMove((int) dragSourcePoint.getX(), (int) dragSourcePoint.getY());
-        try {
-            sleep(100);
-            robot.mousePress(InputEvent.BUTTON1_MASK);
-            sleep(100);
-            robot.mouseRelease(InputEvent.BUTTON1_MASK);
-            sleep(100);
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-
-        Util.drag(robot, dragSourcePoint, new Point(AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(targetPanel),
-                AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(targetPanel)),
-                InputEvent.BUTTON1_MASK);
-    }
-
-
-    enum InterprocessArguments {
-        TARGET_FRAME_X_POSITION_ARGUMENT,
-        TARGET_FRAME_Y_POSITION_ARGUMENT,
-        DRAG_SOURCE_POINT_X_ARGUMENT,
-        DRAG_SOURCE_POINT_Y_ARGUMENT,
-        DATA_FLAVOR_NAMES;
-
-        int extractInt(String[] args) {
-            return Integer.parseInt(args[this.ordinal()]);
-        }
-
-        String[] extractStringArray(String[] args) {
-            return args[this.ordinal()].replaceAll("\"", "").split(",");
-        }
-    }
-
-    public static void main(String[] args) throws InterruptedException {
-        Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extractInt(args),
-                InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extractInt(args));
-        Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extractInt(args),
-                InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extractInt(args));
-        String[] names = InterprocessArguments.DATA_FLAVOR_NAMES.extractStringArray(args);
-
-        DataFlavor df = DataFlavorSearcher.getByteDataFlavorForNative(names);
-        try {
-            new MissedHtmlAndRtfBug(targetFrameLocation, dragSourcePoint, df);
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        sleep(5000);
-        System.exit(InterprocessMessages.NO_DROP_HAPPENED);
-    }
-
-
-}
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MyTransferable.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.datatransfer.*;
-import java.io.IOException;
-
-class MyTransferable implements Transferable {
-
-    public static final String TEST_DATA = "<b>Test</b>";
-    private DataFlavor[] dataFlavors;
-
-    public MyTransferable() {
-        dataFlavors = new DataFlavor[]{DataFlavorSearcher.getByteDataFlavorForNative(DataFlavorSearcher.HTML_NAMES),
-                DataFlavorSearcher.getByteDataFlavorForNative(DataFlavorSearcher.RICH_TEXT_NAMES)};
-    }
-
-
-    @Override
-    public DataFlavor[] getTransferDataFlavors() {
-        return dataFlavors;
-    }
-
-    @Override
-    public boolean isDataFlavorSupported(DataFlavor flavor) {
-        for (DataFlavor f : dataFlavors) {
-            if (f.equals(flavor)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public Object getTransferData(DataFlavor flavor)
-            throws UnsupportedFlavorException, IOException {
-        if (isDataFlavorSupported(flavor)) {
-            return TEST_DATA.getBytes("UTF-16");
-        } else {
-            throw new UnsupportedFlavorException(flavor);
-        }
-    }
-}
\ No newline at end of file
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/NextFramePositionCalculator.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.*;
-
-
-class NextFramePositionCalculator {
-
-    private final Frame currentFrame;
-
-    public NextFramePositionCalculator(Frame currentFrame) {
-        this.currentFrame = currentFrame;
-    }
-
-    public int getNextLocationX() {
-        return currentFrame.getX() + currentFrame.getWidth();
-    }
-
-    public int getNextLocationY() {
-        return currentFrame.getY();
-    }
-
-}
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/SourcePanel.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.dnd.DragSource;
-import java.awt.dnd.DnDConstants;
-import java.awt.dnd.DragGestureEvent;
-import java.awt.dnd.DragGestureListener;
-import java.awt.*;
-
-public class SourcePanel extends Panel {
-
-    private final MyDragGestureListener dragGestureListener =
-            new MyDragGestureListener();
-
-    public SourcePanel() {
-        setPreferredSize(new Dimension(200, 200));
-        DragSource defaultDragSource =
-                DragSource.getDefaultDragSource();
-        defaultDragSource.createDefaultDragGestureRecognizer(this,
-                DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener);
-        setBackground(Color.RED);
-    }
-
-    private class MyDragGestureListener implements DragGestureListener {
-        public void dragGestureRecognized(DragGestureEvent dge) {
-            dge.startDrag(null, new MyTransferable());
-        }
-    }
-}
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/TargetPanel.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.datatransfer.Transferable;
-import java.awt.dnd.*;
-import java.awt.*;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-import java.util.Timer;
-import java.util.TimerTask;
-
-public class TargetPanel extends Panel implements DropTargetListener {
-
-
-    //private final CustomDropTargetListener dropTargetListener = new CustomDropTargetListener();
-
-    private Frame frame;
-    DataFlavor dataFlavor;
-
-    public TargetPanel(Frame frame, DataFlavor dataFlavor) {
-        this.dataFlavor = dataFlavor;
-        this.frame = frame;
-        setBackground(Color.DARK_GRAY);
-        setPreferredSize(new Dimension(200, 200));
-        setDropTarget(new DropTarget(this, this));
-    }
-
-    public void dragEnter(DropTargetDragEvent dtde) {
-        if (dtde.isDataFlavorSupported(dataFlavor)) {
-            dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
-        }
-    }
-
-    public void dragOver(DropTargetDragEvent dtde) {
-        if (dtde.isDataFlavorSupported(dataFlavor)) {
-            dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
-        }
-    }
-
-    public void dropActionChanged(DropTargetDragEvent dtde) {
-        if (dtde.isDataFlavorSupported(dataFlavor)) {
-            dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
-        }
-    }
-
-    public void dragExit(DropTargetEvent dte) {
-
-    }
-
-    public void drop(DropTargetDropEvent dtde) {
-        dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
-        if (dtde.isDataFlavorSupported(dataFlavor)) {
-            String result = null;
-            try {
-                Transferable t = dtde.getTransferable();
-                byte[] data = (byte[]) dtde.getTransferable().getTransferData(dataFlavor);
-                result = new String(data, "UTF-16");
-                repaint();
-            } catch (UnsupportedFlavorException e) {
-                e.printStackTrace();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-            dtde.dropComplete(true);
-
-
-            if (result != null && result.contains(MyTransferable.TEST_DATA)) {
-                System.err.println(InterprocessMessages.EXECUTION_IS_SUCCESSFULL);
-                Timer t = new Timer();
-                t.schedule(new TimerTask() {
-                    @Override
-                    public void run() {
-                        System.exit(0);
-                    }
-                }, 2000);
-                return;
-
-            }
-        }
-        dtde.rejectDrop();
-        System.err.println(InterprocessMessages.DATA_IS_CORRUPTED);
-        System.exit(InterprocessMessages.DATA_IS_CORRUPTED);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/EventQueue/NonComponentSourcePost.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AWTEvent;
+import java.awt.ActiveEvent;
+import java.awt.EventQueue;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @test
+ * @bug 4137796
+ * @summary Checks that the posting of events whose sources are not Components
+ *          does not corrupt the EventQueue.
+ */
+public class NonComponentSourcePost {
+
+    public static final int COUNT = 100;
+    public static CountDownLatch go = new CountDownLatch(COUNT);
+
+    public static void main(String[] args) throws Throwable {
+        EventQueue q = new EventQueue();
+        for (int i = 0; i < COUNT; i++) {
+            q.postEvent(new NewActionEvent());
+        }
+        if (!go.await(30, TimeUnit.SECONDS)) {
+            throw new RuntimeException("Timeout");
+        }
+        AWTEvent event = q.peekEvent();
+        if (event != null) {
+            throw new Exception("Non null event: " + event);
+        }
+
+        if (NewActionEvent.result != NewActionEvent.sum) {
+            throw new Exception("result: " + NewActionEvent.result +
+                                "  sum: " + NewActionEvent.sum);
+        }
+        // Simple way to shutdown the AWT machinery
+        Toolkit.getDefaultToolkit().getSystemEventQueue().push(q);
+    }
+
+    static class NewActionEvent extends ActionEvent implements ActiveEvent {
+        static int counter = 1;
+        static int sum = 0;
+        static int result = 0;
+
+        int myval;
+
+        public NewActionEvent() {
+            super("", ACTION_PERFORMED, "" + counter);
+            myval = counter++;
+            sum += myval;
+        }
+
+        public synchronized void dispatch() {
+            result += myval;
+            try {
+                wait(100);
+            } catch (InterruptedException e) {
+            }
+            go.countDown();
+        }
+    }
+}
--- a/test/java/awt/Focus/ModalDialogActivationTest/ModalDialogActivationTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/awt/Focus/ModalDialogActivationTest/ModalDialogActivationTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -23,15 +23,21 @@
  * questions.
  */
 
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
 
 /*
   @test
-  @bug       8160570
-  @summary   Tests that a modal dialog receives WINDOW_ACTIVATED & WINDOW_GAINED_FOCUS on first show.
+  @key headful
+  @bug 8160570 8166015
+  @summary Tests that a modal dialog receives WINDOW_ACTIVATED
+            & WINDOW_GAINED_FOCUS on first show.
 */
+
 public class ModalDialogActivationTest {
     static final Object lock = new Object();
     static volatile boolean activated;
@@ -48,7 +54,8 @@
             }
         }
         if (!activated || !focused) {
-            throw new RuntimeException("Test FAILED: activated: " + activated + ", focused: " + focused);
+            throw new RuntimeException("Test FAILED: activated: " + activated
+                                        + ", focused: " + focused);
         }
         System.out.println("Test PASSED");
     }
@@ -79,7 +86,7 @@
     }
 
     static class MyModalDialog extends JDialog {
-        public MyModalDialog(Frame owner, String title)ª {
+        public MyModalDialog(Frame owner, String title) {
             super(owner, title, true);
         }
 
--- a/test/java/awt/Toolkit/Headless/WrappedToolkitTest/WrappedToolkitTest.sh	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/awt/Toolkit/Headless/WrappedToolkitTest/WrappedToolkitTest.sh	Wed Feb 03 05:23:32 2021 +0000
@@ -59,7 +59,7 @@
 # Checking for proper OS
 OS=`uname -s`
 case "$OS" in
-   SunOS | Linux | Darwin | CYGWIN* )
+   AIX | SunOS | Linux | Darwin | CYGWIN* )
       FILESEP="/"
       ;;
     
@@ -144,7 +144,7 @@
     fi
     ;;
 
-  SunOS | Linux )
+  AIX | SunOS | Linux )
     ${TESTJAVA}/bin/java -Djava.awt.headless=true \
                          -Dawt.toolkit=sun.awt.X11.XToolkit \
                          TestWrapped sun.awt.X11.XToolkit
--- a/test/java/awt/TrayIcon/DragEventSource/DragEventSource.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/awt/TrayIcon/DragEventSource/DragEventSource.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, 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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,8 @@
 
 /*
   @test
-  @bug 6565779
-  @library ../../../regtesthelpers
+  @bug 6565779 8168292
+  @library ../../regtesthelpers
   @compile DragEventSource.java
   @summary Exception if source of some event is TrayIcon
   @author Andrei Dmitriev: area=awt.tray
@@ -38,9 +38,19 @@
  * instance as source.
  */
 
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
+import java.awt.Button;
+import java.awt.Dialog;
+import java.awt.FileDialog;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.Image;
+import java.awt.Panel;
+import java.awt.SystemTray;
+import java.awt.TextArea;
+import java.awt.TrayIcon;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.image.BufferedImage;
 
 public class DragEventSource
 {
@@ -81,11 +91,10 @@
 
         String[] instructions =
         {
-            "Use see a Frame with a button in it.",
-            "Press the button. FileDialog should appear.",
-            "Drag the mouse from the Tray icon to FileDialog ",
-            "using left mouse button.",
-            "If exception happens, the test fails.",
+            "Click 'Open file dialog' button. FileDialog should appear.",
+            "Using left mouse button,",
+            "Drag the mouse from the Tray icon to FileDialog.",
+            "If exception is thrown, the test fails.",
             "Otherwise, pass."
         };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/TrayIcon/SecurityCheck/NoPermissionTest/tray.policy	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,3 @@
+//NoPermission Test
+grant{
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/DataFlavorCloneTest/DataFlavorCloneTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4181601
+  @summary tests that DataFlavor.clone method doesn't throw exception
+  @author xianfa: area=
+  @run main DataFlavorCloneTest
+*/
+
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorCloneTest {
+
+    public static void main(String[] args) throws Exception {
+        DataFlavor df1 = null;
+        Object df2 = null;
+        try {
+            df1 = new DataFlavor();
+            df2 = df1.clone();
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException("FAILED: Unexpected exception: " + e);
+        } catch (NullPointerException e) {
+            throw new RuntimeException("FAILED: Got Null pointer exception");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsNullTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4175731
+  @summary DataFlavor.equals(null) throws NullPointerException
+  @author prs@sparc.spb.su: area=
+  @run main DataFlavorEqualsNullTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorEqualsNullTest {
+    public static boolean finished = false;
+    static boolean noexc = true;
+    static boolean eq = false;
+    static DataFlavor df = null;
+
+    public static void main(String[] args) throws Exception {
+
+        try {
+            df = new DataFlavor("application/postscript;class=java.awt.datatransfer.DataFlavor");
+        } catch (ClassNotFoundException e) {
+            // This should never happen
+        }
+        try {
+            eq = df.equals((Object) null);
+            if (eq) noexc = false;
+            eq = df.equals((DataFlavor) null);
+            if (eq) noexc = false;
+            eq = df.equals((String) null);
+            if (eq) noexc = false;
+        } catch (NullPointerException e1) {
+            noexc = false;
+        }
+        finished = true;
+        if (!noexc)
+            throw new RuntimeException("Test FAILED");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/DataFlavorEqualsTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4175341
+  @summary DataFlavor.equals throws NullPointerException
+  @author prs@sparc.spb.su: area=
+  @run main DataFlavorEqualsTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorEqualsTest {
+     public static boolean finished = false;
+     static boolean noexc = true;
+     static boolean eq = false;
+     static DataFlavor df = null;
+
+     public static void main(String[] args) {
+         df = new DataFlavor();
+         try {
+             eq = df.equals((Object)new DataFlavor());
+             if (!eq) noexc = false;
+             eq = df.equals(new DataFlavor());
+             if (!eq) noexc = false;
+             eq = df.equals("application/postscript;class=java.awt.datatransfer.DataFlavor");
+             if (eq) noexc = false;
+         } catch (NullPointerException e1) {
+             noexc = false;
+         }
+         finished = true;
+         if (!noexc)
+             throw new RuntimeException("Test FAILED");
+
+     }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/DataFlavorFileListTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4172848
+  @summary DataFlavor.isFlavorJavaFileListType works wrong
+  @author prs@sparc.spb.su: area=
+  @run main DataFlavorFileListTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorFileListTest {
+     public static boolean finished = false;
+     static DataFlavor df = null;
+
+     public static void main(String[] args) throws Exception {
+         df = new DataFlavor("application/x-java-file-list;class=java.util.ArrayList");
+         boolean fl = df.isFlavorJavaFileListType();
+         finished = true;
+         if (!fl)
+             throw new RuntimeException("Test FAILED");
+     }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/DataFlavorSerializedTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4174020
+  @summary DataFlavor.isMimeTypeSerializedObject works wrong
+  @author prs@sparc.spb.su: area=
+  @run main DataFlavorSerializedTest
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+
+public class DataFlavorSerializedTest {
+     public static boolean finished = false;
+     static DataFlavor df = null;
+
+     public static void main(String[] args) throws Exception {
+         df = new DataFlavor("application/x-java-serialized-object;class=java.io.Serializable");
+         boolean fl = df.isMimeTypeSerializedObject();
+         finished = true;
+         if (!fl)
+             throw new RuntimeException("Test FAILED");
+     }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/DefaultMatchTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4250750
+  @summary tests that DataFlavor.match() does not throw NPE.
+  @author prs@sparc.spb.su: area=
+  @run main DefaultMatchTest
+*/
+
+
+import java.awt.datatransfer.DataFlavor;
+
+public class DefaultMatchTest {
+
+    static DataFlavor df1, df2, df3;
+
+    public static void main(String[] args) throws Exception {
+        boolean passed = true;
+        try {
+            df1 = new DataFlavor("application/postscript");
+            df2 = new DataFlavor();
+            df3 = new DataFlavor();
+        } catch (ClassNotFoundException e1) {
+            throw new RuntimeException("Could not create DataFlavors. This should never happen.");
+        } catch (IllegalArgumentException e2) {
+            passed = false;
+        }
+        try {
+            boolean b;
+            b = df1.match(df2);
+            b = df2.match(df1);
+            b = df2.match(df3);
+        } catch (NullPointerException e) {
+            throw new RuntimeException("The test FAILED: DataFlavor.match still throws NPE");
+        }
+        if (!passed) {
+            throw new RuntimeException("Test FAILED");
+        }
+        System.out.println("Test PASSED");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/EqualHashCodeTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4157612
+  @summary tests that certain awt classes do not break basic hashCode() contract.
+  @author prs@sparc.spb.su: area=
+  @run main EqualHashCodeTest
+*/
+
+import java.awt.*;
+import java.awt.color.ColorSpace;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
+
+public class EqualHashCodeTest {
+
+     static DataFlavor df1, df2;
+     static Insets insets1, insets2;
+     static Dimension dim1, dim2;
+     static ColorModel cm1, cm2;
+     static int[] ColorModelBits = { 8, 8, 8, 8 };
+
+     public static void main(String[] args) throws Exception {
+         boolean passed = true;
+         try {
+             df1 = new DataFlavor( "application/postscript" );
+             df2 = new DataFlavor( "application/*" );
+         } catch (ClassNotFoundException e1) {
+             throw new RuntimeException("Could not create DataFlavors. This should never happen.");
+         } catch (IllegalArgumentException e2) {
+             passed = false;
+         }
+         if (df1.hashCode() != df2.hashCode()) {
+             passed = false;
+         }
+         dim1 = new Dimension(3, 18);
+         dim2 = new Dimension(3, 18);
+         if (dim1.hashCode() != dim2.hashCode()) {
+             passed = false;
+         }
+         insets1 = new Insets(3, 4, 7, 11);
+         insets2 = new Insets(3, 4, 7, 11);
+         if (insets1.hashCode() != insets2.hashCode()) {
+             passed = false;
+         }
+         cm1 = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+                                       ColorModelBits, true, true,
+                                       Transparency.OPAQUE, 0);
+         cm2 = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+                                       ColorModelBits, true, true,
+                                       Transparency.OPAQUE, 0);
+         if (cm1.hashCode() != cm2.hashCode()) {
+             passed = false;
+         }
+         if (!passed)
+             throw new RuntimeException("Test FAILED");
+     }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/ExternalizeTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4274267
+  @summary Tests that externalized DataFlavor is restored properly
+  @author prs@sparc.spb.su: area=
+  @run main ExternalizeTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+public class ExternalizeTest {
+
+   public static void main(String[] args) {
+       DataFlavor df = new DataFlavor("text/enriched; charset=ascii", "Enrich Flavor");
+
+       storeDataFlavor(df);
+       DataFlavor df1 = retrieveDataFlavor();
+
+       if (!df.equals(df1)) {
+           throw new RuntimeException("FAILED: restored DataFlavor is not equal to externalized one");
+       }
+
+   }
+
+   public static void storeDataFlavor(DataFlavor dfs){
+       // To store the dataflavor into a file using writeExternal()
+       try {
+           FileOutputStream ostream = new FileOutputStream("t.tmp");
+           ObjectOutputStream p = new ObjectOutputStream(ostream);
+           dfs.writeExternal(p);
+           ostream.close();
+
+       } catch (Exception ex){
+           throw new RuntimeException("FAIL: problem occured while storing DataFlavor");
+       }
+   }
+
+
+   public static DataFlavor retrieveDataFlavor(){
+       DataFlavor df=DataFlavor.stringFlavor;
+       try {
+           FileInputStream istream = new FileInputStream("t.tmp");
+           ObjectInputStream p = new ObjectInputStream(istream);
+           df.readExternal(p);
+           istream.close();
+       } catch (Exception ex){
+           throw new RuntimeException("FAIL: problem occured while retrieving DataFlavor");
+       }
+
+       return df;
+   }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/GetReaderForTextIAEForStringSelectionTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4260874
+  @summary Tests that DataFlavor.getReaderForText do not throw NPE when transferObject is null
+  @author tdv@sparc.spb.su: area=
+  @run main GetReaderForTextIAEForStringSelectionTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.StringSelection;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.io.Reader;
+
+public class GetReaderForTextIAEForStringSelectionTest  {
+
+   public static void main(String[] args) throws Exception {
+      DataFlavor pt ;
+
+      try {
+          pt = DataFlavor.plainTextFlavor;
+          StringSelection ss = new StringSelection("ReaderExample");
+          Reader re = pt.getReaderForText(ss);
+          if(re == null) {
+              throw new RuntimeException("Test FAILED! reader==null");
+          }
+      } catch (Exception e) {
+          throw new RuntimeException("Test FAILED because of the exception: " + e);
+      }
+    }
+
+ }
+
+class FakeTransferable implements Transferable {
+    public DataFlavor[] getTransferDataFlavors() {
+        return null;
+    }
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        return false;
+    }
+    public Object getTransferData(DataFlavor flavor) throws
+        UnsupportedFlavorException, IOException {
+        return null;
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/GetReaderForTextNPETest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4260874
+  @summary Tests that DataFlavor.getReaderForText do not throw NPE when transferObject is null
+  @author tdv@sparc.spb.su: area=
+  @run main GetReaderForTextNPETest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.io.Reader;
+
+public class GetReaderForTextNPETest {
+
+    public static void main(String[] args) {
+        DataFlavor df = new DataFlavor();
+        FakeTransferable t = new FakeTransferable();
+        Reader reader;
+        try {
+            reader = df.getReaderForText(null);
+        } catch (Exception e) {
+            if (!(e instanceof NullPointerException)) {
+                throw new RuntimeException("TEST FAILED: not a NPE thrown on a null argument.");
+            }
+        }
+        try {
+            reader = df.getReaderForText(t);
+        } catch (Exception e) {
+            if (!(e instanceof IllegalArgumentException)) {
+                throw new RuntimeException("FAILED: not an IllegalArgumentException thrown on a transferable with null transfer data .");
+            }
+        }
+    }
+}
+
+class FakeTransferable implements Transferable {
+    public DataFlavor[] getTransferDataFlavors() {
+        return null;
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        return false;
+    }
+
+    public Object getTransferData(DataFlavor flavor) throws
+            UnsupportedFlavorException, IOException {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/MimeTypeSerializationTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4116781
+  @summary Tests that long (more than 64K) MimeType can be serialized
+           and deserialized.
+  @author gas@sparc.spb.su area=datatransfer
+  @run main MimeTypeSerializationTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Arrays;
+
+public class MimeTypeSerializationTest {
+
+    public static void main(String[] args) throws Exception {
+        boolean failed = false;
+
+        try {
+            int len = 70000;
+            char[] longValue = new char[len];
+            Arrays.fill(longValue, 'v');
+            DataFlavor longdf = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType +
+                "; class=java.lang.String; longParameter=" + new String(longValue));
+
+            DataFlavor shortdf = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType +
+                "; class=java.lang.String");
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream(100000);
+            ObjectOutputStream oos = new ObjectOutputStream(baos);
+            oos.writeObject(longdf);
+            oos.writeObject(shortdf);
+            oos.close();
+
+            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            ObjectInputStream ois = new ObjectInputStream(bais);
+            DataFlavor longdf2 = (DataFlavor) ois.readObject();
+            DataFlavor shortdf2 = (DataFlavor) ois.readObject();
+            ois.close();
+
+            failed = !( longdf.getMimeType().equals(longdf2.getMimeType()) &&
+                shortdf.getMimeType().equals(shortdf2.getMimeType()) );
+            if (failed) {
+                System.err.println("deserialized MIME type does not match original one");
+            }
+        } catch (IOException e) {
+            failed = true;
+            e.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        if (failed) {
+            throw new RuntimeException("test failed: serialization attempt failed");
+        } else {
+            System.err.println("test passed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/NoClassParameterTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4212613
+  @summary tests that DataFlavor(String) doesn't through Exception if no "class=" specified.
+  @author prs@sparc.spb.su: area=
+  @run main NoClassParameterTest
+*/
+
+
+import java.awt.datatransfer.DataFlavor;
+
+public class NoClassParameterTest {
+     static DataFlavor df = null;
+
+     public static void main(String[] args) {
+         boolean passed = true;
+         try {
+             df = new DataFlavor("application/postscript");
+         } catch (ClassNotFoundException e1) {
+             throw new RuntimeException("This should never happen.");
+         } catch (IllegalArgumentException e2) {
+             passed = false;
+         }
+         if (!passed)
+             throw new RuntimeException("Test FAILED");
+     }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/NormalizeMimeTypeParameter.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+  @test
+  @bug 4260860
+  @summary tests that DataFlavor.normalizeMimeTypeParameter() returns parm value
+  @author ssi@sparc.spb.su area=
+  @run main NormalizeMimeTypeParameter
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class NormalizeMimeTypeParameter {
+
+  static class TestFlavor extends DataFlavor {
+    public String normalizeMimeType(String mimeType) {
+      return super.normalizeMimeType(mimeType);
+    }
+    public String normalizeMimeTypeParameter(String parameterName,
+                                             String parameterValue) {
+      return super.normalizeMimeTypeParameter(parameterName, parameterValue);
+    }
+  }
+
+  static TestFlavor testFlavor;
+
+  public static void main(String[] args) {
+    testFlavor = new TestFlavor();
+
+    String type = "TestType";
+    String parameter = "TestParameter";
+
+    String retValue = testFlavor.normalizeMimeTypeParameter(type, parameter);
+    if(!retValue.equals(parameter)) {
+      throw new RuntimeException("Test FAILED: " + retValue);
+    }
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/NullDataFlavorTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4682039
+  @summary Tests that DataTransferer.getFormatsForFlavors() does not throw
+           NullPointerException if some of given as parameter data flavors
+           are null.
+  @author gas@sparc.spb.su area=datatransfer
+  @run main NullDataFlavorTest
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+
+public class NullDataFlavorTest {
+
+    private final static Clipboard clipboard =
+        Toolkit.getDefaultToolkit().getSystemClipboard();
+
+    public static void main(String[] args) throws Exception {
+        boolean failed = false;
+
+        try {
+            clipboard.setContents(new NullSelection("DATA1",
+                new DataFlavor[] { null, null, null }), null);
+            clipboard.setContents(new NullSelection("DATA2",
+                new DataFlavor[] { null, DataFlavor.stringFlavor, null }), null);
+            clipboard.setContents(new NullSelection("DATA3", null), null);
+        } catch (NullPointerException e) {
+            failed = true;
+            e.printStackTrace();
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+
+        if (failed) {
+            throw new RuntimeException("test failed: NullPointerException " +
+            "has been thrown");
+        } else {
+            System.err.println("test passed");
+        }
+    }
+}
+
+class NullSelection implements Transferable {
+
+    private final DataFlavor[] flavors;
+
+    private final String data;
+
+    public NullSelection(String data, DataFlavor[] flavors) {
+        this.data = data;
+        this.flavors = flavors;
+    }
+
+    @Override
+    public DataFlavor[] getTransferDataFlavors() {
+        return flavors;
+    }
+
+    @Override
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        for (DataFlavor fl : flavors) {
+            if (flavor.equals(fl)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public Object getTransferData(DataFlavor flavor)
+        throws UnsupportedFlavorException, java.io.IOException
+    {
+        for (DataFlavor fl : flavors) {
+            if (flavor.equals(fl)) {
+                return data;
+            }
+        }
+        throw new UnsupportedFlavorException(flavor);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/ReaderForUnicodeText.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4274234
+  @summary Tests that DataFlavor.getReaderForText() doesn't throw UnsupportedEncodingException for unicode text
+  @author prs@sparc.spb.su: area=
+  @run main ReaderForUnicodeText
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+
+public class ReaderForUnicodeText {
+
+   public static void main(String[] args) throws Exception {
+      DataFlavor df = DataFlavor.plainTextFlavor;
+      TextTransferable t = new TextTransferable();
+      Reader reader;
+      try {
+          reader = df.getReaderForText(t);
+      } catch (UnsupportedEncodingException e) {
+           throw new RuntimeException("FAILED: Exception thrown in getReaderForText()");
+      }
+    }
+}
+
+class TextTransferable implements Transferable {
+
+    String text = "Try to test me...";
+
+    @Override
+    public DataFlavor[] getTransferDataFlavors() {
+        DataFlavor flavors[] = {DataFlavor.plainTextFlavor};
+        return flavors;
+    }
+
+    @Override
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        if (flavor.match(DataFlavor.plainTextFlavor)) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public Object getTransferData(DataFlavor flavor) throws
+        UnsupportedFlavorException, IOException {
+
+        byte[] textBytes = null;
+
+        if (!isDataFlavorSupported(flavor)) {
+            throw new UnsupportedFlavorException(flavor);
+        }
+        String encoding = flavor.getParameter("charset");
+        if (encoding == null) {
+            textBytes = text.getBytes();
+        } else {
+            textBytes = text.getBytes(encoding);
+        }
+        return new ByteArrayInputStream(textBytes);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/SelectBestFlavorNPETest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4370469
+  @summary tests that selectBestTextFlavor doesn't throw NPE
+  @author prs@sparc.spb.su: area=
+  @run main SelectBestFlavorNPETest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class SelectBestFlavorNPETest {
+
+    public static void main(String[] args) {
+
+        DataFlavor flavor1 = new DataFlavor("text/plain; charset=unicode; class=java.io.InputStream",
+                "Flavor 1");
+        DataFlavor flavor2 = new DataFlavor("text/plain; class=java.io.InputStream", "Flavor 2");
+        DataFlavor[] flavors = new DataFlavor[]{flavor1, flavor2};
+        try {
+            DataFlavor best = DataFlavor.selectBestTextFlavor(flavors);
+            System.out.println("best=" + best);
+        } catch (NullPointerException e1) {
+            throw new RuntimeException("Test FAILED because of NPE in selectBestTextFlavor");
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/SelectBestTextFlavorBadArrayTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4386360
+  @summary tests that DataFlavor.selectBestTextFlavor() returns null when passed
+           is a null array or an empty array or an array which doesn't contain
+           a text flavor in a supported encoding.
+  @author das@sparc.spb.su area=datatransfer
+  @run main SelectBestTextFlavorBadArrayTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.util.Stack;
+import java.util.stream.Collectors;
+
+public class SelectBestTextFlavorBadArrayTest {
+
+    public static void main(String[] args) {
+        final String[] failureMessages = {
+            "DataFlavor.selectBestTextFlavor(null) doesn't return null.",
+            "DataFlavor.selectBestTextFlavor() doesn't return null for an empty array.",
+            "DataFlavor.selectBestTextFlavor() shouldn't return flavor in an unsupported encoding."
+        };
+        Stack<String> failures = new Stack<>();
+
+        DataFlavor flavor = DataFlavor.selectBestTextFlavor(null);
+        if (flavor != null) {
+            failures.push(failureMessages[0]);
+        }
+        flavor = DataFlavor.selectBestTextFlavor(new DataFlavor[0]);
+        if (flavor != null) {
+            failures.push(failureMessages[1]);
+        }
+
+        try {
+            flavor = DataFlavor.selectBestTextFlavor(new DataFlavor[]
+                { new DataFlavor("text/plain; charset=unsupported; class=java.io.InputStream") });
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+            failures.push("Exception thrown: " + e.toString());
+        }
+        if (flavor != null) {
+            failures.push(failureMessages[2]);
+        }
+
+        if (failures.size() > 0) {
+            String failureReport = failures.stream().collect(Collectors.joining("\n"));
+            throw new RuntimeException("TEST FAILED: \n" + failureReport);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/ToStringNullPointerTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+  @test
+  @bug 4250768
+  @summary tests that DataFlavor.toString() does not throw NPE
+  @author prs@sparc.spb.su: area=
+  @run main ToStringNullPointerTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+
+public class ToStringNullPointerTest {
+
+     static DataFlavor df1;
+
+     public static void main(String[] args) {
+         df1 = new DataFlavor();
+         try {
+             String thisDF = df1.toString();
+         } catch (NullPointerException e) {
+             throw new RuntimeException("Test FAILED: it still throws NPE!");
+         }
+     }
+}
+
--- a/test/java/awt/datatransfer/DuplicatedNativesTest/DuplicatedNativesTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.SystemFlavorMap;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-/* @test
- * @bug 8028230
- * @summary Checks that SystemFlavorMap.getNativesForFlavor returns a list without duplicates
- * @author Petr Pchelko
- * @run main DuplicatedNativesTest
- */
-public class DuplicatedNativesTest {
-
-    public static void main(String[] args) throws Exception {
-
-        // 1. Check that returned natives do not contain duplicates.
-        SystemFlavorMap flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
-        for (Map.Entry<DataFlavor, String> entry : flavorMap.getNativesForFlavors(null).entrySet()) {
-            List<String> natives = flavorMap.getNativesForFlavor(entry.getKey());
-            if (new HashSet<>(natives).size() != natives.size()) {
-                throw new RuntimeException("FAILED: returned natives contain duplicates: " + Arrays.toString(natives.toArray()));
-            }
-        }
-
-        // 2. Check that even if we set a duplicate it would be ignored.
-        flavorMap.setNativesForFlavor(DataFlavor.stringFlavor, new String[] {"test", "test", "test"});
-        List<String> natives = flavorMap.getNativesForFlavor(DataFlavor.stringFlavor);
-        if (new HashSet<>(natives).size() != natives.size()) {
-            throw new RuntimeException("FAILED: duplicates were not ignored: " + Arrays.toString(natives.toArray()));
-        }
-    }
-}
--- a/test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.SystemFlavorMap;
-import java.util.List;
-
-/*
-  @test
-  @bug 4512530 8027148
-  @summary tests that mappings for text flavors are generated properly
-  @author das@sparc.spb.su area=datatransfer
-*/
-
-public class MappingGenerationTest {
-
-    private static final SystemFlavorMap fm =
-        (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
-
-    public static void main(String[] args)  {
-        test1();
-        test2();
-        test3();
-        test4();
-        test5();
-        test6();
-    }
-
-    /**
-     * Verifies that Lists returned from getNativesForFlavor() and
-     * getFlavorsForNative() are not modified with a subsequent call
-     * to addUnencodedNativeForFlavor() and addFlavorForUnencodedNative()
-     * respectively.
-     */
-    public static void test1() {
-        DataFlavor df = new DataFlavor("text/plain-test1", null);
-        String nat = "native1";
-
-        List<String> natives = fm.getNativesForFlavor(df);
-        fm.addUnencodedNativeForFlavor(df, nat);
-        List<String> nativesNew = fm.getNativesForFlavor(df);
-        if (natives.equals(nativesNew)) {
-            System.err.println("orig=" + natives);
-            System.err.println("new=" + nativesNew);
-            throw new RuntimeException("Test failed");
-        }
-
-        List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
-        fm.addFlavorForUnencodedNative(nat, df);
-        List<DataFlavor> flavorsNew = fm.getFlavorsForNative(nat);
-        if (flavors.equals(flavorsNew)) {
-            System.err.println("orig=" + flavors);
-            System.err.println("new=" + flavorsNew);
-            throw new RuntimeException("Test failed");
-        }
-    }
-
-    /**
-     * Verifies that SystemFlavorMap is not affected by modification of
-     * the Lists returned from getNativesForFlavor() and
-     * getFlavorsForNative().
-     */
-    public static void test2() {
-        DataFlavor df = new DataFlavor("text/plain-test2", null);
-        String nat = "native2";
-        DataFlavor extraDf = new DataFlavor("text/test", null);
-
-        List<String> natives = fm.getNativesForFlavor(df);
-        natives.add("Should not be here");
-        java.util.List nativesNew = fm.getNativesForFlavor(df);
-        if (natives.equals(nativesNew)) {
-            System.err.println("orig=" + natives);
-            System.err.println("new=" + nativesNew);
-            throw new RuntimeException("Test failed");
-        }
-
-        List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
-        flavors.add(extraDf);
-        java.util.List flavorsNew = fm.getFlavorsForNative(nat);
-        if (flavors.equals(flavorsNew)) {
-            System.err.println("orig=" + flavors);
-            System.err.println("new=" + flavorsNew);
-            throw new RuntimeException("Test failed");
-        }
-    }
-
-    /**
-     * Verifies that addUnencodedNativeForFlavor() for a particular text flavor
-     * doesn't affect mappings for other flavors.
-     */
-    public static void test3() {
-        DataFlavor df1 = new DataFlavor("text/plain-test3", null);
-        DataFlavor df2 = new DataFlavor("text/plain-test3; charset=Unicode; class=java.io.Reader", null);
-        String nat = "native3";
-        List<String> natives = fm.getNativesForFlavor(df2);
-        fm.addUnencodedNativeForFlavor(df1, nat);
-        List<String> nativesNew = fm.getNativesForFlavor(df2);
-        if (!natives.equals(nativesNew)) {
-            System.err.println("orig=" + natives);
-            System.err.println("new=" + nativesNew);
-            throw new RuntimeException("Test failed");
-        }
-    }
-
-    /**
-     * Verifies that addUnencodedNativeForFlavor() really adds the specified
-     * flavor-to-native mapping to the existing mappings.
-     */
-    public static void test4() {
-        DataFlavor df = new DataFlavor("text/plain-test4; charset=Unicode; class=java.io.Reader", null);
-        String nat = "native4";
-        List<String> natives = fm.getNativesForFlavor(df);
-        if (!natives.contains(nat)) {
-            fm.addUnencodedNativeForFlavor(df, nat);
-            List<String> nativesNew = fm.getNativesForFlavor(df);
-            natives.add(nat);
-            if (!natives.equals(nativesNew)) {
-                System.err.println("orig=" + natives);
-                System.err.println("new=" + nativesNew);
-                throw new RuntimeException("Test failed");
-            }
-        }
-    }
-
-    /**
-     * Verifies that a flavor doesn't have any flavor-to-native mappings after
-     * a call to setNativesForFlavor() with this flavor and an empty native
-     * array as arguments.
-     */
-    public static void test5() {
-        final DataFlavor flavor =
-            new DataFlavor("text/plain-TEST5; charset=Unicode", null);
-
-        fm.getNativesForFlavor(flavor);
-
-        fm.setNativesForFlavor(flavor, new String[0]);
-
-        List<String> natives = fm.getNativesForFlavor(flavor);
-
-        if (!natives.isEmpty()) {
-            System.err.println("natives=" + natives);
-            throw new RuntimeException("Test failed");
-        }
-    }
-
-    /**
-     * Verifies that a native doesn't have any native-to-flavor mappings after
-     * a call to setFlavorsForNative() with this native and an empty flavor
-     * array as arguments.
-     */
-    public static void test6() {
-        final String nat = "STRING";
-        fm.getFlavorsForNative(nat);
-        fm.setFlavorsForNative(nat, new DataFlavor[0]);
-
-        List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
-
-        if (!flavors.isEmpty()) {
-            System.err.println("flavors=" + flavors);
-            throw new RuntimeException("Test failed");
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/AbsoluteComponentCenterCalculator.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+class AbsoluteComponentCenterCalculator {
+    private AbsoluteComponentCenterCalculator() {
+    }
+
+    public static int calculateXCenterCoordinate(Component component) {
+        return (int) component.getLocationOnScreen().getX() + (component.getWidth() / 2);
+    }
+
+    public static int calculateYCenterCoordinate(Component component) {
+        return (int) component.getLocationOnScreen().getY() + (component.getHeight() / 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/DataFlavorSearcher.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.FlavorTable;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Arrays;
+
+public class DataFlavorSearcher {
+    static public String[] HTML_NAMES = new String[]{"HTML", "HTML Format"};
+    static public String[] RICH_TEXT_NAMES = new String[]{"RICH_TEXT", "Rich Text Format"};
+
+    static public DataFlavor getByteDataFlavorForNative(String[] nats) {
+        FlavorTable flavorTable = (FlavorTable) SystemFlavorMap.getDefaultFlavorMap();
+
+        for (String nat : nats) {
+            java.util.List<DataFlavor> flavors = flavorTable.getFlavorsForNative(nat);
+            for (DataFlavor flavor : flavors) {
+                if (flavor != null
+                        && flavor.getRepresentationClass().equals(byte[].class)) {
+                    return flavor;
+                }
+            }
+        }
+        throw new RuntimeException("No data flavor was found for natives: " + Arrays.toString(nats));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/InterprocessMessages.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013, 2014, 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.
+ */
+
+interface InterprocessMessages {
+    final static int EXECUTION_IS_SUCCESSFULL = 0;
+    final static int DATA_IS_CORRUPTED = 212;
+    final static int NO_DROP_HAPPENED = 112;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,48 @@
+<!--
+ Copyright (c) 2013, 2014, 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.
+-->
+
+<html>
+<!--  
+  @test
+  @bug 8005932 8017456
+  @summary Java 7 on mac os x only provides text clipboard formats
+  @author mikhail.cherkasov@oracle.com
+  @library ../../regtesthelpers
+  @library ../../regtesthelpers/process
+  @build Util
+  @build ProcessResults ProcessCommunicator
+  @run applet/othervm MissedHtmlAndRtfBug.html
+-->
+
+<head>
+    <title>Java 7 on mac os x only provides text clipboard formats</title>
+</head>
+<body>
+
+<h1> MissedHtmlAndRtfBug <br>Bug ID: 8005932 </h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="MissedHtmlAndRtfBug.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.io.File;
+import java.util.ArrayList;
+
+import test.java.awt.regtesthelpers.process.ProcessCommunicator;
+import test.java.awt.regtesthelpers.process.ProcessResults;
+import test.java.awt.regtesthelpers.Util;
+import sun.awt.OSInfo;
+
+import static java.lang.Thread.sleep;
+
+public class MissedHtmlAndRtfBug extends Applet {
+
+    public void init() {
+        setLayout(new BorderLayout());
+    }//End  init()
+
+    public void start() {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX
+                && OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
+            System.out.println("This test is for Windows and Mac only. Passed.");
+            return;
+        }
+
+        final Frame sourceFrame = new Frame("Source frame");
+        final SourcePanel sourcePanel = new SourcePanel();
+        sourceFrame.add(sourcePanel);
+        sourceFrame.pack();
+        sourceFrame.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                sourceFrame.dispose();
+            }
+        });
+        sourceFrame.setVisible(true);
+
+        Util.waitForIdle(null);
+
+        NextFramePositionCalculator positionCalculator = new NextFramePositionCalculator(sourceFrame);
+
+        ArrayList<String> args = new ArrayList<String>(5);
+        args.add(String.valueOf(positionCalculator.getNextLocationX()));
+        args.add(String.valueOf(positionCalculator.getNextLocationY()));
+        args.add(String.valueOf(AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(sourcePanel)));
+        args.add(String.valueOf(AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(sourcePanel)));
+        args.add(concatStrings(DataFlavorSearcher.RICH_TEXT_NAMES));
+
+        ProcessResults processResults =
+                ProcessCommunicator.executeChildProcess(this.getClass(),
+                        "." + File.separator + System.getProperty("java.class.path"), args.toArray(new String[]{}));
+
+        verifyTestResults(processResults);
+
+        args.set(args.size() - 1, concatStrings(DataFlavorSearcher.HTML_NAMES));
+
+        ProcessCommunicator.executeChildProcess(this.getClass(),
+                "." + File.separator + System.getProperty("java.class.path"), args.toArray(new String[]{}));
+        verifyTestResults(processResults);
+
+
+    }// start()
+
+    private String concatStrings(String[] strings) {
+        StringBuffer result = new StringBuffer("\"");
+        for (int i = 0; i < strings.length; i++) {
+            result.append(strings[i]);
+            result.append(",");
+        }
+        result.append("\"");
+        return result.toString();
+    }
+
+
+    private static void verifyTestResults(ProcessResults processResults) {
+        if (InterprocessMessages.DATA_IS_CORRUPTED ==
+                processResults.getExitValue()) {
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("TEST IS FAILED: Target has received" +
+                    " corrupted data.");
+        }
+        if (InterprocessMessages.NO_DROP_HAPPENED ==
+                processResults.getExitValue()) {
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("Error. Drop did not happen." +
+                " Target frame is possibly covered by a window of other application." +
+                " Please, rerun the test with all windows minimized.");
+        }
+        processResults.verifyStdErr(System.err);
+        processResults.verifyProcessExitValue(System.err);
+        processResults.printProcessStandartOutput(System.out);
+    }
+
+    //We cannot make an instance of the applet without the default constructor
+    public MissedHtmlAndRtfBug() {
+        super();
+    }
+
+    //We need in this constructor to pass frame position between JVMs
+    public MissedHtmlAndRtfBug(Point targetFrameLocation, Point dragSourcePoint, DataFlavor df)
+            throws InterruptedException {
+        final Frame targetFrame = new Frame("Target frame");
+        final TargetPanel targetPanel = new TargetPanel(targetFrame, df);
+        targetFrame.add(targetPanel);
+        targetFrame.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                targetFrame.dispose();
+            }
+        });
+        targetFrame.setLocation(targetFrameLocation);
+        targetFrame.pack();
+        targetFrame.setVisible(true);
+
+        doTest(dragSourcePoint, targetPanel);
+    }
+
+    private void doTest(Point dragSourcePoint, TargetPanel targetPanel) {
+        Util.waitForIdle(null);
+
+        final Robot robot = Util.createRobot();
+
+        robot.mouseMove((int) dragSourcePoint.getX(), (int) dragSourcePoint.getY());
+        try {
+            sleep(100);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            sleep(100);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            sleep(100);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
+        Util.drag(robot, dragSourcePoint, new Point(AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(targetPanel),
+                AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(targetPanel)),
+                InputEvent.BUTTON1_MASK);
+    }
+
+
+    enum InterprocessArguments {
+        TARGET_FRAME_X_POSITION_ARGUMENT,
+        TARGET_FRAME_Y_POSITION_ARGUMENT,
+        DRAG_SOURCE_POINT_X_ARGUMENT,
+        DRAG_SOURCE_POINT_Y_ARGUMENT,
+        DATA_FLAVOR_NAMES;
+
+        int extractInt(String[] args) {
+            return Integer.parseInt(args[this.ordinal()]);
+        }
+
+        String[] extractStringArray(String[] args) {
+            return args[this.ordinal()].replaceAll("\"", "").split(",");
+        }
+    }
+
+    public static void main(String[] args) throws InterruptedException {
+        Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extractInt(args),
+                InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extractInt(args));
+        Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extractInt(args),
+                InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extractInt(args));
+        String[] names = InterprocessArguments.DATA_FLAVOR_NAMES.extractStringArray(args);
+
+        DataFlavor df = DataFlavorSearcher.getByteDataFlavorForNative(names);
+        try {
+            new MissedHtmlAndRtfBug(targetFrameLocation, dragSourcePoint, df);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        sleep(5000);
+        System.exit(InterprocessMessages.NO_DROP_HAPPENED);
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/MyTransferable.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.*;
+import java.io.IOException;
+
+class MyTransferable implements Transferable {
+
+    public static final String TEST_DATA = "<b>Test</b>";
+    private DataFlavor[] dataFlavors;
+
+    public MyTransferable() {
+        dataFlavors = new DataFlavor[]{DataFlavorSearcher.getByteDataFlavorForNative(DataFlavorSearcher.HTML_NAMES),
+                DataFlavorSearcher.getByteDataFlavorForNative(DataFlavorSearcher.RICH_TEXT_NAMES)};
+    }
+
+
+    @Override
+    public DataFlavor[] getTransferDataFlavors() {
+        return dataFlavors;
+    }
+
+    @Override
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        for (DataFlavor f : dataFlavors) {
+            if (f.equals(flavor)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public Object getTransferData(DataFlavor flavor)
+            throws UnsupportedFlavorException, IOException {
+        if (isDataFlavorSupported(flavor)) {
+            return TEST_DATA.getBytes("UTF-16");
+        } else {
+            throw new UnsupportedFlavorException(flavor);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/NextFramePositionCalculator.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+
+class NextFramePositionCalculator {
+
+    private final Frame currentFrame;
+
+    public NextFramePositionCalculator(Frame currentFrame) {
+        this.currentFrame = currentFrame;
+    }
+
+    public int getNextLocationX() {
+        return currentFrame.getX() + currentFrame.getWidth();
+    }
+
+    public int getNextLocationY() {
+        return currentFrame.getY();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/SourcePanel.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.*;
+
+public class SourcePanel extends Panel {
+
+    private final MyDragGestureListener dragGestureListener =
+            new MyDragGestureListener();
+
+    public SourcePanel() {
+        setPreferredSize(new Dimension(200, 200));
+        DragSource defaultDragSource =
+                DragSource.getDefaultDragSource();
+        defaultDragSource.createDefaultDragGestureRecognizer(this,
+                DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener);
+        setBackground(Color.RED);
+    }
+
+    private class MyDragGestureListener implements DragGestureListener {
+        public void dragGestureRecognized(DragGestureEvent dge) {
+            dge.startDrag(null, new MyTransferable());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/MissedHtmlAndRtfBug/TargetPanel.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.Transferable;
+import java.awt.dnd.*;
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.util.Timer;
+import java.util.TimerTask;
+
+public class TargetPanel extends Panel implements DropTargetListener {
+
+
+    //private final CustomDropTargetListener dropTargetListener = new CustomDropTargetListener();
+
+    private Frame frame;
+    DataFlavor dataFlavor;
+
+    public TargetPanel(Frame frame, DataFlavor dataFlavor) {
+        this.dataFlavor = dataFlavor;
+        this.frame = frame;
+        setBackground(Color.DARK_GRAY);
+        setPreferredSize(new Dimension(200, 200));
+        setDropTarget(new DropTarget(this, this));
+    }
+
+    public void dragEnter(DropTargetDragEvent dtde) {
+        if (dtde.isDataFlavorSupported(dataFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
+        }
+    }
+
+    public void dragOver(DropTargetDragEvent dtde) {
+        if (dtde.isDataFlavorSupported(dataFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
+        }
+    }
+
+    public void dropActionChanged(DropTargetDragEvent dtde) {
+        if (dtde.isDataFlavorSupported(dataFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
+        }
+    }
+
+    public void dragExit(DropTargetEvent dte) {
+
+    }
+
+    public void drop(DropTargetDropEvent dtde) {
+        dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+        if (dtde.isDataFlavorSupported(dataFlavor)) {
+            String result = null;
+            try {
+                Transferable t = dtde.getTransferable();
+                byte[] data = (byte[]) dtde.getTransferable().getTransferData(dataFlavor);
+                result = new String(data, "UTF-16");
+                repaint();
+            } catch (UnsupportedFlavorException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            dtde.dropComplete(true);
+
+
+            if (result != null && result.contains(MyTransferable.TEST_DATA)) {
+                System.err.println(InterprocessMessages.EXECUTION_IS_SUCCESSFULL);
+                Timer t = new Timer();
+                t.schedule(new TimerTask() {
+                    @Override
+                    public void run() {
+                        System.exit(0);
+                    }
+                }, 2000);
+                return;
+
+            }
+        }
+        dtde.rejectDrop();
+        System.err.println(InterprocessMessages.DATA_IS_CORRUPTED);
+        System.exit(InterprocessMessages.DATA_IS_CORRUPTED);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/SystemFlavorMap/DuplicateMappingTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4493189
+  @summary tests that addUnencodedNativeForFlavor()/addFlavorForUnencodedNative()
+           do not allow to duplicate mappings
+  @author das@sparc.spb.su area=datatransfer
+  @run main DuplicateMappingTest
+*/
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Iterator;
+
+public class DuplicateMappingTest {
+
+    public static void main(String[] args) throws Exception {
+
+        final String nativeString = "NATIVE";
+        final DataFlavor dataFlavor = new DataFlavor();
+
+        final SystemFlavorMap fm =
+                (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
+
+        fm.addUnencodedNativeForFlavor(dataFlavor, nativeString);
+        fm.addUnencodedNativeForFlavor(dataFlavor, nativeString);
+
+        final java.util.List natives =
+                fm.getNativesForFlavor(dataFlavor);
+        boolean found = false;
+
+        for (final Iterator i = natives.iterator(); i.hasNext(); ) {
+            if (nativeString.equals(i.next())) {
+                if (found) {
+                    throw new RuntimeException("getNativesForFlavor() returns:" +
+                            natives);
+                } else {
+                    found = true;
+                }
+            }
+        }
+
+        if (!found) {
+            throw new RuntimeException("getNativesForFlavor() returns:" +
+                    natives);
+        }
+
+        fm.addFlavorForUnencodedNative(nativeString, dataFlavor);
+        fm.addFlavorForUnencodedNative(nativeString, dataFlavor);
+
+        final java.util.List flavors =
+                fm.getFlavorsForNative(nativeString);
+        found = false;
+
+        for (final Iterator i = flavors.iterator(); i.hasNext(); ) {
+            if (dataFlavor.equals(i.next())) {
+                if (found) {
+                    throw new RuntimeException("getFlavorsForNative() returns:" +
+                            flavors);
+                } else {
+                    found = true;
+                }
+            }
+        }
+
+        if (!found) {
+            throw new RuntimeException("getFlavorsForNative() returns:" +
+                    natives);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/SystemFlavorMap/DuplicatedNativesTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+/* @test
+ * @bug 8028230
+ * @summary Checks that SystemFlavorMap.getNativesForFlavor returns a list without duplicates
+ * @author Petr Pchelko
+ * @run main DuplicatedNativesTest
+ */
+public class DuplicatedNativesTest {
+
+    public static void main(String[] args) throws Exception {
+
+        // 1. Check that returned natives do not contain duplicates.
+        SystemFlavorMap flavorMap = (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+        for (Map.Entry<DataFlavor, String> entry : flavorMap.getNativesForFlavors(null).entrySet()) {
+            List<String> natives = flavorMap.getNativesForFlavor(entry.getKey());
+            if (new HashSet<>(natives).size() != natives.size()) {
+                throw new RuntimeException("FAILED: returned natives contain duplicates: " + Arrays.toString(natives.toArray()));
+            }
+        }
+
+        // 2. Check that even if we set a duplicate it would be ignored.
+        flavorMap.setNativesForFlavor(DataFlavor.stringFlavor, new String[] {"test", "test", "test"});
+        List<String> natives = flavorMap.getNativesForFlavor(DataFlavor.stringFlavor);
+        if (new HashSet<>(natives).size() != natives.size()) {
+            throw new RuntimeException("FAILED: duplicates were not ignored: " + Arrays.toString(natives.toArray()));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/SystemFlavorMap/GetNativesForFlavorTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4493178
+  @summary tests that getNativesForFlavor() synthesizes an encoded String native
+           only if there are no mappings for the DataFlavor and the mappings
+           were not explicitly removed
+  @author das@sparc.spb.su area=datatransfer
+  @run main GetNativesForFlavorTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.Iterator;
+
+public class GetNativesForFlavorTest {
+
+    final static SystemFlavorMap fm =
+            (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
+
+    public static void main(String[] args) throws Exception {
+        // 1.Check that the encoded native is not added if there are other
+        // natives for this DataFlavor.
+        test1();
+
+        // 2.Check that the encoded native is not added if all mappings were
+        // explicitly removed for this DataFlavor.
+        test2();
+
+        // 3.Check that only the encoded native is added for text DataFlavors
+        // that has no mappings and that DataFlavor is properly encoded.
+        test3();
+
+        // 4.Verifies that the encoded native is added only for DataFlavors
+        // that has no mappings and that DataFlavor is properly encoded.
+        test4();
+    }
+
+    /**
+     * Verifies that the encoded native is not added if there are other
+     * natives mapped to this DataFlavor.
+     */
+    public static void test1() throws ClassNotFoundException {
+        final DataFlavor flavor =
+                new DataFlavor("text/plain-TEST; charset=Unicode");
+
+        final java.util.List natives = fm.getNativesForFlavor(flavor);
+
+        if (natives.size() > 1) {
+            for (final Iterator i = natives.iterator(); i.hasNext(); ) {
+                String element = (String) i.next();
+                if (SystemFlavorMap.isJavaMIMEType(element)) {
+                    throw new RuntimeException("getFlavorsForNative() returns: "
+                            + natives);
+                }
+            }
+        }
+    }
+
+    /**
+     * Verifies that the encoded native is not added if all mappings were
+     * explicitly removed for this DataFlavor.
+     */
+    public static void test2() throws ClassNotFoundException {
+        final DataFlavor flavor =
+                new DataFlavor("text/plain-TEST; charset=Unicode");
+
+        fm.setNativesForFlavor(flavor, new String[0]);
+
+        final java.util.List natives = fm.getNativesForFlavor(flavor);
+
+        if (!natives.isEmpty()) {
+            throw new RuntimeException("getFlavorsForNative() returns:" +
+                    natives);
+        }
+    }
+
+    /**
+     * Verifies that only the encoded native is added for text DataFlavors
+     * that has no mappings and that DataFlavor is properly encoded.
+     */
+    public static void test3() throws ClassNotFoundException {
+        //
+        final DataFlavor flavor =
+                new DataFlavor("text/plain-TEST-nocharset; class=java.nio.ByteBuffer");
+
+        final java.util.List natives = fm.getNativesForFlavor(flavor);
+        boolean encodedNativeFound = false;
+
+        if (natives.size() == 0) {
+            throw new RuntimeException("getFlavorsForNative() returns:" +
+                    natives);
+        }
+
+        if (natives.size() == 1) {
+            String element = (String) natives.get(0);
+            if (SystemFlavorMap.isJavaMIMEType(element)) {
+                final DataFlavor decodedFlavor =
+                        SystemFlavorMap.decodeDataFlavor(element);
+                if (!flavor.equals(decodedFlavor)) {
+                    System.err.println("DataFlavor is not properly incoded:");
+                    System.err.println("    encoded flavor: " + flavor);
+                    System.err.println("    decoded flavor: " + decodedFlavor);
+                    throw new RuntimeException("getFlavorsForNative() returns:"
+                            + natives);
+                }
+            }
+        } else {
+            for (final Iterator i = natives.iterator(); i.hasNext(); ) {
+                String element = (String) i.next();
+                if (SystemFlavorMap.isJavaMIMEType(element)) {
+                    throw new RuntimeException("getFlavorsForNative() returns:"
+                            + natives);
+                }
+            }
+        }
+    }
+
+    /**
+     * Verifies that the encoded native is added only for DataFlavors
+     * that has no mappings and that DataFlavor is properly encoded.
+     */
+    public static void test4() throws ClassNotFoundException {
+        final DataFlavor flavor =
+                new DataFlavor("unknown/unknown");
+
+        final java.util.List natives = fm.getNativesForFlavor(flavor);
+
+        if (natives.size() == 1) {
+            String element = (String) natives.get(0);
+            if (SystemFlavorMap.isJavaMIMEType(element)) {
+                final DataFlavor decodedFlavor =
+                        SystemFlavorMap.decodeDataFlavor(element);
+                if (!flavor.equals(decodedFlavor)) {
+                    System.err.println("DataFlavor is not properly incoded:");
+                    System.err.println("    encoded flavor: " + flavor);
+                    System.err.println("    decoded flavor: " + decodedFlavor);
+                    throw new RuntimeException("getFlavorsForNative() returns:"
+                            + natives);
+                }
+            }
+        } else {
+            throw new RuntimeException("getFlavorsForNative() returns:"
+                    + natives);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/SystemFlavorMap/MappingGenerationTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.List;
+
+/*
+  @test
+  @bug 4512530 8027148
+  @summary tests that mappings for text flavors are generated properly
+  @author das@sparc.spb.su area=datatransfer
+*/
+
+public class MappingGenerationTest {
+
+    private static final SystemFlavorMap fm =
+        (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+    public static void main(String[] args)  {
+        test1();
+        test2();
+        test3();
+        test4();
+        test5();
+        test6();
+    }
+
+    /**
+     * Verifies that Lists returned from getNativesForFlavor() and
+     * getFlavorsForNative() are not modified with a subsequent call
+     * to addUnencodedNativeForFlavor() and addFlavorForUnencodedNative()
+     * respectively.
+     */
+    public static void test1() {
+        DataFlavor df = new DataFlavor("text/plain-test1", null);
+        String nat = "native1";
+
+        List<String> natives = fm.getNativesForFlavor(df);
+        fm.addUnencodedNativeForFlavor(df, nat);
+        List<String> nativesNew = fm.getNativesForFlavor(df);
+        if (natives.equals(nativesNew)) {
+            System.err.println("orig=" + natives);
+            System.err.println("new=" + nativesNew);
+            throw new RuntimeException("Test failed");
+        }
+
+        List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
+        fm.addFlavorForUnencodedNative(nat, df);
+        List<DataFlavor> flavorsNew = fm.getFlavorsForNative(nat);
+        if (flavors.equals(flavorsNew)) {
+            System.err.println("orig=" + flavors);
+            System.err.println("new=" + flavorsNew);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    /**
+     * Verifies that SystemFlavorMap is not affected by modification of
+     * the Lists returned from getNativesForFlavor() and
+     * getFlavorsForNative().
+     */
+    public static void test2() {
+        DataFlavor df = new DataFlavor("text/plain-test2", null);
+        String nat = "native2";
+        DataFlavor extraDf = new DataFlavor("text/test", null);
+
+        List<String> natives = fm.getNativesForFlavor(df);
+        natives.add("Should not be here");
+        java.util.List nativesNew = fm.getNativesForFlavor(df);
+        if (natives.equals(nativesNew)) {
+            System.err.println("orig=" + natives);
+            System.err.println("new=" + nativesNew);
+            throw new RuntimeException("Test failed");
+        }
+
+        List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
+        flavors.add(extraDf);
+        java.util.List flavorsNew = fm.getFlavorsForNative(nat);
+        if (flavors.equals(flavorsNew)) {
+            System.err.println("orig=" + flavors);
+            System.err.println("new=" + flavorsNew);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    /**
+     * Verifies that addUnencodedNativeForFlavor() for a particular text flavor
+     * doesn't affect mappings for other flavors.
+     */
+    public static void test3() {
+        DataFlavor df1 = new DataFlavor("text/plain-test3", null);
+        DataFlavor df2 = new DataFlavor("text/plain-test3; charset=Unicode; class=java.io.Reader", null);
+        String nat = "native3";
+        List<String> natives = fm.getNativesForFlavor(df2);
+        fm.addUnencodedNativeForFlavor(df1, nat);
+        List<String> nativesNew = fm.getNativesForFlavor(df2);
+        if (!natives.equals(nativesNew)) {
+            System.err.println("orig=" + natives);
+            System.err.println("new=" + nativesNew);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    /**
+     * Verifies that addUnencodedNativeForFlavor() really adds the specified
+     * flavor-to-native mapping to the existing mappings.
+     */
+    public static void test4() {
+        DataFlavor df = new DataFlavor("text/plain-test4; charset=Unicode; class=java.io.Reader", null);
+        String nat = "native4";
+        List<String> natives = fm.getNativesForFlavor(df);
+        if (!natives.contains(nat)) {
+            fm.addUnencodedNativeForFlavor(df, nat);
+            List<String> nativesNew = fm.getNativesForFlavor(df);
+            natives.add(nat);
+            if (!natives.equals(nativesNew)) {
+                System.err.println("orig=" + natives);
+                System.err.println("new=" + nativesNew);
+                throw new RuntimeException("Test failed");
+            }
+        }
+    }
+
+    /**
+     * Verifies that a flavor doesn't have any flavor-to-native mappings after
+     * a call to setNativesForFlavor() with this flavor and an empty native
+     * array as arguments.
+     */
+    public static void test5() {
+        final DataFlavor flavor =
+            new DataFlavor("text/plain-TEST5; charset=Unicode", null);
+
+        fm.getNativesForFlavor(flavor);
+
+        fm.setNativesForFlavor(flavor, new String[0]);
+
+        List<String> natives = fm.getNativesForFlavor(flavor);
+
+        if (!natives.isEmpty()) {
+            System.err.println("natives=" + natives);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    /**
+     * Verifies that a native doesn't have any native-to-flavor mappings after
+     * a call to setFlavorsForNative() with this native and an empty flavor
+     * array as arguments.
+     */
+    public static void test6() {
+        final String nat = "STRING";
+        fm.getFlavorsForNative(nat);
+        fm.setFlavorsForNative(nat, new DataFlavor[0]);
+
+        List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
+
+        if (!flavors.isEmpty()) {
+            System.err.println("flavors=" + flavors);
+            throw new RuntimeException("Test failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/SystemFlavorMap/SetNativesForFlavorTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4478912
+  @summary tests that getNativesForFlavor()/getFlavorsForNative() return the
+           same list as was set with setNativesForFlavor()/setFlavorsForNative()
+  @author das@sparc.spb.su area=datatransfer
+  @run main SetNativesForFlavorTest
+*/
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+
+public class SetNativesForFlavorTest  {
+
+    public static void main(String[] args) throws Exception {
+            final String nativeString = "NATIVE";
+
+            final SystemFlavorMap fm =
+                (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+            fm.setNativesForFlavor(DataFlavor.plainTextFlavor,
+                                   new String[] { nativeString });
+
+            final java.util.List natives =
+                fm.getNativesForFlavor(DataFlavor.plainTextFlavor);
+
+            if (natives.size() != 1 || !natives.contains(nativeString)) {
+                throw new RuntimeException("getNativesForFlavor() returns:" +
+                                           natives);
+            }
+
+            final DataFlavor dataFlavor =
+                new DataFlavor("text/unknown; class=java.lang.String");
+
+            fm.setFlavorsForNative(nativeString, new DataFlavor[] { dataFlavor });
+
+            final java.util.List flavors = fm.getFlavorsForNative(nativeString);
+
+            if (flavors.size() != 1 || !flavors.contains(dataFlavor)) {
+                throw new RuntimeException("getFlavorsForNative() returns:" +
+                                           flavors);
+            }
+    }
+}
--- a/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -56,17 +56,24 @@
             }
         });
 
-        Util.waitForIdle(null);
+        Robot testRobot = null;
         try {
-            Point loc = textArea.getLocationOnScreen();
-            Util.drag(new Robot(),
-                    new Point((int) loc.x + 3, (int) loc.y + 3),
-                    new Point((int) loc.x + 40, (int) loc.y + 40),
-                    InputEvent.BUTTON1_MASK);
-        } catch (AWTException ex) {
-            throw new RuntimeException("Could not initiate a drag operation");
+            testRobot = new Robot();
+        } catch(AWTException ex) {
+            throw new RuntimeException("Error while creating Robot");
         }
-        Util.waitForIdle(null);
+
+        Util.waitForIdle(testRobot);
+
+        Point loc = textArea.getLocationOnScreen();
+        Util.drag(testRobot,
+                new Point((int) loc.x + 3, (int) loc.y + 3),
+                new Point((int) loc.x + 40, (int) loc.y + 40),
+                InputEvent.BUTTON1_MASK);
+
+        Util.waitForIdle(testRobot);
+
+        testRobot.delay(200);
     }
 
     private static void constructTestUI() {
--- a/test/java/awt/regtesthelpers/Util.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/awt/regtesthelpers/Util.java	Wed Feb 03 05:23:32 2021 +0000
@@ -76,12 +76,17 @@
 public final class Util {
     private Util() {} // this is a helper class with static methods :)
 
+    private volatile static Robot robot;
+
     /*
      * @throws RuntimeException when creation failed
      */
     public static Robot createRobot() {
         try {
-            return new Robot();
+            if (robot == null) {
+                robot = new Robot();
+            }
+            return robot;
         } catch (AWTException e) {
             throw new RuntimeException("Error: unable to create robot", e);
         }
@@ -200,7 +205,10 @@
         return false;
     }
 
-    public static void waitForIdle(final Robot robot) {
+    public static void waitForIdle(Robot robot) {
+        if (robot == null) {
+            robot = createRobot();
+        }
         robot.waitForIdle();
     }
 
--- a/test/java/io/File/WinSpecialFiles.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/io/File/WinSpecialFiles.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -22,7 +22,7 @@
  */
 
 /* @test
-   @bug 6192331 6348207
+   @bug 6192331 6348207 8202076
    @summary Check if File.exists()/length() works correctly on Windows
             special files hiberfil.sys and pagefile.sys
  */
@@ -45,9 +45,9 @@
             if (name.indexOf("pagefile.sys") != -1 ||
                 name.indexOf("hiberfil.sys") != -1) {
                 if (dir[i].length() == 0) {
-                    throw new Exception("Size of existing <"
+                    throw new Exception("Size of existing file \""
                                         + dir[i].getPath()
-                                        + " is ZERO");
+                                        + "\" is ZERO");
                 }
             }
         }
--- a/test/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,13 +32,13 @@
  * @run main/othervm/policy=test.policy -Djava.security.manager ClassForNameLeak
  */
 
+import java.io.IOException;
 import java.lang.ref.PhantomReference;
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
@@ -56,61 +56,61 @@
  */
 public class ClassForNameLeak {
     private static final long TIMEOUT = (long)(5000.0 * Utils.TIMEOUT_FACTOR);
-    private static final String TESTCLASSES = System.getProperty("test.classes", ".");
-    private static final String CLASSFILENAME = "ClassForName.class";
     private static final int THREADS = 10;
+    private static final Path jarFilePath = Paths.get("cfn.jar");
     private static final ReferenceQueue<ClassLoader> rq = new ReferenceQueue<>();
 
-    // Use a new classloader to load the ClassForName class, then run its
-    // Runnable.
-    public static PhantomReference<ClassLoader> loadAndRun(Path jarFilePath)
-            throws Exception {
-        ClassLoader classLoader = new URLClassLoader(
-                new URL[]{jarFilePath.toUri().toURL()}) {
-            @Override public String toString() { return "LeakedClassLoader"; }
-        };
+    static class TestLoader {
+        private final PhantomReference<ClassLoader> ref;
+
+        TestLoader() {
+            this.ref = loadAndRun();
+        }
 
-        Class<?> loadClass = Class.forName("ClassForName", true, classLoader);
-        ((Runnable) loadClass.newInstance()).run();
+        // Use a new classloader to load the ClassForName class, then run its
+        // Runnable.
+        PhantomReference<ClassLoader> loadAndRun() {
+            try {
+                ClassLoader classLoader =
+                    new URLClassLoader(new URL[]{jarFilePath.toUri().toURL()},
+                        ClassLoader.getSystemClassLoader());
 
-        PhantomReference<ClassLoader> ref = new PhantomReference<>(classLoader, rq);
-        System.out.println("returning phantom ref: " + ref + " to " + classLoader);
-        return ref;
+                Class<?> loadClass = Class.forName("ClassForName", true, classLoader);
+                ((Runnable) loadClass.newInstance()).run();
+
+                return new PhantomReference<>(classLoader, rq);
+            } catch (MalformedURLException | ReflectiveOperationException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        PhantomReference<ClassLoader> getRef() {
+            return ref;
+        }
     }
 
-    public static void main(final String[] args) throws Exception {
-        Path classFile = FileSystems.getDefault().getPath(TESTCLASSES,
-                                                          CLASSFILENAME);
-
-        // Create a temporary .jar file containing ClassForName.class
-        Path testClassesDir = Paths.get(TESTCLASSES);
-        Path jarFilePath = Files.createTempFile("cfn", ".jar");
-        JarUtils.createJarFile(jarFilePath, testClassesDir, classFile);
-        jarFilePath.toFile().deleteOnExit();
-
-        // Remove the ClassForName.class file that jtreg built, to make sure
-        // we're loading from the tmp .jar
-        Files.delete(classFile);
+    public static void main(String... args) throws Exception {
+        // create the JAR file
+        setup();
 
         // Make simultaneous calls to the test method, to stress things a bit
         ExecutorService es = Executors.newFixedThreadPool(THREADS);
 
-        List<Callable<PhantomReference<ClassLoader>>> callables =
+        List<Callable<TestLoader>> callables =
                 Stream.generate(() -> {
-                    Callable<PhantomReference<ClassLoader>> cprcl = () -> {
-                        return loadAndRun(jarFilePath);
-                    };
+                    Callable<TestLoader> cprcl = TestLoader::new;
                     return cprcl;
                 }).limit(THREADS).collect(Collectors.toList());
 
-        List<Future<PhantomReference<ClassLoader>>> refs = es.invokeAll(callables);
+        List<Future<TestLoader>> futures = es.invokeAll(callables);
 
         // Give the GC a chance to enqueue the PhantomReferences
         for (int i = 0; i < 10; i++) {
             System.gc();
         }
+
         // Make sure all PhantomReferences to the leaked classloader are enqueued
-        for (int j = 0; j < THREADS; j++) {
+        for (int j = 0; j < futures.size(); j++) {
             Reference rmRef = rq.remove(TIMEOUT);
             if (rmRef == null) {
                 throw new RuntimeException("ClassLoader was never enqueued!");
@@ -118,6 +118,16 @@
                 System.out.println("Enqueued " + rmRef);
             }
         }
-        System.out.println("All Classloaders successfully enqued");
+        es.shutdown();
+        System.out.println("All ClassLoaders successfully enqueued");
+    }
+
+    private static final String CLASSFILENAME = "ClassForName.class";
+    private static void setup() throws IOException {
+        String testclasses = System.getProperty("test.classes", ".");
+
+        // Create a temporary .jar file containing ClassForName.class
+        Path testClassesDir = Paths.get(testclasses);
+        JarUtils.createJar(jarFilePath.toString(), testClassesDir.toString(), CLASSFILENAME);
     }
 }
--- a/test/java/lang/ClassLoader/forNameLeak/test.policy	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/lang/ClassLoader/forNameLeak/test.policy	Wed Feb 03 05:23:32 2021 +0000
@@ -2,5 +2,6 @@
   permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete";
   permission java.lang.RuntimePermission "createClassLoader";
   permission java.lang.RuntimePermission "getClassLoader";
+  permission java.lang.RuntimePermission "modifyThread";
   permission java.util.PropertyPermission "*", "read"; /* for Utils */
 };
--- a/test/java/net/URI/Test.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/net/URI/Test.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1587,7 +1587,7 @@
 
     // miscellaneous bugs/rfes that don't fit in with the test framework
 
-    static void bugs() {
+    static void bugs() throws URISyntaxException {
         // 6339649 - include detail message from nested exception
         try {
             URI uri = URI.create("http://nowhere.net/should not be permitted");
@@ -1596,6 +1596,12 @@
                 throw new RuntimeException ("No detail message");
             }
         }
+
+        // 8051853 - getRawSchemeSpecificPart returns null
+        String rssp = new URI("x/").resolve("..").getRawSchemeSpecificPart();
+        if (!"".equals(rssp)) {
+            throw new RuntimeException("Incorrect RawSchemeSpecificPart: [" + rssp + "], must be an empty string");
+        }
     }
 
     public static void main(String[] args) throws Exception {
--- a/test/java/security/cert/PolicyNode/GetPolicyQualifiers.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/security/cert/PolicyNode/GetPolicyQualifiers.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2020, 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
@@ -30,9 +30,11 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.security.cert.*;
+import java.text.DateFormat;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Set;
 
 public class GetPolicyQualifiers {
@@ -52,6 +54,9 @@
         PKIXParameters params = new PKIXParameters(trustAnchors);
         params.setPolicyQualifiersRejected(false);
         params.setRevocationEnabled(false);
+        // Certificates expired on Oct 6th, 2020
+        params.setDate(DateFormat.getDateInstance(DateFormat.MEDIUM,
+                Locale.US).parse("July 01, 2020"));
         List certList = Collections.singletonList(eeCert);
         CertPath cp = cf.generateCertPath(certList);
         PKIXCertPathValidatorResult result =
--- a/test/java/text/Format/DateFormat/Bug6530336.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/DateFormat/Bug6530336.java	Wed Feb 03 05:23:32 2021 +0000
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 6530336 6537997 8008577
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI Bug6530336
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug6530336
  */
 
 import java.text.SimpleDateFormat;
--- a/test/java/text/Format/DateFormat/DateFormatRegression.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/DateFormat/DateFormatRegression.java	Wed Feb 03 05:23:32 2021 +0000
@@ -32,7 +32,7 @@
  * 4134203 4138203 4148168 4151631 4151706 4153860 4162071 4182066 4209272 4210209
  * 4213086 4250359 4253490 4266432 4406615 4413980 8008577
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI DateFormatRegression
+ * @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatRegression
  */
 public class DateFormatRegression extends IntlTest {
 
--- a/test/java/text/Format/DateFormat/DateFormatRoundTripTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/DateFormat/DateFormatRoundTripTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,7 @@
  * @summary test Date Format (Round Trip)
  * @bug 8008577
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI DateFormatRoundTripTest
+ * @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatRoundTripTest
  */
 
 import java.text.*;
--- a/test/java/text/Format/DateFormat/DateFormatTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/DateFormat/DateFormatTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,7 @@
  * @bug 4052223 4089987 4469904 4326988 4486735 8008577 8045998 8140571
  * @summary test DateFormat and SimpleDateFormat.
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI DateFormatTest
+ * @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatTest
  */
 
 import java.util.*;
--- a/test/java/text/Format/DateFormat/IntlTestDateFormat.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/DateFormat/IntlTestDateFormat.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,7 @@
  * @summary test International Date Format
  * @bug 8008577
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI IntlTestDateFormat
+ * @run main/othervm -Djava.locale.providers=JRE,SPI IntlTestDateFormat
  * @key randomness
  */
 /*
--- a/test/java/text/Format/DateFormat/IntlTestDateFormatAPI.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/DateFormat/IntlTestDateFormatAPI.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,7 @@
  * @summary test International Date Format API
  * @bug 8008577
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI IntlTestDateFormatAPI
+ * @run main/othervm -Djava.locale.providers=JRE,SPI IntlTestDateFormatAPI
  */
 /*
 (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
--- a/test/java/text/Format/DateFormat/IntlTestSimpleDateFormatAPI.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/DateFormat/IntlTestSimpleDateFormatAPI.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,7 @@
  * @summary test International Simple Date Format API
  * @bug 8008577
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI IntlTestSimpleDateFormatAPI
+ * @run main/othervm -Djava.locale.providers=JRE,SPI IntlTestSimpleDateFormatAPI
  */
 /*
 (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
--- a/test/java/text/Format/DateFormat/NonGregorianFormatTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/DateFormat/NonGregorianFormatTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -25,7 +25,7 @@
  * @test
  * @bug 4833268 6253991 8008577
  * @summary Test formatting and parsing with non-Gregorian calendars
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI NonGregorianFormatTest
+ * @run main/othervm -Djava.locale.providers=JRE,SPI NonGregorianFormatTest
  */
 
 import java.util.*;
--- a/test/java/text/Format/DateFormat/TimeZoneNameTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/DateFormat/TimeZoneNameTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,7 @@
  * @bug 4348864 4112924 4425386 4495052 4836940 4851113 8008577
  * @summary test time zone display names in en_US locale
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI TimeZoneNameTest
+ * @run main/othervm -Djava.locale.providers=JRE,SPI TimeZoneNameTest
  */
 
 import java.util.*;
--- a/test/java/text/Format/MessageFormat/LargeMessageFormat.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/MessageFormat/LargeMessageFormat.java	Wed Feb 03 05:23:32 2021 +0000
@@ -25,7 +25,7 @@
  * @test
  * @bug 4112090 8008577
  * @summary verify that MessageFormat can handle large numbers of arguments
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI LargeMessageFormat
+ * @run main/othervm -Djava.locale.providers=JRE,SPI LargeMessageFormat
  */
 
 import java.text.MessageFormat;
--- a/test/java/text/Format/NumberFormat/BigDecimalFormat.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/NumberFormat/BigDecimalFormat.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,7 @@
  * @bug 4018937 8008577
  * @summary Confirm that methods which are newly added to support BigDecimal and BigInteger work as expected.
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI BigDecimalFormat
+ * @run main/othervm -Djava.locale.providers=JRE,SPI BigDecimalFormat
  */
 
 import java.math.BigDecimal;
--- a/test/java/text/Format/NumberFormat/BigDecimalParse.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/NumberFormat/BigDecimalParse.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,7 @@
  * @bug 4018937 8008577
  * @summary Confirm that methods which are newly added to support BigDecimal and BigInteger work as expected.
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI BigDecimalParse
+ * @run main/othervm -Djava.locale.providers=JRE,SPI BigDecimalParse
  */
 
 import java.math.BigDecimal;
--- a/test/java/text/Format/NumberFormat/Bug4838107.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/NumberFormat/Bug4838107.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,7 +26,7 @@
  * @bug 4838107 8008577
  * @summary Confirm that DecimalFormat can format a number with negative exponent number correctly.
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI Bug4838107
+ * @run main/othervm -Djava.locale.providers=JRE,SPI Bug4838107
  */
 
 import java.math.*;
--- a/test/java/text/Format/NumberFormat/NumberRegression.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/NumberFormat/NumberRegression.java	Wed Feb 03 05:23:32 2021 +0000
@@ -35,7 +35,7 @@
  * @build IntlTest HexDumpReader
  * @modules java.base/sun.util.resources
  * @compile -XDignore.symbol.file NumberRegression.java
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI NumberRegression
+ * @run main/othervm -Djava.locale.providers=JRE,SPI NumberRegression
  */
 
 /*
--- a/test/java/text/Format/NumberFormat/NumberTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/text/Format/NumberFormat/NumberTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -28,7 +28,7 @@
  * @library /java/text/testlib
  * @modules java.base/sun.util.resources
  * @compile -XDignore.symbol.file NumberTest.java
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI NumberTest
+ * @run main/othervm -Djava.locale.providers=JRE,SPI NumberTest
  */
 
 import java.util.*;
--- a/test/java/util/Calendar/JapanEraNameCompatTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/util/Calendar/JapanEraNameCompatTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -24,9 +24,9 @@
 /*
  * @test
  * @bug 8218781
- * @summary Test the localized names of Japanese era Reiwa from COMPAT provider.
+ * @summary Test the localized names of Japanese era Reiwa from JRE provider.
  * @modules jdk.localedata
- * @run testng/othervm -Djava.locale.providers=COMPAT JapanEraNameCompatTest
+ * @run testng/othervm -Djava.locale.providers=JRE JapanEraNameCompatTest
  */
 
 import static java.util.Calendar.*;
--- a/test/java/util/Formatter/BasicDateTime.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/util/Formatter/BasicDateTime.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1599,6 +1599,17 @@
 
         // Get the supported ids for GMT-08:00 (Pacific Standard Time)
         String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
+        // With tzdata2020b, the test fails for the mentioned zones expecting
+        // "PST" but JDK has Zone name "MST" for JRE locale provider.
+        // Therefore excluding them as the test is only looking for a GMT-08:00
+        // time zone ID. See JDK-8254865.
+        final List<String> list =  new ArrayList<String>();
+        Collections.addAll(list, ids);
+        list.remove("America/Dawson");
+        list.remove("America/WhiteHorse");
+        list.remove("Canada/Yukon");
+        ids = list.toArray(new String[list.size()]);
+
         // Create a Pacific Standard Time time zone
         SimpleTimeZone tz = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
         // public GregorianCalendar(TimeZone zone, Locale aLocale);
--- a/test/java/util/TimeZone/HongKong.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/util/TimeZone/HongKong.java	Wed Feb 03 05:23:32 2021 +0000
@@ -25,7 +25,7 @@
  * @test
  * @bug 4487276 8008577
  * @summary Verify that Hong Kong locale uses traditional Chinese names.
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI HongKong
+ * @run main/othervm -Djava.locale.providers=JRE,SPI HongKong
  */
 
 import java.util.Locale;
--- a/test/java/util/TimeZone/TimeZoneRegression.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/util/TimeZone/TimeZoneRegression.java	Wed Feb 03 05:23:32 2021 +0000
@@ -27,7 +27,7 @@
  * 4154525 4154537 4154542 4154650 4159922 4162593 4173604 4176686 4184229 4208960
  * 4966229 6433179 6851214 8007520 8008577
  * @library /java/text/testlib
- * @run main/othervm -Djava.locale.providers=COMPAT,SPI TimeZoneRegression
+ * @run main/othervm -Djava.locale.providers=JRE,SPI TimeZoneRegression
  */
 
 import java.util.*;
--- a/test/java/util/concurrent/forkjoin/AccessControlContext.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/java/util/concurrent/forkjoin/AccessControlContext.java	Wed Feb 03 05:23:32 2021 +0000
@@ -92,15 +92,7 @@
             testInherit();
             break;
         case "default":
-            // Case fails because of "JDK-8249846: Change of behavior after
-            // JDK-8237117: Better ForkJoinPool behavior".
-            System.out.println("Known to fail with AccessControlException since 8u262 (see JDK-8249846)");
-            try {
-                testDefault();
-                throw new RuntimeException("Pool thread has inherited permissions.");
-            } catch (AccessControlException e) {
-                System.out.println("PASSED: " + e);
-            }
+            testDefault();
             break;
         }
 
--- a/test/javax/imageio/SetOutput.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/javax/imageio/SetOutput.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2020, 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
@@ -30,6 +30,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.imageio.ImageIO;
 import javax.imageio.ImageWriter;
@@ -42,13 +43,10 @@
     public static void main(String[] args) throws IOException {
         ImageWriter iw = new PNGImageWriter(null);
         File f = File.createTempFile("imageio", "tmp");
-        ImageOutputStream ios = ImageIO.createImageOutputStream(f);
-        try {
+        try (ImageOutputStream ios = ImageIO.createImageOutputStream(f)) {
             iw.setOutput(ios);
-        } catch (NullPointerException npe) {
-            f.delete();
-            throw new RuntimeException("Got NullPointerException!");
+        } finally {
+            Files.delete(f.toPath());
         }
-        f.delete();
     }
 }
--- a/test/javax/sound/midi/Devices/InitializationHang.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/javax/sound/midi/Devices/InitializationHang.java	Wed Feb 03 05:23:32 2021 +0000
@@ -28,6 +28,7 @@
 /**
  * @test
  * @bug 8068412
+ * @key headful
  * @author Sergey Bylokhov
  */
 public final class InitializationHang {
--- a/test/javax/sound/sampled/DirectAudio/bug6400879.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/javax/sound/sampled/DirectAudio/bug6400879.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -21,12 +21,13 @@
  * questions.
  */
 
-/* @test
-   @bug 6400879
-   @bug 7100140
-   @summary Tests that Start/Stop sequence doesn't hang
-   @author Alexey Menkov
-   @run main bug6400879
+/*
+ * @test
+ * @bug 6400879 7100140
+ * @summary Tests that Start/Stop sequence doesn't hang
+ * @author Alexey Menkov
+ * @run main bug6400879
+ * @key intermittent
  */
 
 import javax.sound.sampled.*;
--- a/test/javax/swing/JFileChooser/6738668/bug6738668.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/javax/swing/JFileChooser/6738668/bug6738668.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009,2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,21 +22,25 @@
  */
 
 /* @test
-   @bug 6738668
+   @bug 6738668 6962725
    @summary JFileChooser cannot be created under SecurityManager
    @author Pavel Porvatov
    @run main/othervm/policy=security.policy bug6738668
 */
 
-import javax.swing.*;
 import java.io.File;
+import javax.swing.JFileChooser;
+import javax.swing.UIManager;
 
 public class bug6738668 {
     public static void main(String[] args) throws Exception {
         for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) {
             UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
 
-            new JFileChooser(new File("c:/temp"));
+            String tmpdir = System.getProperty("java.io.tmpdir");
+            System.out.println("tmp dir " + tmpdir);
+            new JFileChooser(new File(tmpdir+"/temp"));
+
 
             System.out.println("Test passed for LookAndFeel " + lookAndFeelInfo.getClassName());
         }
--- a/test/javax/swing/JFileChooser/6738668/security.policy	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/javax/swing/JFileChooser/6738668/security.policy	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 grant {
-    permission java.io.FilePermission "C:\\temp\\*", "read";
-    permission java.io.FilePermission "C:\\temp", "read";
+    permission java.io.FilePermission "${java.io.tmpdir}${/}temp${/}*", "read";
+    permission java.io.FilePermission "${java.io.tmpdir}${/}temp", "read";
     permission java.util.PropertyPermission "*", "read";
 };
--- a/test/javax/swing/plaf/nimbus/8057791/bug8057791.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/javax/swing/plaf/nimbus/8057791/bug8057791.java	Wed Feb 03 05:23:32 2021 +0000
@@ -21,20 +21,21 @@
  * questions.
  */
 
-/* @test
-   @bug 8057791
-   @summary Selection in JList is drawn with wrong colors in Nimbus L&F
-   @author Anton Litvinov
-   @run main bug8057791
+ /* @test
+    @key headful
+    @bug 8057791 8160438 8163161
+    @summary Selection in JList is drawn with wrong colors in Nimbus L&F
+    @run main/timeout=500 bug8057791
  */
-
 import java.awt.Color;
+import java.awt.Font;
 import java.awt.Graphics;
+import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Robot;
 import java.awt.image.BufferedImage;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashSet;
 import javax.swing.DefaultListModel;
+import javax.swing.JFrame;
 import javax.swing.JList;
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
@@ -42,59 +43,148 @@
 import javax.swing.plaf.nimbus.NimbusLookAndFeel;
 
 public class bug8057791 {
-    public static void main(String[] args) {
+
+    private static JFrame frame;
+    private static JList<String> list;
+    private static DefaultListModel<String> model;
+    private static Robot robot;
+    private static final int SELECTED_INDEX = 0;
+    private static volatile String errorString = "";
+
+    public static void main(String[] args) throws Exception {
+        robot = new Robot();
+        robot.waitForIdle();
+        runSteps();
+        if (!errorString.isEmpty()) {
+            throw new RuntimeException("Error Log:\n" + errorString);
+        }
+    }
+
+    private static void runSteps() throws Exception {
+        if (tryNimbusLookAndFeel()) {
+            createUI();
+            robot.waitForIdle();
+            runColorTestCase();
+            robot.waitForIdle();
+            cleanUp();
+        }
+
+    }
+
+    private static boolean tryNimbusLookAndFeel()
+            throws Exception {
         try {
             UIManager.setLookAndFeel(new NimbusLookAndFeel());
-
-            SwingUtilities.invokeAndWait(new Runnable() {
-                @Override
-                public void run() {
-                    final int listWidth = 50;
-                    final int listHeight = 50;
-                    final int selCellIndex = 0;
+        } catch (UnsupportedLookAndFeelException e) {
+            errorString += e.getMessage();
+            return false;
+        }
+        return true;
+    }
 
-                    JList<String> list = new JList<String>();
-                    list.setSize(listWidth, listHeight);
-                    DefaultListModel<String> listModel = new DefaultListModel<String>();
-                    listModel.add(selCellIndex, "E");
-                    list.setModel(listModel);
-                    list.setSelectedIndex(selCellIndex);
-
-                    BufferedImage img = new BufferedImage(listWidth, listHeight,
-                        BufferedImage.TYPE_INT_ARGB);
-                    Graphics g = img.getGraphics();
-                    list.paint(g);
-                    g.dispose();
+    private static void createUI()
+            throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame = new JFrame();
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                list = new JList<>();
+                model = new DefaultListModel<>();
+                model.add(0, "@@");
+                Font font = list.getFont();
+                list.setFont(
+                        new Font(font.getFontName(),
+                                Font.BOLD,
+                                (int) (font.getSize2D() * 2)));
+                list.setModel(model);
+                list.setSelectedIndex(SELECTED_INDEX);
+                frame.add(list);
+                frame.pack();
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+            }
+        });
+    }
 
-                    Rectangle cellRect = list.getCellBounds(selCellIndex, selCellIndex);
-                    HashSet<Color> cellColors = new HashSet<Color>();
-                    int uniqueColorIndex = 0;
-                    for (int x = cellRect.x; x < (cellRect.x + cellRect.width); x++) {
-                        for (int y = cellRect.y; y < (cellRect.y + cellRect.height); y++) {
-                            Color cellColor = new Color(img.getRGB(x, y), true);
-                            if (cellColors.add(cellColor)) {
-                                System.err.println(String.format("Cell color #%d: %s",
-                                    uniqueColorIndex++, cellColor));
-                            }
-                        }
-                    }
+    private static void runColorTestCase() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                Rectangle cellBounds = list.getCellBounds(SELECTED_INDEX, SELECTED_INDEX);
+                cellBounds.x += list.getLocationOnScreen().x;
+                cellBounds.y += list.getLocationOnScreen().y;
+                //positive test cases
+                Color foregroundColor = list.getSelectionForeground();
+                Color backgroundColor = list.getSelectionBackground();
+                checkColor(foregroundColor, cellBounds);
+                checkColor(backgroundColor, cellBounds);
+                //negative test cases
+                Color changedForegroundColor = foregroundColor.darker();
+                Color changedBackgroundColor = backgroundColor.brighter();
+                checkNotColor(changedForegroundColor, cellBounds);
+                checkNotColor(changedBackgroundColor, cellBounds);
+            }
+        });
+    }
+
+    private static void checkColor(Color colorCheck, Rectangle bounds) {
+        if (!findColor(colorCheck, bounds)) {
+            String error = "[ERROR][" + colorCheck.toString()
+                    + "] Not found in selected cell";
+            errorString += error;
+        }
+    }
 
-                    Color selForegroundColor = list.getSelectionForeground();
-                    Color selBackgroundColor = list.getSelectionBackground();
-                    if (!cellColors.contains(new Color(selForegroundColor.getRGB(), true))) {
-                        throw new RuntimeException(String.format(
-                            "Selected cell is drawn without selection foreground color '%s'.",
-                            selForegroundColor));
-                    }
-                    if (!cellColors.contains(new Color(selBackgroundColor.getRGB(), true))) {
-                        throw new RuntimeException(String.format(
-                            "Selected cell is drawn without selection background color '%s'.",
-                            selBackgroundColor));
+    private static void checkNotColor(Color colorCheck, Rectangle bounds) {
+        if (findColor(colorCheck, bounds)) {
+            String error = "[ERROR][" + colorCheck.toString()
+                    + "] is found in selected cell. "
+                    + "Not supposed to be found in negative test case";
+            errorString += error;
+        }
+    }
+
+    private static boolean findColor(Color colorCheck, Rectangle bounds) {
+        BufferedImage img = new BufferedImage(bounds.width,
+                bounds.height,
+                BufferedImage.TYPE_INT_ARGB);
+        Graphics g = img.getGraphics();
+        list.paint(g);
+        g.dispose();
+        checkLoops:
+        for (int x = 0; x < bounds.width; x++) {
+            for (int y = 0; y < bounds.height; y++) {
+                Point relativePointCheck = new Point(bounds.x + x, bounds.y + y);
+                robot.mouseMove(relativePointCheck.x, relativePointCheck.y);
+                Color detectedColor = robot.getPixelColor(relativePointCheck.x,
+                        relativePointCheck.y);
+                if (detectedColor.equals(colorCheck)) {
+                    return true;
+                }
+                if (isMac()) {
+                    //One more chance for Mac due to non-Generic display setting
+                    detectedColor = new Color(img.getRGB(x, y), true);
+                    if (detectedColor.equals(colorCheck)) {
+                        return true;
                     }
                 }
-            });
-        } catch (UnsupportedLookAndFeelException | InterruptedException | InvocationTargetException e) {
-            throw new RuntimeException(e);
+            }
         }
+        return false;
+    }
+
+    private static boolean isMac() {
+        String osName = System.getProperty("os.name");
+        return osName.contains("Mac");
+    }
+
+    private static void cleanUp() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame.dispose();
+            }
+        });
     }
 }
--- a/test/javax/swing/regtesthelpers/Util.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/javax/swing/regtesthelpers/Util.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.Callable;
-//import sun.swing.*;
 
 /**
  * <p>This class contains utilities useful for regression testing.
@@ -264,7 +263,7 @@
         if (osName.contains("OS X")) {
             result.add(KeyEvent.VK_CONTROL);
         }
-        result.add(KeyEvent.ALT_MASK);
+        result.add(KeyEvent.VK_ALT);
         return result;
     }
 }
--- a/test/javax/swing/text/html/parser/Test8017492.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/javax/swing/text/html/parser/Test8017492.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2020, 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
@@ -70,6 +70,7 @@
         thread.start();
         thread.join();
         // add error handling
+        SunToolkit.createNewAppContext();
         HTMLDocument document = new HTMLDocument() {
             @Override
             public HTMLEditorKit.ParserCallback getReader(int pos) {
--- a/test/javax/xml/crypto/dsig/GenerationTests.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/javax/xml/crypto/dsig/GenerationTests.java	Wed Feb 03 05:23:32 2021 +0000
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184
- * 8038349 8046724 8074784 8079693 8177334 8210736 8217878
+ * 8038349 8046724 8074784 8079693 8177334 8205507 8210736 8217878
  * @summary Basic unit tests for generating XML Signatures with JSR 105
  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
  *     X509KeySelector.java GenerationTests.java
@@ -268,6 +268,26 @@
         KeyValue, x509data, KeyName
     }
 
+    // cached keys (for performance) used by test_create_detached_signature().
+    private static HashMap<String,Key[]> cachedKeys = new HashMap<>();
+
+    // Load cachedKeys persisted in a file to reproduce a failure.
+    // The keys are always saved to "cached-keys" but you can rename
+    // it to a different file name and load it here. Note: The keys will
+    // always be persisted so renaming is a good idea although the
+    // content might not change.
+    static {
+        String cacheFile = System.getProperty("use.cached.keys");
+        if (cacheFile != null) {
+            try (FileInputStream fis = new FileInputStream(cacheFile);
+                 ObjectInputStream ois = new ObjectInputStream(fis)) {
+                cachedKeys = (HashMap<String,Key[]>) ois.readObject();
+            } catch (Exception e) {
+                throw new AssertionError("Cannot read " + cacheFile, e);
+            }
+        }
+    }
+
     private static boolean result = true;
 
     public static void main(String args[]) throws Exception {
@@ -432,6 +452,12 @@
                     XMLSignatureException.class);
         }
 
+        // persist cached keys to a file.
+        try (FileOutputStream fos = new FileOutputStream("cached-keys", true);
+             ObjectOutputStream oos = new ObjectOutputStream(fos)) {
+            oos.writeObject(cachedKeys);
+        }
+
         if (!result) {
             throw new RuntimeException("At least one test case failed");
         }
@@ -1726,37 +1752,9 @@
 
         SignatureMethod sm = fac.newSignatureMethod(signatureMethod, null);
 
-        Key signingKey;
-        Key validationKey;
-        if (signatureMethod.contains("#hmac-")) {
-            // http://...#hmac-sha1 -> hmac-sha1 -> hmacsha1
-            String algName = signatureMethod
-                    .substring(signatureMethod.indexOf('#') + 1)
-                    .replace("-", "");
-            KeyGenerator kg = KeyGenerator.getInstance(algName);
-            signingKey = kg.generateKey();
-            validationKey = signingKey;
-        } else {
-            KeyPairGenerator kpg;
-            SecureRandom random = new SecureRandom();
-            if (signatureMethod.contains("#rsa-")
-                    || signatureMethod.contains("-rsa-MGF1")) {
-                kpg = KeyPairGenerator.getInstance("RSA");
-                kpg.initialize(signatureMethod.contains("#sha512-rsa-MGF1")
-                        ? 2048 : 1024, random);
-            } else if (signatureMethod.contains("#dsa-")) {
-                kpg = KeyPairGenerator.getInstance("DSA");
-                kpg.initialize(1024, random);
-            } else if (signatureMethod.contains("#ecdsa-")) {
-                kpg = KeyPairGenerator.getInstance("EC");
-                kpg.initialize(256, random);
-            } else {
-                throw new RuntimeException("Unsupported signature algorithm");
-            }
-            KeyPair kp = kpg.generateKeyPair();
-            validationKey = kp.getPublic();
-            signingKey = kp.getPrivate();
-        }
+        Key[] pair = getCachedKeys(signatureMethod);
+        Key signingKey = pair[0];
+        Key validationKey = pair[1];
 
         SignedInfo si = fac.newSignedInfo(cm, sm, refs, null);
 
@@ -1852,6 +1850,44 @@
         setup();
     }
 
+    private static Key[] getCachedKeys(String signatureMethod) {
+        return cachedKeys.computeIfAbsent(signatureMethod, sm -> {
+            try {
+                System.out.print("<create keys for " + sm + ">");
+                System.out.flush();
+                if (sm.contains("#hmac-")) {
+                    // http://...#hmac-sha1 -> hmac-sha1 -> hmacsha1
+                    String algName = sm
+                            .substring(sm.indexOf('#') + 1)
+                            .replace("-", "");
+                    KeyGenerator kg = KeyGenerator.getInstance(algName);
+                    Key signingKey = kg.generateKey();
+                    return new Key[] { signingKey, signingKey};
+                } else {
+                    KeyPairGenerator kpg;
+                    if (sm.contains("#rsa-")
+                            || sm.contains("-rsa-MGF1")) {
+                        kpg = KeyPairGenerator.getInstance("RSA");
+                        kpg.initialize(
+                                sm.contains("#sha512-rsa-MGF1") ? 2048 : 1024);
+                    } else if (sm.contains("#dsa-")) {
+                        kpg = KeyPairGenerator.getInstance("DSA");
+                        kpg.initialize(1024);
+                    } else if (sm.contains("#ecdsa-")) {
+                        kpg = KeyPairGenerator.getInstance("EC");
+                        kpg.initialize(256);
+                    } else {
+                        throw new RuntimeException("Unsupported signature algorithm");
+                    }
+                    KeyPair kp = kpg.generateKeyPair();
+                    return new Key[] { kp.getPrivate(), kp.getPublic()};
+                }
+            } catch (NoSuchAlgorithmException e) {
+                throw new AssertionError("Should not happen", e);
+            }
+        });
+    }
+
     private static final String DSA_Y =
         "070662842167565771936588335128634396171789331656318483584455493822" +
         "400811200853331373030669235424928346190274044631949560438023934623" +
--- a/test/jdk/internal/platform/docker/Dockerfile-BasicTest	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-FROM oraclelinux:7.6
-MAINTAINER mikhailo.seledtsov@oracle.com
-
-COPY /jdk /jdk
-
-ENV JAVA_HOME=/jdk
-
-CMD ["/bin/bash"]
--- a/test/jdk/internal/platform/docker/Dockerfile-BasicTest-aarch64	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-# Use generic ubuntu Linux on AArch64
-FROM aarch64/ubuntu
-
-COPY /jdk /jdk
-
-ENV JAVA_HOME=/jdk
-
-CMD ["/bin/bash"]
--- a/test/jdk/internal/platform/docker/Dockerfile-BasicTest-ppc64le	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-# test on x86_64 uses Oracle Linux but we do not have this for ppc64le
-# so use some other Linux where OpenJDK works 
-# FROM oraclelinux:7.2
-FROM ppc64le/ubuntu
-
-COPY /jdk /jdk
-
-ENV JAVA_HOME=/jdk
-
-CMD ["/bin/bash"]
--- a/test/jdk/internal/platform/docker/Dockerfile-BasicTest-s390x	Tue Jan 19 17:18:23 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-FROM s390x/ubuntu
-
-COPY /jdk /jdk
-
-ENV JAVA_HOME=/jdk
-
-CMD ["/bin/bash"]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/internal/platform/docker/GetFreeSwapSpaceSize.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.management.OperatingSystemMXBean;
+import java.lang.management.ManagementFactory;
+
+public class GetFreeSwapSpaceSize {
+    public static void main(String[] args) {
+        System.out.println("TestGetFreeSwapSpaceSize");
+        OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
+        for (int i = 0; i < 100; i++) {
+            long size = osBean.getFreeSwapSpaceSize();
+            if (size < 0) {
+                System.out.println("Error: getFreeSwapSpaceSize returns " + size);
+                System.exit(-1);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/internal/platform/docker/TestGetFreeSwapSpaceSize.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8242480
+ * @library /lib
+ * @build GetFreeSwapSpaceSize
+ * @run driver TestGetFreeSwapSpaceSize
+ */
+import jdk.test.lib.containers.docker.Common;
+import jdk.test.lib.containers.docker.DockerRunOptions;
+import jdk.test.lib.containers.docker.DockerTestUtils;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class TestGetFreeSwapSpaceSize {
+    private static final String imageName = Common.imageName("memory");
+
+    public static void main(String[] args) throws Exception {
+        if (!DockerTestUtils.canTestDocker()) {
+            return;
+        }
+
+        DockerTestUtils.buildJdkDockerImage(imageName, "Dockerfile-BasicTest", "jdk-docker");
+
+        try {
+            testGetFreeSwapSpaceSize(
+                "150M", Integer.toString(((int) Math.pow(2, 20)) * 150),
+                "150M", Integer.toString(0)
+            );
+        } finally {
+            if (!DockerTestUtils.RETAIN_IMAGE_AFTER_TEST) {
+                DockerTestUtils.removeDockerImage(imageName);
+            }
+        }
+    }
+
+    private static void testGetFreeSwapSpaceSize(String memoryAllocation, String expectedMemory,
+            String swapAllocation, String expectedSwap) throws Exception {
+        Common.logNewTestCase("TestGetFreeSwapSpaceSize");
+
+        DockerRunOptions opts = Common.newOpts(imageName, "GetFreeSwapSpaceSize")
+            .addDockerOpts(
+                "--memory", memoryAllocation,
+                "--memory-swap", swapAllocation
+            );
+
+        OutputAnalyzer out = DockerTestUtils.dockerRunJava(opts);
+        out.shouldHaveExitValue(0)
+           .shouldContain("TestGetFreeSwapSpaceSize");
+    }
+}
--- a/test/jdk/internal/platform/docker/TestSystemMetrics.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/jdk/internal/platform/docker/TestSystemMetrics.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@
             DockerRunOptions opts =
                     new DockerRunOptions(imageName, "/jdk/bin/java", "jdk.test.lib.containers.cgroup.MetricsTester");
             opts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/");
+            opts.addDockerOpts("--memory=256m");
             opts.addJavaOpts("-cp", "/test-classes/");
             DockerTestUtils.dockerRunJava(opts).shouldHaveExitValue(0).shouldContain("TEST PASSED!!!");
         } finally {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jfr/javaagent/Test8252904.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, Azul Systems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8252904
+ * @key jfr
+ * @summary Tests that JFR event classes can be transformed via JVMTI
+ *
+ * @library /lib/testlibrary /lib /
+ * @modules java.instrument
+ *
+ * @build jdk.jfr.javaagent.Test8252904
+ *
+ * @run driver jdk.test.lib.util.JavaAgentBuilder
+ *             jdk.jfr.javaagent.Test8252904 Test8252904Agent.jar
+ *
+ * @run main/othervm -javaagent:Test8252904Agent.jar jdk.jfr.javaagent.Test8252904
+ */
+
+package jdk.jfr.javaagent;
+
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.Instrumentation;
+import java.lang.instrument.IllegalClassFormatException;
+import java.security.ProtectionDomain;
+import jdk.jfr.*;
+
+public class Test8252904 {
+    private Instrumentation instr;
+
+    private static class Transformer implements ClassFileTransformer {
+        public byte[] transform(ClassLoader loader, String fullyQualifiedClassName, Class<?> classBeingRedefined,
+                                ProtectionDomain protectionDomain, byte[] classBytes) throws IllegalClassFormatException {
+            if ("jdk/jfr/Event".equals(fullyQualifiedClassName))
+                System.out.println("transforming");
+            return "jdk/jfr/Event".equals(fullyQualifiedClassName) ? classBytes : null;
+        }
+    }
+
+    // Called when agent is loaded from command line
+    public static void agentmain(String agentArgs, Instrumentation inst) throws Exception {
+        inst.addTransformer(new Transformer());
+    }
+
+    // Called when agent is dynamically loaded
+    public static void premain(String agentArgs, Instrumentation inst) throws Exception {
+        inst.addTransformer(new Transformer());
+    }
+
+
+    public static void main(String... arg) throws Exception {
+        Configuration c = Configuration.getConfiguration("default");
+        Recording r = new Recording(c);
+        r.setToDisk(false);
+        r.start();
+        System.gc();
+        r.stop();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jfr/jcmd/TestJcmdDumpWithFileName.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.jfr.jcmd;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.stream.Stream;
+
+import jdk.jfr.Recording;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.process.ProcessTools;
+
+/**
+ * @test
+ * @bug 8220657
+ * @key jfr
+ * @library /lib /
+ * @run main/othervm jdk.jfr.jcmd.TestJcmdDumpWithFileName
+ */
+public class TestJcmdDumpWithFileName {
+
+    public static void main(String[] args) throws Exception {
+        testDumpAll();
+        testDumpNamed();
+        testDumpNamedWithFilename();
+    }
+
+    private static void testDumpAll() throws Exception {
+        Path p = Paths.get("testDumpAll.jfr").toAbsolutePath();
+        try (Recording r = new Recording()) {
+            r.setName("testDumpAll");
+            r.setDestination(p);
+            r.start();
+
+            JcmdHelper.jcmd("JFR.dump");
+
+            Asserts.assertFalse(namedFile(p), "Unexpected file: " + p.toString());
+            Asserts.assertTrue(generatedFile(), "Expected generated file");
+        }
+        cleanup();
+    }
+
+    private static void testDumpNamed() throws Exception {
+        Path p = Paths.get("testDumpNamed.jfr").toAbsolutePath();
+        try (Recording r = new Recording()) {
+            r.setName("testDumpNamed");
+            r.setDestination(p);
+            r.start();
+
+            JcmdHelper.jcmd("JFR.dump", "name=testDumpNamed");
+
+            Asserts.assertTrue(namedFile(p), "Expected file: " + p.toString());
+            Asserts.assertFalse(generatedFile(), "Unexpected generated file");
+        }
+        cleanup();
+    }
+
+    private static void testDumpNamedWithFilename() throws Exception {
+        Path p = Paths.get("testDumpNamedWithFilename.jfr").toAbsolutePath();
+        Path override = Paths.get("override.jfr").toAbsolutePath();
+        try (Recording r = new Recording()) {
+            r.setName("testDumpNamedWithFilename");
+            r.setDestination(p);
+            r.start();
+
+            JcmdHelper.jcmd("JFR.dump", "name=testDumpNamedWithFilename", "filename=" + override.toString());
+
+            Asserts.assertFalse(namedFile(p), "Unexpected file: " + p.toString());
+            Asserts.assertTrue(namedFile(override), "Expected file: " + override.toString());
+            Asserts.assertFalse(generatedFile(), "Unexpected generated file");
+        }
+        cleanup();
+    }
+
+    private static boolean namedFile(Path dumpFile) throws IOException {
+        return Files.exists(dumpFile) && (Files.size(dumpFile) > 0);
+    }
+
+    private static boolean generatedFile() throws Exception {
+        long pid = ProcessTools.getProcessId();
+        try (Stream<Path> stream = Files.find(Paths.get("."), 1, (p, a) -> p.toString()
+                .matches("^.*hotspot-pid-" + pid + "-[0-9_]+\\.jfr$") && (a.size() > 0L))) {
+            return stream.findAny()
+                         .isPresent();
+        }
+    }
+
+    private static void cleanup() throws IOException {
+        try (Stream<Path> stream = Files.find(Paths.get("."), 1, (p, a) -> p.toString().endsWith(".jfr"))) {
+            stream.forEach(p -> p.toFile().delete());
+        }
+    }
+
+}
--- a/test/jdk/jfr/jvm/TestDumpOnCrash.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/jdk/jfr/jvm/TestDumpOnCrash.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
  */
 package jdk.jfr.jvm;
 
+import java.io.IOException;
 import java.lang.reflect.Field;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -54,7 +55,7 @@
     private static final CharSequence LOG_FILE_EXTENSION = ".log";
     private static final CharSequence JFR_FILE_EXTENSION = ".jfr";
 
-    static class Crasher {
+    static class CrasherIllegalAccess {
         public static void main(String[] args) {
           try {
             Field theUnsafeRefLocation = Unsafe.class.getDeclaredField("theUnsafe");
@@ -67,44 +68,73 @@
         }
     }
 
-    public static void main(String[] args) throws Exception {
-        processOutput(runProcess());
+    static class CrasherHalt {
+        public static void main(String[] args) {
+            System.out.println("Running Runtime.getRuntime.halt");
+            Runtime.getRuntime().halt(17);
+        }
+    }
+
+    static class CrasherSig {
+        public static void main(String[] args) throws Exception {
+            String signalName = args[0];
+            System.out.println("Sending SIG" + signalName + " to process " + ProcessTools.getProcessId());
+            Runtime.getRuntime().exec("kill -" + signalName + " " + ProcessTools.getProcessId()).waitFor();
+        }
     }
 
-    private static OutputAnalyzer runProcess() throws Exception {
-        return new OutputAnalyzer(
-            ProcessTools.createJavaProcessBuilder(true,
+    public static void main(String[] args) throws Exception {
+        verify(runProcess(CrasherIllegalAccess.class.getName(), "", true));
+        verify(runProcess(CrasherIllegalAccess.class.getName(), "", false));
+        verify(runProcess(CrasherHalt.class.getName(), "", true));
+        verify(runProcess(CrasherHalt.class.getName(), "", false));
+
+        // Verification is excluded for the test case below until 8219680 is fixed
+        long pid = runProcess(CrasherSig.class.getName(), "FPE", true);
+        // @ignore 8219680
+        // verify(pid);
+    }
+
+    private static long runProcess(String crasher, String signal, boolean disk) throws Exception {
+        System.out.println("Test case for crasher " + crasher);
+        final String flightRecordingOptions = "dumponexit=true,disk=" + Boolean.toString(disk);
+        Process p = ProcessTools.createJavaProcessBuilder(true,
                 "-Xmx64m",
-                "-Xint",
                 "-XX:-TransmitErrorReport",
                 "-XX:-CreateMinidumpOnCrash",
                 /*"--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",*/
-                "-XX:StartFlightRecording=dumponexit=true",
-                Crasher.class.getName()).start());
+                "-XX:StartFlightRecording=" + flightRecordingOptions,
+                crasher,
+                signal)
+            .start();
+
+        OutputAnalyzer output = new OutputAnalyzer(p);
+        System.out.println("========== Crasher process output:");
+        System.out.println(output.getOutput());
+        System.out.println("==================================");
+
+        return getPid(output);
     }
 
-    private static void processOutput(OutputAnalyzer output) throws Exception {
-        //output.shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
+    private static void verify(long pid) throws IOException {
+        String fileName = "hs_err_pid" + pid + ".jfr";
+        Path file = Paths.get(fileName).toAbsolutePath().normalize();
 
-        final Path jfrEmergencyFilePath = getHsErrJfrPath(output);
-        Asserts.assertTrue(Files.exists(jfrEmergencyFilePath), "No emergency jfr recording file " + jfrEmergencyFilePath + " exists");
-        Asserts.assertNotEquals(Files.size(jfrEmergencyFilePath), 0L, "File length 0. Should at least be some bytes");
-        System.out.printf("File size=%d%n", Files.size(jfrEmergencyFilePath));
+        Asserts.assertTrue(Files.exists(file), "No emergency jfr recording file " + file + " exists");
+        Asserts.assertNotEquals(Files.size(file), 0L, "File length 0. Should at least be some bytes");
+        System.out.printf("File size=%d%n", Files.size(file));
 
-        List<RecordedEvent> events = RecordingFile.readAllEvents(jfrEmergencyFilePath);
+        List<RecordedEvent> events = RecordingFile.readAllEvents(file);
         Asserts.assertFalse(events.isEmpty(), "No event found");
         System.out.printf("Found event %s%n", events.get(0).getEventType().getName());
     }
 
-    private static Path getHsErrJfrPath(OutputAnalyzer output) throws Exception {
-        // extract to find hs-err_pid log file location
-        final String hs_err_pid_log_file = output.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
-        if (hs_err_pid_log_file == null) {
-            throw new RuntimeException("Did not find hs_err_pid.log file in output.\n");
+    private static long getPid(OutputAnalyzer output) {
+        final String pid = output.firstMatch("Use jcmd (\\d+) JFR.dump", 1);
+        if (pid == null) {
+            throw new RuntimeException("Did not find pid in output.\n");
         }
-        // the dumped out jfr file should have the same name and location but with a .jfr extension
-        final String hs_err_pid_jfr_file = hs_err_pid_log_file.replace(LOG_FILE_EXTENSION, JFR_FILE_EXTENSION);
-        return Paths.get(hs_err_pid_jfr_file);
+        return Long.parseLong(pid);
     }
 }
 
--- a/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,7 +85,7 @@
                 String mountPoint = paths[1];
                 if (root != null && cgroupPath != null) {
                     if (root.equals("/")) {
-                        if (cgroupPath.equals("/")) {
+                        if (!cgroupPath.equals("/")) {
                             finalPath = mountPoint + cgroupPath;
                         } else {
                             finalPath = mountPoint;
@@ -94,7 +94,7 @@
                         if (root.equals(cgroupPath)) {
                             finalPath = mountPoint;
                         } else {
-                            if (root.indexOf(cgroupPath) == 0) {
+                            if (cgroupPath.startsWith(root)) {
                                 if (cgroupPath.length() > root.length()) {
                                     String cgroupSubstr = cgroupPath.substring(root.length());
                                     finalPath = mountPoint + cgroupSubstr;
@@ -103,7 +103,7 @@
                         }
                     }
                 }
-                subSystemPaths.put(subSystem, new String[]{finalPath});
+                subSystemPaths.put(subSystem, new String[]{finalPath, mountPoint});
             }
         }
     }
@@ -560,7 +560,7 @@
         long memoryMaxUsage = metrics.getMemoryMaxUsage();
         long memoryUsage = metrics.getMemoryUsage();
 
-        long[] ll = new long[64*1024*1024]; // 64M
+        byte[] bb = new byte[64*1024*1024]; // 64M
 
         long newMemoryMaxUsage = metrics.getMemoryMaxUsage();
         long newMemoryUsage = metrics.getMemoryUsage();
--- a/test/lib/jdk/test/lib/containers/docker/Common.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/lib/jdk/test/lib/containers/docker/Common.java	Wed Feb 03 05:23:32 2021 +0000
@@ -53,7 +53,7 @@
     // create simple commonly used options
     public static DockerRunOptions newOpts(String imageNameAndTag) {
         return new DockerRunOptions(imageNameAndTag, "/jdk/bin/java", "-version")
-            .addJavaOpts("-Xlog:os+container=trace");
+            .addJavaOpts("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintContainerInfo");
     }
 
 
@@ -62,7 +62,8 @@
         DockerRunOptions opts =
             new DockerRunOptions(imageNameAndTag, "/jdk/bin/java", testClass);
         opts.addDockerOpts("--volume", Utils.TEST_CLASSES + ":/test-classes/");
-        opts.addJavaOpts("-Xlog:os+container=trace", "-cp", "/test-classes/");
+        opts.addJavaOpts("-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintContainerInfo");
+        opts.addJavaOpts("-cp", "/test-classes/");
         return opts;
     }
 
--- a/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/lib/jdk/test/lib/containers/docker/DockerTestUtils.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Path;
@@ -35,7 +36,6 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import jdk.test.lib.Platform;
 import jdk.test.lib.Utils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
@@ -46,8 +46,23 @@
     private static boolean isDockerEngineAvailable = false;
     private static boolean wasDockerEngineChecked = false;
 
-    // Diagnostics: set to true to enable more diagnostic info
-    private static final boolean DEBUG = false;
+    // Use this property to specify docker location on your system.
+    // E.g.: "/usr/local/bin/docker".
+    private static final String DOCKER_COMMAND =
+        System.getProperty("jdk.test.docker.command", "docker");
+
+    // Set this property to true to retain image after test. By default
+    // images are removed after test execution completes.
+    // Retaining the image can be useful for diagnostics and image inspection.
+    // E.g.: start image interactively: docker run -it <IMAGE_NAME>.
+    public static final boolean RETAIN_IMAGE_AFTER_TEST =
+        Boolean.getBoolean("jdk.test.docker.retain.image");
+
+    // Path to a JDK under test.
+    // This may be useful when developing tests on non-Linux platforms.
+    public static final String JDK_UNDER_TEST =
+        System.getProperty("jdk.test.docker.jdk", Utils.TEST_JDK);
+
 
     /**
      * Optimized check of whether the docker engine is available in a given
@@ -95,7 +110,7 @@
      */
     private static boolean isDockerEngineAvailableCheck() throws Exception {
         try {
-            execute("docker", "ps")
+            execute(DOCKER_COMMAND, "ps")
                 .shouldHaveExitValue(0)
                 .shouldContain("CONTAINER")
                 .shouldContain("IMAGE");
@@ -126,13 +141,8 @@
         if (Files.exists(buildDir)) {
             throw new RuntimeException("The docker build directory already exists: " + buildDir);
         }
-        // check for the existance of a platform specific docker file as well
-        String platformSpecificDockerfile = dockerfile + "-" + Platform.getOsArch();
-        if (Files.exists(Paths.get(Utils.TEST_SRC, platformSpecificDockerfile))) {
-          dockerfile = platformSpecificDockerfile;
-        }
 
-        Path jdkSrcDir = Paths.get(Utils.TEST_JDK);
+        Path jdkSrcDir = Paths.get(JDK_UNDER_TEST);
         Path jdkDstDir = buildDir.resolve("jdk");
 
         Files.createDirectories(jdkDstDir);
@@ -158,11 +168,12 @@
     public static void
         buildDockerImage(String imageName, Path dockerfile, Path buildDir) throws Exception {
 
-        // Copy docker file to the build dir
-        Files.copy(dockerfile, buildDir.resolve("Dockerfile"));
+        generateDockerFile(buildDir.resolve("Dockerfile"),
+                           DockerfileConfig.getBaseImageName(),
+                           DockerfileConfig.getBaseImageVersion());
 
         // Build the docker
-        execute("docker", "build", "--no-cache", "--tag", imageName, buildDir.toString())
+        execute(DOCKER_COMMAND, "build", "--no-cache", "--tag", imageName, buildDir.toString())
             .shouldHaveExitValue(0)
             .shouldContain("Successfully built");
     }
@@ -179,7 +190,7 @@
     public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Exception {
         ArrayList<String> cmd = new ArrayList<>();
 
-        cmd.add("docker");
+        cmd.add(DOCKER_COMMAND);
         cmd.add("run");
         if (opts.tty)
             cmd.add("--tty=true");
@@ -206,11 +217,10 @@
      * Remove docker image
      *
      * @param DockerRunOptions optins for running docker
-     * @return output of the command
      * @throws Exception
      */
-    public static OutputAnalyzer removeDockerImage(String imageNameAndTag) throws Exception {
-        return execute("docker", "rmi", "--force", imageNameAndTag);
+    public static void removeDockerImage(String imageNameAndTag) throws Exception {
+            execute(DOCKER_COMMAND, "rmi", "--force", imageNameAndTag);
     }
 
 
@@ -250,6 +260,18 @@
     }
 
 
+    private static void generateDockerFile(Path dockerfile, String baseImage,
+                                           String baseImageVersion) throws Exception {
+        String template =
+            "FROM %s:%s\n" +
+            "COPY /jdk /jdk\n" +
+            "ENV JAVA_HOME=/jdk\n" +
+            "CMD [\"/bin/bash\"]\n";
+        String dockerFileStr = String.format(template, baseImage, baseImageVersion);
+        Files.write(dockerfile, dockerFileStr.getBytes(StandardCharsets.UTF_8));
+    }
+
+
     private static class CopyFileVisitor extends SimpleFileVisitor<Path> {
         private final Path src;
         private final Path dst;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/containers/docker/DockerfileConfig.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 jdk.test.lib.containers.docker;
+
+import jdk.test.lib.Platform;
+
+// Use the following properties to specify docker base image at test execution time:
+// Image name: jdk.test.docker.image.name
+// Image version: jdk.test.docker.image.version
+// Usage:
+//     jtreg -Djdk.test.docker.image.name=<BASE_IMAGE_NAME> -Djdk.test.docker.image.version=<BASE_IMAGE_VERSION> test/hotspot/jtreg/runtime/containers/docker/
+// E.g.:
+//     jtreg -Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest test/hotspot/jtreg/runtime/containers/docker/
+// Using make:
+//     make test TEST="test/hotspot/jtreg/runtime/containers/docker" JTREG="JAVA_OPTIONS=-Djdk.test.docker.image.name=ubuntu -Djdk.test.docker.image.version=latest"
+// Note: base image version should not be an empty string. Use "latest" to get the latest version.
+
+public class DockerfileConfig {
+    static String getBaseImageName() {
+        String name = System.getProperty("jdk.test.docker.image.name");
+        if (name != null) {
+            System.out.println("DockerfileConfig: using custom image name: " + name);
+            return name;
+        }
+
+        switch (Platform.getOsArch()) {
+            case "aarch64":
+                return "aarch64/ubuntu";
+            case "ppc64le":
+                return "ppc64le/ubuntu";
+            case "s390x":
+                return "s390x/ubuntu";
+            default:
+                return "oraclelinux";
+        }
+    }
+
+    static String getBaseImageVersion() {
+        String version = System.getProperty("jdk.test.docker.image.version");
+        if (version != null) {
+            System.out.println("DockerfileConfig: using custom image version: " + version);
+            return version;
+        }
+
+        switch (Platform.getOsArch()) {
+            case "aarch64":
+            case "ppc64le":
+            case "s390x":
+                return "latest";
+            default:
+                return "7.6";
+        }
+    }
+}
--- a/test/security/infra/java/security/cert/CertPathValidator/certification/GlobalSignR6CA.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/security/infra/java/security/cert/CertPathValidator/certification/GlobalSignR6CA.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
  /*
  * @test
- * @bug 8216577
+ * @bug 8216577 8249176
  * @summary Interoperability tests with GlobalSign R6 CA
  * @build ValidatePathWithParams
  * @run main/othervm -Djava.security.debug=certpath GlobalSignR6CA OCSP
@@ -42,139 +42,150 @@
  */
 public class GlobalSignR6CA {
 
-    // Owner: CN=GlobalSign R6 Admin CA - SHA256 - G3, O=GlobalSign nv-sa, C=BE
+    // Owner: CN=GlobalSign Atlas R6 EV TLS CA 2020, O=GlobalSign nv-sa, C=BE
     // Issuer: CN=GlobalSign, O=GlobalSign, OU=GlobalSign Root CA - R6
-    // Serial number: 48a402ddb5defd50accfc0fcf13f
-    // Valid from: Tue Sep 20 17:00:00 PDT 2016 until: Mon Sep 20 17:00:00 PDT 2021
+    // Serial number: 7803182afbecd89eb19309bb4a25bdaa
+    // Valid from: Mon Jul 27 17:00:00 PDT 2020 until: Sat Jul 27 17:00:00 PDT 2030
     private static final String INT = "-----BEGIN CERTIFICATE-----\n" +
-            "MIIFmjCCA4KgAwIBAgIOSKQC3bXe/VCsz8D88T8wDQYJKoZIhvcNAQELBQAwTDEg\n" +
-            "MB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2Jh\n" +
-            "bFNpZ24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMTYwOTIxMDAwMDAwWhcNMjEw\n" +
-            "OTIxMDAwMDAwWjBXMQswCQYDVQQGEwJCRTEZMBcGA1UEChMQR2xvYmFsU2lnbiBu\n" +
-            "di1zYTEtMCsGA1UEAxMkR2xvYmFsU2lnbiBSNiBBZG1pbiBDQSAtIFNIQTI1NiAt\n" +
-            "IEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmyyfJA4reymawDG1\n" +
-            "FNDCSFBqst/+Jih2Zg1ThovSfkxVWcviBhIZfu0t/Hv9hmolN2dxPibKCHhjyfMp\n" +
-            "WaGj+S8VPPaR3xoeOvHtuf/2uOyBZa/3mgiWWRF50fLy0fzyWNJL9lbTH459oUci\n" +
-            "QN2H0nFEuD1tGGzFdjtXCRVjWy9dZW8Vv2831buzuPLTtOPSKhqOiigpXFTo6SL9\n" +
-            "n/NHQ4HI7WV+DMB7yOPEERqQzfi28v1B2j4GOT4wqXncbw5uFZdYobBfRNv3VNdk\n" +
-            "p/2Frtm15ePBIAAb4o28du+orJUuVVpxreeEyVBGJuaP0RWksjSnqkSbPm9MEY0k\n" +
-            "dS7tgwIDAQABo4IBbTCCAWkwDgYDVR0PAQH/BAQDAgEGMCcGA1UdJQQgMB4GCCsG\n" +
-            "AQUFBwMBBggrBgEFBQcDAgYIKwYBBQUHAwkwEgYDVR0TAQH/BAgwBgEB/wIBADAd\n" +
-            "BgNVHQ4EFgQUgUlc6QW/DIigOJayXUEDWun/14cwHwYDVR0jBBgwFoAUrmwFo5MT\n" +
-            "4qLn4tcc1sfwf8hnU6AwPgYIKwYBBQUHAQEEMjAwMC4GCCsGAQUFBzABhiJodHRw\n" +
-            "Oi8vb2NzcDIuZ2xvYmFsc2lnbi5jb20vcm9vdHI2MDYGA1UdHwQvMC0wK6ApoCeG\n" +
-            "JWh0dHA6Ly9jcmwuZ2xvYmFsc2lnbi5jb20vcm9vdC1yNi5jcmwwYgYDVR0gBFsw\n" +
-            "WTAHBgVngQwBATALBgkrBgEEAaAyAQEwQQYJKwYBBAGgMgFfMDQwMgYIKwYBBQUH\n" +
-            "AgEWJmh0dHBzOi8vd3d3Lmdsb2JhbHNpZ24uY29tL3JlcG9zaXRvcnkvMA0GCSqG\n" +
-            "SIb3DQEBCwUAA4ICAQBovPHk0rWZ5tGQ3NiYORqZNfSh2KH0RxweRE+ZTpnGOZjE\n" +
-            "vRQYLYm/vf2q+v2IcESmpVCjq1eN0k75wc/4475Y9RH6xK7ai1+O8HHDgj8GK4iZ\n" +
-            "0ILbKtJQ2/ih19TMO7M3Y/tZByLPcdy8cuDMoCWoQJqUFtM8l784S5lEjefrcwkZ\n" +
-            "uNOdTrZbsqXY71Xfa61DNuW3lIt/w34myrKG0xRyGicI9P9VpcWYdWCKpwVe10MP\n" +
-            "d4WQ/lclJZLrLljmn76bc+q/L2Sw+tpadsD2qP3l05FhRqcF5iI9lIw77KIU15Jt\n" +
-            "QysmI7xTjByjny/OiIYP/7PKQjh+KEe/17GOg0AamdI9dbaOHRcyHFht01ymaphf\n" +
-            "kU3hjWb2bdtVLuDsIKfGN/QDXSmv0ThKsgkj3OOiLUpllApr5SU2tY40rpZ210iD\n" +
-            "/jA18LYwBmR64t3e7ud/tDz4c/YLY8p6vPLdASbbwyptj93n0c0HXpjdcrx/XOQa\n" +
-            "ogw6JzJ2v3Kok94frBKKdoxg4SnMvZoakM1SbY6Q3XlC24qVnVuWJ142rVkCFixZ\n" +
-            "Sb5ZEB7fxk/2YfaWkSW3uejwh2qN7qXji0S1ALNbASJATYqMgdJVz+25yOBfxFN6\n" +
-            "KzNbvmVmEM/hnKaQxePhwForQjDFaep1RO5Yg4wnIcLRC3atKgkIIA6YDNUcog==\n" +
+            "MIIGwDCCBKigAwIBAgIQeAMYKvvs2J6xkwm7SiW9qjANBgkqhkiG9w0BAQwFADBM\n" +
+            "MSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xv\n" +
+            "YmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjAeFw0yMDA3MjgwMDAwMDBaFw0z\n" +
+            "MDA3MjgwMDAwMDBaMFUxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWdu\n" +
+            "IG52LXNhMSswKQYDVQQDEyJHbG9iYWxTaWduIEF0bGFzIFI2IEVWIFRMUyBDQSAy\n" +
+            "MDIwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtQ8IiN2Ukq/Clynv\n" +
+            "HhqugFQg5SXIyVO4ZRnxo0hNnaek78LRn4Bkaqcwv6Ls0Ftn4bK2zvBaS1zsfUTA\n" +
+            "vfup/s86zHCRvOqAL8zO/WiMV1G5ikHSlD6RtpIOHRX4y0oIGW59ADY0ANwDeDWL\n" +
+            "x/RgSltuQIqeGXwZnyZFwWtxVkSE4p5tn2Lb6USzwcD22taiXmeYsPMWfJfmWPRj\n" +
+            "ZuYBgxn6tvUVRO+ZzAUKEEaJK/LVLieAVEmfR6anEJ/gWczxz12Lwu6qF5ov0OQt\n" +
+            "AP0rfruyje/EJt6xHjpJ2OgDzCWYstXOpRPDHYS3klpaRbowAlpJdYMRAqY5CNiP\n" +
+            "RAx3wvsWCVI5UkzKVD6RuHHVpfzfdKAfsjHa/aSunHtTpE+NUf3Q/3qHXW5cyDnP\n" +
+            "Jt6VTVVVevjTquwH1xrUigukDbeopV1owsqIA5aw2io7RbBorwPBA0veinHN4vP9\n" +
+            "X8jbTiIiLjlfJOnHZe7pIhb3T9WCqhwwsBNPQpKizGHCj5kL2UJe7N5u4RywFOZE\n" +
+            "l5mbTX4zO6Vj3WM9ZVbZgXVNwEjS5mYq/rvC1yr9obNUJ8br6JAd2ZBnzhA5Zn4s\n" +
+            "bIP99TlUBZWczw+vPM7g1S4e4cyd+8CULVhVs87QlyvwWnRbH7fXZo8xLzhzMCjB\n" +
+            "8Y0cNdL1S6QKrrhC6Pf6tV/JU20CAwEAAaOCAZMwggGPMA4GA1UdDwEB/wQEAwIB\n" +
+            "hjAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwEgYDVR0TAQH/BAgwBgEB\n" +
+            "/wIBADAdBgNVHQ4EFgQUhNwhC8eoXXKXhId+8tW2+nFWTvswHwYDVR0jBBgwFoAU\n" +
+            "rmwFo5MT4qLn4tcc1sfwf8hnU6AwewYIKwYBBQUHAQEEbzBtMC4GCCsGAQUFBzAB\n" +
+            "hiJodHRwOi8vb2NzcDIuZ2xvYmFsc2lnbi5jb20vcm9vdHI2MDsGCCsGAQUFBzAC\n" +
+            "hi9odHRwOi8vc2VjdXJlLmdsb2JhbHNpZ24uY29tL2NhY2VydC9yb290LXI2LmNy\n" +
+            "dDA2BgNVHR8ELzAtMCugKaAnhiVodHRwOi8vY3JsLmdsb2JhbHNpZ24uY29tL3Jv\n" +
+            "b3QtcjYuY3JsMFUGA1UdIAROMEwwQQYJKwYBBAGgMgEBMDQwMgYIKwYBBQUHAgEW\n" +
+            "Jmh0dHBzOi8vd3d3Lmdsb2JhbHNpZ24uY29tL3JlcG9zaXRvcnkvMAcGBWeBDAEB\n" +
+            "MA0GCSqGSIb3DQEBDAUAA4ICAQBD+97H2N1BgiliKQFrb+jcWjkmPP8cdF/eiBW1\n" +
+            "cEzOOhsuVqxbyIk8qdw3UueHSDjqWUjHYoo8TV3DLqUXmIy1Ks3MkESsFKeLpEbk\n" +
+            "VMZga0lbDnqqRc5a2yzrXmwVYDeWVeD20s5vPoKCnFzmcR+2v9TKD4bI6XWVl84q\n" +
+            "GzfFRVdY9f8KN+7891+47ZhptvxtNqJKVI2O+EAP/PvTpwes983LkFzsev4/+Qxs\n" +
+            "EszD7/pE+Byj3t9CMat2XoX0jfJjbEXgewFb/gCwHvqNKLNWrYfE9qN8b6qm4xQk\n" +
+            "qGQKTrFKsBJx4TU+h10qXDhpmOBswiJqoG16XCV32oSn0JUYvXVAvP6YjueOv/jr\n" +
+            "0ZMTWGh8wCz6v3XBaXR0rxDAz9GImpU+xPx2XjuHac7OnYbN+i8p7cJPUxABjHiA\n" +
+            "LWXIZtCn5ziCfvYC6+SCp8x9TPJzAIfJ4NKv/8SpvvzuchVkAQqlQaGFBEdkX84R\n" +
+            "I/WYYG+2BliFIpbQnfljYWCURbfsYz7+Zxb94+4yzva49p8T6lALoK3s2kqIVLKN\n" +
+            "s6qAnk/qX6JihkaR3W+iViHMC5tqQX/pd8QIXccF3PA2OdeNGU4iUNZqUbYB4VZd\n" +
+            "AaOaeaUl0LwAta6DB5w344eUIqDgaitSwQZBnxppmwL3tGzP1ero2e2RvBmphbxI\n" +
+            "atIdxA==\n" +
             "-----END CERTIFICATE-----";
 
-    // Owner: CN=valid.r6.roots.globalsign.com, O=GMO GlobalSign Inc., STREET="Two International Drive, Suite 150",
-    // L=Portsmouth, ST=New Hampshire, C=US, OID.1.3.6.1.4.1.311.60.2.1.2=New Hampshire, OID.1.3.6.1.4.1.311.60.2.1.3=US,
-    // SERIALNUMBER=578611, OID.2.5.4.15=Private Organization
-    // Issuer: CN=GlobalSign R6 Admin CA - SHA256 - G3, O=GlobalSign nv-sa, C=BE
-    // Serial number: 1355071ec648a599cea67b3b
-    // Valid from: Wed Jun 13 21:31:05 PDT 2018 until: Sat Jun 13 21:31:05 PDT 2020
+    // Owner: CN=valid.r6.roots.globalsign.com,
+    // O=GMO GlobalSign LTD, STREET="Springfield House, Sandling Road", OID.2.5.4.17=ME14 2LP, L=Maidstone, ST=Kent,
+    // C=GB, SERIALNUMBER=04705639, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB
+    // Issuer: CN=GlobalSign Atlas R6 EV TLS CA 2020, O=GlobalSign nv-sa, C=BE
+    // Serial number: 1aff2829dd8bf07aa65a7b3c920ca4b
+    // Valid from: Thu Aug 27 00:20:06 PDT 2020 until: Tue Sep 28 00:20:06 PDT 2021
     private static final String VALID = "-----BEGIN CERTIFICATE-----\n" +
-            "MIIHUjCCBjqgAwIBAgIME1UHHsZIpZnOpns7MA0GCSqGSIb3DQEBCwUAMFcxCzAJ\n" +
-            "BgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMS0wKwYDVQQDEyRH\n" +
-            "bG9iYWxTaWduIFI2IEFkbWluIENBIC0gU0hBMjU2IC0gRzMwHhcNMTgwNjE0MDQz\n" +
-            "MTA1WhcNMjAwNjE0MDQzMTA1WjCCARIxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5p\n" +
-            "emF0aW9uMQ8wDQYDVQQFEwY1Nzg2MTExEzARBgsrBgEEAYI3PAIBAxMCVVMxHjAc\n" +
-            "BgsrBgEEAYI3PAIBAhMNTmV3IEhhbXBzaGlyZTELMAkGA1UEBhMCVVMxFjAUBgNV\n" +
-            "BAgTDU5ldyBIYW1wc2hpcmUxEzARBgNVBAcTClBvcnRzbW91dGgxKzApBgNVBAkT\n" +
-            "IlR3byBJbnRlcm5hdGlvbmFsIERyaXZlLCBTdWl0ZSAxNTAxHDAaBgNVBAoTE0dN\n" +
-            "TyBHbG9iYWxTaWduIEluYy4xJjAkBgNVBAMTHXZhbGlkLnI2LnJvb3RzLmdsb2Jh\n" +
-            "bHNpZ24uY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArh1lHcNS\n" +
-            "cfvFI/vGrfu3sC561NL6VTm9WQpq0UcdQpVlOjnmlScZaUhTlcJ2aWz4tqNnT/SF\n" +
-            "EO48kgIy0c07n0z1igBGOvM6shPtdIT3Yik2KwKdnt2Oaw/RqyXQxZhMvvGGyXLP\n" +
-            "hEyRdUrcNEXzOh+/AFzV2Ayo2OfZB/SEJW2BMhYEvZ89ziniab7vaNfVVUwsR6yD\n" +
-            "JX/3bdgRpG3gvKpdawAXMkhX5yAJaLInp5gHfCKNsW7l5gSrW/IYmPZvmEovLLmF\n" +
-            "lJfEDltnaNrO3jFzCjzEVRsurBrn1lMgKuCCkCZhzUgy5w8fR7OiGDpI/DmprRxn\n" +
-            "WQomtZBRd9VG1wIDAQABo4IDXzCCA1swDgYDVR0PAQH/BAQDAgWgMIGWBggrBgEF\n" +
-            "BQcBAQSBiTCBhjBHBggrBgEFBQcwAoY7aHR0cDovL3NlY3VyZS5nbG9iYWxzaWdu\n" +
-            "LmNvbS9jYWNlcnQvZ3NyNmFkbWluY2FzaGEyNTZnMy5jcnQwOwYIKwYBBQUHMAGG\n" +
-            "L2h0dHA6Ly9vY3NwMi5nbG9iYWxzaWduLmNvbS9nc3I2YWRtaW5jYXNoYTI1Nmcz\n" +
-            "MFUGA1UdIAROMEwwQQYJKwYBBAGgMgEBMDQwMgYIKwYBBQUHAgEWJmh0dHBzOi8v\n" +
-            "d3d3Lmdsb2JhbHNpZ24uY29tL3JlcG9zaXRvcnkvMAcGBWeBDAEBMAkGA1UdEwQC\n" +
-            "MAAwQgYDVR0fBDswOTA3oDWgM4YxaHR0cDovL2NybC5nbG9iYWxzaWduLmNvbS9n\n" +
-            "c3I2YWRtaW5jYXNoYTI1NmczLmNybDAoBgNVHREEITAfgh12YWxpZC5yNi5yb290\n" +
-            "cy5nbG9iYWxzaWduLmNvbTAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIw\n" +
-            "HQYDVR0OBBYEFPTkCvZs787YEtziawL5ju/rC8XwMB8GA1UdIwQYMBaAFIFJXOkF\n" +
-            "vwyIoDiWsl1BA1rp/9eHMIIBfwYKKwYBBAHWeQIEAgSCAW8EggFrAWkAdwBVgdTC\n" +
-            "FpA2AUrqC5tXPFPwwOQ4eHAlCBcvo6odBxPTDAAAAWP8j7bvAAAEAwBIMEYCIQDH\n" +
-            "FRH+VkQ4RgVRYaO47rC83fQrzEO9Pb45BD5ZEHfrRwIhALY75BbrPhtAZSXWfpVN\n" +
-            "MoDQzA6X0DQFSf29dlnCMYCmAHcApLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fN\n" +
-            "DsgN3BAAAAFj/I+4QgAABAMASDBGAiEA3kcOlf4Az7R+/MkV5GurWnpUmIhCUB3v\n" +
-            "a/tNz+Dd8HgCIQC22RG+EW4OYdaoWN/B3MeI95OlNofD/OqJB/med+quWwB1AG9T\n" +
-            "dqwx8DEZ2JkApFEV/3cVHBHZAsEAKQaNsgiaN9kTAAABY/yPt6kAAAQDAEYwRAIg\n" +
-            "THH7eeWpo5vDtjDNKzpkkrR/McYDgmQIRRnLKXkKMsoCIC9cY4xj9LlXPVRF9bLH\n" +
-            "1DvP9qmONga9pO7kxuyYtd8YMA0GCSqGSIb3DQEBCwUAA4IBAQA0Ufq4QDCiWxm4\n" +
-            "5D3MrfbQnC9apSMpzRT2udD/gFDbtqTJ7Rx4CJjNWa9ANkKWNlJ6zVASpVzV7KB7\n" +
-            "otvqO4iR5V0EE4+9fitJ3zRe9nl76uDf2upCHLcWsYurq/eIxIuXnIByLJvTS3jS\n" +
-            "42i07D6JsgNg9SR8rIKyYiz4KX2975GlMSue/SOMFcf/AC7amYzs6U+FA68y8GBV\n" +
-            "yDGpYvQW9zfnQ2Z/XVcLE1tVERrEs3Ba08g+uk1dICyibSz83yrX3Eas/bq6kZEy\n" +
-            "kRvhD1fnk3wAlgiuUED65Rn3ezm2AjsFJBIitdDyHFzgZiu/DKccakuuk8NwDZjJ\n" +
-            "NrTZIL32\n" +
+            "MIIHyjCCBbKgAwIBAgIQAa/ygp3YvweqZaezySDKSzANBgkqhkiG9w0BAQsFADBV\n" +
+            "MQswCQYDVQQGEwJCRTEZMBcGA1UEChMQR2xvYmFsU2lnbiBudi1zYTErMCkGA1UE\n" +
+            "AxMiR2xvYmFsU2lnbiBBdGxhcyBSNiBFViBUTFMgQ0EgMjAyMDAeFw0yMDA4Mjcw\n" +
+            "NzIwMDZaFw0yMTA5MjgwNzIwMDZaMIH6MRMwEQYLKwYBBAGCNzwCAQMTAkdCMR0w\n" +
+            "GwYDVQQPDBRQcml2YXRlIE9yZ2FuaXphdGlvbjERMA8GA1UEBRMIMDQ3MDU2Mzkx\n" +
+            "CzAJBgNVBAYTAkdCMQ0wCwYDVQQIDARLZW50MRIwEAYDVQQHDAlNYWlkc3RvbmUx\n" +
+            "ETAPBgNVBBEMCE1FMTQgMkxQMSkwJwYDVQQJDCBTcHJpbmdmaWVsZCBIb3VzZSwg\n" +
+            "U2FuZGxpbmcgUm9hZDEbMBkGA1UECgwSR01PIEdsb2JhbFNpZ24gTFREMSYwJAYD\n" +
+            "VQQDDB12YWxpZC5yNi5yb290cy5nbG9iYWxzaWduLmNvbTCCASIwDQYJKoZIhvcN\n" +
+            "AQEBBQADggEPADCCAQoCggEBAMOxbh7fZVLUB06xxNBePa9vpOuAS5km1w8ngsTu\n" +
+            "SvH1LZnPFd4nu40fi8bPbHd4J2oRWZ28f7LKVQgBupn9knrTQxfTV361WpmwqCcH\n" +
+            "MxornKyHx4t5uGrtTtX2fYoNQQk330dIKAfKpUrOiaDybB7irG2JEHdGD3Iv7ud8\n" +
+            "FXfXgXte26mUDX3XeCvE0pbuNKpTKApqOeojlVR6TCNB1n6KGYLMIz/1ow6XBZ64\n" +
+            "1zKG/9o0gSHelkUHGmGLzOAE5YpkhwzhpND9opycnfieHuy5BcoBIpeMqGNwOsGu\n" +
+            "p+nhFz+N8mPjSjZEf0qx+FLF2cBmNFknJJCdnV7OYfKZHE0CAwEAAaOCAu4wggLq\n" +
+            "MCgGA1UdEQQhMB+CHXZhbGlkLnI2LnJvb3RzLmdsb2JhbHNpZ24uY29tMA4GA1Ud\n" +
+            "DwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwHQYDVR0O\n" +
+            "BBYEFLZolpEC8/bF44e/gnh4StQ9+URwMFUGA1UdIAROMEwwBwYFZ4EMAQEwQQYJ\n" +
+            "KwYBBAGgMgEBMDQwMgYIKwYBBQUHAgEWJmh0dHBzOi8vd3d3Lmdsb2JhbHNpZ24u\n" +
+            "Y29tL3JlcG9zaXRvcnkvMAwGA1UdEwEB/wQCMAAwgZoGCCsGAQUFBwEBBIGNMIGK\n" +
+            "MD4GCCsGAQUFBzABhjJodHRwOi8vb2NzcC5nbG9iYWxzaWduLmNvbS9jYS9nc2F0\n" +
+            "bGFzcjZldnRsc2NhMjAyMDBIBggrBgEFBQcwAoY8aHR0cDovL3NlY3VyZS5nbG9i\n" +
+            "YWxzaWduLmNvbS9jYWNlcnQvZ3NhdGxhc3I2ZXZ0bHNjYTIwMjAuY3J0MB8GA1Ud\n" +
+            "IwQYMBaAFITcIQvHqF1yl4SHfvLVtvpxVk77MEYGA1UdHwQ/MD0wO6A5oDeGNWh0\n" +
+            "dHA6Ly9jcmwuZ2xvYmFsc2lnbi5jb20vY2EvZ3NhdGxhc3I2ZXZ0bHNjYTIwMjAu\n" +
+            "Y3JsMIIBAwYKKwYBBAHWeQIEAgSB9ASB8QDvAHYAfT7y+I//iFVoJMLAyp5SiXkr\n" +
+            "xQ54CX8uapdomX4i8NcAAAF0Lsm7CwAABAMARzBFAiB0fLxAlPzkPxZOVj7c8OFc\n" +
+            "YwycekW0Mo+sRm/BQYoeOgIhAK2lNW7ebraH//ZlLQD7dyzWCO+kgmkQo+mqdm1x\n" +
+            "4P15AHUAb1N2rDHwMRnYmQCkURX/dxUcEdkCwQApBo2yCJo32RMAAAF0Lsm7JAAA\n" +
+            "BAMARjBEAiALOZvdNiA9q1Ysr7ejTGdivUqNJNm9KftmGXwHFGwf2QIgDodNLmbZ\n" +
+            "JFGt8l5ul0fHw2Gn8KqhRUW6CMRT58svhcswDQYJKoZIhvcNAQELBQADggIBAByb\n" +
+            "hoL/sArmkNjTFiEEBocMfb+brgRQdb08NKC1BDxGnfIFjUmOFzI2SVgtBmcoF8FI\n" +
+            "0WyXQv6ZxVE01DFZpeZpsJJYfBAjg9NR4/B7UjajvOJwQNpaciAGQ0ZzTu+SmHja\n" +
+            "jIiC2KqiA7Me2MoUne6hhxZ3dXEneIml8hnbTf2mjSBCVpQqyf2goslhGduPitI6\n" +
+            "guTtVD2PVaNCVkjlRn4Euspl2JjQWzGcEruqGyQN+Bu4yt1hsD4Jj6V9Hmzo8Vrd\n" +
+            "5LUxFPRGIgCUDiiwnENVsQB/D24y3IapPkojujrvsVsmQN42GIgOY5tLK/8cCziD\n" +
+            "vf0GzZnmL1D2ezi3TaBj+XBWFcAyF2Y9AnVRmC9CrVcp6EX0KhD4g9ZgbpJZpVlk\n" +
+            "G3xfOiZWTeqLnQhCMXcdcutWIwXAX5gueyF1t545vECCE4PeGZNAeWqdbrj7xaS8\n" +
+            "3rKQdgwF9r6p7F5HHwEVCckhovEYU4DNFzYb9n/YmC3hmskFB1keTYqydKUYEGZ5\n" +
+            "fvLvsjRj9xwOCqIs5j1vuKw2CaqmHxrfYaDMMSZPq/iYrOWrf72wZIvtnAHePt3X\n" +
+            "atQMqNbDMQrjul31ljDP9CIbbtuZSkSACyMxiC10l4uTTLQiTxtZPkwIazOjnbBe\n" +
+            "A4fruOEQ2k1gu5oFgqmo+xuclOKNjwd/RkK4FXnD\n" +
             "-----END CERTIFICATE-----";
 
-    // Owner: CN=revoked.r6.roots.globalsign.com, O=GMO GlobalSign Inc., STREET="Two International Drive, Suite 150",
-    // L=Portsmouth, ST=New Hampshire, C=US, OID.1.3.6.1.4.1.311.60.2.1.2=New Hampshire, OID.1.3.6.1.4.1.311.60.2.1.3=US,
-    // SERIALNUMBER=578611, OID.2.5.4.15=Private Organization
-    // Issuer: CN=GlobalSign R6 Admin CA - SHA256 - G3, O=GlobalSign nv-sa, C=BE
-    // Serial number: 535589c9d767cf1cd892f1dc
-    // Valid from: Wed Jun 13 21:36:04 PDT 2018 until: Sat Jun 13 21:36:04 PDT 2020
+    // Owner: CN=revoked.r6.roots.globalsign.com,
+    // O=GMO GlobalSign LTD, STREET="Springfield House, Sandling Road", OID.2.5.4.17=ME14 2LP, L=Maidstone, ST=Kent,
+    // C=GB, SERIALNUMBER=04705639, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB
+    // Issuer: CN=GlobalSign Atlas R6 EV TLS CA 2020, O=GlobalSign nv-sa, C=BE
+    // Serial number: 1df30d84796ac20c47da63b8e681e8f
+    // Valid from: Thu Aug 27 00:37:53 PDT 2020 until: Tue Sep 28 00:37:53 PDT 2021
     private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" +
-            "MIIHVTCCBj2gAwIBAgIMU1WJyddnzxzYkvHcMA0GCSqGSIb3DQEBCwUAMFcxCzAJ\n" +
-            "BgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMS0wKwYDVQQDEyRH\n" +
-            "bG9iYWxTaWduIFI2IEFkbWluIENBIC0gU0hBMjU2IC0gRzMwHhcNMTgwNjE0MDQz\n" +
-            "NjA0WhcNMjAwNjE0MDQzNjA0WjCCARQxHTAbBgNVBA8MFFByaXZhdGUgT3JnYW5p\n" +
-            "emF0aW9uMQ8wDQYDVQQFEwY1Nzg2MTExEzARBgsrBgEEAYI3PAIBAxMCVVMxHjAc\n" +
-            "BgsrBgEEAYI3PAIBAhMNTmV3IEhhbXBzaGlyZTELMAkGA1UEBhMCVVMxFjAUBgNV\n" +
-            "BAgTDU5ldyBIYW1wc2hpcmUxEzARBgNVBAcTClBvcnRzbW91dGgxKzApBgNVBAkT\n" +
-            "IlR3byBJbnRlcm5hdGlvbmFsIERyaXZlLCBTdWl0ZSAxNTAxHDAaBgNVBAoTE0dN\n" +
-            "TyBHbG9iYWxTaWduIEluYy4xKDAmBgNVBAMTH3Jldm9rZWQucjYucm9vdHMuZ2xv\n" +
-            "YmFsc2lnbi5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6SJ+O\n" +
-            "PX5/ECfblZpVByiogO5sUCS23Sry3Ucn1fxFO3b6tOKppUtgZjJUxUOHj9jRIsmS\n" +
-            "8Tvbn+Iu35Cjj2vTsJNoFzxiMj/FBl3IqfF7w4ghLNZ+wE91cMwG0LUtDeAKTlJa\n" +
-            "j4Q2Gj1ZOGLPyr4flSig2bOvcIBWYjbXqwBMZek9EC58D34HF+h2fdzXPrqHHWqg\n" +
-            "NQpj7lxkr4XA1jXSgZJZnRfoVW+BCVidbNw9LEteF+WGcg3P9sd8XUWJtG/pb4w1\n" +
-            "GsCMf/ig8gkrsQvrMYPsYgQJMdypXm9eAqZmVcE94E0Uz1dbJL9zCa8y4ue9yDnp\n" +
-            "+gzXxToJvNzrlmUPAgMBAAGjggNgMIIDXDAOBgNVHQ8BAf8EBAMCBaAwgZYGCCsG\n" +
-            "AQUFBwEBBIGJMIGGMEcGCCsGAQUFBzAChjtodHRwOi8vc2VjdXJlLmdsb2JhbHNp\n" +
-            "Z24uY29tL2NhY2VydC9nc3I2YWRtaW5jYXNoYTI1NmczLmNydDA7BggrBgEFBQcw\n" +
-            "AYYvaHR0cDovL29jc3AyLmdsb2JhbHNpZ24uY29tL2dzcjZhZG1pbmNhc2hhMjU2\n" +
-            "ZzMwVQYDVR0gBE4wTDBBBgkrBgEEAaAyAQEwNDAyBggrBgEFBQcCARYmaHR0cHM6\n" +
-            "Ly93d3cuZ2xvYmFsc2lnbi5jb20vcmVwb3NpdG9yeS8wBwYFZ4EMAQEwCQYDVR0T\n" +
-            "BAIwADBCBgNVHR8EOzA5MDegNaAzhjFodHRwOi8vY3JsLmdsb2JhbHNpZ24uY29t\n" +
-            "L2dzcjZhZG1pbmNhc2hhMjU2ZzMuY3JsMCoGA1UdEQQjMCGCH3Jldm9rZWQucjYu\n" +
-            "cm9vdHMuZ2xvYmFsc2lnbi5jb20wHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUF\n" +
-            "BwMCMB0GA1UdDgQWBBR66TcwHJ5KRJZqtNB3Cqj8rWUAYzAfBgNVHSMEGDAWgBSB\n" +
-            "SVzpBb8MiKA4lrJdQQNa6f/XhzCCAX4GCisGAQQB1nkCBAIEggFuBIIBagFoAHYA\n" +
-            "VYHUwhaQNgFK6gubVzxT8MDkOHhwJQgXL6OqHQcT0wwAAAFj/JRH/gAABAMARzBF\n" +
-            "AiBtxn2bgwXrjx2zX3RPP3L4iFEZ1bK71oZ67RvNpI/pWQIhAK1Wg3wEdSqUUa9I\n" +
-            "VKSNaDaMqtI7s5yQvIV3YdDDxl+hAHcAu9nfvB+KcbWTlCOXqpJ7RzhXlQqrUuga\n" +
-            "kJZkNo4e0YUAAAFj/JRJMQAABAMASDBGAiEAkwpftFhujb0p9wNDywVgZPPxGdLy\n" +
-            "7c7WnpBLkViuvVgCIQCtWUK5pfYn+FWPKX82XmG0Hw1VgeQRPZZNAy0HQu/V0QB1\n" +
-            "AG9Tdqwx8DEZ2JkApFEV/3cVHBHZAsEAKQaNsgiaN9kTAAABY/yUSPUAAAQDAEYw\n" +
-            "RAIgEN2Y70rpA+zoK1C5bKEOYUDy6Km5pgymDEPcMBgmh5ECIEAWEPdNA9FeCwqW\n" +
-            "S1Mi3uOhB4dmJKNbToFWtL2lBeDrMA0GCSqGSIb3DQEBCwUAA4IBAQCDoIyqZlvt\n" +
-            "YeqjVCR2rvb1ZHyB5UI5rfYuoNstjaxLKP2tIDByeGwllT0vSb2otM6XjXGVuTTO\n" +
-            "sbVUf4aQQb82pkKXYtB6L7cfPkqrnZXJrmPYb+3xzAsr+HXyyPOu0FIVrtB/WTvd\n" +
-            "Qo/JyVMm7Duke/e5gudw9Lv6sb2P5B3BVcNzbv1f7589wydNvrTgdVeldyPNfuZ4\n" +
-            "gMT/ICoNaX+U6O3EiqYB+gLDBKVAIDsQV1k/fYq5uZr1FsTzOMesaCT4me/4I4tR\n" +
-            "2H7WrVajYEJ73gWUclDLxy7hoDNwR/ZuLcilAaqdwIdmVD0aFiw8RFsyZkXO5J0R\n" +
-            "BuecWspICLIw\n" +
+            "MIIHzzCCBbegAwIBAgIQAd8w2EeWrCDEfaY7jmgejzANBgkqhkiG9w0BAQsFADBV\n" +
+            "MQswCQYDVQQGEwJCRTEZMBcGA1UEChMQR2xvYmFsU2lnbiBudi1zYTErMCkGA1UE\n" +
+            "AxMiR2xvYmFsU2lnbiBBdGxhcyBSNiBFViBUTFMgQ0EgMjAyMDAeFw0yMDA4Mjcw\n" +
+            "NzM3NTNaFw0yMTA5MjgwNzM3NTNaMIH8MRMwEQYLKwYBBAGCNzwCAQMTAkdCMR0w\n" +
+            "GwYDVQQPDBRQcml2YXRlIE9yZ2FuaXphdGlvbjERMA8GA1UEBRMIMDQ3MDU2Mzkx\n" +
+            "CzAJBgNVBAYTAkdCMQ0wCwYDVQQIDARLZW50MRIwEAYDVQQHDAlNYWlkc3RvbmUx\n" +
+            "ETAPBgNVBBEMCE1FMTQgMkxQMSkwJwYDVQQJDCBTcHJpbmdmaWVsZCBIb3VzZSwg\n" +
+            "U2FuZGxpbmcgUm9hZDEbMBkGA1UECgwSR01PIEdsb2JhbFNpZ24gTFREMSgwJgYD\n" +
+            "VQQDDB9yZXZva2VkLnI2LnJvb3RzLmdsb2JhbHNpZ24uY29tMIIBIjANBgkqhkiG\n" +
+            "9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvaNcp7bzmm02Z0S92ZzJ/ul3uQWz3EnBORcI\n" +
+            "RuEzm0HY4t0n9DGnxpxOi/aWGX/Vj7qZC4m3G7uCE7dMy6CfXTwh4UZ+nPVijImo\n" +
+            "q/msJzmju/pk8HVeOEhk88yvwfzmzYLjoQagmHnDUSQULEmNWihejIh4B61qx4SI\n" +
+            "UoBPoBgqDfZW27HkJeqNAO6rljZTZwLenJesm2QMjebYaKxQBi3fLy0Lua2sxTik\n" +
+            "fbT3swEPN9xxvMomtNNM2tJwdExL2RpO8dObUe37ep6roG7gWh8NYDKMo6j9Rn9e\n" +
+            "f0S9jwkcRM2kZSHR09HSu8ULBgP+KYa8DDpOyt+HO+2G57MhbQIDAQABo4IC8TCC\n" +
+            "Au0wKgYDVR0RBCMwIYIfcmV2b2tlZC5yNi5yb290cy5nbG9iYWxzaWduLmNvbTAO\n" +
+            "BgNVHQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0G\n" +
+            "A1UdDgQWBBTa1/37G4T022LEW3WwIVV99qtjsjBVBgNVHSAETjBMMAcGBWeBDAEB\n" +
+            "MEEGCSsGAQQBoDIBATA0MDIGCCsGAQUFBwIBFiZodHRwczovL3d3dy5nbG9iYWxz\n" +
+            "aWduLmNvbS9yZXBvc2l0b3J5LzAMBgNVHRMBAf8EAjAAMIGaBggrBgEFBQcBAQSB\n" +
+            "jTCBijA+BggrBgEFBQcwAYYyaHR0cDovL29jc3AuZ2xvYmFsc2lnbi5jb20vY2Ev\n" +
+            "Z3NhdGxhc3I2ZXZ0bHNjYTIwMjAwSAYIKwYBBQUHMAKGPGh0dHA6Ly9zZWN1cmUu\n" +
+            "Z2xvYmFsc2lnbi5jb20vY2FjZXJ0L2dzYXRsYXNyNmV2dGxzY2EyMDIwLmNydDAf\n" +
+            "BgNVHSMEGDAWgBSE3CELx6hdcpeEh37y1bb6cVZO+zBGBgNVHR8EPzA9MDugOaA3\n" +
+            "hjVodHRwOi8vY3JsLmdsb2JhbHNpZ24uY29tL2NhL2dzYXRsYXNyNmV2dGxzY2Ey\n" +
+            "MDIwLmNybDCCAQQGCisGAQQB1nkCBAIEgfUEgfIA8AB2AG9Tdqwx8DEZ2JkApFEV\n" +
+            "/3cVHBHZAsEAKQaNsgiaN9kTAAABdC7aAfUAAAQDAEcwRQIgHIAHHw/Y/VKaaHhy\n" +
+            "rZ/cMinivfZ4lUq2ejV7FRPbT8ECIQD3RoE13/MBVMVBLCQ2ErKsB5+7F31dX/tv\n" +
+            "Z/muQi5UrQB2AH0+8viP/4hVaCTCwMqeUol5K8UOeAl/LmqXaJl+IvDXAAABdC7a\n" +
+            "AegAAAQDAEcwRQIhALl0LXt6pFqS0cHF/XkxSfDJJdhppR2eSlcMFpZY0q1PAiBJ\n" +
+            "YkKHqq/YD0gwtZAUEPSk54G1cLxFoUiounjya1XTRzANBgkqhkiG9w0BAQsFAAOC\n" +
+            "AgEAdeQotBhB7bn+CztQmF13rdBphHrGkkyHC3hL1bxkmHJcrLQ5ochqPvgdgAVq\n" +
+            "DXcV8zSyNwVxW6REi+uYzcsOPKo/llmgF7Psqn1t/EDcutWlykh8UwE5UaLJ2EWD\n" +
+            "HnIu06n47lWtAwlNMXJ/ce0oVjqsgY52Y1u54e8wFXt6lsSw02tzIC6eo1BFKxQ3\n" +
+            "lDKYVXgg0OvMG/C2rvH/EIq5r+st49rNGWfcWRoHsDUruChZOHwJ9PrXKBLB/QVd\n" +
+            "4uw2V/0ipOETDudly7yLodXP8quhet4bCEO9gweXppL/MikLrE5xt46HW1/6w+jF\n" +
+            "wKCHWlq4ViswlaQ8q0oY/97o2udnuDQaNdrLgW3VofMeBIMNPBgkLDicOH6bLwNf\n" +
+            "lV68qi1ZBxBuOdoOqQyZ9RU9d3EL50XEJ4MtUvjJRAT5EWdFaB8SGGZbD5fyza8c\n" +
+            "KmeO5tkZWYecLd8CKqwKcW7umPflEwOzw60Cxg6eyBYA8Jfagpbdb/kXsF6Ov8IW\n" +
+            "vxNdHCnXnR3oBWm2uHddESO2zGF1ZfOb0O3cHHG5nCgVkWW68VpgX/LaN90u6Dzw\n" +
+            "diJX7esZV5ZaniqD+flWldgAdcfeXlJ5b7I7GnFr61ycmZT/qupagUS1WDq/zfct\n" +
+            "QcB4QmnAzGe6kcqiDOSyIYWpiw09jha63KpJtJDWRemrlQI=\n" +
             "-----END CERTIFICATE-----";
 
     public static void main(String[] args) throws Exception {
@@ -195,8 +206,7 @@
         // Validate Revoked
         pathValidator.validate(new String[]{REVOKED, INT},
                 ValidatePathWithParams.Status.REVOKED,
-                "Wed Jun 13 23:36:02 PDT 2018", System.out);
-
+                "Thu Aug 27 00:38:11 PDT 2020", System.out);
     }
 }
 
--- a/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -824,7 +824,7 @@
 
         String errStr = null;
         for (int i=0;i<conf.length;i++) {
-            for (int j = 0; j < PORT_TEST_LEN; i++) {
+            for (int j = 0; j < PORT_TEST_LEN; j++) {
                 try {
                     errStr = testConfiguration(conf[i],port+testPort++);
                     break;
--- a/test/sun/security/lib/cacerts/VerifyCACerts.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/security/lib/cacerts/VerifyCACerts.java	Wed Feb 03 05:23:32 2021 +0000
@@ -27,6 +27,7 @@
  * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779
  *      8209452 8209506 8210432 8195793 8216577 8222089 8222133 8222137 8222136
  *      8223499 8225392 8232019 8234245 8233223 8225068 8225069 8243321 8243320
+ *      8225072 8258630
  * @summary Check root CA entries in cacerts file
  */
 import java.io.ByteArrayInputStream;
@@ -268,6 +269,14 @@
             add("addtrustexternalca [jdk]");
             // Valid until: Sat May 30 10:44:50 GMT 2020
             add("addtrustqualifiedca [jdk]");
+            // Valid until: Fri Jan 01 15:59:59 PST 2021
+            add("verisigntsaca [jdk]");
+            // Valid until: Fri Jan 01 15:59:59 PST 2021
+            add("thawtepremiumserverca [jdk]");
+            // Valid until: Wed Mar 17 02:51:37 PDT 2021
+            add("luxtrustglobalrootca [jdk]");
+            // Valid until: Wed Mar 17 11:33:33 PDT 2021
+            add("quovadisrootca [jdk]");
         }
     };
 
--- a/test/sun/security/pkcs11/PKCS11Test.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/security/pkcs11/PKCS11Test.java	Wed Feb 03 05:23:32 2021 +0000
@@ -368,7 +368,11 @@
             return nss3_version;
 
         try {
-            libfile = getNSSLibDir() + System.mapLibraryName(library);
+            String libdir = getNSSLibDir();
+            if (libdir == null) {
+                return 0.0;
+            }
+            libfile = libdir + System.mapLibraryName(library);
             try (FileInputStream is = new FileInputStream(libfile)) {
                 byte[] data = new byte[1000];
                 int read = 0;
--- a/test/sun/security/pkcs11/Secmod/TestNssDbSqlite.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/security/pkcs11/Secmod/TestNssDbSqlite.java	Wed Feb 03 05:23:32 2021 +0000
@@ -26,6 +26,8 @@
  * @test
  * @bug 8165996
  * @summary Test NSS DB Sqlite
+ * @comment There is no NSS on Aix.
+ * @requires os.family != "aix"
  * @library ../
  * @run main/othervm/timeout=120 TestNssDbSqlite
  * @author Martin Balao (mbalao@redhat.com)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/rsa/pss/PSSKeyCompatibility.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.security.Key;
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.interfaces.RSAPrivateCrtKey;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.RSAPrivateCrtKeySpec;
+import java.security.spec.RSAPublicKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Arrays;
+import java.util.Base64;
+
+/**
+ * @test
+ * @bug 8242335
+ * @summary OpenSSL generated compatibility test with RSASSA-PSS Java.
+ * @run main PSSKeyCompatibility
+ */
+public class PSSKeyCompatibility {
+
+    private static final String ALGO = "RSASSA-PSS";
+    private static final String OID = "1.2.840.113549.1.1.10";
+    private static final String PROVIDER = "SunRsaSign";
+
+    public static void main(String[] args) {
+
+        boolean result = true;
+        for (String algo : new String[]{ALGO, OID}) {
+            System.out.println("With : " + algo);
+            result &= validateCert(algo, PROVIDER, PUBLIC_256);
+            result &= validateCert(algo, PROVIDER, PUBLIC_384);
+            result &= validateCert(algo, PROVIDER, PUBLIC_512);
+
+            result &= validatePrivate(algo, PROVIDER, PRIVATE);
+        }
+        if (!result) {
+            throw new RuntimeException("Some test cases failed");
+        }
+    }
+
+    private static boolean validatePrivate(String algorithm, String provider,
+            String type) {
+
+        try {
+            KeyFactory kf = KeyFactory.getInstance(algorithm, provider);
+            PKCS8EncodedKeySpec privSpec = new PKCS8EncodedKeySpec(
+                    Base64.getMimeDecoder().decode(type));
+            PrivateKey priv = kf.generatePrivate(privSpec);
+
+            RSAPrivateCrtKey crtKey = (RSAPrivateCrtKey) priv;
+            PrivateKey priv1 = kf.generatePrivate(new RSAPrivateCrtKeySpec(
+                    crtKey.getModulus(),
+                    crtKey.getPublicExponent(),
+                    crtKey.getPrivateExponent(),
+                    crtKey.getPrimeP(),
+                    crtKey.getPrimeQ(),
+                    crtKey.getPrimeExponentP(),
+                    crtKey.getPrimeExponentQ(),
+                    crtKey.getCrtCoefficient(),
+                    crtKey.getParams()
+            ));
+            equals(priv, priv1);
+        } catch (NoSuchAlgorithmException | InvalidKeySpecException
+                | NoSuchProviderException e) {
+            e.printStackTrace(System.out);
+            return false;
+        }
+        System.out.println("PASSED - validatePrivate");
+        return true;
+    }
+
+    private static boolean validateCert(String algorithm, String provider,
+            String type) {
+
+        try {
+            CertificateFactory cf = CertificateFactory.getInstance("X.509");
+            Certificate cert = cf.generateCertificate(
+                    new ByteArrayInputStream(type.getBytes()));
+            System.out.println(cert);
+            KeyFactory kf = KeyFactory.getInstance(algorithm, provider);
+            X509EncodedKeySpec pubSpec = kf.getKeySpec(
+                    cert.getPublicKey(), X509EncodedKeySpec.class);
+            PublicKey pub = kf.generatePublic(pubSpec);
+            PublicKey pub1 = kf.generatePublic(new RSAPublicKeySpec(
+                    ((RSAPublicKey) pub).getModulus(),
+                    ((RSAPublicKey) pub).getPublicExponent(),
+                    ((RSAPublicKey) pub).getParams()));
+            equals(cert.getPublicKey(), pub);
+            equals(pub, pub1);
+        } catch (CertificateException | NoSuchAlgorithmException
+                | InvalidKeySpecException | NoSuchProviderException e) {
+            e.printStackTrace(System.out);
+            return false;
+        }
+        System.out.println("PASSED - validateCert");
+        return true;
+    }
+
+    private static void equals(Key orig, Key gen) {
+        if (!orig.equals(gen) && orig.hashCode() != gen.hashCode()
+                && !Arrays.equals(orig.getEncoded(), gen.getEncoded())) {
+            throw new RuntimeException("Key mismatch found");
+        }
+    }
+
+    //rsa_pss_pss_sha256
+    private static final String PRIVATE
+            = "MIIEvAIBADALBgkqhkiG9w0BAQoEggSoMIIEpAIBAAKCAQEAu1qb8PZ8vMrX08Gf\n"
+            + "y9mx7c5NHymdPIpdDvaiYkpRfYGXp3Jpx7A0Hq01QY0OUu+0sCd5IbiVoVGqM4cq\n"
+            + "r2e4eyYnbgJEF7Tg8Ipu70cOUCZLj/fYNAjvFjv4+lxQYRCZHUH+lWPDPtJWKELx\n"
+            + "iIsAL5tglfyrQrdWLaOiZKlJ49DrYKU6PYqELxdQ1lw3r8iBbgGJP2podGD0rMWw\n"
+            + "nGX4pl9C7dYA+FV2yDirpH+OMNGOqB5QCe2WcsMLMzLPxJxOpqU8lCuscXR0VZuV\n"
+            + "krgztGJcq4J0eqp05jvMWii4vW/KSIh9bndVmS2QIU7YArI8RMXtbSHdE0hXAkh+\n"
+            + "Phb6/QIDAQABAoIBAQC4gbJDKquLTYQhYXTaT4h/toSS5OuZfHXKz675d1ErdZ2B\n"
+            + "ZRaxdmDNuSxSYvSxTqm2NRmA0QRiu0cPudSaq12twdRg7VBbvGEt4lb/xA1fd2dA\n"
+            + "4AcGr6mtTuCSxqjN/oebnat3OalFS+VXfx3Yp3NGbxE+hHewm1b+WUELOwCunhYw\n"
+            + "WJxs5dR0APiqzknveFgkOSDRbMYhwN6ZIrAmZH0wkGI7ufssnp9LEVDkoQCaFHlW\n"
+            + "bUpBHV1YxMCgAD/Azoo7MtedoO/+qnu1h26VhMVMCQL1DymZAnWd5kXumP9PG9j9\n"
+            + "z2JwIdYc7wkLVoSHJmjuXn/Sa/X7YCTGNk5Qwp/tAoGBAPJIWN3b6FPasnAevD2O\n"
+            + "04l1nnNrjNmu7aMGTTH5CrDseI7y/nqbSC18pOivRLmvhkON26I/Gu8GPKBteZAV\n"
+            + "OHKPc4RM11nvv9CyN4yDp0g76pPXLPXRRN/HV0RfBkmaiE6rpS07ue8FDUZmqb9+\n"
+            + "T8LV2eCYL7gYnIxsctzEQ8tXAoGBAMX2H7wpZVqHlGW94FF2pLp82q2cP80PBD+Z\n"
+            + "TglUVHy957EGPqEzxAWf3saORMDXyme7o0eSHJ1tikNTqAb+//zg5JexNEZSv6cR\n"
+            + "trAxuUT7kgjdJaD2i2BjlJyGG6fiXHcxC8lBvnFiWrC+qihTKDPdwWXdEOwzqCdL\n"
+            + "0eBbKAvLAoGAKDjah/p6F3G3LeXsWkvb0nY0V/UC7SCdUvM43ZL6s2SOnyy4EqK0\n"
+            + "2NhYiEiQoEMDhzOFwum3Dvd6GSgThlf/hwVJqC0Zk1S6A2uSzUEOBG/uAZ03WZfk\n"
+            + "V0JAupkL8iw1dNoKEfhYZdXw3j8s7x2JIE9gXGjngyiS1L0sVHpAxwECgYB78csS\n"
+            + "23RLB0JhpU2yk6812ABu3LqRoEpPq6PRcYxogdpz2u4RrkCYKO2psd/YQgPHiRMF\n"
+            + "N7VU2AXOe61jm/sZEJHvbBLHyP2YFB4nGSrfxwc7J4Ns0ZCYbCDbE5hzN+Ye9oVj\n"
+            + "oBcmFKelq+sLzm0IdFqndY8n5HvvBqjEaS6cmwKBgQDM5VsMKnGuqy5pozamgABu\n"
+            + "/z3f8ATzPVr85LiEWP7qB9Y1JIFuTma3IVlULtab2S4rhrHqQNy6qA6Be9fKKPwE\n"
+            + "TCmM/SDdolcz2d0rC2VDO+pc1RPluDpB/Ag8aHkV58azQASHHvAKBckIe7fay2t2\n"
+            + "j4FaKzM/ieY3WSapIbjf3w==";
+
+    /*
+     * Certificate: Data: Version: 3 (0x2)
+     * Serial Number: 11:4c:35:8c:63:47:91:1d:c1:c8:0f:c2:6f:d0:bd:8b:8f:89:e3:6c
+     * Signature Algorithm: rsassaPss
+     * Hash Algorithm: sha256
+     * Mask Algorithm: mgf1 with sha256
+     * Salt Length: 0xDE
+     * Trailer Field: 0xBC (default)
+     * Issuer: CN = localhost
+     * Validity Not Before: Apr 8 06:01:37 2020 GMT
+     * Not After : Apr 3 06:01:37 2040 GMT
+     * Subject: CN = localhost
+     * Subject Public Key Info: Public
+     * Key Algorithm: rsassaPss
+     * RSA-PSS Public-Key: (2048 bit)
+     */
+    private static final String PUBLIC_256 = "-----BEGIN CERTIFICATE-----\n"
+            + "MIIDaTCCAiCgAwIBAgIUe9ijWtZJGfoH6whOTEIc+J/T1vswPgYJKoZIhvcNAQEK\n"
+            + "MDGgDTALBglghkgBZQMEAgGhGjAYBgkqhkiG9w0BAQgwCwYJYIZIAWUDBAIBogQC\n"
+            + "AgDeMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDAeFw0yMDAzMTcwNjM4MDdaFw00MDAz\n"
+            + "MTIwNjM4MDdaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASAwCwYJKoZIhvcNAQEK\n"
+            + "A4IBDwAwggEKAoIBAQC7Wpvw9ny8ytfTwZ/L2bHtzk0fKZ08il0O9qJiSlF9gZen\n"
+            + "cmnHsDQerTVBjQ5S77SwJ3khuJWhUaozhyqvZ7h7JiduAkQXtODwim7vRw5QJkuP\n"
+            + "99g0CO8WO/j6XFBhEJkdQf6VY8M+0lYoQvGIiwAvm2CV/KtCt1Yto6JkqUnj0Otg\n"
+            + "pTo9ioQvF1DWXDevyIFuAYk/amh0YPSsxbCcZfimX0Lt1gD4VXbIOKukf44w0Y6o\n"
+            + "HlAJ7ZZywwszMs/EnE6mpTyUK6xxdHRVm5WSuDO0YlyrgnR6qnTmO8xaKLi9b8pI\n"
+            + "iH1ud1WZLZAhTtgCsjxExe1tId0TSFcCSH4+Fvr9AgMBAAGjUzBRMB0GA1UdDgQW\n"
+            + "BBSDV090I9jEWvpjZ7fgO+GGocVgaDAfBgNVHSMEGDAWgBSDV090I9jEWvpjZ7fg\n"
+            + "O+GGocVgaDAPBgNVHRMBAf8EBTADAQH/MD4GCSqGSIb3DQEBCjAxoA0wCwYJYIZI\n"
+            + "AWUDBAIBoRowGAYJKoZIhvcNAQEIMAsGCWCGSAFlAwQCAaIEAgIA3gOCAQEAVl99\n"
+            + "g2F0H9YzEtvG5NjSGq8uCW5dLQd5DcXNfyfSLlUBwCTaZXncrc5/3DLYN1mWRQm2\n"
+            + "pCwmoGVzslwcLNENldTYogCc0Pc3YeG81wTBq0Tt6zS8RsDR3jhCFSDTVOjOoe0R\n"
+            + "kdYRd9d2pLg2ZOzAJXa6GLrFA+3Vv3dFFh8FhGB9CcVsyPQDzWhXQ0IwukHK+AMY\n"
+            + "6x1h12/CGQfrzBhrUtwbV+9iZN3lVsBYEFNKVz8Ca7H80YC4bsEHAHeR5nIUFk82\n"
+            + "kYuOBhcfC10oz+NdM1KbyAX8/4Uf7S3aBca27GTr1vP6tkmybonRHnZRoELNo1RQ\n"
+            + "wM0XPciACllEAJCVrQ==\n"
+            + "-----END CERTIFICATE-----";
+
+    /*
+     * Certificate: Data: Version: 3 (0x2)
+     *  Serial Number: 32:f5:cf:23:71:d3:7f:16:10:5d:6e:c7:25:82:ee:7f:a8:ec:27:80
+     *  Signature Algorithm: rsassaPss
+     *  Hash Algorithm: sha384
+     *  Mask Algorithm: mgf1 with sha384
+     *  Salt Length: 0xCE
+     *  Trailer Field: 0xBC (default)
+     *  Issuer: CN = localhost
+     *  Validity Not Before: Apr 8 06:01:37 2020 GMT
+     *  Not After : Apr 3 06:01:37 2040 GMT
+     *  Subject: CN = localhost
+     *  Subject Public Key Info: Public
+     *  Key Algorithm: rsassaPss
+     *  RSA-PSS Public-Key: (2048 bit)
+     */
+    private static final String PUBLIC_384 = "-----BEGIN CERTIFICATE-----\n"
+            + "MIIDaTCCAiCgAwIBAgIUAeOnPMUidJHBqZbvhJWcH/05h0MwPgYJKoZIhvcNAQEK\n"
+            + "MDGgDTALBglghkgBZQMEAgKhGjAYBgkqhkiG9w0BAQgwCwYJYIZIAWUDBAICogQC\n"
+            + "AgDOMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDAeFw0yMDAzMTcwNzI2MzFaFw00MDAz\n"
+            + "MTIwNzI2MzFaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASAwCwYJKoZIhvcNAQEK\n"
+            + "A4IBDwAwggEKAoIBAQDPgUMdvdYOeVahvAp92RNG55plAlUyEdowNmIpEbyZOlEM\n"
+            + "Jc+7VqMt1K/+ZX1MkAGrFjV635p3c0NqI6qyv57cXA7VT92aYp9S0l4t7Cb2DQ6Y\n"
+            + "D+1jPNYTpYoMoI8ZPA486RGpnBtmRp9KRSkAoLS6AngCABE7OxuE0MrYKhbJ/8Lq\n"
+            + "Ss627FDXK+7aLCbEdLbr5G9BAIMEQDJAomHcqBMz5+EnEXWHc8drHFVIniHByFv3\n"
+            + "HmzDhFEMKCV9PbBXjgKdpMIAJsRXG3t1CBE/pEzILomgg3i4OHSUvEIzTApwTJvg\n"
+            + "UqtXi0UJqPohPViCQFeWLMa2N0pOAx1FMfdJIutLAgMBAAGjUzBRMB0GA1UdDgQW\n"
+            + "BBQBEi9rWGXrZObncP4StBKXB3baODAfBgNVHSMEGDAWgBQBEi9rWGXrZObncP4S\n"
+            + "tBKXB3baODAPBgNVHRMBAf8EBTADAQH/MD4GCSqGSIb3DQEBCjAxoA0wCwYJYIZI\n"
+            + "AWUDBAICoRowGAYJKoZIhvcNAQEIMAsGCWCGSAFlAwQCAqIEAgIAzgOCAQEADIQ6\n"
+            + "2ktTyS9+POWWe8yGEqW/q9DxL0NAqc0n4rYm5hs/8MKk1NMaqIku2xjE3T/16iFj\n"
+            + "3WEtj51yoSIUN0VxXPUoj3Yv5xR03huBk8gAwTpQc9psRQuGpLt9BBq0dyErQ8XR\n"
+            + "88SshQRpDEZ2yR4Tb+U5XfbWe70uCGfeG3iDMtZPAx2GnYBD+u3JaN/m7sr0cB8V\n"
+            + "Y8GuxWNh40aaIR0iaWbIC4b9N3wYDOa1yd8PqAKnLIs1F5CinJM6i5LmbkQpd+cK\n"
+            + "t13iaFYN26HuD3AywDQDvyYTwV7q5jcoEGAd35+pmKCdatEHlo0uLzbTGZw31Gfo\n"
+            + "BeSEh3vmXa1Q7SOpTQ==\n"
+            + "-----END CERTIFICATE-----";
+    /*
+     * Certificate: Data: Version: 3 (0x2)
+     *  Serial Number: 32:f5:cf:23:71:d3:7f:16:10:5d:6e:c7:25:82:ee:7f:a8:ec:27:80
+     *  Signature Algorithm: rsassaPss
+     *  Hash Algorithm: sha512
+     *  Mask Algorithm: mgf1 with sha512
+     *  Salt Length: 0xBE
+     *  Trailer Field: 0xBC (default)
+     *  Issuer: CN = localhost
+     *  Validity Not Before: Apr 8 06:01:37 2020 GMT
+     *  Not After : Apr 3 06:01:37 2040 GMT
+     *  Subject: CN = localhost
+     *  Subject Public Key Info: Public
+     *  Key Algorithm: rsassaPss
+     *  RSA-PSS Public-Key: (2048 bit)
+     */
+    private static final String PUBLIC_512 = "-----BEGIN CERTIFICATE-----\n"
+            + "MIIDaTCCAiCgAwIBAgIUMvXPI3HTfxYQXW7HJYLuf6jsJ4AwPgYJKoZIhvcNAQEK\n"
+            + "MDGgDTALBglghkgBZQMEAgOhGjAYBgkqhkiG9w0BAQgwCwYJYIZIAWUDBAIDogQC\n"
+            + "AgC+MBQxEjAQBgNVBAMMCWxvY2FsaG9zdDAeFw0yMDAzMTcwNzI4MjZaFw00MDAz\n"
+            + "MTIwNzI4MjZaMBQxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASAwCwYJKoZIhvcNAQEK\n"
+            + "A4IBDwAwggEKAoIBAQCzuWpxs8c0JPgSykN9LM+2k0RlexrxCAlkgHRpfLI8XpV4\n"
+            + "Ak3hx9a045Ym1yyskNw7FjZVfWNgmx5Z8qQZvBykCL2iwDoMLEfoJTcE3cZEppaz\n"
+            + "3PqRoOVhuUGqA4jOW8WGbMi7aq/9UfTQGikxMBD7aS/ExILtAcd0N173ZARWcP0s\n"
+            + "68bRDLmTYAclZTWDZee0gAl8MHMnXSFFPotSbZOEWz4RqhpCa49tcx1BHgto3lyc\n"
+            + "ofzOerHpilZ/zAqOVRF2qHoZKlYTsTcSK0mE2MAfV7fk40qHYkyKbKLJVj8L8Lmc\n"
+            + "AFUNTx07bLYymgtqa07ei+kaVTJdlzDWiREgN8MNAgMBAAGjUzBRMB0GA1UdDgQW\n"
+            + "BBRlbX8E0L89iIOjkgLpbL/WSbuxmTAfBgNVHSMEGDAWgBRlbX8E0L89iIOjkgLp\n"
+            + "bL/WSbuxmTAPBgNVHRMBAf8EBTADAQH/MD4GCSqGSIb3DQEBCjAxoA0wCwYJYIZI\n"
+            + "AWUDBAIDoRowGAYJKoZIhvcNAQEIMAsGCWCGSAFlAwQCA6IEAgIAvgOCAQEAaRTy\n"
+            + "CmQxYkS5qCGQeJun/lFVLVE83Sl2kCBaJCMJdBYw38H+6DknJx/sjZwD1vO+OGj6\n"
+            + "1yyzQF1dv2Y5qOUrJIgw1ODkxTLMCrdotVqClazX02VGvyRe7efbjii96/9hqtxt\n"
+            + "TZwN7+8wUX6sP91z1vXVYD5sfl/qum/cWAVJEyw32h7RpUeB0rCJcIUrNqnbBziw\n"
+            + "SRkZof1Q2b02JRO0Pb3jV3H1MV5Agt3cFCCdsmvVq595rmYRwVMtyzCxXHb8jm+N\n"
+            + "8Fzhl9pxCCd4KIOGDAvngFZAloVsCHt+BG8jPhSxOldnFM7xGrGss2lLJnmf3YSe\n"
+            + "EPDF7NvA9wKPz4oyRg==\n"
+            + "-----END CERTIFICATE-----";
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/rsa/pss/SerializedPSSKey.java	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import static javax.crypto.Cipher.PRIVATE_KEY;
+import static javax.crypto.Cipher.PUBLIC_KEY;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.KeyFactory;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.Signature;
+import java.security.interfaces.RSAPrivateCrtKey;
+import java.security.interfaces.RSAPublicKey;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.MGF1ParameterSpec;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.PSSParameterSpec;
+import java.security.spec.RSAKeyGenParameterSpec;
+import java.security.spec.RSAPrivateCrtKeySpec;
+import java.security.spec.RSAPublicKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Arrays;
+
+/**
+ * @test @bug 8242335
+ * @summary Test RSASSA-PSS serialized keys
+ * @run main SerializedPSSKey
+ */
+public class SerializedPSSKey {
+
+    private static final String ALGO = "RSASSA-PSS";
+    private static final String OID = "1.2.840.113549.1.1.10";
+    private static final String PROVIDER = "SunRsaSign";
+    private static final int KEY_SIZE = 2048;
+    private static final byte[] DATA = "Test".getBytes();
+    /**
+     * Digest algorithms to test w/ RSASSA-PSS signature algorithms
+     */
+    private static final String[] DIGEST_ALG = {
+        "SHA-1", "SHA-224", "SHA-256", "SHA-384",
+        "SHA-512", "SHA-512/224", "SHA-512/256"
+    };
+
+    public static void main(String[] args) throws Exception {
+
+        for (String algo : new String[]{ALGO, OID}) {
+            KeyPairGenerator kpg = KeyPairGenerator.getInstance(algo, PROVIDER);
+
+            // Algorithm-Independent Initialization
+            kpg.initialize(KEY_SIZE);
+            KeyPair kp = kpg.generateKeyPair();
+            test(algo, kp, null);
+            for (String digest : DIGEST_ALG) {
+                PSSParameterSpec params = genPSSParameter(digest, KEY_SIZE);
+                // RSAKeyGenParameterSpec#1 Initialization
+                kpg.initialize(new RSAKeyGenParameterSpec(KEY_SIZE,
+                        RSAKeyGenParameterSpec.F4, params));
+                KeyPair kp2 = kpg.generateKeyPair();
+                test(algo, kp2, params);
+            }
+            System.out.println("Successful with : " + algo);
+        }
+    }
+
+    private static void test(String algo, KeyPair orig, PSSParameterSpec params)
+            throws Exception {
+
+        Key[] privs = manipulateKey(algo, PRIVATE_KEY, orig.getPrivate());
+        Key[] pubs = manipulateKey(algo, PUBLIC_KEY, orig.getPublic());
+        for (Key pri : privs) {
+            for (Key pub : pubs) {
+                testSerialize(orig, new KeyPair(
+                        (PublicKey) pub, (PrivateKey) pri));
+                if (params != null) {
+                    testSignature(algo, (PublicKey) pub,
+                            (PrivateKey) pri, params);
+                }
+            }
+        }
+    }
+
+    private static void testSignature(String algo, PublicKey pub,
+            PrivateKey priv, PSSParameterSpec params) throws Exception {
+
+        Signature sig = Signature.getInstance(algo, PROVIDER);
+        sig.setParameter(params);
+        sig.initSign(priv);
+        sig.update(DATA);
+        byte[] signature = sig.sign();
+
+        sig.initVerify(pub);
+        sig.update(DATA);
+        if (!sig.verify(signature)) {
+            throw new RuntimeException("Signature verification failed");
+        }
+        // Re-verify the signature with another Signature instance
+        Signature sig1 = Signature.getInstance(algo, PROVIDER);
+        sig1.setParameter(params);
+        sig1.initVerify(pub);
+        sig1.update(DATA);
+        if (!sig1.verify(signature)) {
+            throw new RuntimeException("Signature verification failed");
+        }
+    }
+
+    private static Key[] manipulateKey(String algo, int type, Key key)
+            throws NoSuchAlgorithmException, InvalidKeySpecException,
+            NoSuchProviderException, InvalidKeyException {
+
+        KeyFactory kf = KeyFactory.getInstance(algo, PROVIDER);
+        switch (type) {
+            case PUBLIC_KEY:
+                return new Key[]{
+                    kf.generatePublic(kf.getKeySpec(key, RSAPublicKeySpec.class)),
+                    kf.generatePublic(new X509EncodedKeySpec(key.getEncoded())),
+                    kf.generatePublic(new RSAPublicKeySpec(
+                    ((RSAPublicKey) key).getModulus(),
+                    ((RSAPublicKey) key).getPublicExponent(),
+                    ((RSAPublicKey) key).getParams())),
+                    kf.translateKey(key)
+                };
+            case PRIVATE_KEY:
+                RSAPrivateCrtKey crtKey = (RSAPrivateCrtKey) key;
+                return new Key[]{
+                    kf.generatePrivate(
+                    kf.getKeySpec(key, RSAPrivateCrtKeySpec.class)),
+                    kf.generatePrivate(new PKCS8EncodedKeySpec(key.getEncoded())),
+                    kf.generatePrivate(new RSAPrivateCrtKeySpec(
+                    crtKey.getModulus(),
+                    crtKey.getPublicExponent(),
+                    crtKey.getPrivateExponent(),
+                    crtKey.getPrimeP(),
+                    crtKey.getPrimeQ(),
+                    crtKey.getPrimeExponentP(),
+                    crtKey.getPrimeExponentQ(),
+                    crtKey.getCrtCoefficient(),
+                    crtKey.getParams()
+                    )),
+                    kf.translateKey(key)
+                };
+        }
+        throw new RuntimeException("We shouldn't reach here");
+    }
+
+    private static PSSParameterSpec genPSSParameter(String digest, int keySize)
+            throws NoSuchAlgorithmException {
+
+        int dgLen = MessageDigest.getInstance(digest).getDigestLength();
+        // pick a salt length based on the key length and digestAlgo
+        int saltLength = keySize / 8 - dgLen - 2;
+        if (saltLength < 0) {
+            System.out.printf("keysize: %s, digestLen: %s%n", keySize / 8, dgLen);
+            return null;
+        }
+        return new PSSParameterSpec(digest, "MGF1", new MGF1ParameterSpec(digest),
+                saltLength, PSSParameterSpec.TRAILER_FIELD_BC);
+    }
+
+    /**
+     * Compare original KeyPair with transformed ones.
+     */
+    private static void testKeyEquals(KeyPair orig, PublicKey pubKey,
+            PrivateKey priKey) {
+
+        if (!orig.getPrivate().equals(priKey)
+                && orig.getPrivate().hashCode() != priKey.hashCode()
+                && !Arrays.equals(orig.getPrivate().getEncoded(),
+                        priKey.getEncoded())) {
+            throw new RuntimeException(
+                    "PrivateKey is not equal with transformed one");
+        }
+        if (!orig.getPublic().equals(pubKey)
+                && orig.getPublic().hashCode() != pubKey.hashCode()
+                && !Arrays.equals(orig.getPublic().getEncoded(),
+                        pubKey.getEncoded())) {
+            throw new RuntimeException(
+                    "PublicKey is not equal with transformed one");
+        }
+    }
+
+    /**
+     * Test serialization of KeyPair and Keys it holds.
+     */
+    private static void testSerialize(KeyPair orig, KeyPair transformed)
+            throws Exception {
+
+        testKeyEquals(orig, transformed.getPublic(), transformed.getPrivate());
+        PrivateKey serializedPrivate = deserializedCopy(transformed.getPrivate(),
+                PrivateKey.class);
+        PublicKey serializedPublic = deserializedCopy(transformed.getPublic(),
+                PublicKey.class);
+        testKeyEquals(orig, serializedPublic, serializedPrivate);
+        // Verify Serialized KeyPair instance.
+        KeyPair copy = deserializedCopy(transformed, KeyPair.class);
+        testKeyEquals(orig, copy.getPublic(), copy.getPrivate());
+    }
+
+    private static <T extends Object> T deserializedCopy(T orig, Class<T> type)
+            throws IOException, ClassNotFoundException {
+        return deserialize(serialize(orig), type);
+    }
+
+    /**
+     * Deserialize the Key object.
+     */
+    private static <T extends Object> T deserialize(byte[] serialized,
+            Class<T> type) throws IOException, ClassNotFoundException {
+
+        T key = null;
+        try (ByteArrayInputStream bis = new ByteArrayInputStream(serialized);
+                ObjectInputStream ois = new ObjectInputStream(bis)) {
+            key = (T) ois.readObject();
+        }
+        return key;
+    }
+
+    /**
+     * Serialize the given Key object.
+     */
+    private static <T extends Object> byte[] serialize(T key)
+            throws IOException {
+
+        try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
+                ObjectOutputStream oos = new ObjectOutputStream(bos)) {
+            oos.writeObject(key);
+            return bos.toByteArray();
+        }
+    }
+
+}
--- a/test/sun/security/rsa/pss/SignatureTest2.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/security/rsa/pss/SignatureTest2.java	Wed Feb 03 05:23:32 2021 +0000
@@ -31,13 +31,15 @@
 
 /**
  * @test
- * @bug 8146293
- * @summary Create a signature for RSA and get its signed data. re-initiate
- *          the signature with the public key. The signature can be verified
- *          by acquired signed data.
+ * @bug 8146293 8238448
+ * @summary Create a signature for RSASSA-PSS and get its signed data.
+ *          re-initiate the signature with the public key. The signature
+ *          can be verified by acquired signed data.
  * @run main SignatureTest2 768
  * @run main SignatureTest2 1024
+ * @run main SignatureTest2 1025
  * @run main SignatureTest2 2048
+ * @run main SignatureTest2 2049
  * @run main/timeout=240 SignatureTest2 4096
  */
 public class SignatureTest2 {
--- a/test/sun/security/rsa/pss/SignatureTestPSS.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/security/rsa/pss/SignatureTestPSS.java	Wed Feb 03 05:23:32 2021 +0000
@@ -32,16 +32,18 @@
 
 /**
  * @test
- * @bug 8146293
- * @summary Create a signature for RSA and get its signed data. re-initiate
- *          the signature with the public key. The signature can be verified
- *          by acquired signed data.
+ * @bug 8146293 8238448
+ * @summary Create a signature for RSASSA-PSS and get its signed data.
+ *          re-initiate the signature with the public key. The signature
+ *          can be verified by acquired signed data.
  * @library /lib
  * @build jdk.test.lib.SigTestUtil
  * @run main SignatureTestPSS 512
  * @run main SignatureTestPSS 768
  * @run main SignatureTestPSS 1024
+ * @run main SignatureTestPSS 1025
  * @run main SignatureTestPSS 2048
+ * @run main SignatureTestPSS 2049
  * @run main/timeout=240 SignatureTestPSS 4096
  * @run main/timeout=240 SignatureTestPSS 5120
  * @run main/timeout=480 SignatureTestPSS 6144
--- a/test/sun/text/resources/LocaleData	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/text/resources/LocaleData	Wed Feb 03 05:23:32 2021 +0000
@@ -1187,7 +1187,7 @@
 FormatData/ar_JO/MonthNames/1=\u0634\u0628\u0627\u0637
 FormatData/ar_JO/MonthNames/2=\u0622\u0630\u0627\u0631
 FormatData/ar_JO/MonthNames/3=\u0646\u064a\u0633\u0627\u0646
-FormatData/ar_JO/MonthNames/4=\u0646\u0648\u0627\u0631
+FormatData/ar_JO/MonthNames/4=\u0623\u064a\u0627\u0631
 FormatData/ar_JO/MonthNames/5=\u062d\u0632\u064a\u0631\u0627\u0646
 FormatData/ar_JO/MonthNames/6=\u062a\u0645\u0648\u0632
 FormatData/ar_JO/MonthNames/7=\u0622\u0628
@@ -1200,7 +1200,7 @@
 FormatData/ar_JO/MonthAbbreviations/1=\u0634\u0628\u0627\u0637
 FormatData/ar_JO/MonthAbbreviations/2=\u0622\u0630\u0627\u0631
 FormatData/ar_JO/MonthAbbreviations/3=\u0646\u064a\u0633\u0627\u0646
-FormatData/ar_JO/MonthAbbreviations/4=\u0646\u0648\u0627\u0631
+FormatData/ar_JO/MonthAbbreviations/4=\u0623\u064a\u0627\u0631
 FormatData/ar_JO/MonthAbbreviations/5=\u062d\u0632\u064a\u0631\u0627\u0646
 FormatData/ar_JO/MonthAbbreviations/6=\u062a\u0645\u0648\u0632
 FormatData/ar_JO/MonthAbbreviations/7=\u0622\u0628
@@ -1363,7 +1363,7 @@
 FormatData/ar_LB/MonthNames/1=\u0634\u0628\u0627\u0637
 FormatData/ar_LB/MonthNames/2=\u0622\u0630\u0627\u0631
 FormatData/ar_LB/MonthNames/3=\u0646\u064a\u0633\u0627\u0646
-FormatData/ar_LB/MonthNames/4=\u0646\u0648\u0627\u0631
+FormatData/ar_LB/MonthNames/4=\u0623\u064a\u0627\u0631
 FormatData/ar_LB/MonthNames/5=\u062d\u0632\u064a\u0631\u0627\u0646
 FormatData/ar_LB/MonthNames/6=\u062a\u0645\u0648\u0632
 FormatData/ar_LB/MonthNames/7=\u0622\u0628
@@ -1376,7 +1376,7 @@
 FormatData/ar_LB/MonthAbbreviations/1=\u0634\u0628\u0627\u0637
 FormatData/ar_LB/MonthAbbreviations/2=\u0622\u0630\u0627\u0631
 FormatData/ar_LB/MonthAbbreviations/3=\u0646\u064a\u0633\u0627\u0646
-FormatData/ar_LB/MonthAbbreviations/4=\u0646\u0648\u0627\u0631
+FormatData/ar_LB/MonthAbbreviations/4=\u0623\u064a\u0627\u0631
 FormatData/ar_LB/MonthAbbreviations/5=\u062d\u0632\u064a\u0631\u0627\u0646
 FormatData/ar_LB/MonthAbbreviations/6=\u062a\u0645\u0648\u0632
 FormatData/ar_LB/MonthAbbreviations/7=\u0622\u0628
@@ -1980,8 +1980,8 @@
 FormatData/ar_SY/MonthNames/1=\u0634\u0628\u0627\u0637
 FormatData/ar_SY/MonthNames/2=\u0622\u0630\u0627\u0631
 FormatData/ar_SY/MonthNames/3=\u0646\u064a\u0633\u0627\u0646
-FormatData/ar_SY/MonthNames/4=\u0646\u0648\u0627\u0631\u0627\u0646
-FormatData/ar_SY/MonthNames/5=\u062d\u0632\u064a\u0631
+FormatData/ar_SY/MonthNames/4=\u0623\u064a\u0627\u0631
+FormatData/ar_SY/MonthNames/5=\u062d\u0632\u064a\u0631\u0627\u0646
 FormatData/ar_SY/MonthNames/6=\u062a\u0645\u0648\u0632
 FormatData/ar_SY/MonthNames/7=\u0622\u0628
 FormatData/ar_SY/MonthNames/8=\u0623\u064a\u0644\u0648\u0644
@@ -1993,7 +1993,7 @@
 FormatData/ar_SY/MonthAbbreviations/1=\u0634\u0628\u0627\u0637
 FormatData/ar_SY/MonthAbbreviations/2=\u0622\u0630\u0627\u0631
 FormatData/ar_SY/MonthAbbreviations/3=\u0646\u064a\u0633\u0627\u0646
-FormatData/ar_SY/MonthAbbreviations/4=\u0646\u0648\u0627\u0631
+FormatData/ar_SY/MonthAbbreviations/4=\u0623\u064a\u0627\u0631
 FormatData/ar_SY/MonthAbbreviations/5=\u062d\u0632\u064a\u0631\u0627\u0646
 FormatData/ar_SY/MonthAbbreviations/6=\u062a\u0645\u0648\u0632
 FormatData/ar_SY/MonthAbbreviations/7=\u0622\u0628
--- a/test/sun/text/resources/LocaleDataTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/text/resources/LocaleDataTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
  *      7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 7090826
  *      8017142 8037343 8055222 8042126 8074791 8075173 8080774 8129361 8145952
  *      8164784 8187946 8195478 8193552 8202026 8204269 8208746 8209775 8234228
+ *      8250665
  * @summary Verify locale data
  *
  */
--- a/test/sun/tools/jconsole/ResourceCheckTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/tools/jconsole/ResourceCheckTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/test/sun/tools/jconsole/ResourceCheckTest.sh	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/tools/jconsole/ResourceCheckTest.sh	Wed Feb 03 05:23:32 2021 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,87 +26,4 @@
 #   @summary    jtreg test ResourceCheckTest.java must be
 #               able to find jconsole.jar
 #
-#   @run shell ResourceCheckTest.sh
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail() 
- { echo "The test failed :-("
-   echo "$*" 1>&2
-   echo "exit status was $status"
-   exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass() 
- { echo "The test passed!!!"
-   echo "$*" 1>&2
-   exit 0
- } #end of pass()
-
-# end of subroutines
-
-# The beginning of the script proper
-
-OS=`uname -s`
-case "$OS" in
-   SunOS | Linux | Darwin | AIX)
-      PATHSEP=":"
-      ;;
-
-   Windows* | CYGWIN*)
-      PATHSEP=";"
-      ;;
-
-   # catch all other OSs
-   * )
-      echo "Unrecognized system!  $OS"
-      fail "Unrecognized system!  $OS"
-      ;;
-esac
-
-TARGETCLASS="ResourceCheckTest"
-if [ -z "${TESTJAVA}" ] ; then
-   # TESTJAVA is not set, so the test is running stand-alone.
-   # TESTJAVA holds the path to the root directory of the build of the JDK
-   # to be tested.  That is, any java files run explicitly in this shell
-   # should use TESTJAVA in the path to the java interpreter.
-   # So, we'll set this to the JDK spec'd on the command line.  If none
-   # is given on the command line, tell the user that and use a default.
-   # THIS IS THE JDK BEING TESTED.
-   if [ -n "$1" ] ; then
-          TESTJAVA=$1
-      else
-	  TESTJAVA=$JAVA_HOME
-   fi
-   TESTSRC=.
-   TESTCLASSES=.
-   #Deal with .class files:
-fi
-#
-echo "JDK under test is: $TESTJAVA"
-#
-CP="-classpath ${TESTCLASSES}${PATHSEP}${TESTJAVA}/lib/jconsole.jar"
-# Compile the test class using the classpath we need:
-#
-env
-#
-set -vx
-#
-#Compile.  jconsole.jar is required on the classpath.
-${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
-                         "${TESTSRC}"/"${TARGETCLASS}".java
-#
-#Run the test class, again with the classpath we need:
-${TESTJAVA}/bin/java ${CP} ${TARGETCLASS}
-status=$?
-echo "test status was: $status"
-if [ $status -eq "0" ];
-   then pass ""
-
-   else fail "unspecified test failure"
-fi
+#   @run shell common.sh ResourceCheckTest
--- a/test/sun/tools/jconsole/WorkerDeadlockTest.java	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/tools/jconsole/WorkerDeadlockTest.java	Wed Feb 03 05:23:32 2021 +0000
@@ -22,12 +22,12 @@
  */
 
 /**
- * @test
+ * This isn't the test case: WorkerDeadlockTest.sh is.
+ * Refer to WorkerDeaklockTest.sh when running this test.
+ *
  * @bug 8236872
  * @summary The test tries to catch a deadlock by creating a new worker,
  * starting it, adding an empty job and immediately stopping it.
- * @modules jdk.jconsole/sun.tools.jconsole
- * @run main WorkerDeadlockTest
  */
 
 import sun.tools.jconsole.Worker;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/tools/jconsole/WorkerDeadlockTest.sh	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,29 @@
+#
+# Copyright (c) 2020, Huawei Technologies Co. Ltd. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#   @test
+#   @bug        8254683
+#   @summary    jtreg test WorkerDeadlockTest.java must be
+#               able to find jconsole.jar
+#
+#   @run shell common.sh WorkerDeadlockTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/tools/jconsole/common.sh	Wed Feb 03 05:23:32 2021 +0000
@@ -0,0 +1,105 @@
+#
+# Copyright (c) 2004, 2020, 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.
+#
+
+# Beginning of subroutines:
+status=1
+
+#Call this from anywhere to fail the test with an error message
+# usage: fail "reason why the test failed"
+fail() 
+ { echo "The test failed :-("
+   echo "$*" 1>&2
+   echo "exit status was $status"
+   exit $status
+ } #end of fail()
+
+#Call this from anywhere to pass the test with a message
+# usage: pass "reason why the test passed if applicable"
+pass() 
+ { echo "The test passed!!!"
+   echo "$*" 1>&2
+   exit 0
+ } #end of pass()
+
+# end of subroutines
+
+# The beginning of the script proper
+
+OS=`uname -s`
+case "$OS" in
+   SunOS | Linux | Darwin | AIX)
+      PATHSEP=":"
+      ;;
+
+   Windows* | CYGWIN*)
+      PATHSEP=";"
+      ;;
+
+   # catch all other OSs
+   * )
+      echo "Unrecognized system!  $OS"
+      fail "Unrecognized system!  $OS"
+      ;;
+esac
+
+TARGETCLASS=$1
+if [ -z "${TESTJAVA}" ] ; then
+   # TESTJAVA is not set, so the test is running stand-alone.
+   # TESTJAVA holds the path to the root directory of the build of the JDK
+   # to be tested.  That is, any java files run explicitly in this shell
+   # should use TESTJAVA in the path to the java interpreter.
+   # So, we'll set this to the JDK spec'd on the command line.  If none
+   # is given on the command line, tell the user that and use a default.
+   # THIS IS THE JDK BEING TESTED.
+   if [ -n "$1" ] ; then
+          TESTJAVA=$1
+      else
+	  TESTJAVA=$JAVA_HOME
+   fi
+   TESTSRC=.
+   TESTCLASSES=.
+   #Deal with .class files:
+fi
+#
+echo "JDK under test is: $TESTJAVA"
+#
+CP="-classpath ${TESTCLASSES}${PATHSEP}${TESTJAVA}/lib/jconsole.jar"
+# Compile the test class using the classpath we need:
+#
+env
+#
+set -vx
+#
+#Compile.  jconsole.jar is required on the classpath.
+${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
+                         "${TESTSRC}"/"${TARGETCLASS}".java
+#
+#Run the test class, again with the classpath we need:
+${TESTJAVA}/bin/java ${CP} ${TARGETCLASS}
+status=$?
+echo "test status was: $status"
+if [ $status -eq "0" ];
+   then pass ""
+
+   else fail "unspecified test failure"
+fi
--- a/test/sun/util/calendar/zi/tzdata/VERSION	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/util/calendar/zi/tzdata/VERSION	Wed Feb 03 05:23:32 2021 +0000
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2020b
+tzdata2020d
--- a/test/sun/util/calendar/zi/tzdata/asia	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/util/calendar/zi/tzdata/asia	Wed Feb 03 05:23:32 2021 +0000
@@ -3244,13 +3244,40 @@
 
 # From Sharef Mustafa (2019-10-18):
 # Palestine summer time will end on midnight Oct 26th 2019 ...
-# http://www.palestinecabinet.gov.ps/website/ar/ViewDetails?ID=43948
+#
+# From Steffen Thorsen (2020-10-20):
+# Some sources such as these say, and display on clocks, that DST ended at
+# midnight last year...
+# https://www.amad.ps/ar/post/320006
+#
+# From Tim Parenti (2020-10-20):
+# The report of the Palestinian Cabinet meeting of 2019-10-14 confirms
+# a decision on (translated): "The start of the winter time in Palestine, by
+# delaying the clock by sixty minutes, starting from midnight on Friday /
+# Saturday corresponding to 26/10/2019."
+# http://www.palestinecabinet.gov.ps/portal/meeting/details/43948
+
+# From Sharef Mustafa (2020-10-20):
+# As per the palestinian cabinet announcement yesterday , the day light saving
+# shall [end] on Oct 24th 2020 at 01:00AM by delaying the clock by 60 minutes.
+# http://www.palestinecabinet.gov.ps/portal/Meeting/Details/51584
+
+# From Tim Parenti (2020-10-20):
+# Predict future fall transitions at 01:00 on the Saturday preceding October's
+# last Sunday (i.e., Sat>=24).  This is consistent with our predictions since
+# 2016, although the time of the change differed slightly in 2019.
+
+# From Pierre Cashon (2020-10-20):
+# The summer time this year started on March 28 at 00:00.
+# https://wafa.ps/ar_page.aspx?id=GveQNZa872839351758aGveQNZ
+# http://www.palestinecabinet.gov.ps/portal/meeting/details/50284
+# The winter time in 2015 started on October 23 at 01:00.
+# https://wafa.ps/ar_page.aspx?id=CgpCdYa670694628582aCgpCdY
+# http://www.palestinecabinet.gov.ps/portal/meeting/details/27583
 #
 # From Paul Eggert (2019-04-10):
-# For now, guess spring-ahead transitions are March's last Friday at 00:00.
-#
-# From Tim Parenti (2016-10-19):
-# Predict fall transitions on October's last Saturday at 01:00 from now on.
+# For now, guess spring-ahead transitions are at 00:00 on the Saturday
+# preceding March's last Sunday (i.e., Sat>=24).
 
 # Rule	NAME	FROM	TO	-	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -3266,10 +3293,10 @@
 Rule Palestine	2005	only	-	Oct	 4	2:00	0	-
 Rule Palestine	2006	2007	-	Apr	 1	0:00	1:00	S
 Rule Palestine	2006	only	-	Sep	22	0:00	0	-
-Rule Palestine	2007	only	-	Sep	Thu>=8	2:00	0	-
+Rule Palestine	2007	only	-	Sep	13	2:00	0	-
 Rule Palestine	2008	2009	-	Mar	lastFri	0:00	1:00	S
 Rule Palestine	2008	only	-	Sep	 1	0:00	0	-
-Rule Palestine	2009	only	-	Sep	Fri>=1	1:00	0	-
+Rule Palestine	2009	only	-	Sep	 4	1:00	0	-
 Rule Palestine	2010	only	-	Mar	26	0:00	1:00	S
 Rule Palestine	2010	only	-	Aug	11	0:00	0	-
 Rule Palestine	2011	only	-	Apr	 1	0:01	1:00	S
@@ -3278,12 +3305,16 @@
 Rule Palestine	2011	only	-	Sep	30	0:00	0	-
 Rule Palestine	2012	2014	-	Mar	lastThu	24:00	1:00	S
 Rule Palestine	2012	only	-	Sep	21	1:00	0	-
-Rule Palestine	2013	only	-	Sep	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	2013	only	-	Sep	27	0:00	0	-
+Rule Palestine	2014	only	-	Oct	24	0:00	0	-
+Rule Palestine	2015	only	-	Mar	28	0:00	1:00	S
+Rule Palestine	2015	only	-	Oct	23	1:00	0	-
 Rule Palestine	2016	2018	-	Mar	Sat>=24	1:00	1:00	S
-Rule Palestine	2016	max	-	Oct	lastSat	1:00	0	-
-Rule Palestine	2019	max	-	Mar	lastFri	0:00	1:00	S
+Rule Palestine	2016	2018	-	Oct	Sat>=24	1:00	0	-
+Rule Palestine	2019	only	-	Mar	29	0:00	1:00	S
+Rule Palestine	2019	only	-	Oct	Sat>=24	0:00	0	-
+Rule Palestine	2020	max	-	Mar	Sat>=24	0:00	1:00	S
+Rule Palestine	2020	max	-	Oct	Sat>=24	1:00	0	-
 
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct
--- a/test/sun/util/calendar/zi/tzdata/australasia	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/util/calendar/zi/tzdata/australasia	Wed Feb 03 05:23:32 2021 +0000
@@ -404,6 +404,19 @@
 # From Michael Deckers (2019-08-06):
 # https://www.laws.gov.fj/LawsAsMade/downloadfile/848
 
+# From Raymond Kumar (2020-10-08):
+# [DST in Fiji] is from December 20th 2020, till 17th January 2021.
+# From Alan Mintz (2020-10-08):
+# https://www.laws.gov.fj/LawsAsMade/GetFile/1071
+# From Tim Parenti (2020-10-08):
+# https://www.fijivillage.com/news/Daylight-saving-from-Dec-20th-this-year-to-Jan-17th-2021-8rf4x5/
+# "Minister for Employment, Parveen Bala says they had never thought of
+# stopping daylight saving. He says it was just to decide on when it should
+# start and end.  Bala says it is a short period..."
+# Since the end date is still in line with our ongoing predictions, assume for
+# now that the later-than-usual start date is a one-time departure from the
+# recent second Sunday in November pattern.
+
 # Rule	NAME	FROM	TO	-	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	-
 Rule	Fiji	1999	2000	-	Feb	lastSun	3:00	0	-
@@ -415,7 +428,9 @@
 Rule	Fiji	2014	only	-	Jan	Sun>=18	2:00	0	-
 Rule	Fiji	2014	2018	-	Nov	Sun>=1	2:00	1:00	-
 Rule	Fiji	2015	max	-	Jan	Sun>=12	3:00	0	-
-Rule	Fiji	2019	max	-	Nov	Sun>=8	2:00	1:00	-
+Rule	Fiji	2019	only	-	Nov	Sun>=8	2:00	1:00	-
+Rule	Fiji	2020	only	-	Dec	20	2:00	1:00	-
+Rule	Fiji	2021	max	-	Nov	Sun>=8	2:00	1:00	-
 # Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26 # Suva
 			12:00	Fiji	+12/+13
--- a/test/sun/util/calendar/zi/tzdata/europe	Tue Jan 19 17:18:23 2021 +0000
+++ b/test/sun/util/calendar/zi/tzdata/europe	Wed Feb 03 05:23:32 2021 +0000
@@ -1052,17 +1052,16 @@
 # Denmark, Faroe Islands, and Greenland
 
 # From Jesper Nørgaard Welen (2005-04-26):
-# http://www.hum.aau.dk/~poe/tid/tine/DanskTid.htm says that the law
-# [introducing standard time] was in effect from 1894-01-01....
-# The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL
+# the law [introducing standard time] was in effect from 1894-01-01....
+# The page https://www.retsinformation.dk/eli/lta/1893/83
 # confirms this, and states that the law was put forth 1893-03-29.
 #
 # The EU [actually, EEC and Euratom] treaty with effect from 1973:
-# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL
+# https://www.retsinformation.dk/eli/lta/1972/21100
 #
 # This provoked a new law from 1974 to make possible summer time changes
 # in subsequent decrees with the law
-# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19740022330-REGL
+# https://www.retsinformation.dk/eli/lta/1974/223
 #
 # It seems however that no decree was set forward until 1980.  I have
 # not found any decree, but in another related law, the effecting DST
@@ -1074,7 +1073,7 @@
 # The law is about the management of the extra hour, concerning
 # working hours reported and effect on obligatory-rest rules (which
 # was suspended on that night):
-# http://www.retsinfo.dk/_GETDOCI_/ACCN/C19801120554-REGL
+# https://web.archive.org/web/20140104053304/https://www.retsinformation.dk/Forms/R0710.aspx?id=60267
 
 # From Jesper Nørgaard Welen (2005-06-11):
 # The Herning Folkeblad (1980-09-26) reported that the night between
@@ -1612,6 +1611,8 @@
 # https://library.hungaricana.hu/hu/view/Zala_1948_09/?pg=64
 # https://library.hungaricana.hu/hu/view/SatoraljaujhelyiLeveltar_ZempleniNepujsag_1948/?pg=53
 # https://library.hungaricana.hu/hu/view/SatoraljaujhelyiLeveltar_ZempleniNepujsag_1948/?pg=160
+# https://library.hungaricana.hu/hu/view/UjSzo_1949_01-04/?pg=102
+# https://library.hungaricana.hu/hu/view/KeletMagyarorszag_1949_03/?pg=96
 # https://library.hungaricana.hu/hu/view/Delmagyarorszag_1949_09/?pg=94
 Rule	Hungary	1947	1949	-	Apr	Sun>=4	 2:00s	1:00	S
 Rule	Hungary	1947	1949	-	Oct	Sun>=1	 2:00s	0	-
@@ -1627,9 +1628,10 @@
 # https://library.hungaricana.hu/hu/view/PestMegyeiHirlap_1957_09/?pg=143
 Rule	Hungary	1956	1957	-	Jun	Sun>=1	 2:00	1:00	S
 Rule	Hungary	1956	1957	-	Sep	lastSun	 3:00	0	-
-# https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1980/?pg=1227
+# https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1980/?pg=189
 Rule	Hungary	1980	only	-	Apr	 6	 0:00	1:00	S
 Rule	Hungary	1980	only	-	Sep	28	 1:00	0	-
+# https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1980/?pg=1227
 # https://library.hungaricana.hu/hu/view/Delmagyarorszag_1981_01/?pg=79
 # https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1982/?pg=115
 # https://library.hungaricana.hu/hu/view/DTT_KOZL_TanacsokKozlonye_1983/?pg=85
@@ -1640,6 +1642,7 @@
 Zone	Europe/Budapest	1:16:20 -	LMT	1890 Nov  1
 			1:00	C-Eur	CE%sT	1918
 # https://library.hungaricana.hu/hu/view/OGYK_RT_1941/?pg=1204
+# https://library.hungaricana.hu/hu/view/OGYK_RT_1942/?pg=3955
 			1:00	Hungary	CE%sT	1941 Apr  7 23:00
 			1:00	C-Eur	CE%sT	1945
 			1:00	Hungary	CE%sT	1984