Merge
authorprr
Tue, 05 Apr 2016 09:17:15 -0700
changeset 37560 5070d74da2bc
parent 37559 09143ccbfc6e (diff)
parent 36926 c49df7b25461 (current diff)
child 37561 dcb7441b014d
Merge
jdk/make/src/classes/build/tools/module/Module.java
jdk/make/src/classes/build/tools/module/ModuleInfoReader.java
jdk/make/src/classes/build/tools/module/ModulesXmlReader.java
jdk/make/src/classes/build/tools/module/ModulesXmlWriter.java
jdk/src/java.base/share/classes/sun/misc/GC.java
jdk/src/java.base/share/classes/sun/misc/InvalidJarIndexException.java
jdk/src/java.base/share/classes/sun/misc/JarIndex.java
jdk/src/java.base/share/classes/sun/misc/VMSupport.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_de.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_es.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_fr.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_it.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_ja.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_ko.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_pt_BR.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_sv.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_zh_CN.java
jdk/src/java.base/share/classes/sun/misc/resources/Messages_zh_TW.java
jdk/src/java.base/share/native/libjava/GC.c
langtools/test/tools/lib/ToolBox.java
--- a/jdk/make/data/fontconfig/windows.fontconfig.properties	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/make/data/fontconfig/windows.fontconfig.properties	Tue Apr 05 09:17:15 2016 -0700
@@ -243,7 +243,7 @@
 
 # Exclusion Ranges
 
-exclusion.alphabetic=0700-1e9f,1f00-20ab,20ad-f8ff
+exclusion.alphabetic=0700-1e9f,1f00-2017,2020-20ab,20ad-f8ff
 exclusion.chinese-gb18030=0390-03d6,2200-22ef,2701-27be
 exclusion.hebrew=0041-005a,0060-007a,007f-00ff,20ac-20ac
 
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java	Tue Apr 05 09:17:15 2016 -0700
@@ -35,7 +35,6 @@
 import javax.swing.filechooser.FileSystemView;
 import javax.swing.table.AbstractTableModel;
 
-import sun.misc.ManagedLocalsThread;
 /**
  * NavServices-like implementation of a file Table
  *
@@ -393,7 +392,7 @@
             this.currentDirectory = currentDirectory;
             this.fid = fid;
             String name = "Aqua L&F File Loading Thread";
-            this.loadThread = new ManagedLocalsThread(this, name);
+            this.loadThread = new Thread(null, this, name, 0, false);
             this.loadThread.start();
         }
 
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameDockIconUI.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFrameDockIconUI.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,28 +40,28 @@
  * From MacDockIconUI
  *
  * A JRSUI L&F implementation of JInternalFrame.JDesktopIcon
- * @author
- * @version
  */
-public class AquaInternalFrameDockIconUI extends DesktopIconUI implements MouseListener, MouseMotionListener, ComponentListener {
-    private static final String CACHED_FRAME_ICON_KEY = "apple.laf.internal.frameIcon";
+public final class AquaInternalFrameDockIconUI extends DesktopIconUI
+        implements MouseListener, MouseMotionListener {
 
-    protected JInternalFrame.JDesktopIcon fDesktopIcon;
-    protected JInternalFrame fFrame;
-    protected ScaledImageLabel fIconPane;
-    protected DockLabel fDockLabel;
-    protected boolean fTrackingIcon = false;
+    private JInternalFrame.JDesktopIcon fDesktopIcon;
+    private JInternalFrame fFrame;
+    private ScaledImageLabel fIconPane;
+    private DockLabel fDockLabel;
+    private boolean fTrackingIcon;
 
     public static ComponentUI createUI(final JComponent c) {
         return new AquaInternalFrameDockIconUI();
     }
 
+    @Override
     public void installUI(final JComponent c) {
         fDesktopIcon = (JInternalFrame.JDesktopIcon)c;
         installComponents();
         installListeners();
     }
 
+    @Override
     public void uninstallUI(final JComponent c) {
         uninstallComponents();
         uninstallListeners();
@@ -69,55 +69,54 @@
         fFrame = null;
     }
 
-    protected void installComponents() {
+    private void installComponents() {
         fFrame = fDesktopIcon.getInternalFrame();
         fIconPane = new ScaledImageLabel();
         fDesktopIcon.setLayout(new BorderLayout());
         fDesktopIcon.add(fIconPane, BorderLayout.CENTER);
     }
 
-    protected void uninstallComponents() {
+    private void uninstallComponents() {
         fDesktopIcon.setLayout(null);
         fDesktopIcon.remove(fIconPane);
     }
 
-    protected void installListeners() {
+    private void installListeners() {
         fDesktopIcon.addMouseListener(this);
         fDesktopIcon.addMouseMotionListener(this);
-        fFrame.addComponentListener(this);
     }
 
-    protected void uninstallListeners() {
-        fFrame.removeComponentListener(this);
+    private void uninstallListeners() {
         fDesktopIcon.removeMouseMotionListener(this);
         fDesktopIcon.removeMouseListener(this);
     }
 
+    @Override
     public Dimension getMinimumSize(final JComponent c) {
         return new Dimension(32, 32);
     }
 
+    @Override
     public Dimension getMaximumSize(final JComponent c) {
         return new Dimension(128, 128);
     }
 
+    @Override
     public Dimension getPreferredSize(final JComponent c) {
         return new Dimension(64, 64); //$ Dock preferred size
     }
 
-    public Insets getInsets(final JComponent c) {
-        return new Insets(0, 0, 0, 0);
-    }
-
     void updateIcon() {
         fIconPane.updateIcon();
     }
 
+    @Override
     public void mousePressed(final MouseEvent e) {
         fTrackingIcon = fIconPane.mouseInIcon(e);
         if (fTrackingIcon) fIconPane.repaint();
     }
 
+    @Override
     public void mouseReleased(final MouseEvent e) {// only when it's actually in the image
         if (fFrame.isIconifiable() && fFrame.isIcon()) {
             if (fTrackingIcon) {
@@ -137,6 +136,7 @@
         if (fDockLabel != null && !fIconPane.getBounds().contains(e.getX(), e.getY())) fDockLabel.hide();
     }
 
+    @Override
     public void mouseEntered(final MouseEvent e) {
         if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) return;
         String title = fFrame.getTitle();
@@ -145,41 +145,27 @@
         fDockLabel.show(fDesktopIcon);
     }
 
+    @Override
     public void mouseExited(final MouseEvent e) {
         if (fDockLabel != null && (e.getModifiers() & InputEvent.BUTTON1_MASK) == 0) fDockLabel.hide();
     }
 
+    @Override
     public void mouseClicked(final MouseEvent e) { }
 
+    @Override
     public void mouseDragged(final MouseEvent e) { }
 
+    @Override
     public void mouseMoved(final MouseEvent e) { }
 
-    public void componentHidden(final ComponentEvent e) { }
-
-    public void componentMoved(final ComponentEvent e) { }
-
-    public void componentResized(final ComponentEvent e) {
-        fFrame.putClientProperty(CACHED_FRAME_ICON_KEY, null);
-    }
-
-    public void componentShown(final ComponentEvent e) {
-        fFrame.putClientProperty(CACHED_FRAME_ICON_KEY, null);
-    }
-
     @SuppressWarnings("serial") // Superclass is not serializable across versions
-    class ScaledImageLabel extends JLabel {
+    private final class ScaledImageLabel extends JLabel {
         ScaledImageLabel() {
             super(null, null, CENTER);
         }
 
         void updateIcon() {
-            final Object priorIcon = fFrame.getClientProperty(CACHED_FRAME_ICON_KEY);
-            if (priorIcon instanceof ImageIcon) {
-                setIcon((ImageIcon)priorIcon);
-                return;
-            }
-
             int width = fFrame.getWidth();
             int height = fFrame.getHeight();
 
@@ -196,11 +182,10 @@
 
             final float scale = (float)fDesktopIcon.getWidth() / (float)Math.max(width, height) * 0.89f;
             // Sending in -1 for width xor height causes it to maintain aspect ratio
-            final ImageIcon icon = new ImageIcon(fImage.getScaledInstance((int)(width * scale), -1, Image.SCALE_SMOOTH));
-            fFrame.putClientProperty(CACHED_FRAME_ICON_KEY, icon);
-            setIcon(icon);
+            setIcon(new ImageIcon(fImage.getScaledInstance((int)(width * scale), -1, Image.SCALE_SMOOTH)));
         }
 
+        @Override
         public void paint(final Graphics g) {
             if (getIcon() == null) updateIcon();
 
@@ -222,13 +207,14 @@
             return getBounds().contains(e.getX(), e.getY());
         }
 
+        @Override
         public Dimension getPreferredSize() {
             return new Dimension(64, 64); //$ Dock preferred size
         }
     }
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
-    class DockLabel extends JLabel {
+    private static final class DockLabel extends JLabel {
         static final int NUB_HEIGHT = 7;
         static final int ROUND_ADDITIONAL_HEIGHT = 8;
         static final int ROUND_ADDITIONAL_WIDTH = 12;
@@ -243,6 +229,7 @@
             setSize(SwingUtilities.computeStringWidth(metrics, getText()) + ROUND_ADDITIONAL_WIDTH * 2, metrics.getAscent() + NUB_HEIGHT + ROUND_ADDITIONAL_HEIGHT);
         }
 
+        @Override
         public void paint(final Graphics g) {
             final int width = getWidth();
             final int height = getHeight();
@@ -303,6 +290,7 @@
             }
         }
 
+        @Override
         @Deprecated
         public void hide() {
             final Container parent = getParent();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Tue Apr 05 09:17:15 2016 -0700
@@ -2183,50 +2183,21 @@
         }
 
         protected int preferredTabAreaHeight(final int tabPlacement, final int width) {
-            final FontMetrics metrics = getFontMetrics();
             final int tabCount = tabPane.getTabCount();
             int total = 0;
             if (tabCount > 0) {
-                int rows = 1;
-                int x = 0;
-
                 final int maxTabHeight = calculateMaxTabHeight(tabPlacement);
-
-                for (int i = 0; i < tabCount; i++) {
-                    final int tabWidth = calculateTabWidth(tabPlacement, i, metrics);
-
-                    if (x != 0 && x + tabWidth > width) {
-                        rows++;
-                        x = 0;
-                    }
-                    x += tabWidth;
-                }
-                total = calculateTabAreaHeight(tabPlacement, rows, maxTabHeight);
+                total = calculateTabAreaHeight(tabPlacement, 1, maxTabHeight);
             }
             return total;
         }
 
         protected int preferredTabAreaWidth(final int tabPlacement, final int height) {
-            final FontMetrics metrics = getFontMetrics();
             final int tabCount = tabPane.getTabCount();
             int total = 0;
             if (tabCount > 0) {
-                int columns = 1;
-                int y = 0;
-                final int fontHeight = metrics.getHeight();
-
                 maxTabWidth = calculateMaxTabWidth(tabPlacement);
-
-                for (int i = 0; i < tabCount; i++) {
-                    final int tabHeight = calculateTabHeight(tabPlacement, i, fontHeight);
-
-                    if (y != 0 && y + tabHeight > height) {
-                        columns++;
-                        y = 0;
-                    }
-                    y += tabHeight;
-                }
-                total = calculateTabAreaWidth(tabPlacement, columns, maxTabWidth);
+                total = calculateTabAreaWidth(tabPlacement, 1, maxTabWidth);
             }
             return total;
         }
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Tue Apr 05 09:17:15 2016 -0700
@@ -42,7 +42,6 @@
 import sun.awt.HeadlessToolkit;
 import sun.awt.util.ThreadGroupUtils;
 import sun.lwawt.macosx.*;
-import sun.misc.ManagedLocalsThread;
 
 public final class CFontManager extends SunFontManager {
     private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
--- a/jdk/src/java.desktop/macosx/classes/sun/java2d/IntegerNIORaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/java2d/IntegerNIORaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -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
@@ -40,7 +40,7 @@
                                                ") cannot be <= 0");
         }
         // This is cribbed from java.awt.image.Raster.
-        DataBuffer db = new DataBufferNIOInt(w * h);
+        DataBufferNIOInt db = new DataBufferNIOInt(w * h);
         if (location == null) {
             location = new Point(0, 0);
         }
@@ -48,13 +48,11 @@
         return new IntegerNIORaster(sppsm, db, location);
     }
 
-    public IntegerNIORaster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin) {
+    public IntegerNIORaster(SampleModel sampleModel, DataBufferNIOInt dataBuffer, Point origin) {
         // This is all cribbed from sun.awt.image.IntegerInterleavedRaster & sun.awt.image.IntegerComponentRaster
         super(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin, null);
-        if (!(dataBuffer instanceof DataBufferNIOInt)) {
-           throw new RasterFormatException("IntegerNIORasters must have DataBufferNIOInt DataBuffers");
-        }
-        this.data = ((DataBufferNIOInt)dataBuffer).getBuffer();
+
+        this.data = dataBuffer.getBuffer();
     }
 
     public WritableRaster createCompatibleWritableRaster() {
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/LWToolkit.java	Tue Apr 05 09:17:15 2016 -0700
@@ -35,7 +35,6 @@
 import java.util.*;
 
 import sun.awt.*;
-import sun.misc.ManagedLocalsThread;
 import sun.print.*;
 import sun.awt.util.ThreadGroupUtils;
 
@@ -77,13 +76,14 @@
                 shutdown();
                 waitForRunState(STATE_CLEANUP);
             };
-            Thread shutdown = new ManagedLocalsThread(
-                    ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable);
+            Thread shutdown = new Thread(
+                    ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable,
+                    "AWT-Shutdown", 0, false);
             shutdown.setContextClassLoader(null);
             Runtime.getRuntime().addShutdownHook(shutdown);
             String name = "AWT-LW";
-            Thread toolkitThread = new ManagedLocalsThread(
-                    ThreadGroupUtils.getRootThreadGroup(), this, name);
+            Thread toolkitThread = new Thread(
+                   ThreadGroupUtils.getRootThreadGroup(), this, name, 0, false);
             toolkitThread.setDaemon(true);
             toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
             toolkitThread.start();
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -44,7 +44,6 @@
 import sun.lwawt.LWComponentPeer;
 import sun.lwawt.LWWindowPeer;
 import sun.lwawt.PlatformWindow;
-import sun.misc.ManagedLocalsThread;
 
 
 public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
@@ -181,7 +180,7 @@
                     }
                 }
             };
-            new ManagedLocalsThread(dragRunnable).start();
+            new Thread(null, dragRunnable, "Drag", 0, false).start();
         } catch (Exception e) {
             final long nativeDragSource = getNativeContext();
             setNativeContext(0);
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Tue Apr 05 09:17:15 2016 -0700
@@ -37,7 +37,6 @@
 import sun.awt.CausedFocusEvent.Cause;
 import sun.awt.AWTAccessor;
 import sun.java2d.pipe.Region;
-import sun.misc.ManagedLocalsThread;
 import sun.security.action.GetBooleanAction;
 
 class CFileDialog implements FileDialogPeer {
@@ -120,7 +119,7 @@
         if (visible) {
             // Java2 Dialog class requires peer to run code in a separate thread
             // and handles keeping the call modal
-            new ManagedLocalsThread(new Task()).start();
+            new Thread(null, new Task(), "FileDialog", 0, false).start();
         }
         // We hide ourself before "show" returns - setVisible(false)
         // doesn't apply
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -29,7 +29,6 @@
 import java.awt.dnd.*;
 
 import sun.lwawt.*;
-import sun.misc.ManagedLocalsThread;
 
 public class CPrinterDialogPeer extends LWWindowPeer {
     static {
@@ -59,7 +58,7 @@
                 printerDialog.setRetVal(printerDialog.showDialog());
                 printerDialog.setVisible(false);
             };
-            new ManagedLocalsThread(task).start();
+            new Thread(null, task, "PrintDialog", 0, false).start();
         }
     }
 
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Tue Apr 05 09:17:15 2016 -0700
@@ -36,6 +36,7 @@
 import javax.print.*;
 import javax.print.attribute.PrintRequestAttributeSet;
 import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.standard.Copies;
 import javax.print.attribute.standard.Media;
 import javax.print.attribute.standard.MediaPrintableArea;
 import javax.print.attribute.standard.MediaSize;
@@ -43,7 +44,6 @@
 import javax.print.attribute.standard.PageRanges;
 
 import sun.java2d.*;
-import sun.misc.ManagedLocalsThread;
 import sun.print.*;
 
 public final class CPrinterJob extends RasterPrinterJob {
@@ -194,10 +194,37 @@
                 // setPageRange will set firstPage and lastPage as called in getFirstPage
                 // and getLastPage
                 setPageRange(range[0][0] - 1, range[0][1] - 1);
+            } else {
+                // if rangeSelect is SunPageSelection.ALL
+                // then setPageRange appropriately
+                setPageRange(-1, -1);
             }
         }
     }
 
+    private void setPageRangeAttribute(int from, int to, boolean isRangeSet) {
+        if (attributes != null) {
+            // since native Print use zero-based page indices,
+            // we need to store in 1-based format in attributes set
+            // but setPageRange again uses zero-based indices so it should be
+            // 1 less than pageRanges attribute
+            if (isRangeSet) {
+                attributes.add(new PageRanges(from+1, to+1));
+                attributes.add(SunPageSelection.RANGE);
+                setPageRange(from, to);
+            } else {
+                attributes.add(SunPageSelection.ALL);
+            }
+        }
+    }
+
+    private void setCopiesAttribute(int copies) {
+        if (attributes != null) {
+            attributes.add(new Copies(copies));
+            super.setCopies(copies);
+        }
+    }
+
     volatile boolean onEventThread;
 
     @Override
@@ -691,9 +718,15 @@
                 if (pageFormat != null) {
                     Printable printable = pageable.getPrintable(pageIndex);
                     if (printable != null) {
-                        BufferedImage bimg = new BufferedImage((int)Math.round(pageFormat.getWidth()), (int)Math.round(pageFormat.getHeight()), BufferedImage.TYPE_INT_ARGB_PRE);
-                        PeekGraphics peekGraphics = createPeekGraphics(bimg.createGraphics(), printerJob);
-                        Rectangle2D pageFormatArea = getPageFormatArea(pageFormat);
+                        BufferedImage bimg =
+                              new BufferedImage(
+                                  (int)Math.round(pageFormat.getWidth()),
+                                  (int)Math.round(pageFormat.getHeight()),
+                                  BufferedImage.TYPE_INT_ARGB_PRE);
+                        PeekGraphics peekGraphics =
+                         createPeekGraphics(bimg.createGraphics(), printerJob);
+                        Rectangle2D pageFormatArea =
+                             getPageFormatArea(pageFormat);
                         initPrinterGraphics(peekGraphics, pageFormatArea);
 
                         // Do the assignment here!
@@ -741,7 +774,8 @@
 
     // upcall from native
     private static void detachPrintLoop(final long target, final long arg) {
-        new ManagedLocalsThread(() -> _safePrintLoop(target, arg)).start();
+        new Thread(null, () -> _safePrintLoop(target, arg),
+                   "PrintLoop", 0, false).start();
     }
     private static native void _safePrintLoop(long target, long arg);
 
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CPrinterJob.m	Tue Apr 05 09:17:15 2016 -0700
@@ -312,9 +312,9 @@
 static void nsPrintInfoToJavaPrinterJob(JNIEnv* env, NSPrintInfo* src, jobject dstPrinterJob, jobject dstPageable)
 {
     static JNF_MEMBER_CACHE(jm_setService, sjc_CPrinterJob, "setPrinterServiceFromNative", "(Ljava/lang/String;)V");
-    static JNF_MEMBER_CACHE(jm_setCopies, sjc_CPrinterJob, "setCopies", "(I)V");
+    static JNF_MEMBER_CACHE(jm_setCopiesAttribute, sjc_CPrinterJob, "setCopiesAttribute", "(I)V");
     static JNF_MEMBER_CACHE(jm_setCollated, sjc_CPrinterJob, "setCollated", "(Z)V");
-    static JNF_MEMBER_CACHE(jm_setPageRange, sjc_CPrinterJob, "setPageRange", "(II)V");
+    static JNF_MEMBER_CACHE(jm_setPageRangeAttribute, sjc_CPrinterJob, "setPageRangeAttribute", "(IIZ)V");
 
     // get the selected printer's name, and set the appropriate PrintService on the Java side
     NSString *name = [[src printer] name];
@@ -327,7 +327,7 @@
     NSNumber* nsCopies = [printingDictionary objectForKey:NSPrintCopies];
     if ([nsCopies respondsToSelector:@selector(integerValue)])
     {
-        JNFCallVoidMethod(env, dstPrinterJob, jm_setCopies, [nsCopies integerValue]); // AWT_THREADING Safe (known object)
+        JNFCallVoidMethod(env, dstPrinterJob, jm_setCopiesAttribute, [nsCopies integerValue]); // AWT_THREADING Safe (known object)
     }
 
     NSNumber* nsCollated = [printingDictionary objectForKey:NSPrintMustCollate];
@@ -340,6 +340,7 @@
     if ([nsPrintAllPages respondsToSelector:@selector(boolValue)])
     {
         jint jFirstPage = 0, jLastPage = java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES;
+        jboolean isRangeSet = false;
         if (![nsPrintAllPages boolValue])
         {
             NSNumber* nsFirstPage = [printingDictionary objectForKey:NSPrintFirstPage];
@@ -353,9 +354,12 @@
             {
                 jLastPage = [nsLastPage integerValue] - 1;
             }
-        }
+            isRangeSet = true;
+        } 
+        JNFCallVoidMethod(env, dstPrinterJob, jm_setPageRangeAttribute, 
+                          jFirstPage, jLastPage, isRangeSet); 
+            // AWT_THREADING Safe (known object)
 
-        JNFCallVoidMethod(env, dstPrinterJob, jm_setPageRange, jFirstPage, jLastPage); // AWT_THREADING Safe (known object)
     }
 }
 
@@ -368,6 +372,8 @@
     static JNF_MEMBER_CACHE(jm_isCollated, sjc_CPrinterJob, "isCollated", "()Z");
     static JNF_MEMBER_CACHE(jm_getFromPage, sjc_CPrinterJob, "getFromPageAttrib", "()I");
     static JNF_MEMBER_CACHE(jm_getToPage, sjc_CPrinterJob, "getToPageAttrib", "()I");
+    static JNF_MEMBER_CACHE(jm_getMinPage, sjc_CPrinterJob, "getMinPageAttrib", "()I");
+    static JNF_MEMBER_CACHE(jm_getMaxPage, sjc_CPrinterJob, "getMaxPageAttrib", "()I");
     static JNF_MEMBER_CACHE(jm_getSelectAttrib, sjc_CPrinterJob, "getSelectAttrib", "()I");
     static JNF_MEMBER_CACHE(jm_getNumberOfPages, jc_Pageable, "getNumberOfPages", "()I");
     static JNF_MEMBER_CACHE(jm_getPageFormat, sjc_CPrinterJob, "getPageFormatFromAttributes", "()Ljava/awt/print/PageFormat;");
@@ -379,31 +385,33 @@
 
     jboolean collated = JNFCallBooleanMethod(env, srcPrinterJob, jm_isCollated); // AWT_THREADING Safe (known object)
     [printingDictionary setObject:[NSNumber numberWithBool:collated ? YES : NO] forKey:NSPrintMustCollate];
-    jint jNumPages = JNFCallIntMethod(env, srcPageable, jm_getNumberOfPages); // AWT_THREADING Safe (!appKit)
-    if (jNumPages != java_awt_print_Pageable_UNKNOWN_NUMBER_OF_PAGES)
-    {
-        jint selectID = JNFCallIntMethod(env, srcPrinterJob, jm_getSelectAttrib);
-        if (selectID ==0) {
-            [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
-        } else if (selectID == 2) {
-            // In Mac 10.7,  Print ALL is deselected if PrintSelection is YES whether
-            // NSPrintAllPages is YES or NO
-            [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
-            [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintSelectionOnly];
-        } else {
+    jint selectID = JNFCallIntMethod(env, srcPrinterJob, jm_getSelectAttrib);
+    jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage);
+    jint toPage = JNFCallIntMethod(env, srcPrinterJob, jm_getToPage);
+    if (selectID ==0) {
+        [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
+    } else if (selectID == 2) {
+        // In Mac 10.7,  Print ALL is deselected if PrintSelection is YES whether
+        // NSPrintAllPages is YES or NO
+        [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+        [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintSelectionOnly];
+    } else {
+        jint minPage = JNFCallIntMethod(env, srcPrinterJob, jm_getMinPage);
+        jint maxPage = JNFCallIntMethod(env, srcPrinterJob, jm_getMaxPage);
+
+        // for PD_SELECTION or PD_NOSELECTION, check from/to page
+        // to determine which radio button to select
+        if (fromPage > minPage || toPage < maxPage) {
             [printingDictionary setObject:[NSNumber numberWithBool:NO] forKey:NSPrintAllPages];
+        } else {
+            [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
         }
+    }
 
-        jint fromPage = JNFCallIntMethod(env, srcPrinterJob, jm_getFromPage);
-        jint toPage = JNFCallIntMethod(env, srcPrinterJob, jm_getToPage);
-        // setting fromPage and toPage will not be shown in the dialog if printing All pages
-        [printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
-        [printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
-    }
-    else
-    {
-        [printingDictionary setObject:[NSNumber numberWithBool:YES] forKey:NSPrintAllPages];
-    }
+    // setting fromPage and toPage will not be shown in the dialog if printing All pages
+    [printingDictionary setObject:[NSNumber numberWithInteger:fromPage] forKey:NSPrintFirstPage];
+    [printingDictionary setObject:[NSNumber numberWithInteger:toPage] forKey:NSPrintLastPage];
+
     jobject page = JNFCallObjectMethod(env, srcPrinterJob, jm_getPageFormat); 
     if (page != NULL) {
         javaPageFormatToNSPrintInfo(env, NULL, page, dst);
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CTrayIcon.m	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,18 +39,21 @@
  * If the image of the specified size won't fit into the status bar,
  * then scale it down proprtionally. Otherwise, leave it as is.
  */
-static NSSize ScaledImageSizeForStatusBar(NSSize imageSize) {
+static NSSize ScaledImageSizeForStatusBar(NSSize imageSize, BOOL autosize) {
     NSRect imageRect = NSMakeRect(0.0, 0.0, imageSize.width, imageSize.height);
 
     // There is a black line at the bottom of the status bar
     // that we don't want to cover with image pixels.
-    CGFloat desiredHeight = [[NSStatusBar systemStatusBar] thickness] - 1.0;
-    CGFloat scaleFactor = MIN(1.0, desiredHeight/imageSize.height);
-
-    imageRect.size.width *= scaleFactor;
-    imageRect.size.height *= scaleFactor;
+    CGFloat desiredSize = [[NSStatusBar systemStatusBar] thickness] - 1.0;
+    if (autosize) {
+        imageRect.size.width = desiredSize;
+        imageRect.size.height = desiredSize;
+    } else {
+        CGFloat scaleFactor = MIN(1.0, desiredSize/imageSize.height);
+        imageRect.size.width *= scaleFactor;
+        imageRect.size.height *= scaleFactor;
+    }
     imageRect = NSIntegralRect(imageRect);
-
     return imageRect.size;
 }
 
@@ -101,9 +104,9 @@
     return peer;
 }
 
-- (void) setImage:(NSImage *) imagePtr sizing:(BOOL)autosize{
+- (void) setImage:(NSImage *) imagePtr sizing:(BOOL)autosize {
     NSSize imageSize = [imagePtr size];
-    NSSize scaledSize = ScaledImageSizeForStatusBar(imageSize);
+    NSSize scaledSize = ScaledImageSizeForStatusBar(imageSize, autosize);
     if (imageSize.width != scaledSize.width ||
         imageSize.height != scaledSize.height) {
         [imagePtr setSize: scaledSize];
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamCloser.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/stream/StreamCloser.java	Tue Apr 05 09:17:15 2016 -0700
@@ -26,7 +26,6 @@
 package com.sun.imageio.stream;
 
 import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
 
 import java.io.IOException;
 import java.security.AccessController;
@@ -92,8 +91,8 @@
                      * Make its parent the top-level thread group.
                      */
                     ThreadGroup tg = ThreadGroupUtils.getRootThreadGroup();
-                    streamCloser = new ManagedLocalsThread(tg,
-                                                           streamCloserRunnable);
+                    streamCloser = new Thread(tg, streamCloserRunnable,
+                                              "StreamCloser", 0, false);
                     /* Set context class loader to null in order to avoid
                      * keeping a strong reference to an application classloader.
                      */
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Tue Apr 05 09:17:15 2016 -0700
@@ -64,7 +64,6 @@
 import sun.awt.OSInfo;
 import sun.awt.shell.ShellFolder;
 import sun.font.FontUtilities;
-import sun.misc.ManagedLocalsThread;
 import sun.security.action.GetPropertyAction;
 
 import sun.swing.DefaultLayoutStyle;
@@ -2053,7 +2052,7 @@
             if (audioRunnable != null) {
                 // Runnable appears to block until completed playing, hence
                 // start up another thread to handle playing.
-                new ManagedLocalsThread(audioRunnable).start();
+                new Thread(null, audioRunnable, "Audio", 0, false).start();
             }
         }
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatConverter.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package com.sun.media.sound;
 
 import java.nio.ByteBuffer;
@@ -319,8 +320,10 @@
                 float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
-            for (int i = 0; i < out_len; i++)
-                out_buff[ox++] = in_buff[ix++] * (1.0f / 127.0f);
+            for (int i = 0; i < out_len; i++) {
+                byte x = in_buff[ix++];
+                out_buff[ox++] = x > 0 ? x / 127.0f : x / 128.0f;
+            }
             return out_buff;
         }
 
@@ -328,8 +331,10 @@
                 byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
-            for (int i = 0; i < in_len; i++)
-                out_buff[ox++] = (byte) (in_buff[ix++] * 127.0f);
+            for (int i = 0; i < in_len; i++) {
+                final float x = in_buff[ix++];
+                out_buff[ox++] = (byte) (x > 0 ? x * 127 : x * 128);
+            }
             return out_buff;
         }
     }
@@ -340,9 +345,10 @@
                 float[] out_buff, int out_offset, int out_len) {
             int ix = in_offset;
             int ox = out_offset;
-            for (int i = 0; i < out_len; i++)
-                out_buff[ox++] = ((in_buff[ix++] & 0xFF) - 127)
-                        * (1.0f / 127.0f);
+            for (int i = 0; i < out_len; i++) {
+                byte x = (byte) (in_buff[ix++] - 128);
+                out_buff[ox++] = x > 0 ? x / 127.0f : x / 128.0f;
+            }
             return out_buff;
         }
 
@@ -350,8 +356,10 @@
                 byte[] out_buff, int out_offset) {
             int ix = in_offset;
             int ox = out_offset;
-            for (int i = 0; i < in_len; i++)
-                out_buff[ox++] = (byte) (127 + in_buff[ix++] * 127.0f);
+            for (int i = 0; i < in_len; i++) {
+                float x = in_buff[ix++];
+                out_buff[ox++] = (byte) (128 + (x > 0 ? x * 127 : x * 128));
+            }
             return out_buff;
         }
     }
@@ -369,10 +377,9 @@
             int ix = in_offset;
             int len = out_offset + out_len;
             for (int ox = out_offset; ox < len; ox++) {
-                out_buff[ox] = ((short) ((in_buff[ix++] & 0xFF) |
-                           (in_buff[ix++] << 8))) * (1.0f / 32767.0f);
+                short x = (short) (in_buff[ix++] & 0xFF | (in_buff[ix++] << 8));
+                out_buff[ox] = x > 0 ? x / 32767.0f : x / 32768.0f;
             }
-
             return out_buff;
         }
 
@@ -381,7 +388,8 @@
             int ox = out_offset;
             int len = in_offset + in_len;
             for (int ix = in_offset; ix < len; ix++) {
-                int x = (int) (in_buff[ix] * 32767.0);
+                float f = in_buff[ix];
+                short x = (short) (f > 0 ? f * 32767 : f * 32768);
                 out_buff[ox++] = (byte) x;
                 out_buff[ox++] = (byte) (x >>> 8);
             }
@@ -396,8 +404,8 @@
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
-                out_buff[ox++] = ((short) ((in_buff[ix++] << 8) |
-                        (in_buff[ix++] & 0xFF))) * (1.0f / 32767.0f);
+                short x = (short) ((in_buff[ix++] << 8) | (in_buff[ix++] & 0xFF));
+                out_buff[ox++] = x > 0 ? x / 32767.0f : x / 32768.0f;
             }
             return out_buff;
         }
@@ -407,7 +415,8 @@
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
-                int x = (int) (in_buff[ix++] * 32767.0);
+                float f = in_buff[ix++];
+                short x = (short) (f > 0 ? f * 32767.0f : f * 32768.0f);
                 out_buff[ox++] = (byte) (x >>> 8);
                 out_buff[ox++] = (byte) x;
             }
@@ -423,7 +432,8 @@
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
                 int x = (in_buff[ix++] & 0xFF) | ((in_buff[ix++] & 0xFF) << 8);
-                out_buff[ox++] = (x - 32767) * (1.0f / 32767.0f);
+                x -= 32768;
+                out_buff[ox++] = x > 0 ? x / 32767.0f : x / 32768.0f;
             }
             return out_buff;
         }
