changeset 17372:50712368daa2

Merge
author amurillo
date Mon, 08 Aug 2016 08:12:20 -0700
parents 9001adc78f9d 888f66a02c9a
children 67e8b431911d
files make/lib/Awt2dLibraries.gmk src/java.desktop/share/native/libawt/java2d/ShaderList.c src/java.desktop/share/native/libawt/java2d/ShaderList.h src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c test/ProblemList.txt
diffstat 711 files changed, 5955 insertions(+), 1551 deletions(-) [+]
line wrap: on
line diff
--- a/make/lib/Awt2dLibraries.gmk	Fri Aug 05 09:50:29 2016 -0700
+++ b/make/lib/Awt2dLibraries.gmk	Mon Aug 08 08:12:20 2016 -0700
@@ -56,9 +56,6 @@
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBMLIB_CFLAGS), \
-    DISABLED_WARNINGS_gcc := parentheses array-bounds, \
-    DISABLED_WARNINGS_clang := parentheses, \
-    DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
     MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -119,7 +116,6 @@
       CFLAGS := -xarch=sparcvis \
           $(LIBMLIB_IMAGE_V_CFLAGS) \
           $(CFLAGS_JDKLIB), \
-      DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
       MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -147,8 +143,6 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
   LIBAWT_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility
-else
-  LIBAWT_EXFILES := java2d/ShaderList.c
 endif
 
 ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), )
@@ -496,9 +490,7 @@
     CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBJAVAJPEG_HEADERS) \
         $(LIBJAVA_HEADER_FLAGS) \
         -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
-    DISABLED_WARNINGS_gcc := clobbered parentheses array-bounds shift-negative-value, \
-    DISABLED_WARNINGS_clang := logical-op-parentheses, \
-    DISABLED_WARNINGS_microsoft := 4267, \
+    DISABLED_WARNINGS_gcc := clobbered, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/src/java.base/share/classes/java/lang/Class.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.base/share/classes/java/lang/Class.java	Mon Aug 08 08:12:20 2016 -0700
@@ -70,6 +70,7 @@
 import jdk.internal.reflect.ConstantPool;
 import jdk.internal.reflect.Reflection;
 import jdk.internal.reflect.ReflectionFactory;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
 import sun.reflect.generics.repository.ClassRepository;
@@ -802,6 +803,7 @@
      * @see java.lang.RuntimePermission
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public ClassLoader getClassLoader() {
         ClassLoader cl = getClassLoader0();
         if (cl == null)
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Mon Aug 08 08:12:20 2016 -0700
@@ -30,6 +30,7 @@
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import jdk.internal.vm.annotation.Stable;
 import sun.invoke.empty.Empty;
 import sun.invoke.util.ValueConversions;
@@ -44,7 +45,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.function.Function;
-import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import static java.lang.invoke.LambdaForm.*;
@@ -1246,6 +1246,7 @@
         }
 
         @CallerSensitive
