changeset 15755:2ac37e4cbc91

Merge
author amurillo
date Fri, 23 Sep 2016 13:44:03 -0700
parents cebf22a0fa91 a041a4759597
children c2c2e05afe5c
files test/java/net/URLPermission/nstest/LookupTestHosts
diffstat 100 files changed, 3032 insertions(+), 605 deletions(-) [+]
line wrap: on
line diff
--- a/make/data/currency/CurrencyData.properties	Wed Sep 21 12:53:07 2016 -0700
+++ b/make/data/currency/CurrencyData.properties	Fri Sep 23 13:44:03 2016 -0700
@@ -32,14 +32,14 @@
 # Version of the currency code information in this class.
 # It is a serial number that accompanies with each amendment.
 
-dataVersion=160
+dataVersion=162
 
 # List of all valid ISO 4217 currency codes.
 # To ensure compatibility, do not remove codes.
 
 all=ADP020-AED784-AFA004-AFN971-ALL008-AMD051-ANG532-AOA973-ARS032-ATS040-AUD036-\
     AWG533-AYM945-AZM031-AZN944-BAM977-BBD052-BDT050-BEF056-BGL100-BGN975-BHD048-BIF108-\
-    BMD060-BND096-BOB068-BOV984-BRL986-BSD044-BTN064-BWP072-BYB112-BYR974-\
+    BMD060-BND096-BOB068-BOV984-BRL986-BSD044-BTN064-BWP072-BYB112-BYR974-BYN933-\
     BZD084-CAD124-CDF976-CHE947-CHF756-CHW948-CLF990-CLP152-CNY156-COP170-COU970-CRC188-CSD891-CUP192-CUC931-\
     CVE132-CYP196-CZK203-DEM276-DJF262-DKK208-DOP214-DZD012-EEK233-EGP818-\
     ERN232-ESP724-ETB230-EUR978-FIM246-FJD242-FKP238-FRF250-GBP826-GEL981-\
@@ -119,7 +119,7 @@
 # BARBADOS
 BB=BBD
 # BELARUS
-BY=BYR
+BY=BYN
 # BELGIUM
 BE=EUR
 # BELIZE
--- a/make/mapfiles/libjpeg/mapfile-vers	Wed Sep 21 12:53:07 2016 -0700
+++ b/make/mapfiles/libjpeg/mapfile-vers	Fri Sep 23 13:44:03 2016 -0700
@@ -42,6 +42,7 @@
         Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetReader;
         Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_disposeReader;
         Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetLibraryState;
+        Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_clearNativeReadAbortFlag;
         Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initWriterIDs;
         Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initJPEGImageWriter;
         Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_setDest;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/aix/native/libjli/java_md_aix.c	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2016 SAP SE. 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.
+ */
+#include <stdio.h>
+#include <sys/ldr.h>
+
+#include "java_md_aix.h"
+
+static unsigned char dladdr_buffer[0x4000];
+
+static int fill_dll_info(void) {
+    return loadquery(L_GETINFO, dladdr_buffer, sizeof(dladdr_buffer));
+}
+
+static int dladdr_dont_reload(void *addr, Dl_info *info) {
+    const struct ld_info *p = (struct ld_info *)dladdr_buffer;
+    memset((void *)info, 0, sizeof(Dl_info));
+    for (;;) {
+        if (addr >= p->ldinfo_textorg &&
+            addr < (((char*)p->ldinfo_textorg) + p->ldinfo_textsize))
+        {
+            info->dli_fname = p->ldinfo_filename;
+            return 1;
+        }
+        if (!p->ldinfo_next) {
+            break;
+        }
+        p = (struct ld_info *)(((char *)p) + p->ldinfo_next);
+    }
+    return 0;
+}
+
+int dladdr(void *addr, Dl_info *info) {
+    static int loaded = 0;
+    int rc = 0;
+    void *addr0;
+    if (!addr) {
+        return rc;
+    }
+    if (!loaded) {
+        if (fill_dll_info() == -1)
+            return rc;
+        loaded = 1;
+    }
+
+    // first try with addr on cached data
+    rc = dladdr_dont_reload(addr, info);
+
+    // addr could be an AIX function descriptor, so try dereferenced version
+    if (rc == 0) {
+        addr0 = *((void **)addr);
+        rc = dladdr_dont_reload(addr0, info);
+    }
+
+    // if we had no success until now, maybe loadquery info is outdated.
+    // refresh and retry
+    if (rc == 0) {
+        if (fill_dll_info() == -1)
+            return rc;
+        rc = dladdr_dont_reload(addr, info);
+        if (rc == 0) {
+            rc = dladdr_dont_reload(addr0, info);
+        }
+    }
+    return rc;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/aix/native/libjli/java_md_aix.h	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016 SAP SE. 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.
+ */
+
+#ifndef JAVA_MD_AIX_H
+#define JAVA_MD_AIX_H
+
+/*
+ * Very limited AIX port of dladdr() for libjli.so.
+ *
+ * We try to mimick dladdr(3) on Linux (see http://linux.die.net/man/3/dladdr)
+ * dladdr(3) is not POSIX but a GNU extension, and is not available on AIX.
+ *
+ * We only support Dl_info.dli_fname here as this is the only thing that is
+ * used of it by libjli.so. A more comprehensive port of dladdr can be found
+ * in the hotspot implementation which is not available at this place, though.
+ */
+
+typedef struct {
+  const char *dli_fname; /* file path of loaded library */
+  void *dli_fbase;       /* unsupported */
+  const char *dli_sname; /* unsupported */
+  void *dli_saddr;       /* unsupported */
+} Dl_info;
+
+int dladdr(void *addr, Dl_info *info);
+
+#endif /* JAVA_MD_AIX_H */
--- a/src/java.base/share/classes/java/util/ListResourceBundle.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.base/share/classes/java/util/ListResourceBundle.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -206,5 +206,5 @@
         lookup = temp;
     }
 
-    private Map<String,Object> lookup = null;
+    private volatile Map<String,Object> lookup = null;
 }
--- a/src/java.base/share/classes/java/util/PropertyResourceBundle.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.base/share/classes/java/util/PropertyResourceBundle.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,8 +46,6 @@
 import java.nio.charset.MalformedInputException;
 import java.nio.charset.StandardCharsets;
 import java.nio.charset.UnmappableCharacterException;
-import java.security.AccessController;
-import java.util.Locale;
 import sun.security.action.GetPropertyAction;
 import sun.util.PropertyResourceBundleCharset;
 import sun.util.ResourceBundleEnumeration;
@@ -236,5 +234,5 @@
 
     // ==================privates====================
 
-    private Map<String,Object> lookup;
+    private final Map<String,Object> lookup;
 }
--- a/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Fri Sep 23 13:44:03 2016 -0700
@@ -103,34 +103,42 @@
 
 # Translators please note do not translate the options themselves
 java.launcher.X.usage=\
-\    -Xmixed           mixed mode execution (default)\n\
-\    -Xint             interpreted mode execution only\n\
+\    -Xbatch           disable background compilation\n\
 \    -Xbootclasspath/a:<directories and zip/jar files separated by {0}>\n\
 \                      append to end of bootstrap class path\n\
+\    -Xcheck:jni       perform additional checks for JNI functions\n\
+\    -Xcomp            forces compilation of methods on first invocation\n\
+\    -Xdebug           provided for backward compatibility\n\
 \    -Xdiag            show additional diagnostic messages\n\
 \    -Xdiag:resolver   show resolver diagnostic messages\n\
-\    -Xnoclassgc       disable class garbage collection\n\
+\    -Xdisable-@files  disable further argument file expansion\n\
+\    -Xfuture          enable strictest checks, anticipating future default\n\
+\    -Xint             interpreted mode execution only\n\
+\    -Xinternalversion\n\
+\                      displays more detailed JVM version information than the\n\
+\                      -version option\n\
 \    -Xloggc:<file>    log GC status to a file with time stamps\n\
-\    -Xbatch           disable background compilation\n\
+\    -Xmixed           mixed mode execution (default)\n\
+\    -Xmn<size>        sets the initial and maximum size (in bytes) of the heap\n\
+\                      for the young generation (nursery)\n\
 \    -Xms<size>        set initial Java heap size\n\
 \    -Xmx<size>        set maximum Java heap size\n\
-\    -Xss<size>        set java thread stack size\n\
+\    -Xnoclassgc       disable class garbage collection\n\
 \    -Xprof            output cpu profiling data\n\
-\    -Xfuture          enable strictest checks, anticipating future default\n\
 \    -Xrs              reduce use of OS signals by Java/VM (see documentation)\n\
-\    -Xcheck:jni       perform additional checks for JNI functions\n\
+\    -Xshare:auto      use shared class data if possible (default)\n\
 \    -Xshare:off       do not attempt to use shared class data\n\
-\    -Xshare:auto      use shared class data if possible (default)\n\
 \    -Xshare:on        require using shared class data, otherwise fail.\n\
 \    -XshowSettings    show all settings and continue\n\
 \    -XshowSettings:all\n\
 \                      show all settings and continue\n\
-\    -XshowSettings:vm show all vm related settings and continue\n\
+\    -XshowSettings:locale\n\
+\                      show all locale related settings and continue\n\
 \    -XshowSettings:properties\n\
 \                      show all property settings and continue\n\
-\    -XshowSettings:locale\n\
-\                      show all locale related settings and continue\n\
-\    -Xdisable-@files  disable further argument file expansion\n\
+\    -XshowSettings:vm show all vm related settings and continue\n\
+\    -Xss<size>        set java thread stack size\n\
+\    -Xverify          sets the mode of the bytecode verifier\n\
 \    --add-reads <module>=<target-module>(,<target-module>)*\n\
 \                      updates <module> to read <target-module>, regardless\n\
 \                      of module declaration. \n\
--- a/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties	Fri Sep 23 13:44:03 2016 -0700
@@ -92,6 +92,7 @@
 BTN=BTN
 BWP=BWP
 BYB=BYB
+BYN=BYN
 BYR=BYR
 BZD=BZD
 CAD=CAD
@@ -310,8 +311,9 @@
 bsd=Bahamian Dollar
 btn=Bhutanese Ngultrum
 bwp=Botswanan Pula
-byb=Belarusian New Ruble (1994-1999)
-byr=Belarusian Ruble
+byb=Belarusian Ruble (1994-1999)
+byn=Belarusian Ruble
+byr=Belarusian Ruble (2000-2016)
 bzd=Belize Dollar
 cad=Canadian Dollar
 cdf=Congolese Franc
@@ -399,7 +401,7 @@
 mtl=Maltese Lira
 mur=Mauritian Rupee
 mvr=Maldivian Rufiyaa
-mwk=Malawian Kwacha
+mwk=Malawian Malawi Kwacha
 mxn=Mexican Peso
 mxv=Mexican Investment Unit
 myr=Malaysian Ringgit
@@ -414,7 +416,7 @@
 nzd=New Zealand Dollar
 omr=Omani Rial
 pab=Panamanian Balboa
-pen=Peruvian Nuevo Sol
+pen=Peruvian Sol
 pgk=Papua New Guinean Kina
 php=Philippine Peso
 pkr=Pakistani Rupee
--- a/src/java.base/unix/native/libjava/ProcessImpl_md.c	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c	Fri Sep 23 13:44:03 2016 -0700
@@ -152,8 +152,8 @@
 #ifdef __solaris__
     /* These really are the Solaris defaults! */
     return (geteuid() == 0 || getuid() == 0) ?
-        "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" :
-        "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin:";
+        "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:/usr/sbin" :
+        "/usr/xpg4/bin:/usr/bin:/opt/SUNWspro/bin:";
 #else
     return ":/bin:/usr/bin";    /* glibc */
 #endif
--- a/src/java.base/unix/native/libjli/java_md.h	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.base/unix/native/libjli/java_md.h	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,12 +35,12 @@
 #include "manifest_info.h"
 #include "jli_util.h"
 
-#define PATH_SEPARATOR          ':'
-#define FILESEP                 "/"
-#define FILE_SEPARATOR          '/'
+#define PATH_SEPARATOR       ':'
+#define FILESEP              "/"
+#define FILE_SEPARATOR       '/'
 #define IS_FILE_SEPARATOR(c) ((c) == '/')
 #ifndef MAXNAMELEN
-#define MAXNAMELEN              PATH_MAX
+#define MAXNAMELEN           PATH_MAX
 #endif
 
 #ifdef _LP64
@@ -59,10 +59,13 @@
 static jboolean GetJREPath(char *path, jint pathsize, const char * arch,
                            jboolean speculative);
 
+#if defined(_AIX)
+#include "java_md_aix.h"
+#endif
+
 #ifdef MACOSX
 #include "java_md_macosx.h"
 #else  /* !MACOSX */
 #include "java_md_solinux.h"
 #endif /* MACOSX */
-
 #endif /* JAVA_MD_H */
--- a/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Sep 23 13:44:03 2016 -0700
@@ -187,6 +187,7 @@
 
         updateAlwaysOnTopState();
         updateMinimumSize();
+        updateFocusableWindowState();
 
         final Shape shape = getTarget().getShape();
         if (shape != null) {
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Fri Sep 23 13:44:03 2016 -0700
@@ -63,6 +63,7 @@
     private static native void nativeSetNSWindowRepresentedFilename(long nsWindowPtr, String representedFilename);
     private static native void nativeSetEnabled(long nsWindowPtr, boolean isEnabled);
     private static native void nativeSynthesizeMouseEnteredExitedEvents();
+    private static native void nativeSynthesizeMouseEnteredExitedEvents(long nsWindowPtr, int eventType);
     private static native void nativeDispose(long nsWindowPtr);
     private static native void nativeEnterFullScreenMode(long nsWindowPtr);
     private static native void nativeExitFullScreenMode(long nsWindowPtr);
@@ -825,6 +826,13 @@
             return;
         }
 
+        if (blocked) {
+            // We are going to show a modal window. Previously displayed window will be
+            // blocked/disabled. So we have to send mouse exited event to it now, since
+            // all mouse events are discarded for blocked/disabled windows.
+            nativeSynthesizeMouseEnteredExitedEvents(getNSWindowPtr(), CocoaConstants.NSMouseExited);
+        }
+
         nativeSetEnabled(getNSWindowPtr(), !blocked);
         checkBlockingAndOrder();
     }
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m	Fri Sep 23 13:44:03 2016 -0700
@@ -1333,9 +1333,9 @@
 /*
  * Class:     sun_lwawt_macosx_CPlatformWindow
  * Method:    nativeSynthesizeMouseEnteredExitedEvents
- * Signature: (J)V
+ * Signature: ()V
  */
-JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents__
 (JNIEnv *env, jclass clazz)
 {
     JNF_COCOA_ENTER(env);
@@ -1349,6 +1349,29 @@
 
 /*
  * Class:     sun_lwawt_macosx_CPlatformWindow
+ * Method:    nativeSynthesizeMouseEnteredExitedEvents
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeSynthesizeMouseEnteredExitedEvents__JI
+(JNIEnv *env, jclass clazz, jlong windowPtr, jint eventType)
+{
+JNF_COCOA_ENTER(env);
+
+    if (eventType == NSMouseEntered || eventType == NSMouseExited) {
+        NSWindow *nsWindow = OBJC(windowPtr);
+
+        [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
+            [AWTWindow synthesizeMouseEnteredExitedEvents:nsWindow withType:eventType];
+        }];
+    } else {
+        [JNFException raise:env as:kIllegalArgumentException reason:"unknown event type"];
+    }
+    
+JNF_COCOA_EXIT(env);
+}
+
+/*
+ * Class:     sun_lwawt_macosx_CPlatformWindow
  * Method:    _toggleFullScreenMode
  * Signature: (J)V
  */
--- a/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/awt/AWTUtilities.java	Fri Sep 23 13:44:03 2016 -0700
@@ -447,6 +447,7 @@
      * @param shape the new 'mixing-cutout' shape
      * @throws NullPointerException if the component argument is {@code null}
      */
+    @Deprecated(since = "9")
     public static void setComponentMixingCutoutShape(Component component,
             Shape shape)
     {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -749,6 +749,10 @@
         checkIndex(imageIndex);
         clearAbortRequest();
         processImageStarted(imageIndex);
+        if (abortRequested()) {
+            processReadAborted();
+            return bi;
+        }
 
         if (param == null)
             param = getDefaultReadParam();
@@ -1005,9 +1009,6 @@
             int j = isBottomUp ? (height -1)*bytesPerScanline : 0;
 
             for (int i=0; i<height; i++) {
-                if (abortRequested()) {
-                    break;
-                }
                 iis.readFully(bdata, j, bytesPerScanline);
                 iis.skipBytes(padding);
                 j += isBottomUp ? -bytesPerScanline : bytesPerScanline;
@@ -1015,6 +1016,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F * i/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         } else {
             byte[] buf = new byte[lineLength];
@@ -1051,9 +1055,6 @@
 
             for (int j = 0, y = sourceRegion.y;
                  j < destinationRegion.height; j++, y+=scaleY) {
-
-                if (abortRequested())
-                    break;
                 iis.read(buf, 0, lineLength);
                 for (int i = 0; i < destinationRegion.width; i++) {
                     //get the bit and assign to the data buffer of the raster
@@ -1067,6 +1068,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F*j/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         }
     }
@@ -1087,9 +1091,6 @@
             int j = isBottomUp ? (height -1) * bytesPerScanline : 0;
 
             for (int i=0; i<height; i++) {
-                if (abortRequested()) {
-                    break;
-                }
                 iis.readFully(bdata, j, bytesPerScanline);
                 iis.skipBytes(padding);
                 j += isBottomUp ? -bytesPerScanline : bytesPerScanline;
@@ -1097,6 +1098,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F * i/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         } else {
             byte[] buf = new byte[lineLength];
@@ -1133,9 +1137,6 @@
 
             for (int j = 0, y = sourceRegion.y;
                  j < destinationRegion.height; j++, y+=scaleY) {
-
-                if (abortRequested())
-                    break;
                 iis.read(buf, 0, lineLength);
                 for (int i = 0; i < destinationRegion.width; i++) {
                     //get the bit and assign to the data buffer of the raster
@@ -1149,6 +1150,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F*j/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         }
     }
@@ -1168,9 +1172,6 @@
             int j = isBottomUp ? (height -1) * width : 0;
 
             for (int i=0; i<height; i++) {
-                if (abortRequested()) {
-                    break;
-                }
                 iis.readFully(bdata, j, width);
                 iis.skipBytes(padding);
                 j += isBottomUp ? -width : width;
@@ -1178,6 +1179,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F * i/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         } else {
             byte[] buf = new byte[lineLength];
@@ -1200,9 +1204,6 @@
 
             for (int j = 0, y = sourceRegion.y;
                  j < destinationRegion.height; j++, y+=scaleY) {
-
-                if (abortRequested())
-                    break;
                 iis.read(buf, 0, lineLength);
                 for (int i = 0, m = sourceRegion.x;
                      i < destinationRegion.width; i++, m += scaleX) {
@@ -1216,6 +1217,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F*j/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         }
     }
@@ -1235,9 +1239,6 @@
             int j = isBottomUp ? (height -1) * width * 3 : 0;
 
             for (int i=0; i<height; i++) {
-                if (abortRequested()) {
-                    break;
-                }
                 iis.readFully(bdata, j, lineStride);
                 iis.skipBytes(padding);
                 j += isBottomUp ? -lineStride : lineStride;
@@ -1245,6 +1246,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F * i/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         } else {
             byte[] buf = new byte[lineLength];
@@ -1267,9 +1271,6 @@
 
             for (int j = 0, y = sourceRegion.y;
                  j < destinationRegion.height; j++, y+=scaleY) {
-
-                if (abortRequested())
-                    break;
                 iis.read(buf, 0, lineLength);
                 for (int i = 0, m = 3 * sourceRegion.x;
                      i < destinationRegion.width; i++, m += 3 * scaleX) {
@@ -1285,6 +1286,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F*j/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         }
     }
@@ -1302,10 +1306,6 @@
         if (noTransform) {
             int j = isBottomUp ? (height -1) * width : 0;
             for (int i=0; i<height; i++) {
-                if (abortRequested()) {
-                    break;
-                }
-
                 iis.readFully(sdata, j, width);
                 iis.skipBytes(padding);
 
@@ -1314,6 +1314,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F * i/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         } else {
             short[] buf = new short[lineLength];
@@ -1336,9 +1339,6 @@
 
             for (int j = 0, y = sourceRegion.y;
                  j < destinationRegion.height; j++, y+=scaleY) {
-
-                if (abortRequested())
-                    break;
                 iis.readFully(buf, 0, lineLength);
                 for (int i = 0, m = sourceRegion.x;
                      i < destinationRegion.width; i++, m += scaleX) {
@@ -1352,6 +1352,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F*j/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         }
     }
@@ -1361,15 +1364,15 @@
             int j = isBottomUp ? (height -1) * width : 0;
 
             for (int i=0; i<height; i++) {
-                if (abortRequested()) {
-                    break;
-                }
                 iis.readFully(idata, j, width);
                 j += isBottomUp ? -width : width;
                 processImageUpdate(bi, 0, i,
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F * i/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         } else {
             int[] buf = new int[width];
@@ -1392,9 +1395,6 @@
 
             for (int j = 0, y = sourceRegion.y;
                  j < destinationRegion.height; j++, y+=scaleY) {
-
-                if (abortRequested())
-                    break;
                 iis.readFully(buf, 0, width);
                 for (int i = 0, m = sourceRegion.x;
                      i < destinationRegion.width; i++, m += scaleX) {
@@ -1408,6 +1408,9 @@
                                    destinationRegion.width, 1, 1, 1,
                                    new int[]{0});
                 processImageProgress(100.0F*j/destinationRegion.height);
+                if (abortRequested()) {
+                    break;
+                }
             }
         }
     }
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -456,6 +456,9 @@
                 // Update IIOReadProgressListeners
                 ++rowsDone;
                 processImageProgress(100.0F*rowsDone/height);
+                if (abortRequested()) {
+                    return;
+                }
 
                 if (decodeThisRow) {
                     outputRow();
@@ -860,7 +863,6 @@
             throw new IndexOutOfBoundsException("imageIndex out of bounds!");
         }
 
-        clearAbortRequest();
         readMetadata();
 
         // A null ImageReadParam means we use the default
@@ -903,8 +905,13 @@
             (streamY - sourceRegion.y)/sourceYSubsampling;
         computeDecodeThisRow();
 
+        clearAbortRequest();
         // Inform IIOReadProgressListeners of start of image
         processImageStarted(imageIndex);
+        if (abortRequested()) {
+            processReadAborted();
+            return theImage;
+        }
         startPass(0);
 
         this.rowBuf = new byte[width];
@@ -947,7 +954,7 @@
             int codeSize = initCodeSize + 1;
             int codeMask = (1 << codeSize) - 1;
 
-            while (!abortRequested()) {
+            do {
                 code = getCode(codeSize, codeMask);
 
                 if (code == clearCode) {
@@ -1005,7 +1012,7 @@
 
                 outputPixels(string, len);
                 oldCode = code;
-            }
+            } while (!abortRequested());
 
             processReadAborted();
             return theImage;
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1327,28 +1327,32 @@
             System.out.println("callbackUpdates is " + callbackUpdates);
         }
 
-        // Finally, we are ready to read
-
+        /*
+         * All the Jpeg processing happens in native, we should clear
+         * abortFlag of imageIODataStruct in imageioJPEG.c. And we need to
+         * clear abortFlag because if in previous read() if we had called
+         * reader.abort() that will continue to be valid for present call also.
+         */
+        clearNativeReadAbortFlag(structPointer);
         processImageStarted(currentImage);
-
-        boolean aborted = false;
-
-        // Note that getData disables acceleration on buffer, but it is
-        // just a 1-line intermediate data transfer buffer that will not
-        // affect the acceleration of the resulting image.
-        aborted = readImage(structPointer,
-                            buffer.getData(),
-                            numRasterBands,
-                            srcBands,
-                            bandSizes,
-                            srcROI.x, srcROI.y,
-                            srcROI.width, srcROI.height,
-                            periodX, periodY,
-                            abbrevQTables,
-                            abbrevDCHuffmanTables,
-                            abbrevACHuffmanTables,
-                            minProgressivePass, maxProgressivePass,
-                            callbackUpdates);
+        /*
+         * Note that getData disables acceleration on buffer, but it is
+         * just a 1-line intermediate data transfer buffer that will not
+         * affect the acceleration of the resulting image.
+         */
+        boolean aborted = readImage(structPointer,
+                                    buffer.getData(),
+                                    numRasterBands,
+                                    srcBands,
+                                    bandSizes,
+                                    srcROI.x, srcROI.y,
+                                    srcROI.width, srcROI.height,
+                                    periodX, periodY,
+                                    abbrevQTables,
+                                    abbrevDCHuffmanTables,
+                                    abbrevACHuffmanTables,
+                                    minProgressivePass, maxProgressivePass,
+                                    callbackUpdates);
 
         if (aborted) {
             processReadAborted();
@@ -1513,6 +1517,12 @@
                                      int maxProgressivePass,
                                      boolean wantUpdates);
 
+    /*
+     * We should call clearNativeReadAbortFlag() before we start reading
+     * jpeg image as image processing happens at native side.
+     */
+    private native void clearNativeReadAbortFlag(long structPointer);
+
     public void abort() {
         setThreadLock();
         try {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -937,12 +937,6 @@
         for (int srcY = 0; srcY < passHeight; srcY++) {
             // Skip filter byte and the remaining row bytes
             pixelStream.skipBytes(1 + bytesPerRow);
-
-            // If read has been aborted, just return
-            // processReadAborted will be called later
-            if (abortRequested()) {
-                return;
-            }
         }
     }
 
@@ -996,6 +990,13 @@
             for (int srcY = 0; srcY < passHeight; srcY++) {
                 // Update count of pixels read
                 updateImageProgress(passWidth);
+                /*
+                 * If read has been aborted, just return
+                 * processReadAborted will be called later
+                 */
+                if (abortRequested()) {
+                    return;
+                }
                 // Skip filter byte and the remaining row bytes
                 pixelStream.skipBytes(1 + bytesPerRow);
             }
@@ -1105,7 +1106,13 @@
         for (int srcY = 0; srcY < passHeight; srcY++) {
             // Update count of pixels read
             updateImageProgress(passWidth);
-
+            /*
+             * If read has been aborted, just return
+             * processReadAborted will be called later
+             */
+            if (abortRequested()) {
+                return;
+            }
             // Read the filter type byte and a row of data
             int filter = pixelStream.read();
             try {
@@ -1195,12 +1202,6 @@
                                    updateWidth, 1,
                                    updateXStep, updateYStep,
                                    destinationBands);
-
-                // If read has been aborted, just return
-                // processReadAborted will be called later
-                if (abortRequested()) {
-                    return;
-                }
             }
         }
 
@@ -1215,8 +1216,6 @@
         this.pixelsDone = 0;
         this.totalPixels = width*height;
 
-        clearAbortRequest();
-
         if (metadata.IHDR_interlaceMethod == 0) {
             decodePass(0, 0, 0, 1, 1, width, height);
         } else {
@@ -1241,8 +1240,10 @@
                              (height + ybump)/YSubsampling);
                 }
 
-                // If read has been aborted, just return
-                // processReadAborted will be called later
+                /*
+                 * If read has been aborted, just return
+                 * processReadAborted will be called later
+                 */
                 if (abortRequested()) {
                     return;
                 }
@@ -1332,13 +1333,19 @@
                                        inputBandsForColorType[colorType],
                                       theImage.getSampleModel().getNumBands());
 
+            clearAbortRequest();
             processImageStarted(0);
-            decodeImage();
             if (abortRequested()) {
                 processReadAborted();
             } else {
-                processImageComplete();
+                decodeImage();
+                if (abortRequested()) {
+                    processReadAborted();
+                } else {
+                    processImageComplete();
+                }
             }
+
         } catch (IOException e) {
             throw new IIOException("Error reading PNG image data", e);
         } finally {
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDeflateDecompressor.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDeflateDecompressor.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,13 +101,17 @@
 
         if (predictor ==
             BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING) {
+            int step = planar || samplesPerPixel == 1 ? 1 : samplesPerPixel;
+            int samplesPerRow = step * srcWidth;
 
+            int off = bufOffset + step;
             for (int j = 0; j < srcHeight; j++) {
-                int count = bufOffset + samplesPerPixel * (j * srcWidth + 1);
-                for (int i=samplesPerPixel; i<srcWidth*samplesPerPixel; i++) {
-                    buf[count] += buf[count - samplesPerPixel];
+                int count = off;
+                for (int i = step; i < samplesPerRow; i++) {
+                    buf[count] += buf[count - step];
                     count++;
                 }
+                off += samplesPerRow;
             }
         }
 
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageReader.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1131,8 +1131,12 @@
         pixelsToRead = destRegion.width * destRegion.height;
         pixelsRead = 0;
 
+        clearAbortRequest();
         processImageStarted(imageIndex);
-        processImageProgress(0.0f);
+        if (abortRequested()) {
+            processReadAborted();
+            return theImage;
+        }
 
         tilesAcross = (width + tileOrStripWidth - 1) / tileOrStripWidth;
         tilesDown = (height + tileOrStripHeight - 1) / tileOrStripHeight;
@@ -1286,6 +1290,10 @@
                     }
 
                     reportProgress();
+                    if (abortRequested()) {
+                        processReadAborted();
+                        return theImage;
+                    }
                 }
             }
         } else {
@@ -1294,16 +1302,14 @@
                     decodeTile(ti, tj, -1);
 
                     reportProgress();
+                    if (abortRequested()) {
+                        processReadAborted();
+                        return theImage;
+                    }
                 }
             }
         }
-
-        if (abortRequested()) {
-            processReadAborted();
-        } else {
-            processImageComplete();
-        }
-
+        processImageComplete();
         return theImage;
     }
 
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWDecompressor.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWDecompressor.java	Fri Sep 23 13:44:03 2016 -0700
@@ -162,16 +162,18 @@
 
         if (predictor ==
             BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING) {
+            int step = planar || samplesPerPixel == 1 ? 1 : samplesPerPixel;
 
+            int samplesPerRow = step * srcWidth;
+
+            int off = dstOffset + step;
             for (int j = 0; j < srcHeight; j++) {
-
-                int count = dstOffset + samplesPerPixel * (j * srcWidth + 1);
-
-                for (int i = samplesPerPixel; i < srcWidth * samplesPerPixel; i++) {
-
-                    dstData[count] += dstData[count - samplesPerPixel];
+                int count = off;
+                for (int i = step; i < samplesPerRow; i++) {
+                    dstData[count] += dstData[count - step];
                     count++;
                 }
+                off += samplesPerRow;
             }
         }
 
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Fri Sep 23 13:44:03 2016 -0700
@@ -504,7 +504,7 @@
             public Object createValue(UIDefaults table) {
                 GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory();
                 GTKStyle style = (GTKStyle)factory.getStyle(null, region);
-                return style.getFontForState(null);
+                return style.getDefaultFont();
             }
         }
 
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Fri Sep 23 13:44:03 2016 -0700
@@ -282,7 +282,17 @@
         return getColorForState(context, type);
     }
 
+    Font getDefaultFont() {
+        return font;
+    }
+
     protected Font getFontForState(SynthContext context) {
+        Font propFont = UIManager
+                              .getFont(context.getRegion().getName() + ".font");
+        if (propFont != null) {
+            // if font property got a value then return it
+            return propFont;
+        }
         return font;
     }
 
--- a/src/java.desktop/share/classes/java/awt/Component.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/java/awt/Component.java	Fri Sep 23 13:44:03 2016 -0700
@@ -843,32 +843,7 @@
                 return new Rectangle(comp.x, comp.y, comp.width, comp.height);
             }
             public void setMixingCutoutShape(Component comp, Shape shape) {
-                Region region = shape == null ?  null :
-                    Region.getInstance(shape, null);
-
-                synchronized (comp.getTreeLock()) {
-                    boolean needShowing = false;
-                    boolean needHiding = false;
-
-                    if (!comp.isNonOpaqueForMixing()) {
-                        needHiding = true;
-                    }
-
-                    comp.mixingCutoutRegion = region;
-
-                    if (!comp.isNonOpaqueForMixing()) {
-                        needShowing = true;
-                    }
-
-                    if (comp.isMixingNeeded()) {
-                        if (needHiding) {
-                            comp.mixOnHiding(comp.isLightweight());
-                        }
-                        if (needShowing) {
-                            comp.mixOnShowing();
-                        }
-                    }
-                }
+                comp.setMixingCutoutShape(shape);
             }
 
             public void setGraphicsConfiguration(Component comp,
@@ -10238,6 +10213,71 @@
         return true;
     }
 
+    /**
+     * Sets a 'mixing-cutout' shape for the given component.
+     *
+     * By default a lightweight component is treated as an opaque rectangle for
+     * the purposes of the Heavyweight/Lightweight Components Mixing feature.
+     * This method enables developers to set an arbitrary shape to be cut out
+     * from heavyweight components positioned underneath the lightweight
+     * component in the z-order.
+     * <p>
+     * The {@code shape} argument may have the following values:
+     * <ul>
+     * <li>{@code null} - reverts the default cutout shape (the rectangle equal
+     * to the component's {@code getBounds()})
+     * <li><i>empty-shape</i> - does not cut out anything from heavyweight
+     * components. This makes the given lightweight component effectively
+     * transparent. Note that descendants of the lightweight component still
+     * affect the shapes of heavyweight components.  An example of an
+     * <i>empty-shape</i> is {@code new Rectangle()}.
+     * <li><i>non-empty-shape</i> - the given shape will be cut out from
+     * heavyweight components.
+     * </ul>
+     * <p>
+     * The most common example when the 'mixing-cutout' shape is needed is a
+     * glass pane component. The {@link JRootPane#setGlassPane()} method
+     * automatically sets the <i>empty-shape</i> as the 'mixing-cutout' shape
+     * for the given glass pane component.  If a developer needs some other
+     * 'mixing-cutout' shape for the glass pane (which is rare), this must be
+     * changed manually after installing the glass pane to the root pane.
+     * <p>
+     * Note that the 'mixing-cutout' shape neither affects painting, nor the
+     * mouse events handling for the given component. It is used exclusively
+     * for the purposes of the Heavyweight/Lightweight Components Mixing
+     * feature.
+     *
+     * @param shape the new 'mixing-cutout' shape
+     * @since 9
+     */
+    void setMixingCutoutShape(Shape shape) {
+        Region region = shape == null ? null : Region.getInstance(shape, null);
+
+        synchronized (getTreeLock()) {
+            boolean needShowing = false;
+            boolean needHiding = false;
+
+            if (!isNonOpaqueForMixing()) {
+                needHiding = true;
+            }
+
+            mixingCutoutRegion = region;
+
+            if (!isNonOpaqueForMixing()) {
+                needShowing = true;
+            }
+
+            if (isMixingNeeded()) {
+                if (needHiding) {
+                    mixOnHiding(isLightweight());
+                }
+                if (needShowing) {
+                    mixOnShowing();
+                }
+            }
+        }
+    }
+
     // ****************** END OF MIXING CODE ********************************
 
     // Note that the method is overriden in the Window class,
--- a/src/java.desktop/share/classes/java/awt/Taskbar.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/java/awt/Taskbar.java	Fri Sep 23 13:44:03 2016 -0700
@@ -273,9 +273,7 @@
     }
 
     /**
-     * Requests user attention to the specified window until it is activated.
-     *
-     * On an already active window requesting attention does nothing.
+     * Requests user attention to the specified window.
      *
      * @param w window
      * @throws SecurityException if a security manager exists and it denies the
--- a/src/java.desktop/share/classes/java/awt/Toolkit.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/java/awt/Toolkit.java	Fri Sep 23 13:44:03 2016 -0700
@@ -208,7 +208,7 @@
 
     /**
      * Returns whether dynamic layout of Containers on resize is currently
-     * enabled on the underlying operating system and/or window manager). If the
+     * enabled on the underlying operating system and/or window manager. If the
      * platform supports it, {@code setDynamicLayout(boolean)} may be used to
      * programmatically enable or disable platform dynamic layout. Regardless of
      * whether that toggling is supported, or whether {@code true} or {@code
--- a/src/java.desktop/share/classes/java/awt/peer/TaskbarPeer.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/java/awt/peer/TaskbarPeer.java	Fri Sep 23 13:44:03 2016 -0700
@@ -49,9 +49,7 @@
     default void requestUserAttention(boolean enabled, final boolean critical) {}
 
     /**
-     * Requests user attention to the specified window until it is activated.
-     *
-     * On an already active window requesting attention does nothing.
+     * Requests user attention to the specified window.
      *
      * @param w window
      */
--- a/src/java.desktop/share/classes/javax/swing/SortingFocusTraversalPolicy.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/javax/swing/SortingFocusTraversalPolicy.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,15 +26,11 @@
 
 import java.awt.Component;
 import java.awt.Container;
-import java.awt.Window;
 import java.util.*;
 import java.awt.FocusTraversalPolicy;
 import sun.util.logging.PlatformLogger;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import sun.security.action.GetPropertyAction;
 import java.security.AccessController;
-import java.security.PrivilegedAction;
 
 /**
  * A FocusTraversalPolicy that determines traversal order by sorting the
@@ -100,27 +96,10 @@
      * See: JDK-8048887
      */
     private static final boolean legacySortingFTPEnabled;