@@ -433,7 +443,8 @@
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
-                int x = 32767 + (int) (in_buff[ix++] * 32767.0);
+                float f = in_buff[ix++];
+                int x = 32768 + (int) (f > 0 ? f * 32767 : f * 32768);
                 out_buff[ox++] = (byte) x;
                 out_buff[ox++] = (byte) (x >>> 8);
             }
@@ -449,7 +460,8 @@
             int ox = out_offset;
             for (int i = 0; i < out_len; i++) {
                 int x = ((in_buff[ix++] & 0xFF) << 8) | (in_buff[ix++] & 0xFF);
-                out_buff[ox++] = (x - 32767) * (1.0f / 32767.0f);
+                x -= 32768;
+                out_buff[ox++] = x > 0 ? x / 32767.0f : x / 32768.0f;
             }
             return out_buff;
         }
@@ -459,7 +471,8 @@
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
-                int x = 32767 + (int) (in_buff[ix++] * 32767.0);
+                float f = in_buff[ix++];
+                int x = 32768 + (int) (f > 0 ? f * 32767 : f * 32768);
                 out_buff[ox++] = (byte) (x >>> 8);
                 out_buff[ox++] = (byte) x;
             }
@@ -484,7 +497,7 @@
                         | ((in_buff[ix++] & 0xFF) << 16);
                 if (x > 0x7FFFFF)
                     x -= 0x1000000;
-                out_buff[ox++] = x * (1.0f / (float)0x7FFFFF);
+                out_buff[ox++] = x > 0 ? x / 8388607.0f : x / 8388608.0f;
             }
             return out_buff;
         }
@@ -494,7 +507,8 @@
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
-                int x = (int) (in_buff[ix++] * (float)0x7FFFFF);
+                float f = in_buff[ix++];
+                int x = (int) (f > 0 ? f * 8388607.0f : f * 8388608.0f);
                 if (x < 0)
                     x += 0x1000000;
                 out_buff[ox++] = (byte) x;
@@ -516,7 +530,7 @@
                         | ((in_buff[ix++] & 0xFF) << 8) | (in_buff[ix++] & 0xFF);
                 if (x > 0x7FFFFF)
                     x -= 0x1000000;
-                out_buff[ox++] = x * (1.0f / (float)0x7FFFFF);
+                out_buff[ox++] = x > 0 ? x / 8388607.0f : x / 8388608.0f;
             }
             return out_buff;
         }
@@ -526,7 +540,8 @@
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
-                int x = (int) (in_buff[ix++] * (float)0x7FFFFF);
+                float f = in_buff[ix++];
+                int x = (int) (f > 0 ? f * 8388607.0f : f * 8388608.0f);
                 if (x < 0)
                     x += 0x1000000;
                 out_buff[ox++] = (byte) (x >>> 16);
@@ -546,8 +561,8 @@
             for (int i = 0; i < out_len; i++) {
                 int x = (in_buff[ix++] & 0xFF) | ((in_buff[ix++] & 0xFF) << 8)
                         | ((in_buff[ix++] & 0xFF) << 16);
-                x -= 0x7FFFFF;
-                out_buff[ox++] = x * (1.0f / (float)0x7FFFFF);
+                x -= 0x800000;
+                out_buff[ox++] = x > 0 ? x / 8388607.0f : x / 8388608.0f;
             }
             return out_buff;
         }
@@ -557,8 +572,9 @@
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
-                int x = (int) (in_buff[ix++] * (float)0x7FFFFF);
-                x += 0x7FFFFF;
+                float f = in_buff[ix++];
+                int x = (int) (f > 0 ? f * 8388607.0f : f * 8388608.0f);
+                x += 0x800000;
                 out_buff[ox++] = (byte) x;
                 out_buff[ox++] = (byte) (x >>> 8);
                 out_buff[ox++] = (byte) (x >>> 16);
@@ -576,8 +592,8 @@
             for (int i = 0; i < out_len; i++) {
                 int x = ((in_buff[ix++] & 0xFF) << 16)
                         | ((in_buff[ix++] & 0xFF) << 8) | (in_buff[ix++] & 0xFF);
-                x -= 0x7FFFFF;
-                out_buff[ox++] = x * (1.0f / (float)0x7FFFFF);
+                x -= 0x800000;
+                out_buff[ox++] = x > 0 ? x / 8388607.0f : x / 8388608.0f;
             }
             return out_buff;
         }
@@ -587,8 +603,9 @@
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
-                int x = (int) (in_buff[ix++] * (float)0x7FFFFF);
-                x += 0x7FFFFF;
+                float f = in_buff[ix++];
+                int x = (int) (f > 0 ? f * 8388607.0f : f * 8388608.0f);
+                x += 8388608;
                 out_buff[ox++] = (byte) (x >>> 16);
                 out_buff[ox++] = (byte) (x >>> 8);
                 out_buff[ox++] = (byte) x;
@@ -673,7 +690,7 @@
                 int x = (in_buff[ix++] & 0xFF) | ((in_buff[ix++] & 0xFF) << 8) |
                         ((in_buff[ix++] & 0xFF) << 16) |
                         ((in_buff[ix++] & 0xFF) << 24);
-                x -= 0x7FFFFFFF;
+                x -= 0x80000000;
                 out_buff[ox++] = x * (1.0f / (float)0x7FFFFFFF);
             }
             return out_buff;
@@ -685,7 +702,7 @@
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
                 int x = (int) (in_buff[ix++] * (float)0x7FFFFFFF);
-                x += 0x7FFFFFFF;
+                x += 0x80000000;
                 out_buff[ox++] = (byte) x;
                 out_buff[ox++] = (byte) (x >>> 8);
                 out_buff[ox++] = (byte) (x >>> 16);
@@ -706,7 +723,7 @@
                 int x = ((in_buff[ix++] & 0xFF) << 24) |
                         ((in_buff[ix++] & 0xFF) << 16) |
                         ((in_buff[ix++] & 0xFF) << 8) | (in_buff[ix++] & 0xFF);
-                x -= 0x7FFFFFFF;
+                x -= 0x80000000;
                 out_buff[ox++] = x * (1.0f / (float)0x7FFFFFFF);
             }
             return out_buff;
@@ -718,7 +735,7 @@
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
                 int x = (int) (in_buff[ix++] * (float)0x7FFFFFFF);
-                x += 0x7FFFFFFF;
+                x += 0x80000000;
                 out_buff[ox++] = (byte) (x >>> 24);
                 out_buff[ox++] = (byte) (x >>> 16);
                 out_buff[ox++] = (byte) (x >>> 8);