+        @ForceInline // to ensure Reflection.getCallerClass optimization
         private static boolean checkCallerClass(Class<?> expected) {
             // This method is called via MH_checkCallerClass and so it's correct to ask for the immediate caller here.
             Class<?> actual = Reflection.getCallerClass();
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Mon Aug 08 08:12:20 2016 -0700
@@ -29,6 +29,7 @@
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.invoke.util.ValueConversions;
 import sun.invoke.util.VerifyAccess;
 import sun.invoke.util.Wrapper;
@@ -104,6 +105,7 @@
      * @return a lookup object for the caller of this method, with private access
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public static Lookup lookup() {
         return new Lookup(Reflection.getCallerClass());
     }
--- a/src/java.base/share/classes/java/lang/reflect/Constructor.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/Constructor.java	Mon Aug 08 08:12:20 2016 -0700
@@ -29,6 +29,7 @@
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.ConstructorAccessor;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.reflect.annotation.TypeAnnotation;
 import sun.reflect.annotation.TypeAnnotationParser;
 import sun.reflect.generics.repository.ConstructorRepository;
@@ -435,6 +436,7 @@
      *              by this method fails.
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public T newInstance(Object ... initargs)
         throws InstantiationException, IllegalAccessException,
                IllegalArgumentException, InvocationTargetException
--- a/src/java.base/share/classes/java/lang/reflect/Field.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/Field.java	Mon Aug 08 08:12:20 2016 -0700
@@ -29,6 +29,7 @@
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.FieldAccessor;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.reflect.generics.repository.FieldRepository;
 import sun.reflect.generics.factory.CoreReflectionFactory;
 import sun.reflect.generics.factory.GenericsFactory;
@@ -396,6 +397,7 @@
      *              by this method fails.
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public Object get(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -429,6 +431,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public boolean getBoolean(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -462,6 +465,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public byte getByte(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -497,6 +501,7 @@
      * @see Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public char getChar(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -532,6 +537,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public short getShort(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -567,6 +573,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public int getInt(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -602,6 +609,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public long getLong(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -637,6 +645,7 @@
      * @see Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public float getFloat(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -672,6 +681,7 @@
      * @see       Field#get
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public double getDouble(Object obj)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -749,6 +759,7 @@
      *              by this method fails.
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void set(Object obj, Object value)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -784,6 +795,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setBoolean(Object obj, boolean z)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -819,6 +831,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setByte(Object obj, byte b)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -854,6 +867,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setChar(Object obj, char c)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -889,6 +903,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setShort(Object obj, short s)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -924,6 +939,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setInt(Object obj, int i)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -959,6 +975,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setLong(Object obj, long l)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -994,6 +1011,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setFloat(Object obj, float f)
         throws IllegalArgumentException, IllegalAccessException
     {
@@ -1029,6 +1047,7 @@
      * @see       Field#set
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     public void setDouble(Object obj, double d)
         throws IllegalArgumentException, IllegalAccessException
     {
--- a/src/java.base/share/classes/java/lang/reflect/Method.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/Method.java	Mon Aug 08 08:12:20 2016 -0700
@@ -30,6 +30,7 @@
 import jdk.internal.reflect.CallerSensitive;
 import jdk.internal.reflect.MethodAccessor;
 import jdk.internal.reflect.Reflection;
+import jdk.internal.vm.annotation.ForceInline;
 import sun.reflect.annotation.ExceptionProxy;
 import sun.reflect.annotation.TypeNotPresentExceptionProxy;
 import sun.reflect.generics.repository.MethodRepository;
@@ -517,6 +518,7 @@
      * provoked by this method fails.
      */
     @CallerSensitive
+    @ForceInline // to ensure Reflection.getCallerClass optimization
     @HotSpotIntrinsicCandidate
     public Object invoke(Object obj, Object... args)
         throws IllegalAccessException, IllegalArgumentException,
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Mon Aug 08 08:12:20 2016 -0700
@@ -561,6 +561,7 @@
                         throw new IOException("skipImage : Found extra SOI"
                                 + " marker before getting to EOI");
                     case 0:
+                    case 255:
                     // markers which doesn't contain length data
                     case JPEG.RST0:
                     case JPEG.RST1:
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFImageWriter.java	Mon Aug 08 08:12:20 2016 -0700
@@ -263,15 +263,15 @@
     }
 
     public void setOutput(Object output) {
-        super.setOutput(output);
-
         if (output != null) {
-            reset();
-
             if (!(output instanceof ImageOutputStream)) {
                 throw new IllegalArgumentException
                     ("output not an ImageOutputStream!");
             }
+
+            // reset() must precede setOutput() as it sets output to null
+            reset();
+
             this.stream = (ImageOutputStream)output;
 
             //
@@ -312,6 +312,8 @@
         } else {
             this.stream = null;
         }
+
+        super.setOutput(output);
     }
 
     public IIOMetadata
--- a/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFJPEGCompressor.java	Mon Aug 08 08:12:20 2016 -0700
@@ -79,10 +79,8 @@
 
         try {
             IIORegistry registry = IIORegistry.getDefaultInstance();
-            Class<?> imageReaderClass =
-                Class.forName("javax.imageio.spi.ImageReaderSpi");
             Iterator<?> readerSPIs =
-                registry.getServiceProviders(imageReaderClass,
+                registry.getServiceProviders(ImageReaderSpi.class,
                                              new JPEGSPIFilter(),
                                              true);
             if(readerSPIs.hasNext()) {
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -49,16 +49,18 @@
         int componentState = context.getComponentState();
         if ((componentState & SynthConstants.DISABLED) ==
                               SynthConstants.DISABLED){
-            Color orgColor = g.getColor();
-            g.setColor(context.getStyle().getColor(context,
-                                                   GTKColorType.WHITE));
-            x += 1;
-            y += 1;
-            super.paintText(context, g, text, x, y, mnemonicIndex);
+            if (!GTKLookAndFeel.is3()) {
+                Color orgColor = g.getColor();
+                g.setColor(context.getStyle().getColor(context,
+                        GTKColorType.WHITE));
+                x += 1;
+                y += 1;
+                super.paintText(context, g, text, x, y, mnemonicIndex);
 
-            g.setColor(orgColor);
-            x -= 1;
-            y -= 1;
+                g.setColor(orgColor);
+                x -= 1;
+                y -= 1;
+            }
             super.paintText(context, g, text, x, y, mnemonicIndex);
         }
         else {
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -214,6 +214,18 @@
 
             Region region = context.getRegion();
             GTKStyle style = (GTKStyle) context.getStyle();
+            if (GTKLookAndFeel.is3() && region == Region.MENU) {
+                Object value = style.getClassSpecificValue("arrow-scaling");
+                if (value instanceof Number) {
+                    iconDimension = (int)(((Number) value).floatValue() *
+                            (style.getFont(context).getSize2D() +
+                            2 * style.getClassSpecificIntValue(context,
+                            "indicator-spacing", DEFAULT_ICON_SPACING)));
+                    if (iconDimension > 0) {
+                        return iconDimension;
+                    }
+                }
+            }
             iconDimension = style.getClassSpecificIntValue(context,
                     "indicator-size",
                     (region == Region.CHECK_BOX_MENU_ITEM ||
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Mon Aug 08 08:12:20 2016 -0700
@@ -65,12 +65,6 @@
      */
     static Map<Object, Object> aaTextInfo;
 
-    /**
-     * Solaris, or Linux with Sun JDS in a CJK Locale.
-     * Used to determine if Sun's high quality CJK fonts are present.
-     */
-    private static boolean isSunCJK;
-
     /*
      * Used to override if system (desktop) text anti-aliasing settings should
      * be used. The reasons for this are are is that currently its "off"
@@ -107,36 +101,6 @@
      */
     private static String gtkThemeName = "Default";
 
-    static {
-        String language = Locale.getDefault().getLanguage();
-        boolean cjkLocale =
-            (Locale.CHINESE.getLanguage().equals(language) ||
-             Locale.JAPANESE.getLanguage().equals(language) ||
-             Locale.KOREAN.getLanguage().equals(language));
-
-        if (cjkLocale) {
-            boolean isSunDesktop = false;
-            switch (OSInfo.getOSType()) {
-                case SOLARIS:
-                    isSunDesktop = true;
-                    break;
-
-                case LINUX:
-                    Boolean val = AccessController.doPrivileged(
-                                    new PrivilegedAction<Boolean>() {
-                                        public Boolean run() {
-                                            File f = new File("/etc/sun-release");
-                                            return Boolean.valueOf(f.exists());
-                                        }
-                                    });
-                    isSunDesktop = val.booleanValue();
-            }
-            if (isSunDesktop && !sun.java2d.SunGraphicsEnvironment.isOpenSolaris) {
-                isSunCJK = true;
-            }
-        }
-    }
-
     /**
      * Returns true if running on system containing at least 2.2.
      */
@@ -1474,19 +1438,10 @@
 
         /*
          * Check if system AA font settings should be used.
-         * Sun's JDS (for Linux and Solaris) ships with high quality CJK
-         * fonts and specifies via fontconfig that these be rendered in
-         * B&W to take advantage of the embedded bitmaps.
-         * If is a Sun CJK locale or remote display, indicate by the condition
-         * variable that in this case the L&F recommends ignoring desktop
-         * settings. On other Unixes (eg Linux) this doesn't apply.
-         * REMIND 1: The isSunCJK test is really just a place holder
-         * until we can properly query fontconfig and use the properties
-         * set for specific fonts.
-         * REMIND 2: See comment on isLocalDisplay() definition regarding
+         * REMIND: See comment on isLocalDisplay() definition regarding
          * XRender.
          */
-        gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
+        gtkAAFontSettingsCond = SwingUtilities2.isLocalDisplay();
         aaTextInfo = new HashMap<>(2);
         SwingUtilities2.putAATextInfo(gtkAAFontSettingsCond, aaTextInfo);
     }
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java	Mon Aug 08 08:12:20 2016 -0700
@@ -649,10 +649,19 @@
             y += insets.top;
             if (orientation == JSeparator.HORIZONTAL) {
                 w -= (insets.left + insets.right);
-                detail = "hseparator";
             } else {
                 h -= (insets.top + insets.bottom);
-                detail = "vseparator";
+            }
+            if (GTKLookAndFeel.is3()) {
+                if (id == Region.POPUP_MENU_SEPARATOR) {
+                    detail = "menuitem";
+                    h -= (insets.top + insets.bottom);
+                } else {
+                    detail = "separator";
+                }
+            } else {
+                detail = orientation == JSeparator.HORIZONTAL ?
+                                                    "hseparator" : "vseparator";
             }
             synchronized (UNIXToolkit.GTK_LOCK) {
                 if (! ENGINE.paintCachedImage(g, x, y, w, h, id, state,
@@ -1381,8 +1390,13 @@
         if (gtkState == SynthConstants.MOUSE_OVER) {
             shadow = ShadowType.IN;
         }
+        if (!GTKLookAndFeel.is3()) {
+            x += 3;
+            y += 3;
+            w = h = 7;
+        }
         ENGINE.paintArrow(g, context, Region.MENU_ITEM, gtkState, shadow,
-                dir, "menuitem", x + 3, y + 3, 7, 7);
+                dir, "menuitem", x, y, w, h);
     }
 
     public void paintCheckBoxMenuItemCheckIcon(SynthContext context,
--- a/src/java.desktop/share/classes/java/awt/HeadlessException.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/java/awt/HeadlessException.java	Mon Aug 08 08:12:20 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
@@ -28,10 +28,14 @@
 /**
  * Thrown when code that is dependent on a keyboard, display, or mouse
  * is called in an environment that does not support a keyboard, display,
- * or mouse.
+ * or mouse. Any code that depends on any of those devices should firstly
+ * ensure their availability using the {@code GraphicsEnvironment.isHeadless()}
+ * method and throw {@code HeadlessException} if the latter returns
+ * {@code true}.
  *
  * @since 1.4
  * @author  Michael Martak
+ * @see GraphicsEnvironment#isHeadless
  */
 public class HeadlessException extends UnsupportedOperationException {
     /*
@@ -40,12 +44,24 @@
     private static final long serialVersionUID = 167183644944358563L;
 
     /**
-     * Constructs new {@code HeadlessException}
+     * Constructs new {@code HeadlessException} with empty message.
+     * For such {@code HeadlessException} the default headless error message
+     * may be auto-generated for some platforms.
+     * The text of the default headless message may depend on
+     * whether the GraphicsEnvironment is in fact headless.
+     * That is, the default headless message is both system and environmentally
+     * dependent.
      */
     public HeadlessException() {}
 
     /**
      * Create a new instance with the specified detailed error message.
+     * For some platforms the default headless error message may be
+     * added at the end of the specified message.
+     * The text of the default headless message may depend on
+     * whether the GraphicsEnvironment is in fact headless.
+     * That is, the default headless message is both system and environmentally
+     * dependent.
      *
      * @param  msg the error message
      */
@@ -54,7 +70,16 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Returns the detail message string of this {@code HeadlessException}.
+     * Depending on the platform the message specified in the constructor may
+     * be followed by the default headless error message.
+     * The text of the default headless message may depend on
+     * whether the GraphicsEnvironment is in fact headless.
+     * That is, the default headless message is both system and environmentally
+     * dependent.
+     *
+     * @return  the detail message string of this {@code HeadlessException}
+     *          instance (which may be {@code null}).
      */
     public String getMessage() {
         String superMessage = super.getMessage();
--- a/src/java.desktop/share/classes/java/awt/TrayIcon.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/java/awt/TrayIcon.java	Mon Aug 08 08:12:20 2016 -0700
@@ -47,7 +47,8 @@
  * of the events by itself.  For example, by default, when the
  * right-mouse click is performed on the {@code TrayIcon} it
  * displays the specified popup menu.  When the mouse hovers
- * over the {@code TrayIcon} the tooltip is displayed.
+ * over the {@code TrayIcon} the tooltip is displayed (this behaviour is
+ * platform dependent).
  *
  * <p><strong>Note:</strong> When the {@code MouseEvent} is
  * dispatched to its registered listeners its {@code component}
@@ -174,7 +175,7 @@
 
     /**
      * Creates a {@code TrayIcon} with the specified image and
-     * tooltip text.
+     * tooltip text. Tooltip may be not visible on some platforms.
      *
      * @param image the {@code Image} to be used
      * @param tooltip the string to be used as tooltip text; if the
@@ -200,7 +201,7 @@
 
     /**
      * Creates a {@code TrayIcon} with the specified image,
-     * tooltip and popup menu.
+     * tooltip and popup menu. Tooltip may be not visible on some platforms.
      *
      * @param image the {@code Image} to be used
      * @param tooltip the string to be used as tooltip text; if the
@@ -330,8 +331,8 @@
     /**
      * Sets the tooltip string for this {@code TrayIcon}. The
      * tooltip is displayed automatically when the mouse hovers over
-     * the icon.  Setting the tooltip to {@code null} removes any
-     * tooltip text.
+     * the icon.  Tooltip may be not visible on some platforms.
+     * Setting the tooltip to {@code null} removes any tooltip text.
      *
      * When displayed, the tooltip string may be truncated on some platforms;
      * the number of characters that may be displayed is platform-dependent.
--- a/src/java.desktop/share/classes/java/awt/image/LookupOp.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/java/awt/image/LookupOp.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -253,7 +253,6 @@
      */
     public final WritableRaster filter (Raster src, WritableRaster dst) {
         int numBands  = src.getNumBands();
-        int dstLength = dst.getNumBands();
         int height    = src.getHeight();
         int width     = src.getWidth();
         int srcPix[]  = new int[numBands];
@@ -268,7 +267,7 @@
                 IllegalArgumentException ("Width or height of Rasters do not "+
                                           "match");
         }
-        dstLength = dst.getNumBands();
+        int dstLength = dst.getNumBands();
 
         if (numBands != dstLength) {
             throw new
--- a/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/metadata/IIOMetadata.java	Mon Aug 08 08:12:20 2016 -0700
@@ -414,14 +414,23 @@
         }
     }
 
+    // If updating this method also see the same in ImageReaderWriterSpi.java
     private Class<?> getMetadataFormatClass(String formatClassName) {
         Module thisModule = IIOMetadata.class.getModule();
         Module targetModule = this.getClass().getModule();
-        Class<?> c = Class.forName(targetModule, formatClassName);
+        Class<?> c = null;
+        try {
+            ClassLoader cl = this.getClass().getClassLoader();
+            c = Class.forName(formatClassName, false, cl);
+            if (!IIOMetadataFormat.class.isAssignableFrom(c)) {
+                return null;
+            }
+        } catch (ClassNotFoundException e) {
+        }
         if (thisModule.equals(targetModule) || c == null) {
             return c;
         }
-        if (thisModule.isNamed()) {
+        if (targetModule.isNamed()) {
             int i = formatClassName.lastIndexOf(".");
             String pn = i > 0 ? formatClassName.substring(0, i) : "";
             if (!targetModule.isExported(pn, thisModule)) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java	Mon Aug 08 08:12:20 2016 -0700
@@ -517,18 +517,18 @@
      * @param count The number of data values.
      * @param data The actual data content of the field.
      *
-     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws NullPointerException if {@code tag == null}.
      * @throws IllegalArgumentException if {@code type} is not
      * one of the {@code TIFFTag.TIFF_*} data type constants.
      * @throws IllegalArgumentException if {@code type} is an unacceptable
      * data type for the supplied {@code TIFFTag}.
-     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;0}.
-     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;1}
+     * @throws IllegalArgumentException if {@code count < 0}.
+     * @throws IllegalArgumentException if {@code count < 1}
      * and {@code type} is {@code TIFF_RATIONAL} or
      * {@code TIFF_SRATIONAL}.
-     * @throws IllegalArgumentException if {@code count&nbsp;&ne;&nbsp;1}
+     * @throws IllegalArgumentException if {@code count != 1}
      * and {@code type} is {@code TIFF_IFD_POINTER}.
-     * @throws NullPointerException if {@code data&nbsp;==&nbsp;null}.
+     * @throws NullPointerException if {@code data == null}.
      * @throws IllegalArgumentException if {@code data} is an instance of
      * a class incompatible with the specified type.
      * @throws IllegalArgumentException if the size of the data array is wrong.
@@ -632,12 +632,12 @@
      * @param type One of the {@code TIFFTag.TIFF_*} constants
      * indicating the data type of the field as written to the TIFF stream.
      * @param count The number of data values.
-     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws NullPointerException if {@code tag == null}.
      * @throws IllegalArgumentException if {@code type} is not
      * one of the {@code TIFFTag.TIFF_*} data type constants.
      * @throws IllegalArgumentException if {@code type} is an unacceptable
      * data type for the supplied {@code TIFFTag}.
-     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;0}.
+     * @throws IllegalArgumentException if {@code count < 0}.
      * @see #TIFFField(TIFFTag,int,int,Object)
      */
     public TIFFField(TIFFTag tag, int type, int count) {
@@ -649,16 +649,16 @@
      * value.
      * The field will have type
      * {@link TIFFTag#TIFF_SHORT  TIFF_SHORT} if
-     * {@code val&nbsp;&lt;&nbsp;65536} and type
+     * {@code val < 65536} and type
      * {@link TIFFTag#TIFF_LONG TIFF_LONG} otherwise.  The count
      * of the field will be unity.
      *
      * @param tag The tag to associate with this field.
      * @param value The value to associate with this field.
-     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws NullPointerException if {@code tag == null}.
      * @throws IllegalArgumentException if the derived type is unacceptable
      * for the supplied {@code TIFFTag}.
-     * @throws IllegalArgumentException if {@code value&nbsp;&lt;&nbsp;0}.
+     * @throws IllegalArgumentException if {@code value < 0}.
      */
     public TIFFField(TIFFTag tag, int value) {
         if(tag == null) {
@@ -705,19 +705,26 @@
      * @param offset The IFD offset.
      * @param dir The directory.
      *
-     * @throws NullPointerException if {@code tag&nbsp;==&nbsp;null}.
+     * @throws NullPointerException if {@code tag == null}.
+     * @throws IllegalArgumentException if {@code type} is an unacceptable
+     * data type for the supplied {@code TIFFTag}.
      * @throws IllegalArgumentException if {@code type} is neither
      * {@code TIFFTag.TIFF_LONG} nor {@code TIFFTag.TIFF_IFD_POINTER}.
-     * @throws IllegalArgumentException if {@code type} is an unacceptable
-     * data type for the supplied {@code TIFFTag}.
-     * @throws IllegalArgumentException if {@code offset} is non-positive.
-     * @throws NullPointerException if {@code dir&nbsp;==&nbsp;null}.
+     * @throws IllegalArgumentException if {@code offset <= 0}.
+     * @throws NullPointerException if {@code dir == null}.
      *
      * @see #TIFFField(TIFFTag,int,int,Object)
      */
     public TIFFField(TIFFTag tag, int type, long offset, TIFFDirectory dir) {
-        this(tag, type, 1, new long[] {offset});
-        if (type != TIFFTag.TIFF_LONG && type != TIFFTag.TIFF_IFD_POINTER) {
+        if (tag == null) {
+            throw new NullPointerException("tag == null!");
+        } else if (type < TIFFTag.MIN_DATATYPE || type > TIFFTag.MAX_DATATYPE) {
+            throw new IllegalArgumentException("Unknown data type "+type);
+        } else if (!tag.isDataTypeOK(type)) {
+            throw new IllegalArgumentException("Illegal data type " + type
+                + " for " + tag.getName() + " tag");
+        } else if (type != TIFFTag.TIFF_LONG
+                   && type != TIFFTag.TIFF_IFD_POINTER) {
             throw new IllegalArgumentException("type " + type
                 + " is neither TIFFTag.TIFF_LONG nor TIFFTag.TIFF_IFD_POINTER");
         } else if (offset <= 0) {
@@ -726,6 +733,13 @@
         } else if (dir == null) {
             throw new NullPointerException("dir == null");
         }
+
+        this.tag = tag;
+        this.tagNumber = tag.getNumber();
+        this.type = type;
+        this.count = 1;
+        this.data = new long[] {offset};
+
         this.dir = dir;
     }
 
@@ -739,7 +753,7 @@
     }
 
     /**
-     * Retrieves the tag number in the range {@code [0,&nbsp;65535]}.
+     * Retrieves the tag number in the range {@code [0,65535]}.
      *
      * @return The tag number.
      */
@@ -804,7 +818,7 @@
      *
      * @throws IllegalArgumentException if {@code dataType} is not
      * one of the {@code TIFFTag.TIFF_*} data type constants.
-     * @throws IllegalArgumentException if {@code count&nbsp;&lt;&nbsp;0}.
+     * @throws IllegalArgumentException if {@code count < 0}.
      */
     public static Object createArrayForType(int dataType, int count) {
         if(count < 0) {
--- a/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFTag.java	Mon Aug 08 08:12:20 2016 -0700
@@ -334,8 +334,8 @@
      * an IFD pointer if and only if its {@code TIFFTagSet} is
      * non-{@code null} or the data type {@code TIFF_IFD_POINTER} is
      * legal. This condition will be satisfied if and only if either
-     * {@code getTagSet()&nbsp;!=&nbsp;null} or
-     * {@code isDataTypeOK(TIFF_IFD_POINTER)&nbsp;==&nbsp;true}.
+     * {@code getTagSet() != null} or
+     * {@code isDataTypeOK(TIFF_IFD_POINTER) == true}.
      *
      * <p>Many TIFF extensions use the IFD mechanism in order to limit the
      * number of new tags that may appear in the root IFD.</p>
--- a/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java	Mon Aug 08 08:12:20 2016 -0700
@@ -604,14 +604,23 @@
         }
     }
 
+    // If updating this method also see the same in IIOMetadata.java
     private Class<?> getMetadataFormatClass(String formatClassName) {
         Module thisModule = ImageReaderWriterSpi.class.getModule();
         Module targetModule = this.getClass().getModule();
-        Class<?> c = Class.forName(targetModule, formatClassName);
+        Class<?> c = null;
+        try {
+            ClassLoader cl = this.getClass().getClassLoader();
+            c = Class.forName(formatClassName, false, cl);
+            if (!IIOMetadataFormat.class.isAssignableFrom(c)) {
+                return null;
+            }
+        } catch (ClassNotFoundException e) {
+        }
         if (thisModule.equals(targetModule) || c == null) {
             return c;
         }
-        if (thisModule.isNamed()) {
+        if (targetModule.isNamed()) {
             int i = formatClassName.lastIndexOf(".");
             String pn = i > 0 ? formatClassName.substring(0, i) : "";
             if (!targetModule.isExported(pn, thisModule)) {
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -229,10 +229,13 @@
           AbstractButton b = (AbstractButton) e.getSource();
 
           if(b.contains(e.getX(), e.getY())) {
-              long multiClickThreshhold = b.getMultiClickThreshhold();
               long lastTime = lastPressedTimestamp;
-              long currentTime = lastPressedTimestamp = e.getWhen();
-              if (lastTime != -1 && currentTime - lastTime < multiClickThreshhold) {
+              lastPressedTimestamp = e.getWhen();
+              long timeSinceLastClick = lastPressedTimestamp - lastTime;
+              if (lastTime != -1 &&
+                  timeSinceLastClick > 0 &&
+                  timeSinceLastClick < b.getMultiClickThreshhold()) {
+
                   shouldDiscardRelease = true;
                   return;
               }
@@ -325,4 +328,4 @@
                     !((AbstractButton)sender).getModel().isEnabled());
         }
     }
-}
\ No newline at end of file
+}
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Mon Aug 08 08:12:20 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
@@ -940,9 +940,10 @@
                 rootView.setSize(d.width - i.left - i.right -
                         caretMargin, d.height - i.top - i.bottom);
             }
-            else if (d.width <= 0 || d.height <= 0) {
+            else if (!rootViewInitialized && (d.width <= 0 || d.height <= 0)) {
                 // Probably haven't been layed out yet, force some sort of
                 // initial sizing.
+                rootViewInitialized = true;
                 rootView.setSize(Integer.MAX_VALUE, Integer.MAX_VALUE);
             }
             d.width = (int) Math.min((long) rootView.getPreferredSpan(View.X_AXIS) +
@@ -1346,6 +1347,7 @@
     private static final Position.Bias[] discardBias = new Position.Bias[1];
     private DefaultCaret dropCaret;
     private int caretMargin;
+    private boolean rootViewInitialized;
 
     /**
      * Root view that acts as a gateway between the component
--- a/src/java.desktop/share/classes/sun/awt/FontConfiguration.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/sun/awt/FontConfiguration.java	Mon Aug 08 08:12:20 2016 -0700
@@ -251,12 +251,24 @@
 
     private File findImpl(String fname) {
         File f = new File(fname + ".properties");
+        if (FontUtilities.debugFonts()) {
+            logger.info("Looking for text fontconfig file : " + f);
+        }
         if (f.canRead()) {
+            if (FontUtilities.debugFonts()) {
+                logger.info("Found file : " + f);
+            }
             isProperties = true;
             return f;
         }
         f = new File(fname + ".bfc");
+        if (FontUtilities.debugFonts()) {
+            logger.info("Looking for binary fontconfig file : " + f);
+        }
         if (f.canRead()) {
+            if (FontUtilities.debugFonts()) {
+                logger.info("Found file : " + f);
+            }
             isProperties = false;
             return f;
         }
@@ -305,6 +317,9 @@
         if (configFile != null) {
             return configFile;
         }
+        if (FontUtilities.debugFonts()) {
+            logger.info("Did not find a fontconfig file.");
+        }
         return null;
     }
 
--- a/src/java.desktop/share/classes/sun/awt/IconInfo.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/sun/awt/IconInfo.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,10 +25,12 @@
 package sun.awt;
 import java.awt.*;
 import java.awt.color.*;
+import java.awt.geom.AffineTransform;
 import java.awt.image.*;
 import sun.awt.image.ToolkitImage;
 import sun.awt.image.ImageRepresentation;
 import java.util.Arrays;
+import sun.java2d.pipe.Region;
 
 public class IconInfo {
     /**
@@ -101,7 +103,7 @@
         }
         this.scaledWidth = width;
         this.scaledHeight = height;
-        this.rawLength = width * height + 2;
+        this.rawLength = getScaledRawLength();
     }
 
     /*
@@ -110,7 +112,27 @@
     public void setScaledSize(int width, int height) {
         this.scaledWidth = width;
         this.scaledHeight = height;
-        this.rawLength = width * height + 2;
+        this.rawLength = getScaledRawLength();
+    }
+
+    /*
+    * returns scaled raw length.
+     */
+    private int getScaledRawLength() {
+        int scaledWidthAndHeight[] = getScaledWidthAndHeight(width, height);
+        return scaledWidthAndHeight[0] * scaledWidthAndHeight[1] + 2;
+    }
+
+    /*
+    * returns the scaled width and height.
+     */
+    private static int[] getScaledWidthAndHeight(int width, int height) {
+        AffineTransform tx = GraphicsEnvironment.getLocalGraphicsEnvironment().
+                getDefaultScreenDevice().getDefaultConfiguration().
+                getDefaultTransform();
+        int w = Region.clipScale(width, tx.getScaleX());
+        int h = Region.clipScale(height, tx.getScaleY());
+        return new int[]{w, h};
     }
 
     public boolean isValid() {
@@ -215,6 +237,9 @@
             new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), 32,
                                  0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000,
                                  false, DataBuffer.TYPE_INT);
+        int scaledWidthAndHeight[] = getScaledWidthAndHeight(width, height);
+        width = scaledWidthAndHeight[0];
+        height = scaledWidthAndHeight[1];
         DataBufferInt buffer = new DataBufferInt(width * height);
         WritableRaster raster =
             Raster.createPackedRaster(buffer, width, height,
--- a/src/java.desktop/share/classes/sun/awt/RequestFocusController.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/sun/awt/RequestFocusController.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
--- a/src/java.desktop/share/classes/sun/font/FontUtilities.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/sun/font/FontUtilities.java	Mon Aug 08 08:12:20 2016 -0700
@@ -50,12 +50,6 @@
 
     public static boolean isMacOSX;
 
-    public static boolean isSolaris8;
-
-    public static boolean isSolaris9;
-
-    public static boolean isOpenSolaris;
-
     public static boolean useT2K;
 
     public static boolean isWindows;
@@ -88,37 +82,6 @@
                 } else {
                     useT2K = false;
                 }
-                if (isSolaris) {
-                    String version = System.getProperty("os.version", "0.0");
-                    isSolaris8 = version.startsWith("5.8");
-                    isSolaris9 = version.startsWith("5.9");
-                    float ver = Float.parseFloat(version);
-                    if (ver > 5.10f) {
-                        File f = new File("/etc/release");
-                        String line = null;
-                        try {
-                            FileInputStream fis = new FileInputStream(f);
-                            InputStreamReader isr = new InputStreamReader(
-                                                            fis, "ISO-8859-1");
-                            BufferedReader br = new BufferedReader(isr);
-                            line = br.readLine();
-                            fis.close();
-                        } catch (Exception ex) {
-                            // Nothing to do here.
-                        }
-                        if (line != null && line.indexOf("OpenSolaris") >= 0) {
-                            isOpenSolaris = true;
-                        } else {
-                            isOpenSolaris = false;
-                        }
-                    } else {
-                        isOpenSolaris = false;
-                    }
-                } else {
-                    isSolaris8 = false;
-                    isSolaris9 = false;
-                    isOpenSolaris = false;
-                }
                 isWindows = osName.startsWith("Windows");
                 String jreLibDirName = System.getProperty("java.home", "")
                                                       + File.separator + "lib";
--- a/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java	Mon Aug 08 08:12:20 2016 -0700
@@ -32,8 +32,6 @@
 
     static final char REVERSE_SOLIDUS = 0x005c; // the backslash char.
     static final char JA_YEN = 0x00a5;
-    static final char JA_FULLWIDTH_TILDE_CHAR = 0xff5e;
-    static final char JA_WAVE_DASH_CHAR = 0x301c;
 
     /* if running on Solaris and default Locale is ja_JP then
      * we map need to remap reverse solidus (backslash) to Yen as
@@ -41,7 +39,6 @@
      */
     static final boolean isJAlocale = Locale.JAPAN.equals(Locale.getDefault());
     private final boolean needsJAremapping;
-    private boolean remapJAWaveDash;
 
     TrueTypeFont font;
     CMap cmap;
@@ -66,10 +63,6 @@
         }
         if (FontUtilities.isSolaris && isJAlocale && font.supportsJA()) {
             needsJAremapping = true;
-            if (FontUtilities.isSolaris8 &&
-                getGlyphFromCMAP(JA_WAVE_DASH_CHAR) == missingGlyph) {
-                remapJAWaveDash = true;
-            }
         } else {
             needsJAremapping = false;
         }
@@ -113,35 +106,12 @@
         cmap = CMap.theNullCmap;
     }
 
-    @SuppressWarnings("fallthrough")
     private final char remapJAChar(char unicode) {
-        switch (unicode) {
-        case REVERSE_SOLIDUS:
-            return JA_YEN;
-            /* This is a workaround for bug 4533422.
-             * Japanese wave dash missing from Solaris JA TrueType fonts.
-             */
-        case JA_WAVE_DASH_CHAR:
-            if (remapJAWaveDash) {
-                return JA_FULLWIDTH_TILDE_CHAR;
-            }
-        default: return unicode;
-        }
+        return (unicode == REVERSE_SOLIDUS) ? JA_YEN : unicode;
     }
-    @SuppressWarnings("fallthrough")
+
     private final int remapJAIntChar(int unicode) {
-        switch (unicode) {
-        case REVERSE_SOLIDUS:
-            return JA_YEN;
-            /* This is a workaround for bug 4533422.
-             * Japanese wave dash missing from Solaris JA TrueType fonts.
-             */
-        case JA_WAVE_DASH_CHAR:
-            if (remapJAWaveDash) {
-                return JA_FULLWIDTH_TILDE_CHAR;
-            }
-        default: return unicode;
-        }
+        return (unicode == REVERSE_SOLIDUS) ? JA_YEN : unicode;
     }
 
     public int charToGlyph(char unicode) {
--- a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java	Mon Aug 08 08:12:20 2016 -0700
@@ -105,6 +105,7 @@
 
 //REMIND: Remove use of this class when IPPPrintService is moved to share directory.
 import java.lang.reflect.Method;
+import javax.print.attribute.standard.JobSheets;
 
 /**
  * A class which initiates and executes a PostScript printer job.
@@ -1573,10 +1574,10 @@
 
     private String[] printExecCmd(String printer, String options,
                                   boolean noJobSheet,
-                                  String banner, int copies, String spoolFile) {
+                                  String jobTitle, int copies, String spoolFile) {
         int PRINTER = 0x1;
         int OPTIONS = 0x2;
-        int BANNER  = 0x4;
+        int JOBTITLE  = 0x4;
         int COPIES  = 0x8;
         int NOSHEET = 0x10;
         int pFlags = 0;
@@ -1592,8 +1593,8 @@
             pFlags |= OPTIONS;
             ncomps+=1;
         }
-        if (banner != null && !banner.equals("")) {
-            pFlags |= BANNER;
+        if (jobTitle != null && !jobTitle.equals("")) {
+            pFlags |= JOBTITLE;
             ncomps+=1;
         }
         if (copies > 1) {
@@ -1603,23 +1604,29 @@
         if (noJobSheet) {
             pFlags |= NOSHEET;
             ncomps+=1;
+        } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+            ncomps+=1; // for jobsheet
         }
 
-       String osname = System.getProperty("os.name");
-       if (osname.equals("Linux") || osname.contains("OS X")) {
+        String osname = System.getProperty("os.name");
+        if (osname.equals("Linux") || osname.contains("OS X")) {
             execCmd = new String[ncomps];
             execCmd[n++] = "/usr/bin/lpr";
             if ((pFlags & PRINTER) != 0) {
                 execCmd[n++] = "-P" + printer;
             }
-            if ((pFlags & BANNER) != 0) {
-                execCmd[n++] = "-J"  + banner;
+            if ((pFlags & JOBTITLE) != 0) {
+                execCmd[n++] = "-J"  + jobTitle;
             }
             if ((pFlags & COPIES) != 0) {
                 execCmd[n++] = "-#" + copies;
             }
             if ((pFlags & NOSHEET) != 0) {
                 execCmd[n++] = "-h";
+            } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+                execCmd[n++] = "-o job-sheets=standard";
             }
             if ((pFlags & OPTIONS) != 0) {
                 execCmd[n++] = new String(options);
@@ -1632,14 +1639,17 @@
             if ((pFlags & PRINTER) != 0) {
                 execCmd[n++] = "-d" + printer;
             }
-            if ((pFlags & BANNER) != 0) {
-                execCmd[n++] = "-t"  + banner;
+            if ((pFlags & JOBTITLE) != 0) {
+                execCmd[n++] = "-t"  + jobTitle;
             }
             if ((pFlags & COPIES) != 0) {
                 execCmd[n++] = "-n" + copies;
             }
             if ((pFlags & NOSHEET) != 0) {
                 execCmd[n++] = "-o nobanner";
+            } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+                execCmd[n++] = "-o job-sheets=standard";
             }
             if ((pFlags & OPTIONS) != 0) {
                 execCmd[n++] = "-o" + options;
--- a/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/sun/print/PSStreamPrintService.java	Mon Aug 08 08:12:20 2016 -0700
@@ -283,7 +283,16 @@
         } else if (category == OrientationRequested.class) {
             if (flavor == null ||
                 flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) ||
-                flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE)) {
+                flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE) ||
+                flavor.equals(DocFlavor.INPUT_STREAM.GIF) ||
+                flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
+                flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
+                flavor.equals(DocFlavor.BYTE_ARRAY.GIF) ||
+                flavor.equals(DocFlavor.BYTE_ARRAY.JPEG) ||
+                flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
+                flavor.equals(DocFlavor.URL.GIF) ||
+                flavor.equals(DocFlavor.URL.JPEG) ||
+                flavor.equals(DocFlavor.URL.PNG)) {
                 OrientationRequested []arr = new OrientationRequested[3];
                 arr[0] = OrientationRequested.PORTRAIT;
                 arr[1] = OrientationRequested.LANDSCAPE;
--- a/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/sun/print/RasterPrinterJob.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1271,6 +1271,12 @@
         JobSheets jobSheets = (JobSheets)attributes.get(JobSheets.class);
         if (jobSheets != null) {
             noJobSheet = jobSheets == JobSheets.NONE;
+        } else {
+            JobSheets js = (JobSheets)getPrintService().
+                                      getDefaultAttributeValue(JobSheets.class);
+            if (js != null && js.equals(JobSheets.NONE)) {
+                noJobSheet = true;
+            }
         }
 
         JobName jobName = (JobName)attributes.get(JobName.class);
--- a/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/classes/sun/print/ServiceDialog.java	Mon Aug 08 08:12:20 2016 -0700
@@ -2759,10 +2759,10 @@
             if (js == null) {
                 js = (JobSheets)psCurrent.getDefaultAttributeValue(jsCategory);
                 if (js == null) {
-                    js = JobSheets.NONE;
+                    js = JobSheets.STANDARD;
                 }
             }
-            cbJobSheets.setSelected(js != JobSheets.NONE);
+            cbJobSheets.setSelected(js != JobSheets.NONE && jsSupported);
             cbJobSheets.setEnabled(jsSupported);
 
             // setup JobPriority spinner
--- a/src/java.desktop/share/native/libawt/java2d/ShaderList.c	Fri Aug 05 09:50:29 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-#include <malloc.h>
-#include <string.h>
-
-#include "ShaderList.h"
-#include "Trace.h"
-
-/**
- * Creates a new ShaderInfo that wraps the given fragment program handle
- * and related data and stores it at the front of the provided ShaderList.
- * If the addition causes the ShaderList to outgrow its defined capacity,
- * the least-recently used item in the list (including its fragment program
- * object) will be disposed.
- */
-void
-ShaderList_AddProgram(ShaderList *programList,
-                      jlong programID,
-                      jint compType, jint compMode, jint flags)
-{
-    ShaderInfo *info;
-
-    J2dTraceLn(J2D_TRACE_INFO, "ShaderList_AddProgram");
-
-    // create new ShaderInfo
-    info = (ShaderInfo *)malloc(sizeof(ShaderInfo));
-    if (info == NULL) {
-        J2dTraceLn(J2D_TRACE_ERROR,
-                   "OGLContext_AddProgram: could not allocate ShaderInfo");
-        return;
-    }
-
-    // fill in the information
-    info->next = programList->head;
-    info->programID = programID;
-    info->compType = compType;
-    info->compMode = compMode;
-    info->flags = flags;
-
-    // insert it at the head of the list
-    programList->head = info;
-
-    // run through the list and see if we need to delete the least
-    // recently used item
-    {
-        int i = 1;
-        ShaderInfo *prev = NULL;
-        ShaderInfo *curr = info->next;
-        while (curr != NULL) {
-            if (i >= programList->maxItems) {
-                prev->next = NULL;
-                programList->dispose(curr->programID);
-                free(curr);
-                break;
-            }
-            i++;
-            prev = curr;
-            curr = curr->next;
-        }
-    }
-}
-
-/**
- * Locates a fragment program handle given a list of shader programs
- * (ShaderInfos), using the provided composite state and flags as search
- * parameters.  The "flags" parameter is a bitwise-or'd value that helps
- * differentiate one program for another; the interpretation of this value
- * varies depending on the type of shader (BufImgOp, Paint, etc) but here
- * it is only used to find another ShaderInfo with that same "flags" value.
- * If no matching program can be located, this method returns 0.
- */
-jlong
-ShaderList_FindProgram(ShaderList *programList,
-                       jint compType, jint compMode, jint flags)
-{
-    ShaderInfo *prev = NULL;
-    ShaderInfo *info = programList->head;
-
-    J2dTraceLn(J2D_TRACE_INFO, "ShaderList_FindProgram");
-
-    while (info != NULL) {
-        if (compType == info->compType &&
-            compMode == info->compMode &&
-            flags == info->flags)
-        {
-            // it's a match: move it to the front of the list (if it's not
-            // there already) and patch up the links
-            if (info != programList->head) {
-                prev->next = info->next;
-                info->next = programList->head;
-                programList->head = info;
-            }
-            return info->programID;
-        }
-        prev = info;
-        info = info->next;
-    }
-    return 0;
-}
-
-/**
- * Disposes all entries (and their associated shader program objects)
- * contained in the given ShaderList.
- */
-void
-ShaderList_Dispose(ShaderList *programList)
-{
-    ShaderInfo *info = programList->head;
-
-    J2dTraceLn(J2D_TRACE_INFO, "ShaderList_Dispose");
-
-    while (info != NULL) {
-        ShaderInfo *tmp = info->next;
-        programList->dispose(info->programID);
-        free(info);
-        info = tmp;
-    }
-
-    programList->head = NULL;
-}
--- a/src/java.desktop/share/native/libawt/java2d/ShaderList.h	Fri Aug 05 09:50:29 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2007, 2008, 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.
- */
-
-#ifndef ShaderList_h_Included
-#define ShaderList_h_Included
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "jni.h"
-#include "jlong.h"
-
-typedef void (ShaderDisposeFunc)(jlong programID);
-
-/**
- * The following structures are used to maintain a list of fragment program
- * objects and their associated attributes.  Each logical shader (e.g.
- * RadialGradientPaint shader, ConvolveOp shader) can have a number of
- * different variants depending on a number of factors, such as whether
- * antialiasing is enabled or the current composite mode.  Since the number
- * of possible combinations of these factors is in the hundreds, we need
- * some way to create fragment programs on an as-needed basis, and also
- * keep them in a limited sized cache to avoid creating too many objects.
- *
- * The ShaderInfo structure keeps a reference to the fragment program's
- * handle, as well as some other values that help differentiate one ShaderInfo
- * from another.  ShaderInfos can be chained together to form a linked list.
- *
- * The ShaderList structure acts as a cache for ShaderInfos, placing
- * most-recently used items at the front, and removing items from the
- * cache when its size exceeds the "maxItems" limit.
- */
-typedef struct _ShaderInfo ShaderInfo;
-
-typedef struct {
-    ShaderInfo        *head;
-    ShaderDisposeFunc *dispose;
-    jint              maxItems;
-} ShaderList;
-
-struct _ShaderInfo {
-    ShaderInfo  *next;
-    jlong       programID;
-    jint        compType;
-    jint        compMode;
-    jint        flags;
-};
-
-void ShaderList_AddProgram(ShaderList *programList,
-                           jlong programID,
-                           jint compType, jint compMode,
-                           jint flags);
-jlong ShaderList_FindProgram(ShaderList *programList,
-                             jint compType, jint compMode,
-                             jint flags);
-void ShaderList_Dispose(ShaderList *programList);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* ShaderList_h_Included */
--- a/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/libawt/java2d/loops/GraphicsPrimitiveMgr.c	Mon Aug 08 08:12:20 2016 -0700
@@ -104,40 +104,47 @@
     {
         return;
     }
-    RegisterID = (*env)->GetStaticMethodID(env, GPMgr,
-                                           RegisterName, RegisterSig);
-    pNativePrimID = (*env)->GetFieldID(env, GP, "pNativePrim", "J");
-    pixelID = (*env)->GetFieldID(env, SG2D, "pixel", "I");
-    eargbID = (*env)->GetFieldID(env, SG2D, "eargb", "I");
-    clipRegionID = (*env)->GetFieldID(env, SG2D, "clipRegion",
-                                      "Lsun/java2d/pipe/Region;");
-    compositeID = (*env)->GetFieldID(env, SG2D, "composite",
-                                     "Ljava/awt/Composite;");
-    lcdTextContrastID =
-        (*env)->GetFieldID(env, SG2D, "lcdTextContrast", "I");
-    getRgbID = (*env)->GetMethodID(env, Color, "getRGB", "()I");
-    xorPixelID = (*env)->GetFieldID(env, XORComp, "xorPixel", "I");
-    xorColorID = (*env)->GetFieldID(env, XORComp, "xorColor",
-                                    "Ljava/awt/Color;");
-    alphaMaskID = (*env)->GetFieldID(env, XORComp, "alphaMask", "I");
-    ruleID = (*env)->GetFieldID(env, AlphaComp, "rule", "I");
-    extraAlphaID = (*env)->GetFieldID(env, AlphaComp, "extraAlpha", "F");
+    CHECK_NULL(RegisterID =
+        (*env)->GetStaticMethodID(env, GPMgr, RegisterName, RegisterSig));
+    CHECK_NULL(pNativePrimID = (*env)->GetFieldID(env, GP, "pNativePrim", "J"));
+    CHECK_NULL(pixelID = (*env)->GetFieldID(env, SG2D, "pixel", "I"));
+    CHECK_NULL(eargbID = (*env)->GetFieldID(env, SG2D, "eargb", "I"));
+    CHECK_NULL(clipRegionID =
+        (*env)->GetFieldID(env, SG2D, "clipRegion", "Lsun/java2d/pipe/Region;"));
+    CHECK_NULL(compositeID =
+        (*env)->GetFieldID(env, SG2D, "composite", "Ljava/awt/Composite;"));
+    CHECK_NULL(lcdTextContrastID =
+        (*env)->GetFieldID(env, SG2D, "lcdTextContrast", "I"));
+    CHECK_NULL(getRgbID = (*env)->GetMethodID(env, Color, "getRGB", "()I"));
+    CHECK_NULL(xorPixelID = (*env)->GetFieldID(env, XORComp, "xorPixel", "I"));
+    CHECK_NULL(xorColorID =
+        (*env)->GetFieldID(env, XORComp, "xorColor", "Ljava/awt/Color;"));
+    CHECK_NULL(alphaMaskID =
+        (*env)->GetFieldID(env, XORComp, "alphaMask", "I"));
+    CHECK_NULL(ruleID = (*env)->GetFieldID(env, AlphaComp, "rule", "I"));
+    CHECK_NULL(extraAlphaID =
+        (*env)->GetFieldID(env, AlphaComp, "extraAlpha", "F"));
 
 
-    m00ID = (*env)->GetFieldID(env, AT, "m00", "D");
-    m01ID = (*env)->GetFieldID(env, AT, "m01", "D");
-    m02ID = (*env)->GetFieldID(env, AT, "m02", "D");
-    m10ID = (*env)->GetFieldID(env, AT, "m10", "D");
-    m11ID = (*env)->GetFieldID(env, AT, "m11", "D");
-    m12ID = (*env)->GetFieldID(env, AT, "m12", "D");
+    CHECK_NULL(m00ID = (*env)->GetFieldID(env, AT, "m00", "D"));
+    CHECK_NULL(m01ID = (*env)->GetFieldID(env, AT, "m01", "D"));
+    CHECK_NULL(m02ID = (*env)->GetFieldID(env, AT, "m02", "D"));
+    CHECK_NULL(m10ID = (*env)->GetFieldID(env, AT, "m10", "D"));
+    CHECK_NULL(m11ID = (*env)->GetFieldID(env, AT, "m11", "D"));
+    CHECK_NULL(m12ID = (*env)->GetFieldID(env, AT, "m12", "D"));
 
-    path2DTypesID = (*env)->GetFieldID(env, Path2D, "pointTypes", "[B");
-    path2DNumTypesID = (*env)->GetFieldID(env, Path2D, "numTypes", "I");
-    path2DWindingRuleID = (*env)->GetFieldID(env, Path2D, "windingRule", "I");
-    path2DFloatCoordsID = (*env)->GetFieldID(env, Path2DFloat,
-                                             "floatCoords", "[F");
-    sg2dStrokeHintID = (*env)->GetFieldID(env, SG2D, "strokeHint", "I");
-    fid = (*env)->GetStaticFieldID(env, SHints, "INTVAL_STROKE_PURE", "I");
+    CHECK_NULL(path2DTypesID =
+        (*env)->GetFieldID(env, Path2D, "pointTypes", "[B"));
+    CHECK_NULL(path2DNumTypesID =
+        (*env)->GetFieldID(env, Path2D, "numTypes", "I"));
+    CHECK_NULL(path2DWindingRuleID =
+        (*env)->GetFieldID(env, Path2D, "windingRule", "I"));
+    CHECK_NULL(path2DFloatCoordsID =
+        (*env)->GetFieldID(env, Path2DFloat, "floatCoords", "[F"));
+    CHECK_NULL(sg2dStrokeHintID =
+        (*env)->GetFieldID(env, SG2D, "strokeHint", "I"));
+    CHECK_NULL(fid =
+        (*env)->GetStaticFieldID(env, SHints, "INTVAL_STROKE_PURE", "I"));
     sunHints_INTVAL_STROKE_PURE = (*env)->GetStaticIntField(env, SHints, fid);
 }
 
--- a/src/java.desktop/share/native/libfontmanager/HBShaper.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/libfontmanager/HBShaper.c	Mon Aug 08 08:12:20 2016 -0700
@@ -278,6 +278,12 @@
      hb_buffer_set_direction(buffer, direction);
 
      chars = (*env)->GetCharArrayElements(env, text, NULL);
+     if ((*env)->ExceptionCheck(env)) {
+         hb_buffer_destroy(buffer);
+         hb_font_destroy(hbfont);
+         free((void*)jdkFontInfo);
+         return JNI_FALSE;
+     }
      len = (*env)->GetArrayLength(env, text);
 
      hb_buffer_add_utf16(buffer, chars, len, offset, limit-offset);
@@ -309,6 +315,7 @@
      hb_font_destroy(hbfont);
      free((void*)jdkFontInfo);
      if (features != NULL) free(features);
+     (*env)->ReleaseCharArrayElements(env, text, chars, JNI_ABORT);
 
      return JNI_TRUE;
 }
--- a/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/libjavajpeg/imageioJPEG.c	Mon Aug 08 08:12:20 2016 -0700
@@ -952,7 +952,7 @@
                                 sb->hstreamBuffer, 0,
                                 sb->bufferLength);
     if ((ret > 0) && ((unsigned int)ret > sb->bufferLength)) {
-         ret = sb->bufferLength;
+         ret = (int)sb->bufferLength;
     }
     if ((*env)->ExceptionOccurred(env)
         || !GET_ARRAYS(env, data, &(src->next_input_byte))) {
@@ -1050,7 +1050,7 @@
                                 JPEGImageReader_readInputDataID,
                                 sb->hstreamBuffer,
                                 offset, buflen);
-    if ((ret > 0) && ((unsigned int)ret > buflen)) ret = buflen;
+    if ((ret > 0) && ((unsigned int)ret > buflen)) ret = (int)buflen;
     if ((*env)->ExceptionOccurred(env)
         || !GET_ARRAYS(env, data, &(src->next_input_byte))) {
         cinfo->err->error_exit((j_common_ptr) cinfo);
@@ -1774,8 +1774,8 @@
             v_samp1 = cinfo->comp_info[1].v_samp_factor;
             v_samp2 = cinfo->comp_info[2].v_samp_factor;
 
-            if ((h_samp1 > h_samp0) && (h_samp2 > h_samp0) ||
-                (v_samp1 > v_samp0) && (v_samp2 > v_samp0))
+            if (((h_samp1 > h_samp0) && (h_samp2 > h_samp0)) ||
+                ((v_samp1 > v_samp0) && (v_samp2 > v_samp0)))
             {
                 cinfo->jpeg_color_space = JCS_YCCK;
                 /* Leave the output space as CMYK */
@@ -1866,7 +1866,6 @@
     pixelBufferPtr pb;
     sun_jpeg_error_ptr jerr;
     boolean done;
-    boolean mustScale = FALSE;
     boolean progressive = FALSE;
     boolean orderedBands = TRUE;
     imageIODataPtr data = (imageIODataPtr)jlong_to_ptr(ptr);
@@ -2634,6 +2633,18 @@
     RELEASE_ARRAYS(env, data, NULL);
 }
 
+static void freeArray(UINT8** arr, jint size) {
+    int i;
+    if (arr != NULL) {
+        for (i = 0; i < size; i++) {
+            if (arr[i] != NULL) {
+                free(arr[i]);
+            }
+        }
+        free(arr);
+    }
+}
+
 JNIEXPORT jboolean JNICALL
 Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
     (JNIEnv *env,
@@ -2742,6 +2753,8 @@
                 scale = (UINT8**) calloc(numBands, sizeof(UINT8*));
 
                 if (scale == NULL) {
+                    (*env)->ReleaseIntArrayElements(env, bandSizes,
+                                                    bandSize, JNI_ABORT);
                     JNU_ThrowByName( env, "java/lang/OutOfMemoryError",
                                      "Writing JPEG Stream");
                     return JNI_FALSE;
@@ -2758,6 +2771,8 @@
                     free(scale[j]);
                 }
                 free(scale);
+                (*env)->ReleaseIntArrayElements(env, bandSizes,
+                                                bandSize, JNI_ABORT);
                 JNU_ThrowByName( env, "java/lang/OutOfMemoryError",
                                  "Writing JPEG Stream");
                 return JNI_FALSE;
@@ -2782,21 +2797,14 @@
     pb = &data->pixelBuf;
 
     if (setPixelBuffer(env, pb, buffer) == NOT_OK) {
-        if (scale != NULL) {
-            for (i = 0; i < numBands; i++) {
-                if (scale[i] != NULL) {
-                    free(scale[i]);
-                }
-            }
-            free(scale);
-        }
+        freeArray(scale, numBands);
         return data->abortFlag;  // We already threw an out of memory exception
     }
 
     // Allocate a 1-scanline buffer
     scanLinePtr = (JSAMPROW)malloc(scanLineSize);
     if (scanLinePtr == NULL) {
-        RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
+        freeArray(scale, numBands);
         JNU_ThrowByName( env,
                          "java/lang/OutOfMemoryError",
                          "Writing JPEG Stream");
@@ -2818,15 +2826,7 @@
             JNU_ThrowByName(env, "javax/imageio/IIOException", buffer);
         }
 
-        if (scale != NULL) {
-            for (i = 0; i < numBands; i++) {
-                if (scale[i] != NULL) {
-                    free(scale[i]);
-                }
-            }
-            free(scale);
-        }
-
+        freeArray(scale, numBands);
         free(scanLinePtr);
         return data->abortFlag;
     }
@@ -2874,7 +2874,11 @@
     if (qsels) {
         (*env)->ReleaseIntArrayElements(env, QtableSelectors, qsels, JNI_ABORT);
     }
-    if (!success) return data->abortFlag;
+    if (!success) {
+        freeArray(scale, numBands);
+        free(scanLinePtr);
+        return data->abortFlag;
+    }
 
     jpeg_suppress_tables(cinfo, TRUE);  // Disable writing any current
 
@@ -2892,6 +2896,8 @@
     if (GET_ARRAYS(env, data,
                    (const JOCTET **)(&dest->next_output_byte)) == NOT_OK) {
         (*env)->ExceptionClear(env);
+        freeArray(scale, numBands);
+        free(scanLinePtr);
         JNU_ThrowByName(env,
                         "javax/imageio/IIOException",
                         "Array pin failed");
@@ -2926,7 +2932,12 @@
             cinfo->scan_info = cinfo->script_space;
             scanptr = (int *) cinfo->script_space;
             scanData = (*env)->GetIntArrayElements(env, scanInfo, NULL);
-            CHECK_NULL_RETURN(scanData, data->abortFlag);
+            if (scanData == NULL) {
+                RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
+                freeArray(scale, numBands);
+                free(scanLinePtr);
+                return data->abortFlag;
+            }
             // number of jints per scan is 9
             // We avoid a memcpy to handle different size ints
             for (i = 0; i < numScans*9; i++) {
@@ -3022,15 +3033,7 @@
         jpeg_abort((j_common_ptr)cinfo);
     }
 
-    if (scale != NULL) {
-        for (i = 0; i < numBands; i++) {
-            if (scale[i] != NULL) {
-                free(scale[i]);
-            }
-        }
-        free(scale);
-    }
-
+    freeArray(scale, numBands);
     free(scanLinePtr);
     RELEASE_ARRAYS(env, data, NULL);
     return data->abortFlag;
--- a/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/libjavajpeg/jpegdecoder.c	Mon Aug 08 08:12:20 2016 -0700
@@ -358,7 +358,7 @@
     }
     ret = (*env)->CallIntMethod(env, src->hInputStream, InputStream_readID,
                                 src->hInputBuffer, offset, buflen);
-    if ((ret > 0) && ((unsigned int)ret > buflen)) ret = buflen;
+    if ((ret > 0) && ((unsigned int)ret > buflen)) ret = (int)buflen;
     if ((*env)->ExceptionOccurred(env) || !GET_ARRAYS(env, src)) {
         cinfo->err->error_exit((struct jpeg_common_struct *) cinfo);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/share/native/liblcms/cmsalpha.c	Mon Aug 08 08:12:20 2016 -0700
@@ -0,0 +1,547 @@
+/*
+ * 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.
+ */
+
+// This file is available under and governed by the GNU General Public
+// License version 2 only, as published by the Free Software Foundation.
+// However, the following notice accompanied the original version of this
+// file:
+//
+//---------------------------------------------------------------------------------
+//
+//  Little Color Management System
+//  Copyright (c) 1998-2016 Marti Maria Saguer
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the Software
+// is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
+// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//---------------------------------------------------------------------------------
+//
+
+#include "lcms2_internal.h"
+
+
+// Alpha copy ------------------------------------------------------------------------------------------------------------------
+
+// Floor to byte, taking care of saturation
+cmsINLINE cmsUInt8Number _cmsQuickSaturateByte(cmsFloat64Number d)
+{
+       d += 0.5;
+       if (d <= 0) return 0;
+       if (d >= 255.0) return 255;
+
+       return (cmsUInt8Number) _cmsQuickFloorWord(d);
+}
+
+
+// Return the size in bytes of a given formatter
+static
+int trueBytesSize(cmsUInt32Number Format)
+{
+       int fmt_bytes = T_BYTES(Format);
+
+       // For double, the T_BYTES field returns zero
+       if (fmt_bytes == 0)
+              return sizeof(double);
+
+       // Otherwise, it is already correct for all formats
+       return fmt_bytes;
+}
+
+
+// Several format converters
+
+typedef void(*cmsFormatterAlphaFn)(void* dst, const void* src);
+
+
+// From 8
+
+static
+void copy8(void* dst, const void* src)
+{
+       memmove(dst, src, 1);
+}
+
+static
+void from8to16(void* dst, const void* src)
+{
+       cmsUInt8Number n = *(cmsUInt8Number*)src;
+       *(cmsUInt16Number*) dst = FROM_8_TO_16(n);
+}
+
+static
+void from8toFLT(void* dst, const void* src)
+{
+       *(cmsFloat32Number*)dst = (*(cmsUInt8Number*)src) / 255.0f;
+}
+
+static
+void from8toDBL(void* dst, const void* src)
+{
+       *(cmsFloat64Number*)dst = (*(cmsUInt8Number*)src) / 255.0;
+}
+
+static
+void from8toHLF(void* dst, const void* src)
+{
+       cmsFloat32Number n = (*(cmsUInt8Number*)src) / 255.0f;
+       *(cmsUInt16Number*)dst = _cmsFloat2Half(n);
+}
+
+// From 16
+
+static
+void from16to8(void* dst, const void* src)
+{
+       cmsUInt16Number n = *(cmsUInt16Number*)src;
+       *(cmsUInt8Number*) dst = FROM_16_TO_8(n);
+}
+
+static
+void copy16(void* dst, const void* src)
+{
+       memmove(dst, src, 2);
+}
+
+void from16toFLT(void* dst, const void* src)
+{
+       *(cmsFloat32Number*)dst = (*(cmsUInt16Number*)src) / 65535.0f;
+}
+
+void from16toDBL(void* dst, const void* src)
+{
+       *(cmsFloat64Number*)dst = (*(cmsUInt16Number*)src) / 65535.0f;
+}
+
+static
+void from16toHLF(void* dst, const void* src)
+{
+       cmsFloat32Number n = (*(cmsUInt16Number*)src) / 65535.0f;
+       *(cmsUInt16Number*)dst = _cmsFloat2Half(n);
+}
+
+// From Float
+
+static
+void fromFLTto8(void* dst, const void* src)
+{
+       cmsFloat32Number n = *(cmsFloat32Number*)src;
+       *(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0f);
+}
+
+static
+void fromFLTto16(void* dst, const void* src)
+{
+       cmsFloat32Number n = *(cmsFloat32Number*)src;
+       *(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
+}
+
+static
+void copy32(void* dst, const void* src)
+{
+       memmove(dst, src, sizeof(cmsFloat32Number));
+}
+
+static
+void fromFLTtoDBL(void* dst, const void* src)
+{
+       cmsFloat32Number n = *(cmsFloat32Number*)src;
+       *(cmsFloat64Number*)dst = (cmsFloat64Number)n;
+}
+
+static
+void fromFLTtoHLF(void* dst, const void* src)
+{
+       cmsFloat32Number n = *(cmsFloat32Number*)src;
+       *(cmsUInt16Number*)dst = _cmsFloat2Half(n);
+}
+
+
+// From HALF
+
+static
+void fromHLFto8(void* dst, const void* src)
+{
+       cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src);
+       *(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0f);
+}
+
+static
+void fromHLFto16(void* dst, const void* src)
+{
+       cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src);
+       *(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
+}
+
+static
+void fromHLFtoFLT(void* dst, const void* src)
+{
+       *(cmsFloat32Number*)dst = _cmsHalf2Float(*(cmsUInt16Number*)src);
+}
+
+static
+void fromHLFtoDBL(void* dst, const void* src)
+{
+       *(cmsFloat64Number*)dst = (cmsFloat64Number)_cmsHalf2Float(*(cmsUInt16Number*)src);
+}
+
+// From double
+static
+void fromDBLto8(void* dst, const void* src)
+{
+       cmsFloat64Number n = *(cmsFloat64Number*)src;
+       *(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0);
+}
+
+static
+void fromDBLto16(void* dst, const void* src)
+{
+       cmsFloat64Number n = *(cmsFloat64Number*)src;
+       *(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
+}
+
+static
+void fromDBLtoFLT(void* dst, const void* src)
+{
+       cmsFloat64Number n = *(cmsFloat64Number*)src;
+       *(cmsFloat32Number*)dst = (cmsFloat32Number) n;
+}
+
+static
+void fromDBLtoHLF(void* dst, const void* src)
+{
+       cmsFloat32Number n = (cmsFloat32Number) *(cmsFloat64Number*)src;
+       *(cmsUInt16Number*)dst = _cmsFloat2Half(n);
+}
+
+static
+void copy64(void* dst, const void* src)
+{
+       memmove(dst, src, sizeof(cmsFloat64Number));
+}
+
+
+// Returns the position (x or y) of the formatter in the table of functions
+static
+int FormatterPos(cmsUInt32Number frm)
+{
+       int  b = T_BYTES(frm);
+
+       if (b == 0 && T_FLOAT(frm))
+              return 4; // DBL
+       if (b == 2 && T_FLOAT(frm))
+              return 2; // HLF
+       if (b == 4 && T_FLOAT(frm))
+              return 3; // FLT
+       if (b == 2 && !T_FLOAT(frm))
+              return 1; // 16
+       if (b == 1 && !T_FLOAT(frm))
+              return 0; // 8
+
+       return -1; // not recognized
+
+}
+
+// Obtains a alpha-to-alpha funmction formatter
+static
+cmsFormatterAlphaFn _cmsGetFormatterAlpha(cmsContext id, cmsUInt32Number in, cmsUInt32Number out)
+{
+static cmsFormatterAlphaFn FormattersAlpha[5][5] = {
+
+       /* from 8 */  { copy8,      from8to16,   from8toHLF,   from8toFLT,   from8toDBL   },
+       /* from 16*/  { from16to8,  copy16,      from16toHLF,  from16toFLT,  from16toDBL  },
+       /* from HLF*/ { fromHLFto8, fromHLFto16, copy16,       fromHLFtoFLT, fromHLFtoDBL },
+       /* from FLT*/ { fromFLTto8, fromFLTto16, fromFLTtoHLF, copy32,       fromFLTtoDBL },
+       /* from DBL*/ { fromDBLto8, fromDBLto16, fromDBLtoHLF, fromDBLtoFLT, copy64 }};
+
+        int in_n  = FormatterPos(in);
+        int out_n = FormatterPos(out);
+
+        if (in_n < 0 || out_n < 0 || in_n > 4 || out_n > 4) {
+
+               cmsSignalError(id, cmsERROR_UNKNOWN_EXTENSION, "Unrecognized alpha channel width");
+               return NULL;
+        }
+
+        return FormattersAlpha[in_n][out_n];
+}
+
+
+
+// This function computes the distance from each component to the next one in bytes.
+static
+void ComputeIncrementsForChunky(cmsUInt32Number Format,
+                                cmsUInt32Number ComponentStartingOrder[],
+                                cmsUInt32Number ComponentPointerIncrements[])
+{
+       cmsUInt32Number channels[cmsMAXCHANNELS];
+       int extra = T_EXTRA(Format);
+       int nchannels = T_CHANNELS(Format);
+       int total_chans = nchannels + extra;
+       int i;
+       int channelSize = trueBytesSize(Format);
+       int pixelSize = channelSize * total_chans;
+
+           // Sanity check
+           if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
+                   return;
+
+        memset(channels, 0, sizeof(channels));
+
+       // Separation is independent of starting point and only depends on channel size
+       for (i = 0; i < extra; i++)
+              ComponentPointerIncrements[i] = pixelSize;
+
+       // Handle do swap
+       for (i = 0; i < total_chans; i++)
+       {
+              if (T_DOSWAP(Format)) {
+                     channels[i] = total_chans - i - 1;
+              }
+              else {
+                     channels[i] = i;
+              }
+       }
+
+       // Handle swap first (ROL of positions), example CMYK -> KCMY | 0123 -> 3012
+       if (T_SWAPFIRST(Format) && total_chans > 1) {
+
+              cmsUInt32Number tmp = channels[0];
+              for (i = 0; i < total_chans-1; i++)
+                     channels[i] = channels[i + 1];
+
+              channels[total_chans - 1] = tmp;
+       }
+
+       // Handle size
+       if (channelSize > 1)
+              for (i = 0; i < total_chans; i++) {
+                     channels[i] *= channelSize;
+              }
+
+       for (i = 0; i < extra; i++)
+              ComponentStartingOrder[i] = channels[i + nchannels];
+}
+
+
+
+//  On planar configurations, the distance is the stride added to any non-negative
+static
+void ComputeIncrementsForPlanar(cmsUInt32Number Format,
+                                cmsUInt32Number BytesPerPlane,
+                                cmsUInt32Number ComponentStartingOrder[],
+                                cmsUInt32Number ComponentPointerIncrements[])
+{
+       cmsUInt32Number channels[cmsMAXCHANNELS];
+       int extra = T_EXTRA(Format);
+       int nchannels = T_CHANNELS(Format);
+       int total_chans = nchannels + extra;
+       int i;
+       int channelSize = trueBytesSize(Format);
+
+       // Sanity check
+       if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
+           return;
+
+       memset(channels, 0, sizeof(channels));
+
+       // Separation is independent of starting point and only depends on channel size
+       for (i = 0; i < extra; i++)
+              ComponentPointerIncrements[i] = channelSize;
+
+       // Handle do swap
+       for (i = 0; i < total_chans; i++)
+       {
+              if (T_DOSWAP(Format)) {
+                     channels[i] = total_chans - i - 1;
+              }
+              else {
+                     channels[i] = i;
+              }
+       }
+
+       // Handle swap first (ROL of positions), example CMYK -> KCMY | 0123 -> 3012
+       if (T_SWAPFIRST(Format) && total_chans > 0) {
+
+              cmsUInt32Number tmp = channels[0];
+              for (i = 0; i < total_chans - 1; i++)
+                     channels[i] = channels[i + 1];
+
+              channels[total_chans - 1] = tmp;
+       }
+
+       // Handle size
+       for (i = 0; i < total_chans; i++) {
+              channels[i] *= BytesPerPlane;
+       }
+
+       for (i = 0; i < extra; i++)
+              ComponentStartingOrder[i] = channels[i + nchannels];
+}
+
+
+
+// Dispatcher por chunky and planar RGB
+static
+void  ComputeComponentIncrements(cmsUInt32Number Format,
+                                 cmsUInt32Number BytesPerPlane,
+                                 cmsUInt32Number ComponentStartingOrder[],
+                                 cmsUInt32Number ComponentPointerIncrements[])
+{
+       if (T_PLANAR(Format)) {
+
+              ComputeIncrementsForPlanar(Format,  BytesPerPlane, ComponentStartingOrder, ComponentPointerIncrements);
+       }
+       else {
+              ComputeIncrementsForChunky(Format,  ComponentStartingOrder, ComponentPointerIncrements);
+       }
+
+}
+
+
+
+// Handles extra channels copying alpha if requested by the flags
+void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
+                                               void* out,
+                                               cmsUInt32Number PixelsPerLine,
+                                               cmsUInt32Number LineCount,
+                                               const cmsStride* Stride)
+{
+    cmsUInt32Number i, j, k;
+    cmsUInt32Number nExtra;
+    cmsUInt32Number SourceStartingOrder[cmsMAXCHANNELS];
+    cmsUInt32Number SourceIncrements[cmsMAXCHANNELS];
+    cmsUInt32Number DestStartingOrder[cmsMAXCHANNELS];
+    cmsUInt32Number DestIncrements[cmsMAXCHANNELS];
+
+    cmsFormatterAlphaFn copyValueFn;
+
+    // Make sure we need some copy
+    if (!(p->dwOriginalFlags & cmsFLAGS_COPY_ALPHA))
+        return;
+
+    // Exit early if in-place color-management is occurring - no need to copy extra channels to themselves.
+    if (p->InputFormat == p->OutputFormat && in == out)
+        return;
+
+    // Make sure we have same number of alpha channels. If not, just return as this should be checked at transform creation time.
+    nExtra = T_EXTRA(p->InputFormat);
+    if (nExtra != T_EXTRA(p->OutputFormat))
+        return;
+
+    // Anything to do?
+    if (nExtra == 0)
+        return;
+
+    // Compute the increments
+    ComputeComponentIncrements(p->InputFormat, Stride->BytesPerPlaneIn, SourceStartingOrder, SourceIncrements);
+    ComputeComponentIncrements(p->OutputFormat, Stride->BytesPerPlaneOut, DestStartingOrder, DestIncrements);
+
+    // Check for conversions 8, 16, half, float, dbl
+    copyValueFn = _cmsGetFormatterAlpha(p->ContextID, p->InputFormat, p->OutputFormat);
+
+    if (nExtra == 1) { // Optimized routine for copying a single extra channel quickly
+
+        cmsUInt8Number* SourcePtr;
+        cmsUInt8Number* DestPtr;
+
+        cmsUInt32Number SourceStrideIncrement = 0;
+        cmsUInt32Number DestStrideIncrement = 0;
+
+        // The loop itself
+        for (i = 0; i < LineCount; i++) {
+
+            // Prepare pointers for the loop
+            SourcePtr = (cmsUInt8Number*)in + SourceStartingOrder[0] + SourceStrideIncrement;
+            DestPtr = (cmsUInt8Number*)out + DestStartingOrder[0] + DestStrideIncrement;
+
+            for (j = 0; j < PixelsPerLine; j++) {
+
+                copyValueFn(DestPtr, SourcePtr);
+
+                SourcePtr += SourceIncrements[0];
+                DestPtr += DestIncrements[0];
+            }
+
+            SourceStrideIncrement += Stride->BytesPerLineIn;
+            DestStrideIncrement += Stride->BytesPerLineOut;
+        }
+
+    }
+    else { // General case with more than one extra channel
+
+        cmsUInt8Number* SourcePtr[cmsMAXCHANNELS];
+        cmsUInt8Number* DestPtr[cmsMAXCHANNELS];
+
+        cmsUInt32Number SourceStrideIncrements[cmsMAXCHANNELS];
+        cmsUInt32Number DestStrideIncrements[cmsMAXCHANNELS];
+
+        memset(SourceStrideIncrements, 0, sizeof(SourceStrideIncrements));
+        memset(DestStrideIncrements, 0, sizeof(DestStrideIncrements));
+
+        // The loop itself
+        for (i = 0; i < LineCount; i++) {
+
+            // Prepare pointers for the loop
+            for (j = 0; j < nExtra; j++) {
+
+                SourcePtr[j] = (cmsUInt8Number*)in + SourceStartingOrder[j] + SourceStrideIncrements[j];
+                DestPtr[j] = (cmsUInt8Number*)out + DestStartingOrder[j] + DestStrideIncrements[j];
+            }
+
+            for (j = 0; j < PixelsPerLine; j++) {
+
+                for (k = 0; k < nExtra; k++) {
+
+                    copyValueFn(DestPtr[k], SourcePtr[k]);
+
+                    SourcePtr[k] += SourceIncrements[k];
+                    DestPtr[k] += DestIncrements[k];
+                }
+            }
+
+            for (j = 0; j < nExtra; j++) {
+
+                SourceStrideIncrements[j] += Stride->BytesPerLineIn;
+                DestStrideIncrements[j] += Stride->BytesPerLineOut;
+            }
+        }
+    }
+}
+
+
--- a/src/java.desktop/share/native/liblcms/cmscam02.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmscam02.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
--- a/src/java.desktop/share/native/liblcms/cmscgats.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmscgats.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -625,7 +625,7 @@
 }
 
 // Parses a float number
-// This can not call directly atof because it uses locale dependant
+// This can not call directly atof because it uses locale dependent
 // parsing, while CCMX files always use . as decimal separator
 static
 cmsFloat64Number ParseFloatNumber(const char *Buffer)
@@ -830,11 +830,11 @@
 
                     if (it8 ->sy == SINUM) {
 
-                        sprintf(it8->id, "%d", it8->inum);
+                        snprintf(it8->id, 127, "%d", it8->inum);
                     }
                     else {
 
-                        sprintf(it8->id, it8 ->DoubleFormatter, it8->dnum);
+                        snprintf(it8->id, 127, it8 ->DoubleFormatter, it8->dnum);
                     }
 
                     k = (int) strlen(it8 ->id);
@@ -1392,7 +1392,7 @@
     cmsIT8* it8 = (cmsIT8*) hIT8;
     char Buffer[1024];
 
-    sprintf(Buffer, it8->DoubleFormatter, Val);
+    snprintf(Buffer, 1023, it8->DoubleFormatter, Val);
 
     return AddToList(it8, &GetTable(it8)->HeaderList, cProp, NULL, Buffer, WRITE_UNCOOKED) != NULL;
 }
@@ -1402,7 +1402,7 @@
     cmsIT8* it8 = (cmsIT8*) hIT8;
     char Buffer[1024];
 
-    sprintf(Buffer, "%u", Val);
+    snprintf(Buffer, 1023, "%u", Val);
 
     return AddToList(it8, &GetTable(it8)->HeaderList, cProp, NULL, Buffer, WRITE_HEXADECIMAL) != NULL;
 }
@@ -1846,7 +1846,7 @@
 }
 
 
-// -------------------------------------------------------------- Higer level parsing
+// -------------------------------------------------------------- Higher level parsing
 
 static
 cmsBool DataFormatSection(cmsIT8* it8)
@@ -2149,7 +2149,7 @@
 
 
 
-// Init usefull pointers
+// Init useful pointers
 
 static
 void CookPointers(cmsIT8* it8)
@@ -2546,9 +2546,9 @@
 
         fld = GetDataFormat(it8, i);
         if (fld != NULL) {
-        if (cmsstrcasecmp(fld, cSample) == 0)
-            return i;
-    }
+            if (cmsstrcasecmp(fld, cSample) == 0)
+                return i;
+        }
     }
 
     return -1;
@@ -2606,7 +2606,7 @@
 
     _cmsAssert(hIT8 != NULL);
 
-    sprintf(Buff, it8->DoubleFormatter, Val);
+    snprintf(Buff, 255, it8->DoubleFormatter, Val);
 
     return SetData(it8, row, col, Buff);
 }
--- a/src/java.desktop/share/native/liblcms/cmscnvrt.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmscnvrt.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -136,7 +136,7 @@
 };
 
 
-// A pointer to the begining of the list
+// A pointer to the beginning of the list
 _cmsIntentsPluginChunkType _cmsIntentsPluginChunk = { NULL };
 
 // Duplicates the zone of memory used by the plug-in in the new context
@@ -299,6 +299,7 @@
     cmsMAT3 Scale, m1, m2, m3, m4;
 
     // TODO: Follow Marc Mahy's recommendation to check if CHAD is same by using M1*M2 == M2*M1. If so, do nothing.
+    // TODO: Add support for ArgyllArts tag
 
     // Adaptation state
     if (AdaptationState == 1.0) {
@@ -917,7 +918,7 @@
         return TRUE;
     }
 
-    // Make sure to pass thru K (which now is fixed)
+    // Make sure to pass through K (which now is fixed)
     Outf[3] = LabK[3];
 
     // Apply TAC if needed
@@ -985,7 +986,7 @@
     memset(&bp, 0, sizeof(bp));
 
     // We need the input LUT of the last profile, assuming this one is responsible of
-    // black generation. This LUT will be seached in inverse order.
+    // black generation. This LUT will be searched in inverse order.
     bp.LabK2cmyk = _cmsReadInputLUT(hProfiles[nProfiles-1], INTENT_RELATIVE_COLORIMETRIC);
     if (bp.LabK2cmyk == NULL) goto Cleanup;
 
--- a/src/java.desktop/share/native/liblcms/cmserr.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmserr.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2015 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -227,7 +227,7 @@
     }
 }
 
-// Auxiliar to fill memory management functions from plugin (or context 0 defaults)
+// Auxiliary to fill memory management functions from plugin (or context 0 defaults)
 void _cmsInstallAllocFunctions(cmsPluginMemHandler* Plugin, _cmsMemPluginChunkType* ptr)
 {
     if (Plugin == NULL) {
@@ -459,14 +459,14 @@
 
 // Error logging ******************************************************************
 
-// There is no error handling at all. When a funtion fails, it returns proper value.
+// There is no error handling at all. When a function fails, it returns proper value.
 // For example, all create functions does return NULL on failure. Other return FALSE
 // It may be interesting, for the developer, to know why the function is failing.
 // for that reason, lcms2 does offer a logging function. This function does recive
 // a ENGLISH string with some clues on what is going wrong. You can show this
 // info to the end user, or just create some sort of log.
 // The logging function should NOT terminate the program, as this obviously can leave
-// resources. It is the programmer's responsability to check each function return code
+// resources. It is the programmer's responsibility to check each function return code
 // to make sure it didn't fail.
 
 // Error messages are limited to MAX_ERROR_MESSAGE_LEN
--- a/src/java.desktop/share/native/liblcms/cmsgamma.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsgamma.c	Mon Aug 08 08:12:20 2016 -0700
@@ -596,7 +596,7 @@
     return Val;
 }
 
-// Evaluate a segmented funtion for a single value. Return -1 if no valid segment found .
+// Evaluate a segmented function for a single value. Return -1 if no valid segment found .
 // If fn type is 0, perform an interpolation on the table
 static
 cmsFloat64Number EvalSegmentedFn(const cmsToneCurve *g, cmsFloat64Number R)
--- a/src/java.desktop/share/native/liblcms/cmsgmt.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsgmt.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -56,7 +56,7 @@
 #include "lcms2_internal.h"
 
 
-// Auxiliar: append a Lab identity after the given sequence of profiles
+// Auxiliary: append a Lab identity after the given sequence of profiles
 // and return the transform. Lab profile is closed, rest of profiles are kept open.
 cmsHTRANSFORM _cmsChain2Lab(cmsContext            ContextID,
                             cmsUInt32Number        nProfiles,
@@ -201,7 +201,7 @@
     }
 
     // Build the relationship. This effectively limits the maximum accuracy to 16 bits, but
-    // since this is used on black-preserving LUTs, we are not loosing  accuracy in any case
+    // since this is used on black-preserving LUTs, we are not losing  accuracy in any case
     KTone = cmsJoinToneCurve(ContextID, in, out, nPoints);
 
     // Get rid of components
@@ -307,7 +307,7 @@
 }
 
 // Does compute a gamut LUT going back and forth across pcs -> relativ. colorimetric intent -> pcs
-// the dE obtained is then annotated on the LUT. Values truely out of gamut are clipped to dE = 0xFFFE
+// the dE obtained is then annotated on the LUT. Values truly out of gamut are clipped to dE = 0xFFFE
 // and values changed are supposed to be handled by any gamut remapping, so, are out of gamut as well.
 //
 // **WARNING: This algorithm does assume that gamut remapping algorithms does NOT move in-gamut colors,
--- a/src/java.desktop/share/native/liblcms/cmshalf.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmshalf.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
--- a/src/java.desktop/share/native/liblcms/cmsintrp.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsintrp.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -185,7 +185,7 @@
     int i;
     cmsUInt32Number Samples[MAX_INPUT_DIMENSIONS];
 
-    // Fill the auxiliar array
+    // Fill the auxiliary array
     for (i=0; i < MAX_INPUT_DIMENSIONS; i++)
         Samples[i] = nSamples;
 
--- a/src/java.desktop/share/native/liblcms/cmsio0.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsio0.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -353,7 +353,7 @@
     return nReaded;
 }
 
-// Postion file pointer in the file
+// Position file pointer in the file
 static
 cmsBool  FileSeek(cmsIOHANDLER* iohandler, cmsUInt32Number offset)
 {
@@ -397,6 +397,7 @@
 {
     cmsIOHANDLER* iohandler = NULL;
     FILE* fm = NULL;
+    cmsInt32Number fileLen;
 
     _cmsAssert(FileName != NULL);
     _cmsAssert(AccessMode != NULL);
@@ -413,7 +414,16 @@
              cmsSignalError(ContextID, cmsERROR_FILE, "File '%s' not found", FileName);
             return NULL;
         }
-        iohandler -> ReportedSize = (cmsUInt32Number) cmsfilelength(fm);
+        fileLen = cmsfilelength(fm);
+        if (fileLen < 0)
+        {
+            fclose(fm);
+            _cmsFree(ContextID, iohandler);
+            cmsSignalError(ContextID, cmsERROR_FILE, "Cannot get size of file '%s'", FileName);
+            return NULL;
+        }
+
+        iohandler -> ReportedSize = (cmsUInt32Number) fileLen;
         break;
 
     case 'w':
@@ -453,6 +463,14 @@
 cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromStream(cmsContext ContextID, FILE* Stream)
 {
     cmsIOHANDLER* iohandler = NULL;
+    cmsInt32Number fileSize;
+
+    fileSize = cmsfilelength(Stream);
+    if (fileSize < 0)
+    {
+        cmsSignalError(ContextID, cmsERROR_FILE, "Cannot get size of stream");
+        return NULL;
+    }
 
     iohandler = (cmsIOHANDLER*) _cmsMallocZero(ContextID, sizeof(cmsIOHANDLER));
     if (iohandler == NULL) return NULL;
@@ -460,7 +478,7 @@
     iohandler -> ContextID = ContextID;
     iohandler -> stream = (void*) Stream;
     iohandler -> UsedSpace = 0;
-    iohandler -> ReportedSize = (cmsUInt32Number) cmsfilelength(Stream);
+    iohandler -> ReportedSize = (cmsUInt32Number) fileSize;
     iohandler -> PhysicalFile[0] = 0;
 
     iohandler ->Read    = FileRead;
@@ -652,7 +670,7 @@
 }
 
 
-// Check existance
+// Check existence
 cmsBool CMSEXPORT cmsIsTag(cmsHPROFILE hProfile, cmsTagSignature sig)
 {
        _cmsICCPROFILE*  Icc = (_cmsICCPROFILE*) (void*) hProfile;
@@ -708,7 +726,7 @@
         return FALSE;
     }
 
-    // Adjust endianess of the used parameters
+    // Adjust endianness of the used parameters
     Icc -> DeviceClass     = (cmsProfileClassSignature) _cmsAdjustEndianess32(Header.deviceClass);
     Icc -> ColorSpace      = (cmsColorSpaceSignature)   _cmsAdjustEndianess32(Header.colorSpace);
     Icc -> PCS             = (cmsColorSpaceSignature)   _cmsAdjustEndianess32(Header.pcs);
@@ -826,7 +844,7 @@
 
     memset(&Header.reserved, 0, sizeof(Header.reserved));
 
-    // Set profile ID. Endianess is always big endian
+    // Set profile ID. Endianness is always big endian
     memmove(&Header.profileID, &Icc ->ProfileID, 16);
 
     // Dump the header
@@ -836,7 +854,7 @@
 
     // Get true count
     for (i=0;  i < Icc -> TagCount; i++) {
-        if (Icc ->TagNames[i] != 0)
+        if (Icc ->TagNames[i] != (cmsTagSignature) 0)
             Count++;
     }
 
@@ -845,7 +863,7 @@
 
     for (i=0; i < Icc -> TagCount; i++) {
 
-        if (Icc ->TagNames[i] == 0) continue;   // It is just a placeholder
+        if (Icc ->TagNames[i] == (cmsTagSignature) 0) continue;   // It is just a placeholder
 
         Tag.sig    = (cmsTagSignature) _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagNames[i]);
         Tag.offset = _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagOffsets[i]);
@@ -1195,7 +1213,7 @@
 
     for (i=0; i < Icc -> TagCount; i++) {
 
-        if (Icc ->TagNames[i] == 0) continue;
+        if (Icc ->TagNames[i] == (cmsTagSignature) 0) continue;
 
         // Linked tags are not written
         if (Icc ->TagLinked[i] != (cmsTagSignature) 0) continue;
@@ -1329,11 +1347,15 @@
 
     _cmsAssert(hProfile != NULL);
 
+    if (!_cmsLockMutex(Icc->ContextID, Icc->UsrMutex)) return 0;
     memmove(&Keep, Icc, sizeof(_cmsICCPROFILE));
 
     ContextID = cmsGetProfileContextID(hProfile);
     PrevIO = Icc ->IOhandler = cmsOpenIOhandlerFromNULL(ContextID);
-    if (PrevIO == NULL) return 0;
+    if (PrevIO == NULL) {
+        _cmsUnlockMutex(Icc->ContextID, Icc->UsrMutex);
+        return 0;
+    }
 
     // Pass #1 does compute offsets
 
@@ -1353,7 +1375,10 @@
     }
 
     memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
-    if (!cmsCloseIOhandler(PrevIO)) return 0;
+    if (!cmsCloseIOhandler(PrevIO))
+        UsedSpace = 0; // As a error marker
+
+    _cmsUnlockMutex(Icc->ContextID, Icc->UsrMutex);
 
     return UsedSpace;
 
@@ -1361,6 +1386,8 @@
 Error:
     cmsCloseIOhandler(PrevIO);
     memmove(Icc, &Keep, sizeof(_cmsICCPROFILE));
+    _cmsUnlockMutex(Icc->ContextID, Icc->UsrMutex);
+
     return 0;
 }
 
@@ -1564,7 +1591,7 @@
     LocalTypeHandler.ICCVersion = Icc ->Version;
     Icc -> TagPtrs[n] = LocalTypeHandler.ReadPtr(&LocalTypeHandler, io, &ElemCount, TagSize);
 
-    // The tag type is supported, but something wrong happend and we cannot read the tag.
+    // The tag type is supported, but something wrong happened and we cannot read the tag.
     // let know the user about this (although it is just a warning)
     if (Icc -> TagPtrs[n] == NULL) {
 
@@ -1883,7 +1910,7 @@
     _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex);
 
     if (Icc->TagPtrs[i] == NULL) {
-           Icc->TagNames[i] = 0;
+           Icc->TagNames[i] = (cmsTagSignature) 0;
            return FALSE;
     }
     return TRUE;
--- a/src/java.desktop/share/native/liblcms/cmsio1.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsio1.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -157,7 +157,7 @@
 }
 
 
-// Auxiliar, read colorants as a MAT3 structure. Used by any function that needs a matrix-shaper
+// Auxiliary, read colorants as a MAT3 structure. Used by any function that needs a matrix-shaper
 static
 cmsBool ReadICCMatrixRGB2XYZ(cmsMAT3* r, cmsHPROFILE hProfile)
 {
@@ -343,7 +343,7 @@
     cmsTagSignature tagFloat;
     cmsContext ContextID = cmsGetProfileContextID(hProfile);
 
-    // On named color, take the appropiate tag
+    // On named color, take the appropriate tag
     if (cmsGetDeviceClass(hProfile) == cmsSigNamedColorClass) {
 
         cmsPipeline* Lut;
@@ -365,9 +365,9 @@
         return Lut;
     }
 
-    // This is an attempt to reuse this funtion to retrieve the matrix-shaper as pipeline no
+    // This is an attempt to reuse this function to retrieve the matrix-shaper as pipeline no
     // matter other LUT are present and have precedence. Intent = -1 means just this.
-    if (Intent != -1) {
+    if (Intent >= INTENT_PERCEPTUAL && Intent <= INTENT_ABSOLUTE_COLORIMETRIC) {
 
         tag16 = Device2PCS16[Intent];
         tagFloat = Device2PCSFloat[Intent];
@@ -423,7 +423,7 @@
     // Check if this is a grayscale profile.
     if (cmsGetColorSpace(hProfile) == cmsSigGrayData) {
 
-        // if so, build appropiate conversion tables.
+        // if so, build appropriate conversion tables.
         // The tables are the PCS iluminant, scaled across GrayTRC
         return BuildGrayInputMatrixPipeline(hProfile);
     }
@@ -578,7 +578,7 @@
     if (Lut == NULL) return NULL;
 
     // If PCS is Lab or XYZ, the floating point tag is accepting data in the space encoding,
-    // and since the formatter has already accomodated to 0..1.0, we should undo this change
+    // and since the formatter has already accommodated to 0..1.0, we should undo this change
     if ( PCS == cmsSigLabData)
     {
         if (!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageNormalizeToLabFloat(ContextID)))
@@ -619,7 +619,7 @@
     cmsContext ContextID  = cmsGetProfileContextID(hProfile);
 
 
-    if (Intent != -1) {
+    if (Intent >= INTENT_PERCEPTUAL && Intent <= INTENT_ABSOLUTE_COLORIMETRIC) {
 
         tag16 = PCS2Device16[Intent];
         tagFloat = PCS2DeviceFloat[Intent];
@@ -680,7 +680,7 @@
     // Check if this is a grayscale profile.
     if (cmsGetColorSpace(hProfile) == cmsSigGrayData) {
 
-        // if so, build appropiate conversion tables.
+        // if so, build appropriate conversion tables.
         // The tables are the PCS iluminant, scaled across GrayTRC
         return BuildGrayOutputPipeline(hProfile);
     }
@@ -738,15 +738,21 @@
 {
     cmsPipeline* Lut;
     cmsTagTypeSignature OriginalType;
-    cmsTagSignature tag16    = Device2PCS16[Intent];
-    cmsTagSignature tagFloat = Device2PCSFloat[Intent];
+    cmsTagSignature tag16;
+    cmsTagSignature tagFloat;
     cmsContext ContextID = cmsGetProfileContextID(hProfile);
 
 
-    // On named color, take the appropiate tag
+    if (Intent < INTENT_PERCEPTUAL || Intent > INTENT_ABSOLUTE_COLORIMETRIC)
+        return NULL;
+
+    tag16 = Device2PCS16[Intent];
+    tagFloat = Device2PCSFloat[Intent];
+
+    // On named color, take the appropriate tag
     if (cmsGetDeviceClass(hProfile) == cmsSigNamedColorClass) {
 
-        cmsNAMEDCOLORLIST* nc = (cmsNAMEDCOLORLIST*) cmsReadTag(hProfile, cmsSigNamedColor2Tag);
+        cmsNAMEDCOLORLIST* nc = (cmsNAMEDCOLORLIST*)cmsReadTag(hProfile, cmsSigNamedColor2Tag);
 
         if (nc == NULL) return NULL;
 
@@ -762,12 +768,13 @@
                 goto Error;
 
         return Lut;
-Error:
+    Error:
         cmsPipelineFree(Lut);
         cmsFreeNamedColorList(nc);
         return NULL;
     }
 
+
     if (cmsIsTag(hProfile, tagFloat)) {  // Float tag takes precedence
 
         // Floating point LUT are always V
@@ -777,19 +784,19 @@
     tagFloat = Device2PCSFloat[0];
     if (cmsIsTag(hProfile, tagFloat)) {
 
-        return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat));
+        return cmsPipelineDup((cmsPipeline*)cmsReadTag(hProfile, tagFloat));
     }
 
     if (!cmsIsTag(hProfile, tag16)) {  // Is there any LUT-Based table?
 
-        tag16    = Device2PCS16[0];
+        tag16 = Device2PCS16[0];
         if (!cmsIsTag(hProfile, tag16)) return NULL;
     }
 
     // Check profile version and LUT type. Do the necessary adjustments if needed
 
     // Read the tag
-    Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16);
+    Lut = (cmsPipeline*)cmsReadTag(hProfile, tag16);
     if (Lut == NULL) return NULL;
 
     // The profile owns the Lut, so we need to copy it
@@ -802,7 +809,7 @@
         ChangeInterpolationToTrilinear(Lut);
 
     // After reading it, we have info about the original type
-    OriginalType =  _cmsGetTagTrueType(hProfile, tag16);
+    OriginalType = _cmsGetTagTrueType(hProfile, tag16);
 
     // We need to adjust data for Lab16 on output
     if (OriginalType != cmsSigLut16Type) return Lut;
@@ -810,12 +817,12 @@
     // Here it is possible to get Lab on both sides
 
     if (cmsGetColorSpace(hProfile) == cmsSigLabData) {
-        if(!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
+        if (!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID)))
             goto Error2;
     }
 
     if (cmsGetPCS(hProfile) == cmsSigLabData) {
-        if(!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
+        if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID)))
             goto Error2;
     }
 
@@ -950,7 +957,7 @@
 }
 
 
-// Auxiliar, read and duplicate a MLU if found.
+// Auxiliary, read and duplicate a MLU if found.
 static
 cmsMLU* GetMLUFromProfile(cmsHPROFILE h, cmsTagSignature sig)
 {
--- a/src/java.desktop/share/native/liblcms/cmslut.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmslut.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -534,7 +534,7 @@
                 goto Error;
         } else {
             NewElem ->Tab.T = (cmsUInt16Number*) _cmsDupMem(mpe ->ContextID, Data ->Tab.T, Data ->nEntries * sizeof (cmsUInt16Number));
-            if (NewElem ->Tab.TFloat == NULL)
+            if (NewElem ->Tab.T == NULL)
                 goto Error;
         }
     }
@@ -1482,7 +1482,8 @@
                  First = FALSE;
              }
              else {
-                Anterior ->Next = NewMPE;
+                if (Anterior != NULL)
+                    Anterior ->Next = NewMPE;
              }
 
             Anterior = NewMPE;
@@ -1836,3 +1837,5 @@
 
     return TRUE;
 }
+
+
--- a/src/java.desktop/share/native/liblcms/cmsmd5.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsmd5.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
--- a/src/java.desktop/share/native/liblcms/cmsmtrx.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsmtrx.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -67,7 +67,7 @@
     r -> n[VZ] = z;
 }
 
-// Vector substraction
+// Vector subtraction
 void CMSEXPORT _cmsVEC3minus(cmsVEC3* r, const cmsVEC3* a, const cmsVEC3* b)
 {
   r -> n[VX] = a -> n[VX] - b -> n[VX];
@@ -201,3 +201,5 @@
     r->n[VY] = a->v[1].n[VX]*v->n[VX] + a->v[1].n[VY]*v->n[VY] + a->v[1].n[VZ]*v->n[VZ];
     r->n[VZ] = a->v[2].n[VX]*v->n[VX] + a->v[2].n[VY]*v->n[VY] + a->v[2].n[VZ]*v->n[VZ];
 }
+
+
--- a/src/java.desktop/share/native/liblcms/cmsnamed.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsnamed.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2012 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -121,7 +121,7 @@
 static
 cmsBool GrowMLUtable(cmsMLU* mlu)
 {
-    int AllocatedEntries;
+    cmsUInt32Number AllocatedEntries;
     _cmsMLUentry *NewPtr;
 
     // Sanity check
@@ -147,7 +147,7 @@
 static
 int SearchMLUEntry(cmsMLU* mlu, cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode)
 {
-    int i;
+    cmsUInt32Number i;
 
     // Sanity check
     if (mlu == NULL) return -1;
@@ -207,15 +207,42 @@
     return TRUE;
 }
 
+// Convert from a 3-char code to a cmsUInt16Number. It is done inthis way because some
+// compilers don't properly align beginning of strings
 
-// Add an ASCII entry.
+static
+cmsUInt16Number strTo16(const char str[3])
+{
+    cmsUInt16Number n = ((cmsUInt16Number) str[0] << 8) | str[1];
+
+    return n;  // Always big endian in this case
+}
+
+static
+void strFrom16(char str[3], cmsUInt16Number n)
+{
+    // Assiming this would be aligned
+    union {
+
+       cmsUInt16Number n;
+       char str[2];
+
+    } c;
+
+    c.n = n;  // Always big endian in this case
+
+    str[0] = c.str[0]; str[1] = c.str[1]; str[2] = 0;
+
+}
+
+// Add an ASCII entry. Do not add any \0 termination (ICC1v43_2010-12.pdf page 61)
 cmsBool CMSEXPORT cmsMLUsetASCII(cmsMLU* mlu, const char LanguageCode[3], const char CountryCode[3], const char* ASCIIString)
 {
-    cmsUInt32Number i, len = (cmsUInt32Number) strlen(ASCIIString)+1;
+    cmsUInt32Number i, len = (cmsUInt32Number) strlen(ASCIIString);
     wchar_t* WStr;
     cmsBool  rc;
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
+    cmsUInt16Number Lang  = strTo16(LanguageCode);
+    cmsUInt16Number Cntry = strTo16(CountryCode);
 
     if (mlu == NULL) return FALSE;
 
@@ -245,18 +272,17 @@
     return (cmsUInt32Number)(p - s);
 }
 
-
-// Add a wide entry
+// Add a wide entry. Do not add any \0 terminator (ICC1v43_2010-12.pdf page 61)
 cmsBool  CMSEXPORT cmsMLUsetWide(cmsMLU* mlu, const char Language[3], const char Country[3], const wchar_t* WideString)
 {
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) Language);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) Country);
+    cmsUInt16Number Lang  = strTo16(Language);
+    cmsUInt16Number Cntry = strTo16(Country);
     cmsUInt32Number len;
 
     if (mlu == NULL) return FALSE;
     if (WideString == NULL) return FALSE;
 
-    len = (cmsUInt32Number) (mywcslen(WideString) + 1) * sizeof(wchar_t);
+    len = (cmsUInt32Number) (mywcslen(WideString)) * sizeof(wchar_t);
     return AddMLUBlock(mlu, len, WideString, Lang, Cntry);
 }
 
@@ -327,8 +353,8 @@
                               cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode,
                               cmsUInt16Number* UsedLanguageCode, cmsUInt16Number* UsedCountryCode)
 {
-    int i;
-    int Best = -1;
+    cmsUInt32Number i;
+    cmsInt32Number Best = -1;
     _cmsMLUentry* v;
 
     if (mlu == NULL) return NULL;
@@ -379,8 +405,8 @@
     cmsUInt32Number  StrLen = 0;
     cmsUInt32Number ASCIIlen, i;
 
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
+    cmsUInt16Number Lang  = strTo16(LanguageCode);
+    cmsUInt16Number Cntry = strTo16(CountryCode);
 
     // Sanitize
     if (mlu == NULL) return 0;
@@ -423,8 +449,8 @@
     const wchar_t *Wide;
     cmsUInt32Number  StrLen = 0;
 
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
+    cmsUInt16Number Lang  = strTo16(LanguageCode);
+    cmsUInt16Number Cntry = strTo16(CountryCode);
 
     // Sanitize
     if (mlu == NULL) return 0;
@@ -456,8 +482,8 @@
 {
     const wchar_t *Wide;
 
-    cmsUInt16Number Lang  = _cmsAdjustEndianess16(*(cmsUInt16Number*) LanguageCode);
-    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) CountryCode);
+    cmsUInt16Number Lang  = strTo16(LanguageCode);
+    cmsUInt16Number Cntry = strTo16(CountryCode);
     cmsUInt16Number ObtLang, ObtCode;
 
     // Sanitize
@@ -467,10 +493,9 @@
     if (Wide == NULL) return FALSE;
 
     // Get used language and code
-    *(cmsUInt16Number *)ObtainedLanguage = _cmsAdjustEndianess16(ObtLang);
-    *(cmsUInt16Number *)ObtainedCountry  = _cmsAdjustEndianess16(ObtCode);
+    strFrom16(ObtainedLanguage, ObtLang);
+    strFrom16(ObtainedCountry, ObtCode);
 
-    ObtainedLanguage[2] = ObtainedCountry[2] = 0;
     return TRUE;
 }
 
