changeset 14465:14f8bca09c9b

Merge
author ddehaven
date Tue, 03 Nov 2015 09:45:39 -0800
parents 30a4e10baf9c 8bf32c4c2332
children 240ca1b2eb59 af37c3fb97fd
files test/java/awt/datatransfer/DataFlavor/XJavaUrlDataFlavorTest/XJavaUrlDataFlavorTest.java
diffstat 28 files changed, 1397 insertions(+), 506 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.datatransfer/macosx/classes/sun/datatransfer/resources/flavormap.properties	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.datatransfer/macosx/classes/sun/datatransfer/resources/flavormap.properties	Tue Nov 03 09:45:39 2015 -0800
@@ -72,6 +72,7 @@
 TIFF=image/x-java-image;class=java.awt.Image
 RICH_TEXT=text/rtf
 HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
-URL=application/x-java-url;class=java.net.URL,\
-    text/uri-list;eoln="\r\n";terminators=1
+URL=application/x-java-url;class=java.net.URL
+FILE_NAME=text/uri-list;eoln="\r\n";terminators=1
+URL=text/uri-list;eoln="\r\n";terminators=1
 XPICT=image/x-pict;class=java.io.InputStream
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java	Tue Nov 03 09:45:39 2015 -0800
@@ -845,7 +845,7 @@
         boolean isDefaultFocusReceiver(final JComponent component) {
             if (isDefaultFocusReceiver == null) {
                 Component defaultFocusReceiver = KeyboardFocusManager.getCurrentKeyboardFocusManager().getDefaultFocusTraversalPolicy().getDefaultComponent(getTopLevelFocusCycleRootAncestor(component));
-                isDefaultFocusReceiver = new Boolean(defaultFocusReceiver != null && defaultFocusReceiver.equals(component));
+                isDefaultFocusReceiver = defaultFocusReceiver != null && defaultFocusReceiver.equals(component);
             }
             return isDefaultFocusReceiver.booleanValue();
         }
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java	Tue Nov 03 09:45:39 2015 -0800
@@ -175,7 +175,7 @@
                 final AccessibleSelection as = ac.getAccessibleSelection();
                 if (as == null) return Boolean.FALSE;
 
-                return new Boolean(as.isAccessibleChildSelected(index));
+                return as.isAccessibleChildSelected(index);
             }
         }, c);
     }
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Tue Nov 03 09:45:39 2015 -0800
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,12 +29,13 @@
 import java.awt.*;
 
 import java.io.*;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.charset.Charset;
 import java.text.Normalizer;
 import java.text.Normalizer.Form;
 import java.util.*;
-import java.util.regex.*;
 
 import java.awt.datatransfer.*;
 import sun.awt.datatransfer.*;
@@ -127,51 +129,33 @@
                                  long format, Transferable transferable) throws IOException {
 
         if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass())) {
-            String charset = Charset.defaultCharset().name();
-            if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
-                try {
-                    charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
-                } catch (UnsupportedFlavorException cannotHappen) {
-                }
+            String[] strings = dragQueryFile(bytes);
+            if(strings == null || strings.length == 0) {
+                return null;
             }
-            String xml = new String(bytes, charset);
-            // macosx pasteboard returns a property list that consists of one URL
-            // let's extract it.
-            return new URL(extractURL(xml));
-        }
-
-        if (format == CF_STRING) {
+            return new URL(strings[0]);
+        } else if(isUriListFlavor(flavor)) {
+            // dragQueryFile works fine with files and url,
+            // it parses and extracts values from property list.
+            // maxosx always returns property list for
+            // CF_URL and CF_FILE
+            String[] strings = dragQueryFile(bytes);
+            if(strings == null) {
+                return null;
+            }
+            bytes = String.join(System.getProperty("line.separator"),
+                    strings).getBytes();
+            // now we extracted uri from xml, now we should treat it as
+            // regular string that allows to translate data to target represantation
+            // class by base method
+            format = CF_STRING;
+        } else if (format == CF_STRING) {
             bytes = Normalizer.normalize(new String(bytes, "UTF8"), Form.NFC).getBytes("UTF8");
         }
 
         return super.translateBytes(bytes, flavor, format, transferable);
     }
 
-    /**
-     * Macosx pasteboard returns xml document that contains one URL, for exmple:
-     * <pre>
-     *     {@code
-     * <?xml version=\"1.0\" encoding=\"UTF-8\"?>
-     * <!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
-     * <plist version=\"1.0\">
-     *      <array>
-     *          <string>file:///path_to_file</string>
-     *          <string></string>
-     *      </array>
-     * </plist>
-     *     }
-     * </pre>
-     */
-    private String extractURL(String xml) {
-        Pattern urlExtractorPattern = Pattern.compile("<string>(.*)</string>");
-        Matcher matcher = urlExtractorPattern.matcher(xml);
-        if (matcher.find()) {
-            return matcher.group(1);
-        } else {
-            return null;
-        }
-    }
-
     @Override
     protected synchronized Long getFormatForNativeAsLong(String str) {
         Long format = predefinedClipboardNameMap.get(str);
@@ -247,6 +231,7 @@
         return nativeDragQueryFile(bytes);
     }
 
+
     @Override
     protected Image platformImageBytesToImage(byte[] bytes, long format) throws IOException {
         return CImage.getCreator().createImageFromPlatformImageBytes(bytes);
@@ -271,7 +256,7 @@
         }
         try {
             DataFlavor df = new DataFlavor(nat);
-            if (df.getPrimaryType().equals("text") && df.getSubType().equals("uri-list")) {
+            if (isUriListFlavor(df)) {
                 return true;
             }
         } catch (Exception e) {
@@ -279,4 +264,11 @@
         }
         return false;
     }
+
+    private boolean isUriListFlavor(DataFlavor df) {
+        if (df.getPrimaryType().equals("text") && df.getSubType().equals("uri-list")) {
+            return true;
+        }
+        return false;
+    }
 }
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Tue Nov 03 09:45:39 2015 -0800
@@ -380,7 +380,7 @@
         desktopProperties.put("DnD.Autoscroll.interval", new Integer(50));
         desktopProperties.put("DnD.Autoscroll.cursorHysteresis", new Integer(5));
 
-        desktopProperties.put("DnD.isDragImageSupported", new Boolean(true));
+        desktopProperties.put("DnD.isDragImageSupported", Boolean.TRUE);
 
         // Register DnD cursors
         desktopProperties.put("DnD.Cursor.CopyDrop", new NamedCursor("DnD.Cursor.CopyDrop"));
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsEnv.m	Tue Nov 03 09:45:39 2015 -0800
@@ -26,6 +26,7 @@
 #import "AWT_debug.h"
 
 #import "jni_util.h"
+#import "ThreadUtilities.h"
 
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 
@@ -114,17 +115,20 @@
 {
     if (flags == kCGDisplayBeginConfigurationFlag) return;
 
-    JNFPerformEnvBlock(JNFThreadDetachImmediately, ^(JNIEnv *env) {
-        JNFWeakJObjectWrapper *wrapper = (JNFWeakJObjectWrapper *)userInfo;
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^() {
 
-        jobject graphicsEnv = [wrapper jObjectWithEnv:env];
-        if (graphicsEnv == NULL) return; // ref already GC'd
-        static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment");
-        static JNF_MEMBER_CACHE(jm_displayReconfiguration, jc_CGraphicsEnvironment, "_displayReconfiguration", "(IZ)V");
-        JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration,
-                            (jint) display, 
-                            (jboolean) flags & kCGDisplayRemoveFlag);
-    });
+        JNFPerformEnvBlock(JNFThreadDetachImmediately, ^(JNIEnv *env) {
+            JNFWeakJObjectWrapper *wrapper = (JNFWeakJObjectWrapper *)userInfo;
+
+            jobject graphicsEnv = [wrapper jObjectWithEnv:env];
+            if (graphicsEnv == NULL) return; // ref already GC'd
+            static JNF_CLASS_CACHE(jc_CGraphicsEnvironment, "sun/awt/CGraphicsEnvironment");
+            static JNF_MEMBER_CACHE(jm_displayReconfiguration,
+                    jc_CGraphicsEnvironment, "_displayReconfiguration","(IZ)V");
+            JNFCallVoidMethod(env, graphicsEnv, jm_displayReconfiguration,
+                    (jint) display, (jboolean) flags & kCGDisplayRemoveFlag);
+        });
+    }];
 }
 
 /*
--- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m	Tue Nov 03 09:45:39 2015 -0800
@@ -233,6 +233,7 @@
         }
 
         NSOpenGLPixelFormatAttribute attrs[] = {
+            NSOpenGLPFAAllowOfflineRenderers,
             NSOpenGLPFAClosestPolicy,
             NSOpenGLPFAWindow,
             NSOpenGLPFAPixelBuffer,
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java	Tue Nov 03 09:45:39 2015 -0800
@@ -247,11 +247,11 @@
             node.appendChild(subNode);
 
             subNode = new IIOMetadataNode("HorizontalPhysicalPixelSpacing");
-            subNode.setAttribute("value", "" + (1 / xPixelsPerMeter * 1000));
+            subNode.setAttribute("value", "" + (1000.0F / xPixelsPerMeter));
             node.appendChild(subNode);
 
             subNode = new IIOMetadataNode("VerticalPhysicalPixelSpacing");
-            subNode.setAttribute("value", "" + (1 / yPixelsPerMeter * 1000));
+            subNode.setAttribute("value", "" + (1000.0F / yPixelsPerMeter));
             node.appendChild(subNode);
 
             return node;
--- a/src/java.desktop/share/classes/java/awt/Component.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/share/classes/java/awt/Component.java	Tue Nov 03 09:45:39 2015 -0800
@@ -312,7 +312,7 @@
      * @see GraphicsConfiguration
      * @see #getGraphicsConfiguration
      */
-    private transient GraphicsConfiguration graphicsConfig = null;
+    private transient volatile GraphicsConfiguration graphicsConfig;
 
     /**
      * A reference to a <code>BufferStrategy</code> object
@@ -1143,9 +1143,7 @@
      * @since 1.3
      */
     public GraphicsConfiguration getGraphicsConfiguration() {
-        synchronized(getTreeLock()) {
-            return getGraphicsConfiguration_NoClientCode();
-        }
+        return getGraphicsConfiguration_NoClientCode();
     }
 
     final GraphicsConfiguration getGraphicsConfiguration_NoClientCode() {
@@ -3622,18 +3620,17 @@
     }
 
     /**
-     * Creates an off-screen drawable image
-     *     to be used for double buffering.
-     * @param     width the specified width
-     * @param     height the specified height
-     * @return    an off-screen drawable image, which can be used for double
-     *    buffering.  The return value may be <code>null</code> if the
-     *    component is not displayable.  This will always happen if
-     *    <code>GraphicsEnvironment.isHeadless()</code> returns
-     *    <code>true</code>.
+     * Creates an off-screen drawable image to be used for double buffering.
+     *
+     * @param  width the specified width
+     * @param  height the specified height
+     * @return an off-screen drawable image, which can be used for double
+     *         buffering. The {@code null} value if the component is not
+     *         displayable or {@code GraphicsEnvironment.isHeadless()} returns
+     *         {@code true}.
      * @see #isDisplayable
      * @see GraphicsEnvironment#isHeadless
-     * @since     1.0
+     * @since 1.0
      */
     public Image createImage(int width, int height) {
         ComponentPeer peer = this.peer;
@@ -3646,19 +3643,19 @@
     }
 
     /**
-     * Creates a volatile off-screen drawable image
-     *     to be used for double buffering.
-     * @param     width the specified width.
-     * @param     height the specified height.
-     * @return    an off-screen drawable image, which can be used for double
-     *    buffering.  The return value may be <code>null</code> if the
-     *    component is not displayable.  This will always happen if
-     *    <code>GraphicsEnvironment.isHeadless()</code> returns
-     *    <code>true</code>.
+     * Creates a volatile off-screen drawable image to be used for double
+     * buffering.
+     *
+     * @param  width the specified width
+     * @param  height the specified height
+     * @return an off-screen drawable image, which can be used for double
+     *         buffering. The {@code null} value if the component is not
+     *         displayable or {@code GraphicsEnvironment.isHeadless()} returns
+     *         {@code true}.
      * @see java.awt.image.VolatileImage
      * @see #isDisplayable
      * @see GraphicsEnvironment#isHeadless
-     * @since     1.4
+     * @since 1.4
      */
     public VolatileImage createVolatileImage(int width, int height) {
         ComponentPeer peer = this.peer;
@@ -3674,22 +3671,26 @@
     }
 
     /**
-     * Creates a volatile off-screen drawable image, with the given capabilities.
-     * The contents of this image may be lost at any time due
-     * to operating system issues, so the image must be managed
-     * via the <code>VolatileImage</code> interface.
-     * @param width the specified width.
-     * @param height the specified height.
-     * @param caps the image capabilities
-     * @exception AWTException if an image with the specified capabilities cannot
-     * be created
-     * @return a VolatileImage object, which can be used
-     * to manage surface contents loss and capabilities.
+     * Creates a volatile off-screen drawable image, with the given
+     * capabilities. The contents of this image may be lost at any time due to
+     * operating system issues, so the image must be managed via the
+     * {@code VolatileImage} interface.
+     *
+     * @param  width the specified width
+     * @param  height the specified height
+     * @param  caps the image capabilities
+     * @return a VolatileImage object, which can be used to manage surface
+     *         contents loss and capabilities. The {@code null} value if the
+     *         component is not displayable or
+     *         {@code GraphicsEnvironment.isHeadless()} returns {@code true}.
+     * @throws AWTException if an image with the specified capabilities cannot
+     *         be created
      * @see java.awt.image.VolatileImage
      * @since 1.4
      */
     public VolatileImage createVolatileImage(int width, int height,
-                                             ImageCapabilities caps) throws AWTException {
+                                             ImageCapabilities caps)
+            throws AWTException {
         // REMIND : check caps
         return createVolatileImage(width, height);
     }
--- a/src/java.desktop/share/classes/java/awt/Window.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/share/classes/java/awt/Window.java	Tue Nov 03 09:45:39 2015 -0800
@@ -347,7 +347,7 @@
      * @see #getOpacity()
      * @since 1.7
      */
-    private float opacity = 1.0f;
+    private volatile float opacity = 1.0f;
 
     /**
      * The shape assigned to this window. This field is set to {@code null} if
@@ -1040,9 +1040,7 @@
             closeSplashScreen();
             Dialog.checkShouldBeBlocked(this);
             super.show();
-            synchronized (getTreeLock()) {
-                this.locationByPlatform = false;
-            }
+            locationByPlatform = false;
             for (int i = 0; i < ownedWindowList.size(); i++) {
                 Window child = ownedWindowList.elementAt(i).get();
                 if ((child != null) && child.showWithParent) {
@@ -1115,9 +1113,7 @@
             modalBlocker.unblockWindow(this);
         }
         super.hide();
-        synchronized (getTreeLock()) {
-            this.locationByPlatform = false;
-        }
+        locationByPlatform = false;
     }
 
     final void clearMostRecentFocusOwnerOnHide() {
@@ -3411,7 +3407,7 @@
         return super.canContainFocusOwner(focusOwnerCandidate) && isFocusableWindow();
     }
 
-    private boolean locationByPlatform = locationByPlatformProp;
+    private volatile boolean locationByPlatform = locationByPlatformProp;
 
 
     /**
@@ -3482,9 +3478,7 @@
      * @since 1.5
      */
     public boolean isLocationByPlatform() {
-        synchronized (getTreeLock()) {
-            return locationByPlatform;
-        }
+        return locationByPlatform;
     }
 
     /**
@@ -3573,9 +3567,7 @@
      * @since 1.7
      */
     public float getOpacity() {
-        synchronized (getTreeLock()) {
-            return opacity;
-        }
+        return opacity;
     }
 
     /**
--- a/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Tue Nov 03 09:45:39 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,9 +53,7 @@
  */
 public abstract class CachedPainter {
     // CacheMap maps from class to ImageCache.
-    private static final Map<Object,ImageCache> cacheMap =
-                   new HashMap<Object,ImageCache>();
-
+    private static final Map<Object,ImageCache> cacheMap = new HashMap<>();
 
     private static ImageCache getCache(Object key) {
         synchronized(CachedPainter.class) {
@@ -96,20 +94,8 @@
         if (w <= 0 || h <= 0) {
             return;
         }
-        if (c != null) {
-            synchronized(c.getTreeLock()) {
-                synchronized(CachedPainter.class) {
-                    // If c is non-null, synchronize on the tree lock.
-                    // This is necessary because asking for the
-                    // GraphicsConfiguration will grab a tree lock.
-                    paint0(c, g, x, y, w, h, args);
-                }
-            }
-        }
-        else {
-            synchronized(CachedPainter.class) {
-                paint0(c, g, x, y, w, h, args);
-            }
+        synchronized (CachedPainter.class) {
+            paint0(c, g, x, y, w, h, args);
         }
     }
 
--- a/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java	Tue Nov 03 09:45:39 2015 -0800
@@ -272,7 +272,8 @@
     }
 
     protected String[] getWMClass() {
-        return new String[] {XToolkit.getCorrectXIDString(getClass().getName()), XToolkit.getAWTAppClassName()};
+        return new String[] {XToolkit.getAWTAppClassName(),
+                XToolkit.getAWTAppClassName()};
     }
 
     void setReparented(boolean newValue) {
@@ -992,10 +993,13 @@
 //  if ( Check if it's a resize, a move, or a stacking order change )
 //  {
         Rectangle bounds = getBounds();
+        final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
         if (!bounds.getSize().equals(oldBounds.getSize())) {
+            acc.setSize(target, bounds.width, bounds.height);
             postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_RESIZED));
         }
         if (!bounds.getLocation().equals(oldBounds.getLocation())) {
+            acc.setLocation(target, bounds.x, bounds.y);
             postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_MOVED));
         }
 //  }