-    private static final Method legacyMergeSortMethod;
 
     static {
         legacySortingFTPEnabled = "true".equals(AccessController.doPrivileged(
             new GetPropertyAction("swing.legacySortingFTPEnabled", "true")));
-        legacyMergeSortMethod = legacySortingFTPEnabled ?
-            AccessController.doPrivileged(new PrivilegedAction<Method>() {
-                public Method run() {
-                    try {
-                        Method m = java.util.Arrays.class.getDeclaredMethod("legacyMergeSort",
-                                                                            new Class<?>[]{Object[].class,
-                                                                                    Comparator.class});
-                        m.setAccessible(true);
-                        return m;
-                    } catch (NoSuchMethodException e) {
-                        // using default sorting algo
-                        return null;
-                    }
-                }
-            }) :
-            null;
     }
 
     /**
@@ -169,30 +148,25 @@
     private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
         if (focusCycleRoot.isShowing()) {
             enumerateCycle(focusCycleRoot, cycle);
-            if (!legacySortingFTPEnabled ||
-                !legacySort(cycle, comparator))
-            {
-                Collections.sort(cycle, comparator);
+            if (legacySortingFTPEnabled) {
+                legacySort(cycle, comparator);
+            } else {
+                cycle.sort(comparator);
             }
         }
     }
 
-    private boolean legacySort(List<Component> l, Comparator<? super Component> c) {
-        if (legacyMergeSortMethod == null)
-            return false;
-
-        Object[] a = l.toArray();
-        try {
-            legacyMergeSortMethod.invoke(null, a, c);
-        } catch (IllegalAccessException | InvocationTargetException e) {
-            return false;
+    private void legacySort(List<Component> l,
+                                              Comparator<? super Component> c) {
+        if (c != null && l.size() > 1) {
+            Component[] a = l.toArray(new Component[l.size()]);
+            mergeSort(a.clone(), a, 0, a.length, 0, c);
+            ListIterator<Component> i = l.listIterator();
+            for (Component e : a) {
+                i.next();
+                i.set(e);
+            }
         }
-        ListIterator<Component> i = l.listIterator();
-        for (Object e : a) {
-            i.next();
-            i.set((Component)e);
-        }
-        return true;
     }
 
     @SuppressWarnings("deprecation")
@@ -665,6 +639,48 @@
     protected boolean accept(Component aComponent) {
         return fitnessTestPolicy.accept(aComponent);
     }
+
+    // merge sort implementation copied from java.utils.Arrays
+    private <T> void mergeSort(T[] src, T[] dest,
+                               int low, int high, int off,
+                               Comparator<? super T> c) {
+        int length = high - low;
+
+        // Insertion sort on smallest arrays
+        if (length < 7) {
+            for (int i=low; i<high; i++)
+                for (int j=i; j>low && c.compare(dest[j-1], dest[j])>0; j--) {
+                    T t = dest[j];
+                    dest[j] = dest[j-1];
+                    dest[j-1] = t;
+                }
+            return;
+        }
+
+        // Recursively sort halves of dest into src
+        int destLow  = low;
+        int destHigh = high;
+        low  += off;
+        high += off;
+        int mid = (low + high) >>> 1;
+        mergeSort(dest, src, low, mid, -off, c);
+        mergeSort(dest, src, mid, high, -off, c);
+
+        // If list is already sorted, just copy from src to dest.  This is an
+        // optimization that results in faster sorts for nearly ordered lists.
+        if (c.compare(src[mid-1], src[mid]) <= 0) {
+            System.arraycopy(src, low, dest, destLow, length);
+            return;
+        }
+
+        // Merge sorted halves (now in src) into dest
+        for(int i = destLow, p = low, q = mid; i < destHigh; i++) {
+            if (q >= high || p < mid && c.compare(src[p], src[q]) <= 0)
+                dest[i] = src[p++];
+            else
+                dest[i] = src[q++];
+        }
+    }
 }
 
 // Create our own subclass and change accept to public so that we can call
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1603,13 +1603,18 @@
                 blockIncrement = 1;
             }
 
+            int tickSpacing = getTickSpacing();
             if (slider.getSnapToTicks()) {
-                int tickSpacing = getTickSpacing();
 
                 if (blockIncrement < tickSpacing) {
                     blockIncrement = tickSpacing;
                 }
             }
+            else {
+                if (tickSpacing > 0) {
+                    blockIncrement = tickSpacing;
+                }
+            }
 
             int delta = blockIncrement * ((direction > 0) ? POSITIVE_SCROLL : NEGATIVE_SCROLL);
             slider.setValue(slider.getValue() + delta);
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Fri Sep 23 13:44:03 2016 -0700
@@ -391,21 +391,8 @@
     }
 
     private Icon getRolloverIcon(AbstractButton b, Icon defaultIcon) {
-        ButtonModel model = b.getModel();
-        Icon icon = null;
-        if (model.isSelected()) {
-            icon = getIcon(b, b.getRolloverSelectedIcon(), null,
-                    SynthConstants.MOUSE_OVER | SynthConstants.SELECTED);
-            if (icon == null) {
-                icon = getIcon(b, b.getSelectedIcon(), null,
-                        SynthConstants.SELECTED);
-            }
-        }
-        if (icon == null) {
-            icon = getIcon(b, b.getRolloverIcon(), defaultIcon,
-                    SynthConstants.MOUSE_OVER);
-        }
-        return icon;
+        return getSpecificIcon(b, b.getRolloverSelectedIcon(), b.getRolloverIcon(),
+                               defaultIcon, SynthConstants.MOUSE_OVER);
     }
 
     private Icon getPressedIcon(AbstractButton b, Icon defaultIcon) {
@@ -414,21 +401,44 @@
     }
 
     private Icon getSynthDisabledIcon(AbstractButton b, Icon defaultIcon) {
-        ButtonModel model = b.getModel();
+        return getSpecificIcon(b, b.getDisabledSelectedIcon(), b.getDisabledIcon(),
+                               defaultIcon, SynthConstants.DISABLED);
+    }
+
+    private Icon getSpecificIcon(AbstractButton b, Icon specificSelectedIcon,
+                                 Icon specificIcon, Icon defaultIcon,
+                                 int state) {
+        boolean selected = b.getModel().isSelected();
         Icon icon = null;
-        if (model.isSelected()) {
-            icon = getIcon(b, b.getDisabledSelectedIcon(), null,
-                    SynthConstants.DISABLED | SynthConstants.SELECTED);
+
+        if (selected) {
+            icon = specificSelectedIcon;
             if (icon == null) {
-                icon = getIcon(b, b.getSelectedIcon(), null,
-                        SynthConstants.SELECTED);
+                icon = b.getSelectedIcon();
             }
         }
+
         if (icon == null) {
-            icon = getIcon(b, b.getDisabledIcon(), defaultIcon,
-                    SynthConstants.DISABLED);
+            icon = specificIcon;
         }
-        return icon;
+
+        if (icon != null) {
+            return icon;
+        }
+
+        if (defaultIcon == null || defaultIcon instanceof UIResource) {
+            if (selected) {
+                icon = getSynthIcon(b, state | SynthConstants.SELECTED);
+                if (icon == null) {
+                    icon = getSynthIcon(b, SynthConstants.SELECTED);
+                }
+            }
+            if (icon == null) {
+                icon = getSynthIcon(b, state);
+            }
+        }
+
+        return icon != null ? icon : defaultIcon;
     }
 
     /**
--- a/src/java.desktop/share/classes/sun/font/ExtendedTextSourceLabel.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/sun/font/ExtendedTextSourceLabel.java	Fri Sep 23 13:44:03 2016 -0700
@@ -550,13 +550,16 @@
     return charinfo;
   }
 
+  private static final boolean DEBUG = FontUtilities.debugFonts();
 /*
 * This takes the glyph info record obtained from the glyph vector and converts it into a similar record
 * adjusted to represent character data instead.  For economy we don't use glyph info records in this processing.
 *
 * Here are some constraints:
 * - there can be more glyphs than characters (glyph insertion, perhaps based on normalization, has taken place)
-* - there can not be fewer glyphs than characters (0xffff glyphs are inserted for characters ligaturized away)
+* - there can be fewer glyphs than characters
+*   Some layout engines may insert 0xffff glyphs for characters ligaturized away, but
+*   not all do, and it cannot be relied upon.
 * - each glyph maps to a single character, when multiple glyphs exist for a character they all map to it, but
 *   no two characters map to the same glyph
 * - multiple glyphs mapping to the same character need not be in sequence (thai, tamil have split characters)
@@ -578,7 +581,8 @@
 *
 * The algorithm works in the following way:
 * 1) we scan the glyphs ltr or rtl based on the bidi run direction
-* 2) we can work in place, since we always consume a glyph for each char we write
+* 2) Since the may be fewer glyphs than chars we cannot work in place.
+*    A new array is allocated for output.
 *    a) if the line is ltr, we start writing at position 0 until we finish, there may be leftver space
 *    b) if the line is rtl and 1-1, we start writing at position numChars/glyphs - 1 until we finish at 0
 *    c) otherwise if we don't finish at 0, we have to copy the data down
@@ -594,7 +598,7 @@
 *       iii) the x advance is the distance to the maximum x + adv of all glyphs whose advance is not zero
 *       iv) the y advance is the baseline
 *       v) vis x,y,w,h tightly encloses the vis x,y,w,h of all the glyphs with nonzero w and h
-* 4) we can make some simple optimizations if we know some things:
+* 4) In the future, we can make some simple optimizations to avoid copying if we know some things:
 *    a) if the mapping is 1-1, unidirectional, and there are no zero-adv glyphs, we just return the glyphinfo
 *    b) if the mapping is 1-1, unidirectional, we just adjust the remaining glyphs to originate at right/left of the base
 *    c) if the mapping is 1-1, we compute the base position and advance as we go, then go back to adjust the remaining glyphs
@@ -625,23 +629,20 @@
         System.out.println(source);
     }
 
-    /*
-    if ((gv.getDescriptionFlags() & 0x7) == 0) {
-        return glyphinfo;
-    }
-    */
-
     int numGlyphs = gv.getNumGlyphs();
     if (numGlyphs == 0) {
         return glyphinfo;
     }
     int[] indices = gv.getGlyphCharIndices(0, numGlyphs, null);
+    float[] charInfo = new float[source.getLength() * numvals];
 