@@ -493,12 +518,12 @@
 
     if (mlu == NULL) return FALSE;
 
-    if (idx >= (cmsUInt32Number) mlu->UsedEntries) return FALSE;
+    if (idx >= mlu->UsedEntries) return FALSE;
 
     entry = &mlu->Entries[idx];
 
-    *(cmsUInt16Number *)LanguageCode = _cmsAdjustEndianess16(entry->Language);
-    *(cmsUInt16Number *)CountryCode  = _cmsAdjustEndianess16(entry->Country);
+    strFrom16(LanguageCode, entry->Language);
+    strFrom16(CountryCode, entry->Country);
 
     return TRUE;
 }
--- a/src/java.desktop/share/native/liblcms/cmsopt.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsopt.c	Mon Aug 08 08:12:20 2016 -0700
@@ -27,11 +27,10 @@
 // However, the following notice accompanied the original version of this
 // file:
 //
-
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -258,11 +257,10 @@
 
                             // We can not get rid of full matrix
                             cmsStage* Multmat = cmsStageAllocMatrix(Lut->ContextID, 3, 3, (const cmsFloat64Number*) &res, NULL);
+                            if (Multmat == NULL) return FALSE;  // Should never happen
 
                             // Recover the chain
-                            if (Multmat != NULL) {
-                                Multmat->Next = chain;
-                            }
+                            Multmat->Next = chain;
                             *pt1 = Multmat;
                      }
 
