Merge
authorprr
Mon, 08 Feb 2016 09:41:53 -0800
changeset 35995 a4f500294ab3
parent 35994 3e67412f1556 (diff)
parent 35716 07ecc6d51751 (current diff)
child 35996 58d7e425291a
child 36443 d9d59282fc1a
Merge
jdk/test/jdk/internal/misc/JavaLangAccess/FormatUnsigned.java
--- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/ServiceRegistry.java	Mon Feb 08 09:41:53 2016 -0800
@@ -759,7 +759,7 @@
         this.category = category;
     }
 
-    public boolean registerServiceProvider(Object provider) {
+    public synchronized boolean registerServiceProvider(Object provider) {
         Object oprovider = map.get(provider.getClass());
         boolean present =  oprovider != null;
 
@@ -781,7 +781,7 @@
      *
      * @return true if the provider was previously registered.
      */
-    public boolean deregisterServiceProvider(Object provider) {
+    public synchronized boolean deregisterServiceProvider(Object provider) {
         Object oprovider = map.get(provider.getClass());
 
         if (provider == oprovider) {
@@ -797,22 +797,23 @@
         return false;
     }
 
-    public boolean contains(Object provider) {
+    public synchronized boolean contains(Object provider) {
         Object oprovider = map.get(provider.getClass());
         return oprovider == provider;
     }
 
-    public boolean setOrdering(Object firstProvider,
-                               Object secondProvider) {
+    public synchronized boolean setOrdering(Object firstProvider,
+                                            Object secondProvider) {
         return poset.setOrdering(firstProvider, secondProvider);
     }
 
-    public boolean unsetOrdering(Object firstProvider,
-                                 Object secondProvider) {
+    public synchronized boolean unsetOrdering(Object firstProvider,
+                                              Object secondProvider) {
         return poset.unsetOrdering(firstProvider, secondProvider);
     }
 
-    public Iterator<Object> getServiceProviders(boolean useOrdering) {
+    public synchronized Iterator<Object> getServiceProviders
+                                         (boolean useOrdering) {
         if (useOrdering) {
             return poset.iterator();
         } else {
@@ -821,11 +822,12 @@
     }
 
     @SuppressWarnings("unchecked")
-    public <T> T getServiceProviderByClass(Class<T> providerClass) {
+    public synchronized <T> T getServiceProviderByClass
+                              (Class<T> providerClass) {
         return (T)map.get(providerClass);
     }
 
-    public void clear() {
+    public synchronized void clear() {
         Iterator<Object> iter = map.values().iterator();
         while (iter.hasNext()) {
             Object provider = iter.next();
@@ -839,7 +841,7 @@
         poset.clear();
     }
 
-    public void finalize() {
+    public synchronized void finalize() {
         clear();
     }
 }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Mon Feb 08 09:41:53 2016 -0800
@@ -3118,8 +3118,7 @@
                 invalidateTransform();
             }
             return result;
-        } else if (resolutionVariantHint != SunHints.INTVAL_RESOLUTION_VARIANT_BASE
-                   && (img instanceof MultiResolutionImage)) {
+        } else if (img instanceof MultiResolutionImage) {
             // get scaled destination image size
 
             int width = img.getWidth(observer);
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java	Mon Feb 08 09:41:53 2016 -0800
@@ -79,7 +79,6 @@
 
     static enum InitialiseState {
         INITIALISING,
-        NOT_INITIALISED,
         INITIALISED,
         FAILED_INITIALISATION
     };
@@ -122,7 +121,6 @@
      */
     void instantPreInit(XCreateWindowParams params) {
         state_lock = new StateLock();
-        initialising = InitialiseState.NOT_INITIALISED;
     }
 
     /**
@@ -131,7 +129,6 @@
      */
     void preInit(XCreateWindowParams params) {
         state_lock = new StateLock();
-        initialising = InitialiseState.NOT_INITIALISED;
         embedded = Boolean.TRUE.equals(params.get(EMBEDDED));
         visible = Boolean.TRUE.equals(params.get(VISIBLE));
 
@@ -223,7 +220,6 @@
                       return false;
                   }
                   return true;
-              case NOT_INITIALISED:
               case FAILED_INITIALISATION:
                   return false;
               default:
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java	Mon Feb 08 09:41:53 2016 -0800
@@ -452,8 +452,12 @@
     public VolatileImage createBackBufferImage(Component target,
                                                long backBuffer)
     {
+        // it is possible for the component to have size 0x0, adjust it to
+        // be at least 1x1 to avoid IAE
+        int w = Math.max(1, target.getWidth());
+        int h = Math.max(1, target.getHeight());
         return new SunVolatileImage(target,
-                                    target.getWidth(), target.getHeight(),
+                                    w, h,
                                     Long.valueOf(backBuffer));
     }
 
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java	Mon Feb 08 09:41:53 2016 -0800
@@ -641,10 +641,21 @@
             GraphicsEnvironment.getLocalGraphicsEnvironment();
         return ge.getXResolution();
     }
+
     @Override
-    protected native int getScreenWidth();
+    protected int getScreenWidth() {
+        return GraphicsEnvironment.getLocalGraphicsEnvironment()
+                .getDefaultScreenDevice().getDefaultConfiguration()
+                .getBounds().width;
+    }
+
     @Override
-    protected native int getScreenHeight();
+    protected int getScreenHeight() {
+        return GraphicsEnvironment.getLocalGraphicsEnvironment()
+                .getDefaultScreenDevice().getDefaultConfiguration()
+                .getBounds().height;
+    }
+
     private native Insets getScreenInsets(int screen);
 
 
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/opengl/WGLGraphicsConfig.java	Mon Feb 08 09:41:53 2016 -0800
@@ -323,8 +323,12 @@
     @Override
     public VolatileImage createBackBuffer(WComponentPeer peer) {
         Component target = (Component)peer.getTarget();
+        // it is possible for the component to have size 0x0, adjust it to
+        // be at least 1x1 to avoid IAE
+        int w = Math.max(1, target.getWidth());
+        int h = Math.max(1, target.getHeight());
         return new SunVolatileImage(target,
-                                    target.getWidth(), target.getHeight(),
+                                    w, h,
                                     Boolean.TRUE);
     }
 
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextArea.cpp	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextArea.cpp	Mon Feb 08 09:41:53 2016 -0800
@@ -73,10 +73,7 @@
 }
 
 void AwtTextArea::EditSetSel(CHARRANGE &cr) {
-    // Fix for 5003402: added restoring/hiding selection to enable automatic scrolling
-    SendMessage(EM_HIDESELECTION, FALSE, TRUE);
     SendMessage(EM_EXSETSEL, 0, reinterpret_cast<LPARAM>(&cr));
-    SendMessage(EM_HIDESELECTION, TRUE, TRUE);
     // 6417581: force expected drawing
     if (IS_WINVISTA && cr.cpMin == cr.cpMax) {
         ::InvalidateRect(GetHWnd(), NULL, TRUE);
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp	Mon Feb 08 09:41:53 2016 -0800
@@ -2347,53 +2347,6 @@
 
 /*
  * Class:     sun_awt_windows_WToolkit
- * Method:    getScreenWidth
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL
-Java_sun_awt_windows_WToolkit_getScreenWidth(JNIEnv *env, jobject self)
-{
-    TRY;
-
-    int width = ::GetSystemMetrics(SM_CXSCREEN);
-
-    if (!Devices::GetInstance()) {
-        Devices::UpdateInstance(env);
-    }
-    Devices::InstanceAccess devices;
-    AwtWin32GraphicsDevice *device = devices->GetDevice(
-                        AwtWin32GraphicsDevice::GetDefaultDeviceIndex());
-
-    return (device == NULL) ? width : device->ScaleDownX(width);
-    CATCH_BAD_ALLOC_RET(0);
-}
-
-/*
- * Class:     sun_awt_windows_WToolkit
- * Method:    getScreenHeight
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL
-Java_sun_awt_windows_WToolkit_getScreenHeight(JNIEnv *env, jobject self)
-{
-    TRY;
-
-    int height = ::GetSystemMetrics(SM_CYSCREEN);
-
-    if (!Devices::GetInstance()) {
-        Devices::UpdateInstance(env);
-    }
-    Devices::InstanceAccess devices;
-    AwtWin32GraphicsDevice *device = devices->GetDevice(
-                        AwtWin32GraphicsDevice::GetDefaultDeviceIndex());
-
-    return (device == NULL) ? height : device->ScaleDownY(height);
-
-    CATCH_BAD_ALLOC_RET(0);
-}
-
-/*
- * Class:     sun_awt_windows_WToolkit
  * Method:    getSreenInsets
  * Signature: (I)Ljava/awt/Insets;
  */
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp	Mon Feb 08 09:41:53 2016 -0800
@@ -382,6 +382,9 @@
     if (wp->flags & SWP_HIDEWINDOW) {
         EnableTranslucency(FALSE);
     }
+    if (wp->flags & SWP_SHOWWINDOW) {
+        EnableTranslucency(TRUE);
+    }
 
     return mrDoDefault;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,304 @@
+/*
+ * 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
+ * @summary Test of mouse move messages to lightweight components
+ * @library ../../regtesthelpers
+ * @build Util
+ * @compile LightweightEventTest.java
+ * @run main LightweightEventTest
+ */
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.AWTException;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.SwingUtilities;
+import test.java.awt.regtesthelpers.Util;
+
+
+/*
+There are 3 steps to this test :
+1. Two frames are created one with heavy weight component and
+   another with light weight component. Each frame has a centrally placed
+   button
+2. Mouse is dragged along diagonals of each window using Robot object
+3. Events are noted for mouse in and out of frames & buttons and asserted
+*/
+
+public class LightweightEventTest {
+
+    private static EventBug HeavyComponent;
+    private static EventBug LightComponent;
+    private static Robot testRobot;
+
+    public static void main(String[] args) throws Throwable {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                constructTestUI();
+            }
+        });
+
+        try {
+            testRobot = new Robot();
+        } catch (AWTException ex) {
+            throw new RuntimeException("Could not initiate a drag operation");
+        }
+
+        testRobot.waitForIdle();
+
+        // Method performing auto test operation
+        boolean result = test();
+
+        disposeTestUI();
+
+        if (result == false) {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+
+    private static boolean test() {
+        // Test events for HeavyComponent
+        Point loc = HeavyComponent.getLocationOnScreen();
+        Dimension size = HeavyComponent.getSize();
+
+        Util.mouseMove(testRobot,
+                new Point((int) loc.x + 4, (int) loc.y + 4),
+                new Point((int) loc.x + size.width, (int) loc.y + size.height));
+
+        testRobot.waitForIdle();
+
+        boolean HeavyComponentAssert = HeavyComponent.assertEvents(2, 1);
+
+        // Test events for LightComponent
+        loc = LightComponent.getLocationOnScreen();
+        size = LightComponent.getSize();
+
+        Util.mouseMove(testRobot,
+                new Point((int) loc.x + 4, (int) loc.y + 4),
+                new Point((int) loc.x + size.width, (int) loc.y + size.height));
+
+        testRobot.waitForIdle();
+
+        boolean LightComponentAssert = LightComponent.assertEvents(2, 1);
+
+        return (HeavyComponentAssert && LightComponentAssert);
+    }
+
+    private static void constructTestUI() {
+        // here, create the items that will be tested for correct behavior
+        HeavyComponent = new EventBug();
+        Button b = (Button) HeavyComponent.add("Center", new Button("Heavy"));
+
+        LightComponent = new EventBug();
+        BorderedLabel b1 = (BorderedLabel) LightComponent.add("Center",
+                new BorderedLabel("Lite"));
+
+        HeavyComponent.addListeners(b);
+        LightComponent.addListeners(b1);
+
+        LightComponent.setLocation(200, 0);
+        HeavyComponent.setVisible(true);
+        LightComponent.setVisible(true);
+    }
+
+    private static void disposeTestUI() {
+        HeavyComponent.setVisible(false);
+        LightComponent.setVisible(false);
+
+        HeavyComponent.dispose();
+        LightComponent.dispose();
+    }
+}
+
+/*
+ * Lightweight component
+ */
+class BorderedLabel extends Component {
+
+    boolean superIsButton = false;
+    String labelString;
+
+    BorderedLabel(String labelString) {
+        this.labelString = labelString;
+
+        Component thisComponent = this;
+        superIsButton = (thisComponent instanceof Button);
+        if (superIsButton) {
+            ((Button) thisComponent).setLabel(labelString);
+        }
+    }
+
+    @Override
+    public Dimension getMinimumSize() {
+        Dimension minSize = new Dimension();
+
+        if (superIsButton) {
+            minSize = super.getMinimumSize();
+        } else {
+
+            Graphics g = getGraphics();
+            FontMetrics metrics = g.getFontMetrics();
+
+            minSize.width = metrics.stringWidth(labelString) + 14;
+            minSize.height = metrics.getMaxAscent()
+                    + metrics.getMaxDescent() + 9;
+
+            g.dispose();
+            g = null;
+        }
+        return minSize;
+    }
+
+    @Override
+    public Dimension getPreferredSize() {
+        Dimension prefSize;
+        if (superIsButton) {
+            prefSize = super.getPreferredSize();
+        } else {
+            prefSize = getMinimumSize();
+        }
+        return prefSize;
+    }
+
+    @Override
+    public void paint(Graphics g) {
+
+        super.paint(g);
+        Rectangle bounds = getBounds();
+        if (superIsButton) {
+            return;
+        }
+        Dimension size = getSize();
+        Color oldColor = g.getColor();
+
+        // draw border
+        g.setColor(getBackground());
+        g.fill3DRect(0, 0, size.width, size.height, false);
+        g.fill3DRect(3, 3, size.width - 6, size.height - 6, true);
+
+        // draw text
+        FontMetrics metrics = g.getFontMetrics();
+        int centerX = size.width / 2;
+        int centerY = size.height / 2;
+        int textX = centerX - (metrics.stringWidth(labelString) / 2);
+        int textY = centerY
+                + ((metrics.getMaxAscent() + metrics.getMaxDescent()) / 2);
+        g.setColor(getForeground());
+        g.drawString(labelString, textX, textY);
+
+        g.setColor(oldColor);
+    }
+} // class BorderedLabel
+
+class EventBug extends Container {
+
+    Frame testFrame;
+    int frameEnters = 0;
+    int frameExits = 0;
+    int buttonEnters = 0;
+    int buttonExits = 0;
+
+    public EventBug() {
+        super();
+        testFrame = new Frame();
+        testFrame.setLayout(new BorderLayout());
+        this.setLayout(new BorderLayout());
+        testFrame.add("Center", this);
+        testFrame.pack();
+        testFrame.setVisible(true);
+    }
+
+    @Override
+    public Dimension getPreferredSize() {
+        return new Dimension(100, 100);
+    }
+
+    @Override
+    public Insets getInsets() {
+        return new Insets(20, 20, 20, 20);
+    }
+
+    public boolean assertEvents(int expectedFrameEnterEvents,
+            int expectedButtonEnterEvents) {
+        return (frameEnters == expectedFrameEnterEvents)
+                && (buttonEnters == expectedButtonEnterEvents);
+    }
+
+    // Forward to the Window
+    @Override
+    public void setLocation(int x, int y) {
+        testFrame.setLocation(x, y);
+    }
+
+    @Override
+    public void setVisible(boolean b) {
+        testFrame.setVisible(b);
+    }
+
+    public void dispose() {
+        testFrame.dispose();
+    }
+
+    // Add listeners to Frame and button
+    public void addListeners(Component b) {
+        b.setName("Button");
+        b.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mouseEntered(MouseEvent e) {
+                buttonEnters++;
+            }
+
+            @Override
+            public void mouseExited(MouseEvent e) {
+                buttonExits++;
+            }
+
+        });
+        testFrame.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mouseEntered(MouseEvent e) {
+                frameEnters++;
+            }
+
+            @Override
+            public void mouseExited(MouseEvent e) {
+                frameExits++;
+            }
+        });
+    }
+} // class EventBug
--- a/jdk/test/java/awt/Mouse/TitleBarDoubleClick/TitleBarDoubleClick.java	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/test/java/awt/Mouse/TitleBarDoubleClick/TitleBarDoubleClick.java	Mon Feb 08 09:41:53 2016 -0800
@@ -71,7 +71,6 @@
             frame.addMouseListener(this);
             frame.addWindowListener(this);
             frame.setVisible(true);
-            Util.waitForIdle(robot);
     }// start()
 
     // Move the mouse into the title bar and double click to maximize the
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Paint/ComponentIsNotDrawnAfterRemoveAddTest/ComponentIsNotDrawnAfterRemoveAddTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,187 @@
+/*
+ * 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 8139581
+   @summary AWT components are not drawn after removal and addition to a container
+   @author Anton Litvinov
+ */
+
+import java.awt.Button;
+import java.awt.Color;
+import java.awt.Canvas;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Panel;
+import java.util.ArrayList;
+
+public class ComponentIsNotDrawnAfterRemoveAddTest {
+    private final Frame frame;
+    private final Panel panel;
+    private final ArrayList<Testable> compList = new ArrayList<Testable>();
+
+    public ComponentIsNotDrawnAfterRemoveAddTest() {
+        frame = new Frame("ComponentIsNotDrawnAfterRemoveAddTest");
+        frame.setSize(500, 500);
+        frame.setLocation(200, 200);
+        frame.setLayout(null);
+        frame.setBackground(Color.RED);
+
+        panel = new Panel();
+        panel.setLayout(null);
+        panel.setBounds(25, 100, 455, 295);
+        panel.setBackground(Color.GREEN);
+
+        for (int i = 0; i < 10; i++) {
+            TestCanvas canv1 = new TestCanvas();
+            canv1.setBounds(i * 45 + 5, 15, 30 + i, 30 + i);
+            panel.add(canv1);
+            compList.add(canv1);
+
+            TestButton btn1 = new TestButton();
+            btn1.setBounds(i * 45 + 5, 60, 30 + i, 30 + i);
+            panel.add(btn1);
+            compList.add(btn1);
+
+            TestCanvas canv2 = new TestCanvas();
+            canv2.setBounds(i * 45 + 5, 105, 30 + i, 30 + i);
+            panel.add(canv2);
+            compList.add(canv2);
+
+            TestButton btn2 = new TestButton();
+            btn2.setBounds(i * 45 + 5, 150, 30 + i, 30 + i);
+            panel.add(btn2);
+            compList.add(btn2);
+
+            TestCanvas canv3 = new TestCanvas();
+            canv3.setBounds(i * 45 + 5, 195, 30 + i, 30 + i);
+            panel.add(canv3);
+            compList.add(canv3);
+
+            TestButton btn3 = new TestButton();
+            btn3.setBounds(i * 45 + 5, 240, 30 + i, 30 + i);
+            panel.add(btn3);
+            compList.add(btn3);
+        }
+
+        frame.add(panel);
+        frame.setVisible(true);
+    }
+
+    private void runTest() {
+        try {
+            doSleep(1500);
+            checkTestableComponents();
+
+            for (int i = 0; i < 5; i++) {
+                System.err.println(String.format("Test iteration #%d:", i));
+
+                frame.remove(panel);
+                frame.invalidate();
+                frame.validate();
+                frame.add(panel);
+
+                doSleep(1500);
+                checkTestableComponents();
+            }
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    private void doSleep(long millis) {
+        try {
+            Thread.sleep(millis);
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        }
+    }
+
+    private void checkTestableComponents() throws RuntimeException {
+        int notDrawnCompsCount = 0;
+        for (Testable comp : compList) {
+            if (!comp.wasPaintCalled()) {
+                notDrawnCompsCount++;
+            } else {
+                comp.resetPaintCalledFlag();
+            }
+        }
+        if (notDrawnCompsCount > 0) {
+            throw new RuntimeException(String.format(
+                "'paint' method of %d components was not called.", notDrawnCompsCount));
+        }
+    }
+
+    private interface Testable {
+        boolean wasPaintCalled();
+        void resetPaintCalledFlag();
+    }
+
+    private static class TestCanvas extends Canvas implements Testable {
+        private volatile boolean paintWasCalled = false;
+
+        @Override
+        public void paint(Graphics g) {
+            paintWasCalled = true;
+            super.paint(g);
+            g.setColor(Color.BLUE);
+            g.fillRect(0, 0, getWidth(), getHeight());
+        }
+
+        @Override
+        public boolean wasPaintCalled() {
+            return paintWasCalled;
+        }
+
+        @Override
+        public void resetPaintCalledFlag() {
+            paintWasCalled = false;
+        }
+    }
+
+    private static class TestButton extends Button implements Testable {
+        private volatile boolean paintWasCalled = false;
+
+        @Override
+        public void paint(Graphics g) {
+            paintWasCalled = true;
+            super.paint(g);
+            g.setColor(Color.YELLOW);
+            g.fillRect(0, 0, 15, 15);
+        }
+
+        @Override
+        public boolean wasPaintCalled() {
+            return paintWasCalled;
+        }
+
+        @Override
+        public void resetPaintCalledFlag() {
+            paintWasCalled = false;
+        }
+    }
+
+    public static void main(String[] args) {
+        new ComponentIsNotDrawnAfterRemoveAddTest().runTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TextArea/TextAreaScrolling/TextAreaScrolling.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,107 @@
+/*
+ * 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 6180449
+ @summary TextArea scrolls to its left when selecting the text from the end.
+ @run main TextAreaScrolling
+ */
+
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.TextArea;
+import java.awt.event.InputEvent;
+
+public class TextAreaScrolling {
+    Frame mainFrame;
+    TextArea textArea;
+    Robot robot;
+
+    TextAreaScrolling() {
+        mainFrame = new Frame();
+        mainFrame.setSize(200, 200);
+        mainFrame.setLocation(200, 200);
+
+        textArea = new TextArea();
+        textArea.setText("1234 5678");
+        textArea.setSelectionStart(3);
+        textArea.setSelectionStart(4);
+        mainFrame.add(textArea);
+        mainFrame.setVisible(true);
+        textArea.requestFocusInWindow();
+
+        try {
+            robot = new Robot();
+            robot.setAutoWaitForIdle(true);
+        } catch (Exception ex) {
+            dispose();
+            System.exit(0);
+            throw new RuntimeException("Robot Creation Failed");
+        }
+    }
+
+    public void dispose() {
+        if (mainFrame != null) {
+            mainFrame.dispose();
+        }
+    }
+
+    public void performTest() {
+        Point loc = textArea.getLocationOnScreen();
+        Rectangle textAreaBounds = new Rectangle();
+        textArea.getBounds(textAreaBounds);
+
+        // Move mouse at center in first row of TextArea.
+        robot.mouseMove(loc.x + textAreaBounds.width / 2, loc.y + 5);
+
+        // Perform selection by scrolling to left from end of char sequence.
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseMove(textAreaBounds.x - 5, loc.y + 5);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        // Perform double click on beginning word of TextArea
+        robot.mouseMove(loc.x + 5, loc.y + 5);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.delay(100);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.delay(100);
+
+        if (textArea.getSelectedText().contentEquals("5678")) {
+            dispose();
+            throw new RuntimeException ("TextArea over scrolled towards left"
+                + "Expected selected text: '1234 ' and for mac '1234'"
+                + "Actual selected text: 5678");
+        }
+    }
+
+    public static void main(String argv[]) throws RuntimeException {
+        TextAreaScrolling test = new TextAreaScrolling();
+        test.performTest();
+        test.dispose();
+    }
+}
--- a/jdk/test/java/awt/Toolkit/GetSizeTest/GetScreenSizeTest.java	Mon Feb 08 17:37:46 2016 +0100
+++ b/jdk/test/java/awt/Toolkit/GetSizeTest/GetScreenSizeTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -23,7 +23,7 @@
 
 /*
   @test
-  @bug 8144074 8145785
+  @bug 8144074 8145785 8149151
   @summary Crash while getting screen size during Toolkit initialisation
   @run main/othervm GetScreenSizeTest
 */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/multiresolution/MultiDisplayTest/MultiDisplayTest.html	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,62 @@
+<!--
+ Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<head>
+<title> MultiDisplayTest </title>
+</head>
+<body>
+<applet code="MultiDisplayTest.class" width=100 height=30></applet>
+
+This test is for OS X or Windows only.
+For other OSes please simply push "Pass".
+
+The test requires two-display configuration, where
+
+- 1st display is operating in HiDPI mode;
+- 2nd display is non-HiDPI.
+
+In other cases please simply push "Pass".
+
+
+To run test please push "Start".
+
+Then drag parent / child to different displays and check
+that the proper image is shown for every window
+(must be "black 1x" for non-HiDPI and "blue 2x" for HiDPI).
+
+Please try to drag both parent and child,
+do it fast several times and check if no artefacts occur.
+
+Try to switch display resolution (high to low and back).
+
+For Mac OS X please check also the behavior for
+translucent windows appearing on the 2nd (non-active) display
+and Mission Control behavior.
+
+Close the windows.
+
+In case if no issues occur please push "Pass", otherwise "Fail".
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/multiresolution/MultiDisplayTest/MultiDisplayTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,147 @@
+/*
+ * 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 8142861 8143062 8147016
+  @summary Check if multiresolution image behaves properly
+           on HiDPI + non-HiDPI display pair.
+  @author a.stepanov
+  @library /lib/testlibrary
+  @build jdk.testlibrary.OSInfo
+  @run applet/manual=yesno MultiDisplayTest.html
+*/
+
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.*;
+import jdk.testlibrary.OSInfo;
+
+
+public class MultiDisplayTest extends Applet {
+
+    private static final int W = 200, H = 200;
+
+    private static final BaseMultiResolutionImage IMG =
+        new BaseMultiResolutionImage(new BufferedImage[]{
+        generateImage(1, Color.BLACK), generateImage(2, Color.BLUE)});
+
+    private static boolean checkOS() {
+        OSInfo.OSType os = OSInfo.getOSType();
+        return (os.equals(OSInfo.OSType.WINDOWS) ||
+            os.equals(OSInfo.OSType.MACOSX));
+    }
+
+    public void init() { this.setLayout(new BorderLayout()); }
+
+    public void start() {
+
+        Button b = new Button("Start");
+        b.setEnabled(checkOS());
+
+        b.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+
+                ParentFrame p = new ParentFrame();
+                new ChildDialog(p);
+            }
+        });
+
+        add(b, BorderLayout.CENTER);
+
+        validate();
+        setVisible(true);
+    }
+
+
+    private static BufferedImage generateImage(int scale, Color c) {
+
+        BufferedImage image = new BufferedImage(
+            scale * W, scale * H, BufferedImage.TYPE_INT_RGB);
+        Graphics g = image.getGraphics();
+        g.setColor(c);
+        g.fillRect(0, 0, scale * W, scale * H);
+
+        g.setColor(Color.WHITE);
+        Font f = g.getFont();
+        g.setFont(new Font(f.getName(), Font.BOLD, scale * 48));
+        g.drawChars((scale + "X").toCharArray(), 0, 2, scale * W / 2, scale * H / 2);
+
+        return image;
+    }
+
+    private static class ParentFrame extends Frame {
+
+        public ParentFrame() {
+            EventQueue.invokeLater(this::CreateUI);
+        }
+
+        private void CreateUI() {
+
+            addWindowListener(new WindowAdapter() {
+                @Override
+                public void windowClosing(WindowEvent e) { dispose(); }
+            });
+            setSize(W, H);
+            setLocation(50, 50);
+            setTitle("parent");
+            setResizable(false);
+            setVisible(true);
+        }
+
+        @Override
+        public void paint(Graphics gr) {
+            gr.drawImage(IMG, 0, 0, this);
+        }
+    }
+
+    private static class ChildDialog extends Dialog {
+
+        public ChildDialog(Frame f) {
+            super(f);
+            EventQueue.invokeLater(this::CreateUI);
+        }
+
+        private void CreateUI() {
+
+            addWindowListener(new WindowAdapter() {
+                @Override
+                public void windowClosing(WindowEvent e) { dispose(); }
+            });
+            setSize(W, H);
+            setTitle("child");
+            setResizable(false);
+            setModal(true);
+            setVisible(true);
+        }
+
+        @Override
+        public void paint(Graphics gr) {
+            gr.drawImage(IMG, 0, 0, this);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/tiff/TIFFTagSetTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,367 @@
+/*
+ * 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     8145780
+ * @author  a.stepanov
+ * @summary Some checks for TIFFTag, TIFFTagSet
+ * @run     main TIFFTagSetTest
+ */
+
+
+import javax.imageio.plugins.tiff.*;
+
+import java.lang.reflect.Method;
+import java.util.*;
+
+
+public class TIFFTagSetTest {
+
+    public static class TestSet extends TIFFTagSet {
+
+        public static final TIFFTagSet SOME_SET =
+            new TIFFTagSet(new ArrayList<TIFFTag>());
+
+        private static TestSet theInstance = null;
+
+        public static final int TAG_NUM_1  = 0;
+        public static final int TAG_NUM_2  = 666;
+        public static final int TAG_NUM_3  = Integer.MAX_VALUE;
+
+        public static final String TAG_NAME_1  = "tag-1";
+        public static final String TAG_NAME_2  = "tag-2";
+        public static final String TAG_NAME_3  = "tag-3";
+
+        public static final int VALUE_1 = 123;
+        public static final int VALUE_2 = 321;
+
+        public static final String VALUE_NAME_1 = "value-1";
+        public static final String VALUE_NAME_2 = "value-2";
+
+        public static final int VALUE_COUNT = 500;
+
+
+        static class Tag1 extends TIFFTag {
+            public Tag1() {
+                super(TAG_NAME_1,
+                      TAG_NUM_1,
+                      1 << TIFF_SHORT | 1 << TIFF_LONG,
+                      VALUE_COUNT);
+            }
+        }
+
+        static class Tag2 extends TIFFTag {
+            public Tag2() {
+                super(TAG_NAME_2,
+                      TAG_NUM_2,
+                      1 << TIFF_DOUBLE);
+
+                addValueName(VALUE_1, VALUE_NAME_1);
+                addValueName(VALUE_2, VALUE_NAME_2);
+            }
+        }
+
+        static class Tag3 extends TIFFTag {
+            public Tag3() {
+                super(TAG_NAME_3,
+                      TAG_NUM_3,
+                      SOME_SET);
+            }
+        }
+
+        private static List<TIFFTag> tags;
+
+        private static void initTags() {
+
+            tags = new ArrayList<TIFFTag>();
+
+            tags.add(new TestSet.Tag1());
+            tags.add(new TestSet.Tag2());
+            tags.add(new TestSet.Tag3());
+        }
+
+        private TestSet() { super(tags); }
+
+        public synchronized static TestSet getInstance() {
+
+            if (theInstance == null) {
+                initTags();
+                theInstance = new TestSet();
+                tags = null;
+            }
+            return theInstance;
+        }
+    }
+
+
+    private static void checkEq(String what, Object v, Object ref) {
+        if (v == null) {
+            throw new RuntimeException(what + " is null");
+        } else if (!v.equals(ref)) {
+            throw new RuntimeException("invalid " + what +
+                ", expected: " + ref + ", got: " + v);
+        }
+    }
+
+
+
+
+    private final String className;
+    public TIFFTagSetTest(String cName) { className = cName; }
+
+    public void testNamesNumbers() throws ReflectiveOperationException {
+
+        Class<?> c = Class.forName(className);
+
+        Method getInstance = c.getMethod("getInstance", new Class[]{});
+        Object o = getInstance.invoke(new Object[]{});
+
+        TIFFTagSet tagSet = (TIFFTagSet) o;
+        SortedSet tagNames   = tagSet.getTagNames();
+        SortedSet tagNumbers = tagSet.getTagNumbers();
+
+        int nTagNames = tagNames.size();
+        if (nTagNames != tagNumbers.size()) {
+            throw new RuntimeException("Error: unequal sizes for tag names set "
+                    + "and tag numbers set");
+        }
+        System.out.println("\n" + nTagNames + " tag names/numbers\n");
+
+        for (final Iterator itName = tagNames.iterator(); itName.hasNext(); ) {
+
+            String tagName = (String) itName.next();
+            // just in case
+            if (tagName == null) {
+                throw new RuntimeException("null tag name");
+            }
+
+            TIFFTag tagByName = tagSet.getTag(tagName);
+            System.out.println(
+                "name/number: \t" + tagName + "/" + tagByName.getNumber());
+            checkEq("tag name", tagByName.getName(), tagName);
+            TIFFTag tagByNum = tagSet.getTag(tagByName.getNumber());
+            checkEq("tag name", tagByNum.getName(), tagName);
+
+            if (tagByName.isIFDPointer() &&
+               !tagByName.isDataTypeOK(TIFFTag.TIFF_IFD_POINTER)) {
+                throw new RuntimeException("Error: " + tagName +
+                    "must be an IFD pointer");
+            }
+        }
+        System.out.println("");
+
+        for (final Iterator itNum = tagNumbers.iterator(); itNum.hasNext(); ) {
+
+            int tagNum = (int) itNum.next();
+            // just in case
+            if (tagNum < 0) {
+                throw new RuntimeException("negative tag number");
+            }
+            TIFFTag tagByNum = tagSet.getTag(tagNum);
+
+            System.out.println(
+                "number/name: \t" + tagNum + "/" + tagByNum.getName());
+            checkEq("tag number", tagByNum.getNumber(), tagNum);
+            TIFFTag tagByName = tagSet.getTag(tagByNum.getName());
+            checkEq("tag number", tagByName.getNumber(), tagNum);
+        }
+
+        System.out.println("");
+    }
+
+
+    private static void testUserDefTagSet() {
+
+        TIFFTagSet set = TestSet.getInstance();
+
+        SortedSet tagNames = set.getTagNames();
+        checkEq("tagNames set size", tagNames.size(), 3);
+        if (! (tagNames.contains(TestSet.TAG_NAME_1) &&
+               tagNames.contains(TestSet.TAG_NAME_2) &&
+               tagNames.contains(TestSet.TAG_NAME_3)) ) {
+            throw new RuntimeException("invalid tag names");
+        }
+
+        SortedSet tagNumbers = set.getTagNumbers();
+        checkEq("tagNumbers set size", tagNumbers.size(), 3);
+        if (! (tagNumbers.contains(TestSet.TAG_NUM_1) &&
+               tagNumbers.contains(TestSet.TAG_NUM_2) &&
+               tagNumbers.contains(TestSet.TAG_NUM_3)) ) {
+            throw new RuntimeException("invalid tag numbers");
+        }
+
+        TIFFTag t1 = set.getTag(TestSet.TAG_NUM_1),
+                t2 = set.getTag(TestSet.TAG_NUM_2),
+                t3 = set.getTag(TestSet.TAG_NUM_3);
+
+        checkEq(TestSet.TAG_NAME_1 + " name", t1.getName(), TestSet.TAG_NAME_1);
+        checkEq(TestSet.TAG_NAME_2 + " name", t2.getName(), TestSet.TAG_NAME_2);
+        checkEq(TestSet.TAG_NAME_3 + " name", t3.getName(), TestSet.TAG_NAME_3);
+
+        // check count
+        // was set
+        checkEq(TestSet.TAG_NAME_1 + " count",
+            t1.getCount(),  TestSet.VALUE_COUNT);
+        // undefined
+        checkEq(TestSet.TAG_NAME_2 + " count", t2.getCount(), -1);
+        // see docs for constructor TIFFTag(String, int, TIFFTagSet)
+        checkEq(TestSet.TAG_NAME_3 + " count", t3.getCount(),  1);
+
+        // check datatypes
+        checkEq(TestSet.TAG_NAME_1 + " datatypes", t1.getDataTypes(),
+            1 << TIFFTag.TIFF_SHORT | 1 << TIFFTag.TIFF_LONG);
+        boolean ok =  t1.isDataTypeOK(TIFFTag.TIFF_SHORT)  &&
+                      t1.isDataTypeOK(TIFFTag.TIFF_LONG)   &&
+                     !t1.isDataTypeOK(TIFFTag.TIFF_DOUBLE) &&
+                     !t1.isDataTypeOK(TIFFTag.TIFF_IFD_POINTER);
+        if (!ok) { throw new RuntimeException(TestSet.TAG_NAME_1 + ": " +
+            "isDataTypeOK check failed"); }
+        checkEq(TestSet.TAG_NAME_1 + ".isIFDPointer()", t1.isIFDPointer(), false);
+
+        checkEq(TestSet.TAG_NAME_2 + " datatypes", t2.getDataTypes(),
+            1 << TIFFTag.TIFF_DOUBLE);
+        ok = !t2.isDataTypeOK(TIFFTag.TIFF_SHORT)  &&
+             !t2.isDataTypeOK(TIFFTag.TIFF_LONG)   &&
+              t2.isDataTypeOK(TIFFTag.TIFF_DOUBLE) &&
+             !t2.isDataTypeOK(TIFFTag.TIFF_IFD_POINTER);
+        if (!ok) { throw new RuntimeException(TestSet.TAG_NAME_2 + ": " +
+            "isDataTypeOK check failed"); }
+        checkEq(TestSet.TAG_NAME_2 + ".isIFDPointer()", t2.isIFDPointer(), false);
+
+        // see docs for constructor TIFFTag(String, int, TIFFTagSet)
+        checkEq(TestSet.TAG_NAME_3 + " datatypes", t3.getDataTypes(),
+            1 << TIFFTag.TIFF_LONG | 1 << TIFFTag.TIFF_IFD_POINTER);
+        ok = !t3.isDataTypeOK(TIFFTag.TIFF_SHORT)  &&
+              t3.isDataTypeOK(TIFFTag.TIFF_LONG)   &&
+             !t3.isDataTypeOK(TIFFTag.TIFF_DOUBLE) &&
+              t3.isDataTypeOK(TIFFTag.TIFF_IFD_POINTER);
+        if (!ok) { throw new RuntimeException(TestSet.TAG_NAME_3 + ": " +
+            "isDataTypeOK check failed"); }
+        checkEq(TestSet.TAG_NAME_3 + ".isIFDPointer()", t3.isIFDPointer(), true);
+
+        // check value names
+        checkEq(TestSet.TAG_NAME_1 + ".hasValueNames()",
+            t1.hasValueNames(), false);
+        checkEq(TestSet.TAG_NAME_2 + ".hasValueNames()",
+            t2.hasValueNames(), true);
+        checkEq(TestSet.TAG_NAME_3 + ".hasValueNames()",
+            t3.hasValueNames(), false);
+
+        if (t1.getNamedValues() != null && t3.getNamedValues() != null) {
+            throw new RuntimeException(TestSet.TAG_NAME_1 + " and " +
+                TestSet.TAG_NAME_3 + " must have null value names arrays");
+        }
+
+        checkEq("number of " + TestSet.TAG_NAME_2 + " values",
+            t2.getNamedValues().length, 2);
+        checkEq("name of value " + TestSet.VALUE_1,
+            t2.getValueName(TestSet.VALUE_1), TestSet.VALUE_NAME_1);
+        checkEq("name of value " + TestSet.VALUE_2,
+            t2.getValueName(TestSet.VALUE_2), TestSet.VALUE_NAME_2);
+
+        // check tag sets
+        if (!(t1.getTagSet() == null && t2.getTagSet() == null) &&
+              t3.getTagSet().equals(TestSet.SOME_SET)) {
+            throw new RuntimeException("invalid containing tag set");
+        }
+    }
+
+    private static void checkArgs() {
+
+        boolean ok = false;
+        try {
+            TIFFTag t = new TIFFTag(null, 0, 1 << TIFFTag.TIFF_LONG);
+        } catch (Exception e) {
+            ok = true;
+        }
+        if (!ok) {
+            throw new RuntimeException("null names should not be allowed");
+        }
+
+        ok = false;
+        try {
+            TIFFTag t = new TIFFTag("abc", -1, 1 << TIFFTag.TIFF_LONG);
+        } catch (Exception e) {
+            ok = true;
+        }
+        if (!ok) {
+            throw new RuntimeException("negative numbers should not be allowed");
+        }
+
+        ok = false;
+        try {
+            TIFFTag t = new TIFFTag("abc", 666, ~0x3fff);
+        } catch (Exception e) {
+            ok = true;
+        }
+        if (!ok) {
+            throw new RuntimeException("disallowed data types were set");
+        }
+
+        ok = false;
+        try {
+            TIFFTag.getSizeOfType(TIFFTag.MIN_DATATYPE - 1);
+        } catch (Exception e) {
+            ok = true;
+        }
+        if (!ok) { throw new RuntimeException(
+            "missing data types check for getSizeOfType()"); }
+
+        ok = false;
+        try {
+            TIFFTag.getSizeOfType(TIFFTag.MAX_DATATYPE + 1);
+        } catch (Exception e) {
+            ok = true;
+        }
+        if (!ok) { throw new RuntimeException(
+            "missing data types check for getSizeOfType()"); }
+
+    }
+
+
+    public static void main(String[] args) throws ReflectiveOperationException {
+
+        String classNames[] = {"BaselineTIFFTagSet",
+                               "ExifGPSTagSet",
+                               "ExifInteroperabilityTagSet",
+                               "ExifParentTIFFTagSet",
+                               "ExifTIFFTagSet",
+                               "FaxTIFFTagSet",
+                               "GeoTIFFTagSet"};
+
+        for (String cn: classNames) {
+            System.out.println("Testing " + cn + ":");
+            (new TIFFTagSetTest(
+                "javax.imageio.plugins.tiff." + cn)).testNamesNumbers();
+        }
+
+        System.out.println("\nTesting user-defined tag set:");
+        testUserDefTagSet();
+        (new TIFFTagSetTest("TIFFTagSetTest$TestSet")).testNamesNumbers();
+
+        System.out.println("\nSome additional argument checks...");
+        checkArgs();
+        System.out.println("done");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/spi/ServiceRegistrySyncTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,131 @@
+/*
+ * 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     8022640
+ * @summary Test verifies whether ServiceProvider API's of
+ *          ServiceRegistry are safe for concurrent access.
+ * @run     main ServiceRegistrySyncTest
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Locale;
+import javax.imageio.spi.ImageInputStreamSpi;
+import javax.imageio.spi.ServiceRegistry;
+import javax.imageio.stream.ImageInputStream;
+
+public class ServiceRegistrySyncTest {
+    public static void main(String[] args) throws InterruptedException {
+
+        final ArrayList<Class<?>> services = new ArrayList<Class<?>>();
+        services.add(ImageInputStreamSpi.class);
+
+        final ServiceRegistry reg = new ServiceRegistry(services.iterator());
+
+        //create new thread for Registerer and Consumer Class
+        Thread registerer = new Thread(new Registerer(reg));
+        Thread consumer = new Thread(new Consumer(reg));
+
+        //run both registerer and consumer thread parallely
+        registerer.start();
+        consumer.start();
+    }
+
+    static class Consumer implements Runnable {
+        private final ServiceRegistry reg;
+        boolean go = true;
+        int duration;
+        long start, end;
+
+        public Consumer(ServiceRegistry r) {
+            reg = r;
+            //set 5000ms duration to run the test
+            duration = 5000;
+        }
+
+        @Override
+        public void run() {
+            start = System.currentTimeMillis();
+            end = start + duration;
+            while (start < end) {
+                //access the ServiceProvider API
+                reg.getServiceProviders(ImageInputStreamSpi.class, true);
+                start = System.currentTimeMillis();
+            }
+        }
+    }
+
+    static class Registerer implements Runnable {
+        private final ServiceRegistry reg;
+        boolean go = true;
+        int duration;
+        long start, end;
+
+        public Registerer(ServiceRegistry r) {
+            reg = r;
+            //set 5000ms duration to run the test
+            duration = 5000;
+        }
+
+        @Override
+        public void run() {
+            final int N = 20;
+
+            MyService[] services = new MyService[N];
+            for (int i = 0; i < N; i++) {
+                services[i] = new MyService();
+            }
+            start = System.currentTimeMillis();
+            end = start + duration;
+            while (start < end) {
+                //access the ServiceProvider API's
+                for (int i = 0; i < N; i++) {
+                    reg.registerServiceProvider(services[i]);
+                }
+                for (int i = 0; i < N; i++) {
+                    reg.deregisterServiceProvider(services[i]);
+                }
+                start = System.currentTimeMillis();
+            }
+        }
+    }
+}
+
+class MyService extends ImageInputStreamSpi {
+    public MyService() {
+    }
+
+    @Override
+    public String getDescription(Locale locale) {
+        return null;
+    }
+
+    @Override
+    public ImageInputStream createInputStreamInstance
+        (Object input, boolean useCache, File cacheDir) throws IOException {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JDialog/Transparency/TransparencyTest.java	Mon Feb 08 09:41:53 2016 -0800
@@ -0,0 +1,119 @@
+/*
+ * 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 8062946
+ @summary Verify Transparency upon iconify/deiconify sequence
+ @run main TransparencyTest
+ */
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.Robot;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+public class TransparencyTest {
+
+    private static JFrame frame;
+    private static JDialog dialog;
+    private static JDialog backgroundDialog;
+    private static final int WIDTH = 250;
+    private static final int HEIGHT = 250;
+    private static final float OPACITY = 0.60f;
+    private static Point dlgPos;
+
+    public static void createAndShowGUI() {
+        frame = new JFrame("JFrame");
+        frame.setSize(WIDTH, HEIGHT);
+        frame.setLocation(100, 300);
+
+        dialog = new JDialog(frame, false);
+        dialog.setSize(250, 250);
+        dialog.setUndecorated(true);
+        dialog.setLocation(400, 300);
+        dlgPos = dialog.getLocation();
+        backgroundDialog = new JDialog(frame, false);
+        backgroundDialog.setSize(250, 250);
+        backgroundDialog.getContentPane().setBackground(Color.red);
+        backgroundDialog.setLocation(dlgPos.x, dlgPos.y);
+
+        frame.setVisible(true);
+        backgroundDialog.setVisible(true);
+        dialog.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        Robot robot = new Robot();
+        // create a GUI
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+        robot.waitForIdle();
+        Color opaque = robot.getPixelColor(dlgPos.x + 100, dlgPos.y + 100);
+
+        // set Dialog Opacity
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                dialog.setOpacity(OPACITY);
+            }
+        });
+        robot.waitForIdle();
+
+        // iconify frame
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                frame.setExtendedState(JFrame.ICONIFIED);
+            }
+        });
+        robot.waitForIdle();
+
+        // deiconify frame
+        SwingUtilities.invokeAndWait(new Runnable() {
+
+            @Override
+            public void run() {
+                frame.setExtendedState(JFrame.NORMAL);
+            }
+        });
+        robot.waitForIdle();
+
+        Color transparent = robot.getPixelColor(dlgPos.x + 100, dlgPos.y + 100);
+        if (transparent.equals(opaque)) {
+            frame.dispose();
+            throw new RuntimeException("JDialog transparency lost "
+                    + "upon iconify/deiconify sequence");
+        }
+        frame.dispose();
+    }
+}