Merge
authorprr
Mon, 09 Jan 2017 11:57:06 -0800
changeset 43090 65e2b10e8e80
parent 43089 05e2611ebff6 (diff)
parent 43040 ab2c8b03c328 (current diff)
child 43091 a03e216c92ea
child 43093 c0087c8cf069
Merge
corba/THIRD_PARTY_README
hotspot/THIRD_PARTY_README
hotspot/test/compiler/c2/cr7005594/Test7005594.java
hotspot/test/compiler/c2/cr7005594/Test7005594.sh
hotspot/test/serviceability/jvmti/ExceptionCaughtOutOfPhase/ExceptionCaughtOutOfPhaseTest.java
jdk/make/lib/Awt2dLibraries.gmk
jdk/src/java.base/share/classes/sun/security/validator/KeyStores.java
jdk/test/lib/testlibrary/ModuleSourceBuilder.java
jdk/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.sh
jdk/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.sh
nashorn/RELEASE_README
nashorn/src/jdk.scripting.nashorn/share/classes/overview.html
nashorn/test/script/basic/JDK-8141209.js
nashorn/test/script/basic/JDK-8141209.js.EXPECTED
--- a/jdk/make/data/fontconfig/solaris.fontconfig.properties	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/make/data/fontconfig/solaris.fontconfig.properties	Mon Jan 09 11:57:06 2017 -0800
@@ -436,15 +436,15 @@
 
 filename.-monotype-arial-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arial.ttf
 filename.-monotype-arial-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/ariali.ttf
-filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialb.ttf
+filename.-monotype-arial-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbd.ttf
 filename.-monotype-arial-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/arialbi.ttf
 filename.-monotype-courier_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/cour.ttf
 filename.-monotype-courier_new-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/couri.ttf
-filename.-monotype-courier_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courb.ttf
+filename.-monotype-courier_new-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbd.ttf
 filename.-monotype-courier_new-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/courbi.ttf
 filename.-monotype-times_new_roman-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/times.ttf
 filename.-monotype-times_new_roman-medium-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesi.ttf
-filename.-monotype-times_new_roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesb.ttf
+filename.-monotype-times_new_roman-bold-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbd.ttf
 filename.-monotype-times_new_roman-bold-i-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/timesbi.ttf
 
 filename.-monotype-angsana_new-medium-r-normal--*-%d-*-*-p-*-iso10646-1=/usr/share/fonts/TrueType/core/angsa.ttf
--- a/jdk/make/lib/Awt2dLibraries.gmk	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Mon Jan 09 11:57:06 2017 -0800
@@ -222,6 +222,8 @@
 # applies to debug builds.
 ifeq ($(TOOLCHAIN_TYPE), gcc)
   BUILD_LIBAWT_debug_mem.c_CFLAGS := -w
+  # This option improves performance of MaskFill in Java2D by 20% for some gcc
+  LIBAWT_CFLAGS += -fgcse-after-reload
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Mon Jan 09 11:57:06 2017 -0800
@@ -231,6 +231,7 @@
     private boolean isFullScreenAnimationOn;
 
     private volatile boolean isInFullScreen;
+    private volatile boolean isIconifyAnimationActive;
 
     private Window target;
     private LWWindowPeer peer;
@@ -997,6 +998,9 @@
         if (peer != null) {
             peer.notifyIconify(iconify);
         }
+        if (iconify) {
+            isIconifyAnimationActive = false;
+        }
     }
 
     private void deliverZoom(final boolean isZoomed) {
@@ -1071,6 +1075,17 @@
         return true;
     }
 
+    private boolean isIconified() {
+        boolean isIconified = false;
+        if (target instanceof Frame) {
+            int state = ((Frame)target).getExtendedState();
+            if ((state & Frame.ICONIFIED) != 0) {
+                isIconified = true;
+            }
+        }
+        return isIconifyAnimationActive || isIconified;
+    }
+
     private boolean isOneOfOwnersOrSelf(CPlatformWindow window) {
         while (window != null) {
             if (this == window) {
@@ -1094,11 +1109,14 @@
         // the windows are ordered above their nearest owner; ancestors of the window,
         // which is going to become 'main window', are placed above their siblings.
         CPlatformWindow rootOwner = getRootOwner();
-        if (rootOwner.isVisible()) {
+        if (rootOwner.isVisible() && !rootOwner.isIconified()) {
             CWrapper.NSWindow.orderFront(rootOwner.getNSWindowPtr());
         }
-        final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
-        orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target));
+        // Do not order child windows of iconified owner.
+        if (!rootOwner.isIconified()) {
+            final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();
+            orderAboveSiblingsImpl(windowAccessor.getOwnedWindows(rootOwner.target));
+        }
     }
 
     private void orderAboveSiblingsImpl(Window[] windows) {
@@ -1109,10 +1127,12 @@
 
         // Go through the list of windows and perform ordering.
         for (Window w : windows) {
+            boolean iconified = false;
             final Object p = componentAccessor.getPeer(w);
             if (p instanceof LWWindowPeer) {
                 CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
-                if (pw != null && pw.isVisible()) {
+                iconified = isIconified();
+                if (pw != null && pw.isVisible() && !iconified) {
                     // If the window is one of ancestors of 'main window' or is going to become main by itself,
                     // the window should be ordered above its siblings; otherwise the window is just ordered
                     // above its nearest parent.
@@ -1125,10 +1145,13 @@
                     pw.applyWindowLevel(w);
                 }
             }
-            // Retrieve the child windows for each window from the list and store them for future use.
+            // Retrieve the child windows for each window from the list except iconified ones
+            // and store them for future use.
             // Note: we collect data about child windows even for invisible owners, since they may have
             // visible children.
-            childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w)));
+            if (!iconified) {
+                childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w)));
+            }
         }
         // If some windows, which have just been ordered, have any child windows, let's start new iteration
         // and order these child windows.
@@ -1149,6 +1172,10 @@
     //                          NATIVE CALLBACKS
     // ----------------------------------------------------------------------
 
+    private void windowWillMiniaturize() {
+        isIconifyAnimationActive = true;
+    }
+
     private void windowDidBecomeMain() {
         if (checkBlockingAndOrder()) return;
         // If it's not blocked, make sure it's above its siblings
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Mon Jan 09 11:57:06 2017 -0800
@@ -327,10 +327,43 @@
     return [window isKindOfClass: [AWTWindow_Panel class]] || [window isKindOfClass: [AWTWindow_Normal class]];
 }
 
+// Retrieves the list of possible window layers (levels)
++ (NSArray*) getWindowLayers {
+    static NSArray *windowLayers;
+    static dispatch_once_t token;
+
+    // Initialize the list of possible window layers
+    dispatch_once(&token, ^{
+        // The layers are ordered from front to back, (i.e. the toppest one is the first)
+        windowLayers = [NSArray arrayWithObjects:
+                            [NSNumber numberWithInt:CGWindowLevelForKey(kCGPopUpMenuWindowLevelKey)],
+                            [NSNumber numberWithInt:CGWindowLevelForKey(kCGFloatingWindowLevelKey)],
+                            [NSNumber numberWithInt:CGWindowLevelForKey(kCGNormalWindowLevelKey)],
+                            nil
+                        ];
+        [windowLayers retain];
+    });
+    return windowLayers;
+}
+
 // returns id for the topmost window under mouse
 + (NSInteger) getTopmostWindowUnderMouseID {
     NSInteger result = -1;
 
+    NSArray *windowLayers = [AWTWindow getWindowLayers];
+    // Looking for the window under mouse starting from the toppest layer
+    for (NSNumber *layer in windowLayers) {
+        result = [AWTWindow getTopmostWindowUnderMouseIDImpl:[layer integerValue]];
+        if (result != -1) {
+            break;
+        }
+    }
+    return result;
+}
+
++ (NSInteger) getTopmostWindowUnderMouseIDImpl:(NSInteger)windowLayer {
+    NSInteger result = -1;
+
     NSRect screenRect = [[NSScreen mainScreen] frame];
     NSPoint nsMouseLocation = [NSEvent mouseLocation];
     CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y);