@@ -560,7 +558,7 @@
             return TRUE;
 }
 
-// Auxiliar, to see if two values are equal or very different
+// Auxiliary, to see if two values are equal or very different
 static
 cmsBool WhitesAreEqual(int n, cmsUInt16Number White1[], cmsUInt16Number White2[] )
 {
@@ -568,7 +566,7 @@
 
     for (i=0; i < n; i++) {
 
-        if (abs(White1[i] - White2[i]) > 0xf000) return TRUE;  // Values are so extremly different that the fixup should be avoided
+        if (abs(White1[i] - White2[i]) > 0xf000) return TRUE;  // Values are so extremely different that the fixup should be avoided
         if (White1[i] != White2[i]) return FALSE;
     }
     return TRUE;
@@ -706,7 +704,7 @@
         cmsStage* PreLin = cmsPipelineGetPtrToFirstStage(Src);
 
         // Check if suitable
-        if (PreLin ->Type == cmsSigCurveSetElemType) {
+        if (PreLin && PreLin ->Type == cmsSigCurveSetElemType) {
 
             // Maybe this is a linear tram, so we can avoid the whole stuff
             if (!AllCurvesAreLinear(PreLin)) {
@@ -739,7 +737,7 @@
         cmsStage* PostLin = cmsPipelineGetPtrToLastStage(Src);
 
         // Check if suitable
-        if (cmsStageType(PostLin) == cmsSigCurveSetElemType) {
+        if (PostLin && cmsStageType(PostLin) == cmsSigCurveSetElemType) {
 
             // Maybe this is a linear tram, so we can avoid the whole stuff
             if (!AllCurvesAreLinear(PostLin)) {
@@ -1041,8 +1039,8 @@
     }
 
     if (Zeros == 1 && Poles == 1) return FALSE;  // For linear tables
-    if (Zeros > (nEntries / 4)) return TRUE;  // Degenerated, mostly zeros
-    if (Poles > (nEntries / 4)) return TRUE;  // Degenerated, mostly poles
+    if (Zeros > (nEntries / 20)) return TRUE;  // Degenerated, many zeros
+    if (Poles > (nEntries / 20)) return TRUE;  // Degenerated, many poles
 
     return FALSE;
 }
@@ -1064,17 +1062,19 @@
     cmsColorSpaceSignature ColorSpace, OutputColorSpace;
     cmsStage* OptimizedPrelinMpe;
     cmsStage* mpe;
-    cmsToneCurve**   OptimizedPrelinCurves;
-    _cmsStageCLutData*     OptimizedPrelinCLUT;
+    cmsToneCurve** OptimizedPrelinCurves;
+    _cmsStageCLutData* OptimizedPrelinCLUT;
 
 
     // This is a loosy optimization! does not apply in floating-point cases
     if (_cmsFormatterIsFloat(*InputFormat) || _cmsFormatterIsFloat(*OutputFormat)) return FALSE;
 
-    // Only on RGB
+    // Only on chunky RGB
     if (T_COLORSPACE(*InputFormat)  != PT_RGB) return FALSE;
+    if (T_PLANAR(*InputFormat)) return FALSE;
+
     if (T_COLORSPACE(*OutputFormat) != PT_RGB) return FALSE;
-
+    if (T_PLANAR(*OutputFormat)) return FALSE;
 
     // On 16 bits, user has to specify the feature
     if (!_cmsFormatterIs8bit(*InputFormat)) {
@@ -1098,6 +1098,22 @@
     memset(Trans, 0, sizeof(Trans));
     memset(TransReverse, 0, sizeof(TransReverse));
 
+    // If the last stage of the original lut are curves, and those curves are
+    // degenerated, it is likely the transform is squeezing and clipping
+    // the output from previous CLUT. We cannot optimize this case
+    {
+        cmsStage* last = cmsPipelineGetPtrToLastStage(OriginalLut);
+
+        if (cmsStageType(last) == cmsSigCurveSetElemType) {
+
+            _cmsStageToneCurvesData* Data = (_cmsStageToneCurvesData*)cmsStageData(last);
+            for (i = 0; i < Data->nCurves; i++) {
+                if (IsDegenerated(Data->TheCurves[i]))
+                    goto Error;
+            }
+        }
+    }
+
     for (t = 0; t < OriginalLut ->InputChannels; t++) {
         Trans[t] = cmsBuildTabulatedToneCurve16(OriginalLut ->ContextID, PRELINEARIZATION_POINTS, NULL);
         if (Trans[t] == NULL) goto Error;
@@ -1431,7 +1447,10 @@
         GammaTables[i] = NULL;
     }
 
-    if (GammaTables != NULL) _cmsFree(Src ->ContextID, GammaTables);
+    if (GammaTables != NULL) {
+        _cmsFree(Src->ContextID, GammaTables);
+        GammaTables = NULL;
+    }
 
     // Maybe the curves are linear at the end
     if (!AllCurvesAreLinear(ObtainedCurves)) {
--- a/src/java.desktop/share/native/liblcms/cmspack.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmspack.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2010 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -110,7 +110,7 @@
 #define ANYFLAVOR       FLAVOR_SH(1)
 
 
-// Supress waning about info never being used
+// Suppress waning about info never being used
 
 #ifdef _MSC_VER
 #pragma warning(disable : 4100)
@@ -3188,6 +3188,8 @@
     cmsUInt32Number i;
     cmsFormatter fr;
 
+    // Optimization is only a hint
+    dwInput &= ~OPTIMIZED_SH(1);
 
     switch (dwFlags)
     {
--- a/src/java.desktop/share/native/liblcms/cmspcs.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmspcs.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2010 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -337,7 +337,7 @@
     wLab[2] = ab2Fix4(Lab.b);
 }
 
-// Auxiliar: convert to Radians
+// Auxiliary: convert to Radians
 static
 cmsFloat64Number RADIANS(cmsFloat64Number deg)
 {
@@ -345,7 +345,7 @@
 }
 
 
-// Auxiliar: atan2 but operating in degrees and returning 0 if a==b==0
+// Auxiliary: atan2 but operating in degrees and returning 0 if a==b==0
 static
 cmsFloat64Number atan2deg(cmsFloat64Number a, cmsFloat64Number b)
 {
@@ -368,7 +368,7 @@
 }
 
 
-// Auxiliar: Square
+// Auxiliary: Square
 static
 cmsFloat64Number Sqr(cmsFloat64Number v)
 {
--- a/src/java.desktop/share/native/liblcms/cmsplugin.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsplugin.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2010 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -136,7 +136,7 @@
 #endif
 }
 
-// Auxiliar -- read 8, 16 and 32-bit numbers
+// Auxiliary -- read 8, 16 and 32-bit numbers
 cmsBool CMSEXPORT  _cmsReadUInt8Number(cmsIOHANDLER* io, cmsUInt8Number* n)
 {
     cmsUInt8Number tmp;
@@ -201,13 +201,13 @@
 
     _cmsAssert(io != NULL);
 
-    if (io -> Read(io, &tmp, sizeof(cmsFloat32Number), 1) != 1)
+    if (io -> Read(io, &tmp, sizeof(cmsUInt32Number), 1) != 1)
             return FALSE;
 
     if (n != NULL) {
 
         tmp = _cmsAdjustEndianess32(tmp);
-        *n = *(cmsFloat32Number*) &tmp;
+        *n = *(cmsFloat32Number*) (void*) &tmp;
     }
     return TRUE;
 }
@@ -244,22 +244,6 @@
 }
 
 
-// Jun-21-2000: Some profiles (those that comes with W2K) comes
-// with the media white (media black?) x 100. Add a sanity check
-
-static
-void NormalizeXYZ(cmsCIEXYZ* Dest)
-{
-    while (Dest -> X > 2. &&
-           Dest -> Y > 2. &&
-           Dest -> Z > 2.) {
-
-               Dest -> X /= 10.;
-               Dest -> Y /= 10.;
-               Dest -> Z /= 10.;
-       }
-}
-
 cmsBool CMSEXPORT  _cmsReadXYZNumber(cmsIOHANDLER* io, cmsCIEXYZ* XYZ)
 {
     cmsEncodedXYZNumber xyz;
@@ -273,8 +257,6 @@
         XYZ->X = _cms15Fixed16toDouble(_cmsAdjustEndianess32(xyz.X));
         XYZ->Y = _cms15Fixed16toDouble(_cmsAdjustEndianess32(xyz.Y));
         XYZ->Z = _cms15Fixed16toDouble(_cmsAdjustEndianess32(xyz.Z));
-
-        NormalizeXYZ(XYZ);
     }
     return TRUE;
 }
@@ -336,7 +318,7 @@
 
     _cmsAssert(io != NULL);
 
-    tmp = *(cmsUInt32Number*) &n;
+    tmp = *(cmsUInt32Number*) (void*) &n;
     tmp = _cmsAdjustEndianess32(tmp);
     if (io -> Write(io, sizeof(cmsUInt32Number), &tmp) != 1)
             return FALSE;
@@ -532,7 +514,10 @@
     va_start(args, frm);
 
     len = vsnprintf((char*) Buffer, 2047, frm, args);
-    if (len < 0) return FALSE;   // Truncated, which is a fatal error for us
+    if (len < 0) {
+        va_end(args);
+        return FALSE;   // Truncated, which is a fatal error for us
+    }
 
     rc = io ->Write(io, len, Buffer);
 
@@ -554,6 +539,7 @@
         if (ContextID == NULL) {
 
             ctx->MemPool = _cmsCreateSubAlloc(0, 2*1024);
+            if (ctx->MemPool == NULL) return NULL;
         }
         else {
             cmsSignalError(ContextID, cmsERROR_CORRUPTION_DETECTED, "NULL memory pool on context");
@@ -989,3 +975,5 @@
 {
     return _cmsContextGetClientChunk(ContextID, UserPtr);
 }
+
+
--- a/src/java.desktop/share/native/liblcms/cmsps2.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsps2.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -608,7 +608,7 @@
 //
 //  Each row contains Pipeline values for all but first component. So, I
 //  detect row changing by keeping a copy of last value of first
-//  component. -1 is used to mark begining of whole block.
+//  component. -1 is used to mark beginning of whole block.
 
 static
 int OutputValueSampler(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo)
@@ -1422,14 +1422,15 @@
     if (nColorant > cmsMAXCHANNELS)
         nColorant = cmsMAXCHANNELS;
 
-    for (j=0; j < nColorant; j++) {
+    for (j = 0; j < nColorant; j++) {
 
-                sprintf(Buff, "%.3f", Out[j] / 65535.0);
-                strcat(Colorant, Buff);
-                if (j < nColorant -1)
-                        strcat(Colorant, " ");
+        snprintf(Buff, 31, "%.3f", Out[j] / 65535.0);
+        Buff[31] = 0;
+        strcat(Colorant, Buff);
+        if (j < nColorant - 1)
+            strcat(Colorant, " ");
 
-        }
+    }
 }
 
 
--- a/src/java.desktop/share/native/liblcms/cmssamp.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmssamp.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
--- a/src/java.desktop/share/native/liblcms/cmssm.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmssm.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -247,7 +247,8 @@
 {
     cmsFloat64Number a, b, c, d, e, D;
     cmsFloat64Number sc, sN, sD;
-    cmsFloat64Number tc, tN, tD;
+    //cmsFloat64Number tc; // left for future use
+    cmsFloat64Number tN, tD;
     cmsVEC3 w0;
 
     _cmsVEC3minus(&w0, &line1 ->a, &line2 ->a);
@@ -315,7 +316,7 @@
     }
     // finally do the division to get sc and tc
     sc = (fabs(sN) < MATRIX_DET_TOLERANCE ? 0.0 : sN / sD);
-    tc = (fabs(tN) < MATRIX_DET_TOLERANCE ? 0.0 : tN / tD);
+    //tc = (fabs(tN) < MATRIX_DET_TOLERANCE ? 0.0 : tN / tD); // left for future use.
 
     GetPointOfLine(r, line1, sc);
     return TRUE;
@@ -346,7 +347,7 @@
 }
 
 
-// Auxiliar to retrieve a pointer to the segmentr containing the Lab value
+// Auxiliary to retrieve a pointer to the segmentr containing the Lab value
 static
 cmsGDBPoint* GetPoint(cmsGDB* gbd, const cmsCIELab* Lab, cmsSpherical* sp)
 {
@@ -358,7 +359,7 @@
     _cmsAssert(Lab != NULL);
     _cmsAssert(sp != NULL);
 
-    // Center L* by substracting half of its domain, that's 50
+    // Center L* by subtracting half of its domain, that's 50
     _cmsVEC3init(&v, Lab ->L - 50.0, Lab ->a, Lab ->b);
 
     // Convert to spherical coordinates
--- a/src/java.desktop/share/native/liblcms/cmstypes.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmstypes.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -59,7 +59,7 @@
 // This file implements every single tag and tag type as described in the ICC spec. Some types
 // have been deprecated, like ncl and Data. There is no implementation for those types as there
 // are no profiles holding them. The programmer can also extend this list by defining his own types
-// by using the appropiate plug-in. There are three types of plug ins regarding that. First type
+// by using the appropriate plug-in. There are three types of plug ins regarding that. First type
 // allows to define new tags using any existing type. Next plug-in type allows to define new types
 // and the third one is very specific: allows to extend the number of elements in the multiprocessing
 // elements special type.
@@ -142,7 +142,7 @@
 }
 
 
-// Auxiliar to convert UTF-32 to UTF-16 in some cases
+// Auxiliary to convert UTF-32 to UTF-16 in some cases
 static
 cmsBool _cmsWriteWCharArray(cmsIOHANDLER* io, cmsUInt32Number n, const wchar_t* Array)
 {
@@ -158,7 +158,7 @@
     return TRUE;
 }
 
-// Auxiliar to read an array of wchar_t
+// Auxiliary to read an array of wchar_t
 static
 cmsBool _cmsReadWCharArray(cmsIOHANDLER* io, cmsUInt32Number n, wchar_t* Array)
 {
@@ -189,7 +189,7 @@
                                              cmsUInt32Number n,
                                              cmsUInt32Number SizeOfTag);
 
-// Helper function to deal with position tables as decribed in ICC spec 4.3
+// Helper function to deal with position tables as described in ICC spec 4.3
 // A table of n elements is readed, where first comes n records containing offsets and sizes and
 // then a block containing the data itself. This allows to reuse same data in more than one entry
 static
@@ -980,7 +980,7 @@
     cmsMLU* mlu = (cmsMLU*) Ptr;
     char *Text = NULL;
     wchar_t *Wide = NULL;
-    cmsUInt32Number len, len_aligned, len_filler_alignment;
+    cmsUInt32Number len, len_text, len_tag_requirement, len_aligned;
     cmsBool  rc = FALSE;
     char Filler[68];
 
@@ -990,17 +990,18 @@
     // Get the len of string
     len = cmsMLUgetASCII(mlu, cmsNoLanguage, cmsNoCountry, NULL, 0);
 
-    // From ICC3.4: It has been found that textDescriptionType can contain misaligned data
+    // Specification ICC.1:2001-04 (v2.4.0): It has been found that textDescriptionType can contain misaligned data
     //(see clause 4.1 for the definition of “aligned”). Because the Unicode language
     // code and Unicode count immediately follow the ASCII description, their
     // alignment is not correct if the ASCII count is not a multiple of four. The
     // ScriptCode code is misaligned when the ASCII count is odd. Profile reading and
     // writing software must be written carefully in order to handle these alignment
     // problems.
-
-    // Compute an aligned size
-    len_aligned = _cmsALIGNLONG(len);
-    len_filler_alignment = len_aligned - len;
+    //
+    // The above last sentence suggest to handle alignment issues in the
+    // parser. The provided example (Table 69 on Page 60) makes this clear.
+    // The padding only in the ASCII count is not sufficient for a aligned tag
+    // size, with the same text size in ASCII and Unicode.
 
     // Null strings
     if (len <= 0) {
@@ -1021,6 +1022,12 @@
         cmsMLUgetWide(mlu,  cmsNoLanguage, cmsNoCountry,  Wide, len * sizeof(wchar_t));
     }
 
+    // Tell the real text len including the null terminator and padding
+    len_text = (cmsUInt32Number) strlen(Text) + 1;
+    // Compute an total tag size requirement
+    len_tag_requirement = (8+4+len_text+4+4+2*len_text+2+1+67);
+    len_aligned = _cmsALIGNLONG(len_tag_requirement);
+
   // * cmsUInt32Number       count;          * Description length
   // * cmsInt8Number         desc[count]     * NULL terminated ascii string
   // * cmsUInt32Number       ucLangCode;     * UniCode language code
@@ -1030,20 +1037,14 @@
   // * cmsUInt8Number        scCount;        * ScriptCode count
   // * cmsInt8Number         scDesc[67];     * ScriptCode Description
 
-    if (!_cmsWriteUInt32Number(io, len_aligned)) goto Error;
-    if (!io ->Write(io, len, Text)) goto Error;
-    if (!io ->Write(io, len_filler_alignment, Filler)) goto Error;
+    if (!_cmsWriteUInt32Number(io, len_text)) goto Error;
+    if (!io ->Write(io, len_text, Text)) goto Error;
 
     if (!_cmsWriteUInt32Number(io, 0)) goto Error;  // ucLanguageCode
 
-    // This part is tricky: we need an aligned tag size, and the ScriptCode part
-    // takes 70 bytes, so we need 2 extra bytes to do the alignment
-
-    if (!_cmsWriteUInt32Number(io, len_aligned+1)) goto Error;
-
+    if (!_cmsWriteUInt32Number(io, len_text)) goto Error;
     // Note that in some compilers sizeof(cmsUInt16Number) != sizeof(wchar_t)
-    if (!_cmsWriteWCharArray(io, len, Wide)) goto Error;
-    if (!_cmsWriteUInt16Array(io, len_filler_alignment+1, (cmsUInt16Number*) Filler)) goto Error;
+    if (!_cmsWriteWCharArray(io, len_text, Wide)) goto Error;
 
     // ScriptCode Code & count (unused)
     if (!_cmsWriteUInt16Number(io, 0)) goto Error;
@@ -1051,6 +1052,10 @@
 
     if (!io ->Write(io, 67, Filler)) goto Error;
 
+    // possibly add pad at the end of tag
+    if(len_aligned - len_tag_requirement > 0)
+      if (!io ->Write(io, len_aligned - len_tag_requirement, Filler)) goto Error;
+
     rc = TRUE;
 
 Error:
@@ -1498,7 +1503,7 @@
             LargestPosition = EndOfThisString;
     }
 
-    // Now read the remaining of tag and fill all strings. Substract the directory
+    // Now read the remaining of tag and fill all strings. Subtract the directory
     SizeOfTag   = (LargestPosition * sizeof(wchar_t)) / sizeof(cmsUInt16Number);
     if (SizeOfTag == 0)
     {
@@ -1532,7 +1537,7 @@
     cmsMLU* mlu =(cmsMLU*) Ptr;
     cmsUInt32Number HeaderSize;
     cmsUInt32Number  Len, Offset;
-    int i;
+    cmsUInt32Number i;
 
     if (Ptr == NULL) {
 
@@ -3133,6 +3138,8 @@
 
         memset(Colorant, 0, sizeof(Colorant));
         if (io -> Read(io, Root, 32, 1) != 1) return NULL;
+        Root[32] = 0;  // To prevent exploits
+
         if (!_cmsReadUInt16Array(io, 3, PCS)) goto Error;
         if (!_cmsReadUInt16Array(io, nDeviceCoords, Colorant)) goto Error;
 
@@ -3155,8 +3162,8 @@
 cmsBool Type_NamedColor_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
 {
     cmsNAMEDCOLORLIST* NamedColorList = (cmsNAMEDCOLORLIST*) Ptr;
-    char                prefix[32];     // Prefix for each color name
-    char                suffix[32];     // Suffix for each color name
+    char                prefix[33];     // Prefix for each color name
+    char                suffix[33];     // Suffix for each color name
     int i, nColors;
 
     nColors = cmsNamedColorCount(NamedColorList);
@@ -3168,7 +3175,7 @@
     strncpy(prefix, (const char*) NamedColorList->Prefix, 32);
     strncpy(suffix, (const char*) NamedColorList->Suffix, 32);
 
-    suffix[31] = prefix[31] = 0;
+    suffix[32] = prefix[32] = 0;
 
     if (!io ->Write(io, 32, prefix)) return FALSE;
     if (!io ->Write(io, 32, suffix)) return FALSE;
@@ -3180,6 +3187,7 @@
        char Root[33];
 
         if (!cmsNamedColorInfo(NamedColorList, i, Root, NULL, NULL, PCS, Colorant)) return 0;
+        Root[32] = 0;
         if (!io ->Write(io, 32 , Root)) return FALSE;
         if (!_cmsWriteUInt16Array(io, 3, PCS)) return FALSE;
         if (!_cmsWriteUInt16Array(io, NamedColorList ->ColorantCount, Colorant)) return FALSE;
@@ -3630,7 +3638,7 @@
 
 
 
-// Auxiliar, read an string specified as count + string
+// Auxiliary, read an string specified as count + string
 static
 cmsBool  ReadCountAndSting(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsMLU* mlu, cmsUInt32Number* SizeOfTag, const char* Section)
 {
@@ -3879,7 +3887,7 @@
 static
 void* Type_ViewingConditions_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n)
 {
-   return _cmsDupMem(self ->ContextID, Ptr, sizeof(cmsScreening));
+   return _cmsDupMem(self->ContextID, Ptr, sizeof(cmsICCViewingConditions));
 
    cmsUNUSED_PARAMETER(n);
 }
@@ -4333,13 +4341,13 @@
 static
 cmsBool  Type_MPEclut_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
 {
-    cmsUInt8Number Dimensions8[16];
+    cmsUInt8Number Dimensions8[16];  // 16 because the spec says 16 and not max number of channels
     cmsUInt32Number i;
     cmsStage* mpe = (cmsStage*) Ptr;
     _cmsStageCLutData* clut = (_cmsStageCLutData*) mpe ->Data;
 
-    // Check for maximum number of channels
-    if (mpe -> InputChannels > 15) return FALSE;
+    // Check for maximum number of channels supported by lcms
+    if (mpe -> InputChannels > MAX_INPUT_DIMENSIONS) return FALSE;
 
     // Only floats are supported in MPE
     if (clut ->HasFloatValues == FALSE) return FALSE;
@@ -5477,8 +5485,9 @@
     { cmsSigScreeningTag,           { 1, 1, { cmsSigScreeningType},          NULL }, &SupportedTags[59]},
     { cmsSigVcgtTag,                { 1, 1, { cmsSigVcgtType},               NULL }, &SupportedTags[60]},
     { cmsSigMetaTag,                { 1, 1, { cmsSigDictType},               NULL }, &SupportedTags[61]},
-    { cmsSigProfileSequenceIdTag,   { 1, 1, { cmsSigProfileSequenceIdType},  NULL },  &SupportedTags[62]},
-    { cmsSigProfileDescriptionMLTag,{ 1, 1, { cmsSigMultiLocalizedUnicodeType}, NULL}, NULL}
+    { cmsSigProfileSequenceIdTag,   { 1, 1, { cmsSigProfileSequenceIdType},  NULL }, &SupportedTags[62]},
+    { cmsSigProfileDescriptionMLTag,{ 1, 1, { cmsSigMultiLocalizedUnicodeType}, NULL}, &SupportedTags[63]},
+    { cmsSigArgyllArtsTag,          { 9, 1, { cmsSigS15Fixed16ArrayType},    NULL}, NULL}
 
 
 };
--- a/src/java.desktop/share/native/liblcms/cmsvirt.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsvirt.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1167,15 +1167,20 @@
     // If no way, then force CLUT that for sure can be written
     if (AllowedLUT == NULL) {
 
+        cmsStage* FirstStage;
+        cmsStage* LastStage;
+
         dwFlags |= cmsFLAGS_FORCE_CLUT;
         _cmsOptimizePipeline(ContextID, &LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
 
         // Put identity curves if needed
-        if (cmsPipelineGetPtrToFirstStage(LUT) ->Type != cmsSigCurveSetElemType)
+        FirstStage = cmsPipelineGetPtrToFirstStage(LUT);
+        if (FirstStage != NULL && FirstStage ->Type != cmsSigCurveSetElemType)
              if (!cmsPipelineInsertStage(LUT, cmsAT_BEGIN, _cmsStageAllocIdentityCurves(ContextID, ChansIn)))
                  goto Error;
 
-        if (cmsPipelineGetPtrToLastStage(LUT) ->Type != cmsSigCurveSetElemType)
+        LastStage = cmsPipelineGetPtrToLastStage(LUT);
+        if (LastStage != NULL && LastStage ->Type != cmsSigCurveSetElemType)
              if (!cmsPipelineInsertStage(LUT, cmsAT_END,   _cmsStageAllocIdentityCurves(ContextID, ChansOut)))
                  goto Error;
 
--- a/src/java.desktop/share/native/liblcms/cmswtpnt.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmswtpnt.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -376,3 +376,5 @@
 
     return TRUE;
 }
+
+
--- a/src/java.desktop/share/native/liblcms/cmsxform.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/cmsxform.c	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -208,12 +208,18 @@
 
 {
     _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform;
+    cmsStride stride;
 
-    p -> xform(p, InputBuffer, OutputBuffer, Size, Size);
+    stride.BytesPerLineIn = 0;  // Not used
+    stride.BytesPerLineOut = 0;
+    stride.BytesPerPlaneIn = Size;
+    stride.BytesPerPlaneOut = Size;
+
+    p -> xform(p, InputBuffer, OutputBuffer, Size, 1, &stride);
 }
 
 
-// Apply transform.
+// This is a legacy stride for planar
 void CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM  Transform,
                               const void* InputBuffer,
                               void* OutputBuffer,
@@ -221,10 +227,40 @@
 
 {
     _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform;
+    cmsStride stride;
 
-    p -> xform(p, InputBuffer, OutputBuffer, Size, Stride);
+    stride.BytesPerLineIn = 0;
+    stride.BytesPerLineOut = 0;
+    stride.BytesPerPlaneIn = Stride;
+    stride.BytesPerPlaneOut = Stride;
+
+    p -> xform(p, InputBuffer, OutputBuffer, Size, 1, &stride);
 }
 
+// This is the "fast" function for plugins
+void CMSEXPORT cmsDoTransformLineStride(cmsHTRANSFORM  Transform,
+                              const void* InputBuffer,
+                              void* OutputBuffer,
+                              cmsUInt32Number PixelsPerLine,
+                              cmsUInt32Number LineCount,
+                              cmsUInt32Number BytesPerLineIn,
+                              cmsUInt32Number BytesPerLineOut,
+                              cmsUInt32Number BytesPerPlaneIn,
+                              cmsUInt32Number BytesPerPlaneOut)
+
+{
+    _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform;
+    cmsStride stride;
+
+    stride.BytesPerLineIn = BytesPerLineIn;
+    stride.BytesPerLineOut = BytesPerLineOut;
+    stride.BytesPerPlaneIn = BytesPerPlaneIn;
+    stride.BytesPerPlaneOut = BytesPerPlaneOut;
+
+    p->xform(p, InputBuffer, OutputBuffer, PixelsPerLine, LineCount, &stride);
+}
+
+
 
 // Transform routines ----------------------------------------------------------------------------------------------------------
 
@@ -233,49 +269,64 @@
 static
 void FloatXFORM(_cmsTRANSFORM* p,
                 const void* in,
-                void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                void* out,
+                cmsUInt32Number PixelsPerLine,
+                cmsUInt32Number LineCount,
+                const cmsStride* Stride)
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsFloat32Number fIn[cmsMAXCHANNELS], fOut[cmsMAXCHANNELS];
     cmsFloat32Number OutOfGamut;
-    cmsUInt32Number i, j;
+    cmsUInt32Number i, j, c, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < Size; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum = p -> FromInputFloat(p, fIn, accum, Stride);
+    for (i = 0; i < LineCount; i++) {
 
-        // Any gamut chack to do?
-        if (p ->GamutCheck != NULL) {
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
 
-            // Evaluate gamut marker.
-            cmsPipelineEvalFloat( fIn, &OutOfGamut, p ->GamutCheck);
+        for (j = 0; j < PixelsPerLine; j++) {
 
-            // Is current color out of gamut?
-            if (OutOfGamut > 0.0) {
+            accum = p->FromInputFloat(p, fIn, accum, Stride->BytesPerPlaneIn);
 
-                // Certainly, out of gamut
-                for (j=0; j < cmsMAXCHANNELS; j++)
-                    fOut[j] = -1.0;
+            // Any gamut chack to do?
+            if (p->GamutCheck != NULL) {
 
+                // Evaluate gamut marker.
+                cmsPipelineEvalFloat(fIn, &OutOfGamut, p->GamutCheck);
+
+                // Is current color out of gamut?
+                if (OutOfGamut > 0.0) {
+
+                    // Certainly, out of gamut
+                    for (c = 0; c < cmsMAXCHANNELS; c++)
+                        fOut[c] = -1.0;
+
+                }
+                else {
+                    // No, proceed normally
+                    cmsPipelineEvalFloat(fIn, fOut, p->Lut);
+                }
             }
             else {
-                // No, proceed normally
-                cmsPipelineEvalFloat(fIn, fOut, p -> Lut);
+
+                // No gamut check at all
+                cmsPipelineEvalFloat(fIn, fOut, p->Lut);
             }
-        }
-        else {
 
-            // No gamut check at all
-            cmsPipelineEvalFloat(fIn, fOut, p -> Lut);
+
+            output = p->ToOutputFloat(p, fOut, output, Stride->BytesPerPlaneOut);
         }
 
-        // Back to asked representation
-        output = p -> ToOutputFloat(p, fOut, output, Stride);
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
     }
+
 }
 
 
@@ -283,22 +334,34 @@
 void NullFloatXFORM(_cmsTRANSFORM* p,
                     const void* in,
                     void* out,
-                    cmsUInt32Number Size,
-                    cmsUInt32Number Stride)
+                    cmsUInt32Number PixelsPerLine,
+                    cmsUInt32Number LineCount,
+                    const cmsStride* Stride)
+
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsFloat32Number fIn[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum  = p -> FromInputFloat(p, fIn, accum, Stride);
-        output = p -> ToOutputFloat(p, fIn, output, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+           accum = (cmsUInt8Number*) in + strideIn;
+           output = (cmsUInt8Number*) out + strideOut;
+
+           for (j = 0; j < PixelsPerLine; j++) {
+
+                  accum = p->FromInputFloat(p, fIn, accum, Stride ->BytesPerPlaneIn);
+                  output = p->ToOutputFloat(p, fIn, output, Stride->BytesPerPlaneOut);
+           }
+
+           strideIn += Stride->BytesPerLineIn;
+           strideOut += Stride->BytesPerLineOut;
     }
 }
 
@@ -308,23 +371,36 @@
 static
 void NullXFORM(_cmsTRANSFORM* p,
                const void* in,
-               void* out, cmsUInt32Number Size,
-               cmsUInt32Number Stride)
+               void* out,
+               cmsUInt32Number PixelsPerLine,
+               cmsUInt32Number LineCount,
+               const cmsStride* Stride)
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;                    // Buffer len
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum  = p -> FromInput(p, wIn, accum, Stride);
-        output = p -> ToOutput(p, wIn, output, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+           accum = (cmsUInt8Number*)in + strideIn;
+           output = (cmsUInt8Number*)out + strideOut;
+
+           for (j = 0; j < PixelsPerLine; j++) {
+
+                  accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
+                  output = p->ToOutput(p, wIn, output, Stride->BytesPerPlaneOut);
     }
+
+           strideIn += Stride->BytesPerLineIn;
+           strideOut += Stride->BytesPerLineOut;
+    }
+
 }
 
 
@@ -332,27 +408,41 @@
 static
 void PrecalculatedXFORM(_cmsTRANSFORM* p,
                         const void* in,
-                        void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                        void* out,
+                        cmsUInt32Number PixelsPerLine,
+                        cmsUInt32Number LineCount,
+                        const cmsStride* Stride)
 {
     register cmsUInt8Number* accum;
     register cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum = p -> FromInput(p, wIn, accum, Stride);
-        p ->Lut ->Eval16Fn(wIn, wOut, p -> Lut->Data);
-        output = p -> ToOutput(p, wOut, output, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
+
+        for (j = 0; j < PixelsPerLine; j++) {
+
+            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
+            p->Lut->Eval16Fn(wIn, wOut, p->Lut->Data);
+            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
+        }
+
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
     }
+
 }
 
 
-// Auxiliar: Handle precalculated gamut check. The retrieval of context may be alittle bit slow, but this function is not critical.
+// Auxiliary: Handle precalculated gamut check. The retrieval of context may be alittle bit slow, but this function is not critical.
 static
 void TransformOnePixelWithGamutCheck(_cmsTRANSFORM* p,
                                      const cmsUInt16Number wIn[],
@@ -379,22 +469,35 @@
 static
 void PrecalculatedXFORMGamutCheck(_cmsTRANSFORM* p,
                                   const void* in,
-                                  void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                                  void* out,
+                                  cmsUInt32Number PixelsPerLine,
+                                  cmsUInt32Number LineCount,
+                                  const cmsStride* Stride)
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;                    // Buffer len
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum = p -> FromInput(p, wIn, accum, Stride);
-        TransformOnePixelWithGamutCheck(p, wIn, wOut);
-        output = p -> ToOutput(p, wOut, output, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+           accum = (cmsUInt8Number*)in + strideIn;
+           output = (cmsUInt8Number*)out + strideOut;
+
+           for (j = 0; j < PixelsPerLine; j++) {
+
+                  accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
+                  TransformOnePixelWithGamutCheck(p, wIn, wOut);
+                  output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
+           }
+
+           strideIn += Stride->BytesPerLineIn;
+           strideOut += Stride->BytesPerLineOut;
     }
 }
 
@@ -403,94 +506,120 @@
 static
 void CachedXFORM(_cmsTRANSFORM* p,
                  const void* in,
-                 void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                 void* out,
+                 cmsUInt32Number PixelsPerLine,
+                 cmsUInt32Number LineCount,
+                 const cmsStride* Stride)
 {
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-    cmsUInt32Number i, n;
     _cmsCACHE Cache;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-    accum  = (cmsUInt8Number*)  in;
-    output = (cmsUInt8Number*)  out;
-    n = Size;                    // Buffer len
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
     // Empty buffers for quick memcmp
-    memset(wIn,  0, sizeof(wIn));
+    memset(wIn, 0, sizeof(wIn));
     memset(wOut, 0, sizeof(wOut));
 
     // Get copy of zero cache
-    memcpy(&Cache, &p ->Cache, sizeof(Cache));
+    memcpy(&Cache, &p->Cache, sizeof(Cache));
 
-    for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-        accum = p -> FromInput(p, wIn, accum, Stride);
+    for (i = 0; i < LineCount; i++) {
 
-        if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) {
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
 
-            memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
-        }
-        else {
+        for (j = 0; j < PixelsPerLine; j++) {
 
-            p ->Lut ->Eval16Fn(wIn, wOut, p -> Lut->Data);
+            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
 
-            memcpy(Cache.CacheIn,  wIn,  sizeof(Cache.CacheIn));
-            memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
+            if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) {
+
+                memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
+            }
+            else {
+                p->Lut->Eval16Fn(wIn, wOut, p->Lut->Data);
+
+                memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn));
+                memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
+            }
+
+            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
         }
 
-        output = p -> ToOutput(p, wOut, output, Stride);
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
     }
-
 }
 
-
 // All those nice features together
 static
 void CachedXFORMGamutCheck(_cmsTRANSFORM* p,
                            const void* in,
-                           void* out, cmsUInt32Number Size, cmsUInt32Number Stride)
+                           void* out,
+                           cmsUInt32Number PixelsPerLine,
+                           cmsUInt32Number LineCount,
+                           const cmsStride* Stride)
 {
-       cmsUInt8Number* accum;
-       cmsUInt8Number* output;
-       cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-       cmsUInt32Number i, n;
-       _cmsCACHE Cache;
+    cmsUInt8Number* accum;
+    cmsUInt8Number* output;
+    cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
+    _cmsCACHE Cache;
+    cmsUInt32Number i, j, strideIn, strideOut;
 
-       accum  = (cmsUInt8Number*)  in;
-       output = (cmsUInt8Number*)  out;
-       n = Size;                    // Buffer len
+    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
-       // Empty buffers for quick memcmp
-       memset(wIn,  0, sizeof(cmsUInt16Number) * cmsMAXCHANNELS);
-       memset(wOut, 0, sizeof(cmsUInt16Number) * cmsMAXCHANNELS);
+    // Empty buffers for quick memcmp
+    memset(wIn, 0, sizeof(wIn));
+    memset(wOut, 0, sizeof(wOut));
 
-       // Get copy of zero cache
-       memcpy(&Cache, &p ->Cache, sizeof(Cache));
+    // Get copy of zero cache
+    memcpy(&Cache, &p->Cache, sizeof(Cache));
 
-       for (i=0; i < n; i++) {
+    strideIn = 0;
+    strideOut = 0;
 
-            accum = p -> FromInput(p, wIn, accum, Stride);
+    for (i = 0; i < LineCount; i++) {
+
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
+
+        for (j = 0; j < PixelsPerLine; j++) {
+
+            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
 
             if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) {
-                    memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
+
+                memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
             }
             else {
-                    TransformOnePixelWithGamutCheck(p, wIn, wOut);
-                    memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn));
-                    memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
+                TransformOnePixelWithGamutCheck(p, wIn, wOut);
+
+                memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn));
+                memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
             }
 