@@ -737,7 +754,7 @@
     // PCM 32+ bit, signed, little-endian
     private static class AudioFloatConversion32xSL extends AudioFloatConverter {
 
-        final int xbytes;
+        private final int xbytes;
 
         AudioFloatConversion32xSL(int xbytes) {
             this.xbytes = xbytes;
@@ -778,7 +795,7 @@
     // PCM 32+ bit, signed, big-endian
     private static class AudioFloatConversion32xSB extends AudioFloatConverter {
 
-        final int xbytes;
+        private final int xbytes;
 
         AudioFloatConversion32xSB(int xbytes) {
             this.xbytes = xbytes;
@@ -820,7 +837,7 @@
     // PCM 32+ bit, unsigned, little-endian
     private static class AudioFloatConversion32xUL extends AudioFloatConverter {
 
-        final int xbytes;
+        private final int xbytes;
 
         AudioFloatConversion32xUL(int xbytes) {
             this.xbytes = xbytes;
@@ -835,7 +852,7 @@
                 int x = (in_buff[ix++] & 0xFF) | ((in_buff[ix++] & 0xFF) << 8)
                         | ((in_buff[ix++] & 0xFF) << 16)
                         | ((in_buff[ix++] & 0xFF) << 24);
-                x -= 0x7FFFFFFF;
+                x -= 0x80000000;
                 out_buff[ox++] = x * (1.0f / (float)0x7FFFFFFF);
             }
             return out_buff;
@@ -847,7 +864,7 @@
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
                 int x = (int) (in_buff[ix++] * (float)0x7FFFFFFF);
-                x += 0x7FFFFFFF;
+                x += 0x80000000;
                 for (int j = 0; j < xbytes; j++) {
                     out_buff[ox++] = 0;
                 }
@@ -863,7 +880,7 @@
     // PCM 32+ bit, unsigned, big-endian
     private static class AudioFloatConversion32xUB extends AudioFloatConverter {
 
-        final int xbytes;
+        private final int xbytes;
 
         AudioFloatConversion32xUB(int xbytes) {
             this.xbytes = xbytes;
@@ -878,7 +895,7 @@
                         ((in_buff[ix++] & 0xFF) << 16) |
                         ((in_buff[ix++] & 0xFF) << 8) | (in_buff[ix++] & 0xFF);
                 ix += xbytes;
-                x -= 2147483647;
+                x -= 0x80000000;
                 out_buff[ox++] = x * (1.0f / 2147483647.0f);
             }
             return out_buff;
@@ -889,8 +906,8 @@
             int ix = in_offset;
             int ox = out_offset;
             for (int i = 0; i < in_len; i++) {
-                int x = (int) (in_buff[ix++] * 2147483647.0);
-                x += 2147483647;
+                int x = (int) (in_buff[ix++] * 2147483647.0f);
+                x += 0x80000000;
                 out_buff[ox++] = (byte) (x >>> 24);
                 out_buff[ox++] = (byte) (x >>> 16);
                 out_buff[ox++] = (byte) (x >>> 8);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java	Tue Apr 05 09:17:15 2016 -0700
@@ -25,8 +25,6 @@
 
 package com.sun.media.sound;
 
-import sun.misc.ManagedLocalsThread;
-
 import java.io.BufferedInputStream;
 import java.io.InputStream;
 import java.io.File;
@@ -145,12 +143,11 @@
     static Thread createThread(final Runnable runnable,
                                final String threadName,
                                final boolean isDaemon, final int priority,
-                               final boolean doStart) {
-        Thread thread = new ManagedLocalsThread(runnable);
+                               final boolean doStart)
+    {
+        String name = (threadName != null) ? threadName : "JSSM Thread";
+        Thread thread = new Thread(null, runnable, threadName, 0, false);
 
-        if (threadName != null) {
-            thread.setName(threadName);
-        }
         thread.setDaemon(isDaemon);
         if (priority >= 0) {
             thread.setPriority(priority);
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, 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
@@ -232,7 +232,7 @@
         } else if (sequencer != null) {
             try {
                 sequencerloop = false;
-                sequencer.addMetaEventListener(this);
+                sequencer.removeMetaEventListener(this);
                 sequencer.stop();
             } catch (Exception e3) {
                 if (Printer.err) e3.printStackTrace();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftAudioPusher.java	Tue Apr 05 09:17:15 2016 -0700
@@ -24,8 +24,6 @@
  */
 package com.sun.media.sound;
 
-import sun.misc.ManagedLocalsThread;
-
 import java.io.IOException;
 
 import javax.sound.sampled.AudioInputStream;
@@ -55,7 +53,7 @@
         if (active)
             return;
         active = true;
-        audiothread = new ManagedLocalsThread(this);
+        audiothread = new Thread(null, this, "AudioPusher", 0, false);
         audiothread.setDaemon(true);
         audiothread.setPriority(Thread.MAX_PRIORITY);
         audiothread.start();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftJitterCorrector.java	Tue Apr 05 09:17:15 2016 -0700
@@ -24,8 +24,6 @@
  */
 package com.sun.media.sound;
 
-import sun.misc.ManagedLocalsThread;
-
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioInputStream;
 import java.io.EOFException;
@@ -216,7 +214,7 @@
                 }
             };
 
-            thread = new ManagedLocalsThread(runnable);
+            thread = new Thread(null, runnable, "JitterCorrector", 0, false);
             thread.setDaemon(true);
             thread.setPriority(Thread.MAX_PRIORITY);
             thread.start();
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -25,8 +25,6 @@
 
 package com.sun.media.sound;
 
-import sun.misc.ManagedLocalsThread;
-
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -141,7 +139,7 @@
                      pusher = null;
                      jitter_stream = null;
                      sourceDataLine = null;
-                     new ManagedLocalsThread(runnable).start();
+                     new Thread(null, runnable, "Synthesizer",0,false).start();
                  }
                  return len;
              }
--- a/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java	Tue Apr 05 09:17:15 2016 -0700
@@ -31,7 +31,6 @@
 
 import java.util.ArrayList;
 
-import sun.misc.ManagedLocalsThread;
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.dnd.SunDragSourceContextPeer;
@@ -55,7 +54,7 @@
  *
  * @since 1.1
  */
-class EventDispatchThread extends ManagedLocalsThread {
+class EventDispatchThread extends Thread {
 
     private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.EventDispatchThread");
 
@@ -66,8 +65,16 @@
 
     private ArrayList<EventFilter> eventFilters = new ArrayList<EventFilter>();
 
+   /**
+    * Must always call 5 args super-class constructor passing false
+    * to indicate not to inherit locals.
+    */
+    private EventDispatchThread() {
+        throw new UnsupportedOperationException("Must erase locals");
+    }
+
     EventDispatchThread(ThreadGroup group, String name, EventQueue queue) {
-        super(group, name);
+        super(group, null, name, 0, false);
         setEventQueue(queue);
     }
 
--- a/jdk/src/java.desktop/share/classes/java/awt/image/PackedColorModel.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/PackedColorModel.java	Tue Apr 05 09:17:15 2016 -0700
@@ -404,9 +404,6 @@
 
         PackedColorModel cm = (PackedColorModel) obj;
         int numC = cm.getNumComponents();
-        if (numC != numComponents) {
-            return false;
-        }
         for(int i=0; i < numC; i++) {
             if (maskArray[i] != cm.getMask(i)) {
                 return false;
--- a/jdk/src/java.desktop/share/classes/java/awt/image/Raster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/Raster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -629,7 +629,8 @@
                                                          int scanlineStride,
                                                          int pixelStride,
                                                          int bandOffsets[],
-                                                         Point location) {
+                                                         Point location)
+    {
         if (dataBuffer == null) {
             throw new NullPointerException("DataBuffer cannot be null");
         }
@@ -645,15 +646,26 @@
                                             bandOffsets);
         switch(dataType) {
         case DataBuffer.TYPE_BYTE:
-            return new ByteInterleavedRaster(csm, dataBuffer, location);
+            if (dataBuffer instanceof DataBufferByte) {
+                return new ByteInterleavedRaster(csm,
+                        (DataBufferByte) dataBuffer, location);
+            }
+            break;
 
         case DataBuffer.TYPE_USHORT:
-            return new ShortInterleavedRaster(csm, dataBuffer, location);
+            if (dataBuffer instanceof DataBufferUShort) {
+                return new ShortInterleavedRaster(csm,
+                        (DataBufferUShort) dataBuffer, location);
+            }
+            break;
 
         default:
             throw new IllegalArgumentException("Unsupported data type " +
                                                 dataType);
         }
+
+        // Create the generic raster
+        return new SunWritableRaster(csm, dataBuffer, location);
     }
 
     /**
@@ -691,7 +703,8 @@
                                                     int scanlineStride,
                                                     int bankIndices[],
                                                     int bandOffsets[],
-                                                    Point location) {
+                                                    Point location)
+    {
         if (dataBuffer == null) {
             throw new NullPointerException("DataBuffer cannot be null");
         }
@@ -713,18 +726,29 @@
 
         switch(dataType) {
         case DataBuffer.TYPE_BYTE:
-            return new ByteBandedRaster(bsm, dataBuffer, location);
+            if (dataBuffer instanceof DataBufferByte) {
+                return new ByteBandedRaster(bsm,
+                        (DataBufferByte) dataBuffer, location);
+            }
+            break;
 
         case DataBuffer.TYPE_USHORT:
-            return new ShortBandedRaster(bsm, dataBuffer, location);
+            if (dataBuffer instanceof DataBufferUShort) {
+                return new ShortBandedRaster(bsm,
+                        (DataBufferUShort) dataBuffer, location);
+            }
+            break;
 
         case DataBuffer.TYPE_INT:
-            return new SunWritableRaster(bsm, dataBuffer, location);
+            break;
 
         default:
             throw new IllegalArgumentException("Unsupported data type " +
                                                 dataType);
         }
+
+        // Create the generic raster
+        return new SunWritableRaster(bsm, dataBuffer, location);
     }
 
     /**
@@ -761,7 +785,8 @@
                                                     int w, int h,
                                                     int scanlineStride,
                                                     int bandMasks[],
-                                                    Point location) {
+                                                    Point location)
+    {
         if (dataBuffer == null) {
             throw new NullPointerException("DataBuffer cannot be null");
         }
@@ -776,18 +801,33 @@
 
         switch(dataType) {
         case DataBuffer.TYPE_BYTE:
-            return new ByteInterleavedRaster(sppsm, dataBuffer, location);
+            if (dataBuffer instanceof DataBufferByte) {
+                return new ByteInterleavedRaster(sppsm,
+                        (DataBufferByte) dataBuffer, location);
+            }
+            break;
 
         case DataBuffer.TYPE_USHORT:
-            return new ShortInterleavedRaster(sppsm, dataBuffer, location);
+            if (dataBuffer instanceof DataBufferUShort) {
+                return new ShortInterleavedRaster(sppsm,
+                        (DataBufferUShort) dataBuffer, location);
+            }
+            break;
 
         case DataBuffer.TYPE_INT:
-            return new IntegerInterleavedRaster(sppsm, dataBuffer, location);
+            if (dataBuffer instanceof DataBufferInt) {
+                return new IntegerInterleavedRaster(sppsm,
+                        (DataBufferInt) dataBuffer, location);
+            }
+            break;
 
         default:
             throw new IllegalArgumentException("Unsupported data type " +
                                                 dataType);
         }
+
+        // Create the generic raster
+        return new SunWritableRaster(sppsm, dataBuffer, location);
     }
 
     /**
@@ -821,7 +861,8 @@
     public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
                                                     int w, int h,
                                                     int bitsPerPixel,
-                                                    Point location) {
+                                                    Point location)
+    {
         if (dataBuffer == null) {
             throw new NullPointerException("DataBuffer cannot be null");
         }
@@ -846,9 +887,10 @@
         MultiPixelPackedSampleModel mppsm =
                 new MultiPixelPackedSampleModel(dataType, w, h, bitsPerPixel);
 
-        if (dataType == DataBuffer.TYPE_BYTE &&
-            (bitsPerPixel == 1 || bitsPerPixel == 2 || bitsPerPixel == 4)) {
-            return new BytePackedRaster(mppsm, dataBuffer, location);
+        if (dataBuffer instanceof DataBufferByte &&
+            (bitsPerPixel == 1 || bitsPerPixel == 2 || bitsPerPixel == 4))
+        {
+            return new BytePackedRaster(mppsm, (DataBufferByte) dataBuffer, location);
         } else {
             return new SunWritableRaster(mppsm, dataBuffer, location);
         }
@@ -878,7 +920,8 @@
      */
     public static Raster createRaster(SampleModel sm,
                                       DataBuffer db,
-                                      Point location) {
+                                      Point location)
+    {
         if ((sm == null) || (db == null)) {
             throw new NullPointerException("SampleModel and DataBuffer cannot be null");
         }
@@ -890,32 +933,53 @@
 
         if (sm instanceof PixelInterleavedSampleModel) {
             switch(dataType) {
-                case DataBuffer.TYPE_BYTE:
-                    return new ByteInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_BYTE:
+                if (db instanceof DataBufferByte) {
+                    return new ByteInterleavedRaster(sm,
+                            (DataBufferByte) db, location);
+                }
+                break;
 
-                case DataBuffer.TYPE_USHORT:
-                    return new ShortInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_USHORT:
+                if (db instanceof DataBufferUShort) {
+                    return new ShortInterleavedRaster(sm,
+                            (DataBufferUShort) db, location);
+                }
+                break;
             }
         } else if (sm instanceof SinglePixelPackedSampleModel) {
             switch(dataType) {
-                case DataBuffer.TYPE_BYTE:
-                    return new ByteInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_BYTE:
+                if (db instanceof DataBufferByte) {
+                    return new ByteInterleavedRaster(sm,
+                            (DataBufferByte) db, location);
+                }
+                break;
 
-                case DataBuffer.TYPE_USHORT:
-                    return new ShortInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_USHORT:
+                if (db instanceof DataBufferUShort) {
+                    return new ShortInterleavedRaster(sm,
+                            (DataBufferUShort) db, location);
+                }
+                break;
 
-                case DataBuffer.TYPE_INT:
-                    return new IntegerInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_INT:
+                if (db instanceof DataBufferInt) {
+                    return new IntegerInterleavedRaster(sm,
+                            (DataBufferInt) db, location);
+                }
+                break;
             }
         } else if (sm instanceof MultiPixelPackedSampleModel &&
                    dataType == DataBuffer.TYPE_BYTE &&
-                   sm.getSampleSize(0) < 8) {
-            return new BytePackedRaster(sm, db, location);
+                   db instanceof DataBufferByte &&
+                   sm.getSampleSize(0) < 8)
+        {
+            return new BytePackedRaster(sm, (DataBufferByte) db, location);
         }
 
         // we couldn't do anything special - do the generic thing
-
-        return new Raster(sm,db,location);
+        return new Raster(sm, db, location);
     }
 
     /**
@@ -964,7 +1028,8 @@
      */
     public static WritableRaster createWritableRaster(SampleModel sm,
                                                       DataBuffer db,
-                                                      Point location) {
+                                                      Point location)
+    {
         if ((sm == null) || (db == null)) {
             throw new NullPointerException("SampleModel and DataBuffer cannot be null");
         }
@@ -976,32 +1041,53 @@
 
         if (sm instanceof PixelInterleavedSampleModel) {
             switch(dataType) {
-                case DataBuffer.TYPE_BYTE:
-                    return new ByteInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_BYTE:
+                if (db instanceof DataBufferByte) {
+                    return new ByteInterleavedRaster(sm,
+                            (DataBufferByte) db, location);
+                }
+                break;
 
-                case DataBuffer.TYPE_USHORT:
-                    return new ShortInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_USHORT:
+                if (db instanceof DataBufferUShort) {
+                    return new ShortInterleavedRaster(sm,
+                            (DataBufferUShort) db, location);
+                }
+                break;
             }
         } else if (sm instanceof SinglePixelPackedSampleModel) {
             switch(dataType) {
-                case DataBuffer.TYPE_BYTE:
-                    return new ByteInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_BYTE:
+                if (db instanceof DataBufferByte) {
+                    return new ByteInterleavedRaster(sm,
+                            (DataBufferByte) db, location);
+                }
+                break;
 
-                case DataBuffer.TYPE_USHORT:
-                    return new ShortInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_USHORT:
+                if (db instanceof DataBufferUShort) {
+                    return new ShortInterleavedRaster(sm,
+                            (DataBufferUShort) db, location);
+                }
+                break;
 
-                case DataBuffer.TYPE_INT:
-                    return new IntegerInterleavedRaster(sm, db, location);
+            case DataBuffer.TYPE_INT:
+                if (db instanceof DataBufferInt) {
+                    return new IntegerInterleavedRaster(sm,
+                            (DataBufferInt) db, location);
+                }
+                break;
             }
         } else if (sm instanceof MultiPixelPackedSampleModel &&
                    dataType == DataBuffer.TYPE_BYTE &&
-                   sm.getSampleSize(0) < 8) {
-            return new BytePackedRaster(sm, db, location);
+                   db instanceof DataBufferByte &&
+                   sm.getSampleSize(0) < 8)
+        {
+            return new BytePackedRaster(sm, (DataBufferByte) db, location);
         }
 
         // we couldn't do anything special - do the generic thing
-
-        return new SunWritableRaster(sm,db,location);
+        return new SunWritableRaster(sm, db, location);
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -35,8 +35,6 @@
 
 package java.awt.image.renderable;
 
-import sun.misc.ManagedLocalsThread;
-
 import java.awt.image.ColorModel;
 import java.awt.image.DataBuffer;
 import java.awt.image.ImageConsumer;
@@ -137,7 +135,7 @@
         addConsumer(ic);
         // Need to build a runnable object for the Thread.
         String name = "RenderableImageProducer Thread";
-        Thread thread = new ManagedLocalsThread(this, name);
+        Thread thread = new Thread(null, this, name, 0, false);
         thread.start();
     }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JFileChooser.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,12 @@
 
 import javax.swing.event.*;
 import javax.swing.filechooser.*;
+import javax.swing.filechooser.FileFilter;
 import javax.swing.plaf.FileChooserUI;
 
 import javax.accessibility.*;
 
-import java.io.File;
-import java.io.ObjectOutputStream;
-import java.io.IOException;
+import java.io.*;
 
 import java.util.Vector;
 import java.awt.AWTEvent;
@@ -51,8 +50,6 @@
 import java.beans.BeanProperty;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
-import java.io.InvalidObjectException;
-import java.io.ObjectInputStream;
 import java.lang.ref.WeakReference;
 
 /**
@@ -390,19 +387,7 @@
     }
 
     private void installHierarchyListener() {
-        addHierarchyListener(new HierarchyListener() {
-            @Override
-            public void hierarchyChanged(HierarchyEvent e) {
-                if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED)
-                        == HierarchyEvent.PARENT_CHANGED) {
-                    JFileChooser fc = JFileChooser.this;
-                    JRootPane rootPane = SwingUtilities.getRootPane(fc);
-                    if (rootPane != null) {
-                        rootPane.setDefaultButton(fc.getUI().getDefaultButton(fc));
-                    }
-                }
-            }
-        });
+        addHierarchyListener(new FCHierarchyListener());
     }
 
     private void installShowFilesListener() {
@@ -2055,4 +2040,18 @@
 
     } // inner class AccessibleJFileChooser
 
+    private class FCHierarchyListener implements HierarchyListener,
+            Serializable {
+        @Override
+        public void hierarchyChanged(HierarchyEvent e) {
+            if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED)
+                    == HierarchyEvent.PARENT_CHANGED) {
+                JFileChooser fc = JFileChooser.this;
+                JRootPane rootPane = SwingUtilities.getRootPane(fc);
+                if (rootPane != null) {
+                    rootPane.setDefaultButton(fc.getUI().getDefaultButton(fc));
+                }
+            }
+        }
+    }
 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTable.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTable.java	Tue Apr 05 09:17:15 2016 -0700
@@ -56,7 +56,6 @@
 import javax.print.attribute.*;
 import javax.print.PrintService;
 
-import sun.misc.ManagedLocalsThread;
 import sun.reflect.misc.ReflectUtil;
 
 import sun.swing.SwingUtilities2;
@@ -6375,7 +6374,7 @@
         };
 
         // start printing on another thread
-        Thread th = new ManagedLocalsThread(runnable);
+        Thread th = new Thread(null, runnable, "JTablePrint", 0, false);
         th.start();
 
         printingStatus.showModal(true);
--- a/jdk/src/java.desktop/share/classes/javax/swing/TimerQueue.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/TimerQueue.java	Tue Apr 05 09:17:15 2016 -0700
@@ -36,7 +36,6 @@
 import java.util.concurrent.locks.*;
 import java.util.concurrent.atomic.AtomicLong;
 import sun.awt.AppContext;
-import sun.misc.ManagedLocalsThread;
 
 /**
  * Internal class to manage all Timers using one thread.
@@ -101,8 +100,8 @@
                 final ThreadGroup threadGroup = AppContext.getAppContext().getThreadGroup();
                 AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
                     String name = "TimerQueue";
-                    Thread timerThread = new ManagedLocalsThread(threadGroup,
-                                                                 this, name);
+                    Thread timerThread =
+                        new Thread(threadGroup, this, name, 0, false);
                     timerThread.setDaemon(true);
                     timerThread.setPriority(Thread.NORM_PRIORITY);
                     timerThread.start();
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java	Tue Apr 05 09:17:15 2016 -0700
@@ -26,7 +26,6 @@
 package javax.swing.plaf.basic;
 
 import sun.awt.shell.ShellFolder;
-import sun.misc.ManagedLocalsThread;
 
 import javax.swing.*;
 import javax.swing.event.ListDataEvent;
@@ -271,7 +270,7 @@
             this.currentDirectory = currentDirectory;
             this.fid = fid;
             String name = "Basic L&F File Loading Thread";
-            this.loadThread = new ManagedLocalsThread(this, name);
+            this.loadThread = new Thread(null, this, name, 0, false);
             this.loadThread.start();
         }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthStyle.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthStyle.java	Tue Apr 05 09:17:15 2016 -0700
@@ -775,7 +775,7 @@
                 if (disabledColor == null || disabledColor instanceof UIResource) {
                     return getColorForState(context, type);
                 }
-            } else if (c instanceof JLabel &&
+            } else if ((c instanceof JLabel || c instanceof JMenuItem) &&
                             (type == ColorType.FOREGROUND ||
                              type == ColorType.TEXT_FOREGROUND)) {
                 return getColorForState(context, type);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java	Tue Apr 05 09:17:15 2016 -0700
@@ -70,7 +70,6 @@
 import sun.awt.AppContext;
 
 
-import sun.misc.ManagedLocalsThread;
 import sun.swing.PrintingStatus;
 import sun.swing.SwingUtilities2;
 import sun.swing.text.TextComponentPrintable;
@@ -2353,7 +2352,8 @@
             runnablePrinting.run();
         } else {
             if (isEventDispatchThread) {
-                new ManagedLocalsThread(runnablePrinting).start();
+                new Thread(null, runnablePrinting,
+                           "JTextComponentPrint", 0, false ).start();
                 printingStatus.showModal(true);
             } else {
                 printingStatus.showModal(false);
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/LayoutQueue.java	Tue Apr 05 09:17:15 2016 -0700
@@ -26,7 +26,6 @@
 
 import java.util.Vector;
 import sun.awt.AppContext;
-import sun.misc.ManagedLocalsThread;
 
 /**
  * A queue of text layout tasks.
@@ -92,7 +91,7 @@
                     }
                 } while (work != null);
             };
-            worker = new ManagedLocalsThread(workerRunnable, "text-layout");
+            worker = new Thread(null, workerRunnable, "text-layout", 0, false);
             worker.setPriority(Thread.MIN_PRIORITY);
             worker.start();
         }
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, 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
@@ -1522,8 +1522,16 @@
                 current++;
             }
             last = current;
-            while (current < length && !Character.isWhitespace
-                   (value.charAt(current))) {
+            int inParentheses = 0;
+            char ch;
+            while (current < length && (
+                    !Character.isWhitespace(ch = value.charAt(current))
+                            || inParentheses > 0)) {
+                if (ch == '(') {
+                    inParentheses++;
+                } else if (ch == ')') {
+                    inParentheses--;
+                }
                 current++;
             }
             if (last != current) {
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java	Tue Apr 05 09:17:15 2016 -0700
@@ -52,7 +52,6 @@
 import java.security.PermissionCollection;
 import sun.awt.AppContext;
 import sun.awt.SunToolkit;
-import sun.misc.ManagedLocalsThread;
 import sun.net.www.ParseUtil;
 import sun.security.util.SecurityConstants;
 
@@ -858,13 +857,20 @@
  * this operation to complete before continuing, wait for the notifyAll()
  * operation on the syncObject to occur.
  */
-class AppContextCreator extends ManagedLocalsThread {
+class AppContextCreator extends Thread {
     Object syncObject = new Object();
     AppContext appContext = null;
     volatile boolean created = false;
 
+    /**
+     * Must call the 5-args super-class constructor to erase locals.
+     */
+    private AppContextCreator() {
+        throw new UnsupportedOperationException("Must erase locals");
+    }
+
     AppContextCreator(ThreadGroup group)  {
-        super(group, "AppContextCreator");
+        super(group, null, "AppContextCreator", 0, false);
     }
 
     public void run()  {
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Tue Apr 05 09:17:15 2016 -0700
@@ -44,7 +44,6 @@
 import sun.awt.EmbeddedFrame;
 import sun.awt.SunToolkit;
 import sun.awt.util.PerformanceLogger;
-import sun.misc.ManagedLocalsThread;
 import sun.security.util.SecurityConstants;
 
 /**
@@ -166,7 +165,7 @@
 
 
         ThreadGroup appletGroup = loader.getThreadGroup();
-        handler = new ManagedLocalsThread(appletGroup, this, "thread " + nm);
+        handler = new Thread(appletGroup, this, "thread " + nm, 0, false);
         // set the context class loader for this thread
         AccessController.doPrivileged(new PrivilegedAction<Object>() {
                 @Override
@@ -396,9 +395,8 @@
                       // until the loader thread terminates.
                       // (one way or another).
                       if (loaderThread == null) {
-                          // REMIND: do we want a name?
-                          //System.out.println("------------------- loading applet");
-                          setLoaderThread(new ManagedLocalsThread(this));
+                          setLoaderThread(new Thread(null, this,
+                                          "AppletLoader", 0, false));
                           loaderThread.start();
                           // we get to go to sleep while this runs
                           loaderThread.join();
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -38,7 +38,6 @@
 import java.security.PrivilegedAction;
 import sun.awt.SunToolkit;
 import sun.awt.AppContext;
-import sun.misc.ManagedLocalsThread;
 
 /**
  * A frame to show the applet tag in.
@@ -854,7 +853,7 @@
         //
         final AppletPanel p = panel;
 
-        new ManagedLocalsThread(new Runnable()
+        new Thread(null, new Runnable()
         {
             @Override
             public void run()
@@ -867,7 +866,8 @@
                     appletSystemExit();
                 }
             }
-        }).start();
+        },
+        "AppletCloser", 0, false).start();
     }
 
     /**
@@ -890,7 +890,7 @@
         // spawn a new thread to avoid blocking the event queue
         // when calling appletShutdown.
         //
-        new ManagedLocalsThread(new Runnable()
+        new Thread(null, new Runnable()
         {
             @Override
             public void run()
@@ -901,7 +901,8 @@
                 }
                 appletSystemExit();
             }
-        }).start();
+        },
+         "AppletQuit", 0, false).start();
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/AWTAutoShutdown.java	Tue Apr 05 09:17:15 2016 -0700
@@ -34,7 +34,6 @@
 import java.util.Set;
 
 import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
 import sun.util.logging.PlatformLogger;
 
 /**
@@ -337,8 +336,8 @@
     private void activateBlockerThread() {
         AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
             String name = "AWT-Shutdown";
-            Thread thread = new ManagedLocalsThread(
-                    ThreadGroupUtils.getRootThreadGroup(), this, name);
+            Thread thread = new Thread(
+                   ThreadGroupUtils.getRootThreadGroup(), this, name, 0, false);
             thread.setContextClassLoader(null);
             thread.setDaemon(false);
             blockerThread = thread;
--- a/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/AppContext.java	Tue Apr 05 09:17:15 2016 -0700
@@ -46,7 +46,6 @@
 
 import jdk.internal.misc.JavaAWTAccess;
 import jdk.internal.misc.SharedSecrets;
-import sun.misc.ManagedLocalsThread;
 import sun.util.logging.PlatformLogger;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
@@ -598,8 +597,8 @@
         }
 
         public Thread run() {
-            Thread t = new ManagedLocalsThread(appContext.getThreadGroup(),
-                                               runnable, "AppContext Disposer");
+            Thread t = new Thread(appContext.getThreadGroup(),
+                                  runnable, "AppContext Disposer", 0, false);
             t.setContextClassLoader(appContext.getContextClassLoader());
             t.setPriority(Thread.NORM_PRIORITY + 1);
             t.setDaemon(true);
--- a/jdk/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/im/InputMethodManager.java	Tue Apr 05 09:17:15 2016 -0700
@@ -55,7 +55,6 @@
 import java.util.prefs.Preferences;
 import sun.awt.InputMethodSupport;
 import sun.awt.SunToolkit;
-import sun.misc.ManagedLocalsThread;
 
 /**
  * {@code InputMethodManager} is an abstract class that manages the input
@@ -166,7 +165,8 @@
                 // to choose from. Otherwise, just keep the instance.
                 if (imm.hasMultipleInputMethods()) {
                     imm.initialize();
-                    Thread immThread = new ManagedLocalsThread(imm, threadName);
+                    Thread immThread =
+                        new Thread(null, imm, threadName, 0, false);
                     immThread.setDaemon(true);
                     immThread.setPriority(Thread.NORM_PRIORITY + 1);
                     immThread.start();
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
 import java.awt.image.RasterFormatException;
 import java.awt.image.SampleModel;
 import java.awt.image.BandedSampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferByte;
 import java.awt.Rectangle;
 import java.awt.Point;
@@ -74,10 +73,9 @@
      *  @param sampleModel     The SampleModel that specifies the layout.
      *  @param origin          The Point that specifies the origin.
      */
-    public ByteBandedRaster(SampleModel sampleModel,
-                               Point origin) {
+    public ByteBandedRaster(SampleModel sampleModel, Point origin) {
         this(sampleModel,
-             sampleModel.createDataBuffer(),
+             (DataBufferByte) sampleModel.createDataBuffer(),
              new Rectangle(origin.x,
                            origin.y,
                            sampleModel.getWidth(),
@@ -93,12 +91,13 @@
      *  initialized and must be a DataBufferShort compatible with SampleModel.
      *  SampleModel must be of type BandedSampleModel.
      *  @param sampleModel     The SampleModel that specifies the layout.
-     *  @param dataBuffer      The DataBufferShort that contains the image data.
+     *  @param dataBuffer      The DataBufferByte that contains the image data.
      *  @param origin          The Point that specifies the origin.
      */
     public ByteBandedRaster(SampleModel sampleModel,
-                               DataBuffer dataBuffer,
-                               Point origin) {
+                            DataBufferByte dataBuffer,
+                            Point origin)
+    {
         this(sampleModel, dataBuffer,
              new Rectangle(origin.x , origin.y,
                            sampleModel.getWidth(),
@@ -119,39 +118,33 @@
      *  Note that this constructor should generally be called by other
      *  constructors or create methods, it should not be used directly.
      *  @param sampleModel     The SampleModel that specifies the layout.
-     *  @param dataBuffer      The DataBufferShort that contains the image data.
+     *  @param dataBuffer      The DataBufferByte that contains the image data.
      *  @param aRegion         The Rectangle that specifies the image area.
      *  @param origin          The Point that specifies the origin.
      *  @param parent          The parent (if any) of this raster.
      */
     public ByteBandedRaster(SampleModel sampleModel,
-                            DataBuffer dataBuffer,
+                            DataBufferByte dataBuffer,
                             Rectangle aRegion,
                             Point origin,
-                            ByteBandedRaster parent) {
-
+                            ByteBandedRaster parent)
+    {
         super(sampleModel, dataBuffer, aRegion, origin, parent);
         this.maxX = minX + width;
         this.maxY = minY + height;
 
-        if (!(dataBuffer instanceof DataBufferByte)) {
-           throw new RasterFormatException("ByteBandedRaster must have" +
-                "byte DataBuffers");
-        }
-        DataBufferByte dbb = (DataBufferByte)dataBuffer;
-
         if (sampleModel instanceof BandedSampleModel) {
             BandedSampleModel bsm = (BandedSampleModel)sampleModel;
             this.scanlineStride = bsm.getScanlineStride();
             int bankIndices[] = bsm.getBankIndices();
             int bandOffsets[] = bsm.getBandOffsets();
-            int dOffsets[] = dbb.getOffsets();
+            int dOffsets[] = dataBuffer.getOffsets();
             dataOffsets = new int[bankIndices.length];
             data = new byte[bankIndices.length][];
             int xOffset = aRegion.x - origin.x;
             int yOffset = aRegion.y - origin.y;
             for (int i = 0; i < bankIndices.length; i++) {
-               data[i] = stealData(dbb, bankIndices[i]);
+               data[i] = stealData(dataBuffer, bankIndices[i]);
                dataOffsets[i] = dOffsets[bankIndices[i]] +
                    xOffset + yOffset*scanlineStride + bandOffsets[i];
             }
@@ -672,7 +665,7 @@
         int deltaY = y0 - y;
 
         return new ByteBandedRaster(sm,
-                                    dataBuffer,
+                                    (DataBufferByte) dataBuffer,
                                     new Rectangle(x0,y0,width,height),
                                     new Point(sampleModelTranslateX+deltaX,
                                               sampleModelTranslateY+deltaY),
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ByteComponentRaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 import java.awt.image.SampleModel;
 import java.awt.image.ComponentSampleModel;
 import java.awt.image.SinglePixelPackedSampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferByte;
 import java.awt.Rectangle;
 import java.awt.Point;
@@ -94,7 +93,7 @@
      */
     public ByteComponentRaster(SampleModel sampleModel, Point origin) {
         this(sampleModel,
-             sampleModel.createDataBuffer(),
+             (DataBufferByte) sampleModel.createDataBuffer(),
              new Rectangle(origin.x,
                            origin.y,
                            sampleModel.getWidth(),
@@ -111,12 +110,13 @@
      * SampleModel must be of type SinglePixelPackedSampleModel
      * or ComponentSampleModel.
      * @param sampleModel     The SampleModel that specifies the layout.
-     * @param dataBuffer      The DataBufferShort that contains the image data.
+     * @param dataBuffer      The DataBufferByte that contains the image data.
      * @param origin          The Point that specifies the origin.
      */
     public ByteComponentRaster(SampleModel sampleModel,
-                                  DataBuffer dataBuffer,
-                                  Point origin) {
+                               DataBufferByte dataBuffer,
+                               Point origin)
+    {
         this(sampleModel,
              dataBuffer,
              new Rectangle(origin.x,
@@ -141,33 +141,28 @@
      * Note that this constructor should generally be called by other
      * constructors or create methods, it should not be used directly.
      * @param sampleModel     The SampleModel that specifies the layout.
-     * @param dataBuffer      The DataBufferShort that contains the image data.
+     * @param dataBuffer      The DataBufferByte that contains the image data.
      * @param aRegion         The Rectangle that specifies the image area.
      * @param origin          The Point that specifies the origin.
      * @param parent          The parent (if any) of this raster.
      */
     public ByteComponentRaster(SampleModel sampleModel,
-                                  DataBuffer dataBuffer,
-                                  Rectangle aRegion,
-                                  Point origin,
-                                  ByteComponentRaster parent) {
+                               DataBufferByte dataBuffer,
+                               Rectangle aRegion,
+                               Point origin,
+                               ByteComponentRaster parent)
+    {
         super(sampleModel, dataBuffer, aRegion, origin, parent);
         this.maxX = minX + width;
         this.maxY = minY + height;
 
-        if (!(dataBuffer instanceof DataBufferByte)) {
-            throw new RasterFormatException("ByteComponentRasters must have " +
-                                            "byte DataBuffers");
-        }
-
-        DataBufferByte dbb = (DataBufferByte)dataBuffer;
-        this.data = stealData(dbb, 0);
-        if (dbb.getNumBanks() != 1) {
+        this.data = stealData(dataBuffer, 0);
+        if (dataBuffer.getNumBanks() != 1) {
             throw new
                 RasterFormatException("DataBuffer for ByteComponentRasters"+
                                       " must only have 1 bank.");
         }
-        int dbOffset = dbb.getOffset();
+        int dbOffset = dataBuffer.getOffset();
 
         if (sampleModel instanceof ComponentSampleModel) {
             ComponentSampleModel ism = (ComponentSampleModel)sampleModel;
@@ -823,7 +818,7 @@
         int deltaY = y0 - y;
 
         return new ByteComponentRaster(sm,
-                                       dataBuffer,
+                                       (DataBufferByte) dataBuffer,
                                        new Rectangle(x0, y0, width, height),
                                        new Point(sampleModelTranslateX+deltaX,
                                                  sampleModelTranslateY+deltaY),
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ByteInterleavedRaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, 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
@@ -31,7 +31,6 @@
 import java.awt.image.ComponentSampleModel;
 import java.awt.image.PixelInterleavedSampleModel;
 import java.awt.image.SinglePixelPackedSampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferByte;
 import java.awt.Rectangle;
 import java.awt.Point;
@@ -87,7 +86,7 @@
      */
     public ByteInterleavedRaster(SampleModel sampleModel, Point origin) {
         this(sampleModel,
-             sampleModel.createDataBuffer(),
+             (DataBufferByte) sampleModel.createDataBuffer(),
              new Rectangle(origin.x,
                            origin.y,
                            sampleModel.getWidth(),
@@ -104,12 +103,13 @@
      * SampleModel must be of type SinglePixelPackedSampleModel
      * or InterleavedSampleModel.
      * @param sampleModel     The SampleModel that specifies the layout.
-     * @param dataBuffer      The DataBufferShort that contains the image data.
+     * @param dataBuffer      The DataBufferByte that contains the image data.
      * @param origin          The Point that specifies the origin.
      */
     public ByteInterleavedRaster(SampleModel sampleModel,
-                                  DataBuffer dataBuffer,
-                                  Point origin) {
+                                 DataBufferByte dataBuffer,
+                                 Point origin)
+    {
         this(sampleModel,
              dataBuffer,
              new Rectangle(origin.x,
@@ -178,27 +178,22 @@
      * Note that this constructor should generally be called by other
      * constructors or create methods, it should not be used directly.
      * @param sampleModel     The SampleModel that specifies the layout.
-     * @param dataBuffer      The DataBufferShort that contains the image data.
+     * @param dataBuffer      The DataBufferByte that contains the image data.
      * @param aRegion         The Rectangle that specifies the image area.
      * @param origin          The Point that specifies the origin.
      * @param parent          The parent (if any) of this raster.
      */
     public ByteInterleavedRaster(SampleModel sampleModel,
-                                  DataBuffer dataBuffer,
-                                  Rectangle aRegion,
-                                  Point origin,
-                                  ByteInterleavedRaster parent) {
+                                 DataBufferByte dataBuffer,
+                                 Rectangle aRegion,
+                                 Point origin,
+                                 ByteInterleavedRaster parent)
+    {
         super(sampleModel, dataBuffer, aRegion, origin, parent);
         this.maxX = minX + width;
         this.maxY = minY + height;
 
-        if (!(dataBuffer instanceof DataBufferByte)) {
-            throw new RasterFormatException("ByteInterleavedRasters must have " +
-                                            "byte DataBuffers");
-        }
-
-        DataBufferByte dbb = (DataBufferByte)dataBuffer;
-        this.data = stealData(dbb, 0);
+        this.data = stealData(dataBuffer, 0);
 
         int xOffset = aRegion.x - origin.x;
         int yOffset = aRegion.y - origin.y;
@@ -221,7 +216,7 @@
             this.scanlineStride = sppsm.getScanlineStride();
             this.pixelStride = 1;
             this.dataOffsets = new int[1];
-            this.dataOffsets[0] = dbb.getOffset();
+            this.dataOffsets[0] = dataBuffer.getOffset();
             dataOffsets[0] += xOffset*pixelStride+yOffset*scanlineStride;
         } else {
             throw new RasterFormatException("ByteInterleavedRasters must " +
@@ -1259,7 +1254,7 @@
         int deltaY = y0 - y;
 
         return new ByteInterleavedRaster(sm,
-                                       dataBuffer,
+                                       (DataBufferByte) dataBuffer,
                                        new Rectangle(x0, y0, width, height),
                                        new Point(sampleModelTranslateX+deltaX,
                                                  sampleModelTranslateY+deltaY),
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/BytePackedRaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -29,7 +29,6 @@
 import java.awt.image.RasterFormatException;
 import java.awt.image.SampleModel;
 import java.awt.image.MultiPixelPackedSampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferByte;
 import java.awt.Rectangle;
 import java.awt.Point;
@@ -89,10 +88,9 @@
      * @param sampleModel     The SampleModel that specifies the layout.
      * @param origin          The Point that specified the origin.
      */
-    public BytePackedRaster(SampleModel sampleModel,
-                            Point origin) {
+    public BytePackedRaster(SampleModel sampleModel, Point origin) {
         this(sampleModel,
-             sampleModel.createDataBuffer(),
+             (DataBufferByte) sampleModel.createDataBuffer(),
              new Rectangle(origin.x,
                            origin.y,
                            sampleModel.getWidth(),
@@ -108,12 +106,13 @@
      * initialized and must be a DataBufferByte compatible with SampleModel.
      * SampleModel must be of type MultiPixelPackedSampleModel.
      * @param sampleModel     The SampleModel that specifies the layout.
-     * @param dataBuffer      The DataBufferShort that contains the image data.
+     * @param dataBuffer      The DataBufferByte that contains the image data.
      * @param origin          The Point that specifies the origin.
      */
     public BytePackedRaster(SampleModel sampleModel,
-                            DataBuffer dataBuffer,
-                            Point origin) {
+                            DataBufferByte dataBuffer,
+                            Point origin)
+    {
         this(sampleModel,
              dataBuffer,
              new Rectangle(origin.x,
@@ -137,7 +136,7 @@
      * Note that this constructor should generally be called by other
      * constructors or create methods, it should not be used directly.
      * @param sampleModel     The SampleModel that specifies the layout.
-     * @param dataBuffer      The DataBufferShort that contains the image data.
+     * @param dataBuffer      The DataBufferByte that contains the image data.
      * @param aRegion         The Rectangle that specifies the image area.
      * @param origin          The Point that specifies the origin.
      * @param parent          The parent (if any) of this raster.
@@ -146,26 +145,22 @@
      * to requirements of this Raster type.
      */
     public BytePackedRaster(SampleModel sampleModel,
-                            DataBuffer dataBuffer,
+                            DataBufferByte dataBuffer,
                             Rectangle aRegion,
                             Point origin,
-                            BytePackedRaster parent){
+                            BytePackedRaster parent)
+    {
         super(sampleModel,dataBuffer,aRegion,origin, parent);
         this.maxX = minX + width;
         this.maxY = minY + height;
 
-        if (!(dataBuffer instanceof DataBufferByte)) {
-           throw new RasterFormatException("BytePackedRasters must have" +
-                "byte DataBuffers");
-        }
-        DataBufferByte dbb = (DataBufferByte)dataBuffer;
-        this.data = stealData(dbb, 0);
-        if (dbb.getNumBanks() != 1) {
+        this.data = stealData(dataBuffer, 0);
+        if (dataBuffer.getNumBanks() != 1) {
             throw new
                 RasterFormatException("DataBuffer for BytePackedRasters"+
                                       " must only have 1 bank.");
         }
-        int dbOffset = dbb.getOffset();
+        int dbOffset = dataBuffer.getOffset();
 
         if (sampleModel instanceof MultiPixelPackedSampleModel) {
             MultiPixelPackedSampleModel mppsm =
@@ -1322,7 +1317,7 @@
         int deltaY = y0 - y;
 
         return new BytePackedRaster(sm,
-                                    dataBuffer,
+                                    (DataBufferByte) dataBuffer,
                                     new Rectangle(x0, y0, width, height),
                                     new Point(sampleModelTranslateX+deltaX,
                                               sampleModelTranslateY+deltaY),
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ImageFetcher.java	Tue Apr 05 09:17:15 2016 -0700
@@ -27,7 +27,6 @@
 
 import java.util.Vector;
 import sun.awt.AppContext;
-import sun.misc.ManagedLocalsThread;
 
 /**
   * An ImageFetcher is a thread used to fetch ImageFetchable objects.
@@ -42,7 +41,7 @@
   * @author Jim Graham
   * @author Fred Ecks
   */
-class ImageFetcher extends ManagedLocalsThread {
+class ImageFetcher extends Thread {
     static final int HIGH_PRIORITY = 8;
     static final int LOW_PRIORITY = 3;
     static final int ANIM_PRIORITY = 2;
@@ -52,10 +51,17 @@
                                      // queue before an ImageFetcher dies
 
     /**
+     * We must only call the 5 args super() constructor passing
+     * in "false" to indicate to not inherit locals.
+     */
+    private ImageFetcher() {
+        throw new UnsupportedOperationException("Must erase locals");
+    }
+    /**
       * Constructor for ImageFetcher -- only called by add() below.
       */
     private ImageFetcher(ThreadGroup threadGroup, int index) {
-        super(threadGroup, "Image Fetcher " + index);
+        super(threadGroup, null, "Image Fetcher " + index, 0, false);
         setDaemon(true);
     }
 
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerComponentRaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
 import java.awt.image.RasterFormatException;
 import java.awt.image.SampleModel;
 import java.awt.image.SinglePixelPackedSampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferInt;
 import java.awt.Rectangle;
 import java.awt.Point;
@@ -107,10 +106,9 @@
      *  @param sampleModel     The SampleModel that specifies the layout.
      *  @param origin          The Point that specified the origin.
      */
-    public IntegerComponentRaster(SampleModel sampleModel,
-                                     Point origin) {
+    public IntegerComponentRaster(SampleModel sampleModel, Point origin) {
         this(sampleModel,
-             sampleModel.createDataBuffer(),
+             (DataBufferInt) sampleModel.createDataBuffer(),
              new Rectangle(origin.x,
                            origin.y,
                            sampleModel.getWidth(),
@@ -130,8 +128,9 @@
      * @param origin          The Point that specifies the origin.
      */
     public IntegerComponentRaster(SampleModel sampleModel,
-                                     DataBuffer dataBuffer,
-                                     Point origin) {
+                                  DataBufferInt dataBuffer,
+                                  Point origin)
+    {
         this(sampleModel,
              dataBuffer,
              new Rectangle(origin.x,
@@ -161,24 +160,21 @@
      * @param parent          The parent (if any) of this raster.
      */
     public IntegerComponentRaster(SampleModel sampleModel,
-                                     DataBuffer dataBuffer,
-                                     Rectangle aRegion,
-                                     Point origin,
-                                     IntegerComponentRaster parent){
+                                  DataBufferInt dataBuffer,
+                                  Rectangle aRegion,
+                                  Point origin,
+                                  IntegerComponentRaster parent)
+    {
         super(sampleModel,dataBuffer,aRegion,origin,parent);
         this.maxX = minX + width;
         this.maxY = minY + height;
-        if (!(dataBuffer instanceof DataBufferInt)) {
-           throw new RasterFormatException("IntegerComponentRasters must have" +
-                "integer DataBuffers");
-        }
-        DataBufferInt dbi = (DataBufferInt)dataBuffer;
-        if (dbi.getNumBanks() != 1) {
+
+        if (dataBuffer.getNumBanks() != 1) {
             throw new
                 RasterFormatException("DataBuffer for IntegerComponentRasters"+
                                       " must only have 1 bank.");
         }
-        this.data = stealData(dbi, 0);
+        this.data = stealData(dataBuffer, 0);
 
         if (sampleModel instanceof SinglePixelPackedSampleModel) {
             SinglePixelPackedSampleModel sppsm =
@@ -197,7 +193,7 @@
             this.scanlineStride = sppsm.getScanlineStride();
             this.pixelStride    = 1;
             this.dataOffsets = new int[1];
-            this.dataOffsets[0] = dbi.getOffset();
+            this.dataOffsets[0] = dataBuffer.getOffset();
             this.bandOffset = this.dataOffsets[0];
             int xOffset = aRegion.x - origin.x;
             int yOffset = aRegion.y - origin.y;
@@ -569,7 +565,7 @@
         int deltaY = y0 - y;
 
         return new IntegerComponentRaster(sm,
-                                          dataBuffer,
+                                          (DataBufferInt) dataBuffer,
                                           new Rectangle(x0,y0,width,height),
                                           new Point(sampleModelTranslateX+deltaX,
                                                     sampleModelTranslateY+deltaY),
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/IntegerInterleavedRaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, 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
@@ -29,7 +29,6 @@
 import java.awt.image.RasterFormatException;
 import java.awt.image.SampleModel;
 import java.awt.image.SinglePixelPackedSampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferInt;
 import java.awt.Rectangle;
 import java.awt.Point;
@@ -67,10 +66,9 @@
      *  @param sampleModel     The SampleModel that specifies the layout.
      *  @param origin          The Point that specified the origin.
      */
-    public IntegerInterleavedRaster(SampleModel sampleModel,
-                                     Point origin) {
+    public IntegerInterleavedRaster(SampleModel sampleModel, Point origin) {
         this(sampleModel,
-             sampleModel.createDataBuffer(),
+             (DataBufferInt) sampleModel.createDataBuffer(),
              new Rectangle(origin.x,
                            origin.y,
                            sampleModel.getWidth(),
@@ -90,8 +88,9 @@
      * @param origin          The Point that specifies the origin.
      */
     public IntegerInterleavedRaster(SampleModel sampleModel,
-                                     DataBuffer dataBuffer,
-                                     Point origin) {
+                                    DataBufferInt dataBuffer,
+                                    Point origin)
+    {
         this(sampleModel,
              dataBuffer,
              new Rectangle(origin.x,
@@ -121,19 +120,16 @@
      * @param parent          The parent (if any) of this raster.
      */
     public IntegerInterleavedRaster(SampleModel sampleModel,
-                                     DataBuffer dataBuffer,
-                                     Rectangle aRegion,
-                                     Point origin,
-                                     IntegerInterleavedRaster parent){
+                                    DataBufferInt dataBuffer,
+                                    Rectangle aRegion,
+                                    Point origin,
+                                    IntegerInterleavedRaster parent)
+    {
         super(sampleModel,dataBuffer,aRegion,origin,parent);
         this.maxX = minX + width;
         this.maxY = minY + height;
-        if (!(dataBuffer instanceof DataBufferInt)) {
-           throw new RasterFormatException("IntegerInterleavedRasters must have" +
-                "integer DataBuffers");
-        }
-        DataBufferInt dbi = (DataBufferInt)dataBuffer;
-        this.data = stealData(dbi, 0);
+
+        this.data = stealData(dataBuffer, 0);
 
         if (sampleModel instanceof SinglePixelPackedSampleModel) {
             SinglePixelPackedSampleModel sppsm =
@@ -141,7 +137,7 @@
             this.scanlineStride = sppsm.getScanlineStride();
             this.pixelStride    = 1;
             this.dataOffsets = new int[1];
-            this.dataOffsets[0] = dbi.getOffset();
+            this.dataOffsets[0] = dataBuffer.getOffset();
             this.bandOffset = this.dataOffsets[0];
             int xOffset = aRegion.x - origin.x;
             int yOffset = aRegion.y - origin.y;
@@ -481,7 +477,7 @@
         int deltaY = y0 - y;
 
         return new IntegerInterleavedRaster(sm,
-                                          dataBuffer,
+                                          (DataBufferInt) dataBuffer,
                                           new Rectangle(x0,y0,width,height),
                                           new Point(sampleModelTranslateX+deltaX,
                                                     sampleModelTranslateY+deltaY),
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
 import java.awt.image.RasterFormatException;
 import java.awt.image.SampleModel;
 import java.awt.image.BandedSampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferUShort;
 import java.awt.Rectangle;
 import java.awt.Point;
@@ -72,10 +71,9 @@
      * @param sampleModel     The SampleModel that specifies the layout.
      * @param origin          The Point that specified the origin.
      */
-    public ShortBandedRaster(SampleModel sampleModel,
-                                Point origin) {
+    public ShortBandedRaster(SampleModel sampleModel, Point origin) {
         this(sampleModel,
-             sampleModel.createDataBuffer(),
+             (DataBufferUShort) sampleModel.createDataBuffer(),
              new Rectangle(origin.x,
                            origin.y,
                            sampleModel.getWidth(),
@@ -95,8 +93,9 @@
      * @param origin          The Point that specifies the origin.
      */
     public ShortBandedRaster(SampleModel sampleModel,
-                                DataBuffer dataBuffer,
-                                Point origin) {
+                             DataBufferUShort dataBuffer,
+                             Point origin)
+    {
         this(sampleModel, dataBuffer,
              new Rectangle(origin.x, origin.y,
                            sampleModel.getWidth(),
@@ -123,32 +122,27 @@
      * @param parent          The parent (if any) of this raster.
      */
     public ShortBandedRaster(SampleModel sampleModel,
-                                DataBuffer dataBuffer,
-                                Rectangle aRegion,
-                                Point origin,
-                                ShortBandedRaster parent) {
-
+                             DataBufferUShort dataBuffer,
+                             Rectangle aRegion,
+                             Point origin,
+                             ShortBandedRaster parent)
+    {
         super(sampleModel, dataBuffer, aRegion, origin, parent);
         this.maxX = minX + width;
         this.maxY = minY + height;
-        if (!(dataBuffer instanceof DataBufferUShort)) {
-           throw new RasterFormatException("ShortBandedRaster must have " +
-                "ushort DataBuffers");
-        }
-        DataBufferUShort dbus = (DataBufferUShort)dataBuffer;
 
         if (sampleModel instanceof BandedSampleModel) {
             BandedSampleModel bsm = (BandedSampleModel)sampleModel;
             this.scanlineStride = bsm.getScanlineStride();
             int bankIndices[] = bsm.getBankIndices();
             int bandOffsets[] = bsm.getBandOffsets();
-            int dOffsets[] = dbus.getOffsets();
+            int dOffsets[] = dataBuffer.getOffsets();
             dataOffsets = new int[bankIndices.length];
             data = new short[bankIndices.length][];
             int xOffset = aRegion.x - origin.x;
             int yOffset = aRegion.y - origin.y;
             for (int i = 0; i < bankIndices.length; i++) {
-               data[i] = stealData(dbus, bankIndices[i]);
+               data[i] = stealData(dataBuffer, bankIndices[i]);
                dataOffsets[i] = dOffsets[bankIndices[i]] +
                    xOffset + yOffset*scanlineStride + bandOffsets[i];
             }
@@ -670,7 +664,7 @@
         int deltaY = y0 - y;
 
         return new ShortBandedRaster(sm,
-                                     dataBuffer,
+                                     (DataBufferUShort) dataBuffer,
                                      new Rectangle(x0, y0, width, height),
                                      new Point(sampleModelTranslateX+deltaX,
                                                sampleModelTranslateY+deltaY),
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ShortComponentRaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 import java.awt.image.SampleModel;
 import java.awt.image.ComponentSampleModel;
 import java.awt.image.SinglePixelPackedSampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferUShort;
 import java.awt.Rectangle;
 import java.awt.Point;
@@ -94,7 +93,7 @@
      */
     public ShortComponentRaster(SampleModel sampleModel, Point origin) {
         this(sampleModel,
-             sampleModel.createDataBuffer(),
+             (DataBufferUShort) sampleModel.createDataBuffer(),
              new Rectangle(origin.x,
                            origin.y,
                            sampleModel.getWidth(),
@@ -115,8 +114,9 @@
      * @param origin          The Point that specifies the origin.
      */
     public ShortComponentRaster(SampleModel sampleModel,
-                                   DataBuffer dataBuffer,
-                                   Point origin) {
+                                DataBufferUShort dataBuffer,
+                                Point origin)
+    {
         this(sampleModel,
              dataBuffer,
              new Rectangle(origin.x,
@@ -146,28 +146,22 @@
      * @param parent          The parent (if any) of this raster.
      */
     public ShortComponentRaster(SampleModel sampleModel,
-                                   DataBuffer dataBuffer,
-                                   Rectangle aRegion,
-                                   Point origin,
-                                   ShortComponentRaster parent) {
-
+                                DataBufferUShort dataBuffer,
+                                Rectangle aRegion,
+                                Point origin,
+                                ShortComponentRaster parent)
+    {
         super(sampleModel, dataBuffer, aRegion, origin, parent);
         this.maxX = minX + width;
         this.maxY = minY + height;
 
-        if(!(dataBuffer instanceof DataBufferUShort)) {
-            throw new RasterFormatException("ShortComponentRasters must have "+
-                                            "short DataBuffers");
-        }
-
-        DataBufferUShort dbus = (DataBufferUShort)dataBuffer;
-        this.data = stealData(dbus, 0);
-        if (dbus.getNumBanks() != 1) {
+        this.data = stealData(dataBuffer, 0);
+        if (dataBuffer.getNumBanks() != 1) {
             throw new
                 RasterFormatException("DataBuffer for ShortComponentRasters"+
                                       " must only have 1 bank.");
         }
-        int dbOffset = dbus.getOffset();
+        int dbOffset = dataBuffer.getOffset();
 
         if (sampleModel instanceof ComponentSampleModel) {
             ComponentSampleModel csm = (ComponentSampleModel)sampleModel;
@@ -758,7 +752,7 @@
         int deltaY = y0 - y;
 
         return new ShortComponentRaster(sm,
-                                       dataBuffer,
+                                       (DataBufferUShort) dataBuffer,
                                        new Rectangle(x0, y0, width, height),
                                        new Point(sampleModelTranslateX+deltaX,
                                                  sampleModelTranslateY+deltaY),
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/ShortInterleavedRaster.java	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, 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
@@ -31,7 +31,6 @@
 import java.awt.image.ComponentSampleModel;
 import java.awt.image.PixelInterleavedSampleModel;
 import java.awt.image.SinglePixelPackedSampleModel;
-import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferUShort;
 import java.awt.Rectangle;
 import java.awt.Point;
@@ -71,7 +70,7 @@
      */
     public ShortInterleavedRaster(SampleModel sampleModel, Point origin) {
         this(sampleModel,
-             sampleModel.createDataBuffer(),
+             (DataBufferUShort) sampleModel.createDataBuffer(),
              new Rectangle(origin.x,
                            origin.y,
                            sampleModel.getWidth(),
@@ -92,8 +91,9 @@
      * @param origin          The Point that specifies the origin.
      */
     public ShortInterleavedRaster(SampleModel sampleModel,
-                                   DataBuffer dataBuffer,
-                                   Point origin) {
+                                  DataBufferUShort dataBuffer,
+                                  Point origin)
+    {
         this(sampleModel,
              dataBuffer,
              new Rectangle(origin.x,
@@ -123,22 +123,17 @@
      * @param parent          The parent (if any) of this raster.
      */
     public ShortInterleavedRaster(SampleModel sampleModel,
-                                   DataBuffer dataBuffer,
-                                   Rectangle aRegion,
-                                   Point origin,
-                                   ShortInterleavedRaster parent) {
+                                  DataBufferUShort dataBuffer,
+                                  Rectangle aRegion,
+                                  Point origin,
+                                  ShortInterleavedRaster parent)
+    {
 
         super(sampleModel, dataBuffer, aRegion, origin, parent);
         this.maxX = minX + width;
         this.maxY = minY + height;
 
-        if(!(dataBuffer instanceof DataBufferUShort)) {
-            throw new RasterFormatException("ShortInterleavedRasters must "+
-                                            "have ushort DataBuffers");
-        }
-
-        DataBufferUShort dbus = (DataBufferUShort)dataBuffer;
-        this.data = stealData(dbus, 0);
+        this.data = stealData(dataBuffer, 0);
 
         // REMIND: need case for interleaved ComponentSampleModel
         if ((sampleModel instanceof PixelInterleavedSampleModel) ||
@@ -160,7 +155,7 @@
             this.scanlineStride = sppsm.getScanlineStride();
             this.pixelStride    = 1;
             this.dataOffsets = new int[1];
-            this.dataOffsets[0] = dbus.getOffset();
+            this.dataOffsets[0] = dataBuffer.getOffset();
             int xOffset = aRegion.x - origin.x;
             int yOffset = aRegion.y - origin.y;
             dataOffsets[0] += xOffset+yOffset*scanlineStride;
@@ -730,7 +725,7 @@
         int deltaY = y0 - y;
 
         return new ShortInterleavedRaster(sm,
-                                       dataBuffer,
+                                       (DataBufferUShort) dataBuffer,
                                        new Rectangle(x0, y0, width, height),
                                        new Point(sampleModelTranslateX+deltaX,
                                                  sampleModelTranslateY+deltaY),
--- a/jdk/src/java.desktop/share/classes/sun/font/CreatedFontTracker.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/font/CreatedFontTracker.java	Tue Apr 05 09:17:15 2016 -0700
@@ -36,7 +36,6 @@
 
 import sun.awt.AppContext;
 import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
 
 public class CreatedFontTracker {
 
@@ -122,8 +121,8 @@
                      * Make its parent the top-level thread group.
                      */
                     ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
-                    t = new ManagedLocalsThread(rootTG,
-                                                TempFileDeletionHook::runHooks);
+                    t = new Thread(rootTG, TempFileDeletionHook::runHooks,
+                                   "TempFontFileDeleter", 0, false);
                     /* Set context class loader to null in order to avoid
                      * keeping a strong reference to an application classloader.
                      */
--- a/jdk/src/java.desktop/share/classes/sun/font/SunFontManager.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/font/SunFontManager.java	Tue Apr 05 09:17:15 2016 -0700
@@ -55,7 +55,6 @@
 import sun.awt.SunToolkit;
 import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.FontSupport;
-import sun.misc.ManagedLocalsThread;
 import sun.util.logging.PlatformLogger;
 
 /**
@@ -2513,8 +2512,8 @@
                     };
                     AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
                         ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
-                        fileCloser = new ManagedLocalsThread(rootTG,
-                                                             fileCloserRunnable);
+                        fileCloser = new Thread(rootTG, fileCloserRunnable,
+                                                "FileCloser", 0, false);
                         fileCloser.setContextClassLoader(null);
                         Runtime.getRuntime().addShutdownHook(fileCloser);
                         return null;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/Disposer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/Disposer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -26,7 +26,6 @@
 package sun.java2d;
 
 import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
 
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
@@ -85,7 +84,7 @@
         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
             String name = "Java2D Disposer";
             ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
-            Thread t = new ManagedLocalsThread(rootTG, disposerInstance, name);
+            Thread t = new Thread(rootTG, disposerInstance, name, 0, false);
             t.setContextClassLoader(null);
             t.setDaemon(true);
             t.setPriority(Thread.MAX_PRIORITY);
--- a/jdk/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Tue Apr 05 09:17:15 2016 -0700
@@ -48,7 +48,6 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
-import sun.misc.ManagedLocalsThread;
 import sun.security.action.GetPropertyAction;
 
 /**
@@ -420,8 +419,9 @@
         public static void setShutdownHook() {
             AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
                 TraceReporter t = new TraceReporter();
-                Thread thread = new ManagedLocalsThread(
-                        ThreadGroupUtils.getRootThreadGroup(), t);
+                Thread thread = new Thread(
+                        ThreadGroupUtils.getRootThreadGroup(), t,
+                        "TraceReporter", 0, false);
                 thread.setContextClassLoader(null);
                 Runtime.getRuntime().addShutdownHook(thread);
                 return null;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/opengl/OGLRenderQueue.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/opengl/OGLRenderQueue.java	Tue Apr 05 09:17:15 2016 -0700
@@ -28,7 +28,6 @@
 import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.pipe.RenderBuffer;
 import sun.java2d.pipe.RenderQueue;
-import sun.misc.ManagedLocalsThread;
 
 import static sun.java2d.pipe.BufferedOpCodes.*;
 import java.security.AccessController;
@@ -161,7 +160,8 @@
 
         public QueueFlusher() {
             String name = "Java2D Queue Flusher";
-            thread = new ManagedLocalsThread(ThreadGroupUtils.getRootThreadGroup(), this, name);
+            thread = new Thread(ThreadGroupUtils.getRootThreadGroup(),
+                                this, name, 0, false);
             thread.setDaemon(true);
             thread.setPriority(Thread.MAX_PRIORITY);
             thread.start();
--- a/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/print/PrintJob2D.java	Tue Apr 05 09:17:15 2016 -0700
@@ -71,7 +71,6 @@
 import javax.print.attribute.standard.MediaSizeName;
 import javax.print.attribute.standard.PageRanges;
 
-import sun.misc.ManagedLocalsThread;
 import sun.print.SunPageSelection;
 import sun.print.SunMinMaxPage;
 
@@ -483,8 +482,30 @@
                 pageFormat.setOrientation(PageFormat.LANDSCAPE);
             } else {
                 pageFormat.setOrientation(PageFormat.PORTRAIT);
+            }
+
+            PageRanges pageRangesAttr
+                    = (PageRanges) attributes.get(PageRanges.class);
+            if (pageRangesAttr != null) {
+                // Get the PageRanges from print dialog.
+                int[][] range = pageRangesAttr.getMembers();
+
+                int prevFromPage = this.jobAttributes.getFromPage();
+                int prevToPage = this.jobAttributes.getToPage();
+
+                int currFromPage = range[0][0];
+                int currToPage = range[range.length - 1][1];
+
+                // if from < to update fromPage first followed by toPage
+                // else update toPage first followed by fromPage
+                if (currFromPage < prevToPage) {
+                    this.jobAttributes.setFromPage(currFromPage);
+                    this.jobAttributes.setToPage(currToPage);
+                } else {
+                    this.jobAttributes.setToPage(currToPage);
+                    this.jobAttributes.setFromPage(currFromPage);
                 }
-
+            }
             printerJob.setPrintable(this, pageFormat);
 
         }
@@ -987,7 +1008,8 @@
     }
 
     private void startPrinterJobThread() {
-        printerJobThread = new ManagedLocalsThread(this, "printerJobThread");
+        printerJobThread =
+            new Thread(null, this, "printerJobThread", 0, false);
         printerJobThread.start();
     }
 
--- a/jdk/src/java.desktop/share/classes/sun/print/ServiceNotifier.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceNotifier.java	Tue Apr 05 09:17:15 2016 -0700
@@ -25,8 +25,6 @@
 
 package sun.print;
 
-import sun.misc.ManagedLocalsThread;
-
 import java.util.Vector;
 
 import javax.print.PrintService;
@@ -42,15 +40,19 @@
  * to obtain the state of the attributes and notifies the listeners of
  * any changes.
  */
-class ServiceNotifier extends ManagedLocalsThread {
+class ServiceNotifier extends Thread {
 
     private PrintService service;
     private Vector<PrintServiceAttributeListener> listeners;
     private boolean stop = false;
     private PrintServiceAttributeSet lastSet;
 
+    /*
+     * If adding any other constructors, always call the 5-args
+     * super-class constructor passing "false" for inherit-locals.
+     */
     ServiceNotifier(PrintService service) {
-        super(service.getName() + " notifier");
+        super(null, null, service.getName() + " notifier", 0, false);
         this.service = service;
         listeners = new Vector<>();
         try {
@@ -70,7 +72,7 @@
         }
     }
 
-    void removeListener(PrintServiceAttributeListener listener) {
+   void removeListener(PrintServiceAttributeListener listener) {
          synchronized (this) {
             if (listener == null || listeners == null) {
                 return;
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/GtkFileDialogPeer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -29,7 +29,6 @@
 import java.io.File;
 import java.io.FilenameFilter;
 import sun.awt.AWTAccessor;
-import sun.misc.ManagedLocalsThread;
 
 /**
  * FileDialogPeer for the GtkFileChooser.
@@ -120,7 +119,7 @@
                     standaloneWindow = 0;
                     fd.setVisible(false);
                 };
-                new ManagedLocalsThread(task).start();
+                new Thread(null, task, "ShowDialog", 0, false).start();
             } else {
                 quit();
                 fd.setVisible(false);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/InfoWindow.java	Tue Apr 05 09:17:15 2016 -0700
@@ -29,7 +29,6 @@
 import java.awt.event.*;
 import java.awt.peer.TrayIconPeer;
 import sun.awt.*;
-import sun.misc.ManagedLocalsThread;
 
 import java.awt.image.*;
 import java.text.BreakIterator;
@@ -452,7 +451,7 @@
             final Thread thread;
 
             Displayer() {
-                this.thread = new ManagedLocalsThread(this);
+                this.thread = new Thread(null, this, "Displayer", 0, false);
                 this.thread.setDaemon(true);
             }
 
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTaskbarPeer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTaskbarPeer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -29,7 +29,6 @@
 import java.awt.Taskbar.Feature;
 import java.awt.peer.TaskbarPeer;
 import java.awt.event.ActionEvent;
-import sun.misc.ManagedLocalsThread;
 import java.security.AccessController;
 import sun.security.action.GetPropertyAction;
 
@@ -48,10 +47,8 @@
                                 new GetPropertyAction("java.desktop.appName", ""));
                 nativeLibraryLoaded = init(dname);
                 if (nativeLibraryLoaded) {
-                    ManagedLocalsThread t
-                            = new ManagedLocalsThread(() -> {
-                                runloop();
-                            });
+                    Thread t = new Thread(null, () -> { runloop(); },
+                                          "TaskBar", 0, false);
                     t.setDaemon(true);
                     t.start();
                 }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Tue Apr 05 09:17:15 2016 -0700
@@ -284,8 +284,8 @@
                 }
             };
             String name = "XToolkt-Shutdown-Thread";
-            Thread shutdownThread = new ManagedLocalsThread(
-                    ThreadGroupUtils.getRootThreadGroup(), r, name);
+            Thread shutdownThread = new Thread(
+                    ThreadGroupUtils.getRootThreadGroup(), r, name, 0, false);
             shutdownThread.setContextClassLoader(null);
             Runtime.getRuntime().addShutdownHook(shutdownThread);
             return null;
@@ -332,8 +332,9 @@
 
             toolkitThread = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
                 String name = "AWT-XAWT";
-                Thread thread = new ManagedLocalsThread(
-                        ThreadGroupUtils.getRootThreadGroup(), this, name);
+                Thread thread = new Thread(
+                        ThreadGroupUtils.getRootThreadGroup(), this, name,
+                        0, false);
                 thread.setContextClassLoader(null);
                 thread.setPriority(Thread.NORM_PRIORITY + 1);
                 thread.setDaemon(true);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Tue Apr 05 09:17:15 2016 -0700
@@ -44,7 +44,6 @@
 
 import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.SunGraphicsEnvironment;
-import sun.misc.ManagedLocalsThread;
 
 /**
  * This is an implementation of a GraphicsDevice object for a single
@@ -442,8 +441,8 @@
                     }
                 };
                 String name = "Display-Change-Shutdown-Thread-" + screen;
-                Thread t = new ManagedLocalsThread(
-                        ThreadGroupUtils.getRootThreadGroup(), r, name);
+                Thread t = new Thread(
+                      ThreadGroupUtils.getRootThreadGroup(), r, name, 0, false);
                 t.setContextClassLoader(null);
                 Runtime.getRuntime().addShutdownHook(t);
                 return null;
--- a/jdk/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java	Tue Apr 05 09:17:15 2016 -0700
@@ -25,8 +25,6 @@
 
 package sun.print;
 
-import sun.misc.ManagedLocalsThread;
-
 import java.io.BufferedReader;
 import java.io.FileInputStream;
 import java.io.InputStream;
@@ -213,7 +211,8 @@
     public PrintServiceLookupProvider() {
         // start the printer listener thread
         if (pollServices) {
-            Thread thr = new ManagedLocalsThread(new PrinterChangeListener());
+            Thread thr = new Thread(null, new PrinterChangeListener(),
+                                    "PrinterListener", 0, false);
             thr.setDaemon(true);
             thr.start();
             IPPPrintService.debug_println(debugPrefix+"polling turned on");
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Tue Apr 05 09:17:15 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1877,31 +1877,34 @@
 
     AWT_LOCK();
 
-    config = awt_XRRGetScreenInfo(awt_display,
-                                  RootWindow(awt_display, screen));
-    if (config != NULL) {
-        Rotation rotation;
-        short curRate;
-        SizeID curSizeIndex;
-        XRRScreenSize *sizes;
-        int nsizes;
+    if (screen < ScreenCount(awt_display)) {
 
-        curSizeIndex = awt_XRRConfigCurrentConfiguration(config, &rotation);
-        sizes = awt_XRRConfigSizes(config, &nsizes);
-        curRate = awt_XRRConfigCurrentRate(config);
+        config = awt_XRRGetScreenInfo(awt_display,
+                                      RootWindow(awt_display, screen));
+        if (config != NULL) {
+            Rotation rotation;
+            short curRate;
+            SizeID curSizeIndex;
+            XRRScreenSize *sizes;
+            int nsizes;
 
-        if ((sizes != NULL) &&
-            (curSizeIndex < nsizes))
-        {
-            XRRScreenSize curSize = sizes[curSizeIndex];
-            displayMode = X11GD_CreateDisplayMode(env,
-                                                  curSize.width,
-                                                  curSize.height,
-                                                  BIT_DEPTH_MULTI,
-                                                  curRate);
+            curSizeIndex = awt_XRRConfigCurrentConfiguration(config, &rotation);
+            sizes = awt_XRRConfigSizes(config, &nsizes);
+            curRate = awt_XRRConfigCurrentRate(config);
+
+            if ((sizes != NULL) &&
+                (curSizeIndex < nsizes))
+            {
+                XRRScreenSize curSize = sizes[curSizeIndex];
+                displayMode = X11GD_CreateDisplayMode(env,
+                                                      curSize.width,
+                                                      curSize.height,
+                                                      BIT_DEPTH_MULTI,
+                                                      curRate);
+            }
+
+            awt_XRRFreeScreenConfigInfo(config);
         }
-
-        awt_XRRFreeScreenConfigInfo(config);
     }
 
     AWT_FLUSH_UNLOCK();
--- a/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Tue Apr 05 09:17:15 2016 -0700
@@ -41,7 +41,6 @@
 import static sun.awt.shell.Win32ShellFolder2.*;
 import sun.awt.OSInfo;
 import sun.awt.util.ThreadGroupUtils;
-import sun.misc.ManagedLocalsThread;
 // NOTE: This class supersedes Win32ShellFolderManager, which was removed
 //       from distribution after version 1.4.2.
 
@@ -524,8 +523,9 @@
                 return null;
             });
             AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
-                Thread t = new ManagedLocalsThread(
-                        ThreadGroupUtils.getRootThreadGroup(), shutdownHook);
+                Thread t = new Thread(
+                        ThreadGroupUtils.getRootThreadGroup(), shutdownHook,
+                        "ShellFolder", 0, false);
                 Runtime.getRuntime().addShutdownHook(t);
                 return null;
             });
@@ -548,8 +548,9 @@
                   * which will not get GCed before VM exit.
                   * Make its parent the top-level thread group.
                   */
-                Thread thread = new ManagedLocalsThread(
-                        ThreadGroupUtils.getRootThreadGroup(), comRun, name);
+                Thread thread = new Thread(
+                        ThreadGroupUtils.getRootThreadGroup(), comRun, name,
+                        0, false);
                 thread.setDaemon(true);
                 return thread;
             });
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WFileDialogPeer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -36,7 +36,6 @@
 import java.util.Vector;
 import sun.awt.CausedFocusEvent;
 import sun.awt.AWTAccessor;
-import sun.misc.ManagedLocalsThread;
 
 final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
 
@@ -98,7 +97,7 @@
 
     @Override
     public void show() {
-        new ManagedLocalsThread(this::_show).start();
+        new Thread(null, this::_show, "FileDialog", 0, false).start();
     }
 
     @Override
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPageDialogPeer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPageDialogPeer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -25,8 +25,6 @@
 
 package sun.awt.windows;
 
-import sun.misc.ManagedLocalsThread;
-
 final class WPageDialogPeer extends WPrintDialogPeer {
 
     WPageDialogPeer(WPageDialog target) {
@@ -53,6 +51,6 @@
             }
             ((WPrintDialog)target).setVisible(false);
         };
-        new ManagedLocalsThread(runnable).start();
+        new Thread(null, runnable, "PageDialog", 0, false).start();
     }
 }
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Tue Apr 05 09:17:15 2016 -0700
@@ -32,7 +32,6 @@
 import java.util.Vector;
 import sun.awt.CausedFocusEvent;
 import sun.awt.AWTAccessor;
-import sun.misc.ManagedLocalsThread;
 
 class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
 
@@ -78,7 +77,7 @@
             }
             ((WPrintDialog)target).setVisible(false);
         };
-        new ManagedLocalsThread(runnable).start();
+        new Thread(null, runnable, "PrintDialog", 0, false).start();
     }
 
     synchronized void setHWnd(long hwnd) {
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java	Tue Apr 05 09:17:15 2016 -0700
@@ -52,7 +52,6 @@
 import sun.java2d.d3d.D3DRenderQueue;
 import sun.java2d.opengl.OGLRenderQueue;
 
-import sun.misc.ManagedLocalsThread;
 import sun.print.PrintJob2D;
 
 import java.awt.dnd.DragSource;
@@ -256,7 +255,7 @@
                 (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
         if (!startToolkitThread(this, rootTG)) {
             String name = "AWT-Windows";
-            Thread toolkitThread = new ManagedLocalsThread(rootTG, this, name);
+            Thread toolkitThread = new Thread(rootTG, this, name, 0, false);
             toolkitThread.setDaemon(true);
             toolkitThread.start();
         }
@@ -283,8 +282,9 @@
 
     private void registerShutdownHook() {
         AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
-            Thread shutdown = new ManagedLocalsThread(
-                    ThreadGroupUtils.getRootThreadGroup(), this::shutdown);
+            Thread shutdown = new Thread(
+                    ThreadGroupUtils.getRootThreadGroup(), this::shutdown,
+                    "ToolkitShutdown", 0, false);
             shutdown.setContextClassLoader(null);
             Runtime.getRuntime().addShutdownHook(shutdown);
             return null;
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java	Tue Apr 05 09:17:15 2016 -0700
@@ -49,7 +49,6 @@
 import sun.java2d.windows.GDIWindowSurfaceData;
 import sun.java2d.d3d.D3DSurfaceData.D3DWindowSurfaceData;
 import sun.java2d.windows.WindowsFlags;
-import sun.misc.ManagedLocalsThread;
 
 /**
  * This class handles rendering to the screen with the D3D pipeline.
@@ -99,8 +98,9 @@
                 done = true;
                 wakeUpUpdateThread();
             };
-            Thread shutdown = new ManagedLocalsThread(
-                    ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable);
+            Thread shutdown = new Thread(
+                    ThreadGroupUtils.getRootThreadGroup(), shutdownRunnable,
+                    "ScreenUpdater", 0, false);
             shutdown.setContextClassLoader(null);
             try {
                 Runtime.getRuntime().addShutdownHook(shutdown);
@@ -348,8 +348,9 @@
         if (screenUpdater == null) {
             screenUpdater = AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
                 String name = "D3D Screen Updater";
-                Thread t = new ManagedLocalsThread(
-                        ThreadGroupUtils.getRootThreadGroup(), this, name);
+                Thread t = new Thread(
+                        ThreadGroupUtils.getRootThreadGroup(), this, name,
+                        0, false);
                 // REMIND: should it be higher?
                 t.setPriority(Thread.NORM_PRIORITY + 2);
                 t.setDaemon(true);
--- a/jdk/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java	Tue Apr 05 09:17:15 2016 -0700
@@ -25,8 +25,6 @@
 
 package sun.print;
 
-import sun.misc.ManagedLocalsThread;
-
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -99,7 +97,8 @@
                 return;
             }
             // start the printer listener thread
-            Thread thr = new ManagedLocalsThread(new PrinterChangeListener());
+            Thread thr = new Thread(null, new PrinterChangeListener(),
+                                    "PrinterListener", 0, false);
             thr.setDaemon(true);
             thr.start();
         } /* else condition ought to never happen! */
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_List.h	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_List.h	Tue Apr 05 09:17:15 2016 -0700
@@ -56,6 +56,7 @@
     }
     INLINE void Deselect(int pos) {
         if (isMultiSelect) {
+            SendListMessage(LB_SETCARETINDEX, pos, FALSE);
             SendListMessage(LB_SETSEL, FALSE, pos);
         }
         else {
--- a/jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java	Tue Apr 05 09:17:15 2016 -0700
@@ -25,7 +25,7 @@
 
 /*
   @test
-  @bug 6383903
+  @bug 6383903 8144166
   @summary REGRESSION: componentMoved is now getting called for some hidden components
   @author andrei.dmitriev: area=awt.component
   @run main CompEventOnHiddenComponent
--- a/jdk/test/java/awt/FontClass/CreateFont/CreateFontArrayTest.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/test/java/awt/FontClass/CreateFont/CreateFontArrayTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -23,9 +23,9 @@
 
 /*
  * @test
- * @bug 8055463
+ * @bug 8055463 8153272
  * @summary Test createFont APIs
- * @run CreateFontArrayTest
+ * @run main CreateFontArrayTest
  */
 
 import java.awt.Font;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/List/ItemEventTest/ItemEventTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -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.
+ */
+
+/*
+ *  @test
+ *  @bug 8033936
+ *  @summary Verify that correct ItemEvent is received while selection &
+ *           deselection of multi select List items.
+ */
+
+import java.awt.AWTException;
+import java.awt.Event;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.List;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+public class ItemEventTest extends Frame
+{
+    List list;
+    final String expectedSelectionOrder;
+    StringBuilder actualSelectionOrder;
+    Robot robot;
+
+    public ItemEventTest()
+    {
+        try {
+            robot = new Robot();
+        } catch(AWTException e) {
+            throw new RuntimeException(e.getMessage());
+        }
+        expectedSelectionOrder = "01230123";
+
+        list = new List(4, true);
+        list.add("0");
+        list.add("1");
+        list.add("2");
+        list.add("3");
+
+        add(list);
+        setSize(400,400);
+        setLayout(new FlowLayout());
+        pack();
+        setVisible(true);
+        robot.waitForIdle();
+    }
+
+    @Override
+    public boolean handleEvent(Event e) {
+        if (e.target instanceof List) {
+            if (e.id == Event.LIST_DESELECT || e.id == Event.LIST_SELECT) {
+                actualSelectionOrder.append(e.arg);
+            }
+        }
+        return true;
+    }
+
+    void testHandleEvent() {
+        // When no ItemListener is added to List, parent's handleEvent is
+        // called with ItemEvent.
+        performTest();
+    }
+
+    void testItemListener() {
+        list.addItemListener(new ItemListener() {
+            @Override
+            public void itemStateChanged(ItemEvent ie) {
+                actualSelectionOrder.append(ie.getItem());
+            }
+        });
+        performTest();
+    }
+
+    void performTest() {
+        actualSelectionOrder = new StringBuilder();
+        Point loc = list.getLocationOnScreen();
+        Rectangle rect = list.getBounds();
+        int dY = rect.height / list.getItemCount();
+        loc = new Point(loc.x + 10, loc.y + 5);
+
+        String osName = System.getProperty("os.name");
+        boolean isMac = osName.contains("Mac") || osName.contains("mac");
+        if(isMac) {
+            robot.keyPress(KeyEvent.VK_META);
+        }
+
+        // First loop to select & Second loop to deselect the list items.
+        for (int j = 0; j < 2; ++j) {
+            for (int i = 0; i < list.getItemCount(); ++i) {
+                robot.mouseMove(loc.x, loc.y + i * dY);
+                robot.mousePress(InputEvent.BUTTON1_MASK);
+                robot.delay(100);
+                robot.mouseRelease(InputEvent.BUTTON1_MASK);
+                robot.waitForIdle();
+            }
+        }
+
+        if(isMac) {
+            robot.keyRelease(KeyEvent.VK_META);
+        }
+
+        if (!expectedSelectionOrder.equals(actualSelectionOrder.toString())) {
+            dispose();
+            throw new RuntimeException("ItemEvent for selection & deselection"
+                + " of multi select List's item is not correct"
+                + " Expected : " + expectedSelectionOrder
+                + " Actual : " + actualSelectionOrder);
+        }
+    }
+
+    public static void main(String args[]) {
+       ItemEventTest test = new ItemEventTest();
+       test.testHandleEvent();
+       test.testItemListener();
+       test.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/PrintJob/JobAttrUpdateTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,126 @@
+/*
+ * 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 6357905
+ * @summary  JobAttributes.getFromPage() and getToPage() always returns 1
+ * @run main/manual JobAttrUpdateTest
+ */
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.JobAttributes;
+import java.awt.PrintJob;
+import java.awt.Toolkit;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class JobAttrUpdateTest {
+
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(JobAttrUpdateTest::printTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(30000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                throw new RuntimeException(""
+                        + "JobAttributes.getFromPage(),getToPage() not updated correctly");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    private static void printTest() {
+        JobAttributes ja = new JobAttributes();
+
+        Toolkit tk = Toolkit.getDefaultToolkit();
+        // ja.setToPage(4);
+        // ja.setFromPage(3);
+        // show dialog
+        PrintJob pjob = tk.getPrintJob(new JFrame(), "test", ja, null);
+        if (pjob == null) {
+            return;
+        }
+
+
+        if (ja.getDefaultSelection() == JobAttributes.DefaultSelectionType.RANGE) {
+            int fromPage = ja.getFromPage();
+            int toPage = ja.getToPage();
+            if (fromPage != 2 || toPage != 3) {
+                fail();
+            } else {
+                pass();
+            }
+        }
+    }
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String description
+                = " A print dialog will be shown.\n "
+                + " Please select Pages within Page-range.\n"
+                + " and enter From 2 and To 3. Then Select OK.";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("JobAttribute Updation Test");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/MonospacedGlyphWidth/MonospacedGlyphWidthTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,54 @@
+/*
+ * 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 8073400
+ * @summary Some Monospaced logical fonts have a different width
+ * @author Dmitry Markov
+ * @run main MonospacedGlyphWidthTest
+ */
+import java.awt.*;
+import java.awt.font.FontRenderContext;
+
+public class MonospacedGlyphWidthTest {
+    private static final int START_INDEX = 0x2018;
+    private static final int END_INDEX = 0x201F;
+
+    public static void main(String[] args) {
+        Font font = new Font(Font.MONOSPACED, Font.PLAIN, 12);
+        double width = getCharWidth(font, 'a');
+
+        for (int i = START_INDEX; i <= END_INDEX; i++) {
+            if (width != getCharWidth(font, (char)i)) {
+                throw new RuntimeException("Test Failed: characters have different width!");
+            }
+        }
+        System.out.println("Test Passed!");
+    }
+
+    private static double getCharWidth(Font font, char c) {
+        FontRenderContext fontRenderContext = new FontRenderContext(null, false, false);
+        return font.getStringBounds(new char[] {c}, 0, 1, fontRenderContext).getWidth();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/RasterCreationTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,352 @@
+/*
+ * 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.Point;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.DataBufferDouble;
+import java.awt.image.DataBufferFloat;
+import java.awt.image.DataBufferInt;
+import java.awt.image.DataBufferShort;
+import java.awt.image.DataBufferUShort;
+import java.awt.image.Raster;
+import java.awt.image.SampleModel;
+import java.awt.image.MultiPixelPackedSampleModel;
+import java.awt.image.PixelInterleavedSampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+
+/*
+ * @test
+ * @bug  6353518
+ * @summary  Test possible combinations of Raster creation
+ *           Test fails if any of Raster.createXXX() method throws exception.
+ */
+public class RasterCreationTest {
+
+    public static void main(String[] args) {
+
+        final int width = 10;
+        final int height = 5;
+        final int imageSize = width * height;
+        Point location = new Point(0, 0);
+        int[] bandOffsets = {0};
+        int[] bitMask = {0x00ff0000, 0x0000ff00, 0xff, 0x0};
+
+        SampleModel[] inputSampleModels = {
+            new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
+                    1, 1, 1, 1, bandOffsets),
+            new PixelInterleavedSampleModel(DataBuffer.TYPE_USHORT,
+                    1, 1, 1, 1, bandOffsets),
+            new PixelInterleavedSampleModel(DataBuffer.TYPE_INT,
+                    1, 1, 1, 1, bandOffsets),
+            new SinglePixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+                    width, height, bitMask),
+            new SinglePixelPackedSampleModel(DataBuffer.TYPE_USHORT,
+                    width, height, bitMask),
+            new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT,
+                    width, height, bitMask),
+            new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+                    width, height, 4),
+            new MultiPixelPackedSampleModel(DataBuffer.TYPE_USHORT,
+                    width, height, 2),
+            new MultiPixelPackedSampleModel(DataBuffer.TYPE_INT,
+                    width, height, 2)
+        };
+
+        // ---------------------------------------------------------------------
+        // Test ability to create Raster & WritableRaster with DataBuffer
+        // classes
+        // ---------------------------------------------------------------------
+        DataBuffer[] inputDataBuffer = {
+            new DataBufferByte(imageSize),
+            new DataBufferUShort(imageSize),
+            new DataBufferInt(imageSize, 1),
+            new DataBufferShort(imageSize),
+            new DataBufferFloat(imageSize),
+            new DataBufferDouble(imageSize)
+        };
+
+        for (SampleModel sm : inputSampleModels) {
+            for (DataBuffer db : inputDataBuffer) {
+                // Test Raster creation
+                Raster.createRaster(sm, db, location);
+
+                // Test writableRaster creation
+                Raster.createWritableRaster(sm, db, location);
+                Raster.createWritableRaster(sm, location);
+            }
+        }
+
+        // ---------------------------------------------------------------------
+        // Test ability to create Raster & WritableRaster with custom DataBuffer
+        // classes
+        // ---------------------------------------------------------------------
+        DataBuffer[] myDataBuffer = {
+            new MyDataBufferByte(imageSize),
+            new MyDataBufferUShort(imageSize),
+            new MyDataBufferInt(imageSize),
+            new MyDataBufferShort(imageSize),
+            new MyDataBufferDouble(imageSize),
+            new MyDataBufferFloat(imageSize)
+        };
+
+        for (SampleModel sm : inputSampleModels) {
+            for (DataBuffer db : myDataBuffer) {
+                // Test Raster creation
+                Raster.createRaster(sm, db, location);
+
+                // Test writableRaster creation
+                Raster.createWritableRaster(sm, db, location);
+                Raster.createWritableRaster(sm, location);
+            }
+        }
+
+        // ---------------------------------------------------------------------
+        // Test ability to create InterleavedRaster
+        // ---------------------------------------------------------------------
+        int[] interleavedInputDataTypes = {
+            DataBuffer.TYPE_BYTE,
+            DataBuffer.TYPE_USHORT
+        };
+
+        int numBands = 1;
+
+        for (int i : interleavedInputDataTypes) {
+            Raster.createInterleavedRaster(i, width, height, 1, location);
+            Raster.createInterleavedRaster(i, width, height, width * numBands,
+                    numBands, bandOffsets, location);
+        }
+
+        for (int i = 0; i < interleavedInputDataTypes.length ; i++) {
+            DataBuffer d1 = inputDataBuffer[i];
+            DataBuffer d2 = myDataBuffer[i];
+
+            Raster.createInterleavedRaster(d1, width, height, width * numBands,
+                    numBands, bandOffsets, location);
+            Raster.createInterleavedRaster(d2, width, height, width * numBands,
+                    numBands, bandOffsets, location);
+        }
+
+        // ---------------------------------------------------------------------
+        // Test ability to create BandedRaster
+        // ---------------------------------------------------------------------
+        int[] bankIndices = new int[numBands];
+        bankIndices[0] = 0;
+
+        int[] bandedInputDataTypes = {
+            DataBuffer.TYPE_BYTE,
+            DataBuffer.TYPE_USHORT,
+            DataBuffer.TYPE_INT
+        };
+
+        for (int i : bandedInputDataTypes) {
+            Raster.createBandedRaster(i, width, height, 1, location);
+            Raster.createBandedRaster(i, width, height, width,
+                    bankIndices, bandOffsets, location);
+        }
+
+        for (int i = 0; i < bandedInputDataTypes.length; i++) {
+            DataBuffer d1 = inputDataBuffer[i];
+            DataBuffer d2 = myDataBuffer[i];
+
+            Raster.createBandedRaster(d1, width, height, width,
+                    bankIndices, bandOffsets, location);
+            Raster.createBandedRaster(d2, width, height, width,
+                    bankIndices, bandOffsets, location);
+        }
+
+        // ---------------------------------------------------------------------
+        // Test ability to create PackedRaster
+        // ---------------------------------------------------------------------
+        int[] bandMasks = new int[numBands];
+        bandMasks[0] = 0;
+
+        int packedInputDataTypes[] = {
+            DataBuffer.TYPE_BYTE,
+            DataBuffer.TYPE_USHORT,
+            DataBuffer.TYPE_INT
+        };
+
+        for (int i : packedInputDataTypes) {
+            Raster.createPackedRaster(i, width, height, bandMasks, location);
+
+            for (int bits = 1; bits < 5; bits *= 2) {
+                Raster.createPackedRaster(i, width, height, 1, bits, location);
+            }
+        }
+
+        for (int i = 0; i < packedInputDataTypes.length; i++) {
+            DataBuffer d1 = inputDataBuffer[i];
+            DataBuffer d2 = myDataBuffer[i];
+
+            for (int bits = 1; bits < 5; bits *= 2) {
+                Raster.createPackedRaster(d1, width, height, bits, location);
+                Raster.createPackedRaster(d2, width, height, bits, location);
+            }
+
+            Raster.createPackedRaster(d1, width, height, 1,bandMasks, location);
+            Raster.createPackedRaster(d2, width, height, 1,bandMasks, location);
+        }
+    }
+}
+
+// ---------------------------------------------------------------------
+// Custom DataBuffer classes for testing purpose
+// ---------------------------------------------------------------------
+final class MyDataBufferByte extends DataBuffer {
+
+    byte[] data;
+    byte[][] bankdata;
+
+    public MyDataBufferByte(int size) {
+        super(TYPE_BYTE, size);
+        data = new byte[size];
+        bankdata = new byte[1][];
+        bankdata[0] = data;
+    }
+
+    @Override
+    public int getElem(int bank, int i) {
+        return bankdata[bank][i + offsets[bank]];
+    }
+
+    @Override
+    public void setElem(int bank, int i, int val) {
+        bankdata[bank][i + offsets[bank]] = (byte) val;
+    }
+}
+
+final class MyDataBufferDouble extends DataBuffer {
+
+    double[] data;
+    double[][] bankdata;
+
+    public MyDataBufferDouble(int size) {
+        super(TYPE_DOUBLE, size);
+        data = new double[size];
+        bankdata = new double[1][];
+        bankdata[0] = data;
+    }
+
+    @Override
+    public int getElem(int bank, int i) {
+        return (int) bankdata[bank][i + offsets[bank]];
+    }
+
+    @Override
+    public void setElem(int bank, int i, int val) {
+        bankdata[bank][i + offsets[bank]] = (double) val;
+    }
+}
+
+final class MyDataBufferFloat extends DataBuffer {
+
+    float[] data;
+    float[][] bankdata;
+
+    public MyDataBufferFloat(int size) {
+        super(TYPE_FLOAT, size);
+        data = new float[size];
+        bankdata = new float[1][];
+        bankdata[0] = data;
+    }
+
+    @Override
+    public int getElem(int bank, int i) {
+        return (int) bankdata[bank][i + offsets[bank]];
+    }
+
+    @Override
+    public void setElem(int bank, int i, int val) {
+        bankdata[bank][i + offsets[bank]] = (float) val;
+    }
+}
+
+final class MyDataBufferShort extends DataBuffer {
+
+    short[] data;
+    short[][] bankdata;
+
+    public MyDataBufferShort(int size) {
+        super(TYPE_SHORT, size);
+        data = new short[size];
+        bankdata = new short[1][];
+        bankdata[0] = data;
+    }
+
+    @Override
+    public int getElem(int bank, int i) {
+        return bankdata[bank][i + offsets[bank]];
+    }
+
+    @Override
+    public void setElem(int bank, int i, int val) {
+        bankdata[bank][i + offsets[bank]] = (short) val;
+    }
+}
+
+final class MyDataBufferUShort extends DataBuffer {
+
+    short[] data;
+    short[][] bankdata;
+
+    public MyDataBufferUShort(int size) {
+        super(TYPE_USHORT, size);
+        data = new short[size];
+        bankdata = new short[1][];
+        bankdata[0] = data;
+    }
+
+    @Override
+    public int getElem(int bank, int i) {
+        return bankdata[bank][i + offsets[bank]];
+    }
+
+    @Override
+    public void setElem(int bank, int i, int val) {
+        bankdata[bank][i + offsets[bank]] = (short) val;
+    }
+}
+
+final class MyDataBufferInt extends DataBuffer {
+
+    int[] data;
+    int[][] bankdata;
+
+    public MyDataBufferInt(int size) {
+        super(TYPE_INT, size);
+        data = new int[size];
+        bankdata = new int[1][];
+        bankdata[0] = data;
+    }
+
+    @Override
+    public int getElem(int bank, int i) {
+        return bankdata[bank][i + offsets[bank]];
+    }
+
+    @Override
+    public void setElem(int bank, int i, int val) {
+        bankdata[bank][i + offsets[bank]] = (int) val;
+    }
+}
--- a/jdk/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.java	Tue Apr 05 09:13:52 2016 -0700
+++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionTrayIconTest/MultiResolutionTrayIconTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -24,8 +24,7 @@
 
 /*
   @test
-  @bug 8150176
-  @ignore 8150176
+  @bug 8150176 8151773
   @summary Check if correct resolution variant is used for tray icon.
   @author a.stepanov
   @run applet/manual=yesno MultiResolutionTrayIconTest.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/DlgAttrsBug.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,152 @@
+/*
+ * 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 8061258
+ * @summary  PrinterJob's native Print Dialog does not reflect
+ *           specified Copies or Page Ranges
+ * @run main/manual DlgAttrsBug
+ */
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.Copies;
+import javax.print.attribute.standard.PageRanges;
+import javax.print.attribute.standard.DialogTypeSelection;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+
+public class DlgAttrsBug implements Printable {
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+
+    public static void main(String[] args)  throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(DlgAttrsBug::printTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(30000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                throw new RuntimeException("Print Dialog does not " +
+                          "reflect Copies or Page Ranges");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    private static void printTest() {
+        PrinterJob job = PrinterJob.getPrinterJob();
+        if (job.getPrintService() == null) {
+            System.out.println("No printers. Test cannot continue");
+            return;
+        }
+        job.setPrintable(new DlgAttrsBug());
+        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+        aset.add(new Copies(5));
+        aset.add(new PageRanges(3,4));
+        aset.add(DialogTypeSelection.NATIVE);
+        job.printDialog(aset);
+    }
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String description
+                = " Visual inspection of print dialog is required.\n"
+                + " A print dialog will be shown.\n "
+                + " Please verify Copies 5 is selected.\n"
+                + " Also verify, Page Range is selected with "
+                + " from page 3 and to Page 4.\n"
+                + " If ok, press PASS else press FAIL";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("printSelectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail();
+        });
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+            passButton.setEnabled(true);
+            failButton.setEnabled(true);
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+    }
+
+    public int print(Graphics g, PageFormat pf, int pi)
+            throws PrinterException {
+        System.out.println("pi = " + pi);
+        if (pi >= 5) {
+            return NO_SUCH_PAGE;
+        }
+        g.drawString("Page : " + (pi+1), 200, 200);
+        return PAGE_EXISTS;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/PrinterJob/PrintAttributeUpdateTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,91 @@
+/*
+ * 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 8042713
+  @summary  Print Dialog does not update attribute set with page range
+  @run main/manual PrintAttributeUpdateTest
+ */
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.print.PageFormat;
+import java.awt.print.Pageable;
+import java.awt.print.Printable;
+import java.awt.print.PrinterJob;
+import javax.print.attribute.Attribute;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.standard.DialogTypeSelection;
+import javax.print.attribute.standard.PageRanges;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
+public class PrintAttributeUpdateTest implements Pageable, Printable {
+
+    public static void main(String args[]) throws Exception {
+        String[] instructions
+                = {
+                    "Select Pages Range From instead of All in print dialog. ",
+                    "Then select Print"
+                };
+        SwingUtilities.invokeAndWait(() -> {
+            JOptionPane.showMessageDialog((Component) null,
+                    instructions, "Instructions",
+                    JOptionPane.INFORMATION_MESSAGE);
+        });
+        HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet();
+        PrinterJob j = PrinterJob.getPrinterJob();
+        j.setPageable(new PrintAttributeUpdateTest());
+        as.add(DialogTypeSelection.NATIVE);
+        j.printDialog(as);
+        if (as.containsKey(PageRanges.class) == false) {
+            throw new RuntimeException("Print Dialog did not update "
+                    + " attribute set with page range");
+        }
+        Attribute attrs[] = as.toArray();
+        for (int i = 0; i < attrs.length; i++) {
+            System.out.println("attr " + attrs[i]);
+        }
+        j.print(as);
+    }
+
+    public int getNumberOfPages() {
+        return UNKNOWN_NUMBER_OF_PAGES;
+    }
+
+    public PageFormat getPageFormat(int pageIndex) {
+        PageFormat pf = new PageFormat();
+        return pf;
+    }
+
+    public Printable getPrintable(int pageIndex) {
+        return this;
+    }
+
+    public int print(Graphics g, PageFormat pgFmt, int pi) {
+        g.drawString("Page : " + (pi + 1), 200, 200);
+
+        return PAGE_EXISTS;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/tiff/TIFFDirectoryTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,266 @@
+/*
+ * 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     8149028
+ * @author  a.stepanov
+ * @summary some simple checks for TIFFDirectory
+ * @run     main TIFFDirectoryTest
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+import javax.imageio.metadata.*;
+import javax.imageio.plugins.tiff.*;
+
+
+public class TIFFDirectoryTest {
+
+    private static void check(boolean ok, String msg) {
+        if (!ok) { throw new RuntimeException(msg); }
+    }
+
+    private void run() {
+
+        int type = TIFFTag.TIFF_LONG, dt = 1 << type;
+        int n0 = 1000, n1 = 1001, n2 = 1002, n3 = 1003;
+
+        TIFFTag tag1 = new TIFFTag(Integer.toString(n1), n1, dt);
+        TIFFTag tag2 = new TIFFTag(Integer.toString(n2), n2, dt);
+        TIFFTag tag3 = new TIFFTag(Integer.toString(n3), n3, dt);
+        TIFFTag parent = new TIFFTag(Integer.toString(n0), n0, dt);
+
+        // tag sets array must not be null
+        boolean ok = false;
+        try { new TIFFDirectory(null, parent); }
+        catch (NullPointerException e) { ok = true; }
+        check(ok, "can construct TIFFDirectory with null tagsets array");
+
+        // but can be empty
+        TIFFTagSet emptySets[] = {};
+        TIFFDirectory d = new TIFFDirectory(emptySets, parent);
+        check(d.getTagSets().length == 0, "invalid number of tag sets");
+        check(d.getParentTag().getName().equals(Integer.toString(n0)) &&
+             (d.getParentTag().getNumber() == n0), "invalid parent tag");
+
+
+        // add tags
+        List<TIFFTag> tags = new ArrayList<>();
+        tags.add(tag1);
+        tags.add(tag2);
+        TIFFTagSet ts1 = new TIFFTagSet(tags);
+
+        tags.clear();
+        tags.add(tag3);
+        TIFFTagSet ts2 = new TIFFTagSet(tags);
+
+        TIFFTagSet sets[] = {ts1, ts2};
+        d = new TIFFDirectory(sets, parent);
+
+        check(d.getTagSets().length == sets.length, "invalid number of tag sets");
+
+        // check getTag()
+        for (int i = n1; i <= n3; i++) {
+            TIFFTag t = d.getTag(i);
+            check(t.getNumber() == i, "invalid tag number");
+            check(t.getName().equals(Integer.toString(i)), "invalid tag name");
+            check(t.getDataTypes() == dt, "invalid tag data types");
+        }
+
+        TIFFDirectory d2;
+        try { d2 = d.clone(); }
+        catch (CloneNotSupportedException e) { throw new RuntimeException(e); }
+
+        // check removeTagSet()
+        d.removeTagSet(ts2);
+        check(d.getTagSets().length == 1, "invalid number of tag sets");
+        check(d.getTagSets()[0].getTag(n1).getName().equals(Integer.toString(n1)),
+            "invalid tag name");
+        check(d.getTagSets()[0].getTag(n2).getName().equals(Integer.toString(n2)),
+            "invalid tag name");
+
+        d.removeTagSet(ts1);
+        check(d.getTagSets().length == 0, "invalid number of tag sets");
+
+        // check cloned data
+        check(d2.getTagSets().length == sets.length,
+            "invalid number of tag sets");
+        TIFFTagSet sets2[] = d2.getTagSets();
+        check(sets2.length == sets.length, "invalid number of tag sets");
+        check(
+            (sets2[0].getTag(Integer.toString(n1)).getNumber() == n1) &&
+            (sets2[0].getTag(Integer.toString(n2)).getNumber() == n2) &&
+            (sets2[0].getTag(Integer.toString(n0)) == null) &&
+            (sets2[1].getTag(Integer.toString(n3)).getNumber() == n3) &&
+            (sets2[1].getTag(Integer.toString(n0)) == null), "invalid data");
+
+        check(
+            (sets2[0].getTag(Integer.toString(n1)).getDataTypes() == dt) &&
+            (sets2[0].getTag(Integer.toString(n2)).getDataTypes() == dt) &&
+            (sets2[1].getTag(Integer.toString(n3)).getDataTypes() == dt),
+            "invalid data type");
+
+        // must not be able to call removeTagSet with null argument
+        ok = false;
+        try { d.removeTagSet(null); }
+        catch (NullPointerException e) { ok = true; }
+        check(ok, "must not be able to use null as an argument for remove");
+
+        // check parent tag
+        check( d.getParentTag().getName().equals(Integer.toString(n0)) &&
+              d2.getParentTag().getName().equals(Integer.toString(n0)),
+            "invalid parent tag name");
+
+        check(( d.getParentTag().getNumber() == n0) &&
+              (d2.getParentTag().getNumber() == n0),
+            "invalid parent tag number");
+
+        check(( d.getParentTag().getDataTypes() == dt) &&
+              (d2.getParentTag().getDataTypes() == dt),
+            "invalid parent data type");
+
+        d.addTagSet(ts1);
+        d.addTagSet(ts2);
+
+        // add the same tag set twice and check that nothing changed
+        d.addTagSet(ts2);
+
+        check(d.getTagSets().length == 2, "invalid number of tag sets");
+
+        // check field operations
+        check(d.getNumTIFFFields() == 0, "invalid TIFFFields number");
+        check(d.getTIFFField(Integer.MAX_VALUE) == null,
+            "must return null TIFFField");
+
+        long offset = 4L;
+        long a[] = {Long.MIN_VALUE, 0, Long.MAX_VALUE};
+        int v = 100500;
+        TIFFField
+                f1 = new TIFFField(tag1, type, offset, d),
+                f2 = new TIFFField(tag2, v),
+                f3 = new TIFFField(tag3, type, a.length, a);
+
+        d.addTIFFField(f1);
+        d.addTIFFField(f2);
+        d.addTIFFField(f3);
+
+        check(d.containsTIFFField(n1) &&
+              d.containsTIFFField(n2) &&
+              d.containsTIFFField(n3) &&
+             !d.containsTIFFField(n0), "invalid containsTIFFField() results");
+
+        check(d.getTIFFField(n0) == null, "can get unadded field");
+
+        check(d.getNumTIFFFields() == 3, "invalid TIFFFields number");
+
+        check(d.getTIFFField(n1).getCount() == 1, "invalid TIFFField count");
+        check(d.getTIFFField(n1).getAsLong(0) == offset, "invalid offset");
+
+        check(d.getTIFFField(n2).getCount() == 1, "invalid TIFFField count");
+        check(d.getTIFFField(n2).getAsInt(0) == v, "invalid TIFFField value");
+
+        check(d.getTIFFField(n3).getCount() == a.length,
+            "invalid TIFFField count");
+        for (int i = 0; i < a.length; ++i) {
+            check(d.getTIFFField(n3).getAsLong(i) == a[i],
+                "invalid TIFFField value");
+        }
+
+        TIFFField nested = d.getTIFFField(n1).getDirectory().getTIFFField(n1);
+        check(nested.getTag().getNumber() == n1, "invalid tag number");
+        check(nested.getCount() == 1, "invalid field count");
+        check(nested.getAsLong(0) == offset, "invalid offset");
+
+        // check that the field is overwritten correctly
+        int v2 = 1 << 16;
+        d.addTIFFField(new TIFFField(tag3, v2));
+        check(d.getTIFFField(n3).getCount() == 1, "invalid TIFFField count");
+        check(d.getTIFFField(n3).getAsInt(0)== v2, "invalid TIFFField value");
+        check(d.getNumTIFFFields() == 3, "invalid TIFFFields number");
+
+        // check removeTIFFField()
+        d.removeTIFFField(n3);
+        check(d.getNumTIFFFields() == 2, "invalid TIFFFields number");
+        check(d.getTIFFField(n3) == null, "can get removed field");
+
+        d.removeTIFFFields();
+        check((d.getTIFFField(n1) == null) && (d.getTIFFField(n2) == null),
+            "can get removed field");
+        check((d.getNumTIFFFields() == 0) && (d.getTIFFFields().length == 0),
+            "invalid TIFFFields number");
+
+        // check that array returned by getTIFFFields() is sorted
+        // by tag number (as it stated in the docs)
+        d.addTIFFField(f3);
+        d.addTIFFField(f1);
+        d.addTIFFField(f2);
+
+        TIFFField fa[] = d.getTIFFFields();
+        check(fa.length == 3, "invalid number of fields");
+        check((fa[0].getTagNumber() == n1) &&
+              (fa[1].getTagNumber() == n2) &&
+              (fa[2].getTagNumber() == n3),
+            "array of the fields must be sorted by tag number");
+
+        d.removeTIFFFields();
+        d.addTIFFField(f2);
+
+        // test getAsMetaData / createFromMetadata
+        try {
+            d2 = TIFFDirectory.createFromMetadata(d.getAsMetadata());
+        } catch (IIOInvalidTreeException e) {
+            throw new RuntimeException(e);
+        }
+
+        // check new data
+        check(d2.getTagSets().length == sets.length,
+            "invalid number of tag sets");
+        sets2 = d2.getTagSets();
+        check(sets2.length == sets.length, "invalid number of tag sets");
+        check(
+            (sets2[0].getTag(Integer.toString(n1)).getNumber() == n1) &&
+            (sets2[0].getTag(Integer.toString(n2)).getNumber() == n2) &&
+            (sets2[0].getTag(Integer.toString(n0)) == null) &&
+            (sets2[1].getTag(Integer.toString(n3)).getNumber() == n3) &&
+            (sets2[1].getTag(Integer.toString(n0)) == null), "invalid data");
+
+        check(
+            (sets2[0].getTag(Integer.toString(n1)).getDataTypes() == dt) &&
+            (sets2[0].getTag(Integer.toString(n2)).getDataTypes() == dt) &&
+            (sets2[1].getTag(Integer.toString(n3)).getDataTypes() == dt),
+            "invalid data type");
+
+        check(!d2.containsTIFFField(n1) &&
+               d2.containsTIFFField(n2) &&
+              !d2.containsTIFFField(n3), "invalid containsTIFFField() results");
+        check(d2.getTIFFField(n2).getCount()  == 1, "invalid TIFFField count");
+        check(d2.getTIFFField(n2).getAsInt(0) == v, "invalid TIFFField value");
+
+        check((d2.getParentTag().getNumber() == n0) &&
+               d2.getParentTag().getName().equals(Integer.toString(n0)),
+               "invalid parent tag");
+    }
+
+    public static void main(String[] args) { (new TIFFDirectoryTest()).run(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/tiff/TIFFDirectoryWriteReadTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,255 @@
+/*
+ * 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     8149028
+ * @author  a.stepanov
+ * @summary a simple write-read test for TIFFDirectory
+ * @run     main TIFFDirectoryWriteReadTest
+ */
+
+import java.awt.*;
+import java.awt.color.*;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import javax.imageio.*;
+import javax.imageio.metadata.*;
+import javax.imageio.stream.*;
+import javax.imageio.plugins.tiff.*;
+
+
+public class TIFFDirectoryWriteReadTest {
+
+    private final static String FILENAME = "test.tiff";
+    private final static int SZ = 100;
+    private final static Color C = Color.RED;
+
+    private static final String COPYRIGHT[] = {"Copyright 123ABC.."};
+    private static final String DESCRIPTION[] = {"Test Image", "Description"};
+    private static final String SOFTWARE[] = {"test", "software", "123"};
+
+    private static final long RES_X[][] = {{2, 1}}, RES_Y[][] = {{1, 1}};
+
+    private static final byte[] ICC_PROFILE =
+        ICC_ProfileRGB.getInstance(ColorSpace.CS_sRGB).getData();
+
+
+    private ImageWriter getTIFFWriter() {
+
+        java.util.Iterator<ImageWriter> writers =
+            ImageIO.getImageWritersByFormatName("TIFF");
+        if (!writers.hasNext()) {
+            throw new RuntimeException("No writers available for TIFF format");
+        }
+        return writers.next();
+    }
+
+    private ImageReader getTIFFReader() {
+
+        java.util.Iterator<ImageReader> readers =
+            ImageIO.getImageReadersByFormatName("TIFF");
+        if (!readers.hasNext()) {
+            throw new RuntimeException("No readers available for TIFF format");
+        }
+        return readers.next();
+    }
+
+    private void addASCIIField(TIFFDirectory d,
+                               String        name,
+                               String        data[],
+                               int           num) {
+
+        d.addTIFFField(new TIFFField(
+            new TIFFTag(name, num, 1 << TIFFTag.TIFF_ASCII),
+                TIFFTag.TIFF_ASCII, data.length, data));
+    }
+
+    private void checkASCIIField(TIFFDirectory d,
+                                 String        what,
+                                 String        data[],
+                                 int           num) {
+
+        String notFound = what + " field was not found";
+        check(d.containsTIFFField(num), notFound);
+        TIFFField f = d.getTIFFField(num);
+        check(f.getType() == TIFFTag.TIFF_ASCII, "field type != ASCII");
+        check(f.getCount() == data.length, "invalid " + what + " data count");
+        for (int i = 0; i < data.length; i++) {
+            check(f.getValueAsString(i).equals(data[i]),
+                "invalid " + what + " data");
+        }
+    }
+
+    private void writeImage() throws Exception {
+
+        OutputStream s = new BufferedOutputStream(new FileOutputStream(FILENAME));
+        try (ImageOutputStream ios = ImageIO.createImageOutputStream(s)) {
+
+            ImageWriter writer = getTIFFWriter();
+            writer.setOutput(ios);
+
+            BufferedImage img = new BufferedImage(
+                SZ, SZ, BufferedImage.TYPE_INT_RGB);
+            Graphics g = img.getGraphics();
+            g.setColor(C);
+            g.fillRect(0, 0, SZ, SZ);
+            g.dispose();
+
+            IIOMetadata metadata = writer.getDefaultImageMetadata(
+                new ImageTypeSpecifier(img), writer.getDefaultWriteParam());
+
+            TIFFDirectory dir = TIFFDirectory.createFromMetadata(metadata);
+
+            addASCIIField(dir, "Copyright",
+                COPYRIGHT, BaselineTIFFTagSet.TAG_COPYRIGHT);
+
+            addASCIIField(dir, "ImageDescription",
+                DESCRIPTION, BaselineTIFFTagSet.TAG_IMAGE_DESCRIPTION);
+
+            addASCIIField(dir, "Software",
+                SOFTWARE, BaselineTIFFTagSet.TAG_SOFTWARE);
+
+            dir.addTIFFField(new TIFFField(
+                new TIFFTag("XResolution", BaselineTIFFTagSet.TAG_X_RESOLUTION,
+                1 << TIFFTag.TIFF_RATIONAL), TIFFTag.TIFF_RATIONAL, 1, RES_X));
+            dir.addTIFFField(new TIFFField(
+                new TIFFTag("YResolution", BaselineTIFFTagSet.TAG_Y_RESOLUTION,
+                1 << TIFFTag.TIFF_RATIONAL), TIFFTag.TIFF_RATIONAL, 1, RES_Y));
+
+            dir.addTIFFField(new TIFFField(
+            new TIFFTag("ICC Profile", BaselineTIFFTagSet.TAG_ICC_PROFILE,
+                1 << TIFFTag.TIFF_UNDEFINED),
+                TIFFTag.TIFF_UNDEFINED, ICC_PROFILE.length, ICC_PROFILE));
+
+            IIOMetadata data = dir.getAsMetadata();
+            writer.write(new IIOImage(img, null, data));
+
+            ios.flush();
+            writer.dispose();
+        }
+        s.close();
+    }
+
+
+
+    private void readAndCheckImage() throws Exception {
+
+        ImageReader reader = getTIFFReader();
+
+        ImageInputStream s = ImageIO.createImageInputStream(new File(FILENAME));
+        reader.setInput(s);
+
+        int ni = reader.getNumImages(true);
+        check(ni == 1, "invalid number of images");
+
+        // check image
+        BufferedImage img = reader.read(0);
+        check(img.getWidth() == SZ && img.getHeight() == SZ,
+            "invalid image size");
+
+        Color c = new Color(img.getRGB(SZ / 2, SZ / 2));
+        check(C.equals(c), "invalid image color");
+
+        IIOMetadata metadata = reader.readAll(0, null).getMetadata();
+        TIFFDirectory dir = TIFFDirectory.createFromMetadata(metadata);
+
+        reader.dispose();
+        s.close();
+
+        // ===== perform tag checks =====
+
+        checkASCIIField(dir, "copyright", COPYRIGHT,
+            BaselineTIFFTagSet.TAG_COPYRIGHT);
+
+        checkASCIIField(dir, "description", DESCRIPTION,
+            BaselineTIFFTagSet.TAG_IMAGE_DESCRIPTION);
+
+        checkASCIIField(dir, "software", SOFTWARE,
+            BaselineTIFFTagSet.TAG_SOFTWARE);
+
+        TIFFField f = dir.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_WIDTH);
+        check(f.getCount() == 1, "invalid width field count");
+        int w = f.getAsInt(0);
+        check(w == SZ, "invalid width");
+
+        f = dir.getTIFFField(BaselineTIFFTagSet.TAG_IMAGE_LENGTH);
+        check(f.getCount() == 1, "invalid height field count");
+        int h = f.getAsInt(0);
+        check(h == SZ, "invalid height");
+
+        f = dir.getTIFFField(BaselineTIFFTagSet.TAG_BITS_PER_SAMPLE);
+        // RGB: 3 x 8 bits for R, G and B components
+        int bps[] = f.getAsInts();
+        check((f.getCount() == 3) && (bps.length == 3), "invalid BPS count");
+        for (int b: bps) { check(b == 8, "invalid bits per sample"); }
+
+        // RGB: PhotometricInterpretation = 2
+        f = dir.getTIFFField(BaselineTIFFTagSet.TAG_PHOTOMETRIC_INTERPRETATION);
+        check(f.getCount() == 1, "invalid count");
+        check(f.getAsInt(0) == 2, "invalid photometric interpretation for RGB");
+
+        String rat = " resolution must be rational";
+        f = dir.getTIFFField(BaselineTIFFTagSet.TAG_X_RESOLUTION);
+        check(f.getType() == TIFFTag.TIFF_RATIONAL, "x" + rat);
+        check(f.getCount() == 1 &&
+              f.getAsInt(0) == (int) (RES_X[0][0] / RES_X[0][1]),
+              "invalid x resolution");
+
+        f = dir.getTIFFField(BaselineTIFFTagSet.TAG_Y_RESOLUTION);
+        check(f.getType() == TIFFTag.TIFF_RATIONAL, "y" + rat);
+        check(f.getCount() == 1 &&
+              f.getAsInt(0) == (int) (RES_Y[0][0] / RES_Y[0][1]),
+              "invalid y resolution");
+
+        f = dir.getTIFFField(BaselineTIFFTagSet.TAG_ICC_PROFILE);
+        check(f.getType() == TIFFTag.TIFF_UNDEFINED,
+            "invalid ICC profile field type");
+        int cnt = f.getCount();
+        byte icc[] = f.getAsBytes();
+        check((cnt == ICC_PROFILE.length) && (cnt == icc.length),
+                "invalid ICC profile");
+        for (int i = 0; i < cnt; i++) {
+            check(icc[i] == ICC_PROFILE[i], "invalid ICC profile");
+        }
+    }
+
+    public void run() {
+
+        try {
+            writeImage();
+            readAndCheckImage();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+
+    private void check(boolean ok, String msg) {
+        if (!ok) { throw new RuntimeException(msg); }
+    }
+
+    public static void main(String[] args) {
+        (new TIFFDirectoryWriteReadTest()).run();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/tiff/TIFFImageReadParamTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,275 @@
+/*
+ * 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     8149028
+ * @author  a.stepanov
+ * @summary check TIFFDirectory manipulation
+ *          by means of TIFFImageReadParam
+ * @run     main TIFFImageReadParamTest
+ */
+
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import javax.imageio.*;
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.plugins.tiff.*;
+import javax.imageio.stream.ImageInputStream;
+import javax.imageio.stream.ImageOutputStream;
+
+public class TIFFImageReadParamTest {
+
+    private final static String FILENAME = "test.tiff";
+    private final static int SZ = 100;
+    private final static Color C = Color.RED;
+
+    private final static String GEO_DATA = "test params";
+    private final static int GEO_N = GeoTIFFTagSet.TAG_GEO_ASCII_PARAMS;
+
+    private final static String EXIF_DATA = "2000:01:01 00:00:01";
+    private final static int EXIF_N = ExifTIFFTagSet.TAG_DATE_TIME_ORIGINAL;
+
+    private final static String GPS_DATA =
+        ExifGPSTagSet.STATUS_MEASUREMENT_IN_PROGRESS;
+    private final static int GPS_N = ExifGPSTagSet.TAG_GPS_STATUS;
+
+    private final static short FAX_DATA =
+        FaxTIFFTagSet.CLEAN_FAX_DATA_ERRORS_UNCORRECTED;
+    private final static int FAX_N = FaxTIFFTagSet.TAG_CLEAN_FAX_DATA;
+
+    private ImageWriter getTIFFWriter() {
+
+        java.util.Iterator<ImageWriter> writers =
+            ImageIO.getImageWritersByFormatName("TIFF");
+        if (!writers.hasNext()) {
+            throw new RuntimeException("No writers available for TIFF format");
+        }
+        return writers.next();
+    }
+
+    private ImageReader getTIFFReader() {
+
+        java.util.Iterator<ImageReader> readers =
+            ImageIO.getImageReadersByFormatName("TIFF");
+        if (!readers.hasNext()) {
+            throw new RuntimeException("No readers available for TIFF format");
+        }
+        return readers.next();
+    }
+
+    private void check(boolean ok, String msg) {
+        if (!ok) { throw new RuntimeException(msg); }
+    }
+
+    private void addASCIIField(TIFFDirectory d,
+                               String        name,
+                               String        data,
+                               int           num) {
+
+        String a[] = {data};
+        d.addTIFFField(new TIFFField(
+            new TIFFTag(name, num, 1 << TIFFTag.TIFF_ASCII),
+                TIFFTag.TIFF_ASCII, 1, a));
+    }
+
+    private void checkASCIIValue(TIFFDirectory d,
+                                 String        what,
+                                 String        data,
+                                 int           num) {
+
+        TIFFField f = d.getTIFFField(num);
+        check(f.getType() == TIFFTag.TIFF_ASCII, "field type != ASCII");
+        check(f.getCount() == 1, "invalid " + what + " data count");
+        check(f.getValueAsString(0).equals(data),
+            "invalid " + what + " data");
+    }
+
+
+    private void writeImage() throws Exception {
+
+        OutputStream s = new BufferedOutputStream(new FileOutputStream(FILENAME));
+        try (ImageOutputStream ios = ImageIO.createImageOutputStream(s)) {
+            ImageWriter writer = getTIFFWriter();
+            writer.setOutput(ios);
+
+            BufferedImage img =
+                new BufferedImage(SZ, SZ, BufferedImage.TYPE_INT_RGB);
+            Graphics g = img.getGraphics();
+            g.setColor(C);
+            g.fillRect(0, 0, SZ, SZ);
+            g.dispose();
+
+            IIOMetadata metadata = writer.getDefaultImageMetadata(
+                new ImageTypeSpecifier(img), writer.getDefaultWriteParam());
+
+            TIFFDirectory dir = TIFFDirectory.createFromMetadata(metadata);
+
+            // add some extension tags
+            addASCIIField(dir, "GeoAsciiParamsTag", GEO_DATA, GEO_N);
+            addASCIIField(dir, "DateTimeOriginal", EXIF_DATA, EXIF_N);
+            addASCIIField(dir, "GPSStatus", GPS_DATA, GPS_N);
+
+            dir.addTIFFField(new TIFFField(new TIFFTag(
+                "CleanFaxData", FAX_N, 1 << TIFFTag.TIFF_SHORT), FAX_DATA));
+
+            IIOMetadata data = dir.getAsMetadata();
+
+            writer.write(new IIOImage(img, null, data));
+
+            ios.flush();
+            writer.dispose();
+        }
+    }
+
+    private void checkImage(BufferedImage img) {
+
+        check(img.getWidth() == SZ, "invalid image width");
+        check(img.getHeight() == SZ, "invalid image height");
+        Color c = new Color(img.getRGB(SZ / 2, SZ / 2));
+        check(c.equals(C), "invalid image color");
+    }
+
+    private TIFFDirectory getDir(TIFFTagSet[] add,
+                                 TIFFTagSet[] remove) throws Exception {
+
+        ImageReader reader = getTIFFReader();
+
+        ImageInputStream s = ImageIO.createImageInputStream(new File(FILENAME));
+        reader.setInput(s, false, true);
+
+        int ni = reader.getNumImages(true);
+        check(ni == 1, "invalid number of images: " + ni);
+
+        TIFFImageReadParam param = new TIFFImageReadParam();
+        for (TIFFTagSet ts: add) { param.addAllowedTagSet(ts); }
+        for (TIFFTagSet ts: remove) { param.removeAllowedTagSet(ts); }
+
+        IIOImage img = reader.readAll(0, param);
+
+        // just in case, check image
+        checkImage((BufferedImage) img.getRenderedImage());
+
+        IIOMetadata metadata = img.getMetadata();
+        TIFFDirectory dir = TIFFDirectory.createFromMetadata(metadata);
+
+        reader.dispose();
+        s.close();
+
+        return dir;
+    }
+
+    private void simpleChecks() {
+
+        TIFFImageReadParam param = new TIFFImageReadParam();
+
+        java.util.List<TIFFTagSet> allowed = param.getAllowedTagSets();
+
+        // see docs
+        check(allowed.contains(BaselineTIFFTagSet.getInstance()),
+            "must contain BaselineTIFFTagSet");
+        check(allowed.contains(FaxTIFFTagSet.getInstance()),
+            "must contain FaxTIFFTagSet");
+        check(allowed.contains(ExifParentTIFFTagSet.getInstance()),
+            "must contain ExifParentTIFFTagSet");
+        check(allowed.contains(GeoTIFFTagSet.getInstance()),
+            "must contain GeoTIFFTagSet");
+
+        TIFFTagSet gps = ExifGPSTagSet.getInstance();
+        param.addAllowedTagSet(gps);
+        check(param.getAllowedTagSets().contains(gps),
+            "must contain ExifGPSTagSet");
+
+        param.removeAllowedTagSet(gps);
+        check(!param.getAllowedTagSets().contains(gps),
+            "must not contain ExifGPSTagSet");
+
+        // check that repeating remove goes properly
+        param.removeAllowedTagSet(gps);
+
+        boolean ok = false;
+        try { param.addAllowedTagSet(null); }
+        catch (IllegalArgumentException e) { ok = true; }
+        check(ok, "must not be able to add null tag set");
+
+        ok = false;
+        try { param.removeAllowedTagSet(null); }
+        catch (IllegalArgumentException e) { ok = true; }
+        check(ok, "must not be able to remove null tag set");
+    }
+
+    private void run() {
+
+        simpleChecks();
+
+        try {
+
+            writeImage();
+
+            TIFFTagSet
+                empty[] = {},
+                geo[]   = {  GeoTIFFTagSet.getInstance() },
+                exif[]  = { ExifTIFFTagSet.getInstance() },
+                gps[]   = {  ExifGPSTagSet.getInstance() },
+                fax[]   = {  FaxTIFFTagSet.getInstance() };
+
+            // default param state
+            TIFFDirectory dir = getDir(empty, empty);
+            // Geo and Fax are default allowed tag sets
+            check(dir.containsTIFFField(GEO_N), "must contain Geo field");
+            checkASCIIValue(dir, "Geo", GEO_DATA, GEO_N);
+            check(dir.containsTIFFField(FAX_N), "must contain Fax field");
+            check(
+                (dir.getTIFFField(FAX_N).getCount() == 1) &&
+                (dir.getTIFFField(FAX_N).getAsInt(0) == FAX_DATA),
+                "invalid Fax field value");
+
+            // corresponding tag sets are non-default
+            check(!dir.containsTIFFField(EXIF_N), "must not contain Geo field");
+            check(!dir.containsTIFFField(GPS_N), "must not contain GPS field");
+
+            // remove Fax
+            dir = getDir(empty, fax);
+            check(!dir.containsTIFFField(FAX_N), "must not contain Fax field");
+
+            // add EXIF, remove Geo
+            dir = getDir(exif, geo);
+            check(dir.containsTIFFField(EXIF_N), "must contain EXIF field");
+            checkASCIIValue(dir, "EXIF", EXIF_DATA, EXIF_N);
+            check(!dir.containsTIFFField(GEO_N), "must not contain Geo field");
+
+            // add GPS
+            dir = getDir(gps, empty);
+            check(dir.containsTIFFField(GPS_N), "must contain GPS field");
+            checkASCIIValue(dir, "GPS", GPS_DATA, GPS_N);
+
+        } catch (Exception e) { throw new RuntimeException(e); }
+    }
+
+    public static void main(String[] args) {
+        (new TIFFImageReadParamTest()).run();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/midi/Gervill/AudioFloatConverter/Bits16ToFromFloatArray.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,101 @@
+/*
+ * 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.util.Arrays;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
+
+import com.sun.media.sound.AudioFloatConverter;
+
+import static javax.sound.sampled.AudioFormat.Encoding.*;
+
+/**
+ * @test
+ * @bug 8152501
+ * @modules java.desktop/com.sun.media.sound
+ */
+public final class Bits16ToFromFloatArray {
+
+    private static final int SIZE = 16;
+
+    private static final float[] FLOATS = {-1.0f, 0, 1.0f};
+
+    private static short MID_U = (short) (Short.MAX_VALUE + 1);
+    private static short MAX_U = -1;
+
+    // BIG ENDIAN
+    private static final byte[] SIGNED_BIG = {
+            (byte) (Short.MIN_VALUE >> 8), (byte) (Short.MIN_VALUE & 0xff), 0,
+            0, (byte) (Short.MAX_VALUE >> 8), (byte) (Short.MAX_VALUE & 0xff)
+    };
+
+    private static final byte[] UNSIGNED_BIG = {
+            0, 0, (byte) (MID_U >> 8), (byte) (MID_U & 0xff),
+            (byte) (MAX_U >> 8), (byte) (MAX_U >> 8)
+    };
+
+    // LITTLE ENDIAN
+    private static final byte[] SIGNED_LITTLE = {
+            (byte) (Short.MIN_VALUE & 0xff), (byte) (Short.MIN_VALUE >> 8), 0,
+            0, (byte) (Short.MAX_VALUE & 0xff), (byte) (Short.MAX_VALUE >> 8)
+    };
+
+    private static final byte[] UNSIGNED_LITTLE = {
+            0, 0, (byte) (MID_U & 0xff), (byte) (MID_U >> 8),
+            (byte) (MAX_U >> 8), (byte) (MAX_U >> 8)
+    };
+
+    public static void main(final String[] args) {
+        test(PCM_UNSIGNED, UNSIGNED_BIG, true);
+        test(PCM_UNSIGNED, UNSIGNED_LITTLE, false);
+        test(PCM_SIGNED, SIGNED_LITTLE, false);
+        test(PCM_SIGNED, SIGNED_BIG, true);
+    }
+
+    private static void test(final Encoding enc, final byte[] expected,
+                             boolean end) {
+        System.err.println("enc = " + enc);
+        AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
+                                         end);
+        byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
+        AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
+
+        conv.toByteArray(FLOATS, bytes);
+
+        if (!Arrays.equals(bytes, expected)) {
+            System.err.println("Actual: " + Arrays.toString(bytes));
+            System.err.println("Expected: " + Arrays.toString(expected));
+            throw new RuntimeException();
+        }
+
+        float[] floats = new float[bytes.length / af.getFrameSize()];
+        conv.toFloatArray(bytes, floats);
+
+        if (!Arrays.equals(floats, FLOATS)) {
+            System.err.println("Actual: " + Arrays.toString(floats));
+            System.err.println("Expected: " + Arrays.toString(FLOATS));
+            throw new RuntimeException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/midi/Gervill/AudioFloatConverter/Bits24ToFromFloatArray.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,126 @@
+/*
+ * 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.util.Arrays;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
+
+import com.sun.media.sound.AudioFloatConverter;
+
+import static javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED;
+import static javax.sound.sampled.AudioFormat.Encoding.PCM_UNSIGNED;
+
+/**
+ * @test
+ * @bug 8152501
+ * @modules java.desktop/com.sun.media.sound
+ */
+public final class Bits24ToFromFloatArray {
+
+    private static final int SIZE = 24;
+
+    private static final float[] FLOATS = {-1.0f, 0, 1.0f};
+
+    private static int MIN_S = -8_388_608;
+    private static int MAX_S = 8_388_607;
+
+    private static int MID_U = 0xFFFFFF / 2 + 1;
+    private static int MAX_U = 0xFFFFFF;
+
+    // BIG ENDIAN
+    private static final byte[] SIGNED_BIG = {
+            (byte) ((MIN_S >> 16) & 0xff),
+            (byte) ((MIN_S >> 8) & 0xff),
+            (byte) ((MIN_S >> 0) & 0xff),
+            0, 0, 0,
+            (byte) ((MAX_S >> 16) & 0xff),
+            (byte) ((MAX_S >> 8) & 0xff),
+            (byte) ((MAX_S >> 0) & 0xff),
+    };
+
+    private static final byte[] UNSIGNED_BIG = {
+            0, 0, 0,
+            (byte) ((MID_U >> 16) & 0xff),
+            (byte) ((MID_U >> 8) & 0xff),
+            (byte) ((MID_U >> 0) & 0xff),
+            (byte) ((MAX_U >> 16) & 0xff),
+            (byte) ((MAX_U >> 8) & 0xff),
+            (byte) ((MAX_U >> 0) & 0xff),
+
+    };
+
+    // LITTLE ENDIAN
+    private static final byte[] SIGNED_LITTLE = {
+            (byte) ((MIN_S >> 0) & 0xff),
+            (byte) ((MIN_S >> 8) & 0xff),
+            (byte) ((MIN_S >> 16) & 0xff),
+            0, 0, 0,
+            (byte) ((MAX_S >> 0) & 0xff),
+            (byte) ((MAX_S >> 8) & 0xff),
+            (byte) ((MAX_S >> 16) & 0xff),
+            };
+
+    private static final byte[] UNSIGNED_LITTLE = {
+            0, 0, 0,
+            (byte) ((MID_U >> 0) & 0xff),
+            (byte) ((MID_U >> 8) & 0xff),
+            (byte) ((MID_U >> 16) & 0xff),
+            (byte) ((MAX_U >> 0) & 0xff),
+            (byte) ((MAX_U >> 8) & 0xff),
+            (byte) ((MAX_U >> 16) & 0xff),
+            };
+
+    public static void main(final String[] args) {
+        test(PCM_UNSIGNED, UNSIGNED_BIG, true);
+        test(PCM_UNSIGNED, UNSIGNED_LITTLE, false);
+        test(PCM_SIGNED, SIGNED_LITTLE, false);
+        test(PCM_SIGNED, SIGNED_BIG, true);
+    }
+
+    private static void test(final Encoding enc, final byte[] expected,
+                             boolean end) {
+        System.err.println(enc);
+        AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
+                                         end);
+        byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
+        AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
+
+        conv.toByteArray(FLOATS, bytes);
+
+        if (!Arrays.equals(bytes, expected)) {
+            System.err.println("Actual: " + Arrays.toString(bytes));
+            System.err.println("Expected: " + Arrays.toString(expected));
+            throw new RuntimeException();
+        }
+
+        float[] floats = new float[bytes.length / af.getFrameSize()];
+        conv.toFloatArray(bytes, floats);
+
+        if (!Arrays.equals(floats, FLOATS)) {
+            System.err.println("Actual: " + Arrays.toString(floats));
+            System.err.println("Expected: " + Arrays.toString(FLOATS));
+            throw new RuntimeException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/midi/Gervill/AudioFloatConverter/Bits32ToFromFloatArray.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,130 @@
+/*
+ * 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.util.Arrays;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
+
+import com.sun.media.sound.AudioFloatConverter;
+
+import static javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED;
+import static javax.sound.sampled.AudioFormat.Encoding.PCM_UNSIGNED;
+
+/**
+ * @test
+ * @bug 8152501
+ * @modules java.desktop/com.sun.media.sound
+ */
+public final class Bits32ToFromFloatArray {
+
+    private static final int SIZE = 32;
+
+    private static final float[] FLOATS = {-1.0f, 0, 1.0f};
+
+    private static int MID_U = (int) (Integer.MAX_VALUE + 1);
+    private static int MAX_U = -1;
+
+    // BIG ENDIAN
+    private static final byte[] SIGNED_BIG = {
+            (byte) ((Integer.MIN_VALUE >> 24) & 0xff),
+            (byte) ((Integer.MIN_VALUE >> 16) & 0xff),
+            (byte) ((Integer.MIN_VALUE >> 8) & 0xff),
+            (byte) ((Integer.MIN_VALUE >> 0) & 0xff),
+            0, 0, 0, 0,
+            (byte) ((Integer.MAX_VALUE >> 24) & 0xff),
+            (byte) ((Integer.MAX_VALUE >> 16) & 0xff),
+            (byte) ((Integer.MAX_VALUE >> 8) & 0xff),
+            (byte) ((Integer.MAX_VALUE >> 0) & 0xff),
+    };
+
+    private static final byte[] UNSIGNED_BIG = {
+            0, 0, 0, 0,
+            (byte) ((MID_U >> 24) & 0xff),
+            (byte) ((MID_U >> 16) & 0xff),
+            (byte) ((MID_U >> 8) & 0xff),
+            (byte) ((MID_U >> 0) & 0xff),
+            (byte) ((MAX_U >> 24) & 0xff),
+            (byte) ((MAX_U >> 16) & 0xff),
+            (byte) ((MAX_U >> 8) & 0xff),
+            (byte) ((MAX_U >> 0) & 0xff),
+
+    };
+
+    // LITTLE ENDIAN
+    private static final byte[] SIGNED_LITTLE = {
+            (byte) ((Integer.MIN_VALUE >> 0) & 0xff),
+            (byte) ((Integer.MIN_VALUE >> 8) & 0xff),
+            (byte) ((Integer.MIN_VALUE >> 16) & 0xff),
+            (byte) ((Integer.MIN_VALUE >> 24) & 0xff),
+            0, 0, 0, 0,
+            (byte) ((Integer.MAX_VALUE >> 0) & 0xff),
+            (byte) ((Integer.MAX_VALUE >> 8) & 0xff),
+            (byte) ((Integer.MAX_VALUE >> 16) & 0xff),
+            (byte) ((Integer.MAX_VALUE >> 24) & 0xff),
+            };
+
+    private static final byte[] UNSIGNED_LITTLE = {
+            0, 0, 0, 0,
+            (byte) ((MID_U >> 0) & 0xff),
+            (byte) ((MID_U >> 8) & 0xff),
+            (byte) ((MID_U >> 16) & 0xff),
+            (byte) ((MID_U >> 24) & 0xff),
+            (byte) ((MAX_U >> 0) & 0xff),
+            (byte) ((MAX_U >> 8) & 0xff),
+            (byte) ((MAX_U >> 16) & 0xff),
+            (byte) ((MAX_U >> 24) & 0xff),
+            };
+
+    public static void main(final String[] args) {
+        test(PCM_UNSIGNED, UNSIGNED_BIG, true);
+        test(PCM_UNSIGNED, UNSIGNED_LITTLE, false);
+        test(PCM_SIGNED, SIGNED_LITTLE, false);
+        test(PCM_SIGNED, SIGNED_BIG, true);
+    }
+
+    private static void test(final Encoding enc, final byte[] expected,
+                             boolean end) {
+        AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
+                                         end);
+        byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
+        AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
+
+        conv.toByteArray(FLOATS, bytes);
+
+        if (!Arrays.equals(bytes, expected)) {
+            System.err.println("Actual: " + Arrays.toString(bytes));
+            System.err.println("Expected: " + Arrays.toString(expected));
+            throw new RuntimeException();
+        }
+
+        float[] floats = new float[bytes.length / af.getFrameSize()];
+        conv.toFloatArray(bytes, floats);
+
+        if (!Arrays.equals(floats, FLOATS)) {
+            System.err.println("Actual: " + Arrays.toString(floats));
+            System.err.println("Expected: " + Arrays.toString(FLOATS));
+            throw new RuntimeException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/midi/Gervill/AudioFloatConverter/Bits64ToFromFloatArray.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,142 @@
+/*
+ * 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.util.Arrays;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
+
+import com.sun.media.sound.AudioFloatConverter;
+
+import static javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED;
+import static javax.sound.sampled.AudioFormat.Encoding.PCM_UNSIGNED;
+
+/**
+ * @test
+ * @bug 8152501
+ * @modules java.desktop/com.sun.media.sound
+ */
+public final class Bits64ToFromFloatArray {
+
+    private static final int SIZE = 64;
+
+    private static final float[] FLOATS = {-1.0f, 0, 1.0f};
+
+    private static long MID_U = (long) (Long.MAX_VALUE + 1);
+    private static long MAX_U = -1;
+
+    // BIG ENDIAN
+    private static final byte[] SIGNED_BIG = {
+            (byte) ((Long.MIN_VALUE >> 56) & 0xff),
+            (byte) ((Long.MIN_VALUE >> 48) & 0xff),
+            (byte) ((Long.MIN_VALUE >> 40) & 0xff),
+            (byte) ((Long.MIN_VALUE >> 32) & 0xff),
+            0, 0, 0, 0, // current javasound impl will ignore this
+            0, 0, 0, 0,
+            0, 0, 0, 0,
+            (byte) ((Long.MAX_VALUE >> 56) & 0xff),
+            (byte) ((Long.MAX_VALUE >> 48) & 0xff),
+            (byte) ((Long.MAX_VALUE >> 40) & 0xff),
+            (byte) ((Long.MAX_VALUE >> 32) & 0xff),
+            0, 0, 0, 0, // current javasound impl will ignore this
+    };
+
+    private static final byte[] UNSIGNED_BIG = {
+            0, 0, 0, 0,
+            0, 0, 0, 0,
+            (byte) ((MID_U >> 56) & 0xff),
+            (byte) ((MID_U >> 48) & 0xff),
+            (byte) ((MID_U >> 40) & 0xff),
+            (byte) ((MID_U >> 32) & 0xff),
+            0, 0, 0, 0, // current javasound impl will ignore this
+            (byte) ((MAX_U >> 56) & 0xff),
+            (byte) ((MAX_U >> 48) & 0xff),
+            (byte) ((MAX_U >> 40) & 0xff),
+            (byte) ((MAX_U >> 32) & 0xff),
+            0, 0, 0, 0, // current javasound impl will ignore this
+    };
+
+    // LITTLE ENDIAN
+    private static final byte[] SIGNED_LITTLE = {
+            0, 0, 0, 0, // current javasound impl will ignore this
+            (byte) ((Long.MIN_VALUE >> 32) & 0xff),
+            (byte) ((Long.MIN_VALUE >> 40) & 0xff),
+            (byte) ((Long.MIN_VALUE >> 48) & 0xff),
+            (byte) ((Long.MIN_VALUE >> 56) & 0xff),
+            0, 0, 0, 0,
+            0, 0, 0, 0,
+            0, 0, 0, 0, // current javasound impl will ignore this
+            (byte) ((Long.MAX_VALUE >> 32) & 0xff),
+            (byte) ((Long.MAX_VALUE >> 40) & 0xff),
+            (byte) ((Long.MAX_VALUE >> 48) & 0xff),
+            (byte) ((Long.MAX_VALUE >> 56) & 0xff),
+            };
+
+    private static final byte[] UNSIGNED_LITTLE = {
+            0, 0, 0, 0,
+            0, 0, 0, 0,
+            0, 0, 0, 0, // current javasound impl will ignore this
+            (byte) ((MID_U >> 32) & 0xff),
+            (byte) ((MID_U >> 40) & 0xff),
+            (byte) ((MID_U >> 48) & 0xff),
+            (byte) ((MID_U >> 56) & 0xff),
+            0, 0, 0, 0, // current javasound impl will ignore this
+            (byte) ((MAX_U >> 32) & 0xff),
+            (byte) ((MAX_U >> 40) & 0xff),
+            (byte) ((MAX_U >> 48) & 0xff),
+            (byte) ((MAX_U >> 56) & 0xff),
+            };
+
+    public static void main(final String[] args) {
+        test(PCM_UNSIGNED, UNSIGNED_BIG, true);
+        test(PCM_UNSIGNED, UNSIGNED_LITTLE, false);
+        test(PCM_SIGNED, SIGNED_LITTLE, false);
+        test(PCM_SIGNED, SIGNED_BIG, true);
+    }
+
+    private static void test(final Encoding enc, final byte[] expected,
+                             boolean end) {
+        System.err.println(enc);
+        AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
+                                         end);
+        byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
+        AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
+
+        conv.toByteArray(FLOATS, bytes);
+
+        if (!Arrays.equals(bytes, expected)) {
+            System.err.println("Actual:   " + Arrays.toString(bytes));
+            System.err.println("Expected: " + Arrays.toString(expected));
+            throw new RuntimeException();
+        }
+
+        float[] floats = new float[bytes.length / af.getFrameSize()];
+        conv.toFloatArray(bytes, floats);
+
+        if (!Arrays.equals(floats, FLOATS)) {
+            System.err.println("Actual: " + Arrays.toString(floats));
+            System.err.println("Expected: " + Arrays.toString(FLOATS));
+            throw new RuntimeException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/midi/Gervill/AudioFloatConverter/Bits8ToFromFloatArray.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,78 @@
+/*
+ * 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.util.Arrays;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioFormat.Encoding;
+
+import com.sun.media.sound.AudioFloatConverter;
+
+import static javax.sound.sampled.AudioFormat.Encoding.*;
+
+/**
+ * @test
+ * @bug 8152501
+ * @modules java.desktop/com.sun.media.sound
+ */
+public final class Bits8ToFromFloatArray {
+
+    private static final int SIZE = 8;
+
+    private static final float[] FLOATS = {-1.0f, 0, 1.0f};
+
+    private static final byte[] SIGNED = {Byte.MIN_VALUE, 0, Byte.MAX_VALUE};
+
+    private static final byte[] UNSIGNED = {
+            0, (byte) (Byte.MAX_VALUE + 1), (byte) -1
+    };
+
+    public static void main(final String[] args) {
+        test(PCM_UNSIGNED, UNSIGNED);
+        test(PCM_SIGNED, SIGNED);
+    }
+
+    private static void test(final Encoding enc, final byte[] expected) {
+        AudioFormat af = new AudioFormat(enc, 44100, SIZE, 1, SIZE / 8, 44100,
+                                         true);
+        byte[] bytes = new byte[FLOATS.length * af.getFrameSize()];
+        AudioFloatConverter conv = AudioFloatConverter.getConverter(af);
+
+        conv.toByteArray(FLOATS, bytes);
+
+        if (!Arrays.equals(bytes, expected)) {
+            System.err.println("Actual: " + Arrays.toString(bytes));
+            System.err.println("Expected: " + Arrays.toString(expected));
+            throw new RuntimeException();
+        }
+
+        float[] floats = new float[bytes.length / af.getFrameSize()];
+        conv.toFloatArray(bytes, floats);
+
+        if (!Arrays.equals(floats, FLOATS)) {
+            System.err.println("Actual: " + Arrays.toString(floats));
+            System.err.println("Expected: " + Arrays.toString(FLOATS));
+            throw new RuntimeException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,75 @@
+/*
+ * 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 8146301
+ * @summary Enter key does not work in a deserialized JFileChooser.
+ * @run main DeserializedJFileChooserTest
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+public class DeserializedJFileChooserTest {
+
+    private static int state = -1;
+    private static JFileChooser deserialized;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeLater( () -> {
+            try {
+                JFileChooser jfc = new JFileChooser();
+                ByteArrayOutputStream bos = new ByteArrayOutputStream();
+                ObjectOutputStream oos = new ObjectOutputStream(bos);
+                oos.writeObject(jfc);
+                oos.close();
+                ByteArrayInputStream bis =
+                        new ByteArrayInputStream(bos.toByteArray());
+                ObjectInputStream ois = new ObjectInputStream(bis);
+                deserialized = (JFileChooser) ois.readObject();
+                state = deserialized.showOpenDialog(null);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        });
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        robot.keyPress(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_ENTER);
+        robot.waitForIdle();
+        robot.delay(1000);
+        if (state != JFileChooser.APPROVE_OPTION) {
+            deserialized.cancelSelection();
+            throw new RuntimeException("Failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/DockIconRepaint/DockIconRepaint.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,127 @@
+/*
+ * 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.EventQueue;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.beans.PropertyVetoException;
+
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JPanel;
+
+/**
+ * @test
+ * @bug 8144166
+ * @requires (os.family == "mac")
+ */
+public final class DockIconRepaint {
+
+    private static volatile Color color;
+
+    private static JFrame frame;
+
+    private static JInternalFrame jif;
+
+    private static Robot robot;
+
+    private static Point iconLoc;
+
+    private static Rectangle iconBounds;
+
+    public static void main(final String[] args) throws Exception {
+        robot = new Robot();
+        EventQueue.invokeAndWait(DockIconRepaint::createUI);
+        try {
+            robot.waitForIdle();
+            color = Color.BLUE;
+            test();
+            color = Color.RED;
+            test();
+            color = Color.GREEN;
+            test();
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    private static void test() throws Exception {
+        // maximize the frame to force repaint
+        EventQueue.invokeAndWait(() -> {
+            try {
+                jif.setIcon(false);
+                jif.setMaximum(true);
+            } catch (PropertyVetoException e) {
+                throw new RuntimeException(e);
+            }
+        });
+        robot.waitForIdle();
+        Thread.sleep(1000);
+        // minimize the frame to dock, the icon should be up2date
+        EventQueue.invokeAndWait(() -> {
+            try {
+                jif.setIcon(true);
+            } catch (PropertyVetoException e) {
+                throw new RuntimeException(e);
+            }
+            iconLoc = jif.getDesktopIcon().getLocationOnScreen();
+            iconBounds = jif.getDesktopIcon().getBounds();
+        });
+        robot.waitForIdle();
+        Thread.sleep(1000);
+
+        final Color c = robot.getPixelColor(iconLoc.x + iconBounds.width / 2,
+                                            iconLoc.y + iconBounds.height / 2);
+        if (c.getRGB() != color.getRGB()) {
+            System.err.println("Exp: " + Integer.toHexString(color.getRGB()));
+            System.err.println("Actual: " + Integer.toHexString(c.getRGB()));
+            throw new RuntimeException("Wrong color.");
+        }
+    }
+
+    private static void createUI() {
+        frame = new JFrame();
+        frame.setUndecorated(true);
+        frame.setSize(300, 300);
+        frame.setLocationRelativeTo(null);
+        final JDesktopPane pane = new JDesktopPane();
+        final JPanel panel = new JPanel() {
+            @Override
+            protected void paintComponent(Graphics g) {
+                g.setColor(color);
+                g.fillRect(0, 0, getWidth(), getHeight());
+            }
+        };
+        jif = new JInternalFrame();
+        jif.add(panel);
+        jif.setVisible(true);
+        jif.setSize(300, 300);
+        pane.add(jif);
+        frame.add(pane);
+        frame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTabbedPane/8137169/ScrollableTabbedPaneTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,182 @@
+/*
+ * 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 8137169
+ * @summary verifies TabbedScrollPane minimum height for all Look and Feels
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main ScrollableTabbedPaneTest
+ */
+
+import java.awt.Robot;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+public class ScrollableTabbedPaneTest {
+
+    private static JFrame frame;
+    private static JTabbedPane pane;
+    private static Robot robot;
+    private static volatile String errorString = "";
+
+    public static void main(String[] args) throws Exception {
+        robot = new Robot();
+        robot.delay(1000);
+        UIManager.LookAndFeelInfo[] lookAndFeelArray
+                = UIManager.getInstalledLookAndFeels();
+        for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
+            executeCase(lookAndFeelItem.getClassName(),
+                        lookAndFeelItem.getName());
+        }
+        if (!"".equals(errorString)) {
+            throw new RuntimeException("Error Log:\n" + errorString);
+        }
+    }
+
+    private static void executeCase(String lookAndFeelString, String shortLAF)
+            throws Exception {
+        if (tryLookAndFeel(lookAndFeelString)) {
+            createUI(shortLAF);
+            stepsToExecute(shortLAF);
+
+            createLeftUI(shortLAF);
+            stepsToExecute(shortLAF);
+
+            createRightUI(shortLAF);
+            stepsToExecute(shortLAF);
+        }
+    }
+
+    private static void stepsToExecute(String shortLAF) throws Exception {
+        robot.delay(100);
+        runTestCase(shortLAF);
+        robot.delay(1000);
+        cleanUp();
+        robot.delay(1000);
+    }
+
+    private static boolean tryLookAndFeel(String lookAndFeelString)
+            throws Exception {
+        try {
+            UIManager.setLookAndFeel(
+                    lookAndFeelString);
+
+        } catch (UnsupportedLookAndFeelException
+                | ClassNotFoundException
+                | InstantiationException
+                | IllegalAccessException e) {
+            return false;
+        }
+        return true;
+    }
+
+    private static void cleanUp() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame.dispose();
+            }
+        });
+    }
+
+    private static void createUI(final String shortLAF)
+            throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame = new JFrame(shortLAF);
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.setVisible(true);
+                pane = new JTabbedPane();
+                pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
+                frame.add(pane);
+                frame.setSize(500, 500);
+            }
+        });
+    }
+    private static void createLeftUI(final String shortLAF)
+            throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame = new JFrame(shortLAF);
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.setVisible(true);
+                pane = new JTabbedPane();
+                pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
+                pane.setTabPlacement(SwingConstants.LEFT);
+                frame.add(pane);
+                frame.setSize(500, 500);
+            }
+        });
+    }
+
+    private static void createRightUI(final String shortLAF)
+            throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame = new JFrame(shortLAF);
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.setVisible(true);
+                pane = new JTabbedPane();
+                pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
+                pane.setTabPlacement(SwingConstants.RIGHT);
+                frame.add(pane);
+                frame.setSize(500, 500);
+            }
+        });
+    }
+
+    private static void runTestCase(String shortLAF) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                int i = 0;
+                int value= 0;
+                do {
+                    String title = "Tab" + (i + 1);
+                    pane.addTab(title, new JPanel());
+                    int tempValue = pane.getMinimumSize().height;
+                    if(value==0) {
+                        value = tempValue;
+                    }
+                    if(value != tempValue) {
+                        String error = "[" + shortLAF
+                            + "]: [Error]: TabbedScrollPane fails";
+                    errorString += error;
+                    }
+
+                    ++i;
+                } while (i < 10);
+            }
+        });
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/LookAndFeel/6897701/JMenuItemsTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,130 @@
+/*
+ * 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 6897701
+ * @summary Verify JMenu and JMenuItem Disabled state for Nimbus LAF
+ * @run main JMenuItemsTest
+ */
+import java.awt.Color;
+import java.awt.Rectangle;
+import java.awt.image.BufferedImage;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+public class JMenuItemsTest {
+
+    private static JFrame mainFrame;
+    private static JMenu disabledMenu;
+    private static JMenuItem disabledMenuItem;
+
+    public JMenuItemsTest() {
+        createUI();
+    }
+
+    private void createUI() {
+
+        mainFrame = new JFrame("Test");
+
+        disabledMenu = new JMenu("Disabled Menu");
+        disabledMenu.setForeground(Color.BLUE);
+        disabledMenu.setEnabled(false);
+
+        disabledMenuItem = new JMenuItem("Disabled MenuItem");
+        disabledMenuItem.setForeground(Color.BLUE);
+        disabledMenuItem.setEnabled(false);
+
+        JMenuBar menuBar = new JMenuBar();
+        menuBar = new JMenuBar();
+        menuBar.add(disabledMenu);
+        menuBar.add(disabledMenuItem);
+
+        mainFrame.add(menuBar);
+        mainFrame.pack();
+        mainFrame.setVisible(true);
+    }
+
+    private void dispose() {
+        mainFrame.dispose();
+    }
+
+    private void testDisabledStateOfJMenu() {
+
+        // Test disabled JMenu state
+        Rectangle rect = disabledMenu.getBounds();
+        BufferedImage image = new BufferedImage(rect.width, rect.height,
+                BufferedImage.TYPE_INT_ARGB);
+        disabledMenu.paint(image.getGraphics());
+        int y = image.getHeight() / 2;
+        for (int x = 0; x < image.getWidth(); x++) {
+            Color c = new Color(image.getRGB(x, y));
+            if (c.equals(Color.BLUE)) {
+                dispose();
+                throw new RuntimeException("JMenu Disabled"
+                        + " State not Valid.");
+            }
+        }
+
+    }
+
+    private void testDisabledStateOfJMenuItem() {
+
+        // Test disabled JMenuItem state
+        Rectangle rect = disabledMenuItem.getBounds();
+        BufferedImage image = new BufferedImage(rect.width, rect.height,
+                BufferedImage.TYPE_INT_ARGB);
+        disabledMenuItem.paint(image.getGraphics());
+        int y = image.getHeight() / 2;
+        for (int x = 0; x < image.getWidth(); x++) {
+            Color c = new Color(image.getRGB(x, y));
+            if (c.equals(Color.BLUE)) {
+                dispose();
+                throw new RuntimeException("JMenuItem Disabled"
+                        + " State not Valid.");
+            }
+        }
+
+    }
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
+        SwingUtilities.invokeAndWait(() -> {
+
+            try {
+                JMenuItemsTest obj = new JMenuItemsTest();
+                obj.testDisabledStateOfJMenu();
+                obj.testDisabledStateOfJMenuItem();
+                obj.dispose();
+
+            } catch (Exception ex) {
+                throw ex;
+            }
+
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/CSS/ColorValue/RGBColorValueTest.java	Tue Apr 05 09:17:15 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8149631
+ * @summary rgb(...) CSS color values are not parsed properly
+ * @run main RGBColorValueTest
+ */
+
+import javax.swing.text.AttributeSet;
+import javax.swing.text.html.StyleSheet;
+
+import static javax.swing.text.html.CSS.Attribute.*;
+
+public class RGBColorValueTest {
+
+    public static void main(String[] args) {
+        StyleSheet styleSheet = new StyleSheet();
+        AttributeSet attributeSet = styleSheet.
+             getDeclaration("border-color: rgb(1, 2, 3)    rgb(1, 2, 4);");
+        if (!attributeSet.getAttribute(BORDER_TOP_COLOR).toString()
+                                                  .equals("rgb(1, 2, 3)") ||
+            !attributeSet.getAttribute(BORDER_BOTTOM_COLOR).toString()
+                                                  .equals("rgb(1, 2, 3)") ||
+            !attributeSet.getAttribute(BORDER_RIGHT_COLOR).toString()
+                                                  .equals("rgb(1, 2, 4)") ||
+            !attributeSet.getAttribute(BORDER_LEFT_COLOR).toString()
+                                                  .equals("rgb(1, 2, 4)") ) {
+            throw new RuntimeException("Failed");
+        }
+    }
+}