changeset 11790:da84dcac1b0b jdk9-b61

Merge
author lana
date Fri, 17 Apr 2015 10:24:46 -0700
parents c5b5d9045728 fdd5452138e5
children c0ed608fc7d2 0cc533516089
files
diffstat 324 files changed, 59550 insertions(+), 12052 deletions(-) [+]
line wrap: on
line diff
--- a/make/CompileDemos.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/CompileDemos.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -45,7 +45,7 @@
 DEMO_CLOSED_SHARE_SRC := $(JDK_TOPDIR)/src/closed/demo/share
 DEMO_SOLARIS_SRC := $(JDK_TOPDIR)/src/demo/solaris
 DEMO_OS_TYPE_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_TYPE)
-VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
+GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
 
 ##################################################################################################
 
@@ -230,11 +230,8 @@
       $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/README.txt, $2)) \
       $$(wildcard $$(patsubst %, $(DEMO_SHARE_SRC)/jvmti/%/sample.makefile.txt, $2))
   BUILD_DEMO_JVMTI_$1_EXTRA_INC := $$(addprefix -I, $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC))
-  BUILD_DEMO_JVMTI_$1_LANG := C
-  ifneq (, $4)
-    BUILD_DEMO_JVMTI_$1_LANG := $4
-  endif
   ifeq (C++, $4)
+    BUILD_DEMO_JVMTI_$1_TOOLCHAIN := TOOLCHAIN_LINK_CXX
     $1_EXTRA_CXX := $(LDFLAGS_CXX_JDK) $(LIBCXX)
   endif
 
@@ -254,7 +251,7 @@
   # Remove the -incremental:no setting to get .ilk-files like in the old build.
   $$(eval $$(call SetupNativeCompilation,BUILD_DEMO_JVMTI_$1, \
       SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
-      LANG := $$(BUILD_DEMO_JVMTI_$1_LANG), \
+      TOOLCHAIN := $$(BUILD_DEMO_JVMTI_$1_TOOLCHAIN), \
       OPTIMIZATION := LOW, \
       CXXFLAGS := $$($1_CXXFLAGS), \
       DISABLED_WARNINGS_gcc := $(10), \
@@ -267,7 +264,7 @@
       LDFLAGS_SUFFIX_windows := $6, \
       LDFLAGS_SUFFIX_solaris := $7 -lc, \
       LDFLAGS_SUFFIX_linux := $8, \
-      VERSIONINFO_RESOURCE := $(VERSION_INFO_RESOURCE), \
+      VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
       RC_FLAGS := $$(RC_FLAGS) \
           -D "JDK_FNAME=$1.dll" \
           -D "JDK_INTERNAL_NAME=$1" \
@@ -398,7 +395,6 @@
 
   $(eval $(call SetupNativeCompilation,BUILD_LIBPOLLER, \
       SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
           -I$(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \
--- a/make/Tools.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/Tools.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -163,9 +163,7 @@
 ifeq ($(OPENJDK_TARGET_OS), solaris)
   $(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK, \
       SRC := $(JDK_TOPDIR)/make/src/native/add_gnu_debuglink, \
-      LANG := C, \
-      CC := $(BUILD_CC), \
-      LDEXE := $(BUILD_LD), \
+      TOOLCHAIN := TOOLCHAIN_BUILD, \
       LDFLAGS := -lelf, \
       OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/add_gnu_debuglink, \
       OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
@@ -173,9 +171,7 @@
 
   $(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS, \
       SRC := $(JDK_TOPDIR)/make/src/native/fix_empty_sec_hdr_flags, \
-      LANG := C, \
-      CC := $(BUILD_CC), \
-      LDEXE := $(BUILD_LD), \
+      TOOLCHAIN := TOOLCHAIN_BUILD, \
       LDFLAGS := -lelf, \
       OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
       OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
--- a/make/copy/Copy-java.base.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/copy/Copy-java.base.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -170,9 +170,6 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
   POLICY_SRC_LIST += $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
-  ifndef OPENJDK
-    POLICY_SRC_LIST += $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/conf/security/java.policy
-  endif
 endif
 
 POLICY_SRC_LIST += $(POLICY_SRC)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/copy/Copy-jdk.accessibility.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -0,0 +1,47 @@
+#
+# Copyright (c) 2104, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include CopyCommon.gmk
+
+################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  TARGETS += $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCallbacks.h \
+      $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.h \
+      $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h \
+      $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.c \
+      $(CONF_DST_DIR)/accessibility.properties
+
+  $(INCLUDE_DST_OS_DIR)/bridge/%: \
+      $(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge/%
+		$(install-file)
+
+  $(CONF_DST_DIR)/accessibility.properties: \
+      $(JDK_TOPDIR)/src/jdk.accessibility/windows/conf/accessibility.properties
+		$(install-file)
+
+endif
+
+################################################################################
--- a/make/data/swingbeaninfo/SwingBeanInfo.template	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/data/swingbeaninfo/SwingBeanInfo.template	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,25 +92,38 @@
     /**
      * @return an icon of the specified kind for @(BeanClassName)
      */
-    public Image getIcon(int kind) {
+    public Image getIcon(final int kind) {
         Image i;
         switch (kind){
             case ICON_COLOR_32x32:
-                i = loadImage("beaninfo/images/@(BeanClassName)Color32.gif");
-                return ((i == null) ? loadImage("beaninfo/images/JComponentColor32.gif") : i);
+                i = loadStandardImage("beaninfo/images/@(BeanClassName)Color32.gif");
+                return ((i == null) ? loadStandardImage("beaninfo/images/JComponentColor32.gif") : i);
             case ICON_COLOR_16x16:
-                i = loadImage("beaninfo/images/@(BeanClassName)Color16.gif");
-                return ((i == null) ? loadImage("beaninfo/images/JComponentColor16.gif") : i);
+                i = loadStandardImage("beaninfo/images/@(BeanClassName)Color16.gif");
+                return ((i == null) ? loadStandardImage("beaninfo/images/JComponentColor16.gif") : i);
             case ICON_MONO_32x32:
-                i = loadImage("beaninfo/images/@(BeanClassName)Mono32.gif");
-                return ((i == null) ? loadImage("beaninfo/images/JComponentMono32.gif") : i);		  
+                i = loadStandardImage("beaninfo/images/@(BeanClassName)Mono32.gif");
+                return ((i == null) ? loadStandardImage("beaninfo/images/JComponentMono32.gif") : i);         
             case ICON_MONO_16x16:
-                i = loadImage("beaninfo/images/@(BeanClassName)Mono16.gif");
-                return ((i == null) ? loadImage("beaninfo/images/JComponentMono16.gif") : i);		  
+                i = loadStandardImage("beaninfo/images/@(BeanClassName)Mono16.gif");
+                return ((i == null) ? loadStandardImage("beaninfo/images/JComponentMono16.gif") : i);         
             default:
                 return super.getIcon(kind);
         }
     }
+
+    /**
+     * This is a utility method to help in loading standard icon images.
+     *
+     * @param  resourceName A pathname relative to the directory holding the
+     *         class file of the current class
+     * @return an image object. May be null if the load failed.
+     * @see java.beans.SimpleBeanInfo#loadImage(String)
+     */
+    private Image loadStandardImage(final String resourceName) {
+        return java.security.AccessController.doPrivileged(
+                (java.security.PrivilegedAction<Image>) () -> loadImage(resourceName));
+    }
 }
 
 
--- a/make/gensrc/GensrcMisc.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/gensrc/GensrcMisc.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -63,9 +63,7 @@
 $(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOR_EXE, \
     SRC := $(GENSRC_SOR_SRC), \
     INCLUDE_FILES := $(GENSRC_SOR_SRC_FILE), \
-    LANG := C, \
-    CC := $(BUILD_CC), \
-    LDEXE := $(BUILD_LD), \
+    TOOLCHAIN := TOOLCHAIN_BUILD, \
     OBJECT_DIR := $(GENSRC_SOR_BIN), \
     OUTPUT_DIR := $(GENSRC_SOR_BIN), \
     PROGRAM := genSocketOptionRegistry))
@@ -101,9 +99,7 @@
   $(eval $(call SetupNativeCompilation,BUILD_GENSRC_UC_EXE, \
       SRC := $(GENSRC_UC_SRC), \
       INCLUDE_FILES := $(GENSRC_UC_SRC_FILE), \
-      LANG := C, \
-      CC := $(BUILD_CC), \
-      LDEXE := $(BUILD_CC), \
+      TOOLCHAIN := TOOLCHAIN_BUILD, \
       CFLAGS := $(filter -D%, $(CFLAGS_JDKEXE)), \
       OBJECT_DIR := $(GENSRC_UC_BIN), \
       OUTPUT_DIR := $(GENSRC_UC_BIN), \
@@ -142,9 +138,7 @@
   $(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOL_EXE, \
       SRC := $(GENSRC_SOL_SRC), \
       INCLUDE_FILES := $(GENSRC_SOL_SRC_FILE), \
-      LANG := C, \
-      CC := $(BUILD_CC), \
-      LDEXE := $(BUILD_CC), \
+      TOOLCHAIN := TOOLCHAIN_BUILD, \
       OBJECT_DIR := $(GENSRC_SOL_BIN), \
       OUTPUT_DIR := $(GENSRC_SOL_BIN), \
       PROGRAM := genSolarisConstants))
--- a/make/launcher/Launcher-java.base.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/launcher/Launcher-java.base.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -103,7 +103,6 @@
   $(eval $(call SetupNativeCompilation,BUILD_JEXEC, \
       SRC := $(BUILD_JEXEC_SRC), \
       INCLUDE_FILES := jexec.c, \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKEXE) \
           $(BUILD_JEXEC_INC), \
@@ -144,7 +143,6 @@
   $(eval $(call SetupNativeCompilation,BUILD_JSPAWNHELPER, \
       SRC := $(BUILD_JSPAWNHELPER_SRC), \
       INCLUDE_FILES := jspawnhelper.c, \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKEXE) $(JSPAWNHELPER_CFLAGS), \
       LDFLAGS := $(LDFLAGS_JDKEXE) $(LINK_JSPAWNHELPER_FLAGS), \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/launcher/Launcher-jdk.accessibility.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -0,0 +1,61 @@
+#
+# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include LauncherCommon.gmk
+
+################################################################################
+# jabswitch
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+
+  JABSWITCH_SRC := $(JDK_TOPDIR)/src/jdk.accessibility/windows/native/jabswitch
+  ACCESSBRIDGE_SRC := $(JDK_TOPDIR)/src/jdk.accessibility/windows/native/common
+
+  $(eval $(call SetupNativeCompilation,BUILD_JABSWITCH, \
+      SRC := $(JABSWITCH_SRC), \
+      INCLUDE_FILES := jabswitch.cpp, \
+      CFLAGS := $(filter-out -Zc:wchar_t-, $(CFLAGS_JDKEXE)) -Zc:wchar_t \
+          -analyze- -Od -Gd -D_WINDOWS \
+          -D_UNICODE -DUNICODE -RTC1 -EHsc, \
+      DISABLED_WARNINGS_microsoft := 4267, \
+      LDFLAGS := $(LDFLAGS_JDKEXE) \
+          Advapi32.lib Version.lib User32.lib, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/jdk.accessibility/jabswitch, \
+      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_cmds/jdk.accessibility, \
+      PROGRAM := jabswitch, \
+      DEBUG_SYMBOLS := true, \
+      VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRC)/AccessBridgeStatusWindow.RC, \
+      RC_FLAGS := $(RC_FLAGS) \
+          -D "JDK_FNAME=jabswitch.exe" \
+          -D "JDK_INTERNAL_NAME=jabswitch" \
+          -D "JDK_FTYPE=0x01L", \
+      MANIFEST := $(JABSWITCH_SRC)/jabswitch.manifest, \
+      MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \
+  ))
+
+  TARGETS += $(BUILD_JABSWITCH)
+endif
+
+################################################################################
--- a/make/launcher/Launcher-jdk.pack200.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/launcher/Launcher-jdk.pack200.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -56,23 +56,28 @@
 
 endif
 
-UNPACKEXE_LANG := C
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-  UNPACKEXE_LANG := C++
+  UNPACKEXE_TOOLCHAIN := TOOLCHAIN_LINK_CXX
 endif
 
+UNPACK_MAPFILE_DIR := $(JDK_TOPDIR)/make/mapfiles/libunpack
+UNPACK_MAPFILE_PLATFORM_FILE := \
+    $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH)
+
 # The linker on older SuSE distros (e.g. on SLES 10) complains with:
 # "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
 # if feeded with a version script which contains named tags.
 ifeq ($(USING_BROKEN_SUSE_LD), yes)
-  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200.anonymous
+  UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200.anonymous
+else ifneq ($(wildcard $(UNPACK_MAPFILE_PLATFORM_FILE)), )
+  UNPACK_MAPFILE := $(UNPACK_MAPFILE_PLATFORM_FILE)
 else
-  UNPACK_MAPFILE = $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers-unpack200
+  UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
     SRC := $(UNPACKEXE_SRC), \
-    LANG := $(UNPACKEXE_LANG), \
+    TOOLCHAIN := $(UNPACKEXE_TOOLCHAIN), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(UNPACKEXE_CFLAGS) $(CXXFLAGS_JDKEXE) -DFULL, \
     CFLAGS_release := -DPRODUCT, \
@@ -96,7 +101,9 @@
         -D "JDK_INTERNAL_NAME=unpack200" \
         -D "JDK_FTYPE=0x1L", \
     DEBUG_SYMBOLS := true, \
-    MANIFEST := $(JDK_TOPDIR)/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest))
+    MANIFEST := $(JDK_TOPDIR)/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest, \
+    MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \
+))
 
 ifneq ($(USE_EXTERNAL_LIBZ), true)
 
--- a/make/launcher/LauncherCommon.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/launcher/LauncherCommon.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -161,7 +161,6 @@
   $(call SetupNativeCompilation,BUILD_LAUNCHER_$1, \
       SRC := $(LAUNCHER_SRC), \
       INCLUDE_FILES := main.c, \
-      LANG := C, \
       OPTIMIZATION := $$($1_OPTIMIZATION_ARG), \
       CFLAGS := $$($1_CFLAGS) \
           $(LAUNCHER_CFLAGS) \
@@ -199,7 +198,9 @@
           -D "JDK_FTYPE=0x1L" \
           $7, \
       MANIFEST := $(JAVA_MANIFEST), \
-      CODESIGN := $$($1_CODESIGN))
+      MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \
+      CODESIGN := $$($1_CODESIGN), \
+  )
 
   TARGETS += $$(BUILD_LAUNCHER_$1)
 
--- a/make/lib/Awt2dLibraries.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Awt2dLibraries.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -51,7 +51,6 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(BUILD_LIBMLIB_SRC), \
     EXCLUDE_FILES := mlib_c_ImageBlendTable.c, \
-    LANG := C, \
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBMLIB_CFLAGS), \
@@ -124,7 +123,6 @@
       LIBRARY := mlib_image_v, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBMLIB_IMAGE_V_SRC), \
-      LANG := C, \
       EXCLUDE_FILES := $(BUILD_LIBMLIB_IMAGE_V_EXFILES), \
       OPTIMIZATION := HIGHEST, \
       CFLAGS := -xarch=sparcvis \
@@ -204,8 +202,6 @@
   LIBAWT_CFLAGS += -DMLIB_NO_LIBSUNMATH
 endif
 
-LIBAWT_LANG := C
-
 ifeq ($(OPENJDK_TARGET_OS), windows)
   LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
       $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
@@ -222,7 +218,6 @@
       awt/image/cvutils/img_colors.c \
       #
 
-  LIBAWT_LANG := C++
   LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
   ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
     LIBAWT_CFLAGS += -DMLIB_OS64BIT
@@ -247,7 +242,6 @@
     SRC := $(LIBAWT_DIRS), \
     EXCLUDES := $(LIBAWT_EXCLUDES), \
     EXCLUDE_FILES := $(LIBAWT_EXFILES), \
-    LANG := $(LIBAWT_LANG), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
     DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
@@ -355,7 +349,6 @@
         OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(LIBAWT_XAWT_DIRS), \
         EXCLUDES := $(LIBAWT_XAWT_EXCLUDES), \
-        LANG := C, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
             $(X_CFLAGS), \
@@ -413,7 +406,6 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBLCMS_SRC), \
     INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
-    LANG := C, \
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
         $(SHARED_LIBRARY_FLAGS) $(LIBLCMS_CPPFLAGS) \
@@ -496,7 +488,6 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJAVAJPEG_SRC), \
     INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
-    LANG := C, \
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJAVAJPEG_SRC)) \
         $(LIBJAVA_HEADER_FLAGS) \
@@ -564,7 +555,6 @@
         OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(LIBAWT_HEADLESS_DIRS), \
         EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
-        LANG := C, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) \
             -DHEADLESS=true \
@@ -651,7 +641,7 @@
     SRC := $(LIBFONTMANAGER_SRC), \
     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
         AccelGlyphCache.c, \
-    LANG := C++, \
+    TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
@@ -712,7 +702,6 @@
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJAWT_SRC), \
       INCLUDE_FILES := $(LIBJAWT_INCLUDE_FILES), \
-      LANG := C++, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CXXFLAGS_JDKLIB) \
           -EHsc -DUNICODE -D_UNICODE \
@@ -771,7 +760,6 @@
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJAWT_SRC), \
       INCLUDE_FILES := $(JAWT_FILES), \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBJAWT_CFLAGS), \
@@ -889,7 +877,6 @@
       SRC := $(LIBSPLASHSCREEN_DIRS), \
       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
       EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
                 $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
@@ -958,7 +945,6 @@
       LIBRARY := awt_lwawt, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBAWT_LWAWT_DIRS), \
-      LANG := C, \
       INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
       EXCLUDE_FILES := $(LIBAWT_LWAWT_EXFILES), \
       EXCLUDES := $(LIBAWT_LWAWT_EXCLUDES), \
@@ -1008,7 +994,6 @@
       LIBRARY := osxui, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxui, \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxui \
--- a/make/lib/CoreLibraries.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/CoreLibraries.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -43,7 +43,6 @@
       STATIC_LIBRARY := fdlibm, \
       OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
       SRC := $(LIBFDLIBM_SRC), \
-      LANG := C, \
       OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
       CFLAGS_windows_debug := -DLOGGING, \
@@ -62,7 +61,6 @@
       LIBRARY := fdlibm, \
       OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
       SRC := $(LIBFDLIBM_SRC), \
-      LANG := C, \
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
       LDFLAGS := -nostdlib -r -arch x86_64, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
@@ -93,7 +91,6 @@
     LIBRARY := verify, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(JDK_TOPDIR)/src/java.base/share/native/libverify, \
-    LANG := C, \
     OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB), \
     DISABLED_WARNINGS_microsoft := 4244 4267, \
@@ -146,7 +143,6 @@
     LIBRARY := java, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJAVA_SRC_DIRS), \
-    LANG := C, \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(LIBJAVA_CFLAGS), \
@@ -206,7 +202,6 @@
 $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
     LIBRARY := zip, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-    LANG := C, \
     OPTIMIZATION := LOW, \
     SRC := $(JDK_TOPDIR)/src/java.base/share/native/libzip, \
     EXCLUDES := $(LIBZIP_EXCLUDES), \
@@ -314,7 +309,6 @@
     SRC := $(LIBJLI_SRC_DIRS), \
     EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
     EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
-    LANG := C, \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(LIBJLI_CFLAGS), \
     DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION, \
@@ -363,7 +357,6 @@
       SRC := $(LIBJLI_SRC_DIRS), \
       EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
       EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
-      LANG := C, \
       OPTIMIZATION := HIGH, \
       CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
       ARFLAGS := $(ARFLAGS), \
@@ -383,7 +376,6 @@
       SRC := $(LIBJLI_SRC_DIRS), \
       EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
       EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
-      LANG := C, \
       OPTIMIZATION := HIGH, \
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
       LDFLAGS := -nostdlib -r, \
@@ -403,7 +395,6 @@
       SRC := $(LIBJLI_SRC_DIRS), \
       EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
       EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
-      LANG := C, \
       OPTIMIZATION := HIGH, \
       CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
       ARFLAGS := $(ARFLAGS), \
--- a/make/lib/Lib-java.instrument.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-java.instrument.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -57,7 +57,6 @@
     LIBRARY := instrument, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBINSTRUMENT_SRC), \
-    LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(LIBINSTRUMENT_CFLAGS) $(CFLAGS_WARNINGS_ARE_ERRORS), \
     CFLAGS_debug := -DJPLIS_LOGGING, \
--- a/make/lib/Lib-java.management.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-java.management.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -72,7 +72,6 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(BUILD_LIBMANAGEMENT_SRC), \
     EXCLUDE_FILES := $(BUILD_LIBMANAGEMENT_EXCLUDES), \
-    LANG := C, \
     OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(BUILD_LIBMANAGEMENT_CFLAGS), \
     MAPFILE := $(LIBMANAGEMENT_MAPFILE), \
--- a/make/lib/Lib-java.prefs.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-java.prefs.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -37,7 +37,6 @@
     LIBRARY := prefs, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBPREF_SRC_DIRS), \
-    LANG := C, \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBPREF_SRC_DIRS)) \
         $(LIBJAVA_HEADER_FLAGS), \
--- a/make/lib/Lib-java.security.jgss.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-java.security.jgss.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -36,7 +36,6 @@
       LIBRARY := j2gss, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJ2GSS_SRC), \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
           $(LIBJAVA_HEADER_FLAGS) \
@@ -79,7 +78,6 @@
         LIBRARY := $(BUILD_LIBKRB5_NAME), \
         OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(BUILD_LIBKRB5_SRC), \
-        LANG := C, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) \
             $(addprefix -I, $(BUILD_LIBKRB5_SRC)) \
--- a/make/lib/Lib-java.smartcardio.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-java.smartcardio.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -37,7 +37,6 @@
     LIBRARY := j2pcsc, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJ2PCSC_SRC), \
-    LANG := C, \
     CFLAGS_unix := -D__sun_jdk, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBJ2PCSC_CPPFLAGS), \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/lib/Lib-jdk.accessibility.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -0,0 +1,135 @@
+#
+# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include LibCommon.gmk
+
+################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+
+  ROOT_SRCDIR := $(JDK_TOPDIR)/src/jdk.accessibility/windows/native
+  JAVA_AB_SRCDIR := $(ROOT_SRCDIR)/libjavaaccessbridge $(ROOT_SRCDIR)/common
+  WIN_AB_SRCDIR := $(ROOT_SRCDIR)/libwindowsaccessbridge $(ROOT_SRCDIR)/common
+  SYSINFO_SRCDIR := $(ROOT_SRCDIR)/libjabsysinfo
+  ACCESSBRIDGE_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/jdk.accessibility \
+      -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
+      -I$(JDK_TOPDIR)/src/java.desktop/share/native/include
+
+  define SetupJavaDLL
+    # Parameter 1 Suffix
+    # Parameter 2 ACCESSBRIDGE_ARCH_ suffix
+
+    $(call SetupNativeCompilation,BUILD_JAVAACCESSBRIDGE$1, \
+        LIBRARY = javaaccessbridge$1, \
+        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+        SRC := $(JAVA_AB_SRCDIR), \
+        OPTIMIZATION := LOW, \
+        CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS) \
+            $(addprefix -I,$(JAVA_AB_SRCDIR)) \
+            -I$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge \
+            -DACCESSBRIDGE_ARCH_$2, \
+        LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
+            winspool.lib comdlg32.lib advapi32.lib shell32.lib \
+            $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib \
+            ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
+            -subsystem:windows, \
+        VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
+        RC_FLAGS := $(RC_FLAGS) \
+            -D "JDK_FNAME=javaaccessbridge$1.dll" \
+            -D "JDK_INTERNAL_NAME=javaaccessbridge$1" \
+            -D "JDK_FTYPE=0x02L", \
+        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavaaccessbridge$1, \
+        DEBUG_SYMBOLS := true)
+
+    $$(BUILD_JAVAACCESSBRIDGE$1): $(SUPPORT_OUTPUTDIR)/native/java.desktop/libjawt/jawt.lib
+
+    TARGETS += $$(BUILD_JAVAACCESSBRIDGE$1)
+  endef
+
+  define SetupWinDLL
+    # Parameter 1 Suffix
+    # Parameter 2 ACCESSBRIDGE_ARCH_ suffix
+    $(call SetupNativeCompilation,BUILD_WINDOWSACCESSBRIDGE$1, \
+        LIBRARY = windowsaccessbridge$1, \
+        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+        SRC := $(WIN_AB_SRCDIR), \
+        OPTIMIZATION := LOW, \
+        CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT $(ACCESSBRIDGE_CFLAGS) \
+            $(addprefix -I,$(WIN_AB_SRCDIR)) \
+            -I$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge \
+            -DACCESSBRIDGE_ARCH_$2, \
+        LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
+            winspool.lib comdlg32.lib advapi32.lib shell32.lib \
+            ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
+            -subsystem:windows \
+            -def:$(ROOT_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \
+        VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
+        RC_FLAGS := $(RC_FLAGS) \
+            -D "JDK_FNAME=windowsaccessbridge$1.dll" \
+            -D "JDK_INTERNAL_NAME=windowsaccessbridge$1" \
+            -D "JDK_FTYPE=0x02L", \
+        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libwindowsaccessbridge$1, \
+        DEBUG_SYMBOLS := true)
+
+    TARGETS += $$(BUILD_WINDOWSACCESSBRIDGE$1)
+
+  endef
+
+  define SetupAccessBridgeSysInfo
+
+    $(call SetupNativeCompilation,BUILD_ACCESSBRIDGESYSINFO, \
+        LIBRARY = jabsysinfo, \
+        OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+        SRC := $(SYSINFO_SRCDIR), \
+        OPTIMIZATION := LOW, \
+        CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS), \
+        LDFLAGS := $(LDFLAGS_JDKLIB) \
+            -subsystem:windows -machine:I386, \
+        VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
+        RC_FLAGS := $(RC_FLAGS) \
+            -D "JDK_FNAME=jabsysinfo.dll" \
+            -D "JDK_INTERNAL_NAME=jabsysinfo" \
+            -D "JDK_FTYPE=0x02L", \
+        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/lib/libjabsysinfo, \
+        DEBUG_SYMBOLS := true)
+
+    TARGETS += $$(BUILD_ACCESSBRIDGESYSINFO)
+
+  endef
+
+  ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+    $(eval $(call SetupAccessBridgeSysInfo))
+    $(eval $(call SetupJavaDLL,-32,32))
+    $(eval $(call SetupJavaDLL,,LEGACY))
+    $(eval $(call SetupWinDLL,-32,32))
+    $(eval $(call SetupWinDLL,,LEGACY))
+  else
+    $(eval $(call SetupJavaDLL,,64))
+    $(eval $(call SetupWinDLL,-64,64))
+  endif
+
+endif
+
+################################################################################
--- a/make/lib/Lib-jdk.attach.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.attach.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -32,7 +32,6 @@
     LIBRARY := attach, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(call FindSrcDirsForLib, jdk.attach, attach), \
-    LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
         -I$(SUPPORT_OUTPUTDIR)/headers/jdk.attach \
--- a/make/lib/Lib-jdk.crypto.ec.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.crypto.ec.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -47,7 +47,7 @@
       LIBRARY := sunec, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBSUNEC_SRC), \
-      LANG := C++, \
+      TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CFLAGS_JDKLIB)) \
           $(BUILD_LIBSUNEC_FLAGS) \
--- a/make/lib/Lib-jdk.crypto.mscapi.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.crypto.mscapi.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -35,7 +35,6 @@
       LIBRARY := sunmscapi, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBSUNMSCAPI_SRC), \
-      LANG := C++, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           -I$(LIBSUNMSCAPI_SRC), \
--- a/make/lib/Lib-jdk.crypto.pkcs11.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.crypto.pkcs11.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -34,7 +34,6 @@
     LIBRARY := j2pkcs11, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJ2PKCS11_SRC), \
-    LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \
         $(LIBJAVA_HEADER_FLAGS) \
--- a/make/lib/Lib-jdk.crypto.ucrypto.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.crypto.ucrypto.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -35,7 +35,6 @@
       LIBRARY := j2ucrypto, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJ2UCRYPTO_SRC), \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(addprefix -I, $(LIBJ2UCRYPTO_SRC)), \
--- a/make/lib/Lib-jdk.deploy.osx.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.deploy.osx.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -35,7 +35,6 @@
       LIBRARY := AppleScriptEngine, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBAPPLESCRIPTENGINE_SRC), \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           -I$(LIBAPPLESCRIPTENGINE_SRC) \
@@ -68,7 +67,6 @@
       LIBRARY := osx, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBOSX_DIRS), \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBOSX_CFLAGS), \
--- a/make/lib/Lib-jdk.hprof.agent.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.hprof.agent.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -45,7 +45,6 @@
     LIBRARY := hprof, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(BUILD_LIBHPROF_SRC), \
-    LANG := C, \
     OPTIMIZATION := $(LIBHPROF_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
         $(BUILD_LIBHPROF_CFLAGS), \
@@ -75,7 +74,6 @@
     LIBRARY := java_crw_demo, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJAVA_CRW_DEMO_SRC), \
-    LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
         $(addprefix -I, $(LIBJAVA_CRW_DEMO_SRC)), \
--- a/make/lib/Lib-jdk.jdi.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.jdi.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -43,7 +43,6 @@
       LIBRARY := dt_shmem, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBDT_SHMEM_SRC), \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \
           $(LIBDT_SHMEM_CPPFLAGS), \
--- a/make/lib/Lib-jdk.jdwp.agent.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.jdwp.agent.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -40,7 +40,6 @@
     LIBRARY := dt_socket, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBDT_SOCKET_SRC), \
-    LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \
         $(LIBDT_SOCKET_CPPFLAGS), \
@@ -77,7 +76,6 @@
     LIBRARY := jdwp, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJDWP_SRC), \
-    LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DJDWP_LOGGING \
         $(LIBJDWP_CPPFLAGS) \
--- a/make/lib/Lib-jdk.pack200.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.pack200.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -32,7 +32,7 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(JDK_TOPDIR)/src/jdk.pack200/share/native/libunpack \
         $(JDK_TOPDIR)/src/jdk.pack200/share/native/common-unpack, \
-    LANG := C++, \
+    TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CXXFLAGS_JDKLIB) \
         -DNO_ZLIB -DUNPACK_JNI -DFULL \
--- a/make/lib/Lib-jdk.sctp.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.sctp.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -41,7 +41,6 @@
         LIBRARY := sctp, \
         OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
         SRC := $(JDK_TOPDIR)/src/jdk.sctp/$(OPENJDK_TARGET_OS_TYPE)/native/libsctp, \
-        LANG := C, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) \
             -I $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \
--- a/make/lib/Lib-jdk.security.auth.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/Lib-jdk.security.auth.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -42,7 +42,6 @@
     LIBRARY := $(LIBJAAS_NAME), \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(call FindSrcDirsForLib, jdk.security.auth, jaas), \
-    LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.security.auth, \
     MAPFILE := $(LIBJAAS_MAPFILE), \
--- a/make/lib/NetworkingLibraries.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/NetworkingLibraries.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -29,7 +29,6 @@
     LIBRARY := net, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBNET_SRC_DIRS), \
-    LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
         $(LIBJAVA_HEADER_FLAGS) $(addprefix -I, $(LIBNET_SRC_DIRS)), \
--- a/make/lib/NioLibraries.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/NioLibraries.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -65,7 +65,6 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(BUILD_LIBNIO_SRC), \
     EXCLUDE_FILES := $(BUILD_LIBNIO_EXFILES), \
-    LANG := C, \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBNIO_CFLAGS), \
--- a/make/lib/PlatformLibraries.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/PlatformLibraries.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -33,7 +33,6 @@
       LIBRARY := osxapp, \
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBOSXAPP_SRC), \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(addprefix -I, $(LIBOSXAPP_SRC)) \
--- a/make/lib/SoundLibraries.gmk	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/lib/SoundLibraries.gmk	Fri Apr 17 10:24:46 2015 -0700
@@ -35,8 +35,6 @@
 
 LIBJSOUND_SRC_FILES := Utilities.c Platform.c
 
-LIBJSOUND_LANG := C
-
 EXTRA_SOUND_JNI_LIBS :=
 
 LIBJSOUND_MIDIFILES := \
@@ -81,7 +79,7 @@
 endif # OPENJDK_TARGET_OS aix
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  LIBJSOUND_LANG := C++
+  LIBJSOUND_TOOLCHAIN := TOOLCHAIN_LINK_CXX
   LIBJSOUND_CFLAGS += -DX_PLATFORM=X_MACOSX \
       -DUSE_PORTS=TRUE \
       -DUSE_DAUDIO=TRUE \
@@ -124,7 +122,7 @@
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJSOUND_SRC_DIRS), \
     INCLUDE_FILES := $(LIBJSOUND_SRC_FILES), \
-    LANG := $(LIBJSOUND_LANG), \
+    TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(LIBJSOUND_CFLAGS), \
@@ -169,7 +167,6 @@
           PLATFORM_API_LinuxOS_ALSA_MidiOut.c \
           PLATFORM_API_LinuxOS_ALSA_MidiUtils.c \
           PLATFORM_API_LinuxOS_ALSA_Ports.c, \
-      LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \
           $(LIBJSOUND_CFLAGS) \
@@ -201,7 +198,6 @@
       SRC := $(LIBJSOUND_SRC_DIRS), \
       INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \
           PLATFORM_API_WinOS_DirectSound.cpp, \
-      LANG := C++, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBJSOUND_CFLAGS) \
--- a/make/mapfiles/launchers/mapfile-x86_64	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/mapfiles/launchers/mapfile-x86_64	Fri Apr 17 10:24:46 2015 -0700
@@ -34,6 +34,14 @@
 		_environ;
 		__environ_lock;
 
+		# These are needed by the c runtime in SS12u4
+		___Argv;
+		__xargv;
+		__xargc;
+		_start;
+		__longdouble_used;
+		_lib_version;
+
 	local:
 		*;
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-sparc	Fri Apr 17 10:24:46 2015 -0700
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Define library interface.
+
+SUNWprivate_1.1 {
+	global:
+		# These are needed by the c runtime in SS12u4
+		_environ;
+		__environ_lock;
+		___Argv;
+		__xargv;
+		__xargc;
+		_start;
+		_lib_version;
+
+	local:
+	    *;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/mapfiles/libunpack/mapfile-vers-unpack200-solaris-x86	Fri Apr 17 10:24:46 2015 -0700
@@ -0,0 +1,42 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Define library interface.
+
+SUNWprivate_1.1 {
+	global:
+		# These are needed by the c runtime in SS12u4
+		_environ;
+		__environ_lock;
+		___Argv;
+		__xargv;
+		__xargc;
+		_start;
+		__longdouble_used;
+		_lib_version;
+
+	local:
+	    *;
+};
--- a/make/src/classes/build/tools/module/ext.modules	Fri Apr 17 09:59:46 2015 -0700
+++ b/make/src/classes/build/tools/module/ext.modules	Fri Apr 17 10:24:46 2015 -0700
@@ -4,7 +4,7 @@
 java.transaction
 java.xml.bind
 java.xml.ws
-jdk.accessbridge
+jdk.accessibility
 jdk.crypto.ec
 jdk.crypto.mscapi
 jdk.crypto.pkcs11
--- a/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -350,7 +350,7 @@
             switch (mode) {
             case MODE_SIGN:
                 data = padding.pad(buffer, 0, bufOfs);
-                return RSACore.rsa(data, privateKey);
+                return RSACore.rsa(data, privateKey, true);
             case MODE_VERIFY:
                 byte[] verifyBuffer = RSACore.convert(buffer, 0, bufOfs);
                 data = RSACore.rsa(verifyBuffer, publicKey);
@@ -360,7 +360,7 @@
                 return RSACore.rsa(data, publicKey);
             case MODE_DECRYPT:
                 byte[] decryptBuffer = RSACore.convert(buffer, 0, bufOfs);
-                data = RSACore.rsa(decryptBuffer, privateKey);
+                data = RSACore.rsa(decryptBuffer, privateKey, false);
                 return padding.unpad(data);
             default:
                 throw new AssertionError("Internal error");
--- a/src/java.base/share/classes/java/lang/ref/Finalizer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/java/lang/ref/Finalizer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -28,6 +28,7 @@
 import java.security.PrivilegedAction;
 import java.security.AccessController;
 import sun.misc.JavaLangAccess;
+import sun.misc.ManagedLocalsThread;
 import sun.misc.SharedSecrets;
 import sun.misc.VM;
 
@@ -126,7 +127,7 @@
                     for (ThreadGroup tgn = tg;
                          tgn != null;
                          tg = tgn, tgn = tg.getParent());
-                    Thread sft = new Thread(tg, proc, "Secondary finalizer");
+                    Thread sft = new ManagedLocalsThread(tg, proc, "Secondary finalizer");
                     sft.start();
                     try {
                         sft.join();
@@ -185,7 +186,7 @@
                 }}});
     }
 