-            output = p -> ToOutput(p, wOut, output, Stride);
-       }
+            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
+        }
 
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
+    }
 }
 
-// -------------------------------------------------------------------------------------------------------------
+// Transform plug-ins ----------------------------------------------------------------------------------------------------
 
 // List of used-defined transform factories
 typedef struct _cmsTransformCollection_st {
 
-    _cmsTransformFactory  Factory;
+    _cmsTransform2Factory  Factory;
+    cmsBool                OldXform;   // Factory returns xform function in the old style
+
     struct _cmsTransformCollection_st *Next;
 
 } _cmsTransformCollection;
@@ -533,6 +662,7 @@
   ctx ->chunks[TransformPlugin] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsTransformPluginChunkType));
 }
 
+// Allocates memory for transform plugin factory
 void _cmsAllocTransformPluginChunk(struct _cmsContext_struct* ctx,
                                         const struct _cmsContext_struct* src)
 {
@@ -547,6 +677,35 @@
     }
 }
 
+// Adaptor for old versions of plug-in
+static
+void _cmsTransform2toTransformAdaptor(struct _cmstransform_struct *CMMcargo,
+                                      const void* InputBuffer,
+                                      void* OutputBuffer,
+                                      cmsUInt32Number PixelsPerLine,
+                                      cmsUInt32Number LineCount,
+                                      const cmsStride* Stride)
+{
+
+       cmsUInt32Number i, strideIn, strideOut;
+
+       _cmsHandleExtraChannels(CMMcargo, InputBuffer, OutputBuffer, PixelsPerLine, LineCount, Stride);
+
+       strideIn = 0;
+       strideOut = 0;
+
+       for (i = 0; i < LineCount; i++) {
+
+              void *accum = (cmsUInt8Number*)InputBuffer + strideIn;
+              void *output = (cmsUInt8Number*)OutputBuffer + strideOut;
+
+              CMMcargo->OldXform(CMMcargo, accum, output, PixelsPerLine, Stride->BytesPerPlaneIn);
+
+              strideIn += Stride->BytesPerLineIn;
+              strideOut += Stride->BytesPerLineOut;
+       }
+}
+
 
 
 // Register new ways to transform
