Merge
diff --git a/makefiles/CompileNativeLibraries.gmk b/makefiles/CompileNativeLibraries.gmk
index 2fc34d8..4fcb6e8 100644
--- a/makefiles/CompileNativeLibraries.gmk
+++ b/makefiles/CompileNativeLibraries.gmk
@@ -2916,7 +2916,7 @@
 				PLATFORM_API_LinuxOS_ALSA_Ports.c,\
 		LANG:=C,\
 		OPTIMIZATION:=LOW, \
-		CFLAGS:=$(CFLAGS_JDKLIB) \
+		CFLAGS:=$(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \
 			$(LIBJSOUND_CFLAGS) \
 			-DUSE_DAUDIO=TRUE \
 			-DUSE_PORTS=TRUE  \
@@ -2925,7 +2925,7 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjsoundalsa/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB)\
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
-		LDFLAGS_SUFFIX:=-lasound -ljava -ljvm,\
+		LDFLAGS_SUFFIX:=$(ALSA_LIBS) -ljava -ljvm,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjsoundalsa,\
 		DEBUG_SYMBOLS:=$(DEBUG_ALL_BINARIES)))
 
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index eab2791..7230b2e 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -812,8 +812,6 @@
                 throw new RuntimeException("Unknown window state: " + windowState);
         }
 
-        nativeSynthesizeMouseEnteredExitedEvents();
-
         // NOTE: the SWP.windowState field gets updated to the newWindowState
         //       value when the native notification comes to us
     }
diff --git a/src/macosx/native/com/apple/laf/AquaFileView.m b/src/macosx/native/com/apple/laf/AquaFileView.m
index 8f33cc5..65fcc72 100644
--- a/src/macosx/native/com/apple/laf/AquaFileView.m
+++ b/src/macosx/native/com/apple/laf/AquaFileView.m
@@ -187,13 +187,13 @@
 JNF_COCOA_ENTER(env);
 
     UInt8 pathCString[MAXPATHLEN + 1];
-    size_t pathSize = sizeof(pathCString);
+    size_t maxPathLen = sizeof(pathCString) - 1;
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL);
     jsize length = (*env)->GetArrayLength(env, pathToAlias);
 
-    if (length > pathSize) {
-        length = pathSize;
+    if (length > maxPathLen) {
+        length = maxPathLen;
     }
     strncpy((char *)pathCString, (char *)byteArray, length);
     // make sure it's null terminated
diff --git a/src/macosx/native/sun/awt/AWTWindow.m b/src/macosx/native/sun/awt/AWTWindow.m
index 2997ff4..2a596bc 100644
--- a/src/macosx/native/sun/awt/AWTWindow.m
+++ b/src/macosx/native/sun/awt/AWTWindow.m
@@ -447,6 +447,8 @@
         // TODO: create generic AWT assert
     }
 
+    [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
+
     NSRect frame = ConvertNSScreenRect(env, [self.nsWindow frame]);
 
     static JNF_MEMBER_CACHE(jm_deliverMoveResizeEvent, jc_CPlatformWindow, "deliverMoveResizeEvent", "(IIIIZ)V");
@@ -630,6 +632,7 @@
         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_ENTER withEnv:env];
         (*env)->DeleteLocalRef(env, platformWindow);
     }
+    [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
 }
 
 - (void)windowWillExitFullScreen:(NSNotification *)notification {
@@ -652,6 +655,7 @@
         [self _notifyFullScreenOp:com_apple_eawt_FullScreenHandler_FULLSCREEN_DID_EXIT withEnv:env];
         (*env)->DeleteLocalRef(env, platformWindow);
     }
+    [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
 }
 
 - (void)sendEvent:(NSEvent *)event {
@@ -891,8 +895,6 @@
         // ensure we repaint the whole window after the resize operation
         // (this will also re-enable screen updates, which were disabled above)
         // TODO: send PaintEvent
-
-        [AWTWindow synthesizeMouseEnteredExitedEventsForAllWindows];
     }];
 
 JNF_COCOA_EXIT(env);