-    private static class FinalizerThread extends Thread {
+    private static class FinalizerThread extends ManagedLocalsThread {
         private volatile boolean running;
         FinalizerThread(ThreadGroup g) {
             super(g, "Finalizer");
--- a/src/java.base/share/classes/java/lang/ref/Reference.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/java/lang/ref/Reference.java	Fri Apr 17 10:24:46 2015 -0700
@@ -27,6 +27,7 @@
 
 import sun.misc.Cleaner;
 import sun.misc.JavaLangRefAccess;
+import sun.misc.ManagedLocalsThread;
 import sun.misc.SharedSecrets;
 
 /**
@@ -126,7 +127,7 @@
 
     /* High-priority thread to enqueue pending References
      */
-    private static class ReferenceHandler extends Thread {
+    private static class ReferenceHandler extends ManagedLocalsThread {
 
         private static void ensureClassInitialized(Class<?> clazz) {
             try {
--- a/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java	Fri Apr 17 10:24:46 2015 -0700
@@ -70,6 +70,7 @@
 import static java.time.temporal.ChronoField.OFFSET_SECONDS;
 import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
 import static java.time.temporal.ChronoField.YEAR;
+import static java.time.temporal.ChronoField.ERA;
 
 import java.lang.ref.SoftReference;
 import java.math.BigDecimal;
@@ -84,6 +85,7 @@
 import java.time.ZoneOffset;
 import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.Chronology;
+import java.time.chrono.Era;
 import java.time.chrono.IsoChronology;
 import java.time.format.DateTimeTextProvider.LocaleStore;
 import java.time.temporal.ChronoField;
@@ -3131,6 +3133,16 @@
                         return context.setParsedField(field, entry.getValue(), position, position + itText.length());
                     }
                 }
+                if (field == ERA && !context.isStrict()) {
+                    // parse the possible era name from era.toString()
+                    List<Era> eras = chrono.eras();
+                    for (Era era : eras) {
+                        String name = era.toString();
+                        if (context.subSequenceEquals(name, 0, parseText, position, name.length())) {
+                            return context.setParsedField(field, era.getValue(), position, position + name.length());
+                        }
+                    }
+                }
                 if (context.isStrict()) {
                     return ~position;
                 }
--- a/src/java.base/share/classes/sun/misc/GC.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/misc/GC.java	Fri Apr 17 10:24:46 2015 -0700
@@ -82,8 +82,7 @@
      */
     public static native long maxObjectInspectionAge();
 
-
-    private static class Daemon extends Thread {
+    private static class Daemon extends ManagedLocalsThread {
 
         public void run() {
             for (;;) {
--- a/src/java.base/share/classes/sun/misc/InnocuousThread.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/misc/InnocuousThread.java	Fri Apr 17 10:24:46 2015 -0700
@@ -26,32 +26,37 @@
 package sun.misc;
 
 import java.security.AccessControlContext;
+import java.security.AccessController;
 import java.security.ProtectionDomain;
+import java.security.PrivilegedAction;
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * A thread that has no permissions, is not a member of any user-defined
  * ThreadGroup and supports the ability to erase ThreadLocals.
- *
- * @implNote Based on the implementation of InnocuousForkJoinWorkerThread.
  */
-public final class InnocuousThread extends Thread {
+public final class InnocuousThread extends ManagedLocalsThread {
     private static final Unsafe UNSAFE;
-    private static final ThreadGroup THREADGROUP;
+    private static final ThreadGroup INNOCUOUSTHREADGROUP;
     private static final AccessControlContext ACC;
-    private static final long THREADLOCALS;
-    private static final long INHERITABLETHREADLOCALS;
     private static final long INHERITEDACCESSCONTROLCONTEXT;
+    private static final long CONTEXTCLASSLOADER;
+
+    private static final AtomicInteger threadNumber = new AtomicInteger(1);
 
     public InnocuousThread(Runnable target) {
-        super(THREADGROUP, target, "anInnocuousThread");
-        UNSAFE.putOrderedObject(this, INHERITEDACCESSCONTROLCONTEXT, ACC);
-        eraseThreadLocals();
+        this(INNOCUOUSTHREADGROUP, target,
+             "InnocuousThread-" + threadNumber.getAndIncrement());
     }
 
-    @Override
-    public ClassLoader getContextClassLoader() {
-        // always report system class loader
-        return ClassLoader.getSystemClassLoader();
+    public InnocuousThread(Runnable target, String name) {
+        this(INNOCUOUSTHREADGROUP, target, name);
+    }
+
+    public InnocuousThread(ThreadGroup group, Runnable target, String name) {
+        super(group, target, name);
+        UNSAFE.putOrderedObject(this, INHERITEDACCESSCONTROLCONTEXT, ACC);
+        UNSAFE.putOrderedObject(this, CONTEXTCLASSLOADER, ClassLoader.getSystemClassLoader());
     }
 
     @Override
@@ -61,7 +66,11 @@
 
     @Override
     public void setContextClassLoader(ClassLoader cl) {
-        throw new SecurityException("setContextClassLoader");
+        // Allow clearing of the TCCL to remove the reference to the system classloader.
+        if (cl == null)
+            super.setContextClassLoader(null);
+        else
+            throw new SecurityException("setContextClassLoader");
     }
 
     // ensure run method is run only once
@@ -75,14 +84,6 @@
         }
     }
 
-    /**
-     * Drops all thread locals (and inherited thread locals).
-     */
-    public void eraseThreadLocals() {
-        UNSAFE.putObject(this, THREADLOCALS, null);
-        UNSAFE.putObject(this, INHERITABLETHREADLOCALS, null);
-    }
-
     // Use Unsafe to access Thread group and ThreadGroup parent fields
     static {
         try {
@@ -95,12 +96,10 @@
             Class<?> tk = Thread.class;
             Class<?> gk = ThreadGroup.class;
 
-            THREADLOCALS = UNSAFE.objectFieldOffset
-                (tk.getDeclaredField("threadLocals"));
-            INHERITABLETHREADLOCALS = UNSAFE.objectFieldOffset
-                (tk.getDeclaredField("inheritableThreadLocals"));
             INHERITEDACCESSCONTROLCONTEXT = UNSAFE.objectFieldOffset
                 (tk.getDeclaredField("inheritedAccessControlContext"));
+            CONTEXTCLASSLOADER = UNSAFE.objectFieldOffset
+                (tk.getDeclaredField("contextClassLoader"));
 
             long tg = UNSAFE.objectFieldOffset(tk.getDeclaredField("group"));
             long gp = UNSAFE.objectFieldOffset(gk.getDeclaredField("parent"));
@@ -113,7 +112,10 @@
                     break;
                 group = parent;
             }
-            THREADGROUP = new ThreadGroup(group, "InnocuousThreadGroup");
+            final ThreadGroup root = group;
+            INNOCUOUSTHREADGROUP = AccessController.doPrivileged(
+                (PrivilegedAction<ThreadGroup>) () ->
+                    { return new ThreadGroup(root, "InnocuousThreadGroup"); });
         } catch (Exception e) {
             throw new Error(e);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/sun/misc/ManagedLocalsThread.java	Fri Apr 17 10:24:46 2015 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.misc;
+
+/**
+ * A thread that has it's thread locals, and inheritable thread
+ * locals erased on construction.
+ */
+public class ManagedLocalsThread extends Thread {
+    private static final Unsafe UNSAFE;
+    private static final long THREAD_LOCALS;
+    private static final long INHERITABLE_THREAD_LOCALS;
+
+    public ManagedLocalsThread() {
+        eraseThreadLocals();
+    }
+
+    public ManagedLocalsThread(Runnable target) {
+        super(target);
+        eraseThreadLocals();
+    }
+
+    public ManagedLocalsThread(String name) {
+        super(name);
+        eraseThreadLocals();
+    }
+
+    public ManagedLocalsThread(Runnable target, String name) {
+        super(target, name);
+        eraseThreadLocals();
+    }
+
+    public ManagedLocalsThread(ThreadGroup group, String name) {
+        super(group, name);
+        eraseThreadLocals();
+    }
+
+    public ManagedLocalsThread(ThreadGroup group, Runnable target, String name) {
+        super(group, target, name);
+        eraseThreadLocals();
+    }
+
+    /**
+     * Drops all thread locals (and inherited thread locals).
+     */
+    public final void eraseThreadLocals() {
+        UNSAFE.putObject(this, THREAD_LOCALS, null);
+        UNSAFE.putObject(this, INHERITABLE_THREAD_LOCALS, null);
+    }
+
+    static {
+        UNSAFE = Unsafe.getUnsafe();
+        Class<?> t = Thread.class;
+        try {
+            THREAD_LOCALS = UNSAFE.objectFieldOffset
+                (t.getDeclaredField("threadLocals"));
+            INHERITABLE_THREAD_LOCALS = UNSAFE.objectFieldOffset
+                (t.getDeclaredField("inheritableThreadLocals"));
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+    }
+}
+
--- a/src/java.base/share/classes/sun/misc/RequestProcessor.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/misc/RequestProcessor.java	Fri Apr 17 10:24:46 2015 -0700
@@ -77,7 +77,7 @@
      */
     public static synchronized void startProcessing() {
         if (dispatcher == null) {
-            dispatcher = new Thread(new RequestProcessor(), "Request Processor");
+            dispatcher = new ManagedLocalsThread(new RequestProcessor(), "Request Processor");
             dispatcher.setPriority(Thread.NORM_PRIORITY + 2);
             dispatcher.start();
         }
--- a/src/java.base/share/classes/sun/misc/Signal.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/misc/Signal.java	Fri Apr 17 10:24:46 2015 -0700
@@ -213,7 +213,7 @@
             }
         };
         if (handler != null) {
-            new Thread(runnable, sig + " handler").start();
+            new ManagedLocalsThread(runnable, sig + " handler").start();
         }
     }
 
--- a/src/java.base/share/classes/sun/net/NetworkServer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/net/NetworkServer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -27,6 +27,7 @@
 import java.io.*;
 import java.net.Socket;
 import java.net.ServerSocket;
+import sun.misc.ManagedLocalsThread;
 
 /**
  * This is the base class for network servers.  To define a new type
@@ -72,7 +73,7 @@
                     NetworkServer n = (NetworkServer)clone();
                     n.serverSocket = null;
                     n.clientSocket = ns;
-                    new Thread(n).start();
+                    new ManagedLocalsThread(n).start();
                 } catch(Exception e) {
                     System.out.print("Server failure\n");
                     e.printStackTrace();
@@ -107,7 +108,7 @@
         for each new connection. */
     final public void startServer(int port) throws IOException {
         serverSocket = new ServerSocket(port, 50);
-        serverInstance = new Thread(this);
+        serverInstance = new ManagedLocalsThread(this);
         serverInstance.start();
     }
 
--- a/src/java.base/share/classes/sun/net/www/MimeLauncher.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/net/www/MimeLauncher.java	Fri Apr 17 10:24:46 2015 -0700
@@ -27,8 +27,9 @@
 import java.net.URL;
 import java.io.*;
 import java.util.StringTokenizer;
+import sun.misc.ManagedLocalsThread;
 
-class MimeLauncher extends Thread {
+class MimeLauncher extends ManagedLocalsThread {
     java.net.URLConnection uc;
     MimeEntry m;
     String genericTempFileTemplate;
--- a/src/java.base/share/classes/sun/net/www/http/KeepAliveCache.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/net/www/http/KeepAliveCache.java	Fri Apr 17 10:24:46 2015 -0700
@@ -30,6 +30,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.net.URL;
+import sun.misc.InnocuousThread;
 
 /**
  * A class that implements a cache of idle Http connections for keep-alive
@@ -95,15 +96,7 @@
             java.security.AccessController.doPrivileged(
                 new java.security.PrivilegedAction<Void>() {
                 public Void run() {
-                   // We want to create the Keep-Alive-Timer in the
-                    // system threadgroup
-                    ThreadGroup grp = Thread.currentThread().getThreadGroup();
-                    ThreadGroup parent = null;
-                    while ((parent = grp.getParent()) != null) {
-                        grp = parent;
-                    }
-
-                    keepAliveTimer = new Thread(grp, cache, "Keep-Alive-Timer");
+                    keepAliveTimer = new InnocuousThread(cache, "Keep-Alive-Timer");
                     keepAliveTimer.setDaemon(true);
                     keepAliveTimer.setPriority(Thread.MAX_PRIORITY - 2);
                     // Set the context class loader to null in order to avoid
--- a/src/java.base/share/classes/sun/net/www/http/KeepAliveStream.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/net/www/http/KeepAliveStream.java	Fri Apr 17 10:24:46 2015 -0700
@@ -26,6 +26,8 @@
 package sun.net.www.http;
 
 import java.io.*;
+
+import sun.misc.InnocuousThread;
 import sun.net.ProgressSource;
 import sun.net.www.MeteredStream;
 
@@ -171,15 +173,7 @@
                 java.security.AccessController.doPrivileged(
                     new java.security.PrivilegedAction<Void>() {
                     public Void run() {
-                        // We want to create the Keep-Alive-SocketCleaner in the
-                        // system threadgroup
-                        ThreadGroup grp = Thread.currentThread().getThreadGroup();
-                        ThreadGroup parent = null;
-                        while ((parent = grp.getParent()) != null) {
-                            grp = parent;
-                        }
-
-                        cleanerThread = new Thread(grp, queue, "Keep-Alive-SocketCleaner");
+                        cleanerThread = new InnocuousThread(queue, "Keep-Alive-SocketCleaner");
                         cleanerThread.setDaemon(true);
                         cleanerThread.setPriority(Thread.MAX_PRIORITY - 2);
                         // Set the context class loader to null in order to avoid
--- a/src/java.base/share/classes/sun/nio/fs/AbstractPoller.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/nio/fs/AbstractPoller.java	Fri Apr 17 10:24:46 2015 -0700
@@ -30,6 +30,7 @@
 import java.security.PrivilegedAction;
 import java.io.IOException;
 import java.util.*;
+import sun.misc.ManagedLocalsThread;
 
 /**
  * Base implementation of background poller thread used in watch service
@@ -59,7 +60,7 @@
         AccessController.doPrivileged(new PrivilegedAction<Object>() {
             @Override
             public Object run() {
-                Thread thr = new Thread(thisRunnable);
+                Thread thr = new ManagedLocalsThread(thisRunnable);
                 thr.setDaemon(true);
                 thr.start();
                 return null;
--- a/src/java.base/share/classes/sun/nio/fs/Cancellable.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/nio/fs/Cancellable.java	Fri Apr 17 10:24:46 2015 -0700
@@ -25,6 +25,7 @@
 
 package sun.nio.fs;
 
+import sun.misc.ManagedLocalsThread;
 import sun.misc.Unsafe;
 import java.util.concurrent.ExecutionException;
 
@@ -117,7 +118,7 @@
      * thread by writing into the memory location that it polls cooperatively.
      */
     static void runInterruptibly(Cancellable task) throws ExecutionException {
-        Thread t = new Thread(task);
+        Thread t = new ManagedLocalsThread(task);
         t.start();
         boolean cancelledByInterrupt = false;
         while (t.isAlive()) {
--- a/src/java.base/share/classes/sun/nio/fs/PollingWatchService.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/nio/fs/PollingWatchService.java	Fri Apr 17 10:24:46 2015 -0700
@@ -35,6 +35,7 @@
 import java.util.*;
 import java.util.concurrent.*;
 import com.sun.nio.file.SensitivityWatchEventModifier;
+import sun.misc.ManagedLocalsThread;
 
 /**
  * Simple WatchService implementation that uses periodic tasks to poll
@@ -58,7 +59,7 @@
             .newSingleThreadScheduledExecutor(new ThreadFactory() {
                  @Override
                  public Thread newThread(Runnable r) {
-                     Thread t = new Thread(r);
+                     Thread t = new ManagedLocalsThread(r);
                      t.setDaemon(true);
                      return t;
                  }});
--- a/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Fri Apr 17 10:24:46 2015 -0700
@@ -716,6 +716,11 @@
 
         entry.protectedPrivKey = key.clone();
         if (chain != null) {
+            // validate cert-chain
+            if ((chain.length > 1) && (!validateChain(chain))) {
+                throw new KeyStoreException("Certificate chain is "
+                        + "not valid");
+            }
             entry.chain = chain.clone();
             certificateCount += chain.length;
 
@@ -1490,7 +1495,12 @@
             if (!(issuerDN.equals(subjectDN)))
                 return false;
         }
-        return true;
+
+        // Check for loops in the chain. If there are repeated certs,
+        // the Set of certs in the chain will contain fewer certs than
+        // the chain
+        Set<Certificate> set = new HashSet<>(Arrays.asList(certChain));
+        return set.size() == certChain.length;
     }
 
 
@@ -2070,7 +2080,24 @@
                 ArrayList<X509Certificate> chain =
                                 new ArrayList<X509Certificate>();
                 X509Certificate cert = findMatchedCertificate(entry);
+
+                mainloop:
                 while (cert != null) {
+                    // Check for loops in the certificate chain
+                    if (!chain.isEmpty()) {
+                        for (X509Certificate chainCert : chain) {
+                            if (cert.equals(chainCert)) {
+                                if (debug != null) {
+                                    debug.println("Loop detected in " +
+                                        "certificate chain. Skip adding " +
+                                        "repeated cert to chain. Subject: " +
+                                        cert.getSubjectX500Principal()
+                                            .toString());
+                                }
+                                break mainloop;
+                            }
+                        }
+                    }
                     chain.add(cert);
                     X500Principal issuerDN = cert.getIssuerX500Principal();
                     if (issuerDN.equals(cert.getSubjectX500Principal())) {
--- a/src/java.base/share/classes/sun/security/provider/SeedGenerator.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/provider/SeedGenerator.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,6 +75,7 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.util.Random;
+import sun.misc.ManagedLocalsThread;
 import sun.security.util.Debug;
 
 abstract class SeedGenerator {
@@ -304,7 +305,7 @@
                             }
                             finalsg[0] = new ThreadGroup
                                 (group, "SeedGenerator ThreadGroup");
-                            Thread newT = new Thread(finalsg[0],
+                            Thread newT = new ManagedLocalsThread(finalsg[0],
                                 ThreadedSeedGenerator.this,
                                 "SeedGenerator Thread");
                             newT.setPriority(Thread.MIN_PRIORITY);
@@ -341,7 +342,7 @@
                         // Start some noisy threads
                         try {
                             BogusThread bt = new BogusThread();
-                            Thread t = new Thread
+                            Thread t = new ManagedLocalsThread
                                 (seedGroup, bt, "SeedGenerator Thread");
                             t.start();
                         } catch (Exception e) {
--- a/src/java.base/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Fri Apr 17 10:24:46 2015 -0700
@@ -551,10 +551,10 @@
                 // set interim reasons mask to the intersection of
                 // reasons in the DP and onlySomeReasons in the IDP
                 boolean[] idpReasonFlags = reasons.getFlags();
-                for (int i = 0; i < idpReasonFlags.length; i++) {
-                    if (idpReasonFlags[i] && pointReasonFlags[i]) {
-                        interimReasonsMask[i] = true;
-                    }
+                for (int i = 0; i < interimReasonsMask.length; i++) {
+                    interimReasonsMask[i] =
+                        (i < idpReasonFlags.length && idpReasonFlags[i]) &&
+                        (i < pointReasonFlags.length && pointReasonFlags[i]);
                 }
             } else {
                 // set interim reasons mask to the value of
@@ -568,7 +568,6 @@
                 interimReasonsMask = pointReasonFlags.clone();
             } else {
                 // set interim reasons mask to the special value all-reasons
-                interimReasonsMask = new boolean[9];
                 Arrays.fill(interimReasonsMask, true);
             }
         }
@@ -577,7 +576,9 @@
         // not included in the reasons mask
         boolean oneOrMore = false;
         for (int i = 0; i < interimReasonsMask.length && !oneOrMore; i++) {
-            if (!reasonsMask[i] && interimReasonsMask[i]) {
+            if (interimReasonsMask[i] &&
+                    !(i < reasonsMask.length && reasonsMask[i]))
+            {
                 oneOrMore = true;
             }
         }
@@ -703,11 +704,11 @@
         }
 
         // update reasonsMask
-        for (int i = 0; i < interimReasonsMask.length; i++) {
-            if (!reasonsMask[i] && interimReasonsMask[i]) {
-                reasonsMask[i] = true;
-            }
+        for (int i = 0; i < reasonsMask.length; i++) {
+            reasonsMask[i] = reasonsMask[i] ||
+                    (i < interimReasonsMask.length && interimReasonsMask[i]);
         }
+
         return true;
     }
 
--- a/src/java.base/share/classes/sun/security/rsa/RSACore.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/rsa/RSACore.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -102,12 +102,24 @@
 
     /**
      * Perform an RSA private key operation. Uses CRT if the key is a
-     * CRT key.
+     * CRT key with additional verification check after the signature
+     * is computed.
      */
+    @Deprecated
     public static byte[] rsa(byte[] msg, RSAPrivateKey key)
             throws BadPaddingException {
+        return rsa(msg, key, true);
+    }
+
+    /**
+     * Perform an RSA private key operation. Uses CRT if the key is a
+     * CRT key. Set 'verify' to true if this function is used for
+     * generating a signature.
+     */
+    public static byte[] rsa(byte[] msg, RSAPrivateKey key, boolean verify)
+            throws BadPaddingException {
         if (key instanceof RSAPrivateCrtKey) {
-            return crtCrypt(msg, (RSAPrivateCrtKey)key);
+            return crtCrypt(msg, (RSAPrivateCrtKey)key, verify);
         } else {
             return priCrypt(msg, key.getModulus(), key.getPrivateExponent());
         }
@@ -148,10 +160,11 @@
      * RSA private key operations with CRT. Algorithm and variable naming
      * are taken from PKCS#1 v2.1, section 5.1.2.
      */
-    private static byte[] crtCrypt(byte[] msg, RSAPrivateCrtKey key)
-            throws BadPaddingException {
+    private static byte[] crtCrypt(byte[] msg, RSAPrivateCrtKey key,
+            boolean verify) throws BadPaddingException {
         BigInteger n = key.getModulus();
-        BigInteger c = parseMsg(msg, n);
+        BigInteger c0 = parseMsg(msg, n);
+        BigInteger c = c0;
         BigInteger p = key.getPrimeP();
         BigInteger q = key.getPrimeQ();
         BigInteger dP = key.getPrimeExponentP();
@@ -184,6 +197,9 @@
         if (ENABLE_BLINDING) {
             m = m.multiply(brp.v).mod(n);
         }
+        if (verify && !c0.equals(m.modPow(e, n))) {
+            throw new BadPaddingException("RSA private key operation failed");
+        }
 
         return toByteArray(m, getByteLength(n));
     }
--- a/src/java.base/share/classes/sun/security/rsa/RSASignature.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/rsa/RSASignature.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -173,7 +173,7 @@
         try {
             byte[] encoded = encodeSignature(digestOID, digest);
             byte[] padded = padding.pad(encoded);
-            byte[] encrypted = RSACore.rsa(padded, privateKey);
+            byte[] encrypted = RSACore.rsa(padded, privateKey, true);
             return encrypted;
         } catch (GeneralSecurityException e) {
             throw new SignatureException("Could not sign data", e);
--- a/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java	Fri Apr 17 10:24:46 2015 -0700
@@ -293,7 +293,7 @@
             case K_ECDH_RSA:
                 throw new SSLProtocolException(
                     "Protocol violation: server sent a server key exchange"
-                    + "message for key exchange " + keyExchange);
+                    + " message for key exchange " + keyExchange);
             case K_KRB5:
             case K_KRB5_EXPORT:
                 throw new SSLProtocolException(
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Fri Apr 17 10:24:46 2015 -0700
@@ -39,6 +39,7 @@
 
 import javax.crypto.BadPaddingException;
 import javax.net.ssl.*;
+import sun.misc.ManagedLocalsThread;
 
 /**
  * Implementation of an SSL socket.  This is a normal connection type
@@ -1078,8 +1079,10 @@
                             HandshakeCompletedEvent event =
                                 new HandshakeCompletedEvent(this, sess);
 
-                            Thread t = new NotifyHandshakeThread(
-                                handshakeListeners.entrySet(), event);
+                            Thread t = new ManagedLocalsThread(
+                                new NotifyHandshake(
+                                    handshakeListeners.entrySet(), event),
+                                "HandshakeCompletedNotify-Thread");
                             t.start();
                         }
                     }
@@ -2575,17 +2578,16 @@
     // events.  This ensures that the notifications don't block the
     // protocol state machine.
     //
-    private static class NotifyHandshakeThread extends Thread {
+    private static class NotifyHandshake implements Runnable {
 
         private Set<Map.Entry<HandshakeCompletedListener,AccessControlContext>>
                 targets;        // who gets notified
         private HandshakeCompletedEvent event;          // the notification
 
-        NotifyHandshakeThread(
+        NotifyHandshake(
             Set<Map.Entry<HandshakeCompletedListener,AccessControlContext>>
             entrySet, HandshakeCompletedEvent e) {
 
-            super("HandshakeCompletedNotify-Thread");
             targets = new HashSet<>(entrySet);          // clone the entry set
             event = e;
         }
--- a/src/java.base/share/classes/sun/security/validator/EndEntityChecker.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/validator/EndEntityChecker.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -132,26 +132,33 @@
         return new EndEntityChecker(type, variant);
     }
 
-    void check(X509Certificate cert, Object parameter)
-            throws CertificateException {
+    void check(X509Certificate cert, Object parameter,
+            boolean checkUnresolvedCritExts) throws CertificateException {
         if (variant.equals(Validator.VAR_GENERIC)) {
-            // no checks
-            return;
-        } else if (variant.equals(Validator.VAR_TLS_SERVER)) {
-            checkTLSServer(cert, (String)parameter);
+            return; // no checks
+        }
+
+        Set<String> exts = getCriticalExtensions(cert);
+        if (variant.equals(Validator.VAR_TLS_SERVER)) {
+            checkTLSServer(cert, (String)parameter, exts);
         } else if (variant.equals(Validator.VAR_TLS_CLIENT)) {
-            checkTLSClient(cert);
+            checkTLSClient(cert, exts);
         } else if (variant.equals(Validator.VAR_CODE_SIGNING)) {
-            checkCodeSigning(cert);
+            checkCodeSigning(cert, exts);
         } else if (variant.equals(Validator.VAR_JCE_SIGNING)) {
-            checkCodeSigning(cert);
+            checkCodeSigning(cert, exts);
         } else if (variant.equals(Validator.VAR_PLUGIN_CODE_SIGNING)) {
-            checkCodeSigning(cert);
+            checkCodeSigning(cert, exts);
         } else if (variant.equals(Validator.VAR_TSA_SERVER)) {
-            checkTSAServer(cert);
+            checkTSAServer(cert, exts);
         } else {
             throw new CertificateException("Unknown variant: " + variant);
         }
+
+        // if neither VAR_GENERIC variant nor unknown variant
+        if (checkUnresolvedCritExts) {
+            checkRemainingExtensions(exts);
+        }
     }
 
     /**
@@ -219,10 +226,8 @@
      * authentication.
      * @throws CertificateException if not.
      */
-    private void checkTLSClient(X509Certificate cert)
+    private void checkTLSClient(X509Certificate cert, Set<String> exts)
             throws CertificateException {
-        Set<String> exts = getCriticalExtensions(cert);
-
         if (checkKeyUsage(cert, KU_SIGNATURE) == false) {
             throw new ValidatorException
                 ("KeyUsage does not allow digital signatures",
@@ -245,8 +250,6 @@
         exts.remove(SimpleValidator.OID_KEY_USAGE);
         exts.remove(SimpleValidator.OID_EXTENDED_KEY_USAGE);
         exts.remove(SimpleValidator.OID_NETSCAPE_CERT_TYPE);
-
-        checkRemainingExtensions(exts);
     }
 
     /**
@@ -255,10 +258,8 @@
      * specification for details.
      * @throws CertificateException if not.
      */
-    private void checkTLSServer(X509Certificate cert, String parameter)
-            throws CertificateException {
-        Set<String> exts = getCriticalExtensions(cert);
-
+    private void checkTLSServer(X509Certificate cert, String parameter,
+            Set<String> exts) throws CertificateException {
         if (KU_SERVER_ENCRYPTION.contains(parameter)) {
             if (checkKeyUsage(cert, KU_KEY_ENCIPHERMENT) == false) {
                 throw new ValidatorException
@@ -303,18 +304,14 @@
         exts.remove(SimpleValidator.OID_KEY_USAGE);
         exts.remove(SimpleValidator.OID_EXTENDED_KEY_USAGE);
         exts.remove(SimpleValidator.OID_NETSCAPE_CERT_TYPE);
-
-        checkRemainingExtensions(exts);
     }
 
     /**
      * Check whether this certificate can be used for code signing.
      * @throws CertificateException if not.
      */
-    private void checkCodeSigning(X509Certificate cert)
+    private void checkCodeSigning(X509Certificate cert, Set<String> exts)
             throws CertificateException {
-        Set<String> exts = getCriticalExtensions(cert);
-
         if (checkKeyUsage(cert, KU_SIGNATURE) == false) {
             throw new ValidatorException
                 ("KeyUsage does not allow digital signatures",
@@ -341,8 +338,6 @@
         // remove extensions we checked
         exts.remove(SimpleValidator.OID_KEY_USAGE);
         exts.remove(SimpleValidator.OID_EXTENDED_KEY_USAGE);
-
-        checkRemainingExtensions(exts);
     }
 
     /**
@@ -350,10 +345,8 @@
      * server (see RFC 3161, section 2.3).
      * @throws CertificateException if not.
      */
-    private void checkTSAServer(X509Certificate cert)
+    private void checkTSAServer(X509Certificate cert, Set<String> exts)
             throws CertificateException {
-        Set<String> exts = getCriticalExtensions(cert);
-
         if (checkKeyUsage(cert, KU_SIGNATURE) == false) {
             throw new ValidatorException
                 ("KeyUsage does not allow digital signatures",
@@ -376,7 +369,5 @@
         // remove extensions we checked
         exts.remove(SimpleValidator.OID_KEY_USAGE);
         exts.remove(SimpleValidator.OID_EXTENDED_KEY_USAGE);
-
-        checkRemainingExtensions(exts);
     }
 }
--- a/src/java.base/share/classes/sun/security/validator/Validator.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/validator/Validator.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,6 +143,7 @@
      */
     public final static String VAR_PLUGIN_CODE_SIGNING = "plugin code signing";
 
+    private final String type;
     final EndEntityChecker endEntityChecker;
     final String variant;
 
@@ -154,6 +155,7 @@
     volatile Date validationDate;
 
     Validator(String type, String variant) {
+        this.type = type;
         this.variant = variant;
         endEntityChecker = EndEntityChecker.getInstance(type, variant);
     }
@@ -261,7 +263,16 @@
 
         // omit EE extension check if EE cert is also trust anchor
         if (chain.length > 1) {
-            endEntityChecker.check(chain[0], parameter);
+            // EndEntityChecker does not need to check unresolved critical
+            // extensions when validating with a TYPE_PKIX Validator.
+            // A TYPE_PKIX Validator will already have run checks on all
+            // certs' extensions, including checks by any PKIXCertPathCheckers
+            // included in the PKIXParameters, so the extra checks would be
+            // redundant.
+            boolean checkUnresolvedCritExts =
+                    (type == TYPE_PKIX) ? false : true;
+            endEntityChecker.check(chain[0], parameter,
+                                   checkUnresolvedCritExts);
         }
 
         return chain;
--- a/src/java.base/share/classes/sun/security/x509/KeyUsageExtension.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/x509/KeyUsageExtension.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,8 @@
      * @param position the position in the bit string to check.
      */
     private boolean isSet(int position) {
-        return bitString[position];
+        return (position < bitString.length) &&
+                bitString[position];
     }
 
     /**
@@ -275,41 +276,40 @@
      * Returns a printable representation of the KeyUsage.
      */
     public String toString() {
-        String s = super.toString() + "KeyUsage [\n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(super.toString());
+        sb.append("KeyUsage [\n");
 
-        try {
-            if (isSet(0)) {
-                s += "  DigitalSignature\n";
-            }
-            if (isSet(1)) {
-                s += "  Non_repudiation\n";
-            }
-            if (isSet(2)) {
-                s += "  Key_Encipherment\n";
-            }
-            if (isSet(3)) {
-                s += "  Data_Encipherment\n";
-            }
-            if (isSet(4)) {
-                s += "  Key_Agreement\n";
-            }
-            if (isSet(5)) {
-                s += "  Key_CertSign\n";
-            }
-            if (isSet(6)) {
-                s += "  Crl_Sign\n";
-            }
-            if (isSet(7)) {
-                s += "  Encipher_Only\n";
-            }
-            if (isSet(8)) {
-                s += "  Decipher_Only\n";
-            }
-        } catch (ArrayIndexOutOfBoundsException ex) {}
+        if (isSet(0)) {
+            sb.append("  DigitalSignature\n");
+        }
+        if (isSet(1)) {
+            sb.append("  Non_repudiation\n");
+        }
+        if (isSet(2)) {
+            sb.append("  Key_Encipherment\n");
+        }
+        if (isSet(3)) {
+            sb.append("  Data_Encipherment\n");
+        }
+        if (isSet(4)) {
+            sb.append("  Key_Agreement\n");
+        }
+        if (isSet(5)) {
+            sb.append("  Key_CertSign\n");
+        }
+        if (isSet(6)) {
+            sb.append("  Crl_Sign\n");
+        }
+        if (isSet(7)) {
+            sb.append("  Encipher_Only\n");
+        }
+        if (isSet(8)) {
+            sb.append("  Decipher_Only\n");
+        }
+        sb.append("]\n");
 
-        s += "]\n";
-
-        return (s);
+        return sb.toString();
     }
 
     /**
--- a/src/java.base/share/classes/sun/security/x509/NetscapeCertTypeExtension.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/x509/NetscapeCertTypeExtension.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -136,7 +136,8 @@
      * @param position the position in the bit string to check.
      */
     private boolean isSet(int position) {
-        return bitString[position];
+        return (position < bitString.length) &&
+                bitString[position];
     }
 
     /**
@@ -236,27 +237,34 @@
      * Returns a printable representation of the NetscapeCertType.
      */
     public String toString() {
-        String s = super.toString() + "NetscapeCertType [\n";
+        StringBuilder sb = new StringBuilder();
+        sb.append(super.toString());
+        sb.append("NetscapeCertType [\n");
 
-        try {
-           if (isSet(getPosition(SSL_CLIENT)))
-               s += "   SSL client\n";
-           if (isSet(getPosition(SSL_SERVER)))
-               s += "   SSL server\n";
-           if (isSet(getPosition(S_MIME)))
-               s += "   S/MIME\n";
-           if (isSet(getPosition(OBJECT_SIGNING)))
-               s += "   Object Signing\n";
-           if (isSet(getPosition(SSL_CA)))
-               s += "   SSL CA\n";
-           if (isSet(getPosition(S_MIME_CA)))
-               s += "   S/MIME CA\n";
-           if (isSet(getPosition(OBJECT_SIGNING_CA)))
-               s += "   Object Signing CA" ;
-        } catch (Exception e) { }
+        if (isSet(0)) {
+            sb.append("   SSL client\n");
+        }
+        if (isSet(1)) {
+            sb.append("   SSL server\n");
+        }
+        if (isSet(2)) {
+            sb.append("   S/MIME\n");
+        }
+        if (isSet(3)) {
+            sb.append("   Object Signing\n");
+        }
+        if (isSet(5)) {
+            sb.append("   SSL CA\n");
+        }
+        if (isSet(6)) {
+            sb.append("   S/MIME CA\n");
+        }
+        if (isSet(7)) {
+            sb.append("   Object Signing CA");
+        }
 
-        s += "]\n";
-        return (s);
+        sb.append("]\n");
+        return sb.toString();
     }
 
     /**
--- a/src/java.base/share/classes/sun/security/x509/ReasonFlags.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/security/x509/ReasonFlags.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -99,7 +99,8 @@
      * @param position the position in the bit string to check.
      */
     private boolean isSet(int position) {
-        return bitString[position];
+        return (position < bitString.length) &&
+                bitString[position];
     }
 
     /**
@@ -199,23 +200,38 @@
      * Returns a printable representation of the ReasonFlags.
      */
     public String toString() {
-        String s = "Reason Flags [\n";
+        StringBuilder sb = new StringBuilder("Reason Flags [\n");
 
-        try {
-            if (isSet(0)) s += "  Unused\n";
-            if (isSet(1)) s += "  Key Compromise\n";
-            if (isSet(2)) s += "  CA Compromise\n";
-            if (isSet(3)) s += "  Affiliation_Changed\n";
-            if (isSet(4)) s += "  Superseded\n";
-            if (isSet(5)) s += "  Cessation Of Operation\n";
-            if (isSet(6)) s += "  Certificate Hold\n";
-            if (isSet(7)) s += "  Privilege Withdrawn\n";
-            if (isSet(8)) s += "  AA Compromise\n";
-        } catch (ArrayIndexOutOfBoundsException ex) {}
+        if (isSet(0)) {
+            sb.append("  Unused\n");
+        }
+        if (isSet(1)) {
+            sb.append("  Key Compromise\n");
+        }
+        if (isSet(2)) {
+            sb.append("  CA Compromise\n");
+        }
+        if (isSet(3)) {
+            sb.append("  Affiliation_Changed\n");
+        }
+        if (isSet(4)) {
+            sb.append("  Superseded\n");
+        }
+        if (isSet(5)) {
+            sb.append("  Cessation Of Operation\n");
+        }
+        if (isSet(6)) {
+            sb.append("  Certificate Hold\n");
+        }
+        if (isSet(7)) {
+            sb.append("  Privilege Withdrawn\n");
+        }
+        if (isSet(8)) {
+            sb.append("  AA Compromise\n");
+        }
+        sb.append("]\n");
 
-        s += "]\n";
-
-        return (s);
+        return sb.toString();
     }
 
     /**
--- a/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java	Fri Apr 17 10:24:46 2015 -0700
@@ -47,6 +47,7 @@
 import java.util.LinkedHashSet;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 import java.util.ResourceBundle;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -250,17 +251,17 @@
         return (String) localeName;
     }
 
-    String[] getTimeZoneNames(String key, int size) {
+    String[] getTimeZoneNames(String key) {
         String[] names = null;
-        String cacheKey = TIME_ZONE_NAMES + size + '.' + key;
+        String cacheKey = TIME_ZONE_NAMES + '.' + key;
 
         removeEmptyReferences();
         ResourceReference data = cache.get(cacheKey);
 
-        if (data == null || ((names = (String[]) data.get()) == null)) {
+        if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
             TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
             if (tznb.containsKey(key)) {
-                names = tznb.getStringArray(key, size);
+                names = tznb.getStringArray(key);
                 cache.put(cacheKey,
                           new ResourceReference(cacheKey, (Object) names, referenceQueue));
             }
--- a/src/java.base/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java	Fri Apr 17 10:24:46 2015 -0700
@@ -26,6 +26,7 @@
 package sun.util.locale.provider;
 
 import java.util.Locale;
+import java.util.Objects;
 import java.util.Set;
 import java.util.TimeZone;
 import java.util.spi.TimeZoneNameProvider;
@@ -95,8 +96,9 @@
      */
     @Override
     public String getDisplayName(String id, boolean daylight, int style, Locale locale) {
-        String[] names = getDisplayNameArray(id, 5, locale);
-        if (names != null) {
+        String[] names = getDisplayNameArray(id, locale);
+        if (Objects.nonNull(names)) {
+            assert names.length >= 7;
             int index = daylight ? 3 : 1;
             if (style == TimeZone.SHORT) {
                 index++;
@@ -108,18 +110,18 @@
 
     @Override
     public String getGenericDisplayName(String id, int style, Locale locale) {
-        String[] names = getDisplayNameArray(id, 7, locale);
-        if (names != null && names.length >= 7) {
+        String[] names = getDisplayNameArray(id, locale);
+        if (Objects.nonNull(names)) {
+            assert names.length >= 7;
             return names[(style == TimeZone.LONG) ? 5 : 6];
         }
         return null;
     }
 
-    private String[] getDisplayNameArray(String id, int n, Locale locale) {
-        if (id == null || locale == null) {
-            throw new NullPointerException();
-        }
-        return LocaleProviderAdapter.forType(type).getLocaleResources(locale).getTimeZoneNames(id, n);
+    private String[] getDisplayNameArray(String id, Locale locale) {
+        Objects.requireNonNull(id);
+        Objects.requireNonNull(locale);
+        return LocaleProviderAdapter.forType(type).getLocaleResources(locale).getTimeZoneNames(id);
     }
 
     /**
--- a/src/java.base/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/util/locale/provider/TimeZoneNameUtility.java	Fri Apr 17 10:24:46 2015 -0700
@@ -30,6 +30,7 @@
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.spi.TimeZoneNameProvider;
@@ -100,9 +101,9 @@
      * Retrieve display names for a time zone ID.
      */
     public static String[] retrieveDisplayNames(String id, Locale locale) {
-        if (id == null || locale == null) {
-            throw new NullPointerException();
-        }
+        Objects.requireNonNull(id);
+        Objects.requireNonNull(locale);
+
         return retrieveDisplayNamesImpl(id, locale);
     }
 
@@ -115,9 +116,12 @@
      * @return the requested generic time zone display name, or null if not found.
      */
     public static String retrieveGenericDisplayName(String id, int style, Locale locale) {
-        LocaleServiceProviderPool pool =
-            LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
-        return pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale, "generic", style, id);
+        String[] names = retrieveDisplayNamesImpl(id, locale);
+        if (Objects.nonNull(names)) {
+            return names[6 - style];
+        } else {
+            return null;
+        }
     }
 
     /**
@@ -130,140 +134,53 @@
      * @return the requested time zone name, or null if not found.
      */
     public static String retrieveDisplayName(String id, boolean daylight, int style, Locale locale) {
-        LocaleServiceProviderPool pool =
-            LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
-        return pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale, daylight ? "dst" : "std", style, id);
+        String[] names = retrieveDisplayNamesImpl(id, locale);
+        if (Objects.nonNull(names)) {
+            return names[(daylight ? 4 : 2) - style];
+        } else {
+            return null;
+        }
     }
 
     private static String[] retrieveDisplayNamesImpl(String id, Locale locale) {
         LocaleServiceProviderPool pool =
             LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
+        String[] names;
+        Map<Locale, String[]> perLocale = null;
 
         SoftReference<Map<Locale, String[]>> ref = cachedDisplayNames.get(id);
-        if (ref != null) {
-            Map<Locale, String[]> perLocale = ref.get();
-            if (perLocale != null) {
-                String[] names = perLocale.get(locale);
-                if (names != null) {
+        if (Objects.nonNull(ref)) {
+            perLocale = ref.get();
+            if (Objects.nonNull(perLocale)) {
+                names = perLocale.get(locale);
+                if (Objects.nonNull(names)) {
                     return names;
                 }
-                names = pool.getLocalizedObject(TimeZoneNameArrayGetter.INSTANCE, locale, id);
-                if (names != null) {
-                    perLocale.put(locale, names);
-                }
-                return names;
             }
         }
 
-        String[] names = pool.getLocalizedObject(TimeZoneNameArrayGetter.INSTANCE, locale, id);
-        if (names != null) {
-            Map<Locale, String[]> perLocale = new ConcurrentHashMap<>();
-            perLocale.put(locale, names);
-            ref = new SoftReference<>(perLocale);
-            cachedDisplayNames.put(id, ref);
+        // build names array
+        names = new String[7];
+        names[0] = id;
+        for (int i = 1; i <= 6; i ++) {
+            names[i] = pool.getLocalizedObject(TimeZoneNameGetter.INSTANCE, locale,
+                    i<5 ? (i<3 ? "std" : "dst") : "generic", i%2, id);
         }
+
+        if (Objects.isNull(perLocale)) {
+            perLocale = new ConcurrentHashMap<>();
+        }
+        perLocale.put(locale, names);
+        ref = new SoftReference<>(perLocale);
+        cachedDisplayNames.put(id, ref);
         return names;
     }
 
+
     /**
      * Obtains a localized time zone strings from a TimeZoneNameProvider
      * implementation.
      */
-    private static class TimeZoneNameArrayGetter
-        implements LocaleServiceProviderPool.LocalizedObjectGetter<TimeZoneNameProvider,
-                                                                   String[]>{
-        private static final TimeZoneNameArrayGetter INSTANCE =
-            new TimeZoneNameArrayGetter();
-
-        @Override
-        public String[] getObject(TimeZoneNameProvider timeZoneNameProvider,
-                                  Locale locale,
-                                  String requestID,
-                                  Object... params) {
-            assert params.length == 0;
-
-            // First, try to get names with the request ID
-            String[] names = buildZoneStrings(timeZoneNameProvider, locale, requestID);
-
-            if (names == null) {
-                Map<String, String> aliases = ZoneInfo.getAliasTable();
-
-                if (aliases != null) {
-                    // Check whether this id is an alias, if so,
-                    // look for the standard id.
-                    String canonicalID = aliases.get(requestID);
-                    if (canonicalID != null) {
-                        names = buildZoneStrings(timeZoneNameProvider, locale, canonicalID);
-                    }
-                    if (names == null) {
-                        // There may be a case that a standard id has become an
-                        // alias.  so, check the aliases backward.
-                        names = examineAliases(timeZoneNameProvider, locale,
-                                   canonicalID == null ? requestID : canonicalID, aliases);
-                    }
-                }
-            }
-
-            if (names != null) {
-                names[0] = requestID;
-            }
-
-            return names;
-        }
-
-        private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale,
-                                               String id,
-                                               Map<String, String> aliases) {
-            if (aliases.containsValue(id)) {
-                for (Map.Entry<String, String> entry : aliases.entrySet()) {
-                    if (entry.getValue().equals(id)) {
-                        String alias = entry.getKey();
-                        String[] names = buildZoneStrings(tznp, locale, alias);
-                        if (names != null) {
-                            return names;
-                        }
-                        names = examineAliases(tznp, locale, alias, aliases);
-                        if (names != null) {
-                            return names;
-                        }
-                    }
-                }
-            }
-
-            return null;
-        }
-
-        private static String[] buildZoneStrings(TimeZoneNameProvider tznp,
-                                                 Locale locale, String id) {
-            String[] names = new String[5];
-
-            for (int i = 1; i <= 4; i ++) {
-                names[i] = tznp.getDisplayName(id, i>=3, i%2, locale);
-
-                if (names[i] == null) {
-                    switch (i) {
-                    case 1:
-                        // this id seems not localized by this provider
-                        return null;
-                    case 2:
-                    case 4:
-                        // If the display name for SHORT is not supplied,
-                        // copy the LONG name.
-                        names[i] = names[i-1];
-                        break;
-                    case 3:
-                        // If the display name for DST is not supplied,
-                        // copy the "standard" name.
-                        names[3] = names[1];
-                        break;
-                }
-            }
-            }
-
-            return names;
-        }
-    }
-
     private static class TimeZoneNameGetter
         implements LocaleServiceProviderPool.LocalizedObjectGetter<TimeZoneNameProvider,
                                                                    String> {
@@ -299,18 +216,16 @@
         private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                              String requestID, String tzid, int style,
                                              Map<String, String> aliases) {
-            if (aliases.containsValue(tzid)) {
-                for (Map.Entry<String, String> entry : aliases.entrySet()) {
-                    if (entry.getValue().equals(tzid)) {
-                        String alias = entry.getKey();
-                        String name = getName(tznp, locale, requestID, style, alias);
-                        if (name != null) {
-                            return name;
-                        }
-                        name = examineAliases(tznp, locale, requestID, alias, style, aliases);
-                        if (name != null) {
-                            return name;
-                        }
+            for (Map.Entry<String, String> entry : aliases.entrySet()) {
+                if (entry.getValue().equals(tzid)) {
+                    String alias = entry.getKey();
+                    String name = getName(tznp, locale, requestID, style, alias);
+                    if (name != null) {
+                        return name;
+                    }
+                    name = examineAliases(tznp, locale, requestID, alias, style, aliases);
+                    if (name != null) {
+                        return name;
                     }
                 }
             }
--- a/src/java.base/share/classes/sun/util/resources/TimeZoneNamesBundle.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/util/resources/TimeZoneNamesBundle.java	Fri Apr 17 10:24:46 2015 -0700
@@ -44,6 +44,7 @@
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.MissingResourceException;
+import java.util.Objects;
 import java.util.Set;
 
 /**
@@ -61,26 +62,6 @@
 public abstract class TimeZoneNamesBundle extends OpenListResourceBundle {
 
     /**
-     * Returns a String array containing time zone names. The String array has
-     * at most size elements.
-     *
-     * @param key  the time zone ID for which names are obtained
-     * @param size the requested size of array for names
-     * @return a String array containing names
-     */
-    public String[] getStringArray(String key, int size) {
-        String[] names = handleGetObject(key, size);
-        if ((names == null || names.length != size) && parent != null) {
-            names = ((TimeZoneNamesBundle)parent).getStringArray(key, size);
-        }
-        if (names == null) {
-            throw new MissingResourceException("no time zone names", getClass().getName(), key);
-        }
-        return names;
-
-    }
-
-    /**
      * Maps time zone IDs to locale-specific names.
      * The value returned is an array of five strings:
      * <ul>
@@ -89,6 +70,8 @@
      * <li>The short name of the time zone in standard time (localized).
      * <li>The long name of the time zone in daylight savings time (localized).
      * <li>The short name of the time zone in daylight savings time (localized).
+     * <li>The long name of the time zone in generic form (localized).
+     * <li>The short name of the time zone in generic form (localized).
      * </ul>
      * The localized names come from the subclasses's
      * <code>getContents</code> implementations, while the time zone
@@ -96,16 +79,12 @@
      */
     @Override
     public Object handleGetObject(String key) {
-        return handleGetObject(key, 5);
-    }
-
-    private String[] handleGetObject(String key, int n) {
         String[] contents = (String[]) super.handleGetObject(key);
-        if (contents == null) {
+        if (Objects.isNull(contents)) {
             return null;
         }
-        int clen = Math.min(n - 1, contents.length);
-        String[] tmpobj = new String[clen+1];
+        int clen = contents.length;
+        String[] tmpobj = new String[7];
         tmpobj[0] = key;
         System.arraycopy(contents, 0, tmpobj, 1, clen);
         return tmpobj;
--- a/src/java.base/share/classes/sun/util/resources/en/TimeZoneNames_en_IE.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/classes/sun/util/resources/en/TimeZoneNames_en_IE.java	Fri Apr 17 10:24:46 2015 -0700
@@ -47,7 +47,8 @@
     protected final Object[][] getContents() {
         return new Object[][] {
             {"Europe/London", new String[] {"Greenwich Mean Time", "GMT",
-                                    "Irish Summer Time", "IST" /*Dublin*/}},
+                                    "Irish Summer Time", "IST", /*Dublin*/
+                                    "Irish Time", "IT" /*Dublin*/}},
         };
     }
 }
--- a/src/java.base/share/conf/security/java.security	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/share/conf/security/java.security	Fri Apr 17 10:24:46 2015 -0700
@@ -533,4 +533,4 @@
 #
 # Example:
 #   jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048
-jdk.tls.disabledAlgorithms=SSLv3
+jdk.tls.disabledAlgorithms=SSLv3, RC4
--- a/src/java.base/windows/classes/sun/nio/ch/WindowsSelectorImpl.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/windows/classes/sun/nio/ch/WindowsSelectorImpl.java	Fri Apr 17 10:24:46 2015 -0700
@@ -40,6 +40,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import sun.misc.ManagedLocalsThread;
 
 /**
  * A multi-threaded implementation of Selector for Windows.
@@ -403,7 +404,7 @@
     }
 
     // Represents a helper thread used for select.
-    private final class SelectThread extends Thread {
+    private final class SelectThread extends ManagedLocalsThread {
         private final int index; // index of this thread
         final SubSelector subSelector;
         private long lastRun = 0; // last run number
--- a/src/java.base/windows/conf/security/java.policy	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/windows/conf/security/java.policy	Fri Apr 17 10:24:46 2015 -0700
@@ -6,3 +6,7 @@
         permission java.security.SecurityPermission "clearProviderProperties.SunMSCAPI";
         permission java.security.SecurityPermission "removeProviderProperty.SunMSCAPI";
 };
+
+grant codeBase "jrt:/jdk.accessibility" {
+        permission java.security.AllPermission;
+};
--- a/src/java.base/windows/native/launcher/java.manifest	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/windows/native/launcher/java.manifest	Fri Apr 17 10:24:46 2015 -0700
@@ -4,12 +4,12 @@
           xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
 >
 <assemblyIdentity
-    version="IMVERSION"
+    name=""
+    version=""
     processorArchitecture="X86"
-    name="Oracle Corporation, Java(tm) 2 Standard Edition"
     type="win32"
 />
-<description>Java(TM) SE PROGRAM process</description>
+<description>Java(TM) SE process</description>
 <dependency>
     <dependentAssembly>
         <assemblyIdentity
--- a/src/java.base/windows/native/launcher/java.rc	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/windows/native/launcher/java.rc	Fri Apr 17 10:24:46 2015 -0700
@@ -7,9 +7,3 @@
 // Icon
 //
 IDI_ICON           ICON    DISCARDABLE     "awt.ico"
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// RT_MANIFEST
-//
-1                  RT_MANIFEST             "java.manifest"
--- a/src/java.base/windows/native/libjava/TimeZone_md.c	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.base/windows/native/libjava/TimeZone_md.c	Fri Apr 17 10:24:46 2015 -0700
@@ -147,219 +147,248 @@
  */
 static int getWinTimeZone(char *winZoneName, char *winMapID)
 {
-    TIME_ZONE_INFORMATION tzi;
-    OSVERSIONINFO ver;
-    int onlyMapID;
-    HANDLE hKey = NULL, hSubKey = NULL;
+    DYNAMIC_TIME_ZONE_INFORMATION dtzi;
+    DWORD timeType;
+    DWORD bufSize;
+    DWORD val;
+    HANDLE hKey = NULL;
     LONG ret;
-    DWORD nSubKeys, i;
     ULONG valueType;
-    TCHAR subKeyName[MAX_ZONE_CHAR];
-    TCHAR szValue[MAX_ZONE_CHAR];
-    WCHAR stdNameInReg[MAX_ZONE_CHAR];
-    TziValue tempTzi;
-    WCHAR *stdNamePtr = tzi.StandardName;
-    DWORD valueSize;
-    DWORD timeType;
-    int isVista;
 
     /*
-     * Get the current time zone setting of the platform.
+     * Get the dynamic time zone information so that time zone redirection
+     * can be supported. (see JDK-7044727)
      */
-    timeType = GetTimeZoneInformation(&tzi);
+    timeType = GetDynamicTimeZoneInformation(&dtzi);
     if (timeType == TIME_ZONE_ID_INVALID) {
         goto err;
     }
 
     /*
-     * Determine if this is an NT system.
+     * Make sure TimeZoneKeyName is available from the API call. If
+     * DynamicDaylightTime is disabled, return a custom time zone name
+     * based on the GMT offset. Otherwise, return the TimeZoneKeyName
+     * value.
      */
-    ver.dwOSVersionInfoSize = sizeof(ver);
-    GetVersionEx(&ver);
-    isVista = ver.dwMajorVersion >= 6;
+    if (dtzi.TimeZoneKeyName[0] != 0) {
+        if (dtzi.DynamicDaylightTimeDisabled) {
+            customZoneName(dtzi.Bias, winZoneName);
+            return VALUE_GMTOFFSET;
+        }
+        wcstombs(winZoneName, dtzi.TimeZoneKeyName, MAX_ZONE_CHAR);
+        return VALUE_KEY;
+    }
 
-    ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_CURRENT_TZ_KEY, 0,
-                       KEY_READ, (PHKEY)&hKey);
-    if (ret == ERROR_SUCCESS) {
-        DWORD val;
-        DWORD bufSize;
+    /*
+     * If TimeZoneKeyName is not available, check whether StandardName
+     * is available to fall back to the older API GetTimeZoneInformation.
+     * If not, directly read the value from registry keys.
+     */
+    if (dtzi.StandardName[0] == 0) {
+        ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_CURRENT_TZ_KEY, 0,
+                           KEY_READ, (PHKEY)&hKey);
+        if (ret != ERROR_SUCCESS) {
+            goto err;
+        }
 
         /*
          * Determine if auto-daylight time adjustment is turned off.
          */
-        valueType = 0;
         bufSize = sizeof(val);
-        ret = RegQueryValueExA(hKey, "DisableAutoDaylightTimeSet",
-                               NULL, &valueType, (LPBYTE) &val, &bufSize);
+        ret = RegQueryValueExA(hKey, "DynamicDaylightTimeDisabled", NULL,
+                               &valueType, (LPBYTE) &val, &bufSize);
+        if (ret != ERROR_SUCCESS) {
+            goto err;
+        }
         /*
-         * Vista uses the different key name.
+         * Return a custom time zone name if auto-daylight time adjustment
+         * is disabled.
          */
-        if (ret != ERROR_SUCCESS) {
-            bufSize = sizeof(val);
-            ret = RegQueryValueExA(hKey, "DynamicDaylightTimeDisabled",
-                                   NULL, &valueType, (LPBYTE) &val, &bufSize);
+        if (val == 1) {
+            customZoneName(dtzi.Bias, winZoneName);
+            (void) RegCloseKey(hKey);
+            return VALUE_GMTOFFSET;
         }
 
+        bufSize = MAX_ZONE_CHAR;
+        ret = RegQueryValueExA(hKey, "TimeZoneKeyName", NULL,
+                               &valueType, (LPBYTE) winZoneName, &bufSize);
+        if (ret != ERROR_SUCCESS) {
+            goto err;
+        }
+        (void) RegCloseKey(hKey);
+        return VALUE_KEY;
+    } else {
+        /*
+         * Fall back to GetTimeZoneInformation
+         */
+        TIME_ZONE_INFORMATION tzi;
+        HANDLE hSubKey = NULL;
+        DWORD nSubKeys, i;
+        ULONG valueType;
+        TCHAR subKeyName[MAX_ZONE_CHAR];
+        TCHAR szValue[MAX_ZONE_CHAR];
+        WCHAR stdNameInReg[MAX_ZONE_CHAR];
+        TziValue tempTzi;
+        WCHAR *stdNamePtr = tzi.StandardName;
+        DWORD valueSize;
+        int onlyMapID;
+
+        timeType = GetTimeZoneInformation(&tzi);
+        if (timeType == TIME_ZONE_ID_INVALID) {
+            goto err;
+        }
+
+        ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_CURRENT_TZ_KEY, 0,
+                           KEY_READ, (PHKEY)&hKey);
         if (ret == ERROR_SUCCESS) {
-            int daylightSavingsUpdateDisabledOther = val == 1 && tzi.DaylightDate.wMonth != 0;
-            int daylightSavingsUpdateDisabledVista = val == 1;
-            int daylightSavingsUpdateDisabled = isVista ? daylightSavingsUpdateDisabledVista : daylightSavingsUpdateDisabledOther;
+            /*
+             * Determine if auto-daylight time adjustment is turned off.
+             */
+            bufSize = sizeof(val);
+            ret = RegQueryValueExA(hKey, "DynamicDaylightTimeDisabled", NULL,
+                                   &valueType, (LPBYTE) &val, &bufSize);
+            if (ret == ERROR_SUCCESS) {
+                if (val == 1 && tzi.DaylightDate.wMonth != 0) {
+                    (void) RegCloseKey(hKey);
+                    customZoneName(tzi.Bias, winZoneName);
+                    return VALUE_GMTOFFSET;
+                }
+            }
 
-            if (daylightSavingsUpdateDisabled) {
-                (void) RegCloseKey(hKey);
-                customZoneName(tzi.Bias, winZoneName);
-                return VALUE_GMTOFFSET;
+            /*
+             * Win32 problem: If the length of the standard time name is equal
+             * to (or probably longer than) 32 in the registry,
+             * GetTimeZoneInformation() on NT returns a null string as its
+             * standard time name. We need to work around this problem by
+             * getting the same information from the TimeZoneInformation
+             * registry.
+             */
+            if (tzi.StandardName[0] == 0) {
+                bufSize = sizeof(stdNameInReg);
+                ret = getValueInRegistry(hKey, STANDARD_NAME, &valueType,
+                                         (LPBYTE) stdNameInReg, &bufSize);
+                if (ret != ERROR_SUCCESS) {
+                    goto err;
+                }
+                stdNamePtr = stdNameInReg;
+            }
+            (void) RegCloseKey(hKey);
+        }
+
+        /*
+         * Open the "Time Zones" registry.
+         */
+        ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NT_TZ_KEY, 0, KEY_READ, (PHKEY)&hKey);
+        if (ret != ERROR_SUCCESS) {
+            ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_TZ_KEY, 0, KEY_READ, (PHKEY)&hKey);
+            /*
+             * If both failed, then give up.
+             */
+            if (ret != ERROR_SUCCESS) {
+                return VALUE_UNKNOWN;
             }
         }
 
         /*
-         * Vista has the key for the current "Time Zones" entry.
+         * Get the number of subkeys of the "Time Zones" registry for
+         * enumeration.
          */
-        if (isVista) {
-            valueType = 0;
-            bufSize = MAX_ZONE_CHAR;
-            ret = RegQueryValueExA(hKey, "TimeZoneKeyName", NULL,
-                                   &valueType, (LPBYTE) winZoneName, &bufSize);
-            if (ret != ERROR_SUCCESS) {
-                goto err;
-            }
-            (void) RegCloseKey(hKey);
-            return VALUE_KEY;
-        }
-
-        /*
-         * Win32 problem: If the length of the standard time name is equal
-         * to (or probably longer than) 32 in the registry,
-         * GetTimeZoneInformation() on NT returns a null string as its
-         * standard time name. We need to work around this problem by
-         * getting the same information from the TimeZoneInformation
-         * registry. The function on Win98 seems to return its key name.
-         * We can't do anything in that case.
-         */
-        if (tzi.StandardName[0] == 0) {
-            bufSize = sizeof(stdNameInReg);
-            ret = getValueInRegistry(hKey, STANDARD_NAME, &valueType,
-                                     (LPBYTE) stdNameInReg, &bufSize);
-            if (ret != ERROR_SUCCESS) {
-                goto err;
-            }
-            stdNamePtr = stdNameInReg;
-        }
-        (void) RegCloseKey(hKey);
-    }
-
-    /*
-     * Open the "Time Zones" registry.
-     */
-    ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, NT_TZ_KEY, 0, KEY_READ, (PHKEY)&hKey);
-    if (ret != ERROR_SUCCESS) {
-        ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_TZ_KEY, 0, KEY_READ, (PHKEY)&hKey);
-        /*
-         * If both failed, then give up.
-         */
-        if (ret != ERROR_SUCCESS) {
-            return VALUE_UNKNOWN;
-        }
-    }
-
-    /*
-     * Get the number of subkeys of the "Time Zones" registry for
-     * enumeration.
-     */
-    ret = RegQueryInfoKey(hKey, NULL, NULL, NULL, &nSubKeys,
-                          NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-    if (ret != ERROR_SUCCESS) {
-        goto err;
-    }
-
-    /*
-     * Compare to the "Std" value of each subkey and find the entry that
-     * matches the current control panel setting.
-     */
-    onlyMapID = 0;
-    for (i = 0; i < nSubKeys; ++i) {
-        DWORD size = sizeof(subKeyName);
-        ret = RegEnumKeyEx(hKey, i, subKeyName, &size, NULL, NULL, NULL, NULL);
-        if (ret != ERROR_SUCCESS) {
-            goto err;
-        }
-        ret = RegOpenKeyEx(hKey, subKeyName, 0, KEY_READ, (PHKEY)&hSubKey);
+        ret = RegQueryInfoKey(hKey, NULL, NULL, NULL, &nSubKeys,
+                              NULL, NULL, NULL, NULL, NULL, NULL, NULL);
         if (ret != ERROR_SUCCESS) {
             goto err;
         }
 
-        size = sizeof(szValue);
-        ret = getValueInRegistry(hSubKey, STD_NAME, &valueType,
-                                 szValue, &size);
-        if (ret != ERROR_SUCCESS) {
-            /*
-             * NT 4.0 SP3 fails here since it doesn't have the "Std"
-             * entry in the Time Zones registry.
-             */
-            RegCloseKey(hSubKey);
-            onlyMapID = 1;
-            ret = RegOpenKeyExW(hKey, stdNamePtr, 0, KEY_READ, (PHKEY)&hSubKey);
+        /*
+         * Compare to the "Std" value of each subkey and find the entry that
+         * matches the current control panel setting.
+         */
+        onlyMapID = 0;
+        for (i = 0; i < nSubKeys; ++i) {
+            DWORD size = sizeof(subKeyName);
+            ret = RegEnumKeyEx(hKey, i, subKeyName, &size, NULL, NULL, NULL, NULL);
             if (ret != ERROR_SUCCESS) {
                 goto err;
             }
-            break;
-        }
+            ret = RegOpenKeyEx(hKey, subKeyName, 0, KEY_READ, (PHKEY)&hSubKey);
+            if (ret != ERROR_SUCCESS) {
+                goto err;
+            }
 
-        if (wcscmp((WCHAR *)szValue, stdNamePtr) == 0) {
-            /*
-             * Some localized Win32 platforms use a same name to
-             * different time zones. So, we can't rely only on the name
-             * here. We need to check GMT offsets and transition dates
-             * to make sure it's the registry of the current time
-             * zone.
-             */
-            DWORD tziValueSize = sizeof(tempTzi);
-            ret = RegQueryValueEx(hSubKey, "TZI", NULL, &valueType,
-                                  (unsigned char *) &tempTzi, &tziValueSize);
-            if (ret == ERROR_SUCCESS) {
-                if ((tzi.Bias != tempTzi.bias) ||
-                    (memcmp((const void *) &tzi.StandardDate,
-                            (const void *) &tempTzi.stdDate,
-                            sizeof(SYSTEMTIME)) != 0)) {
-                        goto out;
+            size = sizeof(szValue);
+            ret = getValueInRegistry(hSubKey, STD_NAME, &valueType,
+                                     szValue, &size);
+            if (ret != ERROR_SUCCESS) {
+                /*
+                 * NT 4.0 SP3 fails here since it doesn't have the "Std"
+                 * entry in the Time Zones registry.
+                 */
+                RegCloseKey(hSubKey);
+                onlyMapID = 1;
+                ret = RegOpenKeyExW(hKey, stdNamePtr, 0, KEY_READ, (PHKEY)&hSubKey);
+                if (ret != ERROR_SUCCESS) {
+                    goto err;
                 }
+                break;
+            }
 
-                if (tzi.DaylightBias != 0) {
-                    if ((tzi.DaylightBias != tempTzi.dstBias) ||
-                        (memcmp((const void *) &tzi.DaylightDate,
-                                (const void *) &tempTzi.dstDate,
+            if (wcscmp((WCHAR *)szValue, stdNamePtr) == 0) {
+                /*
+                 * Some localized Win32 platforms use a same name to
+                 * different time zones. So, we can't rely only on the name
+                 * here. We need to check GMT offsets and transition dates
+                 * to make sure it's the registry of the current time
+                 * zone.
+                 */
+                DWORD tziValueSize = sizeof(tempTzi);
+                ret = RegQueryValueEx(hSubKey, "TZI", NULL, &valueType,
+                                      (unsigned char *) &tempTzi, &tziValueSize);
+                if (ret == ERROR_SUCCESS) {
+                    if ((tzi.Bias != tempTzi.bias) ||
+                        (memcmp((const void *) &tzi.StandardDate,
+                                (const void *) &tempTzi.stdDate,
                                 sizeof(SYSTEMTIME)) != 0)) {
                         goto out;
                     }
+
+                    if (tzi.DaylightBias != 0) {
+                        if ((tzi.DaylightBias != tempTzi.dstBias) ||
+                            (memcmp((const void *) &tzi.DaylightDate,
+                                    (const void *) &tempTzi.dstDate,
+                                    sizeof(SYSTEMTIME)) != 0)) {
+                            goto out;
+                        }
+                    }
                 }
+
+                /*
+                 * found matched record, terminate search
+                 */
+                strcpy(winZoneName, subKeyName);
+                break;
             }
+        out:
+            (void) RegCloseKey(hSubKey);
+        }
 
+        /*
+         * Get the "MapID" value of the registry to be able to eliminate
+         * duplicated key names later.
+         */
+        valueSize = MAX_MAPID_LENGTH;
+        ret = RegQueryValueExA(hSubKey, "MapID", NULL, &valueType, winMapID, &valueSize);
+        (void) RegCloseKey(hSubKey);
+        (void) RegCloseKey(hKey);
+
+        if (ret != ERROR_SUCCESS) {
             /*
-             * found matched record, terminate search
+             * Vista doesn't have mapID. VALUE_UNKNOWN should be returned
+             * only for Windows NT.
              */
-            strcpy(winZoneName, subKeyName);
-            break;
-        }
-    out:
-        (void) RegCloseKey(hSubKey);
-    }
-
-    /*
-     * Get the "MapID" value of the registry to be able to eliminate
-     * duplicated key names later.
-     */
-    valueSize = MAX_MAPID_LENGTH;
-    ret = RegQueryValueExA(hSubKey, "MapID", NULL, &valueType, winMapID, &valueSize);
-    (void) RegCloseKey(hSubKey);
-    (void) RegCloseKey(hKey);
-
-    if (ret != ERROR_SUCCESS) {
-        /*
-         * Vista doesn't have mapID. VALUE_UNKNOWN should be returned
-         * only for Windows NT.
-         */
-        if (onlyMapID == 1) {
-            return VALUE_UNKNOWN;
+            if (onlyMapID == 1) {
+                return VALUE_UNKNOWN;
+            }
         }
     }
 
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -25,15 +25,16 @@
 
 package com.apple.laf;
 
+
 import java.beans.*;
 import java.io.File;
 import java.util.*;
-
 import javax.swing.*;
 import javax.swing.event.ListDataEvent;
 import javax.swing.filechooser.FileSystemView;
 import javax.swing.table.AbstractTableModel;
 
+import sun.misc.ManagedLocalsThread;
 /**
  * NavServices-like implementation of a file Table
  *
@@ -42,7 +43,7 @@
 @SuppressWarnings("serial") // Superclass is not serializable across versions
 class AquaFileSystemModel extends AbstractTableModel implements PropertyChangeListener {
     private final JTable fFileList;
-    private LoadFilesThread loadThread = null;
+    private FilesLoader filesLoader = null;
     private Vector<File> files = null;
 
     JFileChooser filechooser = null;
@@ -141,9 +142,9 @@
 
     public void runWhenDone(final Runnable runnable){
          synchronized (fileCacheLock) {
-             if (loadThread != null) {
-                 if (loadThread.isAlive()) {
-                     loadThread.queuedTasks.add(runnable);
+             if (filesLoader != null) {
+                 if (filesLoader.loadThread.isAlive()) {
+                     filesLoader.queuedTasks.add(runnable);
                      return;
                  }
              }
@@ -160,9 +161,9 @@
             return;
         }
 
-        if (loadThread != null) {
+        if (filesLoader != null) {
             // interrupt
-            loadThread.interrupt();
+            filesLoader.loadThread.interrupt();
         }
 
         fetchID++;
@@ -173,8 +174,7 @@
             fileCache = new Vector<SortableFile>(50);
         }
 
-        loadThread = new LoadFilesThread(currentDirectory, fetchID);
-        loadThread.start();
+        filesLoader = new FilesLoader(currentDirectory, fetchID);
     }
 
     public int getColumnCount() {
@@ -373,17 +373,25 @@
         }
     }
 
-    class LoadFilesThread extends Thread {
-        Vector<Runnable> queuedTasks = new Vector<Runnable>();
+    class FilesLoader implements Runnable {
+        Vector<Runnable> queuedTasks = new Vector<>();
         File currentDirectory = null;
         int fid;
+        Thread loadThread;
 
-        public LoadFilesThread(final File currentDirectory, final int fid) {
-            super("Aqua L&F File Loading Thread");
+        public FilesLoader(final File currentDirectory, final int fid) {
             this.currentDirectory = currentDirectory;
             this.fid = fid;
+            String name = "Aqua L&F File Loading Thread";
+            if (System.getSecurityManager() == null) {
+                this.loadThread = new Thread(FilesLoader.this, name);
+            } else {
+                this.loadThread = new ManagedLocalsThread(FilesLoader.this, name);
+            }
+            this.loadThread.start();
         }
 
+        @Override
         public void run() {
             final Vector<DoChangeContents> runnables = new Vector<DoChangeContents>(10);
             final FileSystemView fileSystem = filechooser.getFileSystemView();
@@ -415,7 +423,7 @@
                 runnables.addElement(runnable);
                 SwingUtilities.invokeLater(runnable);
                 chunk = new Vector<SortableFile>(10);
-                if (isInterrupted()) {
+                if (loadThread.isInterrupted()) {
                     // interrupted, cancel all runnables
                     cancelRunnables(runnables);
                     return;
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaScrollPaneUI.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaScrollPaneUI.java	Fri Apr 17 10:24:46 2015 -0700
@@ -29,6 +29,7 @@
 
 import javax.swing.*;
 import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicScrollPaneUI;
 
 public class AquaScrollPaneUI extends javax.swing.plaf.basic.BasicScrollPaneUI {
     public static ComponentUI createUI(final JComponent x) {
@@ -39,28 +40,9 @@
         return new XYMouseWheelHandler();
     }
 
-    // This is a grody hack to trick BasicScrollPaneUI into scrolling horizontally
-    // when we notice that the shift key is down. This should be removed when AWT/Swing
-    // becomes aware of multi-axis scroll wheels.
-    protected class XYMouseWheelHandler extends javax.swing.plaf.basic.BasicScrollPaneUI.MouseWheelHandler {
+    protected class XYMouseWheelHandler extends BasicScrollPaneUI.MouseWheelHandler {
         public void mouseWheelMoved(final MouseWheelEvent e) {
-            JScrollBar vScrollBar = null;
-            boolean wasVisible = false;
-
-            if (e.isShiftDown()) {
-                vScrollBar = scrollpane.getVerticalScrollBar();
-                if (vScrollBar != null) {
-                    wasVisible = vScrollBar.isVisible();
-                    vScrollBar.setVisible(false);
-                }
-            }
-
             super.mouseWheelMoved(e);
-
-            if (wasVisible) {
-                vScrollBar.setVisible(true);
-            }
-
             // Consume the event even when the scrollBar is invisible
             // see #7124320
             e.consume();
--- a/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Fri Apr 17 10:24:46 2015 -0700
@@ -42,6 +42,7 @@
 import sun.awt.HeadlessToolkit;
 import sun.awt.util.ThreadGroupUtils;
 import sun.lwawt.macosx.*;
+import sun.misc.InnocuousThread;
 
 public final class CFontManager extends SunFontManager {
     private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
@@ -211,14 +212,18 @@
                                 });
                     }
                 };
-                AccessController.doPrivileged(
-                        (PrivilegedAction<Void>) () -> {
-                            /* The thread must be a member of a thread group
-                             * which will not get GCed before VM exit.
-                             * Make its parent the top-level thread group.
-                             */
-                            ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
-                            fileCloser = new Thread(rootTG, fileCloserRunnable);
+                AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+                            if (System.getSecurityManager() == null) {
+                                /* The thread must be a member of a thread group
+                                 * which will not get GCed before VM exit.
+                                 * Make its parent the top-level thread group.
+                                 */
+                                ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
+                                fileCloser = new Thread(rootTG, fileCloserRunnable);
+                            } else {
+                                /* InnocuousThread is a member of a correct TG by default */
+                                fileCloser = new InnocuousThread(fileCloserRunnable);
+                            }
                             fileCloser.setContextClassLoader(null);
                             Runtime.getRuntime().addShutdownHook(fileCloser);
                             return null;
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWCheckboxPeer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWCheckboxPeer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -132,7 +132,9 @@
     @Override
     public void setState(final boolean state) {
         synchronized (getDelegateLock()) {
+            getDelegate().getCurrentButton().removeItemListener(this);
             getDelegate().setSelected(state);
+            getDelegate().getCurrentButton().addItemListener(this);
         }
         repaintPeer();
     }
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java	Fri Apr 17 10:24:46 2015 -0700
@@ -35,6 +35,7 @@
 import java.util.*;
 
 import sun.awt.*;
+import sun.misc.InnocuousThread;
 import sun.print.*;
 import sun.awt.util.ThreadGroupUtils;
 
@@ -71,22 +72,32 @@
      */
     protected final void init() {
         AWTAutoShutdown.notifyToolkitThreadBusy();
-
-        ThreadGroup rootTG = AccessController.doPrivileged(
-                (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
-
-        Runtime.getRuntime().addShutdownHook(
-            new Thread(rootTG, () -> {
+        AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+            Runnable shutdownRunnable = () -> {
                 shutdown();
                 waitForRunState(STATE_CLEANUP);
-            })
-        );
+            };
+            Thread shutdown;
+            if (System.getSecurityManager() == null) {
+                shutdown = new Thread(ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable);
+            } else {
+                shutdown = new InnocuousThread(shutdownRunnable);
+            }
+            shutdown.setContextClassLoader(null);
+            Runtime.getRuntime().addShutdownHook(shutdown);
 
-        Thread toolkitThread = new Thread(rootTG, this, "AWT-LW");
-        toolkitThread.setDaemon(true);
-        toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
-        toolkitThread.start();
-
+            String name = "AWT-LW";
+            Thread toolkitThread;
+            if (System.getSecurityManager() == null) {
+                toolkitThread = new Thread(ThreadGroupUtils.getRootThreadGroup(), LWToolkit.this, name);
+            } else {
+                toolkitThread = new InnocuousThread(LWToolkit.this, name);
+            }
+            toolkitThread.setDaemon(true);
+            toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
+            toolkitThread.start();
+            return null;
+        });
         waitForRunState(STATE_MESSAGELOOP);
     }
 
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1296,6 +1296,12 @@
         }
 
         KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
+
+        if (!becomesFocused && kfmPeer.getCurrentFocusedWindow() != getTarget()) {
+            // late window focus lost event - ingoring
+            return;
+        }
+
         kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null);
 
         int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS;
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CClipboard.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CClipboard.java	Fri Apr 17 10:24:46 2015 -0700
@@ -57,6 +57,18 @@
     }
 
     @Override
+    public synchronized Transferable getContents(Object requestor) {
+        checkPasteboardAndNotify();
+        return super.getContents(requestor);
+    }
+
+    @Override
+    protected synchronized Transferable getContextContents() {
+        checkPasteboardAndNotify();
+        return super.getContextContents();
+    }
+
+    @Override
     protected void setContentsNative(Transferable contents) {
         FlavorTable flavorMap = getDefaultFlavorTable();
         // Don't use delayed Clipboard rendering for the Transferable's data.
@@ -116,13 +128,20 @@
     private native void declareTypes(long[] formats, SunClipboard newOwner);
     private native void setData(byte[] data, long format);
 
+    void checkPasteboardAndNotify() {
+        if (checkPasteboardWithoutNotification()) {
+            notifyChanged();
+            lostOwnershipNow(null);
+        }
+    }
+
     /**
      * Invokes native check whether a change count on the general pasteboard is different
      * than when we set it. The different count value means the current owner lost
      * pasteboard ownership and someone else put data on the clipboard.
      * @since 1.7
      */
-    native void checkPasteboard();
+    native boolean checkPasteboardWithoutNotification();
 
     /*** Native Callbacks ***/
     private void notifyLostOwnership() {
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -31,7 +31,6 @@
 import java.awt.dnd.*;
 import java.awt.event.*;
 import java.awt.image.*;
-import java.awt.peer.*;
 
 import javax.swing.*;
 import javax.swing.text.*;
@@ -44,6 +43,7 @@
 import sun.lwawt.LWComponentPeer;
 import sun.lwawt.LWWindowPeer;
 import sun.lwawt.PlatformWindow;
+import sun.misc.ManagedLocalsThread;
 
 
 public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
@@ -164,28 +164,29 @@
         // are posted during dragging by native event handlers.
 
         try {
-            Thread dragThread = new Thread() {
-                public void run() {
-                    final long nativeDragSource = getNativeContext();
-                    try {
-                        doDragging(nativeDragSource);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    } finally {
-                        releaseNativeDragSource(nativeDragSource);
-                        fDragImage = null;
-                        if (fDragCImage != null) {
-                            fDragCImage.dispose();
-                            fDragCImage = null;
-                        }
+            Runnable dragRunnable = () -> {
+                final long nativeDragSource = getNativeContext();
+                try {
+                    doDragging(nativeDragSource);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                } finally {
+                    releaseNativeDragSource(nativeDragSource);
+                    fDragImage = null;
+                    if (fDragCImage != null) {
+                        fDragCImage.dispose();
+                        fDragCImage = null;
                     }
                 }
             };
-
+            Thread dragThread;
+            if (System.getSecurityManager() == null) {
+                dragThread = new Thread(dragRunnable);
+            } else {
+                dragThread = new ManagedLocalsThread(dragRunnable);
+            }
             dragThread.start();
-        }
-
-        catch (Exception e) {
+        } catch (Exception e) {
             final long nativeDragSource = getNativeContext();
             setNativeContext(0);
             releaseNativeDragSource(nativeDragSource);
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Fri Apr 17 10:24:46 2015 -0700
@@ -123,7 +123,7 @@
             // it won't be invoced if focuse is moved to a html element
             // on the same page.
             CClipboard clipboard = (CClipboard) Toolkit.getDefaultToolkit().getSystemClipboard();
-            clipboard.checkPasteboard();
+            clipboard.checkPasteboardAndNotify();
         }
         if (parentWindowActive) {
             responder.handleWindowFocusEvent(focused, null);
@@ -164,7 +164,7 @@
         }
         // ignore focus "lost" native request as it may mistakenly
         // deactivate active window (see 8001161)
-        if (globalFocusedWindow == this && parentWindowActive) {
+        if (globalFocusedWindow == this) {
             responder.handleWindowFocusEvent(parentWindowActive, null);
         }
     }
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Fri Apr 17 10:24:46 2015 -0700
@@ -37,6 +37,7 @@
 import sun.awt.CausedFocusEvent.Cause;
 import sun.awt.AWTAccessor;
 import sun.java2d.pipe.Region;
+import sun.misc.ManagedLocalsThread;
 import sun.security.action.GetBooleanAction;
 
 class CFileDialog implements FileDialogPeer {
@@ -119,7 +120,11 @@
         if (visible) {
             // Java2 Dialog class requires peer to run code in a separate thread
             // and handles keeping the call modal
-            new Thread(new Task()).start(); // invokes my 'run' method, below...
+            if (System.getSecurityManager() == null) {
+                new Thread(new Task()).start();
+            } else {
+                new ManagedLocalsThread(new Task()).start();
+            }
         }
         // We hide ourself before "show" returns - setVisible(false)
         // doesn't apply
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -29,6 +29,7 @@
 import java.awt.dnd.*;
 
 import sun.lwawt.*;
+import sun.misc.ManagedLocalsThread;
 
 public class CPrinterDialogPeer extends LWWindowPeer {
     static {
@@ -53,13 +54,16 @@
 
     public void setVisible(boolean visible) {
         if (visible) {
-            new Thread(new Runnable() {
-                public void run() {
-                    CPrinterDialog printerDialog = (CPrinterDialog)fTarget;
-                    printerDialog.setRetVal(printerDialog.showDialog());
-                    printerDialog.setVisible(false);
-                }
-            }).start();
+            Runnable task = () -> {
+                CPrinterDialog printerDialog = (CPrinterDialog)fTarget;
+                printerDialog.setRetVal(printerDialog.showDialog());
+                printerDialog.setVisible(false);
+            };
+            if (System.getSecurityManager() == null) {
+                new Thread(task).start();
+            } else {
+                new ManagedLocalsThread(task).start();
+            }
         }
     }
 
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Fri Apr 17 10:24:46 2015 -0700
@@ -39,6 +39,7 @@
 import javax.print.attribute.standard.PageRanges;
 
 import sun.java2d.*;
+import sun.misc.ManagedLocalsThread;
 import sun.print.*;
 
 public final class CPrinterJob extends RasterPrinterJob {
@@ -731,9 +732,12 @@
 
     // upcall from native
     private static void detachPrintLoop(final long target, final long arg) {
-        new Thread() { public void run() {
-            _safePrintLoop(target, arg);
-        }}.start();
+        Runnable task = () -> _safePrintLoop(target, arg);
+        if (System.getSecurityManager() == null) {
+            new Thread(task).start();
+        } else {
+            new ManagedLocalsThread(task).start();
+        }
     }
     private static native void _safePrintLoop(long target, long arg);
 
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CClipboard.m	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CClipboard.m	Fri Apr 17 10:24:46 2015 -0700
@@ -107,6 +107,19 @@
     }
 }
 
+- (BOOL) checkPasteboardWithoutNotification:(id)application {
+    AWT_ASSERT_APPKIT_THREAD;
+    
+    NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount];
+    
+    if (self.changeCount != newChangeCount) {
+        self.changeCount = newChangeCount;    
+        return YES;
+    } else {
+        return NO;
+    }
+}
+
 @end
 
 /*
@@ -260,21 +273,20 @@
     return returnValue;
 }
 
-/*
- * Class:     sun_lwawt_macosx_CClipboard
- * Method:    checkPasteboard
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CClipboard_checkPasteboard
-(JNIEnv *env, jobject inObject )
-{
-JNF_COCOA_ENTER(env);
-
-    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        [[CClipboard sharedClipboard] checkPasteboard:nil];
-    }];
-        
-JNF_COCOA_EXIT(env);
-}
-
-
+/*                                                                                            
+ * Class:     sun_lwawt_macosx_CClipboard                                                     
+ * Method:    checkPasteboard                                                                 
+ * Signature: ()V                                                                             
+ */                                                                                           
+JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_CClipboard_checkPasteboardWithoutNotification
+(JNIEnv *env, jobject inObject)                                                               
+{                                                                                             
+    __block BOOL ret = NO;                                                                    
+    JNF_COCOA_ENTER(env);                                                                     
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){                                
+        ret = [[CClipboard sharedClipboard] checkPasteboardWithoutNotification:nil];          
+    }];                                                                                       
+                                                                                              
+    JNF_COCOA_EXIT(env);                                                                      
+    return ret;                                                                               
+}                                                                                             
\ No newline at end of file
--- a/src/java.desktop/share/classes/com/sun/imageio/stream/StreamCloser.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/stream/StreamCloser.java	Fri Apr 17 10:24:46 2015 -0700
@@ -25,7 +25,12 @@
 
 package com.sun.imageio.stream;
 
+import sun.awt.util.ThreadGroupUtils;
+import sun.misc.InnocuousThread;
+
 import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Set;
 import java.util.WeakHashMap;
 import javax.imageio.stream.ImageInputStream;
@@ -81,27 +86,25 @@
                     }
                 };
 
-                java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction<Object>() {
-                        public Object run() {
-                            /* The thread must be a member of a thread group
-                             * which will not get GCed before VM exit.
-                             * Make its parent the top-level thread group.
-                             */
-                            ThreadGroup tg =
-                                Thread.currentThread().getThreadGroup();
-                            for (ThreadGroup tgn = tg;
-                                 tgn != null;
-                                 tg = tgn, tgn = tg.getParent());
-                            streamCloser = new Thread(tg, streamCloserRunnable);
-                            /* Set context class loader to null in order to avoid
-                             * keeping a strong reference to an application classloader.
-                             */
-                            streamCloser.setContextClassLoader(null);
-                            Runtime.getRuntime().addShutdownHook(streamCloser);
-                            return null;
-                        }
-                    });
+                AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
+                    if (System.getSecurityManager() == null) {
+                        /* The thread must be a member of a thread group
+                         * which will not get GCed before VM exit.
+                         * Make its parent the top-level thread group.
+                         */
+                        ThreadGroup tg = ThreadGroupUtils.getRootThreadGroup();
+                        streamCloser = new Thread(tg, streamCloserRunnable);
+                    } else {
+                        /* InnocuousThread is a member of a correct TG by default */
+                        streamCloser = new InnocuousThread(streamCloserRunnable);
+                    }
+                    /* Set context class loader to null in order to avoid
+                     * keeping a strong reference to an application classloader.
+                     */
+                    streamCloser.setContextClassLoader(null);
+                    Runtime.getRuntime().addShutdownHook(streamCloser);
+                    return null;
+                });
             }
         }
     }
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java	Fri Apr 17 10:24:46 2015 -0700
@@ -68,7 +68,7 @@
             if (currentFrame != null && f != currentFrame) {
                 // If the current frame is maximized, transfer that
                 // attribute to the frame being activated.
-                if (currentFrame.isMaximum() &&
+                if (!currentFrame.isClosed() && currentFrame.isMaximum() &&
                     (f.getClientProperty("JInternalFrame.frameType") !=
                     "optionDialog") ) {
                     //Special case.  If key binding was used to select next
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -64,6 +64,7 @@
 import sun.awt.OSInfo;
 import sun.awt.shell.ShellFolder;
 import sun.font.FontUtilities;
+import sun.misc.ManagedLocalsThread;
 import sun.security.action.GetPropertyAction;
 
 import sun.swing.DefaultLayoutStyle;
@@ -2037,7 +2038,11 @@
             if (audioRunnable != null) {
                 // Runnable appears to block until completed playing, hence
                 // start up another thread to handle playing.
-                new Thread(audioRunnable).start();
+                if (System.getSecurityManager() == null) {
+                    new Thread(audioRunnable).start();
+                } else {
+                    new ManagedLocalsThread(audioRunnable).start();
+                }
             }
         }
     }
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java	Fri Apr 17 10:24:46 2015 -0700
@@ -197,6 +197,10 @@
                 root = null;
                 winAncestor = null;
             } else {
+                if (WindowsLookAndFeel.isMnemonicHidden() && ev.isAltDown()) {
+                    WindowsLookAndFeel.setMnemonicHidden(false);
+                    WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
+                }
                 altKeyPressed = false;
             }
             return false;
--- a/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java	Fri Apr 17 10:24:46 2015 -0700
@@ -25,6 +25,9 @@
 
 package com.sun.media.sound;
 
+import sun.misc.InnocuousThread;
+import sun.misc.ManagedLocalsThread;
+
 import java.io.BufferedInputStream;
 import java.io.InputStream;
 import java.io.File;
@@ -144,7 +147,13 @@
                                final String threadName,
                                final boolean isDaemon, final int priority,
                                final boolean doStart) {
-        Thread thread = new Thread(runnable);
+        Thread thread;
+        if (System.getSecurityManager() == null) {
+            thread = new Thread(runnable);
+        } else {
+            thread = new ManagedLocalsThread(runnable);
+        }
+
         if (threadName != null) {
             thread.setName(threadName);
         }
--- a/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java	Fri Apr 17 10:24:46 2015 -0700
@@ -24,6 +24,8 @@
  */
 package com.sun.media.sound;
 
+import sun.misc.ManagedLocalsThread;
+
 import java.io.IOException;
 
 import javax.sound.sampled.AudioInputStream;
@@ -53,7 +55,11 @@
         if (active)
             return;
         active = true;
-        audiothread = new Thread(this);
+        if (System.getSecurityManager() == null) {
+            audiothread = new Thread(this);
+        } else {
+            audiothread = new ManagedLocalsThread(this);
+        }
         audiothread.setDaemon(true);
         audiothread.setPriority(Thread.MAX_PRIORITY);
         audiothread.start();
--- a/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java	Fri Apr 17 10:24:46 2015 -0700
@@ -24,13 +24,14 @@
  */
 package com.sun.media.sound;
 
+import sun.misc.ManagedLocalsThread;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
 import java.io.EOFException;
 import java.io.IOException;
 import java.io.InputStream;
 
-import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioInputStream;
-
 /**
  * A jitter corrector to be used with SoftAudioPusher.
  *
@@ -215,7 +216,11 @@
                 }
             };
 
-            thread = new Thread(runnable);
+            if (System.getSecurityManager() == null) {
+                thread = new Thread(runnable);
+            } else {
+                thread = new ManagedLocalsThread(runnable);
+            }
             thread.setDaemon(true);
             thread.setPriority(Thread.MAX_PRIORITY);
             thread.start();
--- a/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -25,6 +25,8 @@
 
 package com.sun.media.sound;
 
+import sun.misc.ManagedLocalsThread;
+
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -139,7 +141,11 @@
                      pusher = null;
                      jitter_stream = null;
                      sourceDataLine = null;
-                     new Thread(runnable).start();
+                     if (System.getSecurityManager() == null) {
+                        new Thread(runnable).start();
+                     } else {
+                         new ManagedLocalsThread(runnable).start();
+                     }
                  }
                  return len;
              }
--- a/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1088,6 +1088,7 @@
      * contains only the specified listener. If no such listeners are chained,
      * this method returns an empty array.
      *
+     * @param <T> the listener type
      * @param l the specified <code>java.util.EventListener</code>
      * @param listenerType the type of listeners requested; this parameter
      *          should specify an interface that descends from
--- a/src/java.desktop/share/classes/java/awt/Component.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/Component.java	Fri Apr 17 10:24:46 2015 -0700
@@ -4316,9 +4316,12 @@
          */
         protected boolean validatedContents; // = false
         /**
-         * Size of the back buffers
+         * Width of the back buffers
          */
         protected int width;
+        /**
+         * Height of the back buffers
+         */
         protected int height;
 
         /**
@@ -6013,6 +6016,7 @@
      *
      * If no such listeners exist, this method returns an empty array.
      *
+     * @param <T> the type of the listeners
      * @param listenerType the type of listeners requested; this parameter
      *          should specify an interface that descends from
      *          <code>java.util.EventListener</code>
--- a/src/java.desktop/share/classes/java/awt/EventDispatchThread.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/EventDispatchThread.java	Fri Apr 17 10:24:46 2015 -0700
@@ -30,6 +30,8 @@
 import java.awt.event.WindowEvent;
 
 import java.util.ArrayList;
+
+import sun.misc.ManagedLocalsThread;
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.dnd.SunDragSourceContextPeer;
@@ -53,7 +55,7 @@
  *
  * @since 1.1
  */
-class EventDispatchThread extends Thread {
+class EventDispatchThread extends ManagedLocalsThread {
 
     private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventDispatchThread");
 
@@ -65,7 +67,7 @@
     private ArrayList<EventFilter> eventFilters = new ArrayList<EventFilter>();
 
     EventDispatchThread(ThreadGroup group, String name, EventQueue queue) {
-        super(group, name);
+        super(group, null, name);
         setEventQueue(queue);
     }
 
--- a/src/java.desktop/share/classes/java/awt/GridBagLayout.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/GridBagLayout.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -353,7 +353,7 @@
  *     }
  * }
  * </pre></blockquote><hr>
- * <p>
+ *
  * @author Doug Stein
  * @author Bill Spitzak (orignial NeWS &amp; OLIT implementation)
  * @see       java.awt.GridBagConstraints
@@ -770,7 +770,7 @@
      * components.  The value should be a number between 0 and 1
      * where 0 represents alignment along the origin, 1 is aligned
      * the furthest away from the origin, 0.5 is centered, etc.
-     * <p>
+     *
      * @return the value <code>0.5f</code> to indicate centered
      */
     public float getLayoutAlignmentX(Container parent) {
@@ -783,7 +783,7 @@
      * components.  The value should be a number between 0 and 1
      * where 0 represents alignment along the origin, 1 is aligned
      * the furthest away from the origin, 0.5 is centered, etc.
-     * <p>
+     *
      * @return the value <code>0.5f</code> to indicate centered
      */
     public float getLayoutAlignmentY(Container parent) {
--- a/src/java.desktop/share/classes/java/awt/MenuComponent.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/MenuComponent.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -328,6 +328,7 @@
      * Its use is discouraged, and it may not be supported
      * in the future.
      * @param evt the event which is to take place
+     * @return unconditionally returns false
      * @deprecated As of JDK version 1.1, replaced by {@link
      * #dispatchEvent(AWTEvent) dispatchEvent}.
      */
--- a/src/java.desktop/share/classes/java/awt/MenuContainer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/MenuContainer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,7 @@
      * Posts an event to the listeners.
      *
      * @param  evt the event to dispatch
+     * @return the results of posting the event
      * @deprecated As of JDK version 1.1
      * replaced by dispatchEvent(AWTEvent).
      */
--- a/src/java.desktop/share/classes/java/awt/MenuItem.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/MenuItem.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -595,6 +595,7 @@
      *
      * If no such listeners exist, this method returns an empty array.
      *
+     * @param <T> the type of the listeners
      * @param listenerType the type of listeners requested; this parameter
      *          should specify an interface that descends from
      *          <code>java.util.EventListener</code>
--- a/src/java.desktop/share/classes/java/awt/Toolkit.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/Toolkit.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1766,6 +1766,7 @@
      *
      * subclasses should override this to provide their own implementation
      *
+     * @param <T> the type of DragGestureRecognizer to create
      * @param abstractRecognizerClass The abstract class of the required recognizer
      * @param ds                      The DragSource
      * @param c                       The Component target for the DragGestureRecognizer
@@ -1867,7 +1868,9 @@
     }
 
     /**
-     * an opportunity to lazily evaluate desktop property values.
+     * An opportunity to lazily evaluate desktop property values.
+     * @return the desktop property or null
+     * @param name the name
      */
     protected Object lazilyLoadDesktopProperty(String name) {
         return null;
@@ -1947,8 +1950,14 @@
         return desktopPropsSupport.getPropertyChangeListeners(propertyName);
     }
 
+    /**
+     * The desktop properties.
+     */
     protected final Map<String,Object> desktopProperties =
             new HashMap<String,Object>();
+    /**
+     * The desktop properties change support.
+     */
     protected final PropertyChangeSupport desktopPropsSupport =
             Toolkit.createPropertyChangeSupport(this);
 
--- a/src/java.desktop/share/classes/java/awt/Window.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/Window.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2789,6 +2789,7 @@
     /**
      * @deprecated As of J2SE 1.4, replaced by
      * {@link Component#applyComponentOrientation Component.applyComponentOrientation}.
+     * @param rb the resource bundle
      */
     @Deprecated
     public void applyResourceBundle(ResourceBundle rb) {
@@ -2798,6 +2799,7 @@
     /**
      * @deprecated As of J2SE 1.4, replaced by
      * {@link Component#applyComponentOrientation Component.applyComponentOrientation}.
+     * @param rbName the resource name
      */
     @Deprecated
     public void applyResourceBundle(String rbName) {
--- a/src/java.desktop/share/classes/java/awt/doc-files/Modality.html	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/doc-files/Modality.html	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,6 @@
       <u>Scope of blocking (SB)</u> - the set of windows (instances of
       <code>java.awt.Window</code> and all derived classes) that are blocked by 
       the modal dialog while it is visible.
-    </p><p>
      <blockquote><hr>
       <b>Note</b>: Everywhere in this document the notion of "window" is equal
       to a top-level window in the Java programming language &mdash; in other words
@@ -109,8 +108,7 @@
       </li></ul>
       A dialog is, by default, modeless.  A modal dialog is, by default,
       application-modal.
-    <p>
-    </p><ol>
+    <ol>
       <li><u>Modeless dialogs</u><br>
         A modeless dialog doesn't block any windows while visible.
       </li><li><u>Document-modal dialogs</u><br>
@@ -156,7 +154,6 @@
           its owner. Thus, in this case the only thing that the owner
           affects is the Z-order: the dialog always stays on top of its owner.
       </li></ul>
-    <p>
     <blockquote><hr>
       <b>Implementation note</b>: Changing the modality type for a visible
       dialog may have no effect until it is hidden and then shown again.
@@ -277,8 +274,7 @@
         </li><li>Exclusion from blocking of application-modal dialogs
       </li></ul>
       By default, a window's modal exclusion property is turned off.
-    <p>
-      </p><ol>
+      <ol>
         <li><u>Application-modal exclusion</u><br>
           If a window is application-modal excluded, it is not blocked by any
           application-modal dialogs. Also, it is not blocked by document-modal
@@ -288,7 +284,6 @@
           by any application- or toolkit-modal dialogs. Also, it is not
           blocked by document-modal dialogs from outside of their child hierarchy.
       </li></ol>
-    <p>
     <blockquote>
       <hr>
         <b>Implementation note</b>: Changing the modal exclusion type for a visible window
@@ -399,7 +394,7 @@
           <br>
         </td>
         <td align="center">
-          <img src="modal-example1.gif">
+          <img src="modal-example1.gif" alt="Example 1">
           <br>
         </td>
       </tr>
@@ -418,7 +413,7 @@
 	 <br>
         </td>
         <td align="center">
-          <img src="modal-example2.gif">
+          <img src="modal-example2.gif" alt="Example 2">
           <br>
         </td>
       </tr>
@@ -440,7 +435,7 @@
           <br>
         </td>
         <td align="center">
-          <img src="modal-example3.gif">
+          <img src="modal-example3.gif" alt="Example 3">
           <br>
         </td>
       </tr>
@@ -462,7 +457,7 @@
           <br>
         </td>
         <td align="center">
-          <img src="modal-example4.gif">
+          <img src="modal-example4.gif" alt="Example 4">
           <br>
         </td>
       </tr>
--- a/src/java.desktop/share/classes/java/awt/geom/Path2D.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/geom/Path2D.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -224,8 +224,8 @@
                 Path2D p2d = (Path2D) s;
                 setWindingRule(p2d.windingRule);
                 this.numTypes = p2d.numTypes;
-                this.pointTypes = Arrays.copyOf(p2d.pointTypes,
-                                                p2d.pointTypes.length);
+                // trim arrays:
+                this.pointTypes = Arrays.copyOf(p2d.pointTypes, p2d.numTypes);
                 this.numCoords = p2d.numCoords;
                 this.floatCoords = p2d.cloneCoordsFloat(at);
             } else {
@@ -237,19 +237,23 @@
             }
         }
 
+        @Override
         float[] cloneCoordsFloat(AffineTransform at) {
+            // trim arrays:
             float ret[];
             if (at == null) {
-                ret = Arrays.copyOf(this.floatCoords, this.floatCoords.length);
+                ret = Arrays.copyOf(floatCoords, numCoords);
             } else {
-                ret = new float[floatCoords.length];
+                ret = new float[numCoords];
                 at.transform(floatCoords, 0, ret, 0, numCoords / 2);
             }
             return ret;
         }
 
+        @Override
         double[] cloneCoordsDouble(AffineTransform at) {
-            double ret[] = new double[floatCoords.length];
+            // trim arrays:
+            double ret[] = new double[numCoords];
             if (at == null) {
                 for (int i = 0; i < numCoords; i++) {
                     ret[i] = floatCoords[i];
@@ -475,6 +479,9 @@
         }
 
         int pointCrossings(double px, double py) {
+            if (numTypes == 0) {
+                return 0;
+            }
             double movx, movy, curx, cury, endx, endy;
             float coords[] = floatCoords;
             curx = movx = coords[0];
@@ -552,6 +559,9 @@
         int rectCrossings(double rxmin, double rymin,
                           double rxmax, double rymax)
         {
+            if (numTypes == 0) {
+                return 0;
+            }
             float coords[] = floatCoords;
             double curx, cury, movx, movy, endx, endy;
             curx = movx = coords[0];
@@ -1061,8 +1071,8 @@
                 Path2D p2d = (Path2D) s;
                 setWindingRule(p2d.windingRule);
                 this.numTypes = p2d.numTypes;
-                this.pointTypes = Arrays.copyOf(p2d.pointTypes,
-                                                p2d.pointTypes.length);
+                // trim arrays:
+                this.pointTypes = Arrays.copyOf(p2d.pointTypes, p2d.numTypes);
                 this.numCoords = p2d.numCoords;
                 this.doubleCoords = p2d.cloneCoordsDouble(at);
             } else {
@@ -1074,8 +1084,10 @@
             }
         }
 
+        @Override
         float[] cloneCoordsFloat(AffineTransform at) {
-            float ret[] = new float[doubleCoords.length];
+            // trim arrays:
+            float ret[] = new float[numCoords];
             if (at == null) {
                 for (int i = 0; i < numCoords; i++) {
                     ret[i] = (float) doubleCoords[i];
@@ -1086,13 +1098,14 @@
             return ret;
         }
 
+        @Override
         double[] cloneCoordsDouble(AffineTransform at) {
+            // trim arrays:
             double ret[];
             if (at == null) {
-                ret = Arrays.copyOf(this.doubleCoords,
-                                    this.doubleCoords.length);
+                ret = Arrays.copyOf(doubleCoords, numCoords);
             } else {
-                ret = new double[doubleCoords.length];
+                ret = new double[numCoords];
                 at.transform(doubleCoords, 0, ret, 0, numCoords / 2);
             }
             return ret;
@@ -1202,6 +1215,9 @@
         }
 
         int pointCrossings(double px, double py) {
+            if (numTypes == 0) {
+                return 0;
+            }
             double movx, movy, curx, cury, endx, endy;
             double coords[] = doubleCoords;
             curx = movx = coords[0];
@@ -1279,6 +1295,9 @@
         int rectCrossings(double rxmin, double rymin,
                           double rxmax, double rymax)
         {
+            if (numTypes == 0) {
+                return 0;
+            }
             double coords[] = doubleCoords;
             double curx, cury, movx, movy, endx, endy;
             curx = movx = coords[0];
--- a/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -34,10 +34,11 @@
  **********************************************************************/
 
 package java.awt.image.renderable;
-import java.awt.color.ColorSpace;
+
+import sun.misc.ManagedLocalsThread;
+
 import java.awt.image.ColorModel;
 import java.awt.image.DataBuffer;
-import java.awt.image.DirectColorModel;
 import java.awt.image.ImageConsumer;
 import java.awt.image.ImageProducer;
 import java.awt.image.Raster;
@@ -135,7 +136,13 @@
     public synchronized void startProduction(ImageConsumer ic) {
         addConsumer(ic);
         // Need to build a runnable object for the Thread.
-        Thread thread = new Thread(this, "RenderableImageProducer Thread");
+        String name = "RenderableImageProducer Thread";
+        Thread thread;
+        if (System.getSecurityManager() == null) {
+            thread = new Thread(this, name);
+        } else {
+            thread = new ManagedLocalsThread(this);
+        }
         thread.start();
     }
 
--- a/src/java.desktop/share/classes/java/beans/Beans.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/beans/Beans.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,9 +46,6 @@
 
 import java.net.URL;
 
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -183,16 +180,10 @@
 
         // Try to find a serialized object with this name
         final String serName = beanName.replace('.','/').concat(".ser");
-        final ClassLoader loader = cls;
-        ins = AccessController.doPrivileged
-            (new PrivilegedAction<InputStream>() {
-                public InputStream run() {
-                    if (loader == null)
-                        return ClassLoader.getSystemResourceAsStream(serName);
-                    else
-                        return loader.getResourceAsStream(serName);
-                }
-        });
+        if (cls == null)
+            ins =  ClassLoader.getSystemResourceAsStream(serName);
+        else
+            ins =  cls.getResourceAsStream(serName);
         if (ins != null) {
             try {
                 if (cls == null) {
@@ -283,19 +274,10 @@
                     URL docBase   = null;
 
                     // Now get the URL correponding to the resource name.
-
-                    final ClassLoader cloader = cls;
-                    objectUrl =
-                        AccessController.doPrivileged
-                        (new PrivilegedAction<URL>() {
-                            public URL run() {
-                                if (cloader == null)
-                                    return ClassLoader.getSystemResource
-                                                                (resourceName);
-                                else
-                                    return cloader.getResource(resourceName);
-                            }
-                    });
+                    if (cls == null) {
+                        objectUrl = ClassLoader.getSystemResource(resourceName);
+                    } else
+                        objectUrl = cls.getResource(resourceName);
 
                     // If we found a URL, we try to locate the docbase by taking
                     // of the final path name component, and the code base by taking
--- a/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,11 @@
 
 package java.beans;
 
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.image.ImageProducer;
+import java.net.URL;
+
 /**
  * This is a support class to make it easier for people to provide
  * BeanInfo classes.
@@ -101,7 +106,7 @@
      * Claim there are no icons available.  You can override
      * this if you want to provide icons for your bean.
      */
-    public java.awt.Image getIcon(int iconKind) {
+    public Image getIcon(int iconKind) {
         return null;
     }
 
@@ -116,33 +121,17 @@
      *          "wombat.gif".
      * @return  an image object.  May be null if the load failed.
      */
-    public java.awt.Image loadImage(final String resourceName) {
+    public Image loadImage(final String resourceName) {
         try {
-            final Class<?> c = getClass();
-            java.awt.image.ImageProducer ip = (java.awt.image.ImageProducer)
-                java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction<Object>() {
-                    public Object run() {
-                        java.net.URL url;
-                        if ((url = c.getResource(resourceName)) == null) {
-                            return null;
-                        } else {
-                            try {
-                                return url.getContent();
-                            } catch (java.io.IOException ioe) {
-                                return null;
-                            }
-                        }
-                    }
-            });
-
-            if (ip == null)
-                return null;
-            java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
-            return tk.createImage(ip);
-        } catch (Exception ex) {
-            return null;
+            final URL url = getClass().getResource(resourceName);
+            if (url != null) {
+                final ImageProducer ip = (ImageProducer) url.getContent();
+                if (ip != null) {
+                    return Toolkit.getDefaultToolkit().createImage(ip);
+                }
+            }
+        } catch (final Exception ignored) {
         }
+        return null;
     }
-
 }
--- a/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/gif_metadata.html	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/gif_metadata.html	Fri Apr 17 10:24:46 2015 -0700
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -34,12 +34,11 @@
 <center><h1>
 GIF Metadata Format Specification
 </h1></center>
-
-<a name="gif_stream_metadata_format">
+<a name="gif_stream_metadata_format"></a>
 <center><h2>
 GIF Stream Metadata Format Specification
 </h2></center>
-</a>
+
 <p>
 
 The GIF stream metadata format encodes the information stored in the
@@ -136,11 +135,10 @@
           &lt;!-- Max value: 255 (inclusive) --&gt;
 ]&gt;
 </pre>
-<a name="gif_image_metadata_format">
+<a name="gif_image_metadata_format"></a>
 <center><h2>
 GIF Image Metadata Format Specification
 </h2></center>
-</a>
 <p>
 
 The GIF image metadata format encodes the image descriptor, local
@@ -352,7 +350,7 @@
 </pre>
 
 <p>
-<a name="mapping">
+<a name="mapping"></a>
 <center>
 <table border=1>
 <caption><b>Mapping of Standard to GIF Native Stream Metadata</b></caption>
@@ -402,9 +400,7 @@
 </tr>
 </table>
 </center>
-</p>
 
-<p>
 <center>
 <table border=1>
 <caption><b>Mapping of Standard to GIF Native Image Metadata</b></caption>
--- a/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html	Fri Apr 17 10:24:46 2015 -0700
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
 <a href=#image>Image Metadata DTD</a><br>
 <a href=#stream>Stream Metadata DTD</a>
 <p>
-<bold>NOTE</bold>: It is important to call <code>dispose()</code> 
+<b>NOTE</b>: It is important to call <code>dispose()</code> 
 on the JPEG reader and writer objects when they are no longer needed, as 
 they consume significant native resources which are not adequately recovered 
 by garbage collection.  Both reader and writer call <code>dispose()</code> 
@@ -57,7 +57,6 @@
 
 The JPEG writer does not support replacing pixels.
 
-<p>
 <h2>
 <a name=metadata>JPEG Metadata</a>
 </h2>
@@ -95,7 +94,7 @@
 the returned object will contain default tables.
 
 <p>The <code>ImageWriter.getDefaultImageMetadata</code> method returns a 
-metadata object containing <bold>no</bold> tables if the 
+metadata object containing <b>no</b> tables if the 
 <code>ImageWriteParam</code> argument contains tables.  Otherwise the 
 returned metadata object will contain default visually lossless tables.  
 Of course, only a <code>JPEGImageWriteParam</code> may contain tables.
@@ -105,7 +104,6 @@
 is set on the reader, stream metadata will not be available, but image
 metadata will.
 
-<p>
 <h2>
 <a name=abbrev>Abbreviated Streams</a>
 </h2>
@@ -194,7 +192,6 @@
 Note that if no image metadata object is specified for a particular image, a 
 default object is used, which includes default tables.
 
-<p>
 <h2>
 <a name=color>Colorspace Transformations and Conventional Markers</a>
 </h2>
@@ -235,7 +232,6 @@
        the YCbCr is converted to RGB according to the formulas given in the
        JFIF spec, and the ICC profile is assumed to refer to the resulting RGB
        space.
-  <p>
   <li> If an Adobe <code>APP14</code> marker segment is present, the 
        colorspace is determined by consulting the <code>transform</code> flag.
        The <code>transform</code> flag takes one of three values:
@@ -249,7 +245,6 @@
       <li> 0 - Unknown.  3-channel images are assumed to be RGB, 4-channel 
            images are assumed to be CMYK.
     </ul>
-   <p>
   <li> If neither marker segment is present, the following procedure is
        followed: Single-channel images are assumed to be grayscale, and
        2-channel images are assumed to be grayscale with an alpha channel.
@@ -273,13 +268,12 @@
        subsampled images are assumed to be YCCK, and 4-channel, non-subsampled
        images are assumed to be CMYK.
 
-  <p>
   <li> All other images are declared uninterpretable and an exception is
        thrown if an attempt is made to read one as a 
        <code>BufferedImage</code>.  Such an image may be read only as a 
        <code>Raster</code>.  If an image is interpretable but there is no Java
        <code>ColorSpace</code> available corresponding to the encoded 
-       colorspace (<italic>e.g.</italic> YCbCr), then 
+       colorspace (<i>e.g.</i> YCbCr), then 
        <code>ImageReader.getRawImageType</code> will return <code>null</code>.
 </ul>
 
@@ -308,7 +302,7 @@
 
   <li> An exception is thrown if an attempt is made to read an image in an 
        unsupported jpeg colorspace as a <code>BufferedImage</code> 
-       (<italic>e.g.</italic> CMYK).  Such images may be read as
+       (<i>e.g.</i> CMYK).  Such images may be read as
        <code>Raster</code>s.  If an image colorspace is unsupported or
        uninterpretable, then <code>ImageReader.getImageTypes</code> will
        return an empty <code>Iterator</code>.   If a subset of the raw bands
@@ -514,7 +508,6 @@
     </ul>
 </ul>
 
-<p>
 <h2>
 <a name=thumbs>Thumbnail Images</a>
 </h2>
@@ -591,7 +584,7 @@
        that no thumbnail is placed in the JFIF <code>APP0</code> segment, and
        the <code>app0JFXX</code> node consulted for each thumbnail is the
        <code>app0JFXX</code> node from the metadata that occurs in the same
-       sequence as the thumbnail.  <italic>I.e.</italic> the first
+       sequence as the thumbnail.  <i>I.e.</i> the first
        <code>app0JFXX</code> node applies to the first thumbnail, the second
        node to the second thumbnail, and so on.  If there are fewer
        <code>app0JFXX</code> nodes in the metadata than thumbnails, then 
@@ -610,7 +603,6 @@
 of image, the thumbnails are ignored and a warning is sent to any warning
 listeners.
 
-<p>
 <h2>
 <a name=prog>Progressive Encoding</a>
 </h2>
@@ -631,7 +623,6 @@
 itself are ignored, and a warning will be sent to any warning listeners if 
 any such tables are present.
 
-<p>
 <h2>
 <a name=tree>Native Metadata Format Tree Structure and Editing</a>
 </h2>
@@ -673,7 +664,7 @@
 This is true regardless of where the JFXX <code>APP0</code> and 
 <code>APP2</code> marker segments actually occur in the stream.  The ordering 
 of nodes within the <code>markerSequence</code> node corresponds to the 
-ordering of marker segments found in the JPEG stream.  
+ordering of marker segments found in the JPEG stream.
 <p>
 On writing, any <code>JFXX</code> and <code>app2ICC</code> nodes must 
 occur as children of an <code>app0JFIF</code> node, itself a child of a 
--- a/src/java.desktop/share/classes/javax/swing/GroupLayout.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/GroupLayout.java	Fri Apr 17 10:24:46 2015 -0700
@@ -2190,7 +2190,7 @@
                     }
                 } else {
                     // Not a padding spring
-                    if (newLeading.size() > 0 && insert) {
+                    if (newLeading.size() > 0 && newLeadingPadding.isEmpty() && insert) {
                         // There's leading ComponentSprings, create an
                         // autopadding spring.
                         AutoPreferredGapSpring padding =
--- a/src/java.desktop/share/classes/javax/swing/JTable.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/JTable.java	Fri Apr 17 10:24:46 2015 -0700
@@ -49,9 +49,12 @@
 import java.text.NumberFormat;
 import java.text.DateFormat;
 import java.text.MessageFormat;
+import java.util.List;
 
 import javax.print.attribute.*;
 import javax.print.PrintService;
+
+import sun.misc.ManagedLocalsThread;
 import sun.reflect.misc.ReflectUtil;
 
 import sun.swing.SwingUtilities2;
@@ -4419,8 +4422,13 @@
         }
 
         if (sortManager != null) {
-            sortedTableChanged(null, e);
-            return;
+            List<? extends RowSorter.SortKey> sortKeys =
+                    sortManager.sorter.getSortKeys();
+            if (sortKeys.size() != 0 &&
+                    sortKeys.get(0).getSortOrder() != SortOrder.UNSORTED) {
+                sortedTableChanged(null, e);
+                return;
+            }
         }
 
         // The totalRowHeight calculated below will be incorrect if
@@ -6378,25 +6386,28 @@
 
         // this runnable will be used to do the printing
         // (and save any throwables) on another thread
-        Runnable runnable = new Runnable() {
-            public void run() {
-                try {
-                    // do the printing
-                    job.print(copyAttr);
-                } catch (Throwable t) {
-                    // save any Throwable to be rethrown
-                    synchronized(lock) {
-                        printError = t;
-                    }
-                } finally {
-                    // we're finished - hide the dialog
-                    printingStatus.dispose();
-                }
+        Runnable runnable = () -> {
+            try {
+                // do the printing
+                job.print(copyAttr);
+            } catch (Throwable t) {
+                // save any Throwable to be rethrown
+                synchronized(lock) {
+                    printError = t;
+                }
+            } finally {
+                // we're finished - hide the dialog
+                printingStatus.dispose();
             }
         };
 
         // start printing on another thread
-        Thread th = new Thread(runnable);
+        Thread th;
+        if  (System.getSecurityManager() == null) {
+            th = new Thread(runnable);
+        } else {
+            th = new ManagedLocalsThread(runnable);
+        }
         th.start();
 
         printingStatus.showModal(true);
--- a/src/java.desktop/share/classes/javax/swing/TimerQueue.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/TimerQueue.java	Fri Apr 17 10:24:46 2015 -0700
@@ -29,12 +29,14 @@
 
 
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.locks.*;
 import java.util.concurrent.atomic.AtomicLong;
 import sun.awt.AppContext;
-
+import sun.misc.InnocuousThread;
 
 
 /**
@@ -94,18 +96,19 @@
         if (! running) {
             runningLock.lock();
             try {
-                final ThreadGroup threadGroup =
-                    AppContext.getAppContext().getThreadGroup();
-                java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction<Object>() {
-                    public Object run() {
-                        Thread timerThread = new Thread(threadGroup, TimerQueue.this,
-                                                        "TimerQueue");
-                        timerThread.setDaemon(true);
-                        timerThread.setPriority(Thread.NORM_PRIORITY);
-                        timerThread.start();
-                        return null;
+                final ThreadGroup threadGroup = AppContext.getAppContext().getThreadGroup();
+                AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
+                    String name = "TimerQueue";
+                    Thread timerThread;
+                    if (System.getSecurityManager() == null) {
+                        timerThread = new Thread(threadGroup, TimerQueue.this, name);
+                    } else {
+                        timerThread = new InnocuousThread(threadGroup, TimerQueue.this, name);
                     }
+                    timerThread.setDaemon(true);
+                    timerThread.setPriority(Thread.NORM_PRIORITY);
+                    timerThread.start();
+                    return null;
                 });
                 running = true;
             } finally {
--- a/src/java.desktop/share/classes/javax/swing/colorchooser/ColorChooserComponentFactory.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/colorchooser/ColorChooserComponentFactory.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,10 @@
 
     private ColorChooserComponentFactory() { } // can't instantiate
 
+    /**
+     * Returns the default chooser panels.
+     * @return the default chooser panels
+     */
     public static AbstractColorChooserPanel[] getDefaultChooserPanels() {
         return new AbstractColorChooserPanel[] {
                 new DefaultSwatchChooserPanel(),
@@ -58,6 +62,10 @@
         };
     }
 
+    /**
+     * Returns the preview panel.
+     * @return the preview panel
+     */
     public static JComponent getPreviewPanel() {
         return new DefaultPreviewPanel();
     }
--- a/src/java.desktop/share/classes/javax/swing/colorchooser/DefaultColorSelectionModel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/colorchooser/DefaultColorSelectionModel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,9 @@
      */
     protected transient ChangeEvent changeEvent = null;
 
+    /**
+     * The listener list.
+     */
     protected EventListenerList listenerList = new EventListenerList();
 
     private Color selectedColor;
--- a/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/event/EventListenerList.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@
 public class EventListenerList implements Serializable {
     /* A null array to be shared by all empty listener lists*/
     private final static Object[] NULL_ARRAY = new Object[0];
-    /* The list of ListenerType - Listener pairs */
+    /** The list of ListenerType - Listener pairs */
     protected transient Object[] listenerList = NULL_ARRAY;
 
     /**
--- a/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/event/TableModelEvent.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,9 +85,21 @@
 //  Instance Variables
 //
 
+    /**
+     * The type of the event.
+     */
     protected int       type;
+    /**
+     * The first row that has changed.
+     */
     protected int       firstRow;
+    /**
+     * The last row that has changed.
+     */
     protected int       lastRow;
+    /**
+     * The column for the event.
+     */
     protected int       column;
 
 //
--- a/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,6 +73,10 @@
     private boolean useSystemExtensionHiding =
             UIManager.getDefaults().getBoolean("FileChooser.useSystemExtensionHiding");
 
+    /**
+     * Returns the file system view.
+     * @return the file system view
+     */
     public static FileSystemView getFileSystemView() {
         if(File.separatorChar == '\\') {
             if(windowsFileSystemView == null) {
@@ -101,6 +105,9 @@
         return genericFileSystemView;
     }
 
+    /**
+     * Constructs a FileSystemView.
+     */
     public FileSystemView() {
         final WeakReference<FileSystemView> weakReference = new WeakReference<FileSystemView>(this);
 
@@ -424,6 +431,10 @@
     // code. If a given OS can't, override these methods in its
     // implementation.
 
+    /**
+     * Returns the home directory.
+     * @return the home directory
+     */
     public File getHomeDirectory() {
         return createFileObject(System.getProperty("user.home"));
     }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -25,15 +25,19 @@
 
 package javax.swing.plaf.basic;
 
+import sun.awt.shell.ShellFolder;
+import sun.misc.ManagedLocalsThread;
+
+import javax.swing.*;
+import javax.swing.event.ListDataEvent;
+import javax.swing.filechooser.FileSystemView;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
 import java.io.File;
-import java.util.*;
+import java.util.List;
+import java.util.Vector;
 import java.util.concurrent.Callable;
-import javax.swing.*;
-import javax.swing.filechooser.*;
-import javax.swing.event.*;
-import java.beans.*;
-
-import sun.awt.shell.ShellFolder;
 
 /**
  * Basic implementation of a file list.
@@ -46,7 +50,7 @@
     private JFileChooser filechooser = null;
     // PENDING(jeff) pick the size more sensibly
     private Vector<File> fileCache = new Vector<File>(50);
-    private LoadFilesThread loadThread = null;
+    private FilesLoader filesLoader = null;
     private Vector<File> files = null;
     private Vector<File> directories = null;
     private int fetchID = 0;
@@ -91,10 +95,10 @@
      * This method is used to interrupt file loading thread.
      */
     public void invalidateFileCache() {
-        if (loadThread != null) {
-            loadThread.interrupt();
-            loadThread.cancelRunnables();
-            loadThread = null;
+        if (filesLoader != null) {
+            filesLoader.loadThread.interrupt();
+            filesLoader.cancelRunnables();
+            filesLoader = null;
         }
     }
 
@@ -149,15 +153,14 @@
         if (currentDirectory == null) {
             return;
         }
-        if (loadThread != null) {
-            loadThread.interrupt();
-            loadThread.cancelRunnables();
+        if (filesLoader != null) {
+            filesLoader.loadThread.interrupt();
+            filesLoader.cancelRunnables();
         }
 
         setBusy(true, ++fetchID);
 
-        loadThread = new LoadFilesThread(currentDirectory, fetchID);
-        loadThread.start();
+        filesLoader = new FilesLoader(currentDirectory, fetchID);
     }
 
     /**
@@ -251,17 +254,25 @@
     }
 
 
-    class LoadFilesThread extends Thread {
+    class FilesLoader implements Runnable {
         File currentDirectory = null;
         int fid;
         Vector<DoChangeContents> runnables = new Vector<DoChangeContents>(10);
+        final Thread loadThread;
 
-        public LoadFilesThread(File currentDirectory, int fid) {
-            super("Basic L&F File Loading Thread");
+        public FilesLoader(File currentDirectory, int fid) {
             this.currentDirectory = currentDirectory;
             this.fid = fid;
+            String name = "Basic L&F File Loading Thread";
+            if (System.getSecurityManager() == null) {
+                this.loadThread = new Thread(this, name);
+            } else {
+                this.loadThread = new ManagedLocalsThread(this, name);
+            }
+            this.loadThread.start();
         }
 
+        @Override
         public void run() {
             run0();
             setBusy(false, fid);
@@ -270,13 +281,13 @@
         public void run0() {
             FileSystemView fileSystem = filechooser.getFileSystemView();
 
-            if (isInterrupted()) {
+            if (loadThread.isInterrupted()) {
                 return;
             }
 
             File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
 
-            if (isInterrupted()) {
+            if (loadThread.isInterrupted()) {
                 return;
             }
 
@@ -296,7 +307,7 @@
                         newFiles.addElement(file);
                     }
 
-                    if (isInterrupted()) {
+                    if (loadThread.isInterrupted()) {
                         return;
                     }
                 }
@@ -333,7 +344,7 @@
                         }
                         if (start >= 0 && end > start
                             && newFileCache.subList(end, newSize).equals(fileCache.subList(start, oldSize))) {
-                            if (isInterrupted()) {
+                            if (loadThread.isInterrupted()) {
                                 return null;
                             }
                             return new DoChangeContents(newFileCache.subList(start, end), start, null, 0, fid);
@@ -351,14 +362,14 @@
                         }
                         if (start >= 0 && end > start
                             && fileCache.subList(end, oldSize).equals(newFileCache.subList(start, newSize))) {
-                            if (isInterrupted()) {
+                            if (loadThread.isInterrupted()) {
                                 return null;
                             }
                             return new DoChangeContents(null, 0, new Vector<>(fileCache.subList(start, end)), start, fid);
                         }
                     }
                     if (!fileCache.equals(newFileCache)) {
-                        if (isInterrupted()) {
+                        if (loadThread.isInterrupted()) {
                             cancelRunnables(runnables);
                         }
                         return new DoChangeContents(newFileCache, 0, fileCache, 0, fid);
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Fri Apr 17 10:24:46 2015 -0700
@@ -962,6 +962,12 @@
                         return;
                     }
                     orientation = SwingConstants.HORIZONTAL;
+                } else if(e.isShiftDown()){
+                    JScrollBar hScroll = scrollpane.getHorizontalScrollBar();
+                    if (hScroll != null && hScroll.isVisible()) {
+                        toScroll = hScroll;
+                        orientation = SwingConstants.HORIZONTAL;
+                    }
                 }
 
                 e.consume();
--- a/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Fri Apr 17 10:24:46 2015 -0700
@@ -569,7 +569,9 @@
         return super.createListSelectionListener(fc);
     }
 
-    // Obsolete class, not used in this version.
+    /**
+     * Obsolete class, not used in this version.
+     */
     protected class SingleClickListener extends MouseAdapter {
         /**
          * Constructs an instance of {@code SingleClickListener}.
@@ -580,7 +582,9 @@
         }
     }
 
-    // Obsolete class, not used in this version.
+    /**
+     * Obsolete class, not used in this version.
+     */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class FileRenderer extends DefaultListCellRenderer  {
     }
--- a/src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -495,8 +495,16 @@
      * control points and bezier curve anchors.
      */
     protected static class PaintContext {
+        /**
+         * Cache mode.
+         */
         protected static enum CacheMode {
-            NO_CACHING, FIXED_SIZES, NINE_SQUARE_SCALE
+            /** No caching.*/
+            NO_CACHING,
+            /** Fixed sizes.*/
+            FIXED_SIZES,
+            /** Nine square scale.*/
+            NINE_SQUARE_SCALE
         }
 
         private static Insets EMPTY_INSETS = new Insets(0, 0, 0, 0);
@@ -632,6 +640,9 @@
         // check if we can scale to the requested size
         Dimension canvas = ctx.canvasSize;
         Insets insets = ctx.stretchingInsets;
+        if (insets.left + insets.right > w || insets.top + insets.bottom > h) {
+            return;
+        }
 
         if (w <= (canvas.width * ctx.maxHorizontalScaleFactor) && h <= (canvas.height * ctx.maxVerticalScaleFactor)) {
             // get image at canvas size
--- a/src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/nimbus/NimbusStyle.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -120,11 +120,17 @@
  */
 public final class NimbusStyle extends SynthStyle {
     /* Keys and scales for large/small/mini components, based on Apples sizes */
+    /** Large key */
     public static final String LARGE_KEY = "large";
+    /** Small key */
     public static final String SMALL_KEY = "small";
+    /** Mini key */
     public static final String MINI_KEY = "mini";
+    /** Large scale */
     public static final double LARGE_SCALE = 1.15;
+    /** Small scale */
     public static final double SMALL_SCALE = 0.857;
+    /** Mini scale */
     public static final double MINI_SCALE = 0.714;
 
     /**
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,10 @@
         return new SynthInternalFrameUI((JInternalFrame)b);
     }
 
+    /**
+     * Constructs a {@code SynthInternalFrameUI}.
+     * @param b an internal frame
+     */
     protected SynthInternalFrameUI(JInternalFrame b) {
         super(b);
     }
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,11 @@
 
     private boolean validMinimumThumbSize;
 
+    /**
+     * Returns a UI.
+     * @return a UI
+     * @param c a component
+     */
     public static ComponentUI createUI(JComponent c)    {
         return new SynthScrollBarUI();
     }
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,6 +93,10 @@
         return new SynthSliderUI((JSlider)c);
     }
 
+    /**
+     * Constructs a {@code SynthSliderUI}.
+     * @param c a slider
+     */
     protected SynthSliderUI(JSlider c) {
         super(c);
     }
--- a/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/table/AbstractTableModel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -320,9 +320,8 @@
      *
      * If no such listeners exist, this method returns an empty array.
      *
-     * @param listenerType the type of listeners requested; this parameter
-     *          should specify an interface that descends from
-     *          <code>java.util.EventListener</code>
+     * @param <T> the listener type
+     * @param listenerType the type of listeners requested
      * @return an array of all objects registered as
      *          <code><em>Foo</em>Listener</code>s on this component,
      *          or an empty array if no such
--- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,6 +95,9 @@
     */
     private static final Border SAFE_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
     private static final Border DEFAULT_NO_FOCUS_BORDER = new EmptyBorder(1, 1, 1, 1);
+    /**
+     * A border without focus.
+     */
     protected static Border noFocusBorder = DEFAULT_NO_FOCUS_BORDER;
 
     // We need a place to store the color the JLabel should be returned
--- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableColumnModel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -652,9 +652,8 @@
      *
      * If no such listeners exist, this method returns an empty array.
      *
-     * @param listenerType the type of listeners requested; this parameter
-     *          should specify an interface that descends from
-     *          <code>java.util.EventListener</code>
+     * @param <T> the listener type
+     * @param listenerType the type of listeners requested
      * @return an array of all objects registered as
      *          <code><em>Foo</em>Listener</code>s on this model,
      *          or an empty array if no such
--- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -314,15 +314,7 @@
 
     /**
      * Obsolete as of Java 2 platform v1.3.  Please use <code>setRowCount</code> instead.
-     */
-    /*
-     *  Sets the number of rows in the model.  If the new size is greater
-     *  than the current size, new rows are added to the end of the model
-     *  If the new size is less than the current size, all
-     *  rows at index <code>rowCount</code> and greater are discarded.
-     *
      * @param   rowCount   the new number of rows
-     * @see #setRowCount
      */
     public void setNumRows(int rowCount) {
         int old = getRowCount();
--- a/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -281,14 +281,8 @@
     /**
      * Obsolete as of Java 2 platform v1.3.  Real time repaints, in response to
      * column dragging or resizing, are now unconditional.
-     */
-    /*
-     *  Sets whether the body of the table updates in real time when
-     *  a column is resized or dragged.
-     *
-     * @param   flag                    true if tableView should update
-     *                                  the body of the table in real time
-     * @see #getUpdateTableInRealTime
+     * @param flag true if tableView should update the body of the
+     * table in real time
      */
     public void setUpdateTableInRealTime(boolean flag) {
         updateTableInRealTime = flag;
@@ -297,15 +291,7 @@
     /**
      * Obsolete as of Java 2 platform v1.3.  Real time repaints, in response to
      * column dragging or resizing, are now unconditional.
-     */
-    /*
-     * Returns true if the body of the table view updates in real
-     * time when a column is resized or dragged.  User can set this flag to
-     * false to speed up the table's response to user resize or drag actions.
-     * The default is true.
-     *
      * @return  true if the table updates in real time
-     * @see #setUpdateTableInRealTime
      */
     public boolean getUpdateTableInRealTime() {
         return updateTableInRealTime;
--- a/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java	Fri Apr 17 10:24:46 2015 -0700
@@ -68,6 +68,7 @@
 import sun.awt.AppContext;
 
 
+import sun.misc.ManagedLocalsThread;
 import sun.swing.PrintingStatus;
 import sun.swing.SwingUtilities2;
 import sun.swing.text.TextComponentPrintable;
@@ -2363,7 +2364,11 @@
             runnablePrinting.run();
         } else {
             if (isEventDispatchThread) {
-                (new Thread(runnablePrinting)).start();
+                if (System.getSecurityManager() == null) {
+                    new Thread(runnablePrinting).start();
+                } else {
+                    new ManagedLocalsThread(runnablePrinting).start();
+                }
                 printingStatus.showModal(true);
             } else {
                 printingStatus.showModal(false);
--- a/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java	Fri Apr 17 10:24:46 2015 -0700
@@ -26,6 +26,7 @@
 
 import java.util.Vector;
 import sun.awt.AppContext;
+import sun.misc.ManagedLocalsThread;
 
 /**
  * A queue of text layout tasks.
@@ -80,7 +81,22 @@
      */
     public synchronized void addTask(Runnable task) {
         if (worker == null) {
-            worker = new LayoutThread();
+            Runnable workerRunnable = () -> {
+                Runnable work;
+                do {
+                    work = waitForWork();
+                    if (work != null) {
+                        work.run();
+                    }
+                } while (work != null);
+            };
+            String name =  "text-layout";
+            if (System.getSecurityManager() == null) {
+                worker = new Thread(workerRunnable, name);
+            } else {
+                worker = new ManagedLocalsThread(workerRunnable, name);
+            }
+            worker.setPriority(Thread.MIN_PRIORITY);
             worker.start();
         }
         tasks.addElement(task);
@@ -102,28 +118,4 @@
         tasks.removeElementAt(0);
         return work;
     }
-
-    /**
-     * low priority thread to perform layout work forever
-     */
-    class LayoutThread extends Thread {
-
-        LayoutThread() {
-            super("text-layout");
-            setPriority(Thread.MIN_PRIORITY);
-        }
-
-        public void run() {
-            Runnable work;
-            do {
-                work = waitForWork();
-                if (work != null) {
-                    work.run();
-                }
-            } while (work != null);
-        }
-
-
-    }
-
 }
--- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellEditor.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellEditor.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -477,6 +477,15 @@
         return true;
     }
 
+    /**
+     * Determine the offset.
+     * @param tree      a <code>JTree</code> object
+     * @param value a value
+     * @param isSelected selection status
+     * @param expanded expansion status
+     * @param leaf leaf status
+     * @param row current row
+     */
     protected void determineOffset(JTree tree, Object value,
                                    boolean isSelected, boolean expanded,
                                    boolean leaf, int row) {
@@ -653,6 +662,9 @@
 
         // This should not be used. It will be removed when new API is
         // allowed.
+        /**
+         * Do not use.
+         */
         public void EditorContainer() {
             setLayout(null);
         }
--- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeModel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -657,9 +657,8 @@
      *
      * If no such listeners exist, this method returns an empty array.
      *
-     * @param listenerType the type of listeners requested; this parameter
-     *          should specify an interface that descends from
-     *          <code>java.util.EventListener</code>
+     * @param <T> the listener type
+     * @param listenerType the type of listeners requested
      * @return an array of all objects registered as
      *          <code><em>Foo</em>Listener</code>s on this component,
      *          or an empty array if no such
--- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -664,9 +664,8 @@
      *
      * If no such listeners exist, this method returns an empty array.
      *
-     * @param listenerType the type of listeners requested; this parameter
-     *          should specify an interface that descends from
-     *          <code>java.util.EventListener</code>
+     * @param <T> the listener type
+     * @param listenerType the type of listeners requested
      * @return an array of all objects registered as
      *          <code><em>Foo</em>Listener</code>s on this component,
      *          or an empty array if no such
--- a/src/java.desktop/share/classes/javax/swing/tree/FixedHeightLayoutCache.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/tree/FixedHeightLayoutCache.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,7 +74,9 @@
 
     private Stack<Stack<TreePath>> tempStacks;
 
-
+    /**
+     * Constructs a {@code FixedHeightLayoutCache}.
+     */
     public FixedHeightLayoutCache() {
         super();
         tempStacks = new Stack<Stack<TreePath>>();
--- a/src/java.desktop/share/classes/javax/swing/tree/VariableHeightLayoutCache.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/tree/VariableHeightLayoutCache.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,9 @@
     private Stack<Stack<TreePath>> tempStacks;
 
 
+    /**
+     * Constructs a {@code VariableHeightLayoutCache}.
+     */
     public VariableHeightLayoutCache() {
         super();
         tempStacks = new Stack<Stack<TreePath>>();
--- a/src/java.desktop/share/classes/javax/swing/undo/CompoundEdit.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/undo/CompoundEdit.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,9 @@
      */
     protected Vector<UndoableEdit> edits;
 
+    /**
+     * Constructs a {@code CompoundEdit}.
+     */
     public CompoundEdit() {
         super();
         inProgress = true;
--- a/src/java.desktop/share/classes/javax/swing/undo/StateEdit.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/undo/StateEdit.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,6 +59,9 @@
 public class StateEdit
         extends AbstractUndoableEdit {
 
+    /**
+     * Obsolete RCS version identity.
+     */
     protected static final String RCSID = "$Id: StateEdit.java,v 1.6 1997/10/01 20:05:51 sandipc Exp $";
 
     //
@@ -114,6 +117,11 @@
         init (anObject,name);
     }
 
+    /**
+     * Initialize the state edit.
+     * @param anObject The object to watch for changing state
+     * @param name The presentation name to be used for this edit
+     */
     protected void init (StateEditable anObject, String name) {
         this.object = anObject;
         this.preState = new Hashtable<Object, Object>(11);
--- a/src/java.desktop/share/classes/javax/swing/undo/UndoableEditSupport.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/javax/swing/undo/UndoableEditSupport.java	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,9 +34,21 @@
  * @author Ray Ryan
  */
 public class UndoableEditSupport {
+    /**
+     * The update level.
+     */
     protected int updateLevel;
+    /**
+     * The compound edit.
+     */
     protected CompoundEdit compoundEdit;
+    /**
+     * The list of listeners.
+     */
     protected Vector<UndoableEditListener> listeners;
+    /**
+     * The real source.
+     */
     protected Object realSource;
 
     /**
--- a/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java	Fri Apr 17 10:24:46 2015 -0700
@@ -52,6 +52,7 @@
 import sun.awt.AppContext;
 import sun.awt.SunToolkit;
 import sun.misc.IOUtils;
+import sun.misc.ManagedLocalsThread;
 import sun.net.www.ParseUtil;
 import sun.security.util.SecurityConstants;
 
@@ -855,13 +856,13 @@
  * this operation to complete before continuing, wait for the notifyAll()
  * operation on the syncObject to occur.
  */
-class AppContextCreator extends Thread  {
+class AppContextCreator extends ManagedLocalsThread {
     Object syncObject = new Object();
     AppContext appContext = null;
     volatile boolean created = false;
 
     AppContextCreator(ThreadGroup group)  {
-        super(group, "AppContextCreator");
+        super(group, null, "AppContextCreator");
     }
 
     public void run()  {
--- a/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Fri Apr 17 10:24:46 2015 -0700
@@ -42,6 +42,7 @@
 import sun.awt.AppContext;
 import sun.awt.EmbeddedFrame;
 import sun.awt.SunToolkit;
+import sun.misc.ManagedLocalsThread;
 import sun.misc.MessageUtils;
 import sun.misc.PerformanceLogger;
 import sun.misc.Queue;
@@ -176,8 +177,7 @@
 
 
         ThreadGroup appletGroup = loader.getThreadGroup();
-
-        handler = new Thread(appletGroup, this, "thread " + nm);
+        handler = new ManagedLocalsThread(appletGroup, this, "thread " + nm);
         // set the context class loader for this thread
         AccessController.doPrivileged(new PrivilegedAction<Object>() {
                 @Override
@@ -410,7 +410,7 @@
                       if (loaderThread == null) {
                           // REMIND: do we want a name?
                           //System.out.println("------------------- loading applet");
-                          setLoaderThread(new Thread(this));
+                          setLoaderThread(new ManagedLocalsThread(this));
                           loaderThread.start();
                           // we get to go to sleep while this runs
                           loaderThread.join();
--- a/src/java.desktop/share/classes/sun/applet/AppletViewer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/applet/AppletViewer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -38,6 +38,7 @@
 import java.security.PrivilegedAction;
 import sun.awt.SunToolkit;
 import sun.awt.AppContext;
+import sun.misc.ManagedLocalsThread;
 
 /**
  * A frame to show the applet tag in.
@@ -853,7 +854,7 @@
         //
         final AppletPanel p = panel;
 
-        new Thread(new Runnable()
+        new ManagedLocalsThread(new Runnable()
         {
             @Override
             public void run()
@@ -889,7 +890,7 @@
         // spawn a new thread to avoid blocking the event queue
         // when calling appletShutdown.
         //
-        new Thread(new Runnable()
+        new ManagedLocalsThread(new Runnable()
         {
             @Override
             public void run()
--- a/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java	Fri Apr 17 10:24:46 2015 -0700
@@ -34,6 +34,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import sun.misc.InnocuousThread;
 import sun.util.logging.PlatformLogger;
 import sun.awt.util.ThreadGroupUtils;
 
@@ -340,7 +341,13 @@
      * Must be called with {@link sun.security.util.SecurityConstants#MODIFY_THREADGROUP_PERMISSION}
      */
     private void activateBlockerThread() {
-        Thread thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, "AWT-Shutdown");
+        Thread thread;
+        String name =  "AWT-Shutdown";
+        if (System.getSecurityManager() == null) {
+            thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, name);
+        } else {
+            thread = new InnocuousThread(this, name);
+        }
         thread.setContextClassLoader(null);
         thread.setDaemon(false);
         blockerThread = thread;
--- a/src/java.desktop/share/classes/sun/awt/AppContext.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/awt/AppContext.java	Fri Apr 17 10:24:46 2015 -0700
@@ -43,6 +43,8 @@
 import java.beans.PropertyChangeSupport;
 import java.beans.PropertyChangeListener;
 import java.lang.ref.SoftReference;
+
+import sun.misc.InnocuousThread;
 import sun.util.logging.PlatformLogger;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
@@ -589,7 +591,12 @@
         }
 
         public Thread run() {
-            Thread t = new Thread(appContext.getThreadGroup(), runnable);
+            Thread t;
+            if (System.getSecurityManager() == null) {
+                t = new Thread(appContext.getThreadGroup(), runnable);
+            } else {
+                t = new InnocuousThread(appContext.getThreadGroup(), runnable, "AppContext Disposer");
+            }
             t.setContextClassLoader(appContext.getContextClassLoader());
             t.setPriority(Thread.NORM_PRIORITY + 1);
             t.setDaemon(true);
--- a/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/awt/datatransfer/SunClipboard.java	Fri Apr 17 10:24:46 2015 -0700
@@ -144,7 +144,7 @@
      *         AppContext as it is currently retrieved or null otherwise
      * @since 1.5
      */
-    private synchronized Transferable getContextContents() {
+    protected synchronized Transferable getContextContents() {
         AppContext context = AppContext.getAppContext();
         return (context == contentsContext) ? contents : null;
     }
@@ -275,42 +275,41 @@
             return;
         }
 
-        final Runnable runnable = new Runnable() {
-                public void run() {
-                    final SunClipboard sunClipboard = SunClipboard.this;
-                    ClipboardOwner owner = null;
-                    Transferable contents = null;
-
-                    synchronized (sunClipboard) {
-                        final AppContext context = sunClipboard.contentsContext;
-
-                        if (context == null) {
-                            return;
-                        }
-
-                        if (disposedContext == null || context == disposedContext) {
-                            owner = sunClipboard.owner;
-                            contents = sunClipboard.contents;
-                            sunClipboard.contentsContext = null;
-                            sunClipboard.owner = null;
-                            sunClipboard.contents = null;
-                            sunClipboard.clearNativeContext();
-                            context.removePropertyChangeListener
-                                (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard);
-                        } else {
-                            return;
-                        }
-                    }
-                    if (owner != null) {
-                        owner.lostOwnership(sunClipboard, contents);
-                    }
-                }
-            };
-
-        SunToolkit.postEvent(context, new PeerEvent(this, runnable,
+        SunToolkit.postEvent(context, new PeerEvent(this, () -> lostOwnershipNow(disposedContext),
                                                     PeerEvent.PRIORITY_EVENT));
     }
 
+    protected void lostOwnershipNow(final AppContext disposedContext) {
+        final SunClipboard sunClipboard = SunClipboard.this;
+        ClipboardOwner owner = null;
+        Transferable contents = null;
+
+        synchronized (sunClipboard) {
+            final AppContext context = sunClipboard.contentsContext;
+
+            if (context == null) {
+                return;
+            }
+
+            if (disposedContext == null || context == disposedContext) {
+                owner = sunClipboard.owner;
+                contents = sunClipboard.contents;
+                sunClipboard.contentsContext = null;
+                sunClipboard.owner = null;
+                sunClipboard.contents = null;
+                sunClipboard.clearNativeContext();
+                context.removePropertyChangeListener
+                        (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard);
+            } else {
+                return;
+            }
+        }
+        if (owner != null) {
+            owner.lostOwnership(sunClipboard, contents);
+        }
+    }
+
+
     protected abstract void clearNativeContext();
 
     protected abstract void setContentsNative(Transferable contents);
--- a/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java	Fri Apr 17 10:24:46 2015 -0700
@@ -55,6 +55,8 @@
 import java.util.prefs.Preferences;
 import sun.awt.InputMethodSupport;
 import sun.awt.SunToolkit;
+import sun.misc.InnocuousThread;
+import sun.misc.ManagedLocalsThread;
 
 /**
  * <code>InputMethodManager</code> is an abstract class that manages the input
@@ -165,7 +167,12 @@
                 // to choose from. Otherwise, just keep the instance.
                 if (imm.hasMultipleInputMethods()) {
                     imm.initialize();
-                    Thread immThread = new Thread(imm, threadName);
+                    Thread immThread;
+                    if (System.getSecurityManager() == null) {
+                        immThread = new Thread(imm, threadName);
+                    } else {
+                        immThread = new ManagedLocalsThread(imm, threadName);
+                    }
                     immThread.setDaemon(true);
                     immThread.setPriority(Thread.NORM_PRIORITY + 1);
                     immThread.start();
--- a/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java	Fri Apr 17 10:24:46 2015 -0700
@@ -27,6 +27,7 @@
 
 import java.util.Vector;
 import sun.awt.AppContext;
+import sun.misc.ManagedLocalsThread;
 
 /**
   * An ImageFetcher is a thread used to fetch ImageFetchable objects.
@@ -41,7 +42,7 @@
   * @author Jim Graham
   * @author Fred Ecks
   */
-class ImageFetcher extends Thread {
+class ImageFetcher extends ManagedLocalsThread {
     static final int HIGH_PRIORITY = 8;
     static final int LOW_PRIORITY = 3;
     static final int ANIM_PRIORITY = 2;
@@ -54,7 +55,7 @@
       * Constructor for ImageFetcher -- only called by add() below.
       */
     private ImageFetcher(ThreadGroup threadGroup, int index) {
-        super(threadGroup, "Image Fetcher " + index);
+        super(threadGroup, null, "Image Fetcher " + index);
         setDaemon(true);
     }
 
--- a/src/java.desktop/share/classes/sun/font/CreatedFontTracker.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/font/CreatedFontTracker.java	Fri Apr 17 10:24:46 2015 -0700
@@ -36,6 +36,7 @@
 
 import sun.awt.AppContext;
 import sun.awt.util.ThreadGroupUtils;
+import sun.misc.InnocuousThread;
 
 public class CreatedFontTracker {
 
@@ -115,18 +116,25 @@
         static void init() {
             if (t == null) {
                 // Add a shutdown hook to remove the temp file.
-                AccessController.doPrivileged(
-                        (PrivilegedAction<Void>) () -> {
-                            /* The thread must be a member of a thread group
-                             * which will not get GCed before VM exit.
-                             * Make its parent the top-level thread group.
-                             */
-                            ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
-                            t = new Thread(rootTG, TempFileDeletionHook::runHooks);
-                            t.setContextClassLoader(null);
-                            Runtime.getRuntime().addShutdownHook(t);
-                            return null;
-                        });
+                AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+                    if (System.getSecurityManager() == null) {
+                        /* The thread must be a member of a thread group
+                         * which will not get GCed before VM exit.
+                         * Make its parent the top-level thread group.
+                         */
+                        ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
+                        t = new Thread(rootTG, TempFileDeletionHook::runHooks);
+                    } else {
+                        /* InnocuousThread is a member of a correct TG by default */
+                        t = new InnocuousThread(TempFileDeletionHook::runHooks);
+                    }
+                    /* Set context class loader to null in order to avoid
+                     * keeping a strong reference to an application classloader.
+                     */
+                    t.setContextClassLoader(null);
+                    Runtime.getRuntime().addShutdownHook(t);
+                    return null;
+                });
             }
         }
 
--- a/src/java.desktop/share/classes/sun/font/SunFontManager.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java	Fri Apr 17 10:24:46 2015 -0700
@@ -54,6 +54,7 @@
 import sun.awt.SunToolkit;
 import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.FontSupport;
+import sun.misc.InnocuousThread;
 import sun.util.logging.PlatformLogger;
 
 /**
@@ -2529,18 +2530,17 @@
                           });
                       }
                     };
-                    AccessController.doPrivileged(
-                            (PrivilegedAction<Void>) () -> {
-                                /* The thread must be a member of a thread group
-                                 * which will not get GCed before VM exit.
-                                 * Make its parent the top-level thread group.
-                                 */
-                                ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
-                                fileCloser = new Thread(rootTG, fileCloserRunnable);
-                                fileCloser.setContextClassLoader(null);
-                                Runtime.getRuntime().addShutdownHook(fileCloser);
-                                return null;
-                            });
+                    AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+                        if (System.getSecurityManager() == null) {
+                            ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
+                            fileCloser = new Thread(rootTG, fileCloserRunnable);
+                        } else {
+                            fileCloser = new InnocuousThread(fileCloserRunnable);
+                        }
+                        fileCloser.setContextClassLoader(null);
+                        Runtime.getRuntime().addShutdownHook(fileCloser);
+                        return null;
+                    });
                 }
             }
         }
--- a/src/java.desktop/share/classes/sun/java2d/Disposer.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/Disposer.java	Fri Apr 17 10:24:46 2015 -0700
@@ -26,6 +26,7 @@
 package sun.java2d;
 
 import sun.awt.util.ThreadGroupUtils;
+import sun.misc.InnocuousThread;
 
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
@@ -81,21 +82,21 @@
             }
         }
         disposerInstance = new Disposer();
-        AccessController.doPrivileged(
-                (PrivilegedAction<Void>) () -> {
-                     /* The thread must be a member of a thread group
-                      * which will not get GCed before VM exit.
-                      * Make its parent the top-level thread group.
-                      */
-                     ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
-                     Thread t = new Thread(rootTG, disposerInstance, "Java2D Disposer");
-                     t.setContextClassLoader(null);
-                     t.setDaemon(true);
-                     t.setPriority(Thread.MAX_PRIORITY);
-                     t.start();
-                     return null;
-                 }
-         );
+        AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+            String name = "Java2D Disposer";
+            Thread t;
+            if (System.getSecurityManager() == null) {
+                ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
+                t = new Thread(rootTG, disposerInstance, name);
+            } else {
+                t = new InnocuousThread(disposerInstance, name);
+            }
+            t.setContextClassLoader(null);
+            t.setDaemon(true);
+            t.setPriority(Thread.MAX_PRIORITY);
+            t.start();
+            return null;
+        });
     }
 
     /**
--- a/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Fri Apr 17 10:24:46 2015 -0700
@@ -33,6 +33,7 @@
 import java.awt.AlphaComposite;
 import java.awt.Rectangle;
 import sun.awt.image.BufImgSurfaceData;
+import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.SurfaceData;
 import sun.java2d.pipe.Region;
 import java.lang.reflect.Field;
@@ -46,6 +47,8 @@
 import java.io.FileNotFoundException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+
+import sun.misc.InnocuousThread;
 import sun.security.action.GetPropertyAction;
 
 /**
@@ -413,15 +416,19 @@
         return traceout;
     }
 
-    public static class TraceReporter extends Thread {
+    public static class TraceReporter implements Runnable {
         public static void setShutdownHook() {
-            AccessController.doPrivileged(new PrivilegedAction<Void>() {
-                public Void run() {
-                    TraceReporter t = new TraceReporter();
-                    t.setContextClassLoader(null);
-                    Runtime.getRuntime().addShutdownHook(t);
-                    return null;
+            AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+                TraceReporter t = new TraceReporter();
+                Thread thread;
+                if (System.getSecurityManager() == null) {
+                    thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), t);
+                } else {
+                    thread = new InnocuousThread(t);
                 }
+                thread.setContextClassLoader(null);
+                Runtime.getRuntime().addShutdownHook(thread);
+                return null;
             });
         }
 
--- a/src/java.desktop/share/classes/sun/java2d/opengl/OGLRenderQueue.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/java2d/opengl/OGLRenderQueue.java	Fri Apr 17 10:24:46 2015 -0700
@@ -28,6 +28,8 @@
 import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.pipe.RenderBuffer;
 import sun.java2d.pipe.RenderQueue;
+import sun.misc.InnocuousThread;
+
 import static sun.java2d.pipe.BufferedOpCodes.*;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -48,9 +50,7 @@
          * The thread must be a member of a thread group
          * which will not get GCed before VM exit.
          */
-        flusher = AccessController.doPrivileged((PrivilegedAction<QueueFlusher>) () -> {
-            return new QueueFlusher(ThreadGroupUtils.getRootThreadGroup());
-        });
+        flusher = AccessController.doPrivileged((PrivilegedAction<QueueFlusher>) QueueFlusher::new);
     }
 
     /**
@@ -115,7 +115,7 @@
      * Returns true if the current thread is the OGL QueueFlusher thread.
      */
     public static boolean isQueueFlusherThread() {
-        return (Thread.currentThread() == getInstance().flusher);
+        return (Thread.currentThread() == getInstance().flusher.thread);
     }
 
     public void flushNow() {
@@ -153,16 +153,22 @@
         refSet.clear();
     }
 
-    private class QueueFlusher extends Thread {
+    private class QueueFlusher implements Runnable {
         private boolean needsFlush;
         private Runnable task;
         private Error error;
+        private final Thread thread;
 
-        public QueueFlusher(ThreadGroup threadGroup) {
-            super(threadGroup, "Java2D Queue Flusher");
-            setDaemon(true);
-            setPriority(Thread.MAX_PRIORITY);
-            start();
+        public QueueFlusher() {
+            String name = "Java2D Queue Flusher";
+            if (System.getSecurityManager() == null) {
+                this.thread = new Thread(ThreadGroupUtils.getRootThreadGroup(), this, name);
+            } else {
+                this.thread = new InnocuousThread(this, name);
+            }
+            thread.setDaemon(true);
+            thread.setPriority(Thread.MAX_PRIORITY);
+            thread.start();
         }
 
         public synchronized void flushNow() {
--- a/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Fri Apr 17 10:24:46 2015 -0700
@@ -71,6 +71,7 @@
 import javax.print.attribute.standard.MediaSizeName;
 import javax.print.attribute.standard.PageRanges;
 
+import sun.misc.ManagedLocalsThread;
 import sun.print.SunPageSelection;
 import sun.print.SunMinMaxPage;
 
@@ -986,8 +987,12 @@
     }
 
     private void startPrinterJobThread() {
-
-        printerJobThread = new Thread(this, "printerJobThread");
+        String name = "printerJobThread";
+        if (System.getSecurityManager() == null) {
+            printerJobThread = new Thread(this, name);
+        } else {
+            printerJobThread = new ManagedLocalsThread(this, name);
+        }
         printerJobThread.start();
     }
 
--- a/src/java.desktop/share/classes/sun/print/ServiceNotifier.java	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/classes/sun/print/ServiceNotifier.java	Fri Apr 17 10:24:46 2015 -0700
@@ -25,6 +25,8 @@
 
 package sun.print;
 
+import sun.misc.ManagedLocalsThread;
+
 import java.util.Vector;
 
 import javax.print.PrintService;
@@ -40,7 +42,7 @@
  * to obtain the state of the attributes and notifies the listeners of
  * any changes.
  */
-class ServiceNotifier extends Thread {
+class ServiceNotifier extends ManagedLocalsThread {
 
     private PrintService service;
     private Vector<PrintServiceAttributeListener> listeners;
@@ -48,7 +50,7 @@
     private PrintServiceAttributeSet lastSet;
 
     ServiceNotifier(PrintService service) {
-        super(service.getName() + " notifier");
+        super((Runnable) null, service.getName() + " notifier");
         this.service = service;
         listeners = new Vector<>();
         try {
--- a/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libfontmanager/layout/LETableReference.h	Fri Apr 17 10:24:46 2015 -0700
@@ -150,8 +150,8 @@
       if(isEmpty()) {
         //err = LE_MISSING_FONT_TABLE_ERROR;
         clear(); // it's just empty. Not an error.
-      } else if(offset >= fParent->fLength) {
-        LE_DEBUG_TR3("offset out of range: (%p) +%d", NULL, offset);
+      } else if(offset >= fParent->fLength || (offset & 0x01)) {
+        LE_DEBUG_TR3("offset out of range or odd alignment: (%p) +%d", NULL, offset);
         err = LE_INDEX_OUT_OF_BOUNDS_ERROR;
         clear();
       } else {
--- a/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc.cpp	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc.cpp	Fri Apr 17 10:24:46 2015 -0700
@@ -115,7 +115,7 @@
                   LE_DEBUG_BAD_FONT("off end of ligature substitution header");
                   return newState; // get out! bad font
               }
-              if(componentGlyph > glyphStorage.getGlyphCount()) {
+              if(componentGlyph >= glyphStorage.getGlyphCount()) {
                 LE_DEBUG_BAD_FONT("preposterous componentGlyph");
                 currGlyph++;
                 return newState; // get out! bad font
--- a/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc2.cpp	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc2.cpp	Fri Apr 17 10:24:46 2015 -0700
@@ -119,7 +119,7 @@
 
             offset = action & lafComponentOffsetMask;
             if (offset != 0) {
-                if(componentGlyph > glyphStorage.getGlyphCount()) {
+                if(componentGlyph >= glyphStorage.getGlyphCount()) {
                   LE_DEBUG_BAD_FONT("preposterous componentGlyph");
                   currGlyph+= dir;
                   return nextStateIndex; // get out! bad font
--- a/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libfontmanager/layout/LigatureSubstSubtables.cpp	Fri Apr 17 10:24:46 2015 -0700
@@ -58,7 +58,7 @@
         if( LE_FAILURE(success) ) { return 0; }
         le_uint16 ligCount = SWAPW(ligSetTable->ligatureCount);
 
-        LEReferenceTo<Offset> ligatureTableOffsetArray(base, success, ligSetTable->ligatureTableOffsetArray, ligCount);
+        LEReferenceToArrayOf<Offset> ligatureTableOffsetArray(base, success, ligSetTable->ligatureTableOffsetArray, ligCount);
         for (le_uint16 lig = 0; LE_SUCCESS(success) && lig < ligCount; lig += 1) {
             Offset ligTableOffset = SWAPW(ligSetTable->ligatureTableOffsetArray[lig]);
             LEReferenceTo<LigatureTable>   ligTable(ligSetTable, success, ligTableOffset);
--- a/src/java.desktop/share/native/libfontmanager/layout/LookupProcessor.cpp	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libfontmanager/layout/LookupProcessor.cpp	Fri Apr 17 10:24:46 2015 -0700
@@ -255,6 +255,7 @@
 
     if (requiredFeatureIndex != 0xFFFF) {
       requiredFeatureTable = featureListTable->getFeatureTable(featureListTable, requiredFeatureIndex, &requiredFeatureTag, success);
+      if (LE_FAILURE(success)) return;
       featureReferences += SWAPW(requiredFeatureTable->lookupCount);
     }
 
@@ -292,7 +293,7 @@
                 }
 
                 featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success);
-
+                if (LE_FAILURE(success)) continue;
                 if (featureTag == fm.tag) {
                   count += selectLookups(featureTable, fm.mask, order + count, success);
                 }
@@ -319,7 +320,7 @@
 #endif
 
                 featureTable = featureListTable->getFeatureTable(featureListTable, featureIndex, &featureTag, success);
-
+                if (LE_FAILURE(success)) continue;
                 if (featureTag == fm.tag) {
                   order += selectLookups(featureTable, fm.mask, order, success);
                 }
--- a/src/java.desktop/share/native/libfontmanager/layout/MultipleSubstSubtables.cpp	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libfontmanager/layout/MultipleSubstSubtables.cpp	Fri Apr 17 10:24:46 2015 -0700
@@ -71,7 +71,12 @@
     if (coverageIndex >= 0 && coverageIndex < seqCount) {
         Offset sequenceTableOffset = SWAPW(sequenceTableOffsetArray[coverageIndex]);
         LEReferenceTo<SequenceTable>   sequenceTable(base, success, sequenceTableOffset);
+        if (LE_FAILURE(success)) {
+            return 0;
+        }
         le_uint16 glyphCount = SWAPW(sequenceTable->glyphCount);
+        LEReferenceToArrayOf<Offset>
+            substituteArrayRef(base, success, sequenceTable->substituteArray, glyphCount);
 
         if (glyphCount == 0) {
             glyphIterator->setCurrGlyphID(0xFFFF);
--- a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES	Fri Apr 17 10:24:46 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,6 @@
  * questions.
  */
 
-#if 0
-libpng_changes(){ /*
 CHANGES - changes for libpng
 
 Version 0.2
@@ -205,7 +203,7 @@
   Fixed serious bug with < 8bpp images introduced in 0.95
   Fixed 256-color transparency bug (Greg Roelofs)
   Fixed up documentation (Greg Roelofs, Laszlo Nyul)
-  Fixed "error" in pngconf.h for Linux setjmp() behaviour
+  Fixed "error" in pngconf.h for Linux setjmp() behavior
   Fixed DOS medium model support (Tim Wegner)
   Fixed png_check_keyword() for case with error in static string text
   Added read of CRC after IEND chunk for embedded PNGs (Laszlo Nyul)
@@ -222,18 +220,20 @@
   Added more typecasts. 65536L becomes (png_uint_32)65536L, etc. (Glenn R-P)
   Minor corrections in libpng.txt
   Added simple sRGB support (Glenn R-P)
-  Easier conditional compiling, e.g. define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
+  Easier conditional compiling, e.g.,
+    define PNG_READ/WRITE_NOT_FULLY_SUPPORTED;
     all configurable options can be selected from command-line instead
     of having to edit pngconf.h (Glenn R-P)
   Fixed memory leak in pngwrite.c (free info_ptr->text) (Glenn R-P)
   Added more conditions for png_do_background, to avoid changing
     black pixels to background when a background is supplied and
     no pixels are transparent
-  Repaired PNG_NO_STDIO behaviour
-  Tested NODIV support and made it default behaviour (Greg Roelofs)
+  Repaired PNG_NO_STDIO behavior
+  Tested NODIV support and made it default behavior (Greg Roelofs)
   Added "-m" option and PNGTEST_DEBUG_MEMORY to pngtest (John Bowler)
   Regularized version numbering scheme and bumped shared-library major
-     version number to 2 to avoid problems with libpng 0.89 apps (Greg Roelofs)
+    version number to 2 to avoid problems with libpng 0.89 apps
+    (Greg Roelofs)
 
 Version 0.98 [January, 1998]
   Cleaned up some typos in libpng.txt and in code documentation
@@ -1803,7 +1803,7 @@
   Removed AC_FUNC_MALLOC from configure.ac
   Work around Intel-Mac compiler bug by setting PNG_NO_MMX_CODE in pngconf.h
   Change "logical" to "bitwise" throughout documentation.
-  Detect and fix attempt to write wrong iCCP profile length.
+  Detect and fix attempt to write wrong iCCP profile length (CVE-2006-7244)
 
 Version 1.0.21, 1.2.13 [November 14, 2006]
   Fix potential buffer overflow in sPLT chunk handler.
@@ -2126,7 +2126,7 @@
     png_decompress_chunk(), and remove "chunkdata" from parameter list.
   Put a call to png_check_chunk_name() in png_read_chunk_header().
   Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
-  Removed two calls to png_check_chunk_name() occurring later in the process.
+  Removed two calls to png_check_chunk_name() occuring later in the process.
   Define PNG_NO_ERROR_NUMBERS by default in pngconf.h
 
 Version 1.4.0beta25 [July 30, 2008]
@@ -2386,7 +2386,7 @@
 
 Version 1.4.0beta73 [August 1, 2009]
   Reject attempt to write iCCP chunk with negative embedded profile length
-    (JD Chen)
+    (JD Chen) (CVE-2009-5063).
 
 Version 1.4.0beta74 [August 8, 2009]
   Changed png_ptr and info_ptr member "trans" to "trans_alpha".
@@ -3174,8 +3174,8 @@
     in version 1.5.0beta36 but is not noted in the CHANGES.  Similarly,
     it was changed from png_charpp to png_const_bytepp in png_set_iCCP().
   Ensure that png_rgb_to_gray ignores palette mapped images, if libpng
-    internally happens to call it with one.
-  Fixed a failure to handle palette mapped images correctly.
+    internally happens to call it with one, and fixed a failure to handle
+    palette mapped images correctly.  This fixes CVE-2690.
 
 Version 1.5.1beta02 [January 14, 2011]
   Fixed a bug in handling of interlaced images (bero at arklinux.org).
@@ -3314,8 +3314,8 @@
 
 Version 1.5.3beta01 [April 1, 2011]
   Re-initialize the zlib compressor before compressing non-IDAT chunks.
-  Added API functions to set parameters for zlib compression of non-IDAT
-    chunks.
+  Added API functions (png_set_text_compression_level() and four others) to
+    set parameters for zlib compression of non-IDAT chunks.
 
 Version 1.5.3beta02 [April 3, 2011]
   Updated scripts/symbols.def with new API functions.
@@ -3372,7 +3372,7 @@
     dependency of the tIME-supporting RFC1132 code on stdio is removed and
     PNG_NO_WARNINGS does actually work now.
   Pass "" instead of '\0' to png_default_error() in png_err().  This mistake
-    was introduced in libpng-1.2.20beta01.
+    was introduced in libpng-1.2.20beta01.  This fixes CVE-2011-2691.
   Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
     optimization configureable.
   IDAT compression failed if preceded by a compressed text chunk (bug
@@ -3403,7 +3403,8 @@
   Documented png_set_alpha_mode(), other changes in libpng.3/libpng-manual.txt
   The cHRM chunk now sets the defaults for png_set_rgb_to_gray() (when negative
     parameters are supplied by the caller), while in the absence of cHRM
-    sRGB/Rec 709 values are still used.
+    sRGB/Rec 709 values are still used.  This introduced a divide-by-zero
+    bug in png_handle_cHRM().
   The bKGD chunk no longer overwrites the background value set by
     png_set_background(), allowing the latter to be used before the file
     header is read. It never performed any useful function to override
@@ -3443,7 +3444,8 @@
     Frank Busse, CVE-2011-2501, related to CVE-2004-0421).
 
 Version 1.5.3beta11 [June 11, 2011]
-  Fixed png_handle_sCAL which is broken in 1.5; added sCAL to pngtest.png
+  Fixed png_handle_sCAL which is broken in 1.5. This fixes CVE 2011-2692.
+  Added sCAL to pngtest.png
   Revised documentation about png_set_user_limits() to say that it also affects
     png writing.
   Revised handling of png_set_user_limits() so that it can increase the
@@ -3468,7 +3470,7 @@
   Removed string/memory macros that are no longer used and are not
     necessarily fully supportable, particularly png_strncpy and png_snprintf.
   Added log option to pngvalid.c and attempted to improve gamma messages.
-  
+
 Version 1.5.3 [omitted]
   People found the presence of a beta release following an rc release
     to be confusing; therefore we bump the version to libpng-1.5.4beta01
@@ -3532,6 +3534,1620 @@
   Define PNG_ALLOCATED to "restrict" only if MSC_VER >= 1400.
 
 Version 1.5.4 [July 7, 2011]
+  No changes.
+
+Version 1.5.5beta01 [July 13, 2011]
+  Fixed some typos and made other minor changes in the manual.
+  Updated contrib/pngminus/makefile.std (Samuli Souminen)
+
+Version 1.5.5beta02 [July 14, 2011]
+  Revised Makefile.am and Makefile.in to look in the right directory for
+    pnglibconf.h.prebuilt
+
+Version 1.5.5beta03 [July 27, 2011]
+  Enabled compilation with g++ compiler.  This compiler does not recognize
+    the file extension, so it always compiles with C++ rules.  Made minor
+    changes to pngrutil.c to cast results where C++ expects it but C does not.
+  Minor editing of libpng.3 and libpng-manual.txt.
+
+Version 1.5.5beta04 [July 29, 2011]
+  Revised CMakeLists.txt (Clifford Yapp)
+  Updated commentary about the png_rgb_to_gray() default coefficients
+    in the manual and in pngrtran.c
+
+Version 1.5.5beta05 [August 17, 2011]
+  Prevent unexpected API exports from non-libpng DLLs on Windows.  The "_DLL"
+    is removed from the test of whether a DLL is being built (this erroneously
+    caused the libpng APIs to be marked as DLL exports in static builds under
+    Microsoft Visual Studio).  Almost all of the libpng building configuration
+    is moved from pngconf.h to pngpriv.h, but PNG_DLL_EXPORT remains in
+    pngconf.h, though, so that it is colocated with the import definition (it
+    is no longer used anywhere in the installed headers).  The VStudio project
+    definitions have been cleaned up: "_USRDLL" has been removed from the
+    static library builds (this was incorrect), and PNG_USE_DLL has been added
+    to pngvalid to test the functionality (pngtest does not supply it,
+    deliberately).  The spurious "_EXPORTS" has been removed from the
+    libpng build (all these errors were a result of copy/paste between project
+    configurations.)
+  Added new types and internal functions for CIE RGB end point handling to
+    pngpriv.h (functions yet to be implemented).
+
+Version 1.5.5beta06 [August 26, 2011]
+  Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set in CMakeLists.txt
+    (Clifford Yap)
+  Fixes to rgb_to_gray and cHRM XYZ APIs (John Bowler):
+    The rgb_to_gray code had errors when combined with gamma correction.
+    Some pixels were treated as true grey when they weren't and such pixels
+    and true grey ones were not gamma corrected (the original value of the
+    red component was used instead).  APIs to get and set cHRM using color
+    space end points have been added and the rgb_to_gray code that defaults
+    based on cHRM, and the divide-by-zero bug in png_handle_cHRM (CERT
+    VU#477046, CVE-2011-3328, introduced in 1.5.4) have been corrected.
+  A considerable number of tests has been added to pngvalid for the
+    rgb_to_gray transform.
+  Arithmetic errors in rgb_to_gray whereby the calculated gray value was
+    truncated to the bit depth rather than rounded have been fixed except in
+    the 8-bit non-gamma-corrected case (where consistency seems more important
+    than correctness.)  The code still has considerable inaccuracies in the
+    8-bit case because 8-bit linear arithmetic is used.
+
+Version 1.5.5beta07 [September 7, 2011]
+  Added "$(ARCH)" option to makefile.darwin
+  Added SunOS support to configure.ac and Makefile.am
+  Changed png_chunk_benign_error() to png_warning() in png.c, in
+    png_XYZ_from_xy_checked().
+
+Version 1.5.5beta08 [September 10, 2011]
+  Fixed 64-bit compilation errors (gcc). The errors fixed relate
+    to conditions where types that are 32 bits in the GCC 32-bit
+    world (uLong and png_size_t) become 64 bits in the 64-bit
+    world.  This produces potential truncation errors which the
+    compiler correctly flags.
+  Relocated new HAVE_SOLARIS_LD definition in configure.ac
+  Constant changes for 64-bit compatibility (removal of L suffixes). The
+    16-bit cases still use "L" as we don't have a 16-bit test system.
+
+Version 1.5.5rc01 [September 15, 2011]
+  Removed "L" suffixes in pngpriv.h
+
+Version 1.5.5 [September 22, 2011]
+  No changes.
+
+Version 1.5.6beta01 [September 22, 2011]
+  Fixed some 64-bit type conversion warnings in pngrtran.c
+  Moved row_info from png_struct to a local variable.
+  The various interlace mask arrays have been made into arrays of
+    bytes and made PNG_CONST and static (previously some arrays were
+    marked PNG_CONST and some weren't).
+  Additional checks have been added to the transform code to validate the
+    pixel depths after the transforms on both read and write.
+  Removed some redundant code from pngwrite.c, in png_destroy_write_struct().
+  Changed chunk reading/writing code to use png_uint_32 instead of png_byte[4].
+    This removes the need to allocate temporary strings for chunk names on
+    the stack in the read/write code.  Unknown chunk handling still uses the
+    string form because this is exposed in the API.
+
+Version 1.5.6beta02 [September 26, 2011]
+  Added a note in the manual the png_read_update_info() must be called only
+    once with a particular info_ptr.
+  Fixed a typo in the definition of the new PNG_STRING_FROM_CHUNK(s,c) macro.
+
+Version 1.5.6beta03 [September 28, 2011]
+  Revised test-pngtest.sh to report FAIL when pngtest fails.
+  Added "--strict" option to pngtest, to report FAIL when the failure is
+    only because the resulting valid files are different.
+  Revised CMakeLists.txt to work with mingw and removed some material from
+    CMakeLists.txt that is no longer useful in libpng-1.5.
+
+Version 1.5.6beta04 [October 5, 2011]
+  Fixed typo in Makefile.in and Makefile.am ("-M Wl" should be "-M -Wl")."
+
+Version 1.5.6beta05 [October 12, 2011]
+  Speed up png_combine_row() for interlaced images. This reduces the generality
+    of the code, allowing it to be optimized for Adam7 interlace.  The masks
+    passed to png_combine_row() are now generated internally, avoiding
+    some code duplication and localizing the interlace handling somewhat.
+  Align png_struct::row_buf - previously it was always unaligned, caused by
+    a bug in the code that attempted to align it; the code needs to subtract
+    one from the pointer to take account of the filter byte prepended to
+    each row.
+  Optimized png_combine_row() when rows are aligned. This gains a small
+    percentage for 16-bit and 32-bit pixels in the typical case where the
+    output row buffers are appropriately aligned. The optimization was not
+    previously possible because the png_struct buffer was always misaligned.
+  Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
+
+Version 1.5.6beta06 [October 17, 2011]
+  Removed two redundant tests for unitialized row.
+  Fixed a relatively harmless memory overwrite in compressed text writing
+    with a 1 byte zlib buffer.
+  Add ability to call png_read_update_info multiple times to pngvalid.c.
+  Fixes for multiple calls to png_read_update_info. These fixes attend to
+    most of the errors revealed in pngvalid, however doing the gamma work
+    twice results in inaccuracies that can't be easily fixed.  There is now
+    a warning in the code if this is going to happen.
+  Turned on multiple png_read_update_info in pngvalid transform tests.
+  Prevent libpng from overwriting unused bits at the end of the image when
+    it is not byte aligned, while reading. Prior to libpng-1.5.6 libpng would
+    overwrite the partial byte at the end of each row if the row width was not
+    an exact multiple of 8 bits and the image is not interlaced.
+
+Version 1.5.6beta07 [October 21, 2011]
+  Made png_ptr->prev_row an aligned pointer into png_ptr->big_prev_row
+    (Mans Rullgard).
+
+Version 1.5.6rc01 [October 26, 2011]
+  Changed misleading "Missing PLTE before cHRM" warning to "Out of place cHRM"
+
+Version 1.5.6rc02 [October 27, 2011]
+  Added LSR() macro to defend against buggy compilers that evaluate non-taken
+    code branches and complain about out-of-range shifts.
+
+Version 1.5.6rc03 [October 28, 2011]
+  Renamed the LSR() macro to PNG_LSR() and added PNG_LSL() macro.
+  Fixed compiler warnings with Intel and MSYS compilers. The logical shift
+    fix for Microsoft Visual C is required by other compilers, so this
+    enables that fix for all compilers when using compile-time constants.
+    Under MSYS 'byte' is a name declared in a system header file, so we
+    changed the name of a local variable to avoid the warnings that result.
+  Added #define PNG_ALIGN_TYPE PNG_ALIGN_NONE to contrib/pngminim/*/pngusr.h
+
+Version 1.5.6 [November 3, 2011]
+  No changes.
+
+Version 1.5.7beta01 [November 4, 2011]
+  Added support for ARM processor, when decoding all PNG up-filtered rows
+    and any other-filtered rows with 3 or 4 bytes per pixel (Mans Rullgard).
+  Fixed bug in pngvalid on early allocation failure; fixed type cast in
+    pngmem.c; pngvalid would attempt to call png_error() if the allocation
+    of a png_struct or png_info failed. This would probably have led to a
+    crash.  The pngmem.c implementation of png_malloc() included a cast
+    to png_size_t which would fail on large allocations on 16-bit systems.
+  Fix for the preprocessor of the Intel C compiler. The preprocessor
+    splits adjacent @ signs with a space; this changes the concatentation
+    token from @-@-@ to PNG_JOIN; that should work with all compiler
+    preprocessors.
+  Paeth filter speed improvements from work by Siarhei Siamashka. This
+    changes the 'Paeth' reconstruction function to improve the GCC code
+    generation on x86. The changes are only part of the suggested ones;
+    just the changes that definitely improve speed and remain simple.
+    The changes also slightly increase the clarity of the code.
+
+Version 1.5.7beta02 [November 11, 2011]
+  Check compression_type parameter in png_get_iCCP and remove spurious
+    casts. The compression_type parameter is always assigned to, so must
+    be non-NULL. The cast of the profile length potentially truncated the
+    value unnecessarily on a 16-bit int system, so the cast of the (byte)
+    compression type to (int) is specified by ANSI-C anyway.
+  Fixed FP division by zero in pngvalid.c; the 'test_pixel' code left
+    the sBIT fields in the test pixel as 0, which resulted in a floating
+    point division by zero which was irrelevant but causes systems where
+    FP exceptions cause a crash. Added code to pngvalid to turn on FP
+    exceptions if the appropriate glibc support is there to ensure this is
+    tested in the future.
+  Updated scripts/pnglibconf.mak and scripts/makefile.std to handle the
+    new PNG_JOIN macro.
+  Added versioning to pnglibconf.h comments.
+  Simplified read/write API initial version; basic read/write tested on
+    a variety of images, limited documentation (in the header file.)
+  Installed more accurate linear to sRGB conversion tables. The slightly
+    modified tables reduce the number of 16-bit values that
+    convert to an off-by-one 8-bit value.  The "makesRGB.c" code that was used
+    to generate the tables is now in a contrib/sRGBtables sub-directory.
+
+Version 1.5.7beta03 [November 17, 2011]
+  Removed PNG_CONST from the sRGB table declarations in pngpriv.h and png.c
+  Added run-time detection of NEON support.
+  Added contrib/libtests; includes simplified API test and timing test and
+    a color conversion utility for rapid checking of failed 'pngstest' results.
+  Multiple transform bug fixes plus a work-round for double gamma correction.
+    libpng does not support more than one transform that requires linear data
+    at once - if this is tried typically the results is double gamma
+    correction. Since the simplified APIs can need rgb to gray combined with
+    a compose operation it is necessary to do one of these outside the main
+    libpng transform code. This check-in also contains fixes to various bugs
+    in the simplified APIs themselves and to some bugs in compose and rgb to
+    gray (on palette) itself.
+  Fixes for C++ compilation using g++ When libpng source is compiled
+    using g++. The compiler imposes C++ rules on the C source; thus it
+    is desireable to make the source work with either C or C++ rules
+    without throwing away useful error information.  This change adds
+    png_voidcast to allow C semantic (void*) cases or the corresponding
+    C++ static_cast operation, as appropriate.
+  Added --noexecstack to assembler file compilation. GCC does not set
+    this on assembler compilation, even though it does on C compilation.
+    This creates security issues if assembler code is enabled; the
+    work-around is to set it by default in the flags for $(CCAS)
+  Work around compilers that don't support declaration of const data. Some
+    compilers fault 'extern const' data declarations (because the data is
+    not initialized); this turns on const-ness only for compilers where
+    this is known to work.
+
+Version 1.5.7beta04 [November 17, 2011]
+  Since the gcc driver does not recognize the --noexecstack flag, we must
+    use the -Wa prefix to have it passed through to the assembler.
+    Also removed a duplicate setting of this flag.
+  Added files that were omitted from the libpng-1.5.7beta03 zip distribution.
+
+Version 1.5.7beta05 [November 25, 2011]
+  Removed "zTXt" from warning in generic chunk decompression function.
+  Validate time settings passed to pngset() and png_convert_to_rfc1123()
+    (Frank Busse).
+  Added MINGW support to CMakeLists.txt
+  Reject invalid compression flag or method when reading the iTXt chunk.
+  Backed out 'simplified' API changes. The API seems too complex and there
+    is a lack of consensus or enthusiasm for the proposals.  The API also
+    reveals significant bugs inside libpng (double gamma correction and the
+    known bug of being unable to retrieve a corrected palette). It seems
+    better to wait until the bugs, at least, are corrected.
+  Moved pngvalid.c into contrib/libtests
+  Rebuilt Makefile.in, configure, etc., with autoconf-2.68
+
+Version 1.5.7rc01 [December 1, 2011]
+  Replaced an "#if" with "#ifdef" in pngrtran.c
+  Revised #if PNG_DO_BC block in png.c (use #ifdef and add #else)
+
+Version 1.5.7rc02 [December 5, 2011]
+  Revised project files and contrib/pngvalid/pngvalid.c to account for
+    the relocation of pngvalid into contrib/libtests.
+  Revised pngconf.h to use " __declspec(restrict)" only when MSC_VER >= 1400,
+    as in libpng-1.5.4.
+  Put CRLF line endings in the owatcom project files.
+
+Version 1.5.7rc03 [December 7, 2011]
+  Updated CMakeLists.txt to account for the relocation of pngvalid.c
+
+Version 1.5.7 [December 15, 2011]
+  Minor fixes to pngvalid.c for gcc 4.6.2 compatibility to remove warnings
+    reported by earlier versions.
+  Fixed minor memset/sizeof errors in pngvalid.c.
+
+Version 1.6.0beta01 [December 15, 2011]
+  Removed machine-generated configure files from the GIT repository (they will
+    continue to appear in the tarball distributions and in the libpng15 and
+    earlier GIT branches).
+  Restored the new 'simplified' API, which was started in libpng-1.5.7beta02
+    but later deleted from libpng-1.5.7beta05.
+  Added example programs for the new 'simplified' API.
+  Added ANSI-C (C90) headers and require them, and take advantage of the
+    change. Also fixed some of the projects/* and contrib/* files that needed
+    updates for libpng16 and the move of pngvalid.c.
+    With this change the required ANSI-C header files are assumed to exist: the
+    implementation must provide float.h, limits.h, stdarg.h and stddef.h and
+    libpng relies on limits.h and stddef.h existing and behaving as defined
+    (the other two required headers aren't used).  Non-ANSI systems that don't
+    have stddef.h or limits.h will have to provide an appropriate fake
+    containing the relevant types and #defines.
+  The use of FAR/far has been eliminated and the definition of png_alloc_size_t
+    is now controlled by a flag so that 'small size_t' systems can select it
+    if necessary.  Libpng 1.6 may not currently work on such systems -- it
+    seems likely that it will ask 'malloc' for more than 65535 bytes with any
+    image that has a sufficiently large row size (rather than simply failing
+    to read such images).
+  New tools directory containing tools used to generate libpng code.
+  Fixed race conditions in parallel make builds. With higher degrees of
+    parallelism during 'make' the use of the same temporary file names such
+    as 'dfn*' can result in a race where a temporary file from one arm of the
+    build is deleted or overwritten in another arm.  This changes the
+    temporary files for suffix rules to always use $* and ensures that the
+    non-suffix rules use unique file names.
+
+Version 1.6.0beta02 [December 21, 2011]
+  Correct configure builds where build and source directories are separate.
+    The include path of 'config.h' was erroneously made relative in pngvalid.c
+    in libpng 1.5.7.
+
+Version 1.6.0beta03 [December 22, 2011]
+  Start-up code size improvements, error handler flexibility. These changes
+    alter how the tricky allocation of the initial png_struct and png_info
+    structures are handled. png_info is now handled in pretty much the same
+    way as everything else, except that the allocations handle NULL return
+    silently.  png_struct is changed in a similar way on allocation and on
+    deallocation a 'safety' error handler is put in place (which should never
+    be required).  The error handler itself is changed to permit mismatches
+    in the application and libpng error buffer size; however, this means a
+    silent change to the API to return the jmp_buf if the size doesn't match
+    the size from the libpng compilation; libpng now allocates the memory and
+    this may fail.  Overall these changes result in slight code size
+    reductions; however, this is a reduction in code that is always executed
+    so is particularly valuable.  Overall on a 64-bit system the libpng DLL
+    decreases in code size by 1733 bytes.  pngerror.o increases in size by
+    about 465 bytes because of the new functionality.
+  Added png_convert_to_rfc1123_buffer() and deprecated png_convert_to_rfc1123()
+    to avoid including a spurious buffer in the png_struct.
+
+Version 1.6.0beta04 [December 30, 2011]
+  Regenerated configure scripts with automake-1.11.2
+  Eliminated png_info_destroy(). It is now used only in png.c and only calls
+    one other internal function and memset().
+  Enabled png_get_sCAL_fixed() if floating point APIs are enabled. Previously
+    it was disabled whenever internal fixed point arithmetic was selected,
+    which meant it didn't exist even on systems where FP was available but not
+    preferred.
+  Added pngvalid.c compile time checks for const APIs.
+  Implemented 'restrict' for png_info and png_struct. Because of the way
+    libpng works both png_info and png_struct are always accessed via a
+    single pointer.  This means adding C99 'restrict' to the pointer gives
+    the compiler some opportunity to optimize the code.  This change allows
+    that.
+  Moved AC_MSG_CHECKING([if libraries can be versioned]) later to the proper
+    location in configure.ac (Gilles Espinasse).
+  Changed png_memcpy to C assignment where appropriate. Changed all those
+    uses of png_memcpy that were doing a simple assignment to assignments
+    (all those cases where the thing being copied is a non-array C L-value).
+  Added some error checking to png_set_*() routines.
+  Removed the reference to the non-exported function png_memcpy() from
+    example.c.
+  Fixed the Visual C 64-bit build - it requires jmp_buf to be aligned, but
+    it had become misaligned.
+  Revised contrib/pngminus/pnm2png.c to avoid warnings when png_uint_32
+    and unsigned long are of different sizes.
+
+Version 1.6.0beta05 [January 15, 2012]
+  Updated manual with description of the simplified API (copied from png.h)
+  Fix bug in pngerror.c: some long warnings were being improperly truncated
+    (CVE-2011-3464, bug introduced in libpng-1.5.3beta05).
+
+Version 1.6.0beta06 [January 24, 2012]
+  Added palette support to the simplified APIs. This commit
+    changes some of the macro definitions in png.h, app code
+    may need corresponding changes.
+  Increased the formatted warning buffer to 192 bytes.
+  Added color-map support to simplified API. This is an initial version for
+    review; the documentation has not yet been updated.
+  Fixed Min/GW uninstall to remove libpng.dll.a
+
+Version 1.6.0beta07 [January 28, 2012]
+  Eliminated Intel icc/icl compiler warnings. The Intel (GCC derived)
+    compiler issues slightly different warnings from those issued by the
+    current vesions of GCC. This eliminates those warnings by
+    adding/removing casts and small code rewrites.
+  Updated configure.ac from autoupdate: added --enable-werror option.
+    Also some layout regularization and removal of introduced tab characters
+    (replaced with 3-character indentation).  Obsolete macros identified by
+    autoupdate have been removed; the replacements are all in 2.59 so
+    the pre-req hasn't been changed.  --enable-werror checks for support
+    for -Werror (or the given argument) in the compiler.  This mimics the
+    gcc configure option by allowing -Werror to be turned on safely; without
+    the option the tests written in configure itself fail compilation because
+    they cause compiler warnings.
+  Rewrote autogen.sh to run autoreconf instead of running tools one-by-one.
+  Conditionalize the install rules for MINGW and CYGWIN in CMakeLists.txt and
+    set CMAKE_LIBRARY_OUTPUT_DIRECTORY to "lib" on all platforms (C. Yapp).
+  Freeze libtool files in the 'scripts' directory. This version of autogen.sh
+    attempts to dissuade people from running it when it is not, or should not,
+    be necessary.  In fact, autogen.sh does not work when run in a libpng
+    directory extracted from a tar distribution anymore. You must run it in
+    a GIT clone instead.
+  Added two images to contrib/pngsuite (1-bit and 2-bit transparent grayscale),
+    and renamed three whose names were inconsistent with those in
+    pngsuite/README.txt.
+
+Version 1.6.0beta08 [February 1, 2012]
+  Fixed Image::colormap misalignment in pngstest.c
+  Check libtool/libtoolize version number (2.4.2) in configure.ac
+  Divide test-pngstest.sh into separate pngstest runs for basic and
+    transparent images.
+  Moved automake options to AM_INIT_AUTOMAKE in configure.ac
+  Added color-tests, silent-rules (Not yet implemented in Makefile.am) and
+    version checking to configure.ac
+  Improved pngstest speed by not doing redundant tests and add const to
+    the background parameter of png_image_finish_read. The --background
+    option is now done automagically only when required, so that commandline
+    option no longer exists.
+  Cleaned up pngpriv.h to consistently declare all functions and data.
+    Also eliminated PNG_CONST_DATA, which is apparently not needed but we
+    can't be sure until it is gone.
+  Added symbol prefixing that allows all the libpng external symbols
+    to be prefixed (suggested by Reuben Hawkins).
+  Updated "ftbb*.png" list in the owatcom and vstudio projects.
+  Fixed 'prefix' builds on clean systems. The generation of pngprefix.h
+    should not require itself.
+  Updated INSTALL to explain that autogen.sh must be run in a GIT clone,
+    not in a libpng directory extracted from a tar distribution.
+
+Version 1.6.0beta09 [February 1, 2012]
+  Reverted the prebuilt configure files to libpng-1.6.0beta05 condition.
+
+Version 1.6.0beta10 [February 3, 2012]
+  Added Z_SOLO for zlib-1.2.6+ and correct pngstest tests
+  Updated list of test images in CMakeLists.txt
+  Updated the prebuilt configure files to current condition.
+  Revised INSTALL information about autogen.sh; it works in tar distributions.
+
+Version 1.6.0beta11 [February 16, 2012]
+  Fix character count in pngstest command in projects/owatcom/pngstest.tgt
+  Revised test-pngstest.sh to report PASS/FAIL for each image.
+  Updated documentation about the simplified API.
+  Corrected estimate of error in libpng png_set_rgb_to_gray API.  The API is
+    extremely inaccurate for sRGB conversions because it uses an 8-bit
+    intermediate linear value and it does not use the sRGB transform, so it
+    suffers from the known instability in gamma transforms for values close
+    to 0 (see Poynton).  The net result is that the calculation has a maximum
+    error of 14.99/255; 0.5/255^(1/2.2).  pngstest now uses 15 for the
+    permitted 8-bit error. This may still not be enough because of arithmetic
+    error.
+  Removed some unused arrays (with #ifdef) from png_read_push_finish_row().
+  Fixed a memory overwrite bug in simplified read of RGB PNG with
+    non-linear gamma Also bugs in the error checking in pngread.c and changed
+    quite a lot of the checks in pngstest.c to be correct; either correctly
+    written or not over-optimistic.  The pngstest changes are insufficient to
+    allow all possible RGB transforms to be passed; pngstest cmppixel needs
+    to be rewritten to make it clearer which errors it allows and then changed
+    to permit known inaccuracies.
+  Removed tests for no-longer-used *_EMPTY_PLTE_SUPPORTED from pngstruct.h
+  Fixed fixed/float API export conditionals. 1) If FIXED_POINT or
+    FLOATING_POINT options were switched off, png.h ended up with lone ';'
+    characters.  This is not valid ANSI-C outside a function.  The ';'
+    characters have been moved inside the definition of PNG_FP_EXPORT and
+    PNG_FIXED_EXPORT. 2) If either option was switched off, the declaration
+    of the corresponding functions were completely omitted, even though some
+    of them are still used internally.  The result is still valid, but
+    produces warnings from gcc with some warning options (including -Wall). The
+    fix is to cause png.h to declare the functions with PNG_INTERNAL_FUNCTION
+    when png.h is included from pngpriv.h.
+  Check for invalid palette index while reading paletted PNG.  When one is
+    found, issue a warning and increase png_ptr->num_palette accordingly.
+    Apps are responsible for checking to see if that happened.
+
+Version 1.6.0beta12 [February 18, 2012]
+  Do not increase num_palette on invalid_index.
+  Relocated check for invalid palette index to pngrtran.c, after unpacking
+    the sub-8-bit pixels.
+  Fixed CVE-2011-3026 buffer overrun bug.  This bug was introduced when
+    iCCP chunk support was added at libpng-1.0.6. Deal more correctly with the
+    test on iCCP chunk length. Also removed spurious casts that may hide
+    problems on 16-bit systems.
+
+Version 1.6.0beta13 [February 24, 2012]
+  Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code from
+    pngpread.c and use the sequential png_handle_tEXt, etc., in pngrutil.c;
+    now that png_ptr->buffer is inaccessible to applications, the special
+    handling is no longer useful.
+  Added PNG_SAFE_LIMITS feature to pnglibconf.dfa, pngpriv.h, and new
+    pngusr.dfa to reset the user limits to safe ones if PNG_SAFE_LIMITS is
+    defined.  To enable, use "CPPFLAGS=-DPNG_SAFE_LIMITS_SUPPORTED=1" on the
+    configure command or put #define PNG_SAFE_LIMITS_SUPPORTED in
+    pnglibconf.h.prebuilt and pnglibconf.h.
+
+Version 1.6.0beta14 [February 27, 2012]
+  Added information about the new limits in the manual.
+  Updated Makefile.in
+
+Version 1.6.0beta15 [March 2, 2012]
+  Removed unused "current_text" members of png_struct and the png_free()
+    of png_ptr->current_text from pngread.c
+  Rewrote pngstest.c for substantial speed improvement.
+  Fixed transparent pixel and 16-bit rgb tests in pngstest and removed a
+    spurious check in pngwrite.c
+  Added PNG_IMAGE_FLAG_FAST for the benefit of applications that store
+    intermediate files, or intermediate in-memory data, while processing
+    image data with the simplified API.  The option makes the files larger
+    but faster to write and read.  pngstest now uses this by default; this
+    can be disabled with the --slow option.
+  Improved pngstest fine tuning of error numbers, new test file generator.
+    The generator generates images that test the full range of sample values,
+    allow the error numbers in pngstest to be tuned and checked.  makepng
+    also allows generation of images with extra chunks, although this is
+    still work-in-progress.
+  Added check for invalid palette index while reading.
+  Fixed some bugs in ICC profile writing. The code should now accept
+    all potentially valid ICC profiles and reject obviously invalid ones.
+    It now uses png_error() to do so rather than casually writing a PNG
+    without the necessary color data.
+  Removed whitespace from the end of lines in all source files and scripts.
+
+Version 1.6.0beta16 [March 6, 2012]
+  Relocated palette-index checking function from pngrutil.c to pngtrans.c
+  Added palette-index checking while writing.
+  Changed png_inflate() and calling routines to avoid overflow problems.
+    This is an intermediate check-in that solves the immediate problems and
+    introduces one performance improvement (avoiding a copy via png_ptr->zbuf.)
+    Further changes will be made to make ICC profile handling more secure.
+  Fixed build warnings (MSVC, GCC, GCC v3). Cygwin GCC with default options
+    declares 'index' as a global, causing a warning if it is used as a local
+    variable.  GCC 64-bit warns about assigning a (size_t) (unsigned 64-bit)
+    to an (int) (signed 32-bit).  MSVC, however, warns about using the
+    unary '-' operator on an unsigned value (even though it is well defined
+    by ANSI-C to be ~x+1).  The padding calculation was changed to use a
+    different method.  Removed the tests on png_ptr->pass.
+  Added contrib/libtests/tarith.c to test internal arithmetic functions from
+    png.c. This is a libpng maintainer program used to validate changes to the
+    internal arithmetic functions.
+  Made read 'inflate' handling like write 'deflate' handling. The read
+    code now claims and releases png_ptr->zstream, like the write code.
+    The bug whereby the progressive reader failed to release the zstream
+    is now fixed, all initialization is delayed, and the code checks for
+    changed parameters on deflate rather than always calling
+    deflatedEnd/deflateInit.
+  Validate the zTXt strings in pngvalid.
+  Added code to validate the windowBits value passed to deflateInit2().
+    If the call to deflateInit2() is wrong a png_warning will be issued
+    (in fact this is harmless, but the PNG data produced may be sub-optimal).
+
+Version 1.6.0beta17 [March 10, 2012]
+  Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition. 
+  Reject all iCCP chunks after the first, even if the first one is invalid.
+  Deflate/inflate was reworked to move common zlib calls into single
+    functions [rw]util.c.  A new shared keyword check routine was also added
+    and the 'zbuf' is no longer allocated on progressive read.  It is now
+    possible to call png_inflate() incrementally.  A warning is no longer
+    issued if the language tag or translated keyword in the iTXt chunk
+    has zero length.
+  If benign errors are disabled use maximum window on ancilliary inflate.
+    This works round a bug introduced in 1.5.4 where compressed ancillary
+    chunks could end up with a too-small windowBits value in the deflate
+    header.
+
+Version 1.6.0beta18 [March 16, 2012]
+  Issue a png_benign_error() instead of png_warning() about bad palette index.
+  In pngtest, treat benign errors as errors if "-strict" is present.
+  Fixed an off-by-one error in the palette index checking function.
+  Fixed a compiler warning under Cygwin (Windows-7, 32-bit system)
+  Revised example.c to put text strings in a temporary character array
+    instead of directly assigning string constants to png_textp members.
+    This avoids compiler warnings when -Wwrite-strings is enabled.
+  Added output flushing to aid debugging under Visual Studio. Unfortunately
+    this is necessary because the VS2010 output window otherwise simply loses
+    the error messages on error (they weren't flushed to the window before
+    the process exited, apparently!)
+  Added configuration support for benign errors and changed the read
+    default. Also changed some warnings in the iCCP and sRGB handling
+    from to benign errors. Configuration now makes read benign
+    errors warnings and write benign errors to errors by default (thus
+    changing the behavior on read).  The simplified API always forces
+    read benign errors to warnings (regardless of the system default, unless
+    this is disabled in which case the simplified API can't be built.)
+
+Version 1.6.0beta19 [March 18, 2012]
+  Work around for duplicate row start calls; added warning messages.
+    This turns on PNG_FLAG_DETECT_UNINITIALIZED to detect app code that
+    fails to call one of the 'start' routines (not enabled in libpng-1.5
+    because it is technically an API change, since it did normally work
+    before.)  It also makes duplicate calls to png_read_start_row (an
+    internal function called at the start of the image read) benign, as
+    they were before changes to use png_inflate_claim. Somehow webkit is
+    causing this to happen; this is probably a mis-feature in the zlib
+    changes so this commit is only a work-round.
+  Removed erroneous setting of DETECT_UNINITIALIZED and added more
+    checks. The code now does a png_error if an attempt is made to do the
+    row initialization twice; this is an application error and it has
+    serious consequences because the transform data in png_struct is
+    changed by each call.
+  Added application error reporting and added chunk names to read
+    benign errors; also added --strict to pngstest - not enabled
+    yet because a warning is produced.
+  Avoid the double gamma correction warning in the simplified API.
+    This allows the --strict option to pass in the pngstest checks
+
+Version 1.6.0beta20 [March 29, 2012]
+  Changed chunk handler warnings into benign errors, incrementally load iCCP
+  Added checksum-icc.c to contrib/tools
+  Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.
+  Recognize known sRGB ICC profiles while reading; prefer writing the
+    iCCP profile over writing the sRGB chunk, controlled by the
+    PNG_sRGB_PROFILE_CHECKS option.
+  Revised png_set_text_2() to avoid potential memory corruption (fixes
+    CVE-2011-3048, also known as CVE-2012-3425).
+
+Version 1.6.0beta21 [April 27, 2012]
+  Revised scripts/makefile.darwin: use system zlib; remove quotes around
+    architecture list; add missing ppc architecture; add architecture options
+    to shared library link; don't try to create a shared lib based on missing
+    RELEASE variable.
+  Enable png_set_check_for_invalid_index() for both read and write.
+  Removed #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED in pngpriv.h around
+    declaration of png_handle_unknown().
+  Added -lssp_nonshared in a comment in scripts/makefile.freebsd
+    and changed deprecated NOOBJ and NOPROFILE to NO_OBJ and NO_PROFILE.
+
+Version 1.6.0beta22 [May 23, 2012]
+  Removed need for -Wno-cast-align with clang.  clang correctly warns on
+    alignment increasing pointer casts when -Wcast-align is passed. This
+    fixes the cases that clang warns about either by eliminating the
+    casts from png_bytep to png_uint_16p (pngread.c), or, for pngrutil.c
+    where the cast is previously verified or pngstest.c where it is OK, by
+    introducing new png_aligncast macros to do the cast in a way that clang
+    accepts.
+
+Version 1.6.0beta23 [June 6, 2012]
+  Revised CMakeLists.txt to not attempt to make a symlink under mingw.
+  Made fixes for new optimization warnings from gcc 4.7.0. The compiler
+    performs an optimization which is safe; however it then warns about it.
+    Changing the type of 'palette_number' in pngvalid.c removes the warning.
+  Do not depend upon a GCC feature macro being available for use in generating
+    the linker mapfile symbol prefix.
+  Improved performance of new do_check_palette_indexes() function (only
+    update the value when it actually increases, move test for whether
+    the check is wanted out of the function.
+
+Version 1.6.0beta24 [June 7, 2012]
+  Don't check palette indexes if num_palette is 0 (as it can be in MNG files).
+
+Version 1.6.0beta25 [June 16, 2012]
+  Revised png_set_keep_unknown_chunks() so num_chunks < 0 means ignore all
+    unknown chunks and all known chunks except for IHDR, PLTE, tRNS, IDAT,
+    and IEND.  Previously it only meant ignore all unknown chunks, the
+    same as num_chunks == 0. Revised png_image_skip_unused_chunks() to
+    provide a list of chunks to be processed instead of a list of chunks to
+    ignore.  Revised contrib/gregbook/readpng2.c accordingly.
+
+Version 1.6.0beta26 [July 10, 2012]
+  Removed scripts/makefile.cegcc from the *.zip and *.7z distributions; it
+    depends on configure, which is not included in those archives.
+  Moved scripts/chkfmt to contrib/tools.
+  Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386.
+
+Version 1.6.0beta27 [August 11, 2012]
+  Do not compile PNG_DEPRECATED, PNG_ALLOC and PNG_PRIVATE when __GNUC__ < 3.
+  Do not use __restrict when GNUC is <= 3.1
+  Removed references to png_zalloc() and png_zfree() from the manual.
+  Fixed configurations where floating point is completely disabled.  Because
+    of the changes to support symbol prefixing PNG_INTERNAL_FUNCTION declares
+    floating point APIs during libpng builds even if they are completely
+    disabled. This requires the png floating point types (png_double*) to be
+    declared even though the functions are never actually defined.  This
+    change provides a dummy definition so that the declarations work, yet any
+    implementation will fail to compile because of an incomplete type.
+  Re-eliminated the use of strcpy() in pngtest.c.  An unncessary use of
+    strcpy() was accidentally re-introduced in libpng16; this change replaces
+    it with strncpy().
+  Eliminated use of png_sizeof(); use sizeof() instead.
+  Use a consistent style for (sizeof type) and (sizeof (array))
+  Cleanup of png_set_filler().  This function does very different things on
+    read and write.  In libpng 1.6 the two cases can be distinguished and
+    considerable code cleanup, and extra error checking, is possible.  This
+    makes calls on the write side that have no effect be ignored with a
+    png_app_error(), which can be disabled in the app using
+    png_set_benign_errors(), and removes the spurious use of usr_channels
+    on the read side.
+  Insist on autotools 1.12.1 for git builds because there are security issues
+    with 1.12 and insisting on anything less would allow 1.12 to be used.
+  Removed info_ptr->signature[8] from WRITE-only builds.
+  Add some conditions for compiling png_fixed().  This is a small function
+    but it requires "-lm" on some platforms.
+  Cause pngtest --strict to fail on any warning from libpng (not just errors)
+    and cause it not to fail at the comparison step if libpng lacks support
+    for writing chunks that it reads from the input (currently only implemented
+    for compressed text chunks).
+  Make all three "make check" test programs work without READ or WRITE support.
+    Now "make check" will succeed even if libpng is compiled with -DPNG_NO_READ
+    or -DPNG_NO_WRITE.  The tests performed are reduced, but the basic reading
+    and writing of a PNG file is always tested by one or more of the tests.
+  Consistently use strlen(), memset(), memcpy(), and memcmp() instead of the
+    png_strlen(), png_memset(), png_memcpy(), and png_memcmp() macros.
+  Removed the png_sizeof(), png_strlen(), png_memset(), png_memcpy(), and
+    png_memcmp() macros.
+  Work around gcc 3.x and Microsoft Visual Studio 2010 complaints. Both object
+    to the split initialization of num_chunks.
+
+Version 1.6.0beta28 [August 29, 2012]
+  Unknown handling fixes and clean up. This adds more correct option
+    control of the unknown handling, corrects the pre-existing bug where
+    the per-chunk 'keep' setting is ignored and makes it possible to skip
+    IDAT chunks in the sequential reader (broken in earlier 1.6 versions).
+    There is a new test program, test-unknown.c, which is a work in progress
+    (not currently part of the test suite).  Comments in the header files now
+    explain how the unknown handling works.
+  Allow fine grain control of unknown chunk APIs. This change allows
+    png_set_keep_unknown_chunks() to be turned off if not required and causes
+    both read and write to behave appropriately (on read this is only possible
+    if the user callback is used to handle unknown chunks).  The change
+    also removes the support for storing unknown chunks in the info_struct
+    if the only unknown handling enabled is via the callback, allowing libpng
+    to be configured with callback reading and none of the unnecessary code.
+  Corrected fix for unknown handling in pngtest. This reinstates the
+    libpng handling of unknown chunks other than vpAg and sTER (including
+    unsafe-to-copy chunks which were dropped before) and eliminates the
+    repositioning of vpAg and sTER in pngtest.png by changing pngtest.png
+    (so the chunks are where libpng would put them).
+  Added "tunknown" test and corrected a logic error in png_handle_unknown()
+    when SAVE support is absent.  Moved the shell test scripts for
+    contrib/libtests from the libpng top directory to contrib/libtests.
+    png_handle_unknown() must always read or skip the chunk, if
+    SAVE_UNKNOWN_CHUNKS is turned off *and* the application does not set
+    a user callback an unknown chunk will not be read, leading to a read
+    error, which was revealed by the "tunknown" test.
+  Cleaned up and corrected ICC profile handling.
+    contrib/libtests/makepng: corrected 'rgb' and 'gray' cases.  profile_error
+    messages could be truncated; made a correct buffer size calculation and
+    adjusted pngerror.c appropriately. png_icc_check_* checking improved;
+    changed the functions to receive the correct color type of the PNG on read
+    or write and check that it matches the color space of the profile (despite
+    what the comments said before, there is danger in assuming the app will
+    cope correctly with an RGB profile on a grayscale image and, since it
+    violates the PNG spec, allowing it is certain to produce inconsistent
+    app behavior and might even cause app crashes.) Check that profiles
+    contain the tags needed to process the PNG (tags all required by the ICC
+    spec). Removed unused PNG_STATIC from pngpriv.h.
+
+Version 1.6.0beta29 [September 4, 2012]
+  Fixed the simplified API example programs to add the *colormap parameter
+    to several of he API and improved the error message if the version field
+    is not set.
+  Added contrib/examples/* to the *.zip and *.7z distributions.
+  Updated simplified API synopses and description of the png_image structure
+    in the manual.
+  Made makepng and pngtest produce identical PNGs, add "--relaxed" option
+    to pngtest. The "--relaxed" option turns off the benign errors that are
+    enabled by default in pre-RC builds. makepng can now write ICC profiles
+    where the length has not been extended to a multiple of 4, and pngtest
+    now intercepts all libpng errors, allowing the previously-introduced
+    "--strict test" on no warnings to actually work.
+  Improved ICC profile handling including cHRM chunk generation and fixed
+    Cygwin+MSVC build errors. The ICC profile handling now includes more
+    checking.  Several errors that caused rejection of the profile are now
+    handled with a warning in such a way that the invalid profiles will be
+    read by default in release (but not pre-RC) builds but will not be
+    written by default.  The easy part of handling the cHRM chunk is written,
+    where the ICC profile contains the required data.  The more difficult
+    part plus guessing a gAMA value requires code to pass selected RGB values
+    through the profile.
+
+Version 1.6.0beta30 [October 24, 2012]
+  Changed ICC profile matrix/vector types to not depend on array type rules.
+    By the ANSI-C standard the new types should be identical to the previous
+    versions, and all known versions of gcc tested with the previous versions
+    except for GCC-4.2.1 work with this version.  The change makes the ANSI-C
+    rule that const applied to an array of elements applies instead to the
+    elements in the array moot by explicitly applying const to the base
+    elements of the png_icc_matrix and png_icc_vector types. The accidental
+    (harmless) 'const' previously applied to the parameters of two of the
+    functions have also been removed.
+  Added a work around for GCC 4.2 optimization bug.
+  Marked the broken (bad white point) original HP sRGB profiles correctly and
+    correct comments.
+  Added -DZ_SOLO to contrib/pngminim/*/makefile to work with zlib-1.2.7
+  Use /MDd for vstudio debug builds. Also added pngunkown to the vstudio
+    builds, fixed build errors and corrected a minor exit code error in
+    pngvalid if the 'touch' file name is invalid.
+  Add updated WARNING file to projects/vstudio from libpng 1.5/vstudio
+  Fixed build when using #define PNG_NO_READ_GAMMA in png_do_compose() in
+    pngrtran.c (Domani Hannes).
+
+Version 1.6.0beta31 [November 1, 2012]
+  Undid the erroneous change to vstudio/pngvalid build in libpng-1.6.0beta30.
+  Made pngvalid so that it will build outside the libpng source tree.
+  Made builds -DPNG_NO_READ_GAMMA compile (the unit tests still fail).
+  Made PNG_NO_READ_GAMMA switch off interfaces that depend on READ_GAMMA.
+    Prior to 1.6.0 switching off READ_GAMMA did unpredictable things to the
+    interfaces that use it (specifically, png_do_background in 1.4 would
+    simply display composite for grayscale images but do composition
+    with the incorrect arithmetic for color ones). In 1.6 the semantic
+    of -DPNG_NO_READ_GAMMA is changed to simply disable any interface that
+    depends on it; this obliges people who set it to consider whether they
+    really want it off if they happen to use any of the interfaces in
+    question (typically most users who disable it won't).
+  Fixed GUIDs in projects/vstudio. Some were duplicated or missing,
+    resulting in VS2010 having to update the files.
+  Removed non-working ICC profile support code that was mostly added to
+    libpng-1.6.0beta29 and beta30. There was too much code for too little
+    gain; implementing full ICC color correction may be desireable but is left
+    up to applications.
+
+Version 1.6.0beta32 [November 25, 2012]
+  Fixed an intermittent SEGV in pngstest due to an uninitialized array element.
+  Added the ability for contrib/libtests/makepng.c to make a PNG with just one
+    color. This is useful for debugging pngstest color inaccuracy reports.
+  Fixed error checking in the simplified write API (Olaf van der Spek)
+  Made png_user_version_check() ok to use with libpng version 1.10.x and later.
+
+Version 1.6.0beta33 [December 15, 2012]
+  Fixed typo in png.c (PNG_SET_CHUNK_MALLOC_MAX should be PNG_CHUNK_MALLOC_MAX)
+    that causes the MALLOC_MAX limit not to work (John Bowler)
+  Change png_warning() to png_app_error() in pngwrite.c and comment the
+    fall-through condition.
+  Change png_warning() to png_app_warning() in png_write_tRNS().
+  Rearranged the ARM-NEON optimizations: Isolated the machine specific code
+    to the hardware subdirectory and added comments to pngrutil.c so that
+    implementors of other optimizations know what to do.
+  Fixed cases of unquoted DESTDIR in Makefile.am
+  Rebuilt Makefile.in, etc., with autoconf-2.69 and automake-1.12.5.
+
+Version 1.6.0beta34 [December 19, 2012]
+  Cleaned up whitespace in the synopsis portion of the manpage "libpng.3"
+  Disassembled the version number in scripts/options.awk (necessary for
+    building on SunOs).
+
+Version 1.6.0beta35 [December 23, 2012]
+  Made default Zlib compression settings be configurable. This adds #defines to
+    pnglibconf.h to control the defaults.
+  Fixed Windows build issues, enabled ARM compilation. Various warnings issued
+    by earlier versions of GCC fixed for Cygwin and Min/GW (which both use old
+    GCCs.) ARM support is enabled by default in zlib.props (unsupported by
+    Microsoft) and ARM compilation is made possible by deleting the check for
+    x86. The test programs cannot be run because they are not signed.
+
+Version 1.6.0beta36 [January 2, 2013]
+  Discontinued distributing libpng-1.x.x.tar.bz2.
+  Discontinued distributing libpng-1.7.0-1.6.0-diff.txt and similar.
+  Rebuilt configure with autoconf-2.69 (inadvertently not done in beta33)
+  Fixed 'make distcheck' on SUN OS - libpng.so was not being removed
+
+Version 1.6.0beta37 [January 10, 2013]
+  Fixed conceivable but difficult to repro overflow. Also added two test
+    programs to generate and test a PNG which should have the problem.
+
+Version 1.6.0beta39 [January 19, 2013]
+  Again corrected attempt at overflow detection in png_set_unknown_chunks()
+  (CVE-2013-7353).  Added overflow detection in png_set_sPLT() and
+  png_set_text_2() (CVE-2013-7354).
+
+Version 1.6.0beta40 [January 20, 2013]
+  Use consistent handling of overflows in text, sPLT and unknown png_set_* APIs
+
+Version 1.6.0rc01 [January 26, 2013]
+  No changes.
+
+Version 1.6.0rc02 [February 4, 2013]
+  Added png_get_palette_max() function.
+
+Version 1.6.0rc03 [February 5, 2013]
+  Fixed the png_get_palette_max API.
+
+Version 1.6.0rc04 [February 7, 2013]
+  Turn serial tests back on (recently turned off by autotools upgrade).
+
+Version 1.6.0rc05 [February 8, 2013]
+  Update manual about png_get_palette_max().
+
+Version 1.6.0rc06 [February 9, 2013]
+  Fixed missing dependency in --prefix builds The intermediate
+    internal 'prefix.h' file can only be generated correctly after
+    pnglibconf.h, however the dependency was not in Makefile.am.  The
+    symptoms are unpredictable depending on the order make chooses to
+    build pngprefix.h and pnglibconf.h, often the error goes unnoticed
+    because there is a system pnglibconf.h to use instead.
+
+Version 1.6.0rc07 [February 10, 2013]
+  Enclosed the new png_get_palette_max in #ifdef PNG_GET_PALETTE_MAX_SUPPORTED
+    block, and revised pnglibconf.h and pnglibconf.h.prebuilt accordingly.
+
+Version 1.6.0rc08 [February 10, 2013]
+  Fix typo in png.h #ifdef
+
+Version 1.6.0 [February 14, 2013]
+  No changes.
+
+Version 1.6.1beta01 [February 16, 2013]
+  Made symbol prefixing work with the ARM neon optimizations. Also allow
+    pngpriv.h to be included for preprocessor definitions only, so it can
+    be used in non-C/C++ files. Back ported from libpng 1.7.
+  Made sRGB check numbers consistent.
+  Ported libpng 1.5 options.awk/dfn file handling to 1.6, fixed one bug.
+  Removed cc -E workround, corrected png_get_palette_max API Tested on
+    SUN OS cc 5.9, which demonstrates the tokenization problem previously
+    avoided by using /lib/cpp.  Since all .dfn output is now protected in
+    double quotes unless it is to be macro substituted the fix should
+    work everywhere.
+  Enabled parallel tests - back ported from libpng-1.7.
+  scripts/pnglibconf.dfa formatting improvements back ported from libpng17.
+  Fixed a race condition in the creation of the build 'scripts' directory
+    while building with a parallel make.
+  Use approved/supported Android method to check for NEON, use Linux/POSIX
+    1003.1 API to check /proc/self/auxv avoiding buffer allocation and other
+    library calls (ported from libpng15).
+
+Version 1.6.1beta02 [February 19, 2013]
+  Use parentheses more consistently in "#if defined(MACRO)" tests.
+  Folded long lines.
+  Reenabled code to allow zero length PLTE chunks for MNG.
+
+Version 1.6.1beta03 [February 22, 2013]
+  Fixed ALIGNED_MEMORY support.
+  Allow run-time ARM NEON checking to be disabled. A new configure option:
+    --enable-arm-neon=always will stop the run-time checks. New checks
+    within arm/arm_init.c will cause the code not to be compiled unless
+    __ARM_NEON__ is set. This should make it fail safe (if someone asks
+    for it on then the build will fail if it can't be done.)
+  Updated the INSTALL document.
+
+Version 1.6.1beta04 [February 27, 2013]
+  Revised INSTALL to recommend using CPPFLAGS instead of INCLUDES.
+  Revised scripts/makefile.freebsd to respect ZLIBLIB and ZLIBINC.
+  Revised scripts/dfn.awk to work with the buggy MSYS awk that has trouble
+    with CRLF line endings.
+
+Version 1.6.1beta05 [March 1, 2013]
+  Avoid a possible memory leak in contrib/gregbook/readpng.c
+
+Version 1.6.1beta06 [March 4, 2013]
+  Better documentation of unknown handling API interactions.
+  Corrected Android builds and corrected libpng.vers with symbol
+    prefixing. This adds an API to set optimization options externally,
+    providing an alternative and general solution for the non-portable
+    run-time tests used by the ARM Neon code.  It also makes those tests
+    compile and link on Android.
+  The order of settings vs options in pnglibconf.h is reversed to allow
+    settings to depend on options and options can now set (or override) the
+    defaults for settings.
+
+Version 1.6.1beta07 [March 7, 2013]
+  Corrected simplified API default gamma for color-mapped output, added
+    a flag to change default. In 1.6.0 when the simplified API was used
+    to produce color-mapped output from an input image with no gamma
+    information the gamma assumed for the input could be different from
+    that assumed for non-color-mapped output.  In particular 16-bit depth
+    input files were assumed to be sRGB encoded, whereas in the 'direct'
+    case they were assumed to have linear data.  This was an error.  The
+    fix makes the simplified API treat all input files the same way and
+    adds a new flag to the png_image::flags member to allow the
+    application/user to specify that 16-bit files contain sRGB data
+    rather than the default linear.
+  Fixed bugs in the pngpixel and makepng test programs.
+
+Version 1.6.1beta08 [March 7, 2013]
+  Fixed CMakelists.txt to allow building a single variant of the library
+    (Claudio Bley):
+  Introduced a PNG_LIB_TARGETS variable that lists all activated library
+    targets.  It is an error if this variable ends up empty, ie. you have
+    to build at least one library variant.
+  Made the *_COPY targets only depend on library targets actually being build.
+  Use PNG_LIB_TARGETS to unify a code path.
+  Changed the CREATE_SYMLINK macro to expect the full path to a file as the
+    first argument. When symlinking the filename component of that path is
+    determined and used as the link target.
+  Use copy_if_different in the CREATE_SYMLINK macro.
+
+Version 1.6.1beta09 [March 13, 2013]
+  Eliminated two warnings from the Intel C compiler. The warnings are
+    technically valid, although a reasonable treatment of division would
+    show it to be incorrect.
+
+Version 1.6.1rc01 [March 21, 2013]
+  No changes.
+
+Version 1.6.1 [March 28, 2013]
+  No changes.
+
+Version 1.6.2beta01 [April 14, 2013]
+  Updated documentation of 1.5.x to 1.6.x changes in iCCP chunk handling.
+  Fixed incorrect warning of excess deflate data. End condition - the
+    warning would be produced if the end of the deflate stream wasn't read
+    in the last row.  The warning is harmless.
+  Corrected the test on user transform changes on read. It was in the
+    png_set of the transform function, but that doesn't matter unless the
+    transform function changes the rowbuf size, and that is only valid if
+    transform_info is called.
+  Corrected a misplaced closing bracket in contrib/libtests/pngvalid.c
+    (Flavio Medeiros).
+  Corrected length written to uncompressed iTXt chunks (Samuli Suominen).
+    Bug was introduced in libpng-1.6.0.
+
+Version 1.6.2rc01 [April 18, 2013]
+  Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length
+    written by libpng-1.6.0 and 1.6.1.
+  Disallow storing sRGB information when the sRGB is not supported.
+
+Version 1.6.2rc02 [April 18, 2013]
+  Merge pngtest.c with libpng-1.7.0
+
+Version 1.6.2rc03 [April 22, 2013]
+  Trivial spelling cleanup.
+
+Version 1.6.2rc04 and 1.6.2rc05 [omitted]
+
+Version 1.6.2rc06 [April 24, 2013]
+  Reverted to version 1.6.2rc03.  Recent changes to arm/neon support
+    have been ported to libpng-1.7.0beta09 and will reappear in version
+    1.6.3beta01.
+
+Version 1.6.2 [April 25, 2013]
+  No changes.
+
+Version 1.6.3beta01 [April 25, 2013]
+  Revised stack marking in arm/filter_neon.S and configure.ac.
+  Ensure that NEON filter stuff is completely disabled when switched 'off'.
+    Previously the ARM NEON specific files were still built if the option
+    was switched 'off' as opposed to being explicitly disabled.
+
+Version 1.6.3beta02 [April 26, 2013]
+  Test for 'arm*' not just 'arm' in the host_cpu configure variable.
+  Rebuilt the configure scripts.
+
+Version 1.6.3beta03 [April 30, 2013]
+  Expanded manual paragraph about writing private chunks, particularly
+    the need to call png_set_keep_unknown_chunks() when writing them.
+  Avoid dereferencing NULL pointer possibly returned from
+     png_create_write_struct() (Andrew Church).
+
+Version 1.6.3beta05 [May 9, 2013]
+  Calculate our own zlib windowBits when decoding rather than trusting the
+    CMF bytes in the PNG datastream.
+  Added an option to force maximum window size for inflating, which was
+    the behavior of libpng15 and earlier.
+  Added png-fix-itxt and png-fix-too-far-back to the built programs and
+    removed warnings from the source code and timepng that are revealed as
+    a result.
+  Detect wrong libpng versions linked to png-fix-too-far-back, which currently
+    only works with libpng versions that can be made to reliably fail when
+    the deflate data contains an out-of-window reference.  This means only
+    1.6 and later.
+  Fixed gnu issues: g++ needs a static_cast, gcc 4.4.7 has a broken warning
+    message which it is easier to work round than ignore.
+  Updated contrib/pngminus/pnm2png.c (Paul Stewart):
+    Check for EOF
+    Ignore "#" delimited comments in input file to pnm2png.c.
+    Fixed whitespace handling
+    Added a call to png_set_packing()
+    Initialize dimension values so if sscanf fails at least we have known
+      invalid values.
+  Attempt to detect configuration issues with png-fix-too-far-back, which
+    requires both the correct libpng and the correct zlib to function
+    correctly.
+  Check ZLIB_VERNUM for mismatches, enclose #error in quotes
+  Added information in the documentation about problems with and fixes for
+    the bad CRC and bad iTXt chunk situations.
+
+Version 1.6.3beta06 [May 12, 2013]
+  Allow contrib/pngminus/pnm2png.c to compile without WRITE_INVERT and
+    WRITE_PACK supported (writes error message that it can't read P1 or
+    P4 PBM files).
+  Improved png-fix-too-far-back usage message, added --suffix option.
+  Revised contrib/pngminim/*/makefile to generate pnglibconf.h with the
+    right zlib header files.
+  Separated CPPFLAGS and CFLAGS in contrib/pngminim/*/makefile
+
+Version 1.6.3beta07 [June 8, 2013]
+  Removed a redundant test in png_set_IHDR().
+  Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt (Andrew Hundt)
+  Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt
+  Enclose the prototypes for the simplified write API in
+    #ifdef PNG_STDIO_SUPPORTED/#endif
+  Make ARM NEON support work at compile time (not just configure time).
+    This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when
+    using a compiler that compiles for multiple architectures at one time.
+  Removed PNG_FILTER_OPTIMIZATIONS and PNG_ARM_NEON_SUPPORTED from
+    pnglibconf.h, allowing more of the decisions to be made internally
+    (pngpriv.h) during the compile.  Without this, symbol prefixing is broken
+    under certain circumstances on ARM platforms.  Now only the API parts of
+    the optimizations ('check' vs 'api') are exposed in the public header files
+    except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
+    decision about whether or not to use the optimizations.
+  Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
+    Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
+    on __ARM_NEON__ from configure time to compile time.  This breaks symbol
+    prefixing because the definition of the special png_init_filter_functions
+    call was hidden at configure time if the relevant compiler arguments are
+    passed in CFLAGS as opposed to CC.  This change attempts to avoid all
+    the confusion that would result by declaring the init function even when
+    it is not used, so that it will always get prefixed.
+
+Version 1.6.3beta08 [June 18, 2013]
+  Revised libpng.3 so that "doclifter" can process it.
+
+Version 1.6.3beta09 [June 27, 2013]
+  Revised example.c to illustrate use of PNG_DEFAULT_sRGB and PNG_GAMMA_MAC_18
+    as parameters for png_set_gamma().  These have been available since
+    libpng-1.5.4.
+  Renamed contrib/tools/png-fix-too-far-back.c to pngfix.c and revised it
+    to check all compressed chunks known to libpng.
+
+Version 1.6.3beta10 [July 5, 2013]
+  Updated documentation to show default behavior of benign errors correctly.
+  Only compile ARM code when PNG_READ_SUPPORTED is defined.
+  Fixed undefined behavior in contrib/tools/pngfix.c and added new strip
+    option. pngfix relied on undefined behavior and even a simple change from
+    gcc to g++ caused it to fail.  The new strip option 'unsafe' has been
+    implemented and is the default if --max is given.  Option names have
+    been clarified, with --strip=transform now stripping the bKGD chunk,
+    which was stripped previously with --strip=unused.
+  Added all documented chunk types to pngpriv.h
+  Unified pngfix.c source with libpng17.
+
+Version 1.6.3rc01 [July 11, 2013]
+  No changes.
+
+Version 1.6.3 [July 18, 2013]
+  Revised manual about changes in iTXt chunk handling made in libpng-1.6.0.
+  Added "/* SAFE */" comments in pngrutil.c and pngrtran.c where warnings
+    may be erroneously issued by code-checking applications.
+
+Version 1.6.4beta01 [August 21, 2013]
+  Added information about png_set_options() to the manual.
+  Delay calling png_init_filter_functions() until a row with nonzero filter
+    is found.
+
+Version 1.6.4beta02 [August 30, 2013]
+  Fixed inconsistent conditional compilation of png_chunk_unknown_handling()
+    prototype, definition, and usage.  Made it depend on
+    PNG_HANDLE_AS_UNKNOWN_SUPPORTED everywhere.
+
+Version 1.6.4rc01 [September 5, 2013]
+  No changes.
+
+Version 1.6.4 [September 12, 2013]
+  No changes.
+
+Version 1.6.5 [September 14, 2013]
+  Removed two stray lines of code from arm/arm_init.c.
+
+Version 1.6.6 [September 16, 2013]
+  Removed two stray lines of code from arm/arm_init.c, again.
+
+Version 1.6.7beta01 [September 30, 2013]
+  Revised unknown chunk code to correct several bugs in the NO_SAVE_/NO_WRITE
+    combination
+  Allow HANDLE_AS_UNKNOWN to work when other options are configured off. Also
+    fixed the pngminim makefiles to work when $(MAKEFLAGS) contains stuff
+    which terminates the make options (as by default in recent versions of
+    Gentoo).
+  Avoid up-cast warnings in pngvalid.c. On ARM the alignment requirements of
+    png_modifier are greater than that of png_store and as a consequence
+    compilation of pngvalid.c results in a warning about increased alignment
+    requirements because of the bare cast to (png_modifier*). The code is safe,
+    because the pointer is known to point to a stack allocated png_modifier,
+    but this change avoids the warning.
+  Fixed default behavior of ARM_NEON_API. If the ARM NEON API option was
+    compiled without the CHECK option it defaulted to on, not off.
+  Check user callback behavior in pngunknown.c. Previous versions compiled
+    if SAVE_UNKNOWN was not available but did nothing since the callback
+    was never implemented.
+  Merged pngunknown.c with 1.7 version and back ported 1.7 improvements/fixes
+
+Version 1.6.7beta02 [October 12, 2013]
+  Made changes for compatibility with automake 1.14:
+    1) Added the 'compile' program to the list of programs that must be cleaned
+       in autogen.sh
+    2) Added 'subdir-objects' which causes .c files in sub-directories to be
+       compiled such that the corresponding .o files are also in the
+       sub-directory.  This is because automake 1.14 warns that the
+       current behavior of compiling to the top level directory may be removed
+       in the future.
+    3) Updated dependencies on pnglibconf.h to match the new .o locations and
+       added all the files in contrib/libtests and contrib/tools that depend
+       on pnglibconf.h
+    4) Added 'BUILD_SOURCES = pnglibconf.h'; this is the automake recommended
+       way of handling the dependencies of sources that are machine generated;
+       unfortunately it only works if the user does 'make all' or 'make check',
+       so the dependencies (3) are still required.
+  Cleaned up (char*) casts of zlib messages. The latest version of the Intel C
+    compiler complains about casting a string literal as (char*), so copied the
+    treatment of z_const from the library code into pngfix.c
+  Simplified error message code in pngunknown. The simplification has the
+    useful side effect of avoiding a bogus warning generated by the latest
+    version of the Intel C compiler (it objects to
+    condition ? string-literal : string-literal).
+  Make autogen.sh work with automake 1.13 as well as 1.14. Do this by always
+    removing the 1.14 'compile' script but never checking for it.
+
+Version 1.6.7beta03 [October 19, 2013]
+  Added ARMv8 support (James Yu <james.yu at linaro.org>).  Added file
+    arm/filter_neon_intrinsics.c; enable with -mfpu=neon.
+  Revised pngvalid to generate size images with as many filters as it can
+    manage, limited by the number of rows.
+  Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h
+    and detect the broken GCC compilers.
+
+Version 1.6.7beta04 [October 26, 2013]
+  Allow clang derived from older GCC versions to use ARM intrinsics. This
+    causes all clang builds that use -mfpu=neon to use the intrinsics code,
+    not the assembler code.  This has only been tested on iOS 7. It may be
+    necessary to exclude some earlier clang versions but this seems unlikely.
+  Changed NEON implementation selection mechanism. This allows assembler
+    or intrinsics to be turned on at compile time during the build by defining
+    PNG_ARM_NEON_IMPLEMENTATION to the correct value (2 or 1).  This macro
+    is undefined by default and the build type is selected in pngpriv.h.
+
+Version 1.6.7rc01 [November 2, 2013]
+  No changes.
+
+Version 1.6.7rc02 [November 7, 2013]
+  Fixed #include in filter_neon_intrinsics.c and ctype macros. The ctype char
+    checking macros take an unsigned char argument, not a signed char.
+
+Version 1.6.7 [November 14, 2013]
+  No changes.
+
+Version 1.6.8beta01 [November 24, 2013]
+  Moved prototype for png_handle_unknown() in pngpriv.h outside of
+    the #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED/#endif block.
+  Added "-Wall" to CFLAGS in contrib/pngminim/*/makefile
+  Conditionally compile some unused functions reported by -Wall in
+    pngminim.
+  Fixed 'minimal' builds. Various obviously useful minimal configurations
+    don't build because of missing contrib/libtests test programs and
+    overly complex dependencies in scripts/pnglibconf.dfa. This change
+    adds contrib/conftest/*.dfa files that can be used in automatic build
+    scripts to ensure that these configurations continue to build.
+  Enabled WRITE_INVERT and WRITE_PACK in contrib/pngminim/encoder.
+  Fixed pngvalid 'fail' function declaration on the Intel C Compiler.
+    This reverts to the previous 'static' implementation and works round
+    the 'unused static function' warning by using PNG_UNUSED().
+
+Version 1.6.8beta02 [November 30, 2013]
+  Removed or marked PNG_UNUSED some harmless "dead assignments" reported
+    by clang scan-build.
+  Changed tabs to 3 spaces in png_debug macros and changed '"%s"m'
+    to '"%s" m' to improve portability among compilers.
+  Changed png_free_default() to free() in pngtest.c
+
+Version 1.6.8rc01 [December 12, 2013]
+  Tidied up pngfix inits and fixed pngtest no-write builds.
+
+Version 1.6.8rc02 [December 14, 2013]
+  Handle zero-length PLTE chunk or NULL palette with png_error()
+    instead of png_chunk_report(), which by default issues a warning
+    rather than an error, leading to later reading from a NULL pointer
+    (png_ptr->palette) in png_do_expand_palette(). This is CVE-2013-6954
+    and VU#650142.  Libpng-1.6.1 through 1.6.7 are vulnerable.
+    Libpng-1.6.0 and earlier do not have this bug.
+
+Version 1.6.8 [December 19, 2013]
+  No changes.
+
+Version 1.6.9beta01 [December 26, 2013]
+  Bookkeeping: Moved functions around (no changes). Moved transform
+    function definitions before the place where they are called so that
+    they can be made static. Move the intrapixel functions and the
+    grayscale palette builder out of the png?tran.c files. The latter
+    isn't a transform function and is no longer used internally, and the
+    former MNG specific functions are better placed in pngread/pngwrite.c
+  Made transform implementation functions static. This makes the internal
+    functions called by png_do_{read|write}_transformations static. On an
+    x86-64 DLL build (Gentoo Linux) this reduces the size of the text
+    segment of the DLL by 1208 bytes, about 0.6%. It also simplifies
+    maintenance by removing the declarations from pngpriv.h and allowing
+    easier changes to the internal interfaces.
+  Rebuilt configure scripts with automake-1.14.1 and autoconf-2.69
+    in the tar distributions.
+
+Version 1.6.9beta02 [January 1, 2014]
+  Added checks for libpng 1.5 to pngvalid.c.  This supports the use of
+    this version of pngvalid in libpng 1.5
+  Merged with pngvalid.c from libpng-1.7 changes to create a single
+    pngvalid.c
+  Removed #error macro from contrib/tools/pngfix.c (Thomas Klausner).
+  Merged pngrio.c, pngtrans.c, pngwio.c, and pngerror.c with libpng-1.7.0
+  Merged libpng-1.7.0 changes to make no-interlace configurations work
+    with test programs.
+  Revised pngvalid.c to support libpng 1.5, which does not support the
+    PNG_MAXIMUM_INFLATE_WINDOW option, so #define it out when appropriate in
+    pngvalid.c
+  Allow unversioned links created on install to be disabled in configure.
+    In configure builds 'make install' changes/adds links like png.h
+    and libpng.a to point to the newly installed, versioned, files (e.g.
+    libpng17/png.h and libpng17.a). Three new configure options and some
+    rearrangement of Makefile.am allow creation of these links to be disabled.
+
+Version 1.6.9beta03 [January 10, 2014]
+  Removed potentially misleading warning from png_check_IHDR().
+
+Version 1.6.9beta04 [January 20, 2014]
+  Updated scripts/makefile.* to use CPPFLAGS (Cosmin).
+  Added clang attribute support (Cosmin).
+
+Version 1.6.9rc01 [January 28, 2014]
+  No changes.
+
+Version 1.6.9rc02 [January 30, 2014]
+  Quiet an uninitialized memory warning from VC2013 in png_get_png().
+
+Version 1.6.9 [February 6, 2014]
+
+Version 1.6.10beta01 [February 9, 2014]
+  Backported changes from libpng-1.7.0beta30 and beta31:
+  Fixed a large number of instances where PNGCBAPI was omitted from
+    function definitions.
+  Added pngimage test program for png_read_png() and png_write_png()
+    with two new test scripts.
+  Removed dependence on !PNG_READ_EXPAND_SUPPORTED for calling
+    png_set_packing() in png_read_png().
+  Fixed combination of ~alpha with shift. On read invert alpha, processing
+    occurred after shift processing, which causes the final values to be
+    outside the range that should be produced by the shift. Reversing the
+    order on read makes the two transforms work together correctly and mirrors
+    the order used on write.
+  Do not read invalid sBIT chunks. Previously libpng only checked sBIT
+    values on write, so a malicious PNG writer could therefore cause
+    the read code to return an invalid sBIT chunk, which might lead to
+    application errors or crashes.  Such chunks are now skipped (with
+    chunk_benign_error).
+  Make png_read_png() and png_write_png() prototypes in png.h depend
+    upon PNG_READ_SUPPORTED and PNG_WRITE_SUPPORTED.
+  Support builds with unsupported PNG_TRANSFORM_* values.  All of the
+    PNG_TRANSFORM_* values are always defined in png.h and, because they
+    are used for both read and write in some cases, it is not reliable
+    to #if out ones that are totally unsupported. This change adds error
+    detection in png_read_image() and png_write_image() to do a
+    png_app_error() if the app requests something that cannot be done
+    and it adds corresponding code to pngimage.c to handle such options
+    by not attempting to test them.
+
+Version 1.6.10beta02 [February 23, 2014]
+  Moved redefines of png_error(), png_warning(), png_chunk_error(),
+    and png_chunk_warning() from pngpriv.h to png.h to make them visible
+    to libpng-calling applications.
+  Moved OS dependent code from arm/arm_init.c, to allow the included
+    implementation of the ARM NEON discovery function to be set at
+    build-time and provide sample implementations from the current code in the
+    contrib/arm-neon subdirectory. The __linux__ code has also been changed to
+    compile and link on Android by using /proc/cpuinfo, and the old linux code
+    is in contrib/arm-neon/linux-auxv.c.  The new code avoids POSIX and Linux
+    dependencies apart from opening /proc/cpuinfo and is C90 compliant.
+  Check for info_ptr == NULL early in png_read_end() so we don't need to
+    run all the png_handle_*() and depend on them to return if info_ptr == NULL.
+    This improves the performance of png_read_end(png_ptr, NULL) and makes
+    it more robust against future programming errors.
+  Check for __has_extension before using it in pngconf.h, to
+    support older Clang versions (Jeremy Sequoia).
+  Treat CRC error handling with png_set_crc_action(), instead of with
+    png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
+  Use a user warning handler in contrib/gregbook/readpng2.c instead of default,
+    so warnings will be put on stderr even if libpng has CONSOLE_IO disabled.
+  Added png_ptr->process_mode = PNG_READ_IDAT_MODE in png_push_read_chunk
+    after recognizing the IDAT chunk, which avoids an infinite loop while
+    reading a datastream whose first IDAT chunk is of zero-length.
+    This fixes CERT VU#684412 and CVE-2014-0333.
+  Don't recognize known sRGB profiles as sRGB if they have been hacked,
+    but don't reject them and don't issue a copyright violation warning.
+
+Version 1.6.10beta03 [February 25, 2014]
+  Moved some documentation from png.h to libpng.3 and libpng-manual.txt
+  Minor editing of contrib/arm-neon/README and contrib/examples/*.c
+
+Version 1.6.10rc01 [February 27, 2014]
+  Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
+    and PNG_USR_CONFIG -> PNG_USER_CONFIG).
+
+Version 1.6.10rc02 [February 28, 2014]
+  Removed unreachable return statement after png_chunk_error()
+    in pngrutil.c
+
+Version 1.6.10rc03 [March 4, 2014]
+  Un-deprecated png_data_freer().
+
+Version 1.6.10 [March 6, 2014]
+  No changes.
+
+Version 1.6.11beta01 [March 17, 2014]
+  Use "if (value != 0)" instead of "if (value)" consistently.
+  Changed ZlibSrcDir from 1.2.5 to 1.2.8 in projects/vstudio.
+  Moved configuration information from the manual to the INSTALL file.
+
+Version 1.6.11beta02 [April 6, 2014]
+  Removed #if/#else/#endif from inside two pow() calls in pngvalid.c because
+    they were handled improperly by Portland Group's PGI-14.1 - PGI-14.3
+    when using its "__builtin_pow()" function.
+  Silence 'unused parameter' build warnings (Cosmin Truta).
+  $(CP) is now used alongside $(RM_F).  Also, use 'copy' instead of 'cp'
+    where applicable, and applied other minor makefile changes (Cosmin).
+  Don't warn about invalid dimensions exceeding user limits (Cosmin).
+  Allow an easy replacement of the default pre-built configuration
+    header with a custom header, via the make PNGLIBCONF_H_PREBUILT
+    macro (Cosmin).
+
+Version 1.6.11beta03 [April 6, 2014]
+  Fixed a typo in pngrutil.c, introduced in libpng-1.5.6, that interferes
+    with "blocky" expansion of sub-8-bit interlaced PNG files (Eric Huss).
+  Optionally use  __builtin_bswap16() in png_do_swap().
+
+Version 1.6.11beta04 [April 19, 2014]
+  Made progressive reading of interlaced images consistent with the
+    behavior of the sequential reader and consistent with the manual, by
+    moving some code out of the PNG_READ_INTERLACING_SUPPORTED blocks. The
+    row_callback now receives the proper pass number and unexpanded rows, when
+    png_combine_row() isn't built or used, and png_set_interlace_handling()
+    is not called.
+  Allow PNG_sRGB_PROFILE_CHECKING = (-1) to mean no sRGB profile checking.
+
+Version 1.6.11beta05 [April 26, 2014]
+  Do not reject ICC V2 profiles that lack padding (Kai-Uwe Behrmann).
+  Relocated closing bracket of the sRGB profile test loop to avoid getting
+    "Not recognizing known sRGB profile that has been edited" warning for
+    ICC V2 profiles that lack the MD5 signature in the profile header.
+
+Version 1.6.11beta06 [May 19, 2014]
+  Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option().
+
+Version 1.6.11rc01 [May 27, 2014]
+  No changes.
+
+Version 1.6.11rc02 [June 3, 2014]
+  Test ZLIB_VERNUM instead of PNG_ZLIB_VERNUM in contrib/tools/pngfix.c
+
+Version 1.6.11 [June 5, 2014]
+  No changes.
+
+Version 1.6.12rc01 [June 6, 2014]
+  Relocated new code from 1.6.11beta06 in png.c to a point after the
+    declarations (Max Stepin).
+
+Version 1.6.12rc02 [June 7, 2014]
+  Changed file permissions of contrib/tools/intgamma.sh,
+    test-driver, and compile from 0644 to 0755 (Cosmin).
+
+Version 1.6.12rc03 [June 8, 2014]
+  Ensure "__has_attribute()" macro exists before trying to use it with
+    old clang compilers (MacPorts Ticket #43939).
+
+Version 1.6.12 [June 12, 2014]
+  No changes.
+
+Version 1.6.13beta01 [July 4, 2014]
+  Quieted -Wsign-compare and -Wclobber compiler warnings in
+    contrib/pngminus/*.c
+  Added "(void) png_ptr;" where needed in contrib/gregbook to quiet
+    compiler complaints about unused pointers.
+  Split a long output string in contrib/gregbook/rpng2-x.c.
+  Added "PNG_SET_OPTION" requirement for sRGB chunk support to pnglibconf.dfa,
+    Needed for write-only support (John Bowler).
+  Changed "if defined(__ARM_NEON__)" to
+    "if (defined(__ARM_NEON__) || defined(__ARM_NEON))" (James Wu).
+  Fixed clang no-warning builds: png_digit was defined but never used.
+    
+Version 1.6.13beta02 [July 21, 2014]
+  Fixed an incorrect separator ("/" should be "\") in scripts/makefile.vcwin32
+    (bug report from Wolfgang S. Kechel).  Bug was introduced in libpng-1.6.11.
+    Also fixed makefile.bc32, makefile.bor, makefile.msc, makefile.intel, and
+    makefile.tc3 similarly.
+
+Version 1.6.13beta03 [August 3, 2014]
+  Removed scripts/makefile.elf. It has not worked since libpng-1.5.0beta14
+    due to elimination of the PNG_FUNCTION_EXPORT and PNG_DATA_EXPORT
+    definitions from pngconf.h.
+  Ensure that CMakeLists.txt makes the target "lib" directory before making
+    symbolic link into it (SourceForge bug report #226 by Rolf Timmermans).
+
+Version 1.6.13beta04 [August 8, 2014]
+  Added opinion that the ECCN (Export Control Classification Number) for
+    libpng is EAR99 to the README file.
+  Eliminated use of "$<" in makefile explicit rules, when copying
+    $PNGLIBCONF_H_PREBUILT.  This does not work on some versions of make;
+    bug introduced in libpng version 1.6.11.
+
+Version 1.6.13rc01 [August 14, 2014]
+  Made "ccopts" agree with "CFLAGS" in scripts/makefile.hp* and makefile.*sunu
+
+Version 1.6.13 [August 21, 2014]
+  No changes.
+
+Version 1.6.14beta01 [September 14, 2014]
+  Guard usage of png_ptr->options with #ifdef PNG_SET_OPTION_SUPPORTED.
+  Do not build contrib/tools/pngfix.c when PNG_SETJMP_NOT_SUPPORTED,
+    to allow "make" to complete without setjmp support (bug report by
+    Claudio Fontana)
+  Add "#include <setjmp.h>" to contrib/tools/pngfix.c (John Bowler)
+
+Version 1.6.14beta02 [September 18, 2014]
+  Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
+    because usleep() is deprecated.
+  Define usleep() in contrib/gregbook/rpng2-x.c if not already defined
+    in unistd.h and nanosleep() is not available; fixes error introduced
+    in libpng-1.6.13.
+  Disable floating point exception handling in pngvalid.c when
+    PNG_FLOATING_ARITHMETIC is not supported (bug report by "zootus
+    at users.sourceforge.net").
+
+Version 1.6.14beta03 [September 19, 2014]
+  Define FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in pngvalid.c if not
+    already defined.  Revert floating point exception handling in pngvalid.c
+    to version 1.6.14beta01 behavior.
+
+Version 1.6.14beta04 [September 27, 2014]
+  Fixed incorrect handling of the iTXt compression flag in pngrutil.c
+    (bug report by Shunsaku Hirata).  Bug was introduced in libpng-1.6.0.
+
+Version 1.6.14beta05 [October 1, 2014]
+  Added "option READ_iCCP enables READ_COMPRESSED_TEXT" to pnglibconf.dfa
+
+Version 1.6.14beta06 [October 5, 2014]
+  Removed unused "text_len" parameter from private function png_write_zTXt().
+  Conditionally compile some code in png_deflate_claim(), when
+    PNG_WARNINGS_SUPPORTED and PNG_ERROR_TEXT_SUPPORTED are disabled.
+  Replaced repeated code in pngpread.c with PNG_PUSH_SAVE_BUFFER_IF_FULL.
+  Added "chunk iTXt enables TEXT" and "chunk zTXt enables TEXT"
+    to pnglibconf.dfa.
+  Removed "option READ_COMPRESSED_TEXT enables READ_TEXT" from pnglibconf.dfa,
+    to make it possible to configure a libpng that supports iCCP but not TEXT.
+
+Version 1.6.14beta07 [October 7, 2014]
+  Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa
+  Only mark text chunks as written after successfully writing them.
+
+Version 1.6.14rc01 [October 15, 2014]
+  Fixed some typos in comments.
+
+Version 1.6.14rc02 [October 17, 2014]
+  Changed png_convert_to_rfc_1123() to png_convert_to_rfc_1123_buffer()
+    in the manual, to reflect the change made in libpng-1.6.0.
+  Updated README file to explain that direct access to the png_struct
+    and info_struct members has not been permitted since libpng-1.5.0.
+
+Version 1.6.14 [October 23, 2014]
+  No changes.
+
+Version 1.6.15beta01 [October 29, 2014]
+  Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x != 0)"
+  Simplified png_free_data().
+  Added missing "ptr = NULL" after some instances of png_free().
+
+Version 1.6.15beta02 [November 1, 2014]
+  Changed remaining "if (!x)" to "if (x == 0)" and "if (x)" to "if (x != 0)"
+
+Version 1.6.15beta03 [November 3, 2014]
+  Added PNG_USE_ARM_NEON configuration flag (Marcin Juszkiewicz).
+
+Version 1.6.15beta04 [November 4, 2014]
+  Removed new PNG_USE_ARM_NEON configuration flag and made a one-line
+    revision to configure.ac to support ARM on aarch64 instead (John Bowler).
+
+Version 1.6.15beta05 [November 5, 2014]
+  Use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING in
+    example.c, pngtest.c, and applications in the contrib directory.
+  Avoid out-of-bounds memory access in png_user_version_check().
+  Simplified and future-proofed png_user_version_check().
+  Fixed GCC unsigned int->float warnings. Various versions of GCC
+    seem to generate warnings when an unsigned value is implicitly
+    converted to double. This is probably a GCC bug but this change
+    avoids the issue by explicitly converting to (int) where safe.
+  Free all allocated memory in pngimage. The file buffer cache was left
+    allocated at the end of the program, harmless but it causes memory
+    leak reports from clang.
+  Fixed array size calculations to avoid warnings. At various points
+    in the code the number of elements in an array is calculated using
+    sizeof.  This generates a compile time constant of type (size_t) which
+    is then typically assigned to an (unsigned int) or (int). Some versions
+    of GCC on 64-bit systems warn about the apparent narrowing, even though
+    the same compiler does apparently generate the correct, in-range,
+    numeric constant.  This adds appropriate, safe, casts to make the
+    warnings go away.
+
+Version 1.6.15beta06 [November 6, 2014]
+  Reverted use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING
+    in the manual, example.c, pngtest.c, and applications in the contrib
+    directory.  It was incorrect advice.
+
+Version 1.6.15beta07 [November 7, 2014]
+  Removed #ifdef PNG_16BIT_SUPPORTED/#endif around png_product2(); it is
+    needed by png_reciprocal2().
+  Added #ifdef PNG_16BIT_SUPPORTED/#endif around png_log16bit() and
+    png_do_swap().
+  Changed all "#endif /* PNG_FEATURE_SUPPORTED */" to "#endif /* FEATURE */"
+
+Version 1.6.15beta08 [November 8, 2014]
+  More housecleaning in *.h
+
+Version 1.6.15rc01 [November 13, 2014]
+
+Version 1.6.15rc02 [November 14, 2014]
+  The macros passed in the command line to Borland make were ignored if
+    similarly-named macros were already defined in makefiles. This behavior
+    is different from POSIX make and other make programs.  Surround the
+    macro definitions with ifndef guards (Cosmin).
+
+Version 1.6.15rc03 [November 16, 2014]
+  Added "-D_CRT_SECURE_NO_WARNINGS" to CFLAGS in scripts/makefile.vcwin32.
+  Removed the obsolete $ARCH variable from scripts/makefile.darwin.
+
+Version 1.6.15 [November 20, 2014]
+  No changes.
+
+Version 1.6.16beta01 [December 14, 2014]
+  Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that
+    don't do alignment correctly.
+  Revised Makefile.am and scripts/symbols.dfn to work with MinGW/MSYS
+    (Bob Friesenhahn).
+
+Version 1.6.16beta02 [December 15, 2014]
+  Revised Makefile.am and scripts/*.dfn again to work with MinGW/MSYS;
+    renamed scripts/*.dfn to scripts/*.c (John Bowler).
+
+Version 1.6.16beta03 [December 21, 2014]
+  Quiet a "comparison always true" warning in pngstest.c (John Bowler).
+
+Version 1.6.16rc01 [December 21, 2014]
+  Restored a test on width that was removed from png.c at libpng-1.6.9
+    (Bug report by Alex Eubanks).
+
+Version 1.6.16rc02 [December 21, 2014]
+  Undid the update to pngrutil.c in 1.6.16rc01.
+
+Version 1.6.16rc03 [December 21, 2014]
+  Fixed an overflow in png_combine_row with very wide interlaced images.
+
+Version 1.6.16 [December 22, 2014]
+  No changes.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
@@ -3540,5 +5156,3 @@
 or to glennrp at users.sourceforge.net
 
 Glenn R-P
-*/ }
-#endif
--- a/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE	Fri Apr 17 10:24:46 2015 -0700
@@ -10,8 +10,8 @@
 
 This code is released under the libpng license.
 
-libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are
-Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
+Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.2.5
 with the following individual added to the list of Contributing Authors
 
@@ -108,4 +108,4 @@
 
 Glenn Randers-Pehrson
 glennrp at users.sourceforge.net
-July 7, 2011
+December 22, 2014
--- a/src/java.desktop/share/native/libsplashscreen/libpng/README	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/README	Fri Apr 17 10:24:46 2015 -0700
@@ -1,11 +1,11 @@
-README for libpng version 1.5.4 - July 7, 2011 (shared library 15.0)
+README for libpng version 1.6.16 - December 22, 2014 (shared library 16.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
 
-Libpng comes in several distribution formats.  Get libpng-*.tar.gz,
-libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
-in the text files, or lpng*.zip if you want DOS-style line endings.
+Libpng comes in several distribution formats.  Get libpng-*.tar.gz or
+libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
+or lpng*.7z or lpng*.zip if you want DOS-style line endings.
 
 Version 0.89 was the first official release of libpng.  Don't let the
 fact that it's the first release fool you.  The libpng library has been in
@@ -23,18 +23,25 @@
 png_uint_32, which will affect shared-library applications that use
 this function.
 
-To avoid problems with changes to the internals of png_info_struct,
+To avoid problems with changes to the internals of png info_struct,
 new APIs have been made available in 0.95 to avoid direct application
 access to info_ptr.  These functions are the png_set_<chunk> and
 png_get_<chunk> functions.  These functions should be used when
 accessing/storing the info_struct data, rather than manipulating it
 directly, to avoid such problems in the future.
 
-It is important to note that the APIs do not make current programs
+It is important to note that the APIs did not make current programs
 that access the info struct directly incompatible with the new
-library.  However, it is strongly suggested that new programs use
-the new APIs (as shown in example.c and pngtest.c), and older programs
-be converted to the new format, to facilitate upgrades in the future.
+library, through libpng-1.2.x.  In libpng-1.4.x, which was meant to
+be a transitional release, members of the png_struct and the
+info_struct can still be accessed, but the compiler will issue a
+warning about deprecated usage.  Since libpng-1.5.0, direct access
+to these structs is not allowed, and the definitions of the structs
+reside in private pngstruct.h and pnginfo.h header files that are not
+accessible to applications.  It is strongly suggested that new
+programs use the new APIs (as shown in example.c and pngtest.c), and
+older programs be converted to the new format, to facilitate upgrades
+in the future.
 ****
 
 Additions since 0.90 include the ability to compile libpng as a
@@ -77,17 +84,21 @@
 You can use zlib as a drop-in replacement for fread() and fwrite() if
 you are so inclined.
 
-zlib should be available at the same place that libpng is, or at.
-ftp://ftp.info-zip.org/pub/infozip/zlib
+zlib should be available at the same place that libpng is, or at zlib.net.
 
 You may also want a copy of the PNG specification.  It is available
 as an RFC, a W3C Recommendation, and an ISO/IEC Standard.  You can find
 these at http://www.libpng.org/pub/png/documents/
 
 This code is currently being archived at libpng.sf.net in the
-[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
-at GO GRAPHSUP.  If you can't find it in any of those places,
-e-mail me, and I'll help you find it.
+[DOWNLOAD] area, and at ftp://ftp.simplesystems.org.  If you can't find it
+in any of those places, e-mail me, and I'll help you find it.
+
+I am not a lawyer, but I believe that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because it
+is open source, publicly available software, that does not contain any
+encryption software.  See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
 
 If you have any code changes, requests, problems, etc., please e-mail
 them to me.  Also, I'd appreciate any make files or project files,
@@ -105,7 +116,7 @@
 development group.
 
 Send comments/corrections/commendations to png-mng-implement at
-lists.sourceforge.net (subscription required; visit 
+lists.sourceforge.net (subscription required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
 to subscribe) or to glennrp at users.sourceforge.net
 
@@ -123,7 +134,7 @@
 to others, if necessary.
 
 Please do not send suggestions on how to change PNG.  We have
-been discussing PNG for sixteen years now, and it is official and
+been discussing PNG for nineteen years now, and it is official and
 finished.  If you have suggestions for libpng, however, I'll
 gladly listen.  Even if your suggestion is not used immediately,
 it may be used later.
@@ -167,23 +178,25 @@
       pngwrite.c    =>  High-level write functions
       pngwtran.c    =>  Write data transformations
       pngwutil.c    =>  Write utility functions
+      arm           =>  Contains optimized code for the ARM platform
       contrib       =>  Contributions
+       examples         =>  Example programs
        gregbook         =>  source code for PNG reading and writing, from
                             Greg Roelofs' "PNG: The Definitive Guide",
                             O'Reilly, 1999
-       msvctest     =>  Builds and runs pngtest using a MSVC workspace
-       pngminus     =>  Simple pnm2png and png2pnm programs
-       pngsuite     =>  Test images
-       visupng      =>  Contains a MSVC workspace for VisualPng
+       libtests         =>  Test programs
+       pngminim         =>  Minimal decoder, encoder, and progressive decoder
+                            programs demonstrating use of pngusr.dfa
+       pngminus         =>  Simple pnm2png and png2pnm programs
+       pngsuite         =>  Test images
+       tools            =>  Various tools
+       visupng          =>  Contains a MSVC workspace for VisualPng
       projects      =>  Contains project files and workspaces for
                         building a DLL
-       cbuilder5        =>  Contains a Borland workspace for building
-                            libpng and zlib
-       visualc6         =>  Contains a Microsoft Visual C++ (MSVC)
-                            workspace for building libpng and zlib
+       owatcom          =>  Contains a WATCOM project for building libpng
        visualc71        =>  Contains a Microsoft Visual C++ (MSVC)
                             workspace for building libpng and zlib
-       xcode            =>  Contains an Apple xcode
+       vstudio          =>  Contains a Microsoft Visual C++ (MSVC)
                             workspace for building libpng and zlib
       scripts       =>  Directory containing scripts for building libpng:
                             (see scripts/README.txt for the list of scripts)
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.c	Fri Apr 17 09:59:46 2015 -0700
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.c	Fri Apr 17 10:24:46 2015 -0700
@@ -29,8 +29,8 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Last changed in libpng 1.5.4 [July 7, 2011]
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.16 [December 22, 2014]
+ * Copyright (c) 1998-2014 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  *
@@ -42,7 +42,7 @@
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_5_4 Your_png_h_is_not_version_1_5_4;
+typedef png_libpng_version_1_6_16 Your_png_h_is_not_version_1_6_16;
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
  * of the PNG file signature.  If the PNG data is embedded into another
@@ -52,7 +52,7 @@
 
 #ifdef PNG_READ_SUPPORTED
 void PNGAPI
-png_set_sig_bytes(png_structp png_ptr, int num_bytes)
+png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
 {
    png_debug(1, "in png_set_sig_bytes");
 
@@ -71,7 +71,7 @@
  * can simply check the remaining bytes for extra assurance.  Returns
  * an integer less than, equal to, or greater than zero if sig is found,
  * respectively, to be less than, to match, or be greater than the correct
- * PNG signature (this is the same behaviour as strcmp, memcmp, etc).
+ * PNG signature (this is the same behavior as strcmp, memcmp, etc).
  */
 int PNGAPI
 png_sig_cmp(png_const_bytep sig, png_size_t start, png_size_t num_to_check)
@@ -90,52 +90,47 @@
    if (start + num_to_check > 8)
       num_to_check = 8 - start;
 
-   return ((int)(png_memcmp(&sig[start], &png_signature[start], num_to_check)));
+   return ((int)(memcmp(&sig[start], &png_signature[start], num_to_check)));
 }
 
-#endif /* PNG_READ_SUPPORTED */
+#endif /* READ */
 
 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 /* Function to allocate memory for zlib */
 PNG_FUNCTION(voidpf /* PRIVATE */,
 png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
 {
-   png_voidp ptr;
-   png_structp p=(png_structp)png_ptr;
-   png_uint_32 save_flags=p->flags;
-   png_alloc_size_t num_bytes;
+   png_alloc_size_t num_bytes = size;
 
    if (png_ptr == NULL)
-      return (NULL);
-
-   if (items > PNG_UINT_32_MAX/size)
+      return NULL;
+
+   if (items >= (~(png_alloc_size_t)0)/size)
    {
-     png_warning (p, "Potential overflow in png_zalloc()");
-     return (NULL);
+      png_warning (png_voidcast(png_structrp, png_ptr),
+         "Potential overflow in png_zalloc()");
+      return NULL;
    }
-   num_bytes = (png_alloc_size_t)items * size;
-
-   p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
-   ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes);
-   p->flags=save_flags;
-
-   return ((voidpf)ptr);
+
+   num_bytes *= items;
+   return png_malloc_warn(png_voidcast(png_structrp, png_ptr), num_bytes);
 }
 
 /* Function to free memory for zlib */
 void /* PRIVATE */
 png_zfree(voidpf png_ptr, voidpf ptr)
 {
-   png_free((png_structp)png_ptr, (png_voidp)ptr);
+   png_free(png_voidcast(png_const_structrp,png_ptr), ptr);
 }
 
 /* Reset the CRC variable to 32 bits of 1's.  Care must be taken
  * in case CRC is > 32 bits to leave the top bits 0.
  */
 void /* PRIVATE */
-png_reset_crc(png_structp png_ptr)
+png_reset_crc(png_structrp png_ptr)
 {
-   png_ptr->crc = crc32(0, Z_NULL, 0);
+   /* The cast is safe because the crc is a 32 bit value. */
+   png_ptr->crc = (png_uint_32)crc32(0, Z_NULL, 0);
 }
 
 /* Calculate the CRC over a section of data.  We can only pass as
@@ -144,119 +139,254 @@
  * trouble of calculating it.
  */
 void /* PRIVATE */
-png_calculate_crc(png_structp png_ptr, png_const_bytep ptr, png_size_t length)
+png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
 {
    int need_crc = 1;
 
-   if (png_ptr->chunk_name[0] & 0x20)                     /* ancillary */
+   if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0)
    {
       if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
           (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
          need_crc = 0;
    }
 
-   else                                                    /* critical */
+   else /* critical */
    {
-      if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE)
+      if ((png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0)
          need_crc = 0;
    }
 
-   if (need_crc)
-      png_ptr->crc = crc32(png_ptr->crc, ptr, (uInt)length);
+   /* 'uLong' is defined in zlib.h as unsigned long; this means that on some
+    * systems it is a 64 bit value.  crc32, however, returns 32 bits so the
+    * following cast is safe.  'uInt' may be no more than 16 bits, so it is
+    * necessary to perform a loop here.
+    */
+   if (need_crc != 0 && length > 0)
+   {
+      uLong crc = png_ptr->crc; /* Should never issue a warning */
+
+      do
+      {
+         uInt safe_length = (uInt)length;
+         if (safe_length == 0)
+            safe_length = (uInt)-1; /* evil, but safe */
+
+         crc = crc32(crc, ptr, safe_length);
+
+         /* The following should never issue compiler warnings; if they do the
+          * target system has characteristics that will probably violate other
+          * assumptions within the libpng code.
+          */
+         ptr += safe_length;
+         length -= safe_length;
+      }
+      while (length > 0);
+
+      /* And the following is always safe because the crc is only 32 bits. */
+      png_ptr->crc = (png_uint_32)crc;
+   }
 }
 
 /* Check a user supplied version number, called from both read and write
- * functions that create a png_struct
+ * functions that create a png_struct.
  */
 int
-png_user_version_check(png_structp png_ptr, png_const_charp user_png_ver)
+png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
 {
-   if (user_png_ver)
+     /* Libpng versions 1.0.0 and later are binary compatible if the version
+      * string matches through the second '.'; we must recompile any
+      * applications that use any older library version.
+      */
+
+   if (user_png_ver != NULL)
    {
-      int i = 0;
+      int i = -1;
+      int found_dots = 0;
 
       do
       {
-         if (user_png_ver[i] != png_libpng_ver[i])
+         i++;
+         if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
             png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
-      } while (png_libpng_ver[i++]);
+         if (user_png_ver[i] == '.')
+            found_dots++;
+      } while (found_dots < 2 && user_png_ver[i] != 0 &&
+            PNG_LIBPNG_VER_STRING[i] != 0);
    }
 
    else
       png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
 
-   if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
+   if ((png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) != 0)
    {
-     /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
-      * we must recompile any applications that use any older library version.
-      * For versions after libpng 1.0, we will be compatible, so we need
-      * only check the first digit.
-      */
-      if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
-          (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
-          (user_png_ver[0] == '0' && user_png_ver[2] < '9'))
-      {
 #ifdef PNG_WARNINGS_SUPPORTED
-         size_t pos = 0;
-         char m[128];
-
-         pos = png_safecat(m, sizeof m, pos, "Application built with libpng-");
-         pos = png_safecat(m, sizeof m, pos, user_png_ver);
-         pos = png_safecat(m, sizeof m, pos, " but running with ");
-         pos = png_safecat(m, sizeof m, pos, png_libpng_ver);
-
-         png_warning(png_ptr, m);
+      size_t pos = 0;
+      char m[128];
+
+      pos = png_safecat(m, (sizeof m), pos,
+          "Application built with libpng-");
+      pos = png_safecat(m, (sizeof m), pos, user_png_ver);
+      pos = png_safecat(m, (sizeof m), pos, " but running with ");
+      pos = png_safecat(m, (sizeof m), pos, PNG_LIBPNG_VER_STRING);
+      PNG_UNUSED(pos)
+
+      png_warning(png_ptr, m);
 #endif
 
 #ifdef PNG_ERROR_NUMBERS_SUPPORTED
-         png_ptr->flags = 0;
+      png_ptr->flags = 0;
 #endif
 
-         return 0;
-      }
+      return 0;
    }
 
    /* Success return. */
    return 1;
 }
 
-/* Allocate the memory for an info_struct for the application.  We don't
- * really need the png_ptr, but it could potentially be useful in the
- * future.  This should be used in favour of malloc(png_sizeof(png_info))
- * and png_info_init() so that applications that want to use a shared
- * libpng don't have to be recompiled if png_info changes size.
+/* Generic function to create a png_struct for either read or write - this
+ * contains the common initialization.
  */
+PNG_FUNCTION(png_structp /* PRIVATE */,
+png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
+    png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
+    png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
+{
+   png_struct create_struct;
+#  ifdef PNG_SETJMP_SUPPORTED
+      jmp_buf create_jmp_buf;
+#  endif
+
+   /* This temporary stack-allocated structure is used to provide a place to
+    * build enough context to allow the user provided memory allocator (if any)
+    * to be called.
+    */
+   memset(&create_struct, 0, (sizeof create_struct));
+
+   /* Added at libpng-1.2.6 */
+#  ifdef PNG_USER_LIMITS_SUPPORTED
+      create_struct.user_width_max = PNG_USER_WIDTH_MAX;
+      create_struct.user_height_max = PNG_USER_HEIGHT_MAX;
+
+#     ifdef PNG_USER_CHUNK_CACHE_MAX
+         /* Added at libpng-1.2.43 and 1.4.0 */
+         create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
+#     endif
+
+#     ifdef PNG_USER_CHUNK_MALLOC_MAX
+         /* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
+          * in png_struct regardless.
+          */
+         create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
+#     endif
+#  endif
+
+   /* The following two API calls simply set fields in png_struct, so it is safe
+    * to do them now even though error handling is not yet set up.
+    */
+#  ifdef PNG_USER_MEM_SUPPORTED
+      png_set_mem_fn(&create_struct, mem_ptr, malloc_fn, free_fn);
+#  else
+      PNG_UNUSED(mem_ptr)
+      PNG_UNUSED(malloc_fn)
+      PNG_UNUSED(free_fn)
+#  endif
+
+   /* (*error_fn) can return control to the caller after the error_ptr is set,
+    * this will result in a memory leak unless the error_fn does something
+    * extremely sophisticated.  The design lacks merit but is implicit in the
+    * API.
+    */
+   png_set_error_fn(&create_struct, error_ptr, error_fn, warn_fn);
+
+#  ifdef PNG_SETJMP_SUPPORTED
+      if (!setjmp(create_jmp_buf))
+      {
+         /* Temporarily fake out the longjmp information until we have
+          * successfully completed this function.  This only works if we have
+          * setjmp() support compiled in, but it is safe - this stuff should
+          * never happen.
+          */
+         create_struct.jmp_buf_ptr = &create_jmp_buf;
+         create_struct.jmp_buf_size = 0; /*stack allocation*/
+         create_struct.longjmp_fn = longjmp;
+#  else
+      {
+#  endif
+         /* Call the general version checker (shared with read and write code):
+          */
+         if (png_user_version_check(&create_struct, user_png_ver) != 0)
+         {
+            png_structrp png_ptr = png_voidcast(png_structrp,
+               png_malloc_warn(&create_struct, (sizeof *png_ptr)));
+
+            if (png_ptr != NULL)
+            {
+               /* png_ptr->zstream holds a back-pointer to the png_struct, so
+                * this can only be done now:
+                */
+               create_struct.zstream.zalloc = png_zalloc;
+               create_struct.zstream.zfree = png_zfree;
+               create_struct.zstream.opaque = png_ptr;
+
+#              ifdef PNG_SETJMP_SUPPORTED
+                  /* Eliminate the local error handling: */
+                  create_struct.jmp_buf_ptr = NULL;
+                  create_struct.jmp_buf_size = 0;
+                  create_struct.longjmp_fn = 0;
+#              endif
+
+               *png_ptr = create_struct;
+
+               /* This is the successful return point */
+               return png_ptr;
+            }
+         }
+      }
+
+   /* A longjmp because of a bug in the application storage allocator or a
+    * simple failure to allocate the png_struct.
+    */
+   return NULL;
+}
+
+/* Allocate the memory for an info_struct for the application. */
 PNG_FUNCTION(png_infop,PNGAPI
-png_create_info_struct,(png_structp png_ptr),PNG_ALLOCATED)
+png_create_info_struct,(png_const_structrp png_ptr),PNG_ALLOCATED)
 {
-   png_infop info_ptr;
+   png_inforp info_ptr;
 
    png_debug(1, "in png_create_info_struct");
 
    if (png_ptr == NULL)
-      return (NULL);
-
-#ifdef PNG_USER_MEM_SUPPORTED
-   info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
-      png_ptr->malloc_fn, png_ptr->mem_ptr);
-#else
-   info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
-#endif
+      return NULL;
+
+   /* Use the internal API that does not (or at least should not) error out, so
+    * that this call always returns ok.  The application typically sets up the
+    * error handling *after* creating the info_struct because this is the way it
+    * has always been done in 'example.c'.
+    */
+   info_ptr = png_voidcast(png_inforp, png_malloc_base(png_ptr,
+      (sizeof *info_ptr)));
+
    if (info_ptr != NULL)
-      png_info_init_3(&info_ptr, png_sizeof(png_info));
-
-   return (info_ptr);
+      memset(info_ptr, 0, (sizeof *info_ptr));
+
+   return info_ptr;
 }
 
 /* This function frees the memory associated with a single info struct.
  * Normally, one would use either png_destroy_read_struct() or
  * png_destroy_write_struct() to free an info struct, but this may be
- * useful for some applications.
+ * useful for some applications.  From libpng 1.6.0 this function is also used
+ * internally to implement the png_info release part of the 'struct' destroy
+ * APIs.  This ensures that all possible approaches free the same data (all of
+ * it).
  */
 void PNGAPI
-png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
+png_destroy_info_struct(png_const_structrp png_ptr, png_infopp info_ptr_ptr)
 {
-   png_infop info_ptr = NULL;
+   png_inforp info_ptr = NULL;
 
    png_debug(1, "in png_destroy_info_struct");