Merge
authorduke
Wed, 05 Jul 2017 16:53:56 +0200
changeset 2855 c233842412b3
parent 2854 47bb5c4cb85e (current diff)
parent 2846 629e4fc20f75 (diff)
child 2856 5a10e4d0b14d
Merge
corba/make/README
hotspot/make/README
jaxp/make/README
jaxws/make/README
--- a/.hgtags-top-repo	Tue May 19 17:39:30 2009 -0700
+++ b/.hgtags-top-repo	Wed Jul 05 16:53:56 2017 +0200
@@ -33,3 +33,4 @@
 ba12117a5e6c918578d6b2a8c693232a33289024 jdk7-b56
 ffd09e767dfa6d21466183a400f72cf62d53297f jdk7-b57
 59b497130f82ec809c245ffb5e521e3a5fabf8af jdk7-b58
+030142474602b4a067662fffc0c8e541de5a78df jdk7-b59
--- a/corba/.hgtags	Tue May 19 17:39:30 2009 -0700
+++ b/corba/.hgtags	Wed Jul 05 16:53:56 2017 +0200
@@ -33,3 +33,4 @@
 553a664b807bb3a3c93f3b5a3c20ff0a90e08371 jdk7-b56
 972c6157fae57850694675da82fd58a17930db0a jdk7-b57
 2e3b8edab3ef55406494d3dd562e06882e6fc15e jdk7-b58
+7e6b2b55c00cc523b468272353ada3979adbbf16 jdk7-b59
--- a/corba/make/README	Tue May 19 17:39:30 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-README:
-  This file should be located at the top of the corba Mercurial repository.
-
-  See http://openjdk.java.net/ for more information about the OpenJDK.
-
-  See ../README-builds.html for complete details on build machine requirements.
-
-Simple Build Instructions:
-
-    cd make && gnumake
-     
-  The files that will be imported into the jdk build will be in the "dist"
-  directory.
-
--- a/corba/make/common/shared/Compiler-gcc.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/corba/make/common/shared/Compiler-gcc.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -73,23 +73,18 @@
   ifneq ("$(findstring sparc,$(ARCH))", "")
     # sparc or sparcv9
     REQUIRED_CC_VER = 4.0
-    REQUIRED_GCC_VER = 4.0.*
   else
   ifeq ($(ARCH_DATA_MODEL), 32)
     # i586
     REQUIRED_CC_VER = 3.2
-    REQUIRED_GCC_VER = 3.2.1*
-    REQUIRED_GCC_VER_INT = 3.2.1-7a
   else
   ifeq ($(ARCH), amd64)
     # amd64
     REQUIRED_CC_VER = 3.2
-    REQUIRED_GCC_VER = 3.2.*
   endif
   ifeq ($(ARCH), ia64)
     # ia64
     REQUIRED_CC_VER = 3.2
-    REQUIRED_GCC_VER = 2.9[56789].*
   endif
   endif
   endif
@@ -109,13 +104,6 @@
 
   # Option used to create a shared library
   SHARED_LIBRARY_FLAG = -G
-  # But gcc is still needed no matter what on 32bit
-  ifeq ($(ARCH_DATA_MODEL), 32)
-    REQUIRED_GCC_VER = 2.95
-    GCC =$(GCC_COMPILER_PATH)gcc
-    _GCC_VER :=$(shell $(GCC) -dumpversion 2>&1 )
-    GCC_VER  :=$(call GetVersion,"$(_GCC_VER)")
-  endif
 
 endif
 
--- a/corba/make/common/shared/Compiler-sun.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/corba/make/common/shared/Compiler-sun.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -39,13 +39,6 @@
   LINT           = $(COMPILER_PATH)lint
   # Option used to create a shared library
   SHARED_LIBRARY_FLAG = -G
-  # But gcc is still needed no matter what on 32bit
-  ifeq ($(ARCH_DATA_MODEL), 32)
-    REQUIRED_GCC_VER = 2.95
-    GCC =$(GCC_COMPILER_PATH)gcc
-    _GCC_VER :=$(shell $(GCC) -dumpversion 2>&1 )
-    GCC_VER  :=$(call GetVersion,"$(_GCC_VER)")
-  endif
 endif
 
 # Sun Studio Compiler settings specific to Linux
--- a/corba/make/common/shared/Platform.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/corba/make/common/shared/Platform.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -288,11 +288,22 @@
   TEMP_DISK=C:/temp
   # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
   # return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
+  PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER))
+  PROC_ARCH:=$(subst x86,X86,$(PROC_ARCH))
+  PROC_ARCH:=$(subst x64,X64,$(PROC_ARCH))
+  PROC_ARCH:=$(subst intel64,X64,$(PROC_ARCH))
+  PROC_ARCH:=$(subst Intel64,X64,$(PROC_ARCH))
+  PROC_ARCH:=$(subst INTEL64,X64,$(PROC_ARCH))
+  PROC_ARCH:=$(subst em64t,X64,$(PROC_ARCH))
+  PROC_ARCH:=$(subst EM64T,X64,$(PROC_ARCH))
+  PROC_ARCH:=$(subst amd64,X64,$(PROC_ARCH))
+  PROC_ARCH:=$(subst AMD64,X64,$(PROC_ARCH))
+  PROC_ARCH:=$(subst ia64,IA64,$(PROC_ARCH))
   ifndef ARCH_DATA_MODEL
-    ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
+    ifeq ($(PROC_ARCH),IA64)
       ARCH_DATA_MODEL=64
     else
-      ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
+      ifeq ($(PROC_ARCH),X64)
         ARCH_DATA_MODEL=64
       else
         ARCH_DATA_MODEL=32
@@ -313,10 +324,12 @@
     #      + set ARCH to ia64 or amd64, or
     REQUIRED_WINDOWS_NAME=Windows Server 2003
     REQUIRED_WINDOWS_VERSION=5 2 Service Pack 1
-    ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)), AMD64)
+    ifeq ($(PROC_ARCH),X64)
       ARCH=amd64
     else
-      ARCH=ia64
+      ifeq ($(PROC_ARCH),IA64)
+        ARCH=ia64
+      endif
     endif
     LIBARCH=$(ARCH)
     # Value of Java os.arch property
--- a/hotspot/.hgtags	Tue May 19 17:39:30 2009 -0700
+++ b/hotspot/.hgtags	Wed Jul 05 16:53:56 2017 +0200
@@ -33,3 +33,4 @@
 a3fd9e40ff2e854f6169eb6d09d491a28634d04f jdk7-b56
 f4cbf78110c726919f46b59a3b054c54c7e889b4 jdk7-b57
 53d9bf689e80fcc76b221bbe6c5d58e08b80cbc6 jdk7-b58
+c55be0c7bd32c016c52218eb4c8b5da8a75450b5 jdk7-b59
--- a/hotspot/make/README	Tue May 19 17:39:30 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-README:
-  This file should be located at the top of the hotspot Mercurial repository.
-
-  See http://openjdk.java.net/ for more information about the OpenJDK.
-
-  See ../README-builds.html for complete details on build machine requirements.
-
-Simple Build Instructions:
-
-    cd make && gnumake
-     
-  The files that will be imported into the jdk build will be in the "build"
-  directory.
-
--- a/hotspot/make/linux/makefiles/gcc.make	Tue May 19 17:39:30 2009 -0700
+++ b/hotspot/make/linux/makefiles/gcc.make	Wed Jul 05 16:53:56 2017 +0200
@@ -171,3 +171,9 @@
 ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
 DEBUG_CFLAGS += -gstabs
 endif
+
+# DEBUG_BINARIES overrides everything, use full -g debug information
+ifeq ($(DEBUG_BINARIES), true)
+  DEBUG_CFLAGS = -g
+  CFLAGS += $(DEBUG_CFLAGS)
+endif
--- a/hotspot/make/linux/makefiles/jsig.make	Tue May 19 17:39:30 2009 -0700
+++ b/hotspot/make/linux/makefiles/jsig.make	Wed Jul 05 16:53:56 2017 +0200
@@ -41,10 +41,15 @@
 
 LFLAGS_JSIG += -D_GNU_SOURCE -D_REENTRANT $(LDFLAGS_HASH_STYLE)
 
+# DEBUG_BINARIES overrides everything, use full -g debug information
+ifeq ($(DEBUG_BINARIES), true)
+  JSIG_DEBUG_CFLAGS = -g
+endif
+
 $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
 	@echo Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
-                         $(LFLAGS_JSIG) -o $@ $< -ldl
+                         $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< -ldl
 
 install_jsig: $(LIBJSIG)
 	@echo "Copying $(LIBJSIG) to $(DEST_JSIG)"
--- a/hotspot/make/linux/makefiles/saproc.make	Tue May 19 17:39:30 2009 -0700
+++ b/hotspot/make/linux/makefiles/saproc.make	Wed Jul 05 16:53:56 2017 +0200
@@ -43,6 +43,11 @@
 
 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
 
+# DEBUG_BINARIES overrides everything, use full -g debug information
+ifeq ($(DEBUG_BINARIES), true)
+  SA_DEBUG_CFLAGS = -g
+endif
+
 # if $(AGENT_DIR) does not exist, we don't build SA
 # also, we don't build SA on Itanium.
 
@@ -67,6 +72,7 @@
 	           -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family)    \
 	           $(SASRCFILES)                                        \
 	           $(SA_LFLAGS)                                         \
+	           $(SA_DEBUG_CFLAGS)                                   \
 	           -o $@                                                \
 	           -lthread_db
 
--- a/hotspot/src/share/vm/adlc/filebuff.hpp	Tue May 19 17:39:30 2009 -0700
+++ b/hotspot/src/share/vm/adlc/filebuff.hpp	Wed Jul 05 16:53:56 2017 +0200
@@ -73,7 +73,7 @@
 
   // This converts a pointer into the buffer to a file offset.  It only works
   // when the pointer is valid (i.e. just obtained from getline()).
-  long getoff(const char* s) { return _bufoff + (s - _buf); }
+  long getoff(const char* s) { return _bufoff + (long)(s - _buf); }
 };
 
 //------------------------------FileBuffRegion---------------------------------
--- a/jaxp/.hgtags	Tue May 19 17:39:30 2009 -0700
+++ b/jaxp/.hgtags	Wed Jul 05 16:53:56 2017 +0200
@@ -33,3 +33,4 @@
 c197c6801271c60f9c9f5d18fcc95b59e76dcd54 jdk7-b56
 e4851e9f7be26fc52a628be06ffa8aaea0919bd7 jdk7-b57
 13bf67d8c6341b841d268985cabaf747f2652bc8 jdk7-b58
+75113d7ce083048e7576b9d0d60a4e80db6b181f jdk7-b59
--- a/jaxp/make/Makefile	Tue May 19 17:39:30 2009 -0700
+++ b/jaxp/make/Makefile	Wed Jul 05 16:53:56 2017 +0200
@@ -69,6 +69,10 @@
   endif
 endif
 
+ifeq ($(DEBUG_CLASSFILES), true)
+  ANT_OPTIONS += -Djavac.debug=true
+endif
+
 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
 # and the somewhat misnamed CLASS_VERSION (-target NN)
 ifdef TARGET_CLASS_VERSION
--- a/jaxp/make/README	Tue May 19 17:39:30 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-README:
-  This file should be located at the top of the jaxp Mercurial repository.
-
-  See http://openjdk.java.net/ for more information about the OpenJDK.
-
-  See ../README-builds.html for complete details on build machine requirements.
-
-Simple Build Instructions:
-
-    cd make && gnumake
-     
-  The files that will be imported into the jdk build will be in the "dist"
-  directory.
-
--- a/jaxp/make/build.properties	Tue May 19 17:39:30 2009 -0700
+++ b/jaxp/make/build.properties	Wed Jul 05 16:53:56 2017 +0200
@@ -32,7 +32,6 @@
 # options for the <javac> tasks used to compile the tools
 javac.target = 5
 javac.debug = true
-javac.debuglevel = source,lines
 javac.no.jdk.warnings = -XDignore.symbol.file=true
 # set the following to -version to verify the versions of javac being used
 javac.version.opt = 
--- a/jaxp/make/build.xml	Tue May 19 17:39:30 2009 -0700
+++ b/jaxp/make/build.xml	Wed Jul 05 16:53:56 2017 +0200
@@ -85,6 +85,7 @@
              destdir="${build.classes.dir}"
              memoryInitialSize="${javac.memoryInitialSize}"
              memoryMaximumSize="${javac.memoryMaximumSize}"
+	     debug="${javac.debug}"
              target="${javac.target}">
          <compilerarg value="-J-Xbootclasspath/p:${bootstrap.dir}/lib/javac.jar"/>
          <compilerarg line="${javac.version.opt}"/>
--- a/jaxws/.hgtags	Tue May 19 17:39:30 2009 -0700
+++ b/jaxws/.hgtags	Wed Jul 05 16:53:56 2017 +0200
@@ -33,3 +33,4 @@
 0f7fbf85f7a1d9c027a863b9955c623352ed1292 jdk7-b56
 68257a5eb19afc11aee7eb19f7250f9b9eec7c05 jdk7-b57
 5fb4fbea81c3609916da00417fdd15dbd9e39e97 jdk7-b58
+f64566bf4c2bc92e65ab2b9fab51b119f0d493d1 jdk7-b59
--- a/jaxws/make/Makefile	Tue May 19 17:39:30 2009 -0700
+++ b/jaxws/make/Makefile	Wed Jul 05 16:53:56 2017 +0200
@@ -69,6 +69,10 @@
   endif
 endif
 
+ifeq ($(DEBUG_CLASSFILES), true)
+  ANT_OPTIONS += -Djavac.debug=true
+endif
+
 # Note: jdk/make/common/Defs.gmk uses LANGUAGE_VERSION (-source NN)
 # and the somewhat misnamed CLASS_VERSION (-target NN)
 ifdef TARGET_CLASS_VERSION
--- a/jaxws/make/README	Tue May 19 17:39:30 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-README:
-  This file should be located at the top of the jaxws Mercurial repository.
-
-  See http://openjdk.java.net/ for more information about the OpenJDK.
-
-  See ../README-builds.html for complete details on build machine requirements.
-
-Simple Build Instructions:
-
-    cd make && gnumake
-     
-  The files that will be imported into the jdk build will be in the "dist"
-  directory.
-
--- a/jaxws/make/build.properties	Tue May 19 17:39:30 2009 -0700
+++ b/jaxws/make/build.properties	Wed Jul 05 16:53:56 2017 +0200
@@ -32,7 +32,6 @@
 # options for the <javac> tasks used to compile the tools
 javac.target = 5
 javac.debug = true
-javac.debuglevel = source,lines
 javac.no.jdk.warnings = -XDignore.symbol.file=true
 # set the following to -version to verify the versions of javac being used
 javac.version.opt = 
--- a/jaxws/make/build.xml	Tue May 19 17:39:30 2009 -0700
+++ b/jaxws/make/build.xml	Wed Jul 05 16:53:56 2017 +0200
@@ -107,6 +107,7 @@
              destdir="${build.classes.dir}"
              memoryInitialSize="${javac.memoryInitialSize}"
              memoryMaximumSize="${javac.memoryMaximumSize}"
+	     debug="${javac.debug}"
              target="${javac.target}"
              excludes="com/sun/tools/internal/txw2/**">
          <compilerarg value="-J-Xbootclasspath/p:${bootstrap.dir}/lib/javac.jar"/>
--- a/jdk/.hgtags	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/.hgtags	Wed Jul 05 16:53:56 2017 +0200
@@ -33,3 +33,4 @@
 7fd3bc37afe36f8f6165ba679db1229716db822a jdk7-b56
 d5a1223e961891564de25c39fba6f2442d0fb045 jdk7-b57
 9ba256e2e5c161b89e638390f998baa175ec9abe jdk7-b58
+2a5a1b269e89f27ebe419ef4cf6e66a3face0df1 jdk7-b59
--- a/jdk/make/common/Defs-linux.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/common/Defs-linux.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -165,6 +165,12 @@
   endif
 endif
 
+# DEBUG_BINARIES overrides everything, use full -g debug information
+ifeq ($(DEBUG_BINARIES), true)
+  DEBUG_FLAG = -g
+  CFLAGS_REQUIRED += $(DEBUG_FLAG)
+endif
+
 CFLAGS_OPT      = $(CC_OPT)
 CFLAGS_DBG      = $(DEBUG_FLAG)
 CFLAGS_COMMON += $(CFLAGS_REQUIRED)
@@ -240,8 +246,11 @@
 #
 ifeq ($(VARIANT), OPT)
   ifneq ($(NO_STRIP), true)
-    # Debug 'strip -g' leaves local function Elf symbols (better stack traces)
-    POST_STRIP_PROCESS = $(STRIP) -g
+    ifneq ($(DEBUG_BINARIES), true)
+      # Debug 'strip -g' leaves local function Elf symbols (better stack
+      # traces)
+      POST_STRIP_PROCESS = $(STRIP) -g
+    endif
   endif
 endif
 
--- a/jdk/make/common/Sanity.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/common/Sanity.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -92,6 +92,7 @@
     sane-ld_run_path \
     sane-alt_bootdir \
     sane-bootdir \
+    sane-local-bootdir \
     sane-alsa-headers \
     sane-jibx
 
--- a/jdk/make/common/shared/Defs-windows.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/common/shared/Defs-windows.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -277,9 +277,9 @@
     # Assume PlatformSDK is in VS71 (will be empty if VS90)
     _ms_sdk       :=$(call FullPath,$(_msvc_dir)/PlatformSDK)
     # Assume VS90, then VS80, then VS71
-    _redist_sdk   :=$(call FullPath,$(_msvc_dir)/../SDK/v3.5/Bin)
+    _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC90.CRT)
     ifeq ($(_redist_sdk),)
-      _redist_sdk   :=$(call FullPath,$(_msvc_dir)/../SDK/v2.0/Bin)
+      _redist_sdk   :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC80.CRT)
       ifeq ($(_redist_sdk),)
         _redist_sdk   :=$(call FullPath,$(_msvc_dir)/../SDK/v1.1/Bin)
       endif
@@ -431,9 +431,11 @@
 
 # _BOOTDIR1: First choice for a Bootstrap JDK, previous released JDK.
 # _BOOTDIR2: Second choice
+# The _BOOTDIR3 is defind optionally.
 ifndef ALT_BOOTDIR
   _BOOTDIR1  =$(_system_drive)/jdk$(PREVIOUS_JDK_VERSION)
   _BOOTDIR2  =$(USRJDKINSTANCES_PATH)/jdk$(PREVIOUS_JDK_VERSION)
+  _BOOTDIR3  =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
 endif
 
 # 32 bit always needs 2 runtimes, 64 bit usually does too
--- a/jdk/make/common/shared/Defs.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/common/shared/Defs.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -94,6 +94,21 @@
   fi)
 endef
 