diff --git a/src/share/classes/java/awt/DefaultKeyboardFocusManager.java b/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
index 1358908..7c0c39d 100644
--- a/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
+++ b/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
@@ -285,10 +285,17 @@
         TimedWindowEvent we = (TimedWindowEvent)e;
         long time = we.getWhen();
         synchronized (this) {
-            for (KeyEvent ke: enqueuedKeyEvents) {
-                if (time >= ke.getWhen()) {
-                    SunToolkit.postEvent(AppContext.getAppContext(), new SequencedEvent(e));
-                    return true;
+            KeyEvent ke = enqueuedKeyEvents.isEmpty() ? null : enqueuedKeyEvents.getFirst();
+            if (ke != null && time >= ke.getWhen()) {
+                TypeAheadMarker marker = typeAheadMarkers.getFirst();
+                if (marker != null) {
+                    Window toplevel = marker.untilFocused.getContainingWindow();
+                    // Check that the component awaiting focus belongs to
+                    // the current focused window. See 8015454.
+                    if (toplevel != null && toplevel.isFocused()) {
+                        SunToolkit.postEvent(AppContext.getAppContext(), new SequencedEvent(e));
+                        return true;
+                    }
                 }
             }
         }
diff --git a/src/share/classes/java/awt/color/ICC_Profile.java b/src/share/classes/java/awt/color/ICC_Profile.java
index b459f63..c153424 100644
--- a/src/share/classes/java/awt/color/ICC_Profile.java
+++ b/src/share/classes/java/awt/color/ICC_Profile.java
@@ -37,6 +37,7 @@
 
 import sun.java2d.cmm.PCMM;
 import sun.java2d.cmm.CMSManager;
+import sun.java2d.cmm.ProfileDataVerifier;
 import sun.java2d.cmm.ProfileDeferralMgr;
 import sun.java2d.cmm.ProfileDeferralInfo;
 import sun.java2d.cmm.ProfileActivator;
@@ -775,6 +776,8 @@
             ProfileDeferralMgr.activateProfiles();
         }
 
+        ProfileDataVerifier.verify(data);
+
         try {
             theID = CMSManager.getModule().loadProfile(data);
         } catch (CMMException c) {
diff --git a/src/share/classes/javax/swing/JFileChooser.java b/src/share/classes/javax/swing/JFileChooser.java
index 2e1655d..d30c696 100644
--- a/src/share/classes/javax/swing/JFileChooser.java
+++ b/src/share/classes/javax/swing/JFileChooser.java
@@ -1146,9 +1146,25 @@
      * @see #resetChoosableFileFilters
      */
     public boolean removeChoosableFileFilter(FileFilter f) {
-        if(filters.contains(f)) {
+        int index = filters.indexOf(f);
+        if (index >= 0) {
             if(getFileFilter() == f) {
-                setFileFilter(null);
+                if (isAcceptAllFileFilterUsed()) {
+                    // choose default filter if it is used
+                    setFileFilter(getAcceptAllFileFilter());
+                }
+                else if (index > 0) {
+                    // choose the first filter, because it is not removed
+                    setFileFilter(filters.get(0));
+                }
+                else if (filters.size() > 1) {
+                    // choose the second filter, because the first one is removed
+                    setFileFilter(filters.get(1));
+                }
+                else {
+                    // no more filters
+                    setFileFilter(null);
+                }
             }
             FileFilter[] oldValue = getChoosableFileFilters();
             filters.removeElement(f);
diff --git a/src/share/classes/javax/swing/JTree.java b/src/share/classes/javax/swing/JTree.java
index f4d89e0..09b31da 100644
--- a/src/share/classes/javax/swing/JTree.java
+++ b/src/share/classes/javax/swing/JTree.java
@@ -3751,7 +3751,7 @@
      * the nodes identified by in <code>e</code>.
      */
     void removeDescendantSelectedPaths(TreeModelEvent e) {
-        TreePath            pPath = e.getTreePath();
+        TreePath            pPath = SwingUtilities2.getTreePath(e, getModel());
         Object[]            oldChildren = e.getChildren();
         TreeSelectionModel  sm = getSelectionModel();
 
@@ -3785,7 +3785,7 @@
             // and update BasicTreeUIs treeStructureChanged method
             // to update descendants in response to a treeStructureChanged
             // event, all the children of the event won't collapse!
-            TreePath            parent = e.getTreePath();
+            TreePath            parent = SwingUtilities2.getTreePath(e, getModel());
 
             if(parent == null)
                 return;
@@ -3822,7 +3822,7 @@
             if(e == null)
                 return;
 
-            TreePath            parent = e.getTreePath();
+            TreePath            parent = SwingUtilities2.getTreePath(e, getModel());
             Object[]            children = e.getChildren();
 
             if(children == null)
diff --git a/src/share/classes/javax/swing/event/TreeModelEvent.java b/src/share/classes/javax/swing/event/TreeModelEvent.java
index 6238946..3c92dc1 100644
--- a/src/share/classes/javax/swing/event/TreeModelEvent.java
+++ b/src/share/classes/javax/swing/event/TreeModelEvent.java
@@ -128,7 +128,7 @@
     public TreeModelEvent(Object source, Object[] path, int[] childIndices,
                           Object[] children)
     {
-        this(source, new TreePath(path), childIndices, children);
+        this(source, (path == null) ? null : new TreePath(path), childIndices, children);
     }
 
     /**
@@ -183,7 +183,7 @@
      */
     public TreeModelEvent(Object source, Object[] path)
     {
-        this(source, new TreePath(path));
+        this(source, (path == null) ? null : new TreePath(path));
     }
 
     /**
diff --git a/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java b/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
index 1b741db..c902252 100644
--- a/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
+++ b/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
@@ -73,6 +73,9 @@
 
         if ( anObject != null )  {
             text = anObject.toString();
+            if (text == null) {
+                text = "";
+            }
             oldValue = anObject;
         } else {
             text = "";
diff --git a/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java b/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
index 3d39cf6..0e7cd17 100644
--- a/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
@@ -3827,7 +3827,7 @@
         //
         public void treeNodesChanged(TreeModelEvent e) {
             if(treeState != null && e != null) {
-                TreePath parentPath = e.getTreePath();
+                TreePath parentPath = SwingUtilities2.getTreePath(e, getModel());
                 int[] indices = e.getChildIndices();
                 if (indices == null || indices.length == 0) {
                     // The root has changed
@@ -3882,7 +3882,7 @@
 
                 updateLeadSelectionRow();
 
-                TreePath       path = e.getTreePath();
+                TreePath       path = SwingUtilities2.getTreePath(e, getModel());
 
                 if(treeState.isExpanded(path)) {
                     updateSize();
@@ -3907,7 +3907,7 @@
 
                 updateLeadSelectionRow();
 
-                TreePath       path = e.getTreePath();
+                TreePath       path = SwingUtilities2.getTreePath(e, getModel());
 
                 if(treeState.isExpanded(path) ||
                    treeModel.getChildCount(path.getLastPathComponent()) == 0)
@@ -3921,7 +3921,7 @@
 
                 updateLeadSelectionRow();
 
-                TreePath       pPath = e.getTreePath();
+                TreePath       pPath = SwingUtilities2.getTreePath(e, getModel());
 
                 if (pPath != null) {
                     pPath = pPath.getParentPath();
diff --git a/src/share/classes/javax/swing/text/View.java b/src/share/classes/javax/swing/text/View.java
index 097e6c3..c2e1e02 100644
--- a/src/share/classes/javax/swing/text/View.java
+++ b/src/share/classes/javax/swing/text/View.java
@@ -1174,7 +1174,7 @@
         // formed by added elements (i.e. they will be updated
         // by initialization.
         index0 = Math.max(index0, 0);
-        index1 = getViewIndex(elem.getDocument().getLength(), Position.Bias.Forward);
+        index1 = Math.max((getViewCount() - 1), 0);
         for (int i = index0; i <= index1; i++) {
             if (! ((i >= hole0) && (i <= hole1))) {
                 v = getView(i);
diff --git a/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java b/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java
index fffea8b..4f61aff 100644
--- a/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java
+++ b/src/share/classes/javax/swing/tree/FixedHeightLayoutCache.java
@@ -26,13 +26,14 @@
 package javax.swing.tree;
 
 import javax.swing.event.TreeModelEvent;
-import java.awt.Dimension;
 import java.awt.Rectangle;
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.NoSuchElementException;
 import java.util.Stack;
 
+import sun.swing.SwingUtilities2;
+
 /**
  * NOTE: This will become more open in a future release.
  * <p>
@@ -346,7 +347,7 @@
         if(e != null) {
             int                 changedIndexs[];
             FHTreeStateNode     changedParent = getNodeForPath
-                                  (e.getTreePath(), false, false);
+                                  (SwingUtilities2.getTreePath(e, getModel()), false, false);
             int                 maxCounter;
 
             changedIndexs = e.getChildIndices();
@@ -390,7 +391,7 @@
         if(e != null) {
             int                 changedIndexs[];
             FHTreeStateNode     changedParent = getNodeForPath
-                                  (e.getTreePath(), false, false);
+                                  (SwingUtilities2.getTreePath(e, getModel()), false, false);
             int                 maxCounter;
 
             changedIndexs = e.getChildIndices();
@@ -429,7 +430,7 @@
         if(e != null) {
             int                  changedIndexs[];
             int                  maxCounter;
-            TreePath             parentPath = e.getTreePath();
+            TreePath             parentPath = SwingUtilities2.getTreePath(e, getModel());
             FHTreeStateNode      changedParentNode = getNodeForPath
                                        (parentPath, false, false);
 
@@ -475,7 +476,7 @@
      */
     public void treeStructureChanged(TreeModelEvent e) {
         if(e != null) {
-            TreePath          changedPath = e.getTreePath();
+            TreePath          changedPath = SwingUtilities2.getTreePath(e, getModel());
             FHTreeStateNode   changedNode = getNodeForPath
                                                 (changedPath, false, false);
 
diff --git a/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java b/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java
index ad91d1c..5185194 100644
--- a/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java
+++ b/src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java
@@ -26,7 +26,6 @@
 package javax.swing.tree;
 
 import javax.swing.event.TreeModelEvent;
-import java.awt.Dimension;
 import java.awt.Rectangle;
 import java.util.Enumeration;
 import java.util.Hashtable;
@@ -34,6 +33,8 @@
 import java.util.Stack;
 import java.util.Vector;
 
+import sun.swing.SwingUtilities2;
+
 /**
  * NOTE: This will become more open in a future release.
  * <p>
@@ -413,7 +414,7 @@
             TreeStateNode     changedNode;
 
             changedIndexs = e.getChildIndices();
-            changedNode = getNodeForPath(e.getTreePath(), false, false);
+            changedNode = getNodeForPath(SwingUtilities2.getTreePath(e, getModel()), false, false);
             if(changedNode != null) {
                 Object            changedValue = changedNode.getValue();
 
@@ -466,7 +467,7 @@
             TreeStateNode     changedParentNode;
 
             changedIndexs = e.getChildIndices();
-            changedParentNode = getNodeForPath(e.getTreePath(), false, false);
+            changedParentNode = getNodeForPath(SwingUtilities2.getTreePath(e, getModel()), false, false);
             /* Only need to update the children if the node has been
                expanded once. */
             // PENDING(scott): make sure childIndexs is sorted!
@@ -540,7 +541,7 @@
             TreeStateNode     changedParentNode;
 
             changedIndexs = e.getChildIndices();
-            changedParentNode = getNodeForPath(e.getTreePath(), false, false);
+            changedParentNode = getNodeForPath(SwingUtilities2.getTreePath(e, getModel()), false, false);
             // PENDING(scott): make sure that changedIndexs are sorted in
             // ascending order.
             if(changedParentNode != null && changedIndexs != null &&
@@ -628,7 +629,7 @@
     public void treeStructureChanged(TreeModelEvent e) {
         if(e != null)
         {
-            TreePath          changedPath = e.getTreePath();
+            TreePath          changedPath = SwingUtilities2.getTreePath(e, getModel());
             TreeStateNode     changedNode;
 
             changedNode = getNodeForPath(changedPath, false, false);
diff --git a/src/share/classes/sun/java2d/cmm/ProfileDataVerifier.java b/src/share/classes/sun/java2d/cmm/ProfileDataVerifier.java
new file mode 100644
index 0000000..e6100bb
--- /dev/null
+++ b/src/share/classes/sun/java2d/cmm/ProfileDataVerifier.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+package sun.java2d.cmm;
+
+public class ProfileDataVerifier {
+    /**
+     * Throws an IllegalArgumentException if the data does not correspond
+     * to a valid ICC Profile.
+     *
+     * @param data the specified profile data.
+     */
+    public static void verify(byte[] data) {
+        if (data == null) {
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        if (data.length < TOC_OFFSET) {
+            // not enough data for profile header
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        // check profile size
+        final int size = readInt32(data, 0);
+        final int tagCount = readInt32(data, HEADER_SIZE);
+
+        if (tagCount < 0 || tagCount > MAX_TAG_COUNT) {
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        if (size < (TOC_OFFSET + (tagCount * TOC_RECORD_SIZE)) ||
+            size > data.length)
+        {
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        final int sig = readInt32(data, 36);
+
+        if (PROFILE_FILE_SIGNATURE != sig) {
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        // verify table of content
+        for (int i = 0; i < tagCount; i++) {
+            final int tag_offset = getTagOffset(i, data);
+            final int tag_size = getTagSize(i, data);
+
+            if (tag_offset < TOC_OFFSET || tag_offset > size) {
+                throw new IllegalArgumentException("Invalid ICC Profile Data");
+            }
+
+            if (tag_size < 0 ||
+                tag_size > (Integer.MAX_VALUE - tag_offset) ||
+                tag_size + tag_offset > size)
+            {
+                throw new IllegalArgumentException("Invalid ICC Profile Data");
+            }
+        }
+    }
+
+    private static int getTagOffset(int idx, byte[] data) {
+        final int pos = TOC_OFFSET + idx * TOC_RECORD_SIZE + 4;
+        return readInt32(data, pos);
+    }
+
+    private static int getTagSize(int idx, byte[] data) {
+        final int pos = TOC_OFFSET + idx * TOC_RECORD_SIZE + 8;
+        return readInt32(data, pos);
+    }
+
+    private static int readInt32(byte[] data, int off) {
+        int res = 0;
+        for (int i = 0; i < 4; i++) {
+            res = res << 8;
+
+            res |= (0xff & data[off++]);
+        }
+        return res;
+    }
+
+    /**
+     * Lcms limit for the number of tags: 100
+     * Kcms limit for the number of tags: N/A
+     */
+    private static final int MAX_TAG_COUNT = 100;
+
+    private static final int HEADER_SIZE = 128;
+    private static final int TOC_OFFSET = HEADER_SIZE + 4;
+    private static final int TOC_RECORD_SIZE = 12;
+
+    private static final int PROFILE_FILE_SIGNATURE = 0x61637370;
+}
diff --git a/src/share/classes/sun/swing/SwingUtilities2.java b/src/share/classes/sun/swing/SwingUtilities2.java
index c613488..a1903f2 100644
--- a/src/share/classes/sun/swing/SwingUtilities2.java
+++ b/src/share/classes/sun/swing/SwingUtilities2.java
@@ -33,18 +33,19 @@
 import java.awt.font.*;
 import java.awt.geom.*;
 import java.awt.print.PrinterGraphics;
-import java.text.Bidi;
 import java.text.AttributedCharacterIterator;
 import java.text.AttributedString;
 
 import javax.swing.*;
-import javax.swing.plaf.*;
+import javax.swing.event.TreeModelEvent;
 import javax.swing.text.Highlighter;
 import javax.swing.text.JTextComponent;
 import javax.swing.text.DefaultHighlighter;
 import javax.swing.text.DefaultCaret;
 import javax.swing.table.TableCellRenderer;
 import javax.swing.table.TableColumnModel;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
 
 import sun.swing.PrintColorUIResource;
 import sun.swing.ImageIconUIResource;
@@ -1887,4 +1888,22 @@
         }
         return InputEvent.ALT_MASK;
     }
+
+    /**
+     * Returns the {@link TreePath} that identifies the changed nodes.
+     *
+     * @param event  changes in a tree model
+     * @param model  corresponing tree model
+     * @return  the path to the changed nodes
+     */
+    public static TreePath getTreePath(TreeModelEvent event, TreeModel model) {
+        TreePath path = event.getTreePath();
+        if ((path == null) && (model != null)) {
+            Object root = model.getRoot();
+            if (root != null) {
+                path = new TreePath(root);
+            }
+        }
+        return path;
+    }
 }
diff --git a/src/share/native/sun/font/layout/KernTable.cpp b/src/share/native/sun/font/layout/KernTable.cpp
index 13ddd0f..2d94651 100644
--- a/src/share/native/sun/font/layout/KernTable.cpp
+++ b/src/share/native/sun/font/layout/KernTable.cpp
@@ -96,7 +96,7 @@
  * TODO: respect header flags
  */
 KernTable::KernTable(const LETableReference& base, LEErrorCode &success)
-  : pairs(), pairsSwapped(NULL), fTable(base)
+  : pairsSwapped(NULL), fTable(base)
 {
   if(LE_FAILURE(success) || (fTable.isEmpty())) {
 #if DEBUG
@@ -143,32 +143,36 @@
 #endif
 
         if(LE_SUCCESS(success) && nPairs>0) {
-          // pairs is an instance member, and table is on the stack.
-          // set 'pairs' based on table.getAlias(). This will range check it.
+          // pairsSwapped is an instance member, and table is on the stack.
+          // set 'pairsSwapped' based on table.getAlias(). This will range check it.
 
-          pairs = LEReferenceToArrayOf<PairInfo>(fTable, // based on overall table
-                                                 success,
-                                                 (const PairInfo*)table.getAlias(),  // subtable 0 + ..
-                                                 KERN_SUBTABLE_0_HEADER_SIZE,  // .. offset of header size
-                                                 nPairs); // count
-        }
-        if (LE_SUCCESS(success) && pairs.isValid()) {
-            pairsSwapped =  (PairInfo*)(malloc(nPairs*sizeof(PairInfo)));
-            PairInfo *p = (PairInfo*)pairsSwapped;
-            for (int i = 0; LE_SUCCESS(success) && i < nPairs; i++, p++) {
-              memcpy(p, pairs.getAlias(i,success), KERN_PAIRINFO_SIZE);
-              p->key = SWAPL(p->key);
+          pairsSwapped = (PairInfo*)(fTable.getFont()->getKernPairs());
+          if (pairsSwapped == NULL) {
+            LEReferenceToArrayOf<PairInfo>pairs =
+              LEReferenceToArrayOf<PairInfo>(fTable, // based on overall table
+                                             success,
+                                             (const PairInfo*)table.getAlias(),  // subtable 0 + ..
+                                             KERN_SUBTABLE_0_HEADER_SIZE,  // .. offset of header size
+                                             nPairs); // count
+            if (LE_SUCCESS(success) && pairs.isValid()) {
+              pairsSwapped =  (PairInfo*)(malloc(nPairs*sizeof(PairInfo)));
+              PairInfo *p = (PairInfo*)pairsSwapped;
+              for (int i = 0; LE_SUCCESS(success) && i < nPairs; i++, p++) {
+                memcpy(p, pairs.getAlias(i,success), KERN_PAIRINFO_SIZE);
+                p->key = SWAPL(p->key);
+              }
+              fTable.getFont()->setKernPairs((void*)pairsSwapped); // store it
             }
-            fTable.getFont()->setKernPairs((void*)pairsSwapped); // store it
+          }
         }
 
 #if 0
-        fprintf(stderr, "coverage: %0.4x nPairs: %d pairs %p\n", coverage, nPairs, pairs.getAlias());
+        fprintf(stderr, "coverage: %0.4x nPairs: %d pairs %p\n", coverage, nPairs, pairsSwapped);
         fprintf(stderr, "  searchRange: %d entrySelector: %d rangeShift: %d\n", searchRange, entrySelector, rangeShift);
         fprintf(stderr, "[[ ignored font table entries: range %d selector %d shift %d ]]\n", SWAPW(table->searchRange), SWAPW(table->entrySelector), SWAPW(table->rangeShift));
 #endif
 #if DEBUG
-        fprintf(stderr, "coverage: %0.4x nPairs: %d pairs 0x%x\n", coverage, nPairs, pairs);
+        fprintf(stderr, "coverage: %0.4x nPairs: %d pairs 0x%x\n", coverage, nPairs, pairsSwapped);
         fprintf(stderr,
           "  searchRange(pairs): %d entrySelector: %d rangeShift(pairs): %d\n",
           searchRange, entrySelector, rangeShift);
@@ -182,7 +186,7 @@
               ids[id] = (char)i;
             }
           }
-          PairInfo *p = pairs;
+          PairInfo *p = pairsSwapped;
           for (int i = 0; i < nPairs; ++i, p++) {
             le_uint32 k = p->key;
             le_uint16 left = (k >> 16) & 0xffff;
diff --git a/src/share/native/sun/font/layout/KernTable.h b/src/share/native/sun/font/layout/KernTable.h
index 1cc4f87..c667a18 100644
--- a/src/share/native/sun/font/layout/KernTable.h
+++ b/src/share/native/sun/font/layout/KernTable.h
@@ -57,7 +57,6 @@
  private:
   le_uint16 coverage;
   le_uint16 nPairs;
-  LEReferenceToArrayOf<PairInfo> pairs;
   PairInfo  *pairsSwapped;
   const LETableReference &fTable;
   le_uint16 searchRange;
diff --git a/src/share/native/sun/font/layout/LayoutEngine.cpp b/src/share/native/sun/font/layout/LayoutEngine.cpp
index 6690316..30fb0bb 100644
--- a/src/share/native/sun/font/layout/LayoutEngine.cpp
+++ b/src/share/native/sun/font/layout/LayoutEngine.cpp
@@ -569,7 +569,6 @@
 {
   if(fGlyphStorage!=NULL) {
     fGlyphStorage->reset();
-    fGlyphStorage = NULL;
   }
 }
 
diff --git a/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java b/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java
index 463a58d..31548f9 100644
--- a/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java
+++ b/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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,9 +26,11 @@
 
 import java.awt.Component;
 import java.awt.Window;
-import sun.util.logging.PlatformLogger;
+
+import sun.awt.AWTAccessor;
 import sun.awt.CausedFocusEvent;
 import sun.awt.KeyboardFocusManagerPeerImpl;
+import sun.util.logging.PlatformLogger;
 
 public class XKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XKeyboardFocusManagerPeer");
@@ -68,13 +70,13 @@
 
         synchronized(this) {
             if (currentFocusedWindow != null) {
-                from = (XWindowPeer)currentFocusedWindow.getPeer();
+                from = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
             }
 
             currentFocusedWindow = win;
 
             if (currentFocusedWindow != null) {
-                to = (XWindowPeer)currentFocusedWindow.getPeer();
+                to = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(currentFocusedWindow);
             }
         }
 
diff --git a/src/solaris/classes/sun/print/UnixPrintServiceLookup.java b/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
index 9fcbb86..c682634 100644
--- a/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
+++ b/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
@@ -362,10 +362,33 @@
      */
     private PrintService getServiceByName(PrinterName nameAttr) {
         String name = nameAttr.getValue();
-        PrintService printer = null;
         if (name == null || name.equals("") || !checkPrinterName(name)) {
             return null;
         }
+        /* check is all printers are already available */
+        if (printServices != null) {
+            for (PrintService printService : printServices) {
+                if (printService.getName().equals(name)) {
+                    return printService;
+                }
+            }
+        }
+        /* take CUPS into account first */
+        if (CUPSPrinter.isCupsRunning()) {
+            try {
+                return new IPPPrintService(name,
+                                           new URL("http://"+
+                                                   CUPSPrinter.getServer()+":"+
+                                                   CUPSPrinter.getPort()+"/"+
+                                                   name));
+            } catch (Exception e) {
+                IPPPrintService.debug_println(debugPrefix+
+                                              " getServiceByName Exception "+
+                                              e);
+            }
+        }
+        /* fallback if nothing not having a printer at this point */
+        PrintService printer = null;
         if (isMac() || isSysV()) {
             printer = getNamedPrinterNameSysV(name);
         } else {
diff --git a/src/solaris/native/sun/awt/awt_GraphicsEnv.c b/src/solaris/native/sun/awt/awt_GraphicsEnv.c
index 7282d22..cb0b727 100644
--- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c
+++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c
@@ -1369,12 +1369,18 @@
     mid = (*env)->GetMethodID(env, clazz, "<init>", "(IIII)V");
     if (mid != NULL) {
         if (usingXinerama) {
-            bounds = (*env)->NewObject(env, clazz, mid, fbrects[screen].x,
-                                                        fbrects[screen].y,
-                                                        fbrects[screen].width,
-                                                        fbrects[screen].height);
-        }
-        else {
+            if (0 <= screen && screen < awt_numScreens) {
+                bounds = (*env)->NewObject(env, clazz, mid, fbrects[screen].x,
+                                                            fbrects[screen].y,
+                                                            fbrects[screen].width,
+                                                            fbrects[screen].height);
+            } else {
+                jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
+                if (exceptionClass != NULL) {
+                    (*env)->ThrowNew(env, exceptionClass, "Illegal screen index");
+                }
+            }
+        } else {
             XWindowAttributes xwa;
             memset(&xwa, 0, sizeof(xwa));
 
diff --git a/src/solaris/native/sun/awt/awt_InputMethod.c b/src/solaris/native/sun/awt/awt_InputMethod.c
index faa7646..dd9fb95 100644
--- a/src/solaris/native/sun/awt/awt_InputMethod.c
+++ b/src/solaris/native/sun/awt/awt_InputMethod.c
@@ -447,7 +447,7 @@
  */
 #define INITIAL_LOOKUP_BUF_SIZE 512
 
-Bool
+Boolean
 awt_x11inputmethod_lookupString(XKeyPressedEvent *event, KeySym *keysymp)
 {
     JNIEnv *env = GetJNIEnv();
@@ -457,8 +457,8 @@
     int mblen;
     jstring javastr;
     XIC ic;
-    Bool result = True;
-    static Bool composing = False;
+    Boolean result = True;
+    static Boolean composing = False;
 
     /*
       printf("lookupString: entering...\n");
diff --git a/src/solaris/native/sun/xawt/XToolkit.c b/src/solaris/native/sun/xawt/XToolkit.c
index 6dfb80d..9abacad 100644
--- a/src/solaris/native/sun/xawt/XToolkit.c
+++ b/src/solaris/native/sun/xawt/XToolkit.c
@@ -685,8 +685,7 @@
     if (result == 0) {
         /* poll() timed out -- update timeout value */
         update_poll_timeout(TIMEOUT_TIMEDOUT);
-        PRINT2("%s(): TIMEOUT_TIMEDOUT curPollTimeout = %d \n",
-              performPoll, curPollTimeout);
+        PRINT2("performPoll(): TIMEOUT_TIMEDOUT curPollTimeout = %d \n", curPollTimeout);
     }
     if (pollFds[1].revents) {
         int count;
@@ -695,14 +694,12 @@
         do {
             count = read(AWT_READPIPE, read_buf, AWT_POLL_BUFSIZE );
         } while (count == AWT_POLL_BUFSIZE );
-        PRINT2("%s():  data on the AWT pipe: curPollTimeout = %d \n",
-               performPoll, curPollTimeout);
+        PRINT2("performPoll():  data on the AWT pipe: curPollTimeout = %d \n", curPollTimeout);
     }
     if (pollFds[0].revents) {
         // Events in X pipe
         update_poll_timeout(TIMEOUT_EVENTS);
-        PRINT2("%s(): TIMEOUT_EVENTS curPollTimeout = %ld \n",
-               performPoll, curPollTimeout);
+        PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %ld \n", curPollTimeout);
     }
     return;
 
diff --git a/src/windows/classes/sun/awt/windows/WPrinterJob.java b/src/windows/classes/sun/awt/windows/WPrinterJob.java
index 250d8c7..897e8f1 100644
--- a/src/windows/classes/sun/awt/windows/WPrinterJob.java
+++ b/src/windows/classes/sun/awt/windows/WPrinterJob.java
@@ -1269,11 +1269,13 @@
         mLastFontFamily = null;
     }
 
+    private boolean defaultCopies = true;
     /**
      * Set the number of copies to be printed.
      */
     public void setCopies(int copies) {
         super.setCopies(copies);
+        defaultCopies = false;
         mAttCopies = copies;
         setNativeCopies(copies);
     }
@@ -1529,8 +1531,9 @@
     }
 
     /* SheetCollate */
-    private final boolean getCollateAttrib() {
-        return (mAttCollate == 1);
+    private final int getCollateAttrib() {
+        // -1 means unset, 0 uncollated, 1 collated.
+        return mAttCollate;
     }
 
     private void setCollateAttrib(Attribute attr) {
@@ -1553,6 +1556,10 @@
         int orient = PageFormat.PORTRAIT;
         OrientationRequested orientReq = (attributes == null) ? null :
             (OrientationRequested)attributes.get(OrientationRequested.class);
+        if (orientReq == null) {
+            orientReq = (OrientationRequested)
+               myService.getDefaultAttributeValue(OrientationRequested.class);
+        }
         if (orientReq != null) {
             if (orientReq == OrientationRequested.REVERSE_LANDSCAPE) {
                 orient = PageFormat.REVERSE_LANDSCAPE;
@@ -1573,7 +1580,11 @@
 
     /* Copies and Page Range. */
     private final int getCopiesAttrib() {
-        return getCopiesInt();
+        if (defaultCopies) {
+            return 0;
+        } else {
+            return getCopiesInt();
+        }
      }
 
     private final void setRangeCopiesAttribute(int from, int to,
@@ -1584,6 +1595,7 @@
                 attributes.add(new PageRanges(from, to));
                 setPageRange(from, to);
             }
+            defaultCopies = false;
             attributes.add(new Copies(copies));
             /* Since this is called from native to tell Java to sync
              * up with native, we don't call this class's own setCopies()
diff --git a/src/windows/classes/sun/print/Win32PrintService.java b/src/windows/classes/sun/print/Win32PrintService.java
index bef2213..ace3326 100644
--- a/src/windows/classes/sun/print/Win32PrintService.java
+++ b/src/windows/classes/sun/print/Win32PrintService.java
@@ -180,6 +180,9 @@
     private static final int DMDUP_VERTICAL = 2;
     private static final int DMDUP_HORIZONTAL = 3;
     private static final int DMCOLLATE_TRUE = 1;
+    private static final int DMCOLOR_MONOCHROME = 1;
+    private static final int DMCOLOR_COLOR = 2;
+
 
     // media sizes with indices above dmPaperToPrintService' length
     private static final int DMPAPER_A2 = 66;
@@ -1041,6 +1044,7 @@
         int defOrient = defaults[5];
         int defSides = defaults[6];
         int defCollate = defaults[7];
+        int defColor = defaults[8];
 
         if (category == Copies.class) {
             if (defCopies > 0) {
@@ -1049,11 +1053,10 @@
                 return new Copies(1);
             }
         } else if (category == Chromaticity.class) {
-            int caps = getPrinterCapabilities();
-            if ((caps & DEVCAP_COLOR) == 0) {
-                return Chromaticity.MONOCHROME;
-            } else {
+            if (defColor == DMCOLOR_COLOR) {
                 return Chromaticity.COLOR;
+            } else {
+                return Chromaticity.MONOCHROME;
             }
         } else if (category == JobName.class) {
             return new JobName("Java Printing", null);
diff --git a/src/windows/native/sun/windows/WPrinterJob.cpp b/src/windows/native/sun/windows/WPrinterJob.cpp
index 1d7b692..4bb4998 100644
--- a/src/windows/native/sun/windows/WPrinterJob.cpp
+++ b/src/windows/native/sun/windows/WPrinterJob.cpp
@@ -750,7 +750,7 @@
 
 
 #define GETDEFAULT_ERROR        -50
-#define NDEFAULT 8
+#define NDEFAULT 9
 
 JNIEXPORT jintArray JNICALL
 Java_sun_print_Win32PrintService_getDefaultSettings(JNIEnv *env,
@@ -859,6 +859,11 @@
       defIndices[7] = pDevMode->dmCollate;
   }
 
+  if (pDevMode->dmFields & DM_COLOR) {
+      defIndices[8] = pDevMode->dmColor;
+  }
+
+
   GlobalFree(pDevMode);
   ::ClosePrinter(hPrinter);
 
diff --git a/src/windows/native/sun/windows/awt_Frame.cpp b/src/windows/native/sun/windows/awt_Frame.cpp
index 5d344e7..1195491 100644
--- a/src/windows/native/sun/windows/awt_Frame.cpp
+++ b/src/windows/native/sun/windows/awt_Frame.cpp
@@ -380,9 +380,11 @@
 
             if (!sm_suppressFocusAndActivation) {
                 if (IsLightweightFrame() || IsEmbeddedFrame()) {
-                    AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL);
+                    HWND oppositeToplevelHWnd = AwtComponent::GetTopLevelParentForWindow((HWND)wParam);
+                    if (oppositeToplevelHWnd != AwtComponent::GetFocusedWindow()) {
+                        AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL);
+                    }
                 }
-
             } else if (sm_restoreFocusAndActivation) {
                 if (AwtComponent::GetFocusedWindow() != NULL) {
                     AwtWindow *focusedWindow = (AwtWindow*)GetComponent(AwtComponent::GetFocusedWindow());
diff --git a/src/windows/native/sun/windows/awt_PrintControl.cpp b/src/windows/native/sun/windows/awt_PrintControl.cpp
index 4005835..71a08d3 100644
--- a/src/windows/native/sun/windows/awt_PrintControl.cpp
+++ b/src/windows/native/sun/windows/awt_PrintControl.cpp
@@ -252,7 +252,7 @@
     AwtPrintControl::getCopiesID =
       env->GetMethodID(cls, "getCopiesAttrib", "()I");
     AwtPrintControl::getCollateID =
-      env->GetMethodID(cls, "getCollateAttrib","()Z");
+      env->GetMethodID(cls, "getCollateAttrib","()I");
     AwtPrintControl::getOrientID =
       env->GetMethodID(cls, "getOrientAttrib", "()I");
     AwtPrintControl::getFromPageID =
@@ -690,12 +690,6 @@
     pd.Flags = PD_ENABLEPRINTHOOK | PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
     pd.lpfnPrintHook = (LPPRINTHOOKPROC)PrintDlgHook;
 
-    if (env->CallBooleanMethod(printCtrl, AwtPrintControl::getCollateID)) {
-        pd.Flags |= PD_COLLATE;
-    }
-
-    pd.nCopies = (WORD)env->CallIntMethod(printCtrl,
-                                          AwtPrintControl::getCopiesID);
     pd.nFromPage = (WORD)env->CallIntMethod(printCtrl,
                                             AwtPrintControl::getFromPageID);
     pd.nToPage = (WORD)env->CallIntMethod(printCtrl,
@@ -729,37 +723,52 @@
       DEVMODE *devmode = (DEVMODE *)::GlobalLock(pd.hDevMode);
       DASSERT(!IsBadWritePtr(devmode, sizeof(DEVMODE)));
 
-      devmode->dmFields |= DM_COPIES | DM_COLLATE | DM_ORIENTATION |
-          DM_PAPERSIZE | DM_PRINTQUALITY | DM_COLOR | DM_DUPLEX;
-
-      devmode->dmCopies = pd.nCopies;
+      WORD copies = (WORD)env->CallIntMethod(printCtrl,
+                                             AwtPrintControl::getCopiesID);
+      if (copies > 0) {
+          devmode->dmFields |= DM_COPIES;
+          devmode->dmCopies = copies;
+      }
 
       jint orient = env->CallIntMethod(printCtrl,
                                        AwtPrintControl::getOrientID);
-      if (orient == 0) {
+      if (orient == 0) {  // PageFormat.LANDSCAPE == 0
+        devmode->dmFields |= DM_ORIENTATION;
         devmode->dmOrientation = DMORIENT_LANDSCAPE;
-      } else if (orient == 1) {
+      } else if (orient == 1) { // PageFormat.PORTRAIT == 1
+        devmode->dmFields |= DM_ORIENTATION;
         devmode->dmOrientation = DMORIENT_PORTRAIT;
       }
 
-      devmode->dmCollate = (pd.Flags & PD_COLLATE) ? DMCOLLATE_TRUE
-        : DMCOLLATE_FALSE;
+      // -1 means unset, so we'll accept the printer default.
+      int collate = env->CallIntMethod(printCtrl,
+                                       AwtPrintControl::getCollateID);
+      if (collate == 1) {
+        devmode->dmFields |= DM_COLLATE;
+        devmode->dmCollate = DMCOLLATE_TRUE;
+      } else if (collate == 0) {
+        devmode->dmFields |= DM_COLLATE;
+        devmode->dmCollate = DMCOLLATE_FALSE;
+      }
 
       int quality = env->CallIntMethod(printCtrl,
                                        AwtPrintControl::getQualityID);
       if (quality) {
+        devmode->dmFields |= DM_PRINTQUALITY;
         devmode->dmPrintQuality = quality;
       }
 
       int color = env->CallIntMethod(printCtrl,
                                      AwtPrintControl::getColorID);
       if (color) {
+        devmode->dmFields |= DM_COLOR;
         devmode->dmColor = color;
       }
 
       int sides = env->CallIntMethod(printCtrl,
                                      AwtPrintControl::getSidesID);
       if (sides) {
+        devmode->dmFields |= DM_DUPLEX;
         devmode->dmDuplex = (int)sides;
       }
 
@@ -771,6 +780,7 @@
 
       double newWid = 0.0, newHt = 0.0;
       if (wid_ht != NULL && wid_ht[0] != 0 && wid_ht[1] != 0) {
+        devmode->dmFields |= DM_PAPERSIZE;
         devmode->dmPaperSize = AwtPrintControl::getNearestMatchingPaper(
                                              printName,
                                              portName,
diff --git a/test/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java b/test/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java
new file mode 100644
index 0000000..60761c0
--- /dev/null
+++ b/test/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2013, 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 4928019
+ * @summary Makes sure all the basic classes can be created with GTK.
+ * @author Scott Violet
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.basic.*;
+
+public class bug4928019 {
+    public static void main(String[] args) throws Throwable {
+        try {
+            UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
+        } catch (UnsupportedLookAndFeelException ex) {
+            System.err.println("GTKLookAndFeel is not supported on this platform." +
+                    " Test is considered passed.");
+            return;
+        } catch (ClassNotFoundException ex) {
+            System.err.println("GTKLookAndFeel class is not found." +
+                    " Test is considered passed.");
+            return;
+        }
+        new JButton() {
+            public void updateUI() {
+                setUI(new BasicButtonUI());
+            }
+        };
+        new JCheckBox() {
+            public void updateUI() {
+                setUI(new BasicCheckBoxUI());
+            }
+        };
+        new JCheckBoxMenuItem() {
+            public void updateUI() {
+                setUI(new BasicCheckBoxMenuItemUI());
+            }
+        };
+        new JColorChooser() {
+            public void updateUI() {
+                setUI(new BasicColorChooserUI());
+            }
+        };
+        new JComboBox() {
+            public void updateUI() {
+                setUI(new BasicComboBoxUI());
+            }
+        };
+        new JDesktopPane() {
+            public void updateUI() {
+                setUI(new BasicDesktopPaneUI());
+            }
+        };
+        new JEditorPane() {
+            public void updateUI() {
+                setUI(new BasicEditorPaneUI());
+            }
+        };
+        new JFileChooser() {
+            public void updateUI() {
+                setUI(new BasicFileChooserUI(null));
+            }
+        };
+        new JFormattedTextField() {
+            public void updateUI() {
+                setUI(new BasicFormattedTextFieldUI());
+            }
+        };
+        new JInternalFrame() {
+            public void updateUI() {
+                setUI(new BasicInternalFrameUI(null));
+            }
+        };
+        new JLabel() {
+            public void updateUI() {
+                setUI(new BasicLabelUI());
+            }
+        };
+        new JList() {
+            public void updateUI() {
+                setUI(new BasicListUI());
+            }
+        };
+        new JMenuBar() {
+            public void updateUI() {
+                setUI(new BasicMenuBarUI());
+            }
+        };
+        new JMenuItem() {
+            public void updateUI() {
+                setUI(new BasicMenuItemUI());
+            }
+        };
+        new JMenu() {
+            public void updateUI() {
+                setUI(new BasicMenuUI());
+            }
+        };
+        new JOptionPane() {
+            public void updateUI() {
+                setUI(new BasicOptionPaneUI());
+            }
+        };
+        new JPanel() {
+            public void updateUI() {
+                setUI(new BasicPanelUI());
+            }
+        };
+        new JPasswordField() {
+            public void updateUI() {
+                setUI(new BasicPasswordFieldUI());
+            }
+        };
+        new JPopupMenu() {
+            public void updateUI() {
+                setUI(new BasicPopupMenuUI());
+            }
+        };
+        new JProgressBar() {
+            public void updateUI() {
+                setUI(new BasicProgressBarUI());
+            }
+        };
+        new JRadioButton() {
+            public void updateUI() {
+                setUI(new BasicRadioButtonUI());
+            }
+        };
+        new JRadioButtonMenuItem() {
+            public void updateUI() {
+                setUI(new BasicRadioButtonMenuItemUI());
+            }
+        };
+        new JRootPane() {
+            public void updateUI() {
+                setUI(new BasicRootPaneUI());
+            }
+        };
+        new JScrollBar() {
+            public void updateUI() {
+                setUI(new BasicScrollBarUI());
+            }
+        };
+        new JScrollPane() {
+            public void updateUI() {
+                setUI(new BasicScrollPaneUI());
+            }
+        };
+        new JSeparator() {
+            public void updateUI() {
+                setUI(new BasicSeparatorUI());
+            }
+        };
+        new JSlider() {
+            public void updateUI() {
+                setUI(new BasicSliderUI(null));
+            }
+        };
+        new JSpinner() {
+            public void updateUI() {
+                setUI(new BasicSpinnerUI());
+            }
+        };
+        new JSplitPane() {
+            public void updateUI() {
+                setUI(new BasicSplitPaneUI());
+            }
+        };
+        new JTabbedPane() {
+            public void updateUI() {
+                setUI(new BasicTabbedPaneUI());
+            }
+        };
+        new JTable() {
+            public void updateUI() {
+                setUI(new BasicTableUI());
+            }
+        };
+        new JTextArea() {
+            public void updateUI() {
+                setUI(new BasicTextAreaUI());
+            }
+        };
+        new JTextField() {
+            public void updateUI() {
+                setUI(new BasicTextFieldUI());
+            }
+        };
+        new JTextPane() {
+            public void updateUI() {
+                setUI(new BasicTextPaneUI());
+            }
+        };
+        new JToggleButton() {
+            public void updateUI() {
+                setUI(new BasicToggleButtonUI());
+            }
+        };
+        new JToolBar() {
+            public void updateUI() {
+                setUI(new BasicToolBarUI());
+            }
+        };
+        new JToolTip() {
+            public void updateUI() {
+                setUI(new BasicToolTipUI());
+            }
+        };
+        new JTree() {
+            public void updateUI() {
+                setUI(new BasicTreeUI());
+            }
+        };
+        new JViewport() {
+            public void updateUI() {
+                setUI(new BasicViewportUI());
+            }
+        };
+        System.out.println("DONE");
+    }
+}
diff --git a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html
index 03f470d..2139635 100644
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html
+++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html
@@ -1,6 +1,5 @@
 <html>
 <!--  
-
   @test
   @bug 8005932
   @summary Java 7 on mac os x only provides text clipboard formats
@@ -9,10 +8,9 @@
   @library ../../regtesthelpers/process
   @build Util
   @build ProcessResults ProcessCommunicator
-
-
   @run applet/othervm MissedHtmlAndRtfBug.html
-*/>
+-->
+
 <head>
     <title>Java 7 on mac os x only provides text clipboard formats</title>
 </head>
diff --git a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java
index 765457e..598426f 100644
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java
+++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java
@@ -22,7 +22,6 @@
  */
 
 /*
-  @test
   @bug 8005932
   @summary Java 7 on mac os x only provides text clipboard formats
   @author mikhail.cherkasov@oracle.com
@@ -30,10 +29,9 @@
   @library ../../regtesthelpers/process
   @build Util
   @build ProcessResults ProcessCommunicator
-
-
   @run applet/othervm MissedHtmlAndRtfBug.html
 */
+
 import java.awt.*;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.event.*;
diff --git a/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java b/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java
index a22551b..2edcf9d 100644
--- a/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java
+++ b/test/java/awt/Focus/TypeAhead/TestFocusFreeze.java
@@ -132,6 +132,7 @@
     }
     protected synchronized void enqueueKeyEvents(long after, Component untilFocused) {
         super.enqueueKeyEvents(after, untilFocused);
+        robot.delay(1);
         robot.keyPress(KeyEvent.VK_SPACE);
         robot.delay(50);
         robot.keyRelease(KeyEvent.VK_SPACE);
diff --git a/test/java/awt/GraphicsDevice/CheckDisplayModes.java b/test/java/awt/GraphicsDevice/CheckDisplayModes.java
index bc8d8a5..719ee9b 100644
--- a/test/java/awt/GraphicsDevice/CheckDisplayModes.java
+++ b/test/java/awt/GraphicsDevice/CheckDisplayModes.java
@@ -37,6 +37,10 @@
     public static void main(String[] args) {
         GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
         GraphicsDevice graphicDevice = ge.getDefaultScreenDevice();
+        if (!graphicDevice.isDisplayChangeSupported()) {
+            System.err.println("Display mode change is not supported on this host. Test is considered passed.");
+            return;
+        }
         DisplayMode defaultDisplayMode = graphicDevice.getDisplayMode();
         checkDisplayMode(defaultDisplayMode);
         graphicDevice.setDisplayMode(defaultDisplayMode);
diff --git a/test/java/awt/Mixing/MixingInHwPanel.java b/test/java/awt/Mixing/MixingInHwPanel.java
index 7aceebd..27b2d96 100644
--- a/test/java/awt/Mixing/MixingInHwPanel.java
+++ b/test/java/awt/Mixing/MixingInHwPanel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, 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
@@ -22,7 +22,7 @@
  */
 
 /*
-  @test %W% %E%
+  @test
   @bug 6829858
   @summary Mixing should work inside heavyweight containers
   @author anthony.petrov@sun.com: area=awt.mixing
@@ -104,7 +104,7 @@
 
         // And click the part of the button that has been previously hidden
         Point bLoc = button.getLocationOnScreen();
-        robot.mouseMove(bLoc.x + button.getWidth() - 6, bLoc.y + button.getHeight() / 2);
+        robot.mouseMove(bLoc.x + button.getWidth() - 15, bLoc.y + button.getHeight() / 2);
 
         Util.waitForIdle(robot);
 
diff --git a/test/java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java b/test/java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java
new file mode 100644
index 0000000..c27b295
--- /dev/null
+++ b/test/java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+import sun.misc.OSEnvironment;
+import test.java.awt.regtesthelpers.Util;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/*
+ * @test
+ * @bug 8013468
+ * @summary Cursor does not update properly when in fullscreen mode on Mac
+ *    The core reason of the issue was the lack of a mouse entered event in fullscreen
+ * @library ../../regtesthelpers
+ * @build Util
+ * @author Petr Pchelko area=awt.event
+ * @run main FullscreenEnterEventTest
+ */
+public class FullscreenEnterEventTest {
+
+    private static String OS = System.getProperty("os.name").toLowerCase();
+
+    private static JFrame frame;
+
+    private static volatile int mouseEnterCount = 0;
+
+    private static volatile boolean windowEnteringFullScreen = false;
+    private static volatile boolean windowEnteredFullScreen = false;
+
+    public static void main(String[] args) throws Exception {
+
+        if (!OS.contains("mac")) {
+            System.out.println("The test is applicable only to Mac OS X. Passed");
+            return;
+        }
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        //Move the mouse away from the frame and check the View-base full screen mode
+        Robot r = Util.createRobot();
+        Util.waitForIdle(r);
+        r.mouseMove(500, 500);
+        Util.waitForIdle(r);
+        mouseEnterCount = 0;
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(frame);
+            }
+        });
+        Util.waitForIdle(r);
+        if (mouseEnterCount != 1) {
+            throw new RuntimeException("No MouseEntered event for view-base full screen. Failed.");
+        }
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(null);
+            }
+        });
+
+        //Test native full screen support
+        Point fullScreenButtonPos = frame.getLocation();
+        fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
+        r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);
+        mouseEnterCount = 0;
+
+        //Cant use waitForIdle for full screen transition.
+        int waitCount = 0;
+        while (!windowEnteringFullScreen) {
+            r.mousePress(InputEvent.BUTTON1_MASK);
+            r.mouseRelease(InputEvent.BUTTON1_MASK);
+            Thread.sleep(100);
+            if (waitCount++ > 10) throw new RuntimeException("Can't enter full screen mode. Failed");
+        }
+
+        waitCount = 0;
+        while (!windowEnteredFullScreen) {
+            Thread.sleep(200);
+            if (waitCount++ > 10) throw new RuntimeException("Can't enter full screen mode. Failed");
+        }
+
+        if (mouseEnterCount != 1) {
+            throw new RuntimeException("No MouseEntered event for native full screen. Failed.");
+        }
+    }
+
+    private static void createAndShowGUI() {
+        frame = new JFrame(" Fullscreen OSX Bug ");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        enableFullScreen(frame);
+        frame.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mouseEntered(MouseEvent e) {
+                mouseEnterCount++;
+            }
+        });
+        frame.setBounds(100, 100, 100, 100);
+        frame.pack();
+        frame.setVisible(true);
+
+    }
+
+    /*
+     *  Use reflection to make a test compilable on not Mac OS X
+     */
+    private static void enableFullScreen(Window window) {
+        try {
+            Class fullScreenUtilities = Class.forName("com.apple.eawt.FullScreenUtilities");
+            Method setWindowCanFullScreen = fullScreenUtilities.getMethod("setWindowCanFullScreen", Window.class, boolean.class);
+            setWindowCanFullScreen.invoke(fullScreenUtilities, window, true);
+            Class fullScreenListener = Class.forName("com.apple.eawt.FullScreenListener");
+            Object listenerObject = Proxy.newProxyInstance(fullScreenListener.getClassLoader(), new Class[]{fullScreenListener}, new InvocationHandler() {
+                @Override
+                public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+                    switch (method.getName()) {
+                        case "windowEnteringFullScreen":
+                            windowEnteringFullScreen = true;
+                            break;
+                        case "windowEnteredFullScreen":
+                            windowEnteredFullScreen = true;
+                            break;
+                    }
+                    return null;
+                }
+            });
+            Method addFullScreenListener = fullScreenUtilities.getMethod("addFullScreenListenerTo", Window.class, fullScreenListener);
+            addFullScreenListener.invoke(fullScreenUtilities, window, listenerObject);
+        } catch (Exception e) {
+            throw new RuntimeException("FullScreen utilities not available", e);
+        }
+    }
+
+}
diff --git a/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.java b/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.java
index 71e8994..34bcbb5 100644
--- a/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.java
+++ b/test/java/awt/event/KeyEvent/KeyReleasedInAppletTest/KeyReleasedInAppletTest.java
@@ -39,7 +39,6 @@
 import java.util.Hashtable;
 
 /*
-@test
 @bug 8010009
 @summary [macosx] Unable type into online word games on MacOSX
 @author petr.pchelko : area=awt.keyboard
diff --git a/test/java/awt/font/TextLayout/KerningLeak.java b/test/java/awt/font/TextLayout/KerningLeak.java
new file mode 100644
index 0000000..fb8448c
--- /dev/null
+++ b/test/java/awt/font/TextLayout/KerningLeak.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @bug 8015334
+ * @summary Memory leak with kerning.
+ */
+
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.font.TextAttribute;
+import java.util.HashMap;
+import java.util.Map;
+import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
+
+public class KerningLeak {
+
+    public static void main(String[] args) {
+        EventQueue.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                leak();
+            }
+        });
+    }
+
+    private static void leak() {
+        Map<TextAttribute, Object> textAttributes = new HashMap<>();
+        textAttributes.put(TextAttribute.FAMILY, "Sans Serif");
+        textAttributes.put(TextAttribute.SIZE, 12);
+        textAttributes.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
+        Font font = Font.getFont(textAttributes);
+        JLabel label = new JLabel();
+        int dummy = 0;
+        for (int i = 0; i < 500; i++) {
+            if (i % 10 == 0) System.out.println("Starting iter " + (i+1));
+            for (int j = 0; j <1000; j++) {
+                FontMetrics fm = label.getFontMetrics(font);
+                dummy += SwingUtilities.computeStringWidth(fm, Integer.toString(j));
+            }
+        }
+        System.out.println("done " + dummy);
+    }
+}
diff --git a/test/javax/print/PrintServiceLookup/GetPrintServices.java b/test/javax/print/PrintServiceLookup/GetPrintServices.java
new file mode 100644
index 0000000..f8373a6
--- /dev/null
+++ b/test/javax/print/PrintServiceLookup/GetPrintServices.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.attribute.AttributeSet;
+import javax.print.attribute.HashAttributeSet;
+import javax.print.attribute.standard.PrinterName;
+
+/*
+ * @test
+ * @bug 8013810
+ * @summary Test that print service returned without filter are of the same class as with name filter
+ */
+public class GetPrintServices {
+
+  public static void main(String[] args) throws Exception {
+    for (PrintService service : PrintServiceLookup.lookupPrintServices(null, null)) {
+      String serviceName = service.getName();
+      PrintService serviceByName = lookupByName(serviceName);
+      if (!service.equals(serviceByName)) {
+        throw new RuntimeException("NOK " + serviceName
+                                   + " expected: " + service.getClass().getName()
+                                   + " got: " + serviceByName.getClass().getName());
+      }
+    }
+    System.out.println("Test PASSED");
+  }
+
+  private static PrintService lookupByName(String name) {
+    AttributeSet attributes = new HashAttributeSet();
+    attributes.add(new PrinterName(name, null));
+    for (PrintService service : PrintServiceLookup.lookupPrintServices(null, attributes)) {
+      return service;
+    }
+    return null;
+  }
+}
diff --git a/test/javax/swing/JFileChooser/8013442/Test8013442.java b/test/javax/swing/JFileChooser/8013442/Test8013442.java
new file mode 100644
index 0000000..e7b892d
--- /dev/null
+++ b/test/javax/swing/JFileChooser/8013442/Test8013442.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2013, 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 8013442
+ * @summary Tests that at least one file filter is selected
+ * @author Sergey Malenkov
+ */
+
+import java.io.File;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+import javax.swing.filechooser.FileFilter;
+
+public class Test8013442 extends FileFilter implements Runnable, Thread.UncaughtExceptionHandler {
+    private static final CountDownLatch LATCH = new CountDownLatch(1);
+
+    public static void main(String[] args) throws InterruptedException {
+        SwingUtilities.invokeLater(new Test8013442());
+        LATCH.await(); // workaround for jtreg
+    }
+
+    private int index;
+    private LookAndFeelInfo[] infos;
+    private JFileChooser chooser;
+
+    @Override
+    public boolean accept(File file) {
+        return !file.isFile() || file.getName().toLowerCase().endsWith(".txt");
+    }
+
+    @Override
+    public String getDescription() {
+        return "Text files";
+    }
+
+    @Override
+    public void run() {
+        if (this.infos == null) {
+            this.infos = UIManager.getInstalledLookAndFeels();
+            Thread.currentThread().setUncaughtExceptionHandler(this);
+        }
+        if (this.infos.length == this.index) {
+            LATCH.countDown(); // release main thread
+        } else if (this.chooser == null) {
+            // change LaF before creation of Swing components
+            LookAndFeelInfo info = this.infos[this.index];
+            System.out.println(info.getName());
+            try {
+                UIManager.setLookAndFeel(info.getClassName());
+            }
+            catch (Exception exception) {
+                throw new Error("could not change look and feel", exception);
+            }
+            // create and show new file chooser
+            JFrame frame = new JFrame(getClass().getSimpleName());
+            frame.add(this.chooser = new JFileChooser());
+            frame.setSize(800, 600);
+            frame.setLocationRelativeTo(null);
+            frame.setVisible(true);
+            SwingUtilities.invokeLater(this);
+        }
+        else {
+            int count = this.chooser.getChoosableFileFilters().length;
+            System.out.println("count = " + count + "; " + this.chooser.isAcceptAllFileFilterUsed());
+            if (count == 0) {
+                if (null != this.chooser.getFileFilter()) {
+                    throw new Error("file filter is selected");
+                }
+                // close window and stop testing file chooser for current LaF
+                SwingUtilities.getWindowAncestor(this.chooser).dispose();
+                this.chooser = null;
+                this.index++;
+            } else {
+                if (null == this.chooser.getFileFilter()) {
+                    throw new Error("file filter is not selected");
+                }
+                if (count == 2) {
+                    // remove default file filter
+                    this.chooser.setAcceptAllFileFilterUsed(false);
+                } else if (this.chooser.isAcceptAllFileFilterUsed()) {
+                    // remove add file filter
+                    this.chooser.addChoosableFileFilter(this);
+                } else {
+                    // remove custom file filter
+                    this.chooser.removeChoosableFileFilter(this);
+                }
+            }
+            SwingUtilities.invokeLater(this);
+        }
+    }
+
+    public void uncaughtException(Thread thread, Throwable throwable) {
+        throwable.printStackTrace();
+        System.exit(1);
+    }
+}
diff --git a/test/javax/swing/JMenu/4692443/bug4692443.java b/test/javax/swing/JMenu/4692443/bug4692443.java
new file mode 100644
index 0000000..6032287
--- /dev/null
+++ b/test/javax/swing/JMenu/4692443/bug4692443.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2009, 2013, 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
+ * @library ../../regtesthelpers
+ * @build Util
+ * @bug 4692443 7105030
+ * @summary JMenu: MenuListener.menuSelected() event fired too late when using mnemonics
+ * @author Alexander Zuev
+ * @run main bug4692443
+ */
+
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import sun.awt.SunToolkit;
+
+public class bug4692443 {
+
+    public static PassedListener pass;
+    public static FailedListener fail;
+    public static volatile Boolean passed;
+
+    public static void main(String args[]) throws Throwable {
+
+        fail = new FailedListener();
+        pass = new PassedListener();
+        passed = false;
+        Robot robo = new Robot();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        try {
+                robo = new Robot();
+            } catch (AWTException e) {
+                throw new RuntimeException("Robot could not be created");
+            }
+            int altKey = java.awt.event.KeyEvent.VK_ALT;
+            robo.setAutoDelay(100);
+            Util.hitMnemonics(robo, KeyEvent.VK_F); // Enter File menu
+            robo.keyPress(KeyEvent.VK_S);  // Enter submenu
+            robo.keyRelease(KeyEvent.VK_S);
+            robo.keyPress(KeyEvent.VK_O); // Launch "One" action
+            robo.keyRelease(KeyEvent.VK_O);
+            robo.keyPress(KeyEvent.VK_M); // Launch "One" action
+            robo.keyRelease(KeyEvent.VK_M);
+
+            toolkit.realSync();
+
+            if (!passed) {
+                throw new RuntimeException("Test failed.");
+            }
+
+    }
+
+    private static void createAndShowGUI() {
+        JFrame mainFrame = new JFrame("Bug 4692443");
+        JMenuBar mbar = new JMenuBar();
+        JMenu menu = new JMenu("File");
+        menu.setMnemonic('F');
+        menu.add(new JMenuItem("Menu Item 1")).setMnemonic('I');
+        final JMenu submenu = new JMenu("Submenu");
+        submenu.setMnemonic('S');
+        submenu.addMenuListener(new MenuListener() {
+            public void menuSelected(MenuEvent e) {
+                JMenuItem item = submenu.add(new JMenuItem("One", 'O'));
+                item.addActionListener(pass);
+                submenu.add(new JMenuItem("Two", 'w'));
+                submenu.add(new JMenuItem("Three", 'r'));
+            }
+            public void menuDeselected(MenuEvent e) {
+                submenu.removeAll();
+            }
+            public void menuCanceled(MenuEvent e) {
+                submenu.removeAll();
+            }
+        });
+        menu.add(submenu);
+        JMenuItem menuItem = menu.add(new JMenuItem("Menu Item 2"));
+        menuItem.setMnemonic('M');
+        menuItem.addActionListener(fail);
+        mbar.add(menu);
+        mainFrame.setJMenuBar(mbar);
+
+        mainFrame.setSize(200, 200);
+        mainFrame.setLocation(200, 200);
+        mainFrame.setVisible(true);
+        mainFrame.toFront();
+    }
+
+    public static class FailedListener implements ActionListener {
+        public void actionPerformed(ActionEvent ev) {
+            throw new RuntimeException("Test failed.");
+        }
+    }
+
+    public static class PassedListener implements ActionListener {
+        public void actionPerformed(ActionEvent ev) {
+            passed = true;
+        }
+    }
+
+}
diff --git a/test/javax/swing/JTree/8013571/Test8013571.java b/test/javax/swing/JTree/8013571/Test8013571.java
new file mode 100644
index 0000000..15ad391
--- /dev/null
+++ b/test/javax/swing/JTree/8013571/Test8013571.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+
+/*
+ * @test
+ * @bug 8016545
+ * @summary Tests beans with public fields
+ * @author Sergey Malenkov
+ */
+
+public class Test8013571 extends DefaultTreeModel {
+    public static void main(String[] args) {
+        DefaultMutableTreeNode root = create("root");
+        root.add(create("colors", "blue", "violet", "red", "yellow"));
+        root.add(create("sports", "basketball", "soccer", "football", "hockey"));
+        root.add(create("food", "hot dogs", "pizza", "ravioli", "bananas"));
+        Test8013571 model = new Test8013571(root);
+        JTree tree = new JTree(model);
+        model.fireTreeChanged(tree);
+    }
+
+    private static DefaultMutableTreeNode create(String name, String... values) {
+        DefaultMutableTreeNode node = new DefaultMutableTreeNode(name);
+        for (String value : values) {
+            node.add(create(value));
+        }
+        return node;
+    }
+
+    private Test8013571(DefaultMutableTreeNode root) {
+        super(root);
+    }
+
+    private void fireTreeChanged(Object source) {
+        fireTreeNodesInserted(source, null, null, null);
+        fireTreeNodesChanged(source, null, null, null);
+        fireTreeNodesRemoved(source, null, null, null);
+        fireTreeStructureChanged(source, null, null, null);
+    }
+}
diff --git a/test/javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java b/test/javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java
new file mode 100644
index 0000000..742fc99
--- /dev/null
+++ b/test/javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.JComboBox;
+
+/*
+ * @test
+ * @bug 8015336
+ * @summary No NPE for BasicComboBoxEditor.setItem(null)
+ * @author Sergey Malenkov
+ */
+public class Test8015336 {
+    public static void main(String[] args) throws Exception {
+        new JComboBox().getEditor().setItem(new Test8015336());
+    }
+
+    @Override
+    public String toString() {
+        return null;
+    }
+}
diff --git a/test/javax/swing/text/View/8015853/bug8015853.java b/test/javax/swing/text/View/8015853/bug8015853.java
new file mode 100644
index 0000000..f632106
--- /dev/null
+++ b/test/javax/swing/text/View/8015853/bug8015853.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2007, 2013, 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 8015853
+ * @summary  Tests the rendering of a large HTML document
+ * @author Dmitry Markov
+ * @run main bug8015853
+ */
+
+import java.io.*;
+import java.net.URL;
+import java.util.Scanner;
+import javax.swing.*;
+import javax.swing.text.html.HTMLEditorKit;
+
+public class bug8015853 {
+
+    private static String text = "";
+
+    public static void main(String[] args) throws Exception {
+
+        try {
+            URL path = ClassLoader.getSystemResource("bug8015853.txt");
+            File file = new File(path.toURI());
+            Scanner scanner = new Scanner(file);
+            while (scanner.hasNextLine()) {
+                text += scanner.nextLine() + "\n";
+            }
+            scanner.close();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+
+        text += text;
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+    }
+
+    private static void createAndShowGUI() {
+        try {
+            UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+        JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        JEditorPane editorPane = new JEditorPane();
+        HTMLEditorKit editorKit = new HTMLEditorKit();
+        editorPane.setEditorKit(editorKit);
+        editorPane.setText(text);
+
+        frame.add(editorPane);
+        frame.setVisible(true);
+    }
+}
diff --git a/test/javax/swing/text/View/8015853/bug8015853.txt b/test/javax/swing/text/View/8015853/bug8015853.txt
new file mode 100644
index 0000000..d9a6230
--- /dev/null
+++ b/test/javax/swing/text/View/8015853/bug8015853.txt
@@ -0,0 +1,67 @@
+</font><font size=2 color="#0000aa"><i>/*
+ * Copyright (c) 2007, 2013, 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.
+ */</font></i><font size=2 color=black>
+<b>import</b> java.io.*;
+<b>import</b> java.net.URL;
+<b>import</b> java.util.Scanner;
+<b>import</b> javax.swing.*;
+<b>import</b> javax.swing.text.html.HTMLEditorKit;
+<b>public</b> <b>class</b> bug8015853 {
+    <b>private</b> <b>static</b> String text = </font><font size=2 color="#00bb00">""</font><font size=2 color=black>;
+    <b>public</b> <b>static</b> <b>void</b> main(String[] args) throws Exception {
+    
+        <b>try</b> {
+            URL path = ClassLoader.getSystemResource(</font><font size=2 color="#00bb00">"bug8015853.txt"</font><font size=2 color=black>);
+            File file = <b>new</b> File(path.toURI());
+            Scanner scanner = <b>new</b> Scanner(file);
+            <b>while</b> (scanner.hasNextLine()) {
+                text += scanner.nextLine() + </font><font size=2 color="#00bb00">"\n"</font><font size=2 color=black>;
+            }
+            scanner.close();
+        } <b>catch</b> (Exception ex) {
+            <b>throw</b> <b>new</b> RuntimeException(ex);
+        }
+        
+        System.out.println(text);
+        
+        SwingUtilities.invokeAndWait(<b>new</b> Runnable() {
+            <b>public</b> <b>void</b> run() {
+                createAndShowGUI();
+            }
+        });
+    }
+    <b>private</b> <b>static</b> <b>void</b> createAndShowGUI() {
+        <b>try</b> {
+            UIManager.setLookAndFeel(</font><font size=2 color="#00bb00">"javax.swing.plaf.metal.MetalLookAndFeel"</font><font size=2 color=black>);
+        } <b>catch</b> (Exception ex) {
+            <b>throw</b> <b>new</b> RuntimeException(ex);
+        }
+        JFrame frame = <b>new</b> JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        JEditorPane editorPane = <b>new</b> JEditorPane();
+        HTMLEditorKit editorKit = <b>new</b> HTMLEditorKit();
+        editorPane.setEditorKit(editorKit);
+        editorPane.setText(text);
+        frame.add(editorPane);
+        frame.setVisible(<b>true</b>);
+    }
+}
\ No newline at end of file
diff --git a/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java b/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java
index 89bd29a..12418c0 100644
--- a/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java
+++ b/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6476665 7033534
+ * @bug 6476665 7033534 6830714
  * @summary Verifies color conversion of Component Color Model based images
  * @run main ColConvCCMTest
  */
@@ -57,9 +57,9 @@
     final static double [] ACCURACY = {
     // Accuracy for color conversions
         2.5,        // sRGB
-        6.5,        // LINEAR_RGB
+        (isOpenProfile() ? 45.0 : 10.1), // LINEAR_RGB
         10.5,       // GRAY
-        45.5,       // PYCC
+        (isOpenProfile() ? 207 : 45.5), // PYCC
         47.5        // CIEXYZ
     };
 
diff --git a/test/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java b/test/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java
index b9f85c7..9ad0568 100644
--- a/test/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java
+++ b/test/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java
@@ -62,7 +62,11 @@
         ColorSpace.CS_LINEAR_RGB,
     };
 
-    final static double ACCURACY = 2.5;
+    final static double [] ACCURACY = {
+        // Accuracy for color conversions
+        2.5, // sRGB
+        (isOpenProfile() ? 45.0 : 2.5), // LINEAR_RGB
+    };
 
     final static String [] gldImgNames = {
         "SRGB.png", "SRGB555.png", "SRGB565.png", "LRGB.png", "LRGB555.png",
@@ -142,7 +146,7 @@
 
             if (!testImage(imgTypes[i][0], imgTypes[i][1], imgTypes[i][2],
                            imgTypes[i][3], cSpaces[imgTypes[i][4]], gldImage,
-                           ACCURACY))
+                           ACCURACY[imgTypes[i][4]]))
             {
                 throw new RuntimeException(
                     "Invalid result of the ColorConvertOp for " +
@@ -154,7 +158,8 @@
 
             if (!testSubImage(SI_X, SI_Y, SI_W, SI_H, imgTypes[i][0],
                               imgTypes[i][1], imgTypes[i][2], imgTypes[i][3],
-                              cSpaces[imgTypes[i][4]], gldImage, ACCURACY))
+                              cSpaces[imgTypes[i][4]], gldImage,
+                              ACCURACY[imgTypes[i][4]]))
             {
                 throw new RuntimeException(
                     "Invalid result of the ColorConvertOp for " +
diff --git a/test/sun/java2d/cmm/ColorConvertOp/ColConvTest.java b/test/sun/java2d/cmm/ColorConvertOp/ColConvTest.java
index db37191..b3f1c2e 100644
--- a/test/sun/java2d/cmm/ColorConvertOp/ColConvTest.java
+++ b/test/sun/java2d/cmm/ColorConvertOp/ColConvTest.java
@@ -22,6 +22,7 @@
  */
 
 import java.awt.color.ColorSpace;
+import java.awt.color.ICC_Profile;
 import java.awt.image.BufferedImage;
 import java.awt.image.DataBuffer;
 
@@ -126,4 +127,33 @@
     public boolean isPassed() {
         return passed;
     }
+
+    private static Boolean isOpenProfile = null;
+
+    public static boolean isOpenProfile() {
+        if (isOpenProfile == null) {
+            ICC_Profile p = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
+
+            byte[] h = p.getData(ICC_Profile.icSigHead);
+
+            if (h == null || h.length < 128) {
+                throw new RuntimeException("Test failed: invalid sRGB header");
+            }
+
+            final byte[] lcmsID = new byte[] {
+                (byte)0x6c, // l
+                (byte)0x63, // c
+                (byte)0x6d, // m
+                (byte)0x73, // s
+            };
+
+            int off = ICC_Profile.icHdrCmmId;
+
+            isOpenProfile = ((h[off + 0] == lcmsID[0])
+                    && (h[off + 1] == lcmsID[1])
+                    && (h[off + 2] == lcmsID[2])
+                    && (h[off + 3] == lcmsID[3]));
+        }
+        return isOpenProfile;
+    }
 }