changeset 15730:cca479e15cf6

Merge
author henryjen
date Mon, 14 Mar 2016 20:53:59 -0700
parents 7ce9360bfcb3 9417e1bcded6
children 7d56aa9d7e32
files make/lib/Lib-jdk.deploy.osx.gmk make/lib/LibosxLibraries.gmk make/mapfiles/libjfr/mapfile-vers src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java src/java.base/share/classes/java/nio/charset/Charset.java src/java.base/share/classes/sun/misc/ASCIICaseInsensitiveComparator.java src/java.base/share/native/include/jni.h src/java.base/windows/native/libjava/java_props_md.c src/jdk.charsets/share/classes/sun/nio/cs/ext/AbstractCharsetProvider.java src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/Dispatch.java src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchConcurrentQueue.java src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchMainQueue.java src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchNative.java src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchQueue.java src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchRetainedResource.java src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchSerialQueue.java src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/package.html src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m src/jdk.deploy.osx/macosx/native/libosx/Dispatch.m test/ProblemList.txt test/java/lang/instrument/NativeMethodPrefixAgent.java test/javax/swing/JScrollPane/8033000/bug8033000.java test/sample/chatserver/ChatTest.java test/sample/mergesort/MergeSortTest.java
diffstat 151 files changed, 5466 insertions(+), 2744 deletions(-) [+]
line wrap: on
line diff
--- a/make/lib/Lib-java.desktop.gmk	Mon Mar 14 12:58:07 2016 +0000
+++ b/make/lib/Lib-java.desktop.gmk	Mon Mar 14 20:53:59 2016 -0700
@@ -29,6 +29,7 @@
 $(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/java.desktop/*/native \
     $(JDK_TOPDIR)/src/*/java.desktop/*/native)))
 
+include LibosxLibraries.gmk
 include PlatformLibraries.gmk
 include Awt2dLibraries.gmk
 include SoundLibraries.gmk
--- a/make/lib/Lib-jdk.deploy.osx.gmk	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#
-# 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
-# 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), macosx)
-
-  ################################################################################
-
-  LIBOSX_DIRS := $(JDK_TOPDIR)/src/jdk.deploy.osx/macosx/native/libosx
-  LIBOSX_CFLAGS := -I$(LIBOSX_DIRS) \
-      -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
-      $(LIBJAVA_HEADER_FLAGS) \
-      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-      -I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx \
-      #
-
-  $(eval $(call SetupNativeCompilation,BUILD_LIBOSX, \
-      LIBRARY := osx, \
-      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-      SRC := $(LIBOSX_DIRS), \
-      OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) \
-          $(LIBOSX_CFLAGS), \
-      DISABLED_WARNINGS_clang := deprecated-declarations, \
-      LDFLAGS := $(LDFLAGS_JDKLIB) \
-          -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
-          $(call SET_SHARED_LIBRARY_ORIGIN), \
-      LIBS := \
-          -losxapp \
-          -framework Cocoa \
-          -framework ApplicationServices \
-          -framework JavaNativeFoundation \
-          -framework JavaRuntimeSupport \
-          -framework SystemConfiguration \
-          $(JDKLIB_LIBS), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
-  ))
-
-  TARGETS += $(BUILD_LIBOSX)
-
-  $(BUILD_LIBOSX): $(call FindLib, java.desktop, osxapp)
-
-  $(BUILD_LIBOSX): $(call FindLib, java.base, java)
-
-  ################################################################################
-
-endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/lib/LibosxLibraries.gmk	Mon Mar 14 20:53:59 2016 -0700
@@ -0,0 +1,67 @@
+#
+# 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
+# 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.
+#
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+  ################################################################################
+
+  LIBOSX_DIRS := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libosx
+  LIBOSX_CFLAGS := -I$(LIBOSX_DIRS) \
+      -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
+      $(LIBJAVA_HEADER_FLAGS) \
+      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
+      #
+
+  $(eval $(call SetupNativeCompilation,BUILD_LIBOSX, \
+      LIBRARY := osx, \
+      OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+      SRC := $(LIBOSX_DIRS), \
+      OPTIMIZATION := LOW, \
+      CFLAGS := $(CFLAGS_JDKLIB) \
+          $(LIBOSX_CFLAGS), \
+      DISABLED_WARNINGS_clang := deprecated-declarations, \
+      LDFLAGS := $(LDFLAGS_JDKLIB) \
+          -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
+          $(call SET_SHARED_LIBRARY_ORIGIN), \
+      LIBS := \
+          -losxapp \
+          -framework Cocoa \
+          -framework ApplicationServices \
+          -framework JavaNativeFoundation \
+          -framework JavaRuntimeSupport \
+          -framework SystemConfiguration \
+          $(JDKLIB_LIBS), \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
+  ))
+
+  TARGETS += $(BUILD_LIBOSX)
+
+  $(BUILD_LIBOSX): $(call FindLib, java.desktop, osxapp)
+
+  $(BUILD_LIBOSX): $(call FindLib, java.base, java)
+
+  ################################################################################
+
+endif
--- a/make/mapfiles/libawt/mapfile-mawt-vers	Mon Mar 14 12:58:07 2016 +0000
+++ b/make/mapfiles/libawt/mapfile-mawt-vers	Mon Mar 14 20:53:59 2016 -0700
@@ -200,6 +200,7 @@
                 Java_sun_print_CUPSPrinter_initIDs;
                 Java_sun_print_CUPSPrinter_getCupsServer;
                 Java_sun_print_CUPSPrinter_getCupsPort;
+                Java_sun_print_CUPSPrinter_getCupsDefaultPrinter;
                 Java_sun_print_CUPSPrinter_canConnect;
                 Java_sun_print_CUPSPrinter_getMedia;
                 Java_sun_print_CUPSPrinter_getPageSizes;
--- a/make/mapfiles/libawt_headless/mapfile-vers	Mon Mar 14 12:58:07 2016 +0000
+++ b/make/mapfiles/libawt_headless/mapfile-vers	Mon Mar 14 20:53:59 2016 -0700
@@ -73,6 +73,7 @@
 		Java_sun_print_CUPSPrinter_initIDs;
 		Java_sun_print_CUPSPrinter_getCupsServer;
 		Java_sun_print_CUPSPrinter_getCupsPort;
+		Java_sun_print_CUPSPrinter_getCupsDefaultPrinter;
 		Java_sun_print_CUPSPrinter_canConnect;
 		Java_sun_print_CUPSPrinter_getMedia;
 		Java_sun_print_CUPSPrinter_getPageSizes;
--- a/make/mapfiles/libawt_xawt/mapfile-vers	Mon Mar 14 12:58:07 2016 +0000
+++ b/make/mapfiles/libawt_xawt/mapfile-vers	Mon Mar 14 20:53:59 2016 -0700
@@ -439,6 +439,7 @@
 	Java_sun_print_CUPSPrinter_initIDs;
 	Java_sun_print_CUPSPrinter_getCupsServer;
 	Java_sun_print_CUPSPrinter_getCupsPort;
+	Java_sun_print_CUPSPrinter_getCupsDefaultPrinter;
 	Java_sun_print_CUPSPrinter_canConnect;
 	Java_sun_print_CUPSPrinter_getMedia;
 	Java_sun_print_CUPSPrinter_getPageSizes;
--- a/make/mapfiles/libjfr/mapfile-vers	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-#
-
-# Define library interface.
-
-SUNWprivate_1.1 {
-  global:
-      Java_oracle_jrockit_jfr_Process_getpid;
-      Java_oracle_jrockit_jfr_Timing_counterTime;
-      Java_oracle_jrockit_jfr_Timing_init;
-      Java_oracle_jrockit_jfr_Logger_output0;
-      Java_oracle_jrockit_jfr_JFR_isCommercialFeaturesUnlocked;
-      Java_oracle_jrockit_jfr_JFR_isStarted;
-      Java_oracle_jrockit_jfr_JFR_isSupportedInVM;
-      Java_oracle_jrockit_jfr_JFR_startFlightRecorder;
-      Java_oracle_jrockit_jfr_JFR_isDisabledOnCommandLine;
-      Java_oracle_jrockit_jfr_JFR_isEnabled;
-      Java_oracle_jrockit_jfr_VMJFR_options;
-      Java_oracle_jrockit_jfr_VMJFR_init;
-      Java_oracle_jrockit_jfr_VMJFR_addConstPool;
-      Java_oracle_jrockit_jfr_VMJFR_removeConstPool;
-      Java_oracle_jrockit_jfr_VMJFR_storeConstPool;
-      Java_oracle_jrockit_jfr_VMJFR_classID0;
-      Java_oracle_jrockit_jfr_VMJFR_stackTraceID;
-      Java_oracle_jrockit_jfr_VMJFR_threadID;
-      Java_oracle_jrockit_jfr_VMJFR_rotate;
-      Java_oracle_jrockit_jfr_VMJFR_shutdown;
-      Java_oracle_jrockit_jfr_VMJFR_start;
-      Java_oracle_jrockit_jfr_VMJFR_stop;
-      Java_oracle_jrockit_jfr_VMJFR_buffer;
-      Java_oracle_jrockit_jfr_VMJFR_flush;
-      Java_oracle_jrockit_jfr_VMJFR_write;
-      Java_oracle_jrockit_jfr_VMJFR_add;
-      Java_oracle_jrockit_jfr_VMJFR_remove;
-      Java_oracle_jrockit_jfr_VMJFR_setThreshold;
-      Java_oracle_jrockit_jfr_VMJFR_setPeriod;
-      Java_oracle_jrockit_jfr_VMJFR_getPeriod;
-      Java_oracle_jrockit_jfr_VMJFR_descriptors;
-      Java_oracle_jrockit_jfr_VMJFR_retransformClasses0;
-      JNI_OnLoad;
-  local:
-      *;
-};
--- a/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/lang/ProcessHandleImpl.java	Mon Mar 14 20:53:59 2016 -0700
@@ -81,9 +81,8 @@
                 ThreadGroup systemThreadGroup = tg;
 
                 ThreadFactory threadFactory = grimReaper -> {
-                    // Our thread stack requirement is quite modest.
-                    Thread t = new Thread(systemThreadGroup, grimReaper,
-                            "process reaper", 32768);
+                    long stackSize = Boolean.getBoolean("jdk.lang.processReaperUseDefaultStackSize") ? 0 : 32768;
+                    Thread t = new Thread(systemThreadGroup, grimReaper, "process reaper", stackSize);
                     t.setDaemon(true);
                     // A small attempt (probably futile) to avoid priority inversion
                     t.setPriority(Thread.MAX_PRIORITY);
--- a/src/java.base/share/classes/java/lang/String.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/lang/String.java	Mon Mar 14 20:53:59 2016 -0700
@@ -42,6 +42,7 @@
 import java.util.stream.IntStream;
 import java.util.stream.StreamSupport;
 import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.vm.annotation.Stable;
 
 /**
  * The {@code String} class represents character strings. All
@@ -119,7 +120,18 @@
 public final class String
     implements java.io.Serializable, Comparable<String>, CharSequence {
 
-    /** The value is used for character storage. */
+    /**
+     * The value is used for character storage.
+     *
+     * @implNote This field is trusted by the VM, and is a subject to
+     * constant folding if String instance is constant. Overwriting this
+     * field after construction will cause problems.
+     *
+     * Additionally, it is marked with {@link Stable} to trust the contents
+     * of the array. No other facility in JDK provides this functionality (yet).
+     * {@link Stable} is safe here, because value is never null.
+     */
+    @Stable
     private final byte[] value;
 
     /**
@@ -129,6 +141,9 @@
      * LATIN1
      * UTF16
      *
+     * @implNote This field is trusted by the VM, and is a subject to
+     * constant folding if String instance is constant. Overwriting this
+     * field after construction will cause problems.
      */
     private final byte coder;
 
@@ -1222,30 +1237,12 @@
         public int compare(String s1, String s2) {
             byte v1[] = s1.value;
             byte v2[] = s2.value;
-            int n1 = s1.length();
-            int n2 = s2.length();
-            boolean s1IsLatin1 = s1.isLatin1();
-            boolean s2IsLatin1 = s2.isLatin1();
-            int min = Math.min(n1, n2);
-            for (int i = 0; i < min; i++) {
-                char c1 = s1IsLatin1 ? StringLatin1.getChar(v1, i)
-                                     : StringUTF16.getChar(v1, i);
-                char c2 = s2IsLatin1 ? StringLatin1.getChar(v2, i)
-                                     : StringUTF16.getChar(v2, i);
-                if (c1 != c2) {
-                    c1 = Character.toUpperCase(c1);
-                    c2 = Character.toUpperCase(c2);
-                    if (c1 != c2) {
-                        c1 = Character.toLowerCase(c1);
-                        c2 = Character.toLowerCase(c2);
-                        if (c1 != c2) {
-                            // No overflow because of numeric promotion
-                            return c1 - c2;
-                        }
-                    }
-                }
+            if (s1.coder() == s2.coder()) {
+                return s1.isLatin1() ? StringLatin1.compareToCI(v1, v2)
+                                     : StringUTF16.compareToCI(v1, v2);
             }
-            return n1 - n2;
+            return s1.isLatin1() ? StringLatin1.compareToCI_UTF16(v1, v2)
+                                 : StringUTF16.compareToCI_Latin1(v1, v2);
         }
 
         /** Replaces the de-serialized object. */
--- a/src/java.base/share/classes/java/lang/StringLatin1.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/lang/StringLatin1.java	Mon Mar 14 20:53:59 2016 -0700
@@ -128,6 +128,48 @@
         return len1 - len2;
     }
 
+    public static int compareToCI(byte[] value, byte[] other) {
+        int len1 = value.length;
+        int len2 = other.length;
+        int lim = Math.min(len1, len2);
+        for (int k = 0; k < lim; k++) {
+            if (value[k] != other[k]) {
+                char c1 = (char) CharacterDataLatin1.instance.toUpperCase(getChar(value, k));
+                char c2 = (char) CharacterDataLatin1.instance.toUpperCase(getChar(other, k));
+                if (c1 != c2) {
+                    c1 = (char) CharacterDataLatin1.instance.toLowerCase(c1);
+                    c2 = (char) CharacterDataLatin1.instance.toLowerCase(c2);
+                    if (c1 != c2) {
+                        return c1 - c2;
+                    }
+                }
+            }
+        }
+        return len1 - len2;
+    }
+
+    public static int compareToCI_UTF16(byte[] value, byte[] other) {
+        int len1 = length(value);
+        int len2 = StringUTF16.length(other);
+        int lim = Math.min(len1, len2);
+        for (int k = 0; k < lim; k++) {
+            char c1 = getChar(value, k);
+            char c2 = StringUTF16.getChar(other, k);
+            if (c1 != c2) {
+                c1 = Character.toUpperCase(c1);
+                c2 = Character.toUpperCase(c2);
+                if (c1 != c2) {
+                    c1 = Character.toLowerCase(c1);
+                    c2 = Character.toLowerCase(c2);
+                    if (c1 != c2) {
+                        return c1 - c2;
+                    }
+                }
+            }
+        }
+        return len1 - len2;
+    }
+
     public static int hashCode(byte[] value) {
         int h = 0;
         for (byte v : value) {
--- a/src/java.base/share/classes/java/lang/StringUTF16.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/lang/StringUTF16.java	Mon Mar 14 20:53:59 2016 -0700
@@ -270,6 +270,50 @@
         return len1 - len2;
     }
 
+    public static int compareToCI(byte[] value, byte[] other) {
+        int len1 = length(value);
+        int len2 = length(other);
+        int lim = Math.min(len1, len2);
+        for (int k = 0; k < lim; k++) {
+            char c1 = getChar(value, k);
+            char c2 = getChar(other, k);
+            if (c1 != c2) {
+                c1 = Character.toUpperCase(c1);
+                c2 = Character.toUpperCase(c2);
+                if (c1 != c2) {
+                    c1 = Character.toLowerCase(c1);
+                    c2 = Character.toLowerCase(c2);
+                    if (c1 != c2) {
+                        return c1 - c2;
+                    }
+                }
+            }
+        }
+        return len1 - len2;
+    }
+
+    public static int compareToCI_Latin1(byte[] value, byte[] other) {
+        int len1 = length(value);
+        int len2 = StringLatin1.length(other);
+        int lim = Math.min(len1, len2);
+        for (int k = 0; k < lim; k++) {
+            char c1 = getChar(value, k);
+            char c2 = StringLatin1.getChar(other, k);
+            if (c1 != c2) {
+                c1 = Character.toUpperCase(c1);
+                c2 = Character.toUpperCase(c2);
+                if (c1 != c2) {
+                    c1 = Character.toLowerCase(c1);
+                    c2 = Character.toLowerCase(c2);
+                    if (c1 != c2) {
+                        return c1 - c2;
+                    }
+                }
+            }
+        }
+        return len1 - len2;
+    }
+
     public static int hashCode(byte[] value) {
         int h = 0;
         int length = value.length >> 1;
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java	Mon Mar 14 20:53:59 2016 -0700
@@ -30,7 +30,7 @@
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
-import jdk.internal.ref.Cleaner;
+import jdk.internal.ref.CleanerFactory;
 
 /**
  * The JVM interface for the method handles package is all here.
@@ -68,10 +68,12 @@
 
         static CallSiteContext make(CallSite cs) {
             final CallSiteContext newContext = new CallSiteContext();
-            // Cleaner is attached to CallSite instance and it clears native structures allocated for CallSite context.
-            // Though the CallSite can become unreachable, its Context is retained by the Cleaner instance (which is
-            // referenced from Cleaner class) until cleanup is performed.
-            Cleaner.create(cs, newContext);
+            // CallSite instance is tracked by a Cleanable which clears native
+            // structures allocated for CallSite context. Though the CallSite can
+            // become unreachable, its Context is retained by the Cleanable instance
+            // (which is referenced from Cleaner instance which is referenced from
+            // CleanerFactory class) until cleanup is performed.
+            CleanerFactory.cleaner().register(cs, newContext);
             return newContext;
         }
 
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java	Mon Mar 14 20:53:59 2016 -0700
@@ -91,7 +91,7 @@
  * can call with more than 255 slots. This limits the number of static and
  * dynamic arguments one can pass to bootstrap method. Since there are potential
  * concatenation strategies that use {@code MethodHandle} combinators, we need
- * to reserve a few empty slots on the parameter lists to to capture the
+ * to reserve a few empty slots on the parameter lists to capture the
  * temporal results. This is why bootstrap methods in this factory do not accept
  * more than 200 argument slots. Users requiring more than 200 argument slots in
  * concatenation are expected to split the large concatenation in smaller
--- a/src/java.base/share/classes/java/lang/ref/Cleaner.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/lang/ref/Cleaner.java	Mon Mar 14 20:53:59 2016 -0700
@@ -25,10 +25,11 @@
 
 package java.lang.ref;
 
+import jdk.internal.ref.CleanerImpl;
+
 import java.util.Objects;
 import java.util.concurrent.ThreadFactory;
-
-import jdk.internal.ref.CleanerImpl;
+import java.util.function.Function;
 
 /**
  * {@code Cleaner} manages a set of object references and corresponding cleaning actions.
@@ -135,7 +136,12 @@
     final CleanerImpl impl;
 
     static {
-        CleanerImpl.setCleanerImplAccess((Cleaner c) -> c.impl);
+        CleanerImpl.setCleanerImplAccess(new Function<Cleaner, CleanerImpl>() {
+            @Override
+            public CleanerImpl apply(Cleaner cleaner) {
+                return cleaner.impl;
+            }
+        });
     }
 
     /**
--- a/src/java.base/share/classes/java/nio/charset/Charset.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/nio/charset/Charset.java	Mon Mar 14 20:53:59 2016 -0700
@@ -44,7 +44,6 @@
 import java.util.SortedMap;
 import java.util.TreeMap;
 import jdk.internal.misc.VM;
-import sun.misc.ASCIICaseInsensitiveComparator;
 import sun.nio.cs.StandardCharsets;
 import sun.nio.cs.ThreadLocalCoders;
 import sun.security.action.GetPropertyAction;
@@ -579,7 +578,7 @@
                 public SortedMap<String,Charset> run() {
                     TreeMap<String,Charset> m =
                         new TreeMap<>(
-                            ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
+                            String.CASE_INSENSITIVE_ORDER);
                     put(standardProvider.charsets(), m);
                     CharsetProvider[] ecps = ExtendedProviderHolder.extendedProviders;
                     for (CharsetProvider ecp :ecps) {
--- a/src/java.base/share/classes/java/util/Collections.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/util/Collections.java	Mon Mar 14 20:53:59 2016 -0700
@@ -2728,7 +2728,7 @@
      *  Set s2 = m2.keySet();  // Needn't be in synchronized block
      *      ...
      *  synchronized (m) {  // Synchronizing on m, not m2 or s2!
-     *      Iterator i = s.iterator(); // Must be in synchronized block
+     *      Iterator i = s2.iterator(); // Must be in synchronized block
      *      while (i.hasNext())
      *          foo(i.next());
      *  }
--- a/src/java.base/share/classes/java/util/jar/Attributes.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/java/util/jar/Attributes.java	Mon Mar 14 20:53:59 2016 -0700
@@ -34,9 +34,9 @@
 import java.util.Collection;
 import java.util.AbstractSet;
 import java.util.Iterator;
+import java.util.Locale;
 import sun.util.logging.PlatformLogger;
 import java.util.Comparator;
-import sun.misc.ASCIICaseInsensitiveComparator;
 
 /**
  * The Attributes class maps Manifest attribute names to associated string
@@ -501,7 +501,7 @@
          */
         public boolean equals(Object o) {
             if (o instanceof Name) {
-                Comparator<String> c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
+                Comparator<String> c = String.CASE_INSENSITIVE_ORDER;
                 return c.compare(name, ((Name)o).name) == 0;
             } else {
                 return false;
@@ -513,7 +513,7 @@
          */
         public int hashCode() {
             if (hashCode == -1) {
-                hashCode = ASCIICaseInsensitiveComparator.lowerCaseHashCode(name);
+                hashCode = name.toLowerCase(Locale.ROOT).hashCode();
             }
             return hashCode;
         }
--- a/src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/jdk/internal/math/FormattedFloatingDecimal.java	Mon Mar 14 20:53:59 2016 -0700
@@ -106,10 +106,28 @@
         return decExponentRounded - 1;
     }
 
+    /**
+     * Returns the mantissa as a {@code char[]}.  Note that the returned value
+     * is a reference to the internal {@code char[]} containing the mantissa,
+     * therefore code invoking this method should not pass the return value to
+     * external code but should in that case make a copy.
+     *
+     * @return a reference to the internal {@code char[]} representing the
+     *         mantissa.
+     */
     public char[] getMantissa(){
         return mantissa;
     }
 
+    /**
+     * Returns the exponent as a {@code char[]}.  Note that the returned value
+     * is a reference to the internal {@code char[]} containing the exponent,
+     * therefore code invoking this method should not pass the return value to
+     * external code but should in that case make a copy.
+     *
+     * @return a reference to the internal {@code char[]} representing the
+     *         exponent.
+     */
     public char[] getExponent(){
         return exponent;
     }
--- a/src/java.base/share/classes/jdk/internal/misc/InnocuousThread.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/jdk/internal/misc/InnocuousThread.java	Mon Mar 14 20:53:59 2016 -0700
@@ -128,8 +128,12 @@
             }
             final ThreadGroup root = group;
             INNOCUOUSTHREADGROUP = AccessController.doPrivileged(
-                (PrivilegedAction<ThreadGroup>) () ->
-                    { return new ThreadGroup(root, "InnocuousThreadGroup"); });
+                new PrivilegedAction<ThreadGroup>() {
+                    @Override
+                    public ThreadGroup run() {
+                        return new ThreadGroup(root, "InnocuousThreadGroup");
+                    }
+                });
         } catch (Exception e) {
             throw new Error(e);
         }
--- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Mon Mar 14 20:53:59 2016 -0700
@@ -782,6 +782,46 @@
                                                      Object expected,
                                                      Object x);
 