+# Select a directory if it exists, or the alternate 2, or the alternate 3, or the alternate 4
+define DirExists4
+$(shell \
+  if [ -d "$1" ]; then  \
+    echo "$1"; \
+  elif [ -d "$2" ]; then \
+    echo "$2"; \
+  elif [ -d "$3" ]; then \
+    echo "$3"; \
+  else \
+    echo "$4"; \
+  fi)
+endef
+
+
 # Select a writable directory if it exists and is writable, or the alternate
 define WriteDirExists
 $(shell \
@@ -356,10 +371,15 @@
 
 # BOOTDIR: Bootstrap JDK, previous released JDK.
 #   _BOOTDIR1 and _BOOTDIR2 picked by platform
+#   Platform may optionally define _BOOTDIR3 as well.
 ifdef ALT_BOOTDIR
   BOOTDIR =$(ALT_BOOTDIR)
 else
-  BOOTDIR  :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
+  ifdef _BOOTDIR3
+    BOOTDIR  :=$(call DirExists4,$(_BOOTDIR1),$(_BOOTDIR2),$(_BOOTDIR3),/NO_BOOTDIR)
+  else
+    BOOTDIR  :=$(call DirExists,$(_BOOTDIR1),$(_BOOTDIR2),/NO_BOOTDIR)
+  endif
 endif
 export BOOTDIR
 BOOTDIR:=$(call AltCheckSpaces,BOOTDIR)
--- a/jdk/make/common/shared/Sanity.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/common/shared/Sanity.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -194,7 +194,8 @@
 	sane-outputdir \
 	sane-alt_bootdir \
 	sane-bootdir \
-        sane-cups \
+	sane-local-bootdir \
+	sane-cups \
 	sane-devtools_path \
 	sane-compiler_path \
 	sane-unixcommand_path \
@@ -767,6 +768,23 @@
 	fi
 
 ######################################################
+# BOOTDIR is recommended to reside on a local drive
+######################################################
+sane-local-bootdir:
+ifeq ($(PLATFORM), windows)
+	@if [ `$(ECHO) $(BOOTDIR) | $(EGREP) -ci '^J:'` -ne 0 ]; then \
+	  $(ECHO) "WARNING: Your BOOTDIR is located on the J: drive. Often the J:\n" \
+	    "        drive is mapped over a network. Using a mapped drive for\n" \
+	    "        the BOOTDIR may significantly slow down the build process.\n" \
+	    "        You may want to consider using the ALT_BOOTDIR variable\n" \
+	    "        to point the build to another location for the BOOTDIR instead. \n" \
+	    "        Your current BOOTDIR is:\n" \
+	    "           $(BOOTDIR) \n" \
+	    "" >> $(WARNING_FILE) ; \
+	fi
+endif
+
+######################################################
 # CACERTS_FILE must be absoulte path and readable
 ######################################################
 sane-cacerts:
@@ -1502,6 +1520,9 @@
 # JIBX_LIBS_PATH must be valid
 ######################################################
 sane-jibx:
+ifdef DISABLE_NIMBUS	
+	$(call SanityWarning,Disabling Nimbus will remove public API in javax.swing.plaf.nimbus.)
+else
 	@if [ ! -r $(subst \,/,$(JIBX_LIBS_PATH))/jibx-run.jar ]; then \
 	  $(ECHO) "ERROR: You do not have access to valid JIBX library files. \n" \
 	    "      Please check your access to \n" \
@@ -1509,6 +1530,7 @@
 	    "      and/or check your value of ALT_JDK_DEVTOOLS_DIR, ALT_JIBX_LIBS_PATH \n" \
 	    "" >> $(ERROR_FILE) ; \
 	fi
+endif
 
 ######################################################
 # MOZILLA_HEADERS_PATH must be valid
--- a/jdk/make/docs/Makefile	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/docs/Makefile	Wed Jul 05 16:53:56 2017 +0200
@@ -324,6 +324,30 @@
 # HTTPSERVER_PKGS is located in NON_CORE_PKGS.gmk
 
 #
+# Variables used by sctp target
+#
+
+SCTPAPI_SOURCEPATH  = $(TOPDIR)/src/share/classes
+SCTPAPI_DOCDIR   = $(DOCSDIR)/jre/api/nio/sctp/spec
+
+SCTPAPI_JAVADOCFLAGS = $(COMMON_JAVADOCFLAGS)                           \
+                   -encoding ascii                                      \
+                   -nodeprecatedlist                                    \
+                   -d $(SCTPAPI_DOCDIR)                                 \
+                   -sourcepath $(SCTPAPI_SOURCEPATH)                    \
+                   -windowtitle $(SCTPAPI_WINDOWTITLE)                  \
+                   -doctitle $(SCTPAPI_DOCTITLE)                        \
+                   -header $(SCTPAPI_JAVADOCHEADER)                     \
+                   -bottom $(SCTPAPI_JAVADOCBOTTOM)			\
+                   -linkoffline ../../../../../api $(DOCSDIR)/api/
+
+SCTPAPI_WINDOWTITLE = "SCTP API"
+SCTPAPI_DOCTITLE    = "SCTP API"
+SCTPAPI_JAVADOCHEADER      = "SCTP API"
+SCTPAPI_JAVADOCBOTTOM = '<font size="-1"><a href="http://bugs.sun.com/services/bugreport/index.jsp">Report a bug or request a feature.</a><br>Copyright $(THIS_YEAR) Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.</font>'
+# SCTPAPI_PKGS is located in NON_CORE_PKGS.gmk
+
+#
 # Variables used by jvmti target
 #
 JVMTI_DOCS_SUBDIR = platform/jvmti
@@ -451,6 +475,7 @@
     smartcardiodocs \
     tracingdocs \
     httpserverdocs  \
+    sctpdocs \
     mgmtdocs \
     attachdocs \
     jconsoledocs \
@@ -631,6 +656,14 @@
 	$(JAVADOC_CMD) $(HTTPSERVER_JAVADOCFLAGS)                     \
 		   $(HTTPSERVER_PKGS)
 
+.PHONY: sctpdocs
+sctpdocs:
+	@# ######## api-sctp #######################
+	$(RM) -r $(SCTPAPI_DOCDIR)
+	$(MKDIR) -p $(SCTPAPI_DOCDIR)
+	$(JAVADOC_CMD) $(SCTPAPI_JAVADOCFLAGS)                     \
+		$(SCTPAPI_PKGS)
+
 .PHONY: mgmtdocs
 mgmtdocs: $(COPY-MIB-TARGET)
 	@# ######## api-management ############################
--- a/jdk/make/javax/swing/plaf/Makefile	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/javax/swing/plaf/Makefile	Wed Jul 05 16:53:56 2017 +0200
@@ -34,7 +34,9 @@
 #
 include FILES.gmk
 AUTO_FILES_JAVA_DIRS = javax/swing/plaf sun/swing com/sun/java/swing/plaf
-SUBDIRS = nimbus
+ifndef DISABLE_NIMBUS
+  SUBDIRS = nimbus
+endif
 
 # Nimbus is handled in its own directory
 AUTO_JAVA_PRUNE = nimbus
--- a/jdk/make/jprt.properties	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/jprt.properties	Wed Jul 05 16:53:56 2017 +0200
@@ -53,19 +53,19 @@
 
 # Standard list of jprt test targets for this workspace
 jprt.test.targets=*-*-*-jvm98
-jprt.regression.test.targets=  \
-   *-*-*-java/lang,            \
-   *-*-*-java/security,        \
-   *-*-*-java/text,            \
-   *-*-*-java/util
+jprt.regression.test.targets=        \
+   *-product-*-java/lang,            \
+   *-product-*-java/security,        \
+   *-product-*-java/text,            \
+   *-product-*-java/util
 
 #jprt.regression.test.targets=   \
-#   *-*-*-java/awt,       \
-#   *-*-*-java/beans,     \
-#   *-*-*-java/io,        \
-#   *-*-*-java/net,       \
-#   *-*-*-java/nio,       \
-#   *-*-*-java/rmi,       \
+#   *-product-*-java/awt,       \
+#   *-product-*-java/beans,     \
+#   *-product-*-java/io,        \
+#   *-product-*-java/net,       \
+#   *-product-*-java/nio,       \
+#   *-product-*-java/rmi,       \
 
 # Directories needed to build
 jprt.bundle.exclude.src.dirs=build
--- a/jdk/make/sun/awt/mawt.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/sun/awt/mawt.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -108,7 +108,9 @@
 #
 
 
-#CFLAGS += -g
+ifeq ($(DEBUG_BINARIES), true)
+  CFLAGS += -g
+endif
 ifeq ($(HEADLESS),true)
 CFLAGS += -DHEADLESS=$(HEADLESS)
 CPPFLAGS += -DHEADLESS=$(HEADLESS)
--- a/jdk/make/sun/javazic/tzdata/VERSION	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/sun/javazic/tzdata/VERSION	Wed Jul 05 16:53:56 2017 +0200
@@ -21,4 +21,4 @@
 # CA 95054 USA or visit www.sun.com if you need additional information or
 # have any questions.
 #
-tzdata2009a
+tzdata2009g
--- a/jdk/make/sun/javazic/tzdata/africa	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/sun/javazic/tzdata/africa	Wed Jul 05 16:53:56 2017 +0200
@@ -258,7 +258,46 @@
 # unless discontinued, next DST may end Thursday 28 August 2008.
 # From Paul Eggert (2007-08-17):
 # For lack of better info, assume the new rule is last Thursday in August.
-Rule	Egypt	2008	max	-	Aug	lastThu	23:00s	0	-
+
+# From Petr Machata (2009-04-06):
+# The following appeared in Red Hat bugzilla[1] (edited):
+#
+# > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 21:59:59 2009 UTC =3D Thu =
+# Apr 23
+# > 23:59:59 2009 EET isdst=3D0 gmtoff=3D7200
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 22:00:00 2009 UTC =3D Fri =
+# Apr 24
+# > 01:00:00 2009 EEST isdst=3D1 gmtoff=3D10800
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 20:59:59 2009 UTC =3D Thu =
+# Aug 27
+# > 23:59:59 2009 EEST isdst=3D1 gmtoff=3D10800
+# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 21:00:00 2009 UTC =3D Thu =
+# Aug 27
+# > 23:00:00 2009 EET isdst=3D0 gmtoff=3D7200
+#
+# > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
+# :59)
+# > http://support.microsoft.com/kb/958729/
+#
+# timeanddate[2] and another site I've found[3] also support that.
+#
+# [1] <a href="https://bugzilla.redhat.com/show_bug.cgi?id=3D492263">
+# https://bugzilla.redhat.com/show_bug.cgi?id=3D492263
+# </a>
+# [2] <a href="http://www.timeanddate.com/worldclock/clockchange.html?n=3D53">
+# http://www.timeanddate.com/worldclock/clockchange.html?n=3D53
+# </a>
+# [3] <a href="http://wwp.greenwichmeantime.com/time-zone/africa/egypt/">
+# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
+# </a>
+
+# From Arthur David Olson (2009-04-20):
+# In 2009 (and for the next several years), Ramadan ends before the fourth
+# Thursday in September; Egypt is expected to revert to the last Thursday
+# in September.
+Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
+Rule	Egypt	2009	max	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct
@@ -586,6 +625,40 @@
 # <a href="http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html">
 # http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
 # </a>
+
+# From Steffen Thorsen (2009-03-17):
+# Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
+# to many sources, such as
+# <a href="http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html">
+# http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html
+# </a>
+# <a href="http://www.medi1sat.ma/fr/depeche.aspx?idp=2312">
+# http://www.medi1sat.ma/fr/depeche.aspx?idp=2312
+# </a>
+# (French)
+#
+# Our summary:
+# <a href="http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html">
+# http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
+# </a>
+
+# From Alexander Krivenyshev (2009-03-17):
+# Here is a link to official document from Royaume du Maroc Premier Ministre,
+# Ministere de la Modernisation des Secteurs Publics
+#
+# Under Article 1 of Royal Decree No. 455-67 of Act 23 safar 1387 (2 june 1967)
+# concerning the amendment of the legal time, the Ministry of Modernization of
+# Public Sectors announced that the official time in the Kingdom will be
+# advanced 60 minutes from Sunday 31 May 2009 at midnight.
+#
+# <a href="http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf">
+# http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf
+# </a>
+#
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_morocco03.html">
+# http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
+# </a>
+
 # RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 
 Rule	Morocco	1939	only	-	Sep	12	 0:00	1:00	S
@@ -605,6 +678,8 @@
 Rule	Morocco	1978	only	-	Aug	 4	 0:00	0	-
 Rule	Morocco	2008	only	-	Jun	 1	 0:00	1:00	S
 Rule	Morocco	2008	only	-	Sep	 1	 0:00	0	-
+Rule	Morocco	2009	only	-	Jun	 1	 0:00	1:00	S
+Rule	Morocco	2009	only	-	Aug	 21	 0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Africa/Casablanca	-0:30:20 -	LMT	1913 Oct 26
 			 0:00	Morocco	WE%sT	1984 Mar 16
@@ -809,6 +884,43 @@
 # Ending         : the last Sunday of October at 03:00 ...
 # http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=1188&Itemid=50
 
+# From Steffen Thorsen (2009-03-16):
+# According to several news sources, Tunisia will not observe DST this year.
+# (Arabic)
+# <a href="http://www.elbashayer.com/?page=viewn&nid=42546">
+# http://www.elbashayer.com/?page=viewn&nid=42546
+# </a>
+# <a href="http://www.babnet.net/kiwidetail-15295.asp">
+# http://www.babnet.net/kiwidetail-15295.asp
+# </a>
+#
+# We have also confirmed this with the US embassy in Tunisia.
+# We have a wrap-up about this on the following page:
+# <a href="http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html">
+# http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
+# </a>
+
+# From Alexander Krivenyshev (2009-03-17):
+# Here is a link to Tunis Afrique Presse News Agency
+#
+# Standard time to be kept the whole year long (tap.info.tn):
+#
+# (in English)
+# <a href="http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157">
+# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157
+# </a>
+#
+# (in Arabic)
+# <a href="http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1">
+# http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1
+# </a>
+
+# From Arthur David Olson (2009--3-18):
+# The Tunis Afrique Presse News Agency notice contains this: "This measure is due to the fact
+# that the fasting month of ramadan coincides with the period concerned by summer time.
+# Therefore, the standard time will be kept unchanged the whole year long."
+# So foregoing DST seems to be an exception (albeit one that may be repeated in the  future).
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Tunisia	1939	only	-	Apr	15	23:00s	1:00	S
 Rule	Tunisia	1939	only	-	Nov	18	23:00s	0	-
@@ -833,8 +945,10 @@
 Rule	Tunisia	1990	only	-	May	 1	 0:00s	1:00	S
 Rule	Tunisia	2005	only	-	May	 1	 0:00s	1:00	S
 Rule	Tunisia	2005	only	-	Sep	30	 1:00s	0	-
-Rule	Tunisia	2006	max	-	Mar	lastSun	 2:00s	1:00	S
-Rule	Tunisia	2006	max	-	Oct	lastSun	 2:00s	0	-
+Rule	Tunisia	2006	2008	-	Mar	lastSun	 2:00s	1:00	S
+Rule	Tunisia	2006	2008	-	Oct	lastSun	 2:00s	0	-
+Rule	Tunisia	2010	max	-	Mar	lastSun	 2:00s	1:00	S
+Rule	Tunisia	2010	max	-	Oct	lastSun	 2:00s	0	-
 # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
 # more precise 0:09:21.
 # Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.
--- a/jdk/make/sun/javazic/tzdata/asia	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/sun/javazic/tzdata/asia	Wed Jul 05 16:53:56 2017 +0200
@@ -1071,6 +1071,40 @@
 # http://www.petranews.gov.jo/nepras/2006/Sep/05/4000.htm
 # "Jordan will switch to winter time on Friday, October 27".
 #
+
+# From Phil Pizzey (2009-04-02):
+# ...I think I may have spotted an error in the timezone data for
+# Jordan.
+# The current (2009d) asia file shows Jordan going to daylight
+# saving
+# time on the last Thursday in March.
+#
+# Rule  Jordan      2000  max	-  Mar   lastThu     0:00s 1:00  S
+#
+# However timeanddate.com, which I usually find reliable, shows Jordan
+# going to daylight saving time on the last Friday in March since 2002.
+# Please see
+# <a href="http://www.timeanddate.com/worldclock/timezone.html?n=11">
+# http://www.timeanddate.com/worldclock/timezone.html?n=11
+# </a>
+
+# From Steffen Thorsen (2009-04-02):
+# This single one might be good enough, (2009-03-24, Arabic):
+# <a href="http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279">
+# http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279
+# </a>
+#
+# Google's translation:
+#
+# > The Council of Ministers decided in 2002 to adopt the principle of timely
+# > submission of the summer at 60 minutes as of midnight on the last Thursday
+# > of the month of March of each year.
+#
+# So - this means the midnight between Thursday and Friday since 2002.
+
+# From Arthur David Olson (2009-04-06):
+# We still have Jordan switching to DST on Thursdays in 2000 and 2001.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Jordan	1973	only	-	Jun	6	0:00	1:00	S
 Rule	Jordan	1973	1975	-	Oct	1	0:00	0	-
@@ -1093,8 +1127,9 @@
 Rule	Jordan	1994	only	-	Sep	Fri>=15	0:00	0	-
 Rule	Jordan	1995	1998	-	Sep	Fri>=15	0:00s	0	-
 Rule	Jordan	1999	only	-	Jul	 1	0:00s	1:00	S
-Rule	Jordan	1999	2002	-	Sep	lastThu	0:00s	0	-
-Rule	Jordan	2000	max	-	Mar	lastThu	0:00s	1:00	S
+Rule	Jordan	1999	2002	-	Sep	lastFri	0:00s	0	-
+Rule	Jordan	2000	2001	-	Mar	lastThu	0:00s	1:00	S
+Rule	Jordan	2002	max	-	Mar	lastFri	0:00s	1:00	S
 Rule	Jordan	2003	only	-	Oct	24	0:00s	0	-
 Rule	Jordan	2004	only	-	Oct	15	0:00s	0	-
 Rule	Jordan	2005	only	-	Sep	lastFri	0:00s	0	-
@@ -1576,11 +1611,46 @@
 # http://dailymailnews.com/200808/28/news/dmbrn03.html
 # </a>
 
+# From Alexander Krivenyshev (2009-04-08):
+# Based on previous media reports that "... proposed plan to
+# advance clocks by one hour from May 1 will cause disturbance
+# to the working schedules rather than bringing discipline in
+# official working."
+# <a href="http://www.thenews.com.pk/daily_detail.asp?id=171280">
+# http://www.thenews.com.pk/daily_detail.asp?id=171280
+# </a>
+#
+# recent news that instead of May 2009 - Pakistan plan to
+# introduce DST from April 15, 2009
+#
+# FYI: Associated Press Of Pakistan
+# April 08, 2009
+# Cabinet okays proposal to advance clocks by one hour from April 15
+# <a href="http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1">
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1
+# </a>
+#
+# or
+#
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html">
+# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html
+# </a>
+#
+# ....
+# The Federal Cabinet on Wednesday approved the proposal to
+# advance clocks in the country by one hour from April 15 to
+# conserve energy"
+
+# From Arthur David Olson (2009-04-10):
+# Assume for now that Pakistan will end DST in 2009 as it did in 2008.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Pakistan	2002	only	-	Apr	Sun>=2	0:01	1:00	S
 Rule Pakistan	2002	only	-	Oct	Sun>=2	0:01	0	-
 Rule Pakistan	2008	only	-	Jun	1	0:00	1:00	S
 Rule Pakistan	2008	only	-	Nov	1	0:00	0	-
+Rule Pakistan	2009	only	-	Apr	15	0:00	1:00	S
+Rule Pakistan	2009	only	-	Nov	1	0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Karachi	4:28:12 -	LMT	1907
 			5:30	-	IST	1942 Sep
@@ -1717,6 +1787,22 @@
 # http://www.worldtimezone.com/dst_news/dst_news_gazastrip01.html
 # </a>
 
+# From Alexander Krivenyshev (2009-03-26):
+# According to the Palestine News Network (arabic.pnn.ps), Palestinian
+# government decided to start Daylight Time on Thursday night March
+# 26 and continue until the night of 27 September 2009.
+#
+# (in Arabic)
+# <a href="http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850">
+# http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850
+# </a>
+#
+# or
+# (English translation)
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_westbank01.html">
+# http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
+# </a>
+
 # The rules for Egypt are stolen from the `africa' file.
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -1730,10 +1816,12 @@
 Rule Palestine	1999	2003	-	Oct	Fri>=15	0:00	0	-
 Rule Palestine	2004	only	-	Oct	 1	1:00	0	-
 Rule Palestine	2005	only	-	Oct	 4	2:00	0	-
-Rule Palestine	2006	max	-	Apr	 1	0:00	1:00	S
+Rule Palestine	2006	2008	-	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	2008	max	-	Aug	lastThu	2:00	0	-
+Rule Palestine	2008	only	-	Aug	lastFri	2:00	0	-
+Rule Palestine	2009	max	-	Mar	lastFri	0:00	1:00	S
+Rule Palestine	2009	max	-	Sep	lastMon	2:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct
@@ -1991,8 +2079,29 @@
 # http://sana.sy/ara/2/2008/10/07/195459.htm
 # </a>
 
-Rule	Syria	2008	max	-	Apr	Fri>=1	0:00	1:00	S
+# From Steffen Thorsen (2009-03-19):
+# Syria will start DST on 2009-03-27 00:00 this year according to many sources,
+# two examples:
+#
+# <a href="http://www.sana.sy/eng/21/2009/03/17/217563.htm">
+# http://www.sana.sy/eng/21/2009/03/17/217563.htm
+# </a>
+# (English, Syrian Arab News # Agency)
+# <a href="http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209">
+# http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209
+# </a>
+# (Arabic, gov-site)
+#
+# We have not found any sources saying anything about when DST ends this year.
+#
+# Our summary
+# <a href="http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html">
+# http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
+# </a>
+
+Rule	Syria	2008	only	-	Apr	Fri>=1	0:00	1:00	S
 Rule	Syria	2008	max	-	Nov	1	0:00	0	-
+Rule	Syria	2009	max	-	Mar	lastFri	0:00	1:00	S
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Damascus	2:25:12 -	LMT	1920	# Dimashq
--- a/jdk/make/sun/javazic/tzdata/leapseconds	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/sun/javazic/tzdata/leapseconds	Wed Jul 05 16:53:56 2017 +0200
@@ -75,40 +75,32 @@
 # SERVICE DE LA ROTATION TERRESTRE
 # OBSERVATOIRE DE PARIS
 # 61, Av. de l'Observatoire 75014 PARIS (France)
-# Tel.      : 33 (0) 1 40 51 22 26
+# Tel.      : 33 (0) 1 40 51 22 29
 # FAX       : 33 (0) 1 40 51 22 91
-# e-mail    : services.iers@obspm.fr
-# http://hpiers.obspm.fr/eop-pc
+# Internet  : services.iers@obspm.fr
 #
-# Paris, 4 July 2008
+# Paris, 15 January 2009
 #
-# Bulletin C 36
+# Bulletin C 37
 #
 # To authorities responsible
 # for the measurement and
 # distribution of time
 #
-# UTC TIME STEP
-# on the 1st of January 2009
-#
-# A positive leap second will be introduced at the end of December 2008.
-# The sequence of dates of the UTC second markers will be:		
+# INFORMATION ON UTC - TAI
 #
-# 2008 December 31,     23h 59m 59s
-# 2008 December 31,     23h 59m 60s
-# 2009 January   1,      0h  0m  0s
+# NO positive leap second will be introduced at the end of June 2009.
+# The difference between Coordinated Universal Time UTC and the
+# International Atomic Time TAI is :		
 #
-# The difference between UTC and the International Atomic Time TAI is:
-#
-# from 2006 January 1, 0h UTC, to 2009 January 1  0h UTC  : UTC-TAI = - 33s
-# from 2009 January 1, 0h UTC, until further notice       : UTC-TAI = - 34s
+# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
 #
 # Leap seconds can be introduced in UTC at the end of the months of December
-# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC or to confirm that there
+# or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC, or to confirm that there
 # will be no time step at the next possible date.
 #
 # Daniel GAMBIS
-# Head		
-# Earth Orientation Center of IERS
+# Head			
+# Earth Orientation Center of the IERS
 # Observatoire de Paris, France
--- a/jdk/make/sun/javazic/tzdata/northamerica	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/sun/javazic/tzdata/northamerica	Wed Jul 05 16:53:56 2017 +0200
@@ -2280,6 +2280,25 @@
 # From Arthur David Olson (2008-03-12):
 # Assume Sun>=15 (third Sunday) going forward.
 
+# From Alexander Krivenyshev (2009-03-04)
+# According to the Radio Reloj - Cuba will start Daylight Saving Time on
+# midnight between Saturday, March 07, 2009 and Sunday, March 08, 2009-
+# not on midnight March 14 / March 15 as previously thought.
+#
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_cuba05.html">
+# http://www.worldtimezone.com/dst_news/dst_news_cuba05.html
+# (in Spanish)
+# </a>
+
+# From Arthur David Olson (2009-03-09)
+# I listened over the Internet to
+# <a href="http://media.enet.cu/readioreloj">
+# http://media.enet.cu/readioreloj
+# </a>
+# this morning; when it was 10:05 a. m. here in Bethesda, Maryland the
+# the time was announced as "diez cinco"--the same time as here, indicating
+# that has indeed switched to DST. Assume second Sunday from 2009 forward.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Cuba	1928	only	-	Jun	10	0:00	1:00	D
 Rule	Cuba	1928	only	-	Oct	10	0:00	0	S
@@ -2312,7 +2331,8 @@
 Rule	Cuba	2000	2004	-	Apr	Sun>=1	0:00s	1:00	D
 Rule	Cuba	2006	max	-	Oct	lastSun	0:00s	0	S
 Rule	Cuba	2007	only	-	Mar	Sun>=8	0:00s	1:00	D
-Rule	Cuba	2008	max	-	Mar	Sun>=15	0:00s	1:00	D
+Rule	Cuba	2008	only	-	Mar	Sun>=15	0:00s	1:00	D
+Rule	Cuba	2009	max	-	Mar	Sun>=8	0:00s	1:00	D
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Havana	-5:29:28 -	LMT	1890
--- a/jdk/make/sun/javazic/tzdata/southamerica	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/sun/javazic/tzdata/southamerica	Wed Jul 05 16:53:56 2017 +0200
@@ -373,6 +373,50 @@
 # keep America/Cordoba a single region rather than splitting it into the
 # other 5 subregions.
 
+# From Mariano Absatz (2009-03-13):
+# Yesterday (with our usual 2-day notice) the Province of San Luis
+# decided that next Sunday instead of "staying" @utc-03:00 they will go
+# to utc-04:00 until the second Saturday in October...
+#
+# The press release is at
+# <a href="http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102">
+# http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102
+# </a>
+# (I couldn't find the decree, but
+# <a href="http://www.sanluis.gov.ar">
+# www.sanluis.gov.ar
+# <a/>
+# is the official page for the Province Government).
+#
+# There's also a note in only one of the major national papers (La Nación) at
+# <a href="http://www.lanacion.com.ar/nota.asp?nota_id=1107912">
+# http://www.lanacion.com.ar/nota.asp?nota_id=1107912
+# </a>
+# 
+# The press release says:
+#  (...) anunció que el próximo domingo a las 00:00 los puntanos deberán
+# atrasar una hora sus relojes.
+#
+# A partir de entonces, San Luis establecerá el huso horario propio de
+# la Provincia. De esta manera, durante el periodo del calendario anual
+# 2009, el cambio horario quedará comprendido entre las 00:00 del tercer
+# domingo de marzo y las 24:00 del segundo sábado de octubre.
+# Quick&dirty translation
+# (...) announced that next Sunday, at 00:00, Puntanos (the San Luis
+# inhabitants) will have to turn back one hour their clocks
+#
+# Since then, San Luis will establish its own Province timezone. Thus,
+# during 2009, this timezone change will run from 00:00 the third Sunday
+# in March until 24:00 of the second Saturday in October.
+
+# From Arthur David Olson (2009-03-16):
+# The unofficial claim at
+# <a href="http://www.timeanddate.com/news/time/san-luis-new-time-zone.html">
+# http://www.timeanddate.com/news/time/san-luis-new-time-zone.html
+# </a>
+# is that "The province will most likely follow the next daylight saving schedule,
+# which is planned for the second Sunday in October."
+
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
@@ -520,7 +564,8 @@
 			-3:00	-	ART	2004 May 31
 			-4:00	-	WART	2004 Jul 25
 			-3:00	Arg	AR%sT	2008 Jan 21
-			-3:00	-	ART
+			-3:00	-	ART	2009 Mar 15
+			-4:00	Arg	WAR%sT
 #
 # Santa Cruz (SC)
 Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31
--- a/jdk/make/sun/xawt/mapfile-vers	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/sun/xawt/mapfile-vers	Wed Jul 05 16:53:56 2017 +0200
@@ -128,6 +128,7 @@
         Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler;
         Java_sun_awt_X11_XlibWrapper_XSetErrorHandler;
         Java_sun_awt_X11_XlibWrapper_CallErrorHandler;
+        Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent;
         Java_sun_awt_X11_XlibWrapper_XInternAtoms;
         Java_sun_awt_X11_XlibWrapper_XChangeWindowAttributes;
         Java_sun_awt_X11_XlibWrapper_XDeleteProperty;
@@ -154,7 +155,7 @@
         Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
         Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
         Java_sun_awt_X11_XRobotPeer_setup;
-        Java_sun_awt_X11_XRobotPeer_getNumberOfButtonsImpl;
+        Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
         Java_java_awt_Component_initIDs;
         Java_java_awt_Container_initIDs;
         Java_java_awt_Button_initIDs;
@@ -276,7 +277,6 @@
         Java_sun_awt_X11_XToolkit_getDefaultXColormap;
         Java_sun_awt_X11_XToolkit_getDefaultScreenData;
         Java_sun_awt_X11_XToolkit_getEnv;
-        Java_sun_awt_X11_XToolkit_setNoisyXErrorHandler;
         Java_sun_awt_X11_XlibWrapper_XCreateBitmapFromData;
         Java_sun_awt_X11_XlibWrapper_XFreePixmap;
         Java_sun_awt_X11_XlibWrapper_XAllocColor;
--- a/jdk/make/tools/Makefile	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/make/tools/Makefile	Wed Jul 05 16:53:56 2017 +0200
@@ -51,9 +51,12 @@
   makeclasslist             \
   strip_properties          \
   spp                       \
-  swing-nimbus              \
   CharsetMapping
 
+ifndef DISABLE_NIMBUS
+  SUBDIRS += swing-nimbus
+endif
+
 all build clean clobber::
 	$(SUBDIRS-loop)
 
--- a/jdk/src/share/classes/java/awt/Component.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/Component.java	Wed Jul 05 16:53:56 2017 +0200
@@ -1038,13 +1038,23 @@
 
     void setGraphicsConfiguration(GraphicsConfiguration gc) {
         synchronized(getTreeLock()) {
-            graphicsConfig = gc;
-
-            ComponentPeer peer = getPeer();
-            if (peer != null) {
-                peer.updateGraphicsData(gc);
-            }
-        }
+            if (updateGraphicsData(gc)) {
+                removeNotify();
+                addNotify();
+            }
+        }
+    }
+
+    boolean updateGraphicsData(GraphicsConfiguration gc) {
+        checkTreeLock();
+
+        graphicsConfig = gc;
+
+        ComponentPeer peer = getPeer();
+        if (peer != null) {
+            return peer.updateGraphicsData(gc);
+        }
+        return false;
     }
 
     /**
--- a/jdk/src/share/classes/java/awt/Container.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/Container.java	Wed Jul 05 16:53:56 2017 +0200
@@ -1113,16 +1113,17 @@
     }
 
     @Override
-    void setGraphicsConfiguration(GraphicsConfiguration gc) {
-        synchronized (getTreeLock()) {
-            super.setGraphicsConfiguration(gc);
-
-            for (Component comp : component) {
-                if (comp != null) {
-                    comp.setGraphicsConfiguration(gc);
-                }
+    boolean updateGraphicsData(GraphicsConfiguration gc) {
+        checkTreeLock();
+
+        boolean ret = super.updateGraphicsData(gc);
+
+        for (Component comp : component) {
+            if (comp != null) {
+                ret |= comp.updateGraphicsData(gc);
             }
         }
+        return ret;
     }
 
     /**
--- a/jdk/src/share/classes/java/awt/GraphicsConfiguration.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsConfiguration.java	Wed Jul 05 16:53:56 2017 +0200
@@ -436,7 +436,7 @@
     }
 
     /**
-     * Returns whether this GraphicsConfiguration supports
+     * Returns whether this {@code GraphicsConfiguration} supports
      * the {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
      * PERPIXEL_TRANSLUCENT} kind of translucency.
      *
--- a/jdk/src/share/classes/java/awt/GraphicsDevice.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/GraphicsDevice.java	Wed Jul 05 16:53:56 2017 +0200
@@ -246,7 +246,7 @@
      * Simulated full-screen mode resizes
      * the window to the size of the screen and positions it at (0,0).
      * <p>
-     * When entering full-screen mode, if the window to be used as the
+     * When entering full-screen mode, if the window to be used as a
      * full-screen window is not visible, this method will make it visible.
      * It will remain visible when returning to windowed mode.
      * <p>
@@ -261,9 +261,9 @@
      *
      * @param w a window to use as the full-screen window; {@code null}
      * if returning to windowed mode.  Some platforms expect the
-     * fullscreen window to be a top-level component (i.e., a Frame);
-     * therefore it is preferable to use a Frame here rather than a
-     * Window.
+     * fullscreen window to be a top-level component (i.e., a {@code Frame});
+     * therefore it is preferable to use a {@code Frame} here rather than a
+     * {@code Window}.
      *
      * @see #isFullScreenSupported
      * @see #getFullScreenWindow
--- a/jdk/src/share/classes/java/awt/Robot.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/Robot.java	Wed Jul 05 16:53:56 2017 +0200
@@ -96,9 +96,13 @@
         init(GraphicsEnvironment.getLocalGraphicsEnvironment()
             .getDefaultScreenDevice());
         int tmpMask = 0;
+
         if (Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
-            for (int i = 0; i < peer.getNumberOfButtons(); i++){
-                tmpMask |= InputEvent.getMaskForButton(i+1);
+            if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
+                final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
+                for (int i = 0; i < buttonsNumber; i++){
+                    tmpMask |= InputEvent.getMaskForButton(i+1);
+                }
             }
         }
         tmpMask |= InputEvent.BUTTON1_MASK|
--- a/jdk/src/share/classes/java/awt/Window.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/Window.java	Wed Jul 05 16:53:56 2017 +0200
@@ -296,7 +296,7 @@
     transient boolean isInShow = false;
 
     /*
-     * Opacity level of the window
+     * The opacity level of the window
      *
      * @serial
      * @see #setOpacity(float)
@@ -306,7 +306,7 @@
     private float opacity = 1.0f;
 
     /*
-     * The shape assigned to this window. This field is set to null if
+     * The shape assigned to this window. This field is set to {@code null} if
      * no shape is set (rectangular window).
      *
      * @serial
@@ -3592,10 +3592,10 @@
     @Override
     public void setBackground(Color bgColor) {
         Color oldBg = getBackground();
+        super.setBackground(bgColor);
         if (oldBg != null && oldBg.equals(bgColor)) {
             return;
         }
-        super.setBackground(bgColor);
         int oldAlpha = oldBg != null ? oldBg.getAlpha() : 255;
         int alpha = bgColor.getAlpha();
         if ((oldAlpha == 255) && (alpha < 255)) { // non-opaque window
@@ -3623,16 +3623,37 @@
         }
     }
 
-    private void updateWindow(BufferedImage backBuffer) {
+    private void updateWindow() {
         synchronized (getTreeLock()) {
             WindowPeer peer = (WindowPeer)getPeer();
             if (peer != null) {
-                peer.updateWindow(backBuffer);
+                peer.updateWindow();
             }
         }
     }
 
-    private static final Color TRANSPARENT_BACKGROUND_COLOR = new Color(0, 0, 0, 0);
+    /**
+     * {@inheritDoc}
+     *
+     * @since 1.7
+     */
+    @Override
+    public void paint(Graphics g) {
+        Color bgColor = getBackground();
+        if ((bgColor != null) && (bgColor.getAlpha() < 255)) {
+            Graphics gg = g.create();
+            try {
+                if (gg instanceof Graphics2D) {
+                    gg.setColor(bgColor);
+                    ((Graphics2D)gg).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));
+                    gg.fillRect(0, 0, getWidth(), getHeight());
+                }
+            } finally {
+                gg.dispose();
+            }
+        }
+        super.paint(g);
+    }
 
     private static void setLayersOpaque(Component component, boolean isOpaque) {
         // Shouldn't use instanceof to avoid loading Swing classes
@@ -3644,18 +3665,10 @@
             Container c = root.getContentPane();
             javax.swing.JComponent content =
                 (c instanceof javax.swing.JComponent) ? (javax.swing.JComponent)c : null;
-            javax.swing.JComponent gp =
-                (rpc.getGlassPane() instanceof javax.swing.JComponent) ?
-                (javax.swing.JComponent)rpc.getGlassPane() : null;
-            if (gp != null) {
-                gp.setDoubleBuffered(isOpaque);
-            }
             lp.setOpaque(isOpaque);
             root.setOpaque(isOpaque);
-            root.setDoubleBuffered(isOpaque);
             if (content != null) {
                 content.setOpaque(isOpaque);
-                content.setDoubleBuffered(isOpaque);
 
                 // Iterate down one level to see whether we have a JApplet
                 // (which is also a RootPaneContainer) which requires processing
@@ -3748,8 +3761,8 @@
                 window.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue(),
                                                opaque ? 255 : 0));
             }