@@ -564,14 +723,22 @@
     }
 
     // Factory callback is required
-    if (Plugin ->Factory == NULL) return FALSE;
+    if (Plugin->factories.xform == NULL) return FALSE;
 
 
     fl = (_cmsTransformCollection*) _cmsPluginMalloc(ContextID, sizeof(_cmsTransformCollection));
     if (fl == NULL) return FALSE;
 
+    // Check for full xform plug-ins previous to 2.8, we would need an adapter in that case
+    if (Plugin->base.ExpectedVersion < 2080) {
+
+           fl->OldXform = TRUE;
+    }
+    else
+           fl->OldXform = FALSE;
+
     // Copy the parameters
-    fl ->Factory = Plugin ->Factory;
+    fl->Factory = Plugin->factories.xform;
 
     // Keep linked list
     fl ->Next = ctx->TransformCollection;
@@ -656,6 +823,12 @@
                             p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
                             p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
 
+                            // Save the day?
+                            if (Plugin->OldXform) {
+                                   p->OldXform = (_cmsTransformFn) p->xform;
+                                   p->xform = _cmsTransform2toTransformAdaptor;
+                            }
+
                             return p;
                      }
               }
@@ -816,6 +989,22 @@
 
 // ----------------------------------------------------------------------------------------------------------------
 
+// Jun-21-2000: Some profiles (those that comes with W2K) comes
+// with the media white (media black?) x 100. Add a sanity check
+
+static
+void NormalizeXYZ(cmsCIEXYZ* Dest)
+{
+    while (Dest -> X > 2. &&
+           Dest -> Y > 2. &&
+           Dest -> Z > 2.) {
+
+               Dest -> X /= 10.;
+               Dest -> Y /= 10.;
+               Dest -> Z /= 10.;
+       }
+}
+
 static
 void SetWhitePoint(cmsCIEXYZ* wtPt, const cmsCIEXYZ* src)
 {
@@ -828,6 +1017,8 @@
         wtPt ->X = src->X;
         wtPt ->Y = src->Y;
         wtPt ->Z = src->Z;
+
+        NormalizeXYZ(wtPt);
     }
 
 }
@@ -1138,7 +1329,6 @@
                                          cmsUInt32Number InputFormat,
                                          cmsUInt32Number OutputFormat)
 {
-
     _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform;
     cmsFormatter16 FromInput, ToOutput;
 
--- a/src/java.desktop/share/native/liblcms/lcms2.h	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/lcms2.h	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -52,7 +52,7 @@
 //
 //---------------------------------------------------------------------------------
 //
-// Version 2.7
+// Version 2.8
 //
 
 #ifndef _lcms2_H
@@ -104,7 +104,7 @@
 #endif
 
 // Version/release
-#define LCMS_VERSION        2070
+#define LCMS_VERSION        2080
 
 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
@@ -202,43 +202,44 @@
 #  define CMS_IS_WINDOWS_ 1
 #endif
 
-// Try to detect big endian platforms. This list can be endless, so only some checks are performed over here.
-// you can pass this toggle to the compiler by using -DCMS_USE_BIG_ENDIAN or something similar
+// Try to detect big endian platforms. This list can be endless, so primarily rely on the configure script
+// on Unix-like systems, and allow it to be set on the compiler command line using
+// -DCMS_USE_BIG_ENDIAN or something similar
+#ifdef CMS_USE_BIG_ENDIAN // set at compiler command line takes overall precedence
 
-#if defined(__sgi__) || defined(__sgi) || defined(sparc)
-#   define CMS_USE_BIG_ENDIAN      1
-#endif
+#  if CMS_USE_BIG_ENDIAN == 0
+#    undef CMS_USE_BIG_ENDIAN
+#  endif
 
-#if defined(__s390__) || defined(__s390x__)
-#   define CMS_USE_BIG_ENDIAN   1
-#endif
+#else // CMS_USE_BIG_ENDIAN
 
+#  ifdef WORDS_BIGENDIAN // set by configure (or explicitly on compiler command line)
+#    define CMS_USE_BIG_ENDIAN 1
+#  else // WORDS_BIGENDIAN
+// Fall back to platform/compiler specific tests
+#    if defined(__sgi__) || defined(__sgi) || defined(sparc)
+#      define CMS_USE_BIG_ENDIAN      1
+#    endif
 
-#if defined(__powerpc__) || defined(__ppc__) || defined(TARGET_CPU_PPC)
-#  if __powerpc__ || __ppc__ || TARGET_CPU_PPC
-#   define CMS_USE_BIG_ENDIAN   1
-#   if defined (__GNUC__) && defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
-#       if __BYTE_ORDER__  == __ORDER_LITTLE_ENDIAN__
-                // Don't use big endian for PowerPC little endian mode
-#                undef CMS_USE_BIG_ENDIAN
-#       endif
-#     endif
-#   endif
-#endif
+#    if defined(__s390__) || defined(__s390x__)
+#      define CMS_USE_BIG_ENDIAN   1
+#    endif
 
-#ifdef macintosh
-# ifdef __BIG_ENDIAN__
-#   define CMS_USE_BIG_ENDIAN      1
-# endif
-# ifdef __LITTLE_ENDIAN__
-#   undef CMS_USE_BIG_ENDIAN
-# endif
-#endif
+#    ifdef macintosh
+#      ifdef __BIG_ENDIAN__
+#        define CMS_USE_BIG_ENDIAN      1
+#      endif
+#      ifdef __LITTLE_ENDIAN__
+#        undef CMS_USE_BIG_ENDIAN
+#      endif
+#    endif
+#  endif  // WORDS_BIGENDIAN
 
-// WORDS_BIGENDIAN takes precedence
-#if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(WORDS_BIGENDIAN)
-#   define CMS_USE_BIG_ENDIAN      1
-#endif
+#  if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
+#    define CMS_USE_BIG_ENDIAN      1
+#  endif
+
+#endif  // CMS_USE_BIG_ENDIAN
 
 
 // Calling convention -- this is hardly platform and compiler dependent
@@ -248,7 +249,7 @@
 #        define CMSEXPORT       __stdcall _export
 #        define CMSAPI
 #     else
-#        define CMSEXPORT      _stdcall
+#        define CMSEXPORT      __stdcall
 #        ifdef CMS_DLL_BUILD
 #            define CMSAPI    __declspec(dllexport)
 #        else
@@ -410,7 +411,8 @@
     cmsSigViewingCondDescTag                = 0x76756564,  // 'vued'
     cmsSigViewingConditionsTag              = 0x76696577,  // 'view'
     cmsSigVcgtTag                           = 0x76636774,  // 'vcgt'
-    cmsSigMetaTag                           = 0x6D657461   // 'meta'
+    cmsSigMetaTag                           = 0x6D657461,  // 'meta'
+    cmsSigArgyllArtsTag                     = 0x61727473   // 'arts'
 
 } cmsTagSignature;
 
@@ -683,7 +685,7 @@
 //            T: Pixeltype
 //            F: Flavor  0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
 //            P: Planar? 0=Chunky, 1=Planar
-//            X: swap 16 bps endianess?
+//            X: swap 16 bps endianness?
 //            S: Do swap? ie, BGR, KYMC
 //            E: Extra samples
 //            C: Channels (Samples per pixel)
@@ -926,7 +928,7 @@
 #define TYPE_ARGB_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|SWAPFIRST_SH(1))
 #define TYPE_BGR_FLT          (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
 #define TYPE_BGRA_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1)|SWAPFIRST_SH(1))
-#define TYPE_ABGR_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
+#define TYPE_ABGR_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(4)|DOSWAP_SH(1))
 
 #define TYPE_CMYK_FLT         (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(4))
 
@@ -1043,7 +1045,7 @@
 // Context handling --------------------------------------------------------------------------------------------------------
 
 // Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility
-// though using the global context is not recomended. Proper context handling makes lcms more thread-safe.
+// though using the global context is not recommended. Proper context handling makes lcms more thread-safe.
 
 typedef struct _cmsContext_struct* cmsContext;
 
@@ -1412,7 +1414,7 @@
 typedef struct {
 
     cmsUInt32Number n;
-    cmsContext     ContextID;
+    cmsContext      ContextID;
     cmsPSEQDESC*    seq;
 
 } cmsSEQ;
@@ -1679,6 +1681,8 @@
 // Specific to unbounded mode
 #define cmsFLAGS_NONEGATIVES              0x8000    // Prevent negative numbers in floating point transforms
 
+// Copy alpha channels when transforming
+#define cmsFLAGS_COPY_ALPHA               0x04000000 // Alpha channels are copied on cmsDoTransform()
 
 // Fine-tune control over number of gridpoints
 #define cmsFLAGS_GRIDPOINTS(n)           (((n) & 0xFF) << 16)
@@ -1757,12 +1761,22 @@
                                                  void * OutputBuffer,
                                                  cmsUInt32Number Size);
 
-CMSAPI void             CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform,
+CMSAPI void             CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM Transform,   // Deprecated
                                                  const void * InputBuffer,
                                                  void * OutputBuffer,
                                                  cmsUInt32Number Size,
                                                  cmsUInt32Number Stride);
 
+CMSAPI void             CMSEXPORT cmsDoTransformLineStride(cmsHTRANSFORM  Transform,
+                                                 const void* InputBuffer,
+                                                 void* OutputBuffer,
+                                                 cmsUInt32Number PixelsPerLine,
+                                                 cmsUInt32Number LineCount,
+                                                 cmsUInt32Number BytesPerLineIn,
+                                                 cmsUInt32Number BytesPerLineOut,
+                                                 cmsUInt32Number BytesPerPlaneIn,
+                                                 cmsUInt32Number BytesPerPlaneOut);
+
 
 CMSAPI void             CMSEXPORT cmsSetAlarmCodes(const cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
 CMSAPI void             CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number NewAlarm[cmsMAXCHANNELS]);
--- a/src/java.desktop/share/native/liblcms/lcms2_internal.h	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/lcms2_internal.h	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2014 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -86,7 +86,15 @@
 #define _cmsALIGNLONG(x) (((x)+(sizeof(cmsUInt32Number)-1)) & ~(sizeof(cmsUInt32Number)-1))
 
 // Alignment to memory pointer
-#define _cmsALIGNMEM(x)  (((x)+(sizeof(void *) - 1)) & ~(sizeof(void *) - 1))
+
+// (Ultra)SPARC with gcc requires ptr alignment of 8 bytes
+// even though sizeof(void *) is only four: for greatest flexibility
+// allow the build to specify ptr alignment.
+#ifndef CMS_PTR_ALIGNMENT
+# define CMS_PTR_ALIGNMENT sizeof(void *)
+#endif
+
+#define _cmsALIGNMEM(x)  (((x)+(CMS_PTR_ALIGNMENT - 1)) & ~(CMS_PTR_ALIGNMENT - 1))
 
 // Maximum encodeable values in floating point
 #define MAX_ENCODEABLE_XYZ  (1.0 + 32767.0/32768.0)
@@ -122,7 +130,7 @@
 
 // A fast way to convert from/to 16 <-> 8 bits
 #define FROM_8_TO_16(rgb) (cmsUInt16Number) ((((cmsUInt16Number) (rgb)) << 8)|(rgb))
-#define FROM_16_TO_8(rgb) (cmsUInt8Number) ((((rgb) * 65281 + 8388608) >> 24) & 0xFF)
+#define FROM_16_TO_8(rgb) (cmsUInt8Number) ((((cmsUInt32Number)(rgb) * 65281U + 8388608U) >> 24) & 0xFFU)
 
 // Code analysis is broken on asserts
 #ifdef _MSC_VER
@@ -691,8 +699,8 @@
     cmsContext ContextID;
 
     // The directory
-    int AllocatedEntries;
-    int UsedEntries;
+    cmsUInt32Number  AllocatedEntries;
+    cmsUInt32Number  UsedEntries;
     _cmsMLUentry* Entries;     // Array of pointers to strings allocated in MemPool
 
     // The Pool
@@ -760,7 +768,7 @@
     // Dictionary
     cmsUInt32Number          TagCount;
     cmsTagSignature          TagNames[MAX_TABLE_TAG];
-    cmsTagSignature          TagLinked[MAX_TABLE_TAG];           // The tag to wich is linked (0=none)
+    cmsTagSignature          TagLinked[MAX_TABLE_TAG];           // The tag to which is linked (0=none)
     cmsUInt32Number          TagSizes[MAX_TABLE_TAG];            // Size on disk
     cmsUInt32Number          TagOffsets[MAX_TABLE_TAG];
     cmsBool                  TagSaveAsRaw[MAX_TABLE_TAG];        // True to write uncooked
@@ -988,7 +996,7 @@
     cmsUInt32Number InputFormat, OutputFormat; // Keep formats for further reference
 
     // Points to transform code
-    _cmsTransformFn xform;
+    _cmsTransform2Fn xform;
 
     // Formatters, cannot be embedded into LUT because cache
     cmsFormatter16 FromInput;
@@ -1034,9 +1042,20 @@
     void* UserData;
     _cmsFreeUserDataFn FreeUserData;
 
+    // A way to provide backwards compatibility with full xform plugins
+    _cmsTransformFn OldXform;
+
 } _cmsTRANSFORM;
 
-// --------------------------------------------------------------------------------------------------
+// Copies extra channels from input to output if the original flags in the transform structure
+// instructs to do so. This function is called on all standard transform functions.
+void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
+                             void* out,
+                             cmsUInt32Number PixelsPerLine,
+                             cmsUInt32Number LineCount,
+                             const cmsStride* Stride);
+
+// -----------------------------------------------------------------------------------------------------------------------
 
 cmsHTRANSFORM _cmsChain2Lab(cmsContext             ContextID,
                             cmsUInt32Number        nProfiles,
--- a/src/java.desktop/share/native/liblcms/lcms2_plugin.h	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/liblcms/lcms2_plugin.h	Mon Aug 08 08:12:20 2016 -0700
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2011 Marti Maria Saguer
+//  Copyright (c) 1998-2016 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -157,7 +157,7 @@
                                                                    const void* Buffer);
 };
 
-// Endianess adjust functions
+// Endianness adjust functions
 CMSAPI cmsUInt16Number   CMSEXPORT  _cmsAdjustEndianess16(cmsUInt16Number Word);
 CMSAPI cmsUInt32Number   CMSEXPORT  _cmsAdjustEndianess32(cmsUInt32Number Value);
 CMSAPI void              CMSEXPORT  _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord);
@@ -371,8 +371,8 @@
 
 typedef cmsUInt8Number* (* cmsFormatter16)(register struct _cmstransform_struct* CMMcargo,
                                            register cmsUInt16Number Values[],
-                                           register cmsUInt8Number*  Buffer,
-                                           register cmsUInt32Number  Stride);
+                                           register cmsUInt8Number* Buffer,
+                                           register cmsUInt32Number Stride);
 
 typedef cmsUInt8Number* (* cmsFormatterFloat)(struct _cmstransform_struct* CMMcargo,
                                               cmsFloat32Number Values[],
@@ -600,11 +600,28 @@
 
 //----------------------------------------------------------------------------------------------------------
 // Full xform
-typedef void     (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo,
+
+typedef struct {
+       cmsUInt32Number BytesPerLineIn;
+       cmsUInt32Number BytesPerLineOut;
+       cmsUInt32Number BytesPerPlaneIn;
+       cmsUInt32Number BytesPerPlaneOut;
+
+} cmsStride;
+
+typedef void     (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo,   // Legacy function, handles just ONE scanline.
                                      const void* InputBuffer,
                                      void* OutputBuffer,
                                      cmsUInt32Number Size,
-                                     cmsUInt32Number Stride);
+                                     cmsUInt32Number Stride);                 // Stride in bytes to the next plana in planar formats
+
+
+typedef void     (*_cmsTransform2Fn)(struct _cmstransform_struct *CMMcargo,
+                                     const void* InputBuffer,
+                                     void* OutputBuffer,
+                                     cmsUInt32Number PixelsPerLine,
+                                     cmsUInt32Number LineCount,
+                                     const cmsStride* Stride);
 
 typedef cmsBool  (* _cmsTransformFactory)(_cmsTransformFn* xform,
                                          void** UserData,
@@ -614,6 +631,14 @@
                                          cmsUInt32Number* OutputFormat,
                                          cmsUInt32Number* dwFlags);
 
+typedef cmsBool  (* _cmsTransform2Factory)(_cmsTransform2Fn* xform,
+                                         void** UserData,
+                                         _cmsFreeUserDataFn* FreePrivateDataFn,
+                                         cmsPipeline** Lut,
+                                         cmsUInt32Number* InputFormat,
+                                         cmsUInt32Number* OutputFormat,
+                                         cmsUInt32Number* dwFlags);
+
 
 // Retrieve user data as specified by the factory
 CMSAPI void   CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn);
@@ -628,7 +653,10 @@
       cmsPluginBase     base;
 
       // Transform entry point
-      _cmsTransformFactory  Factory;
+      union {
+             _cmsTransformFactory        legacy_xform;
+             _cmsTransform2Factory       xform;
+      } factories;
 
 }  cmsPluginTransform;
 
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageAffine_NN_Bit.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageAffine_NN_Bit.c	Mon Aug 08 08:12:20 2016 -0700
@@ -84,8 +84,7 @@
         ySrc = MLIB_POINTER_SHIFT(Y);
         srcPixelPtr = MLIB_POINTER_GET(lineAddr, ySrc);
 
-        res = (res & ~(1 << bit)) | (((srcPixelPtr[X >> (MLIB_SHIFT + 3)] >> (7 - (X >> MLIB_SHIFT) & 7)) & 1) <<
-           bit);
+        res = (res & ~(1 << bit)) | (((srcPixelPtr[X >> (MLIB_SHIFT + 3)] >> (7 - ((X >> MLIB_SHIFT) & 7))) & 1) << bit);
 
         X += dX;
         Y += dY;
@@ -150,7 +149,7 @@
         ySrc = MLIB_POINTER_SHIFT(Y);
         srcPixelPtr = MLIB_POINTER_GET(lineAddr, ySrc);
 
-        res = (res & ~(1 << bit)) | (((srcPixelPtr[X >> (MLIB_SHIFT + 3)] >> (7 - (X >> MLIB_SHIFT) & 7)) & 1) << bit);
+        res = (res & ~(1 << bit)) | (((srcPixelPtr[X >> (MLIB_SHIFT + 3)] >> (7 - ((X >> MLIB_SHIFT) & 7))) & 1) << bit);
 
         X += dX;
         Y += dY;
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageConv.h	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageConv.h	Mon Aug 08 08:12:20 2016 -0700
@@ -34,11 +34,9 @@
 // Shared macro defined for cleanup of allocated memory.
 #ifndef FREE_AND_RETURN_STATUS
 #define FREE_AND_RETURN_STATUS \
-{ \
 if (pbuff != buff) mlib_free(pbuff); \
 if (k != akernel) mlib_free(k); \
-return status; \
-}
+return status
 #endif /* FREE_AND_RETURN_STATUS */
 
 mlib_status mlib_convMxNext_s32(mlib_image       *dst,
--- a/src/java.desktop/share/native/libmlib_image/mlib_c_ImageConv.h	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/libmlib_image/mlib_c_ImageConv.h	Mon Aug 08 08:12:20 2016 -0700
@@ -34,11 +34,9 @@
 // Shared macro defined for cleanup of allocated memory.
 #ifndef FREE_AND_RETURN_STATUS
 #define FREE_AND_RETURN_STATUS \
-{ \
 if (pbuff != buff) mlib_free(pbuff); \
 if (k != akernel) mlib_free(k); \
-return status; \
-}
+return status
 #endif /* FREE_AND_RETURN_STATUS */
 
 mlib_status mlib_c_convMxNnw_u8(mlib_image       *dst,
--- a/src/java.desktop/share/native/libmlib_image/mlib_c_ImageCopy.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/share/native/libmlib_image/mlib_c_ImageCopy.c	Mon Aug 08 08:12:20 2016 -0700
@@ -182,7 +182,7 @@
 #define STRIP(pd, ps, w, h, data_type) {                        \
   data_type s0, s1;                                             \
   for ( i = 0; i < h; i++ ) {                                   \
-    if (j = w & 1)                                              \
+    if ((j = (w & 1)))                                          \
       pd[i * dst_stride] = ps[i * src_stride];                  \
     for (; j < w; j += 2) {                                     \
       s0 = ps[i * src_stride + j];                              \
@@ -546,7 +546,8 @@
     mlib_u32 *psrc_row = psrc + i * src_stride, *pdst_row = pdst + i * dst_stride;
 
     if (!(((mlib_addr) psrc_row ^ (mlib_addr) pdst_row) & 7)) {
-      if (j = ((mlib_s32) ((mlib_addr) psrc_row & 4) >> 2)) {
+      j = (mlib_s32) ((mlib_addr) psrc_row & 4) >> 2;
+      if (j != 0) {
         pdst_row[0] = psrc_row[0];
       }
 
@@ -575,8 +576,10 @@
       {
         mlib_u64 *ps, src0, src1;
 
-        if (j = ((mlib_s32) ((mlib_addr) pdst_row & 4) >> 2))
+        j = (mlib_s32) ((mlib_addr) pdst_row & 4) >> 2;
+        if (j != 0) {
           pdst_row[0] = psrc_row[0];
+        }
         ps = (mlib_u64 *) (psrc_row + j - 1);
         src1 = ps[0];
 #ifdef __SUNPRO_C
--- a/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java	Mon Aug 08 08:12:20 2016 -0700
@@ -266,6 +266,12 @@
         return new Insets(i.top, i.left, i.bottom, i.right);
     }
 
+    private Insets copyAndScaleDown(Insets i) {
+        return new Insets(scaleDown(i.top), scaleDown(i.left),
+                          scaleDown(i.bottom), scaleDown(i.right));
+    }
+
+
     // insets which we get from WM (e.g from _NET_FRAME_EXTENTS)
     private Insets wm_set_insets;
 
@@ -289,7 +295,7 @@
         }
 
         if (wm_set_insets != null) {
-            wm_set_insets = copy(wm_set_insets);
+            wm_set_insets = copyAndScaleDown(wm_set_insets);
         }
         return wm_set_insets;
     }
@@ -386,6 +392,9 @@
                     }
                 } else {
                     correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
+                    if (correctWM != null) {
+                        correctWM = copyAndScaleDown(correctWM);
+                    }
 
                     if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
                         if (correctWM != null) {
@@ -470,6 +479,9 @@
                 Insets res = getWMSetInsets(null);
                 if (res == null) {
                     res = XWM.getWM().guessInsets(this);
+                    if (res != null) {
+                        res = copyAndScaleDown(res);
+                    }
                 }
                 return res;
             }
@@ -756,7 +768,7 @@
                 }
             }
             if (correctWM != null) {
-                handleCorrectInsets(correctWM);
+                handleCorrectInsets(copyAndScaleDown(correctWM));
             } else {
                 //Only one attempt to correct insets is made (to lower risk)
                 //if insets are still not available we simply set the flag
--- a/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11/XDesktopPeer.java	Mon Aug 08 08:12:20 2016 -0700
@@ -60,7 +60,7 @@
         try {
             if (!initExecuted) {
                 nativeLibraryLoaded = init(UNIXToolkit.getEnabledGtkVersion()
-                        .ordinal(), UNIXToolkit.isGtkVerbose());
+                        .getNumber(), UNIXToolkit.isGtkVerbose());
             }
         } finally {
             initExecuted = true;
--- a/src/java.desktop/unix/classes/sun/awt/X11FontManager.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/classes/sun/awt/X11FontManager.java	Mon Aug 08 08:12:20 2016 -0700
@@ -742,28 +742,20 @@
     protected FontConfiguration createFontConfiguration() {
         /* The logic here decides whether to use a preconfigured
          * fontconfig.properties file, or synthesise one using platform APIs.
-         * On Solaris (as opposed to OpenSolaris) we try to use the
+         * On Solaris we try to use the
          * pre-configured ones, but if the files it specifies are missing
          * we fail-safe to synthesising one. This might happen if Solaris
          * changes its fonts.
-         * For OpenSolaris I don't expect us to ever create fontconfig files,
-         * so it will always synthesise. Note that if we misidentify
-         * OpenSolaris as Solaris, then the test for the presence of
-         * Solaris-only font files will correct this.
          * For Linux we require an exact match of distro and version to
-         * use the preconfigured file, and also that it points to
-         * existent fonts.
+         * use the preconfigured file.
          * If synthesising fails, we fall back to any preconfigured file
          * and do the best we can. For the commercial JDK this will be
          * fine as it includes the Lucida fonts. OpenJDK should not hit
          * this as the synthesis should always work on its platforms.
          */
         FontConfiguration mFontConfig = new MFontConfiguration(this);
-        if (FontUtilities.isOpenSolaris ||
-            (FontUtilities.isLinux &&
-             (!mFontConfig.foundOsSpecificFile() ||
-              !mFontConfig.fontFilesArePresent()) ||
-             (FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent()))) {
+        if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile()) ||
+            (FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent())) {
             FcFontConfiguration fcFontConfig =
                 new FcFontConfiguration(this);
             if (fcFontConfig.init()) {
@@ -773,6 +765,7 @@
         mFontConfig.init();
         return mFontConfig;
     }
+
     public FontConfiguration
         createFontConfiguration(boolean preferLocaleFonts,
                                 boolean preferPropFonts) {
--- a/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/classes/sun/font/MFontConfiguration.java	Mon Aug 08 08:12:20 2016 -0700
@@ -88,21 +88,13 @@
         reorderMap.put("UTF-8.th", "thai");
         reorderMap.put("UTF-8.zh.TW", "chinese-big5");
         reorderMap.put("UTF-8.zh.HK", split("chinese-big5,chinese-hkscs"));
-        if (FontUtilities.isSolaris8) {
-            reorderMap.put("UTF-8.zh.CN", split("chinese-gb2312,chinese-big5"));
-        } else {
-            reorderMap.put("UTF-8.zh.CN",
-                           split("chinese-gb18030-0,chinese-gb18030-1"));
-        }
+        reorderMap.put("UTF-8.zh.CN",
+                       split("chinese-gb18030-0,chinese-gb18030-1"));
         reorderMap.put("UTF-8.zh",
                        split("chinese-big5,chinese-hkscs,chinese-gb18030-0,chinese-gb18030-1"));
         reorderMap.put("Big5", "chinese-big5");
         reorderMap.put("Big5-HKSCS", split("chinese-big5,chinese-hkscs"));
-        if (! FontUtilities.isSolaris8 && ! FontUtilities.isSolaris9) {
-            reorderMap.put("GB2312", split("chinese-gbk,chinese-gb2312"));
-        } else {
-            reorderMap.put("GB2312","chinese-gb2312");
-        }
+        reorderMap.put("GB2312", split("chinese-gbk,chinese-gb2312"));
         reorderMap.put("x-EUC-TW",
             split("chinese-cns11643-1,chinese-cns11643-2,chinese-cns11643-3"));
         reorderMap.put("GBK", "chinese-gbk");
--- a/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java	Mon Aug 08 08:12:20 2016 -0700
@@ -127,7 +127,11 @@
             vImgSurfaceType = SurfaceType.IntArgbPre;
         }
 
-        if (vImg == null || vImg.getWidth() < w || vImg.getHeight() < h) {
+        if (vImg == null || vImg.getWidth() < w || vImg.getHeight() < h ||
+            // Sometimes we get volatile image of wrong dest surface type,
+            // so recreating it
+            !(vImg.getDestSurface() instanceof XRSurfaceData))
+        {
             if (vImg != null) {
                 vImg.flush();
             }
@@ -142,6 +146,11 @@
         }
 
         Blit swToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, vImgSurfaceType);
+
+        if (!(vImg.getDestSurface() instanceof XRSurfaceData)) {
+            throw new InvalidPipeException("wrong surface data type: " + vImg.getDestSurface());
+        }
+
         XRSurfaceData vImgSurface = (XRSurfaceData) vImg.getDestSurface();
         swToSurfaceBlit.Blit(src, vImgSurface, AlphaComposite.Src, null,
                              sx, sy, 0, 0, w, h);
--- a/src/java.desktop/unix/classes/sun/print/IPPPrintService.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/classes/sun/print/IPPPrintService.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1684,7 +1684,6 @@
         }
         connection = (HttpURLConnection)urlc;
         connection.setUseCaches(false);
-        connection.setDefaultUseCaches(false);
         connection.setDoInput(true);
         connection.setDoOutput(true);
         connection.setRequestProperty("Content-type", "application/ipp");
--- a/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java	Mon Aug 08 08:12:20 2016 -0700
@@ -126,6 +126,11 @@
             mDestination = ((IPPPrintService)service).getDest();
         }
         mDestType = UnixPrintJob.DESTPRINTER;
+        JobSheets js = (JobSheets)(service.
+                                      getDefaultAttributeValue(JobSheets.class));
+        if (js != null && js.equals(JobSheets.NONE)) {
+            mNoJobSheet = true;
+        }
     }
 
     public PrintService getPrintService() {
@@ -848,10 +853,10 @@
 
     private String[] printExecCmd(String printer, String options,
                                  boolean noJobSheet,
-                                 String banner, int copies, String spoolFile) {
+                                 String jobTitle, int copies, String spoolFile) {
         int PRINTER = 0x1;
         int OPTIONS = 0x2;
-        int BANNER  = 0x4;
+        int JOBTITLE  = 0x4;
         int COPIES  = 0x8;
         int NOSHEET  = 0x10;
         int pFlags = 0;
@@ -868,8 +873,8 @@
             pFlags |= OPTIONS;
             ncomps+=1;
         }
-        if (banner != null && !banner.equals("")) {
-            pFlags |= BANNER;
+        if (jobTitle != null && !jobTitle.equals("")) {
+            pFlags |= JOBTITLE;
             ncomps+=1;
         }
         if (copies > 1) {
@@ -879,6 +884,9 @@
         if (noJobSheet) {
             pFlags |= NOSHEET;
             ncomps+=1;
+        } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+            ncomps+=1;
         }
         if (PrintServiceLookupProvider.osname.equals("SunOS")) {
             ncomps+=1; // lp uses 1 more arg than lpr (make a copy)
@@ -888,15 +896,18 @@
             if ((pFlags & PRINTER) != 0) {
                 execCmd[n++] = "-d" + printer;
             }
-            if ((pFlags & BANNER) != 0) {
+            if ((pFlags & JOBTITLE) != 0) {
                 String quoteChar = "\"";
-                execCmd[n++] = "-t "  + quoteChar+banner+quoteChar;
+                execCmd[n++] = "-t "  + quoteChar+jobTitle+quoteChar;
             }
             if ((pFlags & COPIES) != 0) {
                 execCmd[n++] = "-n " + copies;
             }
             if ((pFlags & NOSHEET) != 0) {
                 execCmd[n++] = "-o nobanner";
+            } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+                execCmd[n++] = "-o job-sheets=standard";
             }
             if ((pFlags & OPTIONS) != 0) {
                 execCmd[n++] = "-o " + options;
@@ -907,14 +918,17 @@
             if ((pFlags & PRINTER) != 0) {
                 execCmd[n++] = "-P" + printer;
             }
-            if ((pFlags & BANNER) != 0) {
-                execCmd[n++] = "-J "  + banner;
+            if ((pFlags & JOBTITLE) != 0) {
+                execCmd[n++] = "-J "  + jobTitle;
             }
             if ((pFlags & COPIES) != 0) {
                 execCmd[n++] = "-#" + copies;
             }
             if ((pFlags & NOSHEET) != 0) {
                 execCmd[n++] = "-h";
+            } else if (getPrintService().
+                        isAttributeCategorySupported(JobSheets.class)) {
+                execCmd[n++] = "-o job-sheets=standard";
             }
             if ((pFlags & OPTIONS) != 0) {
                 execCmd[n++] = "-o" + options;
--- a/src/java.desktop/unix/native/common/awt/fontpath.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/native/common/awt/fontpath.c	Mon Aug 08 08:12:20 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
@@ -805,30 +805,36 @@
     pattern = (*FcPatternBuild)(NULL, FC_OUTLINE, FcTypeBool, FcTrue, NULL);
     objset = (*FcObjectSetBuild)(FC_FILE, NULL);
     fontSet = (*FcFontList)(NULL, pattern, objset);
-    fontdirs = (char**)calloc(fontSet->nfont+1, sizeof(char*));
-    for (f=0; f < fontSet->nfont; f++) {
-        FcChar8 *file;
-        FcChar8 *dir;
-        if ((*FcPatternGetString)(fontSet->fonts[f], FC_FILE, 0, &file) ==
-                                  FcResultMatch) {
-            dir = (*FcStrDirname)(file);
-            found = 0;
-            for (i=0;i<numdirs; i++) {
-                if (strcmp(fontdirs[i], (char*)dir) == 0) {
-                    found = 1;
-                    break;
+    if (fontSet == NULL) {
+        /* FcFontList() may return NULL if fonts are not installed. */
+        fontdirs = NULL;
+    } else {
+        fontdirs = (char**)calloc(fontSet->nfont+1, sizeof(char*));
+        for (f=0; f < fontSet->nfont; f++) {
+            FcChar8 *file;
+            FcChar8 *dir;
+            if ((*FcPatternGetString)(fontSet->fonts[f], FC_FILE, 0, &file) ==
+                                      FcResultMatch) {
+                dir = (*FcStrDirname)(file);
+                found = 0;
+                for (i=0;i<numdirs; i++) {
+                    if (strcmp(fontdirs[i], (char*)dir) == 0) {
+                        found = 1;
+                        break;
+                    }
+                }
+                if (!found) {
+                    fontdirs[numdirs++] = (char*)dir;
+                } else {
+                    free((char*)dir);
                 }
             }
-            if (!found) {
-                fontdirs[numdirs++] = (char*)dir;
-            } else {
-                free((char*)dir);
-            }
         }
+        /* Free fontset if one was returned */
+        (*FcFontSetDestroy)(fontSet);
     }
 
     /* Free memory and close the ".so" */
-    (*FcFontSetDestroy)(fontSet);
     (*FcPatternDestroy)(pattern);
     closeFontConfig(libfontconfig, JNI_TRUE);
     return fontdirs;
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c	Mon Aug 08 08:12:20 2016 -0700
@@ -100,9 +100,9 @@
 
     /* check if XTest is available */
     isXTestAvailable = XQueryExtension(awt_display, XTestExtensionName, &major_opcode, &first_event, &first_error);
-    DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XTEST) returns major_opcode = %d, first_event = %d, first_error = %d",
-                    major_opcode, first_event, first_error);
     if (isXTestAvailable) {
+        DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XTEST) returns major_opcode = %d, first_event = %d, first_error = %d",
+                        major_opcode, first_event, first_error);
         /* check if XTest version is OK */
         XTestQueryExtension(awt_display, &event_basep, &error_basep, &majorp, &minorp);
         DTRACE_PRINTLN4("RobotPeer: XTestQueryExtension returns event_basep = %d, error_basep = %d, majorp = %d, minorp = %d",
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_UNIXToolkit.c	Mon Aug 08 08:12:20 2016 -0700
@@ -129,6 +129,7 @@
         return JNI_FALSE;
     }
     if (!init_method(env, this) ) {
+        free(filename_str);
         return JNI_FALSE;
     }
     (*env)->GetStringUTFRegion(env, filename, 0, len, filename_str);
--- a/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c	Mon Aug 08 08:12:20 2016 -0700
@@ -1008,9 +1008,9 @@
      * before calling XTestFakeButtonEvent().
      */
     xinputAvailable = XQueryExtension(awt_display, INAME, &major_opcode, &first_event, &first_error);
-    DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
-                    major_opcode, first_event, first_error);
     if (xinputAvailable) {
+        DTRACE_PRINTLN3("RobotPeer: XQueryExtension(XINPUT) returns major_opcode = %d, first_event = %d, first_error = %d",
+                        major_opcode, first_event, first_error);
         devices = XListInputDevices(awt_display, &numDevices);
         for (devIdx = 0; devIdx < numDevices; devIdx++) {
             aDevice = &(devices[devIdx]);
--- a/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.h	Mon Aug 08 08:12:20 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/windows/native/libawt/java2d/d3d/ShaderList.c	Mon Aug 08 08:12:20 2016 -0700
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+#include <malloc.h>
+#include <string.h>
+
+#include "ShaderList.h"
+#include "Trace.h"
+
+/**
+ * Creates a new ShaderInfo that wraps the given fragment program handle
+ * and related data and stores it at the front of the provided ShaderList.
+ * If the addition causes the ShaderList to outgrow its defined capacity,
+ * the least-recently used item in the list (including its fragment program
+ * object) will be disposed.
+ */
+void
+ShaderList_AddProgram(ShaderList *programList,
+                      jlong programID,
+                      jint compType, jint compMode, jint flags)
+{
+    ShaderInfo *info;
+
+    J2dTraceLn(J2D_TRACE_INFO, "ShaderList_AddProgram");
+
+    // create new ShaderInfo
+    info = (ShaderInfo *)malloc(sizeof(ShaderInfo));
+    if (info == NULL) {
+        J2dTraceLn(J2D_TRACE_ERROR,
+                   "D3DContext_AddProgram: could not allocate ShaderInfo");
+        return;
+    }
+
+    // fill in the information
+    info->next = programList->head;
+    info->programID = programID;
+    info->compType = compType;
+    info->compMode = compMode;
+    info->flags = flags;
+
+    // insert it at the head of the list
+    programList->head = info;
+
+    // run through the list and see if we need to delete the least
+    // recently used item
+    {
+        int i = 1;
+        ShaderInfo *prev = NULL;
+        ShaderInfo *curr = info->next;
+        while (curr != NULL) {
+            if (i >= programList->maxItems) {
+                prev->next = NULL;
+                programList->dispose(curr->programID);
+                free(curr);
+                break;
+            }
+            i++;
+            prev = curr;
+            curr = curr->next;
+        }
+    }
+}
+
+/**
+ * Locates a fragment program handle given a list of shader programs
+ * (ShaderInfos), using the provided composite state and flags as search
+ * parameters.  The "flags" parameter is a bitwise-or'd value that helps
+ * differentiate one program for another; the interpretation of this value
+ * varies depending on the type of shader (BufImgOp, Paint, etc) but here
+ * it is only used to find another ShaderInfo with that same "flags" value.
+ * If no matching program can be located, this method returns 0.
+ */
+jlong
+ShaderList_FindProgram(ShaderList *programList,
+                       jint compType, jint compMode, jint flags)
+{
+    ShaderInfo *prev = NULL;
+    ShaderInfo *info = programList->head;
+
+    J2dTraceLn(J2D_TRACE_INFO, "ShaderList_FindProgram");
+
+    while (info != NULL) {
+        if (compType == info->compType &&
+            compMode == info->compMode &&
+            flags == info->flags)
+        {
+            // it's a match: move it to the front of the list (if it's not
+            // there already) and patch up the links
+            if (info != programList->head) {
+                prev->next = info->next;
+                info->next = programList->head;
+                programList->head = info;
+            }
+            return info->programID;
+        }
+        prev = info;
+        info = info->next;
+    }
+    return 0;
+}
+
+/**
+ * Disposes all entries (and their associated shader program objects)
+ * contained in the given ShaderList.
+ */
+void
+ShaderList_Dispose(ShaderList *programList)
+{
+    ShaderInfo *info = programList->head;
+
+    J2dTraceLn(J2D_TRACE_INFO, "ShaderList_Dispose");
+
+    while (info != NULL) {
+        ShaderInfo *tmp = info->next;
+        programList->dispose(info->programID);
+        free(info);
+        info = tmp;
+    }
+
+    programList->head = NULL;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/windows/native/libawt/java2d/d3d/ShaderList.h	Mon Aug 08 08:12:20 2016 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2007, 2008, 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.
+ */
+
+#ifndef ShaderList_h_Included
+#define ShaderList_h_Included
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "jni.h"
+#include "jlong.h"
+
+typedef void (ShaderDisposeFunc)(jlong programID);
+
+/**
+ * The following structures are used to maintain a list of fragment program
+ * objects and their associated attributes.  Each logical shader (e.g.
+ * RadialGradientPaint shader, ConvolveOp shader) can have a number of
+ * different variants depending on a number of factors, such as whether
+ * antialiasing is enabled or the current composite mode.  Since the number
+ * of possible combinations of these factors is in the hundreds, we need
+ * some way to create fragment programs on an as-needed basis, and also
+ * keep them in a limited sized cache to avoid creating too many objects.
+ *
+ * The ShaderInfo structure keeps a reference to the fragment program's
+ * handle, as well as some other values that help differentiate one ShaderInfo
+ * from another.  ShaderInfos can be chained together to form a linked list.
+ *
+ * The ShaderList structure acts as a cache for ShaderInfos, placing
+ * most-recently used items at the front, and removing items from the
+ * cache when its size exceeds the "maxItems" limit.
+ */
+typedef struct _ShaderInfo ShaderInfo;
+
+typedef struct {
+    ShaderInfo        *head;
+    ShaderDisposeFunc *dispose;
+    jint              maxItems;
+} ShaderList;
+
+struct _ShaderInfo {
+    ShaderInfo  *next;
+    jlong       programID;
+    jint        compType;
+    jint        compMode;
+    jint        flags;
+};
+
+void ShaderList_AddProgram(ShaderList *programList,
+                           jlong programID,
+                           jint compType, jint compMode,
+                           jint flags);
+jlong ShaderList_FindProgram(ShaderList *programList,
+                             jint compType, jint compMode,
+                             jint flags);
+void ShaderList_Dispose(ShaderList *programList);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* ShaderList_h_Included */
--- a/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Choice.cpp	Mon Aug 08 08:12:20 2016 -0700
@@ -345,7 +345,7 @@
      * drop down item height.
      */
     env->SetIntField(dimension, AwtDimension::heightID,
-                       GetFontHeight(env));
+                       ScaleUpY(GetFontHeight(env)));
     return dimension;
 }
 
--- a/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Mon Aug 08 08:12:20 2016 -0700
@@ -3852,10 +3852,12 @@
     if (!m_useNativeCompWindow) {
         if (subMsg == IMN_OPENCANDIDATE) {
             m_bitsCandType = subMsg;
-        } else if (subMsg != IMN_SETCANDIDATEPOS) {
+            InquireCandidatePosition();
+        } else if (subMsg == IMN_OPENSTATUSWINDOW ||
+                   subMsg == WM_IME_STARTCOMPOSITION) {
             m_bitsCandType = 0;
+            InquireCandidatePosition();
         }
-        InquireCandidatePosition();
         return mrConsume;
     }
     return mrDoDefault;
--- a/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Font.cpp	Mon Aug 08 08:12:20 2016 -0700
@@ -1685,6 +1685,8 @@
 
 CSegTableManager g_segTableManager;
 
+#define KEYLEN 16
+
 class CCombinedSegTable : public CSegTableComponent
 {
 public:
@@ -1695,7 +1697,7 @@
 private:
     LPSTR GetCodePageSubkey();
     void GetEUDCFileName(LPWSTR lpszFileName, int cchFileName);
-    static char m_szCodePageSubkey[16];
+    static char m_szCodePageSubkey[KEYLEN];
     static WCHAR m_szDefaultEUDCFile[_MAX_PATH];
     static BOOL m_fEUDCSubKeyExist;
     static BOOL m_fTTEUDCFileExist;
@@ -1703,7 +1705,7 @@
     CEUDCSegTable* m_pEUDCSegTable;
 };
 
-char CCombinedSegTable::m_szCodePageSubkey[16] = "";
+char CCombinedSegTable::m_szCodePageSubkey[KEYLEN] = "";
 
 WCHAR CCombinedSegTable::m_szDefaultEUDCFile[_MAX_PATH] = L"";
 
@@ -1735,8 +1737,11 @@
     }
     lpszCP++; // cf lpszCP = "932"
 
-    char szSubKey[80];
+    char szSubKey[KEYLEN];
     strcpy(szSubKey, "EUDC\\");
+    if ((strlen(szSubKey) + strlen(lpszCP)) >= KEYLEN) {
+        return NULL;
+    }
     strcpy(&(szSubKey[strlen(szSubKey)]), lpszCP);
     strcpy(m_szCodePageSubkey, szSubKey);
     return m_szCodePageSubkey;
--- a/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Mon Aug 08 08:12:20 2016 -0700
@@ -1374,7 +1374,6 @@
             } else { // zoom == iconify == FALSE
                 wp.showCmd = focusable ? SW_RESTORE : SW_SHOWNOACTIVATE;
             }
-            ::ShowWindow(hwnd, wp.showCmd);
             if (zoom && iconify) {
                 wp.flags |= WPF_RESTORETOMAXIMIZED;
             } else {
--- a/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Robot.cpp	Mon Aug 08 08:12:20 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -335,7 +335,17 @@
     } else {
         // get the scancode from the virtual key
         scancode = ::MapVirtualKey(vkey, 0);
-        if (vkey == VK_RMENU) {
+        if (vkey == VK_RMENU ||
+            vkey == VK_DELETE ||
+            vkey == VK_INSERT ||
+            vkey == VK_NEXT ||
+            vkey == VK_PRIOR ||
+            vkey == VK_HOME ||
+            vkey == VK_END ||
+            vkey == VK_LEFT ||
+            vkey == VK_RIGHT ||
+            vkey == VK_UP ||
+            vkey == VK_DOWN) {
             dwFlags |= KEYEVENTF_EXTENDEDKEY;
         }
         keybd_event(vkey, scancode, dwFlags, 0);
--- a/src/java.httpclient/share/classes/java/net/http/AuthenticationFilter.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/java.httpclient/share/classes/java/net/http/AuthenticationFilter.java	Mon Aug 08 08:12:20 2016 -0700
@@ -189,7 +189,7 @@
         }
 
         boolean proxy = status == PROXY_UNAUTHORIZED;
-        String authname = proxy ? "Proxy-Authentication" : "WWW-Authenticate";
+        String authname = proxy ? "Proxy-Authenticate" : "WWW-Authenticate";
         String authval = hdrs.firstValue(authname).orElseThrow(() -> {
             return new IOException("Invalid auth header");
         });
--- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java	Mon Aug 08 08:12:20 2016 -0700
@@ -70,7 +70,6 @@
  * @author Roland Schemers
  * @author Jan Luehe
  */
-@SuppressWarnings("deprecation")
 public class Main {
 
     // for i18n
@@ -98,7 +97,6 @@
     static final String VERSION = "1.0";
 
     static final int IN_KEYSTORE = 0x01;        // signer is in keystore
-    static final int IN_SCOPE = 0x02;
     static final int NOT_ALIAS = 0x04;          // alias list is NOT empty and
                                                 // signer is not in alias list
     static final int SIGNED_BY_ALIAS = 0x08;    // signer is in alias list
@@ -676,14 +674,13 @@
                     hasUnsignedEntry |= !je.isDirectory() && !isSigned
                                         && !signatureRelated(name);
 
-                    int inStoreOrScope = inKeyStore(signers);
+                    int inStoreWithAlias = inKeyStore(signers);
 
-                    boolean inStore = (inStoreOrScope & IN_KEYSTORE) != 0;
-                    boolean inScope = (inStoreOrScope & IN_SCOPE) != 0;
+                    boolean inStore = (inStoreWithAlias & IN_KEYSTORE) != 0;
 
-                    notSignedByAlias |= (inStoreOrScope & NOT_ALIAS) != 0;
+                    notSignedByAlias |= (inStoreWithAlias & NOT_ALIAS) != 0;
                     if (keystore != null) {
-                        aliasNotInStore |= isSigned && (!inStore && !inScope);
+                        aliasNotInStore |= isSigned && !inStore;
                     }
 
                     // Only used when -verbose provided
@@ -697,8 +694,7 @@
                         sb.append(isSigned ? rb.getString("s") : rb.getString("SPACE"))
                                 .append(inManifest ? rb.getString("m") : rb.getString("SPACE"))
                                 .append(inStore ? rb.getString("k") : rb.getString("SPACE"))
-                                .append(inScope ? rb.getString("i") : rb.getString("SPACE"))
-                                .append((inStoreOrScope & NOT_ALIAS) != 0 ? 'X' : ' ')
+                                .append((inStoreWithAlias & NOT_ALIAS) != 0 ? 'X' : ' ')
                                 .append(rb.getString("SPACE"));
                         sb.append('|');
                     }
@@ -800,8 +796,6 @@
                     ".m.entry.is.listed.in.manifest"));
                 System.out.println(rb.getString(
                     ".k.at.least.one.certificate.was.found.in.keystore"));
-                System.out.println(rb.getString(
-                    ".i.at.least.one.certificate.was.found.in.identity.scope"));
                 if (ckaliases.size() > 0) {
                     System.out.println(rb.getString(
                         ".X.not.signed.by.specified.alias.es."));
@@ -1076,8 +1070,6 @@
             if (alias != null) {
                 if (alias.startsWith("(")) {
                     result |= IN_KEYSTORE;
-                } else if (alias.startsWith("[")) {
-                    result |= IN_SCOPE;
                 }
                 if (ckaliases.contains(alias.substring(1, alias.length() - 1))) {
                     result |= SIGNED_BY_ALIAS;
--- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources.java	Mon Aug 08 08:12:20 2016 -0700
@@ -130,7 +130,6 @@
         {"s", "s"},
         {"m", "m"},
         {"k", "k"},
-        {"i", "i"},
         {".and.d.more.", "(and %d more)"},
         {".s.signature.was.verified.",
                 "  s = signature was verified "},
@@ -138,8 +137,6 @@
                 "  m = entry is listed in manifest"},
         {".k.at.least.one.certificate.was.found.in.keystore",
                 "  k = at least one certificate was found in keystore"},
-        {".i.at.least.one.certificate.was.found.in.identity.scope",
-                "  i = at least one certificate was found in identity scope"},
         {".X.not.signed.by.specified.alias.es.",
                 "  X = not signed by specified alias(es)"},
         {"no.manifest.", "no manifest."},
--- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java	Mon Aug 08 08:12:20 2016 -0700
@@ -123,7 +123,6 @@
         {"s", "s"},
         {"m", "m"},
         {"k", "k"},
-        {"i", "i"},
         {".and.d.more.", "(\u4ED6\u306B\u3082%d\u500B)"},
         {".s.signature.was.verified.",
                 "  s=\u7F72\u540D\u304C\u691C\u8A3C\u3055\u308C\u307E\u3057\u305F "},
@@ -131,8 +130,6 @@
                 "  m=\u30A8\u30F3\u30C8\u30EA\u304C\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u5185\u306B\u30EA\u30B9\u30C8\u3055\u308C\u307E\u3059"},
         {".k.at.least.one.certificate.was.found.in.keystore",
                 "  k=1\u3064\u4EE5\u4E0A\u306E\u8A3C\u660E\u66F8\u304C\u30AD\u30FC\u30B9\u30C8\u30A2\u3067\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
-        {".i.at.least.one.certificate.was.found.in.identity.scope",
-                "  i=1\u3064\u4EE5\u4E0A\u306E\u8A3C\u660E\u66F8\u304C\u30A2\u30A4\u30C7\u30F3\u30C6\u30A3\u30C6\u30A3\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"},
         {".X.not.signed.by.specified.alias.es.",
                 "  X =\u6307\u5B9A\u3057\u305F\u5225\u540D\u3067\u7F72\u540D\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},
         {"no.manifest.", "\u30DE\u30CB\u30D5\u30A7\u30B9\u30C8\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002"},
--- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java	Mon Aug 08 08:12:20 2016 -0700
@@ -123,7 +123,6 @@
         {"s", "s"},
         {"m", "m"},
         {"k", "k"},
-        {"i", "i"},
         {".and.d.more.", "(%d \u53CA\u4EE5\u4E0A)"},
         {".s.signature.was.verified.",
                 "  s = \u5DF2\u9A8C\u8BC1\u7B7E\u540D "},
@@ -131,8 +130,6 @@
                 "  m = \u5728\u6E05\u5355\u4E2D\u5217\u51FA\u6761\u76EE"},
         {".k.at.least.one.certificate.was.found.in.keystore",
                 "  k = \u5728\u5BC6\u94A5\u5E93\u4E2D\u81F3\u5C11\u627E\u5230\u4E86\u4E00\u4E2A\u8BC1\u4E66"},
-        {".i.at.least.one.certificate.was.found.in.identity.scope",
-                "  i = \u5728\u8EAB\u4EFD\u4F5C\u7528\u57DF\u5185\u81F3\u5C11\u627E\u5230\u4E86\u4E00\u4E2A\u8BC1\u4E66"},
         {".X.not.signed.by.specified.alias.es.",
                 "  X = \u672A\u7531\u6307\u5B9A\u522B\u540D\u7B7E\u540D"},
         {"no.manifest.", "\u6CA1\u6709\u6E05\u5355\u3002"},
--- a/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java	Mon Aug 08 08:12:20 2016 -0700
@@ -149,7 +149,13 @@
      * {@code null} if we are not connected to a browser.
      * @throws JSException when an error is reported from the browser or
      * JavaScript engine or if applet is {@code null}
+     *
+     * @deprecated  The Applet API is deprecated. See the
+     * <a href="../../../../../../api/java/applet/package-summary.html">
+     * java.applet package documentation</a> for further information.
      */
+
+    @Deprecated(since = "9")
     public static JSObject getWindow(Applet applet) throws JSException {
         return ProviderLoader.callGetWindow(applet);
     }
--- a/test/ProblemList.txt	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/ProblemList.txt	Mon Aug 08 08:12:20 2016 -0700
@@ -297,9 +297,6 @@
 ############################################################################
 
 # jdk_imageio
-javax/imageio/plugins/shared/CanWriteSequence.java              8148454 generic-all
-javax/imageio/plugins/tiff/MultiPageTest/MultiPageTest.java     8148454 generic-all
-javax/imageio/plugins/tiff/WriteToSequenceAfterAbort.java       8148454 generic-all
 
 ############################################################################
 
--- a/test/com/sun/java/accessibility/util/8051626/Bug8051626.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/com/sun/java/accessibility/util/8051626/Bug8051626.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8051626
  * @summary Ensure no failure when using Java Accessibility Utility with security manager
  * @modules java.desktop jdk.accessibility
--- a/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java	Mon Aug 08 08:12:20 2016 -0700
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8016551
  * @summary JMenuItem in WindowsLookAndFeel can't paint default icons
  * @author Leonid Romanov
--- a/test/java/awt/Checkbox/SetStateExcessEvent/SetStateExcessEvent.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Checkbox/SetStateExcessEvent/SetStateExcessEvent.java	Mon Aug 08 08:12:20 2016 -0700
@@ -29,6 +29,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8074500
  * @summary Checkbox.setState() call should not post ItemEvent
  * @author Sergey Bylokhov
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Choice/ChoiceHiDpi/ChoiceTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8144594
+ * @summary HiDPI: awt.Choice looks improperly (Win 8)
+ * @run main ChoiceTest
+ */
+import java.awt.Frame;
+import java.awt.Choice;
+import java.awt.Font;
+import java.util.stream.Stream;
+
+public class ChoiceTest {
+
+    private static void UI() {
+        Frame frame = new Frame("Test frame");
+        Choice choice = new Choice();
+
+        Stream.of(new String[]{"item 1", "item 2", "item 3"}).forEach(choice::add);
+        frame.add(choice);
+        frame.setBounds(100, 100, 400, 200);
+
+        frame.setVisible(true);
+        Font font = choice.getFont();
+        int size = font.getSize();
+        int height = choice.getBounds().height;
+        try {
+            if (height < size) {
+                throw new RuntimeException("Test failed");
+            }
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        ChoiceTest.UI();
+    }
+}
+
--- a/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,13 +22,14 @@
  */
 
 /*
- @test
-  @bug 7159566
-  @summary The choice positioned in the top of applet when clicking the choice.
-  @author Petr Pchelko
-  @library ../../regtesthelpers
-  @build Util
-  @run main ChoiceLocationTest
+ * @test
+ * @key headful
+ * @bug 7159566
+ * @summary The choice positioned in the top of applet when clicking the choice.
+ * @author Petr Pchelko
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main ChoiceLocationTest
  */
 
 import java.awt.*;
--- a/test/java/awt/Choice/DragMouseOutAndRelease/DragMouseOutAndRelease.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Choice/DragMouseOutAndRelease/DragMouseOutAndRelease.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 6322625
   @summary REG:Choice does not trigger MouseReleased when dragging and releasing the mouse outside choice, XAWT
   @author andrei.dmitriev area=awt.choice
--- a/test/java/awt/Choice/GetSizeTest/GetSizeTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Choice/GetSizeTest/GetSizeTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 4255631
   @summary Solaris: Size returned by Choice.getSize() does not match actual size
   @author Andrei Dmitriev : area=Choice
--- a/test/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Choice/ResizeAutoClosesChoice/ResizeAutoClosesChoice.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 6399679
   @summary Choice is not invalidated when the frame gets resized programmatically when the drop-down is visible
   @author andrei.dmitriev area=awt.choice
--- a/test/java/awt/Choice/UnfocusableCB_ERR/UnfocusableCB_ERR.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Choice/UnfocusableCB_ERR/UnfocusableCB_ERR.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 6390103
   @summary Non-Focusable choice throws exception when selecting an item, Win32
   @author andrei.dmitriev area=awt.choice
--- a/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Choice/UnfocusableToplevel/UnfocusableToplevel.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6566434 8039467
   @library ../../regtesthelpers
   @build Util Sysout AbstractTest
--- a/test/java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Component/DimensionEncapsulation/DimensionEncapsulation.java	Mon Aug 08 08:12:20 2016 -0700
@@ -90,6 +90,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 6459798
  * @author Sergey Bylokhov
  */
--- a/test/java/awt/Component/GetScreenLocTest/GetScreenLocTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Component/GetScreenLocTest/GetScreenLocTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -38,6 +38,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 4356202
  * @summary Tests that getLocationOnScreen returns valid value(WindowMaker
  *          only).
--- a/test/java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Component/InsetsEncapsulation/InsetsEncapsulation.java	Mon Aug 08 08:12:20 2016 -0700
@@ -74,6 +74,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 6459800
  * @author Sergey Bylokhov
  */
--- a/test/java/awt/Component/PaintAll/PaintAll.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Component/PaintAll/PaintAll.java	Mon Aug 08 08:12:20 2016 -0700
@@ -43,6 +43,7 @@
 
 /*
   @test
+  @key headful
   @bug 6596915
   @summary Test Component.paintAll() method
   @author sergey.bylokhov@oracle.com: area=awt.component
--- a/test/java/awt/Component/Revalidate/Revalidate.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Component/Revalidate/Revalidate.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 7036669
   @summary Test Component.revalidate() method
   @author anthony.petrov@oracle.com: area=awt.component
--- a/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java	Mon Aug 08 08:12:20 2016 -0700
@@ -31,6 +31,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8071306
  * @author Sergey Bylokhov
  */
--- a/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Container/CheckZOrderChange/CheckZOrderChange.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,12 +22,14 @@
  */
 
 /*
-   @test %I% %E%
-   @bug 2161766
-   @summary Component is missing after changing the z-order of the component & focus is not transfered in
-   @author  Andrei Dmitriev : area=awt.container
-   @run main CheckZOrderChange
-*/
+ * @test %I% %E%
+ * @key headful
+ * @bug 2161766
+ * @summary Component is missing after changing the z-order of the component & focus is not transfered in
+ * @author  Andrei Dmitriev : area=awt.container
+ * @run main CheckZOrderChange
+ */
+
 import java.awt.*;
 import java.awt.event.*;
 
--- a/test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6852592
   @summary invalidate() must stop when it encounters a validate root
   @author anthony.petrov@sun.com
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Desktop/DesktopGtkLoadTest/DesktopGtkLoadTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -0,0 +1,66 @@
+/*
+ * 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 8157827
+ * @summary AWT_Desktop/Automated/Exceptions/BasicTest loads incorrect GTK
+ * version when jdk.gtk.version=3
+ * @requires (os.family == "linux")
+ * @run main DesktopGtkLoadTest
+ */
+
+
+import java.awt.*;
+import java.io.*;
+
+public class DesktopGtkLoadTest {
+    public static class RunDesktop {
+        public static void main(String[] args) {
+            Desktop.getDesktop();
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        Process p = Runtime.getRuntime().exec(System.getProperty("java.home") +
+                "/bin/java -Djdk.gtk.version=3 -Djdk.gtk.verbose=true " +
+                "-cp " + System.getProperty("java.class.path", ".") +
+                " DesktopGtkLoadTest$RunDesktop");
+        p.waitFor();
+        try (BufferedReader br = new BufferedReader(
+                                   new InputStreamReader(p.getErrorStream()))) {
+            String line;
+            while ((line = br.readLine()) != null) {
+                System.out.println(line);
+                if (line.contains("Looking for GTK2 library")) {
+                    break;
+                }
+                if (line.contains("Looking for GTK3 library")) {
+                    return;
+                }
+            }
+            throw new RuntimeException("Wrong GTK library version: \n" + line);
+        }
+
+    }
+
+}
--- a/test/java/awt/Dialog/ChildProperties/ChildDialogProperties.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Dialog/ChildProperties/ChildDialogProperties.java	Mon Aug 08 08:12:20 2016 -0700
@@ -21,12 +21,14 @@
  * questions.
  */
 
- /*
- @test
- @bug 8057574
- @summary Verify that child Dialog does not inherit parent's Properties
- @run main ChildDialogProperties
+/*
+ * @test
+ * @key headful
+ * @bug 8057574
+ * @summary Verify that child Dialog does not inherit parent's Properties
+ * @run main ChildDialogProperties
  */
+
 import java.awt.Color;
 import java.awt.Dialog;
 import java.awt.Font;
--- a/test/java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6829546
   @summary tests that an always-on-top modal dialog doesn't make any windows always-on-top
   @author artem.ananiev: area=awt.modal
--- a/test/java/awt/Dialog/ValidateOnShow/ValidateOnShow.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Dialog/ValidateOnShow/ValidateOnShow.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 7027013
   @summary Dialog.show() should validate the window unconditionally
   @author anthony.petrov@oracle.com: area=awt.toplevel
--- a/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/EventDispatchThread/LoopRobustness/LoopRobustness.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,7 +24,8 @@
 /**
  *
  * @bug 4023283
- * @summary Checks that an Error which propogate up to the EventDispatch
+ * @key headful
+ * @summary Checks that an Error which propogates up to the EventDispatch
  * loop does not crash AWT.
  * @author Andrei Dmitriev: area=awt.event
  * @library ../../regtesthelpers
--- a/test/java/awt/Focus/6981400/Test1.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/6981400/Test1.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug     6981400
  * @summary Tabbing between textfiled do not work properly when ALT+TAB
  * @author  anton.tarasov
--- a/test/java/awt/Focus/6981400/Test2.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/6981400/Test2.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug     6981400
  * @summary Tabbing between textfiled do not work properly when ALT+TAB
  * @author  anton.tarasov
--- a/test/java/awt/Focus/6981400/Test3.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/6981400/Test3.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug     6981400
  * @summary Tabbing between textfiled do not work properly when ALT+TAB
  * @author  anton.tarasov
--- a/test/java/awt/Focus/8013611/JDK8013611.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/8013611/JDK8013611.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug      8013611
   @summary  Tests showing a modal dialog with requesting focus in frame.
   @author   Anton.Tarasov: area=awt.focus
--- a/test/java/awt/Focus/8073453/AWTFocusTransitionTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/8073453/AWTFocusTransitionTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8073453
  * @summary Focus doesn't move when pressing Shift + Tab keys
  * @author Dmitry Markov
--- a/test/java/awt/Focus/8073453/SwingFocusTransitionTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/8073453/SwingFocusTransitionTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -21,7 +21,9 @@
  * questions.
  */
 
-/* @test
+/*
+ * @test
+ * @key headful
  * @bug 8073453
  * @summary Focus doesn't move when pressing Shift + Tab keys
  * @author Dmitry Markov
--- a/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug      4823903
   @summary  Tests actual focused window retaining.
   @author   Anton.Tarasov: area=awt.focus
--- a/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug       6187066
   @summary   Tests the Window.autoRequestFocus property for the Window.setVisible() method.
   @author    anton.tarasov: area=awt.focus
--- a/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusToFrontTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusToFrontTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug       6187066
   @summary   Tests the Window.autoRequestFocus property for the Window.toFront() method.
   @author    anton.tarasov: area=awt.focus
--- a/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 4390555
   @summary Synopsis: clearGlobalFocusOwner() is not trigerring permanent FOCUS_LOST event
   @author son@sparc.spb.su, anton.tarasov: area=awt.focus
--- a/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/KeyEventForBadFocusOwnerTest/KeyEventForBadFocusOwnerTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug 4476629
   @library ../../../../javax/swing/regtesthelpers
   @build Util
--- a/test/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -42,6 +42,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 5028014
  * @summary Focus request & mouse click being performed nearly synchronously
  *          shouldn't break the focus subsystem
--- a/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6411406
   @summary Components automatically transfer focus on removal, even if developer requests focus elsewhere first
   @author oleg.sukhodolsky, anton.tarasov: area=awt.focus
--- a/test/java/awt/Focus/RollbackFocusFromAnotherWindowTest/RollbackFocusFromAnotherWindowTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/RollbackFocusFromAnotherWindowTest/RollbackFocusFromAnotherWindowTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug       8139218
   @summary   Dialog that opens and closes quickly changes focus in original
              focusowner
--- a/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/SimpleWindowActivationTest/SimpleWindowActivationTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug       6385277
  * @summary   Tests that override redirect window gets activated on click.
  * @author    anton.tarasov@sun.com: area=awt.focus
--- a/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6562853 7035459
   @summary Tests that focus transfered directy to window w/o transfering it to frame.
   @author Oleg Sukhodolsky: area=awt.focus
--- a/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,14 +22,15 @@
  */
 
 /*
-   @test
-   @bug        6183877 6216005 6225560
-   @library    ../../regtesthelpers
-   @build      Util
-   @summary    Tests that keyboard input doesn't freeze due to type-ahead problems
-   @author     Denis.Mikhalkin, Anton.Tarasov: area=awt.focus
-   @run        main TestFocusFreeze
-*/
+ * @test
+ * @key headful
+ * @bug        6183877 6216005 6225560
+ * @library    ../../regtesthelpers
+ * @build      Util
+ * @summary    Tests that keyboard input doesn't freeze due to type-ahead problems
+ * @author     Denis.Mikhalkin, Anton.Tarasov: area=awt.focus
+ * @run        main TestFocusFreeze
+ */
 
 import java.awt.Component;
 import java.awt.DefaultKeyboardFocusManager;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Frame/8158918/SetExtendedState.java	Mon Aug 08 08:12:20 2016 -0700
@@ -0,0 +1,48 @@
+/*
+ * 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 8158918
+ * @summary setExtendedState(1) for maximized Frame results in state==7
+ * @run main SetExtendedState
+ */
+import java.awt.Frame;
+
+public class SetExtendedState {
+
+    public static void main(String[] args) {
+        Frame frame = new Frame("frame");
+        frame.setBounds(100, 100, 200, 200);
+        frame.setVisible(true);
+        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
+        frame.setExtendedState(Frame.ICONIFIED);
+        if (frame.getExtendedState() != Frame.ICONIFIED) {
+            frame.dispose();
+            throw new RuntimeException("Test Failed");
+        }
+        frame.dispose();
+    }
+}
+
+
--- a/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Frame/DecoratedExceptions/DecoratedExceptions.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary An attempt to set non-trivial background, shape, or translucency
  *          to a decorated toplevel should end with an exception.
  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
--- a/test/java/awt/Frame/DisposeParentGC/DisposeParentGC.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Frame/DisposeParentGC/DisposeParentGC.java	Mon Aug 08 08:12:20 2016 -0700
@@ -30,6 +30,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Display a dialog with a parent, the dialog contains all awt components
  *          added to it & each components are setted with different cursors types.
  *          Dispose the parent & collect GC. Garbage collection should happen
--- a/test/java/awt/Frame/FramesGC/FramesGC.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Frame/FramesGC/FramesGC.java	Mon Aug 08 08:12:20 2016 -0700
@@ -30,6 +30,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Verify that disposed frames are collected with GC
  * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
  * @library ../../../../lib/testlibrary
--- a/test/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,14 +22,15 @@
  */
 
 /*
-* @test
-* @summary To check proper WINDOW_EVENTS are triggered when Frame gains or losses the focus
-* @author Jitender(jitender.singh@eng.sun.com) area=AWT
-* @author yan
-* @library ../../../../lib/testlibrary
-* @build ExtendedRobot
-* @run main ActiveAWTWindowTest
-*/
+ * @test
+ * @key headful
+ * @summary To check proper WINDOW_EVENTS are triggered when Frame gains or losses the focus
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @author yan
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main ActiveAWTWindowTest
+ */
 
 import java.awt.*;
 import java.awt.event.*;
--- a/test/java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,14 +22,15 @@
  */
 
 /*
-* @test
-* @summary To check proper WINDOW_EVENTS are triggered when JFrame gains or losses the focus
-* @author Jitender(jitender.singh@eng.sun.com) area=AWT
-* @author yan
-* @library ../../../../lib/testlibrary
-* @build ExtendedRobot
-* @run main ActiveSwingWindowTest
-*/
+ * @test
+ * @key headful
+ * @summary To check proper WINDOW_EVENTS are triggered when JFrame gains or losses the focus
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @author yan
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main ActiveSwingWindowTest
+ */
 
 import java.awt.*;
 import java.awt.event.*;
--- a/test/java/awt/Frame/MiscUndecorated/FrameCloseTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Frame/MiscUndecorated/FrameCloseTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,14 +22,15 @@
  */
 
 /*
-* @test
-* @summary To make sure Undecorated Frame triggers correct windows events while closing
-* @author Jitender(jitender.singh@eng.sun.com) area=AWT*
-* @author yan
-* @library ../../../../lib/testlibrary
-* @build ExtendedRobot
-* @run main FrameCloseTest
-*/
+ * @test
+ * @key headful
+ * @summary To make sure Undecorated Frame triggers correct windows events while closing
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT*
+ * @author yan
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main FrameCloseTest
+ */
 
 import java.awt.*;
 import java.awt.event.*;
--- a/test/java/awt/Frame/MiscUndecorated/RepaintTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Frame/MiscUndecorated/RepaintTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -20,16 +20,18 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 /*
-* @test
-* @summary Make sure that on changing state of Undecorated Frame,
-*          all the components on it are repainted correctly
-* @author Jitender(jitender.singh@eng.sun.com) area=AWT
-* @author yan
-* @library ../../../../lib/testlibrary
-* @build ExtendedRobot
-* @run main RepaintTest
-*/
+ * @test
+ * @key headful
+ * @summary Make sure that on changing state of Undecorated Frame,
+ *          all the components on it are repainted correctly
+ * @author Jitender(jitender.singh@eng.sun.com) area=AWT
+ * @author yan
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main RepaintTest
+ */
 
 import java.awt.*;
 import java.awt.event.*;
--- a/test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Frame/ShapeNotSetSometimes/ShapeNotSetSometimes.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
   @test
+  @key headful
   @bug 6988428
   @summary Tests whether shape is always set
   @author anthony.petrov@oracle.com: area=awt.toplevel
--- a/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6837004
  * @summary Checks that non-opaque window can be made a fullscreen window
  * @author Artem Ananiev
--- a/test/java/awt/Graphics2D/WhiteTextColorTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Graphics2D/WhiteTextColorTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -27,11 +27,13 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8056009
  * @summary tests whether Graphics.setColor-calls with Color.white are ignored directly
  *          after pipeline initialization for a certain set of operations.
  * @author ceisserer
  */
+
 public class WhiteTextColorTest extends Frame {
     public static volatile boolean success = false;
 
--- a/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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,6 +26,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Have different components having different preferred sizes
  *          added to a grid layout. Change the rows and columns of the
  *          grid layout and check the components are re-laid out.
@@ -33,14 +34,13 @@
  *          depending on the preferred sizes and gaps and click the cornors
  *          of the components to check if events are triggered
  * @library ../../../../lib/testlibrary/
- * @build ExtendedRobot
  * @run main ChangeGridSize
  * @run main ChangeGridSize -hg 20 -vg 20
  */
 
 public class ChangeGridSize {
 
-    private int width = 200;
+    private int width = 300;
     private int height = 200;
     private final int hGap, vGap;
     private final int rows = 3;
@@ -50,7 +50,7 @@
     private Button[] buttons;
     private Frame frame;
 
-    private ExtendedRobot robot;
+    private Robot robot;
     private GridLayout layout;
 
     private volatile boolean actionPerformed = false;
@@ -58,7 +58,7 @@
     public ChangeGridSize(int hGap, int vGap) throws Exception  {
         this.hGap = hGap;
         this.vGap = vGap;
-        robot = new ExtendedRobot();
+        robot = new Robot();
         EventQueue.invokeAndWait( () -> {
             frame = new Frame("Test frame");
             frame.setSize(width, height);
@@ -122,10 +122,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the left top of button did not trigger action event");
+        }
 
         actionPerformed = false;
         robot.mouseMove(bottomRightX, bottomRightY);
@@ -133,10 +135,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the bottom right of button did not trigger action event");
+        }
     }
 
     private void doTest() throws Exception {
@@ -154,6 +158,7 @@
         for (int i = 0; i < buttons.length; i++) {
             if (buttons[i].getSize().width != componentWidth ||
                     buttons[i].getSize().height != componentHeight) {
+                frame.dispose();
                 throw new RuntimeException(
                         "FAIL: Button " + i + " not of proper size" +
                         "Expected: " + componentWidth + "*" + componentHeight +
--- a/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java	Mon Aug 08 08:12:20 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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,6 +26,7 @@
 
 /*
  * @test
+ * @key headful
  * @summary Have different components having different preferred sizes
  *          added to a grid layout having various values of row/columns.
  *          Check if the compnents are correctly laid out.
@@ -33,14 +34,13 @@
  *          depending on the preferred sizes and gaps and click the cornors
  *          of the components to check if events are triggered
  * @library ../../../../lib/testlibrary/
- * @build ExtendedRobot
  * @run main ComponentPreferredSize
  * @run main ComponentPreferredSize -hg 20 -vg 20
  */
 
 public class ComponentPreferredSize {
 
-    private int width = 200;
+    private int width = 300;
     private int height = 200;
     private final int hGap, vGap;
     private final int rows = 3;
@@ -50,7 +50,7 @@
     private Button[] buttons;
     private Frame frame;
 
-    private ExtendedRobot robot;
+    private Robot robot;
     private GridLayout layout;
 
     private volatile boolean actionPerformed = false;
@@ -58,7 +58,7 @@
     public ComponentPreferredSize(int hGap, int vGap) throws Exception {
         this.hGap = hGap;
         this.vGap = vGap;
-        robot = new ExtendedRobot();
+        robot = new Robot();
         EventQueue.invokeAndWait( () -> {
             frame = new Frame("Test frame");
             frame.setSize(width, height);
@@ -115,10 +115,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the left top of button did not trigger action event");
+        }
 
         actionPerformed = false;
         robot.mouseMove(bottomRightX, bottomRightY);
@@ -126,10 +128,12 @@
         robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
         robot.delay(500);
         robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
-        robot.waitForIdle(3000);
+        robot.delay(3000);
 
-        if(!actionPerformed)
+        if (!actionPerformed) {
+            frame.dispose();
             throw new RuntimeException("Clicking on the bottom right of button did not trigger action event");
+        }
     }
 
     private void doTest() throws Exception {
@@ -146,6 +150,7 @@
         for (int i = 0; i < buttons.length; i++) {
             if (buttons[i].getSize().width != componentWidth ||
                     buttons[i].getSize().height != componentHeight) {
+                frame.dispose();
                 throw new RuntimeException(
                         "FAIL: Button " + i + " not of proper size" +
                         "Expected: " + componentWidth + "*" + componentHeight +
--- a/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/LightweightComponent/LightweightEventTest/LightweightEventTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @summary Test of mouse move messages to lightweight components
  * @library ../../regtesthelpers
  * @build Util
--- a/test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/LightweightDispatcher/LWDispatcherMemoryLeakTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -38,6 +38,7 @@
 
 /*
  @test
+ @key headful
  @bug 7079254
  @summary Toolkit eventListener leaks memory
  @library ../regtesthelpers
--- a/test/java/awt/List/EmptyListEventTest/EmptyListEventTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/List/EmptyListEventTest/EmptyListEventTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 6366126
  * @summary List throws ArrayIndexOutOfBoundsException when pressing ENTER after removing all the items, Win32
  * @author Dmitry Cherepanov area=awt.list
--- a/test/java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/List/NofocusListDblClickTest/NofocusListDblClickTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -22,6 +22,7 @@
  */
 /*
   @test
+  @key headful
   @bug       6240202
   @summary   Tests that non-focusable List in a Window generates ActionEvent.
   @author    anton.tarasov@sun.com: area=awt-list
--- a/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Mon Aug 08 08:12:20 2016 -0700
@@ -37,6 +37,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 6263470
  * @summary Tries to change font of MenuBar. Test passes if the font has changed
  * fails otherwise.
--- a/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogAppModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogAppModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogAppModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogAppModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogAppModal5Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogAppModal6Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks an application modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogDocModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogDocModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogDocModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogDocModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogDocModal5Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogDocModal6Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a document modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogDocModal7Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  * @summary Check whether a FileDialog set to document modality behaves as expected.
  *
--- a/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogModal5Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogModal6Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogNonModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogNonModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogNonModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogNonModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogNonModal5Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogNonModal6Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  *
  * @summary Check whether FileDialog blocks a non-modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogNonModal7Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359
  * @summary Check whether a modeless FileDialog behaves as expected.
  *
--- a/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogTKModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogTKModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogTKModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogTKModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogTKModal5Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogTKModal6Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 8055752
  *
  * @summary Check whether FileDialog blocks a toolkit modal Dialog
--- a/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/FileDialog/FileDialogTKModal7Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8054359 7186009
  * @summary Check whether a FileDialog set to toolkit modality behaves as expected.
  *
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDDAppModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDDDocModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDDModelessTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDDNonModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDDSetModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDDToolkitModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDFAppModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDFSetModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDFToolkitModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Frame
  *          constructor receives focus, whether its components receives focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDFWModeless2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDFWNonModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a Dialog
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingDocModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -28,6 +28,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Test if a document modality works as expected:
  *          whether all the windows lying down the document root
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDAppModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDDocModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDModelessTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDNonModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDSetModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDToolkitModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Frame
  *          constructor receives focus, whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWDocModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWModeless4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingFDWNonModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal5Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsAppModal6Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog created with a Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsDocModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog created with a Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal5Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsSetModal6Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modal Dialog created with a Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal1Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a null Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal2Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a null Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal3Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a hidden Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal4Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a hidden Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal5Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Frame
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/BlockingWindowsToolkitModal6Test.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a toolkit modal Dialog created with a Dialog
  *          constructor receives focus; whether its components receive focus
--- a/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogAppModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether an application modal Dialog receives focus; check
  *          if its components receive focus and respond to key events
--- a/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogDocModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a document modal Dialog receives focus; check
  *          if its components receive focus and respond to key events
--- a/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogModelessTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -25,6 +25,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a modeless Dialog receives focus; check
  *          if its components receive focus and respond to key events
--- a/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java	Fri Aug 05 09:50:29 2016 -0700
+++ b/test/java/awt/Modal/ModalBlockingTests/UnblockedDialogNonModalTest.java	Mon Aug 08 08:12:20 2016 -0700
@@ -24,6 +24,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8049617
  * @summary Check whether a non-modal Dialog receives focus; check