+    @HotSpotIntrinsicCandidate
+    public final native Object compareAndExchangeObjectVolatile(Object o, long offset,
+                                                                Object expected,
+                                                                Object x);
+
+    @HotSpotIntrinsicCandidate
+    public final Object compareAndExchangeObjectAcquire(Object o, long offset,
+                                                               Object expected,
+                                                               Object x) {
+        return compareAndExchangeObjectVolatile(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final Object compareAndExchangeObjectRelease(Object o, long offset,
+                                                               Object expected,
+                                                               Object x) {
+        return compareAndExchangeObjectVolatile(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final boolean weakCompareAndSwapObject(Object o, long offset,
+                                                         Object expected,
+                                                         Object x) {
+        return compareAndSwapObject(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final boolean weakCompareAndSwapObjectAcquire(Object o, long offset,
+                                                                Object expected,
+                                                                Object x) {
+        return compareAndSwapObject(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final boolean weakCompareAndSwapObjectRelease(Object o, long offset,
+                                                                Object expected,
+                                                                Object x) {
+        return compareAndSwapObject(o, offset, expected, x);
+    }
+
     /**
      * Atomically updates Java variable to {@code x} if it is currently
      * holding {@code expected}.
@@ -796,6 +836,46 @@
                                                   int expected,
                                                   int x);
 
+    @HotSpotIntrinsicCandidate
+    public final native int compareAndExchangeIntVolatile(Object o, long offset,
+                                                          int expected,
+                                                          int x);
+
+    @HotSpotIntrinsicCandidate
+    public final int compareAndExchangeIntAcquire(Object o, long offset,
+                                                         int expected,
+                                                         int x) {
+        return compareAndExchangeIntVolatile(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final int compareAndExchangeIntRelease(Object o, long offset,
+                                                         int expected,
+                                                         int x) {
+        return compareAndExchangeIntVolatile(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final boolean weakCompareAndSwapInt(Object o, long offset,
+                                                      int expected,
+                                                      int x) {
+        return compareAndSwapInt(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final boolean weakCompareAndSwapIntAcquire(Object o, long offset,
+                                                             int expected,
+                                                             int x) {
+        return compareAndSwapInt(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final boolean weakCompareAndSwapIntRelease(Object o, long offset,
+                                                             int expected,
+                                                             int x) {
+        return compareAndSwapInt(o, offset, expected, x);
+    }
+
     /**
      * Atomically updates Java variable to {@code x} if it is currently
      * holding {@code expected}.
@@ -810,6 +890,46 @@
                                                    long expected,
                                                    long x);
 
+    @HotSpotIntrinsicCandidate
+    public final native long compareAndExchangeLongVolatile(Object o, long offset,
+                                                            long expected,
+                                                            long x);
+
+    @HotSpotIntrinsicCandidate
+    public final long compareAndExchangeLongAcquire(Object o, long offset,
+                                                           long expected,
+                                                           long x) {
+        return compareAndExchangeLongVolatile(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final long compareAndExchangeLongRelease(Object o, long offset,
+                                                           long expected,
+                                                           long x) {
+        return compareAndExchangeLongVolatile(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final boolean weakCompareAndSwapLong(Object o, long offset,
+                                                       long expected,
+                                                       long x) {
+        return compareAndSwapLong(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final boolean weakCompareAndSwapLongAcquire(Object o, long offset,
+                                                              long expected,
+                                                              long x) {
+        return compareAndSwapLong(o, offset, expected, x);
+    }
+
+    @HotSpotIntrinsicCandidate
+    public final boolean weakCompareAndSwapLongRelease(Object o, long offset,
+                                                              long expected,
+                                                              long x) {
+        return compareAndSwapLong(o, offset, expected, x);
+    }
+
     /**
      * Fetches a reference value from a given Java variable, with volatile
      * load semantics. Otherwise identical to {@link #getObject(Object, long)}
@@ -908,6 +1028,224 @@
     @HotSpotIntrinsicCandidate
     public native void    putOrderedLong(Object o, long offset, long x);
 
+    /** Acquire version of {@link #getObjectVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final Object getObjectAcquire(Object o, long offset) {
+        return getObjectVolatile(o, offset);
+    }
+
+    /** Acquire version of {@link #getBooleanVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final boolean getBooleanAcquire(Object o, long offset) {
+        return getBooleanVolatile(o, offset);
+    }
+
+    /** Acquire version of {@link #getByteVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final byte getByteAcquire(Object o, long offset) {
+        return getByteVolatile(o, offset);
+    }
+
+    /** Acquire version of {@link #getShortVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final short getShortAcquire(Object o, long offset) {
+        return getShortVolatile(o, offset);
+    }
+
+    /** Acquire version of {@link #getCharVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final char getCharAcquire(Object o, long offset) {
+        return getCharVolatile(o, offset);
+    }
+
+    /** Acquire version of {@link #getIntVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final int getIntAcquire(Object o, long offset) {
+        return getIntVolatile(o, offset);
+    }
+
+    /** Acquire version of {@link #getFloatVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final float getFloatAcquire(Object o, long offset) {
+        return getFloatVolatile(o, offset);
+    }
+
+    /** Acquire version of {@link #getLongVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final long getLongAcquire(Object o, long offset) {
+        return getLongVolatile(o, offset);
+    }
+
+    /** Acquire version of {@link #getDoubleVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final double getDoubleAcquire(Object o, long offset) {
+        return getDoubleVolatile(o, offset);
+    }
+
+    /** Release version of {@link #putObjectVolatile(Object, long, Object)} */
+    @HotSpotIntrinsicCandidate
+    public final void putObjectRelease(Object o, long offset, Object x) {
+        putObjectVolatile(o, offset, x);
+    }
+
+    /** Release version of {@link #putBooleanVolatile(Object, long, boolean)} */
+    @HotSpotIntrinsicCandidate
+    public final void putBooleanRelease(Object o, long offset, boolean x) {
+        putBooleanVolatile(o, offset, x);
+    }
+
+    /** Release version of {@link #putByteVolatile(Object, long, byte)} */
+    @HotSpotIntrinsicCandidate
+    public final void putByteRelease(Object o, long offset, byte x) {
+        putByteVolatile(o, offset, x);
+    }
+
+    /** Release version of {@link #putShortVolatile(Object, long, short)} */
+    @HotSpotIntrinsicCandidate
+    public final void putShortRelease(Object o, long offset, short x) {
+        putShortVolatile(o, offset, x);
+    }
+
+    /** Release version of {@link #putCharVolatile(Object, long, char)} */
+    @HotSpotIntrinsicCandidate
+    public final void putCharRelease(Object o, long offset, char x) {
+        putCharVolatile(o, offset, x);
+    }
+
+    /** Release version of {@link #putIntVolatile(Object, long, int)} */
+    @HotSpotIntrinsicCandidate
+    public final void putIntRelease(Object o, long offset, int x) {
+        putIntVolatile(o, offset, x);
+    }
+
+    /** Release version of {@link #putFloatVolatile(Object, long, float)} */
+    @HotSpotIntrinsicCandidate
+    public final void putFloatRelease(Object o, long offset, float x) {
+        putFloatVolatile(o, offset, x);
+    }
+
+    /** Release version of {@link #putLongVolatile(Object, long, long)} */
+    @HotSpotIntrinsicCandidate
+    public final void putLongRelease(Object o, long offset, long x) {
+        putLongVolatile(o, offset, x);
+    }
+
+    /** Release version of {@link #putDoubleVolatile(Object, long, double)} */
+    @HotSpotIntrinsicCandidate
+    public final void putDoubleRelease(Object o, long offset, double x) {
+        putDoubleVolatile(o, offset, x);
+    }
+
+    // ------------------------------ Opaque --------------------------------------
+
+    /** Opaque version of {@link #getObjectVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final Object getObjectOpaque(Object o, long offset) {
+        return getObjectVolatile(o, offset);
+    }
+
+    /** Opaque version of {@link #getBooleanVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final boolean getBooleanOpaque(Object o, long offset) {
+        return getBooleanVolatile(o, offset);
+    }
+
+    /** Opaque version of {@link #getByteVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final byte getByteOpaque(Object o, long offset) {
+        return getByteVolatile(o, offset);
+    }
+
+    /** Opaque version of {@link #getShortVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final short getShortOpaque(Object o, long offset) {
+        return getShortVolatile(o, offset);
+    }
+
+    /** Opaque version of {@link #getCharVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final char getCharOpaque(Object o, long offset) {
+        return getCharVolatile(o, offset);
+    }
+
+    /** Opaque version of {@link #getIntVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final int getIntOpaque(Object o, long offset) {
+        return getIntVolatile(o, offset);
+    }
+
+    /** Opaque version of {@link #getFloatVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final float getFloatOpaque(Object o, long offset) {
+        return getFloatVolatile(o, offset);
+    }
+
+    /** Opaque version of {@link #getLongVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final long getLongOpaque(Object o, long offset) {
+        return getLongVolatile(o, offset);
+    }
+
+    /** Opaque version of {@link #getDoubleVolatile(Object, long)} */
+    @HotSpotIntrinsicCandidate
+    public final double getDoubleOpaque(Object o, long offset) {
+        return getDoubleVolatile(o, offset);
+    }
+
+    /** Opaque version of {@link #putObjectVolatile(Object, long, Object)} */
+    @HotSpotIntrinsicCandidate
+    public final void putObjectOpaque(Object o, long offset, Object x) {
+        putObjectVolatile(o, offset, x);
+    }
+
+    /** Opaque version of {@link #putBooleanVolatile(Object, long, boolean)} */
+    @HotSpotIntrinsicCandidate
+    public final void putBooleanOpaque(Object o, long offset, boolean x) {
+        putBooleanVolatile(o, offset, x);
+    }
+
+    /** Opaque version of {@link #putByteVolatile(Object, long, byte)} */
+    @HotSpotIntrinsicCandidate
+    public final void putByteOpaque(Object o, long offset, byte x) {
+        putByteVolatile(o, offset, x);
+    }
+
+    /** Opaque version of {@link #putShortVolatile(Object, long, short)} */
+    @HotSpotIntrinsicCandidate
+    public final void putShortOpaque(Object o, long offset, short x) {
+        putShortVolatile(o, offset, x);
+    }
+
+    /** Opaque version of {@link #putCharVolatile(Object, long, char)} */
+    @HotSpotIntrinsicCandidate
+    public final void putCharOpaque(Object o, long offset, char x) {
+        putCharVolatile(o, offset, x);
+    }
+
+    /** Opaque version of {@link #putIntVolatile(Object, long, int)} */
+    @HotSpotIntrinsicCandidate
+    public final void putIntOpaque(Object o, long offset, int x) {
+        putIntVolatile(o, offset, x);
+    }
+
+    /** Opaque version of {@link #putFloatVolatile(Object, long, float)} */
+    @HotSpotIntrinsicCandidate
+    public final void putFloatOpaque(Object o, long offset, float x) {
+        putFloatVolatile(o, offset, x);
+    }
+
+    /** Opaque version of {@link #putLongVolatile(Object, long, long)} */
+    @HotSpotIntrinsicCandidate
+    public final void putLongOpaque(Object o, long offset, long x) {
+        putLongVolatile(o, offset, x);
+    }
+
+    /** Opaque version of {@link #putDoubleVolatile(Object, long, double)} */
+    @HotSpotIntrinsicCandidate
+    public final void putDoubleOpaque(Object o, long offset, double x) {
+        putDoubleVolatile(o, offset, x);
+    }
+
     /**
      * Unblocks the given thread blocked on {@code park}, or, if it is
      * not blocked, causes the subsequent call to {@code park} not to
@@ -1101,6 +1439,23 @@
     public native void fullFence();
 
     /**
+     * Ensures that loads before the fence will not be reordered with
+     * loads after the fence.
+     */
+    public final void loadLoadFence() {
+        loadFence();
+    }
+
+    /**
+     * Ensures that stores before the fence will not be reordered with
+     * stores after the fence.
+     */
+    public final void storeStoreFence() {
+        storeFence();
+    }
+
+
+    /**
      * Throws IllegalAccessError; for use by the VM for access control
      * error support.
      * @since 1.8
--- a/src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java	Mon Mar 14 20:53:59 2016 -0700
@@ -31,6 +31,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Function;
 
 import jdk.internal.misc.InnocuousThread;
@@ -39,7 +40,7 @@
  * CleanerImpl manages a set of object references and corresponding cleaning actions.
  * CleanerImpl provides the functionality of {@link java.lang.ref.Cleaner}.
  */
-public final class CleanerImpl {
+public final class CleanerImpl implements Runnable {
 
     /**
      * An object to access the CleanerImpl from a Cleaner; set by Cleaner init.
@@ -103,7 +104,7 @@
         }
         // schedule a nop cleaning action for the cleaner, so the associated thread
         // will continue to run at least until the cleaner is reclaimable.
-        new PhantomCleanableRef(cleaner, cleaner, () -> {});
+        new CleanerCleanable(cleaner);
 
         if (threadFactory == null) {
             threadFactory = CleanerImpl.InnocuousThreadFactory.factory();
@@ -112,7 +113,7 @@
         // now that there's at least one cleaning action, for the cleaner,
         // we can start the associated thread, which runs until
         // all cleaning actions have been run.
-        Thread thread = threadFactory.newThread(this::run);
+        Thread thread = threadFactory.newThread(this);
         thread.setDaemon(true);
         thread.start();
     }
@@ -128,7 +129,8 @@
      * If the thread is a ManagedLocalsThread, the threadlocals
      * are erased before each cleanup
      */
-    private void run() {
+    @Override
+    public void run() {
         Thread t = Thread.currentThread();
         InnocuousThread mlThread = (t instanceof InnocuousThread)
                 ? (InnocuousThread) t
@@ -147,10 +149,9 @@
                 if (ref != null) {
                     ref.clean();
                 }
-            } catch (InterruptedException i) {
-                continue;   // ignore the interruption
             } catch (Throwable e) {
                 // ignore exceptions from the cleanup action
+                // (including interruption of cleanup thread)
             }
         }
     }
@@ -320,14 +321,32 @@
             return factory;
         }
 
+        final AtomicInteger cleanerThreadNumber = new AtomicInteger();
+
         public Thread newThread(Runnable r) {
-            return AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
-                Thread t = new InnocuousThread(r);
-                t.setPriority(Thread.MAX_PRIORITY - 2);
-                t.setName("Cleaner-" + t.getId());
-                return t;
+            return AccessController.doPrivileged(new PrivilegedAction<Thread>() {
+                @Override
+                public Thread run() {
+                    Thread t = new InnocuousThread(r);
+                    t.setPriority(Thread.MAX_PRIORITY - 2);
+                    t.setName("Cleaner-" + cleanerThreadNumber.getAndIncrement());
+                    return t;
+                }
             });
         }
     }
 
+    /**
+     * A PhantomCleanable implementation for tracking the Cleaner itself.
+     */
+    static final class CleanerCleanable extends PhantomCleanable<Cleaner> {
+        CleanerCleanable(Cleaner cleaner) {
+            super(cleaner, cleaner);
+        }
+
+        @Override
+        protected void performCleanup() {
+            // no action
+        }
+    }
 }
--- a/src/java.base/share/classes/sun/misc/ASCIICaseInsensitiveComparator.java	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2002, 2004, 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;
-
-import java.util.Comparator;
-
-/** Implements a locale and case insensitive comparator suitable for
-    strings that are known to only contain ASCII characters. Some
-    tables internal to the JDK contain only ASCII data and are using
-    the "generalized" java.lang.String case-insensitive comparator
-    which converts each character to both upper and lower case. */
-
-public class ASCIICaseInsensitiveComparator implements Comparator<String> {
-    public static final Comparator<String> CASE_INSENSITIVE_ORDER =
-        new ASCIICaseInsensitiveComparator();
-
-    public int compare(String s1, String s2) {
-        int n1=s1.length(), n2=s2.length();
-        int minLen = n1 < n2 ? n1 : n2;
-        for (int i=0; i < minLen; i++) {
-            char c1 = s1.charAt(i);
-            char c2 = s2.charAt(i);
-            assert c1 <= '\u007F' && c2 <= '\u007F';
-            if (c1 != c2) {
-                c1 = (char)toLower(c1);
-                c2 = (char)toLower(c2);
-                if (c1 != c2) {
-                    return c1 - c2;
-                }
-            }
-        }
-        return n1 - n2;
-    }
-
-    /**
-     * A case insensitive hash code method to go with the case insensitive
-     * compare() method.
-     *
-     * Returns a hash code for this ASCII string as if it were lower case.
-     *
-     * returns same answer as:<p>
-     * <code>s.toLowerCase(Locale.US).hashCode();</code><p>
-     * but does not allocate memory (it does NOT have the special
-     * case Turkish rules).
-     *
-     * @param s a String to compute the hashcode on.
-     * @return  a hash code value for this object.
-     */
-    public static int lowerCaseHashCode(String s) {
-        int h = 0;
-        int len = s.length();
-
-        for (int i = 0; i < len; i++) {
-            h = 31*h + toLower(s.charAt(i));
-        }
-
-        return h;
-    }
-
-    /* If java.util.regex.ASCII ever becomes public or sun.*, use its code instead:*/
-    static boolean isLower(int ch) {
-        return ((ch-'a')|('z'-ch)) >= 0;
-    }
-
-    static boolean isUpper(int ch) {
-        return ((ch-'A')|('Z'-ch)) >= 0;
-    }
-
-    static int toLower(int ch) {
-        return isUpper(ch) ? (ch + 0x20) : ch;
-    }
-
-    static int toUpper(int ch) {
-        return isLower(ch) ? (ch - 0x20) : ch;
-    }
-}
--- a/src/java.base/share/classes/sun/nio/ch/IOVecWrapper.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/sun/nio/ch/IOVecWrapper.java	Mon Mar 14 20:53:59 2016 -0700
@@ -26,7 +26,7 @@
 package sun.nio.ch;
 
 import java.nio.ByteBuffer;
-import jdk.internal.ref.Cleaner;
+import jdk.internal.ref.CleanerFactory;
 
 
 /**
@@ -101,7 +101,7 @@
         }
         if (wrapper == null) {
             wrapper = new IOVecWrapper(size);
-            Cleaner.create(wrapper, new Deallocator(wrapper.vecArray));
+            CleanerFactory.cleaner().register(wrapper, new Deallocator(wrapper.vecArray));
             cached.set(wrapper);
         }
         return wrapper;
--- a/src/java.base/share/classes/sun/nio/ch/Util.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/sun/nio/ch/Util.java	Mon Mar 14 20:53:59 2016 -0700
@@ -33,7 +33,6 @@
 import java.security.PrivilegedAction;
 import java.util.*;
 import jdk.internal.misc.Unsafe;
-import jdk.internal.ref.Cleaner;
 import sun.security.action.GetPropertyAction;
 
 
--- a/src/java.base/share/classes/sun/nio/fs/NativeBuffer.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/sun/nio/fs/NativeBuffer.java	Mon Mar 14 20:53:59 2016 -0700
@@ -71,8 +71,8 @@
         return size;
     }
 
-    Cleaner cleaner() {
-        return cleaner;
+    void free() {
+        cleaner.clean();
     }
 
     // not synchronized; only safe for use by thread-local caches
--- a/src/java.base/share/classes/sun/nio/fs/NativeBuffers.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/sun/nio/fs/NativeBuffers.java	Mon Mar 14 20:53:59 2016 -0700
@@ -107,14 +107,14 @@
         for (int i=0; i<TEMP_BUF_POOL_SIZE; i++) {
             NativeBuffer existing = buffers[i];
             if (existing.size() < buffer.size()) {
-                existing.cleaner().clean();
+                existing.free();
                 buffers[i] = buffer;
                 return;
             }
         }
 
         // free it
-        buffer.cleaner().clean();
+        buffer.free();
     }
 
     /**
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -700,7 +700,7 @@
      *      OCSP response data is provided.
      */
     CertificateStatus(StatusRequestType type, X509Certificate[] chain,
-            Map<X509Certificate, byte[]> responses) throws SSLException {
+            Map<X509Certificate, byte[]> responses) {
         statusType = type;
         encodedResponsesLen = 0;
         encodedResponses = new ArrayList<>(chain.length);
@@ -715,7 +715,7 @@
                 encodedResponses.add(respDER);
                 encodedResponsesLen = 3 + respDER.length;
             } else {
-                throw new SSLHandshakeException("Zero-length or null " +
+                throw new IllegalArgumentException("Zero-length or null " +
                         "OCSP Response");
             }
         } else if (statusType == StatusRequestType.OCSP_MULTI) {
@@ -732,8 +732,8 @@
                 }
             }
         } else {
-            throw new SSLHandshakeException("Unsupported StatusResponseType: " +
-                    statusType);
+            throw new IllegalArgumentException(
+                    "Unsupported StatusResponseType: " + statusType);
         }
     }
 
--- a/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java	Mon Mar 14 20:53:59 2016 -0700
@@ -36,7 +36,6 @@
 import java.math.BigInteger;
 
 import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
 import javax.net.ssl.*;
 
 import sun.security.action.GetLongAction;
@@ -67,7 +66,6 @@
 
     // our authentication info
     private X509Certificate[]   certs;
-    private Map<X509Certificate, byte[]> responseMap;
     private PrivateKey          privateKey;
 
     private Object              serviceCreds;
@@ -118,7 +116,6 @@
                     LegacyAlgorithmConstraints.PROPERTY_TLS_LEGACY_ALGS,
                     new SSLAlgorithmDecomposer());
 
-    private boolean staplingActive = false;
     private long statusRespTimeout;
 
     static {
@@ -578,16 +575,6 @@
             }
         }
 
-        // Check if the client has asserted the status_request[_v2] extension(s)
-        CertStatusReqExtension statReqExt = (CertStatusReqExtension)
-                    mesg.extensions.get(ExtensionType.EXT_STATUS_REQUEST);
-        CertStatusReqListV2Extension statReqExtV2 =
-                (CertStatusReqListV2Extension)mesg.extensions.get(
-                        ExtensionType.EXT_STATUS_REQUEST_V2);
-        // Keep stapling active if at least one of the extensions has been set
-        staplingActive = sslContext.isStaplingEnabled(false) &&
-                (statReqExt != null || statReqExtV2 != null);
-
         /*
          * FIRST, construct the ServerHello using the options and priorities
          * from the ClientHello.  Update the (pending) cipher spec as we do
@@ -883,79 +870,17 @@
             m1.extensions.add(maxFragLenExt);
         }
 
-        StatusRequestType statReqType = null;
-        StatusRequest statReqData = null;
-        if (staplingActive && !resumingSession) {
-            ExtensionType statusRespExt = ExtensionType.EXT_STATUS_REQUEST;
-
-            // Determine which type of stapling we are doing and assert the
-            // proper extension in the server hello.
-            // Favor status_request_v2 over status_request and ocsp_multi
-            // over ocsp.
-            // If multiple ocsp or ocsp_multi types exist, select the first
-            // instance of a given type
-            if (statReqExtV2 != null) {             // RFC 6961 stapling
-                statusRespExt = ExtensionType.EXT_STATUS_REQUEST_V2;
-                List<CertStatusReqItemV2> reqItems =
-                        statReqExtV2.getRequestItems();
-                int ocspIdx = -1;
-                int ocspMultiIdx = -1;
-                for (int pos = 0; pos < reqItems.size(); pos++) {
-                    CertStatusReqItemV2 item = reqItems.get(pos);
-                    if (ocspIdx < 0 && item.getType() ==
-                            StatusRequestType.OCSP) {
-                        ocspIdx = pos;
-                    } else if (ocspMultiIdx < 0 && item.getType() ==
-                            StatusRequestType.OCSP_MULTI) {
-                        ocspMultiIdx = pos;
-                    }
-                }
-                if (ocspMultiIdx >= 0) {
-                    statReqType = reqItems.get(ocspMultiIdx).getType();
-                    statReqData = reqItems.get(ocspMultiIdx).getRequest();
-                } else if (ocspIdx >= 0) {
-                    statReqType = reqItems.get(ocspIdx).getType();
-                    statReqData = reqItems.get(ocspIdx).getRequest();
-                } else {
-                    // Some unknown type.  We will not do stapling for
-                    // this connection since we cannot understand the
-                    // requested type.
-                    staplingActive = false;
-                }
-            } else {                                // RFC 6066 stapling
-                statReqType = StatusRequestType.OCSP;
-                statReqData = statReqExt.getRequest();
-            }
-
-            if (statReqType != null && statReqData != null) {
-                StatusResponseManager statRespMgr =
-                        sslContext.getStatusResponseManager();
-                if (statRespMgr != null) {
-                    responseMap = statRespMgr.get(statReqType, statReqData,
-                            certs, statusRespTimeout, TimeUnit.MILLISECONDS);
-                    if (!responseMap.isEmpty()) {
-                        // We now can safely assert status_request[_v2] in our
-                        // ServerHello, and know for certain that we can provide
-                        // responses back to this client for this connection.
-                        if (statusRespExt == ExtensionType.EXT_STATUS_REQUEST) {
-                            m1.extensions.add(new CertStatusReqExtension());
-                        } else if (statusRespExt ==
-                                ExtensionType.EXT_STATUS_REQUEST_V2) {
-                            m1.extensions.add(
-                                    new CertStatusReqListV2Extension());
-                        }
-                    }
-                } else {
-                    // This should not happen if stapling is active, but
-                    // if lazy initialization of the StatusResponseManager
-                    // doesn't occur we should turn off stapling.
-                    if (debug != null && Debug.isOn("handshake")) {
-                        System.out.println("Warning: lazy initialization " +
-                                "of the StatusResponseManager failed.  " +
-                                "Stapling has been disabled.");
-                        staplingActive = false;
-                    }
-                }
+        StaplingParameters staplingParams = processStapling(mesg);
+        if (staplingParams != null) {
+            // We now can safely assert status_request[_v2] in our
+            // ServerHello, and know for certain that we can provide
+            // responses back to this client for this connection.
+            if (staplingParams.statusRespExt ==
+                    ExtensionType.EXT_STATUS_REQUEST) {
+                m1.extensions.add(new CertStatusReqExtension());
+            } else if (staplingParams.statusRespExt ==
+                    ExtensionType.EXT_STATUS_REQUEST_V2) {
+                m1.extensions.add(new CertStatusReqListV2Extension());
             }
         }
 
@@ -1031,24 +956,15 @@
          * supports status stapling and there is at least one response to
          * return to the client.
          */
-        if (staplingActive && !responseMap.isEmpty()) {
-            try {
-                CertificateStatus csMsg = new CertificateStatus(statReqType,
-                        certs, responseMap);
-                if (debug != null && Debug.isOn("handshake")) {
-                    csMsg.print(System.out);
-                }
-                csMsg.write(output);
-                handshakeState.update(csMsg, resumingSession);
-                responseMap = null;
-            } catch (SSLException ssle) {
-                // We don't want the exception to be fatal, we just won't
-                // send the message if we fail on construction.
-                if (debug != null && Debug.isOn("handshake")) {
-                    System.out.println("Failed during CertificateStatus " +
-                            "construction: " + ssle);
-                }
+        if (staplingParams != null) {
+            CertificateStatus csMsg = new CertificateStatus(
+                    staplingParams.statReqType, certs,
+                    staplingParams.responseMap);
+            if (debug != null && Debug.isOn("handshake")) {
+                csMsg.print(System.out);
             }
+            csMsg.write(output);
+            handshakeState.update(csMsg, resumingSession);
         }
 
         /*
@@ -2078,4 +1994,121 @@
 
         session.setPeerCertificates(peerCerts);
     }
+
+    private StaplingParameters processStapling(ClientHello mesg) {
+        StaplingParameters params = null;
+        ExtensionType ext;
+        StatusRequestType type = null;
+        StatusRequest req = null;
+        Map<X509Certificate, byte[]> responses;
+
+        // If this feature has not been enabled, then no more processing
+        // is necessary.  Also we will only staple if we're doing a full
+        // handshake.
+        if (!sslContext.isStaplingEnabled(false) || resumingSession) {
+            return null;
+        }
+
+        // Check if the client has asserted the status_request[_v2] extension(s)
+        CertStatusReqExtension statReqExt = (CertStatusReqExtension)
+                    mesg.extensions.get(ExtensionType.EXT_STATUS_REQUEST);
+        CertStatusReqListV2Extension statReqExtV2 =
+                (CertStatusReqListV2Extension)mesg.extensions.get(
+                        ExtensionType.EXT_STATUS_REQUEST_V2);
+        // Keep processing only if either status_request or status_request_v2
+        // has been sent in the ClientHello.
+        if (statReqExt == null && statReqExtV2 == null) {
+            return null;
+        }
+
+        // Determine which type of stapling we are doing and assert the
+        // proper extension in the server hello.
+        // Favor status_request_v2 over status_request and ocsp_multi
+        // over ocsp.
+        // If multiple ocsp or ocsp_multi types exist, select the first
+        // instance of a given type
+        ext = ExtensionType.EXT_STATUS_REQUEST;
+        if (statReqExtV2 != null) {             // RFC 6961 stapling
+            ext = ExtensionType.EXT_STATUS_REQUEST_V2;
+            List<CertStatusReqItemV2> reqItems =
+                    statReqExtV2.getRequestItems();
+            int ocspIdx = -1;
+            int ocspMultiIdx = -1;
+            for (int pos = 0; pos < reqItems.size(); pos++) {
+                CertStatusReqItemV2 item = reqItems.get(pos);
+                if (ocspIdx < 0 && item.getType() ==
+                        StatusRequestType.OCSP) {
+                    ocspIdx = pos;
+                } else if (ocspMultiIdx < 0 && item.getType() ==
+                        StatusRequestType.OCSP_MULTI) {
+                    ocspMultiIdx = pos;
+                }
+            }
+            if (ocspMultiIdx >= 0) {
+                type = reqItems.get(ocspMultiIdx).getType();
+                req = reqItems.get(ocspMultiIdx).getRequest();
+            } else if (ocspIdx >= 0) {
+                type = reqItems.get(ocspIdx).getType();
+                req = reqItems.get(ocspIdx).getRequest();
+            }
+        } else {                                // RFC 6066 stapling
+            type = StatusRequestType.OCSP;
+            req = statReqExt.getRequest();
+        }
+
+        // If, after walking through the extensions we were unable to
+        // find a suitable StatusRequest, then stapling is disabled.
+        // Both statReqType and statReqData must have been set to continue.
+        if (type == null || req == null) {
+            return null;
+        }
+
+        // Get the OCSP responses from the StatusResponseManager
+        StatusResponseManager statRespMgr =
+                sslContext.getStatusResponseManager();
+        if (statRespMgr != null) {
+            responses = statRespMgr.get(type, req, certs, statusRespTimeout,
+                    TimeUnit.MILLISECONDS);
+            if (!responses.isEmpty()) {
+                // If this RFC 6066-style stapling (SSL cert only) then the
+                // response cannot be zero length
+                if (type == StatusRequestType.OCSP) {
+                    byte[] respDER = responses.get(certs[0]);
+                    if (respDER == null || respDER.length <= 0) {
+                        return null;
+                    }
+                }
+                params = new StaplingParameters(ext, type, req, responses);
+            }
+        } else {
+            // This should not happen, but if lazy initialization of the
+            // StatusResponseManager doesn't occur we should turn off stapling.
+            if (debug != null && Debug.isOn("handshake")) {
+                System.out.println("Warning: lazy initialization " +
+                        "of the StatusResponseManager failed.  " +
+                        "Stapling has been disabled.");
+            }
+        }
+
+        return params;
+    }
+
+    /**
+     * Inner class used to hold stapling parameters needed by the handshaker
+     * when stapling is active.
+     */
+    private class StaplingParameters {
+        private final ExtensionType statusRespExt;
+        private final StatusRequestType statReqType;
+        private final StatusRequest statReqData;
+        private final Map<X509Certificate, byte[]> responseMap;
+
+        StaplingParameters(ExtensionType ext, StatusRequestType type,
+                StatusRequest req, Map<X509Certificate, byte[]> responses) {
+            statusRespExt = ext;
+            statReqType = type;
+            statReqData = req;
+            responseMap = responses;
+        }
+    }
 }
--- a/src/java.base/share/native/include/jni.h	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/share/native/include/jni.h	Mon Mar 14 20:53:59 2016 -0700
@@ -1977,6 +1977,7 @@
 #define JNI_VERSION_1_4 0x00010004
 #define JNI_VERSION_1_6 0x00010006
 #define JNI_VERSION_1_8 0x00010008
+#define JNI_VERSION_9   0x00090000
 
 #ifdef __cplusplus
 } /* extern "C" */
--- a/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java	Mon Mar 14 20:53:59 2016 -0700
@@ -463,7 +463,7 @@
             }
             CloseHandle(key.handle());
             closeAttachedEvent(key.overlappedAddress());
-            key.buffer().cleaner().clean();
+            key.buffer().free();
         }
 
         /**
--- a/src/java.base/windows/native/libjava/java_props_md.c	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.base/windows/native/libjava/java_props_md.c	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -469,7 +469,9 @@
          * Windows Server 2008 R2       6               1  (!VER_NT_WORKSTATION)
          * Windows 8                    6               2  (VER_NT_WORKSTATION)
          * Windows Server 2012          6               2  (!VER_NT_WORKSTATION)
+         * Windows Server 2012 R2       6               3  (!VER_NT_WORKSTATION)
          * Windows 10                   10              0  (VER_NT_WORKSTATION)
+         * Windows Server 2016          10              0  (!VER_NT_WORKSTATION)
          *
          * This mapping will presumably be augmented as new Windows
          * versions are released.
@@ -543,6 +545,7 @@
                     }
                 } else {
                     switch (minorVersion) {
+                    case  0: sprops.os_name = "Windows Server 2016";           break;
                     default: sprops.os_name = "Windows NT (unknown)";
                     }
                 }
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameBorder.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameBorder.java	Mon Mar 14 20:53:59 2016 -0700
@@ -40,6 +40,7 @@
 
 import com.apple.laf.AquaUtils.RecyclableSingleton;
 import com.apple.laf.AquaInternalFrameBorderMetrics;
+import java.awt.geom.AffineTransform;
 
 public class AquaInternalFrameBorder implements Border, UIResource {
     private static final int kCloseButton = 0;
@@ -309,18 +310,40 @@
         return isInsideYButtonArea(i, y) && x >= startX && x <= endX;
     }
 
-    protected void paintTitleIcon(final Graphics g, final JInternalFrame frame, final int x, final int y) {
+    protected void paintTitleIcon(final Graphics g, final JInternalFrame frame,
+            final int x, final int y) {
+
         Icon icon = frame.getFrameIcon();
-        if (icon == null) icon = UIManager.getIcon("InternalFrame.icon");
-        if (icon == null) return;
-
-        // Resize to 16x16 if necessary.
-        if (icon instanceof ImageIcon && (icon.getIconWidth() > sMaxIconWidth || icon.getIconHeight() > sMaxIconHeight)) {
-            final Image img = ((ImageIcon)icon).getImage();
-            ((ImageIcon)icon).setImage(img.getScaledInstance(sMaxIconWidth, sMaxIconHeight, Image.SCALE_SMOOTH));
+        if (icon == null) {
+            icon = UIManager.getIcon("InternalFrame.icon");
         }
 
-        icon.paintIcon(frame, g, x, y);
+        if (icon == null) {
+            return;
+        }
+
+        if (icon.getIconWidth() > sMaxIconWidth
+                || icon.getIconHeight() > sMaxIconHeight) {
+            final Graphics2D g2 = (Graphics2D) g;
+            final AffineTransform savedAT = g2.getTransform();
+            double xScaleFactor = (double) sMaxIconWidth / icon.getIconWidth();
+            double yScaleFactor = (double) sMaxIconHeight / icon.getIconHeight();
+
+            //Coordinates are after a translation hence relative origin shifts
+            g2.translate(x, y);
+
+            //scaling factor is needed to scale while maintaining aspect ratio
+            double scaleMaintainAspectRatio = Math.min(xScaleFactor, yScaleFactor);
+
+            //minimum value is taken to set to a maximum Icon Dimension
+            g2.scale(scaleMaintainAspectRatio, scaleMaintainAspectRatio);
+
+            icon.paintIcon(frame, g2, 0, 0);
+            g2.setTransform(savedAT);
+
+        } else {
+            icon.paintIcon(frame, g, x, y);
+        }
     }
 
     protected int getIconWidth(final JInternalFrame frame) {
@@ -330,9 +353,7 @@
         if (icon == null) {
             icon = UIManager.getIcon("InternalFrame.icon");
         }
-
-        if (icon != null && icon instanceof ImageIcon) {
-            // Resize to 16x16 if necessary.
+        if (icon != null) {
             width = Math.min(icon.getIconWidth(), sMaxIconWidth);
         }
 
@@ -346,9 +367,7 @@
         if (icon == null) {
             icon = UIManager.getIcon("InternalFrame.icon");
         }
-
-        if (icon != null && icon instanceof ImageIcon) {
-            // Resize to 16x16 if necessary.
+        if (icon != null) {
             height = Math.min(icon.getIconHeight(), sMaxIconHeight);
         }
 
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaTableHeaderUI.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaTableHeaderUI.java	Mon Mar 14 20:53:59 2016 -0700
@@ -128,14 +128,17 @@
             // Modify the table "border" to draw smaller, and with the titles in the right position
             // and sort indicators, just like an NSSave/Open panel.
             final AquaTableHeaderBorder cellBorder = AquaTableHeaderBorder.getListHeaderBorder();
-            final boolean thisColumnSelected = localTable.getColumnModel().getColumn(column).getModelIndex() == sortColumn;
+            cellBorder.setSortOrder(AquaTableHeaderBorder.SORT_NONE);
 
-            cellBorder.setSelected(thisColumnSelected);
-            if (thisColumnSelected) {
-                cellBorder.setSortOrder(sortOrder);
-            } else {
-                cellBorder.setSortOrder(AquaTableHeaderBorder.SORT_NONE);
+            if (localTable != null) {
+                final boolean thisColumnSelected = localTable.getColumnModel().getColumn(column).getModelIndex() == sortColumn;
+
+                cellBorder.setSelected(thisColumnSelected);
+                if (thisColumnSelected) {
+                    cellBorder.setSortOrder(sortOrder);
+               }
             }
+
             setBorder(cellBorder);
             return this;
         }
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m	Mon Mar 14 20:53:59 2016 -0700
@@ -134,7 +134,7 @@
     {0x3D, NO,  KL_UNKNOWN,  java_awt_event_KeyEvent_VK_UNDEFINED},
     {0x3E, NO,  KL_UNKNOWN,  java_awt_event_KeyEvent_VK_UNDEFINED},
     {0x3F, NO,  KL_UNKNOWN,  java_awt_event_KeyEvent_VK_UNDEFINED}, // the 'fn' key on PowerBooks
-    {0x40, NO,  KL_UNKNOWN,  java_awt_event_KeyEvent_VK_UNDEFINED},
+    {0x40, NO,  KL_STANDARD, java_awt_event_KeyEvent_VK_F17},
     {0x41, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_DECIMAL},
     {0x42, NO,  KL_UNKNOWN,  java_awt_event_KeyEvent_VK_UNDEFINED},
     {0x43, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_MULTIPLY},
@@ -149,8 +149,8 @@
     {0x4C, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_ENTER},
     {0x4D, NO,  KL_UNKNOWN,  java_awt_event_KeyEvent_VK_UNDEFINED},
     {0x4E, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_SUBTRACT},
-    {0x4F, NO,  KL_UNKNOWN,  java_awt_event_KeyEvent_VK_UNDEFINED},
-    {0x50, NO,  KL_UNKNOWN,  java_awt_event_KeyEvent_VK_UNDEFINED},
+    {0x4F, NO,  KL_STANDARD, java_awt_event_KeyEvent_VK_F18},
+    {0x50, NO,  KL_STANDARD, java_awt_event_KeyEvent_VK_F19},
     {0x51, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_EQUALS},
     {0x52, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_NUMPAD0},
     {0x53, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_NUMPAD1},
@@ -160,7 +160,7 @@
     {0x57, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_NUMPAD5},
     {0x58, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_NUMPAD6},
     {0x59, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_NUMPAD7},
-    {0x5A, NO,  KL_UNKNOWN,  java_awt_event_KeyEvent_VK_UNDEFINED},
+    {0x5A, NO,  KL_STANDARD, java_awt_event_KeyEvent_VK_F20},
     {0x5B, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_NUMPAD8},
     {0x5C, YES, KL_NUMPAD,   java_awt_event_KeyEvent_VK_NUMPAD9},
     {0x5D, YES, KL_STANDARD, java_awt_event_KeyEvent_VK_BACK_SLASH}, // This is a combo yen/backslash on JIS keyboards.
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -624,7 +624,8 @@
 {
     NSString *selectedText = [self accessibleSelectedText];
     NSAttributedString *styledText = [[NSAttributedString alloc] initWithString:selectedText];
-    NSData *rtfdData = [styledText RTFDFromRange:NSMakeRange(0, [styledText length]) documentAttributes:nil];
+    NSData *rtfdData = [styledText RTFDFromRange:NSMakeRange(0, [styledText length])
+                              documentAttributes:@{NSDocumentTypeDocumentAttribute: NSRTFTextDocumentType}];
     [styledText release];
     return rtfdData;
 }
@@ -681,7 +682,7 @@
     if ([[pboard types] containsObject:NSRTFDPboardType])
     {
         NSData *rtfdData = [pboard dataForType:NSRTFDPboardType];
-        NSAttributedString *styledText = [[NSAttributedString alloc] initWithRTFD:rtfdData documentAttributes:nil];
+        NSAttributedString *styledText = [[NSAttributedString alloc] initWithRTFD:rtfdData documentAttributes:NULL];
         NSString *text = [styledText string];
         [styledText release];
 
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -743,9 +743,10 @@
 JNIEXPORT jint JNICALL DEF_JNI_OnLoad(JavaVM *vm, void *reserved) {
     OSXAPP_SetJavaVM(vm);
 
-    // We need to let Foundation know that this is a multithreaded application, if it isn't already.
+    // We need to let Foundation know that this is a multithreaded application,
+    // if it isn't already.
     if (![NSThread isMultiThreaded]) {
-        [NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
+        [[[[NSThread alloc] init] autorelease] start];
     }
 
     return JNI_VERSION_1_4;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/macosx/native/libosx/CFileManager.m	Mon Mar 14 20:53:59 2016 -0700
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+#import "com_apple_eio_FileManager.h"
+
+#import <Cocoa/Cocoa.h>
+#import <JavaNativeFoundation/JavaNativeFoundation.h>
+
+#import "ThreadUtilities.h"
+
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    _setFileTypeAndCreator
+ * Signature: (Ljava/lang/String;II)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileTypeAndCreator
+(JNIEnv *env, jclass clz, jstring javaFilename, jint type, jint creator)
+{
+JNF_COCOA_ENTER(env);
+        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+        NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys:
+                                                        [NSNumber numberWithInt:type], NSFileHFSTypeCode,
+                                                        [NSNumber numberWithInt:creator], NSFileHFSCreatorCode, nil];
+    [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    _setFileType
+ * Signature: (Ljava/lang/String;I)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileType
+(JNIEnv *env, jclass ckz, jstring javaFilename, jint type)
+{
+JNF_COCOA_ENTER(env);
+        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+        NSDictionary *attr = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:type] forKey:NSFileHFSTypeCode];
+    [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    _setFileCreator
+ * Signature: (Ljava/lang/String;I)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileCreator
+(JNIEnv *env, jclass clz, jstring javaFilename, jint creator)
+{
+JNF_COCOA_ENTER(env);
+        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+        NSDictionary *attr = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:creator] forKey:NSFileHFSCreatorCode];
+    [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    _getFileType
+ * Signature: (Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_com_apple_eio_FileManager__1getFileType
+(JNIEnv *env, jclass clz, jstring javaFilename)
+{
+    jint type = 0;
+JNF_COCOA_ENTER(env);
+        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+    NSDictionary *attributes = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
+    NSNumber *val = [attributes objectForKey:NSFileHFSTypeCode];
+    type = [val intValue];
+JNF_COCOA_EXIT(env);
+    return type;
+}
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    _getFileCreator
+ * Signature: (Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_com_apple_eio_FileManager__1getFileCreator
+  (JNIEnv *env, jclass clz, jstring javaFilename)
+{
+    jint creator = 0;
+JNF_COCOA_ENTER(env);
+        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
+    NSDictionary *attributes = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
+    NSNumber *val = [attributes objectForKey:NSFileHFSCreatorCode];
+    creator = [val intValue];
+JNF_COCOA_EXIT(env);
+    return creator;
+}
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    _findFolder
+ * Signature: (SIZ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager__1findFolder__SIZ
+(JNIEnv *env, jclass clz, jshort domain, jint folderType, jboolean createIfNeeded)
+{
+    jstring filename = nil;
+JNF_COCOA_ENTER(env);
+
+    FSRef foundRef;
+    createIfNeeded = createIfNeeded || (folderType == kTemporaryFolderType) || (folderType == kChewableItemsFolderType);
+    if (FSFindFolder((SInt16)domain, (OSType)folderType, (Boolean)createIfNeeded, &foundRef) == noErr) {
+        char path[PATH_MAX];
+        if (FSRefMakePath(&foundRef, (UInt8 *)path, sizeof(path)) == noErr) {
+            NSString *filenameString = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path length:strlen(path)];
+            filename = JNFNormalizedJavaStringForPath(env, filenameString);
+        }
+    }
+
+JNF_COCOA_EXIT(env);
+    return filename;
+}
+
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    _openURL
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1openURL
+(JNIEnv *env, jclass clz, jstring urlString)
+{
+JNF_COCOA_ENTER(env);
+
+    NSURL *url = [NSURL URLWithString:JNFNormalizedNSStringForPath(env, urlString)];
+
+        // Radar 3208005: Run this on the main thread; file:// style URLs will hang otherwise.
+    [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
+        [[NSWorkspace sharedWorkspace] openURL:url];
+    }];
+
+JNF_COCOA_EXIT(env);
+}
+
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    getNativeResourceFromBundle
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager_getNativeResourceFromBundle
+(JNIEnv *env, jclass clz, jstring javaResourceName, jstring javaSubDirName, jstring javaTypeName)
+{
+    jstring filename = NULL;
+JNF_COCOA_ENTER(env);
+
+    NSString *resourceName = JNFNormalizedNSStringForPath(env, javaResourceName);
+        NSString *subDirectory = JNFNormalizedNSStringForPath(env, javaSubDirName);
+        NSString *typeName = JNFNormalizedNSStringForPath(env, javaTypeName);
+
+    NSString *path = [[NSBundle mainBundle] pathForResource:resourceName
+                                                     ofType:typeName
+                                                inDirectory:subDirectory];
+
+    filename = JNFNormalizedJavaStringForPath(env, path);
+
+JNF_COCOA_EXIT(env);
+    return filename;
+}
+
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    getNativePathToApplicationBundle
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager_getNativePathToApplicationBundle
+(JNIEnv *env, jclass clazz)
+{
+        jstring filename = nil;
+JNF_COCOA_ENTER(env);
+
+        NSBundle *mainBundle = [NSBundle mainBundle];
+        filename = JNFNormalizedJavaStringForPath(env, [mainBundle bundlePath]);
+
+JNF_COCOA_EXIT(env);
+        return filename;
+}
+
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    __moveToTrash
+ * Signature: (Ljava/lang/String;)V
+ */
+
+JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1moveToTrash
+(JNIEnv *env, jclass clz, jstring fileName)
+{
+    __block BOOL returnValue = NO;
+JNF_COCOA_ENTER(env);
+
+    NSString * path = JNFNormalizedNSStringForPath(env, fileName);
+    NSURL *url = [NSURL fileURLWithPath:path];
+    [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+
+        returnValue  = [[NSFileManager defaultManager] trashItemAtURL:url
+                                                     resultingItemURL:nil
+                                                                error:nil];
+    }];
+
+JNF_COCOA_EXIT(env);
+
+        return returnValue ? JNI_TRUE: JNI_FALSE;
+}
+
+/*
+ * Class:     com_apple_eio_FileManager
+ * Method:    __revealInFinder
+ * Signature: (Ljava/lang/String;)V
+ */
+
+JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1revealInFinder
+(JNIEnv *env, jclass clz, jstring url)
+{
+        __block jboolean returnValue = JNI_FALSE;
+JNF_COCOA_ENTER(env);
+
+    NSString *path = JNFNormalizedNSStringForPath(env, url);
+    [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+        returnValue = [[NSWorkspace sharedWorkspace] selectFile:path inFileViewerRootedAtPath:@""];
+    }];
+
+JNF_COCOA_EXIT(env);
+
+        return returnValue;
+}
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,16 +86,16 @@
 
     /**
      * Whether to write abbreviated JPEG streams (default == false).
-     * A subclass which sets this to <code>true</code> should also
+     * A subclass which sets this to {@code true} should also
      * initialized {@link #JPEGStreamMetadata}.
      */
     protected boolean writeAbbreviatedStream = false;
 
     /**
      * Stream metadata equivalent to a tables-only stream such as in
-     * the <code>JPEGTables</code>. Default value is <code>null</code>.
+     * the {@code JPEGTables}. Default value is {@code null}.
      * This should be set by any subclass which sets
-     * {@link writeAbbreviatedStream} to <code>true</code>.
+     * {@link writeAbbreviatedStream} to {@code true}.
      */
     protected IIOMetadata JPEGStreamMetadata = null;
 
@@ -108,15 +108,15 @@
     /**
      * Removes nonessential nodes from a JPEG native image metadata tree.
      * All nodes derived from JPEG marker segments other than DHT, DQT,
-     * SOF, SOS segments are removed unless <code>pruneTables</code> is
-     * <code>true</code> in which case the nodes derived from the DHT and
+     * SOF, SOS segments are removed unless {@code pruneTables} is
+     * {@code true} in which case the nodes derived from the DHT and
      * DQT marker segments are also removed.
      *
      * @param tree A <tt>javax_imageio_jpeg_image_1.0</tt> tree.
      * @param pruneTables Whether to prune Huffman and quantization tables.
-     * @throws NullPointerException if <code>tree</code> is
-     * <code>null</code>.
-     * @throws IllegalArgumentException if <code>tree</code> is not the root
+     * @throws NullPointerException if {@code tree} is
+     * {@code null}.
+     * @throws IllegalArgumentException if {@code tree} is not the root
      * of a JPEG native image metadata tree.
      */
     private static void pruneNodes(Node tree, boolean pruneTables) {
@@ -182,8 +182,8 @@
     }
 
     /**
-     * A <code>ByteArrayOutputStream</code> which allows writing to an
-     * <code>ImageOutputStream</code>.
+     * A {@code ByteArrayOutputStream} which allows writing to an
+     * {@code ImageOutputStream}.
      */
     private static class IIOByteArrayOutputStream extends ByteArrayOutputStream {
         IIOByteArrayOutputStream() {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,39 +31,39 @@
 public abstract class TIFFColorConverter {
 
     /**
-     * Constructs an instance of a <code>TIFFColorConverter</code>.
+     * Constructs an instance of a {@code TIFFColorConverter}.
      */
     public TIFFColorConverter() {}
 
     /**
      * Converts an RGB triple into the native color space of this
      * TIFFColorConverter, and stores the result in the first three
-     * entries of the <code>result</code> array.
+     * entries of the {@code result} array.
      *
      * @param r the red value.
      * @param g the green value.
      * @param b the blue value.
-     * @param result an array of <code>float</code>s containing three elements.
-     * @throws NullPointerException if <code>result</code> is
-     * <code>null</code>.
+     * @param result an array of {@code float}s containing three elements.
+     * @throws NullPointerException if {@code result} is
+     * {@code null}.
      * @throws ArrayIndexOutOfBoundsException if
-     * <code>result.length&nbsp;&lt;&nbsp;3</code>.
+     * {@code result.length&nbsp;&lt;&nbsp;3}.
      */
     public abstract void fromRGB(float r, float g, float b, float[] result);
 
     /**
      * Converts  a   triple  in  the   native  color  space   of  this
      * TIFFColorConverter into an RGB triple, and stores the result in
-     * the first three entries of the <code>rgb</code> array.
+     * the first three entries of the {@code rgb} array.
      *
      * @param x0 the value of channel 0.
      * @param x1 the value of channel 1.
      * @param x2 the value of channel 2.
-     * @param rgb an array of <code>float</code>s containing three elements.
-     * @throws NullPointerException if <code>rgb</code> is
-     * <code>null</code>.
+     * @param rgb an array of {@code float}s containing three elements.
+     * @throws NullPointerException if {@code rgb} is
+     * {@code null}.
      * @throws ArrayIndexOutOfBoundsException if
-     * <code>rgb.length&nbsp;&lt;&nbsp;3</code>.
+     * {@code rgb.length&nbsp;&lt;&nbsp;3}.
      */
     public abstract void toRGB(float x0, float x1, float x2, float[] rgb);
 }
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFCompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFCompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,13 +35,13 @@
 public abstract class TIFFCompressor {
 
     /**
-     * The <code>ImageWriter</code> calling this
-     * <code>TIFFCompressor</code>.
+     * The {@code ImageWriter} calling this
+     * {@code TIFFCompressor}.
      */
     protected ImageWriter writer;
 
     /**
-     * The <code>IIOMetadata</code> object containing metadata for the
+     * The {@code IIOMetadata} object containing metadata for the
      * current image.
      */
     protected IIOMetadata metadata;
@@ -63,7 +63,7 @@
     protected boolean isCompressionLossless;
 
     /**
-     * The <code>ImageOutputStream</code> to be written.
+     * The {@code ImageOutputStream} to be written.
      */
     protected ImageOutputStream stream;
 
@@ -75,26 +75,26 @@
      * to provide the implementation of the compression algorithm of an
      * unsupported compression type.
      *
-     * <p>The parameters <code>compressionTagValue</code> and
-     * <code>isCompressionLossless</code> are provided to accomodate
+     * <p>The parameters {@code compressionTagValue} and
+     * {@code isCompressionLossless} are provided to accomodate
      * compression types which are unknown. A compression type is
      * "known" if it is either among those already supported by the
      * TIFF writer (see {@link TIFFImageWriteParam}), or is listed in
      * the TIFF 6.0 specification but not supported. If the compression
-     * type is unknown, the <code>compressionTagValue</code> and
-     * <code>isCompressionLossless</code> parameters are ignored.</p>
+     * type is unknown, the {@code compressionTagValue} and
+     * {@code isCompressionLossless} parameters are ignored.</p>
      *
      * @param compressionType The name of the compression type.
      * @param compressionTagValue The value to be assigned to the TIFF
      * <i>Compression</i> tag in the TIFF image metadata; ignored if
-     * <code>compressionType</code> is a known type.
+     * {@code compressionType} is a known type.
      * @param isCompressionLossless Whether the compression is lossless;
-     * ignored if <code>compressionType</code> is a known type.
+     * ignored if {@code compressionType} is a known type.
      *
-     * @throws NullPointerException if <code>compressionType</code> is
-     * <code>null</code>.
-     * @throws IllegalArgumentException if <code>compressionTagValue</code> is
-     * less <code>1</code>.
+     * @throws NullPointerException if {@code compressionType} is
+     * {@code null}.
+     * @throws IllegalArgumentException if {@code compressionTagValue} is
+     * less {@code 1}.
      */
     public TIFFCompressor(String compressionType,
                           int compressionTagValue,
@@ -163,9 +163,9 @@
     }
 
     /**
-     * Sets the <code>ImageOutputStream</code> to be written.
+     * Sets the {@code ImageOutputStream} to be written.
      *
-     * @param stream an <code>ImageOutputStream</code> to be written.
+     * @param stream an {@code ImageOutputStream} to be written.
      *
      * @see #getStream
      */
@@ -174,9 +174,9 @@
     }
 
     /**
-     * Returns the <code>ImageOutputStream</code> that will be written.
+     * Returns the {@code ImageOutputStream} that will be written.
      *
-     * @return an <code>ImageOutputStream</code>.
+     * @return an {@code ImageOutputStream}.
      *
      * @see #setStream(ImageOutputStream)
      */
@@ -185,9 +185,9 @@
     }
 
     /**
-     * Sets the value of the <code>writer</code> field.
+     * Sets the value of the {@code writer} field.
      *
-     * @param writer the current <code>ImageWriter</code>.
+     * @param writer the current {@code ImageWriter}.
      *
      * @see #getWriter()
      */
@@ -196,9 +196,9 @@
     }
 
     /**
-     * Returns the current <code>ImageWriter</code>.
+     * Returns the current {@code ImageWriter}.
      *
-     * @return an <code>ImageWriter</code>.
+     * @return an {@code ImageWriter}.
      *
      * @see #setWriter(ImageWriter)
      */