-            public void updateWindow(Window window, BufferedImage backBuffer) {
-                window.updateWindow(backBuffer);
+            public void updateWindow(Window window) {
+                window.updateWindow();
             }
 
             public Dimension getSecurityWarningSize(Window window) {
--- a/jdk/src/share/classes/java/awt/event/InputEvent.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/event/InputEvent.java	Wed Jul 05 16:53:56 2017 +0200
@@ -157,6 +157,8 @@
     /**
      * An array of extended modifiers for additional buttons.
      * @see getButtonDownMasks
+     * There are twenty buttons fit into 4byte space.
+     * one more bit is reserved for FIRST_HIGH_BIT.
      * @since 7.0
      */
     private static final int [] BUTTON_DOWN_MASK = new int [] { BUTTON1_DOWN_MASK,
@@ -169,7 +171,16 @@
                                                                1<<18,
                                                                1<<19,
                                                                1<<20,
-                                                               1<<21 };
+                                                               1<<21,
+                                                               1<<22,
+                                                               1<<23,
+                                                               1<<24,
+                                                               1<<25,
+                                                               1<<26,
+                                                               1<<27,
+                                                               1<<28,
+                                                               1<<29,
+                                                               1<<30};
 
     /**
      * A method to access an array of extended modifiers for additional buttons.
@@ -240,7 +251,7 @@
     // in fact, it is undesirable to add modifier bits
     // to the same field as this may break applications
     // see bug# 5066958
-    static final int FIRST_HIGH_BIT = 1 << 22;
+    static final int FIRST_HIGH_BIT = 1 << 31;
 
     static final int JDK_1_3_MODIFIERS = SHIFT_DOWN_MASK - 1;
     static final int HIGH_MODIFIERS = ~( FIRST_HIGH_BIT - 1 );
--- a/jdk/src/share/classes/java/awt/event/MouseEvent.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/event/MouseEvent.java	Wed Jul 05 16:53:56 2017 +0200
@@ -33,6 +33,7 @@
 import java.io.ObjectInputStream;
 import java.awt.IllegalComponentStateException;
 import java.awt.MouseInfo;
+import sun.awt.SunToolkit;
 
 /**
  * An event which indicates that a mouse action occurred in a component.
@@ -379,12 +380,25 @@
      */
     private static final long serialVersionUID = -991214153494842848L;
 
+    /**
+     * A number of buttons available on the mouse at the {@code Toolkit} machinery startup.
+     */
+    private static int cachedNumberOfButtons;
+
     static {
         /* ensure that the necessary native libraries are loaded */
         NativeLibLoader.loadLibraries();
         if (!GraphicsEnvironment.isHeadless()) {
             initIDs();
         }
+        final Toolkit tk = Toolkit.getDefaultToolkit();
+        if (tk instanceof SunToolkit) {
+            cachedNumberOfButtons = ((SunToolkit)tk).getNumberOfButtons();
+        } else {
+            //It's expected that some toolkits (Headless,
+            //whatever besides SunToolkit) could also operate.
+            cachedNumberOfButtons = 3;
+        }
     }
 
     /**
@@ -412,15 +426,6 @@
     }
 
     /**
-     * A number of buttons available on the mouse at the {@code Toolkit} machinery startup.
-     */
-    private static int cachedNumberOfButtons;
-
-    static {
-        cachedNumberOfButtons = MouseInfo.getNumberOfButtons();
-    }
-
-    /**
      * Returns the absolute horizontal x position of the event.
      * In a virtual device multi-screen environment in which the
      * desktop area could span multiple physical screen devices,
@@ -735,7 +740,6 @@
         if (button < NOBUTTON){
             throw new IllegalArgumentException("Invalid button value :" + button);
         }
-        //TODO: initialize MouseInfo.cachedNumber on toolkit creation.
         if (button > BUTTON3) {
             if (!Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
                 throw new IllegalArgumentException("Extra mouse events are disabled " + button);
--- a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -548,7 +548,8 @@
     /**
      * Updates internal data structures related to the component's GC.
      *
+     * @return if the peer needs to be recreated for the changes to take effect
      * @since 1.7
      */
-    void updateGraphicsData(GraphicsConfiguration gc);
+    boolean updateGraphicsData(GraphicsConfiguration gc);
 }
--- a/jdk/src/share/classes/java/awt/peer/RobotPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/peer/RobotPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -121,11 +121,4 @@
      * Disposes the robot peer when it is not needed anymore.
      */
     void dispose();
-
-    /**
-     * Returns the number of buttons that the robot simulates.
-     *
-     * @return the number of buttons that the robot simulates
-     */
-    int getNumberOfButtons();
 }
--- a/jdk/src/share/classes/java/awt/peer/WindowPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/java/awt/peer/WindowPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -110,12 +110,11 @@
     void setOpaque(boolean isOpaque);
 
     /**
-     * Updates the native part of non-opaque window using
-     * the given image with color+alpha values for each pixel.
+     * Updates the native part of non-opaque window.
      *
      * @see Window#setBackground(Color)
      */
-    void updateWindow(BufferedImage backBuffer);
+    void updateWindow();
 
     /**
      * Instructs the peer to update the position of the security warning.
--- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Wed Jul 05 16:53:56 2017 +0200
@@ -34,6 +34,9 @@
 import java.awt.event.ComponentAdapter;
 import java.awt.event.ComponentEvent;
 
+import sun.awt.AWTAccessor;
+import sun.awt.SunToolkit;
+
 /** This is an implementation of the <code>DesktopManager</code>.
   * It currently implements the basic behaviors for managing
   * <code>JInternalFrame</code>s in an arbitrary parent.
@@ -361,7 +364,7 @@
               g.dispose();
             }
         } else if (dragMode == FASTER_DRAG_MODE) {
-          dragFrameFaster(f, newX, newY);
+            dragFrameFaster(f, newX, newY);
         } else {
             setBoundsForFrame(f, newX, newY, f.getWidth(), f.getHeight());
         }
@@ -634,13 +637,8 @@
 
       boolean floaterCollision = isFloaterCollision(previousBounds, currentBounds);
 
-    // System.out.println(previousBounds);
       JComponent parent = (JComponent)f.getParent();
       Rectangle visBounds = previousBounds.intersection(desktopBounds);
-    //  System.out.println(previousBounds);
-
-
-     // System.out.println(visBounds);
 
       RepaintManager currentManager = RepaintManager.currentManager(f);
 
@@ -682,7 +680,6 @@
           } else {
               dirtyRects = new Rectangle[1];
               dirtyRects[0] = previousBounds;
-              //  System.out.println("no intersection");
           };
 
           // Fix the damage
@@ -701,14 +698,22 @@
 
                   parent.paintImmediately(dirtyRects[i]);
                   ((JInternalFrame)f).isDragging = true;
-
-                  // System.out.println(dirtyRects[i]);
               }
 
           }
       } finally {
           currentManager.endPaint();
       }
+
+      // update window if it's non-opaque
+      Window topLevel = SwingUtilities.getWindowAncestor(f);
+      Toolkit tk = Toolkit.getDefaultToolkit();
+      if (!AWTAccessor.getWindowAccessor().isOpaque(topLevel) &&
+          (tk instanceof SunToolkit) &&
+          ((SunToolkit)tk).needUpdateWindow())
+      {
+          AWTAccessor.getWindowAccessor().updateWindow(topLevel);
+      }
    }
 
    private boolean isFloaterCollision(Rectangle moveFrom, Rectangle moveTo) {
--- a/jdk/src/share/classes/javax/swing/JComponent.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/javax/swing/JComponent.java	Wed Jul 05 16:53:56 2017 +0200
@@ -1021,8 +1021,10 @@
 
             int bw,bh;
             boolean printing = getFlag(IS_PRINTING);
-            if(!printing && repaintManager.isDoubleBufferingEnabled() &&
-               !getFlag(ANCESTOR_USING_BUFFER) && isDoubleBuffered()) {
+            if (!printing && repaintManager.isDoubleBufferingEnabled() &&
+                !getFlag(ANCESTOR_USING_BUFFER) && isDoubleBuffered() &&
+                (getFlag(IS_REPAINTING) || repaintManager.isPainting()))
+            {
                 repaintManager.beginPaint();
                 try {
                     repaintManager.paint(this, this, co, clipX, clipY, clipW,
--- a/jdk/src/share/classes/javax/swing/RepaintManager.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/javax/swing/RepaintManager.java	Wed Jul 05 16:53:56 2017 +0200
@@ -43,7 +43,6 @@
 
 import com.sun.java.swing.SwingUtilities3;
 
-
 /**
  * This class manages repaint requests, allowing the number
  * of repaints to be minimized, for example by collapsing multiple
@@ -717,14 +716,12 @@
         }
     }
 
-    private Map<Component,Rectangle>
-        updateWindows(Map<Component,Rectangle> dirtyComponents)
-    {
+    private void updateWindows(Map<Component,Rectangle> dirtyComponents) {
         Toolkit toolkit = Toolkit.getDefaultToolkit();
         if (!(toolkit instanceof SunToolkit &&
               ((SunToolkit)toolkit).needUpdateWindow()))
         {
-            return dirtyComponents;
+            return;
         }
 
         Set<Window> windows = new HashSet<Window>();
@@ -734,25 +731,20 @@
             Window window = dirty instanceof Window ?
                 (Window)dirty :
                 SwingUtilities.getWindowAncestor(dirty);
-
             if (window != null &&
                 !AWTAccessor.getWindowAccessor().isOpaque(window))
             {
-                // if this component's toplevel is perpixel translucent, it will
-                // be repainted below
-                it.remove();
-                // add to the set of windows to update (so that we don't update
-                // the window many times for each component to be repainted that
-                // belongs to this window)
                 windows.add(window);
             }
         }
 
         for (Window window : windows) {
-            AWTAccessor.getWindowAccessor().updateWindow(window, null);
+            AWTAccessor.getWindowAccessor().updateWindow(window);
         }
+    }
 
-        return dirtyComponents;
+    boolean isPainting() {
+        return painting;
     }
 
     /**
@@ -788,10 +780,6 @@
         int localBoundsW;
         Enumeration keys;
 
-        // the components belonging to perpixel-translucent windows will be
-        // removed from the list
-        tmpDirtyComponents = updateWindows(tmpDirtyComponents);
-
         roots = new ArrayList<Component>(count);
 
         for (Component dirty : tmpDirtyComponents.keySet()) {
@@ -799,13 +787,11 @@
         }
 
         count = roots.size();
-        //        System.out.println("roots size is " + count);
         painting = true;
         try {
             for(i=0 ; i < count ; i++) {
                 dirtyComponent = roots.get(i);
                 rect = tmpDirtyComponents.get(dirtyComponent);
-                //            System.out.println("Should refresh :" + rect);
                 localBoundsH = dirtyComponent.getHeight();
                 localBoundsW = dirtyComponent.getWidth();
 
@@ -848,6 +834,9 @@
         } finally {
             painting = false;
         }
+
+        updateWindows(tmpDirtyComponents);
+
         tmpDirtyComponents.clear();
     }
 
@@ -1004,6 +993,16 @@
             return delegate.getVolatileOffscreenBuffer(c, proposedWidth,
                                                         proposedHeight);
         }
+
+        // If the window is non-opaque, it's double-buffered at peer's level
+        Window w = (c instanceof Window) ? (Window)c : SwingUtilities.getWindowAncestor(c);
+        if (!AWTAccessor.getWindowAccessor().isOpaque(w)) {
+            Toolkit tk = Toolkit.getDefaultToolkit();
+            if ((tk instanceof SunToolkit) && (((SunToolkit)tk).needUpdateWindow())) {
+                return null;
+            }
+        }
+
         GraphicsConfiguration config = c.getGraphicsConfiguration();
         if (config == null) {
             config = GraphicsEnvironment.getLocalGraphicsEnvironment().
@@ -1031,6 +1030,15 @@
         DoubleBufferInfo doubleBuffer;
         int width, height;
 
+        // If the window is non-opaque, it's double-buffered at peer's level
+        Window w = (c instanceof Window) ? (Window)c : SwingUtilities.getWindowAncestor(c);
+        if (!AWTAccessor.getWindowAccessor().isOpaque(w)) {
+            Toolkit tk = Toolkit.getDefaultToolkit();
+            if ((tk instanceof SunToolkit) && (((SunToolkit)tk).needUpdateWindow())) {
+                return null;
+            }
+        }
+
         if (standardDoubleBuffer == null) {
             standardDoubleBuffer = new DoubleBufferInfo();
         }
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java	Wed Jul 05 16:53:56 2017 +0200
@@ -230,51 +230,46 @@
         }
 
         public void run0() {
-            DoChangeContents doChangeContents = ShellFolder.getInvoker().invoke(new Callable<DoChangeContents>() {
-                public DoChangeContents call() throws Exception {
-                    FileSystemView fileSystem = filechooser.getFileSystemView();
+            FileSystemView fileSystem = filechooser.getFileSystemView();
+
+            File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
 
-                    File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
+            if (isInterrupted()) {
+                return;
+            }
 
-                    Vector<File> acceptsList = new Vector<File>();
+            final Vector<File> newFileCache = new Vector<File>();
+            Vector<File> newFiles = new Vector<File>();
 
-                    if (isInterrupted()) {
-                        return null;
-                    }
+            // run through the file list, add directories and selectable files to fileCache
+            // Note that this block must be OUTSIDE of Invoker thread because of
+            // deadlock possibility with custom synchronized FileSystemView
+            for (File file : list) {
+                if (filechooser.accept(file)) {
+                    boolean isTraversable = filechooser.isTraversable(file);
 
-                    // run through the file list, add directories and selectable files to fileCache
-                    for (File file : list) {
-                        if (filechooser.accept(file)) {
-                            acceptsList.addElement(file);
-                        }
+                    if (isTraversable) {
+                        newFileCache.addElement(file);
+                    } else if (filechooser.isFileSelectionEnabled()) {
+                        newFiles.addElement(file);
                     }
 
                     if (isInterrupted()) {
-                        return null;
+                        return;
                     }
-
-                    // First sort alphabetically by filename
-                    sort(acceptsList);
+                }
+            }
 
-                    Vector<File> newDirectories = new Vector<File>(50);
-                    Vector<File> newFiles = new Vector<File>();
-                    // run through list grabbing directories in chunks of ten
-                    for (int i = 0; i < acceptsList.size(); i++) {
-                        File f = acceptsList.elementAt(i);
-                        boolean isTraversable = filechooser.isTraversable(f);
-                        if (isTraversable) {
-                            newDirectories.addElement(f);
-                        } else if (!isTraversable && filechooser.isFileSelectionEnabled()) {
-                            newFiles.addElement(f);
-                        }
-                        if (isInterrupted()) {
-                            return null;
-                        }
-                    }
+            // First sort alphabetically by filename
+            sort(newFileCache);
+            sort(newFiles);
 
-                    Vector<File> newFileCache = new Vector<File>(newDirectories);
-                    newFileCache.addAll(newFiles);
+            newFileCache.addAll(newFiles);
 
+            // To avoid loads of synchronizations with Invoker and improve performance we
+            // execute the whole block on the COM thread
+            DoChangeContents doChangeContents = ShellFolder.getInvoker().invoke(new Callable<DoChangeContents>() {
+                public DoChangeContents call() throws Exception {
                     int newSize = newFileCache.size();
                     int oldSize = fileCache.size();
 
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf	Wed Jul 05 16:53:56 2017 +0200
@@ -4201,8 +4201,9 @@
             <stateType key="Disabled"/>
             <stateType key="Focused"/>
             <stateType key="Editable">
-               <codeSnippet><![CDATA[
-                          return ((JComboBox)c).isEditable();]]></codeSnippet>
+                <codeSnippet><![CDATA[
+        return c instanceof JComboBox && ((JComboBox)c).isEditable();
+                ]]></codeSnippet>
             </stateType>
          </stateTypes>
          <contentMargins top="0" bottom="0" left="0" right="0"/>
@@ -16160,12 +16161,14 @@
             <stateType key="Disabled"/>
             <stateType key="Indeterminate">
                <codeSnippet><![CDATA[
-                        return ((JProgressBar)c).isIndeterminate();
+        return c instanceof JProgressBar &&
+               ((JProgressBar)c).isIndeterminate();
                ]]></codeSnippet>
             </stateType>
             <stateType key="Finished">
                <codeSnippet><![CDATA[
-                        return ((JProgressBar)c).getPercentComplete() == 1.0;
+        return c instanceof JProgressBar &&
+               ((JProgressBar)c).getPercentComplete() == 1.0;
                 ]]></codeSnippet>
             </stateType>
          </stateTypes>
@@ -25845,26 +25848,26 @@
          <stateTypes>
             <stateType key="North">
                <codeSnippet><![CDATA[
-        JToolBar toolbar = (JToolBar)c;
-        return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.NORTH;
+        return (c instanceof JToolBar) &&
+               NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.NORTH;
                ]]></codeSnippet>
             </stateType>
             <stateType key="East">
                <codeSnippet><![CDATA[
-        JToolBar toolbar = (JToolBar)c;
-        return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.EAST;
+        return (c instanceof JToolBar) &&
+               NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.EAST;
                ]]></codeSnippet>
             </stateType>
             <stateType key="West">
                <codeSnippet><![CDATA[
-        JToolBar toolbar = (JToolBar)c;
-        return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.WEST;
+        return (c instanceof JToolBar) &&
+               NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.WEST;
                ]]></codeSnippet>
             </stateType>
             <stateType key="South">
                <codeSnippet><![CDATA[
-        JToolBar toolbar = (JToolBar)c;
-        return NimbusLookAndFeel.resolveToolbarConstraint(toolbar) == BorderLayout.SOUTH;
+        return (c instanceof JToolBar) &&
+               NimbusLookAndFeel.resolveToolbarConstraint((JToolBar)c) == BorderLayout.SOUTH;
                ]]></codeSnippet>
             </stateType>
          </stateTypes>
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java	Wed Jul 05 16:53:56 2017 +0200
@@ -132,7 +132,7 @@
         /*
          * Update the image of a non-opaque (translucent) window.
          */
-        void updateWindow(Window window, BufferedImage backBuffer);
+        void updateWindow(Window window);
 
         /** Get the size of the security warning.
          */
--- a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java	Wed Jul 05 16:53:56 2017 +0200
@@ -592,8 +592,9 @@
         public void setOpaque(boolean isOpaque) {
         }
 
-        public void updateWindow(BufferedImage bi) {
+        public void updateWindow() {
         }
+
         public void repositionSecurityWarning() {
         }
      }
--- a/jdk/src/share/classes/sun/awt/HeadlessToolkit.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/awt/HeadlessToolkit.java	Wed Jul 05 16:53:56 2017 +0200
@@ -179,9 +179,15 @@
         throw new HeadlessException();
     }
 
-    public  KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager)
-        throws HeadlessException {
-        throw new HeadlessException();
+    public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
+        // See 6833019.
+        return
+            new KeyboardFocusManagerPeer() {
+                public Window getCurrentFocusedWindow() { return null; }
+                public void setCurrentFocusOwner(Component comp) {}
+                public Component getCurrentFocusOwner() { return null; }
+                public void clearGlobalFocusOwner(Window activeWindow) {}
+            };
     }
 
     public TrayIconPeer createTrayIcon(TrayIcon target)
--- a/jdk/src/share/classes/sun/awt/NullComponentPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/awt/NullComponentPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -300,7 +300,9 @@
     public void setZOrder(ComponentPeer above) {
     }
 
-    public void updateGraphicsData(GraphicsConfiguration gc) {}
+    public boolean updateGraphicsData(GraphicsConfiguration gc) {
+        return false;
+    }
 
     public GraphicsConfiguration getAppropriateGraphicsConfiguration(
                         GraphicsConfiguration gc)
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Wed Jul 05 16:53:56 2017 +0200
@@ -89,6 +89,25 @@
      */
     private static final String POST_EVENT_QUEUE_KEY = "PostEventQueue";
 
+    /**
+     * Number of buttons.
+     * By default it's taken from the system. If system value does not
+     * fit into int type range, use our own MAX_BUTTONS_SUPPORT value.
+     */
+    protected static int numberOfButtons = 0;
+
+
+    /* XFree standard mention 24 buttons as maximum:
+     * http://www.xfree86.org/current/mouse.4.html
+     * We workaround systems supporting more than 24 buttons.
+     * Otherwise, we have to use long type values as masks
+     * which leads to API change.
+     * InputEvent.BUTTON_DOWN_MASK may contain only 21 masks due to
+     * the 4-bytes limit for the int type. (CR 6799099)
+     * One more bit is reserved for FIRST_HIGH_BIT.
+     */
+    public final static int MAX_BUTTONS_SUPPORTED = 20;
+
     public SunToolkit() {
         /* If awt.threadgroup is set to class name the instance of
          * this class is created (should be subclass of ThreadGroup)
@@ -2079,6 +2098,12 @@
         return false;
     }
 
+    /**
+     * Descendants of the SunToolkit should override and put their own logic here.
+     */
+    public int getNumberOfButtons(){
+        return 3;
+    }
 } // class SunToolkit
 
 
--- a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java	Wed Jul 05 16:53:56 2017 +0200
@@ -274,45 +274,61 @@
 
     // Override File methods
 