@@ -339,7 +372,7 @@
 
     for (NSDictionary *window in windows) {
         NSInteger layer = [[window objectForKey:(id)kCGWindowLayer] integerValue];
-        if (layer == 0) {
+        if (layer == windowLayer) {
             CGRect rect;
             CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
             if (CGRectContainsPoint(rect, cgMouseLocation)) {
@@ -639,6 +672,14 @@
 AWT_ASSERT_APPKIT_THREAD;
 
     self.isMinimizing = YES;
+
+    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
+    if (platformWindow != NULL) {
+        static JNF_MEMBER_CACHE(jm_windowWillMiniaturize, jc_CPlatformWindow, "windowWillMiniaturize", "()V");
+        JNFCallVoidMethod(env, platformWindow, jm_windowWillMiniaturize);
+        (*env)->DeleteLocalRef(env, platformWindow);
+    }
     // Excplicitly make myself a key window to avoid possible
     // negative visual effects during iconify operation
     [self.nsWindow makeKeyAndOrderFront:self.nsWindow];
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Mon Jan 09 11:57:06 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, 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
@@ -730,18 +730,47 @@
             // to use it if the data layout is component type.
             if (iccProfileField != null
                     && itsRaw.getColorModel() instanceof ComponentColorModel) {
-                // Create a ColorSpace from the profile.
-                byte[] iccProfileValue = iccProfileField.getAsBytes();
-                ICC_Profile iccProfile
-                        = ICC_Profile.getInstance(iccProfileValue);
-                ICC_ColorSpace iccColorSpace
-                        = new ICC_ColorSpace(iccProfile);
-
                 // Get the raw sample and color information.
                 ColorModel cmRaw = itsRaw.getColorModel();
                 ColorSpace csRaw = cmRaw.getColorSpace();
                 SampleModel smRaw = itsRaw.getSampleModel();
 
+                ColorSpace iccColorSpace = null;
+                try {
+                    // Create a ColorSpace from the profile.
+                    byte[] iccProfileValue = iccProfileField.getAsBytes();
+                    ICC_Profile iccProfile
+                        = ICC_Profile.getInstance(iccProfileValue);
+                    iccColorSpace = new ICC_ColorSpace(iccProfile);
+
+                    // Workaround for JDK-8145241: test a conversion and fall
+                    // back to a standard ColorSpace if it fails. This
+                    // workaround could be removed if JDK-8145241 is fixed.
+                    float[] rgb =
+                        iccColorSpace.toRGB(new float[] {1.0F, 1.0F, 1.0F});
+                } catch (Exception iccProfileException) {
+                    processWarningOccurred("Superseding bad ICC profile: "
+                        + iccProfileException.getMessage());
+
+                    if (iccColorSpace != null) {
+                        switch (iccColorSpace.getType()) {
+                            case ColorSpace.TYPE_GRAY:
+                                iccColorSpace =
+                                    ColorSpace.getInstance(ColorSpace.CS_GRAY);
+                                break;
+                            case ColorSpace.TYPE_RGB:
+                                iccColorSpace =
+                                    ColorSpace.getInstance(ColorSpace.CS_sRGB);
+                                break;
+                            default:
+                                iccColorSpace = csRaw;
+                                break;
+                        }
+                    } else {
+                        iccColorSpace = csRaw;
+                    }
+                }
+
                 // Get the number of samples per pixel and the number
                 // of color components.
                 int numBands = smRaw.getNumBands();
--- a/jdk/src/java.desktop/share/classes/java/beans/AppletInitializer.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/beans/AppletInitializer.java	Mon Jan 09 11:57:06 2017 -0800
@@ -30,21 +30,20 @@
 import java.beans.beancontext.BeanContext;
 
 /**
- * <p>
  * This interface is designed to work in collusion with java.beans.Beans.instantiate.
  * The interface is intended to provide mechanism to allow the proper
  * initialization of JavaBeans that are also Applets, during their
  * instantiation by java.beans.Beans.instantiate().
- * </p>
  *
  * @see java.beans.Beans#instantiate
  *
  * @since 1.2
  *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
-
-
-@SuppressWarnings("deprecation")
+@Deprecated(since = "9")
 public interface AppletInitializer {
 
     /**
@@ -74,7 +73,6 @@
      * @param bCtxt          The BeanContext intended for this Applet, or
      *                       null.
      */
-
     void initialize(Applet newAppletBean, BeanContext bCtxt);
 
     /**
@@ -86,6 +84,5 @@
      *
      * @param newApplet  The newly instantiated JavaBean
      */
-
     void activate(Applet newApplet);
 }
--- a/jdk/src/java.desktop/share/classes/java/beans/Beans.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/java/beans/Beans.java	Mon Jan 09 11:57:06 2017 -0800
@@ -97,8 +97,10 @@
      * @exception IOException if an I/O error occurs.
      * @since 1.2
      */
-
-    public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException {
+    @SuppressWarnings("deprecation")
+    public static Object instantiate(ClassLoader cls, String beanName,
+                                     BeanContext beanContext)
+            throws IOException, ClassNotFoundException {
         return Beans.instantiate(cls, beanName, beanContext, null);
     }
 
@@ -153,10 +155,18 @@
      *              object could not be found.
      * @exception IOException if an I/O error occurs.
      * @since 1.2
+     *
+     * @deprecated It is recommended to use
+     * {@link #instantiate(ClassLoader, String, BeanContext)},
+     * because the Applet API is deprecated. See the
+     * <a href="../../java/applet/package-summary.html"> java.applet package
+     * documentation</a> for further information.
      */
-    @SuppressWarnings("deprecation")
-    public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
-                        throws IOException, ClassNotFoundException {
+    @Deprecated(since = "9")
+    public static Object instantiate(ClassLoader cls, String beanName,
+                                     BeanContext beanContext,
+                                     AppletInitializer initializer)
+            throws IOException, ClassNotFoundException {
 
         InputStream ins;
         ObjectInputStream oins = null;
@@ -501,7 +511,7 @@
  * Package private support class.  This provides a default AppletContext
  * for beans which are applets.
  */
-@SuppressWarnings("deprecation")
+@Deprecated(since = "9")
 class BeansAppletContext implements AppletContext {
     Applet target;
     Hashtable<URL,Object> imageCache = new Hashtable<>();
@@ -586,7 +596,7 @@
  * Package private support class.  This provides an AppletStub
  * for beans which are applets.
  */
-@SuppressWarnings("deprecation")
+@Deprecated(since = "9")
 class BeansAppletStub implements AppletStub {
     transient boolean active;
     transient Applet target;
--- a/jdk/src/java.desktop/share/classes/javax/swing/PopupFactory.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/PopupFactory.java	Mon Jan 09 11:57:06 2017 -0800
@@ -260,6 +260,7 @@
      * Obtains the appropriate <code>Popup</code> based on
      * <code>popupType</code>.
      */
+    @SuppressWarnings("deprecation")
     private Popup getPopup(Component owner, Component contents,
                            int ownerX, int ownerY, int popupType) {
         if (GraphicsEnvironment.isHeadless()) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/RepaintManager.java	Mon Jan 09 11:57:06 2017 -0800
@@ -525,8 +525,12 @@
      * @param h Height of the region to repaint
      * @see JApplet#repaint
      * @since 1.6
+     *
+     * @deprecated The Applet API is deprecated. See the
+     * <a href="../../java/applet/package-summary.html"> java.applet package
+     * documentation</a> for further information.
      */
-    @SuppressWarnings("deprecation")
+    @Deprecated(since = "9")
     public void addDirtyRegion(Applet applet, int x, int y, int w, int h) {
         addDirtyRegion0(applet, x, y, w, h);
     }
--- a/jdk/src/java.desktop/share/classes/javax/swing/TablePrintable.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/TablePrintable.java	Mon Jan 09 11:57:06 2017 -0800
@@ -380,6 +380,12 @@
         // print the current section of the table
         g2d.translate(-clip.x, -clip.y);
         g2d.clip(clip);
+
+        // set a property so that BasicTableUI#paint can know JTable printMode
+        // is FIT_WIDTH since TablePrintable.printMode is not accessible from BasicTableUI
+        if (printMode == JTable.PrintMode.FIT_WIDTH) {
+            table.putClientProperty("Table.printMode", JTable.PrintMode.FIT_WIDTH);
+        }
         table.print(g2d);
 
         // restore the original transform and clip
@@ -407,8 +413,18 @@
         for(int visrow = rMin; visrow < rMax; visrow++) {
             rowHeight += table.getRowHeight(visrow);
         }
-        g2d.drawRect(0, 0, visibleBounds.width, hclip.height + rowHeight);
+        // If PrintMode is FIT_WIDTH, then draw rect for entire column width while
+        // printing irrespective of how many columns are visible in console
+        if (printMode == JTable.PrintMode.FIT_WIDTH) {
+            g2d.drawRect(0, 0, clip.width, hclip.height + rowHeight);
+        } else {
+            g2d.drawRect(0, 0, visibleBounds.width, hclip.height + rowHeight);
+        }
 
+        // clear the property
+        if (printMode == JTable.PrintMode.FIT_WIDTH) {
+            table.putClientProperty("Table.printMode", null);
+        }
         // dispose the graphics copy
         g2d.dispose();
 
@@ -534,5 +550,4 @@
         } while (clip.width + colWidth <= pw);
 
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java	Mon Jan 09 11:57:06 2017 -0800
@@ -1812,12 +1812,12 @@
         }
 
         boolean ltr = table.getComponentOrientation().isLeftToRight();
-
+        Point upperLeft, lowerRight;
         // compute the visible part of table which needs to be painted
         Rectangle visibleBounds = clip.intersection(bounds);
-        Point upperLeft = visibleBounds.getLocation();
-        Point lowerRight = new Point(visibleBounds.x + visibleBounds.width - 1,
-                                     visibleBounds.y + visibleBounds.height - 1);
+        upperLeft = visibleBounds.getLocation();
+        lowerRight = new Point(visibleBounds.x + visibleBounds.width - 1,
+                               visibleBounds.y + visibleBounds.height - 1);
 
         int rMin = table.rowAtPoint(upperLeft);
         int rMax = table.rowAtPoint(lowerRight);
@@ -1834,6 +1834,18 @@
             rMax = table.getRowCount()-1;
         }
 
+        // For FIT_WIDTH, all columns should be printed irrespective of
+        // how many columns are visible. So, we used clip which is already set to
+        // total col width instead of visible region
+        // Since JTable.PrintMode is not accessible
+        // from here, we aet "Table.printMode" in TablePrintable#print and
+        // access from here.
+        Object printMode = table.getClientProperty("Table.printMode");
+        if ((printMode == JTable.PrintMode.FIT_WIDTH)) {
+            upperLeft = clip.getLocation();
+            lowerRight = new Point(clip.x + clip.width - 1,
+                                   clip.y + clip.height - 1);
+        }
         int cMin = table.columnAtPoint(ltr ? upperLeft : lowerRight);
         int cMax = table.columnAtPoint(ltr ? lowerRight : upperLeft);
         // This should never happen.
@@ -2018,7 +2030,7 @@
             int y = damagedArea.y;
             for (int row = rMin; row <= rMax; row++) {
                 y += table.getRowHeight(row);
-                g.drawLine(damagedArea.x, y - 1, tableWidth - 1, y - 1);
+                SwingUtilities2.drawHLine(g, damagedArea.x, tableWidth - 1, y - 1);
             }
         }
         if (table.getShowVerticalLines()) {
@@ -2030,14 +2042,14 @@
                 for (int column = cMin; column <= cMax; column++) {
                     int w = cm.getColumn(column).getWidth();
                     x += w;
-                    g.drawLine(x - 1, 0, x - 1, tableHeight - 1);
+                    SwingUtilities2.drawVLine(g, x - 1, 0, tableHeight - 1);
                 }
             } else {
                 x = damagedArea.x;
                 for (int column = cMax; column >= cMin; column--) {
                     int w = cm.getColumn(column).getWidth();
                     x += w;
-                    g.drawLine(x - 1, 0, x - 1, tableHeight - 1);
+                    SwingUtilities2.drawVLine(g, x - 1, 0, tableHeight - 1);
                 }
             }
         }
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/PasswordView.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/PasswordView.java	Mon Jan 09 11:57:06 2017 -0800
@@ -27,10 +27,7 @@
 import sun.swing.SwingUtilities2;
 import java.awt.*;
 import java.awt.font.FontRenderContext;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import javax.swing.JPasswordField;
-import static javax.swing.text.PlainView.isFPMethodOverriden;
 
 /**
  * Implements a View suitable for use in JPasswordField
@@ -332,22 +329,6 @@
 
     static char[] ONE = new char[1];
 
-    private final boolean drawEchoCharacterOverridden;
-
-    {
-        final Class<?> CLS = getClass();
-        final Class<?> INT = Integer.TYPE;
-        final Class<?> FP = Float.TYPE;
-        final Class<?> CHAR = Character.TYPE;
-
-        drawEchoCharacterOverridden = AccessController
-                .doPrivileged(new PrivilegedAction<Boolean>() {
-            @Override
-            public Boolean run() {
-                Class<?>[] intTypes = {Graphics.class, INT, INT, CHAR};
-                Class<?>[] fpTypes = {Graphics2D.class, FP, FP, CHAR};
-                return isFPMethodOverriden("drawEchoCharacter", CLS, intTypes, fpTypes);
-            }
-        });
-    }
+    private final boolean drawEchoCharacterOverridden =
+            getFPMethodOverridden(getClass(), "drawEchoCharacter", FPMethodArgs.GNNC);
 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/PlainView.java	Mon Jan 09 11:57:06 2017 -0800
@@ -32,6 +32,8 @@
 import java.util.Objects;
 import javax.swing.event.*;
 import java.lang.reflect.Module;
+import java.lang.ref.SoftReference;
+import java.util.HashMap;
 
 /**
  * Implements View interface for a simple multi-line text view
@@ -818,10 +820,45 @@
         return w;
     }
 
-    static boolean isFPMethodOverriden(String method,
-                                Class<?> cls,
-                                Class<?>[] intTypes,
-                                Class<?>[] fpTypes)
+    static boolean getFPMethodOverridden(Class<?> cls, String method,
+                                         FPMethodArgs methodArgs) {
+        HashMap<FPMethodItem, Boolean> map = null;
+        boolean initialized = methodsOverriddenMapRef != null
+                              && (map = methodsOverriddenMapRef.get()) != null;
+
+        if (!initialized) {
+            map = new HashMap<>();
+            methodsOverriddenMapRef = new SoftReference<>(map);
+        }
+
+        FPMethodItem key = new FPMethodItem(cls, method);
+        Boolean isFPMethodOverridden = map.get(key);
+        if (isFPMethodOverridden == null) {
+            isFPMethodOverridden = checkFPMethodOverridden(cls, method, methodArgs);
+            map.put(key, isFPMethodOverridden);
+        }
+        return isFPMethodOverridden;
+    }
+
+    private static boolean checkFPMethodOverridden(final Class<?> className,
+                                                   final String methodName,
+                                                   final FPMethodArgs methodArgs) {
+
+        return AccessController
+                .doPrivileged(new PrivilegedAction<Boolean>() {
+                    @Override
+                    public Boolean run() {
+                        return isFPMethodOverridden(methodName, className,
+                                                    methodArgs.getMethodArguments(false),
+                                                    methodArgs.getMethodArguments(true));
+                    }
+                });
+    }
+
+    private static boolean isFPMethodOverridden(String method,
+                                                Class<?> cls,
+                                                Class<?>[] intTypes,
+                                                Class<?>[] fpTypes)
     {
         Module thisModule = PlainView.class.getModule();
         while (!thisModule.equals(cls.getModule())) {
@@ -840,6 +877,57 @@
         return true;
     }
 
+    enum FPMethodArgs {
+
+        IGNN,
+        IIGNN,
+        GNNII,
+        GNNC;
+
+        public Class<?>[] getMethodArguments(boolean isFPType) {
+            Class<?> N = (isFPType) ? Float.TYPE : Integer.TYPE;
+            Class<?> G = (isFPType) ? Graphics2D.class : Graphics.class;
+            switch (this) {
+                case IGNN:
+                    return new Class<?>[]{Integer.TYPE, G, N, N};
+                case IIGNN:
+                    return new Class<?>[]{Integer.TYPE, Integer.TYPE, G, N, N};
+                case GNNII:
+                    return new Class<?>[]{G, N, N, Integer.TYPE, Integer.TYPE};
+                case GNNC:
+                    return new Class<?>[]{G, N, N, Character.TYPE};
+                default:
+                    throw new RuntimeException("Unknown method arguments!");
+            }
+        }
+    }
+
+     private static class FPMethodItem {
+
+        final Class<?> className;
+        final String methodName;
+
+        public FPMethodItem(Class<?> className, String methodName) {
+            this.className = className;
+            this.methodName = methodName;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof FPMethodItem) {
+                FPMethodItem that = (FPMethodItem) obj;
+                return this.className.equals(that.className)
+                        && this.methodName.equals(that.methodName);
+            }
+            return false;
+        }
+
+        @Override
+        public int hashCode() {
+            return 31 * methodName.hashCode() + className.hashCode();
+        }
+    }
+
     // --- member variables -----------------------------------------------
 
     /**
@@ -878,46 +966,13 @@
      */
     int firstLineOffset;
 
-    final boolean drawLineOverridden;
-    final boolean drawSelectedTextOverridden;
-    final boolean drawUnselectedTextOverridden;
-    final boolean useFloatingPointAPI;
-
-    {
-        final Class<?> CLS = getClass();
-        final Class<?> INT = Integer.TYPE;
-        final Class<?> FP = Float.TYPE;
-
-        drawLineOverridden = AccessController
-                .doPrivileged(new PrivilegedAction<Boolean>() {
-            @Override
-            public Boolean run() {
-                Class<?>[] intTypes = {INT, Graphics.class, INT, INT};
-                Class<?>[] fpTypes = {INT, Graphics2D.class, FP, FP};
-                return isFPMethodOverriden("drawLine", CLS, intTypes, fpTypes);
-            }
-        });
-
-        drawUnselectedTextOverridden = AccessController
-                .doPrivileged(new PrivilegedAction<Boolean>() {
-            @Override
-            public Boolean run() {
-                Class<?>[] intTypes = {Graphics.class, INT, INT, INT, INT};
-                Class<?>[] fpTypes = {Graphics2D.class, FP, FP, INT, INT};
-                return isFPMethodOverriden("drawUnselectedText", CLS, intTypes, fpTypes);
-            }
-        });
-
-        drawSelectedTextOverridden = AccessController
-                .doPrivileged(new PrivilegedAction<Boolean>() {
-            @Override
-            public Boolean run() {
-                Class<?>[] intTypes = {Graphics.class, INT, INT, INT, INT};
-                Class<?>[] fpTypes = {Graphics2D.class, FP, FP, INT, INT};
-                return isFPMethodOverriden("drawSelectedText", CLS, intTypes, fpTypes);
-            }
-        });
-
-        useFloatingPointAPI = drawUnselectedTextOverridden || drawSelectedTextOverridden;
-    }
+    private static SoftReference<HashMap<FPMethodItem, Boolean>> methodsOverriddenMapRef;
+    final boolean drawLineOverridden =
+            getFPMethodOverridden(getClass(), "drawLine", FPMethodArgs.IGNN);
+    final boolean drawSelectedTextOverridden =
+            getFPMethodOverridden(getClass(), "drawSelectedText", FPMethodArgs.GNNII);
+    final boolean drawUnselectedTextOverridden =
+            getFPMethodOverridden(getClass(), "drawUnselectedText", FPMethodArgs.GNNII);
+    final boolean useFloatingPointAPI =
+            drawUnselectedTextOverridden || drawSelectedTextOverridden;
 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/WrappedPlainView.java	Mon Jan 09 11:57:06 2017 -0800
@@ -28,10 +28,9 @@
 import java.awt.font.FontRenderContext;
 import java.awt.geom.Rectangle2D;
 import java.lang.ref.SoftReference;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import javax.swing.event.*;
-import static javax.swing.text.PlainView.isFPMethodOverriden;
+import static javax.swing.text.PlainView.FPMethodArgs.*;
+import static javax.swing.text.PlainView.getFPMethodOverridden;
 
 /**
  * View of plain text (text with only one font and color)
@@ -989,46 +988,12 @@
         SoftReference<int[]> lineCache = null;
     }
 
-    private final boolean drawLineOverridden;
-    private final boolean drawSelectedTextOverridden;
-    private final boolean drawUnselectedTextOverridden;
-    private final boolean useFloatingPointAPI;
-
-    {
-        final Class<?> CLS = getClass();
-        final Class<?> INT = Integer.TYPE;
-        final Class<?> FP = Float.TYPE;
-
-        drawLineOverridden = AccessController
-                .doPrivileged(new PrivilegedAction<Boolean>() {
-            @Override
-            public Boolean run() {
-                Class<?>[] intTypes = {INT, INT, Graphics.class, INT, INT};
-                Class<?>[] fpTypes = {INT, INT, Graphics2D.class, FP, FP};
-                return isFPMethodOverriden("drawLine", CLS, intTypes, fpTypes);
-            }
-        });
-
-        drawUnselectedTextOverridden = AccessController
-                .doPrivileged(new PrivilegedAction<Boolean>() {
-            @Override
-            public Boolean run() {
-                Class<?>[] intTypes = {Graphics.class, INT, INT, INT, INT};
-                Class<?>[] fpTypes = {Graphics2D.class, FP, FP, INT, INT};
-                return isFPMethodOverriden("drawUnselectedText", CLS, intTypes, fpTypes);
-            }
-        });
-
-        drawSelectedTextOverridden = AccessController
-                .doPrivileged(new PrivilegedAction<Boolean>() {
-            @Override
-            public Boolean run() {
-                Class<?>[] intTypes = {Graphics.class, INT, INT, INT, INT};
-                Class<?>[] fpTypes = {Graphics2D.class, FP, FP, INT, INT};
-                return isFPMethodOverriden("drawSelectedText", CLS, intTypes, fpTypes);
-            }
-        });
-
-        useFloatingPointAPI = drawUnselectedTextOverridden || drawSelectedTextOverridden;
-    }
+    private final boolean drawLineOverridden =
+            getFPMethodOverridden(getClass(), "drawLine", IIGNN);
+    private final boolean drawSelectedTextOverridden =
+            getFPMethodOverridden(getClass(), "drawSelectedText", GNNII);
+    private final boolean drawUnselectedTextOverridden =
+            getFPMethodOverridden(getClass(), "drawUnselectedText", GNNII);
+    private final boolean useFloatingPointAPI =
+            drawUnselectedTextOverridden || drawSelectedTextOverridden;
 }
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletEvent.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletEvent.java	Mon Jan 09 11:57:06 2017 -0800
@@ -32,8 +32,13 @@
  * AppletEvent class.
  *
  * @author  Sunita Mani
+ *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
 @SuppressWarnings("serial") // JDK-implementation class
+@Deprecated(since = "9")
 public class AppletEvent extends EventObject {
 
     private Object arg;
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletEventMulticaster.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletEventMulticaster.java	Mon Jan 09 11:57:06 2017 -0800
@@ -36,7 +36,12 @@
  * responsible for dispatching events to them.
  *
  * @author  Sunita Mani
+ *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
+@Deprecated(since = "9")
 public class AppletEventMulticaster implements AppletListener {
 
     private final AppletListener a, b;
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletIOException.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletIOException.java	Mon Jan 09 11:57:06 2017 -0800
@@ -31,10 +31,14 @@
  * An applet IO exception.
  *
  * @author      Koji Uno
+ *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
 @SuppressWarnings("serial") // JDK implementation class
-public
-class AppletIOException extends IOException {
+@Deprecated(since = "9")
+public class AppletIOException extends IOException {
     private String key = null;
     private Object msgobj = null;
 
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletIllegalArgumentException.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletIllegalArgumentException.java	Mon Jan 09 11:57:06 2017 -0800
@@ -29,10 +29,14 @@
  * An applet security exception.
  *
  * @author      Arthur van Hoff
+ *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
 @SuppressWarnings("serial") // JDK implementation class
-public
-class AppletIllegalArgumentException extends IllegalArgumentException {
+@Deprecated(since = "9")
+public class AppletIllegalArgumentException extends IllegalArgumentException {
     private String key = null;
 
     public AppletIllegalArgumentException(String key) {
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletImageRef.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletImageRef.java	Mon Jan 09 11:57:06 2017 -0800
@@ -31,6 +31,7 @@
 import sun.awt.image.URLImageSource;
 import java.net.URL;
 
+@Deprecated(since = "9")
 class AppletImageRef {
     private SoftReference<Image> soft = null;
 
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletListener.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletListener.java	Mon Jan 09 11:57:06 2017 -0800
@@ -32,8 +32,12 @@
  * by objects interested in AppletEvents.
  *
  * @author  Sunita Mani
+ *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
-
+@Deprecated(since = "9")
 public interface AppletListener extends EventListener {
     public void appletStateChanged(AppletEvent e);
 }
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletObjectInputStream.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletObjectInputStream.java	Mon Jan 09 11:57:06 2017 -0800
@@ -34,8 +34,12 @@
 /**
  * This subclass of ObjectInputStream delegates loading of classes to
  * an existing ClassLoader.
+ *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
-
+@Deprecated(since = "9")
 class AppletObjectInputStream extends ObjectInputStream
 {
     private AppletClassLoader loader;
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Mon Jan 09 11:57:06 2017 -0800
@@ -52,9 +52,14 @@
  * thread group to call the applet's init(), start(), stop(), and
  * destroy() methods.
  *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
+ *
  * @author      Arthur van Hoff
  */
-@SuppressWarnings({"serial", "deprecation"}) // JDK implementation class
+@SuppressWarnings({"serial"}) // JDK implementation class
+@Deprecated(since = "9")
 public
 abstract class AppletPanel extends Panel implements AppletStub, Runnable {
 
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletProps.java	Mon Jan 09 11:57:06 2017 -0800
@@ -36,6 +36,7 @@
 import sun.security.action.*;
 
 @SuppressWarnings("serial") // JDK implementation class
+@Deprecated(since = "9")
 class AppletProps extends Frame {
 
     TextField proxyHost;
@@ -197,6 +198,7 @@
 /* 4066432 */
 /* Dialog class to display property-related errors to user */
 @SuppressWarnings("serial") // JDK implementation class
+@Deprecated(since = "9")
 class AppletPropsErrorDialog extends Dialog {
     @SuppressWarnings("deprecation")
     public AppletPropsErrorDialog(Frame parent, String title, String message,
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewer.java	Mon Jan 09 11:57:06 2017 -0800
@@ -43,6 +43,7 @@
  * A frame to show the applet tag in.
  */
 @SuppressWarnings("serial") // JDK-implementation class
+@Deprecated(since = "9")
 final class TextFrame extends Frame {
 
     /**
@@ -91,6 +92,7 @@
 /**
  * Lets us construct one using unix-style one shot behaviors.
  */
+@Deprecated(since = "9")
 final class StdAppletViewerFactory implements AppletViewerFactory {
 
     @Override
@@ -116,8 +118,13 @@
  * <a href="../../../docs/tooldocs/appletviewertags.html">AppletViewer Tags</a>.
  * (The document named appletviewertags.html in the JDK's docs/tooldocs directory,
  *  once the JDK docs have been installed.)
+ *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
-@SuppressWarnings({"serial", "deprecation"}) // JDK-implementation class
+@SuppressWarnings({"serial"}) // JDK-implementation class
+@Deprecated(since = "9")
 public class AppletViewer extends Frame implements AppletContext, Printable {
 
     /**
@@ -146,7 +153,7 @@
      */
     AppletViewerFactory factory;
 
-
+    @Deprecated(since = "9")
     private final class UserActionListener implements ActionListener {
         @Override
         public void actionPerformed(ActionEvent evt) {
@@ -219,6 +226,7 @@
             }
         };
 
+        @Deprecated(since = "9")
         class AppletEventListener implements AppletListener
         {
             final Frame frame;
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerFactory.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerFactory.java	Mon Jan 09 11:57:06 2017 -0800
@@ -33,8 +33,8 @@
 import java.net.URL;
 import java.awt.MenuBar;
 
-public
-interface AppletViewerFactory {
+@Deprecated(since = "9")
+public interface AppletViewerFactory {
         public AppletViewer createAppletViewer(int x, int y, URL doc,
                                                Hashtable<String, String> atts);
         public MenuBar getBaseMenuBar();
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerPanel.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletViewerPanel.java	Mon Jan 09 11:57:06 2017 -0800
@@ -40,7 +40,12 @@
  * destroy() methods.
  *
  * @author      Arthur van Hoff
+ *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
+@Deprecated(since = "9")
 class AppletViewerPanel extends AppletPanel {
 
     /* Are we debugging? */
--- a/jdk/src/java.desktop/share/classes/sun/applet/Main.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/applet/Main.java	Mon Jan 09 11:57:06 2017 -0800
@@ -39,7 +39,12 @@
 
 /**
  * The main entry point into AppletViewer.
+ *
+ * @deprecated The Applet API is deprecated. See the
+ * <a href="../../java/applet/package-summary.html"> java.applet package
+ * documentation</a> for further information.
  */
+@Deprecated(since = "9")
 public class Main {
     /**
      * The file which contains all of the AppletViewer specific properties.
--- a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java	Mon Jan 09 11:57:06 2017 -0800
@@ -496,10 +496,14 @@
      * Checks if the component is in an EmbeddedFrame. If so,
      * returns the applet found in the hierarchy or null if
      * not found.
-     * @return the parent applet or {@ null}
+     * @return the parent applet or {@code null}
      * @since 1.6
+     *
+     * @deprecated The Applet API is deprecated. See the
+     * <a href="../../java/applet/package-summary.html"> java.applet package
+     * documentation</a> for further information.
      */
-    @SuppressWarnings("deprecation")
+    @Deprecated(since = "9")
     public static Applet getAppletIfAncestorOf(Component comp) {
         Container parent = comp.getParent();
         Applet applet = null;
--- a/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c	Mon Jan 09 11:57:06 2017 -0800
@@ -2419,7 +2419,7 @@
     case sun_awt_image_IntegerComponentRaster_TYPE_INT_8BIT_SAMPLES:
         if (!((rasterP->chanOffsets[0] == 0 || SAFE_TO_ALLOC_2(rasterP->chanOffsets[0], 4)) &&
               SAFE_TO_ALLOC_2(width, 4) &&
-              SAFE_TO_ALLOC_3(height, rasterP->scanlineStride, 4)))
+              SAFE_TO_ALLOC_3(rasterP->scanlineStride, height, 4)))
         {
             return -1;
         }
@@ -2428,7 +2428,7 @@
 
         if (offset < 0 || offset >= dataSize ||
             width > rasterP->scanlineStride ||
-            height * rasterP->scanlineStride * 4 > dataSize - offset)
+            ((width + (height - 1) * rasterP->scanlineStride) * 4) > dataSize - offset)
         {
             // raster data buffer is too short
             return -1;
@@ -2446,7 +2446,7 @@
         return 0;
     case sun_awt_image_IntegerComponentRaster_TYPE_BYTE_SAMPLES:
         if (!(SAFE_TO_ALLOC_2(width, rasterP->numBands) &&
-              SAFE_TO_ALLOC_2(height, rasterP->scanlineStride)))
+              SAFE_TO_ALLOC_2(rasterP->scanlineStride, height)))
         {
             return -1;
         }
@@ -2455,7 +2455,8 @@
 
         if (offset < 0 || offset >= dataSize ||
             width * rasterP->numBands > rasterP->scanlineStride ||
-            height * rasterP->scanlineStride > dataSize - offset)
+            ((width * rasterP->numBands) +
+             (height - 1) * rasterP->scanlineStride) > dataSize - offset)
         {
             // raster data buffer is too short
             return -1;
@@ -2474,7 +2475,7 @@
     case sun_awt_image_IntegerComponentRaster_TYPE_USHORT_SAMPLES:
         if (!((rasterP->chanOffsets[0] == 0 || SAFE_TO_ALLOC_2(rasterP->chanOffsets[0], 2)) &&
               SAFE_TO_ALLOC_3(width, rasterP->numBands, 2) &&
-              SAFE_TO_ALLOC_3(height, rasterP->scanlineStride, 2)))
+              SAFE_TO_ALLOC_3(rasterP->scanlineStride, height, 2)))
         {
               return -1;
         }
@@ -2483,7 +2484,8 @@
 
         if (offset < 0 || offset >= dataSize ||
             width * rasterP->numBands > rasterP->scanlineStride ||
-            height * rasterP->scanlineStride * 2 > dataSize - offset)
+            (((width * rasterP->numBands) +
+             (height - 1) * rasterP->scanlineStride)) * 2 > dataSize - offset)
         {
             // raster data buffer is too short
              return -1;
--- a/jdk/src/java.desktop/share/native/libmlib_image/safe_alloc.h	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/share/native/libmlib_image/safe_alloc.h	Mon Jan 09 11:57:06 2017 -0800
@@ -35,10 +35,10 @@
  */
 #define SAFE_TO_ALLOC_2(c, sz)                                             \
     (((c) > 0) && ((sz) > 0) &&                                            \
-     ((0xffffffffu / ((juint)(c))) > ((juint)(sz))))
+     ((0x7fffffff / (c)) > (sz)))
 
 #define SAFE_TO_ALLOC_3(w, h, sz)                                          \
     (((w) > 0) && ((h) > 0) && ((sz) > 0) &&                               \
-     (((0xffffffffu / ((juint)(w))) / ((juint)(h))) > ((juint)(sz))))
+     (((0x7fffffff / (w)) / (h)) > (sz)))
 
 #endif // __SAFE_ALLOC_H__
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java	Mon Jan 09 11:57:06 2017 -0800
@@ -51,9 +51,9 @@
     boolean insets_corrected;
 
     XIconWindow iconWindow;
-    WindowDimensions dimensions;
+    volatile WindowDimensions dimensions;
     XContentWindow content;
-    Insets currentInsets;
+    volatile Insets currentInsets;
     XFocusProxyWindow focusProxy;
     static final Map<Class<?>,Insets> lastKnownInsets =
                                    Collections.synchronizedMap(new HashMap<>());
@@ -106,7 +106,7 @@
 
         // The lines that follow need to be in a postInit, so they
         // happen after the X window is created.
-        initResizability();
+        setResizable(winAttr.initialResizability);
         XWM.requestWMExtents(getWindow());
 
         content = XContentWindow.createContent(this);
@@ -130,7 +130,12 @@
 
     public void updateMinimumSize() {
         super.updateMinimumSize();
-        updateMinSizeHints();
+        XToolkit.awtLock();
+        try {
+            updateMinSizeHints();
+        } finally {
+            XToolkit.awtUnlock();
+        }
     }
 
     private void updateMinSizeHints() {
@@ -193,8 +198,13 @@
         if (log.isLoggable(PlatformLogger.Level.FINE)) {
             log.fine("Title is " + title);
         }
-        winAttr.title = title;
-        updateWMName();
+        XToolkit.awtLock();
+        try {
+            winAttr.title = title;
+            updateWMName();
+        } finally {
+            XToolkit.awtUnlock();
+        }
     }
 
     protected String getWMName() {
@@ -206,10 +216,10 @@
     }
 
     void updateWMName() {
-        super.updateWMName();
-        String name = getWMName();
         XToolkit.awtLock();
         try {
+            super.updateWMName();
+            String name = getWMName();
             if (name == null || name.trim().equals("")) {
                 name = "Java";
             }
@@ -304,6 +314,8 @@
         if (XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
             currentInsets = new Insets(0, 0, 0, 0);
             wm_set_insets = null;
+        } else {
+            insets_corrected = false;
         }
     }
 
@@ -330,7 +342,7 @@
             if (XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
                 getWMSetInsets(XAtom.get(ev.get_atom()));
             } else {
-                if(!isReparented()) {
+                if (!isReparented()) {
                     return;
                 }
                 wm_set_insets = null;
@@ -377,137 +389,127 @@
             insLog.fine(xe.toString());
         }
         reparent_serial = xe.get_serial();
-        XToolkit.awtLock();
-        try {
-            long root = XlibWrapper.RootWindow(XToolkit.getDisplay(), getScreenNumber());
+        long root = XlibWrapper.RootWindow(XToolkit.getDisplay(), getScreenNumber());
+
+        if (isEmbedded()) {
+            setReparented(true);
+            insets_corrected = true;
+            return;
+        }
+        if (getDecorations() == XWindowAttributesData.AWT_DECOR_NONE) {
+            setReparented(true);
+            insets_corrected = true;
+            reshape(dimensions, SET_SIZE, false);
+        } else if (xe.get_parent() == root) {
+            configure_seen = false;
+            insets_corrected = false;
 
-            if (isEmbedded()) {
-                setReparented(true);
-                insets_corrected = true;
+            /*
+             * We can be repareted to root for two reasons:
+             *   . setVisible(false)
+             *   . WM exited
+             */
+            if (isVisible()) { /* WM exited */
+                /* Work around 4775545 */
+                XWM.getWM().unshadeKludge(this);
+                insLog.fine("- WM exited");
+            } else {
+                insLog.fine(" - reparent due to hide");
+            }
+        } else { /* reparented to WM frame, figure out our insets */
+            setReparented(true);
+            insets_corrected = false;
+            if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
                 return;
             }
-            Component t = target;
-            if (getDecorations() == XWindowAttributesData.AWT_DECOR_NONE) {
-                setReparented(true);
-                insets_corrected = true;
-                reshape(dimensions, SET_SIZE, false);
-            } else if (xe.get_parent() == root) {
-                configure_seen = false;
-                insets_corrected = false;
 
-                /*
-                 * We can be repareted to root for two reasons:
-                 *   . setVisible(false)
-                 *   . WM exited
-                 */
-                if (isVisible()) { /* WM exited */
-                    /* Work around 4775545 */
-                    XWM.getWM().unshadeKludge(this);
-                    insLog.fine("- WM exited");
-                } else {
-                    insLog.fine(" - reparent due to hide");
+            // Check if we have insets provided by the WM
+            Insets correctWM = getWMSetInsets(null);
+            if (correctWM != null) {
+                if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
+                    insLog.finer("wm-provided insets {0}", correctWM);
                 }
-            } else { /* reparented to WM frame, figure out our insets */
-                setReparented(true);
-                insets_corrected = false;
-                if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
+                // If these insets are equal to our current insets - no actions are necessary
+                Insets dimInsets = dimensions.getInsets();
+                if (correctWM.equals(dimInsets)) {
+                    insLog.finer("Insets are the same as estimated - no additional reshapes necessary");
+                    no_reparent_artifacts = true;
+                    insets_corrected = true;
+                    applyGuessedInsets();
                     return;
                 }
+            } else {
+                correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
+                if (correctWM != null) {
+                    correctWM = copyAndScaleDown(correctWM);
+                }
 
-                // Check if we have insets provided by the WM
-                Insets correctWM = getWMSetInsets(null);
-                if (correctWM != null) {
-                    if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
-                        insLog.finer("wm-provided insets {0}", correctWM);
-                    }
-                    // If these insets are equal to our current insets - no actions are necessary
-                    Insets dimInsets = dimensions.getInsets();
-                    if (correctWM.equals(dimInsets)) {
-                        insLog.finer("Insets are the same as estimated - no additional reshapes necessary");
-                        no_reparent_artifacts = true;
-                        insets_corrected = true;
-                        applyGuessedInsets();
-                        return;
-                    }
-                } else {
-                    correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
+                if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
                     if (correctWM != null) {
-                        correctWM = copyAndScaleDown(correctWM);
-                    }
-
-                    if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
-                        if (correctWM != null) {
-                            insLog.finer("correctWM {0}", correctWM);
-                        } else {
-                            insLog.finer("correctWM insets are not available, waiting for configureNotify");
-                        }
+                        insLog.finer("correctWM {0}", correctWM);
+                    } else {
+                        insLog.finer("correctWM insets are not available, waiting for configureNotify");
                     }
                 }
+            }
 
-                if (correctWM != null) {
-                    handleCorrectInsets(correctWM);
-                }
+            if (correctWM != null) {
+                handleCorrectInsets(correctWM);
             }
-        } finally {
-            XToolkit.awtUnlock();
         }
     }
 
-    protected void handleCorrectInsets(Insets correctWM) {
-        XToolkit.awtLock();
-        try {
-            /*
-             * Ok, now see if we need adjust window size because
-             * initial insets were wrong (most likely they were).
-             */
-            Insets correction = difference(correctWM, currentInsets);
-            if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
-                insLog.finest("Corrention {0}", correction);
-            }
-            if (!isNull(correction)) {
-                currentInsets = copy(correctWM);
-                applyGuessedInsets();
+    private void handleCorrectInsets(Insets correctWM) {
+        /*
+         * Ok, now see if we need adjust window size because
+         * initial insets were wrong (most likely they were).
+         */
+        Insets correction = difference(correctWM, currentInsets);
+        if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
+            insLog.finest("Corrention {0}", correction);
+        }
+        if (!isNull(correction)) {
+            currentInsets = copy(correctWM);
+            applyGuessedInsets();
 
-                //Fix for 6318109: PIT: Min Size is not honored properly when a
-                //smaller size is specified in setSize(), XToolkit
-                //update minimum size hints
-                updateMinSizeHints();
-            }
-            if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
-                insLog.finer("Dimensions before reparent: " + dimensions);
-            }
-
-            dimensions.setInsets(getRealInsets());
-            insets_corrected = true;
+            //Fix for 6318109: PIT: Min Size is not honored properly when a
+            //smaller size is specified in setSize(), XToolkit
+            //update minimum size hints
+            updateMinSizeHints();
+        }
+        if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
+            insLog.finer("Dimensions before reparent: " + dimensions);
+        }
+        WindowDimensions newDimensions = new WindowDimensions(dimensions);
+        newDimensions.setInsets(getRealInsets());
+        dimensions = newDimensions;
+        insets_corrected = true;
 
-            if (isMaximized()) {
-                return;
-            }
+        if (isMaximized()) {
+            return;
+        }
 
-            /*
-             * If this window has been sized by a pack() we need
-             * to keep the interior geometry intact.  Since pack()
-             * computed width and height with wrong insets, we
-             * must adjust the target dimensions appropriately.
-             */
-            if ((getHints().get_flags() & (XUtilConstants.USPosition | XUtilConstants.PPosition)) != 0) {
-                reshape(dimensions, SET_BOUNDS, false);
-            } else {
-                reshape(dimensions, SET_SIZE, false);
-            }
-        } finally {
-            XToolkit.awtUnlock();
+        /*
+         * If this window has been sized by a pack() we need
+         * to keep the interior geometry intact.  Since pack()
+         * computed width and height with wrong insets, we
+         * must adjust the target dimensions appropriately.
+         */
+        if ((getHints().get_flags() & (XUtilConstants.USPosition | XUtilConstants.PPosition)) != 0) {
+            reshape(dimensions, SET_BOUNDS, false);
+        } else {
+            reshape(dimensions, SET_SIZE, false);
         }
     }
 
-    public void handleMoved(WindowDimensions dims) {
+    void handleMoved(WindowDimensions dims) {
         Point loc = dims.getLocation();
         AWTAccessor.getComponentAccessor().setLocation(target, loc.x, loc.y);
         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED));
     }
 
 
-    protected Insets guessInsets() {
+    private Insets guessInsets() {
         if (isEmbedded() || isTargetUndecorated()) {
             return new Insets(0, 0, 0, 0);
         } else {
@@ -532,16 +534,7 @@
         currentInsets = copy(guessed);
     }
 
-    public void revalidate() {
-        XToolkit.executeOnEventHandlerThread(target, new Runnable() {
-                public void run() {
-                    target.invalidate();
-                    target.validate();
-                }
-            });
-    }
-
-    Insets getRealInsets() {
+    private Insets getRealInsets() {
         if (isNull(currentInsets)) {
             applyGuessedInsets();
         }
@@ -578,7 +571,7 @@
 
     // Coordinates are that of the target
     // Called only on Toolkit thread
-    public void reshape(WindowDimensions newDimensions, int op,
+    private void reshape(WindowDimensions newDimensions, int op,
                         boolean userReshape)
     {
         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
@@ -599,81 +592,75 @@
             }
             newDimensions = new WindowDimensions(newBounds, insets, newDimensions.isClientSizeSet());
         }
-        XToolkit.awtLock();
-        try {
-            if (!isReparented() || !isVisible()) {
-                if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
-                    insLog.fine("- not reparented({0}) or not visible({1}), default reshape",
-                           Boolean.valueOf(isReparented()), Boolean.valueOf(visible));
-                }
-
-                // Fix for 6323293.
-                // This actually is needed to preserve compatibility with previous releases -
-                // some of licensees are expecting componentMoved event on invisible one while
-                // its location changes.
-                Point oldLocation = getLocation();
+        if (!isReparented() || !isVisible()) {
+            if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
+                insLog.fine("- not reparented({0}) or not visible({1}), default reshape",
+                       Boolean.valueOf(isReparented()), Boolean.valueOf(visible));
+            }
 
-                Point newLocation = new Point(AWTAccessor.getComponentAccessor().getX(target),
-                                              AWTAccessor.getComponentAccessor().getY(target));
-
-                if (!newLocation.equals(oldLocation)) {
-                    handleMoved(newDimensions);
-                }
+            // Fix for 6323293.
+            // This actually is needed to preserve compatibility with previous releases -
+            // some of licensees are expecting componentMoved event on invisible one while
+            // its location changes.
+            Point oldLocation = getLocation();
 
-                dimensions = new WindowDimensions(newDimensions);
-                updateSizeHints(dimensions);
-                Rectangle client = dimensions.getClientRect();
-                checkShellRect(client);
-                setShellBounds(client);
-                if (content != null &&
-                    !content.getSize().equals(newDimensions.getSize()))
-                {
-                    reconfigureContentWindow(newDimensions);
-                }
-                return;
+            Point newLocation = new Point(AWTAccessor.getComponentAccessor().getX(target),
+                                          AWTAccessor.getComponentAccessor().getY(target));
+
+            if (!newLocation.equals(oldLocation)) {
+                handleMoved(newDimensions);
             }
 
-            int wm = XWM.getWMID();
-            updateChildrenSizes();
-            applyGuessedInsets();
-
-            Rectangle shellRect = newDimensions.getClientRect();
-
-            if (gravityBug()) {
-                Insets in = newDimensions.getInsets();
-                shellRect.translate(in.left, in.top);
+            dimensions = new WindowDimensions(newDimensions);
+            updateSizeHints(dimensions);
+            Rectangle client = dimensions.getClientRect();
+            checkShellRect(client);
+            setShellBounds(client);
+            if (content != null &&
+                !content.getSize().equals(newDimensions.getSize()))
+            {
+                reconfigureContentWindow(newDimensions);
             }
+            return;
+        }
 
-            if ((op & NO_EMBEDDED_CHECK) == 0 && isEmbedded()) {
-                shellRect.setLocation(0, 0);
-            }
+        updateChildrenSizes();
+        applyGuessedInsets();
 
-            checkShellRectSize(shellRect);
-            if (!isEmbedded()) {
-                checkShellRectPos(shellRect);
-            }
+        Rectangle shellRect = newDimensions.getClientRect();
+
+        if (gravityBug()) {
+            Insets in = newDimensions.getInsets();
+            shellRect.translate(in.left, in.top);
+        }
 
-            op = op & ~NO_EMBEDDED_CHECK;
+        if ((op & NO_EMBEDDED_CHECK) == 0 && isEmbedded()) {
+            shellRect.setLocation(0, 0);
+        }
 
-            if (op == SET_LOCATION) {
-                setShellPosition(shellRect);
-            } else if (isResizable()) {
-                if (op == SET_BOUNDS) {
-                    setShellBounds(shellRect);
-                } else {
-                    setShellSize(shellRect);
-                }
+        checkShellRectSize(shellRect);
+        if (!isEmbedded()) {
+            checkShellRectPos(shellRect);
+        }
+
+        op = op & ~NO_EMBEDDED_CHECK;
+
+        if (op == SET_LOCATION) {
+            setShellPosition(shellRect);
+        } else if (isResizable()) {
+            if (op == SET_BOUNDS) {
+                setShellBounds(shellRect);
             } else {
-                XWM.setShellNotResizable(this, newDimensions, shellRect, true);
-                if (op == SET_BOUNDS) {
-                    setShellPosition(shellRect);
-                }
+                setShellSize(shellRect);
             }
+        } else {
+            XWM.setShellNotResizable(this, newDimensions, shellRect, true);
+            if (op == SET_BOUNDS) {
+                setShellPosition(shellRect);
+            }
+        }
 
-            reconfigureContentWindow(newDimensions);
-        } finally {
-            XToolkit.awtUnlock();
-        }
+        reconfigureContentWindow(newDimensions);
     }
 
     /**
@@ -682,8 +669,6 @@
     private void reshape(int x, int y, int width, int height, int operation,
                          boolean userReshape)
     {
-        Rectangle newRec;
-        boolean setClient = false;
         WindowDimensions dims = new WindowDimensions(dimensions);
         switch (operation & (~NO_EMBEDDED_CHECK)) {
           case SET_LOCATION:
@@ -726,7 +711,12 @@
      */
     public void setBounds(int x, int y, int width, int height, int op) {
         // TODO: Rewrite with WindowDimensions
-        reshape(x, y, width, height, op, true);
+        XToolkit.awtLock();
+        try {
+            reshape(x, y, width, height, op, true);
+        } finally {
+            XToolkit.awtUnlock();
+        }
         validateSurface();
     }
 
@@ -861,81 +851,74 @@
         checkShellRectPos(shellRect);
     }
 
-    public void setShellBounds(Rectangle rec) {
+    private void setShellBounds(Rectangle rec) {
         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
             insLog.fine("Setting shell bounds on " + this + " to " + rec);
         }
-        XToolkit.awtLock();
-        try {
-            updateSizeHints(rec.x, rec.y, rec.width, rec.height);
-            XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getShell(),
-                                          scaleUp(rec.x), scaleUp(rec.y),
-                                          scaleUp(rec.width), scaleUp(rec.height));
-        }
-        finally {
-            XToolkit.awtUnlock();
-        }
+        updateSizeHints(rec.x, rec.y, rec.width, rec.height);
+        XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), getShell(),
+                                      scaleUp(rec.x), scaleUp(rec.y),
+                                      scaleUp(rec.width), scaleUp(rec.height));
     }
-    public void setShellSize(Rectangle rec) {
+
+    private void setShellSize(Rectangle rec) {
         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
             insLog.fine("Setting shell size on " + this + " to " + rec);
         }
-        XToolkit.awtLock();
-        try {
-            updateSizeHints(rec.x, rec.y, rec.width, rec.height);
-            XlibWrapper.XResizeWindow(XToolkit.getDisplay(), getShell(),
-                                      scaleUp(rec.width), scaleUp(rec.height));
-        }
-        finally {
-            XToolkit.awtUnlock();
-        }
+        updateSizeHints(rec.x, rec.y, rec.width, rec.height);
+        XlibWrapper.XResizeWindow(XToolkit.getDisplay(), getShell(),
+                                  scaleUp(rec.width), scaleUp(rec.height));
     }
-    public void setShellPosition(Rectangle rec) {
+
+    private void setShellPosition(Rectangle rec) {
         if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
             insLog.fine("Setting shell position on " + this + " to " + rec);
         }
-        XToolkit.awtLock();
-        try {
-            updateSizeHints(rec.x, rec.y, rec.width, rec.height);
-            XlibWrapper.XMoveWindow(XToolkit.getDisplay(), getShell(),
-                                    scaleUp(rec.x), scaleUp(rec.y));
-        }
-        finally {
-            XToolkit.awtUnlock();
-        }
+        updateSizeHints(rec.x, rec.y, rec.width, rec.height);
+        XlibWrapper.XMoveWindow(XToolkit.getDisplay(), getShell(),
+                                scaleUp(rec.x), scaleUp(rec.y));
     }
 
-    void initResizability() {
-        setResizable(winAttr.initialResizability);
-    }
     public void setResizable(boolean resizable) {
-        int fs = winAttr.functions;
-        if (!isResizable() && resizable) {
-            resetWMSetInsets();
-            if (!isEmbedded()) {
-                setReparented(false);
-            }
-            winAttr.isResizable = resizable;
-            if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
-                fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
-            } else {
-                fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
+        XToolkit.awtLock();
+        try {
+            int fs = winAttr.functions;
+            if (!isResizable() && resizable) {
+                resetWMSetInsets();
+                if (!isEmbedded()) {
+                    setReparented(false);
+                }
+                winAttr.isResizable = resizable;
+                if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
+                    fs &= ~(MWMConstants.MWM_FUNC_RESIZE
+                          | MWMConstants.MWM_FUNC_MAXIMIZE);
+                } else {
+                    fs |= (MWMConstants.MWM_FUNC_RESIZE
+                         | MWMConstants.MWM_FUNC_MAXIMIZE);
+                }
+                winAttr.functions = fs;
+                XWM.setShellResizable(this);
+            } else if (isResizable() && !resizable) {
+                resetWMSetInsets();
+                if (!isEmbedded()) {
+                    setReparented(false);
+                }
+                winAttr.isResizable = resizable;
+                if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
+                    fs |= (MWMConstants.MWM_FUNC_RESIZE
+                         | MWMConstants.MWM_FUNC_MAXIMIZE);
+                } else {
+                    fs &= ~(MWMConstants.MWM_FUNC_RESIZE
+                          | MWMConstants.MWM_FUNC_MAXIMIZE);
+                }
+                winAttr.functions = fs;
+                XWM.setShellNotResizable(this, dimensions,
+                        XWM.getWMID() == XWM.UNITY_COMPIZ_WM && configure_seen ?
+                        dimensions.getScreenBounds() :
+                        dimensions.getBounds(), false);
             }
-            winAttr.functions = fs;
-            XWM.setShellResizable(this);
-        } else if (isResizable() && !resizable) {
-            resetWMSetInsets();
-            if (!isEmbedded()) {
-                setReparented(false);
-            }
-            winAttr.isResizable = resizable;
-            if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
-                fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
-            } else {
-                fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
-            }
-            winAttr.functions = fs;
-            XWM.setShellNotResizable(this, dimensions, dimensions.getBounds(), false);
+        } finally {
+            XToolkit.awtUnlock();
         }
     }
 
@@ -990,17 +973,16 @@
         try {
             if (configure_seen) {
                 return toGlobal(0,0);
-            } else {
-                Point location = target.getLocation();
-                if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
-                    insLog.fine("getLocationOnScreen {0} not reparented: {1} ",
-                                this, location);
-                }
-                return location;
             }
         } finally {
             XToolkit.awtUnlock();
         }
+        Point location = target.getLocation();
+        if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
+            insLog.fine("getLocationOnScreen {0} not reparented: {1} ",
+                        this, location);
+        }
+        return location;
     }
 
 
@@ -1134,7 +1116,7 @@
         return focusProxy;
     }
 
-    public void handleQuit() {
+    private void handleQuit() {
         postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_CLOSING));
     }
 
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWM.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWM.java	Mon Jan 09 11:57:06 2017 -0800
@@ -1029,8 +1029,14 @@
         }
         XToolkit.awtLock();
         try {
-            Rectangle shellBounds = window.getShellBounds();
-            shellBounds.translate(-window.currentInsets.left, -window.currentInsets.top);
+            Rectangle shellBounds;
+            if (getWMID() != UNITY_COMPIZ_WM) {
+                shellBounds = window.getShellBounds();
+                shellBounds.translate(-window.currentInsets.left,
+                                      -window.currentInsets.top);
+            } else {
+                shellBounds = window.getDimensions().getScreenBounds();
+            }
             window.updateSizeHints(window.getDimensions());
             requestWMExtents(window.getWindow());
             XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(),
--- a/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/src/java.desktop/unix/classes/sun/print/IPPPrintService.java	Mon Jan 09 11:57:06 2017 -0800
@@ -1053,15 +1053,8 @@
             // of setting it, it is a safe assumption to just always
             // include SheetCollate as supported attribute.
 
-            /*
-               In Linux, we use Postscript for rendering but Linux still
-               has issues in propagating Postscript-embedded setpagedevice
-               setting like collation.  Therefore, we temporarily exclude
-               Linux.
-            */
-            if (!PrintServiceLookupProvider.isLinux()) {
-                catList.add(SheetCollate.class);
-            }
+            catList.add(SheetCollate.class);
+
         }
 
         // With the assumption that  Chromaticity is equivalent to
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/NormalToIconified/NormalToIconifiedTest.java	Mon Jan 09 11:57:06 2017 -0800
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8171949
+ * @summary Tests that bitwise mask is set and state listener is notified during state transition.
+ * @author Dmitry Markov
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main NormalToIconifiedTest
+ */
+
+import java.awt.Frame;
+import java.awt.Robot;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowStateListener;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class NormalToIconifiedTest {
+    private static final AtomicBoolean listenerNotified = new AtomicBoolean(false);
+
+    public static void main(String[] args) {
+        Robot robot = Util.createRobot();
+
+        Frame testFrame = new Frame("Test Frame");
+        testFrame.setSize(200, 200);
+        testFrame.addWindowStateListener(new WindowStateListener() {
+            @Override
+            public void windowStateChanged(WindowEvent e) {
+                listenerNotified.set(true);
+                synchronized (listenerNotified) {
+                    listenerNotified.notifyAll();
+                }
+            }
+        });
+        testFrame.setVisible(true);
+
+        Frame mainFrame = new Frame("Main Frame");
+        mainFrame.setSize(200, 200);
+        mainFrame.setLocationRelativeTo(null);
+        mainFrame.setVisible(true);
+
+        Util.waitForIdle(robot);
+
+        try {
+            Util.clickOnComp(mainFrame, robot);
+            Util.waitForIdle(robot);
+
+            // NORMAL -> ICONIFIED
+            listenerNotified.set(false);
+            testFrame.setExtendedState(Frame.ICONIFIED);
+            Util.waitForIdle(robot);
+
+            Util.waitForCondition(listenerNotified, 2000);
+            if (!listenerNotified.get()) {
+                throw new RuntimeException("Test FAILED! Window state listener was not notified during NORMAL to" +
+                        "ICONIFIED transition");
+            }
+            if (testFrame.getExtendedState() != Frame.ICONIFIED) {
+                throw new RuntimeException("Test FAILED! Frame is not in ICONIFIED state");
+            }
+
+            // ICONIFIED -> NORMAL
+            listenerNotified.set(false);
+            testFrame.setExtendedState(Frame.NORMAL);
+            Util.waitForIdle(robot);
+
+            Util.waitForCondition(listenerNotified, 2000);
+            if (!listenerNotified.get()) {
+                throw new RuntimeException("Test FAILED! Window state listener was not notified during ICONIFIED to" +
+                        "NORMAL transition");
+            }
+            if (testFrame.getExtendedState() != Frame.NORMAL) {
+                throw new RuntimeException("Test FAILED! Frame is not in NORMAL state");
+            }
+        } finally {
+            testFrame.dispose();
+            mainFrame.dispose();
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/ObscuredFrame/ObscuredFrameTest.java	Mon Jan 09 11:57:06 2017 -0800
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8171952
+ * @summary Tests that getMousePosition() returns null for obscured component.
+ * @author Dmitry Markov
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main ObscuredFrameTest
+ */
+
+import java.awt.*;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class ObscuredFrameTest {
+    public static void main(String[] args) {
+        Robot robot = Util.createRobot();
+
+        Frame frame = new Frame("Obscured Frame");
+        frame.setSize(200, 200);
+        frame.setLocationRelativeTo(null);
+        Button button = new Button("Button");
+        frame.add(button);
+
+        Dialog dialog = new Dialog(frame, "Visible Dialog", false);
+        dialog.setSize(200, 200);
+        dialog.setLocationRelativeTo(null);
+        dialog.setVisible(true);
+
+        frame.setVisible(true);
+
+        Util.waitForIdle(robot);
+
+        Util.pointOnComp(button, robot);
+        Util.waitForIdle(robot);
+
+        try {
+            if (button.getMousePosition() != null) {
+                throw new RuntimeException("Test Failed! Mouse position is not null for obscured component.");
+            }
+        } finally {
+            frame.dispose();
+            dialog.dispose();
+        }
+    }
+}
+
--- a/jdk/test/java/awt/Window/ChangeWindowResizabilty/ChangeWindowResizabiltyTest.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/test/java/awt/Window/ChangeWindowResizabilty/ChangeWindowResizabiltyTest.java	Mon Jan 09 11:57:06 2017 -0800
@@ -23,7 +23,7 @@
 
 /* @test
    @key headful
-   @bug      8166897
+   @bug      8166897 8167652
    @summary  Some font overlap in the Optionpane dialog.
    @run      main ChangeWindowResizabiltyTest
 */
@@ -34,41 +34,75 @@
 import java.awt.Frame;
 import java.awt.Panel;
 import java.awt.Robot;
+import java.awt.Point;
 
 public class ChangeWindowResizabiltyTest {
     public static void main(String[] args) throws Exception {
         Robot robot = new Robot();
         for(int i = 0; i < 10; i++) {
             Dialog dialog = new Dialog((Frame) null);
+            dialog.setLocation(100, 100);
             Component panel = new Panel();
             panel.setPreferredSize(new Dimension(200, 100));
             dialog.add(panel);
             dialog.pack();
             dialog.setVisible(true);
+            robot.waitForIdle();
+            robot.delay(200);
+
+            Point frameLoc = dialog.getLocationOnScreen();
+            Point contentLoc = panel.getLocationOnScreen();
+
+            System.out.println("Decor location " + frameLoc);
+            System.out.println("Content location " + contentLoc);
 
             dialog.setResizable(false);
             robot.waitForIdle();
             robot.delay(200);
 
-            System.out.println(panel.getLocationOnScreen());
-            System.out.println(dialog.getLocationOnScreen());
+            Point l = dialog.getLocationOnScreen();
+            if (!l.equals(frameLoc)) {
+                dialog.dispose();
+                throw new RuntimeException("Decorated frame location moved " +
+                        "after setResizable(false)" + l);
+            }
+
+            l = panel.getLocationOnScreen();
+            if (!l.equals(contentLoc)) {
+                dialog.dispose();
+                throw new RuntimeException("Content location moved after " +
+                        "setResizable(false)" + l);
+            }
+
             if (panel.getLocationOnScreen().y <
-                       dialog.getLocationOnScreen().y + dialog.getInsets().top) {
+                      dialog.getLocationOnScreen().y + dialog.getInsets().top) {
                 dialog.dispose();
                 throw new RuntimeException(
-                        "Wrong content position after setResizable(false)");
+                            "Wrong content position after setResizable(false)");
             }
 
             dialog.setResizable(true);
             robot.waitForIdle();
             robot.delay(200);
-            System.out.println(panel.getLocationOnScreen());
-            System.out.println(dialog.getLocationOnScreen());
+
+            l = dialog.getLocationOnScreen();
+            if (!l.equals(frameLoc)) {
+                dialog.dispose();
+                throw new RuntimeException("Decorated frame location moved " +
+                        "after setResizable(true)" + l);
+            }
+
+            l = panel.getLocationOnScreen();
+            if (!l.equals(contentLoc)) {
+                dialog.dispose();
+                throw new RuntimeException("Content location moved after " +
+                        "setResizable(true)" + l);
+            }
             if (panel.getLocationOnScreen().y <
-                    dialog.getLocationOnScreen().y + dialog.getInsets().top) {
+                      dialog.getLocationOnScreen().y + dialog.getInsets().top) {
                 dialog.dispose();
                 throw new RuntimeException(
-                        "Wrong content position after setResizable(true)");
+                             "Wrong content position after setResizable(true)");
             }
 
             dialog.dispose();
--- a/jdk/test/java/awt/datatransfer/DragImage/MultiResolutionDragImageTest.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/test/java/awt/datatransfer/DragImage/MultiResolutionDragImageTest.java	Mon Jan 09 11:57:06 2017 -0800
@@ -22,7 +22,6 @@
  */
 
 import sun.awt.image.MultiResolutionToolkitImage;
-import sun.java2d.SunGraphics2D;
 
 import javax.swing.*;
 import java.awt.*;
@@ -37,7 +36,6 @@
  * @summary [macosx] Drag image of TransferHandler does not honor
  * MultiResolutionImage
  * @modules java.desktop/sun.awt.image
- *          java.desktop/sun.java2d
  * @run main MultiResolutionDragImageTest TEST_DRAG
  */
 public class MultiResolutionDragImageTest {
@@ -126,30 +124,11 @@
         return Math.abs(n - m) <= 50;
     }
 
-    private static float getScaleFactor() {
-
-        final Dialog dialog = new Dialog((Window) null);
-        dialog.setSize(100, 100);
-        dialog.setModal(true);
-        final float[] scaleFactors = new float[1];
-        Panel panel = new Panel() {
-
-            @Override
-            public void paint(Graphics g) {
-                float scaleFactor = 1;
-                if (g instanceof SunGraphics2D) {
-                    scaleFactor = ((SunGraphics2D) g).surfaceData.getDefaultScale();
-                }
-                scaleFactors[0] = scaleFactor;
-                dialog.setVisible(false);
-            }
-        };
-
-        dialog.add(panel);
-        dialog.setVisible(true);
-        dialog.dispose();
-
-        return scaleFactors[0];
+    static float getScaleFactor() {
+        return (float) GraphicsEnvironment.
+                getLocalGraphicsEnvironment().
+                getDefaultScreenDevice().getDefaultConfiguration().
+                getDefaultTransform().getScaleX();
     }
 
     private static Image createMultiResolutionImage() {
--- a/jdk/test/java/awt/font/GlyphVector/TestLayoutFlags.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/test/java/awt/font/GlyphVector/TestLayoutFlags.java	Mon Jan 09 11:57:06 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 
 /* @test
-   @bug 4328745 5090704
+   @bug 4328745 5090704 8166111
    @summary exercise getLayoutFlags, getGlyphCharIndex, getGlyphCharIndices
  */
 
@@ -82,7 +82,7 @@
         test("latin", latinGV, GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS);
         test("hebrew", hebrewGV, GlyphVector.FLAG_RUN_RTL |
              GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS);
-        test("arabic", arabicGV, GlyphVector.FLAG_RUN_RTL |
+        test("arabic", arabicGV, GlyphVector.FLAG_COMPLEX_GLYPHS |
              GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS);
         test("hindi", hindiGV, GlyphVector.FLAG_COMPLEX_GLYPHS |
              GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/image/Raster/TestChildRasterOp.java	Mon Jan 09 11:57:06 2017 -0800
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @bug 8130737
+ * @test
+ * @summary test no exception rasterop for child raster with non-zero offset
+ */
+
+import java.awt.geom.AffineTransform;
+import java.awt.image.AffineTransformOp;
+import java.awt.image.DataBuffer;
+import java.awt.image.DataBufferByte;
+import java.awt.image.DataBufferInt;
+import java.awt.image.DataBufferUShort;
+import java.awt.image.Raster;
+import java.awt.image.WritableRaster;
+
+public class TestChildRasterOp {
+
+    private static AffineTransform at = new AffineTransform();
+    private static final AffineTransformOp rop =
+        new AffineTransformOp(at, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
+    private static int[] offsets = {0};
+
+    public static void main(String[] args) {
+        testByteRaster();
+        testShortRaster();
+        testIntRaster();
+    }
+
+    private static void testByteRaster() {
+        WritableRaster srcRaster, dstRaster;
+
+        byte[] pixels =
+            { 11, 12, 13, 14,
+              21, 22, 23, 24,
+              31, 32, 33, 34,
+              41, 42, 43, 44 };
+
+        DataBuffer db = new DataBufferByte(pixels, pixels.length);
+        srcRaster =
+            Raster.createInterleavedRaster(db, 4, 4, 4, 1, offsets, null);
+        srcRaster = srcRaster.createWritableChild(1, 1, 3, 3, 0, 0, null);
+        dstRaster = rop.filter(srcRaster, null);
+    }
+
+    private static void testShortRaster() {
+        WritableRaster srcRaster, dstRaster;
+
+        short[] pixels =
+            { 11, 12, 13, 14,
+              21, 22, 23, 24,
+              31, 32, 33, 34,
+              41, 42, 43, 44 };
+
+        DataBuffer db = new DataBufferUShort(pixels, pixels.length);
+        srcRaster =
+            Raster.createInterleavedRaster(db, 4, 4, 4, 1, offsets, null);
+        srcRaster = srcRaster.createWritableChild(1, 1, 3, 3, 0, 0, null);
+        dstRaster = rop.filter(srcRaster, null);
+    }
+
+    private static void testIntRaster() {
+        WritableRaster srcRaster, dstRaster;
+
+        int[] pixels =
+            { 11, 12, 13, 14,
+              21, 22, 23, 24,
+              31, 32, 33, 34,
+              41, 42, 43, 44 };
+
+        DataBuffer db = new DataBufferInt(pixels, pixels.length);
+        srcRaster =
+            Raster.createPackedRaster(db, 4, 4, 4,  offsets, null);
+        srcRaster = srcRaster.createWritableChild(1, 1, 3, 3, 0, 0, null);
+        dstRaster = rop.filter(srcRaster, null);
+    }
+}
--- a/jdk/test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/test/java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java	Mon Jan 09 11:57:06 2017 -0800
@@ -24,16 +24,28 @@
 /*
  * @test
  * @key headful
- * @bug 7108598
+ * @bug 7108598 8172009
  * @summary Container.paint/KeyboardFocusManager.clearMostRecentFocusOwner methods deadlock
  * @library ../../regtesthelpers
  * @author Oleg Pekhovskiy
  * @build Util
- * @run main/timeout=20 PaintSetEnabledDeadlock
+ * @run main PaintSetEnabledDeadlock
  */
 
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Button;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Image;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
 import test.java.awt.regtesthelpers.Util;
 
 public class PaintSetEnabledDeadlock extends Frame {
--- a/jdk/test/java/awt/print/PrinterJob/BannerTest.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/test/java/awt/print/PrinterJob/BannerTest.java	Mon Jan 09 11:57:06 2017 -0800
@@ -22,7 +22,7 @@
  */
 /*
  * @test
- * @bug 6575247
+ * @bug 6575247 8170579
  * @summary  Verifies if Banner page is printed
  * @requires (os.family == "linux" | os.family == "solaris")
  * @run main/manual BannerTest
@@ -39,6 +39,9 @@
 import static java.awt.print.Printable.PAGE_EXISTS;
 import java.awt.print.PrinterException;
 import java.awt.print.PrinterJob;
+import javax.print.PrintService;
+import javax.print.attribute.standard.JobSheets;
+import javax.print.attribute.standard.SheetCollate;
 import javax.swing.JButton;
 import javax.swing.JDialog;
 import javax.swing.JPanel;
@@ -50,8 +53,18 @@
     private static Thread mainThread;
     private static boolean testPassed;
     private static boolean testGeneratedInterrupt;
+    private static volatile PrinterJob job;
 
     public static void main(String[] args)  throws Exception {
+        job = PrinterJob.getPrinterJob();
+        PrintService prtSrv = job.getPrintService();
+        if (job.getPrintService() == null) {
+            System.out.println("No printers. Test cannot continue");
+            return;
+        }
+        if (!prtSrv.isAttributeCategorySupported(JobSheets.class)) {
+            return;
+        }
         SwingUtilities.invokeAndWait(() -> {
             doTest(BannerTest::printTest);
         });
@@ -69,11 +82,6 @@
     }
 
     private static void printTest() {
-        PrinterJob job = PrinterJob.getPrinterJob();
-        if (job.getPrintService() == null) {
-            System.out.println("No printers. Test cannot continue");
-            return;
-        }
         job.setPrintable(new BannerTest());
         if(job.printDialog()) {
             try {
--- a/jdk/test/java/awt/print/PrinterJob/TestCheckSystemDefaultBannerOption.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/test/java/awt/print/PrinterJob/TestCheckSystemDefaultBannerOption.java	Mon Jan 09 11:57:06 2017 -0800
@@ -22,7 +22,7 @@
  */
 /*
  * @test
- * @bug 8165947
+ * @bug 8165947 8170579
  * @summary  Verifies System default banner page option is honoured by jdk
  * @requires (os.family == "linux" | os.family == "solaris")
  * @run main/manual TestCheckSystemDefaultBannerOption
@@ -38,6 +38,7 @@
 import static java.awt.print.Printable.PAGE_EXISTS;
 import java.awt.print.PrinterException;
 import java.awt.print.PrinterJob;
+import javax.print.PrintService;
 import javax.print.attribute.standard.JobSheets;
 import javax.swing.JButton;
 import javax.swing.JDialog;
@@ -56,10 +57,15 @@
     public static void main (String[] args) throws Exception {
 
         job = PrinterJob.getPrinterJob();
-        if (job.getPrintService() == null) {
+        PrintService prtSrv = job.getPrintService();
+        if (prtSrv == null) {
             System.out.println("No printers. Test cannot continue");
             return;
         }
+        // do not run the test if JobSheet category is not supported
+        if (!prtSrv.isAttributeCategorySupported(JobSheets.class)) {
+            return;
+        }
         // check system default banner option and let user know what to expect
         JobSheets js = (JobSheets)job.getPrintService().
                 getDefaultAttributeValue(JobSheets.class);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/8133919/DrawGridLInesTest.java	Mon Jan 09 11:57:06 2017 -0800
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableModel;
+
+/*
+ * @test
+ * @bug 8133919
+ * @summary [macosx] JTable grid lines are incorrectly positioned on HiDPI display
+ * @run main DrawGridLinesTest
+ */
+public class DrawGridLinesTest {
+
+    private static final int WIDTH = 300;
+    private static final int HEIGHT = 150;
+    private static final Color GRID_COLOR = Color.BLACK;
+    private static final Color TABLE_BACKGROUND_COLOR = Color.BLUE;
+    private static final Color CELL_RENDERER_BACKGROUND_COLOR = Color.YELLOW;
+    private static final int SCALE = 2;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(DrawGridLinesTest::checkTableGridLines);
+    }
+
+    private static void checkTableGridLines() {
+
+        TableModel dataModel = new AbstractTableModel() {
+            public int getColumnCount() {
+                return 10;
+            }
+
+            public int getRowCount() {
+                return 10;
+            }
+
+            public Object getValueAt(int row, int col) {
+                return " ";
+            }
+        };
+
+        DefaultTableCellRenderer r = new DefaultTableCellRenderer();
+        r.setOpaque(true);
+        r.setBackground(CELL_RENDERER_BACKGROUND_COLOR);
+
+        JTable table = new JTable(dataModel);
+        table.setSize(WIDTH, HEIGHT);
+        table.setDefaultRenderer(Object.class, r);
+        table.setGridColor(GRID_COLOR);
+        table.setShowGrid(true);
+        table.setShowHorizontalLines(true);
+        table.setShowVerticalLines(true);
+        table.setBackground(TABLE_BACKGROUND_COLOR);
+
+        checkTableGridLines(table);
+    }
+
+    private static void checkTableGridLines(JTable table) {
+
+        int w = SCALE * WIDTH;
+        int h = SCALE * HEIGHT;
+
+        BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g = img.createGraphics();
+        g.scale(SCALE, SCALE);
+        table.paint(g);
+        g.dispose();
+
+        int size = Math.min(w, h);
+        int rgb = TABLE_BACKGROUND_COLOR.getRGB();
+
+        for (int i = 0; i < size; i++) {
+            if (img.getRGB(i, i) == rgb || img.getRGB(i, size - i - 1) == rgb) {
+                throw new RuntimeException("Artifacts in the table background color!");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/PrintManualTest_FitWidthMultiple.java	Mon Jan 09 11:57:06 2017 -0800
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @bug 8170349
+ * @summary  Verify if printed content is within border and all columns are
+ *           printed for PrintMode.FIT_WIDTH
+ * @run main/manual PrintManualTest_FitWidthMultiple
+ */
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.text.MessageFormat;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableModel;
+
+public class PrintManualTest_FitWidthMultiple extends JTable implements Runnable {
+
+    static boolean testPassed;
+    static JFrame fr = null;
+    static JFrame instructFrame = null;
+    private final CountDownLatch latch;
+
+    public PrintManualTest_FitWidthMultiple(CountDownLatch latch){
+        this.latch = latch;
+    }
+
+    @Override
+    public void run() {
+        try {
+            createUIandTest();
+        } catch (Exception ex) {
+            dispose();
+            latch.countDown();
+            throw new RuntimeException(ex.getMessage());
+        }
+    }
+
+    private void createUIandTest() throws Exception {
+        /*Message Format Header and Footer */
+        final MessageFormat header=new MessageFormat("JTable Printing Header {0}");
+        final MessageFormat footer = new MessageFormat("JTable Printing Footer {0}");
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                /* Instructions Section */
+                String info =
+                    " \nThis test case brings up JTable with more Columns and Rows \n"+
+                    "Press the Print Button. It Prints in PRINT_MODE_FIT_WIDTH \n" +
+                    "It Pops up the Print Dialog. Check if Job/Print Attributes in the\n" +
+                    "Print Dialog are configurable. Default Print out will be in Landscape \n"+
+                    "The Print out should have JTable Centered on the Print out with thin borders \n"+
+                    "Prints out with Header and Footer. \n"+
+                    "The JTable should have all columns printed within border";
+
+                instructFrame=new JFrame("PrintManualTest_NormalSingle");
+                JPanel panel=new JPanel(new BorderLayout());
+                JButton button1 = new JButton("Pass");
+                JButton button2 = new JButton("Fail");
+                button1.addActionListener((e) -> {
+                    testPassed = true;
+                    dispose();
+                    latch.countDown();
+                });
+                button2.addActionListener((e) -> {
+                    testPassed = false;
+                    dispose();
+                    latch.countDown();
+                });
+                JPanel btnpanel1 = new JPanel();
+                btnpanel1.add(button1);
+                btnpanel1.add(button2);
+                panel.add(addInfo(info),BorderLayout.CENTER);
+                panel.add(btnpanel1, BorderLayout.SOUTH);
+                instructFrame.getContentPane().add(panel);
+                instructFrame.setBounds(600,100,350,350);
+
+                /* Print Button */
+                final JButton printButton=new JButton("Print");
+
+                /* Table Model */
+                final TableModel datamodel=new AbstractTableModel(){
+                    @Override
+                    public int getColumnCount() { return 50;}
+                    @Override
+                    public int getRowCount() { return 50; }
+                    @Override
+                    public Object getValueAt(int row, int column){ return new Integer(row*column);}
+                };
+
+                /* Constructing the JTable */
+                final JTable table=new JTable(datamodel);
+
+                /* Putting the JTable in ScrollPane and Frame Container */
+                JScrollPane scrollpane=new JScrollPane(table);
+                fr = new JFrame("PrintManualTest_FitWidthMultiple");
+                fr.getContentPane().add(scrollpane);
+
+                /* Light Weight Panel for holding Print and other buttons */
+                JPanel btnpanel=new JPanel();
+                btnpanel.add(printButton);
+                fr.getContentPane().add(btnpanel,BorderLayout.SOUTH);
+                fr.setBounds(0,0,400,400);
+                fr.setSize(500,500);
+
+                /* Binding the KeyStroke to Print Button Action */
+                fr.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ctrl P"), "printButton");
+                fr.getRootPane().getActionMap().put("printButton", new AbstractAction(){
+                    @Override
+                    public void actionPerformed(ActionEvent e){
+                        printButton.doClick();
+                    }
+                });
+
+                /* Container and Component Listeners */
+                fr.addWindowListener(new WindowAdapter() {
+                    @Override
+                    public void windowClosing(WindowEvent e) {
+                        dispose();
+                        if (testPassed == false) {
+                            throw new RuntimeException(" User has not executed the test");
+                        }
+                    }
+                });
+
+                final PrintRequestAttributeSet prattr=new HashPrintRequestAttributeSet();
+                prattr.add(javax.print.attribute.standard.OrientationRequested.LANDSCAPE);
+
+                printButton.addActionListener(new ActionListener(){
+                    @Override
+                    public void actionPerformed(ActionEvent ae){
+                        try{
+                            table.print(JTable.PrintMode.FIT_WIDTH, header,footer,true,prattr,true);
+                        } catch(Exception e){}
+                    }
+                });
+                instructFrame.setVisible(true);
+                fr.setVisible(true);
+            }
+        });
+    }
+
+    public void dispose() {
+        instructFrame.dispose();
+        fr.dispose();
+    }
+
+    public JScrollPane addInfo(String info) {
+        JTextArea jta = new JTextArea(info,8,20);
+        jta.setEditable(false);
+        jta.setLineWrap(true);
+        JScrollPane sp = new JScrollPane(jta);
+        return sp;
+
+    }
+
+    /* Main Method */
+
+    public static void main(String[] argv) throws Exception {
+        final CountDownLatch latch = new CountDownLatch(1);
+        PrintManualTest_FitWidthMultiple test = new PrintManualTest_FitWidthMultiple(latch);
+        Thread T1 = new Thread(test);
+        T1.start();
+
+        // wait for latch to complete
+        boolean ret = false;
+        try {
+            ret = latch.await(60, TimeUnit.SECONDS);
+        } catch (InterruptedException ie) {
+            throw ie;
+        }
+        if (!ret) {
+            test.dispose();
+            throw new RuntimeException(" User has not executed the test");
+        }
+        if (test.testPassed == false) {
+            throw new RuntimeException("printed contents is beyond borders");
+        }
+    }
+}
--- a/jdk/test/javax/swing/text/View/8156217/FPMethodCalledTest.java	Wed Jul 05 22:40:29 2017 +0200
+++ b/jdk/test/javax/swing/text/View/8156217/FPMethodCalledTest.java	Mon Jan 09 11:57:06 2017 -0800
@@ -42,7 +42,7 @@
 
 /**
  * @test
- * @bug 8156217
+ * @bug 8156217 8169922
  * @key headful
  * @summary Selected text is shifted on HiDPI display
  * @run main FPMethodCalledTest