-    boolean DEBUG = false;
     if (DEBUG) {
       System.err.println("number of glyphs: " + numGlyphs);
+      System.err.println("glyphinfo.len: " + glyphinfo.length);
+      System.err.println("indices.len: " + indices.length);
       for (int i = 0; i < numGlyphs; ++i) {
         System.err.println("g: " + i +
+            "  v: " + gv.getGlyphCode(i) +
             ", x: " + glyphinfo[i*numvals+posx] +
             ", a: " + glyphinfo[i*numvals+advx] +
             ", n: " + indices[i]);
@@ -650,22 +651,19 @@
 
     int minIndex = indices[0];  // smallest index seen this cluster
     int maxIndex = minIndex;    // largest index seen this cluster
-    int nextMin = 0;            // expected smallest index for this cluster
     int cp = 0;                 // character position
-    int cx = 0;                 // character index (logical)
+    int cc = 0;
     int gp = 0;                 // glyph position
     int gx = 0;                 // glyph index (visual)
     int gxlimit = numGlyphs;    // limit of gx, when we reach this we're done
     int pdelta = numvals;       // delta for incrementing positions
     int xdelta = 1;             // delta for incrementing indices
 
-    boolean ltr = (source.getLayoutFlags() & 0x1) == 0;
-    if (!ltr) {
+    boolean rtl = (source.getLayoutFlags() & 0x1) == 1;
+    if (rtl) {
         minIndex = indices[numGlyphs - 1];
         maxIndex = minIndex;
-        nextMin  = 0; // still logical
-        cp = glyphinfo.length - numvals;
-        cx = 0; // still logical
+        cp = charInfo.length - numvals;
         gp = glyphinfo.length - numvals;
         gx = numGlyphs - 1;
         gxlimit = -1;
@@ -693,47 +691,36 @@
     float cposl = 0, cposr = 0, cvisl = 0, cvist = 0, cvisr = 0, cvisb = 0;
     float baseline = 0;
 
-    // record if we have to copy data even when no cluster
-    boolean mustCopy = false;
-
     while (gx != gxlimit) {
         // start of new cluster
-        boolean haveCopy = false;
         int clusterExtraGlyphs = 0;
 
         minIndex = indices[gx];
         maxIndex = minIndex;
 
+        cposl = glyphinfo[gp + posx];
+        cposr = cposl + glyphinfo[gp + advx];
+        cvisl = glyphinfo[gp + visx];
+        cvist = glyphinfo[gp + visy];
+        cvisr = cvisl + glyphinfo[gp + visw];
+        cvisb = cvist + glyphinfo[gp + vish];
+
         // advance to next glyph
         gx += xdelta;
         gp += pdelta;
 
- /*
-        while (gx != gxlimit && (glyphinfo[gp + advx] == 0 ||
-                           minIndex != nextMin || indices[gx] <= maxIndex)) {
-  */
         while (gx != gxlimit &&
                ((glyphinfo[gp + advx] == 0) ||
-               (minIndex != nextMin) ||
                (indices[gx] <= maxIndex) ||
                (maxIndex - minIndex > clusterExtraGlyphs))) {
-            // initialize base data first time through, using base glyph
-            if (!haveCopy) {
-                int gps = gp - pdelta;
 
-                cposl = glyphinfo[gps + posx];
-                cposr = cposl + glyphinfo[gps + advx];
-                cvisl = glyphinfo[gps + visx];
-                cvist = glyphinfo[gps + visy];
-                cvisr = cvisl + glyphinfo[gps + visw];
-                cvisb = cvist + glyphinfo[gps + vish];
-
-                haveCopy = true;
+            ++clusterExtraGlyphs; // have an extra glyph in this cluster
+            if (DEBUG) {
+                System.err.println("gp=" +gp +" adv=" + glyphinfo[gp + advx] +
+                                   " gx="+ gx+ " i[gx]="+indices[gx] +
+                                   " clusterExtraGlyphs="+clusterExtraGlyphs);
             }
 
-            // have an extra glyph in this cluster
-            ++clusterExtraGlyphs;
-
             // adjust advance only if new glyph has non-zero advance
             float radvx = glyphinfo[gp + advx];
             if (radvx != 0) {
@@ -764,110 +751,90 @@
         // done with cluster, gx and gp are set for next glyph
 
         if (DEBUG) {
-            System.out.println("minIndex = " + minIndex + ", maxIndex = " + maxIndex);
+            System.err.println("minIndex = " + minIndex + ", maxIndex = " + maxIndex);
         }
 
-        nextMin = maxIndex + 1;
+        // save adjustments to the base character and do common adjustments.
+        charInfo[cp + posx] = cposl;
+        charInfo[cp + posy] = baseline;
+        charInfo[cp + advx] = cposr - cposl;
+        charInfo[cp + advy] = 0;
+        charInfo[cp + visx] = cvisl;
+        charInfo[cp + visy] = cvist;
+        charInfo[cp + visw] = cvisr - cvisl;
+        charInfo[cp + vish] = cvisb - cvist;
+        cc++;
 
-        // do common character adjustments
-        glyphinfo[cp + posy] = baseline;
-        glyphinfo[cp + advy] = 0;
+        /* We may have consumed multiple glyphs for this char position.
+         * Map those extra consumed glyphs to char positions that would follow
+         * up to the index prior to that which begins the next cluster.
+         * If we have reached the last glyph (reached gxlimit) then we need to
+         * map remaining unmapped chars to the same location as the last one.
+         */
+        int tgt;
+        if (gx == gxlimit) {
+           tgt = charInfo.length / numvals;
+        } else {
+           tgt = indices[gx]-1;
+        }
+        if (DEBUG) {
+           System.err.println("gx=" + gx + " gxlimit=" + gxlimit +
+                              " charInfo.len=" + charInfo.length +
+                              " tgt=" + tgt + " cc=" + cc + " cp=" + cp);
+        }
+        while (cc < tgt) {
+            if (rtl) {
+                // if rtl, characters to left of base, else to right.  reuse cposr.
+                cposr = cposl;
+            }
+            cvisr -= cvisl; // reuse, convert to deltas.
+            cvisb -= cvist;
 
-        if (haveCopy) {
-            // save adjustments to the base character
-            glyphinfo[cp + posx] = cposl;
-            glyphinfo[cp + advx] = cposr - cposl;
-            glyphinfo[cp + visx] = cvisl;
-            glyphinfo[cp + visy] = cvist;
-            glyphinfo[cp + visw] = cvisr - cvisl;
-            glyphinfo[cp + vish] = cvisb - cvist;
+            cp += pdelta;
 
-            // compare number of chars read with number of glyphs read.
-            // if more glyphs than chars, set mustCopy to true, as we'll always have
-            // to copy the data from here on out.
-            if (maxIndex - minIndex < clusterExtraGlyphs) {
-                mustCopy = true;
+            if (cp < 0 || cp >= charInfo.length) {
+                if (DEBUG)  {
+                    System.err.println("Error : cp=" + cp +
+                                       " charInfo.length=" + charInfo.length);
+                }
+                break;
             }
 
-            // Fix the characters that follow the base character.
-            // New values are all the same.  Note we fix the number of characters
-            // we saw, not the number of glyphs we saw.
-            if (minIndex < maxIndex) {
-                if (!ltr) {
-                    // if rtl, characters to left of base, else to right.  reuse cposr.
-                    cposr = cposl;
-                }
-                cvisr -= cvisl; // reuse, convert to deltas.
-                cvisb -= cvist;
-
-                int iMinIndex = minIndex, icp = cp / 8;
-
-                while (minIndex < maxIndex) {
-                    ++minIndex;
-                    cx += xdelta;
-                    cp += pdelta;
-
-                    if (cp < 0 || cp >= glyphinfo.length) {
-                        if (DEBUG) System.out.println("minIndex = " + iMinIndex + ", maxIndex = " + maxIndex + ", cp = " + icp);
-                    }
-
-                    glyphinfo[cp + posx] = cposr;
-                    glyphinfo[cp + posy] = baseline;
-                    glyphinfo[cp + advx] = 0;
-                    glyphinfo[cp + advy] = 0;
-                    glyphinfo[cp + visx] = cvisl;
-                    glyphinfo[cp + visy] = cvist;
-                    glyphinfo[cp + visw] = cvisr;
-                    glyphinfo[cp + vish] = cvisb;
-                }
+            if (DEBUG) {
+                System.err.println("Insert charIndex " + cc + " at pos="+cp);
             }
-
-            // no longer using this copy
-            haveCopy = false;
-        } else if (mustCopy) {
-            // out of synch, so we have to copy all the time now
-            int gpr = gp - pdelta;
-
-            glyphinfo[cp + posx] = glyphinfo[gpr + posx];
-            glyphinfo[cp + advx] = glyphinfo[gpr + advx];
-            glyphinfo[cp + visx] = glyphinfo[gpr + visx];
-            glyphinfo[cp + visy] = glyphinfo[gpr + visy];
-            glyphinfo[cp + visw] = glyphinfo[gpr + visw];
-            glyphinfo[cp + vish] = glyphinfo[gpr + vish];
+            charInfo[cp + posx] = cposr;
+            charInfo[cp + posy] = baseline;
+            charInfo[cp + advx] = 0;
+            charInfo[cp + advy] = 0;
+            charInfo[cp + visx] = cvisl;
+            charInfo[cp + visy] = cvist;
+            charInfo[cp + visw] = cvisr;
+            charInfo[cp + vish] = cvisb;
+            cc++;
         }
-        // else glyphinfo is already at the correct character position, and is unchanged, so just leave it
-
-        // reset for new cluster
-        cp += pdelta;
-        cx += xdelta;
-    }
-
-    if (mustCopy && !ltr) {
-        // data written to wrong end of array, need to shift down
-
-        cp -= pdelta; // undo last increment, get start of valid character data in array
-        System.arraycopy(glyphinfo, cp, glyphinfo, 0, glyphinfo.length - cp);
+        cp += pdelta; // reset for new cluster
     }
 
     if (DEBUG) {
-      char[] chars = source.getChars();
-      int start = source.getStart();
-      int length = source.getLength();
-      System.out.println("char info for " + length + " characters");
-      for(int i = 0; i < length * numvals;) {
-        System.out.println(" ch: " + Integer.toHexString(chars[start + v2l(i / numvals)]) +
-                           " x: " + glyphinfo[i++] +
-                           " y: " + glyphinfo[i++] +
-                           " xa: " + glyphinfo[i++] +
-                           " ya: " + glyphinfo[i++] +
-                           " l: " + glyphinfo[i++] +
-                           " t: " + glyphinfo[i++] +
-                           " w: " + glyphinfo[i++] +
-                           " h: " + glyphinfo[i++]);
+        char[] chars = source.getChars();
+        int start = source.getStart();
+        int length = source.getLength();
+        System.err.println("char info for " + length + " characters");
+
+        for (int i = 0; i < length * numvals;) {
+            System.err.println(" ch: " + Integer.toHexString(chars[start + v2l(i / numvals)]) +
+                               " x: " + charInfo[i++] +
+                               " y: " + charInfo[i++] +
+                               " xa: " + charInfo[i++] +
+                               " ya: " + charInfo[i++] +
+                               " l: " + charInfo[i++] +
+                               " t: " + charInfo[i++] +
+                               " w: " + charInfo[i++] +
+                               " h: " + charInfo[i++]);
       }
     }
-
-    return glyphinfo;
+    return charInfo;
   }
 
   /**
--- a/src/java.desktop/share/classes/sun/print/DialogOwner.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/sun/print/DialogOwner.java	Fri Sep 23 13:44:03 2016 -0700
@@ -25,9 +25,11 @@
 
 package sun.print;
 
+import java.awt.Dialog;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintRequestAttribute;
 import java.awt.Frame;
+import java.awt.Window;
 
 /**
  * Class DialogOwner is a printing attribute class that identifies
@@ -42,7 +44,7 @@
 public final class DialogOwner
     implements PrintRequestAttribute {
 
-    private Frame dlgOwner;
+    private Window dlgOwner;
 
     /**
      * Construct a new dialog owner attribute with the given frame.
@@ -53,11 +55,19 @@
         dlgOwner = frame;
     }
 
+    /**
+     * Construct a new dialog owner attribute with the given dialog.
+     *
+     * @param  dialog the dialog that owns the print dialog
+     */
+    public DialogOwner(Dialog dialog) {
+        dlgOwner = dialog;
+    }
 
     /**
      * Returns the string table for class DialogOwner.
      */
-    public Frame getOwner() {
+    public Window getOwner() {
         return dlgOwner;
     }
 
--- a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Fri Sep 23 13:44:03 2016 -0700
@@ -30,7 +30,6 @@
 import java.awt.Color;
 import java.awt.Dialog;
 import java.awt.Frame;
-import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsEnvironment;
@@ -39,7 +38,6 @@
 import java.awt.Rectangle;
 import java.awt.Shape;
 import java.awt.geom.AffineTransform;
-import java.awt.geom.Area;
 import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 import java.awt.image.BufferedImage;
@@ -55,7 +53,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.Locale;
 import sun.awt.image.ByteInterleavedRaster;
 
@@ -74,7 +71,6 @@
 import javax.print.attribute.PrintRequestAttributeSet;
 import javax.print.attribute.ResolutionSyntax;
 import javax.print.attribute.Size2DSyntax;
-import javax.print.attribute.standard.Chromaticity;
 import javax.print.attribute.standard.Copies;
 import javax.print.attribute.standard.Destination;
 import javax.print.attribute.standard.DialogTypeSelection;
@@ -96,11 +92,6 @@
 import javax.print.attribute.standard.SheetCollate;
 import javax.print.attribute.standard.Sides;
 
-import sun.print.PageableDoc;
-import sun.print.ServiceDialog;
-import sun.print.SunPrinterJobService;
-import sun.print.SunPageSelection;
-
 /**
  * A class which rasterizes a printer job.
  *
@@ -836,9 +827,16 @@
         Rectangle gcBounds = gc.getBounds();
         int x = gcBounds.x+50;
         int y = gcBounds.y+50;
-        ServiceDialog pageDialog = new ServiceDialog(gc, x, y, service,
-                                       DocFlavor.SERVICE_FORMATTED.PAGEABLE,
-                                       attributes, (Frame)null);
+        ServiceDialog pageDialog;
+        if (w instanceof Frame) {
+            pageDialog = new ServiceDialog(gc, x, y, service,
+                                           DocFlavor.SERVICE_FORMATTED.PAGEABLE,
+                                           attributes,(Frame)w);
+        } else {
+            pageDialog = new ServiceDialog(gc, x, y, service,
+                                           DocFlavor.SERVICE_FORMATTED.PAGEABLE,
+                                           attributes, (Dialog)w);
+        }
         Rectangle dlgBounds = pageDialog.getBounds();
 
         // if portion of dialog is not within the gc boundary
@@ -944,6 +942,14 @@
         Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
         if (w != null) {
             grCfg = w.getGraphicsConfiguration();
+             /* Add DialogOwner attribute to set the owner of this print dialog
+              * only if it is not set already
+              * (it might be set in java.awt.PrintJob.printDialog)
+              */
+            if (attributes.get(DialogOwner.class) == null) {
+                attributes.add(w instanceof Frame ? new DialogOwner((Frame)w) :
+                                                    new DialogOwner((Dialog)w));
+            }
         } else {
             grCfg = GraphicsEnvironment.getLocalGraphicsEnvironment().
                         getDefaultScreenDevice().getDefaultConfiguration();
@@ -1001,6 +1007,10 @@
         // temporarily add an attribute pointing back to this job.
         PrinterJobWrapper jobWrapper = new PrinterJobWrapper(this);
         attributes.add(jobWrapper);
+        PageRanges pgRng = (PageRanges)attributes.get(PageRanges.class);
+        if (pgRng == null && mDocument.getNumberOfPages() > 1) {
+            attributes.add(new PageRanges(1, mDocument.getNumberOfPages()));
+        }
         try {
             newService =
             ServiceUI.printDialog(gc, x, y,
@@ -1014,6 +1024,7 @@
                                   attributes);
         }
         attributes.remove(PrinterJobWrapper.class);
+        attributes.remove(DialogOwner.class);
 
         if (newService == null) {
             return false;
--- a/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/classes/sun/swing/CachedPainter.java	Fri Sep 23 13:44:03 2016 -0700
@@ -107,13 +107,16 @@
         ImageCache cache = getCache(key);
         Image image = cache.getImage(key, config, w, h, args);
         int attempts = 0;
+        VolatileImage volatileImage = (image instanceof VolatileImage)
+                ? (VolatileImage) image
+                : null;
         do {
             boolean draw = false;
-            if (image instanceof VolatileImage) {
+            if (volatileImage != null) {
                 // See if we need to recreate the image
-                switch (((VolatileImage)image).validate(config)) {
+                switch (volatileImage.validate(config)) {
                 case VolatileImage.IMAGE_INCOMPATIBLE:
-                    ((VolatileImage)image).flush();
+                    volatileImage.flush();
                     image = null;
                     break;
                 case VolatileImage.IMAGE_RESTORED:
@@ -126,11 +129,14 @@
                 image = createImage(c, w, h, config, args);
                 cache.setImage(key, config, w, h, args, image);
                 draw = true;
+                volatileImage = (image instanceof VolatileImage)
+                        ? (VolatileImage) image
+                        : null;
             }
             if (draw) {
                 // Render to the Image
                 Graphics2D g2 = (Graphics2D) image.getGraphics();
-                if (w != baseWidth || h != baseHeight) {
+                if (volatileImage == null && (w != baseWidth || h != baseHeight)) {
                     g2.scale((double) w / baseWidth, (double) h / baseHeight);
                 }
                 paintToImage(c, image, g2, baseWidth, baseHeight, args);
@@ -140,8 +146,8 @@
             // If we did this 3 times and the contents are still lost
             // assume we're painting to a VolatileImage that is bogus and
             // give up.  Presumably we'll be called again to paint.
-        } while ((image instanceof VolatileImage) &&
-                 ((VolatileImage)image).contentsLost() && ++attempts < 3);
+        } while ((volatileImage != null) &&
+                 volatileImage.contentsLost() && ++attempts < 3);
 
         return image;
     }
--- a/src/java.desktop/share/native/libfontmanager/HBShaper.c	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/native/libfontmanager/HBShaper.c	Fri Sep 23 13:44:03 2016 -0700
@@ -40,6 +40,7 @@
 static jfieldID gvdGlyphsFID = 0;
 static jfieldID gvdPositionsFID = 0;
 static jfieldID gvdIndicesFID = 0;
+static jmethodID gvdGrowMID = 0;
 static int jniInited = 0;
 
 static void getFloat(JNIEnv* env, jobject pt, jfloat *x, jfloat *y) {
@@ -63,73 +64,88 @@
     CHECK_NULL_RETURN(gvdGlyphsFID = (*env)->GetFieldID(env, gvdClass, "_glyphs", "[I"), 0);
     CHECK_NULL_RETURN(gvdPositionsFID = (*env)->GetFieldID(env, gvdClass, "_positions", "[F"), 0);
     CHECK_NULL_RETURN(gvdIndicesFID = (*env)->GetFieldID(env, gvdClass, "_indices", "[I"), 0);
+    CHECK_NULL_RETURN(gvdGrowMID = (*env)->GetMethodID(env, gvdClass, "grow", "()V"), 0);
     jniInited = 1;
     return jniInited;
 }
 
 // gmask is the composite font slot mask
 // baseindex is to be added to the character (code point) index.
-int storeGVData(JNIEnv* env,
-               jobject gvdata, jint slot, jint baseIndex, jobject startPt,
-               int glyphCount, hb_glyph_info_t *glyphInfo,
-               hb_glyph_position_t *glyphPos, hb_direction_t direction,
-               float devScale) {
+jboolean storeGVData(JNIEnv* env,
+                     jobject gvdata, jint slot,
+                     jint baseIndex, int offset, jobject startPt,
+                     int charCount, int glyphCount, hb_glyph_info_t *glyphInfo,
+                     hb_glyph_position_t *glyphPos, float devScale) {
 
-    int i;
+    int i, needToGrow;
     float x=0, y=0;
-    float startX, startY;
-    float scale = 1.0f/64.0f/devScale;
+    float startX, startY, advX, advY;
+    float scale = 1.0f / HBFloatToFixedScale / devScale;
     unsigned int* glyphs;
     float* positions;
-    int initialCount, glyphArrayLen, posArrayLen, maxGlyphs, storeadv;
+    int initialCount, glyphArrayLen, posArrayLen, maxGlyphs, storeadv, maxStore;
     unsigned int* indices;
     jarray glyphArray, posArray, inxArray;
 
     if (!init_JNI_IDs(env)) {
-        return 0;
+        return JNI_FALSE;
     }
 
     initialCount = (*env)->GetIntField(env, gvdata, gvdCountFID);
-    glyphArray =
-       (jarray)(*env)->GetObjectField(env, gvdata, gvdGlyphsFID);
-    posArray =
-        (jarray)(*env)->GetObjectField(env, gvdata, gvdPositionsFID);
-
-    if (glyphArray == NULL || posArray == NULL)
-    {
-        JNU_ThrowArrayIndexOutOfBoundsException(env, "");
-        return 0;
-    }
-
-    // The Java code catches the IIOBE and expands the storage
-    // and re-invokes layout. I suppose this is expected to be rare
-    // because at least in a single threaded case there should be
-    // re-use of the same container, but it is a little wasteful/distateful.
-    glyphArrayLen = (*env)->GetArrayLength(env, glyphArray);
-    posArrayLen = (*env)->GetArrayLength(env, posArray);
-    maxGlyphs = glyphCount + initialCount;
-    if ((maxGlyphs >  glyphArrayLen) ||
-        (maxGlyphs * 2 + 2 >  posArrayLen))
-    {
-        JNU_ThrowArrayIndexOutOfBoundsException(env, "");
-        return 0;
-    }
+    do {
+        glyphArray = (jarray)(*env)->GetObjectField(env, gvdata, gvdGlyphsFID);
+        posArray = (jarray)(*env)->GetObjectField(env, gvdata, gvdPositionsFID);
+        inxArray = (jarray)(*env)->GetObjectField(env, gvdata, gvdIndicesFID);
+        if (glyphArray == NULL || posArray == NULL || inxArray == NULL) {
+            JNU_ThrowArrayIndexOutOfBoundsException(env, "");
+            return JNI_FALSE;
+        }
+        glyphArrayLen = (*env)->GetArrayLength(env, glyphArray);
+        posArrayLen = (*env)->GetArrayLength(env, posArray);
+        maxGlyphs = (charCount > glyphCount) ? charCount : glyphCount;
+        maxStore = maxGlyphs + initialCount;
+        needToGrow = (maxStore > glyphArrayLen) ||
+                     (maxStore * 2 + 2 >  posArrayLen);
+        if (needToGrow) {
+            (*env)->CallVoidMethod(env, gvdata, gvdGrowMID);
+            if ((*env)->ExceptionCheck(env)) {
+                return JNI_FALSE;
+            }
+        }
+    } while (needToGrow);
 
     getFloat(env, startPt, &startX, &startY);
 
     glyphs =
         (unsigned int*)(*env)->GetPrimitiveArrayCritical(env, glyphArray, NULL);
+    if (glyphs == NULL) {
+        return JNI_FALSE;
+    }
     positions = (jfloat*)(*env)->GetPrimitiveArrayCritical(env, posArray, NULL);
+    if (positions == NULL) {
+        (*env)->ReleasePrimitiveArrayCritical(env, glyphArray, glyphs, 0);
+        return JNI_FALSE;
+    }
+    indices =
+        (unsigned int*)(*env)->GetPrimitiveArrayCritical(env, inxArray, NULL);
+    if (indices == NULL) {
+        (*env)->ReleasePrimitiveArrayCritical(env, glyphArray, glyphs, 0);
+        (*env)->ReleasePrimitiveArrayCritical(env, posArray, positions, 0);
+        return JNI_FALSE;
+    }
+
     for (i = 0; i < glyphCount; i++) {
         int storei = i + initialCount;
-        int index = glyphInfo[i].codepoint | slot;
-        if (i<glyphCount)glyphs[storei] = (unsigned int)index;
-        positions[(storei*2)] = startX + x + glyphPos[i].x_offset * scale;
-        positions[(storei*2)+1] = startY + y - glyphPos[i].y_offset * scale;
+        int cluster = glyphInfo[i].cluster - offset;
+        indices[storei] = baseIndex + cluster;
+        glyphs[storei] = (unsigned int)(glyphInfo[i].codepoint | slot);
+        positions[storei*2] = startX + x + glyphPos[i].x_offset * scale;
+        positions[(storei*2)+1] = startY + y + glyphPos[i].y_offset * scale;
         x += glyphPos[i].x_advance * scale;
         y += glyphPos[i].y_advance * scale;
+        storei++;
     }
-    storeadv = initialCount+glyphCount;
+    storeadv = initialCount + glyphCount;
     // The final slot in the positions array is important
     // because when the GlyphVector is created from this
     // data it determines the overall advance of the glyphvector
@@ -137,30 +153,17 @@
     // during rendering where text is broken into runs.
     // We also need to report it back into "pt", so layout can
     // pass it back down for that next run in this code.
-    positions[(storeadv*2)] = startX + x;
-    positions[(storeadv*2)+1] = startY + y;
+    advX = startX + x;
+    advY = startY + y;
+    positions[(storeadv*2)] = advX;
+    positions[(storeadv*2)+1] = advY;
     (*env)->ReleasePrimitiveArrayCritical(env, glyphArray, glyphs, 0);
     (*env)->ReleasePrimitiveArrayCritical(env, posArray, positions, 0);
-    putFloat(env, startPt,positions[(storeadv*2)],positions[(storeadv*2)+1] );
-    inxArray =
-        (jarray)(*env)->GetObjectField(env, gvdata, gvdIndicesFID);
-    indices =
-        (unsigned int*)(*env)->GetPrimitiveArrayCritical(env, inxArray, NULL);
-    for (i = 0; i < glyphCount; i++) {
-        int cluster = glyphInfo[i].cluster;
-        if (direction == HB_DIRECTION_LTR) {
-            // I need to understand what hb does when processing a substring
-            // I expected the cluster index to be from the start of the text
-            // to process.
-            // Instead it appears to be from the start of the whole thing.
-            indices[i+initialCount] = cluster;
-        } else {
-            indices[i+initialCount] = baseIndex + glyphCount -1 -i;
-        }
-    }
     (*env)->ReleasePrimitiveArrayCritical(env, inxArray, indices, 0);
-    (*env)->SetIntField(env, gvdata, gvdCountFID, initialCount+glyphCount);
-    return initialCount+glyphCount;
+    putFloat(env, startPt, advX, advY);
+    (*env)->SetIntField(env, gvdata, gvdCountFID, storeadv);
+
+    return JNI_TRUE;
 }
 
 static float euclidianDistance(float a, float b)
@@ -226,7 +229,9 @@
 }
 
 
-#define TYPO_RTL 0x80000000
+#define TYPO_KERN 0x00000001
+#define TYPO_LIGA 0x00000002
+#define TYPO_RTL  0x80000000
 
 JNIEXPORT jboolean JNICALL Java_sun_font_SunLayoutEngine_shape
     (JNIEnv *env, jclass cls,
@@ -255,10 +260,11 @@
      hb_glyph_info_t *glyphInfo;
      hb_glyph_position_t *glyphPos;
      hb_direction_t direction = HB_DIRECTION_LTR;
-     hb_feature_t *features =  NULL;
+     hb_feature_t *features = NULL;
      int featureCount = 0;
-
-     int i;
+     char* kern = (flags & TYPO_KERN) ? "kern" : "-kern";
+     char* liga = (flags & TYPO_LIGA) ? "liga" : "-liga";
+     jboolean ret;
      unsigned int buflen;
 
      JDKFontInfo *jdkFontInfo =
@@ -281,6 +287,8 @@
          direction = HB_DIRECTION_RTL;
      }
      hb_buffer_set_direction(buffer, direction);
+     hb_buffer_set_cluster_level(buffer,
+                                 HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
 
      chars = (*env)->GetCharArrayElements(env, text, NULL);
      if ((*env)->ExceptionCheck(env)) {
@@ -293,36 +301,26 @@
 
      hb_buffer_add_utf16(buffer, chars, len, offset, limit-offset);
 
+     features = calloc(2, sizeof(hb_feature_t));
+     if (features) {
+         hb_feature_from_string(kern, -1, &features[featureCount++]);
+         hb_feature_from_string(liga, -1, &features[featureCount++]);
+     }
+
      hb_shape_full(hbfont, buffer, features, featureCount, 0);
      glyphCount = hb_buffer_get_length(buffer);
      glyphInfo = hb_buffer_get_glyph_infos(buffer, 0);
      glyphPos = hb_buffer_get_glyph_positions(buffer, &buflen);
-     for (i = 0; i < glyphCount; i++) {
-         int index = glyphInfo[i].codepoint;
-         int xadv = (glyphPos[i].x_advance);
-         int yadv = (glyphPos[i].y_advance);
-     }
-     // On "input" HB assigns a cluster index to each character in UTF-16.
-     // On output where a sequence of characters have been mapped to
-     // a glyph they are all mapped to the cluster index of the first character.
-     // The next cluster index will be that of the first character in the
-     // next cluster. So cluster indexes may 'skip' on output.
-     // This can also happen if there are supplementary code-points
-     // such that two UTF-16 characters are needed to make one codepoint.
-     // In RTL text you need to count down.
-     // So the following code tries to build the reverse map as expected
-     // by calling code.
 
-     storeGVData(env, gvdata, slot, baseIndex, startPt,
-                 glyphCount, glyphInfo, glyphPos, direction,
-                 jdkFontInfo->devScale);
+     ret = storeGVData(env, gvdata, slot, baseIndex, offset, startPt,
+                       limit - offset, glyphCount, glyphInfo, glyphPos,
+                       jdkFontInfo->devScale);
 
      hb_buffer_destroy (buffer);
      hb_font_destroy(hbfont);
      free((void*)jdkFontInfo);
      if (features != NULL) free(features);
      (*env)->ReleaseCharArrayElements(env, text, chars, JNI_ABORT);
-
-     return JNI_TRUE;
+     return ret;
 }
 
--- a/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc	Fri Sep 23 13:44:03 2016 -0700
@@ -55,10 +55,6 @@
     return (*glyph != 0);
 }
 
-// This is also define in freetypescaler.c and similar macros are
-// in fontscalerdefs.h. Consider tidying this up.
-#define FloatToF26Dot6(x) ((unsigned int) ((x)*64))
-
 static hb_position_t
 hb_jdk_get_glyph_h_advance (hb_font_t *font HB_UNUSED,
 			   void *font_data,
@@ -84,7 +80,7 @@
     fadv *= jdkFontInfo->devScale;
     env->DeleteLocalRef(pt);
 
-    return FloatToF26Dot6(fadv); // should this round ?
+    return HBFloatToFixed(fadv);
 }
 
 static hb_position_t
@@ -111,7 +107,7 @@
     fadv = env->GetFloatField(pt, sunFontIDs.yFID);
     env->DeleteLocalRef(pt);
 
-    return FloatToF26Dot6(fadv); // should this round ?
+    return HBFloatToFixed(fadv);
   
 }
 
@@ -205,8 +201,8 @@
         *x = 0; *y = 0;
         return true;
     }
-    *x = FloatToF26Dot6(env->GetFloatField(pt, sunFontIDs.xFID));
-    *y = FloatToF26Dot6(env->GetFloatField(pt, sunFontIDs.yFID));
+    *x = HBFloatToFixed(env->GetFloatField(pt, sunFontIDs.xFID));
+    *y = HBFloatToFixed(env->GetFloatField(pt, sunFontIDs.yFID));
     env->DeleteLocalRef(pt);
 
   return true;
@@ -325,8 +321,8 @@
                        _hb_jdk_get_font_funcs (),
                        jdkFontInfo, (hb_destroy_func_t) _do_nothing);
     hb_font_set_scale (font,
-                      FloatToF26Dot6(jdkFontInfo->ptSize*jdkFontInfo->devScale),
-                      FloatToF26Dot6(jdkFontInfo->ptSize*jdkFontInfo->devScale));
+                      HBFloatToFixed(jdkFontInfo->ptSize*jdkFontInfo->devScale),
+                      HBFloatToFixed(jdkFontInfo->ptSize*jdkFontInfo->devScale));
   return font;
 }
 
@@ -343,8 +339,8 @@
     hb_face_destroy(face);
 
     hb_font_set_scale(font,
-                     FloatToF26Dot6(jdkFontInfo->ptSize),
-                     FloatToF26Dot6(jdkFontInfo->ptSize));
+                     HBFloatToFixed(jdkFontInfo->ptSize),
+                     HBFloatToFixed(jdkFontInfo->ptSize));
     return font;
 }
 #endif
--- a/src/java.desktop/share/native/libfontmanager/hb-jdk.h	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/native/libfontmanager/hb-jdk.h	Fri Sep 23 13:44:03 2016 -0700
@@ -48,6 +48,10 @@
 } JDKFontInfo;
 
 
+// Use 16.16 for better precision than 26.6
+#define HBFloatToFixedScale ((float)(1 << 16))
+#define HBFloatToFixed(f) ((unsigned int)((f) * HBFloatToFixedScale))
+
 /*
  * Note:
  *
--- a/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c	Fri Sep 23 13:44:03 2016 -0700
@@ -2162,6 +2162,25 @@
 }
 
 JNIEXPORT void JNICALL
+Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_clearNativeReadAbortFlag
+    (JNIEnv *env,
+    jobject this,
+    jlong ptr) {
+
+    imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
+
+    if (data == NULL) {
+        JNU_ThrowByName(env,
+            "java/lang/IllegalStateException",
+            "Attempting to use reader after dispose()");
+        return;
+    }
+
+    data->abortFlag = JNI_FALSE;
+
+}
+
+JNIEXPORT void JNICALL
 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_abortRead
     (JNIEnv *env,
      jobject this,
--- a/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1570,6 +1570,10 @@
                                   Integer.valueOf(getMultiClickTime()));
             desktopProperties.put("awt.mouse.numButtons",
                                   Integer.valueOf(getNumberOfButtons()));
+            if(SunGraphicsEnvironment.isUIScaleEnabled()) {
+                addPropertyChangeListener("gnome.Xft/DPI", evt ->
+                                                     localEnv.displayChanged());
+            }
         }
     }
 
--- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java	Fri Sep 23 13:44:03 2016 -0700
@@ -63,7 +63,7 @@
     private SunDisplayChanger topLevels = new SunDisplayChanger();
     private DisplayMode origDisplayMode;
     private boolean shutdownHookRegistered;
-    private final int scale;
+    private int scale;
 
     public X11GraphicsDevice(int screennum) {
         this.screen = screennum;
@@ -488,6 +488,7 @@
      * X11GraphicsEnvironment when the display mode has been changed.
      */
     public synchronized void displayChanged() {
+        scale = initScaleFactor();
         // On X11 the visuals do not change, and therefore we don't need
         // to reset the defaultConfig, config, doubleBufferVisuals,
         // neither do we need to reset the native data.
--- a/src/java.desktop/unix/native/common/awt/systemscale/systemScale.c	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/unix/native/common/awt/systemscale/systemScale.c	Fri Sep 23 13:44:03 2016 -0700
@@ -148,7 +148,7 @@
                         void *scale = fp_g_variant_get_child_value(entry, 1);
                         if (screen && scale) {
                             char *name = fp_g_variant_get_string(screen, NULL);
-                            if (name && strcmp(name, output_name)) {
+                            if (name && !strcmp(name, output_name)) {
                                 result = fp_g_variant_get_int32(scale) / 8.;
                             }
                             fp_g_variant_unref(screen);
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c	Fri Sep 23 13:44:03 2016 -0700
@@ -442,7 +442,7 @@
 
 #ifndef __linux__ /* SOLARIS */
         if (xrenderLibHandle == NULL) {
-            xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
+            xrenderLibHandle = dlopen("/usr/lib/libXrender.so.1",
                                       RTLD_LAZY | RTLD_GLOBAL);
         }
 #endif
@@ -2181,7 +2181,8 @@
 JNIEXPORT jdouble JNICALL
 Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor
     (JNIEnv *env, jobject this, jint screen) {
-    char *name = get_output_screen_name(env, screen);
+    // in case of Xinerama individual screen scales are not supported
+    char *name = get_output_screen_name(env, usingXinerama ? 0 : screen);
     double scale = getNativeScaleFactor(name);
     if (name) {
         free(name);
--- a/src/java.desktop/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -303,10 +303,10 @@
             if (bb instanceof DestSurfaceProvider) {
                 Surface s = ((DestSurfaceProvider)bb).getDestSurface();
                 if (s instanceof AccelSurface) {
-                    final int w = bb.getWidth(null);
-                    final int h = bb.getHeight(null);
                     final boolean arr[] = { false };
                     final AccelSurface as = (AccelSurface)s;
+                    final int w = as.getBounds().width;
+                    final int h = as.getBounds().height;
                     RenderQueue rq = as.getContext().getRenderQueue();
                     rq.lock();
                     try {
--- a/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java	Fri Sep 23 13:44:03 2016 -0700
@@ -478,9 +478,12 @@
         }
 
         DialogOwner dlgOwner = (DialogOwner)attributes.get(DialogOwner.class);
-        Frame ownerFrame = (dlgOwner != null) ? dlgOwner.getOwner() : null;
+        Window owner = (dlgOwner != null) ? dlgOwner.getOwner() : null;
 
-        WPrintDialog dialog = new WPrintDialog(ownerFrame, this);
+        WPrintDialog dialog =  (owner instanceof Frame) ?
+                new WPrintDialog((Frame)owner, this) :
+                new WPrintDialog((Dialog)owner, this);
+
         dialog.setRetVal(false);
         dialog.setVisible(true);
         boolean prv = dialog.getRetVal();
@@ -498,8 +501,9 @@
                 title = rb.getString("dialog.printtofile");
             } catch (MissingResourceException e) {
             }
-            FileDialog fileDialog = new FileDialog(ownerFrame, title,
-                                                   FileDialog.SAVE);
+            FileDialog fileDialog = (owner instanceof Frame) ?
+                    new FileDialog((Frame)owner, title, FileDialog.SAVE) :
+                    new FileDialog((Dialog)owner, title, FileDialog.SAVE);
 
             URI destURI = dest.getURI();
             // Old code destURI.getPath() would return null for "file:out.prn"
@@ -531,10 +535,17 @@
                    ((pFile != null) &&
                       (!pFile.exists() || (pFile.exists() && !pFile.canWrite())))) {
 
-                (new PrintToFileErrorDialog(ownerFrame,
+                if (owner instanceof Frame) {
+                    (new PrintToFileErrorDialog((Frame)owner,
                                 ServiceDialog.getMsg("dialog.owtitle"),
                                 ServiceDialog.getMsg("dialog.writeerror")+" "+fullName,
                                 ServiceDialog.getMsg("button.ok"))).setVisible(true);
+                } else {
+                    (new PrintToFileErrorDialog((Dialog)owner,
+                                ServiceDialog.getMsg("dialog.owtitle"),
+                                ServiceDialog.getMsg("dialog.writeerror")+" "+fullName,
+                                ServiceDialog.getMsg("button.ok"))).setVisible(true);
+                }
 
                 fileDialog.setVisible(true);
                 fileName = fileDialog.getFile();
--- a/src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/ThemeReader.cpp	Fri Sep 23 13:44:03 2016 -0700
@@ -753,10 +753,15 @@
 }
 
 void rescale(SIZE *size) {
-    HWND hWnd = ::GetDesktopWindow();
-    HDC hDC = ::GetDC(hWnd);
-    int dpiX = ::GetDeviceCaps(hDC, LOGPIXELSX);
-    int dpiY = ::GetDeviceCaps(hDC, LOGPIXELSY);
+    static int dpiX = -1;
+    static int dpiY = -1;
+    if (dpiX == -1 || dpiY == -1) {
+        HWND hWnd = ::GetDesktopWindow();
+        HDC hDC = ::GetDC(hWnd);
+        dpiX = ::GetDeviceCaps(hDC, LOGPIXELSX);
+        dpiY = ::GetDeviceCaps(hDC, LOGPIXELSY);
+        ::ReleaseDC(hWnd, hDC);
+    }
 
     if (dpiX !=0 && dpiX != 96) {
         float invScaleX = 96.0f / dpiX;
@@ -766,7 +771,6 @@
         float invScaleY = 96.0f / dpiY;
         size->cy = ROUND_TO_INT(size->cy * invScaleY);
     }
-    ::ReleaseDC(hWnd, hDC);
 }
 
 /*
--- a/src/java.desktop/windows/native/libawt/windows/awt_DesktopProperties.cpp	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_DesktopProperties.cpp	Fri Sep 23 13:44:03 2016 -0700
@@ -88,11 +88,16 @@
 }
 
 void getInvScale(float &invScaleX, float &invScaleY) {
-    HWND hWnd = ::GetDesktopWindow();
-    HDC hDC = ::GetDC(hWnd);
-    int dpiX = ::GetDeviceCaps(hDC, LOGPIXELSX);
-    int dpiY = ::GetDeviceCaps(hDC, LOGPIXELSY);
-    ::ReleaseDC(hWnd, hDC);
+    static int dpiX = -1;
+    static int dpiY = -1;
+    if (dpiX == -1 || dpiY == -1) {
+        HWND hWnd = ::GetDesktopWindow();
+        HDC hDC = ::GetDC(hWnd);
+        dpiX = ::GetDeviceCaps(hDC, LOGPIXELSX);
+        dpiY = ::GetDeviceCaps(hDC, LOGPIXELSY);
+        ::ReleaseDC(hWnd, hDC);
+    }
+
     invScaleX = (dpiX == 0.0f) ? 1.0f : 96.0f / dpiX;
     invScaleY = (dpiY == 0.0f) ? 1.0f : 96.0f / dpiY;
 }
--- a/src/java.desktop/windows/native/libawt/windows/awt_Taskbar.cpp	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Taskbar.cpp	Fri Sep 23 13:44:03 2016 -0700
@@ -108,7 +108,7 @@
 JNIEXPORT void JNICALL Java_sun_awt_windows_WTaskbarPeer_flashWindow
   (JNIEnv *, jobject, jlong window)
 {
-    AwtWindow::FlashWindowEx((HWND) window, 3, 0, FLASHW_TIMERNOFG);
+    ::FlashWindow((HWND) window, TRUE);
 }
 
 /*
--- a/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Secmod.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/Secmod.java	Fri Sep 23 13:44:03 2016 -0700
@@ -45,7 +45,7 @@
  * <pre>
  *   Secmod secmod = Secmod.getInstance();
  *   if (secmod.isInitialized() == false) {
- *       secmod.initialize("/home/myself/.mozilla", "/usr/sfw/lib/mozilla");
+ *       secmod.initialize("/home/myself/.mozilla");
  *   }
  *
  *   Provider p = secmod.getModule(ModuleType.KEYSTORE).getProvider();
--- a/src/jdk.jdi/share/classes/module-info.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/jdk.jdi/share/classes/module-info.java	Fri Sep 23 13:44:03 2016 -0700
@@ -25,6 +25,7 @@
 
 module jdk.jdi {
     requires jdk.attach;
+    requires jdk.jdwp.agent;
 
     exports com.sun.jdi;
     exports com.sun.jdi.connect;
--- a/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_be_BY.properties	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/jdk.localedata/share/classes/sun/util/resources/ext/CurrencyNames_be_BY.properties	Fri Sep 23 13:44:03 2016 -0700
@@ -35,4 +35,5 @@
 # This notice and attribution to Taligent may not be removed.
 # Taligent is a registered trademark of Taligent, Inc.
 
+BYN=\u0420\u0443\u0431
 BYR=\u0420\u0443\u0431
--- a/src/jdk.rmic/share/classes/sun/tools/javac/resources/javac.properties	Wed Sep 21 12:53:07 2016 -0700
+++ b/src/jdk.rmic/share/classes/sun/tools/javac/resources/javac.properties	Fri Sep 23 13:44:03 2016 -0700
@@ -265,8 +265,6 @@
 	No constructor matching {0} found in {1}.
 javac.err.wrong.number.args=\
 	Wrong number of arguments in {0}.
-javac.err.wrong.number.args=\
-	Wrong number of arguments in {0}.
 javac.err.forward.ref=\
 	Can''t make forward reference to {0} in {1}.
 javac.err.array.dim.missing=\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Focus/ModalDialogActivationTest/ModalDialogActivationTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+/*
+  @test
+  @bug       8160570
+  @summary   Tests that a modal dialog receives WINDOW_ACTIVATED & WINDOW_GAINED_FOCUS on first show.
+*/
+public class ModalDialogActivationTest {
+    static final Object lock = new Object();
+    static volatile boolean activated;
+    static volatile boolean focused;
+
+    public static void main(String[] args) throws InterruptedException {
+        EventQueue.invokeLater(() -> runGUI());
+
+        long time = System.currentTimeMillis();
+        synchronized (lock) {
+            while (!activated || !focused) {
+                lock.wait(5000);
+                if (System.currentTimeMillis() - time >= 5000) break;
+            }
+        }
+        if (!activated || !focused) {
+            throw new RuntimeException("Test FAILED: activated: " + activated + ", focused: " + focused);
+        }
+        System.out.println("Test PASSED");
+    }
+
+    static void runGUI() {
+        JFrame f = new JFrame("frame");
+        final JDialog d = new MyModalDialog(f, "dialog");
+        d.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowActivated(WindowEvent e) {
+                synchronized (lock) {
+                    activated = true;
+                    lock.notifyAll();
+                }
+            }
+        });
+        d.addWindowFocusListener(new WindowAdapter() {
+            @Override
+            public void windowGainedFocus(WindowEvent e) {
+                synchronized (lock) {
+                    focused = true;
+                    lock.notifyAll();
+                }
+            }
+        });
+        f.setVisible(true);
+        d.setVisible(true);
+    }
+
+    static class MyModalDialog extends JDialog {
+        public MyModalDialog(Frame owner, String title)ยช {
+            super(owner, title, true);
+        }
+
+        @Override
+        public boolean getFocusableWindowState() {
+            try {
+                // let Toolkit thread go ahead
+                Thread.sleep(100);
+            } catch (InterruptedException ignore) {
+            }
+            return super.getFocusableWindowState();
+        }
+    }
+}
--- a/test/java/awt/Focus/SortingFPT/JDK8048887.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/awt/Focus/SortingFPT/JDK8048887.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,7 +23,7 @@
 
 /*
   @test
-  @bug       8048887
+  @bug       8048887 8164937
   @summary   Tests SortingFTP for an exception caused by the tim-sort algo.
   @author    anton.tarasov: area=awt.focus
   @run       main JDK8048887
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Mouse/EnterExitEvents/ModalDialogEnterExitEventsTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,129 @@
+/*
+ * 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
+ * @key headful
+ * @bug 8050478
+ * @summary Cursor not updating correctly after closing a modal dialog.
+ *    The root cause of the issue was the lack of a mouse exit event
+ *    during displaying of a modal dialog.
+ * @author Dmitry Markov
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main ModalDialogEnterExitEventsTest
+ */
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.Robot;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class ModalDialogEnterExitEventsTest {
+    private static volatile AtomicInteger mouseEnterCount = new AtomicInteger();
+    private static volatile AtomicInteger mouseExitCount = new AtomicInteger();
+
+    private static JFrame frame;
+    private static JButton openButton;
+    private static JButton closeButton;
+
+    public static void main(String[] args) {
+        Robot robot = Util.createRobot();
+
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+        Util.waitForIdle(robot);
+
+        Util.clickOnComp(frame, robot, 500);
+        Util.waitForIdle(robot);
+
+        mouseEnterCount.set(0);
+        mouseExitCount.set(0);
+
+        Util.clickOnComp(openButton, robot, 500);
+        Util.waitForIdle(robot);
+        if (mouseExitCount.get() != 1) {
+            throw new RuntimeException("Test FAILED. Wrong number of MouseExited events = " + mouseExitCount.get());
+        }
+
+        Util.clickOnComp(closeButton, robot, 500);
+        Util.waitForIdle(robot);
+        if (mouseEnterCount.get() != 1) {
+            throw new RuntimeException("Test FAILED. Wrong number of MouseEntered events = "+ mouseEnterCount.get());
+        }
+    }
+
+    private static void createAndShowGUI() {
+        frame = new JFrame("ModalDialogEnterExitEventsTest");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setLayout(new FlowLayout());
+        frame.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mouseExited(MouseEvent e) {
+                mouseExitCount.getAndIncrement();
+            }
+
+            @Override
+            public void mouseEntered(MouseEvent e) {
+                mouseEnterCount.getAndIncrement();
+            }
+        });
+        openButton = new JButton("Open Dialog");
+        openButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                JDialog dialog = new JDialog(frame, "Modal Dialog", true);
+                dialog.setLayout(new FlowLayout());
+                closeButton = new JButton("Close");
+                closeButton.addActionListener(new ActionListener() {
+                    @Override
+                    public void actionPerformed(ActionEvent e) {
+                        dialog.dispose();
+                    }
+                });
+                dialog.add(closeButton);
+                dialog.setSize(200, 200);
+                dialog.setLocationRelativeTo(null);
+                dialog.setVisible(true);
+            }
+        });
+        frame.add(openButton);
+        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
+        frame.setVisible(true);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/font/GlyphVector/GetGlyphCharIndexTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary Test getGlyphCharIndex() results from layout
+ * @bug 8152680
+ */
+
+import java.awt.Font;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+
+public class GetGlyphCharIndexTest {
+    public static void main(String[] args) {
+        Font font = new Font(Font.MONOSPACED, Font.PLAIN, 12);
+        FontRenderContext frc = new FontRenderContext(null, false, false);
+        GlyphVector gv = font.layoutGlyphVector(frc, "abc".toCharArray(), 1, 3,
+                                                Font.LAYOUT_LEFT_TO_RIGHT);
+        int idx0 = gv.getGlyphCharIndex(0);
+        if (idx0 != 0) {
+           throw new RuntimeException("Expected 0, got " + idx0);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/font/LineBreakMeasurer/TestLineBreakWithFontSub.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 4175418 8158924
+ * @author John Raley
+ * @summary This insures that bug 4175418: Font substitution in TextLayout /
+ * LineBreakMeasurer is inconsistent has been fixed.  The problem was
+ * that text was measured in one Font, but lines were produced
+ * in a different font.
+ */
+
+/*
+ * (C) Copyright IBM Corp. 1999, All Rights Reserved
+ */
+
+import java.text.AttributedString;
+import java.awt.font.LineBreakMeasurer;
+import java.awt.font.TextLayout;
+import java.awt.font.FontRenderContext;
+import java.awt.font.TextAttribute;
+
+/**
+ * This insures that bug 4175418: Font substitution in TextLayout /
+ * LineBreakMeasurer is inconsistent has been fixed.  The problem was
+ * that text was measured in one Font, but lines were produced
+ * in a different font.  One symptom of this problem is that lines are
+ * either too short or too long.  This test line-breaks a paragraph
+ * and checks the line lengths to make sure breaks were chosen well.
+ * This can be checked because the paragraph is so simple.
+ */
+public class TestLineBreakWithFontSub {
+
+    public static void main(String[] args) {
+
+        new TestLineBreakWithFontSub().test();
+        System.out.println("Line break / font substitution test PASSED");
+    }
+
+    private static final String WORD = "word";
+    private static final String SPACING = " ";
+    // The Hebrew character in this string can trigger font substitution
+    private static final String MIXED = "A\u05D0";
+
+    private static final int NUM_WORDS = 12;
+
+    private static final FontRenderContext DEFAULT_FRC =
+                            new FontRenderContext(null, false, false);
+
+    public void test() {
+
+        // construct a paragraph as follows: MIXED + [SPACING + WORD] + ...
+        StringBuffer text = new StringBuffer(MIXED);
+        for (int i=0; i < NUM_WORDS; i++) {
+            text.append(SPACING);
+            text.append(WORD);
+        }
+
+        AttributedString attrString = new AttributedString(text.toString());
+        attrString.addAttribute(TextAttribute.SIZE, new Float(24.0));
+
+        LineBreakMeasurer measurer = new LineBreakMeasurer(attrString.getIterator(),
+                                                           DEFAULT_FRC);
+
+        // get width of a space-word sequence, in context
+        int sequenceLength = WORD.length()+SPACING.length();
+        measurer.setPosition(text.length() - sequenceLength);
+
+        TextLayout layout = measurer.nextLayout(10000.0f);
+
+        if (layout.getCharacterCount() != sequenceLength) {
+            throw new Error("layout length is incorrect!");
+        }
+
+        final float sequenceAdvance = layout.getVisibleAdvance();
+
+        float wrappingWidth = sequenceAdvance * 2;
+
+        // now run test with a variety of widths
+        while (wrappingWidth < (sequenceAdvance*NUM_WORDS)) {
+            measurer.setPosition(0);
+            checkMeasurer(measurer,
+                          wrappingWidth,
+                          sequenceAdvance,
+                          text.length());
+            wrappingWidth += sequenceAdvance / 5;
+        }
+    }
+
+    /**
+     * Iterate through measurer and check that every line is
+     * not too long and not too short, but just right.
+     */
+    private void checkMeasurer(LineBreakMeasurer measurer,
+                               float wrappingWidth,
+                               float sequenceAdvance,
+                               int endPosition) {
+
+        do {
+            TextLayout layout = measurer.nextLayout(wrappingWidth);
+            float visAdvance = layout.getVisibleAdvance();
+
+            // Check that wrappingWidth-sequenceAdvance < visAdvance
+            // Also, if we're not at the end of the paragraph,
+            // check that visAdvance <= wrappingWidth
+
+            if (visAdvance > wrappingWidth) {
+                // line is too long for given wrapping width
+                throw new Error("layout is too long");
+            }
+
+            if (measurer.getPosition() < endPosition) {
+                if (visAdvance <= wrappingWidth - sequenceAdvance) {
+                    // line is too short for given wrapping width;
+                    // another word would have fit
+                    throw new Error("room for more words on line.  diff=" +
+                                    (wrappingWidth - sequenceAdvance - visAdvance));
+                }
+            }
+        } while (measurer.getPosition() != endPosition);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/font/TextLayout/LigatureCaretTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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 4178145 8144015
+*/
+
+/*
+ * Copyright 1998 IBM Corp.  All Rights Reserved.
+ */
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.font.TextAttribute;
+import java.awt.font.TextLayout;
+import java.awt.font.TextHitInfo;
+import java.awt.font.FontRenderContext;
+import java.util.Hashtable;
+
+/**
+ * This test ensures that TextLayout will not place a caret within
+ * an Arabic lam-alef ligature, and will correctly caret through
+ * bidirectional text with numbers.
+ */
+
+public class LigatureCaretTest {
+
+    public static void main(String[] args) {
+
+        //testBidiWithNumbers();
+        testLamAlef();
+        System.out.println("LigatureCaretTest PASSED");
+    }
+
+    // These values are for TextLayout constructors
+    private static final Hashtable map = new Hashtable();
+    static {
+      map.put(TextAttribute.FONT, new Font("Lucida Sans", Font.PLAIN, 24));
+    }
+    private static final FontRenderContext frc =
+                                new FontRenderContext(null, false, false);
+
+    /**
+     * Caret through text mixed-direction text and check the results.
+     * If the test fails an Error is thrown.
+     * @exception an Error is thrown if the test fails
+     */
+    public static void testBidiWithNumbers() {
+
+        String bidiWithNumbers = "abc\u05D0\u05D1\u05D2123abc";
+        // visual order for the text:
+        // abc123<gimel><bet><aleph>abc
+
+        int[] carets = { 0, 1, 2, 3, 7, 8, 6, 5, 4, 9, 10, 11, 12 };
+        TextLayout layout = new TextLayout(bidiWithNumbers, map, frc);
+
+        // Caret through TextLayout in both directions and check results.
+        for (int i=0; i < carets.length-1; i++) {
+
+            TextHitInfo hit = layout.getNextRightHit(carets[i]);
+            if (hit.getInsertionIndex() != carets[i+1]) {
+                throw new Error("right hit failed within layout");
+            }
+        }
+
+        if (layout.getNextRightHit(carets[carets.length-1]) != null) {
+            throw new Error("right hit failed at end of layout");
+        }
+
+        for (int i=carets.length-1; i > 0; i--) {
+
+            TextHitInfo hit = layout.getNextLeftHit(carets[i]);
+            if (hit.getInsertionIndex() != carets[i-1]) {
+                throw new Error("left hit failed within layout");
+            }
+        }
+
+        if (layout.getNextLeftHit(carets[0]) != null) {
+            throw new Error("left hit failed at end of layout");
+        }
+    }
+
+    /**
+     * Ensure proper careting and hit-testing behavior with
+     * a lam-alef ligature.
+     * If the test fails, an Error is thrown.
+     * @exception an Error is thrown if the test fails
+     */
+    public static void testLamAlef() {
+
+        // lam-alef form a mandantory ligature.
+        final String lamAlef = "\u0644\u0627";
+        final String ltrText = "abcd";
+
+        // Create a TextLayout with just a lam-alef sequence.  There
+        // should only be two valid caret positions:  one at
+        // insertion offset 0 and the other at insertion offset 2.
+        TextLayout layout = new TextLayout(lamAlef, map, frc);
+
+        TextHitInfo hit;
+
+        hit = layout.getNextLeftHit(0);
+        if (hit.getInsertionIndex() != 2) {
+            throw new Error("Left hit failed.  Hit:" + hit);
+        }
+
+        hit = layout.getNextRightHit(2);
+        if (hit.getInsertionIndex() != 0) {
+            throw new Error("Right hit failed.  Hit:" + hit);
+        }
+
+        hit = layout.hitTestChar(layout.getAdvance()/2, 0);
+        if (hit.getInsertionIndex() != 0 && hit.getInsertionIndex() != 2) {
+            throw new Error("Hit-test allowed incorrect caret.  Hit:" + hit);
+        }
+
+
+        // Create a TextLayout with some left-to-right text
+        // before the lam-alef sequence.  There should not be
+        // a caret position between the lam and alef.
+        layout = new TextLayout(ltrText+lamAlef, map, frc);
+
+        final int ltrLen = ltrText.length();
+        final int layoutLen = layout.getCharacterCount();
+
+        for (int i=0; i < ltrLen; i++) {
+            hit = layout.getNextRightHit(i);
+            if (hit.getInsertionIndex() != i+1) {
+                throw new Error("Right hit failed in ltr text.");
+            }
+        }
+
+        hit = layout.getNextRightHit(ltrLen);
+        if (layoutLen != hit.getInsertionIndex()) {
+            throw new Error("Right hit failed at direction boundary.");
+        }
+
+        hit = layout.getNextLeftHit(layoutLen);
+        if (hit.getInsertionIndex() != ltrLen) {
+            throw new Error("Left hit failed at end of text.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/font/TextLayout/TestJustification.html	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,52 @@
+<!--
+ Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+ 
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+ 
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ 
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+--> 
+
+<html>
+<head>
+<title>Test Justification</title>
+</head>
+<body>
+<!--
+ @test
+ @bug 4211728 4178140 8145542
+ @summary Justify several lines of text and verify that the lines are the same
+ length and cursor positions are correct.
+Bug 4211728:  TextLayout.draw() draws characters at wrong position.
+Bug 4178140:  TextLayout does not justify
+ @run applet/manual=yesno TestJustification.html
+-->
+<h3>Test Justification</h1>
+<hr>
+<p>Five lines of text should appear, all justified to the same width,
+followed by a sixth line containing only roman characters and no spaces
+which is not justified, and instead is centered.
+Carets should appear between all characters. Pass the test if this is
+true.
+<p>
+<applet code=TestJustification.class width=500 height=500>
+alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
+Your browser is completely ignoring the &lt;APPLET&gt; tag!
+</applet>
+</body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/font/TextLayout/TestJustification.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/*
+ *
+ * See TestJustification.html for main test.
+ */
+
+import java.applet.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.font.*;
+import java.awt.geom.*;
+import java.text.*;
+
+public class TestJustification extends Applet {
+  JustificationPanel panel;
+
+  public void init() {
+    setLayout(new BorderLayout());
+    panel = new JustificationPanel("Bitstream Cyberbit");
+    add("Center", panel);
+  }
+
+  public void destroy() {
+    remove(panel);
+  }
+
+  // calls system.exit, not for use in tests.
+  public static void main(String args[]) {
+    TestJustification justificationTest = new TestJustification();
+    justificationTest.init();
+    justificationTest.start();
+
+    Frame f = new Frame("Test Justification");
+    f.addWindowListener(new WindowAdapter() {
+      public void windowClosing(WindowEvent e) {
+        System.exit(0);
+      }
+    });
+
+    f.add("Center", justificationTest);
+    f.setSize(500, 500);
+    f.show();
+  }
+
+  public String getAppletInfo() {
+    return "Test TextLayout.getJustifiedLayout()";
+  }
+
+  static class JustificationPanel extends Panel {
+    TextLayout[] layouts;
+    String fontname;
+    float height;
+    float oldfsize;
+
+    AttributedCharacterIterator lineText;
+    TextLayout[] lines;
+    int linecount;
+    float oldwidth;
+
+    JustificationPanel(String fontname) {
+      this.fontname = fontname;
+    }
+
+    private static final String[] texts = {
+      "This is an english Highlighting demo.", "Highlighting",
+      "This is an arabic \u0627\u0628\u062a\u062c \u062e\u0644\u0627\u062e demo.", "arabic \u0627\u0628\u062a\u062c",
+      "This is a hebrew \u05d0\u05d1\u05d2 \u05d3\u05d4\u05d5 demo.", "hebrew \u05d0\u05d1\u05d2",
+      "This is a cjk \u4e00\u4e01\u4e02\uac00\uac01\uc4fa\uf900\uf901\uf902 demo.", "cjk",
+      "NoSpaceCJK:\u4e00\u4e01\u4e02and\uac00\uac01\uc4faand\uf900\uf901\uf902", "No",
+      "NoSpaceRoman", "Space"
+    };
+
+    public void paint(Graphics g) {
+      Graphics2D g2d = (Graphics2D)g;
+
+      Dimension d = getSize();
+      Insets insets = getInsets();
+
+      float w = d.width - insets.left - insets.right;
+      float h = d.height - insets.top - insets.bottom;
+      int fsize = (int)w/25;
+
+      FontRenderContext frc = g2d.getFontRenderContext();
+
+      if (layouts == null || fsize != oldfsize) {
+        oldfsize = fsize;
+
+        Font f0 = new Font(fontname, Font.PLAIN, fsize);
+        Font f1 = new Font(fontname, Font.ITALIC, (int)(fsize * 1.5));
+
+        if (layouts == null) {
+          layouts = new TextLayout[texts.length / 2];
+        }
+
+        height = 0;
+        for (int i = 0; i < layouts.length; ++i) {
+          String text = texts[i*2];
+          String target = texts[i*2+1];
+
+          AttributedString astr = new AttributedString(text);
+          astr.addAttribute(TextAttribute.FONT, f0, 0, text.length());
+
+          int start = text.indexOf(target);
+          int limit = start + target.length();
+          astr.addAttribute(TextAttribute.FONT, f1, start, limit);
+
+          TextLayout layout = new TextLayout(astr.getIterator(), frc);
+
+          layout = layout.getJustifiedLayout(w - 20);
+
+          layouts[i] = layout;
+
+          height += layout.getAscent() + layout.getDescent() + layout.getLeading();
+        }
+      }
+
+      g2d.setColor(Color.white);
+      g2d.fill(new Rectangle.Float(insets.left, insets.top, w, h));
+
+      float basey = 20;
+
+      for (int i = 0; i < layouts.length; ++i) {
+        TextLayout layout = layouts[i];
+
+        float la = layout.getAscent();
+        float ld = layout.getDescent();
+        float ll = layout.getLeading();
+        float lw = layout.getAdvance();
+        float lh = la + ld + ll;
+        float lx = (w - lw) / 2f;
+        float ly = basey + layout.getAscent();
+
+        g2d.setColor(Color.black);
+        g2d.translate(insets.left + lx, insets.top + ly);
+
+        Rectangle2D bounds = new Rectangle2D.Float(0, -la, lw, lh);
+        g2d.draw(bounds);
+
+        layout.draw(g2d, 0, 0);
+
+        g2d.setColor(Color.red);
+        for (int j = 0, e = layout.getCharacterCount(); j <= e; ++j) {
+          Shape[] carets = layout.getCaretShapes(j, bounds);
+          g2d.draw(carets[0]);
+        }
+
+        g2d.translate(-insets.left - lx, -insets.top - ly);
+        basey += layout.getAscent() + layout.getDescent() + layout.getLeading();
+      }
+
+      // add LineBreakMeasurer-generated layouts
+
+      if (lineText == null) {
+        String text = "This is a long line of text that should be broken across multiple "
+          + "lines and then justified to fit the break width.  This test should pass if "
+          + "these lines are justified to the same width, and fail otherwise.  It should "
+          + "also format the hebrew (\u05d0\u05d1\u05d2 \u05d3\u05d4\u05d5) and arabic "
+          + "(\u0627\u0628\u062a\u062c \u062e\u0644\u0627\u062e) and CJK "
+          + "(\u4e00\u4e01\u4e02\uac00\uac01\uc4fa\u67b1\u67b2\u67b3\u67b4\u67b5\u67b6\u67b7"
+          + "\u67b8\u67b9) text correctly.";
+
+        Float regular = new Float(16.0);
+        Float big = new Float(24.0);
+        AttributedString astr = new AttributedString(text);
+        astr.addAttribute(TextAttribute.SIZE, regular, 0, text.length());
+        astr.addAttribute(TextAttribute.FAMILY, fontname, 0, text.length());
+
+        int ix = text.indexOf("broken");
+        astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 6);
+        ix = text.indexOf("hebrew");
+        astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 6);
+        ix = text.indexOf("arabic");
+        astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 6);
+        ix = text.indexOf("CJK");
+        astr.addAttribute(TextAttribute.SIZE, big, ix, ix + 3);
+
+        lineText = astr.getIterator();
+      }
+
+      float width = w - 20;
+      if (lines == null || width != oldwidth) {
+        oldwidth = width;
+
+        lines = new TextLayout[10];
+        linecount = 0;
+
+        LineBreakMeasurer measurer = new LineBreakMeasurer(lineText, frc);
+
+        for (;;) {
+          TextLayout layout = measurer.nextLayout(width);
+          if (layout == null) {
+            break;
+          }
+
+          // justify all but last line
+          if (linecount > 0) {
+            lines[linecount - 1] = lines[linecount - 1].getJustifiedLayout(width);
+          }
+
+          if (linecount == lines.length) {
+            TextLayout[] nlines = new TextLayout[lines.length * 2];
+            System.arraycopy(lines, 0, nlines, 0, lines.length);
+            lines = nlines;
+          }
+
+          lines[linecount++] = layout;
+        }
+      }
+
+      float basex = insets.left + 10;
+      basey += 10;
+      g2d.setColor(Color.black);
+
+      for (int i = 0; i < linecount; ++i) {
+        TextLayout layout = lines[i];
+
+        basey += layout.getAscent();
+        float adv = layout.getAdvance();
+        float dx = layout.isLeftToRight() ? 0 : width - adv;
+
+        layout.draw(g2d, basex + dx, basey);
+
+        basey += layout.getDescent() + layout.getLeading();
+      }
+    }
+  }
+}
--- a/test/java/awt/font/TextLayout/VisibleAdvance.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/awt/font/TextLayout/VisibleAdvance.java	Fri Sep 23 13:44:03 2016 -0700
@@ -29,7 +29,7 @@
 
 /* @test
  * @summary verify TextLine advance
- * @bug 6582460
+ * @bug 6582460 8164818
  */
 
 /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/print/PrinterJob/PrintDlgPageable.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,171 @@
+/*
+ * 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 4885375
+ * @summary  Verifies if PageRanges To Field is populated based on Pageable
+ *           for COMMON print dialog
+ * @run main/manual PrintDlgPageable
+ */
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.print.PageFormat;
+import java.awt.print.Pageable;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.DialogTypeSelection;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class PrintDlgPageable implements Printable {
+
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+
+    public static void main(String[] args)  throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(PrintDlgPageable::printTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(30000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                throw new RuntimeException("Print Dialog does not " +
+                          "`reflect Copies or Page Ranges");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    private static void printTest() {
+        PrinterJob pj = PrinterJob.getPrinterJob();
+        PageableHandler handler = new PageableHandler();
+        pj.setPageable(handler);
+
+        PrintRequestAttributeSet pSet =  new HashPrintRequestAttributeSet();
+        pSet.add(DialogTypeSelection.COMMON);
+        pj.printDialog(pSet);
+    }
+
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String description
+                = " Visual inspection of print dialog is required.\n"
+                + " A print dialog will be shown.\n "
+                + " Please verify Page Range is populated \n"
+                + " with \"From\" 1 and \"To\" 5.\n"
+                + " If ok, press PASS else press FAIL";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("printSelectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail();
+        });
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+            passButton.setEnabled(true);
+            failButton.setEnabled(true);
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+        dialog.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                System.out.println("main dialog closing");
+                testGeneratedInterrupt = false;
+                mainThread.interrupt();
+            }
+        });
+    }
+
+    @Override
+    public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
+        return NO_SUCH_PAGE;
+    }
+}
+
+class PageableHandler implements Pageable {
+
+    PageFormat pf = new PageFormat();
+
+    @Override
+    public int getNumberOfPages() {
+        return 5;
+    }
+
+    @Override
+    public Printable getPrintable(int pageIndex) {
+        return new PrintDlgPageable();
+    }
+
+    @Override
+    public PageFormat getPageFormat(int pageIndex) {
+        return pf;
+    }
+}
--- a/test/java/awt/print/PrinterJob/TestMediaTraySelection.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/awt/print/PrinterJob/TestMediaTraySelection.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,8 +21,7 @@
  * questions.
  */
 /*
- * @test
- * @bug 6357887
+ * @bug 6357887 8165146
  * @summary  Verifies if selected printertray is used
  * @requires (os.family == "linux" | os.family == "solaris")
  * @run main/manual TestMediaTraySelection
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/print/PrinterJob/TestPageDlgFrameAssociation.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,166 @@
+/*
+ * 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 7064425 6948907
+ * @summary  Verifies if owner Frame is associated with page dialog of PrinterJob
+ * @run main/manual TestPageDlgFrameAssociation
+ */
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.print.PageFormat;
+import java.awt.print.PrinterJob;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class TestPageDlgFrameAssociation {
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+    private static Button print;
+    private static Frame frame;
+    private static boolean start;
+    private static Thread t;
+
+    public static void main(String args[]) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(TestPageDlgFrameAssociation::frameTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(60000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                throw new RuntimeException("Page dialog not disposed."
+                        + " Page dialog is not associated with owner Frame`");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    private static void frameTest() {
+        Panel panel =new Panel();
+
+        print = new Button("PageDialog");
+        print.setActionCommand("PageDialog");
+        print.addActionListener((e) -> {
+            PrinterJob job = PrinterJob.getPrinterJob();
+                PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+                t.start();
+                start = true;
+                PageFormat pf = job.pageDialog(aset);
+        });
+
+        panel.add(print);
+
+        frame = new Frame("Test Frame");
+        frame.setLayout (new BorderLayout ());
+        frame.add(panel,"South");
+        frame.pack();
+        frame.setVisible(true);
+
+        t = new Thread (() -> {
+            if (start) {
+                try {
+                    Thread.sleep(5000);
+                } catch (InterruptedException ex) {}
+                frame.dispose();
+            }
+        });
+    }
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String description
+                = " A Frame with PageDialog Button is shown. Press PageDialog.\n"
+                + " A page dialog will be shown. Do not press any button.\n"
+                + " After 5 secs the frame along with this page dialog will be disposed.\n"
+                + " If the page dialog is not disposed, press FAIL else press PASS";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("printSelectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail();
+        });
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+            passButton.setEnabled(true);
+            failButton.setEnabled(true);
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+        dialog.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                System.out.println("main dialog closing");
+                testGeneratedInterrupt = false;
+                mainThread.interrupt();
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/print/PrinterJob/TestPrintDlgFrameAssociation.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,165 @@
+/*
+ * 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 7064425 6948907
+ * @summary  Verifies if owner Frame is associated with print dialog of PrinterJob
+ * @run main/manual TestPrintDlgFrameAssociation
+ */
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.print.PrinterJob;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+
+public class TestPrintDlgFrameAssociation {
+    private static Thread mainThread;
+    private static boolean testPassed;
+    private static boolean testGeneratedInterrupt;
+    private static Button print;
+    private static Frame frame;
+    private static boolean start;
+    private static Thread t;
+
+    public static void main(String args[]) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            doTest(TestPrintDlgFrameAssociation::frameTest);
+        });
+        mainThread = Thread.currentThread();
+        try {
+            Thread.sleep(60000);
+        } catch (InterruptedException e) {
+            if (!testPassed && testGeneratedInterrupt) {
+                throw new RuntimeException("Print dialog not disposed."
+                        + " Print dialog is not associated with owner Frame`");
+            }
+        }
+        if (!testGeneratedInterrupt) {
+            throw new RuntimeException("user has not executed the test");
+        }
+    }
+
+    private static void frameTest() {
+        Panel panel =new Panel();
+
+        print = new Button("PrintDialog");
+        print.setActionCommand("PrintDialog");
+        print.addActionListener((e) -> {
+            PrinterJob job = PrinterJob.getPrinterJob();
+            PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+            t.start();
+            start = true;
+            job.printDialog(aset);
+        });
+
+        panel.add(print);
+
+        frame = new Frame("Test Frame");
+        frame.setLayout (new BorderLayout ());
+        frame.add(panel,"South");
+        frame.pack();
+        frame.setVisible(true);
+
+        t = new Thread (() -> {
+            if (start) {
+                try {
+                    Thread.sleep(5000);
+                } catch (InterruptedException ex) {}
+                frame.dispose();
+            }
+        });
+    }
+
+    public static synchronized void pass() {
+        testPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail() {
+        testPassed = false;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    private static void doTest(Runnable action) {
+        String description
+                = " A Frame with PrintDialog Button is shown. Press PrintDialog.\n"
+                + " A print dialog will be shown. Do not press any button.\n"
+                + " After 5 secs the frame along with this print dialog will be disposed.\n"
+                + " If the print dialog is not disposed, press FAIL else press PASS";
+
+        final JDialog dialog = new JDialog();
+        dialog.setTitle("printSelectionTest");
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton testButton = new JButton("Start Test");
+        final JButton passButton = new JButton("PASS");
+        passButton.setEnabled(false);
+        passButton.addActionListener((e) -> {
+            dialog.dispose();
+            pass();
+        });
+        final JButton failButton = new JButton("FAIL");
+        failButton.setEnabled(false);
+        failButton.addActionListener((e) -> {
+            dialog.dispose();
+            fail();
+        });
+        testButton.addActionListener((e) -> {
+            testButton.setEnabled(false);
+            action.run();
+            passButton.setEnabled(true);
+            failButton.setEnabled(true);
+        });
+        JPanel mainPanel = new JPanel(new BorderLayout());
+        mainPanel.add(textArea, BorderLayout.CENTER);
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(testButton);
+        buttonPanel.add(passButton);
+        buttonPanel.add(failButton);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        dialog.add(mainPanel);
+        dialog.pack();
+        dialog.setVisible(true);
+        dialog.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                System.out.println("main dialog closing");
+                testGeneratedInterrupt = false;
+                mainThread.interrupt();
+            }
+        });
+    }
+}
--- a/test/java/net/URLClassLoader/definePackage/SplitPackage.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/net/URLClassLoader/definePackage/SplitPackage.java	Fri Sep 23 13:44:03 2016 -0700
@@ -27,6 +27,7 @@
  * @summary Test two URLClassLoader define Package object of the same name
  * @library /lib/testlibrary
  * @build CompilerUtils
+ * @modules jdk.compiler
  * @run testng SplitPackage
  */
 
--- a/test/java/net/URLPermission/nstest/LookupTest.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/net/URLPermission/nstest/LookupTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -37,6 +37,7 @@
         String url, boolean throwsSecException, boolean throwsIOException)
     {
         try {
+            ProxySelector.setDefault(null);
             URL u = new URL(url);
             System.err.println ("Connecting to " + u);
             URLConnection urlc = u.openConnection();
@@ -71,7 +72,7 @@
             System.out.print(port);
         } else if (cmd.equals("-runtest")) {
             port = Integer.parseInt(args[1]);
-            String hostsFileName = System.getProperty("test.src", ".") + "/LookupTestHosts";
+            String hostsFileName = System.getProperty("user.dir", ".") + "/LookupTestHosts";
             System.setProperty("jdk.net.hosts.file", hostsFileName);
             addMappingToHostsFile("allowedAndFound.com", "127.0.0.1", hostsFileName, false);
             addMappingToHostsFile("notAllowedButFound.com", "99.99.99.99", hostsFileName, true);
--- a/test/java/net/URLPermission/nstest/LookupTestHosts	Wed Sep 21 12:53:07 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-127.0.0.1 allowedAndFound.com
-99.99.99.99 notAllowedButFound.com
--- a/test/java/net/URLPermission/nstest/lookup.sh	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/net/URLPermission/nstest/lookup.sh	Fri Sep 23 13:44:03 2016 -0700
@@ -48,6 +48,7 @@
 grant {
     permission java.net.URLPermission "http://allowedAndFound.com:${port}/-", "*:*";
     permission java.net.URLPermission "http://allowedButNotfound.com:${port}/-", "*:*";
+    permission java.net.NetPermission "setProxySelector";
     permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
     permission java.util.PropertyPermission "java.io.tmpdir", "read";
 
--- a/test/java/net/httpclient/HeadersTest1.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/net/httpclient/HeadersTest1.java	Fri Sep 23 13:44:03 2016 -0700
@@ -23,9 +23,11 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8153142
+ * @modules java.httpclient
+ *          jdk.httpserver
  * @run main/othervm HeadersTest1
  * @summary HeadersTest1
  */
@@ -39,9 +41,11 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.InetSocketAddress;
-import java.net.PasswordAuthentication;
 import java.net.URI;
-import java.net.http.*;
+import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
+import java.net.http.HttpResponse;
+import java.net.http.HttpRequest;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.List;
--- a/test/java/net/httpclient/ProxyAuthTest.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/net/httpclient/ProxyAuthTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -26,6 +26,7 @@
  * @test
  * @bug 8163561
  * @modules java.base/sun.net.www
+ *          java.httpclient
  * @summary Verify that Proxy-Authenticate header is correctly handled
  *
  * @run main/othervm ProxyAuthTest
--- a/test/java/net/httpclient/whitebox/Driver.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/net/httpclient/whitebox/Driver.java	Fri Sep 23 13:44:03 2016 -0700
@@ -24,5 +24,6 @@
 /*
  * @test
  * @bug 8151299
+ * @modules java.httpclient
  * @run testng java.httpclient/java.net.http.SelectorTest
  */
--- a/test/java/util/Currency/ValidateISO4217.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/util/Currency/ValidateISO4217.java	Fri Sep 23 13:44:03 2016 -0700
@@ -23,7 +23,7 @@
 /*
  * @test
  * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759
- *     8039317 8074350 8074351
+ *      8039317 8074350 8074351 8145952
  * @summary Validate ISO 4217 data for Currency class.
  */
 
@@ -93,7 +93,7 @@
 
     /* Codes that are obsolete, do not have related country */
     static final String otherCodes =
-        "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-CHE-CHW-CLF-COU-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-PTE-ROL-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZMK-ZWD-ZWN-ZWR";
+        "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-PTE-ROL-RUR-SDD-SIT-SKK-SRG-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-YUM-ZMK-ZWD-ZWN-ZWR";
 
     static boolean err = false;
 
--- a/test/java/util/Currency/tablea1.txt	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/java/util/Currency/tablea1.txt	Fri Sep 23 13:44:03 2016 -0700
@@ -1,12 +1,12 @@
 #
 #
-# Amendments up until ISO 4217 AMENDMENT NUMBER 160
-#   (As of 19 June 2015)
+# Amendments up until ISO 4217 AMENDMENT NUMBER 162
+#   (As of 30 Auguest 2016)
 #
 
 # Version
 FILEVERSION=3
-DATAVERSION=160
+DATAVERSION=162
 
 # ISO 4217 currency data
 AF	AFN	971	2
@@ -28,7 +28,7 @@
 BH	BHD	48	3
 BD	BDT	50	2
 BB	BBD	52	2
-BY	BYR	974	0
+BY	BYN	933	2
 BE	EUR	978	2
 BZ	BZD	84	2
 BJ	XOF	952	0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/imageio/ReadAbortTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,181 @@
+/*
+ * 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     4924727
+ * @summary Test verifies that if we call ImageReader.abort() in
+ *          IIOReadProgressListener.imageStarted() or
+ *          IIOReadProgressListener.imageProgress() are we
+ *          calling IIOReadProgressListener.readAborted() for all readers.
+ * @run     main ReadAbortTest
+ */
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.util.Iterator;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
+import javax.imageio.event.IIOReadProgressListener;
+import javax.imageio.stream.ImageInputStream;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.nio.file.Files;
+
+public class ReadAbortTest implements IIOReadProgressListener {
+
+    ImageReader reader = null;
+    ImageInputStream iis = null;
+    BufferedImage bimg = null;
+    File file;
+    boolean startAbort = false;
+    boolean startAborted = false;
+    boolean progressAbort = false;
+    boolean progressAborted = false;
+    Color srccolor = Color.red;
+    int width = 100;
+    int heght = 100;
+
+    public ReadAbortTest(String format) throws Exception {
+        try {
+            System.out.println("Test for format " + format);
+            bimg = new BufferedImage(width, heght,
+                    BufferedImage.TYPE_INT_RGB);
+
+            Graphics2D g = bimg.createGraphics();
+            g.setColor(srccolor);
+            g.fillRect(0, 0, width, heght);
+            g.dispose();
+
+            file = File.createTempFile("src_", "." + format, new File("."));
+            ImageIO.write(bimg, format, file);
+            ImageInputStream iis = ImageIO.createImageInputStream(file);
+
+            Iterator iter = ImageIO.getImageReaders(iis);
+            while (iter.hasNext()) {
+                reader = (ImageReader) iter.next();
+                break;
+            }
+            reader.setInput(iis);
+            reader.addIIOReadProgressListener(this);
+
+            // Abort reading in IIOReadProgressListener.imageStarted().
+            startAbort = true;
+            bimg = reader.read(0);
+            startAbort = false;
+
+            // Abort reading in IIOReadProgressListener.imageProgress().
+            progressAbort = true;
+            bimg = reader.read(0);
+            progressAbort = false;
+
+            iis.close();
+            /*
+             * All abort requests from imageStarted,imageProgress and
+             * imageComplete from IIOReadProgressListener should be reached
+             * otherwise throw RuntimeException.
+             */
+            if (!(startAborted
+                    && progressAborted)) {
+                throw new RuntimeException("All IIOReadProgressListener abort"
+                        + " requests are not processed for format "
+                        + format);
+            }
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            Files.delete(file.toPath());
+        }
+    }
+
+    /*
+     * Abstract methods that we need to implement from
+     * IIOReadProgressListener, and relevant for this test case.
+     */
+    @Override
+    public void imageStarted(ImageReader source, int imageIndex) {
+        System.out.println("imageStarted called");
+        if (startAbort) {
+            source.abort();
+        }
+    }
+
+    @Override
+    public void imageProgress(ImageReader source, float percentageDone) {
+        System.out.println("imageProgress called");
+        if (progressAbort) {
+            source.abort();
+        }
+    }
+
+    @Override
+    public void readAborted(ImageReader source) {
+        System.out.println("readAborted called");
+        // Verify IIOReadProgressListener.imageStarted() abort request.
+        if (startAbort) {
+            System.out.println("imageStarted aborted ");
+            startAborted = true;
+        }
+
+        // Verify IIOReadProgressListener.imageProgress() abort request.
+        if (progressAbort) {
+            System.out.println("imageProgress aborted ");
+            progressAborted = true;
+        }
+    }
+
+    public static void main(String args[]) throws Exception {
+        final String[] formats = {"bmp", "png", "gif", "jpg", "tif"};
+        for (String format : formats) {
+            new ReadAbortTest(format);
+        }
+    }
+
+    /*
+     * Remaining abstract methods that we need to implement from
+     * IIOReadProgressListener, but not relevant for this test case.
+     */
+    @Override
+    public void imageComplete(ImageReader source) {
+    }
+
+    @Override
+    public void sequenceStarted(ImageReader reader, int i) {
+    }
+
+    @Override
+    public void sequenceComplete(ImageReader reader) {
+    }
+
+    @Override
+    public void thumbnailStarted(ImageReader reader, int i, int i1) {
+    }
+
+    @Override
+    public void thumbnailProgress(ImageReader reader, float f) {
+    }
+
+    @Override
+    public void thumbnailComplete(ImageReader reader) {
+    }
+}
+
--- a/test/javax/swing/JColorChooser/Test7194184.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/javax/swing/JColorChooser/Test7194184.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -25,19 +25,15 @@
  * Portions Copyright (c) 2012 IBM Corporation
  */
 
-/*
- * @test
- * @key headful
- * @bug 7194184
+/* @test
+   @key headful
+ * @bug 7194184 8163274
  * @summary Tests JColorChooser Swatch keyboard accessibility.
- * @author Sean Chou
  * @library ../regtesthelpers
  * @build Util
- * @run main Test7194184
+ * @run main/timeout=500 Test7194184
  */
-
 import java.awt.Component;
-import java.awt.AWTException;
 import java.awt.Color;
 import java.awt.Robot;
 import java.awt.event.KeyEvent;
@@ -46,66 +42,81 @@
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
 
-import java.util.concurrent.Callable;
+public class Test7194184 {
 
-public class Test7194184 implements Runnable {
     private static JFrame frame;
     private static JColorChooser colorChooser;
-    private static Color selectedColor;
+    private static Color testColor;
+    private static Color newColor;
+
+    private static Robot robot;
 
     public static void main(String[] args) throws Exception {
-        testKeyBoardAccess();
+        robot = new Robot();
+        robot.setAutoWaitForIdle(true);
+        createUI();
+        accessRecentSwatch();
+        runRobot();
+        testColorChooser();
+        cleanUpUI();
     }
 
-    private static void testKeyBoardAccess() throws Exception {
-        Robot robot = new Robot();
-
-        SwingUtilities.invokeLater(new Test7194184());
-        robot.waitForIdle();
-
+    private static void createUI() throws Exception {
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
-                selectedColor = colorChooser.getColor();
+                String title = getClass().getName();
+                frame = new JFrame(title);
+                colorChooser = new JColorChooser();
+                frame.add(colorChooser);
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+    }
 
+    private static void accessRecentSwatch() throws Exception {
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
                 Component recentSwatchPanel = Util.findSubComponent(colorChooser, "RecentSwatchPanel");
                 if (recentSwatchPanel == null) {
                     throw new RuntimeException("RecentSwatchPanel not found");
                 }
                 recentSwatchPanel.requestFocusInWindow();
+                testColor = colorChooser.getColor();
+
             }
         });
+    }
 
-        robot.waitForIdle();
-
+    private static void runRobot() {
         // Tab to move the focus to MainSwatch
         Util.hitKeys(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_TAB);
-
         // Select the color on right
         Util.hitKeys(robot, KeyEvent.VK_RIGHT);
         Util.hitKeys(robot, KeyEvent.VK_RIGHT);
         Util.hitKeys(robot, KeyEvent.VK_SPACE);
-        robot.waitForIdle();
+    }
 
+    private static void testColorChooser() throws Exception {
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
             public void run() {
-                frame.dispose();
-                if (selectedColor == colorChooser.getColor()) {
+                newColor = colorChooser.getColor();
+                if (newColor == testColor) {
                     throw new RuntimeException("JColorChooser misses keyboard accessibility");
                 }
             }
         });
     }
 
-    public void run() {
-        String title = getClass().getName();
-        frame = new JFrame(title);
-        colorChooser = new JColorChooser();
-
-        frame.add(colorChooser);
-        frame.pack();
-        frame.setVisible(true);
+    private static void cleanUpUI() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                frame.dispose();
+            }
+        });
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JSlider/SliderTick/SliderTickTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,181 @@
+/*
+ * 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 8009477
+ * @summary Verify PageUp/PageDown key moves slider to Next/Previous minor tick.
+ * @run main/manual SliderTickTest
+ */
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.concurrent.TimeUnit;
+import javax.swing.JSlider;
+
+public class SliderTickTest {
+
+    public static void main(String args[]) throws Exception {
+        final CountDownLatch latch = new CountDownLatch(1);
+        TestUI test = new TestUI(latch);
+
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    test.createUI();
+                } catch (Exception ex) {
+                    throw new RuntimeException("Exception while creating UI");
+                }
+            }
+        });
+
+        boolean status = latch.await(5, TimeUnit.MINUTES);
+
+        if (!status) {
+            System.out.println("Test timed out.");
+        }
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    test.disposeUI();
+                } catch (Exception ex) {
+                    throw new RuntimeException("Exception while disposing UI");
+                }
+            }
+        });
+
+        if (test.testResult == false) {
+            throw new RuntimeException("Test Failed.");
+        }
+    }
+}
+
+class TestUI {
+
+    private static JFrame mainFrame;
+    private static JPanel mainControlPanel;
+
+    private static JTextArea instructionTextArea;
+
+    private static JPanel resultButtonPanel;
+    private static JButton passButton;
+    private static JButton failButton;
+
+    private static GridBagLayout layout;
+    private final CountDownLatch latch;
+    public boolean testResult = false;
+
+    public TestUI(CountDownLatch latch) throws Exception {
+        this.latch = latch;
+    }
+
+    public final void createUI() throws Exception {
+
+        mainFrame = new JFrame("SliderTickTest");
+
+        layout = new GridBagLayout();
+        mainControlPanel = new JPanel(layout);
+        resultButtonPanel = new JPanel(layout);
+
+        GridBagConstraints gbc = new GridBagConstraints();
+
+        // Create Test instructions
+        String instructions
+                = "INSTRUCTIONS:"
+                + "\n Click PageUp/PageDown key. If the slider indicator"
+                + "\n moves to Next/Previous immediate minor tick, then "
+                + "\n test passes else failed.";
+
+        instructionTextArea = new JTextArea();
+        instructionTextArea.setText(instructions);
+        instructionTextArea.setEnabled(false);
+        instructionTextArea.setDisabledTextColor(Color.black);
+        instructionTextArea.setBackground(Color.white);
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        gbc.fill = GridBagConstraints.HORIZONTAL;
+        mainControlPanel.add(instructionTextArea, gbc);
+
+        JSlider slider = new JSlider(0, 50);
+        slider.setMajorTickSpacing(10);
+        slider.setMinorTickSpacing(2);
+        slider.setPaintTicks(true);
+        slider.setPaintLabels(true);
+        slider.setValue(30);
+        slider.setBorder(BorderFactory.createTitledBorder("Ticks"));
+        gbc.gridx = 0;
+        gbc.gridy = 1;
+        mainControlPanel.add(slider, gbc);
+
+        passButton = new JButton("Pass");
+        passButton.setActionCommand("Pass");
+        passButton.addActionListener((ActionEvent e) -> {
+            testResult = true;
+            mainFrame.dispose();
+            latch.countDown();
+
+        });
+        failButton = new JButton("Fail");
+        failButton.setActionCommand("Fail");
+        failButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                testResult = false;
+                mainFrame.dispose();
+                latch.countDown();
+            }
+        });
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        resultButtonPanel.add(passButton, gbc);
+        gbc.gridx = 1;
+        gbc.gridy = 0;
+        resultButtonPanel.add(failButton, gbc);
+
+        gbc.gridx = 0;
+        gbc.gridy = 2;
+        mainControlPanel.add(resultButtonPanel, gbc);
+
+        mainFrame.add(mainControlPanel);
+        mainFrame.pack();
+        mainFrame.setVisible(true);
+    }
+
+    public void disposeUI() {
+        mainFrame.setVisible(false);
+        mainFrame.dispose();
+    }
+}
--- a/test/javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentPerPixelTranslucentGradient.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentPerPixelTranslucentGradient.java	Fri Sep 23 13:44:03 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @bug 8144735
  * @key headful
  * @summary Check if a per-pixel translucent and translucent window is dragged
  *          and resized by mouse correctly
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/plaf/metal/MetalGradient/8163193/ButtonGradientTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,134 @@
+/*
+ * 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.BorderLayout;
+import java.awt.Color;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.image.BufferedImage;
+import java.util.List;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+/*
+ * @test
+ * @bug 8163193
+ * @key headful
+ * @summary Metal L&F gradient is lighter on HiDPI display
+ * @run main/othervm -Dsun.java2d.uiScale=2 ButtonGradientTest
+ */
+public class ButtonGradientTest {
+
+    private static JFrame frame;
+    private static JButton button;
+
+    public static void main(String[] args) throws Exception {
+        try {
+            testGradient();
+        } finally {
+            SwingUtilities.invokeAndWait(() -> {
+                if (frame != null) {
+                    frame.dispose();
+                }
+            });
+        }
+    }
+
+    private static void testGradient() throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(ButtonGradientTest::createAndShowGUI);
+        robot.waitForIdle();
+
+        Rectangle rect = getButtonBounds();
+        List<?> gradient = (List) UIManager.get("Button.gradient");
+        float ratio = ((Number) gradient.get(0)).floatValue();
+        Color c1 = (Color) gradient.get(2);
+        Color c2 = (Color) gradient.get(3);
+        int mid = (int) (ratio * rect.height);
+
+        Color gradientColor = getGradientColor(rect.width, mid, c1, c2);
+        int x = rect.x + rect.width / 2;
+        int y = rect.y + mid / 2;
+        Color buttonColor = robot.getPixelColor(x, y);
+
+        if (!similarColors(buttonColor, gradientColor)) {
+            throw new RuntimeException("Button gradient is changed!");
+        }
+    }
+
+    private static void createAndShowGUI() {
+
+        try {
+            UIManager.setLookAndFeel(new MetalLookAndFeel());
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        frame = new JFrame();
+        frame.setSize(300, 300);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        JPanel panel = new JPanel(new BorderLayout());
+        button = new JButton("");
+        panel.add(button);
+        frame.getContentPane().add(panel);
+        frame.setVisible(true);
+    }
+
+    private static Rectangle getButtonBounds() throws Exception {
+        Rectangle[] rectangles = new Rectangle[1];
+        SwingUtilities.invokeAndWait(() -> {
+            rectangles[0] = button.getBounds();
+            rectangles[0].setLocation(button.getLocationOnScreen());
+        });
+        return rectangles[0];
+    }
+
+    private static Color getGradientColor(int w, int h, Color c1, Color c2) {
+        GradientPaint gradient = new GradientPaint(0, 0, c1, 0, h, c2, true);
+        BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g = img.createGraphics();
+        g.setPaint(gradient);
+        g.fillRect(0, 0, w, h);
+        g.dispose();
+        return new Color(img.getRGB(w / 2, h / 2));
+    }
+
+    private static boolean similarColors(Color c1, Color c2) {
+        return similar(c1.getRed(), c2.getRed())
+                && similar(c1.getGreen(), c2.getGreen())
+                && similar(c1.getBlue(), c2.getBlue());
+    }
+
+    private static boolean similar(int i1, int i2) {
+        return Math.abs(i2 - i1) < 7;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/text/DevanagariEditor.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,36 @@
+/*
+ * 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 8151725
+ * @summary Tests no exception creating a JEditorPane with Devanagari
+ */
+
+import javax.swing.JEditorPane;
+
+public class DevanagariEditor {
+    public static void main(String[] args) {
+        new JEditorPane().setText("\u0930\u093E\u0915\u094D\u0937\u0938");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/text/GlyphPainter2/6427244/bug6427244.java	Fri Sep 23 13:44:03 2016 -0700
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 6427244 8144240
+   @summary Test that pressing HOME correctly moves caret in I18N document.
+   @author Sergey Groznyh
+   @library ../../../regtesthelpers
+   @build JRobot Util TestCase
+   @run main bug6427244
+*/
+
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Shape;
+import java.awt.event.KeyEvent;
+import javax.swing.JFrame;
+import javax.swing.JTextPane;
+import javax.swing.SwingUtilities;
+import javax.swing.text.Position;
+
+public class bug6427244 extends TestCase {
+    private static final JRobot ROBOT = JRobot.getRobot();
+
+    final static int TP_SIZE = 200;
+    final static String[] SPACES = new String[] {
+        "\u0020", // ASCII space
+        "\u2002", // EN space
+        "\u2003", // EM space
+        "\u2004", // THREE-PER-EM space
+        "\u2005", // ... etc.
+        "\u2006",
+        //"\u2007",
+        "\u2008",
+        "\u2009",
+        "\u200a",
+        "\u200b",
+        "\u205f",
+        "\u3000",
+    };
+    final static String[] WORDS = new String[] {
+        "It", "is", "a", "long", "paragraph", "for", "testing", "GlyphPainter2\n\n",
+    };
+
+    public static void main(String[] args) {
+        bug6427244 t = new bug6427244();
+        for (String space: SPACES) {
+            t.init(space);
+            t.runAllTests();
+        }
+
+        System.out.println("OK");
+    }
+
+    void init(final String space) {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    String text = null;
+                    for (String word: WORDS) {
+                        if (text == null) {
+                            text = "";
+                        } else {
+                            text += space;
+                        }
+                        text += word;
+                    }
+                    tp = new JTextPane();
+                    tp.setText(text +
+                            "Some arabic: \u062a\u0641\u0627\u062d and some not.");
+                    if (jf == null) {
+                        jf = new JFrame();
+                        jf.setTitle("bug6427244");
+                        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                        jf.setSize(TP_SIZE, TP_SIZE);
+                        jf.setVisible(true);
+                    }
+                    Container c = jf.getContentPane();
+                    c.removeAll();
+                    c.add(tp);
+                    c.invalidate();
+                    c.validate();
+                    dim = c.getSize();
+                }
+            });
+            Util.blockTillDisplayed(tp);
+            ROBOT.waitForIdle();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public void testCaretPosition() {
+        Point p = tp.getLocationOnScreen();
+        // the right-top corner position
+        p.x += (dim.width - 5);
+        p.y += 5;
+        ROBOT.mouseMove(p.x, p.y);
+        ROBOT.clickMouse();
+        ROBOT.hitKey(KeyEvent.VK_HOME);
+        ROBOT.waitForIdle();
+        // this will fail if caret moves out of the 1st line.
+        assertEquals(0, getCaretOrdinate());
+    }
+
+    int getCaretOrdinate() {
+        final int[] y = new int[1];
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    Shape s;
+                    try {
+                        s = tp.getUI().getRootView(tp).modelToView(
+                                        tp.getCaretPosition(), tp.getBounds(),
+                                        Position.Bias.Forward);
+                    } catch (Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                    y[0] = s.getBounds().y;
+                }
+            });
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return y[0];
+    }
+
+    JFrame jf;
+    JTextPane tp;
+    Dimension dim;
+}
--- a/test/jdk/nio/zipfs/jarfs/JFSTester.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/jdk/nio/zipfs/jarfs/JFSTester.java	Fri Sep 23 13:44:03 2016 -0700
@@ -26,6 +26,7 @@
  * @bug 8164389
  * @summary walk entries in a jdk.nio.zipfs.JarFileSystem
  * @modules jdk.jartool/sun.tools.jar
+ *          jdk.zipfs
  * @run testng JFSTester
  */
 
--- a/test/jprt.config	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/jprt.config	Fri Sep 23 13:44:03 2016 -0700
@@ -82,15 +82,12 @@
     fi
 
     # Add basic solaris system paths
-    path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
+    path4sdk=/usr/bin:/usr/gnu/bin
 
     # Find GNU make
-    make=/usr/sfw/bin/gmake
+    make=/usr/bin/gmake
     if [ ! -f ${make} ] ; then
-	make=/opt/sfw/bin/gmake
-	if [ ! -f ${make} ] ; then
-	    make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
-        fi 
+	make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
     fi
     fileMustExist "${make}" make
 
--- a/test/start-Xvfb.sh	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/start-Xvfb.sh	Fri Sep 23 13:44:03 2016 -0700
@@ -59,9 +59,6 @@
   /usr/bin/nohup /usr/bin/X11/Xvfb -fbdir ${currentDir} -pixdepths 8 16 24 32 ${DISPLAY} > ${currentDir}/nohup.$$ 2>&1 &
 fi
 WM="/usr/bin/X11/fvwm2"
-if [ ! -x ${WM} ] ; then
-  WM="/opt/sfw/bin/fvwm2"
-fi
 #
 # Wait for Xvfb to initialize:
 sleep 5