-    public static void sort(List<? extends File> files) {
+    public static void sort(final List<? extends File> files) {
         if (files == null || files.size() <= 1) {
             return;
         }
 
-        // Check that we can use the ShellFolder.sortChildren() method:
-        //   1. All files have the same non-null parent
-        //   2. All files is ShellFolders
-        File commonParent = null;
+        // To avoid loads of synchronizations with Invoker and improve performance we
+        // synchronize the whole code of the sort method once
+        getInvoker().invoke(new Callable<Void>() {
+            public Void call() throws Exception {
+                // Check that we can use the ShellFolder.sortChildren() method:
+                //   1. All files have the same non-null parent
+                //   2. All files is ShellFolders
+                File commonParent = null;
 
-        for (File file : files) {
-            File parent = file.getParentFile();
+                for (File file : files) {
+                    File parent = file.getParentFile();
 
-            if (parent == null || !(file instanceof ShellFolder)) {
-                commonParent = null;
+                    if (parent == null || !(file instanceof ShellFolder)) {
+                        commonParent = null;
 
-                break;
-            }
+                        break;
+                    }
 
-            if (commonParent == null) {
-                commonParent = parent;
-            } else {
-                if (commonParent != parent && !commonParent.equals(parent)) {
-                    commonParent = null;
+                    if (commonParent == null) {
+                        commonParent = parent;
+                    } else {
+                        if (commonParent != parent && !commonParent.equals(parent)) {
+                            commonParent = null;
 
-                    break;
+                            break;
+                        }
+                    }
                 }
-            }
-        }
 
-        if (commonParent instanceof ShellFolder) {
-            ((ShellFolder) commonParent).sortChildren(files);
-        } else {
-            Collections.sort(files, FILE_COMPARATOR);
-        }
+                if (commonParent instanceof ShellFolder) {
+                    ((ShellFolder) commonParent).sortChildren(files);
+                } else {
+                    Collections.sort(files, FILE_COMPARATOR);
+                }
+
+                return null;
+            }
+        });
     }
 
-    public void sortChildren(List<? extends File> files) {
-        Collections.sort(files, FILE_COMPARATOR);
+    public void sortChildren(final List<? extends File> files) {
+        // To avoid loads of synchronizations with Invoker and improve performance we
+        // synchronize the whole code of the sort method once
+        getInvoker().invoke(new Callable<Void>() {
+            public Void call() throws Exception {
+                Collections.sort(files, FILE_COMPARATOR);
+
+                return null;
+            }
+        });
     }
 
     public boolean isAbsolute() {
--- a/jdk/src/share/classes/sun/swing/plaf/GTKKeybindings.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/swing/plaf/GTKKeybindings.java	Wed Jul 05 16:53:56 2017 +0200
@@ -402,6 +402,11 @@
                         "released SPACE", "released",
                         "RETURN", "pressed"
                 }),
+                "RootPane.ancestorInputMap",
+                new UIDefaults.LazyInputMap(new Object[]{
+                        "shift F10", "postPopup",
+                        "CONTEXT_MENU", "postPopup"
+                }),
                 // These bindings are only enabled when there is a default
                 // button set on the rootpane.
                 "RootPane.defaultButtonWindowKeyBindings", new Object[]{
--- a/jdk/src/share/classes/sun/swing/plaf/WindowsKeybindings.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/swing/plaf/WindowsKeybindings.java	Wed Jul 05 16:53:56 2017 +0200
@@ -360,6 +360,11 @@
                         "DOWN", "decrement",
                         "KP_DOWN", "decrement",
                 }),
+                "RootPane.ancestorInputMap",
+                new UIDefaults.LazyInputMap(new Object[]{
+                        "shift F10", "postPopup",
+                        "CONTEXT_MENU", "postPopup"
+                }),
                 // These bindings are only enabled when there is a default
                 // button set on the rootpane.
                 "RootPane.defaultButtonWindowKeyBindings", new Object[]{
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                       "Truk Summer Time", "TRUST"};
         String ULAT[]= new String[] {"Ulaanbaatar Time", "ULAT",
                                      "Ulaanbaatar Summer Time", "ULAST"};
+        String WART[] = new String[] {"Western Argentine Time", "WART",
+                                      "Western Argentine Summer Time", "WARST"};
         String WAT[] = new String[] {"Western African Time", "WAT",
                                      "Western African Summer Time", "WAST"};
         String WET[] = new String[] {"Western European Time", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                       "Truk Sommerzeit", "TRUST"};
         String ULAT[]= new String[] {"Ulaanbaatar Zeit", "ULAT",
                                      "Ulaanbaatar Sommerzeit", "ULAST"};
+        String WART[] = new String[] {"Argentinische Zeit", "WART",
+                                      "Argentinische Sommerzeit", "WARST"};
         String WAT[] = new String[] {"Westafrikanische Zeit", "WAT",
                                      "Westafrikanische Sommerzeit", "WAST"};
         String WET[] = new String[] {"Westeurop\u00e4ische Zeit", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                      "Hora de verano de Truk", "TRUST"};
         String ULAT[]= new String[] {"Hora de Ulan Bator", "ULAT",
                                      "Hora de verano de Ulan Bator", "ULAST"};
+        String WART[] = new String[] {"Hora de Argentina", "WART",
+                                      "Hora de verano de Argentina", "WARST"};
         String WAT[] = new String[] {"Hora de \u00c1frica Occidental", "WAT",
                                      "Hora de verano de \u00c1frica Occidental", "WAST"};
         String WET[] = new String[] {"Hora de Europa Occidental", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                       "Heure d'\u00e9t\u00e9 de Truk", "TRUST"};
         String ULAT[]= new String[] {"Heure de l'Ulaanbaatar", "ULAT",
                                      "Heure d'\u00e9t\u00e9 de l'Ulaanbaatar", "ULAST"} ;
+        String WART[] = new String[] {"Heure D'Argentine", "WART",
+                                      "Heure d'\u00e9t\u00e9 D'Argentine", "WARST"} ;
         String WAT[] = new String[] {"Heure d'Afrique de l'Ouest", "WAT",
                                      "Heure d'\u00e9t\u00e9 d'Afrique de l'Ouest", "WAST"} ;
         String WET[] = new String[] {"Heure d'Europe de l'Ouest", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                       "Ora estiva di Truk", "TRUST"};
         String ULAT[]= new String[] {"Ora di Ulaanbaatar", "ULAT",
                                      "Ora estiva di Ulaanbaatar", "ULAST"};
+        String WART[] = new String[] {"Ora dell'Argentina", "WART",
+                                      "Ora estiva dell'Argentina", "WARST"};
         String WAT[] = new String[] {"Ora dell'Africa occidentale", "WAT",
                                      "Ora estiva dell'Africa occidentale", "WAST"};
         String WET[] = new String[] {"Ora dell'Europa occidentale", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                       "\u30c8\u30e9\u30c3\u30af\u590f\u6642\u9593", "TRUST"};
         String ULAT[]= new String[] {"\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u6642\u9593", "ULAT",
                                      "\u30a6\u30e9\u30fc\u30f3\u30d0\u30fc\u30c8\u30eb\u590f\u6642\u9593", "ULAST"};
+        String WART[] = new String[] {"\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u6642\u9593", "WART",
+                                      "\u30a2\u30eb\u30bc\u30f3\u30c1\u30f3\u590f\u6642\u9593", "WARST"};
         String WAT[] = new String[] {"\u897f\u30a2\u30d5\u30ea\u30ab\u6642\u9593", "WAT",
                                      "\u897f\u30a2\u30d5\u30ea\u30ab\u590f\u6642\u9593", "WAST"};
         String WET[] = new String[] {"\u897f\u30e8\u30fc\u30ed\u30c3\u30d1\u6642\u9593", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                       "\ud2b8\ub8e8\ud06c \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "TRUST"};
         String ULAT[]= new String[] {"\uc6b8\ub780\ubc14\ud0c0\ub974 \uc2dc\uac04", "ULAT",
                                      "\uc6b8\ub780\ubc14\ud0c0\ub974 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "ULAST"};
+        String WART[] = new String[] {"\uc544\ub974\ud5e8\ud2f0\ub098 \uc2dc\uac04", "WART",
+                                      "\uc544\ub974\ud5e8\ud2f0\ub098 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WARST"};
         String WAT[] = new String[] {"\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc2dc\uac04", "WAT",
                                      "\uc11c\ubd80 \uc544\ud504\ub9ac\uce74 \uc77c\uad11\uc808\uc57d\uc2dc\uac04", "WAST"};
         String WET[] = new String[] {"\uc11c\uc720\ub7fd \uc2dc\uac04", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                       "Truk, sommartid", "TRUST"};
         String ULAT[]= new String[] {"Ulaanbaatar, normaltid", "ULAT",
                                      "Ulaanbaatar, sommartid", "ULAST"};
+        String WART[] = new String[] {"Argentina, normaltid", "WART",
+                                      "Argentina, sommartid", "WARST"};
         String WAT[] = new String[] {"V\u00e4stafrikansk tid", "WAT",
                                      "V\u00e4stafrikansk sommartid", "WAST"};
         String WET[] = new String[] {"V\u00e4steuropeisk tid", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_CN.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                       "\u7279\u9c81\u514b\u590f\u4ee4\u65f6", "TRUST"};
         String ULAT[]= new String[] {"\u5e93\u4f26\u65f6\u95f4", "ULAT",
                                      "\u5e93\u4f26\u590f\u4ee4\u65f6", "ULAST"};
+        String WART[] = new String[] {"\u963f\u6839\u5ef7\u65f6\u95f4", "WART",
+                                      "\u963f\u6839\u5ef7\u590f\u4ee4\u65f6", "WARST"};
         String WAT[] = new String[] {"\u897f\u975e\u65f6\u95f4", "WAT",
                                      "\u897f\u975e\u590f\u4ee4\u65f6", "WAST"};
         String WET[] = new String[] {"\u897f\u6b27\u65f6\u95f4", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/classes/sun/util/resources/TimeZoneNames_zh_TW.java	Wed Jul 05 16:53:56 2017 +0200
@@ -171,6 +171,8 @@
                                       "\u7279\u9b6f\u514b\u590f\u4ee4\u6642\u9593", "TRUST"};
         String ULAT[]= new String[] {"\u5eab\u502b\u6642\u9593", "ULAT",
                                      "\u5eab\u502b\u590f\u4ee4\u6642\u9593", "ULAST"};
+          String WART[] = new String[] {"\u963f\u6839\u5ef7\u6642\u9593", "WART",
+                                      "\u963f\u6839\u5ef7\u590f\u4ee4\u6642\u9593", "WARST"};
         String WAT[] = new String[] {"\u897f\u975e\u6642\u9593", "WAT",
                                      "\u897f\u975e\u590f\u4ee4\u6642\u9593", "WAST"};
         String WET[] = new String[] {"\u897f\u6b50\u6642\u9593", "WET",
@@ -296,7 +298,7 @@
             {"America/Argentina/Rio_Gallegos", AGT},
             {"America/Argentina/Salta", AGT},
             {"America/Argentina/San_Juan", AGT},
-            {"America/Argentina/San_Luis", AGT},
+            {"America/Argentina/San_Luis", WART},
             {"America/Argentina/Tucuman", AGT},
             {"America/Argentina/Ushuaia", AGT},
             {"America/Aruba", AST},
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Wed Jul 05 16:53:56 2017 +0200
@@ -610,14 +610,19 @@
         return FALSE;
     }
 
-    if (!Icc->Grow(Icc, delta)) {
-        free(ptr);
-        if(isNew) {
-            Icc->TagCount--;
+    /* We change the size of Icc here only if we know it'll actually
+     * grow: if Icc is about to shrink we must wait until we've read
+     * the previous data.  */
+    if (delta > 0) {
+        if (!Icc->Grow(Icc, delta)) {
+            free(ptr);
+            if(isNew) {
+                Icc->TagCount--;
+            }
+            J2dRlsTraceLn(J2D_TRACE_ERROR,
+                          "_cmsModifyTagData: Icc->Grow() == FALSE");
+            return FALSE;
         }
-        J2dRlsTraceLn(J2D_TRACE_ERROR,
-                      "_cmsModifyTagData: Icc->Grow() == FALSE");
-        return FALSE;
     }
 
     /* Compute size of tag data before/after the modified tag */
@@ -680,6 +685,18 @@
     temp = TransportValue32(profileSize);
     Icc->Write(Icc, sizeof(icUInt32Number), &temp);
 
+    /* Shrink Icc, if needed.  */
+    if (delta < 0) {
+        if (!Icc->Grow(Icc, delta)) {
+            free(ptr);
+            if(isNew) {
+                Icc->TagCount--;
+            }
+            J2dRlsTraceLn(J2D_TRACE_ERROR,
+                          "_cmsModifyTagData: Icc->Grow() == FALSE");
+            return FALSE;
+        }
+    }
 
     /* Adjust tag offsets: if the tag is new, we must account
        for the new tag table entry; otherwise, only those tags after
--- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDConstants.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDConstants.java	Wed Jul 05 16:53:56 2017 +0200
@@ -120,7 +120,7 @@
                                                             false,
                                                             XConstants.AnyPropertyType);
         try {
-            int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
+            int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
             if (status == XConstants.Success &&
                 wpg.getData() != 0 &&
@@ -190,7 +190,7 @@
                 try {
                     Native.putLong(data, motifWindow);
 
-                    XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+                    XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
                     XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
                                                 defaultRootWindow,
                                                 XA_MOTIF_DRAG_WINDOW.getAtom(),
@@ -280,7 +280,7 @@
                                                             false,
                                                             XA_MOTIF_DRAG_TARGETS.getAtom());
         try {
-            int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
+            int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
             if (status != XConstants.Success
                 || wpg.getActualType() != XA_MOTIF_DRAG_TARGETS.getAtom()
@@ -394,7 +394,7 @@
                 }
             }
 
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
                                         motifWindow,
                                         XA_MOTIF_DRAG_TARGETS.getAtom(),
@@ -410,7 +410,7 @@
                 // Create a new motif window and retry.
                 motifWindow = createMotifWindow();
 
-                XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
                 XlibWrapper.XChangeProperty(XToolkit.getDisplay(),
                                             motifWindow,
                                             XA_MOTIF_DRAG_TARGETS.getAtom(),
@@ -534,7 +534,7 @@
             // CARD32 icc_handle
             unsafe.putInt(structData + 4, (int)XA_MOTIF_ATOM_0.getAtom());
 
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
                                         XA_MOTIF_ATOM_0.getAtom(),
                                         XA_MOTIF_DRAG_INITIATOR_INFO.getAtom(),
@@ -567,7 +567,7 @@
             unsafe.putShort(data + 10, (short)0); /* pad */
             unsafe.putInt(data + 12, dataSize);
 
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XlibWrapper.XChangeProperty(XToolkit.getDisplay(), window,
                                         XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
                                         XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
--- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java	Wed Jul 05 16:53:56 2017 +0200
@@ -184,7 +184,7 @@
                                      XConstants.AnyPropertyType);
 
         try {
-            int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
+            int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
             /*
              * DragICCI.h:
--- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java	Wed Jul 05 16:53:56 2017 +0200
@@ -102,7 +102,7 @@
                                      XConstants.AnyPropertyType);
 
         try {
-            status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
+            status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
             /*
              * DragICCI.h:
@@ -162,7 +162,7 @@
                 unsafe.putInt(data + 12, dataSize);
             }
 
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
                                         MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
                                         MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
@@ -204,7 +204,7 @@
                                          XConstants.AnyPropertyType);
 
             try {
-                status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
+                status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                 /*
                  * DragICCI.h:
@@ -236,7 +236,7 @@
 
                     unsafe.putInt(data + 4, tproxy);
 
-                    XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+                    XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
                     XlibWrapper.XChangeProperty(XToolkit.getDisplay(), embedder,
                                                 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
                                                 MotifDnDConstants.XA_MOTIF_DRAG_RECEIVER_INFO.getAtom(),
@@ -276,7 +276,7 @@
                                      XConstants.AnyPropertyType);
 
         try {
-            status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
+            status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
             /*
              * DragICCI.h:
@@ -325,7 +325,7 @@
                                      XConstants.AnyPropertyType);
 
         try {
-            int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
+            int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
             if (status == (int)XConstants.Success && wpg.getData() != 0 &&
                 wpg.getActualType() != 0 && wpg.getActualFormat() == 8 &&
@@ -375,7 +375,7 @@
                                          MotifDnDConstants.XA_MOTIF_DRAG_INITIATOR_INFO.getAtom());
 
             try {
-                int status = wpg.execute(XToolkit.IgnoreBadWindowHandler);
+                int status = wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                 if (status == XConstants.Success && wpg.getData() != 0 &&
                     wpg.getActualType() ==
@@ -412,7 +412,7 @@
          */
         XWindowAttributes wattr = new XWindowAttributes();
         try {
-            XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
             int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
                                                           source_win, wattr.pData);
 
@@ -429,7 +429,7 @@
             wattr.dispose();
         }
 
-        XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+        XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
         XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
                                  source_win_mask |
                                  XConstants.StructureNotifyMask);
@@ -1020,7 +1020,7 @@
         if (sourceWindow != 0) {
             XToolkit.awtLock();
             try {
-                XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
                 XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
                                          sourceWindowMask);
                 XToolkit.RESTORE_XERROR_HANDLER();
--- a/jdk/src/solaris/classes/sun/awt/X11/WindowPropertyGetter.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/WindowPropertyGetter.java	Wed Jul 05 16:53:56 2017 +0200
@@ -75,7 +75,7 @@
     public int execute() {
         return execute(null);
     }
-    public int execute(XToolkit.XErrorHandler errorHandler) {
+    public int execute(XErrorHandler errorHandler) {
 
         XToolkit.awtLock();
         try {
@@ -94,7 +94,7 @@
 
             // Fix for performance problem - IgnodeBadWindowHandler is
             // used too much without reason, just ignore it
-            if (errorHandler == XToolkit.IgnoreBadWindowHandler) {
+            if (errorHandler instanceof XErrorHandler.IgnoreBadWindowHandler) {
                 errorHandler = null;
             }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java	Wed Jul 05 16:53:56 2017 +0200
@@ -126,7 +126,7 @@
                 new WindowPropertyGetter(owner, xSettingsPropertyAtom, 0, MAX_LENGTH,
                         false, xSettingsPropertyAtom.getAtom() );
             try {
-                int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
+                int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                 if (status != XConstants.Success || getter.getData() == 0) {
                     if (log.isLoggable(Level.FINE)) log.fine("OH OH : getter failed  status = " + status );
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java	Wed Jul 05 16:53:56 2017 +0200
@@ -989,8 +989,17 @@
      */
     public void handleButtonPressRelease(XEvent xev) {
         XButtonEvent xbe = xev.get_xbutton();
+        /*
+         * Ignore the buttons above 20 due to the bit limit for
+         * InputEvent.BUTTON_DOWN_MASK.
+         * One more bit is reserved for FIRST_HIGH_BIT.
+         */
+        if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
+            return;
+        }
         int buttonState = 0;
-        for (int i = 0; i<XToolkit.getNumMouseButtons(); i++){
+        final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
+        for (int i = 0; i<buttonsNumber; i++){
             // A bug in WM implementation: extra buttons doesn't have state!=0 as they should on Release message.
             if ((i != 4) && (i != 5)){
                 buttonState |= (xbe.get_state() & XConstants.buttonsMask[i]);
@@ -1026,7 +1035,9 @@
      * Checks ButtonRelease released all Mouse buttons
      */
     static boolean isFullRelease(int buttonState, int button) {
-        if (button < 0 || button > XToolkit.getNumMouseButtons()) {
+        final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
+
+        if (button < 0 || button > buttonsNumber) {
             return buttonState == 0;
         } else {
             return buttonState == XConstants.buttonsMask[button - 1];
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -1429,7 +1429,26 @@
         }
     }
 
-    public void updateGraphicsData(GraphicsConfiguration gc) {
+    public boolean updateGraphicsData(GraphicsConfiguration gc) {
+        int oldVisual = -1, newVisual = -1;
+
+        if (graphicsConfig != null) {
+            oldVisual = graphicsConfig.getVisual();
+        }
+        if (gc != null && gc instanceof X11GraphicsConfig) {
+            newVisual = ((X11GraphicsConfig)gc).getVisual();
+        }
+
+        // If the new visual differs from the old one, the peer must be
+        // recreated because X11 does not allow changing the visual on the fly.
+        // So we even skip the initGraphicsConfiguration() call.
+        // The initial assignment should happen though, hence the != -1 thing.
+        if (oldVisual != -1 && oldVisual != newVisual) {
+            return true;
+        }
+
         initGraphicsConfiguration();
+        doValidateSurface();
+        return false;
     }
 }
--- a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -1100,7 +1100,8 @@
     }
 
     boolean isOverrideRedirect() {
-        return false;
+//        return false;
+        return ((XToolkit)Toolkit.getDefaultToolkit()).isOverrideRedirect((Window)target);
     }
 
     public boolean requestWindowFocus(long time, boolean timeProvided) {
--- a/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java	Wed Jul 05 16:53:56 2017 +0200
@@ -96,7 +96,7 @@
                 action_count++;
             }
 
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XDnDConstants.XA_XdndActionList.setAtomData(window,
                                                         XAtom.XA_ATOM,
                                                         data, action_count);
@@ -117,7 +117,7 @@
         try {
             Native.put(data, formats);
 
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XDnDConstants.XA_XdndTypeList.setAtomData(window,
                                                       XAtom.XA_ATOM,
                                                       data, formats.length);
@@ -195,7 +195,7 @@
             new WindowPropertyGetter(window, XDnDConstants.XA_XdndAware, 0, 1,
                                      false, XConstants.AnyPropertyType);
 
-        int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
+        int status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
         if (status == XConstants.Success &&
             wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
@@ -215,7 +215,7 @@
                                              0, 1, false, XAtom.XA_WINDOW);
 
                 try {
-                    status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
+                    status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                     if (status == XConstants.Success &&
                         wpg2.getData() != 0 &&
@@ -233,7 +233,7 @@
                                                  0, 1, false, XAtom.XA_WINDOW);
 
                     try {
-                        status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
+                        status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                         if (status != XConstants.Success ||
                             wpg3.getData() == 0 ||
@@ -249,7 +249,7 @@
                                                          XConstants.AnyPropertyType);
 
                             try {
-                                status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
+                                status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                                 if (status != XConstants.Success ||
                                     wpg4.getData() == 0 ||
--- a/jdk/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDnDDropTargetProtocol.java	Wed Jul 05 16:53:56 2017 +0200
@@ -88,7 +88,7 @@
         try {
             Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
 
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XDnDConstants.XA_XdndAware.setAtomData(window, XAtom.XA_ATOM, data, 1);
             XToolkit.RESTORE_XERROR_HANDLER();
 
@@ -122,7 +122,7 @@
                                      false, XConstants.AnyPropertyType);
 
         try {
-            status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
+            status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
             if (status == XConstants.Success &&
                 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
@@ -141,7 +141,7 @@
                                          0, 1, false, XAtom.XA_WINDOW);
 
             try {
-                status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
+                status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                 if (status == XConstants.Success &&
                     wpg2.getData() != 0 &&
@@ -159,7 +159,7 @@
                                              0, 1, false, XAtom.XA_WINDOW);
 
                 try {
-                    status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
+                    status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                     if (status != XConstants.Success ||
                         wpg3.getData() == 0 ||
@@ -175,7 +175,7 @@
                                                      XConstants.AnyPropertyType);
 
                         try {
-                            status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
+                            status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                             if (status != XConstants.Success ||
                                 wpg4.getData() == 0 ||
@@ -205,7 +205,7 @@
 
             /* The proxy window must have the XdndAware set, as XDnD protocol
                prescribes to check the proxy window for XdndAware. */
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XDnDConstants.XA_XdndAware.setAtomData(newProxy, XAtom.XA_ATOM,
                                                    data, 1);
             XToolkit.RESTORE_XERROR_HANDLER();
@@ -219,7 +219,7 @@
             Native.putLong(data, 0, newProxy);
 
             /* The proxy window must have the XdndProxy set to point to itself.*/
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XDnDConstants.XA_XdndProxy.setAtomData(newProxy, XAtom.XA_WINDOW,
                                                    data, 1);
             XToolkit.RESTORE_XERROR_HANDLER();
@@ -232,7 +232,7 @@
 
             Native.putLong(data, 0, XDnDConstants.XDND_PROTOCOL_VERSION);
 
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
                                                    data, 1);
             XToolkit.RESTORE_XERROR_HANDLER();
@@ -245,7 +245,7 @@
 
             Native.putLong(data, 0, newProxy);
 
-            XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
                                                    data, 1);
             XToolkit.RESTORE_XERROR_HANDLER();
@@ -278,7 +278,7 @@
             try {
                 Native.putLong(data, 0, entry.getVersion());
 
-                XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
                 XDnDConstants.XA_XdndAware.setAtomData(embedder, XAtom.XA_ATOM,
                                                        data, 1);
                 XToolkit.RESTORE_XERROR_HANDLER();
@@ -291,7 +291,7 @@
 
                 Native.putLong(data, 0, (int)entry.getProxy());
 
-                XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
                 XDnDConstants.XA_XdndProxy.setAtomData(embedder, XAtom.XA_WINDOW,
                                                        data, 1);
                 XToolkit.RESTORE_XERROR_HANDLER();
@@ -329,7 +329,7 @@
                                      false, XConstants.AnyPropertyType);
 
         try {
-            status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
+            status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
             if (status == XConstants.Success &&
                 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
@@ -348,7 +348,7 @@
                                          0, 1, false, XAtom.XA_WINDOW);
 
             try {
-                status = wpg2.execute(XToolkit.IgnoreBadWindowHandler);
+                status = wpg2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                 if (status == XConstants.Success &&
                     wpg2.getData() != 0 &&
@@ -366,7 +366,7 @@
                                              0, 1, false, XAtom.XA_WINDOW);
 
                 try {
-                    status = wpg3.execute(XToolkit.IgnoreBadWindowHandler);
+                    status = wpg3.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                     if (status != XConstants.Success ||
                         wpg3.getData() == 0 ||
@@ -382,7 +382,7 @@
                                                      XConstants.AnyPropertyType);
 
                         try {
-                            status = wpg4.execute(XToolkit.IgnoreBadWindowHandler);
+                            status = wpg4.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                             if (status != XConstants.Success ||
                                 wpg4.getData() == 0 ||
@@ -411,7 +411,7 @@
                                      false, XConstants.AnyPropertyType);
 
         try {
-            int status = wpg1.execute(XToolkit.IgnoreBadWindowHandler);
+            int status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
             if (status == XConstants.Success &&
                 wpg1.getData() != 0 && wpg1.getActualType() == XAtom.XA_ATOM) {
@@ -473,7 +473,7 @@
                                          0, 0xFFFF, false,
                                          XAtom.XA_ATOM);
             try {
-                wpg.execute(XToolkit.IgnoreBadWindowHandler);
+                wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                 if (wpg.getActualType() == XAtom.XA_ATOM &&
                     wpg.getActualFormat() == 32) {
@@ -505,7 +505,7 @@
                                          0, 0xFFFF, false,
                                          XAtom.XA_ATOM);
             try {
-                wpg.execute(XToolkit.IgnoreBadWindowHandler);
+                wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                 if (wpg.getActualType() == XAtom.XA_ATOM &&
                     wpg.getActualFormat() == 32) {
@@ -541,7 +541,7 @@
          */
         XWindowAttributes wattr = new XWindowAttributes();
         try {
-            XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
             int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
                                                           source_win, wattr.pData);
 
@@ -558,7 +558,7 @@
             wattr.dispose();
         }
 
-        XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+        XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
         XlibWrapper.XSelectInput(XToolkit.getDisplay(), source_win,
                                  source_win_mask |
                                  XConstants.StructureNotifyMask);
@@ -963,7 +963,7 @@
         if (sourceWindow != 0) {
             XToolkit.awtLock();
             try {
-                XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
                 XlibWrapper.XSelectInput(XToolkit.getDisplay(), sourceWindow,
                                          sourceWindowMask);
                 XToolkit.RESTORE_XERROR_HANDLER();
@@ -1104,14 +1104,14 @@
                                                  0, 0xFFFF, false,
                                                  XAtom.XA_ATOM);
                     try {
-                        wpg.execute(XToolkit.IgnoreBadWindowHandler);
+                        wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
                         if (wpg.getActualType() == XAtom.XA_ATOM &&
                             wpg.getActualFormat() == 32) {
 
                             XToolkit.awtLock();
                             try {
-                                XToolkit.WITH_XERROR_HANDLER(XWM.VerifyChangePropertyHandler);
+                                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
                                 XDnDConstants.XA_XdndTypeList.setAtomData(xclient.get_window(),
                                                                           XAtom.XA_ATOM,
                                                                           wpg.getData(),
--- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -42,6 +42,7 @@
 
 import sun.awt.dnd.SunDragSourceContextPeer;
 import sun.awt.dnd.SunDropTargetContextPeer;
+import sun.awt.SunToolkit;
 
 /**
  * The XDragSourceContextPeer class is the class responsible for handling
@@ -666,6 +667,15 @@
         case XConstants.ButtonRelease: {
             XButtonEvent xbutton = ev.get_xbutton();
             /*
+             * Ignore the buttons above 20 due to the bit limit for
+             * InputEvent.BUTTON_DOWN_MASK.
+             * One more bit is reserved for FIRST_HIGH_BIT.
+             */
+            if (xbutton.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
+                return true;
+            }
+
+            /*
              * On some X servers it could happen that ButtonRelease coordinates
              * differ from the latest MotionNotify coordinates, so we need to
              * process it as a mouse motion.
--- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java	Wed Jul 05 16:53:56 2017 +0200
@@ -181,7 +181,7 @@
                                    long time) {
         XWindowAttributes wattr = new XWindowAttributes();
         try {
-            XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
             int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
                                                           targetWindow, wattr.pData);
 
@@ -198,7 +198,7 @@
             wattr.dispose();
         }
 
-        XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+        XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
         XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
                                  targetWindowMask |
                                  XConstants.StructureNotifyMask);
@@ -214,7 +214,7 @@
     }
 
     protected final void finalizeDrop() {
-        XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+        XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
         XlibWrapper.XSelectInput(XToolkit.getDisplay(), targetWindow,
                                  targetWindowMask);
         XToolkit.RESTORE_XERROR_HANDLER();
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java	Wed Jul 05 16:53:56 2017 +0200
@@ -168,7 +168,7 @@
                 if (dest_x >= 0 && dest_y >= 0) {
                     XWindowAttributes wattr = new XWindowAttributes();
                     try {
-                        XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+                        XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
                         int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
                                                                       window, wattr.pData);
                         XToolkit.RESTORE_XERROR_HANDLER();
@@ -222,7 +222,7 @@
             long event_mask = 0;
             XWindowAttributes wattr = new XWindowAttributes();
             try {
-                XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
                 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
                                                               embedder, wattr.pData);
                 XToolkit.RESTORE_XERROR_HANDLER();
@@ -240,7 +240,7 @@
             }
 
             if ((event_mask & XConstants.PropertyChangeMask) == 0) {
-                XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
                 XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
                                          event_mask | XConstants.PropertyChangeMask);
                 XToolkit.RESTORE_XERROR_HANDLER();
@@ -394,7 +394,7 @@
 
             /* Restore the original event mask for the embedder. */
             if ((event_mask & XConstants.PropertyChangeMask) == 0) {
-                XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
                 XlibWrapper.XSelectInput(XToolkit.getDisplay(), embedder,
                                          event_mask);
                 XToolkit.RESTORE_XERROR_HANDLER();
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -301,7 +301,7 @@
         try {
             XWindowAttributes wattr = new XWindowAttributes();
             try {
-                XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+                XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
                 int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
                                                               xembed.handle, wattr.pData);
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -386,5 +386,7 @@
     public void setZOrder(ComponentPeer above) {
     }
 
-    public void updateGraphicsData(GraphicsConfiguration gc) {}
+    public boolean updateGraphicsData(GraphicsConfiguration gc) {
+        return false;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/solaris/classes/sun/awt/X11/XErrorHandler.java	Wed Jul 05 16:53:56 2017 +0200
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2009 Sun Microsystems, 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package sun.awt.X11;
+
+public abstract class XErrorHandler {
+
+    /*
+     * Called under AWT lock
+     */
+    public abstract int handleError(long display, XErrorEvent err);
+
+    /*
+     * Forwards all the errors to saved error handler (which was
+     * set before XToolkit had been initialized).
+     */
+    public static class XBaseErrorHandler extends XErrorHandler {
+        @Override
+        public int handleError(long display, XErrorEvent err) {
+            return XToolkit.SAVED_ERROR_HANDLER(display, err);
+        }
+    }
+
+    /*
+     * Instead of validating window id, we simply call XGetWindowProperty,
+     * but temporary install this function as the error handler to ignore
+     * BadWindow error.
+     */
+    public static class IgnoreBadWindowHandler extends XBaseErrorHandler {
+        @Override
+        public int handleError(long display, XErrorEvent err) {
+            if (err.get_error_code() == XConstants.BadWindow) {
+                return 0;
+            }
+            return super.handleError(display, err);
+        }
+        // Shared instance
+        private static IgnoreBadWindowHandler theInstance = new IgnoreBadWindowHandler();
+        public static IgnoreBadWindowHandler getInstance() {
+            return theInstance;
+        }
+    }
+
+    public static class VerifyChangePropertyHandler extends XBaseErrorHandler {
+        @Override
+        public int handleError(long display, XErrorEvent err) {
+            if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
+                return 0;
+            }
+            return super.handleError(display, err);
+        }
+        // Shared instance
+        private static IgnoreBadWindowHandler theInstance = new IgnoreBadWindowHandler();
+        public static IgnoreBadWindowHandler getInstance() {
+            return theInstance;
+        }
+    }
+}
--- a/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java	Wed Jul 05 16:53:56 2017 +0200
@@ -29,6 +29,9 @@
 import java.util.Hashtable;
 import sun.misc.Unsafe;
 
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
 public class XKeysym {
 
     public static void main( String args[] ) {
@@ -67,6 +70,7 @@
     static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
     static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
     static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
+    private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XKeysym");
     public static char convertKeysym( long ks, int state ) {
 
         /* First check for Latin-1 characters (1:1 mapping) */
@@ -107,8 +111,15 @@
                 // clearly means that caller needs a so called primary keysym.
                 mods ^= XConstants.ShiftMask;
             }
-            XlibWrapper.XkbTranslateKeyCode(XToolkit.getXKBKbdDesc(), ev.get_keycode(),
+            long kbdDesc = XToolkit.getXKBKbdDesc();
+            if( kbdDesc != 0 ) {
+                XlibWrapper.XkbTranslateKeyCode(kbdDesc, ev.get_keycode(),
                        mods, XlibWrapper.iarg1, XlibWrapper.larg3);
+            }else{
+                // xkb resources already gone
+                keyEventLog.fine("Thread race: Toolkit shutdown before the end of a key event processing.");
+                return 0;
+            }
             //XXX unconsumed modifiers?
             return Native.getLong(XlibWrapper.larg3);
         } finally {
--- a/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java	Wed Jul 05 16:53:56 2017 +0200
@@ -35,20 +35,6 @@
     private Map<XAtom, XAtomList> atomToList = new HashMap<XAtom, XAtomList>();
     private Map<XAtom, Long> atomToAnchor = new HashMap<XAtom, Long>();
 
-    /*
-     * Temporary error handler that ensures that we know if
-     * XChangeProperty succeeded or not.
-     */
-    static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
-            public int handleError(long display, XErrorEvent err) {
-                XToolkit.XERROR_SAVE(err);
-                if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
-                    return 0;
-                } else {
-                    return XToolkit.SAVED_ERROR_HANDLER(display, err);
-                }
-            }
-        };
     volatile boolean firstCheck = true;
     /*
      * Check that that the list of protocols specified by WM in property
--- a/jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XQueryTree.java	Wed Jul 05 16:53:56 2017 +0200
@@ -52,7 +52,7 @@
         public int execute() {
                 return execute(null);
         }
-        public int execute(XToolkit.XErrorHandler errorHandler) {
+        public int execute(XErrorHandler errorHandler) {
                 XToolkit.awtLock();
                 try {
                     if (isDisposed()) {
--- a/jdk/src/solaris/classes/sun/awt/X11/XRobotPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XRobotPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -81,16 +81,11 @@
         return pixelArray;
     }
 
-    public int getNumberOfButtons(){
-        return getNumberOfButtonsImpl();
-    }
-
     private static native synchronized void setup();
 
     private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
     private static native synchronized void mousePressImpl(int buttons);
     private static native synchronized void mouseReleaseImpl(int buttons);
-    private static native synchronized int getNumberOfButtonsImpl();
     private static native synchronized void mouseWheelImpl(int wheelAmt);
 
     private static native synchronized void keyPressImpl(int keycode);
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Wed Jul 05 16:53:56 2017 +0200
@@ -85,21 +85,6 @@
     private static boolean areExtraMouseButtonsEnabled = true;
 
     /**
-     * Number of buttons.
-     * By default it's taken from the system. If system value does not
-     * fit into int type range, use our own MAX_BUTTONS_SUPPORT value.
-     */
-    private static int numberOfButtons = 0;
-
-    /* XFree standard mention 24 buttons as maximum:
-     * http://www.xfree86.org/current/mouse.4.html
-     * We workaround systems supporting more than 24 buttons.
-     * Otherwise, we have to use long type values as masks
-     * which leads to API change.
-     */
-    private static int MAX_BUTTONS_SUPPORT = 24;
-
-    /**
      * True when the x settings have been loaded.
      */
     private boolean loadedXSettings;
@@ -149,63 +134,78 @@
             setBackingStoreType();
         }
         m_removeSourceEvents = SunToolkit.getMethod(EventQueue.class, "removeSourceEvents", new Class[] {Object.class, Boolean.TYPE}) ;
+
+        noisyAwtHandler = AccessController.doPrivileged(new GetBooleanAction("sun.awt.noisyerrorhandler"));
+    }
+
+    //---- ERROR HANDLER CODE ----//
+
+    /*
+     * Error handler at the moment of XToolkit initialization
+     */
+    private static long saved_error_handler;
+
+    /*
+     * XErrorEvent being handled
+     */
+    static volatile XErrorEvent saved_error;
+
+    /*
+     * Current error handler or null if no error handler is set
+     */
+    private static XErrorHandler current_error_handler;
+
+    /*
+     * Value of sun.awt.noisyerrorhandler system property
+     */
+    private static boolean noisyAwtHandler;
+
+    public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
+        saved_error = null;
+        current_error_handler = handler;
     }
 
-    // Error handler stuff
-    static XErrorEvent saved_error;
-    static long saved_error_handler;
-    static XErrorHandler curErrorHandler;
-    // Should be called under LOCK, before releasing LOCK RESTORE_XERROR_HANDLER should be called
-    static void WITH_XERROR_HANDLER(XErrorHandler handler) {
-        saved_error = null;
-        curErrorHandler = handler;
-        XSync();
-        saved_error_handler = XlibWrapper.SetToolkitErrorHandler();
+    public static void RESTORE_XERROR_HANDLER() {
+        current_error_handler = null;
     }
-    static void XERROR_SAVE(XErrorEvent event) {
-        saved_error = event;
-    }
+
     // Should be called under LOCK
-    static void RESTORE_XERROR_HANDLER() {
-       XSync();
-        XlibWrapper.XSetErrorHandler(saved_error_handler);
-        curErrorHandler = null;
-    }
-    // Should be called under LOCK
-    static int SAVED_ERROR_HANDLER(long display, XErrorEvent error) {
-        return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
+    public static int SAVED_ERROR_HANDLER(long display, XErrorEvent error) {
+        if (saved_error_handler != 0) {
+            // Default XErrorHandler may just terminate the process. Don't call it.
+            // return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
+        }
+        if (log.isLoggable(Level.FINE)) {
+            log.log(Level.FINE, "Unhandled XErrorEvent: " +
+                    "id=" + error.get_resourceid() + ", " +
+                    "serial=" + error.get_serial() + ", " +
+                    "ec=" + error.get_error_code() + ", " +
+                    "rc=" + error.get_request_code() + ", " +
+                    "mc=" + error.get_minor_code());
+        }
+        return 0;
     }
-    interface XErrorHandler {
-        int handleError(long display, XErrorEvent err);
-    }
-    static int GlobalErrorHandler(long display, long event_ptr) {
+
+    // Called from the native code when an error occurs
+    private static int globalErrorHandler(long display, long event_ptr) {
+        if (noisyAwtHandler) {
+            XlibWrapper.PrintXErrorEvent(display, event_ptr);
+        }
         XErrorEvent event = new XErrorEvent(event_ptr);
+        saved_error = event;
         try {
-            if (curErrorHandler != null) {
-                return curErrorHandler.handleError(display, event);
+            if (current_error_handler != null) {
+                return current_error_handler.handleError(display, event);
             } else {
                 return SAVED_ERROR_HANDLER(display, event);
             }
-        } finally {
+        } catch (Throwable z) {
+            log.log(Level.FINE, "Error in GlobalErrorHandler", z);
         }
+        return 0;
     }
 
-/*
- * Instead of validating window id, we simply call XGetWindowProperty,
- * but temporary install this function as the error handler to ignore
- * BadWindow error.
- */
-    static XErrorHandler IgnoreBadWindowHandler = new XErrorHandler() {
-            public int handleError(long display, XErrorEvent err) {
-                XERROR_SAVE(err);
-                if (err.get_error_code() == XConstants.BadWindow) {
-                    return 0;
-                } else {
-                    return SAVED_ERROR_HANDLER(display, err);
-                }
-            }
-        };
-
+    //---- END OF ERROR HANDLER CODE ----//
 
     private native static void initIDs();
     native static void waitForEvents(long nextTaskTime);
@@ -302,25 +302,34 @@
             areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
             //set system property if not yet assigned
             System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
+
+            saved_error_handler = XlibWrapper.SetToolkitErrorHandler();
         } finally {
             awtUnlock();
         }
 
         Runtime.getRuntime().addShutdownHook(new Thread() {
-                public void run() {
-                    XSystemTrayPeer peer = XSystemTrayPeer.getPeerInstance();
-                    if (peer != null) {
-                        peer.dispose();
-                    }
-                    if (xs != null) {
-                        ((XAWTXSettings)xs).dispose();
-                    }
-                    freeXKB();
-                    if (log.isLoggable(Level.FINE)) {
-                        dumpPeers();
-                    }
+            public void run() {
+                XSystemTrayPeer peer = XSystemTrayPeer.getPeerInstance();
+                if (peer != null) {
+                    peer.dispose();
+                }
+                if (xs != null) {
+                    ((XAWTXSettings)xs).dispose();
                 }
-            });
+                freeXKB();
+                if (log.isLoggable(Level.FINE)) {
+                    dumpPeers();
+                }
+
+                awtLock();
+                try {
+                    XlibWrapper.XSetErrorHandler(saved_error_handler);
+                } finally {
+                    awtUnlock();
+                }
+            }
+        });
     }
 
     static String getCorrectXIDString(String val) {
@@ -1434,19 +1443,26 @@
             desktopProperties.put("awt.multiClickInterval",
                                   Integer.valueOf(getMultiClickTime()));
             desktopProperties.put("awt.mouse.numButtons",
-                                  Integer.valueOf(getNumMouseButtons()));
+                                  Integer.valueOf(getNumberOfButtons()));
         }
     }
 
-    public static int getNumMouseButtons() {
+    /**
+     * This method runs through the XPointer and XExtendedPointer array.
+     * XExtendedPointer has priority because on some systems XPointer
+     * (which is assigned to the virtual pointer) reports the maximum
+     * capabilities of the mouse pointer (i.e. 32 physical buttons).
+     */
+    private native synchronized int getNumberOfButtonsImpl();
+
+    @Override
+    public int getNumberOfButtons(){
         awtLock();
         try {
             if (numberOfButtons == 0) {
-                numberOfButtons = Math.min(
-                    XlibWrapper.XGetPointerMapping(XToolkit.getDisplay(), 0, 0),
-                    MAX_BUTTONS_SUPPORT);
+                numberOfButtons = getNumberOfButtonsImpl();
             }
-            return numberOfButtons;
+            return (numberOfButtons > MAX_BUTTONS_SUPPORTED)? MAX_BUTTONS_SUPPORTED : numberOfButtons;
         } finally {
             awtUnlock();
         }
@@ -2239,6 +2255,7 @@
         try {
             if (awt_UseXKB_Calls && awt_XKBDescPtr != 0) {
                 XlibWrapper.XkbFreeKeyboard(awt_XKBDescPtr, 0xFF, true);
+                awt_XKBDescPtr = 0;
             }
         } finally {
             awtUnlock();
@@ -2409,8 +2426,6 @@
         return new XDesktopPeer();
     }
 
-    public static native void setNoisyXErrorHandler();
-
     public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
         return areExtraMouseButtonsEnabled;
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XTranslateCoordinates.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTranslateCoordinates.java	Wed Jul 05 16:53:56 2017 +0200
@@ -57,7 +57,7 @@
         public int execute() {
                 return execute(null);
         }
-        public int execute(XToolkit.XErrorHandler errorHandler) {
+        public int execute(XErrorHandler errorHandler) {
                 XToolkit.awtLock();
                 try {
                 if (isDisposed()) {
--- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Wed Jul 05 16:53:56 2017 +0200
@@ -276,7 +276,7 @@
             winmgr_running = false;
             substruct.set_event_mask(XConstants.SubstructureRedirectMask);
 
-            XToolkit.WITH_XERROR_HANDLER(DetectWMHandler);
+            XToolkit.WITH_XERROR_HANDLER(detectWMHandler);
             XlibWrapper.XChangeWindowAttributes(XToolkit.getDisplay(),
                                                 XToolkit.getDefaultRootWindow(),
                                                 XConstants.CWEventMask,
@@ -321,7 +321,7 @@
             new WindowPropertyGetter(window, XA_ENLIGHTENMENT_COMMS, 0, 14, false,
                                      XAtom.XA_STRING);
         try {
-            int status = getter.execute(XToolkit.IgnoreBadWindowHandler);
+            int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
             if (status != XConstants.Success || getter.getData() == 0) {
                 return 0;
             }
@@ -439,7 +439,7 @@
                 new WindowPropertyGetter(wmwin, XA_DT_SM_STATE_INFO, 0, 1,
                                          false, XA_DT_SM_STATE_INFO);
             try {
-                status = getter2.execute(XToolkit.IgnoreBadWindowHandler);
+                status = getter2.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
 
 
                 if (status != XConstants.Success || getter2.getData() == 0) {
@@ -571,21 +571,6 @@
     }
 
     /*
-     * Temporary error handler that ensures that we know if
-     * XChangeProperty succeeded or not.
-     */
-    static XToolkit.XErrorHandler VerifyChangePropertyHandler = new XToolkit.XErrorHandler() {
-            public int handleError(long display, XErrorEvent err) {
-                XToolkit.XERROR_SAVE(err);
-                if (err.get_request_code() == XProtocolConstants.X_ChangeProperty) {
-                    return 0;
-                } else {
-                    return XToolkit.SAVED_ERROR_HANDLER(display, err);
-                }
-            }
-        };
-
-    /*
      * Prepare IceWM check.
      *
      * The only way to detect IceWM, seems to be by setting
@@ -617,7 +602,7 @@
 
         XToolkit.awtLock();
         try {
-            XToolkit.WITH_XERROR_HANDLER(VerifyChangePropertyHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.VerifyChangePropertyHandler.getInstance());
             XlibWrapper.XChangePropertyS(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(),
                                          XA_ICEWM_WINOPTHINT.getAtom(),
                                          XA_ICEWM_WINOPTHINT.getAtom(),
@@ -682,20 +667,19 @@
      * Temporary error handler that checks if selecting for
      * SubstructureRedirect failed.
      */
-    static boolean winmgr_running = false;
-    static XToolkit.XErrorHandler DetectWMHandler = new XToolkit.XErrorHandler() {
-            public int handleError(long display, XErrorEvent err) {
-                XToolkit.XERROR_SAVE(err);
-                if (err.get_request_code() == XProtocolConstants.X_ChangeWindowAttributes
-                    && err.get_error_code() == XConstants.BadAccess)
-                {
-                    winmgr_running = true;
-                    return 0;
-                } else {
-                    return XToolkit.SAVED_ERROR_HANDLER(display, err);
-                }
+    private static boolean winmgr_running = false;
+    private static XErrorHandler detectWMHandler = new XErrorHandler.XBaseErrorHandler() {
+        @Override
+        public int handleError(long display, XErrorEvent err) {
+            if ((err.get_request_code() == XProtocolConstants.X_ChangeWindowAttributes) &&
+                (err.get_error_code() == XConstants.BadAccess))
+            {
+                winmgr_running = true;
+                return 0;
             }
-        };
+            return super.handleError(display, err);
+        }
+    };
 
     /*
      * Make an educated guess about running window manager.
--- a/jdk/src/solaris/classes/sun/awt/X11/XWarningWindow.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWarningWindow.java	Wed Jul 05 16:53:56 2017 +0200
@@ -34,74 +34,68 @@
 import sun.awt.SunToolkit;
 
 class XWarningWindow extends XWindow {
-    private final static int showingDelay = 330;
-    private final static int hidingDelay = 2000;
+    private final static int SHOWING_DELAY = 330;
+    private final static int HIDING_DELAY = 2000;
 
     private final Window ownerWindow;
     private WeakReference<XWindowPeer> ownerPeer;
-
-    public final Window getOwnerWindow() {
-        return ownerWindow;
-    }
     private long parentWindow;
 
     private final static String OWNER = "OWNER";
-
-    private static XIconInfo[][] icons;
-
     private InfoWindow.Tooltip tooltip;
 
-    private static synchronized XIconInfo getSecurityIconInfo(int size, int num) {
-        if (icons == null) {
-            icons = new XIconInfo[4][3];
-            if (XlibWrapper.dataModel == 32) {
-                icons[0][0] = new XIconInfo(XAWTIcon32_security_icon_bw16_png.security_icon_bw16_png);
-                icons[0][1] = new XIconInfo(XAWTIcon32_security_icon_interim16_png.security_icon_interim16_png);
-                icons[0][2] = new XIconInfo(XAWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png);
-                icons[1][0] = new XIconInfo(XAWTIcon32_security_icon_bw24_png.security_icon_bw24_png);
-                icons[1][1] = new XIconInfo(XAWTIcon32_security_icon_interim24_png.security_icon_interim24_png);
-                icons[1][2] = new XIconInfo(XAWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png);
-                icons[2][0] = new XIconInfo(XAWTIcon32_security_icon_bw32_png.security_icon_bw32_png);
-                icons[2][1] = new XIconInfo(XAWTIcon32_security_icon_interim32_png.security_icon_interim32_png);
-                icons[2][2] = new XIconInfo(XAWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png);
-                icons[3][0] = new XIconInfo(XAWTIcon32_security_icon_bw48_png.security_icon_bw48_png);
-                icons[3][1] = new XIconInfo(XAWTIcon32_security_icon_interim48_png.security_icon_interim48_png);
-                icons[3][2] = new XIconInfo(XAWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png);
-            } else {
-                icons[0][0] = new XIconInfo(XAWTIcon64_security_icon_bw16_png.security_icon_bw16_png);
-                icons[0][1] = new XIconInfo(XAWTIcon64_security_icon_interim16_png.security_icon_interim16_png);
-                icons[0][2] = new XIconInfo(XAWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png);
-                icons[1][0] = new XIconInfo(XAWTIcon64_security_icon_bw24_png.security_icon_bw24_png);
-                icons[1][1] = new XIconInfo(XAWTIcon64_security_icon_interim24_png.security_icon_interim24_png);
-                icons[1][2] = new XIconInfo(XAWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png);
-                icons[2][0] = new XIconInfo(XAWTIcon64_security_icon_bw32_png.security_icon_bw32_png);
-                icons[2][1] = new XIconInfo(XAWTIcon64_security_icon_interim32_png.security_icon_interim32_png);
-                icons[2][2] = new XIconInfo(XAWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png);
-                icons[3][0] = new XIconInfo(XAWTIcon64_security_icon_bw48_png.security_icon_bw48_png);
-                icons[3][1] = new XIconInfo(XAWTIcon64_security_icon_interim48_png.security_icon_interim48_png);
-                icons[3][2] = new XIconInfo(XAWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png);
+    /**
+     * Animation stage.
+     */
+    private volatile int currentIcon = 0;
+
+    /* -1 - uninitialized.
+     * 0 - 16x16
+     * 1 - 24x24
+     * 2 - 32x32
+     * 3 - 48x48
+     */
+    private int currentSize = -1;
+    private static XIconInfo[][] icons;
+    private static XIconInfo getSecurityIconInfo(int size, int num) {
+        synchronized (XWarningWindow.class) {
+            if (icons == null) {
+                icons = new XIconInfo[4][3];
+                if (XlibWrapper.dataModel == 32) {
+                    icons[0][0] = new XIconInfo(XAWTIcon32_security_icon_bw16_png.security_icon_bw16_png);
+                    icons[0][1] = new XIconInfo(XAWTIcon32_security_icon_interim16_png.security_icon_interim16_png);
+                    icons[0][2] = new XIconInfo(XAWTIcon32_security_icon_yellow16_png.security_icon_yellow16_png);
+                    icons[1][0] = new XIconInfo(XAWTIcon32_security_icon_bw24_png.security_icon_bw24_png);
+                    icons[1][1] = new XIconInfo(XAWTIcon32_security_icon_interim24_png.security_icon_interim24_png);
+                    icons[1][2] = new XIconInfo(XAWTIcon32_security_icon_yellow24_png.security_icon_yellow24_png);
+                    icons[2][0] = new XIconInfo(XAWTIcon32_security_icon_bw32_png.security_icon_bw32_png);
+                    icons[2][1] = new XIconInfo(XAWTIcon32_security_icon_interim32_png.security_icon_interim32_png);
+                    icons[2][2] = new XIconInfo(XAWTIcon32_security_icon_yellow32_png.security_icon_yellow32_png);
+                    icons[3][0] = new XIconInfo(XAWTIcon32_security_icon_bw48_png.security_icon_bw48_png);
+                    icons[3][1] = new XIconInfo(XAWTIcon32_security_icon_interim48_png.security_icon_interim48_png);
+                    icons[3][2] = new XIconInfo(XAWTIcon32_security_icon_yellow48_png.security_icon_yellow48_png);
+                } else {
+                    icons[0][0] = new XIconInfo(XAWTIcon64_security_icon_bw16_png.security_icon_bw16_png);
+                    icons[0][1] = new XIconInfo(XAWTIcon64_security_icon_interim16_png.security_icon_interim16_png);
+                    icons[0][2] = new XIconInfo(XAWTIcon64_security_icon_yellow16_png.security_icon_yellow16_png);
+                    icons[1][0] = new XIconInfo(XAWTIcon64_security_icon_bw24_png.security_icon_bw24_png);
+                    icons[1][1] = new XIconInfo(XAWTIcon64_security_icon_interim24_png.security_icon_interim24_png);
+                    icons[1][2] = new XIconInfo(XAWTIcon64_security_icon_yellow24_png.security_icon_yellow24_png);
+                    icons[2][0] = new XIconInfo(XAWTIcon64_security_icon_bw32_png.security_icon_bw32_png);
+                    icons[2][1] = new XIconInfo(XAWTIcon64_security_icon_interim32_png.security_icon_interim32_png);
+                    icons[2][2] = new XIconInfo(XAWTIcon64_security_icon_yellow32_png.security_icon_yellow32_png);
+                    icons[3][0] = new XIconInfo(XAWTIcon64_security_icon_bw48_png.security_icon_bw48_png);
+                    icons[3][1] = new XIconInfo(XAWTIcon64_security_icon_interim48_png.security_icon_interim48_png);
+                    icons[3][2] = new XIconInfo(XAWTIcon64_security_icon_yellow48_png.security_icon_yellow48_png);
+                }
             }
         }
         final int sizeIndex = size % icons.length;
         return icons[sizeIndex][num % icons[sizeIndex].length];
     }
 
-    private volatile int currentIcon = 0;
-
-    /* -1 - uninitialized yet
-     * 0 - 16x16
-     * 1 - 24x24
-     * 2 - 32x32
-     * 3 - 48x48
-     */
-    private volatile int currentSize = -1;
-
-    /** Indicates whether the shape of the window must be updated
-     */
-    private volatile boolean sizeUpdated = true;
-
-    private synchronized boolean updateIconSize() {
-        int newSize = currentSize;
+    private void updateIconSize() {
+        int newSize = -1;
 
         if (ownerWindow != null) {
             Insets insets = ownerWindow.getInsets();
@@ -117,14 +111,32 @@
                 newSize = 3;
             }
         }
-        if (newSize != currentSize) {
-            currentSize = newSize;
-            sizeUpdated = true;
+        // Make sure we have a valid size
+        if (newSize == -1) {
+            newSize = 0;
         }
-        return sizeUpdated;
+
+        // Note: this is not the most wise solution to use awtLock here,
+        // this should have been sync'ed with the stateLock. However,
+        // the awtLock must be taken first (see XBaseWindow.getStateLock()),
+        // and we need the awtLock anyway to update the shape of the icon.
+        // So it's easier to use just one lock instead.
+        XToolkit.awtLock();
+        try {
+            if (newSize != currentSize) {
+                currentSize = newSize;
+                XIconInfo ico = getSecurityIconInfo(currentSize, 0);
+                XlibWrapper.SetBitmapShape(XToolkit.getDisplay(), getWindow(),
+                        ico.getWidth(), ico.getHeight(), ico.getIntData());
+                AWTAccessor.getWindowAccessor().setSecurityWarningSize(
+                        ownerWindow, ico.getWidth(), ico.getHeight());
+            }
+        } finally {
+            XToolkit.awtUnlock();
+        }
     }
 
-    private synchronized XIconInfo getSecurityIconInfo() {
+    private XIconInfo getSecurityIconInfo() {
         updateIconSize();
         return getSecurityIconInfo(currentSize, currentIcon);
     }
@@ -183,28 +195,6 @@
         }
     }
 
-    private void updateWarningWindowBounds() {
-        XWindowPeer peer = ownerPeer.get();
-        if (peer != null) {
-            synchronized (this) {
-                if (updateIconSize()) {
-                    XIconInfo ico = getSecurityIconInfo();
-                    XToolkit.awtLock();
-                    try {
-                        XlibWrapper.SetBitmapShape(XToolkit.getDisplay(), getWindow(),
-                                ico.getWidth(), ico.getHeight(), ico.getIntData());
-                    } finally {
-                        XToolkit.awtUnlock();
-                    }
-                    sizeUpdated = false;
-                    AWTAccessor.getWindowAccessor().setSecurityWarningSize(
-                            ownerWindow, ico.getWidth(), ico.getHeight());
-                }
-            }
-            peer.repositionSecurityWarning();
-        }
-    }
-
     /**
      * @param x,y,w,h coordinates of the untrusted window
      */
@@ -376,25 +366,22 @@
 
     private final Runnable showingTask = new Runnable() {
         public void run() {
-            new Thread() {
-                public void run() {
-                    if (!isVisible()) {
-                        xSetVisible(true);
-                        updateWarningWindowBounds();
-                    }
-                    repaint();
-                    if (currentIcon > 0) {
-                        currentIcon--;
-                        XToolkit.schedule(showingTask, showingDelay);
-                    }
-                }}.start();
+            if (!isVisible()) {
+                xSetVisible(true);
+                updateIconSize();
+                XWindowPeer peer = ownerPeer.get();
+                if (peer != null) {
+                    peer.repositionSecurityWarning();
+                }
+            }
+            repaint();
+            if (currentIcon > 0) {
+                currentIcon--;
+                XToolkit.schedule(showingTask, SHOWING_DELAY);
+            }
         }
     };
 
-    public void setSecurityWarningVisible(boolean visible) {
-        setSecurityWarningVisible(visible, true);
-    }
-
     public void setSecurityWarningVisible(boolean visible, boolean doSchedule) {
         if (visible) {
             XToolkit.remove(hidingTask);
@@ -416,7 +403,7 @@
                 return;
             }
             if (doSchedule) {
-                XToolkit.schedule(hidingTask, hidingDelay);
+                XToolkit.schedule(hidingTask, HIDING_DELAY);
             } else {
                 hidingTask.run();
             }
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Wed Jul 05 16:53:56 2017 +0200
@@ -677,6 +677,14 @@
         int button=0;
         boolean wheel_mouse = false;
         int lbutton = xbe.get_button();
+        /*
+         * Ignore the buttons above 20 due to the bit limit for
+         * InputEvent.BUTTON_DOWN_MASK.
+         * One more bit is reserved for FIRST_HIGH_BIT.
+         */
+        if (lbutton > SunToolkit.MAX_BUTTONS_SUPPORTED) {
+            return;
+        }
         int type = xev.get_type();
         when = xbe.get_time();
         long jWhen = XToolkit.nowMillisUTC_offset(when);
@@ -795,8 +803,9 @@
         //this doesn't work for extra buttons because Xsystem is sending state==0 for every extra button event.
         // we can't correct it in MouseEvent class as we done it with modifiers, because exact type (DRAG|MOVE)
         // should be passed from XWindow.
-        //TODO: eliminate it with some other value obtained w/o AWTLock.
-        for (int i = 0; i < XToolkit.getNumMouseButtons(); i++){
+        final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
+
+        for (int i = 0; i < buttonsNumber; i++){
             // TODO : here is the bug in WM: extra buttons doesn't have state!=0 as they should.
             if ((i != 4) && (i != 5)) {
                 mouseKeyState = mouseKeyState | (xme.get_state() & XConstants.buttonsMask[i]);
@@ -1343,18 +1352,23 @@
         setSizeHints(flags, x, y, width, height);
     }
 
-      void validateSurface() {
+    void validateSurface() {
         if ((width != oldWidth) || (height != oldHeight)) {
-            SurfaceData oldData = surfaceData;
-            if (oldData != null) {
-                surfaceData = graphicsConfig.createSurfaceData(this);
-                oldData.invalidate();
-            }
+            doValidateSurface();
+
             oldWidth = width;
             oldHeight = height;
         }
     }
 
+    final void doValidateSurface() {
+        SurfaceData oldData = surfaceData;
+        if (oldData != null) {
+            surfaceData = graphicsConfig.createSurfaceData(this);
+            oldData.invalidate();
+        }
+    }
+
     public SurfaceData getSurfaceData() {
         return surfaceData;
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -1108,7 +1108,7 @@
             }
         }
 
-        warningWindow.setSecurityWarningVisible(show);
+        warningWindow.setSecurityWarningVisible(show, true);
     }
 
     boolean isOverrideRedirect() {
@@ -1894,7 +1894,9 @@
         }
         if (isGrabbed()) {
             boolean dragging = false;
-            for (int i = 0; i<XToolkit.getNumMouseButtons(); i++){
+            final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
+
+            for (int i = 0; i < buttonsNumber; i++){
                 // here is the bug in WM: extra buttons doesn't have state!=0 as they should.
                 if ((i != 4) && (i != 5)){
                     dragging = dragging || ((xme.get_state() & XConstants.buttonsMask[i]) != 0);
@@ -1940,6 +1942,15 @@
 
     public void handleButtonPressRelease(XEvent xev) {
         XButtonEvent xbe = xev.get_xbutton();
+
+        /*
+         * Ignore the buttons above 20 due to the bit limit for
+         * InputEvent.BUTTON_DOWN_MASK.
+         * One more bit is reserved for FIRST_HIGH_BIT.
+         */
+        if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
+            return;
+        }
         if (grabLog.isLoggable(Level.FINE)) {
             grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2} ({3}, {4}, {5}x{6})",
                         new Object[] {xbe, isGrabbed(), containsGlobal(xbe.get_x_root(), xbe.get_y_root()), getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()});
@@ -2058,7 +2069,7 @@
     }
 
     @Override
-    public void updateWindow(BufferedImage backBuffer) {
+    public void updateWindow() {
         // no-op
     }
 }
--- a/jdk/src/solaris/classes/sun/awt/X11/XlibUtil.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XlibUtil.java	Wed Jul 05 16:53:56 2017 +0200
@@ -149,7 +149,7 @@
                 new XTranslateCoordinates(src, dst, p.x, p.y);
             try
             {
-                int status = xtc.execute(XToolkit.IgnoreBadWindowHandler);
+                int status = xtc.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
                 if ((status != 0) &&
                     ((XToolkit.saved_error == null) ||
                      (XToolkit.saved_error.get_error_code() == XConstants.Success)))
@@ -306,7 +306,7 @@
                                          XWM.XA_WM_STATE);
             try
             {
-                wpg.execute(XToolkit.IgnoreBadWindowHandler);
+                wpg.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
                 if (wpg.getActualType() == XWM.XA_WM_STATE.getAtom())
                 {
                     return true;
@@ -345,7 +345,7 @@
         XWindowAttributes wattr = new XWindowAttributes();
         try
         {
-            XToolkit.WITH_XERROR_HANDLER(XToolkit.IgnoreBadWindowHandler);
+            XToolkit.WITH_XERROR_HANDLER(XErrorHandler.IgnoreBadWindowHandler.getInstance());
             int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
                                                           window, wattr.pData);
             XToolkit.RESTORE_XERROR_HANDLER();
--- a/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	Wed Jul 05 16:53:56 2017 +0200
@@ -646,4 +646,6 @@
         String javaVersion = XToolkit.getSystemProperty("java.version");
         return javaVersion != null && javaVersion.contains("internal");
     }
+
+    static native void PrintXErrorEvent(long display, long event_ptr);
 }
--- a/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386	Wed Jul 05 16:53:56 2017 +0200
@@ -186,6 +186,15 @@
 XEvent.xkeymap	0
 XEvent.pad	0
 XEvent	192
+XRenderDirectFormat.red	0
+XRenderDirectFormat.redMask	2
+XRenderDirectFormat.green	4
+XRenderDirectFormat.greenMask	6
+XRenderDirectFormat.blue	8
+XRenderDirectFormat.blueMask	10
+XRenderDirectFormat.alpha	12
+XRenderDirectFormat.alphaMask	14
+XRenderDirectFormat	16
 ColorData.awt_Colors	0
 ColorData.awt_numICMcolors	8
 ColorData.awt_icmLUT	16
@@ -440,6 +449,12 @@
 XSetWindowAttributes.colormap	96
 XSetWindowAttributes.cursor	104
 XSetWindowAttributes	112
+XRenderPictFormat.id	0
+XRenderPictFormat.type	8
+XRenderPictFormat.depth	12
+XRenderPictFormat.direct	16
+XRenderPictFormat.colormap	32
+XRenderPictFormat	40
 XReparentEvent.type	0
 XReparentEvent.serial	8
 XReparentEvent.send_event	16
@@ -985,7 +1000,8 @@
 AwtGraphicsConfigData.color_data	144
 AwtGraphicsConfigData.glxInfo	152
 AwtGraphicsConfigData.isTranslucencySupported	160
-AwtGraphicsConfigData	168
+AwtGraphicsConfigData.renderPictFormat	168
+AwtGraphicsConfigData	208
 XColor.pixel	0
 XColor.red	8
 XColor.green	10
--- a/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt	Wed Jul 05 16:53:56 2017 +0200
@@ -245,6 +245,21 @@
     blue_mask	long
     colormap_size	int
     bits_per_rgb	int
+XRenderDirectFormat
+    red         short
+    redMask     short
+    green       short
+    greenMask   short
+    blue        short
+    blueMask    short
+    alpha       short
+    alphaMask   short
+XRenderPictFormat
+    id          long
+    type        int
+    depth       int
+    direct      struct XRenderDirectFormat
+    colormap    long
 XIMHotKeyTrigger
     keysym	long
     modifier	int
@@ -751,6 +766,7 @@
     color_data pointer ColorData
     glxInfo pointer
     isTranslucencySupported int
+    renderPictFormat struct XRenderPictFormat
 
 AwtScreenData
     numConfigs int
--- a/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h	Wed Jul 05 16:53:56 2017 +0200
@@ -67,6 +67,9 @@
 tojava import java.util.Hashtable;
 tojava import sun.misc.Unsafe;
 tojava
+tojava import java.util.logging.Level;
+tojava import java.util.logging.Logger;
+tojava
 tojava public class XKeysym {
 tojava
 tojava     public static void main( String args[] ) {
@@ -105,6 +108,7 @@
 tojava     static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
 tojava     static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
 tojava     static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
+tojava     private static Logger keyEventLog = Logger.getLogger("sun.awt.X11.kye.XKeysym");
 tojava     public static char convertKeysym( long ks, int state ) {
 tojava
 tojava         /* First check for Latin-1 characters (1:1 mapping) */
@@ -145,8 +149,15 @@
 tojava                 // clearly means that caller needs a so called primary keysym.
 tojava                 mods ^= XConstants.ShiftMask;
 tojava             }
-tojava             XlibWrapper.XkbTranslateKeyCode(XToolkit.getXKBKbdDesc(), ev.get_keycode(),
+tojava             long kbdDesc = XToolkit.getXKBKbdDesc();
+tojava             if( kbdDesc != 0 ) {
+tojava                 XlibWrapper.XkbTranslateKeyCode(kbdDesc, ev.get_keycode(),
 tojava                        mods, XlibWrapper.iarg1, XlibWrapper.larg3);
+tojava             }else{
+tojava                 // xkb resources already gone
+tojava                 keyEventLog.fine("Thread race: Toolkit shutdown before the end of a key event processing.");
+tojava                 return 0;
+tojava             }
 tojava             //XXX unconsumed modifiers?
 tojava             return Native.getLong(XlibWrapper.larg3);
 tojava         } finally {
--- a/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java	Wed Jul 05 16:53:56 2017 +0200
@@ -37,7 +37,10 @@
 import java.awt.Transparency;
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
+import java.awt.color.ColorSpace;
+import java.awt.image.ComponentColorModel;
 import java.awt.image.DirectColorModel;
+import java.awt.image.DataBuffer;
 import java.awt.image.VolatileImage;
 import java.awt.image.WritableRaster;
 import java.awt.geom.AffineTransform;
@@ -230,6 +233,22 @@
         }
     }
 
+    public static DirectColorModel createDCM32(int rMask, int gMask, int bMask,
+                                               int aMask, boolean aPre) {
+        return new DirectColorModel(
+            ColorSpace.getInstance(ColorSpace.CS_sRGB),
+            32, rMask, gMask, bMask, aMask, aPre, DataBuffer.TYPE_INT);
+    }
+
+    public static ComponentColorModel createABGRCCM() {
+        ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
+        int[] nBits = {8, 8, 8, 8};
+        int[] bOffs = {3, 2, 1, 0};
+        return new ComponentColorModel(cs, nBits, true, true,
+                                       Transparency.TRANSLUCENT,
+                                       DataBuffer.TYPE_BYTE);
+    }
+
     /**
      * Returns the default Transform for this configuration.  This
      * Transform is typically the Identity transform for most normal
--- a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java	Wed Jul 05 16:53:56 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1995-2009 Sun Microsystems, 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
@@ -624,7 +624,6 @@
     }
 
     private native int getMulticlickTime();
-    private native int getNumMouseButtons();
 
     protected void initializeDesktopProperties() {
         desktopProperties.put("DnD.Autoscroll.initialDelay",     Integer.valueOf(50));
@@ -643,7 +642,7 @@
             desktopProperties.put("awt.multiClickInterval",
                                   Integer.valueOf(getMulticlickTime()));
             desktopProperties.put("awt.mouse.numButtons",
-                                  Integer.valueOf(getNumMouseButtons()));
+                                  Integer.valueOf(getNumberOfButtons()));
         }
     }
 
--- a/jdk/src/solaris/classes/sun/java2d/x11/X11PMBlitBgLoops.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/x11/X11PMBlitBgLoops.java	Wed Jul 05 16:53:56 2017 +0200
@@ -70,6 +70,10 @@
                                  X11SurfaceData.UShort565RgbX11),
             new X11PMBlitBgLoops(X11SurfaceData.UShortIndexedX11_BM,
                                  X11SurfaceData.UShortIndexedX11),
+            new X11PMBlitBgLoops(X11SurfaceData.IntRgbX11_BM,
+                                 X11SurfaceData.IntArgbPreX11),
+            new X11PMBlitBgLoops(X11SurfaceData.IntBgrX11_BM,
+                                 X11SurfaceData.FourByteAbgrPreX11),
         };
         GraphicsPrimitiveMgr.register(primitives);
     }
--- a/jdk/src/solaris/classes/sun/java2d/x11/X11PMBlitLoops.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/x11/X11PMBlitLoops.java	Wed Jul 05 16:53:56 2017 +0200
@@ -95,6 +95,22 @@
             new X11PMBlitLoops(X11SurfaceData.UShortIndexedX11_BM,
                                X11SurfaceData.UShortIndexedX11, true),
 
+            new X11PMBlitLoops(X11SurfaceData.IntRgbX11,
+                               X11SurfaceData.IntArgbPreX11, true),
+            new X11PMBlitLoops(X11SurfaceData.IntRgbX11,
+                               X11SurfaceData.IntArgbPreX11, false),
+            new X11PMBlitLoops(X11SurfaceData.IntRgbX11_BM,
+                               X11SurfaceData.IntArgbPreX11, true),
+
+            new X11PMBlitLoops(X11SurfaceData.IntBgrX11,
+                               X11SurfaceData.FourByteAbgrPreX11, true),
+            new X11PMBlitLoops(X11SurfaceData.IntBgrX11,
+                               X11SurfaceData.FourByteAbgrPreX11, false),
+            new X11PMBlitLoops(X11SurfaceData.IntBgrX11_BM,
+                               X11SurfaceData.FourByteAbgrPreX11, true),
+
+
+
             // delegate loops
             new DelegateBlitLoop(X11SurfaceData.IntBgrX11_BM,
                                  X11SurfaceData.IntBgrX11),
--- a/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Wed Jul 05 16:53:56 2017 +0200
@@ -81,6 +81,13 @@
         DESC_INT_BGR_X11        = "Integer BGR Pixmap";
     public static final String
         DESC_INT_RGB_X11        = "Integer RGB Pixmap";
+
+    public static final String
+        DESC_4BYTE_ABGR_PRE_X11 = "4 byte ABGR Pixmap with pre-multplied alpha";
+    public static final String
+        DESC_INT_ARGB_PRE_X11   = "Integer ARGB Pixmap with pre-multiplied " +
+                                  "alpha";
+
     public static final String
         DESC_BYTE_IND_OPQ_X11   = "Byte Indexed Opaque Pixmap";
 
@@ -133,6 +140,11 @@
     public static final SurfaceType IntRgbX11 =
         SurfaceType.IntRgb.deriveSubType(DESC_INT_RGB_X11);
 
+    public static final SurfaceType FourByteAbgrPreX11 =
+        SurfaceType.FourByteAbgrPre.deriveSubType(DESC_4BYTE_ABGR_PRE_X11);
+    public static final SurfaceType IntArgbPreX11 =
+        SurfaceType.IntArgbPre.deriveSubType(DESC_INT_ARGB_PRE_X11);
+
     public static final SurfaceType ThreeByteRgbX11 =
         SurfaceType.ThreeByteRgb.deriveSubType(DESC_3BYTE_RGB_X11);
     public static final SurfaceType ThreeByteBgrX11 =
@@ -413,7 +425,7 @@
                                                   int transparency)
     {
         return new X11PixmapSurfaceData(gc, width, height, image,
-                                        getSurfaceType(gc, transparency),
+                                        getSurfaceType(gc, transparency, true),
                                         cm, drawable, transparency);
     }
 
@@ -498,6 +510,13 @@
     public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
                                              int transparency)
     {
+        return getSurfaceType(gc, transparency, false);
+    }
+
+    public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
+                                             int transparency,
+                                             boolean pixmapSurface)
+    {
         boolean transparent = (transparency == Transparency.BITMASK);
         SurfaceType sType;
         ColorModel cm = gc.getColorModel();
@@ -524,11 +543,21 @@
             // Fall through for 32 bit case
         case 32:
             if (cm instanceof DirectColorModel) {
-                if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
-                    sType = transparent ? X11SurfaceData.IntRgbX11_BM : X11SurfaceData.IntRgbX11;
+                if (((SunToolkit)java.awt.Toolkit.getDefaultToolkit()
+                     ).isTranslucencyCapable(gc) && !pixmapSurface)
+                {
+                    sType = X11SurfaceData.IntArgbPreX11;
                 } else {
-                    sType = transparent ? X11SurfaceData.IntBgrX11_BM : X11SurfaceData.IntBgrX11;
+                    if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
+                        sType = transparent ? X11SurfaceData.IntRgbX11_BM :
+                                              X11SurfaceData.IntRgbX11;
+                    } else {
+                        sType = transparent ? X11SurfaceData.IntBgrX11_BM :
+                                              X11SurfaceData.IntBgrX11;
+                    }
                 }
+            } else if (cm instanceof ComponentColorModel) {
+                   sType = X11SurfaceData.FourByteAbgrPreX11;
             } else {
 
                 throw new sun.java2d.InvalidPipeException("Unsupported bit " +
--- a/jdk/src/solaris/native/sun/awt/X11Color.c	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/native/sun/awt/X11Color.c	Wed Jul 05 16:53:56 2017 +0200
@@ -886,6 +886,27 @@
 #define blue(v)         (((v) >>  0) & 0xFF)
 
 #ifndef HEADLESS
+
+jobject getColorSpace(JNIEnv* env, jint csID) {
+    jclass clazz;
+    jobject cspaceL;
+    jmethodID mid;
+
+    clazz = (*env)->FindClass(env,"java/awt/color/ColorSpace");
+    mid = (*env)->GetStaticMethodID(env, clazz, "getInstance",
+                                    "(I)Ljava/awt/color/ColorSpace;");
+    if (mid == NULL) {
+        return NULL;
+    }
+
+    /* SECURITY: This is safe, because static methods cannot
+     *           be overridden, and this method does not invoke
+     *           client code
+     */
+
+    return (*env)->CallStaticObjectMethod(env, clazz, mid, csID);
+}
+
 jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData)
 {
     jobject awt_colormodel = NULL;
@@ -899,21 +920,61 @@
         (aData->awt_depth >= 15))
     {
         clazz = (*env)->FindClass(env,"java/awt/image/DirectColorModel");
+        if (!aData->isTranslucencySupported) {
 
-        mid = (*env)->GetMethodID(env,clazz,"<init>","(IIIII)V");
+            mid = (*env)->GetMethodID(env,clazz,"<init>","(IIIII)V");
+
+            if (mid == NULL) {
+                (*env)->PopLocalFrame(env, 0);
+                return NULL;
+            }
+            awt_colormodel = (*env)->NewObject(env,clazz, mid,
+                    aData->awt_visInfo.depth,
+                    aData->awt_visInfo.red_mask,
+                    aData->awt_visInfo.green_mask,
+                    aData->awt_visInfo.blue_mask,
+                    0);
+        } else {
+            clazz = (*env)->FindClass(env,"sun/awt/X11GraphicsConfig");
+            if (clazz == NULL) {
+                (*env)->PopLocalFrame(env, 0);
+                return NULL;
+            }
+
+            if (aData->renderPictFormat.direct.red == 16) {
+                mid = (*env)->GetStaticMethodID( env,clazz,"createDCM32",
+                        "(IIIIZ)Ljava/awt/image/DirectColorModel;");
 
-        if (mid == NULL) {
-            (*env)->PopLocalFrame(env, 0);
-            return NULL;
+                if (mid == NULL) {
+                    (*env)->PopLocalFrame(env, 0);
+                    return NULL;
+                }
+
+                awt_colormodel = (*env)->CallStaticObjectMethod(
+                        env,clazz, mid,
+                        aData->renderPictFormat.direct.redMask
+                            << aData->renderPictFormat.direct.red,
+                        aData->renderPictFormat.direct.greenMask
+                            << aData->renderPictFormat.direct.green,
+                        aData->renderPictFormat.direct.blueMask
+                            << aData->renderPictFormat.direct.blue,
+                        aData->renderPictFormat.direct.alphaMask
+                            << aData->renderPictFormat.direct.alpha,
+                        JNI_TRUE);
+            } else {
+                mid = (*env)->GetStaticMethodID( env,clazz,"createABGRCCM",
+                        "()Ljava/awt/image/ComponentColorModel;");
+
+                if (mid == NULL) {
+                    (*env)->PopLocalFrame(env, 0);
+                    return NULL;
+                }
+
+                awt_colormodel = (*env)->CallStaticObjectMethod(
+                        env,clazz, mid);
+            }
         }
 
-        awt_colormodel = (*env)->NewObject(env,clazz, mid,
-                                           aData->awt_visInfo.depth,
-                                           aData->awt_visInfo.red_mask,
-                                           aData->awt_visInfo.green_mask,
-                                           aData->awt_visInfo.blue_mask,
-                                           0);
-
         if(awt_colormodel == NULL)
         {
             (*env)->PopLocalFrame(env, 0);
@@ -923,25 +984,13 @@
     }
     else if (aData->awt_visInfo.class == StaticGray &&
              aData->awt_num_colors == 256) {
-        jclass clazz1;
         jobject cspace = NULL;
         jint bits[1];
         jintArray bitsArray;
         jboolean falseboolean = JNI_FALSE;
 
-        clazz1 = (*env)->FindClass(env,"java/awt/color/ColorSpace");
-        mid = (*env)->GetStaticMethodID(env, clazz1, "getInstance",
-              "(I)Ljava/awt/color/ColorSpace;");
-        if (mid == NULL) {
-            (*env)->PopLocalFrame(env, 0);
-            return NULL;
-        }
-        /* SECURITY: This is safe, because static methods cannot
-         *           be overridden, and this method does not invoke
-         *           client code
-         */
-        cspace = (*env)->CallStaticObjectMethod(env, clazz1, mid,
-            java_awt_color_ColorSpace_CS_GRAY);
+        cspace = getColorSpace(env, java_awt_color_ColorSpace_CS_GRAY);
+
         if (cspace == NULL) {
             (*env)->PopLocalFrame(env, 0);
             return NULL;
--- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Wed Jul 05 16:53:56 2017 +0200
@@ -175,42 +175,11 @@
 }
 
 #ifndef HEADLESS
+
 /*
- * error handlers
+ * XIOErrorHandler
  */
-
-int
-xerror_handler(Display * disp, XErrorEvent * err)
-{
-/* #ifdef DEBUG */
-    char msg[128];
-    char buf[128];
-    char *ev = getenv("NOISY_AWT");
-
-    if (!ev || !ev[0])
-        return 0;
-    XGetErrorText(disp, err->error_code, msg, sizeof(msg));
-    jio_fprintf(stderr, "Xerror %s, XID %x, ser# %d\n", msg, err->resourceid, err->serial);
-    jio_snprintf(buf, sizeof(buf), "%d", err->request_code);
-    XGetErrorDatabaseText(disp, "XRequest", buf, "Unknown", msg, sizeof(msg));
-    jio_fprintf(stderr, "Major opcode %d (%s)\n", err->request_code, msg);
-    if (err->request_code > 128) {
-        jio_fprintf(stderr, "Minor opcode %d\n", err->minor_code);
-    }
-    if (awtLockInited) {
-        /*SignalError(lockedee->lastpc, lockedee, "fp/ade/gui/GUIException", msg); */
-    }
-    if (strcasecmp(ev, "abort") == 0) {
-        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-
-        (*env)->FatalError(env, "xerror_handler abort");
-    }
-/* #endif */
-    return 0;
-}
-
-static int
-xioerror_handler(Display * disp)
+static int xioerror_handler(Display *disp)
 {
     if (awtLockInited) {
         if (errno == EPIPE) {
@@ -354,48 +323,6 @@
     return NULL;
 }
 
-/* Note: until we include the <X11/extensions/Xrender.h> explicitly
- * we have to define a couple of things ourselves.
- */
-typedef unsigned long   PictFormat;
-#define PictTypeIndexed             0
-#define PictTypeDirect              1
-
-typedef struct {
-    short   red;
-    short   redMask;
-    short   green;
-    short   greenMask;
-    short   blue;
-    short   blueMask;
-    short   alpha;
-    short   alphaMask;
-} XRenderDirectFormat;
-
-typedef struct {
-    PictFormat      id;
-    int         type;
-    int         depth;
-    XRenderDirectFormat direct;
-    Colormap        colormap;
-} XRenderPictFormat;
-
-#define PictFormatID        (1 << 0)
-#define PictFormatType      (1 << 1)
-#define PictFormatDepth     (1 << 2)
-#define PictFormatRed       (1 << 3)
-#define PictFormatRedMask   (1 << 4)
-#define PictFormatGreen     (1 << 5)
-#define PictFormatGreenMask (1 << 6)
-#define PictFormatBlue      (1 << 7)
-#define PictFormatBlueMask  (1 << 8)
-#define PictFormatAlpha     (1 << 9)
-#define PictFormatAlphaMask (1 << 10)
-#define PictFormatColormap  (1 << 11)
-
-typedef XRenderPictFormat *
-XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
-
 static void
 getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
 
@@ -535,6 +462,8 @@
                 format->direct.alphaMask)
             {
                 graphicsConfigs [ind]->isTranslucencySupported = 1;
+                memcpy(&graphicsConfigs [ind]->renderPictFormat, format,
+                        sizeof(*format));
             }
         }
     }
@@ -886,7 +815,6 @@
         return NULL;
     }
 
-    XSetErrorHandler(xerror_handler);
     XSetIOErrorHandler(xioerror_handler);
 
     /* set awt_numScreens, and whether or not we're using Xinerama */
--- a/jdk/src/solaris/native/sun/awt/awt_InputMethod.c	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_InputMethod.c	Wed Jul 05 16:53:56 2017 +0200
@@ -1458,7 +1458,6 @@
 }
 
 static void OpenXIMCallback(Display *display, XPointer client_data, XPointer call_data) {
-    extern int xerror_handler();
     XIMCallback ximCallback;
 
     X11im = XOpenIM(display, NULL, NULL, NULL);
@@ -1469,13 +1468,6 @@
     ximCallback.callback = (XIMProc)DestroyXIMCallback;
     ximCallback.client_data = NULL;
     XSetIMValues(X11im, XNDestroyCallback, &ximCallback, NULL);
-
-    /* Workaround for Solaris 2.6 bug 4097754. We're affected by this problem
-     * because Motif also calls XOpenIM for us. Re-registering the error handler
-     * that MToolkit has registered already after calling XOpenIM avoids the
-     * problem.
-     */
-    XSetErrorHandler(xerror_handler);
 }
 
 static void DestroyXIMCallback(XIM im, XPointer client_data, XPointer call_data) {
--- a/jdk/src/solaris/native/sun/awt/awt_MToolkit.c	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_MToolkit.c	Wed Jul 05 16:53:56 2017 +0200
@@ -1926,26 +1926,6 @@
               XtAppProcessEvent(awt_appContext, iMask & ~XtIMXEvent);
             }
 
-            /*
-            ** Bug #4361799: Forte4J sometimes crashes on Solaris:
-            ** There is an underlying bug in Selection.c in Xt lib.
-            ** The routine HandleSelectionEvents, can call EndProtectedSection()
-            ** more than  StartProtectedSection(), and then EndProtectedSection
-            ** will restore the default XError handler.  As a result awt's
-            ** XError handler gets removed and we later crash on an XError.
-            **
-            ** This happens when we call XtAppProcessEvent with event type 1e
-            ** (SelectionRequest) when running two copies of Forte
-            **
-            ** XSetErrorHandler can safely be called repeatedly, so we are
-            ** fixing this with the sledgehammer, and resetting our XError
-            ** handler every time through the loop:
-            */
-            {
-                extern int32_t xerror_handler();
-                XSetErrorHandler(xerror_handler);
-            }
-
 } /* processOneEvent() */
 
 /*
@@ -3188,21 +3168,6 @@
 
 /*
  * Class:     sun_awt_motif_MToolkit
- * Method:    getNumMouseButtons
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_sun_awt_motif_MToolkit_getNumMouseButtons
-  (JNIEnv *env, jobject this)
-{
-    jint res = 0;
-    AWT_LOCK();
-    res = XGetPointerMapping(awt_display, NULL, 0);
-    AWT_UNLOCK();
-    return res;
-}
-
-/*
- * Class:     sun_awt_motif_MToolkit
  * Method:    loadXSettings
  * Signature: ()V
  */
--- a/jdk/src/solaris/native/sun/awt/awt_Robot.c	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_Robot.c	Wed Jul 05 16:53:56 2017 +0200
@@ -51,9 +51,8 @@
 
 extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
 
-// 2 would be more correct, however that's how Robot originally worked
-// and tests start to fail if this value is changed
-static int32_t num_buttons = 3;
+extern int32_t getNumButtons();
+
 static jint * masks;
 
 static int32_t isXTestAvailable() {
@@ -90,46 +89,6 @@
     return isXTestAvailable;
 }
 
-static void getNumButtons() {
-    int32_t major_opcode, first_event, first_error;
-    int32_t xinputAvailable;
-    int32_t numDevices, devIdx, clsIdx;
-    XDeviceInfo* devices;
-    XDeviceInfo* aDevice;
-    XButtonInfo* bInfo;
-
-    /* 4700242:
-     * If XTest is asked to press a non-existant mouse button
-     * (i.e. press Button3 on a system configured with a 2-button mouse),
-     * then a crash may happen.  To avoid this, we use the XInput
-     * extension to query for the number of buttons on the XPointer, and check
-     * before calling XTestFakeButtonEvent().
-     */
-    xinputAvailable = XQueryExtension(awt_display, INAME, &major_opcode, &first_event, &first_error);
-    DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
-                    major_opcode, first_event, first_error);
-    if (xinputAvailable) {
-        devices = XListInputDevices(awt_display, &numDevices);
-        for (devIdx = 0; devIdx < numDevices; devIdx++) {
-            aDevice = &(devices[devIdx]);
-            if (aDevice->use == IsXPointer) {
-                for (clsIdx = 0; clsIdx < aDevice->num_classes; clsIdx++) {
-                    if (aDevice->inputclassinfo[clsIdx].class == ButtonClass) {
-                        bInfo = (XButtonInfo*)(&(aDevice->inputclassinfo[clsIdx]));
-                        num_buttons = bInfo->num_buttons;
-                        DTRACE_PRINTLN1("RobotPeer: XPointer has %d buttons", num_buttons);
-                        break;
-                    }
-                }
-                break;
-            }
-        }
-        XFreeDeviceList(devices);
-    }
-    else {
-        DTRACE_PRINTLN1("RobotPeer: XINPUT extension is unavailable, assuming %d mouse buttons", num_buttons);
-    }
-}
 
 static XImage *getWindowImage(Display * display, Window window,
                               int32_t x, int32_t y,
@@ -241,17 +200,10 @@
         return;
     }
 
-    getNumButtons();
     finally:
     AWT_UNLOCK();
 }
 
-JNIEXPORT jint JNICALL
-Java_sun_awt_X11_XRobotPeer_getNumberOfButtonsImpl(JNIEnv *env,
-                                                   jclass cls) {
-    // At the moment this routine being called we already should have an initialized num_buttons variable.
-    return num_buttons;
-}
 
 JNIEXPORT void JNICALL
 Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
@@ -386,6 +338,8 @@
 {
     AWT_LOCK();
 
+    int32_t num_buttons = getNumButtons(); //from XToolkit.c
+
     DTRACE_PRINTLN1("RobotPeer: mouseAction(%i)", buttonMask);
     DTRACE_PRINTLN1("RobotPeer: mouseAction, press = %d", isMousePress);
 
--- a/jdk/src/solaris/native/sun/awt/awt_p.h	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/native/sun/awt/awt_p.h	Wed Jul 05 16:53:56 2017 +0200
@@ -119,6 +119,50 @@
 } DamageRect;
 
 #ifndef HEADLESS
+
+/* Note: until we include the <X11/extensions/Xrender.h> explicitly
+ * we have to define a couple of things ourselves.
+ */
+typedef unsigned long   PictFormat;
+#define PictTypeIndexed             0
+#define PictTypeDirect              1
+
+typedef struct {
+    short   red;
+    short   redMask;
+    short   green;
+    short   greenMask;
+    short   blue;
+    short   blueMask;
+    short   alpha;
+    short   alphaMask;
+} XRenderDirectFormat;
+
+typedef struct {
+    PictFormat      id;
+    int         type;
+    int         depth;
+    XRenderDirectFormat direct;
+    Colormap        colormap;
+} XRenderPictFormat;
+
+#define PictFormatID        (1 << 0)
+#define PictFormatType      (1 << 1)
+#define PictFormatDepth     (1 << 2)
+#define PictFormatRed       (1 << 3)
+#define PictFormatRedMask   (1 << 4)
+#define PictFormatGreen     (1 << 5)
+#define PictFormatGreenMask (1 << 6)
+#define PictFormatBlue      (1 << 7)
+#define PictFormatBlueMask  (1 << 8)
+#define PictFormatAlpha     (1 << 9)
+#define PictFormatAlphaMask (1 << 10)
+#define PictFormatColormap  (1 << 11)
+
+typedef XRenderPictFormat *
+XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
+/* END OF Xrender.h chunk */
+
 typedef struct _AwtGraphicsConfigData  {
     int         awt_depth;
     Colormap    awt_cmap;
@@ -136,6 +180,7 @@
     ColorData      *color_data;
     struct _GLXGraphicsConfigInfo *glxInfo;
     int         isTranslucencySupported; /* Uses Xrender to find this out. */
+    XRenderPictFormat renderPictFormat; /*Used only if translucency supported*/
 } AwtGraphicsConfigData;
 
 typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr;
--- a/jdk/src/solaris/native/sun/xawt/XToolkit.c	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c	Wed Jul 05 16:53:56 2017 +0200
@@ -45,10 +45,14 @@
 #include "sun_awt_X11_XToolkit.h"
 #include "java_awt_SystemColor.h"
 #include "java_awt_TrayIcon.h"
+#include <X11/extensions/XTest.h>
 
 uint32_t awt_NumLockMask = 0;
 Boolean  awt_ModLockIsShiftLock = False;
 
+static int32_t num_buttons = 0;
+int32_t getNumButtons();
+
 extern JavaVM *jvm;
 
 // Tracing level
@@ -575,7 +579,6 @@
         pollFds[1].revents = 0;
     }
 
-
     AWT_NOFLUSH_UNLOCK();
 
     /* ACTUALLY DO THE POLL() */
@@ -684,8 +687,6 @@
     return ret;
 }
 
-static XErrorHandler saved_error_handler = NULL;
-
 #ifdef __linux__
 void print_stack(void)
 {
@@ -706,38 +707,6 @@
 }
 #endif
 
-static int NoisyXErrorHandler(Display * dpy, XErrorEvent * event) {
-    fprintf(stderr, "id=%x, serial=%x, ec=%d, rc=%d, mc=%d\n",
-            event->resourceid, event->serial, event->error_code,
-            event->request_code, event->minor_code);
-    /*
-    #ifdef __linux__
-        print_stack();
-    #endif
-    */
-    if (jvm != NULL) {
-      JNIEnv * env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-      JNU_CallStaticMethodByName(env, NULL, "java/lang/Thread", "dumpStack", "()V");
-    }
-    if (!saved_error_handler) {
-        return saved_error_handler(dpy, event);
-    }
-    return 0;
-}
-
-/*
- * Class:     sun_awt_X11_XToolkit
- * Method:    setNoisyXErrorHandler
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_XToolkit_setNoisyXErrorHandler
-(JNIEnv *env , jclass clazz)
-{
-    (*env)->GetJavaVM(env, &jvm);
-    saved_error_handler = XSetErrorHandler(NoisyXErrorHandler);
-}
-
-
 Window get_xawt_root_shell(JNIEnv *env) {
   static jclass classXRootWindow = NULL;
   static jmethodID methodGetXRootWindow = NULL;
@@ -943,3 +912,80 @@
         AWT_UNLOCK();
     }
 }
+
+
+/*
+ * Class:     sun_awt_X11_XToolkit
+ * Method:    getNumberOfButtonsImpl
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl
+(JNIEnv * env, jobject cls){
+    if (num_buttons == 0) {
+        num_buttons = getNumButtons();
+    }
+    return num_buttons;
+}
+
+int32_t getNumButtons() {
+    int32_t major_opcode, first_event, first_error;
+    int32_t xinputAvailable;
+    int32_t numDevices, devIdx, clsIdx;
+    XDeviceInfo* devices;
+    XDeviceInfo* aDevice;
+    XButtonInfo* bInfo;
+    int32_t local_num_buttons = 0;
+
+    /* 4700242:
+     * If XTest is asked to press a non-existant mouse button
+     * (i.e. press Button3 on a system configured with a 2-button mouse),
+     * then a crash may happen.  To avoid this, we use the XInput
+     * extension to query for the number of buttons on the XPointer, and check
+     * before calling XTestFakeButtonEvent().
+     */
+    xinputAvailable = XQueryExtension(awt_display, INAME, &major_opcode, &first_event, &first_error);
+    DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
+                    major_opcode, first_event, first_error);
+    if (xinputAvailable) {
+        devices = XListInputDevices(awt_display, &numDevices);
+        for (devIdx = 0; devIdx < numDevices; devIdx++) {
+            aDevice = &(devices[devIdx]);
+#ifdef IsXExtensionPointer
+            if (aDevice->use == IsXExtensionPointer) {
+                for (clsIdx = 0; clsIdx < aDevice->num_classes; clsIdx++) {
+                    if (aDevice->inputclassinfo[clsIdx].class == ButtonClass) {
+                        bInfo = (XButtonInfo*)(&(aDevice->inputclassinfo[clsIdx]));
+                        local_num_buttons = bInfo->num_buttons;
+                        DTRACE_PRINTLN1("RobotPeer: XPointer has %d buttons", num_buttons);
+                        break;
+                    }
+                }
+                break;
+            }
+#endif
+            if (local_num_buttons <= 0 ) {
+                if (aDevice->use == IsXPointer) {
+                    for (clsIdx = 0; clsIdx < aDevice->num_classes; clsIdx++) {
+                        if (aDevice->inputclassinfo[clsIdx].class == ButtonClass) {
+                            bInfo = (XButtonInfo*)(&(aDevice->inputclassinfo[clsIdx]));
+                            local_num_buttons = bInfo->num_buttons;
+                            DTRACE_PRINTLN1("RobotPeer: XPointer has %d buttons", num_buttons);
+                            break;
+                        }
+                    }
+                    break;
+                }
+            }
+        }
+
+        XFreeDeviceList(devices);
+    }
+    else {
+        DTRACE_PRINTLN1("RobotPeer: XINPUT extension is unavailable, assuming %d mouse buttons", num_buttons);
+    }
+    if (local_num_buttons == 0 ) {
+        local_num_buttons = 3;
+    }
+
+    return local_num_buttons;
+}
--- a/jdk/src/solaris/native/sun/xawt/XlibWrapper.c	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/solaris/native/sun/xawt/XlibWrapper.c	Wed Jul 05 16:53:56 2017 +0200
@@ -1186,7 +1186,7 @@
 static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) {
     if (jvm != NULL) {
         JNIEnv * env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-        return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit", "GlobalErrorHandler", "(JJ)I",
+        return JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit", "globalErrorHandler", "(JJ)I",
                                           ptr_to_jlong(dpy), ptr_to_jlong(event)).i;
     } else {
         return 0;
@@ -1229,6 +1229,28 @@
     return (*(XErrorHandler)jlong_to_ptr(handler))((Display*) jlong_to_ptr(display), (XErrorEvent*) jlong_to_ptr(event_ptr));
 }
 
+/*
+ * Class:     sun_awt_X11_XlibWrapper
+ * Method:    PrintXErrorEvent
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_PrintXErrorEvent
+(JNIEnv *env, jclass clazz, jlong display, jlong event_ptr)
+{
+    char msg[128];
+    char buf[128];
+
+    XErrorEvent* err = (XErrorEvent *)jlong_to_ptr(event_ptr);
+
+    XGetErrorText((Display *)jlong_to_ptr(display), err->error_code, msg, sizeof(msg));
+    jio_fprintf(stderr, "Xerror %s, XID %x, ser# %d\n", msg, err->resourceid, err->serial);
+    jio_snprintf(buf, sizeof(buf), "%d", err->request_code);
+    XGetErrorDatabaseText((Display *)jlong_to_ptr(display), "XRequest", buf, "Unknown", msg, sizeof(msg));
+    jio_fprintf(stderr, "Major opcode %d (%s)\n", err->request_code, msg);
+    if (err->request_code > 128) {
+        jio_fprintf(stderr, "Minor opcode %d\n", err->minor_code);
+    }
+}
 
 
 /*
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java	Wed Jul 05 16:53:56 2017 +0200
@@ -527,7 +527,7 @@
     /**
      * @return Whether this is a file system shell folder
      */
-    public synchronized boolean isFileSystem() {
+    public boolean isFileSystem() {
         if (cachedIsFileSystem == null) {
             cachedIsFileSystem = hasAttribute(ATTRIB_FILESYSTEM);
         }
@@ -543,8 +543,8 @@
             public Boolean call() throws Exception {
                 // Caching at this point doesn't seem to be cost efficient
                 return (getAttributes0(getParentIShellFolder(),
-                        getRelativePIDL(), attribute)
-                        & attribute) != 0;
+                    getRelativePIDL(), attribute)
+                    & attribute) != 0;
             }
         });
     }
@@ -761,7 +761,7 @@
     /**
      * @return Whether this shell folder is a link
      */
-    public synchronized boolean isLink() {
+    public boolean isLink() {
         if (cachedIsLink == null) {
             cachedIsLink = hasAttribute(ATTRIB_LINK);
         }
@@ -1160,8 +1160,16 @@
     private static native int compareIDsByColumn(long pParentIShellFolder, long pidl1, long pidl2, int columnIdx);
 
 
-    public void sortChildren(List<? extends File> files) {
-        Collections.sort(files, new ColumnComparator(getIShellFolder(), 0));
+    public void sortChildren(final List<? extends File> files) {
+        // To avoid loads of synchronizations with Invoker and improve performance we
+        // synchronize the whole code of the sort method once
+        getInvoker().invoke(new Callable<Void>() {
+            public Void call() throws Exception {
+                Collections.sort(files, new ColumnComparator(getIShellFolder(), 0));
+
+                return null;
+            }
+        });
     }
 
     private static class ColumnComparator implements Comparator<File> {
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Wed Jul 05 16:53:56 2017 +0200
@@ -478,21 +478,22 @@
 
         public <T> T invoke(Callable<T> task) {
             try {
-                T result;
                 if (Thread.currentThread() == comThread) {
                     // if it's already called from the COM
                     // thread, we don't need to delegate the task
-                    result = task.call();
+                    return task.call();
                 } else {
-                    Future<T> future = submit(task);
-                    try {
-                        result = future.get();
-                    } catch (InterruptedException e) {
-                        result = null;
-                        future.cancel(true);
+                    while (true) {
+                        Future<T> future = submit(task);
+
+                        try {
+                            return future.get();
+                        } catch (InterruptedException e) {
+                            // Repeat the attempt
+                            future.cancel(true);
+                        }
                     }
                 }
-                return result;
             } catch (Exception e) {
                 Throwable cause = (e instanceof ExecutionException) ? e.getCause() : e;
                 if (cause instanceof RuntimeException) {
--- a/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Wed Jul 05 16:53:56 2017 +0200
@@ -105,9 +105,10 @@
     }
 
     /**
-     * Creates (if needed), clears and returns the buffer for this painter.
+     * Creates (if needed), clears (if requested) and returns the buffer
+     * for this painter.
      */
-    protected abstract Image getBackBuffer();
+    protected abstract Image getBackBuffer(boolean clear);
 
     /**
      * Updates the the window associated with this painter with the contents
@@ -123,31 +124,16 @@
     public abstract void flush();
 
     /**
-     * Updates the window associated with the painter given the passed image.
-     * If the passed image is null the painter will use its own buffer for
-     * rendering the contents of the window into it and updating the window.
+     * Updates the window associated with the painter.
      *
-     * If the passed buffer has dimensions different from the window, it is
-     * copied into the internal buffer first and the latter is used to update
-     * the window.
-     *
-     * @param bb the image to update the non opaque window with, or null.
-     * If not null, the image must be of ARGB_PRE type.
+     * @param repaint indicates if the window should be completely repainted
+     * to the back buffer using {@link java.awt.Window#paintAll} before update.
      */
-    public void updateWindow(Image bb) {
+    public void updateWindow(boolean repaint) {
         boolean done = false;
-        if (bb != null && (window.getWidth()  != bb.getWidth(null) ||
-                           window.getHeight() != bb.getHeight(null)))
-        {
-            Image ourBB = getBackBuffer();
-            Graphics2D g = (Graphics2D)ourBB.getGraphics();
-            g.drawImage(bb, 0, 0, null);
-            g.dispose();
-            bb = ourBB;
-        }
-        do {
-            if (bb == null) {
-                bb = getBackBuffer();
+        Image bb = getBackBuffer(repaint);
+        while (!done) {
+            if (repaint) {
                 Graphics2D g = (Graphics2D)bb.getGraphics();
                 try {
                     window.paintAll(g);
@@ -156,17 +142,12 @@
                 }
             }
 
-            peer.paintAppletWarning((Graphics2D)bb.getGraphics(),
-                                    bb.getWidth(null), bb.getHeight(null));
-
             done = update(bb);
-            // in case they passed us a lost VI, next time around we'll use our
-            // own bb because we can not validate and restore the contents of
-            // their VI
             if (!done) {
-                bb = null;
+                repaint = true;
+                bb = getBackBuffer(true);
             }
-        } while (!done);
+        }
     }
 
     private static final Image clearImage(Image bb) {
@@ -190,30 +171,24 @@
      * method (VI, BI, regular Images).
      */
     private static class BIWindowPainter extends TranslucentWindowPainter {
-        private WeakReference<BufferedImage> biRef;
+        private BufferedImage backBuffer;
 
         protected BIWindowPainter(WWindowPeer peer) {
             super(peer);
         }
 
-        private BufferedImage getBIBackBuffer() {
+        @Override
+        protected Image getBackBuffer(boolean clear) {
             int w = window.getWidth();
             int h = window.getHeight();
-            BufferedImage bb = biRef == null ? null : biRef.get();
-            if (bb == null || bb.getWidth() != w || bb.getHeight() != h) {
-                if (bb != null) {
-                    bb.flush();
-                    bb = null;
-                }
-                bb = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
-                biRef = new WeakReference<BufferedImage>(bb);
+            if (backBuffer == null ||
+                backBuffer.getWidth() != w ||
+                backBuffer.getHeight() != h)
+            {
+                flush();
+                backBuffer = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
             }
-            return (BufferedImage)clearImage(bb);
-        }
-
-        @Override
-        protected Image getBackBuffer() {
-            return getBIBackBuffer();
+            return clear ? (BufferedImage)clearImage(backBuffer) : backBuffer;
         }
 
         @Override
@@ -246,10 +221,7 @@
             }
 
             // copy the passed image into our own buffer, then upload
-            BufferedImage bi = getBIBackBuffer();
-            Graphics2D g = (Graphics2D)bi.getGraphics();
-            g.setComposite(AlphaComposite.Src);
-            g.drawImage(bb, 0, 0, null);
+            BufferedImage bi = (BufferedImage)clearImage(backBuffer);
 
             int data[] =
                 ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
@@ -259,8 +231,9 @@
         }
 
         public void flush() {
-            if (biRef != null) {
-                biRef.clear();
+            if (backBuffer != null) {
+                backBuffer.flush();
+                backBuffer = null;
             }
         }
     }
@@ -271,27 +244,22 @@
      * Java heap-based buffer (which is then uploaded to the layered window)
      */
     private static class VIWindowPainter extends BIWindowPainter {
-        private WeakReference<VolatileImage> viRef;
+        private VolatileImage viBB;
 
         protected VIWindowPainter(WWindowPeer peer) {
             super(peer);
         }
 
         @Override
-        protected Image getBackBuffer() {
+        protected Image getBackBuffer(boolean clear) {
             int w = window.getWidth();
             int h = window.getHeight();
             GraphicsConfiguration gc = peer.getGraphicsConfiguration();
 
-            VolatileImage viBB = viRef == null ? null : viRef.get();
-
             if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
                 viBB.validate(gc) == IMAGE_INCOMPATIBLE)
             {
-                if (viBB != null) {
-                    viBB.flush();
-                    viBB = null;
-                }
+                flush();
 
                 if (gc instanceof AccelGraphicsConfig) {
                     AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
@@ -303,21 +271,16 @@
                     viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
                 }
                 viBB.validate(gc);
-                viRef = new WeakReference<VolatileImage>(viBB);
             }
 
-            return clearImage(viBB);
+            return clear ? clearImage(viBB) : viBB;
         }
 
         @Override
         public void flush() {
-            if (viRef != null) {
-                VolatileImage viBB = viRef.get();
-                if (viBB != null) {
-                    viBB.flush();
-                    viBB = null;
-                }
-                viRef.clear();
+            if (viBB != null) {
+                viBB.flush();
+                viBB = null;
             }
         }
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -78,25 +78,6 @@
         super.paint(g);
     }
 
-    public void print(Graphics g) {
-        if (!(target instanceof Window) ||
-            AWTAccessor.getWindowAccessor().isOpaque((Window)target))
-        {
-            Dimension d = ((Component)target).getSize();
-            if (g instanceof Graphics2D ||
-                g instanceof sun.awt.Graphics2Delegate) {
-                // background color is setup correctly, so just use clearRect
-                g.clearRect(0, 0, d.width, d.height);
-            } else {
-                // emulate clearRect
-                g.setColor(((Component)target).getBackground());
-                g.fillRect(0, 0, d.width, d.height);
-                g.setColor(((Component)target).getForeground());
-            }
-        }
-        super.print(g);
-    }
-
     public boolean shouldClearRectBeforePaint() {
         return eraseBackground;
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -239,7 +239,8 @@
 
     private static final double BANDING_DIVISOR = 4.0;
     private native int[] createPrintedPixels(int srcX, int srcY,
-                                             int srcW, int srcH);
+                                             int srcW, int srcH,
+                                             int alpha);
     public void print(Graphics g) {
 
         Component comp = (Component)target;
@@ -261,7 +262,9 @@
             }
             int h = endY - startY + 1;
 
-            int[] pix = createPrintedPixels(0, startY, totalW, h);
+            Color bgColor = comp.getBackground();
+            int[] pix = createPrintedPixels(0, startY, totalW, h,
+                                            bgColor == null ? 255 : bgColor.getAlpha());
             if (pix != null) {
                 BufferedImage bim = new BufferedImage(totalW, h,
                                               BufferedImage.TYPE_INT_ARGB);
@@ -488,13 +491,14 @@
         }
     }
 
-    public void updateGraphicsData(GraphicsConfiguration gc) {
+    public boolean updateGraphicsData(GraphicsConfiguration gc) {
         winGraphicsConfig = (Win32GraphicsConfig)gc;
         try {
             replaceSurfaceData();
         } catch (InvalidPipeException e) {
             // REMIND : what do we do if our surface creation failed?
         }
+        return false;
     }
 
     //This will return null for Components not yet added to a Container
--- a/jdk/src/windows/classes/sun/awt/windows/WObjectPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WObjectPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -42,6 +42,9 @@
     // set from JNI if any errors in creating the peer occur
     protected Error createError = null;
 
+    // used to synchronize the state of this peer
+    private final Object stateLock = new Object();
+
     public static WObjectPeer getPeerForTarget(Object t) {
         WObjectPeer peer = (WObjectPeer) WToolkit.targetToPeer(t);
         return peer;
@@ -55,6 +58,10 @@
         return target;
     }
 
+    public final Object getStateLock() {
+        return stateLock;
+    }
+
     /*
      * Subclasses should override disposeImpl() instead of dispose(). Client
      * code should always invoke dispose(), never disposeImpl().
--- a/jdk/src/windows/classes/sun/awt/windows/WRobotPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WRobotPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -60,8 +60,6 @@
     }
     public native int getRGBPixelImpl(int x, int y);
 
-    public native int getNumberOfButtons();
-
     public int [] getRGBPixels(Rectangle bounds) {
         int pixelArray[] = new int[bounds.width*bounds.height];
         getRGBPixels(bounds.x, bounds.y, bounds.width, bounds.height, pixelArray);
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Wed Jul 05 16:53:56 2017 +0200
@@ -982,6 +982,16 @@
         return areExtraMouseButtonsEnabled;
     }
 
+    private native synchronized int getNumberOfButtonsImpl();
+
+    @Override
+    public int getNumberOfButtons(){
+        if (numberOfButtons == 0) {
+            numberOfButtons = getNumberOfButtonsImpl();
+        }
+        return (numberOfButtons > MAX_BUTTONS_SUPPORTED)? MAX_BUTTONS_SUPPORTED : numberOfButtons;
+    }
+
     @Override
     public boolean isWindowOpacitySupported() {
         // supported in Win2K and later
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Wed Jul 05 16:53:56 2017 +0200
@@ -54,7 +54,7 @@
 
     private boolean isOpaque;
 
-    private volatile TranslucentWindowPainter painter;
+    private TranslucentWindowPainter painter;
 
     /*
      * A key used for storing a list of active windows in AppContext. The value
@@ -106,11 +106,13 @@
         GraphicsConfiguration gc = getGraphicsConfiguration();
         ((Win32GraphicsDevice)gc.getDevice()).removeDisplayChangedListener(this);
 
-        TranslucentWindowPainter currentPainter = painter;
-        if (currentPainter != null) {
-            currentPainter.flush();
-            // don't set the current one to null here; reduces the chances of
-            // MT issues (like NPEs)
+        synchronized (getStateLock()) {
+            TranslucentWindowPainter currentPainter = painter;
+            if (currentPainter != null) {
+                currentPainter.flush();
+                // don't set the current one to null here; reduces the chances of
+                // MT issues (like NPEs)
+            }
         }
 
         super.disposeImpl();
@@ -178,9 +180,23 @@
 
         updateIconImages();
 
-        updateShape();
-        updateOpacity();
-        updateOpaque();
+        Shape shape = ((Window)target).getShape();
+        if (shape != null) {
+            applyShape(Region.getInstance(shape, null));
+        }
+
+        float opacity = ((Window)target).getOpacity();
+        if (opacity < 1.0f) {
+            setOpacity(opacity);
+        }
+
+        synchronized (getStateLock()) {
+            // default value of a boolean field is 'false', so set isOpaque to
+            // true here explicitly
+            this.isOpaque = true;
+            Color bgColor = ((Window)target).getBackground();
+            setOpaque((bgColor == null) || (bgColor.getAlpha() == 255));
+        }
     }
 
     native void createAwtWindow(WComponentPeer parent);
@@ -214,7 +230,11 @@
             setAlwaysOnTop(alwaysOnTop);
         }
 
-        updateWindow(null);
+        synchronized (getStateLock()) {
+            if (!isOpaque) {
+                updateWindow(true);
+            }
+        }
     }
 
     // Synchronize the insets members (here & in helper) with actual window
@@ -334,29 +354,6 @@
         }
     }
 
-    private void updateShape() {
-        Shape shape = ((Window)target).getShape();
-        if (shape != null) {
-            applyShape(Region.getInstance(shape, null));
-        }
-    }
-
-    private void updateOpacity() {
-        float opacity = ((Window)target).getOpacity();
-        if (opacity < 1.0f) {
-            setOpacity(opacity);
-        }
-    }
-
-    private void updateOpaque() {
-        this.isOpaque = true;
-        // boolean opaque = ((Window)target).isOpaque();
-        boolean opaque = AWTAccessor.getWindowAccessor().isOpaque((Window)target);
-        if (!opaque) {
-            setOpaque(opaque);
-        }
-    }
-
     native void setMinSize(int width, int height);
 
 /*
@@ -579,6 +576,26 @@
         }
     }
 
+    @Override
+    public Graphics getGraphics() {
+        synchronized (getStateLock()) {
+            if (!isOpaque) {
+                return painter.getBackBuffer(false).getGraphics();
+            }
+        }
+        return super.getGraphics();
+    }
+
+    @Override
+    public void setBackground(Color c) {
+        super.setBackground(c);
+        synchronized (getStateLock()) {
+            if (!isOpaque && ((Window)target).isVisible()) {
+                updateWindow(true);
+            }
+        }
+    }
+
     private native void setOpacity(int iOpacity);
 
     public void setOpacity(float opacity) {
@@ -600,12 +617,23 @@
         }
 
         setOpacity(iOpacity);
-        updateWindow(null);
+
+        synchronized (getStateLock()) {
+            if (!isOpaque && ((Window)target).isVisible()) {
+                updateWindow(true);
+            }
+        }
     }
 
     private native void setOpaqueImpl(boolean isOpaque);
 
     public void setOpaque(boolean isOpaque) {
+        synchronized (getStateLock()) {
+            if (this.isOpaque == isOpaque) {
+                return;
+            }
+        }
+
         Window target = (Window)getTarget();
 
         if (!isOpaque) {
@@ -617,20 +645,17 @@
             }
         }
 
-        boolean opaqueChanged = this.isOpaque != isOpaque;
         boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS();
 
-        if (opaqueChanged && !isVistaOS){
+        if (!isVistaOS) {
             // non-Vista OS: only replace the surface data if the opacity
             // status changed (see WComponentPeer.isAccelCapable() for more)
             replaceSurfaceDataRecursively(target);
         }
 
-        this.isOpaque = isOpaque;
-
-        setOpaqueImpl(isOpaque);
-
-        if (opaqueChanged) {
+        synchronized (getStateLock()) {
+            this.isOpaque = isOpaque;
+            setOpaqueImpl(isOpaque);
             if (isOpaque) {
                 TranslucentWindowPainter currentPainter = painter;
                 if (currentPainter != null) {
@@ -642,7 +667,7 @@
             }
         }
 
-        if (opaqueChanged && isVistaOS) {
+        if (isVistaOS) {
             // On Vista: setting the window non-opaque makes the window look
             // rectangular, though still catching the mouse clicks within
             // its shape only. To restore the correct visual appearance
@@ -654,42 +679,33 @@
             }
         }
 
-        updateWindow(null);
+        if (((Window)target).isVisible()) {
+            updateWindow(true);
+        }
     }
 
     public native void updateWindowImpl(int[] data, int width, int height);
 
-    public void updateWindow(BufferedImage backBuffer) {
-        if (isOpaque) {
-            return;
-        }
-
-        Component target = (Component)this.target;
-        if (target.getWidth() <= 0 || target.getHeight() <= 0) {
-            return;
-        }
-
-        TranslucentWindowPainter currentPainter = painter;
-        if (currentPainter != null) {
-            currentPainter.updateWindow(backBuffer);
-        } else if (log.isLoggable(Level.FINER)) {
-            log.log(Level.FINER,
-                    "Translucent window painter is null in updateWindow");
-        }
+    public void updateWindow() {
+        updateWindow(false);
     }
 
-    /**
-     * Paints the Applet Warning into the passed Graphics2D. This method is
-     * called by the TranslucentWindowPainter before updating the layered
-     * window.
-     *
-     * @param g Graphics context to paint the warning to
-     * @param w the width of the area
-     * @param h the height of the area
-     * @see TranslucentWindowPainter
-     */
-    public void paintAppletWarning(Graphics2D g, int w, int h) {
-        // REMIND: the applet warning needs to be painted here
+    private void updateWindow(boolean repaint) {
+        Window w = (Window)target;
+        synchronized (getStateLock()) {
+            if (isOpaque || !w.isVisible() ||
+                (w.getWidth() <= 0) || (w.getHeight() <= 0))
+            {
+                return;
+            }
+            TranslucentWindowPainter currentPainter = painter;
+            if (currentPainter != null) {
+                currentPainter.updateWindow(repaint);
+            } else if (log.isLoggable(Level.FINER)) {
+                log.log(Level.FINER,
+                        "Translucent window painter is null in updateWindow");
+            }
+        }
     }
 
     /*
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp	Wed Jul 05 16:53:56 2017 +0200
@@ -30,6 +30,7 @@
 
 #include "jlong.h"
 #include "awt_AWTEvent.h"
+#include "awt_BitmapUtil.h"
 #include "awt_Component.h"
 #include "awt_Cursor.h"
 #include "awt_Dimension.h"
@@ -127,6 +128,7 @@
     jobject component;
     int srcx, srcy;
     int srcw, srch;
+    jint alpha;
 };
 // Struct for _SetRectangularShape() method
 struct SetRectangularShapeStruct {
@@ -361,8 +363,8 @@
 AwtComponent* AwtComponent::GetComponentImpl(HWND hWnd) {
     AwtComponent *component =
         (AwtComponent *)::GetWindowLongPtr(hWnd, GWLP_USERDATA);
-    DASSERT( !IsBadReadPtr(component, sizeof(AwtComponent)) );
-    DASSERT( component->GetHWnd() == hWnd );
+    DASSERT(!component || !IsBadReadPtr(component, sizeof(AwtComponent)) );
+    DASSERT(!component || component->GetHWnd() == hWnd );
     return component;
 }
 
@@ -1918,11 +1920,14 @@
           mr = mrConsume;
           break;
       }
-      case WM_AWT_CREATE_PRINTED_PIXELS:
-          retValue = (LRESULT)CreatePrintedPixels(*((SIZE *)wParam),
-                                                  *((SIZE *)lParam));
+      case WM_AWT_CREATE_PRINTED_PIXELS: {
+          CreatePrintedPixelsStruct* cpps = (CreatePrintedPixelsStruct*)wParam;
+          SIZE loc = { cpps->srcx, cpps->srcy };
+          SIZE size = { cpps->srcw, cpps->srch };
+          retValue = (LRESULT)CreatePrintedPixels(loc, size, cpps->alpha);
           mr = mrConsume;
           break;
+      }
       case WM_UNDOCUMENTED_CLICKMENUBAR:
       {
           if (::IsWindow(AwtWindow::GetModalBlocker(GetHWnd()))) {
@@ -4526,18 +4531,20 @@
 
 void AwtComponent::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
 {
-    if (bitmapBits) {
-        DWORD* dest = (DWORD*)bitmapBits;
-        //XXX: might be optimized to use one loop (cy*cx -> 0).
-        for (int i = 0; i < size.cy; i++ ) {
-            for (int j = 0; j < size.cx; j++ ) {
-                ((BYTE*)(dest++))[3] = alpha;
-            }
+    if (!bitmapBits) {
+        return;
+    }
+
+    DWORD* dest = (DWORD*)bitmapBits;
+    //XXX: might be optimized to use one loop (cy*cx -> 0)
+    for (int i = 0; i < size.cy; i++ ) {
+        for (int j = 0; j < size.cx; j++ ) {
+            ((BYTE*)(dest++))[3] = alpha;
         }
     }
 }
 
-jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size) {
+jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size, int alpha) {
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 
     if (!::IsWindowVisible(GetHWnd())) {
@@ -4549,12 +4556,12 @@
         return NULL;
     }
     HDC hMemoryDC = ::CreateCompatibleDC(hdc);
-    HBITMAP hBitmap = ::CreateCompatibleBitmap(hdc, size.cx, size.cy);
+    void *bitmapBits = NULL;
+    HBITMAP hBitmap = BitmapUtil::CreateARGBBitmap(size.cx, size.cy, &bitmapBits);
     HBITMAP hOldBitmap = (HBITMAP)::SelectObject(hMemoryDC, hBitmap);
     SendMessage(WM_AWT_RELEASEDC, (WPARAM)hdc);
 
-    RECT eraseR = { 0, 0, size.cx, size.cy };
-    VERIFY(::FillRect(hMemoryDC, &eraseR, GetBackgroundBrush()));
+    FillBackground(hMemoryDC, size);
 
     VERIFY(::SetWindowOrgEx(hMemoryDC, loc.cx, loc.cy, NULL));
 
@@ -4562,6 +4569,14 @@
     // above.
     SendMessage(WM_PRINT, (WPARAM)hMemoryDC, PRF_CLIENT | PRF_NONCLIENT);
 
+    // First make sure the system completed any drawing to the bitmap.
+    ::GdiFlush();
+
+    // WM_PRINT does not fill the alpha-channel of the ARGB bitmap
+    // leaving it equal to zero. Hence we need to fill it manually. Otherwise
+    // the pixels will be considered transparent when interpreting the data.
+    FillAlpha(bitmapBits, size, alpha);
+
     ::SelectObject(hMemoryDC, hOldBitmap);
 
     BITMAPINFO bmi;
@@ -5937,10 +5952,6 @@
 
     CreatePrintedPixelsStruct *cpps = (CreatePrintedPixelsStruct *)param;
     jobject self = cpps->component;
-    jint srcx = cpps->srcx;
-    jint srcy = cpps->srcy;
-    jint srcw = cpps->srcw;
-    jint srch = cpps->srch;
 
     jintArray result = NULL;
     AwtComponent *c = NULL;
@@ -5950,12 +5961,7 @@
     c = (AwtComponent *)pData;
     if (::IsWindow(c->GetHWnd()))
     {
-        SIZE loc = { srcx, srcy };
-        SIZE size = { srcw, srch };
-
-        result = (jintArray)
-            c->SendMessage(WM_AWT_CREATE_PRINTED_PIXELS, (WPARAM)&loc,
-                          (LPARAM)&size);
+        result = (jintArray)c->SendMessage(WM_AWT_CREATE_PRINTED_PIXELS, (WPARAM)cpps, 0);
     }
 ret:
     env->DeleteGlobalRef(self);
@@ -6749,7 +6755,7 @@
  */
 JNIEXPORT jintArray JNICALL
 Java_sun_awt_windows_WComponentPeer_createPrintedPixels(JNIEnv* env,
-    jobject self, jint srcX, jint srcY, jint srcW, jint srcH)
+    jobject self, jint srcX, jint srcY, jint srcW, jint srcH, jint alpha)
 {
     TRY;
 
@@ -6761,6 +6767,7 @@
     cpps->srcy = srcY;
     cpps->srcw = srcW;
     cpps->srch = srcH;
+    cpps->alpha = alpha;
 
     jintArray globalRef = (jintArray)AwtToolkit::GetInstance().SyncCall(
         (void*(*)(void*))AwtComponent::_CreatePrintedPixels, cpps);
--- a/jdk/src/windows/native/sun/windows/awt_Component.h	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Component.h	Wed Jul 05 16:53:56 2017 +0200
@@ -596,7 +596,7 @@
 
     void UpdateColorModel();
 
-    jintArray CreatePrintedPixels(SIZE &loc, SIZE &size);
+    jintArray CreatePrintedPixels(SIZE &loc, SIZE &size, int alpha);
 
     /*
      * HWND, AwtComponent and Java Peer interaction
@@ -738,7 +738,6 @@
     virtual void SetDragCapture(UINT flags);
     virtual void ReleaseDragCapture(UINT flags);
 
-    //These functions are overridden in AwtWindow to handle non-opaque windows.
     virtual void FillBackground(HDC hMemoryDC, SIZE &size);
     virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
 
--- a/jdk/src/windows/native/sun/windows/awt_Robot.cpp	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Robot.cpp	Wed Jul 05 16:53:56 2017 +0200
@@ -437,9 +437,3 @@
 
     CATCH_BAD_ALLOC;
 }
-
-JNIEXPORT jint JNICALL Java_sun_awt_windows_WRobotPeer_getNumberOfButtons(
-  JNIEnv *, jobject self)
-{
-    return GetSystemMetrics(SM_CMOUSEBUTTONS);
-}
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Wed Jul 05 16:53:56 2017 +0200
@@ -2259,3 +2259,8 @@
 void AwtToolkit::setExtraMouseButtonsEnabled(BOOL enable) {
     m_areExtraMouseButtonsEnabled = enable;
 }
+
+JNIEXPORT jint JNICALL Java_sun_awt_windows_WToolkit_getNumberOfButtonsImpl
+(JNIEnv *, jobject self) {
+    return GetSystemMetrics(SM_CMOUSEBUTTONS);
+}
--- a/jdk/src/windows/native/sun/windows/awt_Window.cpp	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Window.cpp	Wed Jul 05 16:53:56 2017 +0200
@@ -464,7 +464,7 @@
         size_t length = env->GetStringLength(javaWarningString) + 1;
         warningString = new WCHAR[length];
         env->GetStringRegion(javaWarningString, 0,
-                static_cast<jsize>(length - 1), warningString);
+                static_cast<jsize>(length - 1), reinterpret_cast<jchar*>(warningString));
         warningString[length-1] = L'\0';
 
         env->DeleteLocalRef(javaWarningString);
@@ -2651,20 +2651,6 @@
     ::LeaveCriticalSection(&contentBitmapCS);
 }
 
-void AwtWindow::FillBackground(HDC hMemoryDC, SIZE &size)
-{
-    if (isOpaque()) {
-        AwtCanvas::FillBackground(hMemoryDC, size);
-    }
-}
-
-void AwtWindow::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
-{
-    if (isOpaque()) {
-        AwtCanvas::FillAlpha(bitmapBits, size, alpha);
-    }
-}
-
 /*
  * Fixed 6353381: it's improved fix for 4792958
  * which was backed-out to avoid 5059656
--- a/jdk/src/windows/native/sun/windows/awt_Window.h	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Window.h	Wed Jul 05 16:53:56 2017 +0200
@@ -343,11 +343,6 @@
     BOOL m_iconInherited;     /* TRUE if icon is inherited from the owner */
     BOOL m_filterFocusAndActivation; /* Used in the WH_CBT hook */
 
-    //These are used in AwtComponent::CreatePrintedPixels. They are overridden
-    //here to handle non-opaque windows.
-    virtual void FillBackground(HDC hMemoryDC, SIZE &size);
-    virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
-
     inline BOOL IsUntrusted() {
         return warningString != NULL;
     }
--- a/jdk/test/Makefile	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/test/Makefile	Wed Jul 05 16:53:56 2017 +0200
@@ -189,6 +189,7 @@
           $(shell $(GETMIXEDPATH) "$(JTREG)")                                \
             -a -v:fail,error                                                 \
 	    -ignore:quiet                                                    \
+	    -timeoutFactor:2                                                 \
             $(EXTRA_JTREG_OPTIONS)                                           \
             -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport    \
             -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork      \
--- a/jdk/test/java/lang/ThreadGroup/NullThreadName.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/test/java/lang/ThreadGroup/NullThreadName.java	Wed Jul 05 16:53:56 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 6576763
+ * @ignore until hotspot 6776144 bug is resolved
  * @summary (thread) Thread constructors throw undocumented NPE for null name
  */
 
--- a/jdk/test/java/util/ResourceBundle/RestrictedBundleTest.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/test/java/util/ResourceBundle/RestrictedBundleTest.java	Wed Jul 05 16:53:56 2017 +0200
@@ -23,6 +23,7 @@
 /**
  * @test
  * @bug 4126805
+ * @ignore until 6842022 is resolved
  * @run applet RestrictedBundleTest.html
  * @summary I was able to reproduce this bug with 1.2b2, but not with the current 1.2
  * build.  It appears that it was fixed by changes to the class-loading mechanism,
--- a/jdk/test/java/util/WeakHashMap/GCDuringIteration.java	Tue May 19 17:39:30 2009 -0700
+++ b/jdk/test/java/util/WeakHashMap/GCDuringIteration.java	Wed Jul 05 16:53:56 2017 +0200
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 6499848
+ * @ignore until 6842353 is resolved
  * @summary Check that iterators work properly in the presence of
  *          concurrent finalization and removal of elements.
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComponent/6683775/bug6683775.java	Wed Jul 05 16:53:56 2017 +0200
@@ -0,0 +1,82 @@
+/* @test
+   @bug 6683775 6794764
+   @summary Painting artifacts is seen when panel is made setOpaque(false) for a translucent window
+   @author Alexander Potochkin
+   @run main bug6683775
+*/
+
+import com.sun.awt.AWTUtilities;
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+public class bug6683775 {
+    public static void main(String[] args) throws Exception {
+        GraphicsConfiguration gc = getGC();
+        if (!AWTUtilities.isTranslucencySupported(
+                AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT)
+                || gc == null) {
+            return;
+        }
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        final JFrame testFrame = new JFrame(gc);
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                JFrame backgroundFrame = new JFrame("Background frame");
+                backgroundFrame.setUndecorated(true);
+                JPanel panel = new JPanel();
+                panel.setBackground(Color.RED);
+                backgroundFrame.add(panel);
+                backgroundFrame.setSize(200, 200);
+                backgroundFrame.setVisible(true);
+
+                testFrame.setUndecorated(true);
+                JPanel p = new JPanel();
+                p.setOpaque(false);
+                testFrame.add(p);
+                AWTUtilities.setWindowOpaque(testFrame, false);
+                testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                testFrame.setSize(400, 400);
+                testFrame.setLocation(0, 0);
+                testFrame.setVisible(true);
+            }
+        });
+
+        toolkit.realSync();
+
+        //robot.getPixelColor() didn't work right for some reason
+        BufferedImage capture = robot.createScreenCapture(new Rectangle(100, 100));
+
+        int redRGB = Color.RED.getRGB();
+        if (redRGB != capture.getRGB(10, 10)) {
+            throw new RuntimeException("Transparent frame is not transparent!");
+        }
+    }
+
+    private static GraphicsConfiguration getGC() {
+        GraphicsConfiguration transparencyCapableGC =
+                GraphicsEnvironment.getLocalGraphicsEnvironment()
+                        .getDefaultScreenDevice().getDefaultConfiguration();
+        if (!AWTUtilities.isTranslucencyCapable(transparencyCapableGC)) {
+            transparencyCapableGC = null;
+
+            GraphicsEnvironment env =
+                    GraphicsEnvironment.getLocalGraphicsEnvironment();
+            GraphicsDevice[] devices = env.getScreenDevices();
+
+            for (int i = 0; i < devices.length && transparencyCapableGC == null; i++) {
+                GraphicsConfiguration[] configs = devices[i].getConfigurations();
+                for (int j = 0; j < configs.length && transparencyCapableGC == null; j++) {
+                    if (AWTUtilities.isTranslucencyCapable(configs[j])) {
+                        transparencyCapableGC = configs[j];
+                    }
+                }
+            }
+        }
+        return transparencyCapableGC;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/6713352/bug6713352.java	Wed Jul 05 16:53:56 2017 +0200
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2009 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6713352
+   @summary Deadlock in JFileChooser with synchronized custom FileSystemView
+   @author Pavel Porvatov
+   @run main bug6713352
+*/
+
+import sun.awt.shell.ShellFolder;
+
+import javax.swing.*;
+import javax.swing.filechooser.FileSystemView;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+public class bug6713352 {
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                String tempDir = System.getProperty("java.io.tmpdir");
+
+                if (tempDir == null || !new File(tempDir).isDirectory()) {
+                    tempDir = System.getProperty("user.home");
+                }
+
+                MyFileSystemView systemView = new MyFileSystemView();
+
+                synchronized (systemView) { // Get SystemView lock
+                    new JFileChooser(systemView);
+
+                    // Wait a little bit. BasicDirectoryModel will lock Invoker and stop on
+                    // the bug6713352.MyFileSystemView.getFiles() method
+                    try {
+                        Thread.sleep(5000);
+                    } catch (InterruptedException e) {
+                        throw new RuntimeException(e);
+                    }
+
+                    try {
+                        System.out.println("Try to get Invokers lock");
+
+                        ShellFolder.getShellFolder(new File(tempDir)).listFiles(true);
+                    } catch (FileNotFoundException e) {
+                        throw new RuntimeException(e);
+                    }
+                }
+
+                // To avoid RejectedExecutionException in BasicDirectoryModel wait a second
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+    }
+
+    private static class MyFileSystemView extends FileSystemView {
+
+        public File createNewFolder(File containingDir) throws IOException {
+            return null;
+        }
+
+        public File[] getFiles(File dir, boolean useFileHiding) {
+            System.out.println("getFiles start");
+
+            File[] result;
+
+            synchronized (this) {
+                result = super.getFiles(dir, useFileHiding);
+            }
+
+            System.out.println("getFiles finished");
+
+            return result;
+        }
+
+        public synchronized Boolean isTraversable(File f) {
+            return super.isTraversable(f);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/6726866/bug6726866.html	Wed Jul 05 16:53:56 2017 +0200
@@ -0,0 +1,7 @@
+<html>
+<body>
+<applet  code="bug6726866.class" width=400 height=100></applet>
+Drag the internal frame inside the green undecorated window,
+if you can drag it the test passes, otherwise fails.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/6726866/bug6726866.java	Wed Jul 05 16:53:56 2017 +0200
@@ -0,0 +1,44 @@
+/* @test
+   @bug 6726866
+   @summary Repainting artifacts when resizing or dragging JInternalFrames in non-opaque toplevel
+   @author Alexander Potochkin
+   @run applet/manual=yesno bug6726866.html
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.lang.reflect.Method;
+
+public class bug6726866 extends JApplet {
+
+    public void init() {
+        JFrame frame = new JFrame("bug6726866");
+        frame.setUndecorated(true);
+        setWindowNonOpaque(frame);
+
+        JDesktopPane desktop = new JDesktopPane();
+        desktop.setBackground(Color.GREEN);
+        JInternalFrame iFrame = new JInternalFrame("Test", true, true, true, true);
+        iFrame.add(new JLabel("internal Frame"));
+        iFrame.setBounds(10, 10, 300, 200);
+        iFrame.setVisible(true);
+        desktop.add(iFrame);
+        frame.add(desktop);
+
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(400, 400);
+        frame.setVisible(true);
+        frame.toFront();
+    }
+
+    private void setWindowNonOpaque(Window w) {
+        try {
+            Class<?> c = Class.forName("com.sun.awt.AWTUtilities");
+            Method m = c.getMethod("setWindowOpaque", Window.class, boolean.class);
+            m.invoke(null, w, false);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/nimbus/Test6741426.java	Wed Jul 05 16:53:56 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Sun Microsystems, 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6741426
+   @summary Tests reusing Nimbus borders across different components (JComboBox border set on a JTextField)
+   @author Peter Zhelezniakov
+   @run main Test6741426
+*/
+
+import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
+import javax.swing.*;
+import java.awt.image.BufferedImage;
+
+
+public class Test6741426 implements Runnable {
+
+    static final int WIDTH = 160;
+    static final int HEIGHT = 80;
+
+    @Override public void run() {
+        JComboBox cb = new JComboBox();
+        JTextField tf = new JTextField();
+        tf.setBorder(cb.getBorder());
+        BufferedImage img =
+                new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
+        tf.setSize(WIDTH, HEIGHT);
+        tf.paint(img.getGraphics());
+    }
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new NimbusLookAndFeel());
+        SwingUtilities.invokeAndWait(new Test6741426());
+    }
+}
--- a/make/sanity-rules.gmk	Tue May 19 17:39:30 2009 -0700
+++ b/make/sanity-rules.gmk	Wed Jul 05 16:53:56 2017 +0200
@@ -348,6 +348,8 @@
 ifeq ($(SPONSORS_SRC_AVAILABLE), true)
 	@$(ECHO) "   BUILD_SPONSORS = $(BUILD_SPONSORS) " >> $(MESSAGE_FILE)
 endif
+	@$(ECHO) "   DEBUG_CLASSFILES = $(DEBUG_CLASSFILES) " >> $(MESSAGE_FILE)
+	@$(ECHO) "   DEBUG_BINARIES = $(DEBUG_BINARIES) " >> $(MESSAGE_FILE)
 	@$(ECHO) "" >> $(MESSAGE_FILE)
 
 .PHONY: sanity settings pre-sanity insane \