--- a/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WPathGraphics.java	Tue Nov 03 09:45:39 2015 -0800
@@ -494,24 +494,48 @@
          */
         float fontSize = font.getSize2D();
 
+        double devResX = wPrinterJob.getXRes();
+        double devResY = wPrinterJob.getYRes();
+
+        double fontDevScaleY = devResY / DEFAULT_USER_RES;
+
+        int orient = getPageFormat().getOrientation();
+        if (orient == PageFormat.LANDSCAPE ||
+            orient == PageFormat.REVERSE_LANDSCAPE)
+        {
+            double tmp = devResX;
+            devResX = devResY;
+            devResY = tmp;
+        }
+
+        double devScaleX = devResX / DEFAULT_USER_RES;
+        double devScaleY = devResY / DEFAULT_USER_RES;
+        fontTransform.scale(1.0/devScaleX, 1.0/devScaleY);
+
         Point2D.Double pty = new Point2D.Double(0.0, 1.0);
         fontTransform.deltaTransform(pty, pty);
         double scaleFactorY = Math.sqrt(pty.x*pty.x+pty.y*pty.y);
-        float scaledFontSizeY = (float)(fontSize * scaleFactorY);
+        float scaledFontSizeY = (float)(fontSize * scaleFactorY * fontDevScaleY);
 
         Point2D.Double ptx = new Point2D.Double(1.0, 0.0);
         fontTransform.deltaTransform(ptx, ptx);
         double scaleFactorX = Math.sqrt(ptx.x*ptx.x+ptx.y*ptx.y);
-        float scaledFontSizeX = (float)(fontSize * scaleFactorX);
 
         float awScale = getAwScale(scaleFactorX, scaleFactorY);
         int iangle = getAngle(ptx);
 