--- a/test/sun/security/smartcardio/README.txt	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/README.txt	Fri Sep 23 13:44:03 2016 -0700
@@ -1,17 +1,17 @@
 
 Rough hints for setting up MUSCLE on Solaris:
 
-Make sure you have libusb, usually in /usr/sfw:
+Make sure you have libusb, usually in /usr/lib:
 
-ls -l /usr/sfw/lib/libusb.so
-lrwxrwxrwx   1 root     other         11 Jan 12 16:02 /usr/sfw/lib/libusb.so -> libusb.so.1
+ls -l /usr/lib/libusb.so
+lrwxrwxrwx   1 root     other         11 Jan 12 16:02 /usr/lib/libusb.so -> libusb.so.1
 
 Get PCSC and CCID.
 -rwx------   1 user staff     529540 Jun 16 18:24 ccid-1.0.1.tar.gz
 -rwx------   1 user staff     842654 Jun 16 18:24 pcsc-lite-1.3.1.tar.gz
 
 Unpack pcsc
-Run ./configure --enable-libusb=/usr/sfw (??)
+Run ./configure --enable-libusb (??)
 gnumake
 Make /usr/local writeable for user
 gnumake install
--- a/test/sun/security/smartcardio/TestChannel.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestChannel.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117
  * @summary test logical channels work
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestChannel
  */
 
--- a/test/sun/security/smartcardio/TestConnect.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestConnect.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6293769 6294527 6309280
  * @summary test connect() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestConnect
  */
 
--- a/test/sun/security/smartcardio/TestConnectAgain.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestConnectAgain.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117
  * @summary test connect works correctly if called multiple times/card removed
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestConnectAgain
  */
 
--- a/test/sun/security/smartcardio/TestControl.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestControl.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117 6470320
  * @summary test if transmitControlCommand() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestControl
  */
 
--- a/test/sun/security/smartcardio/TestDefault.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestDefault.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6327047
  * @summary verify that TerminalFactory.getDefault() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestDefault
  */
 
--- a/test/sun/security/smartcardio/TestDirect.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestDirect.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,10 +21,11 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 8046343
  * @summary Make sure that direct protocol is available
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestDirect
  */
 
--- a/test/sun/security/smartcardio/TestExclusive.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestExclusive.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117
  * @summary verify that beginExclusive()/endExclusive() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestExclusive
  */
 
--- a/test/sun/security/smartcardio/TestMultiplePresent.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestMultiplePresent.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6239117 6445367
  * @summary test that CardTerminals.waitForCard() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestMultiplePresent
  */
 
--- a/test/sun/security/smartcardio/TestPresent.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestPresent.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6293769 6294527
  * @summary test that the isCardPresent()/waitForX() APIs work correctly
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestPresent
  */
 
--- a/test/sun/security/smartcardio/TestTransmit.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/smartcardio/TestTransmit.java	Fri Sep 23 13:44:03 2016 -0700
@@ -21,11 +21,12 @@
  * questions.
  */
 
-/**
+/*
  * @test
  * @bug 6293769 6294527
  * @summary test transmit() works
  * @author Andreas Sterbenz
+ * @modules java.smartcardio/javax.smartcardio
  * @run main/manual TestTransmit
  */
 
--- a/test/sun/security/ssl/SocketCreation/SocketCreation.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/ssl/SocketCreation/SocketCreation.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -139,7 +139,7 @@
             (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
 
         System.out.println("Server: Will call createServerSocket(int)");
-        ServerSocket sslServerSocket = sslssf.createServerSocket(serverPort);
+        ServerSocket sslServerSocket = sslssf.createServerSocket(0);
         serverPort = sslServerSocket.getLocalPort();
 
         System.out.println("Server: Will accept on SSL server socket...");
@@ -157,7 +157,7 @@
             (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
 
         System.out.println("Server: Will call createServerSocket(int, int)");
-        ServerSocket sslServerSocket = sslssf.createServerSocket(serverPort,
+        ServerSocket sslServerSocket = sslssf.createServerSocket(0,
                                                                  1);
         serverPort = sslServerSocket.getLocalPort();
 
@@ -177,7 +177,7 @@
 
         System.out.println("Server: Will call createServerSocket(int, " +
                            " int, InetAddress)");
-        ServerSocket sslServerSocket = sslssf.createServerSocket(serverPort,
+        ServerSocket sslServerSocket = sslssf.createServerSocket(0,
                                          1,
                                          InetAddress.getByName("localhost"));
         serverPort = sslServerSocket.getLocalPort();
@@ -203,14 +203,15 @@
         if (sslServerSocket.isBound())
             throw new Exception("Server socket is already bound!");
 
-        System.out.println("Server: Will bind SSL server socket to port " +
-                           serverPort + "...");
-
-        sslServerSocket.bind(new java.net.InetSocketAddress(serverPort));
+        sslServerSocket.bind(new java.net.InetSocketAddress(0));
 
         if (!sslServerSocket.isBound())
             throw new Exception("Server socket is not bound!");
 
+        serverPort = sslServerSocket.getLocalPort();
+        System.out.println("Server: Bound SSL server socket to port " +
+                serverPort + "...");
+
         serverReady = true;
 
         System.out.println("Server: Will accept on SSL server socket...");
@@ -224,11 +225,10 @@
         SSLSocketFactory sslsf =
             (SSLSocketFactory) SSLSocketFactory.getDefault();
 
-        System.out.println("Server: Will create normal server socket bound"
-                           + " to port " + serverPort + "...");
-
-        ServerSocket ss = new ServerSocket(serverPort);
+        ServerSocket ss = new ServerSocket(0);
         serverPort = ss.getLocalPort();
+        System.out.println("Server: Created normal server socket bound"
+                + " to port " + serverPort + "...");
         System.out.println("Server: Will accept on server socket...");
         serverReady = true;
         Socket s = ss.accept();
--- a/test/sun/security/tools/keytool/KeyToolTest.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/security/tools/keytool/KeyToolTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -1761,7 +1761,7 @@
         //PKCS#11 tests
 
         //   1. sccs edit cert8.db key3.db
-        //Runtime.getRuntime().exec("/usr/ccs/bin/sccs edit cert8.db key3.db");
+        //Runtime.getRuntime().exec("/usr/bin/sccs edit cert8.db key3.db");
         testOK("", p11Arg + ("-storepass test12 -genkey -alias genkey" +
                 " -dname cn=genkey -keysize 512 -keyalg rsa"));
         testOK("", p11Arg + "-storepass test12 -list");
@@ -1781,7 +1781,7 @@
         testOK("", p11Arg + "-storepass test12 -list");
         assertTrue(out.indexOf("Your keystore contains 0 entries") != -1);
         //(check for empty database listing)
-        //Runtime.getRuntime().exec("/usr/ccs/bin/sccs unedit cert8.db key3.db");
+        //Runtime.getRuntime().exec("/usr/bin/sccs unedit cert8.db key3.db");
         remove("genkey.cert");
         remove("genkey.certreq");
         //  12. sccs unedit cert8.db key3.db
--- a/test/sun/text/resources/LocaleData	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/text/resources/LocaleData	Fri Sep 23 13:44:03 2016 -0700
@@ -6403,8 +6403,8 @@
 CurrencyNames//bif=Burundian Franc
 CurrencyNames//bob=Bolivian Boliviano
 CurrencyNames//btn=Bhutanese Ngultrum
-CurrencyNames//byb=Belarusian New Ruble (1994-1999)
-CurrencyNames//byr=Belarusian Ruble
+CurrencyNames//byb=Belarusian Ruble (1994-1999)
+CurrencyNames//byr=Belarusian Ruble (2000-2016)
 CurrencyNames//cdf=Congolese Franc
 CurrencyNames//clf=Chilean Unit of Account (UF)
 CurrencyNames//cny=Chinese Yuan
@@ -6436,7 +6436,6 @@
 CurrencyNames//mro=Mauritanian Ouguiya
 CurrencyNames//mur=Mauritian Rupee
 CurrencyNames//mvr=Maldivian Rufiyaa
-CurrencyNames//mwk=Malawian Kwacha
 CurrencyNames//mxv=Mexican Investment Unit
 CurrencyNames//mzm=Mozambican Metical (1980-2006)
 CurrencyNames//mzn=Mozambican Metical
@@ -6444,7 +6443,6 @@
 CurrencyNames//nio=Nicaraguan C\u00f3rdoba
 CurrencyNames//nlg=Dutch Guilder
 CurrencyNames//omr=Omani Rial
-CurrencyNames//pen=Peruvian Nuevo Sol
 CurrencyNames//pgk=Papua New Guinean Kina
 CurrencyNames//pkr=Pakistani Rupee
 CurrencyNames//pyg=Paraguayan Guarani
@@ -8287,3 +8285,11 @@
 
 # bug #8129361
 CurrencyNames//hrk=Kuna
+
+# bug #8164784
+CurrencyNames//mwk=Malawian Malawi Kwacha
+CurrencyNames//pen=Peruvian Sol
+
+# bug #8145952
+CurrencyNames//byn=Belarusian Ruble
+CurrencyNames/be_BY/BYN=\u0420\u0443\u0431
--- a/test/sun/text/resources/LocaleDataTest.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/sun/text/resources/LocaleDataTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -37,7 +37,7 @@
  *      7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
  *      7114053 7074882 7040556 8008577 8013836 8021121 6192407 6931564 8027695
  *      8017142 8037343 8055222 8042126 8074791 8075173 8080774 8129361 8134916
- *      8145136
+ *      8145136 8145952 8164784
  * @summary Verify locale data
  * @modules java.base/sun.util.resources
  * @modules jdk.localedata
--- a/test/tools/launcher/RunpathTest.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/tools/launcher/RunpathTest.java	Fri Sep 23 13:44:03 2016 -0700
@@ -40,7 +40,7 @@
     }
 
     final String findElfReader() {
-        String[] paths = {"/bin", "/sbin", "/usr/bin", "/usr/sbin", "/usr/ccs/bin"};
+        String[] paths = {"/usr/sbin", "/usr/bin"};
         final String cmd = isSolaris ? "elfdump" : "readelf";
         for (String x : paths) {
             File p = new File(x);
--- a/test/tools/pack200/Pack200Test.java	Wed Sep 21 12:53:07 2016 -0700
+++ b/test/tools/pack200/Pack200Test.java	Fri Sep 23 13:44:03 2016 -0700
@@ -24,6 +24,7 @@
  /*
   * @test
   * @bug 6521334 6712743 8007902 8151901
+  * @requires (sun.arch.data.model == "64" & os.maxMemory >= 4g)
   * @summary test general packer/unpacker functionality
   *          using native and java unpackers
   * @compile -XDignore.symbol.file Utils.java Pack200Test.java