@@ -207,9 +207,9 @@
     }
 
     /**
-     * Sets the value of the <code>metadata</code> field.
+     * Sets the value of the {@code metadata} field.
      *
-     * @param metadata the <code>IIOMetadata</code> object for the
+     * @param metadata the {@code IIOMetadata} object for the
      * image being written.
      *
      * @see #getMetadata()
@@ -219,9 +219,9 @@
     }
 
     /**
-     * Returns the current <code>IIOMetadata</code> object.
+     * Returns the current {@code IIOMetadata} object.
      *
-     * @return the <code>IIOMetadata</code> object for the image being
+     * @return the {@code IIOMetadata} object for the image being
      * written.
      *
      * @see #setMetadata(IIOMetadata)
@@ -232,15 +232,15 @@
 
     /**
      * Encodes the supplied image data, writing to the currently set
-     * <code>ImageOutputStream</code>.
+     * {@code ImageOutputStream}.
      *
-     * @param b an array of <code>byte</code>s containing the packed
+     * @param b an array of {@code byte}s containing the packed
      * but uncompressed image data.
      * @param off the starting offset of the data to be written in the
-     * array <code>b</code>.
+     * array {@code b}.
      * @param width the width of the rectangle of pixels to be written.
      * @param height the height of the rectangle of pixels to be written.
-     * @param bitsPerSample an array of <code>int</code>s indicting
+     * @param bitsPerSample an array of {@code int}s indicting
      * the number of bits used to represent each image sample within
      * a pixel.
      * @param scanlineStride the number of bytes separating each
@@ -249,7 +249,7 @@
      * @return the number of bytes written.
      *
      * @throws IOException if the supplied data cannot be encoded by
-     * this <code>TIFFCompressor</code>, or if any I/O error occurs
+     * this {@code TIFFCompressor}, or if any I/O error occurs
      * during writing.
      */
     public abstract int encode(byte[] b, int off,
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,7 @@
  *
  * <p> Decompressors may be written with various levels of complexity.
  * The most complex decompressors will override the
- * <code>decode</code> method, and will perform all the work of
+ * {@code decode} method, and will perform all the work of
  * decoding, subsampling, offsetting, clipping, and format conversion.
  * This approach may be the most efficient, since it is possible to
  * avoid the use of extra image buffers, and it may be possible to
@@ -89,35 +89,35 @@
  * the destination.
  *
  * <p> Less ambitious decompressors may override the
- * <code>decodeRaw</code> method, which is responsible for
+ * {@code decodeRaw} method, which is responsible for
  * decompressing the entire tile or strip into a byte array (or other
  * appropriate datatype).  The default implementation of
- * <code>decode</code> will perform all necessary setup of buffers,
- * call <code>decodeRaw</code> to perform the actual decoding, perform
+ * {@code decode} will perform all necessary setup of buffers,
+ * call {@code decodeRaw} to perform the actual decoding, perform
  * subsampling, and copy the results into the final destination image.
  * Where possible, it will pass the real image buffer to
- * <code>decodeRaw</code> in order to avoid making an extra copy.
+ * {@code decodeRaw} in order to avoid making an extra copy.
  *
  * <p> Slightly more ambitious decompressors may override
- * <code>decodeRaw</code>, but avoid writing pixels that will be
+ * {@code decodeRaw}, but avoid writing pixels that will be
  * discarded in the subsampling phase.
  */
 public abstract class TIFFDecompressor {
 
     /**
-     * The <code>ImageReader</code> calling this
-     * <code>TIFFDecompressor</code>.
+     * The {@code ImageReader} calling this
+     * {@code TIFFDecompressor}.
      */
     protected ImageReader reader;
 
     /**
-     * The <code>IIOMetadata</code> object containing metadata for the
+     * The {@code IIOMetadata} object containing metadata for the
      * current image.
      */
     protected IIOMetadata metadata;
 
     /**
-     * The value of the <code>PhotometricInterpretation</code> tag.
+     * The value of the {@code PhotometricInterpretation} tag.
      * Legal values are {@link
      * BaselineTIFFTagSet#PHOTOMETRIC_INTERPRETATION_WHITE_IS_ZERO },
      * {@link
@@ -135,7 +135,7 @@
     protected int photometricInterpretation;
 
     /**
-     * The value of the <code>Compression</code> tag. Legal values are
+     * The value of the {@code Compression} tag. Legal values are
      * {@link BaselineTIFFTagSet#COMPRESSION_NONE}, {@link
      * BaselineTIFFTagSet#COMPRESSION_CCITT_RLE}, {@link
      * BaselineTIFFTagSet#COMPRESSION_CCITT_T_4}, {@link
@@ -151,23 +151,23 @@
     protected int compression;
 
     /**
-     * <code>true</code> if the image is encoded using separate planes.
+     * {@code true} if the image is encoded using separate planes.
      */
     protected boolean planar;
 
     /**
-     * The value of the <code>SamplesPerPixel</code> tag.
+     * The value of the {@code SamplesPerPixel} tag.
      */
     protected int samplesPerPixel;
 
     /**
-     * The value of the <code>BitsPerSample</code> tag.
+     * The value of the {@code BitsPerSample} tag.
      *
      */
     protected int[] bitsPerSample;
 
     /**
-     * The value of the <code>SampleFormat</code> tag.  Legal values
+     * The value of the {@code SampleFormat} tag.  Legal values
      * are {@link BaselineTIFFTagSet#SAMPLE_FORMAT_UNSIGNED_INTEGER},
      * {@link BaselineTIFFTagSet#SAMPLE_FORMAT_SIGNED_INTEGER}, {@link
      * BaselineTIFFTagSet#SAMPLE_FORMAT_FLOATING_POINT}, {@link
@@ -178,7 +178,7 @@
         new int[] {BaselineTIFFTagSet.SAMPLE_FORMAT_UNSIGNED_INTEGER};
 
     /**
-     * The value of the <code>ExtraSamples</code> tag.  Legal values
+     * The value of the {@code ExtraSamples} tag.  Legal values
      * are {@link BaselineTIFFTagSet#EXTRA_SAMPLES_UNSPECIFIED},
      * {@link BaselineTIFFTagSet#EXTRA_SAMPLES_ASSOCIATED_ALPHA},
      * {@link BaselineTIFFTagSet#EXTRA_SAMPLES_UNASSOCIATED_ALPHA},
@@ -187,7 +187,7 @@
     protected int[] extraSamples;
 
     /**
-     * The value of the <code>ColorMap</code> tag.
+     * The value of the {@code ColorMap} tag.
      *
      */
     protected char[] colorMap;
@@ -195,20 +195,20 @@
     // Region of input stream containing the data
 
     /**
-     * The <code>ImageInputStream</code> containing the TIFF source
+     * The {@code ImageInputStream} containing the TIFF source
      * data.
      */
     protected ImageInputStream stream;
 
     /**
-     * The offset in the source <code>ImageInputStream</code> of the
+     * The offset in the source {@code ImageInputStream} of the
      * start of the data to be decompressed.
      */
     protected long offset;
 
     /**
      * The number of bytes of data from the source
-     * <code>ImageInputStream</code> to be decompressed.
+     * {@code ImageInputStream} to be decompressed.
      */
     protected int byteCount;
 
@@ -244,15 +244,15 @@
     // Subsampling to be performed
 
     /**
-     * The source X offset used, along with <code>dstXOffset</code>
-     * and <code>subsampleX</code>, to map between horizontal source
+     * The source X offset used, along with {@code dstXOffset}
+     * and {@code subsampleX}, to map between horizontal source
      * and destination pixel coordinates.
      */
     protected int sourceXOffset;
 
     /**
      * The horizontal destination offset used, along with
-     * <code>sourceXOffset</code> and <code>subsampleX</code>, to map
+     * {@code sourceXOffset} and {@code subsampleX}, to map
      * between horizontal source and destination pixel coordinates.
      * See the comment for {@link #sourceXOffset sourceXOffset} for
      * the mapping equations.
@@ -260,15 +260,15 @@
     protected int dstXOffset;
 
     /**
-     * The source Y offset used, along with <code>dstYOffset</code>
-     * and <code>subsampleY</code>, to map between vertical source and
+     * The source Y offset used, along with {@code dstYOffset}
+     * and {@code subsampleY}, to map between vertical source and
      * destination pixel coordinates.
      */
     protected int sourceYOffset;
 
     /**
      * The vertical destination offset used, along with
-     * <code>sourceYOffset</code> and <code>subsampleY</code>, to map
+     * {@code sourceYOffset} and {@code subsampleY}, to map
      * between horizontal source and destination pixel coordinates.
      * See the comment for {@link #sourceYOffset sourceYOffset} for
      * the mapping equations.
@@ -305,7 +305,7 @@
     // Destination for decodeRaw
 
     /**
-     * A <code>BufferedImage</code> for the <code>decodeRaw</code>
+     * A {@code BufferedImage} for the {@code decodeRaw}
      * method to write into.
      */
     protected BufferedImage rawImage;
@@ -345,15 +345,15 @@
      * The X coordinate of the upper-left source pixel that will
      * actually be copied into the destination image, taking into
      * account all subsampling, offsetting, and clipping.  That is,
-     * the pixel at (<code>activeSrcMinX</code>,
-     * <code>activeSrcMinY</code>) is to be copied into the
-     * destination pixel at (<code>dstMinX</code>,
-     * <code>dstMinY</code>).
+     * the pixel at ({@code activeSrcMinX},
+     * {@code activeSrcMinY}) is to be copied into the
+     * destination pixel at ({@code dstMinX},
+     * {@code dstMinY}).
      *
      * <p> The pixels in the source region to be copied are
-     * those with X coordinates of the form <code>activeSrcMinX +
-     * k*subsampleX</code>, where <code>k</code> is an integer such
-     * that <code>0 &le; k &lt; dstWidth</code>.
+     * those with X coordinates of the form {@code activeSrcMinX +
+     * k*subsampleX}, where {@code k} is an integer such
+     * that {@code 0 &le; k &lt; dstWidth}.
      */
     protected int activeSrcMinX;
 
@@ -363,9 +363,9 @@
      * all subsampling, offsetting, and clipping.
      *
      * <p> The pixels in the source region to be copied are
-     * those with Y coordinates of the form <code>activeSrcMinY +
-     * k*subsampleY</code>, where <code>k</code> is an integer such
-     * that <code>0 &le; k &lt; dstHeight</code>.
+     * those with Y coordinates of the form {@code activeSrcMinY +
+     * k*subsampleY}, where {@code k} is an integer such
+     * that {@code 0 &le; k &lt; dstHeight}.
      */
     protected int activeSrcMinY;
 
@@ -375,7 +375,7 @@
      * susbampling, offsetting, and clipping.
      *
      * <p> The active source width will always be equal to
-     * <code>(dstWidth - 1)*subsampleX + 1</code>.
+     * {@code (dstWidth - 1)*subsampleX + 1}.
      */
     protected int activeSrcWidth;
 
@@ -385,13 +385,13 @@
      * susbampling, offsetting, and clipping.
      *
      * <p> The active source height will always be equal to
-     * <code>(dstHeight - 1)*subsampleY + 1</code>.
+     * {@code (dstHeight - 1)*subsampleY + 1}.
      */
     protected int activeSrcHeight;
 
     /**
-     * A <code>TIFFColorConverter</code> object describing the color space of
-     * the encoded pixel data, or <code>null</code>.
+     * A {@code TIFFColorConverter} object describing the color space of
+     * the encoded pixel data, or {@code null}.
      */
     protected TIFFColorConverter colorConverter;
 
@@ -420,13 +420,13 @@
     // to exactly those dest pixels that are present in the source region.
 
     /**
-     * Create a <code>PixelInterleavedSampleModel</code> for use in creating
-     * an <code>ImageTypeSpecifier</code>.  Its dimensions will be 1x1 and
+     * Create a {@code PixelInterleavedSampleModel} for use in creating
+     * an {@code ImageTypeSpecifier}.  Its dimensions will be 1x1 and
      * it will have ascending band offsets as {0, 1, 2, ..., numBands}.
      *
      * @param dataType The data type (DataBuffer.TYPE_*).
      * @param numBands The number of bands.
-     * @return A <code>PixelInterleavedSampleModel</code>.
+     * @return A {@code PixelInterleavedSampleModel}.
      */
     static SampleModel createInterleavedSM(int dataType,
                                            int numBands) {
@@ -443,8 +443,8 @@
     }
 
     /**
-     * Create a <code>ComponentColorModel</code> for use in creating
-     * an <code>ImageTypeSpecifier</code>.
+     * Create a {@code ComponentColorModel} for use in creating
+     * an {@code ImageTypeSpecifier}.
      */
     // This code was copied from javax.imageio.ImageTypeSpecifier.
     static ColorModel createComponentCM(ColorSpace colorSpace,
@@ -518,8 +518,8 @@
     }
 
     /**
-     * Return the number of bits occupied by <code>dataType</code>
-     * which must be one of the <code>DataBuffer</code> <code>TYPE</code>s.
+     * Return the number of bits occupied by {@code dataType}
+     * which must be one of the {@code DataBuffer} {@code TYPE}s.
      */
     private static int getDataTypeSize(int dataType) throws IIOException {
         int dataTypeSize = 0;
@@ -578,7 +578,7 @@
     }
 
     /**
-     * Determines whether the <code>DataBuffer</code> is filled without
+     * Determines whether the {@code DataBuffer} is filled without
      * any interspersed padding bits.
      */
     private static boolean isDataBufferBitContiguous(SampleModel sm)
@@ -678,8 +678,8 @@
     }
 
     /**
-     * Reformats bit-discontiguous data into the <code>DataBuffer</code>
-     * of the supplied <code>WritableRaster</code>.
+     * Reformats bit-discontiguous data into the {@code DataBuffer}
+     * of the supplied {@code WritableRaster}.
      */
     private static void reformatDiscontiguousData(byte[] buf,
                                                   int stride,
@@ -715,21 +715,21 @@
 
     /**
      * A utility method that returns an
-     * <code>ImageTypeSpecifier</code> suitable for decoding an image
+     * {@code ImageTypeSpecifier} suitable for decoding an image
      * with the given parameters.
      *
      * @param photometricInterpretation the value of the
-     * <code>PhotometricInterpretation</code> field.
-     * @param compression the value of the <code>Compression</code> field.
+     * {@code PhotometricInterpretation} field.
+     * @param compression the value of the {@code Compression} field.
      * @param samplesPerPixel the value of the
-     * <code>SamplesPerPixel</code> field.
-     * @param bitsPerSample the value of the <code>BitsPerSample</code> field.
-     * @param sampleFormat the value of the <code>SampleFormat</code> field.
-     * @param extraSamples the value of the <code>ExtraSamples</code> field.
-     * @param colorMap the value of the <code>ColorMap</code> field.
+     * {@code SamplesPerPixel} field.
+     * @param bitsPerSample the value of the {@code BitsPerSample} field.
+     * @param sampleFormat the value of the {@code SampleFormat} field.
+     * @param extraSamples the value of the {@code ExtraSamples} field.
+     * @param colorMap the value of the {@code ColorMap} field.
      *
-     * @return a suitable <code>ImageTypeSpecifier</code>, or
-     * <code>null</code> if it is not possible to create one.
+     * @return a suitable {@code ImageTypeSpecifier}, or
+     * {@code null} if it is not possible to create one.
      */
     public static ImageTypeSpecifier
         getRawImageTypeSpecifier(int photometricInterpretation,
@@ -1216,26 +1216,26 @@
     }
 
     /**
-     * Sets the value of the <code>reader</code> field.
+     * Sets the value of the {@code reader} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
-     * @param reader the current <code>ImageReader</code>.
+     * @param reader the current {@code ImageReader}.
      */
     public void setReader(ImageReader reader) {
         this.reader = reader;
     }
 
     /**
-     * Sets the value of the <code>metadata</code> field.
+     * Sets the value of the {@code metadata} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
-     * @param metadata the <code>IIOMetadata</code> object for the
+     * @param metadata the {@code IIOMetadata} object for the
      * image being read.
      */
     public void setMetadata(IIOMetadata metadata) {
@@ -1243,10 +1243,10 @@
     }
 
     /**
-     * Sets the value of the <code>photometricInterpretation</code>
+     * Sets the value of the {@code photometricInterpretation}
      * field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1258,9 +1258,9 @@
     }
 
     /**
-     * Sets the value of the <code>compression</code> field.
+     * Sets the value of the {@code compression} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1271,13 +1271,13 @@
     }
 
     /**
-     * Sets the value of the <code>planar</code> field.
+     * Sets the value of the {@code planar} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
-     * @param planar <code>true</code> if the image to be decoded is
+     * @param planar {@code true} if the image to be decoded is
      * stored in planar format.
      */
     public void setPlanar(boolean planar) {
@@ -1285,9 +1285,9 @@
     }
 
     /**
-     * Sets the value of the <code>samplesPerPixel</code> field.
+     * Sets the value of the {@code samplesPerPixel} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1299,9 +1299,9 @@
     }
 
     /**
-     * Sets the value of the <code>bitsPerSample</code> field.
+     * Sets the value of the {@code bitsPerSample} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1314,9 +1314,9 @@
     }
 
     /**
-     * Sets the value of the <code>sampleFormat</code> field.
+     * Sets the value of the {@code sampleFormat} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1330,9 +1330,9 @@
     }
 
     /**
-     * Sets the value of the <code>extraSamples</code> field.
+     * Sets the value of the {@code extraSamples} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1346,14 +1346,14 @@
     }
 
     /**
-     * Sets the value of the <code>colorMap</code> field.
+     * Sets the value of the {@code colorMap} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
      * @param colorMap the color map to apply to the source data,
-     * as an array of <code>char</code>s.
+     * as an array of {@code char}s.
      */
     public void setColorMap(char[] colorMap) {
         this.colorMap = colorMap == null ?
@@ -1361,22 +1361,22 @@
     }
 
     /**
-     * Sets the value of the <code>stream</code> field.
+     * Sets the value of the {@code stream} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
-     * @param stream the <code>ImageInputStream</code> to be read.
+     * @param stream the {@code ImageInputStream} to be read.
      */
     public void setStream(ImageInputStream stream) {
         this.stream = stream;
     }
 
     /**
-     * Sets the value of the <code>offset</code> field.
+     * Sets the value of the {@code offset} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1388,9 +1388,9 @@
     }
 
     /**
-     * Sets the value of the <code>byteCount</code> field.
+     * Sets the value of the {@code byteCount} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1403,9 +1403,9 @@
     // Region of the file image represented in the stream
 
     /**
-     * Sets the value of the <code>srcMinX</code> field.
+     * Sets the value of the {@code srcMinX} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1418,9 +1418,9 @@
     }
 
     /**
-     * Sets the value of the <code>srcMinY</code> field.
+     * Sets the value of the {@code srcMinY} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1433,9 +1433,9 @@
     }
 
     /**
-     * Sets the value of the <code>srcWidth</code> field.
+     * Sets the value of the {@code srcWidth} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1447,9 +1447,9 @@
     }
 
     /**
-     * Sets the value of the <code>srcHeight</code> field.
+     * Sets the value of the {@code srcHeight} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1463,9 +1463,9 @@
     // First source pixel to be read
 
     /**
-     * Sets the value of the <code>sourceXOffset</code> field.
+     * Sets the value of the {@code sourceXOffset} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1477,9 +1477,9 @@
     }
 
     /**
-     * Sets the value of the <code>dstXOffset</code> field.
+     * Sets the value of the {@code dstXOffset} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1491,9 +1491,9 @@
     }
 
     /**
-     * Sets the value of the <code>sourceYOffset</code>.
+     * Sets the value of the {@code sourceYOffset}.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1505,9 +1505,9 @@
     }
 
     /**
-     * Sets the value of the <code>dstYOffset</code> field.
+     * Sets the value of the {@code dstYOffset} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1521,15 +1521,15 @@
     // Subsampling to be performed
 
     /**
-     * Sets the value of the <code>subsampleX</code> field.
+     * Sets the value of the {@code subsampleX} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
      * @param subsampleX the horizontal subsampling factor.
      *
-     * @throws IllegalArgumentException if <code>subsampleX</code> is
+     * @throws IllegalArgumentException if {@code subsampleX} is
      * less than or equal to 0.
      */
     public void setSubsampleX(int subsampleX) {
@@ -1540,15 +1540,15 @@
     }
 
     /**
-     * Sets the value of the <code>subsampleY</code> field.
+     * Sets the value of the {@code subsampleY} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
      * @param subsampleY the vertical subsampling factor.
      *
-     * @throws IllegalArgumentException if <code>subsampleY</code> is
+     * @throws IllegalArgumentException if {@code subsampleY} is
      * less than or equal to 0.
      */
     public void setSubsampleY(int subsampleY) {
@@ -1561,13 +1561,13 @@
     // Band subsetting/rearrangement
 
     /**
-     * Sets the value of the <code>sourceBands</code> field.
+     * Sets the value of the {@code sourceBands} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
-     * @param sourceBands an array of <code>int</code>s
+     * @param sourceBands an array of {@code int}s
      * specifying the source bands to be read.
      */
     public void setSourceBands(int[] sourceBands) {
@@ -1576,13 +1576,13 @@
     }
 
     /**
-     * Sets the value of the <code>destinationBands</code> field.
+     * Sets the value of the {@code destinationBands} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
-     * @param destinationBands an array of <code>int</code>s
+     * @param destinationBands an array of {@code int}s
      * specifying the destination bands to be written.
      */
     public void setDestinationBands(int[] destinationBands) {
@@ -1593,22 +1593,22 @@
     // Destination image and region
 
     /**
-     * Sets the value of the <code>image</code> field.
+     * Sets the value of the {@code image} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
-     * @param image the destination <code>BufferedImage</code>.
+     * @param image the destination {@code BufferedImage}.
      */
     public void setImage(BufferedImage image) {
         this.image = image;
     }
 
     /**
-     * Sets the value of the <code>dstMinX</code> field.
+     * Sets the value of the {@code dstMinX} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1620,9 +1620,9 @@
     }
 
     /**
-     * Sets the value of the <code>dstMinY</code> field.
+     * Sets the value of the {@code dstMinY} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1634,9 +1634,9 @@
     }
 
     /**
-     * Sets the value of the <code>dstWidth</code> field.
+     * Sets the value of the {@code dstWidth} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1647,9 +1647,9 @@
     }
 
     /**
-     * Sets the value of the <code>dstHeight</code> field.
+     * Sets the value of the {@code dstHeight} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1662,9 +1662,9 @@
     // Active source region
 
     /**
-     * Sets the value of the <code>activeSrcMinX</code> field.
+     * Sets the value of the {@code activeSrcMinX} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1676,9 +1676,9 @@
     }
 
     /**
-     * Sets the value of the <code>activeSrcMinY</code> field.
+     * Sets the value of the {@code activeSrcMinY} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1690,9 +1690,9 @@
     }
 
     /**
-     * Sets the value of the <code>activeSrcWidth</code> field.
+     * Sets the value of the {@code activeSrcWidth} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1703,9 +1703,9 @@
     }
 
     /**
-     * Sets the value of the <code>activeSrcHeight</code> field.
+     * Sets the value of the {@code activeSrcHeight} field.
      *
-     * <p> If this method is called, the <code>beginDecoding</code>
+     * <p> If this method is called, the {@code beginDecoding}
      * method must be called prior to calling any of the decode
      * methods.
      *
@@ -1716,23 +1716,23 @@
     }
 
     /**
-     * Sets the <code>TIFFColorConverter</code> object describing the color
+     * Sets the {@code TIFFColorConverter} object describing the color
      * space of the encoded data in the input stream.  If no
-     * <code>TIFFColorConverter</code> is set, no conversion will be performed.
+     * {@code TIFFColorConverter} is set, no conversion will be performed.
      *
-     * @param colorConverter a <code>TIFFColorConverter</code> object, or
-     * <code>null</code>.
+     * @param colorConverter a {@code TIFFColorConverter} object, or
+     * {@code null}.
      */
     public void setColorConverter(TIFFColorConverter colorConverter) {
         this.colorConverter = colorConverter;
     }
 
     /**
-     * Returns an <code>ImageTypeSpecifier</code> describing an image
+     * Returns an {@code ImageTypeSpecifier} describing an image
      * whose underlying data array has the same format as the raw
      * source pixel data.
      *
-     * @return an <code>ImageTypeSpecifier</code>.
+     * @return an {@code ImageTypeSpecifier}.
      */
     public ImageTypeSpecifier getRawImageType() {
         ImageTypeSpecifier its =
@@ -1747,18 +1747,18 @@
     }
 
     /**
-     * Creates a <code>BufferedImage</code> whose underlying data
+     * Creates a {@code BufferedImage} whose underlying data
      * array will be suitable for holding the raw decoded output of
-     * the <code>decodeRaw</code> method.
+     * the {@code decodeRaw} method.
      *
      * <p> The default implementation calls
-     * <code>getRawImageType</code>, and calls the resulting
-     * <code>ImageTypeSpecifier</code>'s
-     * <code>createBufferedImage</code> method.
+     * {@code getRawImageType}, and calls the resulting
+     * {@code ImageTypeSpecifier}'s
+     * {@code createBufferedImage} method.
      *
-     * @return a <code>BufferedImage</code> whose underlying data
+     * @return a {@code BufferedImage} whose underlying data
      * array has the same format as the raw source pixel data, or
-     * <code>null</code> if it is not possible to create such an
+     * {@code null} if it is not possible to create such an
      * image.
      */
     public BufferedImage createRawImage() {
@@ -1811,22 +1811,22 @@
     }
 
     /**
-     * Decodes the source data into the provided <code>byte</code>
-     * array <code>b</code>, starting at the offset given by
-     * <code>dstOffset</code>.  Each pixel occupies
-     * <code>bitsPerPixel</code> bits, with no padding between pixels.
-     * Scanlines are separated by <code>scanlineStride</code>
-     * <code>byte</code>s.
+     * Decodes the source data into the provided {@code byte}
+     * array {@code b}, starting at the offset given by
+     * {@code dstOffset}.  Each pixel occupies
+     * {@code bitsPerPixel} bits, with no padding between pixels.
+     * Scanlines are separated by {@code scanlineStride}
+     * {@code byte}s.
      *
-     * @param b a <code>byte</code> array to be written.
-     * @param dstOffset the starting offset in <code>b</code> to be
+     * @param b a {@code byte} array to be written.
+     * @param dstOffset the starting offset in {@code b} to be
      * written.
      * @param bitsPerPixel the number of bits for each pixel.
-     * @param scanlineStride the number of <code>byte</code>s to
+     * @param scanlineStride the number of {@code byte}s to
      * advance between that starting pixels of each scanline.
      *
      * @throws IOException if an error occurs reading from the source
-     * <code>ImageInputStream</code>.
+     * {@code ImageInputStream}.
      */
     public abstract void decodeRaw(byte[] b,
                                    int dstOffset,
@@ -1834,25 +1834,25 @@
                                    int scanlineStride) throws IOException;
 
     /**
-     * Decodes the source data into the provided <code>short</code>
-     * array <code>s</code>, starting at the offset given by
-     * <code>dstOffset</code>.  Each pixel occupies
-     * <code>bitsPerPixel</code> bits, with no padding between pixels.
-     * Scanlines are separated by <code>scanlineStride</code>
-     * <code>short</code>s
+     * Decodes the source data into the provided {@code short}
+     * array {@code s}, starting at the offset given by
+     * {@code dstOffset}.  Each pixel occupies
+     * {@code bitsPerPixel} bits, with no padding between pixels.
+     * Scanlines are separated by {@code scanlineStride}
+     * {@code short}s
      *
-     * <p> The default implementation calls <code>decodeRaw(byte[] b,
-     * ...)</code> and copies the resulting data into <code>s</code>.
+     * <p> The default implementation calls {@code decodeRaw(byte[] b,
+     * ...)} and copies the resulting data into {@code s}.
      *
-     * @param s a <code>short</code> array to be written.
-     * @param dstOffset the starting offset in <code>s</code> to be
+     * @param s a {@code short} array to be written.
+     * @param dstOffset the starting offset in {@code s} to be
      * written.
      * @param bitsPerPixel the number of bits for each pixel.
-     * @param scanlineStride the number of <code>short</code>s to
+     * @param scanlineStride the number of {@code short}s to
      * advance between that starting pixels of each scanline.
      *
      * @throws IOException if an error occurs reading from the source
-     * <code>ImageInputStream</code>.
+     * {@code ImageInputStream}.
      */
     public void decodeRaw(short[] s,
                           int dstOffset,
@@ -1891,25 +1891,25 @@
     }
 
     /**
-     * Decodes the source data into the provided <code>int</code>
-     * array <code>i</code>, starting at the offset given by
-     * <code>dstOffset</code>.  Each pixel occupies
-     * <code>bitsPerPixel</code> bits, with no padding between pixels.
-     * Scanlines are separated by <code>scanlineStride</code>
-     * <code>int</code>s.
+     * Decodes the source data into the provided {@code int}
+     * array {@code i}, starting at the offset given by
+     * {@code dstOffset}.  Each pixel occupies
+     * {@code bitsPerPixel} bits, with no padding between pixels.
+     * Scanlines are separated by {@code scanlineStride}
+     * {@code int}s.
      *
-     * <p> The default implementation calls <code>decodeRaw(byte[] b,
-     * ...)</code> and copies the resulting data into <code>i</code>.
+     * <p> The default implementation calls {@code decodeRaw(byte[] b,
+     * ...)} and copies the resulting data into {@code i}.
      *
-     * @param i an <code>int</code> array to be written.
-     * @param dstOffset the starting offset in <code>i</code> to be
+     * @param i an {@code int} array to be written.
+     * @param dstOffset the starting offset in {@code i} to be
      * written.
      * @param bitsPerPixel the number of bits for each pixel.
-     * @param scanlineStride the number of <code>int</code>s to
+     * @param scanlineStride the number of {@code int}s to
      * advance between that starting pixels of each scanline.
      *
      * @throws IOException if an error occurs reading from the source
-     * <code>ImageInputStream</code>.
+     * {@code ImageInputStream}.
      */
     public void decodeRaw(int[] i,
                           int dstOffset,
@@ -1953,25 +1953,25 @@
     }
 
     /**
-     * Decodes the source data into the provided <code>float</code>
-     * array <code>f</code>, starting at the offset given by
-     * <code>dstOffset</code>.  Each pixel occupies
-     * <code>bitsPerPixel</code> bits, with no padding between pixels.
-     * Scanlines are separated by <code>scanlineStride</code>
-     * <code>float</code>s.
+     * Decodes the source data into the provided {@code float}
+     * array {@code f}, starting at the offset given by
+     * {@code dstOffset}.  Each pixel occupies
+     * {@code bitsPerPixel} bits, with no padding between pixels.
+     * Scanlines are separated by {@code scanlineStride}
+     * {@code float}s.
      *
-     * <p> The default implementation calls <code>decodeRaw(byte[] b,
-     * ...)</code> and copies the resulting data into <code>f</code>.
+     * <p> The default implementation calls {@code decodeRaw(byte[] b,
+     * ...)} and copies the resulting data into {@code f}.
      *
-     * @param f a <code>float</code> array to be written.
-     * @param dstOffset the starting offset in <code>f</code> to be
+     * @param f a {@code float} array to be written.
+     * @param dstOffset the starting offset in {@code f} to be
      * written.
      * @param bitsPerPixel the number of bits for each pixel.
-     * @param scanlineStride the number of <code>float</code>s to
+     * @param scanlineStride the number of {@code float}s to
      * advance between that starting pixels of each scanline.
      *
      * @throws IOException if an error occurs reading from the source
-     * <code>ImageInputStream</code>.
+     * {@code ImageInputStream}.
      */
     public void decodeRaw(float[] f,
                           int dstOffset,
@@ -2017,25 +2017,25 @@
     }
 
     /**
-     * Decodes the source data into the provided <code>double</code>
-     * array <code>f</code>, starting at the offset given by
-     * <code>dstOffset</code>.  Each pixel occupies
-     * <code>bitsPerPixel</code> bits, with no padding between pixels.
-     * Scanlines are separated by <code>scanlineStride</code>
-     * <code>double</code>s.
+     * Decodes the source data into the provided {@code double}
+     * array {@code f}, starting at the offset given by
+     * {@code dstOffset}.  Each pixel occupies
+     * {@code bitsPerPixel} bits, with no padding between pixels.
+     * Scanlines are separated by {@code scanlineStride}
+     * {@code double}s.
      *
-     * <p> The default implementation calls <code>decodeRaw(byte[] b,
-     * ...)</code> and copies the resulting data into <code>f</code>.
+     * <p> The default implementation calls {@code decodeRaw(byte[] b,
+     * ...)} and copies the resulting data into {@code f}.
      *
-     * @param f a <code>double</code> array to be written.
-     * @param dstOffset the starting offset in <code>f</code> to be
+     * @param f a {@code double} array to be written.
+     * @param dstOffset the starting offset in {@code f} to be
      * written.
      * @param bitsPerPixel the number of bits for each pixel.
-     * @param scanlineStride the number of <code>double</code>s to
+     * @param scanlineStride the number of {@code double}s to
      * advance between that starting pixels of each scanline.
      *
      * @throws IOException if an error occurs reading from the source
-     * <code>ImageInputStream</code>.
+     * {@code ImageInputStream}.
      */
     public void decodeRaw(double[] d,
                           int dstOffset,
@@ -2104,16 +2104,16 @@
 
     /**
      * This routine is called prior to a sequence of calls to the
-     * <code>decode</code> method, in order to allow any necessary
+     * {@code decode} method, in order to allow any necessary
      * tables or other structures to be initialized based on metadata
      * values.  This routine is guaranteed to be called any time the
      * metadata values have changed.
      *
      * <p> The default implementation computes tables used by the
-     * <code>decode</code> method to rescale components to different
+     * {@code decode} method to rescale components to different
      * bit depths.  Thus, if this method is overridden, it is
-     * important for the subclass method to call <code>super()</code>,
-     * unless it overrides <code>decode</code> as well.
+     * important for the subclass method to call {@code super()},
+     * unless it overrides {@code decode} as well.
      */
     public void beginDecoding() {
         // Note: This method assumes that sourceBands, destinationBands,
@@ -2242,35 +2242,35 @@
 
     /**
      * Decodes the input bit stream (located in the
-     * <code>ImageInputStream</code> <code>stream</code>, at offset
-     * <code>offset</code>, and continuing for <code>byteCount</code>
-     * bytes) into the output <code>BufferedImage</code>
-     * <code>image</code>.
+     * {@code ImageInputStream} {@code stream}, at offset
+     * {@code offset}, and continuing for {@code byteCount}
+     * bytes) into the output {@code BufferedImage}
+     * {@code image}.
      *
      * <p> The default implementation analyzes the destination image
      * to determine if it is suitable as the destination for the
-     * <code>decodeRaw</code> method.  If not, a suitable image is
-     * created.  Next, <code>decodeRaw</code> is called to perform the
+     * {@code decodeRaw} method.  If not, a suitable image is
+     * created.  Next, {@code decodeRaw} is called to perform the
      * actual decoding, and the results are copied into the
      * destination image if necessary.  Subsampling and offsetting are
      * performed automatically.
      *
      * <p> The precise responsibilities of this routine are as
      * follows.  The input bit stream is defined by the instance
-     * variables <code>stream</code>, <code>offset</code>, and
-     * <code>byteCount</code>.  These bits contain the data for the
-     * region of the source image defined by <code>srcMinX</code>,
-     * <code>srcMinY</code>, <code>srcWidth</code>, and
-     * <code>srcHeight</code>.
+     * variables {@code stream}, {@code offset}, and
+     * {@code byteCount}.  These bits contain the data for the
+     * region of the source image defined by {@code srcMinX},
+     * {@code srcMinY}, {@code srcWidth}, and
+     * {@code srcHeight}.
      *
      * <p> The source data is required to be subsampling, starting at
-     * the <code>sourceXOffset</code>th column and including
-     * every <code>subsampleX</code>th pixel thereafter (and similarly
-     * for <code>sourceYOffset</code> and
-     * <code>subsampleY</code>).
+     * the {@code sourceXOffset}th column and including
+     * every {@code subsampleX}th pixel thereafter (and similarly
+     * for {@code sourceYOffset} and
+     * {@code subsampleY}).
      *
      * <p> Pixels are copied into the destination with an addition shift of
-     * (<code>dstXOffset</code>, <code>dstYOffset</code>).  The complete
+     * ({@code dstXOffset}, {@code dstYOffset}).  The complete
      * set of formulas relating the source and destination coordinate spaces
      * are:
      *
@@ -2279,9 +2279,9 @@
      * dy = (sy - sourceYOffset)/subsampleY + dstYOffset;
      * </pre>
      *
-     * Only source pixels such that <code>(sx - sourceXOffset) %
-     * subsampleX == 0</code> and <code>(sy - sourceYOffset) %
-     * subsampleY == 0</code> are copied.
+     * Only source pixels such that {@code (sx - sourceXOffset) %
+     * subsampleX == 0} and {@code (sy - sourceYOffset) %
+     * subsampleY == 0} are copied.
      *
      * <p> The inverse mapping, from destination to source coordinates,
      * is one-to-one:
@@ -2292,9 +2292,9 @@
      * </pre>
      *
      * <p> The region of the destination image to be updated is given
-     * by the instance variables <code>dstMinX</code>,
-     * <code>dstMinY</code>, <code>dstWidth</code>, and
-     * <code>dstHeight</code>.
+     * by the instance variables {@code dstMinX},
+     * {@code dstMinY}, {@code dstWidth}, and
+     * {@code dstHeight}.
      *
      * <p> It is possible that not all of the source data being read
      * will contribute to the destination image.  For example, the
@@ -2303,32 +2303,32 @@
      * convenience, the bounds of the active source region (that is,
      * the region of the strip or tile being read that actually
      * contributes to the destination image, taking clipping into
-     * account) are available as <code>activeSrcMinX</code>,
-     * <code>activeSrcMinY</code>, <code>activeSrcWidth</code> and
-     * <code>activeSrcHeight</code>.  Thus, the source pixel at
-     * (<code>activeSrcMinX</code>, <code>activeSrcMinY</code>) will
-     * map to the destination pixel (<code>dstMinX</code>,
-     * <code>dstMinY</code>).
+     * account) are available as {@code activeSrcMinX},
+     * {@code activeSrcMinY}, {@code activeSrcWidth} and
+     * {@code activeSrcHeight}.  Thus, the source pixel at
+     * ({@code activeSrcMinX}, {@code activeSrcMinY}) will
+     * map to the destination pixel ({@code dstMinX},
+     * {@code dstMinY}).
      *
      * <p> The sequence of source bands given by
-     * <code>sourceBands</code> are to be copied into the sequence of
+     * {@code sourceBands} are to be copied into the sequence of
      * bands in the destination given by
-     * <code>destinationBands</code>.
+     * {@code destinationBands}.
      *
      * <p> Some standard tag information is provided the instance
-     * variables <code>photometricInterpretation</code>,
-     * <code>compression</code>, <code>samplesPerPixel</code>,
-     * <code>bitsPerSample</code>, <code>sampleFormat</code>,
-     * <code>extraSamples</code>, and <code>colorMap</code>.
+     * variables {@code photometricInterpretation},
+     * {@code compression}, {@code samplesPerPixel},
+     * {@code bitsPerSample}, {@code sampleFormat},
+     * {@code extraSamples}, and {@code colorMap}.
      *
      * <p> In practice, unless there is a significant performance
      * advantage to be gained by overriding this routine, most users
      * will prefer to use the default implementation of this routine,
-     * and instead override the <code>decodeRaw</code> and/or
-     * <code>getRawImageType</code> methods.
+     * and instead override the {@code decodeRaw} and/or
+     * {@code getRawImageType} methods.
      *
      * @exception IOException if an error occurs in
-     * <code>decodeRaw</code>.
+     * {@code decodeRaw}.
      */
     public void decode() throws IOException {
         byte[] byteData = null;
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFExifJPEGCompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFExifJPEGCompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 import javax.imageio.plugins.tiff.BaselineTIFFTagSet;
 
 /**
- * A <code>TIFFCompressor</code> for the JPEG variant of Exif.
+ * A {@code TIFFCompressor} for the JPEG variant of Exif.
  */
 public class TIFFExifJPEGCompressor extends TIFFBaseJPEGCompressor {
     public TIFFExifJPEGCompressor(ImageWriteParam param) {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFaxCompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFaxCompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -232,12 +232,12 @@
     }
 
     /**
-     * Sets the value of the <code>metadata</code> field.
+     * Sets the value of the {@code metadata} field.
      *
      * <p> The implementation in this class also sets local options
      * from the FILL_ORDER field if it exists.</p>
      *
-     * @param metadata the <code>IIOMetadata</code> object for the
+     * @param metadata the {@code IIOMetadata} object for the
      * image being written.
      *
      * @see #getMetadata()
@@ -253,8 +253,8 @@
     }
 
     /**
-     * Return min of <code>maxOffset</code> or offset of first pixel
-     * different from pixel at <code>bitOffset</code>.
+     * Return min of {@code maxOffset} or offset of first pixel
+     * different from pixel at {@code bitOffset}.
      */
     public int nextState(byte[] data,
                           int    base,
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFieldNode.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFieldNode.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,12 +34,12 @@
 import javax.imageio.plugins.tiff.TIFFTagSet;
 
 /**
- * The <code>Node</code> representation of a <code>TIFFField</code>
+ * The {@code Node} representation of a {@code TIFFField}
  * wherein the child node is procedural rather than buffered.
  */
 public class TIFFFieldNode extends IIOMetadataNode {
     private static String getNodeName(TIFFField f) {
-        return f.getData() instanceof TIFFDirectory ?
+        return (f.hasDirectory() || f.getData() instanceof TIFFDirectory) ?
             "TIFFIFD" : "TIFFField";
     }
 
@@ -52,7 +52,8 @@
     public TIFFFieldNode(TIFFField field) {
         super(getNodeName(field));
 
-        isIFD = field.getData() instanceof TIFFDirectory;
+        isIFD = field.hasDirectory() ||
+            field.getData() instanceof TIFFDirectory;
 
         this.field = field;
 
@@ -68,7 +69,8 @@
                 setAttribute("parentTagName", tagName);
             }
 
-            TIFFDirectory dir = (TIFFDirectory)field.getData();
+            TIFFDirectory dir = field.hasDirectory() ?
+                field.getDirectory() : (TIFFDirectory)field.getData();
             TIFFTagSet[] tagSets = dir.getTagSets();
             if(tagSets != null) {
                 StringBuilder tagSetNames = new StringBuilder();
@@ -90,7 +92,8 @@
         if(isInitialized) return;
 
         if(isIFD) {
-            TIFFDirectory dir = (TIFFDirectory)field.getData();
+            TIFFDirectory dir = field.hasDirectory() ?
+                field.getDirectory() : (TIFFDirectory)field.getData();
             TIFFField[] fields = dir.getTIFFFields();
             if(fields != null) {
                 TIFFTagSet[] tagSets = dir.getTagSets();
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -153,7 +153,7 @@
     }
 
     /**
-     * Returns an <code>Iterator</code> over the TIFF fields. The
+     * Returns an {@code Iterator} over the TIFF fields. The
      * traversal is in the order of increasing tag number.
      */
     // Note: the sort is guaranteed for low fields by the use of an
@@ -164,7 +164,7 @@
     }
 
     /**
-     * Read the value of a field. The <code>data</code> parameter should be
+     * Read the value of a field. The {@code data} parameter should be
      * an array of length 1 of Object.
      *
      * @param stream the input stream
@@ -762,8 +762,8 @@
     }
 
     /**
-     * Returns a <code>TIFFIFD</code> wherein all fields from the
-     * <code>BaselineTIFFTagSet</code> are copied by value and all other
+     * Returns a {@code TIFFIFD} wherein all fields from the
+     * {@code BaselineTIFFTagSet} are copied by value and all other
      * fields copied by reference.
      */
     public TIFFIFD getShallowClone() {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1620,8 +1620,8 @@
     }
 
     /**
-     * Returns a <code>TIFFImageMetadata</code> wherein all fields in the
-     * root IFD from the <code>BaselineTIFFTagSet</code> are copied by value
+     * Returns a {@code TIFFImageMetadata} wherein all fields in the
+     * root IFD from the {@code BaselineTIFFTagSet} are copied by value
      * and all other fields copied by reference.
      */
     public TIFFImageMetadata getShallowClone() {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@
     // Metadata for image at 'currIndex', or null.
     private TIFFImageMetadata imageMetadata = null;
 
-    // A <code>List</code> of <code>Long</code>s indicating the stream
+    // A {@code List} of {@code Long}s indicating the stream
     // positions of the start of the IFD for each image.  Entries
     // are added as needed.
     private List<Long> imageStartPosition = new ArrayList<Long>();
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriteParam.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriteParam.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,11 +122,11 @@
  * quality value is passed directly to the JPEG writer plug-in which
  * interprets it in the usual way.</p>
  *
- * <p> The <code>canWriteTiles</code> and
- * <code>canWriteCompressed</code> methods will return
- * <code>true</code>; the <code>canOffsetTiles</code> and
- * <code>canWriteProgressive</code> methods will return
- * <code>false</code>.</p>
+ * <p> The {@code canWriteTiles} and
+ * {@code canWriteCompressed} methods will return
+ * {@code true}; the {@code canOffsetTiles} and
+ * {@code canWriteProgressive} methods will return
+ * {@code false}.</p>
  *
  * <p> If tiles are being written, then each of their dimensions will be
  * rounded to the nearest multiple of 16 per the TIFF specification. If
@@ -140,10 +140,10 @@
 public class TIFFImageWriteParam extends ImageWriteParam {
 
     /**
-     * Constructs a <code>TIFFImageWriteParam</code> instance
-     * for a given <code>Locale</code>.
+     * Constructs a {@code TIFFImageWriteParam} instance
+     * for a given {@code Locale}.
      *
-     * @param locale the <code>Locale</code> for which messages
+     * @param locale the {@code Locale} for which messages
      * should be localized.
      */
     public TIFFImageWriteParam(Locale locale) {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -221,11 +221,11 @@
      * relative to a given tile grid layout specified by its X offset
      * and tile width.
      *
-     * <p> If <code>tileWidth < 0</code>, the results of this method
-     * are undefined.  If <code>tileWidth == 0</code>, an
-     * <code>ArithmeticException</code> will be thrown.
+     * <p> If {@code tileWidth < 0}, the results of this method
+     * are undefined.  If {@code tileWidth == 0}, an
+     * {@code ArithmeticException} will be thrown.
      *
-     * @throws ArithmeticException  If <code>tileWidth == 0</code>.
+     * @throws ArithmeticException  If {@code tileWidth == 0}.
      */
     public static int XToTileX(int x, int tileGridXOffset, int tileWidth) {
         x -= tileGridXOffset;
@@ -240,11 +240,11 @@
      * relative to a given tile grid layout specified by its Y offset
      * and tile height.
      *
-     * <p> If <code>tileHeight < 0</code>, the results of this method
-     * are undefined.  If <code>tileHeight == 0</code>, an
-     * <code>ArithmeticException</code> will be thrown.
+     * <p> If {@code tileHeight < 0}, the results of this method
+     * are undefined.  If {@code tileHeight == 0}, an
+     * {@code ArithmeticException} will be thrown.
      *
-     * @throws ArithmeticException  If <code>tileHeight == 0</code>.
+     * @throws ArithmeticException  If {@code tileHeight == 0}.
      */
     public static int YToTileY(int y, int tileGridYOffset, int tileHeight) {
         y -= tileGridYOffset;
@@ -424,17 +424,17 @@
     }
 
     /**
-     * Converts a standard <code>javax_imageio_1.0</code> tree to a
-     * <code>TIFFImageMetadata</code> object.
+     * Converts a standard {@code javax_imageio_1.0} tree to a
+     * {@code TIFFImageMetadata} object.
      *
      * @param inData The metadata object.
-     * @return a <code>TIFFImageMetadata</code> or <code>null</code> if
-     * the standard tree derived from the input object is <code>null</code>.
-     * @throws IllegalArgumentException if <code>inData</code> is
-     * <code>null</code>.
-     * @throws IllegalArgumentException if <code>inData</code> does not support
+     * @return a {@code TIFFImageMetadata} or {@code null} if
+     * the standard tree derived from the input object is {@code null}.
+     * @throws IllegalArgumentException if {@code inData} is
+     * {@code null}.
+     * @throws IllegalArgumentException if {@code inData} does not support
      * the standard metadata format.
-     * @throws IIOInvalidTreeException if <code>inData</code> generates an
+     * @throws IIOInvalidTreeException if {@code inData} generates an
      * invalid standard metadata tree.
      */
     private TIFFImageMetadata convertStandardImageMetadata(IIOMetadata inData)
@@ -463,15 +463,15 @@
 
     /**
      * Converts a native
-     * <code>javax_imageio_tiff_image_1.0</code> tree to a
-     * <code>TIFFImageMetadata</code> object.
+     * {@code javax_imageio_tiff_image_1.0} tree to a
+     * {@code TIFFImageMetadata} object.
      *
      * @param inData The metadata object.
-     * @return a <code>TIFFImageMetadata</code> or <code>null</code> if
-     * the native tree derived from the input object is <code>null</code>.
-     * @throws IllegalArgumentException if <code>inData</code> is
-     * <code>null</code> or does not support the native metadata format.
-     * @throws IIOInvalidTreeException if <code>inData</code> generates an
+     * @return a {@code TIFFImageMetadata} or {@code null} if
+     * the native tree derived from the input object is {@code null}.
+     * @throws IllegalArgumentException if {@code inData} is
+     * {@code null} or does not support the native metadata format.
+     * @throws IIOInvalidTreeException if {@code inData} generates an
      * invalid native metadata tree.
      */
     private TIFFImageMetadata convertNativeImageMetadata(IIOMetadata inData)
@@ -504,8 +504,8 @@
      * as needed. The destination image dimensions are provided as parameters
      * because these might differ from those of the source due to subsampling.
      *
-     * @param cm The <code>ColorModel</code> of the image being written.
-     * @param sm The <code>SampleModel</code> of the image being written.
+     * @param cm The {@code ColorModel} of the image being written.
+     * @param sm The {@code SampleModel} of the image being written.
      * @param destWidth The width of the written image after subsampling.
      * @param destHeight The height of the written image after subsampling.
      */
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -102,14 +102,14 @@
     }
 
     /**
-     * Sets the value of the <code>metadata</code> field.
+     * Sets the value of the {@code metadata} field.
      *
      * <p>The implementation in this class also adds the TIFF fields
      * JPEGTables, YCbCrSubSampling, YCbCrPositioning, and
      * ReferenceBlackWhite superseding any prior settings of those
      * fields.</p>
      *
-     * @param metadata the <code>IIOMetadata</code> object for the
+     * @param metadata the {@code IIOMetadata} object for the
      * image being written.
      *
      * @see #getMetadata()
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWDecompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWDecompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -245,7 +245,7 @@
     }
 
     /**
-     * Append <code>newString</code> to the end of <code>oldString</code>.
+     * Append {@code newString} to the end of {@code oldString}.
      */
     public byte[] composeString(byte oldString[], byte newString) {
         int length = oldString.length;
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWUtil.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWUtil.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -188,7 +188,7 @@
     }
 
     /**
-     * Append <code>newString</code> to the end of <code>oldString</code>.
+     * Append {@code newString} to the end of {@code oldString}.
      */
     public byte[] composeString(byte oldString[], byte newString) {
         int length = oldString.length;
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFNullDecompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFNullDecompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,16 +34,16 @@
      */
     private boolean isReadActiveOnly = false;
 
-    /** The original value of <code>srcMinX</code>. */
+    /** The original value of {@code srcMinX}. */
     private int originalSrcMinX;
 
-    /** The original value of <code>srcMinY</code>. */
+    /** The original value of {@code srcMinY}. */
     private int originalSrcMinY;
 
-    /** The original value of <code>srcWidth</code>. */
+    /** The original value of {@code srcWidth}. */
     private int originalSrcWidth;
 
-    /** The original value of <code>srcHeight</code>. */
+    /** The original value of {@code srcHeight}. */
     private int originalSrcHeight;
 
     public TIFFNullDecompressor() {}
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
 import javax.imageio.plugins.tiff.TIFFField;
 
 /**
- * <code>TIFFDecompressor</code> for "Old JPEG" compression.
+ * {@code TIFFDecompressor} for "Old JPEG" compression.
  */
 public class TIFFOldJPEGDecompressor extends TIFFJPEGDecompressor {
 
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFRLECompressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFRLECompressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,8 +42,8 @@
      * CCITT RLE (Run Lenth Encoding).
      *
      * @param data        The row of data to compress.
-     * @param rowOffset   Starting index in <code>data</code>.
-     * @param colOffset   Bit offset within first <code>data[rowOffset]</code>.
+     * @param rowOffset   Starting index in {@code data}.
+     * @param colOffset   Bit offset within first {@code data[rowOffset]}.
      * @param rowLength   Number of bits in the row.
      * @param compData    The compressed data.
      *
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFRenderedImage.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFRenderedImage.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,15 +85,15 @@
     }
 
     /**
-     * Creates a copy of <code>param</code>. The source subsampling and
+     * Creates a copy of {@code param}. The source subsampling and
      * and bands settings and the destination bands and offset settings
-     * are copied. If <code>param</code> is a <code>TIFFImageReadParam</code>
-     * then the <code>TIFFDecompressor</code> and
-     * <code>TIFFColorConverter</code> settings are also copied; otherwise
-     * they are explicitly set to <code>null</code>.
+     * are copied. If {@code param} is a {@code TIFFImageReadParam}
+     * then the {@code TIFFDecompressor} and
+     * {@code TIFFColorConverter} settings are also copied; otherwise
+     * they are explicitly set to {@code null}.
      *
      * @param param the parameters to be copied.
-     * @param copyTagSets whether the <code>TIFFTagSet</code> settings
+     * @param copyTagSets whether the {@code TIFFTagSet} settings
      * should be copied if set.
      * @return copied parameters.
      */
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFT4Compressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFT4Compressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,13 +41,13 @@
     }
 
     /**
-     * Sets the value of the <code>metadata</code> field.
+     * Sets the value of the {@code metadata} field.
      *
      * <p> The implementation in this class also sets local options
      * from the T4_OPTIONS field if it exists, and if it doesn't, adds
      * it with default values.</p>
      *
-     * @param metadata the <code>IIOMetadata</code> object for the
+     * @param metadata the {@code IIOMetadata} object for the
      * image being written.
      *
      * @see #getMetadata()
@@ -86,7 +86,7 @@
      * @param isEOLAligned Whether EOL bit sequences should be padded.
      * @param data         The row of data to compress.
      * @param lineStride   Byte step between the same sample in different rows.
-     * @param colOffset    Bit offset within first <code>data[rowOffset]</code>.
+     * @param colOffset    Bit offset within first {@code data[rowOffset]}.
      * @param width        Number of bits in the row.
      * @param height       Number of rows in the buffer.
      * @param compData     The compressed data.
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFT6Compressor.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFT6Compressor.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
      *
      * @param data        The row of data to compress.
      * @param lineStride  Byte step between the same sample in different rows.
-     * @param colOffset   Bit offset within first <code>data[rowOffset]</code>.
+     * @param colOffset   Bit offset within first {@code data[rowOffset]}.
      * @param width       Number of bits in the row.
      * @param height      Number of rows in the buffer.
      * @param compData    The compressed data.
--- a/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,11 +26,11 @@
 package com.sun.media.sound;
 
 import java.io.DataInputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
 import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioFileFormat.Type;
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.UnsupportedAudioFileException;
@@ -49,11 +49,6 @@
             throws UnsupportedAudioFileException, IOException {
         DataInputStream dis = new DataInputStream(stream);
 
-        // assumes a stream at the beginning of the file which has already
-        // passed the magic number test...
-        // leaves the input stream at the beginning of the audio data
-        int fileRead = 0;
-        int dataLength = 0;
         AudioFormat format = null;
 
         // Read the magic number
@@ -65,9 +60,9 @@
             throw new UnsupportedAudioFileException("not an AIFF file");
         }
 
+        int frameLength = 0;
         int length = dis.readInt();
         int iffType = dis.readInt();
-        fileRead += 12;
 
         int totallength;
         if(length <= 0 ) {
@@ -91,7 +86,6 @@
             // Read the chunk name
             int chunkName = dis.readInt();
             int chunkLen = dis.readInt();
-            fileRead += 8;
 
             int chunkRead = 0;
 
@@ -112,7 +106,13 @@
                 if (channels <= 0) {
                     throw new UnsupportedAudioFileException("Invalid number of channels");
                 }
-                dis.readInt(); // numSampleFrames
+                frameLength = dis.readInt(); // numSampleFrames
+                if (frameLength < 0) {
+                    // AiffFileFormat uses int, unlike AIS which uses long
+                    //TODO this (negative) value should be passed as long to AIS
+                    frameLength = AudioSystem.NOT_SPECIFIED;
+                }
+
                 int sampleSizeInBits = dis.readUnsignedShort();
                 if (sampleSizeInBits < 1 || sampleSizeInBits > 32) {
                     throw new UnsupportedAudioFileException("Invalid AIFF/COMM sampleSize");
@@ -149,38 +149,17 @@
                 break;
             case AiffFileFormat.SSND_MAGIC:
                 // Data chunk.
-                // we are getting *weird* numbers for chunkLen sometimes;
-                // this really should be the size of the data chunk....
-                int dataOffset = dis.readInt();
-                int blocksize = dis.readInt();
+                int dataOffset = dis.readInt(); // for now unused in javasound
+                int blocksize = dis.readInt();  // for now unused in javasound
                 chunkRead += 8;
-
-                // okay, now we are done reading the header.  we need to set the size
-                // of the data segment.  we know that sometimes the value we get for
-                // the chunksize is absurd.  this is the best i can think of:if the
-                // value seems okay, use it.  otherwise, we get our value of
-                // length by assuming that everything left is the data segment;
-                // its length should be our original length (for all AIFF data chunks)
-                // minus what we've read so far.
-                // $$kk: we should be able to get length for the data chunk right after
-                // we find "SSND."  however, some aiff files give *weird* numbers.  what
-                // is going on??
-
-                if (chunkLen < length) {
-                    dataLength = chunkLen - chunkRead;
-                } else {
-                    // $$kk: 11.03.98: this seems dangerous!
-                    dataLength = length - (fileRead + chunkRead);
-                }
                 ssndFound = true;
                 break;
             } // switch
-            fileRead += chunkRead;
             // skip the remainder of this chunk
             if (!ssndFound) {
                 int toSkip = chunkLen - chunkRead;
                 if (toSkip > 0) {
-                    fileRead += dis.skipBytes(toSkip);
+                    dis.skipBytes(toSkip);
                 }
             }
         } // while
@@ -188,36 +167,12 @@
         if (format == null) {
             throw new UnsupportedAudioFileException("missing COMM chunk");
         }
-        AudioFileFormat.Type type = aifc?AudioFileFormat.Type.AIFC:AudioFileFormat.Type.AIFF;
+        Type type = aifc ? Type.AIFC : Type.AIFF;
 
-        return new AiffFileFormat(type, totallength, format, dataLength / format.getFrameSize());
+        return new AiffFileFormat(type, totallength, format, frameLength);
     }
 
     // HELPER METHODS
-    /** write_ieee_extended(DataOutputStream dos, double f) throws IOException {
-     * Extended precision IEEE floating-point conversion routine.
-     * @argument DataOutputStream
-     * @argument double
-     * @return void
-     * @exception IOException
-     */
-    private void write_ieee_extended(DataOutputStream dos, double f) throws IOException {
-
-        int exponent = 16398;
-        double highMantissa = f;
-
-        // For now write the integer portion of f
-        // $$jb: 03.30.99: stay in synch with JMF on this!!!!
-        while (highMantissa < 44000) {
-            highMantissa *= 2;
-            exponent--;
-        }
-        dos.writeShort(exponent);
-        dos.writeInt( ((int) highMantissa) << 16);
-        dos.writeInt(0); // low Mantissa
-    }
-
-
     /**
      * read_ieee_extended
      * Extended precision IEEE floating-point conversion routine.
--- a/src/java.desktop/share/classes/com/sun/media/sound/AiffFileWriter.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/media/sound/AiffFileWriter.java	Mon Mar 14 20:53:59 2016 -0700
@@ -59,7 +59,6 @@
         super(new AudioFileFormat.Type[]{AudioFileFormat.Type.AIFF});
     }
 
-
     // METHODS TO IMPLEMENT AudioFileWriter
 
     @Override
@@ -83,7 +82,6 @@
         return new AudioFileFormat.Type[0];
     }
 
-
     @Override
     public int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException {
         Objects.requireNonNull(stream);
@@ -102,11 +100,9 @@
             throw new IOException("stream length not specified");
         }
 
-        int bytesWritten = writeAiffFile(stream, aiffFileFormat, out);
-        return bytesWritten;
+        return writeAiffFile(stream, aiffFileFormat, out);
     }
 
-
     @Override
     public int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException {
         Objects.requireNonNull(stream);
@@ -129,12 +125,15 @@
 
             // $$kk: 10.22.99: jan: please either implement this or throw an exception!
             // $$fb: 2001-07-13: done. Fixes Bug 4479981
-            int ssndBlockSize           = (aiffFileFormat.getFormat().getChannels() * aiffFileFormat.getFormat().getSampleSizeInBits());
+            int channels = aiffFileFormat.getFormat().getChannels();
+            int sampleSize = aiffFileFormat.getFormat().getSampleSizeInBits();
+            int ssndBlockSize = channels * ((sampleSize + 7) / 8);
 
             int aiffLength=bytesWritten;
             int ssndChunkSize=aiffLength-aiffFileFormat.getHeaderSize()+16;
             long dataSize=ssndChunkSize-16;
-            int numFrames=(int) (dataSize*8/ssndBlockSize);
+            //TODO possibly incorrect round
+            int numFrames = (int) (dataSize / ssndBlockSize);
 
             RandomAccessFile raf=new RandomAccessFile(out, "rw");
             // skip FORM magic
@@ -173,12 +172,7 @@
         AudioFormat streamFormat = stream.getFormat();
         AudioFormat.Encoding streamEncoding = streamFormat.getEncoding();
 
-
-        float sampleRate;
         int sampleSizeInBits;
-        int channels;
-        int frameSize;
-        float frameRate;
         int fileSize;
         boolean convert8to16 = false;
 
@@ -235,7 +229,6 @@
         return fileFormat;
     }
 
-
     private int writeAiffFile(InputStream in, AiffFileFormat aiffFileFormat, OutputStream out) throws IOException {
 
         int bytesRead = 0;
@@ -275,25 +268,20 @@
         AudioFormat.Encoding encoding = null;
 
         //$$fb a little bit nicer handling of constants
-
-        //int headerSize          = 54;
         int headerSize          = aiffFileFormat.getHeaderSize();
-
         //int fverChunkSize       = 0;
         int fverChunkSize       = aiffFileFormat.getFverChunkSize();
-        //int commChunkSize       = 26;
         int commChunkSize       = aiffFileFormat.getCommChunkSize();
         int aiffLength          = -1;
         int ssndChunkSize       = -1;
-        //int ssndOffset                        = headerSize - 16;
         int ssndOffset                  = aiffFileFormat.getSsndChunkOffset();
         short channels = (short) format.getChannels();
         short sampleSize = (short) format.getSampleSizeInBits();
-        int ssndBlockSize               = (channels * sampleSize);
-        int numFrames                   = aiffFileFormat.getFrameLength();
-        long dataSize            = -1;
+        int ssndBlockSize = channels * ((sampleSize + 7) / 8);
+        int numFrames = aiffFileFormat.getFrameLength();
+        long dataSize = -1;
         if( numFrames != AudioSystem.NOT_SPECIFIED) {
-            dataSize = (long) numFrames * ssndBlockSize / 8;
+            dataSize = (long) numFrames * ssndBlockSize;
             ssndChunkSize = (int)dataSize + 16;
             aiffLength = (int)dataSize+headerSize;
         }
@@ -403,9 +391,6 @@
 
     }
 
-
-
-
     // HELPER METHODS
 
     private static final int DOUBLE_MANTISSA_LENGTH = 52;
@@ -452,6 +437,4 @@
         dos.writeShort(extendedBits79To64);
         dos.writeLong(extendedBits63To0);
     }
-
-
 }
--- a/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Mon Mar 14 20:53:59 2016 -0700
@@ -255,16 +255,17 @@
     public AudioInputStream getAudioInputStream(final InputStream stream)
             throws UnsupportedAudioFileException, IOException {
 
-        AudioFileFormat format = getAudioFileFormat(stream);
+        final AudioFileFormat format = getAudioFileFormat(stream);
         // we've got everything, the stream is supported and it is at the
         // beginning of the header, so find the data chunk again and return an
         // AudioInputStream
-        RIFFReader riffiterator = new RIFFReader(stream);
+        final RIFFReader riffiterator = new RIFFReader(stream);
         while (riffiterator.hasNextChunk()) {
             RIFFReader chunk = riffiterator.nextChunk();
             if (chunk.getFormat().equals("data")) {
-                return new AudioInputStream(chunk, format.getFormat(), chunk
-                        .getSize());
+                final AudioFormat af = format.getFormat();
+                final long length = chunk.getSize() / af.getFrameSize();
+                return new AudioInputStream(chunk, af, length);
             }
         }
         throw new UnsupportedAudioFileException();
--- a/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java	Mon Mar 14 20:53:59 2016 -0700
@@ -95,16 +95,17 @@
     public AudioInputStream getAudioInputStream(final InputStream stream)
             throws UnsupportedAudioFileException, IOException {
 
-        AudioFileFormat format = getAudioFileFormat(stream);
+        final AudioFileFormat format = getAudioFileFormat(stream);
         // we've got everything, the stream is supported and it is at the
         // beginning of the header, so find the data chunk again and return an
         // AudioInputStream
-        RIFFReader riffiterator = new RIFFReader(stream);
+        final RIFFReader riffiterator = new RIFFReader(stream);
         while (riffiterator.hasNextChunk()) {
             RIFFReader chunk = riffiterator.nextChunk();
             if (chunk.getFormat().equals("data")) {
-                return new AudioInputStream(chunk, format.getFormat(),
-                        chunk.getSize());
+                final AudioFormat af = format.getFormat();
+                final long length = chunk.getSize() / af.getFrameSize();
+                return new AudioInputStream(chunk, af, length);
             }
         }
         throw new UnsupportedAudioFileException();
--- a/src/java.desktop/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java	Mon Mar 14 20:53:59 2016 -0700
@@ -231,7 +231,9 @@
             // Before all the checks below we first see if it's an FTP provider or a focus cycle root.
             // If it's the case just go down cycle (if it's set to "implicit").
             Component comp = getComponentDownCycle(aComponent, FORWARD_TRAVERSAL);
-            if (comp != null) {
+            // Check if aComponent is focus-cycle-root's default Component, i.e.
+            // focus cycle root & focus-cycle-root's default Component is same.
+            if (comp != null && comp != aComponent) {
                 return comp;
             }
 
--- a/src/java.desktop/share/classes/java/beans/EventHandler.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/java/beans/EventHandler.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -526,8 +526,11 @@
      * @throws NullPointerException if {@code listenerInterface} is null
      * @throws NullPointerException if {@code target} is null
      * @throws NullPointerException if {@code action} is null
-     *
+     * @throws IllegalArgumentException if creating a Proxy for
+     *         {@code listenerInterface} fails for any of the restrictions
+     *         specified by {@link Proxy#newProxyInstance}
      * @see #create(Class, Object, String, String)
+     * @see Proxy#newProxyInstance
      */
     public static <T> T create(Class<T> listenerInterface,
                                Object target, String action)
@@ -584,8 +587,11 @@
      * @throws NullPointerException if {@code listenerInterface} is null
      * @throws NullPointerException if {@code target} is null
      * @throws NullPointerException if {@code action} is null
-     *
+     * @throws IllegalArgumentException if creating a Proxy for
+     *         {@code listenerInterface} fails for any of the restrictions
+     *         specified by {@link Proxy#newProxyInstance}
      * @see #create(Class, Object, String, String, String)
+     * @see Proxy#newProxyInstance
      */
     public static <T> T create(Class<T> listenerInterface,
                                Object target, String action,
@@ -675,8 +681,11 @@
      * @throws NullPointerException if {@code listenerInterface} is null
      * @throws NullPointerException if {@code target} is null
      * @throws NullPointerException if {@code action} is null
-     *
+     * @throws IllegalArgumentException if creating a Proxy for
+     *         {@code listenerInterface} fails for any of the restrictions
+     *         specified by {@link Proxy#newProxyInstance}
      * @see EventHandler
+     * @see Proxy#newProxyInstance
      */
     public static <T> T create(Class<T> listenerInterface,
                                Object target, String action,
--- a/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,8 @@
 
 import java.awt.Image;
 import java.awt.Toolkit;
-import java.io.InputStream;
+import java.awt.image.ImageProducer;
+import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
@@ -171,19 +172,24 @@
     }
 
     /**
-     * This is a utility method to help in loading icon images.
-     * It takes the name of a resource file associated with the
-     * current object's class file and loads an image object
-     * from that file.  Typically images will be GIFs.
+     * This is a utility method to help in loading icon images. It takes the
+     * name of a resource file associated with the current object's class file
+     * and loads an image object from that file. Typically images will be GIFs.
      *
-     * @param resourceName  A pathname relative to the directory
-     *          holding the class file of the current class.  For example,
-     *          "wombat.gif".
-     * @return  an image object.  May be null if the load failed.
+     * @param  resourceName A pathname relative to the directory holding the
+     *         class file of the current class. For example, "wombat.gif".
+     * @return an image object or null if the resource is not found or the
+     *         resource could not be loaded as an Image
      */
     public Image loadImage(final String resourceName) {
-        try (InputStream in = getClass().getResourceAsStream(resourceName)) {
-            return Toolkit.getDefaultToolkit().createImage(in.readAllBytes());
+        try {
+            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/plugins/tiff/BaselineTIFFTagSet.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2175,9 +2175,9 @@
     }
 
     /**
-     * Returns a shared instance of a <code>BaselineTIFFTagSet</code>.
+     * Returns a shared instance of a {@code BaselineTIFFTagSet}.
      *
-     * @return a <code>BaselineTIFFTagSet</code> instance.
+     * @return a {@code BaselineTIFFTagSet} instance.
      */
     public synchronized static BaselineTIFFTagSet getInstance() {
         if (theInstance == null) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifGPSTagSet.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifGPSTagSet.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
     /**
      * A value to be used with the "GPSVersionID" tag to indicate GPS version
      * 2.2.  The value equals the US-ASCII encoding of the byte array
-     * <code>{'2', '2', '0', '0'}</code>.
+     * {@code {'2', '2', '0', '0'}}.
      *
      * @see #TAG_GPS_VERSION_ID
      */
@@ -711,9 +711,9 @@
     }
 
     /**
-     * Returns a shared instance of an <code>ExifGPSTagSet</code>.
+     * Returns a shared instance of an {@code ExifGPSTagSet}.
      *
-     * @return an <code>ExifGPSTagSet</code> instance.
+     * @return an {@code ExifGPSTagSet} instance.
      */
     public synchronized static ExifGPSTagSet getInstance() {
         if (theInstance == null) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifInteroperabilityTagSet.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifInteroperabilityTagSet.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,9 +88,9 @@
 
     /**
      * Returns the shared instance of
-     * <code>ExifInteroperabilityTagSet</code>.
+     * {@code ExifInteroperabilityTagSet}.
      *
-     * @return the <code>ExifInteroperabilityTagSet</code> instance.
+     * @return the {@code ExifInteroperabilityTagSet} instance.
      */
     public synchronized static ExifInteroperabilityTagSet getInstance() {
         if (theInstance == null) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifParentTIFFTagSet.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifParentTIFFTagSet.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,9 +80,9 @@
     }
 
     /**
-     * Returns a shared instance of an <code>ExifParentTIFFTagSet</code>.
+     * Returns a shared instance of an {@code ExifParentTIFFTagSet}.
      *
-     * @return an <code>ExifParentTIFFTagSet</code> instance.
+     * @return an {@code ExifParentTIFFTagSet} instance.
      */
     public synchronized static ExifParentTIFFTagSet getInstance() {
         if (theInstance == null) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifTIFFTagSet.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifTIFFTagSet.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
  * standard for annotating images used by most digital camera
  * manufacturers.  The Exif specification may be found at
  * <a href="http://www.exif.org/Exif2-2.PDF">
- * <code>http://www.exif.org/Exif2-2.PDF</code>
+ * {@code http://www.exif.org/Exif2-2.PDF}
  * </a>.
  *
  * <p> The definitions of the data types referenced by the field
@@ -67,7 +67,7 @@
     /**
      * A value to be used with the "ExifVersion" tag to indicate Exif version
      * 2.1.  The value equals the US-ASCII encoding of the byte array
-     * <code>{'0', '2', '1', '0'}</code>.
+     * {@code {'0', '2', '1', '0'}}.
      *
      * @see #TAG_EXIF_VERSION
      */
@@ -78,7 +78,7 @@
     /**
      * A value to be used with the "ExifVersion" tag to indicate Exif version
      * 2.2.  The value equals the US-ASCII encoding of the byte array
-     * <code>{'0', '2', '2', '0'}</code>.
+     * {@code {'0', '2', '2', '0'}}.
      *
      * @see #TAG_EXIF_VERSION
      */
@@ -94,7 +94,7 @@
 
     /**
      * A tag indicating the color space information (type SHORT).  The
-     * legal values are given by the <code>COLOR_SPACE_*</code>
+     * legal values are given by the {@code COLOR_SPACE_*}
      * constants.
      *
      * @see #COLOR_SPACE_SRGB
@@ -1256,7 +1256,7 @@
     static class ExifVersion extends TIFFTag {
 
         public ExifVersion() {
-            super("Exifversion",
+            super("ExifVersion",
                   TAG_EXIF_VERSION,
                   1 << TIFFTag.TIFF_UNDEFINED,
                   4);
@@ -1992,9 +1992,9 @@
     }
 
     /**
-     * Returns a shared instance of an <code>ExifTIFFTagSet</code>.
+     * Returns a shared instance of an {@code ExifTIFFTagSet}.
      *
-     * @return an <code>ExifTIFFTagSet</code> instance.
+     * @return an {@code ExifTIFFTagSet} instance.
      */
     public synchronized static ExifTIFFTagSet getInstance() {
         if (theInstance == null) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -131,9 +131,9 @@
     }
 
     /**
-     * Returns a shared instance of a <code>FaxTIFFTagSet</code>.
+     * Returns a shared instance of a {@code FaxTIFFTagSet}.
      *
-     * @return a <code>FaxTIFFTagSet</code> instance.
+     * @return a {@code FaxTIFFTagSet} instance.
      */
     public synchronized static FaxTIFFTagSet getInstance() {
         if (theInstance == null) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
  * standard for annotating georeferenced or geocoded raster imagery.
  * The GeoTIFF specification may be found at <a
  * href="http://www.remotesensing.org/geotiff/spec/geotiffhome.html">
- * <code>http://www.remotesensing.org/geotiff/spec/geotiffhome.html</code>
+ * {@code http://www.remotesensing.org/geotiff/spec/geotiffhome.html}
  * </a>. This class does <i>not</i> handle the <i>GeoKey</i>s referenced
  * from a <i>GeoKeyDirectoryTag</i> as those are not TIFF tags per se.
  *
@@ -63,7 +63,7 @@
     /** A tag used to store the <i>GeoKey</i> directory. */
     public static final int TAG_GEO_KEY_DIRECTORY = 34735;
 
-    /** A tag used to store all <code>double</code>-values <i>GeoKey</i>s. */
+    /** A tag used to store all {@code double}-values <i>GeoKey</i>s. */
     public static final int TAG_GEO_DOUBLE_PARAMS = 34736;
 
     /** A tag used to store all ASCII-values <i>GeoKey</i>s. */
@@ -97,7 +97,7 @@
 
     static class GeoKeyDirectory extends TIFFTag {
         public GeoKeyDirectory() {
-            super("GeoKeyDirectory",
+            super("GeoKeyDirectoryTag",
                   TAG_GEO_KEY_DIRECTORY,
                   1 << TIFFTag.TIFF_SHORT);
         }
@@ -105,7 +105,7 @@
 
     static class GeoDoubleParams extends TIFFTag {
         public GeoDoubleParams() {
-            super("GeoDoubleParams",
+            super("GeoDoubleParamsTag",
                   TAG_GEO_DOUBLE_PARAMS,
                   1 << TIFFTag.TIFF_DOUBLE);
         }
@@ -113,7 +113,7 @@
 
     static class GeoAsciiParams extends TIFFTag {
         public GeoAsciiParams() {
-            super("GeoAsciiParams",
+            super("GeoAsciiParamsTag",
                   TAG_GEO_ASCII_PARAMS,
                   1 << TIFFTag.TIFF_ASCII);
         }
@@ -137,9 +137,9 @@
     }
 
     /**
-     * Returns a shared instance of a <code>GeoTIFFTagSet</code>.
+     * Returns a shared instance of a {@code GeoTIFFTagSet}.
      *
-     * @return a <code>GeoTIFFTagSet</code> instance.
+     * @return a {@code GeoTIFFTagSet} instance.
      */
     public synchronized static GeoTIFFTagSet getInstance() {
         if (theInstance == null) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,58 +41,58 @@
  * image metadata. A TIFF image metadata tree represents an Image File
  * Directory (IFD) from a TIFF 6.0 stream. An IFD consists of a number of
  * IFD Entries each of which associates an identifying tag number with
- * a compatible value. A <code>TIFFDirectory</code> instance corresponds
+ * a compatible value. A {@code TIFFDirectory} instance corresponds
  * to an IFD and contains a set of {@link TIFFField}s each of which
  * corresponds to an IFD Entry in the IFD.
  *
- * <p>When reading, a <code>TIFFDirectory</code> may be created by passing
+ * <p>When reading, a {@code TIFFDirectory} may be created by passing
  * the value returned by {@link javax.imageio.ImageReader#getImageMetadata
  * ImageReader.getImageMetadata()} to {@link #createFromMetadata
  * createFromMetadata()}. The {@link TIFFField}s in the directory may then
  * be obtained using the accessor methods provided in this class.</p>
  *
  * <p>When writing, an {@link IIOMetadata} object for use by one of the
- * <code>write()</code> methods of {@link javax.imageio.ImageWriter} may be
- * created from a <code>TIFFDirectory</code> by {@link #getAsMetadata()}.
- * The <code>TIFFDirectory</code> itself may be created by construction or
- * from the <code>IIOMetadata</code> object returned by
+ * {@code write()} methods of {@link javax.imageio.ImageWriter} may be
+ * created from a {@code TIFFDirectory} by {@link #getAsMetadata()}.
+ * The {@code TIFFDirectory} itself may be created by construction or
+ * from the {@code IIOMetadata} object returned by
  * {@link javax.imageio.ImageWriter#getDefaultImageMetadata
- * ImageWriter.getDefaultImageMetadata()}. The <code>TIFFField</code>s in the
+ * ImageWriter.getDefaultImageMetadata()}. The {@code TIFFField}s in the
  * directory may be set using the mutator methods provided in this class.</p>
  *
- * <p>A <code>TIFFDirectory</code> is aware of the tag numbers in the
+ * <p>A {@code TIFFDirectory} is aware of the tag numbers in the
  * group of {@link TIFFTagSet}s associated with it. When
- * a <code>TIFFDirectory</code> is created from a native image metadata
+ * a {@code TIFFDirectory} is created from a native image metadata
  * object, these tag sets are derived from the <tt>tagSets</tt> attribute
  * of the <tt>TIFFIFD</tt> node.</p>
  *
- * <p>A <code>TIFFDirectory</code> might also have a parent {@link TIFFTag}.
+ * <p>A {@code TIFFDirectory} might also have a parent {@link TIFFTag}.
  * This will occur if the directory represents an IFD other than the root
  * IFD of the image. The parent tag is the tag of the IFD Entry which is a
- * pointer to the IFD represented by this <code>TIFFDirectory</code>. The
- * {@link TIFFTag#isIFDPointer} method of this parent <code>TIFFTag</code>
- * must return <code>true</code>.  When a <code>TIFFDirectory</code> is
+ * pointer to the IFD represented by this {@code TIFFDirectory}. The
+ * {@link TIFFTag#isIFDPointer} method of this parent {@code TIFFTag}
+ * must return {@code true}.  When a {@code TIFFDirectory} is
  * created from a native image metadata object, the parent tag set is set
  * from the <tt>parentTagName</tt> attribute of the corresponding
- * <tt>TIFFIFD</tt> node. Note that a <code>TIFFDirectory</code> instance
- * which has a non-<code>null</code> parent tag will be contained in the
- * data field of a <code>TIFFField</code> instance which has a tag field
+ * <tt>TIFFIFD</tt> node. Note that a {@code TIFFDirectory} instance
+ * which has a non-{@code null} parent tag will be contained in the
+ * data field of a {@code TIFFField} instance which has a tag field
  * equal to the contained directory's parent tag.</p>
  *
- * <p>As an example consider an Exif image. The <code>TIFFDirectory</code>
+ * <p>As an example consider an Exif image. The {@code TIFFDirectory}
  * instance corresponding to the Exif IFD in the Exif stream would have parent
  * tag {@link ExifParentTIFFTagSet#TAG_EXIF_IFD_POINTER TAG_EXIF_IFD_POINTER}
  * and would include {@link ExifTIFFTagSet} in its group of known tag sets.
- * The <code>TIFFDirectory</code> corresponding to this Exif IFD will be
- * contained in the data field of a <code>TIFFField</code> which will in turn
- * be contained in the <code>TIFFDirectory</code> corresponding to the primary
- * IFD of the Exif image which will itself have a <code>null</code>-valued
+ * The {@code TIFFDirectory} corresponding to this Exif IFD will be
+ * contained in the data field of a {@code TIFFField} which will in turn
+ * be contained in the {@code TIFFDirectory} corresponding to the primary
+ * IFD of the Exif image which will itself have a {@code null}-valued
  * parent tag.</p>
  *
  * <p><b>Note that this implementation is not synchronized. </b>If multiple
- * threads use a <code>TIFFDirectory</code> instance concurrently, and at
+ * threads use a {@code TIFFDirectory} instance concurrently, and at
  * least one of the threads modifies the directory, for example, by adding
- * or removing <code>TIFFField</code>s or <code>TIFFTagSet</code>s, it
+ * or removing {@code TIFFField}s or {@code TIFFTagSet}s, it
  * <i>must</i> be synchronized externally.</p>
  *
  * @since 9
@@ -107,10 +107,10 @@
     private static final int MAX_LOW_FIELD_TAG_NUM =
         BaselineTIFFTagSet.TAG_REFERENCE_BLACK_WHITE;
 
-    /** The <code>TIFFTagSets</code> associated with this directory. */
+    /** The {@code TIFFTagSets} associated with this directory. */
     private List<TIFFTagSet> tagSets;
 
-    /** The parent <code>TIFFTag</code> of this directory. */
+    /** The parent {@code TIFFTag} of this directory. */
     private TIFFTag parentTag;
 
     /**
@@ -123,13 +123,13 @@
     private int numLowFields = 0;
 
     /**
-     * A mapping of <code>Integer</code> tag numbers to <code>TIFFField</code>s
+     * A mapping of {@code Integer} tag numbers to {@code TIFFField}s
      * for fields which are not low tag numbered.
      */
     private Map<Integer,TIFFField> highFields = new TreeMap<Integer,TIFFField>();
 
     /**
-     * Creates a <code>TIFFDirectory</code> instance from the contents of
+     * Creates a {@code TIFFDirectory} instance from the contents of
      * an image metadata object. The supplied object must support an image
      * metadata format supported by the TIFF {@link javax.imageio.ImageWriter}
      * plug-in. This will usually be either the TIFF native image metadata
@@ -139,12 +139,12 @@
      * @param tiffImageMetadata A metadata object which supports a compatible
      * image metadata format.
      *
-     * @return A <code>TIFFDirectory</code> populated from the contents of
+     * @return A {@code TIFFDirectory} populated from the contents of
      * the supplied metadata object.
      *
-     * @throws NullPointerException if <code>tiffImageMetadata</code>
-     * is <code>null</code>.
-     * @throws IllegalArgumentException if <code>tiffImageMetadata</code>
+     * @throws NullPointerException if {@code tiffImageMetadata}
+     * is {@code null}.
+     * @throws IllegalArgumentException if {@code tiffImageMetadata}
      * does not support a compatible image metadata format.
      * @throws IIOInvalidTreeException if the supplied metadata object
      * cannot be parsed.
@@ -204,7 +204,7 @@
     }
 
     /**
-     * Converts a <code>TIFFDirectory</code> to a <code>TIFFIFD</code>.
+     * Converts a {@code TIFFDirectory} to a {@code TIFFIFD}.
      */
     private static TIFFIFD getDirectoryAsIFD(TIFFDirectory dir) {
         if(dir instanceof TIFFIFD) {
@@ -219,27 +219,39 @@
             TIFFField f = fields[i];
             TIFFTag tag = f.getTag();
             if(tag.isIFDPointer()) {
-                TIFFDirectory subIFD =
-                    getDirectoryAsIFD((TIFFDirectory)f.getData());
-                f = new TIFFField(tag, f.getType(), (long)f.getCount(), subIFD);
+                TIFFDirectory subDir = null;
+                if (f.hasDirectory()) {
+                    subDir = f.getDirectory();
+                } else if (f.getData() instanceof TIFFDirectory) {
+                    subDir = (TIFFDirectory)f.getData();
+                }
+                if (subDir != null) {
+                    TIFFDirectory subIFD = getDirectoryAsIFD(subDir);
+                    f = new TIFFField(tag, f.getType(), (long)f.getCount(),
+                                      subIFD);
+                } else {
+                    f = null;
+                }
             }
-            ifd.addTIFFField(f);
+            if (f != null) {
+                ifd.addTIFFField(f);
+            }
         }
 
         return ifd;
     }
 
     /**
-     * Constructs a <code>TIFFDirectory</code> which is aware of a given
+     * Constructs a {@code TIFFDirectory} which is aware of a given
      * group of {@link TIFFTagSet}s. An optional parent {@link TIFFTag}
      * may also be specified.
      *
-     * @param tagSets The <code>TIFFTagSets</code> associated with this
+     * @param tagSets The {@code TIFFTagSets} associated with this
      * directory.
-     * @param parentTag The parent <code>TIFFTag</code> of this directory;
-     * may be <code>null</code>.
-     * @throws NullPointerException if <code>tagSets</code> is
-     * <code>null</code>.
+     * @param parentTag The parent {@code TIFFTag} of this directory;
+     * may be {@code null}.
+     * @throws NullPointerException if {@code tagSets} is
+     * {@code null}.
      */
     public TIFFDirectory(TIFFTagSet[] tagSets, TIFFTag parentTag) {
         if(tagSets == null) {
@@ -256,8 +268,8 @@
     /**
      * Returns the {@link TIFFTagSet}s of which this directory is aware.
      *
-     * @return The <code>TIFFTagSet</code>s associated with this
-     * <code>TIFFDirectory</code>.
+     * @return The {@code TIFFTagSet}s associated with this
+     * {@code TIFFDirectory}.
      */
     public TIFFTagSet[] getTagSets() {
         return tagSets.toArray(new TIFFTagSet[tagSets.size()]);
@@ -267,9 +279,9 @@
      * Adds an element to the group of {@link TIFFTagSet}s of which this
      * directory is aware.
      *
-     * @param tagSet The <code>TIFFTagSet</code> to add.
-     * @throws NullPointerException if <code>tagSet</code> is
-     * <code>null</code>.
+     * @param tagSet The {@code TIFFTagSet} to add.
+     * @throws NullPointerException if {@code tagSet} is
+     * {@code null}.
      */
     public void addTagSet(TIFFTagSet tagSet) {
         if(tagSet == null) {
@@ -285,9 +297,9 @@
      * Removes an element from the group of {@link TIFFTagSet}s of which this
      * directory is aware.
      *
-     * @param tagSet The <code>TIFFTagSet</code> to remove.
-     * @throws NullPointerException if <code>tagSet</code> is
-     * <code>null</code>.
+     * @param tagSet The {@code TIFFTagSet} to remove.
+     * @throws NullPointerException if {@code tagSet} is
+     * {@code null}.
      */
     public void removeTagSet(TIFFTagSet tagSet) {
         if(tagSet == null) {
@@ -301,10 +313,10 @@
 
     /**
      * Returns the parent {@link TIFFTag} of this directory if one
-     * has been defined or <code>null</code> otherwise.
+     * has been defined or {@code null} otherwise.
      *
-     * @return The parent <code>TIFFTag</code> of this
-     * <code>TIFFDiectory</code> or <code>null</code>.
+     * @return The parent {@code TIFFTag} of this
+     * {@code TIFFDiectory} or {@code null}.
      */
     public TIFFTag getParentTag() {
         return parentTag;
@@ -312,12 +324,12 @@
 
     /**
      * Returns the {@link TIFFTag} which has tag number equal to
-     * <code>tagNumber</code> or <code>null</code> if no such tag
+     * {@code tagNumber} or {@code null} if no such tag
      * exists in the {@link TIFFTagSet}s associated with this
      * directory.
      *
      * @param tagNumber The tag number of interest.
-     * @return The corresponding <code>TIFFTag</code> or <code>null</code>.
+     * @return The corresponding {@code TIFFTag} or {@code null}.
      */
     public TIFFTag getTag(int tagNumber) {
         return TIFFIFD.getTag(tagNumber, tagSets);
@@ -326,8 +338,8 @@
     /**
      * Returns the number of {@link TIFFField}s in this directory.
      *
-     * @return The number of <code>TIFFField</code>s in this
-     * <code>TIFFDirectory</code>.
+     * @return The number of {@code TIFFField}s in this
+     * {@code TIFFDirectory}.
      */
     public int getNumTIFFFields() {
         return numLowFields + highFields.size();
@@ -339,7 +351,7 @@
      *
      * @param tagNumber The tag number.
      * @return Whether a {@link TIFFTag} with tag number equal to
-     * <code>tagNumber</code> is present in this <code>TIFFDirectory</code>.
+     * {@code tagNumber} is present in this {@code TIFFDirectory}.
      */
     public boolean containsTIFFField(int tagNumber) {
         return (tagNumber >= 0 && tagNumber <= MAX_LOW_FIELD_TAG_NUM &&
@@ -351,7 +363,7 @@
      * Adds a TIFF field to the directory.
      *
      * @param f The field to add.
-     * @throws NullPointerException if <code>f</code> is <code>null</code>.
+     * @throws NullPointerException if {@code f} is {@code null}.
      */
     public void addTIFFField(TIFFField f) {
         if(f == null) {
@@ -372,8 +384,8 @@
      * Retrieves a TIFF field from the directory.
      *
      * @param tagNumber The tag number of the tag associated with the field.
-     * @return A <code>TIFFField</code> with the requested tag number of
-     * <code>null</code> if no such field is present.
+     * @return A {@code TIFFField} with the requested tag number of
+     * {@code null} if no such field is present.
      */
     public TIFFField getTIFFField(int tagNumber) {
         TIFFField f;
@@ -444,7 +456,7 @@
      * Converts the directory to a metadata object.
      *
      * @return A metadata instance initialized from the contents of this
-     * <code>TIFFDirectory</code>.
+     * {@code TIFFDirectory}.
      */
     public IIOMetadata getAsMetadata() {
         return new TIFFImageMetadata(getDirectoryAsIFD(this));
@@ -453,7 +465,7 @@
     /**
      * Clones the directory and all the fields contained therein.
      *
-     * @return A clone of this <code>TIFFDirectory</code>.
+     * @return A clone of this {@code TIFFDirectory}.
      * @throws CloneNotSupportedException if the instance cannot be cloned.
      */
     @Override
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
  *
  * <p> A field in a TIFF Image File Directory (IFD) is defined as a
  * tag number accompanied by a sequence of values of identical data type.
- * TIFF 6.0 defines 12 data types; a 13th type <code>IFD</code> is
+ * TIFF 6.0 defines 12 data types; a 13th type {@code IFD} is
  * defined in TIFF Tech Note 1 of TIFF Specification Supplement 1. These
  * TIFF data types are referred to by Java constants and mapped internally
  * onto Java language data types and type names as follows:
@@ -68,10 +68,10 @@
  * {@link TIFFTag#TIFF_BYTE}
  * </td>
  * <td>
- * <code>byte</code>
+ * {@code byte}
  * </td>
  * <td>
- * <code>"Byte"</code>
+ * {@code "Byte"}
  * </td>
  * </tr>
  *
@@ -83,10 +83,10 @@
  * {@link TIFFTag#TIFF_ASCII}
  * </td>
  * <td>
- * <code>String</code>
+ * {@code String}
  * </td>
  * <td>
- * <code>"Ascii"</code>
+ * {@code "Ascii"}
  * </td>
  * </tr>
  *
@@ -98,10 +98,10 @@
  * {@link TIFFTag#TIFF_SHORT}
  * </td>
  * <td>
- * <code>char</code>
+ * {@code char}
  * </td>
  * <td>
- * <code>"Short"</code>
+ * {@code "Short"}
  * </td>
  * </tr>
  *
@@ -113,10 +113,10 @@
  * {@link TIFFTag#TIFF_LONG}
  * </td>
  * <td>
- * <code>long</code>
+ * {@code long}
  * </td>
  * <td>
- * <code>"Long"</code>
+ * {@code "Long"}
  * </td>
  * </tr>
  *
@@ -128,10 +128,10 @@
  * {@link TIFFTag#TIFF_RATIONAL}
  * </td>
  * <td>
- * <code>long[2]</code> {numerator, denominator}
+ * {@code long[2]} {numerator, denominator}
  * </td>
  * <td>
- * <code>"Rational"</code>
+ * {@code "Rational"}
  * </td>
  * </tr>
  *
@@ -143,10 +143,10 @@
  * {@link TIFFTag#TIFF_SBYTE}
  * </td>
  * <td>
- * <code>byte</code>
+ * {@code byte}
  * </td>
  * <td>
- * <code>"SByte"</code>
+ * {@code "SByte"}
  * </td>
  * </tr>
  *
@@ -158,10 +158,10 @@
  * {@link TIFFTag#TIFF_UNDEFINED}
  * </td>
  * <td>
- * <code>byte</code>
+ * {@code byte}
  * </td>
  * <td>
- * <code>"Undefined"</code>
+ * {@code "Undefined"}
  * </td>
  * </tr>
  *
@@ -173,10 +173,10 @@
  * {@link TIFFTag#TIFF_SSHORT}
  * </td>
  * <td>
- * <code>short</code>
+ * {@code short}
  * </td>
  * <td>
- * <code>"SShort"</code>
+ * {@code "SShort"}
  * </td>
  * </tr>
  *
@@ -188,10 +188,10 @@
  * {@link TIFFTag#TIFF_SLONG}
  * </td>
  * <td>
- * <code>int</code>
+ * {@code int}
  * </td>
  * <td>
- * <code>"SLong"</code>
+ * {@code "SLong"}
  * </td>
  * </tr>
  *
@@ -203,10 +203,10 @@
  * {@link TIFFTag#TIFF_SRATIONAL}
  * </td>
  * <td>
- * <code>int[2]</code> {numerator, denominator}
+ * {@code int[2]} {numerator, denominator}
  * </td>
  * <td>
- * <code>"SRational"</code>
+ * {@code "SRational"}
  * </td>
  * </tr>
  *
@@ -218,10 +218,10 @@
  * {@link TIFFTag#TIFF_FLOAT}
  * </td>
  * <td>
- * <code>float</code>
+ * {@code float}
  * </td>
  * <td>
- * <code>"Float"</code>
+ * {@code "Float"}
  * </td>
  * </tr>
  *
@@ -233,10 +233,10 @@
  * {@link TIFFTag#TIFF_DOUBLE}
  * </td>
  * <td>
- * <code>double</code>
+ * {@code double}
  * </td>
  * <td>
- * <code>"Double"</code>
+ * {@code "Double"}
  * </td>
  * </tr>
  *
@@ -248,10 +248,10 @@
  * {@link TIFFTag#TIFF_IFD_POINTER}
  * </td>
  * <td>
- * <code>long</code>
+ * {@code long}
  * </td>
  * <td>
- * <code>"IFDPointer"</code>
+ * {@code "IFDPointer"}
  * </td>
  * </tr>
  *
@@ -411,19 +411,19 @@
     }
 
     /**
-     * Creates a <code>TIFFField</code> from a TIFF native image
+     * Creates a {@code TIFFField} from a TIFF native image
      * metadata node. If the value of the <tt>"tagNumber"</tt> attribute
-     * of the node is not found in <code>tagSet</code> then a new
-     * <code>TIFFTag</code> with name <code>TIFFTag.UNKNOWN_TAG_NAME</code>
+     * of the node is not found in {@code tagSet} then a new
+     * {@code TIFFTag} with name {@code TIFFTag.UNKNOWN_TAG_NAME}
      * will be created and assigned to the field.
      *
-     * @param tagSet The <code>TIFFTagSet</code> to which the
-     * <code>TIFFTag</code> of the field belongs.
-     * @param node A native TIFF image metadata <code>TIFFField</code> node.
-     * @throws NullPointerException if <code>node</code> is
-     * <code>null</code>.
+     * @param tagSet The {@code TIFFTagSet} to which the
+     * {@code TIFFTag} of the field belongs.
+     * @param node A native TIFF image metadata {@code TIFFField} node.
+     * @throws NullPointerException if {@code node} is
+     * {@code null}.
      * @throws IllegalArgumentException if the name of the node is not
-     * <code>"TIFFField"</code>.
+     * {@code "TIFFField"}.
      * @return A new {@code TIFFField}.
      */
     public static TIFFField createFromMetadataNode(TIFFTagSet tagSet,
@@ -487,14 +487,14 @@
     }
 
     /**
-     * Constructs a <code>TIFFField</code> with arbitrary data. The
-     * <code>type</code> parameter must be a value for which
+     * Constructs a {@code TIFFField} with arbitrary data. The
+     * {@code type} parameter must be a value for which
      * {@link TIFFTag#isDataTypeOK tag.isDataTypeOK()}
-     * returns <code>true</code>. The <code>data</code> parameter must
+     * returns {@code true}. The {@code data} parameter must
      * be an array of a Java type appropriate for the type of the TIFF
      * field.
      *
-     * <p>Note that the value (data) of the <code>TIFFField</code>
+     * <p>Note that the value (data) of the {@code TIFFField}
      * will always be the actual field value regardless of the number of
      * bytes required for that value. This is the case despite the fact
      * that the TIFF <i>IFD Entry</i> corresponding to the field may
@@ -503,24 +503,29 @@
      * value fits into 4 bytes). In other words, the value of the
      * field will already have been read from the TIFF stream. (An exception
      * to this case may occur when the field represents the contents of a
-     * non-baseline IFD. In that case the data will be a <code>long[]</code>
-     * containing the offset to the IFD and the <code>TIFFDirectory</code>
+     * non-baseline IFD. In that case the data will be a {@code long[]}
+     * containing the offset to the IFD and the {@code TIFFDirectory}
      * returned by {@link #getDirectory()} will be its contents.)
      *
      * @param tag The tag to associated with this field.
-     * @param type One of the <code>TIFFTag.TIFF_*</code> constants
+     * @param type One of the {@code TIFFTag.TIFF_*} constants
      * indicating the data type of the field as written to the TIFF stream.
      * @param count The number of data values.
      * @param data The actual data content of the field.
      *
-     * @throws NullPointerException if <code>tag&nbsp;==&nbsp;null</code>.
-     * @throws IllegalArgumentException if <code>type</code> is not
-     * one of the <code>TIFFTag.TIFF_*</code> data type constants.
-     * @throws IllegalArgumentException if <code>type</code> is an unacceptable
-     * data type for the supplied <code>TIFFTag</code>.
-     * @throws IllegalArgumentException if <code>count&nbsp;&lt;&nbsp;0</code>.
-     * @throws NullPointerException if <code>data&nbsp;==&nbsp;null</code>.
-     * @throws IllegalArgumentException if <code>data</code> is an instance of
+     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws IllegalArgumentException if {@code type} is not
+     * one of the {@code TIFFTag.TIFF_*} data type constants.
+     * @throws IllegalArgumentException if {@code type} is an unacceptable
+     * data type for the supplied {@code TIFFTag}.
+     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;0}.
+     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;1}
+     * and {@code type} is {@code TIFF_RATIONAL} or
+     * {@code TIFF_SRATIONAL}.
+     * @throws IllegalArgumentException if {@code count&nbsp;&ne;&nbsp;1}
+     * and {@code type} is {@code TIFF_IFD_POINTER}.
+     * @throws NullPointerException if {@code data&nbsp;==&nbsp;null}.
+     * @throws IllegalArgumentException if {@code data} is an instance of
      * a class incompatible with the specified type.
      * @throws IllegalArgumentException if the size of the data array is wrong.
      */
@@ -534,6 +539,14 @@
                 + " for " + tag.getName() + " tag");
         } else if(count < 0) {
             throw new IllegalArgumentException("count < 0!");
+        } else if((type == TIFFTag.TIFF_RATIONAL
+                   || type == TIFFTag.TIFF_SRATIONAL)
+                  && count < 1) {
+            throw new IllegalArgumentException
+                ("Type is TIFF_RATIONAL or TIFF_SRATIONAL and count < 1");
+        } else if (type == TIFFTag.TIFF_IFD_POINTER && count != 1) {
+            throw new IllegalArgumentException
+                ("Type is TIFF_IFD_POINTER count != 1");
         } else if(data == null) {
             throw new NullPointerException("data == null!");
         }
@@ -612,15 +625,15 @@
      * parameters and the created array.
      *
      * @param tag The tag to associated with this field.
-     * @param type One of the <code>TIFFTag.TIFF_*</code> constants
+     * @param type One of the {@code TIFFTag.TIFF_*} constants
      * indicating the data type of the field as written to the TIFF stream.
      * @param count The number of data values.
-     * @throws NullPointerException if <code>tag&nbsp;==&nbsp;null</code>.
-     * @throws IllegalArgumentException if <code>type</code> is not
-     * one of the <code>TIFFTag.TIFF_*</code> data type constants.
-     * @throws IllegalArgumentException if <code>type</code> is an unacceptable
-     * data type for the supplied <code>TIFFTag</code>.
-     * @throws IllegalArgumentException if <code>count&nbsp;&lt;&nbsp;0</code>.
+     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws IllegalArgumentException if {@code type} is not
+     * one of the {@code TIFFTag.TIFF_*} data type constants.
+     * @throws IllegalArgumentException if {@code type} is an unacceptable
+     * data type for the supplied {@code TIFFTag}.
+     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;0}.
      * @see #TIFFField(TIFFTag,int,int,Object)
      */
     public TIFFField(TIFFTag tag, int type, int count) {
@@ -628,20 +641,20 @@
     }
 
     /**
-     * Constructs a <code>TIFFField</code> with a single non-negative integral
+     * Constructs a {@code TIFFField} with a single non-negative integral
      * value.
      * The field will have type
      * {@link TIFFTag#TIFF_SHORT  TIFF_SHORT} if
-     * <code>val&nbsp;&lt;&nbsp;65536</code> and type
+     * {@code val&nbsp;&lt;&nbsp;65536} and type
      * {@link TIFFTag#TIFF_LONG TIFF_LONG} otherwise.  The count
      * of the field will be unity.
      *
      * @param tag The tag to associate with this field.
      * @param value The value to associate with this field.
-     * @throws NullPointerException if <code>tag&nbsp;==&nbsp;null</code>.
+     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
      * @throws IllegalArgumentException if the derived type is unacceptable
-     * for the supplied <code>TIFFTag</code>.
-     * @throws IllegalArgumentException if <code>value&nbsp;&lt;&nbsp;0</code>.
+     * for the supplied {@code TIFFTag}.
+     * @throws IllegalArgumentException if {@code value&nbsp;&lt;&nbsp;0}.
      */
     public TIFFField(TIFFTag tag, int value) {
         if(tag == null) {
@@ -677,24 +690,24 @@
     }
 
     /**
-     * Constructs a <code>TIFFField</code> with an IFD offset and contents.
+     * Constructs a {@code TIFFField} with an IFD offset and contents.
      * The offset will be stored as the data of this field as
-     * <code>long[] {offset}</code>. The directory will not be cloned. The count
+     * {@code long[] {offset}}. The directory will not be cloned. The count
      * of the field will be unity.
      *
      * @param tag The tag to associated with this field.
-     * @param type One of the constants <code>TIFFTag.TIFF_LONG</code> or
-     * <code>TIFFTag.TIFF_IFD_POINTER</code>.
+     * @param type One of the constants {@code TIFFTag.TIFF_LONG} or
+     * {@code TIFFTag.TIFF_IFD_POINTER}.
      * @param offset The IFD offset.
      * @param dir The directory.
      *
-     * @throws NullPointerException if <code>tag&nbsp;==&nbsp;null</code>.
-     * @throws IllegalArgumentException if <code>type</code> is neither
-     * <code>TIFFTag.TIFF_LONG</code> nor <code>TIFFTag.TIFF_IFD_POINTER</code>.
-     * @throws IllegalArgumentException if <code>type</code> is an unacceptable
-     * data type for the supplied <code>TIFFTag</code>.
-     * @throws IllegalArgumentException if <code>offset</code> is non-positive.
-     * @throws NullPointerException if <code>dir&nbsp;==&nbsp;null</code>.
+     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws IllegalArgumentException if {@code type} is neither
+     * {@code TIFFTag.TIFF_LONG} nor {@code TIFFTag.TIFF_IFD_POINTER}.
+     * @throws IllegalArgumentException if {@code type} is an unacceptable
+     * data type for the supplied {@code TIFFTag}.
+     * @throws IllegalArgumentException if {@code offset} is non-positive.
+     * @throws NullPointerException if {@code dir&nbsp;==&nbsp;null}.
      *
      * @see #TIFFField(TIFFTag,int,int,Object)
      */
@@ -715,14 +728,14 @@
     /**
      * Retrieves the tag associated with this field.
      *
-     * @return The associated <code>TIFFTag</code>.
+     * @return The associated {@code TIFFTag}.
      */
     public TIFFTag getTag() {
         return tag;
     }
 
     /**
-     * Retrieves the tag number in the range <code>[0,&nbsp;65535]</code>.
+     * Retrieves the tag number in the range {@code [0,&nbsp;65535]}.
      *
      * @return The tag number.
      */
@@ -732,7 +745,7 @@
 
     /**
      * Returns the type of the data stored in the field.  For a TIFF 6.0
-     * stream, the value will equal one of the <code>TIFFTag.TIFF_*</code>
+     * stream, the value will equal one of the {@code TIFFTag.TIFF_*}
      * constants. For future revisions of TIFF, higher values are possible.
      *
      * @return The data type of the field value.
@@ -744,11 +757,11 @@
     /**
      * Returns the name of the supplied data type constant.
      *
-     * @param dataType One of the <code>TIFFTag.TIFF_*</code> constants
+     * @param dataType One of the {@code TIFFTag.TIFF_*} constants
      * indicating the data type of the field as written to the TIFF stream.
      * @return The type name corresponding to the supplied type constant.
-     * @throws IllegalArgumentException if <code>dataType</code> is not
-     * one of the <code>TIFFTag.TIFF_*</code> data type constants.
+     * @throws IllegalArgumentException if {@code dataType} is not
+     * one of the {@code TIFFTag.TIFF_*} data type constants.
      */
     public static String getTypeName(int dataType) {
         if (dataType < TIFFTag.MIN_DATATYPE ||
@@ -761,11 +774,11 @@
 
     /**
      * Returns the data type constant corresponding to the supplied data
-     * type name. If the name is unknown <code>-1</code> will be returned.
+     * type name. If the name is unknown {@code -1} will be returned.
      *
      * @param typeName The type name.
-     * @return One of the <code>TIFFTag.TIFF_*</code> constants or
-     * <code>-1</code> if the name is not recognized.
+     * @return One of the {@code TIFFTag.TIFF_*} constants or
+     * {@code -1} if the name is not recognized.
      */
     public static int getTypeByName(String typeName) {
         for (int i = TIFFTag.MIN_DATATYPE; i <= TIFFTag.MAX_DATATYPE; i++) {
@@ -780,14 +793,14 @@
     /**
      * Creates an array appropriate for the indicated data type.
      *
-     * @param dataType One of the <code>TIFFTag.TIFF_*</code> data type
+     * @param dataType One of the {@code TIFFTag.TIFF_*} data type
      * constants.
      * @param count The number of values in the array.
      * @return An array appropriate for the specified data type.
      *
-     * @throws IllegalArgumentException if <code>dataType</code> is not
-     * one of the <code>TIFFTag.TIFF_*</code> data type constants.
-     * @throws IllegalArgumentException if <code>count&nbsp;&lt;&nbsp;0</code>.
+     * @throws IllegalArgumentException if {@code dataType} is not
+     * one of the {@code TIFFTag.TIFF_*} data type constants.
+     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;0}.
      */
     public static Object createArrayForType(int dataType, int count) {
         if(count < 0) {
@@ -823,15 +836,15 @@
     }
 
     /**
-     * Returns the <code>TIFFField</code> as a node named either
+     * Returns the {@code TIFFField} as a node named either
      * <tt>"TIFFField"</tt> or <tt>"TIFFIFD"</tt> as described in the
      * TIFF native image metadata specification. The node will be named
      * <tt>"TIFFIFD"</tt> if and only if the field's data object is an
      * instance of {@link TIFFDirectory} or equivalently
      * {@link TIFFTag#isIFDPointer getTag.isIFDPointer()} returns
-     * <code>true</code>.
+     * {@code true}.
      *
-     * @return a <code>Node</code> named <tt>"TIFFField"</tt> or
+     * @return a {@code Node} named <tt>"TIFFField"</tt> or
      * <tt>"TIFFIFD"</tt>.
      */
     public Node getAsNativeNode() {
@@ -850,8 +863,8 @@
 
     /**
      * Returns the number of data items present in the field.  For
-     * <code>TIFFTag.TIFF_ASCII</code> fields, the value returned is the
-     * number of <code>String</code>s, not the total length of the
+     * {@code TIFFTag.TIFF_ASCII} fields, the value returned is the
+     * number of {@code String}s, not the total length of the
      * data as in the file representation.
      *
      * @return The number of data items present in the field.
@@ -871,17 +884,17 @@
 
     /**
      * Returns the data as an uninterpreted array of
-     * <code>byte</code>s.  The type of the field must be one of
-     * <code>TIFFTag.TIFF_BYTE</code>, <code>TIFF_SBYTE</code>, or
-     * <code>TIFF_UNDEFINED</code>.
+     * {@code byte}s.  The type of the field must be one of
+     * {@code TIFFTag.TIFF_BYTE}, {@code TIFF_SBYTE}, or
+     * {@code TIFF_UNDEFINED}.
      *
-     * <p> For data in <code>TIFFTag.TIFF_BYTE</code> format, the application
+     * <p> For data in {@code TIFFTag.TIFF_BYTE} format, the application
      * must take care when promoting the data to longer integral types
      * to avoid sign extension.
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_BYTE</code>, <code>TIFF_SBYTE</code>, or
-     * <code>TIFF_UNDEFINED</code>.
+     * {@code TIFF_BYTE}, {@code TIFF_SBYTE}, or
+     * {@code TIFF_UNDEFINED}.
      * @return The data as an uninterpreted array of bytes.
      */
     public byte[] getAsBytes() {
@@ -889,11 +902,11 @@
     }
 
     /**
-     * Returns <code>TIFFTag.TIFF_SHORT</code> data as an array of
-     * <code>char</code>s (unsigned 16-bit integers).
+     * Returns {@code TIFFTag.TIFF_SHORT} data as an array of
+     * {@code char}s (unsigned 16-bit integers).
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_SHORT</code>.
+     * {@code TIFF_SHORT}.
      * @return The data as an array of {@code char}s.
      */
     public char[] getAsChars() {
@@ -901,11 +914,11 @@
     }
 
     /**
-     * Returns <code>TIFFTag.TIFF_SSHORT</code> data as an array of
-     * <code>short</code>s (signed 16-bit integers).
+     * Returns {@code TIFFTag.TIFF_SSHORT} data as an array of
+     * {@code short}s (signed 16-bit integers).
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_SSHORT</code>.
+     * {@code TIFF_SSHORT}.
      * @return The data as an array of {@code short}s.
      */
     public short[] getAsShorts() {
@@ -913,12 +926,12 @@
     }
 
     /**
-     * Returns <code>TIFFTag.TIFF_SLONG</code> data as an array of
-     * <code>int</code>s (signed 32-bit integers).
+     * Returns {@code TIFFTag.TIFF_SLONG} data as an array of
+     * {@code int}s (signed 32-bit integers).
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_SHORT</code>, <code>TIFF_SSHORT</code>, or
-     * <code>TIFF_SLONG</code>.
+     * {@code TIFF_SHORT}, {@code TIFF_SSHORT}, or
+     * {@code TIFF_SLONG}.
      * @return The data as an array of {@code int}s.
      */
     public int[] getAsInts() {
@@ -944,12 +957,12 @@
     }
 
     /**
-     * Returns <code>TIFFTag.TIFF_LONG</code> or
-     * <code>TIFF_IFD_POINTER</code> data as an array of
-     * <code>long</code>s (signed 64-bit integers).
+     * Returns {@code TIFFTag.TIFF_LONG} or
+     * {@code TIFF_IFD_POINTER} data as an array of
+     * {@code long}s (signed 64-bit integers).
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_LONG</code> or <code>TIFF_IFD_POINTER</code>.
+     * {@code TIFF_LONG} or {@code TIFF_IFD_POINTER}.
      * @return The data as an array of {@code long}s.
      */
     public long[] getAsLongs() {
@@ -957,11 +970,11 @@
     }
 
     /**
-     * Returns <code>TIFFTag.TIFF_FLOAT</code> data as an array of
-     * <code>float</code>s (32-bit floating-point values).
+     * Returns {@code TIFFTag.TIFF_FLOAT} data as an array of
+     * {@code float}s (32-bit floating-point values).
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_FLOAT</code>.
+     * {@code TIFF_FLOAT}.
      * @return The data as an array of {@code float}s.
      */
     public float[] getAsFloats() {
@@ -969,11 +982,11 @@
     }
 
     /**
-     * Returns <code>TIFFTag.TIFF_DOUBLE</code> data as an array of
-     * <code>double</code>s (64-bit floating-point values).
+     * Returns {@code TIFFTag.TIFF_DOUBLE} data as an array of
+     * {@code double}s (64-bit floating-point values).
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_DOUBLE</code>.
+     * {@code TIFF_DOUBLE}.
      * @return The data as an array of {@code double}s.
      */
     public double[] getAsDoubles() {
@@ -981,11 +994,11 @@
     }
 
     /**
-     * Returns <code>TIFFTag.TIFF_SRATIONAL</code> data as an array of
-     * 2-element arrays of <code>int</code>s.
+     * Returns {@code TIFFTag.TIFF_SRATIONAL} data as an array of
+     * 2-element arrays of {@code int}s.
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_SRATIONAL</code>.
+     * {@code TIFF_SRATIONAL}.
      * @return The data as an array of signed rationals.
      */
     public int[][] getAsSRationals() {
@@ -993,11 +1006,11 @@
     }
 
     /**
-     * Returns <code>TIFFTag.TIFF_RATIONAL</code> data as an array of
-     * 2-element arrays of <code>long</code>s.
+     * Returns {@code TIFFTag.TIFF_RATIONAL} data as an array of
+     * 2-element arrays of {@code long}s.
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_RATIONAL</code>.
+     * {@code TIFF_RATIONAL}.
      * @return The data as an array of unsigned rationals.
      */
     public long[][] getAsRationals() {
@@ -1005,30 +1018,30 @@
     }
 
     /**
-     * Returns data in any format as an <code>int</code>.
+     * Returns data in any format as an {@code int}.
      *
-     * <p> <code>TIFFTag.TIFF_BYTE</code> values are treated as unsigned; that
+     * <p> {@code TIFFTag.TIFF_BYTE} values are treated as unsigned; that
      * is, no sign extension will take place and the returned value
-     * will be in the range [0, 255].  <code>TIFF_SBYTE</code> data
+     * will be in the range [0, 255].  {@code TIFF_SBYTE} data
      * will be returned in the range [-128, 127].
      *
-     * <p> A <code>TIFF_UNDEFINED</code> value is treated as though
-     * it were a <code>TIFF_BYTE</code>.
+     * <p> A {@code TIFF_UNDEFINED} value is treated as though
+     * it were a {@code TIFF_BYTE}.
      *
-     * <p> Data in <code>TIFF_SLONG</code>, <code>TIFF_LONG</code>,
-     * <code>TIFF_FLOAT</code>, <code>TIFF_DOUBLE</code> or
-     * <code>TIFF_IFD_POINTER</code> format are simply cast to
-     * <code>int</code> and may suffer from truncation.
+     * <p> Data in {@code TIFF_SLONG}, {@code TIFF_LONG},
+     * {@code TIFF_FLOAT}, {@code TIFF_DOUBLE} or
+     * {@code TIFF_IFD_POINTER} format are simply cast to
+     * {@code int} and may suffer from truncation.
      *
-     * <p> Data in <code>TIFF_SRATIONAL</code> or
-     * <code>TIFF_RATIONAL</code> format are evaluated by dividing the
+     * <p> Data in {@code TIFF_SRATIONAL} or
+     * {@code TIFF_RATIONAL} format are evaluated by dividing the
      * numerator into the denominator using double-precision
-     * arithmetic and then casting to <code>int</code>.  Loss of
+     * arithmetic and then casting to {@code int}.  Loss of
      * precision and truncation may occur.
      *
-     * <p> Data in <code>TIFF_ASCII</code> format will be parsed as by
-     * the <code>Double.parseDouble</code> method, with the result
-     * case to <code>int</code>.
+     * <p> Data in {@code TIFF_ASCII} format will be parsed as by
+     * the {@code Double.parseDouble} method, with the result
+     * case to {@code int}.
      *
      * @param index The index of the data.
      * @return The data at the given index as an {@code int}.
@@ -1068,17 +1081,17 @@
     }
 
     /**
-     * Returns data in any format as a <code>long</code>.
+     * Returns data in any format as a {@code long}.
      *
-     * <p> <code>TIFFTag.TIFF_BYTE</code> and <code>TIFF_UNDEFINED</code> data
+     * <p> {@code TIFFTag.TIFF_BYTE} and {@code TIFF_UNDEFINED} data
      * are treated as unsigned; that is, no sign extension will take
      * place and the returned value will be in the range [0, 255].
-     * <code>TIFF_SBYTE</code> data will be returned in the range
+     * {@code TIFF_SBYTE} data will be returned in the range
      * [-128, 127].
      *
-     * <p> Data in <code>TIFF_ASCII</code> format will be parsed as by
-     * the <code>Double.parseDouble</code> method, with the result
-     * cast to <code>long</code>.
+     * <p> Data in {@code TIFF_ASCII} format will be parsed as by
+     * the {@code Double.parseDouble} method, with the result
+     * cast to {@code long}.
      *
      * @param index The index of the data.
      * @return The data at the given index as a {@code long}.
@@ -1114,27 +1127,27 @@
     }
 
     /**
-     * Returns data in any format as a <code>float</code>.
+     * Returns data in any format as a {@code float}.
      *
-     * <p> <code>TIFFTag.TIFF_BYTE</code> and <code>TIFF_UNDEFINED</code> data
+     * <p> {@code TIFFTag.TIFF_BYTE} and {@code TIFF_UNDEFINED} data
      * are treated as unsigned; that is, no sign extension will take
      * place and the returned value will be in the range [0, 255].
-     * <code>TIFF_SBYTE</code> data will be returned in the range
+     * {@code TIFF_SBYTE} data will be returned in the range
      * [-128, 127].
      *
-     * <p> Data in <code>TIFF_SLONG</code>, <code>TIFF_LONG</code>,
-     * <code>TIFF_DOUBLE</code>, or <code>TIFF_IFD_POINTER</code> format are
-     * simply cast to <code>float</code> and may suffer from
+     * <p> Data in {@code TIFF_SLONG}, {@code TIFF_LONG},
+     * {@code TIFF_DOUBLE}, or {@code TIFF_IFD_POINTER} format are
+     * simply cast to {@code float} and may suffer from
      * truncation.
      *
-     * <p> Data in <code>TIFF_SRATIONAL</code> or
-     * <code>TIFF_RATIONAL</code> format are evaluated by dividing the
+     * <p> Data in {@code TIFF_SRATIONAL} or
+     * {@code TIFF_RATIONAL} format are evaluated by dividing the
      * numerator into the denominator using double-precision
-     * arithmetic and then casting to <code>float</code>.
+     * arithmetic and then casting to {@code float}.
      *
-     * <p> Data in <code>TIFF_ASCII</code> format will be parsed as by
-     * the <code>Double.parseDouble</code> method, with the result
-     * cast to <code>float</code>.
+     * <p> Data in {@code TIFF_ASCII} format will be parsed as by
+     * the {@code Double.parseDouble} method, with the result
+     * cast to {@code float}.
      *
      * @param index The index of the data.
      * @return The data at the given index as a {@code float}.
@@ -1174,21 +1187,21 @@
     }
 
     /**
-     * Returns data in any format as a <code>double</code>.
+     * Returns data in any format as a {@code double}.
      *
-     * <p> <code>TIFFTag.TIFF_BYTE</code> and <code>TIFF_UNDEFINED</code> data
+     * <p> {@code TIFFTag.TIFF_BYTE} and {@code TIFF_UNDEFINED} data
      * are treated as unsigned; that is, no sign extension will take
      * place and the returned value will be in the range [0, 255].
-     * <code>TIFF_SBYTE</code> data will be returned in the range
+     * {@code TIFF_SBYTE} data will be returned in the range
      * [-128, 127].
      *
-     * <p> Data in <code>TIFF_SRATIONAL</code> or
-     * <code>TIFF_RATIONAL</code> format are evaluated by dividing the
+     * <p> Data in {@code TIFF_SRATIONAL} or
+     * {@code TIFF_RATIONAL} format are evaluated by dividing the
      * numerator into the denominator using double-precision
      * arithmetic.
      *
-     * <p> Data in <code>TIFF_ASCII</code> format will be parsed as by
-     * the <code>Double.parseDouble</code> method.
+     * <p> Data in {@code TIFF_ASCII} format will be parsed as by
+     * the {@code Double.parseDouble} method.
      *
      * @param index The index of the data.
      * @return The data at the given index as a {@code double}.
@@ -1228,11 +1241,11 @@
     }
 
     /**
-     * Returns a <code>TIFFTag.TIFF_ASCII</code> value as a
-     * <code>String</code>.
+     * Returns a {@code TIFFTag.TIFF_ASCII} value as a
+     * {@code String}.
      *
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_ASCII</code>.
+     * {@code TIFF_ASCII}.
      *
      * @param index The index of the data.
      * @return The data at the given index as a {@code String}.
@@ -1242,13 +1255,13 @@
     }
 
     /**
-     * Returns a <code>TIFFTag.TIFF_SRATIONAL</code> data item as a
-     * two-element array of <code>int</code>s.
+     * Returns a {@code TIFFTag.TIFF_SRATIONAL} data item as a
+     * two-element array of {@code int}s.
      *
      * @param index The index of the data.
      * @return The data at the given index as a signed rational.
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_SRATIONAL</code>.
+     * {@code TIFF_SRATIONAL}.
      */
     public int[] getAsSRational(int index) {
         return ((int[][])data)[index];
@@ -1261,7 +1274,7 @@
      * @param index The index of the data.
      * @return The data at the given index as an unsigned rational.
      * @throws ClassCastException if the field is not of type
-     * <code>TIFF_RATIONAL</code>.
+     * {@code TIFF_RATIONAL}.
      */
     public long[] getAsRational(int index) {
         return ((long[][])data)[index];
@@ -1269,11 +1282,11 @@
 
 
     /**
-     * Returns a <code>String</code> containing a human-readable
+     * Returns a {@code String} containing a human-readable
      * version of the data item.  Data of type
-     * <code>TIFFTag.TIFF_RATIONAL</code> or <code>TIFF_SRATIONAL</code> are
+     * {@code TIFFTag.TIFF_RATIONAL} or {@code TIFF_SRATIONAL} are
      * represented as a pair of integers separated by a
-     * <code>'/'</code> character.
+     * {@code '/'} character.
      *
      * @param index The index of the data.
      * @return The data at the given index as a {@code String}.
@@ -1342,7 +1355,7 @@
     }
 
     /**
-     * Returns whether the field has a <code>TIFFDirectory</code>.
+     * Returns whether the field has a {@code TIFFDirectory}.
      *
      * @return true if and only if getDirectory() returns non-null.
      */
@@ -1351,8 +1364,8 @@
     }
 
     /**
-     * Returns the associated <code>TIFFDirectory</code>, if available. If no
-     * directory is set, then <code>null</code> will be returned.
+     * Returns the associated {@code TIFFDirectory}, if available. If no
+     * directory is set, then {@code null} will be returned.
      *
      * @return the TIFFDirectory instance or null.
      */
@@ -1363,7 +1376,7 @@
     /**
      * Clones the field and all the information contained therein.
      *
-     * @return A clone of this <code>TIFFField</code>.
+     * @return A clone of this {@code TIFFField}.
      * @throws CloneNotSupportedException if the instance cannot be cloned.
      */
     @Override
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,11 +39,11 @@
  * be provided by this interface.
  *
  * <p> Additional TIFF tags must be organized into
- * <code>TIFFTagSet</code>s.  A <code>TIFFTagSet</code> may be
+ * {@code TIFFTagSet}s.  A {@code TIFFTagSet} may be
  * provided to the reader by means of the
- * <code>addAllowedTagSet</code> method.  By default, the tag sets
- * <code>BaselineTIFFTagSet</code>, <code>FaxTIFFTagSet</code>,
- * <code>ExifParentTIFFTagSet</code>, and <code>GeoTIFFTagSet</code>
+ * {@code addAllowedTagSet} method.  By default, the tag sets
+ * {@code BaselineTIFFTagSet}, {@code FaxTIFFTagSet},
+ * {@code ExifParentTIFFTagSet}, and {@code GeoTIFFTagSet}
  * are included.
  *
  * @since 9
@@ -53,10 +53,10 @@
     private List<TIFFTagSet> allowedTagSets = new ArrayList<TIFFTagSet>(4);
 
     /**
-     * Constructs a <code>TIFFImageReadParam</code>.  Tags defined by
-     * the <code>TIFFTagSet</code>s <code>BaselineTIFFTagSet</code>,
-     * <code>FaxTIFFTagSet</code>, <code>ExifParentTIFFTagSet</code>, and
-     * <code>GeoTIFFTagSet</code> will be supported.
+     * Constructs a {@code TIFFImageReadParam}.  Tags defined by
+     * the {@code TIFFTagSet}s {@code BaselineTIFFTagSet},
+     * {@code FaxTIFFTagSet}, {@code ExifParentTIFFTagSet}, and
+     * {@code GeoTIFFTagSet} will be supported.
      *
      * @see BaselineTIFFTagSet
      * @see FaxTIFFTagSet
@@ -71,13 +71,13 @@
     }
 
     /**
-     * Adds a <code>TIFFTagSet</code> object to the list of allowed
+     * Adds a {@code TIFFTagSet} object to the list of allowed
      * tag sets.
      *
-     * @param tagSet a <code>TIFFTagSet</code>.
+     * @param tagSet a {@code TIFFTagSet}.
      *
-     * @throws IllegalArgumentException if <code>tagSet</code> is
-     * <code>null</code>.
+     * @throws IllegalArgumentException if {@code tagSet} is
+     * {@code null}.
      */
     public void addAllowedTagSet(TIFFTagSet tagSet) {
         if (tagSet == null) {
@@ -87,15 +87,15 @@
     }
 
     /**
-     * Removes a <code>TIFFTagSet</code> object from the list of
-     * allowed tag sets.  Removal is based on the <code>equals</code>
-     * method of the <code>TIFFTagSet</code>, which is normally
+     * Removes a {@code TIFFTagSet} object from the list of
+     * allowed tag sets.  Removal is based on the {@code equals}
+     * method of the {@code TIFFTagSet}, which is normally
      * defined as reference equality.
      *
-     * @param tagSet a <code>TIFFTagSet</code>.
+     * @param tagSet a {@code TIFFTagSet}.
      *
-     * @throws IllegalArgumentException if <code>tagSet</code> is
-     * <code>null</code>.
+     * @throws IllegalArgumentException if {@code tagSet} is
+     * {@code null}.
      */
     public void removeAllowedTagSet(TIFFTagSet tagSet) {
         if (tagSet == null) {
@@ -105,10 +105,10 @@
     }
 
     /**
-     * Returns a <code>List</code> containing the allowed
-     * <code>TIFFTagSet</code> objects.
+     * Returns a {@code List} containing the allowed
+     * {@code TIFFTagSet} objects.
      *
-     * @return a <code>List</code> of <code>TIFFTagSet</code>s.
+     * @return a {@code List} of {@code TIFFTagSet}s.
      */
     public List<TIFFTagSet> getAllowedTagSets() {
         return allowedTagSets;
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -105,7 +105,7 @@
      * The name assigned to a tag with an unknown tag number. Such
      * a tag may be created for example when reading an IFD and a
      * tag number is encountered which is not in any of the
-     * <code>TIFFTagSet</code>s known to the reader.
+     * {@code TIFFTagSet}s known to the reader.
      */
     public static final String UNKNOWN_TAG_NAME = "UnknownTag";
 
@@ -141,12 +141,12 @@
     private SortedMap<Integer,String> valueNames = null;
 
     /**
-     * Constructs a <code>TIFFTag</code> with a given name, tag number, set
+     * Constructs a {@code TIFFTag} with a given name, tag number, set
      * of legal data types, and value count. A negative value count signifies
      * that either an arbitrary number of values is legal or the required count
      * is determined by the values of other fields in the IFD. A non-negative
      * count specifies the number of values which an associated field must
-     * contain. The tag will have no associated <code>TIFFTagSet</code>.
+     * contain. The tag will have no associated {@code TIFFTagSet}.
      *
      * <p> If there are mnemonic names to be associated with the legal
      * data values for the tag, {@link #addValueName(int, String)
@@ -183,18 +183,18 @@
     }
 
     /**
-     * Constructs a <code>TIFFTag</code> with a given name, tag number and
-     * <code>TIFFTagSet</code> to which it refers. The legal data types are
+     * Constructs a {@code TIFFTag} with a given name, tag number and
+     * {@code TIFFTagSet} to which it refers. The legal data types are
      * set to include {@link #TIFF_LONG} and {@link #TIFF_IFD_POINTER} and the
-     * value count is unity. The <code>TIFFTagSet</code> will
-     * represent the set of <code>TIFFTag</code>s which appear in the IFD
-     * pointed to. A <code>TIFFTag</code> represents an IFD pointer if and
-     * only if <code>tagSet</code> is non-<code>null</code> or the data
-     * type <code>TIFF_IFD_POINTER</code> is legal.
+     * value count is unity. The {@code TIFFTagSet} will
+     * represent the set of {@code TIFFTag}s which appear in the IFD
+     * pointed to. A {@code TIFFTag} represents an IFD pointer if and
+     * only if {@code tagSet} is non-{@code null} or the data
+     * type {@code TIFF_IFD_POINTER} is legal.
      *
      * @param name the name of the tag.
      * @param number the number used to represent the tag.
-     * @param tagSet the <code>TIFFTagSet</code> to which this tag belongs.
+     * @param tagSet the {@code TIFFTagSet} to which this tag belongs.
      * @throws NullPointerException if name or tagSet is null.
      * @throws IllegalArgumentException if number is negative.
      *
@@ -210,9 +210,9 @@
     }
 
     /**
-     * Constructs  a  <code>TIFFTag</code>  with  a  given  name,  tag number,
+     * Constructs  a  {@code TIFFTag}  with  a  given  name,  tag number,
      * and set  of  legal  data  types.  The value count of the tag will be
-     * undefined and it will  have  no associated <code>TIFFTagSet</code>.
+     * undefined and it will  have  no associated {@code TIFFTagSet}.
      *
      * @param name the name of the tag.
      * @param number the number used to represent the tag.
@@ -236,9 +236,9 @@
      *
      * @return the number of bytes used to store the given data type.
      *
-     * @throws IllegalArgumentException if <code>datatype</code> is
-     * less than <code>MIN_DATATYPE</code> or greater than
-     * <code>MAX_DATATYPE</code>.
+     * @throws IllegalArgumentException if {@code datatype} is
+     * less than {@code MIN_DATATYPE} or greater than
+     * {@code MAX_DATATYPE}.
      */
     public static int getSizeOfType(int dataType) {
         if (dataType < MIN_DATATYPE ||dataType > MAX_DATATYPE) {
@@ -251,7 +251,7 @@
     /**
      * Returns the name of the tag, as it will appear in image metadata.
      *
-     * @return the tag name, as a <code>String</code>.
+     * @return the tag name, as a {@code String}.
      */
     public String getName() {
         return name;
@@ -260,7 +260,7 @@
     /**
      * Returns the integer used to represent the tag.
      *
-     * @return the tag number, as an <code>int</code>.
+     * @return the tag number, as an {@code int}.
      */
     public int getNumber() {
         return number;
@@ -276,7 +276,7 @@
      * (1 &lt;&lt; TIFFTag.TIFF_SHORT) | (1 &lt;&lt; TIFFTag.TIFF_LONG)
      * </pre>
      *
-     * @return an <code>int</code> containing a bitmask encoding the
+     * @return an {@code int} containing a bitmask encoding the
      * set of valid data types.
      */
     public int getDataTypes() {
@@ -285,11 +285,11 @@
 
     /**
      * Returns the value count of this tag. If this value is positive, it
-     * represents the required number of values for a <code>TIFFField</code>
+     * represents the required number of values for a {@code TIFFField}
      * which has this tag. If the value is negative, the count is undefined.
      * In the latter case the count may be derived, e.g., the number of values
-     * of the <code>BitsPerSample</code> field is <code>SamplesPerPixel</code>,
-     * or it may be variable as in the case of most <code>US-ASCII</code>
+     * of the {@code BitsPerSample} field is {@code SamplesPerPixel},
+     * or it may be variable as in the case of most {@code US-ASCII}
      * fields.
      *
      * @return the value count of this tag.
@@ -299,18 +299,18 @@
     }
 
     /**
-     * Returns <code>true</code> if the given data type
+     * Returns {@code true} if the given data type
      * may be used for the data associated with this tag.
      *
      * @param dataType the data type to be queried, one of
-     * <code>TIFF_BYTE</code>, <code>TIFF_SHORT</code>, etc.
+     * {@code TIFF_BYTE}, {@code TIFF_SHORT}, etc.
      *
-     * @return a <code>boolean</code> indicating whether the given
+     * @return a {@code boolean} indicating whether the given
      * data type may be used with this tag.
      *
-     * @throws IllegalArgumentException if <code>datatype</code> is
-     * less than <code>MIN_DATATYPE</code> or greater than
-     * <code>MAX_DATATYPE</code>.
+     * @throws IllegalArgumentException if {@code datatype} is
+     * less than {@code MIN_DATATYPE} or greater than
+     * {@code MAX_DATATYPE}.
      */
     public boolean isDataTypeOK(int dataType) {
         if (dataType < MIN_DATATYPE || dataType > MAX_DATATYPE) {
@@ -320,38 +320,38 @@
     }
 
     /**
-     * Returns the <code>TIFFTagSet</code> of which this tag is a part.
+     * Returns the {@code TIFFTagSet} of which this tag is a part.
      *
-     * @return the containing <code>TIFFTagSet</code>.
+     * @return the containing {@code TIFFTagSet}.
      */
     public TIFFTagSet getTagSet() {
         return tagSet;
     }
 
     /**
-     * Returns <code>true</code> if this tag is used to point to an IFD
-     * structure containing additional tags. A <code>TIFFTag</code> represents
-     * an IFD pointer if and only if its <code>TIFFTagSet</code> is
-     * non-<code>null</code> or the data type <code>TIFF_IFD_POINTER</code> is
+     * Returns {@code true} if this tag is used to point to an IFD
+     * structure containing additional tags. A {@code TIFFTag} represents
+     * an IFD pointer if and only if its {@code TIFFTagSet} is
+     * non-{@code null} or the data type {@code TIFF_IFD_POINTER} is
      * legal. This condition will be satisfied if and only if either
-     * <code>getTagSet()&nbsp;!=&nbsp;null</code> or
-     * <code>isDataTypeOK(TIFF_IFD_POINTER)&nbsp;==&nbsp;true</code>.
+     * {@code getTagSet()&nbsp;!=&nbsp;null} or
+     * {@code isDataTypeOK(TIFF_IFD_POINTER)&nbsp;==&nbsp;true}.
      *
      * <p>Many TIFF extensions use the IFD mechanism in order to limit the
      * number of new tags that may appear in the root IFD.</p>
      *
-     * @return <code>true</code> if this tag points to an IFD.
+     * @return {@code true} if this tag points to an IFD.
      */
     public boolean isIFDPointer() {
         return tagSet != null || isDataTypeOK(TIFF_IFD_POINTER);
     }
 
     /**
-     * Returns <code>true</code> if there are mnemonic names associated with
+     * Returns {@code true} if there are mnemonic names associated with
      * the set of legal values for the data associated with this tag.  Mnemonic
      * names apply only to tags which have integral data type.
      *
-     * @return <code>true</code> if mnemonic value names are available.
+     * @return {@code true} if mnemonic value names are available.
      */
     public boolean hasValueNames() {
         return valueNames != null;
@@ -373,14 +373,14 @@
 
     /**
      * Returns the mnemonic name associated with a particular value
-     * that this tag's data may take on, or <code>null</code> if
+     * that this tag's data may take on, or {@code null} if
      * no name is present.  Mnemonic names apply only to tags which have
      * integral data type.
      *
      * @param value the data value.
      *
      * @return the mnemonic name associated with the value, as a
-     * <code>String</code>.
+     * {@code String}.
      */
     public String getValueName(int value) {
         if (valueNames == null) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTagSet.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTagSet.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
  * specification itself).
  *
  * <p> This class and its subclasses are responsible for mapping
- * between raw tag numbers and <code>TIFFTag</code> objects, which
+ * between raw tag numbers and {@code TIFFTag} objects, which
  * contain additional information about each tag, such as the tag's
  * name, legal data types, and mnemonic names for some or all of ts
  * data values.
@@ -59,15 +59,15 @@
     private TIFFTagSet() {}
 
     /**
-     * Constructs a <code>TIFFTagSet</code>, given a <code>List</code>
-     * of <code>TIFFTag</code> objects.
+     * Constructs a {@code TIFFTagSet}, given a {@code List}
+     * of {@code TIFFTag} objects.
      *
-     * @param tags a <code>List</code> object containing
-     * <code>TIFFTag</code> objects to be added to this tag set.
+     * @param tags a {@code List} object containing
+     * {@code TIFFTag} objects to be added to this tag set.
      *
-     * @throws IllegalArgumentException if <code>tags</code> is
-     * <code>null</code>, or contains objects that are not instances
-     * of the <code>TIFFTag</code> class.
+     * @throws IllegalArgumentException if {@code tags} is
+     * {@code null}, or contains objects that are not instances
+     * of the {@code TIFFTag} class.
      */
     public TIFFTagSet(List<TIFFTag> tags) {
         if (tags == null) {
@@ -88,29 +88,29 @@
     }
 
     /**
-     * Returns the <code>TIFFTag</code> from this set that is
-     * associated with the given tag number, or <code>null</code> if
+     * Returns the {@code TIFFTag} from this set that is
+     * associated with the given tag number, or {@code null} if
      * no tag exists for that number.
      *
      * @param tagNumber the number of the tag to be retrieved.
      *
-     * @return the numbered <code>TIFFTag</code>, or <code>null</code>.
+     * @return the numbered {@code TIFFTag}, or {@code null}.
      */
     public TIFFTag getTag(int tagNumber) {
         return allowedTagsByNumber.get(Integer.valueOf(tagNumber));
     }
 
     /**
-     * Returns the <code>TIFFTag</code> having the given tag name, or
-     * <code>null</code> if the named tag does not belong to this tag set.
+     * Returns the {@code TIFFTag} having the given tag name, or
+     * {@code null} if the named tag does not belong to this tag set.
      *
      * @param tagName the name of the tag to be retrieved, as a
-     * <code>String</code>.
+     * {@code String}.
      *
-     * @return the named <code>TIFFTag</code>, or <code>null</code>.
+     * @return the named {@code TIFFTag}, or {@code null}.
      *
-     * @throws IllegalArgumentException if <code>tagName</code> is
-     * <code>null</code>.
+     * @throws IllegalArgumentException if {@code tagName} is
+     * {@code null}.
      */
     public TIFFTag getTag(String tagName) {
         if (tagName == null) {
@@ -123,7 +123,7 @@
      * Retrieves an unmodifiable numerically increasing set of tag numbers.
      *
      * <p>The returned object is unmodifiable and contains the tag
-     * numbers of all <code>TIFFTag</code>s in this <code>TIFFTagSet</code>
+     * numbers of all {@code TIFFTag}s in this {@code TIFFTagSet}
      * sorted into ascending order according to
      * {@link Integer#compareTo(Object)}.</p>
      *
@@ -145,7 +145,7 @@
      * Retrieves an unmodifiable lexicographically increasing set of tag names.
      *
      * <p>The returned object is unmodifiable and contains the tag
-     * names of all <code>TIFFTag</code>s in this <code>TIFFTagSet</code>
+     * names of all {@code TIFFTag}s in this {@code TIFFTagSet}
      * sorted into ascending order according to
      * {@link String#compareTo(Object)}.</p>
      *
--- a/src/java.desktop/share/classes/javax/print/ServiceUI.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/print/ServiceUI.java	Mon Mar 14 20:53:59 2016 -0700
@@ -193,36 +193,48 @@
             getLocalGraphicsEnvironment().getDefaultScreenDevice().
             getDefaultConfiguration().getBounds() : gc.getBounds();
 
+        x += gcBounds.x;
+        y += gcBounds.y;
         ServiceDialog dialog;
         if (owner instanceof Frame) {
             dialog = new ServiceDialog(gc,
-                                       x + gcBounds.x,
-                                       y + gcBounds.y,
+                                       x,
+                                       y,
                                        services, defaultIndex,
                                        flavor, attributes,
                                        (Frame)owner);
         } else {
             dialog = new ServiceDialog(gc,
-                                       x + gcBounds.x,
-                                       y + gcBounds.y,
+                                       x,
+                                       y,
                                        services, defaultIndex,
                                        flavor, attributes,
                                        (Dialog)owner);
         }
         Rectangle dlgBounds = dialog.getBounds();
 
-        // get union of all GC bounds
-        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
-        GraphicsDevice[] gs = ge.getScreenDevices();
-        for (int j=0; j<gs.length; j++) {
-            gcBounds =
-                gcBounds.union(gs[j].getDefaultConfiguration().getBounds());
-        }
-
         // if portion of dialog is not within the gc boundary
         if (!gcBounds.contains(dlgBounds)) {
-            // put in the center relative to parent frame/dialog
-            dialog.setLocationRelativeTo(owner);
+            // check if dialog exceed window bounds at left or bottom
+            // Then position the dialog by moving it by the amount it exceeds
+            // the window bounds
+            // If it results in dialog moving beyond the window bounds at top/left
+            // then position it at window top/left
+            if (dlgBounds.x + dlgBounds.width > gcBounds.x + gcBounds.width) {
+                if ((gcBounds.x + gcBounds.width - dlgBounds.width) > gcBounds.x) {
+                    x = (gcBounds.x + gcBounds.width) - dlgBounds.width;
+                } else {
+                    x = gcBounds.x;
+                }
+            }
+            if (dlgBounds.y + dlgBounds.height > gcBounds.y + gcBounds.height) {
+                if ((gcBounds.y + gcBounds.height - dlgBounds.height) > gcBounds.y) {
+                    y = (gcBounds.y + gcBounds.height) - dlgBounds.height;
+                } else {
+                    y = gcBounds.y;
+                }
+            }
+            dialog.setBounds(x, y, dlgBounds.width, dlgBounds.height);
         }
         dialog.show();
 
--- a/src/java.desktop/share/classes/javax/swing/DefaultDesktopManager.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/swing/DefaultDesktopManager.java	Mon Mar 14 20:53:59 2016 -0700
@@ -191,12 +191,6 @@
             JLayeredPane.putLayer(desktopIcon, layer);
         }
 
-        // If we are maximized we already have the normal bounds recorded
-        // don't try to re-record them, otherwise we incorrectly set the
-        // normal bounds to maximized state.
-        if (!f.isMaximum()) {
-            f.setNormalBounds(f.getBounds());
-        }
         if (findNext) {
             if (d.selectFrame(true) == null) {
                 // The icon is the last frame.
--- a/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -584,6 +584,69 @@
     }
 
     /**
+     * Returns an array of files representing the values to show by default in
+     * the file chooser selector.
+     *
+     * @return an array of {@code File} objects.
+     * @throws SecurityException if the caller does not have necessary
+     *                           permissions
+     * @since 9
+     */
+    public File[] getChooserComboBoxFiles() {
+        return (File[]) ShellFolder.get("fileChooserComboBoxFolders");
+    }
+
+    /**
+     * Returns whether the specified file denotes a shell interpreted link which
+     * can be obtained by the {@link #getLinkLocation(File)}.
+     *
+     * @param file a file
+     * @return whether this is a link
+     * @throws NullPointerException if {@code file} equals {@code null}
+     * @throws SecurityException if the caller does not have necessary
+     *                           permissions
+     * @see #getLinkLocation(File)
+     * @since 9
+     */
+    public boolean isLink(File file) {
+        if (file == null) {
+            throw new NullPointerException("file is null");
+        }
+        try {
+            return ShellFolder.getShellFolder(file).isLink();
+        } catch (FileNotFoundException e) {
+            return false;
+        }
+    }
+
+    /**
+     * Returns the regular file referenced by the specified link file if
+     * the specified file is a shell interpreted link.
+     * Returns {@code null} if the specified file is not
+     * a shell interpreted link.
+     *
+     * @param file a file
+     * @return the linked file or {@code null}.
+     * @throws FileNotFoundException if the linked file does not exist
+     * @throws NullPointerException if {@code file} equals {@code null}
+     * @throws SecurityException if the caller does not have necessary
+     *                           permissions
+     * @since 9
+     */
+    public File getLinkLocation(File file) throws FileNotFoundException {
+        if (file == null) {
+            throw new NullPointerException("file is null");
+        }
+        ShellFolder shellFolder;
+        try {
+            shellFolder = ShellFolder.getShellFolder(file);
+        } catch (FileNotFoundException e) {
+            return null;
+        }
+        return shellFolder.isLink() ? shellFolder.getLinkLocation() : null;
+    }
+
+    /**
      * Throws {@code FileNotFoundException} if file not found or current thread was interrupted
      */
     ShellFolder getShellFolder(File f) throws FileNotFoundException {
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -962,18 +962,13 @@
                 int orientation = SwingConstants.VERTICAL;
 
                 // find which scrollbar to scroll, or return if none
-                if (toScroll == null || !toScroll.isVisible()) {
+                if (toScroll == null || !toScroll.isVisible()
+                        || e.isShiftDown()) {
                     toScroll = scrollpane.getHorizontalScrollBar();
                     if (toScroll == null || !toScroll.isVisible()) {
                         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/synth/SynthDesktopPaneUI.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Mon Mar 14 20:53:59 2016 -0700
@@ -362,9 +362,6 @@
                 setWasIcon(f, Boolean.TRUE);
             }
 
-            if (!f.isMaximum()) {
-                f.setNormalBounds(f.getBounds());
-            }
             c.remove(f);
             c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight());
             try {
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Mon Mar 14 20:53:59 2016 -0700
@@ -230,9 +230,10 @@
 
             boolean hasRollover = (column == getRolloverColumn());
             if (isSelected || hasRollover || hasFocus) {
+                boolean enabled = (table == null)? true : table.isEnabled();
                 SynthLookAndFeel.setSelectedUI((SynthLabelUI)SynthLookAndFeel.
                              getUIOfType(getUI(), SynthLabelUI.class),
-                             isSelected, hasFocus, table.isEnabled(),
+                             isSelected, hasFocus, enabled,
                              hasRollover);
             } else {
                 SynthLookAndFeel.resetSelectedUI();
--- a/src/java.desktop/share/classes/sun/applet/Main.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/applet/Main.java	Mon Mar 14 20:53:59 2016 -0700
@@ -30,8 +30,6 @@
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 import java.net.MalformedURLException;
 import java.util.Enumeration;
@@ -75,7 +73,6 @@
     /**
      * Member variables set according to options passed in to AppletViewer.
      */
-    private boolean debugFlag = false;
     private boolean helpFlag  = false;
     private String  encoding  = null;
     private boolean noSecurityFlag  = false;
@@ -136,14 +133,6 @@
             return 1;
         }
 
-        if (debugFlag) {
-            // START A DEBUG SESSION
-            // Given the current architecture, we will end up decoding the
-            // arguments again, but at least we are guaranteed to have
-            // arguments which are valid.
-            return invokeDebugger(args);
-        }
-
         // INSTALL THE SECURITY MANAGER (if necessary)
         if (!noSecurityFlag && (System.getSecurityManager() == null))
             init();
@@ -191,9 +180,6 @@
                 throw new ParseException(lookup("main.err.dupoption", arg));
             encoding = args[++i];
             return 2;
-        } else if ("-debug".equals(arg)) {
-            debugFlag = true;
-            return 1;
         } else if ("-Xnosecurity".equals(arg)) {
             // This is an undocumented (and, in the future, unsupported)
             // flag which prevents AppletViewer from installing its own
@@ -267,68 +253,6 @@
         return u;
     }
 
-    /**
-     * Invoke the debugger with the arguments passed in to appletviewer.
-     *
-     * @param args The arguments passed into the debugger.
-     * @return     {@code 0} if the debugger is invoked successfully,
-     *             {@code 1} otherwise.
-     */
-    private int invokeDebugger(String [] args) {
-        // CONSTRUCT THE COMMAND LINE
-        String [] newArgs = new String[args.length + 1];
-        int current = 0;
-
-        // Add a -classpath argument that prevents
-        // the debugger from launching appletviewer with the default of
-        // ".". appletviewer's classpath should never contain valid
-        // classes since they will result in security exceptions.
-        // Ideally, the classpath should be set to "", but the VM won't
-        // allow an empty classpath, so a phony directory name is used.
-        String phonyDir = System.getProperty("java.home") +
-                          File.separator + "phony";
-        newArgs[current++] = "-Djava.class.path=" + phonyDir;
-
-        // Appletviewer's main class is the debuggee
-        newArgs[current++] = "sun.applet.Main";
-
-        // Append all the of the original appletviewer arguments,
-        // leaving out the "-debug" option.
-        for (int i = 0; i < args.length; i++) {
-            if (!("-debug".equals(args[i]))) {
-                newArgs[current++] = args[i];
-            }
-        }
-
-        // LAUNCH THE DEBUGGER
-        // Reflection is used for two reasons:
-        // 1) The debugger classes are on classpath and thus must be loaded
-        // by the application class loader. (Currently, appletviewer are
-        // loaded through the boot class path out of rt.jar.)
-        // 2) Reflection removes any build dependency between appletviewer
-        // and jdb.
-        try {
-            Class<?> c = Class.forName("com.sun.tools.example.debug.tty.TTY", true,
-                                    ClassLoader.getSystemClassLoader());
-            Method m = c.getDeclaredMethod("main",
-                                           new Class<?>[] { String[].class });
-            m.invoke(null, new Object[] { newArgs });
-        } catch (ClassNotFoundException cnfe) {
-            System.err.println(lookup("main.debug.cantfinddebug"));
-            return 1;
-        } catch (NoSuchMethodException nsme) {
-            System.err.println(lookup("main.debug.cantfindmain"));
-            return 1;
-        } catch (InvocationTargetException ite) {
-            System.err.println(lookup("main.debug.exceptionindebug"));
-            return 1;
-        } catch (IllegalAccessException iae) {
-            System.err.println(lookup("main.debug.cantaccess"));
-            return 1;
-        }
-        return 0;
-    }
-
     private void init() {
         // GET APPLETVIEWER USER-SPECIFIC PROPERTIES
         Properties avProps = getAVProps();
--- a/src/java.desktop/share/classes/sun/applet/resources/MsgAppletViewer.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/applet/resources/MsgAppletViewer.java	Mon Mar 14 20:53:59 2016 -0700
@@ -74,7 +74,7 @@
             {"appletviewer.parse.warning.embed.requireswidth", "Warning: <embed> tag requires width attribute."},
             {"appletviewer.parse.warning.appnotLongersupported", "Warning: <app> tag no longer supported, use <applet> instead:"},
             {"appletviewer.deprecated", "AppletViewer is deprecated."},
-            {"appletviewer.usage", "Usage: appletviewer <options> url(s)\n\nwhere <options> include:\n  -debug                  Start the applet viewer in the Java debugger\n  -encoding <encoding>    Specify character encoding used by HTML files\n  -J<runtime flag>        Pass argument to the java interpreter\n\nThe -J option is non-standard and subject to change without notice."},
+            {"appletviewer.usage", "Usage: appletviewer <options> url(s)\n\nwhere <options> include:\n  -encoding <encoding>    Specify character encoding used by HTML files\n  -J<runtime flag>        Pass argument to the java interpreter\n\nThe -J option is non-standard and subject to change without notice."},
             {"appletviewer.main.err.unsupportedopt", "Unsupported option: {0}"},
             {"appletviewer.main.err.unrecognizedarg", "Unrecognized argument: {0}"},
             {"appletviewer.main.err.dupoption", "Duplicate use of option: {0}"},
--- a/src/java.desktop/share/classes/sun/awt/ExtendedKeyCodes.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/awt/ExtendedKeyCodes.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,3 +1,27 @@
+/*
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.awt;
 
 import java.util.Collections;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/ReentrantContext.java	Mon Mar 14 20:53:59 2016 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.java2d;
+
+import java.lang.ref.Reference;
+
+/**
+ * ReentrantContext is a base class to hold thread-local data supporting
+ * reentrancy in either a ThreadLocal or a ConcurrentLinkedQueue
+ *
+ * @see ReentrantContextProvider
+ */
+public class ReentrantContext {
+    // usage stored as a byte
+    byte usage = ReentrantContextProvider.USAGE_TL_INACTIVE;
+    /*
+     * Reference to this instance (hard, soft or weak).
+     * @see ReentrantContextProvider#refType
+     */
+    Reference<? extends ReentrantContext> reference = null;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/ReentrantContextProvider.java	Mon Mar 14 20:53:59 2016 -0700
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.java2d;
+
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
+import java.lang.ref.WeakReference;
+
+/**
+ * This abstract ReentrantContextProvider helper class manages the creation,
+ * storage, and retrieval of concrete ReentrantContext instances which can be
+ * subclassed to hold cached contextual data.
+ *
+ * It supports reentrancy as every call to acquire() provides a new unique context
+ * instance that must later be returned for reuse by a call to release(ctx)
+ * (typically in a try/finally block).
+ *
+ * It has a couple of abstract implementations which store references in a queue
+ * and/or thread-local storage.
+ * The Providers can be configured to hold ReentrantContext instances in memory
+ * using hard, soft or weak references.
+ *
+ * The acquire() and release() methods are used to retrieve and return the contexts.
+ *
+ * The {@code newContext()} method remains abstract in all implementations and
+ * must be provided by the module to create a new subclass of ReentrantContext
+ * with the appropriate contextual data in it.
+ *
+ * Sample Usage:
+ * - create a subclass ReentrantContextImpl to hold the thread state:
+ *
+ * static final class ReentrantContextImpl extends ReentrantContext {
+ *     // specific cached data
+ * }
+ *
+ * - create the appropriate ReentrantContextProvider:
+ *
+ * private static final ReentrantContextProvider<ReentrantContextImpl> contextProvider =
+ *     new ReentrantContextProviderTL<ReentrantContextImpl>(ReentrantContextProvider.REF_WEAK)
+ *     {
+ *         @Override
+ *         protected ReentrantContextImpl newContext() {
+ *             return new ReentrantContextImpl();
+ *         }
+ *     };
+ * ...
+ * void someMethod() {
+ *     ReentrantContextImpl ctx = contextProvider.acquire();
+ *     try {
+ *         // use the context
+ *     } finally {
+ *         contextProvider.release(ctx);
+ *     }
+ * }
+ *
+ * @param <K> ReentrantContext subclass
+ *
+ * @see ReentrantContext
+ */
+public abstract class ReentrantContextProvider<K extends ReentrantContext>
+{
+    // thread-local storage: inactive
+    static final byte USAGE_TL_INACTIVE = 0;
+    // thread-local storage: in use
+    static final byte USAGE_TL_IN_USE = 1;
+    // CLQ storage
+    static final byte USAGE_CLQ = 2;
+
+    // hard reference
+    public static final int REF_HARD = 0;
+    // soft reference
+    public static final int REF_SOFT = 1;
+    // weak reference
+    public static final int REF_WEAK = 2;
+
+    /* members */
+    // internal reference type
+    private final int refType;
+
+    /**
+     * Create a new ReentrantContext provider using the given reference type
+     * among hard, soft or weak
+     *
+     * @param refType reference type
+     */
+    protected ReentrantContextProvider(final int refType) {
+        this.refType = refType;
+    }
+
+    /**
+     * Create a new ReentrantContext instance
+     *
+     * @return new ReentrantContext instance
+     */
+    protected abstract K newContext();
+
+    /**
+     * Give a ReentrantContext instance for the current thread
+     *
+     * @return ReentrantContext instance
+     */
+    public abstract K acquire();
+
+    /**
+     * Restore the given ReentrantContext instance for reuse
+     *
+     * @param ctx ReentrantContext instance
+     */
+    public abstract void release(K ctx);
+
+    @SuppressWarnings("unchecked")
+    protected final Reference<K> getOrCreateReference(final K ctx) {
+        if (ctx.reference == null) {
+            // Create the reference:
+            switch (refType) {
+                case REF_HARD:
+                    ctx.reference = new HardReference<K>(ctx);
+                    break;
+                case REF_SOFT:
+                    ctx.reference = new SoftReference<K>(ctx);
+                    break;
+                default:
+                case REF_WEAK:
+                    ctx.reference = new WeakReference<K>(ctx);
+                    break;
+            }
+        }
+        return (Reference<K>) ctx.reference;
+    }
+
+    /* Missing HardReference implementation */
+    static final class HardReference<V> extends WeakReference<V> {
+        // kept strong reference:
+        private final V strongRef;
+
+        HardReference(final V referent) {
+            // no referent needed for the parent WeakReference:
+            super(null);
+            this.strongRef = referent;
+        }
+
+        @Override
+        public V get() {
+            return strongRef;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/ReentrantContextProviderCLQ.java	Mon Mar 14 20:53:59 2016 -0700
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.java2d;
+
+import java.lang.ref.Reference;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * This ReentrantContextProvider implementation uses one ConcurrentLinkedQueue
+ * to store all ReentrantContext instances (thread and its child contexts)
+ *
+ * Note: this implementation keeps less contexts in memory depending on the
+ * concurrent active threads in contrary to a ThreadLocal provider. However,
+ * it is slower in highly concurrent workloads.
+ *
+ * @param <K> ReentrantContext subclass
+ */
+public abstract class ReentrantContextProviderCLQ<K extends ReentrantContext>
+    extends ReentrantContextProvider<K>
+{
+    // ReentrantContext queue to store all contexts
+    private final ConcurrentLinkedQueue<Reference<K>> ctxQueue
+        = new ConcurrentLinkedQueue<Reference<K>>();
+
+    /**
+     * Create a new ReentrantContext provider using the given reference type
+     * among hard, soft or weak based using a ConcurrentLinkedQueue storage
+     *
+     * @param refType reference type
+     */
+    public ReentrantContextProviderCLQ(final int refType) {
+        super(refType);
+    }
+
+    /**
+     * Give a ReentrantContext instance for the current thread
+     *
+     * @return ReentrantContext instance
+     */
+    @Override
+    public final K acquire() {
+        K ctx = null;
+        // Drain queue if all referent are null:
+        Reference<K> ref = null;
+        while ((ctx == null) && ((ref = ctxQueue.poll()) != null)) {
+            ctx = ref.get();
+        }
+        if (ctx == null) {
+            // create a new ReentrantContext if none is available
+            ctx = newContext();
+            ctx.usage = USAGE_CLQ;
+        }
+        return ctx;
+    }
+
+    /**
+     * Restore the given ReentrantContext instance for reuse
+     *
+     * @param ctx ReentrantContext instance
+     */
+    @Override
+    public final void release(final K ctx) {
+        if (ctx.usage == USAGE_CLQ) {
+            ctxQueue.offer(getOrCreateReference(ctx));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/ReentrantContextProviderTL.java	Mon Mar 14 20:53:59 2016 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.java2d;
+
+import java.lang.ref.Reference;
+
+/**
+* This ReentrantContextProvider implementation uses a ThreadLocal to hold
+ * the first ReentrantContext per thread and a ReentrantContextProviderCLQ to
+ * store child ReentrantContext instances needed during recursion.
+ *
+ * Note: this implementation may keep up to one context in memory per thread.
+ * Child contexts for recursive uses are stored in the queue using a WEAK
+ * reference by default unless specified in the 2 argument constructor.
+ *
+ * @param <K> ReentrantContext subclass
+ */
+public abstract class ReentrantContextProviderTL<K extends ReentrantContext>
+    extends ReentrantContextProvider<K>
+{
+    // Thread-local storage:
+    private final ThreadLocal<Reference<K>> ctxTL
+        = new ThreadLocal<Reference<K>>();
+
+    // ReentrantContext CLQ provider for child contexts:
+    private final ReentrantContextProviderCLQ<K> ctxProviderCLQ;
+
+    /**
+     * Create a new ReentrantContext provider using the given reference type
+     * among hard, soft or weak.
+     * It uses weak reference for the child contexts.
+     *
+     * @param refType reference type
+     */
+    public ReentrantContextProviderTL(final int refType) {
+        this(refType, REF_WEAK);
+    }
+
+    /**
+     * Create a new ReentrantContext provider using the given reference types
+     * among hard, soft or weak
+     *
+     * @param refTypeTL reference type used by ThreadLocal
+     * @param refTypeCLQ reference type used by ReentrantContextProviderCLQ
+     */
+    public ReentrantContextProviderTL(final int refTypeTL, final int refTypeCLQ)
+    {
+        super(refTypeTL);
+
+        final ReentrantContextProviderTL<K> parent = this;
+
+        this.ctxProviderCLQ = new ReentrantContextProviderCLQ<K>(refTypeCLQ) {
+            @Override
+            protected K newContext() {
+                return parent.newContext();
+            }
+        };
+    }
+
+    /**
+     * Give a ReentrantContext instance for the current thread
+     *
+     * @return ReentrantContext instance
+     */
+    @Override
+    public final K acquire() {
+        K ctx = null;
+        final Reference<K> ref = ctxTL.get();
+        if (ref != null) {
+            ctx = ref.get();
+        }
+        if (ctx == null) {
+            // create a new ReentrantContext if none is available
+            ctx = newContext();
+            // update thread local reference:
+            ctxTL.set(getOrCreateReference(ctx));
+        }
+        // Check reentrance:
+        if (ctx.usage == USAGE_TL_INACTIVE) {
+           ctx.usage = USAGE_TL_IN_USE;
+        } else {
+            // get or create another ReentrantContext from CLQ provider:
+            ctx = ctxProviderCLQ.acquire();
+        }
+        return ctx;
+    }
+
+    /**
+     * Restore the given ReentrantContext instance for reuse
+     *
+     * @param ctx ReentrantContext instance
+     */
+    @Override
+    public final void release(final K ctx) {
+        if (ctx.usage == USAGE_TL_IN_USE) {
+           ctx.usage = USAGE_TL_INACTIVE;
+        } else {
+            ctxProviderCLQ.release(ctx);
+        }
+    }
+}
--- a/src/java.desktop/share/classes/sun/java2d/marlin/ByteArrayCache.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/ByteArrayCache.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -126,7 +126,7 @@
         }
 
         if (doChecks) {
-            check(array, 0, array.length, value);
+            check(array, fromIndex, toIndex, value);
         }
     }
 
@@ -135,9 +135,10 @@
     {
         if (doChecks) {
             // check zero on full array:
-            for (int i = fromIndex; i < toIndex; i++) {
+            for (int i = 0; i < array.length; i++) {
                 if (array[i] != value) {
-                    logException("Invalid array value at " + i + "\n"
+                    logException("Invalid value at: " + i + " = " + array[i]
+                            + " from: " + fromIndex + " to: " + toIndex + "\n"
                             + Arrays.toString(array), new Throwable());
 
                     // ensure array is correctly filled:
--- a/src/java.desktop/share/classes/sun/java2d/marlin/FloatArrayCache.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/FloatArrayCache.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -127,7 +127,7 @@
         }
 
         if (doChecks) {
-            check(array, 0, array.length, value);
+            check(array, fromIndex, toIndex, value);
         }
     }
 
@@ -136,9 +136,10 @@
     {
         if (doChecks) {
             // check zero on full array:
-            for (int i = fromIndex; i < toIndex; i++) {
+            for (int i = 0; i < array.length; i++) {
                 if (array[i] != value) {
-                    logException("Invalid array value at " + i + "\n"
+                    logException("Invalid value at: " + i + " = " + array[i]
+                            + " from: " + fromIndex + " to: " + toIndex + "\n"
                             + Arrays.toString(array), new Throwable());
 
                     // ensure array is correctly filled:
--- a/src/java.desktop/share/classes/sun/java2d/marlin/IntArrayCache.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/IntArrayCache.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -126,7 +126,7 @@
         }
 
         if (doChecks) {
-            check(array, 0, array.length, value);
+            check(array, fromIndex, toIndex, value);
         }
     }
 
@@ -135,9 +135,10 @@
     {
         if (doChecks) {
             // check zero on full array:
-            for (int i = fromIndex; i < toIndex; i++) {
+            for (int i = 0; i < array.length; i++) {
                 if (array[i] != value) {
-                    logException("Invalid array value at " + i + "\n"
+                    logException("Invalid value at: " + i + " = " + array[i]
+                            + " from: " + fromIndex + " to: " + toIndex + "\n"
                             + Arrays.toString(array), new Throwable());
 
                     // ensure array is correctly filled:
--- a/src/java.desktop/share/classes/sun/java2d/marlin/MarlinCache.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/MarlinCache.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -590,8 +590,8 @@
             alphaRow[to + 1] = 0;
         }
         if (doChecks) {
-            IntArrayCache.check(blkFlags, 0, blkFlags.length, 0);
-            IntArrayCache.check(alphaRow, 0, alphaRow.length, 0);
+            IntArrayCache.check(blkFlags, blkW, blkE, 0);
+            IntArrayCache.check(alphaRow, from, px1 - bboxX0, 0);
         }
 
         if (doMonitors) {
--- a/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,11 +30,12 @@
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Path2D;
 import java.awt.geom.PathIterator;
-import java.lang.ref.Reference;
 import java.security.AccessController;
-import java.util.concurrent.ConcurrentLinkedQueue;
 import static sun.java2d.marlin.MarlinUtils.logInfo;
 import sun.awt.geom.PathConsumer2D;
+import sun.java2d.ReentrantContextProvider;
+import sun.java2d.ReentrantContextProviderCLQ;
+import sun.java2d.ReentrantContextProviderTL;
 import sun.java2d.pipe.AATileGenerator;
 import sun.java2d.pipe.Region;
 import sun.java2d.pipe.RenderingEngine;
@@ -882,46 +883,50 @@
     // use ThreadLocal or ConcurrentLinkedQueue to get one RendererContext
     private static final boolean useThreadLocal;
 
-    // hard reference
-    static final int REF_HARD = 0;
-    // soft reference
-    static final int REF_SOFT = 1;
-    // weak reference
-    static final int REF_WEAK = 2;
-
     // reference type stored in either TL or CLQ
     static final int REF_TYPE;
 
     // Per-thread RendererContext
-    private static final ThreadLocal<Object> rdrCtxThreadLocal;
-    // RendererContext queue when ThreadLocal is disabled
-    private static final ConcurrentLinkedQueue<Object> rdrCtxQueue;
+    private static final ReentrantContextProvider<RendererContext> rdrCtxProvider;
 
     // Static initializer to use TL or CLQ mode
     static {
-        // CLQ mode by default:
         useThreadLocal = MarlinProperties.isUseThreadLocal();
-        rdrCtxThreadLocal = (useThreadLocal) ? new ThreadLocal<Object>()
-                                             : null;
-        rdrCtxQueue = (!useThreadLocal) ? new ConcurrentLinkedQueue<Object>()
-                                        : null;
 
         // Soft reference by default:
-        String refType = AccessController.doPrivileged(
+        final String refType = AccessController.doPrivileged(
                             new GetPropertyAction("sun.java2d.renderer.useRef",
                             "soft"));
         switch (refType) {
             default:
             case "soft":
-                REF_TYPE = REF_SOFT;
+                REF_TYPE = ReentrantContextProvider.REF_SOFT;
                 break;
             case "weak":
-                REF_TYPE = REF_WEAK;
+                REF_TYPE = ReentrantContextProvider.REF_WEAK;
                 break;
             case "hard":
-                REF_TYPE = REF_HARD;
+                REF_TYPE = ReentrantContextProvider.REF_HARD;
                 break;
         }
+
+        if (useThreadLocal) {
+            rdrCtxProvider = new ReentrantContextProviderTL<RendererContext>(REF_TYPE)
+                {
+                    @Override
+                    protected RendererContext newContext() {
+                        return RendererContext.createContext();
+                    }
+                };
+        } else {
+            rdrCtxProvider = new ReentrantContextProviderCLQ<RendererContext>(REF_TYPE)
+                {
+                    @Override
+                    protected RendererContext newContext() {
+                        return RendererContext.createContext();
+                    }
+                };
+        }
     }
 
     private static boolean settingsLogged = !enableLogs;
@@ -936,13 +941,13 @@
         String refType;
         switch (REF_TYPE) {
             default:
-            case REF_HARD:
+            case ReentrantContextProvider.REF_HARD:
                 refType = "hard";
                 break;
-            case REF_SOFT:
+            case ReentrantContextProvider.REF_SOFT:
                 refType = "soft";
                 break;
-            case REF_WEAK:
+            case ReentrantContextProvider.REF_WEAK:
                 refType = "weak";
                 break;
         }
@@ -1025,22 +1030,7 @@
      */
     @SuppressWarnings({"unchecked"})
     static RendererContext getRendererContext() {
-        RendererContext rdrCtx = null;
-        final Object ref = (useThreadLocal) ? rdrCtxThreadLocal.get()
-                           : rdrCtxQueue.poll();
-        if (ref != null) {
-            // resolve reference:
-            rdrCtx = (REF_TYPE == REF_HARD) ? ((RendererContext) ref)
-                     : ((Reference<RendererContext>) ref).get();
-        }
-        // create a new RendererContext if none is available
-        if (rdrCtx == null) {
-            rdrCtx = RendererContext.createContext();
-            if (useThreadLocal) {
-                // update thread local reference:
-                rdrCtxThreadLocal.set(rdrCtx.reference);
-            }
-        }
+        final RendererContext rdrCtx = rdrCtxProvider.acquire();
         if (doMonitors) {
             RendererContext.stats.mon_pre_getAATileGenerator.start();
         }
@@ -1057,8 +1047,6 @@
         if (doMonitors) {
             RendererContext.stats.mon_pre_getAATileGenerator.stop();
         }
-        if (!useThreadLocal) {
-            rdrCtxQueue.offer(rdrCtx.reference);
-        }
+        rdrCtxProvider.release(rdrCtx);
     }
 }
--- a/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java	Mon Mar 14 20:53:59 2016 -0700
@@ -148,8 +148,8 @@
 //////////////////////////////////////////////////////////////////////////////
 //  EDGE LIST
 //////////////////////////////////////////////////////////////////////////////
-    private float edgeMinY = Float.POSITIVE_INFINITY;
-    private float edgeMaxY = Float.NEGATIVE_INFINITY;
+    private int edgeMinY = Integer.MAX_VALUE;
+    private int edgeMaxY = Integer.MIN_VALUE;
     private float edgeMinX = Float.POSITIVE_INFINITY;
     private float edgeMaxX = Float.NEGATIVE_INFINITY;
 
@@ -357,18 +357,21 @@
             }
             return;
         }
-        // edge min/max X/Y are in subpixel space (inclusive)
-        if (y1 < edgeMinY) {
-            edgeMinY = y1;
+
+        // edge min/max X/Y are in subpixel space (inclusive) within bounds:
+        // note: Use integer crossings to ensure consistent range within
+        // edgeBuckets / edgeBucketCounts arrays in case of NaN values (int = 0)
+        if (firstCrossing < edgeMinY) {
+            edgeMinY = firstCrossing;
         }
-        if (y2 > edgeMaxY) {
-            edgeMaxY = y2;
+        if (lastCrossing > edgeMaxY) {
+            edgeMaxY = lastCrossing;
         }
 
         // Use double-precision for improved accuracy:
         final double x1d   = x1;
         final double y1d   = y1;
-        final double slope = (x2 - x1d) / (y2 - y1d);
+        final double slope = (x1d - x2) / (y1d - y2);
 
         if (slope >= 0.0) { // <==> x1 < x2
             if (x1 < edgeMinX) {
@@ -504,7 +507,7 @@
     private float x0, y0;
 
     // Position of most recent 'moveTo' command
-    private float pix_sx0, pix_sy0;
+    private float sx0, sy0;
 
     // per-thread renderer context
     final RendererContext rdrCtx;
@@ -570,8 +573,8 @@
             edgeBucketCounts = rdrCtx.getIntArray(edgeBucketsLength);
         }
 
-        edgeMinY = Float.POSITIVE_INFINITY;
-        edgeMaxY = Float.NEGATIVE_INFINITY;
+        edgeMinY = Integer.MAX_VALUE;
+        edgeMaxY = Integer.MIN_VALUE;
         edgeMinX = Float.POSITIVE_INFINITY;
         edgeMaxX = Float.NEGATIVE_INFINITY;
 
@@ -628,7 +631,7 @@
             blkFlags = blkFlags_initial;
         }
 
-        if (edgeMinY != Float.POSITIVE_INFINITY) {
+        if (edgeMinY != Integer.MAX_VALUE) {
             // if context is maked as DIRTY:
             if (rdrCtx.dirty) {
                 // may happen if an exception if thrown in the pipeline processing:
@@ -688,16 +691,18 @@
     @Override
     public void moveTo(float pix_x0, float pix_y0) {
         closePath();
-        this.pix_sx0 = pix_x0;
-        this.pix_sy0 = pix_y0;
-        this.y0 = tosubpixy(pix_y0);
-        this.x0 = tosubpixx(pix_x0);
+        final float sx = tosubpixx(pix_x0);
+        final float sy = tosubpixy(pix_y0);
+        this.sx0 = sx;
+        this.sy0 = sy;
+        this.x0 = sx;
+        this.y0 = sy;
     }
 
     @Override
     public void lineTo(float pix_x1, float pix_y1) {
-        float x1 = tosubpixx(pix_x1);
-        float y1 = tosubpixy(pix_y1);
+        final float x1 = tosubpixx(pix_x1);
+        final float y1 = tosubpixy(pix_y1);
         addLine(x0, y0, x1, y1);
         x0 = x1;
         y0 = y1;
@@ -729,8 +734,9 @@
 
     @Override
     public void closePath() {
-        // lineTo expects its input in pixel coordinates.
-        lineTo(pix_sx0, pix_sy0);
+        addLine(x0, y0, sx0, sy0);
+        x0 = sx0;
+        y0 = sy0;
     }
 
     @Override
@@ -1396,7 +1402,7 @@
         if (doMonitors) {
             RendererContext.stats.mon_rdr_endRendering.start();
         }
-        if (edgeMinY == Float.POSITIVE_INFINITY) {
+        if (edgeMinY == Integer.MAX_VALUE) {
             return false; // undefined edges bounds
         }
 
@@ -1407,11 +1413,10 @@
         final int spminX = FloatMath.max(FloatMath.ceil_int(edgeMinX - 0.5f), boundsMinX);
         final int spmaxX = FloatMath.min(FloatMath.ceil_int(edgeMaxX - 0.5f), boundsMaxX - 1);
 
-        // y1 (and y2) are already biased by -0.5 in tosubpixy():
-        final int spminY = FloatMath.max(FloatMath.ceil_int(edgeMinY), _boundsMinY);
-        int maxY = FloatMath.ceil_int(edgeMaxY);
-
+        // edge Min/Max Y are already rounded to subpixels within bounds:
+        final int spminY = edgeMinY;
         final int spmaxY;
+        int maxY = edgeMaxY;
 
         if (maxY <= _boundsMaxY - 1) {
             spmaxY = maxY;
--- a/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,10 @@
 package sun.java2d.marlin;
 
 import java.awt.geom.Path2D;
-import java.lang.ref.SoftReference;
 import java.lang.ref.WeakReference;
 import java.util.concurrent.atomic.AtomicInteger;
+import sun.java2d.ReentrantContext;
+import sun.java2d.ReentrantContextProvider;
 import static sun.java2d.marlin.ArrayCache.*;
 import sun.java2d.marlin.MarlinRenderingEngine.NormalizingPathIterator;
 import static sun.java2d.marlin.MarlinUtils.logInfo;
@@ -36,7 +37,7 @@
 /**
  * This class is a renderer context dedicated to a single thread
  */
-final class RendererContext implements MarlinConst {
+final class RendererContext extends ReentrantContext implements MarlinConst {
 
     // RendererContext creation counter
     private static final AtomicInteger contextCount = new AtomicInteger(1);
@@ -45,7 +46,7 @@
                                        ? RendererStats.getInstance(): null;
 
     private static final boolean USE_CACHE_HARD_REF = doStats
-        || (MarlinRenderingEngine.REF_TYPE == MarlinRenderingEngine.REF_WEAK);
+        || (MarlinRenderingEngine.REF_TYPE == ReentrantContextProvider.REF_WEAK);
 
     /**
      * Create a new renderer context
@@ -55,6 +56,7 @@
     static RendererContext createContext() {
         final RendererContext newCtx = new RendererContext("ctx"
                     + Integer.toString(contextCount.getAndIncrement()));
+
         if (RendererContext.stats != null) {
             RendererContext.stats.allContexts.add(newCtx);
         }
@@ -63,11 +65,6 @@
 
     // context name (debugging purposes)
     final String name;
-    /*
-     * Reference to this instance (hard, soft or weak).
-     * @see MarlinRenderingEngine#REF_TYPE
-     */
-    final Object reference;
     // Smallest object used as Cleaner's parent reference
     final Object cleanerObj = new Object();
     // dirty flag indicating an exception occured during pipeline in pathTo()
@@ -101,7 +98,7 @@
     /**
      * Constructor
      *
-     * @param name
+     * @param name context name (debugging)
      */
     RendererContext(final String name) {
         if (logCreateContext) {
@@ -124,20 +121,6 @@
 
         stroker = new Stroker(this);
         dasher = new Dasher(this);
-
-        // Create the reference to this instance (hard, soft or weak):
-        switch (MarlinRenderingEngine.REF_TYPE) {
-            default:
-            case MarlinRenderingEngine.REF_HARD:
-                reference = this;
-                break;
-            case MarlinRenderingEngine.REF_SOFT:
-                reference = new SoftReference<RendererContext>(this);
-                break;
-            case MarlinRenderingEngine.REF_WEAK:
-                reference = new WeakReference<RendererContext>(this);
-                break;
-        }
     }
 
     /**
--- a/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 
 public final class Version {
 
-    private static final String version = "marlin-0.7.3-Unsafe-OpenJDK";
+    private static final String version = "marlin-0.7.3.2-Unsafe-OpenJDK";
 
     public static String getVersion() {
         return version;
--- a/src/java.desktop/share/classes/sun/java2d/pipe/AAShapePipe.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/java2d/pipe/AAShapePipe.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,11 @@
 import java.awt.Rectangle;
 import java.awt.Shape;
 import java.awt.geom.Rectangle2D;
+import java.util.concurrent.ConcurrentLinkedQueue;
 import sun.awt.SunHints;
+import sun.java2d.ReentrantContext;
+import sun.java2d.ReentrantContextProvider;
+import sun.java2d.ReentrantContextProviderTL;
 import sun.java2d.SunGraphics2D;
 
 /**
@@ -38,28 +42,31 @@
  * This class sets up the Generator and computes the alpha tiles
  * and then passes them on to a CompositePipe object for painting.
  */
-public class AAShapePipe
+public final class AAShapePipe
     implements ShapeDrawPipe, ParallelogramPipe
 {
-    static RenderingEngine renderengine = RenderingEngine.getInstance();
+    static final RenderingEngine renderengine = RenderingEngine.getInstance();
 
     // Per-thread TileState (~1K very small so do not use any Weak Reference)
-    private static final ThreadLocal<TileState> tileStateThreadLocal =
-            new ThreadLocal<TileState>() {
-        @Override
-        protected TileState initialValue() {
-            return new TileState();
-        }
-    };
+    private static final ReentrantContextProvider<TileState> tileStateProvider =
+            new ReentrantContextProviderTL<TileState>(
+                    ReentrantContextProvider.REF_HARD)
+            {
+                @Override
+                protected TileState newContext() {
+                    return new TileState();
+                }
+            };
 
-    CompositePipe outpipe;
+    final CompositePipe outpipe;
 
     public AAShapePipe(CompositePipe pipe) {
         outpipe = pipe;
     }
 
+    @Override
     public void draw(SunGraphics2D sg, Shape s) {
-        BasicStroke bs;
+        final BasicStroke bs;
 
         if (sg.stroke instanceof BasicStroke) {
             bs = (BasicStroke) sg.stroke;
@@ -71,10 +78,12 @@
         renderPath(sg, s, bs);
     }
 
+    @Override
     public void fill(SunGraphics2D sg, Shape s) {
         renderPath(sg, s, null);
     }
 
+    @Override
     public void fillParallelogram(SunGraphics2D sg,
                                   double ux1, double uy1,
                                   double ux2, double uy2,
@@ -82,21 +91,23 @@
                                   double dx1, double dy1,
                                   double dx2, double dy2)
     {
-        Region clip = sg.getCompClip();
-        final TileState ts = tileStateThreadLocal.get();
-        final int[] abox = ts.abox;
+        final TileState ts = tileStateProvider.acquire();
+        try {
+            final int[] abox = ts.abox;
 
-        AATileGenerator aatg =
-            renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0,
-                                            clip, abox);
-        if (aatg == null) {
-            // Nothing to render
-            return;
+            final AATileGenerator aatg =
+                renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0,
+                                                sg.getCompClip(), abox);
+            if (aatg != null) {
+                renderTiles(sg, ts.computeBBox(ux1, uy1, ux2, uy2),
+                            aatg, abox, ts);
+            }
+        } finally {
+            tileStateProvider.release(ts);
         }
-
-        renderTiles(sg, ts.computeBBox(ux1, uy1, ux2, uy2), aatg, abox, ts);
     }
 
+    @Override
     public void drawParallelogram(SunGraphics2D sg,
                                   double ux1, double uy1,
                                   double ux2, double uy2,
@@ -105,52 +116,61 @@
                                   double dx2, double dy2,
                                   double lw1, double lw2)
     {
-        Region clip = sg.getCompClip();
-        final TileState ts = tileStateThreadLocal.get();
-        final int[] abox = ts.abox;
+        final TileState ts = tileStateProvider.acquire();
+        try {
+            final int[] abox = ts.abox;
 
-        AATileGenerator aatg =
-            renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, lw1, lw2,
-                                            clip, abox);
-        if (aatg == null) {
-            // Nothing to render
-            return;
+            final AATileGenerator aatg =
+                renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, lw1,
+                                                lw2, sg.getCompClip(), abox);
+            if (aatg != null) {
+                // Note that bbox is of the original shape, not the wide path.
+                // This is appropriate for handing to Paint methods...
+                renderTiles(sg, ts.computeBBox(ux1, uy1, ux2, uy2),
+                            aatg, abox, ts);
+            }
+        } finally {
+            tileStateProvider.release(ts);
         }
-
-        // Note that bbox is of the original shape, not the wide path.
-        // This is appropriate for handing to Paint methods...
-        renderTiles(sg, ts.computeBBox(ux1, uy1, ux2, uy2), aatg, abox, ts);
     }
 
     public void renderPath(SunGraphics2D sg, Shape s, BasicStroke bs) {
-        boolean adjust = (bs != null &&
+        final boolean adjust = (bs != null &&
                           sg.strokeHint != SunHints.INTVAL_STROKE_PURE);
-        boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED);
+        final boolean thin = (sg.strokeState <= SunGraphics2D.STROKE_THINDASHED);
 
-        Region clip = sg.getCompClip();
-        final TileState ts = tileStateThreadLocal.get();
-        final int[] abox = ts.abox;
+        final TileState ts = tileStateProvider.acquire();
+        try {
+            final int[] abox = ts.abox;
 
-        AATileGenerator aatg =
-            renderengine.getAATileGenerator(s, sg.transform, clip,
-                                            bs, thin, adjust, abox);
-        if (aatg == null) {
-            // Nothing to render
-            return;
+            final AATileGenerator aatg =
+                renderengine.getAATileGenerator(s, sg.transform, sg.getCompClip(),
+                                                bs, thin, adjust, abox);
+            if (aatg != null) {
+                renderTiles(sg, s, aatg, abox, ts);
+            }
+        } finally {
+            tileStateProvider.release(ts);
         }
-
-        renderTiles(sg, s, aatg, abox, ts);
     }
 
     public void renderTiles(SunGraphics2D sg, Shape s,
-                            AATileGenerator aatg, int abox[], TileState ts)
+                            final AATileGenerator aatg,
+                            final int[] abox, final TileState ts)
     {
         Object context = null;
         try {
+            // reentrance: outpipe may also use AAShapePipe:
             context = outpipe.startSequence(sg, s,
                                             ts.computeDevBox(abox),
                                             abox);
 
+            // copy of int[] abox as local variables for performance:
+            final int x0 = abox[0];
+            final int y0 = abox[1];
+            final int x1 = abox[2];
+            final int y1 = abox[3];
+
             final int tw = aatg.getTileWidth();
             final int th = aatg.getTileHeight();
 
@@ -158,16 +178,15 @@
             final byte[] alpha = ts.getAlphaTile(tw * th);
             byte[] atile;
 
-            for (int y = abox[1]; y < abox[3]; y += th) {
-                int h = Math.min(th, abox[3] - y);
+            for (int y = y0; y < y1; y += th) {
+                final int h = Math.min(th, y1 - y);
 
-                for (int x = abox[0]; x < abox[2]; x += tw) {
-                    int w = Math.min(tw, abox[2] - x);
+                for (int x = x0; x < x1; x += tw) {
+                    final int w = Math.min(tw, x1 - x);
 
-                    int a = aatg.getTypicalAlpha();
-                    if (a == 0x00 ||
-                        outpipe.needTile(context, x, y, w, h) == false)
-                    {
+                    final int a = aatg.getTypicalAlpha();
+
+                    if (a == 0x00 || !outpipe.needTile(context, x, y, w, h)) {
                         aatg.nextTile();
                         outpipe.skipTile(context, x, y);
                         continue;
@@ -180,8 +199,7 @@
                         aatg.getAlpha(alpha, 0, tw);
                     }
 
-                    outpipe.renderPathTile(context, atile, 0, tw,
-                                           x, y, w, h);
+                    outpipe.renderPathTile(context, atile, 0, tw, x, y, w, h);
                 }
             }
         } finally {
@@ -193,7 +211,7 @@
     }
 
     // Tile state used by AAShapePipe
-    static final class TileState {
+    static final class TileState extends ReentrantContext {
         // cached tile (32 x 32 tile by default)
         private byte[] theTile = new byte[32 * 32];
         // dirty aabox array
@@ -240,5 +258,4 @@
             return box;
         }
     }
-
 }
--- a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Mon Mar 14 20:53:59 2016 -0700
@@ -791,12 +791,15 @@
             return page;
         }
 
-        final GraphicsConfiguration gc =
-            GraphicsEnvironment.getLocalGraphicsEnvironment().
-            getDefaultScreenDevice().getDefaultConfiguration();
-        Rectangle bounds = gc.getBounds();
-        int x = bounds.x+bounds.width/3;
-        int y = bounds.y+bounds.height/3;
+        GraphicsConfiguration grCfg = null;
+        Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+        if (w != null) {
+            grCfg = w.getGraphicsConfiguration();
+        } else {
+            grCfg = GraphicsEnvironment.getLocalGraphicsEnvironment().
+                        getDefaultScreenDevice().getDefaultConfiguration();
+        }
+        final GraphicsConfiguration gc = grCfg;
 
         PrintService service = java.security.AccessController.doPrivileged(
                                new java.security.PrivilegedAction<PrintService>() {
@@ -814,9 +817,39 @@
             return null;
         }
 
+        // we position the dialog a little beyond the upper-left corner of the window
+        // which is consistent with the NATIVE page dialog
+        Rectangle gcBounds = gc.getBounds();
+        int x = gcBounds.x+50;
+        int y = gcBounds.y+50;
         ServiceDialog pageDialog = new ServiceDialog(gc, x, y, service,
                                        DocFlavor.SERVICE_FORMATTED.PAGEABLE,
                                        attributes, (Frame)null);
+        Rectangle dlgBounds = pageDialog.getBounds();
+
+        // if portion of dialog is not within the gc boundary
+        if (!gcBounds.contains(dlgBounds)) {
+            // check if dialog exceed window bounds at left or bottom
+            // Then position the dialog by moving it by the amount it exceeds
+            // the window bounds
+            // If it results in dialog moving beyond the window bounds at top/left
+            // then position it at window top/left
+            if (dlgBounds.x + dlgBounds.width > gcBounds.x + gcBounds.width) {
+                if ((gcBounds.x + gcBounds.width - dlgBounds.width) > gcBounds.x) {
+                    x = (gcBounds.x + gcBounds.width) - dlgBounds.width;
+                } else {
+                    x = gcBounds.x;
+                }
+            }
+            if (dlgBounds.y + dlgBounds.height > gcBounds.y + gcBounds.height) {
+                if ((gcBounds.y + gcBounds.height - dlgBounds.height) > gcBounds.y) {
+                    y = (gcBounds.y + gcBounds.height) - dlgBounds.height;
+                } else {
+                    y = gcBounds.y;
+                }
+            }
+            pageDialog.setBounds(x, y, dlgBounds.width, dlgBounds.height);
+        }
         pageDialog.show();
 
         if (pageDialog.getStatus() == ServiceDialog.APPROVE) {
@@ -893,9 +926,15 @@
          * We raise privilege when we put up the dialog, to avoid
          * the "warning applet window" banner.
          */
-        final GraphicsConfiguration gc =
-            GraphicsEnvironment.getLocalGraphicsEnvironment().
-            getDefaultScreenDevice().getDefaultConfiguration();
+        GraphicsConfiguration grCfg = null;
+        Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+        if (w != null) {
+            grCfg = w.getGraphicsConfiguration();
+        } else {
+            grCfg = GraphicsEnvironment.getLocalGraphicsEnvironment().
+                        getDefaultScreenDevice().getDefaultConfiguration();
+        }
+        final GraphicsConfiguration gc = grCfg;
 
         PrintService service = java.security.AccessController.doPrivileged(
                                new java.security.PrivilegedAction<PrintService>() {
@@ -940,9 +979,10 @@
             }
         }
 
-        Rectangle bounds = gc.getBounds();
-        int x = bounds.x+bounds.width/3;
-        int y = bounds.y+bounds.height/3;
+        // we position the dialog a little beyond the upper-left corner of the window
+        // which is consistent with the NATIVE print dialog
+        int x = 50;
+        int y = 50;
         PrintService newService;
         // temporarily add an attribute pointing back to this job.
         PrinterJobWrapper jobWrapper = new PrinterJobWrapper(this);
--- a/src/java.desktop/unix/classes/sun/java2d/x11/XSurfaceData.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/unix/classes/sun/java2d/x11/XSurfaceData.java	Mon Mar 14 20:53:59 2016 -0700
@@ -1,3 +1,27 @@
+/*
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.java2d.x11;
 
 import java.awt.image.*;
--- a/src/java.desktop/unix/classes/sun/print/CUPSPrinter.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/unix/classes/sun/print/CUPSPrinter.java	Mon Mar 14 20:53:59 2016 -0700
@@ -52,6 +52,7 @@
     private boolean initialized;
     private static native String getCupsServer();
     private static native int getCupsPort();
+    private static native String getCupsDefaultPrinter();
     private static native boolean canConnect(String server, int port);
     private static native boolean initIDs();
     // These functions need to be synchronized as
@@ -266,6 +267,15 @@
      * Returns 2 values - index 0 is printer name, index 1 is the uri.
      */
     static String[] getDefaultPrinter() {
+        // Try to get user/lpoptions-defined printer name from CUPS
+        // if not user-set, then go for server default destination
+        String printerInfo[] = new String[2];
+        printerInfo[0] = getCupsDefaultPrinter();
+
+        if (printerInfo[0] != null) {
+            printerInfo[1] = null;
+            return printerInfo.clone();
+        }
         try {
             URL url = new URL("http", getServer(), getPort(), "");
             final HttpURLConnection urlConnection =
@@ -301,7 +311,7 @@
                                         attCl)) {
 
                     HashMap<String, AttributeClass> defaultMap = null;
-                    String[] printerInfo = new String[2];
+
                     InputStream is = urlConnection.getInputStream();
                     HashMap<String, AttributeClass>[] responseMap = IPPPrintService.readIPPResponse(
                                          is);
--- a/src/java.desktop/unix/native/common/awt/CUPSfuncs.c	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/unix/native/common/awt/CUPSfuncs.c	Mon Mar 14 20:53:59 2016 -0700
@@ -43,6 +43,10 @@
 typedef http_t* (*fn_httpConnect)(const char *, int);
 typedef void (*fn_httpClose)(http_t *);
 typedef char* (*fn_cupsGetPPD)(const char *);
+typedef cups_dest_t* (*fn_cupsGetDest)(const char *name,
+    const char *instance, int num_dests, cups_dest_t *dests);
+typedef int (*fn_cupsGetDests)(cups_dest_t **dests);
+typedef void (*fn_cupsFreeDests)(int num_dests, cups_dest_t *dests);
 typedef ppd_file_t* (*fn_ppdOpenFile)(const char *);
 typedef void (*fn_ppdClose)(ppd_file_t *);
 typedef ppd_option_t* (*fn_ppdFindOption)(ppd_file_t *, const char *);
@@ -53,6 +57,9 @@
 fn_httpConnect j2d_httpConnect;
 fn_httpClose j2d_httpClose;
 fn_cupsGetPPD j2d_cupsGetPPD;
+fn_cupsGetDest j2d_cupsGetDest;
+fn_cupsGetDests j2d_cupsGetDests;
+fn_cupsFreeDests j2d_cupsFreeDests;
 fn_ppdOpenFile j2d_ppdOpenFile;
 fn_ppdClose j2d_ppdClose;
 fn_ppdFindOption j2d_ppdFindOption;
@@ -106,6 +113,24 @@
     return JNI_FALSE;
   }
 
+  j2d_cupsGetDest = (fn_cupsGetDest)dlsym(handle, "cupsGetDest");
+  if (j2d_cupsGetDest == NULL) {
+    dlclose(handle);
+    return JNI_FALSE;
+  }
+
+  j2d_cupsGetDests = (fn_cupsGetDests)dlsym(handle, "cupsGetDests");
+  if (j2d_cupsGetDests == NULL) {
+    dlclose(handle);
+    return JNI_FALSE;
+  }
+
+  j2d_cupsFreeDests = (fn_cupsFreeDests)dlsym(handle, "cupsFreeDests");
+  if (j2d_cupsFreeDests == NULL) {
+    dlclose(handle);
+    return JNI_FALSE;
+  }
+
   j2d_ppdOpenFile = (fn_ppdOpenFile)dlsym(handle, "ppdOpenFile");
   if (j2d_ppdOpenFile == NULL) {
     dlclose(handle);
@@ -170,6 +195,30 @@
 
 
 /*
+ * Gets CUPS default printer name.
+ *
+ */
+JNIEXPORT jstring JNICALL
+Java_sun_print_CUPSPrinter_getCupsDefaultPrinter(JNIEnv *env,
+                                                  jobject printObj)
+{
+    jstring cDefPrinter = NULL;
+    cups_dest_t *dests;
+    char *defaultPrinter = NULL;
+    int num_dests = j2d_cupsGetDests(&dests);
+    int i = 0;
+    cups_dest_t *dest = j2d_cupsGetDest(NULL, NULL, num_dests, dests);
+    if (dest != NULL) {
+        defaultPrinter = dest->name;
+        if (defaultPrinter != NULL) {
+            cDefPrinter = JNU_NewStringPlatform(env, defaultPrinter);
+        }
+    }
+    j2d_cupsFreeDests(num_dests, dests);
+    return cDefPrinter;
+}
+
+/*
  * Checks if connection can be made to the server.
  *
  */
--- a/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Mon Mar 14 20:53:59 2016 -0700
@@ -500,6 +500,7 @@
 class D3DSurfaceToSwBlit extends Blit {
 
     private int typeval;
+    private WeakReference<SurfaceData> srcTmp;
 
     // REMIND: destination will actually be opaque/premultiplied...
     D3DSurfaceToSwBlit(SurfaceType dstType, int typeval) {
@@ -509,11 +510,97 @@
         this.typeval = typeval;
     }
 
+    /*
+     * Clip value is ignored in D3D SurfaceToSw blit.
+     * Root Cause: The native interfaces to D3D use StretchRect API followed
+     * by custom copy of pixels from Surface to Sysmem. As a result, clipping
+     * in D3DSurfaceToSw works 'only' for Rect clips, provided, proper srcX,
+     * srcY, dstX, dstY, width and height are passed to native interfaces.
+     * Non rect clips (For example: Shape clips) are ignored completely.
+     *
+     * Solution: There are three solutions possible to fix this issue.
+     * 1. Convert the entire Surface to Sysmem and perform regular Blit.
+     *    An optimized version of this is to take up the conversion only
+     *    when Shape clips are needed. Existing native interface will suffice
+     *    for supporting Rect clips.
+     * 2. With help of existing classes we could perform SwToSurface,
+     *    SurfaceToSurface (implements clip) and SurfaceToSw (complete copy)
+     *    in order.
+     * 3. Modify the native D3D interface to accept clip and perform same logic
+     *    as the second approach but at native side.
+     *
+     * Upon multiple experiments, the first approach has been found to be
+     * faster than the others as it deploys 1-draw/copy operation for rect clip
+     * and 2-draw/copy operations for shape clip compared to 3-draws/copy
+     * operations deployed by the remaining approaches.
+     *
+     * complexClipBlit method helps to convert or copy the contents from
+     * D3DSurface onto Sysmem and perform a regular Blit with the clip
+     * information as required. This method is used when non-rectangular
+     * clip is needed.
+     */
+    private synchronized void complexClipBlit(SurfaceData src, SurfaceData dst,
+                                              Composite comp, Region clip,
+                                              int sx, int sy, int dx, int dy,
+                                              int w, int h) {
+        SurfaceData cachedSrc = null;
+        if (srcTmp != null) {
+            // use cached intermediate surface, if available
+            cachedSrc = srcTmp.get();
+        }
+
+        // Type- indicates the pixel format of Sysmem based BufferedImage.
+        // Native d3d interfaces support on the fly conversion of pixels from
+        // d3d surface to destination sysmem memory of type IntARGB only.
+        final int type = BufferedImage.TYPE_INT_ARGB;
+        src = convertFrom(this, src, sx, sy, w, h, cachedSrc, type);
+
+        // copy intermediate SW to destination SW using complex clip
+        final Blit performop = Blit.getFromCache(src.getSurfaceType(),
+                                                 CompositeType.SrcNoEa,
+                                                 dst.getSurfaceType());
+        performop.Blit(src, dst, comp, clip, 0, 0, dx, dy, w, h);
+
+        if (src != cachedSrc) {
+            // cache the intermediate surface
+            srcTmp = new WeakReference<>(src);
+        }
+    }
+
     public void Blit(SurfaceData src, SurfaceData dst,
                      Composite comp, Region clip,
                      int sx, int sy, int dx, int dy,
                      int w, int h)
     {
+        if (clip != null) {
+            clip = clip.getIntersectionXYWH(dx, dy, w, h);
+            // At the end this method will flush the RenderQueue, we should exit
+            // from it as soon as possible.
+            if (clip.isEmpty()) {
+                return;
+            }
+
+            // Adjust final dst(x,y) and src(x,y) based on the clip. The
+            // logic is that, when clip limits drawing on the destination,
+            // corresponding pixels from the src should be skipped.
+            sx += clip.getLoX() - dx;
+            sy += clip.getLoY() - dy;
+            dx = clip.getLoX();
+            dy = clip.getLoY();
+            w = clip.getWidth();
+            h = clip.getHeight();
+
+            // Check if the clip is Rectangular. For non-rectangular clips
+            // complexClipBlit will convert Surface To Sysmem and perform
+            // regular Blit.
+            if (!clip.isRectangular()) {
+                complexClipBlit(src, dst, comp, clip,
+                                sx, sy, dx, dy,
+                                w, h);
+                return;
+            }
+        }
+
         D3DRenderQueue rq = D3DRenderQueue.getInstance();
         rq.lock();
         try {
--- a/src/java.httpclient/share/classes/java/net/http/Exchange.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.httpclient/share/classes/java/net/http/Exchange.java	Mon Mar 14 20:53:59 2016 -0700
@@ -214,21 +214,21 @@
                 .sendHeadersAsync()
                 .thenCompose((Void v) -> {
                     // send body and get response at same time
-                    exchImpl.sendBodyAsync();
-                    return exchImpl.getResponseAsync(null);
+                    return exchImpl.sendBodyAsync()
+                                   .thenCompose(exchImpl::getResponseAsync);
                 })
-                    .thenCompose((HttpResponseImpl r1) -> {
-                        int rcode = r1.statusCode();
-                        CompletableFuture<HttpResponseImpl> cf =
-                                checkForUpgradeAsync(r1, exchImpl);
-                        if (cf != null) {
-                            return cf;
-                        } else {
-                            Exchange.this.response = r1;
-                            logResponse(r1);
-                            return CompletableFuture.completedFuture(r1);
-                        }
-                    })
+                .thenCompose((HttpResponseImpl r1) -> {
+                    int rcode = r1.statusCode();
+                    CompletableFuture<HttpResponseImpl> cf =
+                            checkForUpgradeAsync(r1, exchImpl);
+                    if (cf != null) {
+                        return cf;
+                    } else {
+                        Exchange.this.response = r1;
+                        logResponse(r1);
+                        return CompletableFuture.completedFuture(r1);
+                    }
+                })
                 .thenApply((HttpResponseImpl response) -> {
                     this.response = response;
                     logResponse(response);
--- a/src/java.httpclient/share/classes/java/net/http/HttpClientImpl.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.httpclient/share/classes/java/net/http/HttpClientImpl.java	Mon Mar 14 20:53:59 2016 -0700
@@ -30,19 +30,17 @@
 import java.net.URI;
 import static java.net.http.Utils.BUFSIZE;
 import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
 import java.nio.channels.SelectableChannel;
 import java.nio.channels.SelectionKey;
 import static java.nio.channels.SelectionKey.OP_CONNECT;
 import static java.nio.channels.SelectionKey.OP_READ;
 import static java.nio.channels.SelectionKey.OP_WRITE;
 import java.nio.channels.Selector;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
+import java.util.stream.Stream;
 import java.util.concurrent.ExecutorService;
 import java.security.NoSuchAlgorithmException;
-import java.util.ListIterator;
-import java.util.Optional;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 import javax.net.ssl.SSLContext;
@@ -72,12 +70,6 @@
     private static final ThreadFactory defaultFactory = Executors.defaultThreadFactory();
     private final LinkedList<TimeoutEvent> timeouts;
 
-    //@Override
-    void debugPrint() {
-        selmgr.debugPrint();
-        client2.debugPrint();
-    }
-
     public static HttpClientImpl create(HttpClientBuilderImpl builder) {
         HttpClientImpl impl = new HttpClientImpl(builder);
         impl.start();
@@ -173,19 +165,15 @@
     // Main loop for this client's selector
 
     class SelectorManager extends Thread {
-
         final Selector selector;
         boolean closed;
 
         final List<AsyncEvent> readyList;
         final List<AsyncEvent> registrations;
 
-        List<AsyncEvent> debugList;
-
         SelectorManager() throws IOException {
             readyList = new LinkedList<>();
             registrations = new LinkedList<>();
-            debugList = new LinkedList<>();
             selector = Selector.open();
         }
 
@@ -216,13 +204,6 @@
             return c;
         }
 
-        synchronized void debugPrint() {
-            System.err.println("Selecting on:");
-            for (AsyncEvent e : debugList) {
-                System.err.println(opvals(e.interestOps()));
-            }
-        }
-
         String opvals(int i) {
             StringBuilder sb = new StringBuilder();
             if ((i & OP_READ) != 0)
@@ -239,14 +220,18 @@
             try {
                 while (true) {
                     synchronized (this) {
-                        debugList = copy(registrations);
                         for (AsyncEvent exchange : registrations) {
                             SelectableChannel c = exchange.channel();
                             try {
                                 c.configureBlocking(false);
-                                c.register(selector,
-                                           exchange.interestOps(),
-                                           exchange);
+                                SelectionKey key = c.keyFor(selector);
+                                SelectorAttachment sa;
+                                if (key == null) {
+                                    sa = new SelectorAttachment(c, selector);
+                                } else {
+                                    sa = (SelectorAttachment)key.attachment();
+                                }
+                                sa.register(exchange);
                             } catch (IOException e) {
                                 Log.logError("HttpClientImpl: " + e);
                                 c.close();
@@ -266,11 +251,10 @@
                     Set<SelectionKey> keys = selector.selectedKeys();
 
                     for (SelectionKey key : keys) {
-                        if (key.isReadable() || key.isConnectable() || key.isWritable()) {
-                            key.cancel();
-                            AsyncEvent exchange = (AsyncEvent) key.attachment();
-                            readyList.add(exchange);
-                        }
+                        SelectorAttachment sa = (SelectorAttachment)key.attachment();
+                        int eventsOccurred = key.readyOps();
+                        sa.events(eventsOccurred).forEach(readyList::add);
+                        sa.resetInterestOps(eventsOccurred);
                     }
                     selector.selectNow(); // complete cancellation
                     selector.selectedKeys().clear();
@@ -306,6 +290,80 @@
     }
 
     /**
+     * Tracks multiple user level registrations associated with one NIO
+     * registration (SelectionKey). In this implementation, registrations
+     * are one-off and when an event is posted the registration is cancelled
+     * until explicitly registered again.
+     *
+     * <p> No external synchronization required as this class is only used
+     * by the SelectorManager thread. One of these objects required per
+     * connection.
+     */
+    private static class SelectorAttachment {
+        private final SelectableChannel chan;
+        private final Selector selector;
+        private final ArrayList<AsyncEvent> pending;
+        private int interestops;
+
+        SelectorAttachment(SelectableChannel chan, Selector selector) {
+            this.pending = new ArrayList<>();
+            this.chan = chan;
+            this.selector = selector;
+        }
+
+        void register(AsyncEvent e) throws ClosedChannelException {
+            int newops = e.interestOps();
+            boolean reRegister = (interestops & newops) != newops;
+            interestops |= newops;
+            pending.add(e);
+            if (reRegister) {
+                // first time registration happens here also
+                chan.register(selector, interestops, this);
+            }
+        }
+
+        int interestOps() {
+            return interestops;
+        }
+
+        /**
+         * Returns a Stream<AsyncEvents> containing only events that are
+         * registered with the given {@code interestop}.
+         */
+        Stream<AsyncEvent> events(int interestop) {
+            return pending.stream()
+                          .filter(ev -> (ev.interestOps() & interestop) != 0);
+        }
+
+        /**
+         * Removes any events with the given {@code interestop}, and if no
+         * events remaining, cancels the associated SelectionKey.
+         */
+        void resetInterestOps(int interestop) {
+            int newops = 0;
+
+            Iterator<AsyncEvent> itr = pending.iterator();
+            while (itr.hasNext()) {
+                AsyncEvent event = itr.next();
+                int evops = event.interestOps();
+                if ((evops & interestop) != 0) {
+                    itr.remove();
+                } else {
+                    newops |= evops;
+                }
+            }
+
+            interestops = newops;
+            SelectionKey key = chan.keyFor(selector);
+            if (newops == 0) {
+                key.cancel();
+            } else {
+                key.interestOps(newops);
+            }
+        }
+    }
+
+    /**
      * Creates a HttpRequest associated with this group.
      *
      * @throws IllegalStateException if the group has been stopped
@@ -425,18 +483,9 @@
             }
         }
         iter.add(event);
-        //debugPrintList("register");
         selmgr.wakeupSelector();
     }
 
-    void debugPrintList(String s) {
-        System.err.printf("%s: {", s);
-        for (TimeoutEvent e : timeouts) {
-            System.err.printf("(%d,%d) ", e.delta, e.timeval);
-        }
-        System.err.println("}");
-    }
-
     synchronized void signalTimeouts(long then) {
         if (timeouts.isEmpty()) {
             return;
@@ -462,7 +511,6 @@
                 break;
             }
         }
-        //debugPrintList("signalTimeouts");
     }
 
     synchronized void cancelTimer(TimeoutEvent event) {
--- a/src/java.naming/share/classes/javax/naming/CompoundName.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/java.naming/share/classes/javax/naming/CompoundName.java	Mon Mar 14 20:53:59 2016 -0700
@@ -82,7 +82,7 @@
  *      attribute-value-assertions when specifying multiple attribute/value
  *      pairs. (e.g. ","  in age=65,gender=male).
  *  <dt>jndi.syntax.separator.typeval
- *  <dd>If present, specifies the string that separators attribute
+ *  <dd>If present, specifies the string that separates attribute
  *              from value (e.g. "=" in "age=65")
  *</dl>
  * These properties are interpreted according to the following rules:
--- a/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java	Mon Mar 14 20:53:59 2016 -0700
@@ -32,6 +32,7 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.image.*;
+import java.security.AccessControlException;
 // Do not import Swing classes.  This module is intended to work
 // with both Swing and AWT.
 // import javax.swing.*;
@@ -77,7 +78,7 @@
             return null;
         }
         try {
-            t = Class.forName("com.sun.java.accessibility.util.internal"
+            t = Class.forName("com.sun.java.accessibility.util.internal."
                               + c.getSimpleName()
                               + "Translator");
             return t;
@@ -105,6 +106,10 @@
         if (o instanceof Accessible) {
             a = (Accessible)o;
         } else {
+            // About to "newInstance" an object of a class of a restricted package
+            // so ensure the caller is allowed access to that package.
+            String pkg = "com.sun.java.accessibility.util.internal";
+            System.getSecurityManager().checkPackageAccess(pkg);
             Class<?> translatorClass = getTranslatorClass(o.getClass());
             if (translatorClass != null) {
                 try {
--- a/src/jdk.charsets/share/classes/sun/nio/cs/ext/AbstractCharsetProvider.java	Mon Mar 14 12:58:07 2016 +0000
+++ b/src/jdk.charsets/share/classes/sun/nio/cs/ext/AbstractCharsetProvider.java	Mon Mar 14 20:53:59 2016 -0700
@@ -33,7 +33,6 @@
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
-import sun.misc.ASCIICaseInsensitiveComparator;
 
 
 /**
@@ -49,22 +48,22 @@
     /* Maps canonical names to class names
      */
     private Map<String,String> classMap
-        = new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
+        = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
 
     /* Maps alias names to canonical names
      */
     private Map<String,String> aliasMap
-        = new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
+        = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
 
     /* Maps canonical names to alias-name arrays
      */
     private Map<String,String[]> aliasNameMap
-        = new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
+        = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
 
     /* Maps canonical names to soft references that hold cached instances
      */
     private Map<String,SoftReference<Charset>> cache
-        = new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
+        = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
 
     private String packagePrefix;
 
--- a/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/Dispatch.java	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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 com.apple.concurrent;
-
-import java.util.concurrent.*;
-
-/**
- * Factory for {@link Executor}s and {@link ExecutorService}s backed by
- * libdispatch.
- *
- * Access is controlled through the Dispatch.getInstance() method, because
- * performed tasks occur on threads owned by libdispatch. These threads are
- * not owned by any particular AppContext or have any specific context
- * classloader installed.
- *
- * @since Java for Mac OS X 10.6 Update 2
- */
-public final class Dispatch {
-        /**
-         * The priorities of the three default asynchronous queues.
-         */
-        public enum Priority {
-                LOW(-2), NORMAL(0), HIGH(2); // values from <dispatch/queue.h>
-
-                final int nativePriority;
-                Priority(final int nativePriority) { this.nativePriority = nativePriority; }
-        };
-
-        final static Dispatch instance = new Dispatch();
-
-        /**
-         * Factory method returns an instnace of Dispatch if supported by the
-         * underlying operating system, and if the caller's security manager
-         * permits "canInvokeInSystemThreadGroup".
-         *
-         * @return a factory instance of Dispatch, or null if not available
-         */
-        public static Dispatch getInstance() {
-                checkSecurity();
-                if (!LibDispatchNative.nativeIsDispatchSupported()) return null;
-
-                return instance;
-        }
-
-        private static void checkSecurity() {
-        final SecurityManager security = System.getSecurityManager();
-        if (security != null) security.checkPermission(new RuntimePermission("canInvokeInSystemThreadGroup"));
-    }
-
-        private Dispatch() { }
-
-        /**
-         * Creates an {@link Executor} that performs tasks asynchronously. The {@link Executor}
-         * cannot be shutdown, and enqueued {@link Runnable}s cannot be canceled. Passing null
-         * returns the {@link Priority.NORMAL} {@link Executor}.
-         *
-         * @param priority - the priority of the returned {@link Executor}
-         * @return an asynchronous {@link Executor}
-         */
-        public Executor getAsyncExecutor(Priority priority) {
-                if (priority == null) priority = Priority.NORMAL;
-                final long nativeQueue = LibDispatchNative.nativeCreateConcurrentQueue(priority.nativePriority);
-                if (nativeQueue == 0L) return null;
-                return new LibDispatchConcurrentQueue(nativeQueue);
-        }
-
-        int queueIndex = 0;
-        /**
-         * Creates an {@link ExecutorService} that performs tasks synchronously in FIFO order.
-         * Useful to protect a resource against concurrent modification, in lieu of a lock.
-         * Passing null returns an {@link ExecutorService} with a uniquely labeled queue.
-         *
-         * @param label - a label to name the queue, shown in several debugging tools
-         * @return a synchronous {@link ExecutorService}
-         */
-        public ExecutorService createSerialExecutor(String label) {
-                if (label == null) label = "";
-                if (label.length() > 256) label = label.substring(0, 256);
-                String queueName = "com.apple.java.concurrent.";
-                if ("".equals(label)) {
-                        synchronized (this) {
-                                queueName += queueIndex++;
-                        }
-                } else {
-                        queueName += label;
-                }
-
-                final long nativeQueue = LibDispatchNative.nativeCreateSerialQueue(queueName);
-                if (nativeQueue == 0) return null;
-                return new LibDispatchSerialQueue(nativeQueue);
-        }
-
-        Executor nonBlockingMainQueue = null;
-        /**
-         * Returns an {@link Executor} that performs the provided Runnables on the main queue of the process.
-         * Runnables submitted to this {@link Executor} will not run until the AWT is started or another native toolkit is running a CFRunLoop or NSRunLoop on the main thread.
-         *
-         * Submitting a Runnable to this {@link Executor} does not wait for the Runnable to complete.
-         * @return an asynchronous {@link Executor} that is backed by the main queue
-         */
-        public synchronized Executor getNonBlockingMainQueueExecutor() {
-                if (nonBlockingMainQueue != null) return nonBlockingMainQueue;
-                return nonBlockingMainQueue = new LibDispatchMainQueue.ASync();
-        }
-
-        Executor blockingMainQueue = null;
-        /**
-         * Returns an {@link Executor} that performs the provided Runnables on the main queue of the process.
-         * Runnables submitted to this {@link Executor} will not run until the AWT is started or another native toolkit is running a CFRunLoop or NSRunLoop on the main thread.
-         *
-         * Submitting a Runnable to this {@link Executor} will block until the Runnable has completed.
-         * @return an {@link Executor} that is backed by the main queue
-         */
-        public synchronized Executor getBlockingMainQueueExecutor() {
-                if (blockingMainQueue != null) return blockingMainQueue;
-                return blockingMainQueue = new LibDispatchMainQueue.Sync();
-        }
-}
--- a/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchConcurrentQueue.java	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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 com.apple.concurrent;
-
-import java.util.concurrent.Executor;
-
-class LibDispatchConcurrentQueue extends LibDispatchQueue implements Executor {
-        LibDispatchConcurrentQueue(final long queuePtr) {
-                super(queuePtr);
-        }
-
-        @Override
-        public void execute(final Runnable task) {
-                LibDispatchNative.nativeExecuteAsync(ptr, task);
-        }
-
-        @Override
-        protected synchronized void dispose() {
-                // should not dispose the default concurrent queues
-        }
-}
--- a/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchMainQueue.java	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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 com.apple.concurrent;
-
-import java.util.concurrent.Executor;
-
-abstract class LibDispatchMainQueue extends LibDispatchQueue implements Executor {
-        public LibDispatchMainQueue() {
-                super(LibDispatchNative.nativeGetMainQueue());
-        }
-
-        @Override
-        protected synchronized void dispose() {
-                // should not dispose the main queue
-        }
-
-        static class Sync extends LibDispatchMainQueue {
-                @Override
-                public void execute(final Runnable task) {
-                        LibDispatchNative.nativeExecuteSync(ptr, task);
-                }
-        }
-
-        static class ASync extends LibDispatchMainQueue {
-                @Override
-                public void execute(final Runnable task) {
-                        LibDispatchNative.nativeExecuteAsync(ptr, task);
-                }
-        }
-}
--- a/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchNative.java	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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 com.apple.concurrent;
-
-final class LibDispatchNative {
-    static {
-        java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction<Void>() {
-                public Void run() {
-                    System.loadLibrary("osx");
-                    return null;
-                }
-            });
-    }
-
-    static native boolean nativeIsDispatchSupported();
-    static native long nativeGetMainQueue();
-    static native long nativeCreateConcurrentQueue(int priority);
-    static native long nativeCreateSerialQueue(String name);
-    static native void nativeReleaseQueue(long nativeQueue);
-    static native void nativeExecuteAsync(long nativeQueue, Runnable task);
-    static native void nativeExecuteSync(long nativeQueue, Runnable task);
-
-    private LibDispatchNative() { }
-}
--- a/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchQueue.java	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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 com.apple.concurrent;
-
-class LibDispatchQueue extends LibDispatchRetainedResource {
-        LibDispatchQueue(final long queuePtr) {
-                super(queuePtr);
-        }
-}
--- a/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchRetainedResource.java	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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 com.apple.concurrent;
-
-class LibDispatchRetainedResource {
-        protected long ptr;
-
-        protected LibDispatchRetainedResource(final long ptr) {
-                this.ptr = ptr;
-        }
-
-        protected synchronized void dispose() {
-                if (ptr != 0) LibDispatchNative.nativeReleaseQueue(ptr);
-                ptr = 0;
-        }
-
-        protected void finalize() throws Throwable {
-                dispose();
-        }
-}
--- a/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/LibDispatchSerialQueue.java	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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 com.apple.concurrent;
-
-import java.util.List;
-import java.util.concurrent.*;
-
-class LibDispatchSerialQueue extends AbstractExecutorService {
-        static final int RUNNING    = 0;
-    static final int SHUTDOWN   = 1;
-//  static final int STOP       = 2; // not supported by GCD
-    static final int TERMINATED = 3;
-
-    final Object lock = new Object();
-        LibDispatchQueue nativeQueueWrapper;
-    volatile int runState;
-
-        LibDispatchSerialQueue(final long queuePtr) {
-                nativeQueueWrapper = new LibDispatchQueue(queuePtr);
-        }
-
-        @Override
-        public void execute(final Runnable task) {
-                if (nativeQueueWrapper == null) return;
-                LibDispatchNative.nativeExecuteAsync(nativeQueueWrapper.ptr, task);
-        }
-
-        @Override
-        public boolean isShutdown() {
-                return runState != RUNNING;
-        }
-
-        @Override
-        public boolean isTerminated() {
-                return runState == TERMINATED;
-        }
-
-        @Override
-        public void shutdown() {
-                synchronized (lock) {
-                        if (runState != RUNNING) return;
-
-                        runState = SHUTDOWN;
-                        execute(new Runnable() {
-                                public void run() {
-                                        synchronized (lock) {
-                                                runState = TERMINATED;
-                                                lock.notifyAll(); // for the benefit of awaitTermination()
-                                        }
-                                }
-                        });
-                        nativeQueueWrapper = null;
-                }
-        }
-
-        @Override
-        public List<Runnable> shutdownNow() {
-                shutdown();
-                return null;
-        }
-
-        @Override
-        public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException {
-                if (runState == TERMINATED) return true;
-
-                final long millis = unit.toMillis(timeout);
-                if (millis <= 0) return false;
-
-                synchronized (lock) {
-                        if (runState == TERMINATED) return true;
-                        lock.wait(timeout);
-                        if (runState == TERMINATED) return true;
-                }
-
-                return false;
-        }
-}
--- a/src/jdk.deploy.osx/macosx/classes/com/apple/concurrent/package.html	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<html>
-<head>
-</head>
-<body bgcolor="white">
-Apple-specific implementations of the java.util.concurrent.* API based on libdispatch.
-</body>
-</html>
--- a/src/jdk.deploy.osx/macosx/native/libosx/CFileManager.m	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, 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.
- */
-
-#import "com_apple_eio_FileManager.h"
-
-#import <Cocoa/Cocoa.h>
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-#import "ThreadUtilities.h"
-
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    _setFileTypeAndCreator
- * Signature: (Ljava/lang/String;II)V
- */
-JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileTypeAndCreator
-(JNIEnv *env, jclass clz, jstring javaFilename, jint type, jint creator)
-{
-JNF_COCOA_ENTER(env);
-        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
-        NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys:
-                                                        [NSNumber numberWithInt:type], NSFileHFSTypeCode,
-                                                        [NSNumber numberWithInt:creator], NSFileHFSCreatorCode, nil];
-    [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    _setFileType
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileType
-(JNIEnv *env, jclass ckz, jstring javaFilename, jint type)
-{
-JNF_COCOA_ENTER(env);
-        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
-        NSDictionary *attr = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:type] forKey:NSFileHFSTypeCode];
-    [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    _setFileCreator
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1setFileCreator
-(JNIEnv *env, jclass clz, jstring javaFilename, jint creator)
-{
-JNF_COCOA_ENTER(env);
-        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
-        NSDictionary *attr = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:creator] forKey:NSFileHFSCreatorCode];
-    [[NSFileManager defaultManager] changeFileAttributes:attr atPath:filename];
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    _getFileType
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_com_apple_eio_FileManager__1getFileType
-(JNIEnv *env, jclass clz, jstring javaFilename)
-{
-    jint type = 0;
-JNF_COCOA_ENTER(env);
-        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
-    NSDictionary *attributes = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
-    NSNumber *val = [attributes objectForKey:NSFileHFSTypeCode];
-    type = [val intValue];
-JNF_COCOA_EXIT(env);
-    return type;
-}
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    _getFileCreator
- * Signature: (Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL Java_com_apple_eio_FileManager__1getFileCreator
-  (JNIEnv *env, jclass clz, jstring javaFilename)
-{
-    jint creator = 0;
-JNF_COCOA_ENTER(env);
-        NSString *filename = JNFNormalizedNSStringForPath(env, javaFilename);
-    NSDictionary *attributes = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
-    NSNumber *val = [attributes objectForKey:NSFileHFSCreatorCode];
-    creator = [val intValue];
-JNF_COCOA_EXIT(env);
-    return creator;
-}
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    _findFolder
- * Signature: (SIZ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager__1findFolder__SIZ
-(JNIEnv *env, jclass clz, jshort domain, jint folderType, jboolean createIfNeeded)
-{
-    jstring filename = nil;
-JNF_COCOA_ENTER(env);
-
-    FSRef foundRef;
-    createIfNeeded = createIfNeeded || (folderType == kTemporaryFolderType) || (folderType == kChewableItemsFolderType);
-    if (FSFindFolder((SInt16)domain, (OSType)folderType, (Boolean)createIfNeeded, &foundRef) == noErr) {
-        char path[PATH_MAX];
-        if (FSRefMakePath(&foundRef, (UInt8 *)path, sizeof(path)) == noErr) {
-            NSString *filenameString = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path length:strlen(path)];
-            filename = JNFNormalizedJavaStringForPath(env, filenameString);
-        }
-    }
-
-JNF_COCOA_EXIT(env);
-    return filename;
-}
-
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    _openURL
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_com_apple_eio_FileManager__1openURL
-(JNIEnv *env, jclass clz, jstring urlString)
-{
-JNF_COCOA_ENTER(env);
-
-    NSURL *url = [NSURL URLWithString:JNFNormalizedNSStringForPath(env, urlString)];
-
-        // Radar 3208005: Run this on the main thread; file:// style URLs will hang otherwise.
-    [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^(){
-        [[NSWorkspace sharedWorkspace] openURL:url];
-    }];
-
-JNF_COCOA_EXIT(env);
-}
-
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    getNativeResourceFromBundle
- * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager_getNativeResourceFromBundle
-(JNIEnv *env, jclass clz, jstring javaResourceName, jstring javaSubDirName, jstring javaTypeName)
-{
-    jstring filename = NULL;
-JNF_COCOA_ENTER(env);
-
-    NSString *resourceName = JNFNormalizedNSStringForPath(env, javaResourceName);
-        NSString *subDirectory = JNFNormalizedNSStringForPath(env, javaSubDirName);
-        NSString *typeName = JNFNormalizedNSStringForPath(env, javaTypeName);
-
-    NSString *path = [[NSBundle mainBundle] pathForResource:resourceName
-                                                     ofType:typeName
-                                                inDirectory:subDirectory];
-
-    filename = JNFNormalizedJavaStringForPath(env, path);
-
-JNF_COCOA_EXIT(env);
-    return filename;
-}
-
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    getNativePathToApplicationBundle
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_com_apple_eio_FileManager_getNativePathToApplicationBundle
-(JNIEnv *env, jclass clazz)
-{
-        jstring filename = nil;
-JNF_COCOA_ENTER(env);
-
-        NSBundle *mainBundle = [NSBundle mainBundle];
-        filename = JNFNormalizedJavaStringForPath(env, [mainBundle bundlePath]);
-
-JNF_COCOA_EXIT(env);
-        return filename;
-}
-
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    __moveToTrash
- * Signature: (Ljava/lang/String;)V
- */
-
-JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1moveToTrash
-(JNIEnv *env, jclass clz, jstring url)
-{
-        __block jboolean returnValue = JNI_FALSE;
-JNF_COCOA_ENTER(env);
-
-    NSString *path = JNFNormalizedNSStringForPath(env, url);
-    [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
-        NSInteger res = 0;
-        [[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation
-                                                     source:[path stringByDeletingLastPathComponent]
-                                                destination:nil
-                                                      files:[NSArray arrayWithObject:[path lastPathComponent]]
-                                                        tag:&res];
-        returnValue = (res == 0);
-    }];
-
-JNF_COCOA_EXIT(env);
-
-        return returnValue;
-}
-
-/*
- * Class:     com_apple_eio_FileManager
- * Method:    __revealInFinder
- * Signature: (Ljava/lang/String;)V
- */
-
-JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1revealInFinder
-(JNIEnv *env, jclass clz, jstring url)
-{
-        __block jboolean returnValue = JNI_FALSE;
-JNF_COCOA_ENTER(env);
-
-    NSString *path = JNFNormalizedNSStringForPath(env, url);
-    [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
-        returnValue = [[NSWorkspace sharedWorkspace] selectFile:path inFileViewerRootedAtPath:@""];
-    }];
-
-JNF_COCOA_EXIT(env);
-
-        return returnValue;
-}
--- a/src/jdk.deploy.osx/macosx/native/libosx/Dispatch.m	Mon Mar 14 12:58:07 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
- * 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
- * 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.
- */
-
-/*
- * Must include this before JavaNativeFoundation.h to get jni.h from build
- */
-#include "jni.h"
-#include "jni_util.h"
-
-#import "com_apple_concurrent_LibDispatchNative.h"
-
-#import <dispatch/dispatch.h>
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-/*
- * Declare library specific JNI_Onload entry if static build
- */
-DEF_STATIC_JNI_OnLoad
-
-/*
- * Class:     com_apple_concurrent_LibDispatchNative
- * Method:    nativeIsDispatchSupported
- * Signature: ()Z
- */
-JNIEXPORT jboolean JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeIsDispatchSupported
-(JNIEnv *env, jclass clazz)
-{
-        return JNI_TRUE;
-}
-
-
-/*
- * Class:     com_apple_concurrent_LibDispatchNative
- * Method:    nativeGetMainQueue
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeGetMainQueue
-(JNIEnv *env, jclass clazz)
-{
-        dispatch_queue_t queue = dispatch_get_main_queue();
-        return ptr_to_jlong(queue);
-}
-
-
-/*
- * Class:     com_apple_concurrent_LibDispatchNative
- * Method:    nativeCreateConcurrentQueue
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeCreateConcurrentQueue
-(JNIEnv *env, jclass clazz, jint priority)
-{
-        dispatch_queue_t queue = dispatch_get_global_queue((long)priority, 0);
-        return ptr_to_jlong(queue);
-}
-
-
-/*
- * Class:     com_apple_concurrent_LibDispatchNative
- * Method:    nativeCreateSerialQueue
- * Signature: (Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeCreateSerialQueue
-(JNIEnv *env, jclass clazz, jstring name)
-{
-        if (name == NULL) return 0L;
-
-        jboolean isCopy;
-        const char *queue_name = (*env)->GetStringUTFChars(env, name, &isCopy);
-        dispatch_queue_t queue = dispatch_queue_create(queue_name, NULL);
-        (*env)->ReleaseStringUTFChars(env, name, queue_name);
-
-        return ptr_to_jlong(queue);
-}
-
-
-/*
- * Class:     com_apple_concurrent_LibDispatchNative
- * Method:    nativeReleaseQueue
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeReleaseQueue
-(JNIEnv *env, jclass clazz, jlong nativeQueue)
-{
-        if (nativeQueue == 0L) return;
-        dispatch_release((dispatch_queue_t)jlong_to_ptr(nativeQueue));
-}
-
-
-static JNF_CLASS_CACHE(jc_Runnable, "java/lang/Runnable");
-static JNF_MEMBER_CACHE(jm_run, jc_Runnable, "run", "()V");
-
-static void perform_dispatch(JNIEnv *env, jlong nativeQueue, jobject runnable, void (*dispatch_fxn)(dispatch_queue_t, dispatch_block_t))
-{
-JNF_COCOA_ENTER(env);
-        dispatch_queue_t queue = (dispatch_queue_t)jlong_to_ptr(nativeQueue);
-        if (queue == NULL) return; // shouldn't happen
-
-        // create a global-ref around the Runnable, so it can be safely passed to the dispatch thread
-        JNFJObjectWrapper *wrappedRunnable = [[JNFJObjectWrapper alloc] initWithJObject:runnable withEnv:env];
-
-        dispatch_fxn(queue, ^{
-                // attach the dispatch thread to the JVM if necessary, and get an env
-                JNFThreadContext ctx = JNFThreadDetachOnThreadDeath | JNFThreadSetSystemClassLoaderOnAttach | JNFThreadAttachAsDaemon;
-                JNIEnv *blockEnv = JNFObtainEnv(&ctx);
-
-        JNF_COCOA_ENTER(blockEnv);
-
-                // call the user's runnable
-                JNFCallObjectMethod(blockEnv, [wrappedRunnable jObject], jm_run);
-
-                // explicitly clear object while we have an env (it's cheaper that way)
-                [wrappedRunnable setJObject:NULL withEnv:blockEnv];
-
-        JNF_COCOA_EXIT(blockEnv);
-
-                // let the env go, but leave the thread attached as a daemon
-                JNFReleaseEnv(blockEnv, &ctx);
-        });
-
-        // release this thread's interest in the Runnable, the block
-        // will have retained the it's own interest above
-        [wrappedRunnable release];
-
-JNF_COCOA_EXIT(env);
-}
-
-
-/*
- * Class:     com_apple_concurrent_LibDispatchNative
- * Method:    nativeExecuteAsync
- * Signature: (JLjava/lang/Runnable;)V
- */
-JNIEXPORT void JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeExecuteAsync
-(JNIEnv *env, jclass clazz, jlong nativeQueue, jobject runnable)
-{
-        // enqueues and returns
-        perform_dispatch(env, nativeQueue, runnable, dispatch_async);
-}
-
-
-/*
- * Class:     com_apple_concurrent_LibDispatchNative
- * Method:    nativeExecuteSync
- * Signature: (JLjava/lang/Runnable;)V
- */
-JNIEXPORT void JNICALL Java_com_apple_concurrent_LibDispatchNative_nativeExecuteSync
-(JNIEnv *env, jclass clazz, jlong nativeQueue, jobject runnable)
-{
-        // blocks until the Runnable completes
-        perform_dispatch(env, nativeQueue, runnable, dispatch_sync);
-}
--- a/test/ProblemList.txt	Mon Mar 14 12:58:07 2016 +0000
+++ b/test/ProblemList.txt	Mon Mar 14 20:53:59 2016 -0700
@@ -334,9 +334,6 @@
 
 # jdk_time
 
-# 8134979
-java/time/tck/java/time/chrono/TCKJapaneseChronology.java       generic-all
-
 ############################################################################
 
 # jdk_tools
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/jdi/RedefineAddPrivateMethod.sh	Mon Mar 14 20:53:59 2016 -0700
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope