Merge
authorddehaven
Fri, 11 Mar 2016 09:16:55 -0800
changeset 36472 323288129e00
parent 36439 e0fdb6c0bb65 (current diff)
parent 36471 df8107032af5 (diff)
child 36473 95a8dbae68c9
Merge
jdk/src/java.desktop/macosx/native/libosx/CFileManager.m
jdk/test/javax/swing/JScrollPane/8033000/bug8033000.java
--- a/jdk/make/mapfiles/libawt/mapfile-mawt-vers	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/make/mapfiles/libawt/mapfile-mawt-vers	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/make/mapfiles/libawt_headless/mapfile-vers	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/make/mapfiles/libawt_headless/mapfile-vers	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/make/mapfiles/libawt_xawt/mapfile-vers	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/make/mapfiles/libawt_xawt/mapfile-vers	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameBorder.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameBorder.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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) {
-        Icon icon = frame.getFrameIcon();
-        if (icon == null) icon = UIManager.getIcon("InternalFrame.icon");
-        if (icon == null) return;
+    protected void paintTitleIcon(final Graphics g, final JInternalFrame frame,
+            final int x, final int y) {
 
-        // 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));
+        Icon icon = frame.getFrameIcon();
+        if (icon == null) {
+            icon = UIManager.getIcon("InternalFrame.icon");
+        }
+
+        if (icon == null) {
+            return;
         }
 
-        icon.paintIcon(frame, g, x, y);
+        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/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTableHeaderUI.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTableHeaderUI.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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);
+
+            if (localTable != null) {
+                final boolean thisColumnSelected = localTable.getColumnModel().getColumn(column).getModelIndex() == sortColumn;
 
-            cellBorder.setSelected(thisColumnSelected);
-            if (thisColumnSelected) {
-                cellBorder.setSortOrder(sortOrder);
-            } else {
-                cellBorder.setSortOrder(AquaTableHeaderBorder.SORT_NONE);
+                cellBorder.setSelected(thisColumnSelected);
+                if (thisColumnSelected) {
+                    cellBorder.setSortOrder(sortOrder);
+               }
             }
+
             setBorder(cellBorder);
             return this;
         }
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m	Fri Mar 11 09:16:55 2016 -0800
@@ -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;
--- a/jdk/src/java.desktop/macosx/native/libosx/CFileManager.m	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/macosx/native/libosx/CFileManager.m	Fri Mar 11 09:16:55 2016 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -213,25 +213,23 @@
  */
 
 JNIEXPORT jboolean JNICALL Java_com_apple_eio_FileManager__1moveToTrash
-(JNIEnv *env, jclass clz, jstring url)
+(JNIEnv *env, jclass clz, jstring fileName)
 {
-        __block jboolean returnValue = JNI_FALSE;
+    __block BOOL returnValue = NO;
 JNF_COCOA_ENTER(env);
 
-    NSString *path = JNFNormalizedNSStringForPath(env, url);
+    NSString * path = JNFNormalizedNSStringForPath(env, fileName);
+    NSURL *url = [NSURL fileURLWithPath:path];
     [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);
+
+        returnValue  = [[NSFileManager defaultManager] trashItemAtURL:url
+                                                     resultingItemURL:nil
+                                                                error:nil];
     }];
 
 JNF_COCOA_EXIT(env);
 