+        ptx = new Point2D.Double(1.0, 0.0);
+        deviceTransform.deltaTransform(ptx, ptx);
+        double advanceScaleX = Math.sqrt(ptx.x*ptx.x+ptx.y*ptx.y);
+        pty = new Point2D.Double(0.0, 1.0);
+        deviceTransform.deltaTransform(pty, pty);
+        double advanceScaleY = Math.sqrt(pty.x*pty.x+pty.y*pty.y);
+
         Font2D font2D = FontUtilities.getFont2D(font);
         if (font2D instanceof TrueTypeFont) {
             textOut(str, font, (TrueTypeFont)font2D, frc,
                     scaledFontSizeY, iangle, awScale,
-                    deviceTransform, scaleFactorX,
+                    advanceScaleX, advanceScaleY,
                     x, y, devpos.x, devpos.y, targetW);
         } else if (font2D instanceof CompositeFont) {
             /* Composite fonts are made up of multiple fonts and each
@@ -542,7 +566,7 @@
                 PhysicalFont slotFont = compFont.getSlotFont(slot);
                 textOut(substr, font, slotFont, frc,
                         scaledFontSizeY, iangle, awScale,
-                        deviceTransform, scaleFactorX,
+                        advanceScaleX, advanceScaleY,
                         userx, usery, devx, devy, 0f);
                 Rectangle2D bds = font.getStringBounds(substr, frc);
                 float xAdvance = (float)bds.getWidth();
@@ -635,18 +659,42 @@
          */
         float fontSize = font.getSize2D();
 
+        double devResX = wPrinterJob.getXRes();
+        double devResY = wPrinterJob.getYRes();
+
+        double fontDevScaleY = devResY / DEFAULT_USER_RES;
+
+        int orient = getPageFormat().getOrientation();
+        if (orient == PageFormat.LANDSCAPE ||
+            orient == PageFormat.REVERSE_LANDSCAPE)
+        {
+            double tmp = devResX;
+            devResX = devResY;
+            devResY = tmp;
+        }
+
+        double devScaleX = devResX / DEFAULT_USER_RES;
+        double devScaleY = devResY / DEFAULT_USER_RES;
+        fontTransform.scale(1.0/devScaleX, 1.0/devScaleY);
+
         Point2D.Double pty = new Point2D.Double(0.0, 1.0);
         fontTransform.deltaTransform(pty, pty);
         double scaleFactorY = Math.sqrt(pty.x*pty.x+pty.y*pty.y);
-        float scaledFontSizeY = (float)(fontSize * scaleFactorY);
+        float scaledFontSizeY = (float)(fontSize * scaleFactorY * fontDevScaleY);
 
-        Point2D.Double pt = new Point2D.Double(1.0, 0.0);
-        fontTransform.deltaTransform(pt, pt);
-        double scaleFactorX = Math.sqrt(pt.x*pt.x+pt.y*pt.y);
-        float scaledFontSizeX = (float)(fontSize * scaleFactorX);
+        Point2D.Double ptx = new Point2D.Double(1.0, 0.0);
+        fontTransform.deltaTransform(ptx, ptx);
+        double scaleFactorX = Math.sqrt(ptx.x*ptx.x+ptx.y*ptx.y);
 
         float awScale = getAwScale(scaleFactorX, scaleFactorY);
-        int iangle = getAngle(pt);
+        int iangle = getAngle(ptx);
+
+        ptx = new Point2D.Double(1.0, 0.0);
+        deviceTransform.deltaTransform(ptx, ptx);
+        double advanceScaleX = Math.sqrt(ptx.x*ptx.x+ptx.y*ptx.y);
+        pty = new Point2D.Double(0.0, 1.0);
+        deviceTransform.deltaTransform(pty, pty);
+        double advanceScaleY = Math.sqrt(pty.x*pty.x+pty.y*pty.y);
 
         int numGlyphs = gv.getNumGlyphs();
         int[] glyphCodes = gv.getGlyphCodes(0, numGlyphs, null);
@@ -705,8 +753,7 @@
          * rotation element of the deviceTransform.
          */
         AffineTransform advanceTransform =
-            new AffineTransform(deviceTransform);
-        advanceTransform.rotate(iangle*Math.PI/1800.0);
+           AffineTransform.getScaleInstance(advanceScaleX, advanceScaleY);
         float[] glyphAdvPos = new float[glyphPos.length];
 
         advanceTransform.transform(glyphPos, 0,         //source
@@ -784,8 +831,7 @@
                           Font font, PhysicalFont font2D,
                           FontRenderContext frc,
                           float deviceSize, int rotation, float awScale,
-                          AffineTransform deviceTransform,
-                          double scaleFactorX,
+                          double scaleFactorX, double scaleFactorY,
                           float userx, float usery,
                           float devx, float devy, float targetW) {
 
@@ -826,8 +872,7 @@
               * See earlier comment in printGlyphVector() for details.
               */
              AffineTransform advanceTransform =
-               new AffineTransform(deviceTransform);
-             advanceTransform.rotate(rotation*Math.PI/1800.0);
+                AffineTransform.getScaleInstance(scaleFactorX, scaleFactorY);
              float[] glyphAdvPos = new float[glyphPos.length];
 
              advanceTransform.transform(glyphPos, 0,         //source
@@ -841,11 +886,11 @@
      /* If 2D and GDI agree on the advance of the string we do not
       * need to explicitly assign glyph positions.
       * If we are to use the GDI advance, require it to agree with
-      * JDK to a precision of <= 0.2% - ie 1 pixel in 500
+      * JDK to a precision of <= 1.0% - ie 1 pixel in 100
       * discrepancy after rounding the 2D advance to the
       * nearest pixel and is greater than one pixel in total.
-      * ie strings < 500 pixels in length will be OK so long
-      * as they differ by only 1 pixel even though that is > 0.02%
+      * ie strings < 100 pixels in length will be OK so long
+      * as they differ by only 1 pixel even though that is > 1%
       * The bounds from 2D are in user space so need to
       * be scaled to device space for comparison with GDI.
       * scaleX is the scale from user space to device space needed for this.
@@ -863,7 +908,7 @@
              if (ratio < 1) {
                  ratio = 1/ratio;
              }
-             return diff <= 1 || ratio < 1.002;
+             return diff <= 1 || ratio < 1.01;
          }
          return true;
      }
--- a/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.cpp	Tue Nov 03 09:45:39 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -114,8 +114,9 @@
         // which may've been disposed by this time, and we have
         // no means of checking against it.
         if (oldhDC != NULL) {
-            MoveDCToPassiveList(oldhDC);
+            MoveDCToPassiveList(oldhDC, info->hWnd);
             info->hDC = NULL;
+            info->hWnd = NULL;
         }
 
         if (wsdo->window != NULL){
@@ -150,6 +151,7 @@
 
             // Finally, set these new values in the info for this thread
             info->hDC = hDC;
+            info->hWnd = wsdo->window;
         }
 
         // cached brush and pen are not associated with any DC, and can be
@@ -187,7 +189,7 @@
         if (info->hDC != NULL) {
             // move the DC from the active dcs list to
             // the passive dc list to be released later
-            MoveDCToPassiveList(info->hDC);
+            MoveDCToPassiveList(info->hDC, info->hWnd);
         }
 
         if (info->clip != NULL) {
--- a/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.h	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/windows/native/libawt/java2d/windows/GDIWindowSurfaceData.h	Tue Nov 03 09:45:39 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -196,6 +196,7 @@
  */
 typedef struct {
     HDC         hDC;
+    HWND        hWnd;
     GDIWinSDOps *wsdo;
     LONG        wsdoTimeStamp; // wsdo creation time stamp.
                                // Other threads may deallocate wsdo
--- a/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Tue Nov 03 09:45:39 2015 -0800
@@ -1382,7 +1382,7 @@
       case WM_AWT_RELEASEDC:
       {
             HDC hDC = (HDC)wParam;
-            MoveDCToPassiveList(hDC);
+            MoveDCToPassiveList(hDC, GetHWnd());
             ReleaseDCList(GetHWnd(), passiveDCList);
             mr = mrConsume;
             break;
@@ -7165,8 +7165,8 @@
 }
 
 /**
- * Given a DC, remove it from the DC list and return
- * TRUE if it exists on the current list.  Otherwise
+ * Given a DC and window handle, remove the DC from the DC list
+ * and return TRUE if it exists on the current list.  Otherwise
  * return FALSE.
  * A DC may not exist on the list because it has already
  * been released elsewhere (for example, the window
@@ -7174,14 +7174,14 @@
  * thread may also want to release a DC when it notices that
  * its DC is obsolete for the current window).
  */
-DCItem *DCList::RemoveDC(HDC hDC)
+DCItem *DCList::RemoveDC(HDC hDC, HWND hWnd)
 {
     listLock.Enter();
     DCItem **prevPtrPtr = &head;
     DCItem *listPtr = head;
     while (listPtr) {
         DCItem *nextPtr = listPtr->next;
-        if (listPtr->hDC == hDC) {
+        if (listPtr->hDC == hDC && listPtr->hWnd == hWnd) {
             *prevPtrPtr = nextPtr;
             break;
         }
@@ -7235,9 +7235,9 @@
     listLock.Leave();
 }
 
-void MoveDCToPassiveList(HDC hDC) {
+void MoveDCToPassiveList(HDC hDC, HWND hWnd) {
     DCItem *removedDC;
-    if ((removedDC = activeDCList.RemoveDC(hDC)) != NULL) {
+    if ((removedDC = activeDCList.RemoveDC(hDC, hWnd)) != NULL) {
         passiveDCList.AddDCItem(removedDC);
     }
 }
--- a/src/java.desktop/windows/native/libawt/windows/awt_Component.h	Tue Nov 03 17:54:25 2015 +0100
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Component.h	Tue Nov 03 09:45:39 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -900,13 +900,13 @@
 
     void            AddDC(HDC hDC, HWND hWnd);
     void            AddDCItem(DCItem *newItem);
-    DCItem          *RemoveDC(HDC hDC);
+    DCItem          *RemoveDC(HDC hDC, HWND hWnd);
     DCItem          *RemoveAllDCs(HWND hWnd);
     void            RealizePalettes(int screen);
 };
 
 void ReleaseDCList(HWND hwnd, DCList &list);
-void MoveDCToPassiveList(HDC hDC);
+void MoveDCToPassiveList(HDC hDC, HWND hWnd);
 
 #include "ObjectList.h"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Component/CreateImage/CreateImage.java	Tue Nov 03 09:45:39 2015 -0800
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.AWTException;
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.GraphicsEnvironment;
+
+import javax.swing.JButton;
+
+/**
+ * @test
+ * @bug 6815345
+ * @run main CreateImage
+ * @run main/othervm -Djava.awt.headless=true CreateImage
+ */
+public final class CreateImage {
+
+    public static void main(final String[] args) throws Exception {
+        EventQueue.invokeAndWait(CreateImage::test);
+    }
+
+    private static void test() {
+        final JButton jbutton1 = new JButton();
+        final JButton jbutton2 = new JButton();
+
+        if (GraphicsEnvironment.isHeadless()) {
+            checkCreateImage(jbutton1, true);
+            checkCreateImage(jbutton2, true);
+            return;
+        }
+
+        final Frame frame = new Frame();
+        final Button button1 = new Button();
+        final Button button2 = new Button();
+        try {
+            // all components are not displayable
+            checkCreateImage(frame, true);
+            checkCreateImage(button1, true);
+            checkCreateImage(button2, true);
+            checkCreateImage(jbutton1, true);
+            checkCreateImage(jbutton2, true);
+
+            // some components added to the non-displayable frame
+            frame.add(button1);
+            frame.add(jbutton1);
+            checkCreateImage(button1, true);
+            checkCreateImage(jbutton1, true);
+            frame.pack();
+
+            // tests previously added components when the frame is displayable
+            checkCreateImage(frame, false);
+            checkCreateImage(button1, false);
+            checkCreateImage(jbutton1, false);
+
+            // some components added to the displayable frame
+            frame.add(button2);
+            frame.add(jbutton2);
+            checkCreateImage(button2, false);
+            checkCreateImage(jbutton2, false);
+
+        } finally {
+            frame.dispose();
+        }
+        // tests all components after the frame became non-displayable again
+        checkCreateImage(frame, true);
+        checkCreateImage(button1, true);
+        checkCreateImage(button2, true);
+        checkCreateImage(jbutton1, true);
+        checkCreateImage(jbutton2, true);
+    }
+
+    private static void checkCreateImage(final Component comp,
+                                         final boolean isNull) {
+        if ((comp.createImage(10, 10) != null) == isNull) {
+            throw new RuntimeException("Image is wrong");
+        }
+        if ((comp.createVolatileImage(10, 10) != null) == isNull) {
+            throw new RuntimeException("Image is wrong");
+        }
+        try {
+            if ((comp.createVolatileImage(10, 10, null) != null) == isNull) {
+                throw new RuntimeException("Image is wrong");
+            }
+        } catch (final AWTException ignored) {
+            // this check is not applicable
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Component/TreeLockDeadlock/TreeLockDeadlock.java	Tue Nov 03 09:45:39 2015 -0800
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.Window;
+
+import static java.util.concurrent.TimeUnit.MINUTES;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
+
+/**
+ * @test
+ * @bug 8138764
+ */
+public final class TreeLockDeadlock extends Frame {
+
+    @Override
+    public synchronized GraphicsConfiguration getGraphicsConfiguration() {
+        return super.getGraphicsConfiguration();
+    }
+
+    @Override
+    public synchronized void reshape(int x, int y, int width, int height) {
+        super.reshape(x, y, width, height);
+    }
+
+    @Override
+    public synchronized float getOpacity() {
+        return super.getOpacity();
+    }
+
+    public static void main(final String[] args) throws Exception {
+        final Window window = new TreeLockDeadlock();
+        window.setSize(300, 300);
+        test(window);
+    }
+
+    private static void test(final Window window) throws Exception {
+        final long start = System.nanoTime();
+        final long end = start + NANOSECONDS.convert(1, MINUTES);
+
+        final Runnable r1 = () -> {
+            while (System.nanoTime() < end) {
+                window.setBounds(window.getBounds());
+            }
+        };
+        final Runnable r2 = () -> {
+            while (System.nanoTime() < end) {
+                window.getGraphicsConfiguration();
+                window.getOpacity();
+            }
+        };
+
+        final Thread t1 = new Thread(r1);
+        final Thread t2 = new Thread(r1);
+        final Thread t3 = new Thread(r2);
+        final Thread t4 = new Thread(r2);
+
+        t1.start();
+        t2.start();
+        t3.start();
+        t4.start();
+        t1.join();
+        t2.join();
+        t3.join();
+        t4.join();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/EmbeddedFrame/GraphicsConfigTest/GraphicsConfigTest.java	Tue Nov 03 09:45:39 2015 -0800
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6356322
+ * @summary Tests that embedded frame's graphics configuration is updated
+ *          correctly when it is moved to another screen in multiscreen system,
+ *          XToolkit
+ * @author artem.ananiev@sun.com: area=awt.multiscreen
+ * @requires (os.family == "linux") | (os.family == "solaris")
+ * @modules java.desktop/sun.awt
+ *          java.desktop/sun.awt.X11
+ *          java.desktop/java.awt.peer
+ * @run main GraphicsConfigTest
+ */
+
+import java.awt.*;
+import java.awt.peer.*;
+import java.lang.reflect.*;
+import java.util.*;
+import sun.awt.*;
+
+public class GraphicsConfigTest {
+
+    private static void init()
+        throws InterruptedException, AWTException {
+        if (!isXToolkit()) {
+            System.err.println("The test should be run only on XToolkit");
+            return;
+        }
+
+        GraphicsEnvironment ge =
+                GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            System.err.println("The test should be run only in"
+                + " multiscreen configuration");
+            return;
+        }
+
+        boolean xinerama = Arrays.stream(gds)
+            .map((gd) -> gd.getDefaultConfiguration().getBounds())
+            .filter((r) -> r.x != 0 || r.y != 0).findFirst().isPresent();
+
+        if (!xinerama) {
+            System.err.println("The test should be run only with Xinerama ON");
+            return;
+        }
+
+        Rectangle r0 = gds[0].getDefaultConfiguration().getBounds();
+        Rectangle r1 = gds[1].getDefaultConfiguration().getBounds();
+
+        System.setProperty("sun.awt.xembedserver", "true");
+        Frame f = new Frame("F");
+        try {
+            final Robot robot = new Robot();
+
+            f.setBounds(r0.x + 100, r0.y + 100, 200, 200);
+            f.setVisible(true);
+            robot.waitForIdle();
+            Thread.sleep(1000);
+
+            Canvas c = new Canvas();
+            f.add(c);
+            AWTAccessor.ComponentAccessor acc =
+                        AWTAccessor.getComponentAccessor();
+            WindowIDProvider wip = acc.getPeer(c);
+            long h = wip.getWindow();
+
+            EmbeddedFrame e = createEmbeddedFrame(h);
+            acc.<FramePeer>getPeer(e).setBoundsPrivate(0, 0, 100,
+                100); // triggers XConfigureEvent
+            e.registerListeners();
+            e.setVisible(true);
+            robot.waitForIdle();
+            Thread.sleep(1000);
+
+            if (!checkGC(f, e)) {
+                throw new RuntimeException("Failed at checkpoint 1");
+            }
+
+            f.setLocation(r1.x + 100, r1.y + 100);
+            Thread.sleep(100);
+            acc.<FramePeer>getPeer(e).setBoundsPrivate(0, 0, 101,
+                101); // triggers XConfigureEvent
+            robot.waitForIdle();
+            Thread.sleep(1000);
+
+            if (!checkGC(f, e)) {
+                throw new RuntimeException("Failed at checkpoint 2");
+            }
+
+            f.setLocation(r0.x + 100, r0.y + 100);
+            Thread.sleep(100);
+            acc.<FramePeer>getPeer(e).setBoundsPrivate(0, 0, 102,
+                102); // triggers XConfigureEvent
+            robot.waitForIdle();
+            Thread.sleep(1000);
+
+            if (!checkGC(f, e)) {
+                throw new RuntimeException("Failed at checkpoint 3");
+            }
+
+        } finally {
+            f.dispose();
+        }
+    }
+
+    private static boolean isXToolkit() {
+        return Toolkit.getDefaultToolkit().getClass()
+                        .getName().equals("sun.awt.X11.XToolkit");
+    }
+
+    private static EmbeddedFrame createEmbeddedFrame(long window) {
+        try {
+            Class cl = Class.forName("sun.awt.X11.XEmbeddedFrame");
+            Constructor cons = cl.getConstructor(
+                new Class[]{Long.TYPE, Boolean.TYPE});
+            return (EmbeddedFrame) cons.newInstance(new Object[]{window, true});
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("Can't create embedded frame");
+        }
+    }
+
+    private static boolean checkGC(Component c, Component d) {
+        GraphicsConfiguration g1 = c.getGraphicsConfiguration();
+        System.err.println(g1);
+        GraphicsConfiguration g2 = d.getGraphicsConfiguration();
+        System.err.println(g2);
+
+        return g1.equals(g2);
+    }
+
+    public static void main(String args[]) throws InterruptedException, AWTException {
+        init();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/List/FocusEmptyListTest/FocusEmptyListTest.html	Tue Nov 03 09:45:39 2015 -0800
@@ -0,0 +1,47 @@
+<!--
+ Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ 
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+ 
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+ 
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ 
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+<html>
+<!--  
+  @test
+  @bug 6387275
+  @summary List: the focus is at the top of the first item, XAWT
+  @author Dmitry.Cherepanov@SUN.COM area=awt.list
+  @requires (os.family == "linux" | os.family == "solaris")
+  @modules java.desktop/sun.awt
+           java.desktop/java.awt.peer
+           java.desktop/sun.awt.X11
+  @run applet FocusEmptyListTest.html
+  -->
+<head>
+<title> FocusEmptyListTest </title>
+</head>
+<body>
+
+<h1>FocusEmptyListTest<br>Bug ID: 6387275 </h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="FocusEmptyListTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/List/FocusEmptyListTest/FocusEmptyListTest.java	Tue Nov 03 09:45:39 2015 -0800
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 6387275
+  @summary List: the focus is at the top of the first item, XAWT
+  @author Dmitry.Cherepanov@SUN.COM area=awt.list
+  @run applet FocusEmptyListTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.lang.reflect.*;
+import java.awt.peer.ListPeer;
+
+import sun.awt.AWTAccessor;
+
+public class FocusEmptyListTest extends Applet {
+
+    public void init() {
+        setLayout(new BorderLayout());
+    }//End  init()
+
+    public void start() {
+        boolean isXToolkit = Toolkit.getDefaultToolkit()
+            .getClass().getName().equals("sun.awt.X11.XToolkit");
+        if (!isXToolkit) {
+            System.out.println("The test is XAWT-only.");
+            return;
+        }
+
+        List list = new List();
+        Object isIndexDisplayed = null;
+        setLayout(new FlowLayout());
+
+        getToolkit().addAWTEventListener(System.out::println,
+            AWTEvent.FOCUS_EVENT_MASK | AWTEvent.WINDOW_FOCUS_EVENT_MASK);
+
+        add(list);
+        list.add("item1");
+
+        setSize(200, 200);
+        setVisible(true);
+        validate();
+
+        list.removeAll();
+
+        try {
+
+            // peer = List.getPeer()
+            ListPeer peer = AWTAccessor.getComponentAccessor().getPeer(list);
+            System.out.println("peer = " + peer);
+            Class peerClass = peer.getClass();
+            System.out.println("peer's class = " + peerClass);
+
+            // isIndexDisplayed = peer.isIndexDisplayed(-1)
+            Method isIndexDisplayedM
+                = peerClass.getDeclaredMethod("isIndexDisplayed", Integer.TYPE);
+            System.out.println("method = " + isIndexDisplayedM);
+            isIndexDisplayedM.setAccessible(true);
+            isIndexDisplayed = isIndexDisplayedM.invoke(peer, -1);
+            System.out.println("isIndexDisplayed=" + isIndexDisplayed);
+
+        } catch (Throwable thr) {
+            throw new RuntimeException("TEST FAILED: " + thr);
+        }
+
+        if ((Boolean) isIndexDisplayed) {
+            throw new RuntimeException("TEST FAILED: -1 should be"
+                + " invisible index");
+        }
+
+    }// start()
+
+}// class AutomaticAppletTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Window/MultiWindowApp/MultiWindowAppTest.java	Tue Nov 03 09:45:39 2015 -0800
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test @summary After calling frame.toBack() dialog goes to the back on Ubuntu 12.04
+ * @bug 8022334
+ * @author Semyon Sadetsky
+ * @run main MultiWindowAppTest
+ */
+
+import java.awt.*;
+
+public class MultiWindowAppTest {
+
+    public static void main(String[] args) throws Exception {
+        Window win1 = new Frame();
+        Window win2 = new Dialog((Frame) null);
+
+        win1.setBounds(100, 100, 200, 200);
+        win1.setBackground(Color.RED);
+        win1.setVisible(true);
+
+        Robot robot = new Robot();
+        robot.delay(200);
+        robot.waitForIdle();
+
+        win2.setBounds(win1.getBounds());
+        win2.setVisible(true);
+
+        robot.delay(200);
+        robot.waitForIdle();
+
+        win1.toFront();
+        robot.delay(200);
+        robot.waitForIdle();
+
+        Point point = win1.getLocationOnScreen();
+        Color color = robot.getPixelColor(point.x + 100, point.y + 100);
+
+        if(!color.equals(Color.RED)) {
+            win1.dispose();
+            win2.dispose();
+            throw new RuntimeException("Window was not sent to front.");
+        }
+
+        win1.toBack();
+        robot.delay(200);
+        robot.waitForIdle();
+
+        color = robot.getPixelColor(point.x + 100, point.y + 100);
+
+        win1.dispose();
+        win2.dispose();
+
+        if(color.equals(Color.RED)) {
+            throw new RuntimeException("Window was not sent to back.");
+        }
+
+        System.out.println("ok");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Window/ScreenLocation/ScreenLocationTest.java	Tue Nov 03 09:45:39 2015 -0800
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 8011616
+   @summary JWindow.getLocation and JWindow.getLocationOnScreen return different
+            values on Unity
+   @author Semyon Sadetsky
+  */
+
+import java.awt.*;
+
+public class ScreenLocationTest {
+
+
+    public static void main(String[] args) throws Exception {
+        testLocation();
+        testSize();
+        System.out.println("ok");
+    }
+
+    public static void testLocation() throws Exception {
+        Window window = new Window((Frame) null);
+        window.setSize(100, 100);
+        window.setLocation(0, 0);
+        window.setVisible(true);
+
+        Robot robot = new Robot();
+        robot.delay(200);
+        robot.waitForIdle();
+
+        Point location1 = window.getLocation();
+        Point location2 = window.getLocationOnScreen();
+        window.setLocation(10000, 10000);
+
+        if (!location1.equals(location2)) {
+            window.dispose();
+            throw new RuntimeException("getLocation is different");
+        }
+
+        robot.delay(200);
+        robot.waitForIdle();
+        location1 = window.getLocation();
+        location2 = window.getLocationOnScreen();
+
+        if (!location1.equals(location2)) {
+            window.dispose();
+            throw new RuntimeException("getLocation is different");
+        }
+
+        window.dispose();
+    }
+
+    public static void testSize() throws Exception {
+        Window window = new Window((Frame) null);
+        window.setSize(Integer.MAX_VALUE, Integer.MAX_VALUE);
+        window.setVisible(true);
+
+        Robot robot = new Robot();
+        robot.delay(200);
+        robot.waitForIdle();
+
+        Dimension size = window.getSize();
+        if (size.width == Integer.MAX_VALUE ||
+                size.height == Integer.MAX_VALUE) {
+            window.dispose();
+            throw new RuntimeException("size is wrong");
+        }
+
+        window.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/datatransfer/DataFlavor/MacOsXFileAndMultipleFileCopingTest/MacOsXFileAndMultipleFileCopingTest.java	Tue Nov 03 09:45:39 2015 -0800
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 8081787 8136763
+  @author Mikhail Cherkasov
+  @run main/manual MacOsXFileAndMultipleFileCopingTest
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URL;
+
+public class MacOsXFileAndMultipleFileCopingTest {
+    private static void init() {
+        String[] instructions =
+                {"Test for MacOS X only:",
+                        "1. The aim is to test that java works fine with \"application/" +
+                                "x-java-url;class=java.net.URL\"falvor and support coping of multiple files",
+                        "2. Open finder and select any file.",
+                        "3. Press CMD+C or press \"Copy\" in context menu",
+                        "4. Focus window with \"Test URL\" Button.",
+                        "5. If you see URL for selected file, then test PASSED,",
+                        "otherwise test FAILED.",
+
+                        "6. Open finder again and select several files.",
+                        "7. Press CMD+C or press \"Copy\" in context menu",
+                        "8. Focus window with \"Test multiple files coping\" Button.",
+                        "9. If you see list of selected files, then test PASSED,",
+                        "otherwise test FAILED.",
+
+                };
+
+        Sysout.createDialog();
+        Sysout.printInstructions(instructions);
+
+        final Frame frame = new Frame();
+        Panel panel = new Panel();
+        panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
+
+        frame.add(panel);
+        Button testUrlBtn = new Button("Test URL");
+        final TextArea textArea = new TextArea(5, 80);
+        testUrlBtn.addActionListener(new AbstractAction() {
+            @Override
+            public void actionPerformed(ActionEvent ae) {
+                try {
+                    Clipboard board = Toolkit.getDefaultToolkit().getSystemClipboard();
+                    URL url = (URL) board.getData(new DataFlavor("application/x-java-url;class=java.net.URL"));
+                    textArea.setText(url.toString());
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+        panel.add(testUrlBtn);
+        Button testUriList = new Button("Test multiple files coping");
+        testUriList.addActionListener(new AbstractAction() {
+            @Override
+            public void actionPerformed(ActionEvent ae) {
+                try {
+                    Clipboard board = Toolkit.getDefaultToolkit().getSystemClipboard();
+                        String files = (String) board.getData(new DataFlavor("text/uri-list;class=java.lang.String"));
+                    textArea.setText(files);
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+        panel.add(testUriList);
+        panel.add(textArea);
+        frame.setBounds(200, 200, 400, 400);
+        frame.setVisible(true);
+
+    }//End  init()
+
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-defined
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    public static void main(String args[]) throws InterruptedException {
+        if (!System.getProperty("os.name").startsWith("Mac")) {
+            return;
+        }
+        mainThread = Thread.currentThread();
+        try {
+            init();
+        } catch (TestPassedException e) {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test passed nor test failed has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try {
+            Thread.sleep(sleepTime);
+            //Timed out, so fail the test
+            throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds");
+        } catch (InterruptedException e) {
+            if (!testGeneratedInterrupt) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+            if (theTestPassed == false) {
+                throw new RuntimeException(failureMessage);
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo(int seconds) {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass() {
+        Sysout.println("The test passed.");
+        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
+        //first check if this is executing in main thread
+        if (mainThread == Thread.currentThread()) {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        //pass was called from a different thread, so set the flag and interrupt
+        // the main thead.
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        if (mainThread != null) {
+            mainThread.interrupt();
+        }
+    }//pass()
+
+    public static synchronized void fail() {
+        //test writer didn't specify why test failed, so give generic
+        fail("it just plain failed! :-)");
+    }
+
+    public static synchronized void fail(String whyFailed) {
+        Sysout.println("The test failed: " + whyFailed);
+        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
+        //check if this called from main thread
+        if (mainThread == Thread.currentThread()) {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException(whyFailed);
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+
+}// class ManualMainTest
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException {
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+/****************************************************
+ * Standard Test Machinery
+ * DO NOT modify anything below -- it's a standard
+ * chunk of code whose purpose is to make user
+ * interaction uniform, and thereby make it simpler
+ * to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+ for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+ WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+ with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+ as standalone.
+ */
+
+class Sysout {
+    private static TestDialog dialog;
+    private static boolean numbering = false;
+    private static int messageNumber = 0;
+
+    public static void createDialogWithInstructions(String[] instructions) {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        dialog.printInstructions(instructions);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void createDialog() {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        String[] defInstr = {"Instructions will appear here. ", ""};
+        dialog.printInstructions(defInstr);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+
+    /* Enables message counting for the tester. */
+    public static void enableNumbering(boolean enable) {
+        numbering = enable;
+    }
+
+    public static void printInstructions(String[] instructions) {
+        dialog.printInstructions(instructions);
+    }
+
+
+    public static void println(String messageIn) {
+        if (numbering) {
+            messageIn = "" + messageNumber + " " + messageIn;
+            messageNumber++;
+        }
+        dialog.displayMessage(messageIn);
+    }
+
+}// Sysout  class
+
+/**
+ This is part of the standard test machinery.  It provides a place for the
+ test instructions to be displayed, and a place for interactive messages
+ to the user to be displayed.
+ To have the test instructions displayed, see Sysout.
+ To have a message to the user be displayed, see Sysout.
+ Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog implements ActionListener {
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+    Panel buttonP = new Panel();
+    Button passB = new Button("pass");
+    Button failB = new Button("fail");
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog(Frame frame, String name) {
+        super(frame, name);
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
+        add("North", instructionsText);
+
+        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
+        add("Center", messageText);
+
+        passB = new Button("pass");
+        passB.setActionCommand("pass");
+        passB.addActionListener(this);
+        buttonP.add("East", passB);
+
+        failB = new Button("fail");
+        failB.setActionCommand("fail");
+        failB.addActionListener(this);
+        buttonP.add("West", failB);
+
+        add("South", buttonP);
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions(String[] instructions) {
+        //Clear out any current instructions
+        instructionsText.setText("");
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for (int i = 0; i < instructions.length; i++) {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[i];
+            while (remainingStr.length() > 0) {
+                //if longer than max then chop off first max chars to print
+                if (remainingStr.length() >= maxStringLength) {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                            lastIndexOf(' ', maxStringLength - 1);
+
+                    if (posOfSpace <= 0) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring(0, posOfSpace + 1);
+                    remainingStr = remainingStr.substring(posOfSpace + 1);
+                }
+                //else just print
+                else {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append(printStr + "\n");
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage(String messageIn) {
+        messageText.append(messageIn + "\n");
+        System.out.println(messageIn);
+    }
+
+    //catch presses of the passed and failed buttons.
+    //simply call the standard pass() or fail() static methods of
+    //ManualMainTest
+    public void actionPerformed(ActionEvent e) {
+        if (e.getActionCommand() == "pass") {
+            MacOsXFileAndMultipleFileCopingTest.pass();
+        } else {
+            MacOsXFileAndMultipleFileCopingTest.fail();
+        }
+    }
+
+}// TestDialog  class
\ No newline at end of file
--- a/test/java/awt/datatransfer/DataFlavor/XJavaUrlDataFlavorTest/XJavaUrlDataFlavorTest.java	Tue Nov 03 17:54:25 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,345 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
-  @test
-  @bug 8081787
-  @summary MalformedURLException is thrown during reading data for application/x-java-url;class=java.net.URL flavor
-  @author Mikhail Cherkasov
-  @run main/manual XJavaUrlDataFlavorTest
-*/
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.datatransfer.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.URL;
-
-public class XJavaUrlDataFlavorTest {
-    private static void init() {
-        String[] instructions =
-                {"Test for MacOS X only:",
-                        "1. The aim is to test that java works fine with \"application/" +
-                                "x-java-url;class=java.net.URL\"falvor.",
-                        "2. Open finder and select any file.",
-                        "3. Press CMD+C or press \"Copy\" in context menu",
-                        "4. Focus window with \"Test\" Button.",
-                        "5. If you see URL for selected file, then test PASSED,",
-                        "otherwise test FAILED."
-                };
-
-        Sysout.createDialog();
-        Sysout.printInstructions(instructions);
-
-        final Frame frame = new Frame();
-        Panel panel = new Panel();
-        panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
-
-        frame.add(panel);
-        Button testButton = new Button("Test");
-        final TextField textField = new TextField(40);
-        testButton.addActionListener(new AbstractAction() {
-            @Override
-            public void actionPerformed(ActionEvent ae) {
-                try {
-                    Clipboard board = Toolkit.getDefaultToolkit().getSystemClipboard();
-                    URL url = (URL)board.getData(new DataFlavor("application/x-java-url;class=java.net.URL"));
-                    textField.setText(url.toString());
-                } catch (Exception e) {
-                    throw new RuntimeException(e);
-                }
-            }
-        });
-        panel.add(testButton);
-        panel.add(textField);
-        frame.setBounds(200, 200, 400, 400);
-        frame.setVisible(true);
-
-    }//End  init()
-
-
-    /*****************************************************
-     * Standard Test Machinery Section
-     * DO NOT modify anything in this section -- it's a
-     * standard chunk of code which has all of the
-     * synchronisation necessary for the test harness.
-     * By keeping it the same in all tests, it is easier
-     * to read and understand someone else's test, as
-     * well as insuring that all tests behave correctly
-     * with the test harness.
-     * There is a section following this for test-defined
-     * classes
-     ******************************************************/
-    private static boolean theTestPassed = false;
-    private static boolean testGeneratedInterrupt = false;
-    private static String failureMessage = "";
-
-    private static Thread mainThread = null;
-
-    private static int sleepTime = 300000;
-
-    public static void main(String args[]) throws InterruptedException {
-        mainThread = Thread.currentThread();
-        try {
-            init();
-        } catch (TestPassedException e) {
-            //The test passed, so just return from main and harness will
-            // interepret this return as a pass
-            return;
-        }
-        //At this point, neither test passed nor test failed has been
-        // called -- either would have thrown an exception and ended the
-        // test, so we know we have multiple threads.
-
-        //Test involves other threads, so sleep and wait for them to
-        // called pass() or fail()
-        try {
-            Thread.sleep(sleepTime);
-            //Timed out, so fail the test
-            throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds");
-        } catch (InterruptedException e) {
-            if (!testGeneratedInterrupt) throw e;
-
-            //reset flag in case hit this code more than once for some reason (just safety)
-            testGeneratedInterrupt = false;
-            if (theTestPassed == false) {
-                throw new RuntimeException(failureMessage);
-            }
-        }
-
-    }//main
-
-    public static synchronized void setTimeoutTo(int seconds) {
-        sleepTime = seconds * 1000;
-    }
-
-    public static synchronized void pass() {
-        Sysout.println("The test passed.");
-        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
-        //first check if this is executing in main thread
-        if (mainThread == Thread.currentThread()) {
-            //Still in the main thread, so set the flag just for kicks,
-            // and throw a test passed exception which will be caught
-            // and end the test.
-            theTestPassed = true;
-            throw new TestPassedException();
-        }
-        //pass was called from a different thread, so set the flag and interrupt
-        // the main thead.
-        theTestPassed = true;
-        testGeneratedInterrupt = true;
-        if (mainThread != null) {
-            mainThread.interrupt();
-        }
-    }//pass()
-
-    public static synchronized void fail() {
-        //test writer didn't specify why test failed, so give generic
-        fail("it just plain failed! :-)");
-    }
-
-    public static synchronized void fail(String whyFailed) {
-        Sysout.println("The test failed: " + whyFailed);
-        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
-        //check if this called from main thread
-        if (mainThread == Thread.currentThread()) {
-            //If main thread, fail now 'cause not sleeping
-            throw new RuntimeException(whyFailed);
-        }
-        theTestPassed = false;
-        testGeneratedInterrupt = true;
-        failureMessage = whyFailed;
-        mainThread.interrupt();
-    }//fail()
-
-}// class ManualMainTest
-
-//This exception is used to exit from any level of call nesting
-// when it's determined that the test has passed, and immediately
-// end the test.
-class TestPassedException extends RuntimeException {
-}
-
-//*********** End Standard Test Machinery Section **********
-
-
-/****************************************************
- * Standard Test Machinery
- * DO NOT modify anything below -- it's a standard
- * chunk of code whose purpose is to make user
- * interaction uniform, and thereby make it simpler
- * to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
- for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
- WithInstructions method.  Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
- with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
- as standalone.
- */
-
-class Sysout {
-    private static TestDialog dialog;
-    private static boolean numbering = false;
-    private static int messageNumber = 0;
-
-    public static void createDialogWithInstructions(String[] instructions) {
-        dialog = new TestDialog(new Frame(), "Instructions");
-        dialog.printInstructions(instructions);
-        dialog.setVisible(true);
-        println("Any messages for the tester will display here.");
-    }
-
-    public static void createDialog() {
-        dialog = new TestDialog(new Frame(), "Instructions");
-        String[] defInstr = {"Instructions will appear here. ", ""};
-        dialog.printInstructions(defInstr);
-        dialog.setVisible(true);
-        println("Any messages for the tester will display here.");
-    }
-
-
-    /* Enables message counting for the tester. */
-    public static void enableNumbering(boolean enable) {
-        numbering = enable;
-    }
-
-    public static void printInstructions(String[] instructions) {
-        dialog.printInstructions(instructions);
-    }
-
-
-    public static void println(String messageIn) {
-        if (numbering) {
-            messageIn = "" + messageNumber + " " + messageIn;
-            messageNumber++;
-        }
-        dialog.displayMessage(messageIn);
-    }
-
-}// Sysout  class
-
-/**
- This is part of the standard test machinery.  It provides a place for the
- test instructions to be displayed, and a place for interactive messages
- to the user to be displayed.
- To have the test instructions displayed, see Sysout.
- To have a message to the user be displayed, see Sysout.
- Do not call anything in this dialog directly.
- */
-class TestDialog extends Dialog implements ActionListener {
-
-    TextArea instructionsText;
-    TextArea messageText;
-    int maxStringLength = 80;
-    Panel buttonP = new Panel();
-    Button passB = new Button("pass");
-    Button failB = new Button("fail");
-
-    //DO NOT call this directly, go through Sysout
-    public TestDialog(Frame frame, String name) {
-        super(frame, name);
-        int scrollBoth = TextArea.SCROLLBARS_BOTH;
-        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
-        add("North", instructionsText);
-
-        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
-        add("Center", messageText);
-
-        passB = new Button("pass");
-        passB.setActionCommand("pass");
-        passB.addActionListener(this);
-        buttonP.add("East", passB);
-
-        failB = new Button("fail");
-        failB.setActionCommand("fail");
-        failB.addActionListener(this);
-        buttonP.add("West", failB);
-
-        add("South", buttonP);
-        pack();
-
-        setVisible(true);
-    }// TestDialog()
-
-    //DO NOT call this directly, go through Sysout
-    public void printInstructions(String[] instructions) {
-        //Clear out any current instructions
-        instructionsText.setText("");
-
-        //Go down array of instruction strings
-
-        String printStr, remainingStr;
-        for (int i = 0; i < instructions.length; i++) {
-            //chop up each into pieces maxSringLength long
-            remainingStr = instructions[i];
-            while (remainingStr.length() > 0) {
-                //if longer than max then chop off first max chars to print
-                if (remainingStr.length() >= maxStringLength) {
-                    //Try to chop on a word boundary
-                    int posOfSpace = remainingStr.
-                            lastIndexOf(' ', maxStringLength - 1);
-
-                    if (posOfSpace <= 0) posOfSpace = maxStringLength - 1;
-
-                    printStr = remainingStr.substring(0, posOfSpace + 1);
-                    remainingStr = remainingStr.substring(posOfSpace + 1);
-                }
-                //else just print
-                else {
-                    printStr = remainingStr;
-                    remainingStr = "";
-                }
-
-                instructionsText.append(printStr + "\n");
-
-            }// while
-
-        }// for
-
-    }//printInstructions()
-
-    //DO NOT call this directly, go through Sysout
-    public void displayMessage(String messageIn) {
-        messageText.append(messageIn + "\n");
-        System.out.println(messageIn);
-    }
-
-    //catch presses of the passed and failed buttons.
-    //simply call the standard pass() or fail() static methods of
-    //ManualMainTest
-    public void actionPerformed(ActionEvent e) {
-        if (e.getActionCommand() == "pass") {
-            XJavaUrlDataFlavorTest.pass();
-        } else {
-            XJavaUrlDataFlavorTest.fail();
-        }
-    }
-
-}// TestDialog  class
--- a/test/java/awt/print/PrinterJob/PrintTextTest.java	Tue Nov 03 17:54:25 2015 +0100
+++ b/test/java/awt/print/PrinterJob/PrintTextTest.java	Tue Nov 03 09:45:39 2015 -0800
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6425068 7157659
+ * @bug 6425068 7157659 8132890
  * @summary Confirm that text prints where we expect to the length we expect.
  * @run main/manual=yesno PrintTextTest
  */
@@ -113,6 +113,32 @@
         book.append(ptt, portrait);
         book.append(ptt, landscape);
 
+        font = new Font("Dialog", Font.PLAIN, 18);
+        AffineTransform scaleTx = AffineTransform.getScaleInstance(1.25, 1.25);
+        name = "Page " + new Integer(page++);
+        ptt = new PrintTextTest(name, font, scaleTx, false);
+        p.add(name, ptt);
+        book.append(ptt, portrait);
+        book.append(ptt, landscape);
+
+        font = new Font("Dialog", Font.PLAIN, 18);
+        scaleTx = AffineTransform.getScaleInstance(-1.25, 1.25);
+        scaleTx.translate(-preferredSize/1.25, 0);
+        name = "Page " + new Integer(page++);
+        ptt = new PrintTextTest(name, font, scaleTx, false);
+        p.add(name, ptt);
+        book.append(ptt, portrait);
+        book.append(ptt, landscape);
+
+        font = new Font("Dialog", Font.PLAIN, 18);
+        scaleTx = AffineTransform.getScaleInstance(1.25, -1.25);
+        scaleTx.translate(0, -preferredSize/1.25);
+        name = "Page " + new Integer(page++);
+        ptt = new PrintTextTest(name, font, scaleTx, false);
+        p.add(name, ptt);
+        book.append(ptt, portrait);
+        book.append(ptt, landscape);
+
         font = font.deriveFont(rotTx);
         name = "Page " + new Integer(page++);
         ptt = new PrintTextTest(name, font, null, false);
@@ -121,6 +147,30 @@
         book.append(ptt, portrait);
         book.append(ptt, landscape);
 
+        font = new Font("Monospaced", Font.PLAIN, 12);
+        name = "Page " + new Integer(page++);
+        ptt = new PrintTextTest(name, font, null, false);
+        p.add(ptt, BorderLayout.CENTER);
+        p.add(name, ptt);
+        book.append(ptt, portrait);
+        book.append(ptt, landscape);
+
+        Font xfont = font.deriveFont(AffineTransform.getScaleInstance(1.5, 1));
+        name = "Page " + new Integer(page++);
+        ptt = new PrintTextTest(name, xfont, null, false);
+        p.add(ptt, BorderLayout.CENTER);
+        p.add(name, ptt);
+        book.append(ptt, portrait);
+        book.append(ptt, landscape);
+
+        Font yfont = font.deriveFont(AffineTransform.getScaleInstance(1, 1.5));
+        name = "Page " + new Integer(page++);
+        ptt = new PrintTextTest(name, yfont, null, false);
+        p.add(ptt, BorderLayout.CENTER);
+        p.add(name, ptt);
+        book.append(ptt, portrait);
+        book.append(ptt, landscape);
+
         if (System.getProperty("os.name").startsWith("Windows")) {
             font = new Font("MS Gothic", Font.PLAIN, 12);
             name = "Page " + new Integer(page++);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/imageio/plugins/bmp/BMPPixelSpacingTest.java	Tue Nov 03 09:45:39 2015 -0800
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     7182758
+ * @summary Test verifies whether we are getting correct Horizontal
+ *          & Vertical Physical pixel spacing for active BMP image
+ *          through stored metadata or not.
+ * @run     main BMPPixelSpacingTest
+ */
+
+import java.io.ByteArrayInputStream;
+import java.util.Iterator;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.stream.ImageInputStream;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class BMPPixelSpacingTest {
+
+    public static void main(String[] args) throws Exception {
+        // Header contaning X & Y pixels-per-meter more than value 1
+        byte[] bmpHeaderData = { (byte) 0x42, (byte) 0x4d, (byte) 0x7e,
+            (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x3e, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x28, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x64, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x64,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02,
+            (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0xff,
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+            (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+            (byte) 0xff };
+
+        ImageInputStream imageInput = ImageIO.
+            createImageInputStream(new ByteArrayInputStream(bmpHeaderData));
+
+        for (Iterator<ImageReader> it = ImageIO.getImageReaders(imageInput);
+            it.hasNext(); ) {
+            ImageReader reader = it.next();
+            reader.setInput(imageInput);
+            IIOMetadata metadata = reader.getImageMetadata(0);
+
+            Node rootNode = metadata.getAsTree("javax_imageio_1.0");
+            NodeList nl = rootNode.getChildNodes();
+
+            //Parse until you get Dimension child node
+            for (int i = 0; i < nl.getLength(); i++) {
+                Node node = nl.item(i);
+                if ((node.getNodeName()).equals("Dimension")) {
+                    //get childnode list under Dimension node
+                    NodeList cl = node.getChildNodes();
+                    //Corresponding node indices under Dimension node
+                    int horizontalNodeIndex = 1;
+                    int verticalNodeIndex = 2;
+                    Node horizontalNode = cl.item(horizontalNodeIndex);
+                    Node verticalNode = cl.item(verticalNodeIndex);
+
+                    //get attributes for horizontal and vertical nodes
+                    NamedNodeMap horizontalAttr = horizontalNode.
+                        getAttributes();
+                    NamedNodeMap verticalAttr = verticalNode.getAttributes();
+
+                    //since they have only one attribute index is 0
+                    int attributeIndex = 0;
+                    Node horizontalValue = horizontalAttr.item(attributeIndex);
+                    Node verticalValue = verticalAttr.item(attributeIndex);
+                    float horizontalNodeValue = Float.
+                        parseFloat((horizontalValue.getNodeValue()));
+                    float verticalNodeValue = Float.
+                        parseFloat((verticalValue.getNodeValue()));
+
+                    float expectedHorizontalValue, expectedVerticalValue;
+                    // in test metadata xPixelsPerMeter & yPixelsPerMeter is 2
+                    expectedHorizontalValue = expectedVerticalValue =
+                        1000.0F / 2;
+                    //expected and returned values should be same
+                    if ((Float.compare(horizontalNodeValue,
+                        expectedHorizontalValue) != 0) ||
+                        (Float.compare(verticalNodeValue,
+                        expectedVerticalValue) != 0)) {
+                        throw new RuntimeException("Invalid pixel spacing");
+                    }
+                }
+            }
+    }
+    }
+}