-        return returnValue;
+        return returnValue ? JNI_TRUE: JNI_FALSE;
 }
 
 /*
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFBaseJPEGCompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFColorConverter.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFCompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFCompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDecompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFExifJPEGCompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFExifJPEGCompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFaxCompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFaxCompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFieldNode.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFieldNode.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageMetadata.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriteParam.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriteParam.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWDecompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWDecompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWUtil.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWUtil.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFNullDecompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFNullDecompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFOldJPEGDecompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFRLECompressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFRLECompressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFRenderedImage.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFRenderedImage.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFT4Compressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFT4Compressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFT6Compressor.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFT6Compressor.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileWriter.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileWriter.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/java/beans/EventHandler.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/beans/EventHandler.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/BaselineTIFFTagSet.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifGPSTagSet.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifGPSTagSet.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifInteroperabilityTagSet.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifInteroperabilityTagSet.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifParentTIFFTagSet.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifParentTIFFTagSet.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifTIFFTagSet.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/ExifTIFFTagSet.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/GeoTIFFTagSet.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFDirectory.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFImageReadParam.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTagSet.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTagSet.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/swing/DefaultDesktopManager.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/DefaultDesktopManager.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/applet/Main.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/applet/Main.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/applet/resources/MsgAppletViewer.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/applet/resources/MsgAppletViewer.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/awt/ExtendedKeyCodes.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/awt/ExtendedKeyCodes.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/ReentrantContext.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/ReentrantContextProvider.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/ReentrantContextProviderCLQ.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/ReentrantContextProviderTL.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ByteArrayCache.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ByteArrayCache.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/marlin/FloatArrayCache.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/FloatArrayCache.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/marlin/IntArrayCache.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/IntArrayCache.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinCache.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinCache.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/java2d/pipe/AAShapePipe.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/AAShapePipe.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/unix/classes/sun/java2d/x11/XSurfaceData.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/x11/XSurfaceData.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/unix/classes/sun/print/CUPSPrinter.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/unix/classes/sun/print/CUPSPrinter.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/unix/native/common/awt/CUPSfuncs.c	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/unix/native/common/awt/CUPSfuncs.c	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/FocusTraversalPolicy/ContainerOrderFTPTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 8025001
+  @summary Tests java.awt.ContainerOrderFocusTraversalPolicy functionality.
+  @run main ContainerOrderFTPTest
+*/
+
+import java.awt.Frame;
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.ContainerOrderFocusTraversalPolicy;
+
+public class ContainerOrderFTPTest {
+
+    private final ContainerOrderFocusTraversalPolicy coftp;
+    private final Frame frame;
+    private final Button b1;
+    private final Button b2;
+    private final String expectedTraversal;
+
+    public ContainerOrderFTPTest() {
+        expectedTraversal = "B1B2F1";
+        b1 = new Button("B1");
+        b2 = new Button("B2");
+        frame = new Frame("F1");
+
+        frame.setLayout(new FlowLayout());
+        frame.setSize(200, 200);
+        coftp = new ContainerOrderFocusTraversalPolicy();
+        frame.setFocusTraversalPolicy(coftp);
+        frame.add(b1);
+        frame.add(b2);
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+        ContainerOrderFTPTest test = new ContainerOrderFTPTest();
+        test.performTest();
+        test.dispose();
+    }
+
+    public void performTest() {
+        int count = 0;
+        Component comp = coftp.getFirstComponent(frame);
+        String traversal = "";
+        do {
+            comp = coftp.getComponentAfter(frame, comp);
+            if (comp instanceof Button) {
+                traversal += ((Button)comp).getLabel();
+            } else if (comp instanceof Frame) {
+                traversal += ((Frame)comp).getTitle();
+            }
+            count++;
+        } while(count < 3);
+
+        if (!expectedTraversal.equals(traversal)) {
+            dispose();
+            throw new RuntimeException("Incorrect Traversal. Expected : "
+                + expectedTraversal + "Actual : " + traversal);
+        }
+    }
+
+    public void dispose() {
+        frame.dispose();
+    }
+}
--- a/jdk/test/java/awt/image/DrawImage/IncorrectClipSurface2SW.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/test/java/awt/image/DrawImage/IncorrectClipSurface2SW.java	Fri Mar 11 09:16:55 2016 -0800
@@ -42,11 +42,11 @@
 
 /**
  * @test
- * @bug 8041644
+ * @bug 8041644 8044788
  * @summary Tests drawing volatile image to BI using different clip.
  *          Results of the blit compatibleImage to BI used for comparison.
  * @author Sergey Bylokhov
- * @run main/othervm -Dsun.java2d.d3d=false IncorrectClipSurface2SW
+ * @run main/othervm IncorrectClipSurface2SW
  */
 public final class IncorrectClipSurface2SW {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/multiresolution/MenuMultiresolutionIconTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8150258
+ * @author a.stepanov
+ * @summary Check that correct resolution variants are chosen for menu icons
+ *          when multiresolution image is used for their construction.
+ *
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main/othervm -Dsun.java2d.uiScale=1 MenuMultiresolutionIconTest
+ * @run main/othervm -Dsun.java2d.uiScale=2 MenuMultiresolutionIconTest
+ */
+
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.*;
+import javax.swing.*;
+
+public class MenuMultiresolutionIconTest extends JPanel {
+
+    private final static int DELAY = 1000;
+    private final static int SZ = 50;
+    private final static String SCALE = "sun.java2d.uiScale";
+    private final static Color C1X = Color.RED, C2X = Color.BLUE;
+    private final ExtendedRobot r;
+
+    private static BufferedImage generateImage(int scale, Color c) {
+
+        int x = SZ * scale;
+        BufferedImage img = new BufferedImage(x, x, BufferedImage.TYPE_INT_RGB);
+        Graphics g = img.getGraphics();
+        g.setColor(c);
+        g.fillRect(0, 0, x, x);
+        return img;
+    }
+
+    private static BaseMultiResolutionImage createIcon() {
+
+        return new BaseMultiResolutionImage(new BufferedImage[] {
+            generateImage(1, C1X), generateImage(2, C2X)});
+    }
+
+    private JFrame     frame;
+    private JPopupMenu popup;
+    private JMenuItem  popupItem;
+    private JMenu      menu;
+
+    public MenuMultiresolutionIconTest() throws Exception {
+
+        r = new ExtendedRobot();
+        SwingUtilities.invokeAndWait(this::createUI);
+    }
+
+    private void createUI() {
+
+        ImageIcon ii = new ImageIcon(createIcon());
+
+        popup = new JPopupMenu();
+        popupItem = new JMenuItem("test", ii);
+        popup.add(popupItem);
+        popupItem.setHorizontalTextPosition(JMenuItem.RIGHT);
+        addMouseListener(new MousePopupListener());
+
+        frame = new JFrame();
+        JMenuBar menuBar = new JMenuBar();
+        menu = new JMenu("test");
+        menuBar.add(menu);
+        menu.add(new JMenuItem("test", ii));
+        menu.add(new JRadioButtonMenuItem("test", ii, true));
+        menu.add(new JCheckBoxMenuItem("test", ii, true));
+
+        frame.setJMenuBar(menuBar);
+        frame.setContentPane(this);
+        frame.setSize(300, 300);
+        frame.setVisible(true);
+    }
+
+    private class MousePopupListener extends MouseAdapter {
+
+        @Override
+        public void mousePressed(MouseEvent e)  { showPopup(e); }
+        @Override
+        public void mouseClicked(MouseEvent e)  { showPopup(e); }
+        @Override
+        public void mouseReleased(MouseEvent e) { showPopup(e); }
+
+        private void showPopup(MouseEvent e) {
+            if (e.isPopupTrigger()) {
+                popup.show(MenuMultiresolutionIconTest.this, e.getX(), e.getY());
+            }
+        }
+    }
+
+    private static boolean is2x() {
+
+        return GraphicsEnvironment.getLocalGraphicsEnvironment().
+            getDefaultScreenDevice().getDefaultConfiguration().
+            getDefaultTransform().getScaleX() > 1.001;
+    }
+
+    private boolean eqColors(Color c1, Color c2) {
+
+        int tol = 15;
+        return (
+            Math.abs(c2.getRed()   - c1.getRed()  ) < tol &&
+            Math.abs(c2.getGreen() - c1.getGreen()) < tol &&
+            Math.abs(c2.getBlue()  - c1.getBlue() ) < tol);
+    }
+
+    private void checkIconColor(Point p, String what) {
+
+        Color expected = is2x() ? C2X : C1X;
+        Color c = r.getPixelColor(p.x + SZ / 2, p.y + SZ / 2);
+        if (!eqColors(c, expected)) {
+            frame.dispose();
+            throw new RuntimeException("invalid " + what + "menu item icon " +
+                "color, expected: " + expected + ", got: " + c);
+        }
+        System.out.println(what + "item icon check passed");
+    }
+
+    private void doTest() {
+
+        r.waitForIdle(2 * DELAY);
+
+        Point p = getLocationOnScreen();
+        r.mouseMove(p.x + getWidth() / 4, p.y + getHeight() / 4);
+        r.waitForIdle(DELAY);
+        r.click(InputEvent.BUTTON3_DOWN_MASK);
+        r.waitForIdle(DELAY);
+        p = popupItem.getLocationOnScreen();
+        checkIconColor(p, "popup ");
+        r.waitForIdle(DELAY);
+
+        p = menu.getLocationOnScreen();
+        r.mouseMove(p.x + menu.getWidth() / 2, p.y + menu.getHeight() / 2);
+        r.waitForIdle(DELAY);
+        r.click();
+        p = menu.getItem(0).getLocationOnScreen();
+        checkIconColor(p, "");
+        r.waitForIdle(DELAY);
+
+        p = menu.getItem(1).getLocationOnScreen();
+        checkIconColor(p, "radiobutton ");
+        r.waitForIdle(DELAY);
+
+        p = menu.getItem(2).getLocationOnScreen();
+        checkIconColor(p, "checkbox ");
+        r.waitForIdle(DELAY);
+
+        frame.dispose();
+    }
+
+    public static void main(String s[]) throws Exception {
+
+        // TODO: remove is2x() after JDK-8150844 fix
+        if (is2x() == "2".equals(System.getProperty(SCALE))) {
+            (new MenuMultiresolutionIconTest()).doTest();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.html	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,41 @@
+<!--
+ Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<head>
+<title> MultiResolutionTrayIconTest </title>
+</head>
+<body>
+<applet code="MultiResolutionTrayIconTest.class" width=100 height=30></applet>
+
+To run test please push "Start" (if system tray is not supported, push "Pass").
+
+Two tray icons will appear (note: sometimes they can go to the tray icons pool).
+
+Please check if both of them have correct size and
+the same colouring (white rectagle in a blue mount). In this case please push "Pass".
+
+Otherwise (if the 2nd red-white small icon appears) please push "Fail".
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+  @test
+  @bug 8150176
+  @ignore 8150176
+  @summary Check if correct resolution variant is used for tray icon.
+  @author a.stepanov
+  @run applet/manual=yesno MultiResolutionTrayIconTest.html
+*/
+
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.*;
+
+
+public class MultiResolutionTrayIconTest extends Applet {
+
+    private SystemTray tray;
+    private TrayIcon   icon, iconMRI;
+
+    public void init() { this.setLayout(new BorderLayout()); }
+
+    public void start() {
+
+        boolean trayIsSupported = SystemTray.isSupported();
+        Button b = new Button("Start");
+        if (trayIsSupported) {
+
+            prepareIcons();
+            b.addActionListener(new ActionListener() {
+                @Override
+                public void actionPerformed(ActionEvent e) { doTest(); }
+            });
+        } else {
+             b.setLabel("not supported");
+             b.setEnabled(false);
+             System.out.println("system tray is not supported");
+        }
+        add(b, BorderLayout.CENTER);
+
+        validate();
+        setVisible(true);
+    }
+
+    private BufferedImage generateImage(int w, int h, Color c) {
+
+        BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+        Graphics g = img.getGraphics();
+        g.setColor(c);
+        g.fillRect(0, 0, w, h);
+        g.setColor(Color.WHITE);
+        int r = (Math.min(w, h) >= 8) ? 3 : 1;
+        g.fillRect(r, r, w - 2 * r, h - 2 * r);
+        return img;
+    }
+
+    private void prepareIcons() {
+
+        tray = SystemTray.getSystemTray();
+        Dimension d = tray.getTrayIconSize();
+        int w = d.width, h = d.height;
+
+        BufferedImage img = generateImage(w, h, Color.BLUE);
+        // use wrong icon size for "nok"
+        BufferedImage nok = generateImage(w / 2 + 2, h / 2 + 2, Color.RED);
+        BaseMultiResolutionImage mri =
+            new BaseMultiResolutionImage(new BufferedImage[] {nok, img});
+        icon    = new TrayIcon(img);
+        iconMRI = new TrayIcon(mri);
+    }
+
+    private void doTest() {
+
+        if (tray.getTrayIcons().length > 0) { return; } // icons were added already
+        try {
+            tray.add(icon);
+            tray.add(iconMRI);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public void stop() {
+
+        // check for null, just in case
+        if (tray != null) {
+            tray.remove(icon);
+            tray.remove(iconMRI);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/MultiMonPrintDlgTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.KeyboardFocusManager;
+import java.awt.Window;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
+/**
+ * @test
+ * @bug 8138749
+ * @summary PrinterJob.printDialog() does not support multi-mon,
+ *           always displayed on primary
+ * @run main/manual MultiMonPrintDlgTest
+ */
+public class MultiMonPrintDlgTest implements ActionListener {
+
+    Frame primaryFrame = null;
+    Frame secFrame = null;
+    GraphicsDevice gd[] = GraphicsEnvironment.getLocalGraphicsEnvironment().
+                            getScreenDevices();
+
+    public MultiMonPrintDlgTest() throws Exception {
+        if (gd.length <= 1) {
+            System.out.println("This test should be run only on dual-monitor systems. Aborted!!");
+            return;
+        }
+
+        String[] instructions =
+            {
+             " This test should be running on a dual-monitor setup.",
+             "A frame will be created on each of the 2 monitor. ",
+             "Click the Print button on the frame displayed in the non-default monitor.",
+             "Please verify that page dialog followed by print dialog ",
+             " is displayed in the same screen",
+             "where the frame is located ie, in the non-default monitor.",
+            };
+
+        SwingUtilities.invokeAndWait(() -> {
+            JOptionPane.showMessageDialog(
+                    (Component) null,
+                    instructions,
+                    "information", JOptionPane.INFORMATION_MESSAGE);
+        });
+        GraphicsDevice defDev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+        int x = 0;
+        Frame f = null;
+        for (x = 0; x < gd.length; x ++) {
+            if (gd[x] != defDev) {
+                secFrame = new Frame("Screen " + x + " - secondary", gd[x].getDefaultConfiguration());
+                f = secFrame;
+            } else {
+                primaryFrame = new Frame("Screen " + x + " - primary", gd[x].getDefaultConfiguration());
+                f = primaryFrame;
+            }
+            Button b = new Button("Print");
+            b.addActionListener(this);
+            f.add("South", b);
+            f.addWindowListener (new WindowAdapter() {
+                public void windowClosing(WindowEvent we) {
+                    ((Window) we.getSource()).dispose();
+                }
+            });
+            f.setSize(200, 200);
+            f.setVisible(true);
+        }
+    }
+
+    public void actionPerformed (ActionEvent ae) {
+        try {
+            javax.print.attribute.PrintRequestAttributeSet prSet =
+                  new javax.print.attribute.HashPrintRequestAttributeSet();
+            java.awt.print.PrinterJob.getPrinterJob().pageDialog(prSet);
+            Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+            int dialogButton = JOptionPane.showConfirmDialog (w,
+                            "Did the pageDialog shown in non-default monitor?",
+                            null, JOptionPane.YES_NO_OPTION);
+            if(dialogButton == JOptionPane.NO_OPTION) {
+                throw new RuntimeException("PageDialog is shown in wrong monitor");
+            }
+            java.awt.print.PrinterJob.getPrinterJob().printDialog(prSet);
+            dialogButton = JOptionPane.showConfirmDialog (w,
+                            "Did the printDialog shown in non-default monitor?",
+                            null, JOptionPane.YES_NO_OPTION);
+            if(dialogButton == JOptionPane.NO_OPTION) {
+                throw new RuntimeException("PrintDialog is shown in wrong monitor");
+            }
+        } finally {
+            primaryFrame.dispose();
+            secFrame.dispose();
+        }
+    }
+
+    public static void main (String args[]) throws Exception {
+        MultiMonPrintDlgTest test = new MultiMonPrintDlgTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.UnsupportedAudioFileException;
+import javax.sound.sampled.spi.AudioFileWriter;
+import javax.sound.sampled.spi.FormatConversionProvider;
+
+import static java.util.ServiceLoader.load;
+import static javax.sound.sampled.AudioFileFormat.Type.AIFC;
+import static javax.sound.sampled.AudioFileFormat.Type.AIFF;
+import static javax.sound.sampled.AudioFileFormat.Type.AU;
+import static javax.sound.sampled.AudioFileFormat.Type.SND;
+import static javax.sound.sampled.AudioFileFormat.Type.WAVE;
+import static javax.sound.sampled.AudioSystem.NOT_SPECIFIED;
+
+/**
+ * @test
+ * @bug 8038139
+ */
+public final class FrameLengthAfterConversion {
+
+    /**
+     * We will try to use all formats, in this case all our providers will be
+     * covered by supported/unsupported formats.
+     */
+    private static final List<AudioFormat> formats = new ArrayList<>(23000);
+
+    private static final AudioFormat.Encoding[] encodings = {
+            AudioFormat.Encoding.ALAW, AudioFormat.Encoding.ULAW,
+            AudioFormat.Encoding.PCM_SIGNED, AudioFormat.Encoding.PCM_UNSIGNED,
+            AudioFormat.Encoding.PCM_FLOAT, new AudioFormat.Encoding("Test")
+    };
+
+    private static final int[] sampleBits = {
+            1, 4, 8, 11, 16, 20, 24, 32
+    };
+
+    private static final int[] channels = {
+            1, 2, 3, 4, 5
+    };
+
+    private static final AudioFileFormat.Type[] types = {
+            WAVE, AU, AIFF, AIFC, SND,
+            new AudioFileFormat.Type("TestName", "TestExt")
+    };
+
+    private static final int FRAME_LENGTH = 10;
+
+    static {
+        for (final int sampleSize : sampleBits) {
+            for (final int channel : channels) {
+                for (final AudioFormat.Encoding enc : encodings) {
+                    final int frameSize = ((sampleSize + 7) / 8) * channel;
+                    formats.add(new AudioFormat(enc, 44100, sampleSize, channel,
+                                                frameSize, 44100, true));
+                    formats.add(new AudioFormat(enc, 44100, sampleSize, channel,
+                                                frameSize, 44100, false));
+                }
+            }
+        }
+    }
+
+    public static void main(final String[] args) {
+        for (final FormatConversionProvider fcp : load(
+                FormatConversionProvider.class)) {
+            System.out.println("fcp = " + fcp);
+            for (final AudioFormat from : formats) {
+                for (final AudioFormat to : formats) {
+                    testAfterConversion(fcp, to, getStream(from, true));
+                }
+            }
+        }
+
+        for (final AudioFileWriter afw : load(AudioFileWriter.class)) {
+            System.out.println("afw = " + afw);
+            for (final AudioFileFormat.Type type : types) {
+                for (final AudioFormat from : formats) {
+                    testAfterSaveToStream(afw, type, getStream(from, true));
+                }
+            }
+        }
+
+        for (final AudioFileWriter afw : load(AudioFileWriter.class)) {
+            System.out.println("afw = " + afw);
+            for (final AudioFileFormat.Type type : types) {
+                for (final AudioFormat from : formats) {
+                    testAfterSaveToFile(afw, type, getStream(from, true));
+                }
+            }
+        }
+
+        for (final AudioFileWriter afw : load(AudioFileWriter.class)) {
+            System.out.println("afw = " + afw);
+            for (final AudioFileFormat.Type type : types) {
+                for (final AudioFormat from : formats) {
+                    testAfterSaveToFile(afw, type, getStream(from, false));
+                }
+            }
+        }
+    }
+
+    /**
+     * Verifies the frame length after the stream was saved/read to/from
+     * stream.
+     */
+    private static void testAfterSaveToStream(final AudioFileWriter afw,
+                                              final AudioFileFormat.Type type,
+                                              final AudioInputStream ais) {
+        try {
+            final ByteArrayOutputStream out = new ByteArrayOutputStream();
+            afw.write(ais, type, out);
+            final InputStream input = new ByteArrayInputStream(
+                    out.toByteArray());
+            validate(AudioSystem.getAudioInputStream(input).getFrameLength());
+        } catch (IllegalArgumentException | UnsupportedAudioFileException
+                | IOException ignored) {
+        }
+    }
+
+    /**
+     * Verifies the frame length after the stream was saved/read to/from file.
+     */
+    private static void testAfterSaveToFile(final AudioFileWriter afw,
+                                            final AudioFileFormat.Type type,
+                                            AudioInputStream ais) {
+        try {
+            final File temp = File.createTempFile("sound", ".tmp");
+            temp.deleteOnExit();
+            afw.write(ais, type, temp);
+            ais = AudioSystem.getAudioInputStream(temp);
+            final long frameLength = ais.getFrameLength();
+            ais.close();
+            temp.delete();
+            validate(frameLength);
+        } catch (IllegalArgumentException | UnsupportedAudioFileException
+                | IOException ignored) {
+        }
+    }
+
+    /**
+     * Verifies the frame length after the stream was converted to other
+     * stream.
+     *
+     * @see FormatConversionProvider#getAudioInputStream(AudioFormat,
+     * AudioInputStream)
+     */
+    private static void testAfterConversion(final FormatConversionProvider fcp,
+                                            final AudioFormat to,
+                                            final AudioInputStream ais) {
+        if (fcp.isConversionSupported(to, ais.getFormat())) {
+            validate(fcp.getAudioInputStream(to, ais).getFrameLength());
+        }
+    }
+
+    /**
+     * Throws an exception if the frameLength is specified and is not equal to
+     * the gold value.
+     */
+    private static void validate(final long frameLength) {
+        if (frameLength != FRAME_LENGTH) {
+            System.err.println("Expected: " + FRAME_LENGTH);
+            System.err.println("Actual: " + frameLength);
+            throw new RuntimeException();
+        }
+    }
+
+    private static AudioInputStream getStream(final AudioFormat format,
+                                              final boolean frameLength) {
+        final int dataSize = FRAME_LENGTH * format.getFrameSize();
+        final InputStream in = new ByteArrayInputStream(new byte[dataSize]);
+        if (frameLength) {
+            return new AudioInputStream(in, format, FRAME_LENGTH);
+        } else {
+            return new AudioInputStream(in, format, NOT_SPECIFIED);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/ShellFolderQueries/ShellFolderQueriesTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8081722
+ * @summary Provide public API for file hierarchy provided by
+ * sun.awt.shell.ShellFolder
+ * @author Semyon Sadetsky
+ * @run main ShellFolderQueriesTest
+ */
+
+import sun.awt.OSInfo;
+
+import javax.swing.filechooser.FileSystemView;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public class ShellFolderQueriesTest {
+    static final String HOME = System.getProperty("user.home");
+    static final FileSystemView fsv = FileSystemView.getFileSystemView();
+
+
+    static String scriptBeg =
+            "set WshShell = WScript.CreateObject(\"WScript.Shell\")\n" +
+            "set oShellLink = WshShell.CreateShortcut(\"shortcut.lnk\")\n" +
+            "oShellLink.TargetPath = \"";
+    static String scriptEnd = "\"\noShellLink.WindowStyle = 1\noShellLink.Save";
+
+    public static void main(String[] args) throws Exception {
+        if(OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
+            testGet();
+            testLink();
+        } else {
+            testGet();
+        }
+        System.out.println("ok");
+    }
+
+    private static void testLink() throws IOException, InterruptedException {
+        // Create and execute VBS script to create a link
+        File file = createVbsScript(scriptBeg + HOME + scriptEnd);
+        Runtime.getRuntime().exec("cscript " + file.getName(), null,
+                file.getParentFile()).waitFor();
+        file.delete();
+
+        File link = new File(file.getParentFile(), "shortcut.lnk");
+        if (!fsv.isLink(link)) {
+            link.delete();
+            throw new RuntimeException("Link is not detected");
+        }
+
+        File location = fsv.getLinkLocation(link);
+        if (!location.getAbsolutePath().equals(HOME)) {
+            link.delete();
+            throw new RuntimeException("Link location " + location +
+                    " is wrong");
+        }
+        link.delete();
+
+
+        link = File.createTempFile("test", ".tst");
+
+        if (fsv.isLink(link)) {
+            link.delete();
+            throw new RuntimeException("File is not a link");
+        }
+
+        try {
+            location = fsv.getLinkLocation(link);
+            if (location != null) {
+                link.delete();
+                throw new RuntimeException("Not a link, should return null");
+            }
+        }
+        catch (FileNotFoundException e) {
+        }
+        link.delete();
+    }
+
+    private static File createVbsScript(String script) throws IOException {
+        File file = File.createTempFile("test", ".vbs");
+        file.deleteOnExit();
+        FileOutputStream fos = new FileOutputStream(file);
+        fos.write(script.getBytes());
+        fos.close();
+        return file;
+    }
+
+    private static void testGet() {
+        File[] files = fsv.getChooserComboBoxFiles();
+        for (File file : files) {
+            if (fsv.isLink(file)) {
+                throw new RuntimeException(
+                        "Link shouldn't be in FileChooser combobox, "
+                                + file.getPath());
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8146321
+ * @summary verifies JInternalFrame Icon and ImageIcon
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main JInternalFrameIconTest
+ */
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.image.BufferedImage;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+public class JInternalFrameIconTest {
+
+    private static JFrame frame;
+    private static JDesktopPane desktopPane;
+    private static JInternalFrame internalFrame;
+    private static ImageIcon titleImageIcon;
+    private static Icon titleIcon;
+    private static BufferedImage imageIconImage;
+    private static BufferedImage iconImage;
+
+    private static Robot robot;
+
+    public static void main(String[] args) throws Exception {
+        robot = new Robot();
+        robot.delay(2000);
+        UIManager.LookAndFeelInfo[] lookAndFeelArray
+                = UIManager.getInstalledLookAndFeels();
+        for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
+            executeCase(lookAndFeelItem.getClassName());
+        }
+
+    }
+
+    private static void executeCase(String lookAndFeelString) throws Exception {
+        if (tryLookAndFeel(lookAndFeelString)) {
+            createImageIconUI(lookAndFeelString);
+            robot.delay(1000);
+            getImageIconBufferedImage();
+            robot.waitForIdle();
+            cleanUp();
+            robot.waitForIdle();
+
+            createIconUI(lookAndFeelString);
+            robot.delay(1000);
+            getIconBufferedImage();
+            robot.waitForIdle();
+            cleanUp();
+            robot.waitForIdle();
+            testIfSame();
+            robot.waitForIdle();
+        }
+
+    }
+
+    private static void createImageIconUI(final String lookAndFeelString)
+            throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                desktopPane = new JDesktopPane();
+                internalFrame = new JInternalFrame();
+                frame = new JFrame();
+                internalFrame.setTitle(lookAndFeelString);
+                titleImageIcon = new ImageIcon() {
+                    @Override
+                    public int getIconWidth() {
+                        return 16;
+                    }
+
+                    @Override
+                    public int getIconHeight() {
+                        return 16;
+                    }
+
+                    @Override
+                    public void paintIcon(
+                            Component c, Graphics g, int x, int y) {
+                        g.setColor(java.awt.Color.black);
+                        g.fillRect(x, y, 16, 16);
+                    }
+                };
+                internalFrame.setFrameIcon(titleImageIcon);
+                internalFrame.setSize(500, 200);
+                internalFrame.setVisible(true);
+                desktopPane.add(internalFrame);
+
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.getContentPane().setLayout(new BorderLayout());
+                frame.getContentPane().add(desktopPane, "Center");
+                frame.setSize(500, 500);
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+                frame.toFront();
+            }
+        });
+    }
+
+    private static void createIconUI(final String lookAndFeelString)
+            throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                desktopPane = new JDesktopPane();
+                internalFrame = new JInternalFrame();
+                frame = new JFrame();
+                internalFrame.setTitle(lookAndFeelString);
+                titleIcon = new Icon() {
+                    @Override
+                    public int getIconWidth() {
+                        return 16;
+                    }
+
+                    @Override
+                    public int getIconHeight() {
+                        return 16;
+                    }
+
+                    @Override
+                    public void paintIcon(
+                            Component c, Graphics g, int x, int y) {
+                        g.setColor(java.awt.Color.black);
+                        g.fillRect(x, y, 16, 16);
+                    }
+                };
+                internalFrame.setFrameIcon(titleIcon);
+                internalFrame.setSize(500, 200);
+                internalFrame.setVisible(true);
+                desktopPane.add(internalFrame);
+
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.getContentPane().setLayout(new BorderLayout());
+                frame.getContentPane().add(desktopPane, "Center");
+                frame.setSize(500, 500);
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+                frame.toFront();
+            }
+        });
+    }
+
+    private static void getImageIconBufferedImage() throws Exception {
+        Point point = internalFrame.getLocationOnScreen();
+        Rectangle rect = internalFrame.getBounds();
+        Rectangle captureRect = new Rectangle(
+                point.x + internalFrame.getInsets().left,
+                point.y,
+                rect.width,
+                internalFrame.getInsets().top);
+        imageIconImage
+                = robot.createScreenCapture(captureRect);
+    }
+
+    private static void getIconBufferedImage() throws Exception {
+        Point point = internalFrame.getLocationOnScreen();
+        Rectangle rect = internalFrame.getBounds();
+        Rectangle captureRect = new Rectangle(
+                point.x + internalFrame.getInsets().left,
+                point.y,
+                rect.width,
+                internalFrame.getInsets().top);
+        iconImage
+                = robot.createScreenCapture(captureRect);
+    }
+
+    private static void testIfSame() throws Exception {
+        if (!bufferedImagesEqual(imageIconImage, iconImage)) {
+            System.err.println("ERROR: icon and imageIcon not same.");
+        } else {
+            System.out.println("SUCCESS: icon and imageIcon same.");
+        }
+    }
+
+    private static boolean bufferedImagesEqual(
+            BufferedImage bufferedImage1, BufferedImage bufferedImage2) {
+        boolean flag = true;
+
+        if (bufferedImage1.getWidth() == bufferedImage2.getWidth()
+                && bufferedImage1.getHeight() == bufferedImage2.getHeight()) {
+            final int colorTolerance = 25;
+            final int mismatchTolerance = (int) (0.1
+                    * bufferedImage1.getWidth() * bufferedImage1.getHeight());
+            int mismatchCounter = 0;
+            for (int x = 0; x < bufferedImage1.getWidth(); x++) {
+                for (int y = 0; y < bufferedImage1.getHeight(); y++) {
+
+                    int color1 = bufferedImage1.getRGB(x, y);
+                    int red1 = (color1 >> 16) & 0x000000FF;
+                    int green1 = (color1 >> 8) & 0x000000FF;
+                    int blue1 = (color1) & 0x000000FF;
+
+                    int color2 = bufferedImage2.getRGB(x, y);
+                    int red2 = (color2 >> 16) & 0x000000FF;
+                    int green2 = (color2 >> 8) & 0x000000FF;
+                    int blue2 = (color2) & 0x000000FF;
+                    if (red1 != red2 || green1 != green2 || blue1 != blue2) {
+                        ++mismatchCounter;
+                        if ((Math.abs(red1 - red2) > colorTolerance)
+                                || (Math.abs(green1 - green2) > colorTolerance)
+                                || (Math.abs(blue1 - blue2) > colorTolerance)) {
+
+                            flag = false;
+                        }
+                    }
+                }
+            }
+            if (mismatchCounter > mismatchTolerance) {
+                flag = false;
+            }
+        } else {
+            System.err.println("ERROR: size is different");
+            flag = false;
+        }
+        return flag;
+    }
+
+    private static void cleanUp() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame.dispose();
+            }
+        });
+    }
+
+    private static boolean tryLookAndFeel(String lookAndFeelString)
+            throws Exception {
+        try {
+            UIManager.setLookAndFeel(
+                    lookAndFeelString);
+
+        } catch (UnsupportedLookAndFeelException
+                | ClassNotFoundException
+                | InstantiationException
+                | IllegalAccessException e) {
+            return false;
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/NormalBoundsTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ @test
+ @bug 7126823
+ @summary Verify NormalBounds upon iconify/deiconify sequence
+ @run main NormalBoundsTest
+ */
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.beans.PropertyVetoException;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.WindowConstants;
+
+public class NormalBoundsTest {
+
+    private static JFrame mainFrame;
+    private static JInternalFrame internalFrame;
+    private static Rectangle bounds;
+
+    private static void createUI(String lookAndFeelString) {
+        internalFrame = new JInternalFrame("Internal", true, true, true, true);
+        internalFrame.setDefaultCloseOperation(
+                WindowConstants.DO_NOTHING_ON_CLOSE);
+        internalFrame.setSize(200, 200);
+
+        JDesktopPane desktopPane = new JDesktopPane();
+        desktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
+        desktopPane.add(internalFrame);
+
+        mainFrame = new JFrame(lookAndFeelString);
+        mainFrame.setSize(640, 480);
+        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        mainFrame.setContentPane(desktopPane);
+
+        mainFrame.setVisible(true);
+        internalFrame.setVisible(true);
+
+    }
+
+    private static int signWOZero(int i) {
+        return (i > 0) ? 1 : -1;
+    }
+
+    private static void mouseMove(Robot robot, Point startPt, Point endPt) {
+        int dx = endPt.x - startPt.x;
+        int dy = endPt.y - startPt.y;
+
+        int ax = Math.abs(dx) * 2;
+        int ay = Math.abs(dy) * 2;
+
+        int sx = signWOZero(dx);
+        int sy = signWOZero(dy);
+
+        int x = startPt.x;
+        int y = startPt.y;
+
+        int d = 0;
+
+        if (ax > ay) {
+            d = ay - ax / 2;
+            while (true) {
+                robot.mouseMove(x, y);
+                robot.delay(50);
+
+                if (x == endPt.x) {
+                    return;
+                }
+                if (d >= 0) {
+                    y = y + sy;
+                    d = d - ax;
+                }
+                x = x + sx;
+                d = d + ay;
+            }
+        } else {
+            d = ax - ay / 2;
+            while (true) {
+                robot.mouseMove(x, y);
+                robot.delay(50);
+
+                if (y == endPt.y) {
+                    return;
+                }
+                if (d >= 0) {
+                    x = x + sx;
+                    d = d - ay;
+                }
+                y = y + sy;
+                d = d + ax;
+            }
+        }
+    }
+
+    private static void drag(Robot r, Point startPt, Point endPt, int button) {
+        if (!(button == InputEvent.BUTTON1_MASK
+                || button == InputEvent.BUTTON2_MASK
+                || button == InputEvent.BUTTON3_MASK)) {
+            throw new IllegalArgumentException("invalid mouse button");
+        }
+
+        r.mouseMove(startPt.x, startPt.y);
+        r.mousePress(button);
+        try {
+            mouseMove(r, startPt, endPt);
+        } finally {
+            r.mouseRelease(button);
+        }
+    }
+
+    private static boolean tryLookAndFeel(String lookAndFeelString) {
+        try {
+            UIManager.setLookAndFeel(lookAndFeelString);
+            return true;
+        } catch (UnsupportedLookAndFeelException | ClassNotFoundException |
+                InstantiationException | IllegalAccessException e) {
+            return false;
+        }
+    }
+
+    public static void executeTest(Robot robot) throws Exception {
+
+        // Iconize JInternalFrame
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    internalFrame.setIcon(true);
+                } catch (PropertyVetoException ex) {
+                    mainFrame.dispose();
+                    throw new RuntimeException("Iconize InternalFrame Failed");
+                }
+            }
+        });
+        robot.waitForIdle();
+
+        // Deiconize JInternalFrame
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    internalFrame.setIcon(false);
+                } catch (PropertyVetoException ex) {
+                    mainFrame.dispose();
+                    throw new RuntimeException("Deiconize InternalFrame"
+                            + " Failed");
+                }
+            }
+        });
+        robot.waitForIdle();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                Point loc = internalFrame.getLocationOnScreen();
+                // Drag Frame
+                drag(robot,
+                        new Point((int) loc.x + 80, (int) loc.y + 12),
+                        new Point((int) loc.x + 100, (int) loc.y + 40),
+                        InputEvent.BUTTON1_MASK);
+            }
+        });
+        robot.waitForIdle();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                bounds = internalFrame.getBounds();
+                if (!internalFrame.getNormalBounds().equals(bounds)) {
+                    mainFrame.dispose();
+                    throw new RuntimeException("Invalid NormalBounds");
+                }
+            }
+        });
+        robot.waitForIdle();
+
+        // Regression Test Bug ID: 4424247
+        // Maximize JInternalFrame
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    internalFrame.setMaximum(true);
+                } catch (PropertyVetoException ex) {
+                    mainFrame.dispose();
+                    throw new RuntimeException("Maximize InternalFrame Failed");
+                }
+            }
+        });
+        robot.waitForIdle();
+
+        // Iconize JInternalFrame
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    internalFrame.setIcon(true);
+                } catch (PropertyVetoException ex) {
+                    mainFrame.dispose();
+                    throw new RuntimeException("Iconize InternalFrame Failed");
+                }
+            }
+        });
+        robot.waitForIdle();
+
+        // DeIconize JInternalFrame
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    internalFrame.setIcon(false);
+                } catch (PropertyVetoException ex) {
+                    mainFrame.dispose();
+                    throw new RuntimeException("DeIcoize InternalFrame "
+                            + " Failed");
+                }
+            }
+        });
+        robot.waitForIdle();
+
+        // Restore/Undo Maximize JInternalFrame
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    internalFrame.setMaximum(false);
+                } catch (PropertyVetoException ex) {
+                    mainFrame.dispose();
+                    throw new RuntimeException("Restore InternalFrame "
+                            + " Failed");
+                }
+            }
+        });
+        robot.waitForIdle();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                if (!internalFrame.getBounds().equals(bounds)) {
+                    mainFrame.dispose();
+                    throw new RuntimeException("Regression Test Failed");
+                }
+            }
+        });
+        robot.waitForIdle();
+
+        mainFrame.dispose();
+    }
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        UIManager.LookAndFeelInfo[] lookAndFeelArray
+                = UIManager.getInstalledLookAndFeels();
+        for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
+            String lookAndFeelString = lookAndFeelItem.getClassName();
+            if (tryLookAndFeel(lookAndFeelString)) {
+                // create UI
+                SwingUtilities.invokeAndWait(new Runnable() {
+                    @Override
+                    public void run() {
+                        createUI(lookAndFeelString);
+                    }
+                });
+
+                robot.waitForIdle();
+                executeTest(robot);
+            } else {
+                throw new RuntimeException("Setting Look and Feel Failed");
+            }
+        }
+
+    }
+}
--- a/jdk/test/javax/swing/JScrollPane/8033000/bug8033000.java	Fri Mar 11 18:35:26 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-import java.awt.BorderLayout;
-import java.awt.Point;
-import java.awt.Robot;
-import java.awt.event.KeyEvent;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-import jdk.testlibrary.OSInfo;
-
-/**
- * @test
- * @bug 8033000
- * @author Alexander Scherbatiy
- * @summary No Horizontal Mouse Wheel Support In BasicScrollPaneUI
- * @library ../../../../lib/testlibrary
- * @build jdk.testlibrary.OSInfo
- * @run main bug8033000
- */
-public class bug8033000 {
-
-    private static JScrollPane scrollPane;
-    private static JTextArea textArea;
-    private static Point point;
-    private static final int delta;
-
-    static {
-        delta = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ? -30 : 30;
-    }
-
-    public static void main(String[] args) throws Exception {
-
-        Robot robot = new Robot();
-        robot.setAutoDelay(50);
-
-        SwingUtilities.invokeAndWait(bug8033000::createAndShowGUI);
-        robot.waitForIdle();
-
-        SwingUtilities.invokeAndWait(() -> {
-            Point locationOnScreen = scrollPane.getLocationOnScreen();
-            point = new Point(
-                    locationOnScreen.x + scrollPane.getWidth() / 2,
-                    locationOnScreen.y + scrollPane.getHeight() / 2);
-        });
-
-        robot.mouseMove(point.x, point.y);
-        robot.waitForIdle();
-
-        // vertical scroll bar is enabled
-        initScrollPane(true, false);
-        robot.waitForIdle();
-        robot.mouseWheel(delta);
-        robot.waitForIdle();
-        checkScrollPane(true);
-
-        // vertical scroll bar is enabled + shift
-        initScrollPane(true, false);
-        robot.waitForIdle();
-        robot.keyPress(KeyEvent.VK_SHIFT);
-        robot.mouseWheel(delta);
-        robot.keyRelease(KeyEvent.VK_SHIFT);
-        robot.waitForIdle();
-        checkScrollPane(true);
-
-        // horizontal scroll bar is enabled
-        initScrollPane(false, true);
-        robot.waitForIdle();
-        robot.mouseWheel(delta);
-        robot.waitForIdle();
-        checkScrollPane(false);
-
-        // horizontal scroll bar is enabled + shift
-        initScrollPane(false, true);
-        robot.waitForIdle();
-        robot.keyPress(KeyEvent.VK_SHIFT);
-        robot.mouseWheel(delta);
-        robot.keyRelease(KeyEvent.VK_SHIFT);
-        robot.waitForIdle();
-        checkScrollPane(false);
-
-        // both scroll bars are enabled
-        initScrollPane(true, true);
-        robot.waitForIdle();
-        robot.mouseWheel(delta);
-        robot.waitForIdle();
-        checkScrollPane(true);
-
-        // both scroll bars are enabled + shift
-        initScrollPane(true, true);
-        robot.waitForIdle();
-        robot.keyPress(KeyEvent.VK_SHIFT);
-        robot.mouseWheel(delta);
-        robot.keyRelease(KeyEvent.VK_SHIFT);
-        robot.waitForIdle();
-        checkScrollPane(false);
-    }
-
-    static void initScrollPane(boolean vVisible, boolean hVisible) throws Exception {
-        SwingUtilities.invokeAndWait(() -> {
-            scrollPane.getVerticalScrollBar().setValue(0);
-            scrollPane.getHorizontalScrollBar().setValue(0);
-
-            textArea.setRows(vVisible ? 100 : 1);
-            textArea.setColumns(hVisible ? 100 : 1);
-            scrollPane.getVerticalScrollBar().setVisible(vVisible);
-            scrollPane.getHorizontalScrollBar().setVisible(hVisible);
-        });
-    }
-
-    static void checkScrollPane(boolean verticalScrolled) throws Exception {
-        SwingUtilities.invokeAndWait(() -> {
-
-            if (verticalScrolled) {
-                if (scrollPane.getVerticalScrollBar().getValue() == 0
-                        || scrollPane.getHorizontalScrollBar().getValue() != 0) {
-                    throw new RuntimeException("Wrong vertical scrolling!");
-                }
-            } else {
-                if (scrollPane.getVerticalScrollBar().getValue() != 0
-                        || scrollPane.getHorizontalScrollBar().getValue() == 0) {
-                    throw new RuntimeException("Wrong horizontal scrolling!");
-                }
-            }
-        });
-    }
-
-    static void createAndShowGUI() {
-        JFrame frame = new JFrame();
-        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        frame.setSize(300, 300);
-        textArea = new JTextArea("Hello World!");
-        scrollPane = new JScrollPane(textArea);
-        JPanel panel = new JPanel(new BorderLayout());
-        panel.add(scrollPane, BorderLayout.CENTER);
-        frame.getContentPane().add(panel);
-        frame.setVisible(true);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JScrollPane/HorizontalMouseWheelOnShiftPressed/HorizontalMouseWheelOnShiftPressed.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,181 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+import jdk.testlibrary.OSInfo;
+
+/**
+ * @test
+ * @bug 8033000 8147994
+ * @author Alexander Scherbatiy
+ * @summary No Horizontal Mouse Wheel Support In BasicScrollPaneUI
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
+ * @run main HorizontalMouseWheelOnShiftPressed
+ */
+public class HorizontalMouseWheelOnShiftPressed {
+
+    private static JScrollPane scrollPane;
+    private static JTextArea textArea;
+    private static Point point;
+    private static final int delta;
+    private static JFrame frame;
+
+    static {
+        delta = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ? -30 : 30;
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(
+                HorizontalMouseWheelOnShiftPressed::createAndShowGUI);
+        robot.waitForIdle();
+        try {
+            test(robot);
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    private static void test(Robot robot) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            Point locationOnScreen = scrollPane.getLocationOnScreen();
+            point = new Point(
+                    locationOnScreen.x + scrollPane.getWidth() / 2,
+                    locationOnScreen.y + scrollPane.getHeight() / 2);
+        });
+
+        robot.mouseMove(point.x, point.y);
+        robot.waitForIdle();
+
+        // vertical scroll bar is enabled
+        initScrollPane(true, false);
+        robot.waitForIdle();
+        robot.mouseWheel(delta);
+        robot.waitForIdle();
+        checkScrollPane(true, false);
+
+        // vertical scroll bar is enabled + shift
+        initScrollPane(true, false);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_SHIFT);
+        robot.mouseWheel(delta);
+        robot.keyRelease(KeyEvent.VK_SHIFT);
+        robot.waitForIdle();
+        checkScrollPane(false, false);
+
+        // horizontal scroll bar is enabled
+        initScrollPane(false, true);
+        robot.waitForIdle();
+        robot.mouseWheel(delta);
+        robot.waitForIdle();
+        checkScrollPane(false, true);
+
+        // horizontal scroll bar is enabled + shift
+        initScrollPane(false, true);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_SHIFT);
+        robot.mouseWheel(delta);
+        robot.keyRelease(KeyEvent.VK_SHIFT);
+        robot.waitForIdle();
+        checkScrollPane(false, true);
+
+        // both scroll bars are enabled
+        initScrollPane(true, true);
+        robot.waitForIdle();
+        robot.mouseWheel(delta);
+        robot.waitForIdle();
+        checkScrollPane(true, false);
+
+        // both scroll bars are enabled + shift
+        initScrollPane(true, true);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_SHIFT);
+        robot.mouseWheel(delta);
+        robot.keyRelease(KeyEvent.VK_SHIFT);
+        robot.waitForIdle();
+        checkScrollPane(false, true);
+    }
+
+    static void initScrollPane(boolean vVisible, boolean hVisible) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            scrollPane.getVerticalScrollBar().setValue(0);
+            scrollPane.getHorizontalScrollBar().setValue(0);
+
+            textArea.setRows(vVisible ? 100 : 1);
+            textArea.setColumns(hVisible ? 100 : 1);
+            scrollPane.getVerticalScrollBar().setVisible(vVisible);
+            scrollPane.getHorizontalScrollBar().setVisible(hVisible);
+        });
+    }
+
+    static void checkScrollPane(boolean verticalScrolled,
+                                boolean horizontalScrolled) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+
+            if (verticalScrolled) {
+                if (scrollPane.getVerticalScrollBar().getValue() == 0) {
+                    throw new RuntimeException("Wrong vertical scrolling!");
+                }
+            } else{
+                if (scrollPane.getVerticalScrollBar().getValue() != 0) {
+                    throw new RuntimeException("Wrong vertical scrolling!");
+                }
+            }
+            if (horizontalScrolled) {
+                if (scrollPane.getHorizontalScrollBar().getValue() == 0) {
+                    throw new RuntimeException("Wrong horizontal scrolling!");
+                }
+            } else {
+                if (scrollPane.getHorizontalScrollBar().getValue() != 0) {
+                    throw new RuntimeException("Wrong horizontal scrolling!");
+                }
+            }
+        });
+    }
+
+    static void createAndShowGUI() {
+        frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(300, 300);
+        frame.setLocationRelativeTo(null);
+        textArea = new JTextArea("Hello World!");
+        scrollPane = new JScrollPane(textArea);
+        JPanel panel = new JPanel(new BorderLayout());
+        panel.add(scrollPane, BorderLayout.CENTER);
+        frame.getContentPane().add(panel);
+        frame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTableHeader/8020039/TableHeaderRendererExceptionTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.UIManager;
+import javax.swing.table.JTableHeader;
+
+/**
+ * @test
+ * @summary Tests whether getTableCellRendererComponent() method handles
+ *          null table parameter
+ * @bug 8020039
+ * @run main TableHeaderRendererExceptionTest
+ */
+public class TableHeaderRendererExceptionTest {
+
+    public static void main(String[] args) throws Throwable {
+        //Execute test for all supported look and feels
+        UIManager.LookAndFeelInfo[] lookAndFeelArray
+                = UIManager.getInstalledLookAndFeels();
+
+        for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
+            String lookAndFeelString = lookAndFeelItem.getClassName();
+
+            UIManager.setLookAndFeel(lookAndFeelString);
+
+            // Test getTableCellRendererComponent method by passing null table
+            JTableHeader header = new JTableHeader();
+
+            header.getDefaultRenderer().getTableCellRendererComponent(null,
+                    " test ", true, true, -1, 0);
+        }
+    }
+}
--- a/jdk/test/javax/swing/plaf/gtk/crash/RenderBadPictureCrash.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/test/javax/swing/plaf/gtk/crash/RenderBadPictureCrash.java	Fri Mar 11 09:16:55 2016 -0800
@@ -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
@@ -23,16 +23,15 @@
 
 /*
  @test
- @bug 8056151
+ @bug 8056151 8131751
  @summary Switching to GTK L&F on-the-fly leads to X Window System error RenderBadPicture
  @run main/othervm -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel -Dsun.java2d.xrender=T RenderBadPictureCrash
  */
-
 import java.awt.Color;
+import java.awt.GraphicsDevice;
 import java.lang.reflect.InvocationTargetException;
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
-
 import javax.swing.UIManager;
 
 public class RenderBadPictureCrash {
@@ -41,7 +40,10 @@
         SwingUtilities.invokeAndWait(() -> {
             JFrame f = new JFrame();
             f.setUndecorated(true);
-            f.setBackground(new Color(0, 0, 0, 0));
+            GraphicsDevice gd = f.getGraphicsConfiguration().getDevice();
+            if (gd.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
+                f.setBackground(new Color(0, 0, 0, 0));
+            }
             f.setSize(200, 300);
             f.setVisible(true);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/marlin/CrashNaNTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.geom.Path2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import static java.lang.Double.NaN;
+import java.util.Locale;
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import javax.imageio.ImageIO;
+
+/**
+ * @test
+ * @bug 8149338
+ * @summary Verifies that Marlin supports NaN coordinates and no JVM crash happens !
+ * @run main CrashNaNTest
+ */
+public class CrashNaNTest {
+
+    static final boolean SAVE_IMAGE = false;
+
+    public static void main(String argv[]) {
+        Locale.setDefault(Locale.US);
+
+        // initialize j.u.l Looger:
+        final Logger log = Logger.getLogger("sun.java2d.marlin");
+        log.addHandler(new Handler() {
+            @Override
+            public void publish(LogRecord record) {
+                Throwable th = record.getThrown();
+                // detect any Throwable:
+                if (th != null) {
+                    System.out.println("Test failed:\n" + record.getMessage());
+                    th.printStackTrace(System.out);
+
+                    throw new RuntimeException("Test failed: ", th);
+                }
+            }
+
+            @Override
+            public void flush() {
+            }
+
+            @Override
+            public void close() throws SecurityException {
+            }
+        });
+
+        // enable Marlin logging & internal checks:
+        System.setProperty("sun.java2d.renderer.log", "true");
+        System.setProperty("sun.java2d.renderer.useLogger", "true");
+        System.setProperty("sun.java2d.renderer.doChecks", "true");
+
+        final int width = 400;
+        final int height = 400;
+
+        final BufferedImage image = new BufferedImage(width, height,
+                BufferedImage.TYPE_INT_ARGB);
+
+        final Graphics2D g2d = (Graphics2D) image.getGraphics();
+        try {
+            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                    RenderingHints.VALUE_ANTIALIAS_ON);
+
+            g2d.setBackground(Color.WHITE);
+            g2d.clearRect(0, 0, width, height);
+
+            final Path2D.Double path = new Path2D.Double();
+            path.moveTo(30, 30);
+            path.lineTo(100, 100);
+
+            for (int i = 0; i < 20000; i++) {
+                path.lineTo(110 + 0.01 * i, 110);
+                path.lineTo(111 + 0.01 * i, 100);
+            }
+
+            path.lineTo(NaN, 200);
+            path.lineTo(200, 200);
+            path.lineTo(200, NaN);
+            path.lineTo(300, 300);
+            path.lineTo(NaN, NaN);
+            path.lineTo(100, 100);
+            path.closePath();
+
+            final Path2D.Double path2 = new Path2D.Double();
+            path2.moveTo(0,0);
+            path2.lineTo(width,height);
+            path2.lineTo(10, 10);
+            path2.closePath();
+
+            for (int i = 0; i < 1; i++) {
+                final long start = System.nanoTime();
+                g2d.setColor(Color.BLUE);
+                g2d.fill(path);
+
+                g2d.fill(path2);
+
+                final long time = System.nanoTime() - start;
+                System.out.println("paint: duration= " + (1e-6 * time) + " ms.");
+            }
+
+            if (SAVE_IMAGE) {
+                try {
+                    final File file = new File("CrashNaNTest.png");
+                    System.out.println("Writing file: "
+                            + file.getAbsolutePath());
+                    ImageIO.write(image, "PNG", file);
+                } catch (IOException ex) {
+                    System.out.println("Writing file failure:");
+                    ex.printStackTrace();
+                }
+            }
+        } finally {
+            g2d.dispose();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/java2d/marlin/CrashPaintTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Paint;
+import java.awt.PaintContext;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.TexturePaint;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.Raster;
+import java.io.File;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.logging.Handler;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import javax.imageio.ImageIO;
+
+/**
+ * @test
+ * @bug 8148886
+ * @summary Verifies that Marlin supports reentrant operations (ThreadLocal)
+ * like in custom Paint or custom Composite
+ * @run main CrashPaintTest
+ */
+public class CrashPaintTest {
+
+    static final boolean SAVE_IMAGE = false;
+
+    public static void main(String argv[]) {
+        Locale.setDefault(Locale.US);
+
+        // initialize j.u.l Looger:
+        final Logger log = Logger.getLogger("sun.java2d.marlin");
+        log.addHandler(new Handler() {
+            @Override
+            public void publish(LogRecord record) {
+                Throwable th = record.getThrown();
+                // detect any Throwable:
+                if (th != null) {
+                    System.out.println("Test failed:\n" + record.getMessage());
+                    th.printStackTrace(System.out);
+
+                    throw new RuntimeException("Test failed: ", th);
+                }
+            }
+
+            @Override
+            public void flush() {
+            }
+
+            @Override
+            public void close() throws SecurityException {
+            }
+        });
+
+        // enable Marlin logging & internal checks:
+        System.setProperty("sun.java2d.renderer.log", "true");
+        System.setProperty("sun.java2d.renderer.useLogger", "true");
+        System.setProperty("sun.java2d.renderer.doChecks", "true");
+
+        // Force using thread-local storage:
+        System.setProperty("sun.java2d.renderer.useThreadLocal", "true");
+        // Force smaller pixelsize to force using array caches:
+        System.setProperty("sun.java2d.renderer.pixelsize", "256");
+
+        final int width = 300;
+        final int height = 300;
+
+        final BufferedImage image = new BufferedImage(width, height,
+                BufferedImage.TYPE_INT_ARGB);
+
+        final Graphics2D g2d = (Graphics2D) image.getGraphics();
+        try {
+            g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                    RenderingHints.VALUE_ANTIALIAS_ON);
+
+            g2d.setBackground(Color.WHITE);
+            g2d.clearRect(0, 0, width, height);
+
+            final Ellipse2D.Double ellipse
+                = new Ellipse2D.Double(0, 0, width, height);
+
+            final Paint paint = new CustomPaint(100);
+
+            for (int i = 0; i < 20; i++) {
+                final long start = System.nanoTime();
+                g2d.setPaint(paint);
+                g2d.fill(ellipse);
+
+                g2d.setColor(Color.GREEN);
+                g2d.draw(ellipse);
+
+                final long time = System.nanoTime() - start;
+                System.out.println("paint: duration= " + (1e-6 * time) + " ms.");
+            }
+
+            if (SAVE_IMAGE) {
+                try {
+                    final File file = new File("CrashPaintTest.png");
+                    System.out.println("Writing file: "
+                            + file.getAbsolutePath());
+                    ImageIO.write(image, "PNG", file);
+                } catch (IOException ex) {
+                    System.out.println("Writing file failure:");
+                    ex.printStackTrace();
+                }
+            }
+
+            // Check image on few pixels:
+            final Raster raster = image.getData();
+
+            // 170, 175 = blue
+            checkPixel(raster, 170, 175, Color.BLUE.getRGB());
+            // 50, 50 = blue
+            checkPixel(raster, 50, 50, Color.BLUE.getRGB());
+
+            // 190, 110 = pink
+            checkPixel(raster, 190, 110, Color.PINK.getRGB());
+            // 280, 210 = pink
+            checkPixel(raster, 280, 210, Color.PINK.getRGB());
+
+        } finally {
+            g2d.dispose();
+        }
+    }
+
+    private static void checkPixel(final Raster raster,
+                                   final int x, final int y,
+                                   final int expected) {
+
+        final int[] rgb = (int[]) raster.getDataElements(x, y, null);
+
+        if (rgb[0] != expected) {
+            throw new IllegalStateException("bad pixel at (" + x + ", " + y
+                + ") = " + rgb[0] + " expected: " + expected);
+        }
+    }
+
+    private static class CustomPaint extends TexturePaint {
+        private int size;
+
+        CustomPaint(final int size) {
+            super(new BufferedImage(size, size,
+                    BufferedImage.TYPE_INT_ARGB),
+                    new Rectangle2D.Double(0, 0, size, size)
+            );
+            this.size = size;
+        }
+
+        @Override
+        public PaintContext createContext(ColorModel cm,
+                                          Rectangle deviceBounds,
+                                          Rectangle2D userBounds,
+                                          AffineTransform at,
+                                          RenderingHints hints) {
+
+            // Fill bufferedImage using
+            final Graphics2D g2d = (Graphics2D) getImage().getGraphics();
+            try {
+                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                        RenderingHints.VALUE_ANTIALIAS_ON);
+                g2d.setBackground(Color.PINK);
+                g2d.clearRect(0, 0, size, size);
+
+                g2d.setColor(Color.BLUE);
+                g2d.drawRect(0, 0, size, size);
+
+                g2d.fillOval(size / 10, size / 10,
+                             size * 8 / 10, size * 8 / 10);
+
+            } finally {
+                g2d.dispose();
+            }
+
+            return super.createContext(cm, deviceBounds, userBounds, at, hints);
+        }
+    }
+}
--- a/jdk/test/sun/java2d/marlin/TextClipErrorTest.java	Fri Mar 11 18:35:26 2016 +0530
+++ b/jdk/test/sun/java2d/marlin/TextClipErrorTest.java	Fri Mar 11 09:16:55 2016 -0800
@@ -69,24 +69,12 @@
             @Override
             public void publish(LogRecord record) {
                 Throwable th = record.getThrown();
-                // detect potential Throwable thrown by XxxArrayCache.check():
-                if (th != null && th.getClass() == Throwable.class) {
-                    StackTraceElement[] stackElements = th.getStackTrace();
-
-                    for (int i = 0; i < stackElements.length; i++) {
-                        StackTraceElement e = stackElements[i];
+                // detect any Throwable:
+                if (th != null) {
+                    System.out.println("Test failed:\n" + record.getMessage());
+                    th.printStackTrace(System.out);
 
-                        if (e.getClassName().startsWith("sun.java2d.marlin")
-                            && e.getClassName().contains("ArrayCache")
-                            && "check".equals(e.getMethodName()))
-                        {
-                            System.out.println("Test failed:\n"
-                                + record.getMessage());
-                            th.printStackTrace(System.out);
-
-                            throw new RuntimeException("Test failed: ", th);
-                        }
-                    }
+                    throw new RuntimeException("Test failed: ", th);
                 }
             }