Merge
authorlana
Wed, 18 Sep 2013 16:01:37 -0700
changeset 20145 08266da0533a
parent 20144 f998f8dc5b40 (diff)
parent 19945 74049f7a28b4 (current diff)
child 20146 019d103c3e40
Merge
hotspot/src/share/vm/classfile/genericSignatures.cpp
hotspot/src/share/vm/classfile/genericSignatures.hpp
jdk/src/share/classes/java/awt/Toolkit.java
jdk/src/share/classes/java/util/stream/CloseableStream.java
jdk/src/share/classes/java/util/stream/DelegatingStream.java
jdk/src/share/classes/sun/swing/SwingUtilities2.java
jdk/src/windows/native/sun/windows/awt_PrintControl.cpp
jdk/test/java/util/Collection/ListDefaults.java
jdk/test/java/util/Map/CheckRandomHashSeed.java
jdk/test/java/util/Map/TreeBinSplitBackToEntries.java
jdk/test/java/util/concurrent/ConcurrentHashMap/toArray.java
jdk/test/sun/tools/jconsole/ImmutableResourceTest.java
jdk/test/sun/tools/jconsole/ImmutableResourceTest.sh
langtools/src/share/classes/com/sun/tools/javac/code/Annotations.java
langtools/test/tools/javac/diags/examples/CyclicInference.java
langtools/test/tools/javac/diags/examples/MrefStat.java.rej
langtools/test/tools/javac/diags/examples/MrefStat1.java.rej
langtools/test/tools/javac/lambda/TargetType10.out
langtools/test/tools/javac/lambda/typeInference/InferenceTest5.java
langtools/test/tools/javac/lambda/typeInference/InferenceTest_neg5.java
langtools/test/tools/javac/lambda/typeInference/InferenceTest_neg5.out
nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseScriptObjectMirrorIterator.java
nashorn/src/jdk/nashorn/internal/runtime/arrays/ScriptObjectMirrorIterator.java
--- a/jdk/make/bridge/AccessBridgeJava/Makefile	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/make/bridge/AccessBridgeJava/Makefile	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# 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
@@ -51,7 +51,7 @@
 #
 # Java files to compile.
 #
-FILES_java = com/sun/java/accessibility/AccessBridge.java
+FILES_java = com/sun/java/accessibility/AccessBridgeLoader.java com/sun/java/accessibility/AccessBridge.java
 
 #
 # Location for the newly built classfiles.
@@ -68,7 +68,7 @@
 build: prebuild
 
 prebuild:
-	$(CP) $(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility/$(ABPLATFORM)/AccessBridge.java \
+	$(CP) $(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility/$(ABPLATFORM)/AccessBridgeLoader.java \
 		$(CLOSED_PLATFORM_SRC)/classes/com/sun/java/accessibility
 
 all : build $(JARFILE) 
--- a/jdk/make/sun/lwawt/FILES_export_macosx.gmk	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/make/sun/lwawt/FILES_export_macosx.gmk	Wed Sep 18 16:01:37 2013 -0700
@@ -141,7 +141,6 @@
         sun/lwawt/macosx/CMenuBar.java \
         sun/lwawt/macosx/CMenuComponent.java \
         sun/lwawt/macosx/CMenuItem.java \
-        sun/lwawt/macosx/CMouseInfoPeer.java \
         sun/lwawt/macosx/CPlatformView.java \
         sun/lwawt/macosx/CPlatformWindow.java \
         sun/lwawt/macosx/CWarningWindow.java \
--- a/jdk/makefiles/CompileDemos.gmk	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/makefiles/CompileDemos.gmk	Wed Sep 18 16:01:37 2013 -0700
@@ -65,14 +65,10 @@
 $(eval $(call SetupAppletDemo,DrawTest))
 $(eval $(call SetupAppletDemo,Fractal))
 $(eval $(call SetupAppletDemo,GraphicsTest))
-$(eval $(call SetupAppletDemo,MoleculeViewer))
 $(eval $(call SetupAppletDemo,NervousText))
 $(eval $(call SetupAppletDemo,SimpleGraph))
 $(eval $(call SetupAppletDemo,SortDemo))
 $(eval $(call SetupAppletDemo,SpreadSheet))
-# Build WireFrame without a server since it
-# has a class Matrix3D that also exists in MoleculeViewer.
-$(eval $(call SetupAppletDemo,WireFrame,true))
 
 ifndef OPENJDK
     $(eval $(call SetupAppletDemo,Animator,,closed/))
@@ -83,7 +79,7 @@
 
 ##################################################################################################
 
-PATTERNS_TO_COPY=.html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf
+PATTERNS_TO_COPY=.html .txt .properties .js .gif .jpg .theme .data .opt README .c .h .png .ttf .xyz .obj
 
 define SetupDemo
     # Param 1 = Name of the demo
@@ -161,6 +157,8 @@
 
 BUILD_DEMOS+=$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services
 
+$(eval $(call SetupDemo,MoleculeViewer,applets,,XYZChemModel,,,example*.html XYZApp.java))
+$(eval $(call SetupDemo,WireFrame,applets,,ThreeD,,,example*.html ThreeD.java))
 $(eval $(call SetupDemo,FileChooserDemo,jfc,,FileChooserDemo,,,README*))
 $(eval $(call SetupDemo,Font2DTest,jfc,,Font2DTest,,,*.html *.txt))
 $(eval $(call SetupDemo,Metalworks,jfc,,Metalworks,,,README*))
--- a/jdk/makefiles/CompileJavaClasses.gmk	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/makefiles/CompileJavaClasses.gmk	Wed Sep 18 16:01:37 2013 -0700
@@ -62,6 +62,7 @@
 
       # AccessBridge is compiled separately below.
       EXFILES += AccessBridge.java \
+		 AccessBridgeLoader.java \
 		 com/sun/java/accessibility/util/java/awt/ChoiceTranslator.java
       # This seems to never be built
       EXCLUDES += com/sun/java/accessibility/extensions
--- a/jdk/makefiles/GensrcMisc.gmk	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/makefiles/GensrcMisc.gmk	Wed Sep 18 16:01:37 2013 -0700
@@ -200,26 +200,38 @@
     AB_SRC_DIR := $(JDK_TOPDIR)/src/closed/windows/classes/com/sun/java/accessibility
 
     ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+         $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridgeLoader.java: \
+			$(AB_SRC_DIR)/32bit/AccessBridgeLoader.java
+		$(install-file)
+
          $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java: \
-			$(AB_SRC_DIR)/32bit/AccessBridge.java
+			$(AB_SRC_DIR)/AccessBridge.java
+		$(install-file)
+
+         $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridgeLoader.java: \
+			$(AB_SRC_DIR)/legacy/AccessBridgeLoader.java
 		$(install-file)
 
          $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java: \
-			$(AB_SRC_DIR)/legacy/AccessBridge.java
+			$(AB_SRC_DIR)/AccessBridge.java
 		$(install-file)
 
-        GENSRC_MISC += $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java \
-		       $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java
+        GENSRC_MISC += $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridgeLoader.java \
+		       $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridgeLoader.java \
+			   $(AB_GENSRC_DIR)/32bit/com/sun/java/accessibility/AccessBridge.java \
+			   $(AB_GENSRC_DIR)/legacy/com/sun/java/accessibility/AccessBridge.java
 
     else
-         $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java: \
-			$(AB_SRC_DIR)/64bit/AccessBridge.java
+         $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridgeLoader.java: \
+			$(AB_SRC_DIR)/64bit/AccessBridgeLoader.java
 		$(install-file)
 
-         GENSRC_MISC += $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java
+         GENSRC_MISC += $(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridgeLoader.java \
+			$(AB_GENSRC_DIR)/64bit/com/sun/java/accessibility/AccessBridge.java
 
     endif
+
 endif
 endif
 
-##########################################################################################
\ No newline at end of file
+##########################################################################################
--- a/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Wed Sep 18 16:01:37 2013 -0700
@@ -42,6 +42,7 @@
 import javax.swing.plaf.*;
 import javax.swing.table.*;
 
+import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 public class AquaFileChooserUI extends FileChooserUI {
@@ -1266,64 +1267,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends DefaultListModel implements ComboBoxModel, PropertyChangeListener {
-        int selectedIndex = -1;
-
-        protected FilterComboBoxModel() {
-            super();
-            final FileFilter filters[] = getFileChooser().getChoosableFileFilters();
-            for (int i = 0; i < filters.length; i++) {
-                this.add(i, filters[i]);
-            }
-        }
-
-        public void propertyChange(final PropertyChangeEvent e) {
-            final String prop = e.getPropertyName();
-            if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                this.clear();
-                final FileFilter filters[] = (FileFilter[])e.getNewValue();
-
-                for (int i = 0; i < filters.length; i++) {
-                    this.add(i, filters[i]);
-                }
-
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                final FileFilter currentFilter = (FileFilter)e.getNewValue();
-                FileFilter filters[] = getFileChooser().getChoosableFileFilters();
-
-                boolean found = false;
-                if (currentFilter != null) {
-                    for (final FileFilter element : filters) {
-                        if (element == currentFilter) {
-                            found = true;
-                        }
-                    }
-                    if (found == false) {
-                        getFileChooser().addChoosableFileFilter(currentFilter);
-                    }
-                }
-
-                filters = getFileChooser().getChoosableFileFilters();
-                setSelectedItem(e.getNewValue());
-            }
-        }
-
-        public void setSelectedItem(final Object filter) {
-            if (filter != null) {
-                selectedIndex = this.indexOf(filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            final Object returnValue = null;
-
-            if (this.size() > 0) {
-                if ((selectedIndex != -1) && (selectedIndex < size())) { return this.get(selectedIndex); }
-            }
-
-            return returnValue;
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return AquaFileChooserUI.this.getFileChooser();
         }
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1254,6 +1254,8 @@
             KeyEvent ke = (KeyEvent) e;
             delegateEvent = new KeyEvent(getDelegateFocusOwner(), ke.getID(), ke.getWhen(),
                     ke.getModifiers(), ke.getKeyCode(), ke.getKeyChar(), ke.getKeyLocation());
+            AWTAccessor.getKeyEventAccessor().setExtendedKeyCode((KeyEvent) delegateEvent,
+                    ke.getExtendedKeyCode());
         } else if (e instanceof FocusEvent) {
             FocusEvent fe = (FocusEvent) e;
             delegateEvent = new FocusEvent(getDelegateFocusOwner(), fe.getID(), fe.isTemporary());
--- a/jdk/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/LWLightweightFramePeer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -34,6 +34,8 @@
 
 import sun.awt.CausedFocusEvent;
 import sun.awt.LightweightFrame;
+import sun.swing.JLightweightFrame;
+import sun.swing.SwingAccessor;
 
 public class LWLightweightFramePeer extends LWWindowPeer {
 
@@ -91,11 +93,6 @@
     }
 
     @Override
-    public void updateCursorImmediately() {
-        // TODO: tries to switch to the awt/fx toolkit thread and causes a deadlock on macosx
-    }
-
-    @Override
     public void addDropTarget(DropTarget dt) {
     }
 
@@ -112,4 +109,9 @@
     public void ungrab() {
         getLwTarget().ungrabFocus();
     }
+
+    @Override
+    public void updateCursorImmediately() {
+        SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
+    }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -933,7 +933,12 @@
                 focusOwner = this.getTarget();
             }
         }
-        postEvent(new KeyEvent(focusOwner, id, when, modifiers, keyCode, keyChar, keyLocation));
+
+        KeyEvent keyEvent = new KeyEvent(focusOwner, id, when, modifiers,
+            keyCode, keyChar, keyLocation);
+        AWTAccessor.getKeyEventAccessor().setExtendedKeyCode(keyEvent,
+            ExtendedKeyCodes.getExtendedKeyCodeForChar(keyChar));
+        postEvent(keyEvent);
     }
 
     // ---- UTILITY METHODS ---- //
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenu.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenu.java	Wed Sep 18 16:01:37 2013 -0700
@@ -26,9 +26,11 @@
 package sun.lwawt.macosx;
 
 import java.awt.*;
+import java.awt.peer.MenuItemPeer;
 import java.awt.peer.MenuPeer;
 
 public class CMenu extends CMenuItem implements MenuPeer {
+
     public CMenu(Menu target) {
         super(target);
     }
@@ -41,6 +43,20 @@
     }
 
     @Override
+    public final void setEnabled(final boolean b) {
+        super.setEnabled(b);
+        final Menu target = (Menu) getTarget();
+        final int count = target.getItemCount();
+        for (int i = 0; i < count; ++i) {
+            MenuItem item = target.getItem(i);
+            MenuItemPeer p = (MenuItemPeer) LWCToolkit.targetToPeer(item);
+            if (p != null) {
+                p.setEnabled(b && item.isEnabled());
+            }
+        }
+    }
+
+    @Override
     protected long createModel() {
         CMenuComponent parent = (CMenuComponent)
             LWCToolkit.targetToPeer(getTarget().getParent());
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuItem.java	Wed Sep 18 16:01:37 2013 -0700
@@ -28,17 +28,20 @@
 import sun.awt.SunToolkit;
 import sun.lwawt.LWToolkit;
 
+import java.awt.MenuContainer;
 import java.awt.MenuItem;
 import java.awt.MenuShortcut;
 import java.awt.event.*;
 import java.awt.peer.MenuItemPeer;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 public class CMenuItem extends CMenuComponent implements MenuItemPeer {
 
+    private final AtomicBoolean enabled = new AtomicBoolean(true);
+
     public CMenuItem(MenuItem target) {
         super(target);
         initialize(target);
-
     }
 
     // This way we avoiding invocation of the setters twice
@@ -124,9 +127,19 @@
         setEnabled(false);
     }
 
+    public final boolean isEnabled() {
+        return enabled.get();
+    }
+
     @Override
     public void setEnabled(boolean b) {
-        nativeSetEnabled(getModel(), b);
+        final Object parent = LWToolkit.targetToPeer(getTarget().getParent());
+        if (parent instanceof CMenuItem) {
+            b &= ((CMenuItem) parent).isEnabled();
+        }
+        if (enabled.compareAndSet(!b, b)) {
+            nativeSetEnabled(getModel(), b);
+        }
     }
 
     private native long nativeCreate(long parentMenu, boolean isSeparator);
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMouseInfoPeer.java	Wed Jul 05 19:12:21 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2011, 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.lwawt.macosx;
-
-import java.awt.Window;
-import sun.lwawt.LWMouseInfoPeer;
-import sun.lwawt.LWWindowPeer;
-
-public class CMouseInfoPeer extends LWMouseInfoPeer
-{
-    //If a new window is to appear under the cursor,
-    //we get wrong window.
-    //This is a workaround for macosx.
-    @Override
-    public boolean isWindowUnderMouse(Window w) {
-        if (w == null) {
-            return false;
-        }
-
-        return ((LWWindowPeer)w.getPeer()).getPlatformWindow().isUnderMouse();
-    }
-}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Wed Sep 18 16:01:37 2013 -0700
@@ -820,6 +820,7 @@
         }
 
         nativeSetEnabled(getNSWindowPtr(), !blocked);
+        checkBlockingAndOrder();
     }
 
     public final void invalidateShadow(){
@@ -984,7 +985,7 @@
         setStyleBits(SHOULD_BECOME_KEY | SHOULD_BECOME_MAIN, isFocusable); // set both bits at once
     }
 
-    private boolean checkBlocking() {
+    private boolean checkBlockingAndOrder() {
         LWWindowPeer blocker = (peer == null)? null : peer.getBlocker();
         if (blocker == null) {
             return false;
@@ -1040,7 +1041,7 @@
     private void windowDidBecomeMain() {
         assert CThreading.assertAppKit();
 
-        if (checkBlocking()) return;
+        if (checkBlockingAndOrder()) return;
         // If it's not blocked, make sure it's above its siblings
         orderAboveSiblings();
     }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Sep 18 16:01:37 2013 -0700
@@ -207,9 +207,9 @@
 
     @Override
     public MenuBarPeer createMenuBar(MenuBar target) {
-         MenuBarPeer peer = new CMenuBar(target);
-         targetCreatedPeer(target, peer);
-             return peer;
+        MenuBarPeer peer = new CMenuBar(target);
+        targetCreatedPeer(target, peer);
+        return peer;
     }
 
     @Override
@@ -303,11 +303,6 @@
     }
 
     @Override
-    protected MouseInfoPeer createMouseInfoPeerImpl() {
-        return new CMouseInfoPeer();
-    }
-
-    @Override
     protected int getScreenHeight() {
         return GraphicsEnvironment.getLocalGraphicsEnvironment()
                 .getDefaultScreenDevice().getDefaultConfiguration().getBounds().height;
--- a/jdk/src/macosx/native/sun/awt/AWTEvent.m	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/native/sun/awt/AWTEvent.m	Wed Sep 18 16:01:37 2013 -0700
@@ -759,7 +759,7 @@
  */
 JNIEXPORT jint JNICALL
 Java_sun_lwawt_macosx_event_NSEvent_nsToJavaChar
-(JNIEnv *env, jclass cls, char nsChar, jint modifierFlags)
+(JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags)
 {
     jchar javaChar = 0;
 
--- a/jdk/src/macosx/native/sun/awt/AWTView.m	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m	Wed Sep 18 16:01:37 2013 -0700
@@ -126,7 +126,7 @@
 
     self.cglLayer = nil;
 
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
     (*env)->DeleteGlobalRef(env, m_cPlatformView);
     m_cPlatformView = NULL;
 
@@ -387,7 +387,7 @@
         [rolloverTrackingArea release];
     }
 
-    int options = (NSTrackingActiveInActiveApp | NSTrackingMouseEnteredAndExited |
+    int options = (NSTrackingActiveAlways | NSTrackingMouseEnteredAndExited |
                    NSTrackingMouseMoved | NSTrackingEnabledDuringMouseDrag);
 
     rolloverTrackingArea = [[NSTrackingArea alloc] initWithRect:[self visibleRect]
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m	Wed Sep 18 16:01:37 2013 -0700
@@ -350,7 +350,7 @@
 - (void) dealloc {
 AWT_ASSERT_APPKIT_THREAD;
 
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
     [self.javaPlatformWindow setJObject:nil withEnv:env];
 
     self.nsWindow = nil;
@@ -366,6 +366,22 @@
 
 - (BOOL) canBecomeMainWindow {
 AWT_ASSERT_APPKIT_THREAD;
+    if(!self.isEnabled){
+        // Native system can bring up the NSWindow to
+        // the top even if the window is not main.
+        // We should bring up the modal dialog manually
+        [AWTToolkit eventCountPlusPlus];
+
+        JNIEnv *env = [ThreadUtilities getJNIEnv];
+        jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
+        if (platformWindow != NULL) {
+            static JNF_MEMBER_CACHE(jm_checkBlockingAndOrder, jc_CPlatformWindow,
+                                    "checkBlockingAndOrder", "()Z");
+            JNFCallVoidMethod(env, platformWindow, jm_checkBlockingAndOrder);
+            (*env)->DeleteLocalRef(env, platformWindow);
+        }
+    }
+
     return self.isEnabled && IS(self.styleBits, SHOULD_BECOME_MAIN);
 }
 
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -278,10 +278,11 @@
                         (JFIFMarkerSegment) findMarkerSegment
                         (JFIFMarkerSegment.class, true);
                     if (jfif == null) {
-                        throw new IIOException
-                            ("ICC APP2 encountered without prior JFIF!");
+                        newGuy = new MarkerSegment(buffer);
+                        newGuy.loadData(buffer);
+                    } else {
+                        jfif.addICC(buffer);
                     }
-                    jfif.addICC(buffer);
                     // newGuy remains null
                 } else {
                     newGuy = new MarkerSegment(buffer);
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Wed Sep 18 16:01:37 2013 -0700
@@ -41,6 +41,7 @@
 import javax.swing.table.*;
 import javax.accessibility.*;
 
+import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 import sun.swing.plaf.synth.*;
@@ -1328,71 +1329,9 @@
     /**
      * Data model for filter combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel
-            implements ComboBoxModel, PropertyChangeListener {
-        protected FileFilter[] filters;
-
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if (filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if (currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if (found == false) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if (filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public Object getElementAt(int index) {
-            if (index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if (filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return GTKFileChooserUI.this.getFileChooser();
         }
     }
 }
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Wed Sep 18 16:01:37 2013 -0700
@@ -38,6 +38,7 @@
 import java.io.IOException;
 import java.util.*;
 import sun.awt.shell.ShellFolder;
+import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 /**
@@ -777,70 +778,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
-            PropertyChangeListener {
-        protected FileFilter[] filters;
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if(prop.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if(filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if(currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if (!found) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if(filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public FileFilter getElementAt(int index) {
-            if(index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if(filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return MotifFileChooserUI.this.getFileChooser();
         }
     }
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1193,70 +1193,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
-            PropertyChangeListener {
-        protected FileFilter[] filters;
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if(filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if(currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if(found == false) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if(filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public FileFilter getElementAt(int index) {
-            if(index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if(filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return WindowsFileChooserUI.this.getFileChooser();
         }
     }
 
--- a/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Wed Sep 18 16:01:37 2013 -0700
@@ -67,7 +67,7 @@
 public class AWTKeyStroke implements Serializable {
     static final long serialVersionUID = -6430539691155161871L;
 
-    private static Map modifierKeywords;
+    private static Map<String, Integer> modifierKeywords;
     /**
      * Associates VK_XXX (as a String) with code (as Integer). This is
      * done to avoid the overhead of the reflective call to find the
@@ -85,8 +85,8 @@
      * AWTKeyStroke class.
      * Must be called under locked AWTKeyStro
      */
-    private static Class getAWTKeyStrokeClass() {
-        Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+    private static Class<AWTKeyStroke> getAWTKeyStrokeClass() {
+        Class<AWTKeyStroke> clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
         if (clazz == null) {
             clazz = AWTKeyStroke.class;
             AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class);
@@ -182,7 +182,7 @@
             throw new IllegalArgumentException("subclass cannot be null");
         }
         synchronized (AWTKeyStroke.class) {
-            Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+            Class<AWTKeyStroke> keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
             if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){
                 // Already registered
                 return;
@@ -229,8 +229,8 @@
      */
     private static Constructor getCtor(final Class clazz)
     {
-        Object ctor = AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        Constructor ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor>() {
+            public Constructor run() {
                 try {
                     Constructor ctor = clazz.getDeclaredConstructor((Class[]) null);
                     if (ctor != null) {
@@ -249,17 +249,17 @@
     private static synchronized AWTKeyStroke getCachedStroke
         (char keyChar, int keyCode, int modifiers, boolean onKeyRelease)
     {
-        Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
+        Map<AWTKeyStroke, AWTKeyStroke> cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
         AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY);
 
         if (cache == null) {
-            cache = new HashMap();
+            cache = new HashMap<>();
             AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache);
         }
 
         if (cacheKey == null) {
             try {
-                Class clazz = getAWTKeyStrokeClass();
+                Class<AWTKeyStroke> clazz = getAWTKeyStrokeClass();
                 cacheKey = (AWTKeyStroke)getCtor(clazz).newInstance((Object[]) null);
                 AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey);
             } catch (InstantiationException e) {
@@ -513,7 +513,7 @@
 
         synchronized (AWTKeyStroke.class) {
             if (modifierKeywords == null) {
-                Map uninitializedMap = new HashMap(8, 1.0f);
+                Map<String, Integer> uninitializedMap = new HashMap<>(8, 1.0f);
                 uninitializedMap.put("shift",
                                      Integer.valueOf(InputEvent.SHIFT_DOWN_MASK
                                                      |InputEvent.SHIFT_MASK));
@@ -861,12 +861,12 @@
 }
 
 class VKCollection {
-    Map code2name;
-    Map name2code;
+    Map<Integer, String> code2name;
+    Map<String, Integer> name2code;
 
     public VKCollection() {
-        code2name = new HashMap();
-        name2code = new HashMap();
+        code2name = new HashMap<>();
+        name2code = new HashMap<>();
     }
 
     public synchronized void put(String name, Integer code) {
--- a/jdk/src/share/classes/java/awt/CardLayout.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/CardLayout.java	Wed Sep 18 16:01:37 2013 -0700
@@ -66,7 +66,7 @@
      * pairs of components and their names.
      * @see java.util.Vector
      */
-    Vector vector = new Vector();
+    Vector<Card> vector = new Vector<>();
 
     /*
      * A pair of Component and String that represents its name.
@@ -570,10 +570,10 @@
 
         if (f.defaulted("vector")) {
             //  pre-1.4 stream
-            Hashtable tab = (Hashtable)f.get("tab", null);
-            vector = new Vector();
+            Hashtable<String, Component> tab = (Hashtable)f.get("tab", null);
+            vector = new Vector<>();
             if (tab != null && !tab.isEmpty()) {
-                for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) {
+                for (Enumeration<String> e = tab.keys() ; e.hasMoreElements() ; ) {
                     String key = (String)e.nextElement();
                     Component comp = (Component)tab.get(key);
                     vector.add(new Card(key, comp));
@@ -594,7 +594,7 @@
     private void writeObject(ObjectOutputStream s)
         throws IOException
     {
-        Hashtable tab = new Hashtable();
+        Hashtable<String, Component> tab = new Hashtable<>();
         int ncomponents = vector.size();
         for (int i = 0; i < ncomponents; i++) {
             Card card = (Card)vector.get(i);
--- a/jdk/src/share/classes/java/awt/Component.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Component.java	Wed Sep 18 16:01:37 2013 -0700
@@ -972,6 +972,10 @@
             public AccessControlContext getAccessControlContext(Component comp) {
                 return comp.getAccessControlContext();
             }
+
+            public void revalidateSynchronously(Component comp) {
+                comp.revalidateSynchronously();
+            }
         });
     }
 
@@ -2977,6 +2981,13 @@
      * @since 1.7
      */
     public void revalidate() {
+        revalidateSynchronously();
+    }
+
+    /**
+     * Revalidates the component synchronously.
+     */
+    final void revalidateSynchronously() {
         synchronized (getTreeLock()) {
             invalidate();
 
--- a/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java	Wed Sep 18 16:01:37 2013 -0700
@@ -85,7 +85,7 @@
      * list should be reused if possible.
      */
     transient private Container cachedRoot;
-    transient private List cachedCycle;
+    transient private List<Component> cachedCycle;
 
     /*
      * We suppose to use getFocusTraversalCycle & getComponentIndex methods in order
@@ -111,7 +111,7 @@
         return cycle.indexOf(aComponent);
     }
 
-    private void enumerateCycle(Container container, List cycle) {
+    private void enumerateCycle(Container container, List<Component> cycle) {
         if (!(container.isVisible() && container.isDisplayable())) {
             return;
         }
--- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Wed Sep 18 16:01:37 2013 -0700
@@ -808,13 +808,13 @@
             }
         }
         boolean stopPostProcessing = false;
-        java.util.List processors = getKeyEventPostProcessors();
+        java.util.List<KeyEventPostProcessor> processors = getKeyEventPostProcessors();
         if (processors != null) {
-            for (java.util.Iterator iter = processors.iterator();
+            for (java.util.Iterator<KeyEventPostProcessor> iter = processors.iterator();
                  !stopPostProcessing && iter.hasNext(); )
             {
-                stopPostProcessing = (((KeyEventPostProcessor)(iter.next())).
-                            postProcessKeyEvent(e));
+                stopPostProcessing = iter.next().
+                            postProcessKeyEvent(e);
             }
         }
         if (!stopPostProcessing) {
@@ -1059,12 +1059,12 @@
             return true;
         }
 
-        java.util.List dispatchers = getKeyEventDispatchers();
+        java.util.List<KeyEventDispatcher> dispatchers = getKeyEventDispatchers();
         if (dispatchers != null) {
-            for (java.util.Iterator iter = dispatchers.iterator();
+            for (java.util.Iterator<KeyEventDispatcher> iter = dispatchers.iterator();
                  iter.hasNext(); )
              {
-                 if (((KeyEventDispatcher)(iter.next())).
+                 if (iter.next().
                      dispatchKeyEvent(ke))
                  {
                      return true;
@@ -1131,7 +1131,7 @@
                 oppStroke = AWTKeyStroke.getAWTKeyStroke(stroke.getKeyCode(),
                                                  stroke.getModifiers(),
                                                  !stroke.isOnKeyRelease());
-            Set toTest;
+            Set<AWTKeyStroke> toTest;
             boolean contains, containsOpp;
 
             toTest = focusedComponent.getFocusTraversalKeys(
--- a/jdk/src/share/classes/java/awt/EventQueue.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/EventQueue.java	Wed Sep 18 16:01:37 2013 -0700
@@ -690,7 +690,10 @@
         final Object src = event.getSource();
         final PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
             public Void run() {
-                if (fwDispatcher == null) {
+                // In case fwDispatcher is installed and we're already on the
+                // dispatch thread (e.g. performing DefaultKeyboardFocusManager.sendMessage),
+                // dispatch the event straight away.
+                if (fwDispatcher == null || isDispatchThreadImpl()) {
                     dispatchEventImpl(event, src);
                 } else {
                     fwDispatcher.scheduleDispatch(new Runnable() {
--- a/jdk/src/share/classes/java/awt/GradientPaintContext.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/GradientPaintContext.java	Wed Sep 18 16:01:37 2013 -0700
@@ -41,7 +41,7 @@
         new DirectColorModel(24, 0x000000ff, 0x0000ff00, 0x00ff0000);
 
     static ColorModel cachedModel;
-    static WeakReference cached;
+    static WeakReference<Raster> cached;
 
     static synchronized Raster getCachedRaster(ColorModel cm, int w, int h) {
         if (cm == cachedModel) {
@@ -76,7 +76,7 @@
             }
         }
         cachedModel = cm;
-        cached = new WeakReference(ras);
+        cached = new WeakReference<>(ras);
     }
 
     double x1;
--- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Wed Sep 18 16:01:37 2013 -0700
@@ -95,18 +95,18 @@
         String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
         try {
 //          long t0 = System.currentTimeMillis();
-            Class geCls;
+            Class<GraphicsEnvironment> geCls;
             try {
                 // First we try if the bootclassloader finds the requested
                 // class. This way we can avoid to run in a privileged block.
-                geCls = Class.forName(nm);
+                geCls = (Class<GraphicsEnvironment>)Class.forName(nm);
             } catch (ClassNotFoundException ex) {
                 // If the bootclassloader fails, we try again with the
                 // application classloader.
                 ClassLoader cl = ClassLoader.getSystemClassLoader();
-                geCls = Class.forName(nm, true, cl);
+                geCls = (Class<GraphicsEnvironment>)Class.forName(nm, true, cl);
             }
-            ge = (GraphicsEnvironment) geCls.newInstance();
+            ge = geCls.newInstance();
 //          long t1 = System.currentTimeMillis();
 //          System.out.println("GE creation took " + (t1-t0)+ "ms.");
             if (isHeadless()) {
@@ -161,7 +161,7 @@
     private static boolean getHeadlessProperty() {
         if (headless == null) {
             java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
+            new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     String nm = System.getProperty("java.awt.headless");
 
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Wed Sep 18 16:01:37 2013 -0700
@@ -348,7 +348,7 @@
      * Component of those Windows that has no such array of its own explicitly
      * set.
      */
-    private Set[] defaultFocusTraversalKeys = new Set[4];
+    private Set<AWTKeyStroke>[] defaultFocusTraversalKeys = new Set[4];
 
     /**
      * The current focus cycle root. If the focus owner is itself a focus cycle
@@ -376,7 +376,7 @@
      * KeyEventDispatchers are registered, this field may be null or refer to
      * a List of length 0.
      */
-    private java.util.LinkedList keyEventDispatchers;
+    private java.util.LinkedList<KeyEventDispatcher> keyEventDispatchers;
 
     /**
      * This KeyboardFocusManager's KeyEventPostProcessor chain. The List does
@@ -385,12 +385,12 @@
      * If no other KeyEventPostProcessors are registered, this field may be
      * null or refer to a List of length 0.
      */
-    private java.util.LinkedList keyEventPostProcessors;
+    private java.util.LinkedList<KeyEventPostProcessor> keyEventPostProcessors;
 
     /**
      * Maps Windows to those Windows' most recent focus owners.
      */
-    private static java.util.Map mostRecentFocusOwners = new WeakHashMap();
+    private static java.util.Map<Window, WeakReference<Component>> mostRecentFocusOwners = new WeakHashMap<>();
 
     /**
      * We cache the permission used to verify that the calling thread is
@@ -431,7 +431,7 @@
      */
     public KeyboardFocusManager() {
         for (int i = 0; i < TRAVERSAL_KEY_LENGTH; i++) {
-            Set work_set = new HashSet();
+            Set<AWTKeyStroke> work_set = new HashSet<>();
             for (int j = 0; j < defaultFocusTraversalKeyStrokes[i].length; j++) {
                 work_set.add(defaultFocusTraversalKeyStrokes[i][j]);
             }
@@ -1125,7 +1125,7 @@
             throw new IllegalArgumentException("cannot set null Set of default focus traversal keys");
         }
 
-        Set oldKeys;
+        Set<AWTKeyStroke> oldKeys;
 
         synchronized (this) {
             for (AWTKeyStroke keystroke : keystrokes) {
@@ -1153,7 +1153,7 @@
 
             oldKeys = defaultFocusTraversalKeys[id];
             defaultFocusTraversalKeys[id] =
-                Collections.unmodifiableSet(new HashSet(keystrokes));
+                Collections.unmodifiableSet(new HashSet<>(keystrokes));
         }
 
         firePropertyChange(defaultFocusTraversalKeyPropertyNames[id],
@@ -1699,7 +1699,7 @@
         if (dispatcher != null) {
             synchronized (this) {
                 if (keyEventDispatchers == null) {
-                    keyEventDispatchers = new java.util.LinkedList();
+                    keyEventDispatchers = new java.util.LinkedList<>();
                 }
                 keyEventDispatchers.add(dispatcher);
             }
@@ -1787,7 +1787,7 @@
         if (processor != null) {
             synchronized (this) {
                 if (keyEventPostProcessors == null) {
-                    keyEventPostProcessors = new java.util.LinkedList();
+                    keyEventPostProcessors = new java.util.LinkedList<>();
                 }
                 keyEventPostProcessors.add(processor);
             }
@@ -1865,9 +1865,9 @@
         // of Component.parent fields.  Since WeakHasMap refers to its
         // values strongly, we need to break the strong link from the
         // value (component) back to its key (window).
-        WeakReference weakValue = null;
+        WeakReference<Component> weakValue = null;
         if (component != null) {
-            weakValue = new WeakReference(component);
+            weakValue = new WeakReference<>(component);
         }
         mostRecentFocusOwners.put(window, weakValue);
     }
@@ -1906,7 +1906,7 @@
      * javax.swing.JComponent.runInputVerifier() using reflection.
      */
     static synchronized Component getMostRecentFocusOwner(Window window) {
-        WeakReference weakValue =
+        WeakReference<Component> weakValue =
             (WeakReference)mostRecentFocusOwners.get(window);
         return weakValue == null ? null : (Component)weakValue.get();
     }
@@ -2649,11 +2649,11 @@
                 Component lastFocusOwner = null;
                 Component currentFocusOwner = null;
 
-                for (Iterator iter = localLightweightRequests.iterator(); iter.hasNext(); ) {
+                for (Iterator<KeyboardFocusManager.LightweightFocusRequest> iter = localLightweightRequests.iterator(); iter.hasNext(); ) {
 
                     currentFocusOwner = manager.getGlobalFocusOwner();
                     LightweightFocusRequest lwFocusRequest =
-                        (LightweightFocusRequest)iter.next();
+                        iter.next();
 
                     /*
                      * WARNING: This is based on DKFM's logic solely!
@@ -2978,12 +2978,12 @@
             if (hwFocusRequest != null) {
                 heavyweightRequests.removeFirst();
                 if (hwFocusRequest.lightweightRequests != null) {
-                    for (Iterator lwIter = hwFocusRequest.lightweightRequests.
+                    for (Iterator<KeyboardFocusManager.LightweightFocusRequest> lwIter = hwFocusRequest.lightweightRequests.
                              iterator();
                          lwIter.hasNext(); )
                     {
                         manager.dequeueKeyEvents
-                            (-1, ((LightweightFocusRequest)lwIter.next()).
+                            (-1, lwIter.next().
                              component);
                     }
                 }
@@ -3063,8 +3063,8 @@
     // Accessor to private field isProxyActive of KeyEvent
     private static boolean isProxyActiveImpl(KeyEvent e) {
         if (proxyActive == null) {
-            proxyActive = (Field) AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
+            proxyActive =  AccessController.doPrivileged(new PrivilegedAction<Field>() {
+                    public Field run() {
                         Field field = null;
                         try {
                             field = KeyEvent.class.getDeclaredField("isProxyActive");
--- a/jdk/src/share/classes/java/awt/Scrollbar.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Scrollbar.java	Wed Sep 18 16:01:37 2013 -0700
@@ -715,6 +715,9 @@
      * The unit increment must be greater than zero.
      * Attepts to set the unit increment to a value lower than 1
      * will result in a value of 1 being set.
+     * <p>
+     * In some operating systems, this property
+     * can be ignored by the underlying controls.
      *
      * @param        v  the amount by which to increment or decrement
      *                         the scroll bar's value
@@ -752,6 +755,9 @@
      * scroll bar, generally through a mouse or keyboard gesture
      * that the scroll bar receives as an adjustment event.
      * The unit increment must be greater than zero.
+     * <p>
+     * In some operating systems, this property
+     * can be ignored by the underlying controls.
      *
      * @return      the unit increment of this scroll bar
      * @see         java.awt.Scrollbar#setUnitIncrement
--- a/jdk/src/share/classes/java/awt/SequencedEvent.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/SequencedEvent.java	Wed Sep 18 16:01:37 2013 -0700
@@ -49,7 +49,7 @@
 
     private static final int ID =
         java.awt.event.FocusEvent.FOCUS_LAST + 1;
-    private static final LinkedList list = new LinkedList();
+    private static final LinkedList<SequencedEvent> list = new LinkedList<>();
 
     private final AWTEvent nested;
     private AppContext appContext;
--- a/jdk/src/share/classes/java/awt/TexturePaintContext.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/TexturePaintContext.java	Wed Sep 18 16:01:37 2013 -0700
@@ -73,11 +73,11 @@
         WritableRaster raster = bufImg.getRaster();
         ColorModel cm = bufImg.getColorModel();
         int maxw = devBounds.width;
-        Object val = hints.get(hints.KEY_INTERPOLATION);
+        Object val = hints.get(RenderingHints.KEY_INTERPOLATION);
         boolean filter =
             (val == null
-             ? (hints.get(hints.KEY_RENDERING) == hints.VALUE_RENDER_QUALITY)
-             : (val != hints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
+             ? (hints.get(RenderingHints.KEY_RENDERING) == RenderingHints.VALUE_RENDER_QUALITY)
+             : (val != RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
         if (raster instanceof IntegerInterleavedRaster &&
             (!filter || isFilterableDCM(cm)))
         {
@@ -234,8 +234,8 @@
         return outRas;
     }
 
-    private static WeakReference xrgbRasRef;
-    private static WeakReference argbRasRef;
+    private static WeakReference<Raster> xrgbRasRef;
+    private static WeakReference<Raster> argbRasRef;
 
     synchronized static WritableRaster makeRaster(ColorModel cm,
                                                   Raster srcRas,
@@ -278,13 +278,13 @@
             return;
         }
         if (xrgbmodel == cm) {
-            xrgbRasRef = new WeakReference(outRas);
+            xrgbRasRef = new WeakReference<>(outRas);
         } else if (argbmodel == cm) {
-            argbRasRef = new WeakReference(outRas);
+            argbRasRef = new WeakReference<>(outRas);
         }
     }
 
-    private static WeakReference byteRasRef;
+    private static WeakReference<Raster> byteRasRef;
 
     synchronized static WritableRaster makeByteRaster(Raster srcRas,
                                                       int w, int h)
@@ -307,7 +307,7 @@
         if (outRas == null) {
             return;
         }
-        byteRasRef = new WeakReference(outRas);
+        byteRasRef = new WeakReference<>(outRas);
     }
 
     public abstract WritableRaster makeRaster(int w, int h);
--- a/jdk/src/share/classes/java/awt/Toolkit.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/Toolkit.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1239,7 +1239,8 @@
     }
 
     /**
-     * Emits an audio beep.
+     * Emits an audio beep depending on native system settings and hardware
+     * capabilities.
      * @since     JDK1.1
      */
     public abstract void beep();
--- a/jdk/src/share/classes/java/awt/WaitDispatchSupport.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/WaitDispatchSupport.java	Wed Sep 18 16:01:37 2013 -0700
@@ -224,8 +224,8 @@
             // starts. Thus, the enter() method will not hang.
             //
             // Event pump should be privileged. See 6300270.
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                public Void run() {
                     run.run();
                     return null;
                 }
--- a/jdk/src/share/classes/java/awt/dnd/DropTarget.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/awt/dnd/DropTarget.java	Wed Sep 18 16:01:37 2013 -0700
@@ -351,6 +351,8 @@
      * @see #isActive
      */
     public synchronized void dragEnter(DropTargetDragEvent dtde) {
+        isDraggingInside = true;
+
         if (!active) return;
 
         if (dtListener != null) {
@@ -421,6 +423,8 @@
      * @see #isActive
      */
     public synchronized void dragExit(DropTargetEvent dte) {
+        isDraggingInside = false;
+
         if (!active) return;
 
         if (dtListener != null && active) dtListener.dragExit(dte);
@@ -444,6 +448,8 @@
      * @see #isActive
      */
     public synchronized void drop(DropTargetDropEvent dtde) {
+        isDraggingInside = false;
+
         clearAutoscroll();
 
         if (dtListener != null && active)
@@ -533,6 +539,12 @@
             ((DropTargetPeer)nativePeer).removeDropTarget(this);
 
         componentPeer = nativePeer = null;
+
+        synchronized (this) {
+            if (isDraggingInside) {
+                dragExit(new DropTargetEvent(getDropTargetContext()));
+            }
+        }
     }
 
     /**
@@ -855,4 +867,9 @@
      */
 
     private transient FlavorMap flavorMap;
+
+    /*
+     * If the dragging is currently inside this drop target
+     */
+    private transient boolean isDraggingInside;
 }
--- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java	Wed Sep 18 16:01:37 2013 -0700
@@ -149,6 +149,7 @@
      * @return An expression whose value is <code>oldInstance</code>.
      *
      * @throws NullPointerException if {@code out} is {@code null}
+     *                              and this value is used in the method
      *
      * @see #DefaultPersistenceDelegate(String[])
      */
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Wed Sep 18 16:01:37 2013 -0700
@@ -41,8 +41,8 @@
 public class IndexedPropertyDescriptor extends PropertyDescriptor {
 
     private Reference<? extends Class<?>> indexedPropertyTypeRef;
-    private Reference<Method> indexedReadMethodRef;
-    private Reference<Method> indexedWriteMethodRef;
+    private final MethodRef indexedReadMethodRef = new MethodRef();
+    private final MethodRef indexedWriteMethodRef = new MethodRef();
 
     private String indexedReadMethodName;
     private String indexedWriteMethodName;
@@ -173,11 +173,11 @@
      * May return null if the property isn't indexed or is write-only.
      */
     public synchronized Method getIndexedReadMethod() {
-        Method indexedReadMethod = getIndexedReadMethod0();
+        Method indexedReadMethod = this.indexedReadMethodRef.get();
         if (indexedReadMethod == null) {
             Class<?> cls = getClass0();
             if (cls == null ||
-                (indexedReadMethodName == null && indexedReadMethodRef == null)) {
+                (indexedReadMethodName == null && !this.indexedReadMethodRef.isSet())) {
                 // the Indexed readMethod was explicitly set to null.
                 return null;
             }
@@ -215,20 +215,19 @@
 
         // the indexed property type is set by the reader.
         setIndexedPropertyType(findIndexedPropertyType(readMethod,
-                                                       getIndexedWriteMethod0()));
+                                                       this.indexedWriteMethodRef.get()));
         setIndexedReadMethod0(readMethod);
     }
 
     private void setIndexedReadMethod0(Method readMethod) {
+        this.indexedReadMethodRef.set(readMethod);
         if (readMethod == null) {
             indexedReadMethodName = null;
-            indexedReadMethodRef = null;
             return;
         }
         setClass0(readMethod.getDeclaringClass());
 
         indexedReadMethodName = readMethod.getName();
-        this.indexedReadMethodRef = getSoftReference(readMethod);
         setTransient(readMethod.getAnnotation(Transient.class));
     }
 
@@ -241,11 +240,11 @@
      * May return null if the property isn't indexed or is read-only.
      */
     public synchronized Method getIndexedWriteMethod() {
-        Method indexedWriteMethod = getIndexedWriteMethod0();
+        Method indexedWriteMethod = this.indexedWriteMethodRef.get();
         if (indexedWriteMethod == null) {
             Class<?> cls = getClass0();
             if (cls == null ||
-                (indexedWriteMethodName == null && indexedWriteMethodRef == null)) {
+                (indexedWriteMethodName == null && !this.indexedWriteMethodRef.isSet())) {
                 // the Indexed writeMethod was explicitly set to null.
                 return null;
             }
@@ -301,15 +300,14 @@
     }
 
     private void setIndexedWriteMethod0(Method writeMethod) {
+        this.indexedWriteMethodRef.set(writeMethod);
         if (writeMethod == null) {
             indexedWriteMethodName = null;
-            indexedWriteMethodRef = null;
             return;
         }
         setClass0(writeMethod.getDeclaringClass());
 
         indexedWriteMethodName = writeMethod.getName();
-        this.indexedWriteMethodRef = getSoftReference(writeMethod);
         setTransient(writeMethod.getAnnotation(Transient.class));
     }
 
@@ -349,18 +347,6 @@
                 : null;
     }
 
-    private Method getIndexedReadMethod0() {
-        return (this.indexedReadMethodRef != null)
-                ? this.indexedReadMethodRef.get()
-                : null;
-    }
-
-    private Method getIndexedWriteMethod0() {
-        return (this.indexedWriteMethodRef != null)
-                ? this.indexedWriteMethodRef.get()
-                : null;
-    }
-
     private Class<?> findIndexedPropertyType(Method indexedReadMethod,
                                           Method indexedWriteMethod)
         throws IntrospectionException {
@@ -492,8 +478,8 @@
      */
     IndexedPropertyDescriptor(IndexedPropertyDescriptor old) {
         super(old);
-        indexedReadMethodRef = old.indexedReadMethodRef;
-        indexedWriteMethodRef = old.indexedWriteMethodRef;
+        this.indexedReadMethodRef.set(old.indexedReadMethodRef.get());
+        this.indexedWriteMethodRef.set(old.indexedWriteMethodRef.get());
         indexedPropertyTypeRef = old.indexedPropertyTypeRef;
         indexedWriteMethodName = old.indexedWriteMethodName;
         indexedReadMethodName = old.indexedReadMethodName;
@@ -502,7 +488,7 @@
     void updateGenericsFor(Class<?> type) {
         super.updateGenericsFor(type);
         try {
-            setIndexedPropertyType(findIndexedPropertyType(getIndexedReadMethod0(), getIndexedWriteMethod0()));
+            setIndexedPropertyType(findIndexedPropertyType(this.indexedReadMethodRef.get(), this.indexedWriteMethodRef.get()));
         }
         catch (IntrospectionException exception) {
             setIndexedPropertyType(null);
@@ -532,7 +518,7 @@
     void appendTo(StringBuilder sb) {
         super.appendTo(sb);
         appendTo(sb, "indexedPropertyType", this.indexedPropertyTypeRef);
-        appendTo(sb, "indexedReadMethod", this.indexedReadMethodRef);
-        appendTo(sb, "indexedWriteMethod", this.indexedWriteMethodRef);
+        appendTo(sb, "indexedReadMethod", this.indexedReadMethodRef.get());
+        appendTo(sb, "indexedWriteMethod", this.indexedWriteMethodRef.get());
     }
 }
--- a/jdk/src/share/classes/java/beans/MethodDescriptor.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java	Wed Sep 18 16:01:37 2013 -0700
@@ -38,7 +38,7 @@
 
 public class MethodDescriptor extends FeatureDescriptor {
 
-    private Reference<Method> methodRef;
+    private final MethodRef methodRef = new MethodRef();
 
     private String[] paramNames;
 
@@ -81,7 +81,7 @@
      * @return The low-level description of the method
      */
     public synchronized Method getMethod() {
-        Method method = getMethod0();
+        Method method = this.methodRef.get();
         if (method == null) {
             Class<?> cls = getClass0();
             String name = getName();
@@ -114,13 +114,7 @@
             setClass0(method.getDeclaringClass());
         }
         setParams(getParameterTypes(getClass0(), method));
-        this.methodRef = getSoftReference(method);
-    }
-
-    private Method getMethod0() {
-        return (this.methodRef != null)
-                ? this.methodRef.get()
-                : null;
+        this.methodRef.set(method);
     }
 
     private synchronized void setParams(Class<?>[] param) {
@@ -177,12 +171,10 @@
      */
 
     MethodDescriptor(MethodDescriptor x, MethodDescriptor y) {
-        super(x,y);
+        super(x, y);
 
-        methodRef = x.methodRef;
-        if (y.methodRef != null) {
-            methodRef = y.methodRef;
-        }
+        Method method = y.methodRef.get();
+        this.methodRef.set(null != method ? method : x.methodRef.get());
         params = x.params;
         if (y.params != null) {
             params = y.params;
@@ -205,7 +197,7 @@
     MethodDescriptor(MethodDescriptor old) {
         super(old);
 
-        methodRef = old.methodRef;
+        this.methodRef.set(old.getMethod());
         params = old.params;
         paramNames = old.paramNames;
 
@@ -219,7 +211,7 @@
     }
 
     void appendTo(StringBuilder sb) {
-        appendTo(sb, "method", this.methodRef);
+        appendTo(sb, "method", this.methodRef.get());
         if (this.parameterDescriptors != null) {
             sb.append("; parameterDescriptors={");
             for (ParameterDescriptor pd : this.parameterDescriptors) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/beans/MethodRef.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,87 @@
+/*
+ * 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 java.beans;
+
+import java.lang.ref.SoftReference;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.Method;
+
+import static sun.reflect.misc.ReflectUtil.isPackageAccessible;
+
+final class MethodRef {
+    private String signature;
+    private SoftReference<Method> methodRef;
+    private WeakReference<Class<?>> typeRef;
+
+    void set(Method method) {
+        if (method == null) {
+            this.signature = null;
+            this.methodRef = null;
+            this.typeRef = null;
+        }
+        else {
+            this.signature = method.toGenericString();
+            this.methodRef = new SoftReference<>(method);
+            this.typeRef = new WeakReference<Class<?>>(method.getDeclaringClass());
+        }
+    }
+
+    boolean isSet() {
+        return this.methodRef != null;
+    }
+
+    Method get() {
+        if (this.methodRef == null) {
+            return null;
+        }
+        Method method = this.methodRef.get();
+        if (method == null) {
+            method = find(this.typeRef.get(), this.signature);
+            if (method == null) {
+                this.signature = null;
+                this.methodRef = null;
+                this.typeRef = null;
+            }
+            else {
+                this.methodRef = new SoftReference<>(method);
+            }
+        }
+        return isPackageAccessible(method.getDeclaringClass()) ? method : null;
+    }
+
+    private static Method find(Class<?> type, String signature) {
+        if (type != null) {
+            for (Method method : type.getMethods()) {
+                if (type.equals(method.getDeclaringClass())) {
+                    if (method.toGenericString().equals(signature)) {
+                        return method;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+}
--- a/jdk/src/share/classes/java/beans/PersistenceDelegate.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/beans/PersistenceDelegate.java	Wed Sep 18 16:01:37 2013 -0700
@@ -162,6 +162,7 @@
      * @return An expression whose value is <code>oldInstance</code>.
      *
      * @throws NullPointerException if {@code out} is {@code null}
+     *                              and this value is used in the method
      */
     protected abstract Expression instantiate(Object oldInstance, Encoder out);
 
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Wed Sep 18 16:01:37 2013 -0700
@@ -36,8 +36,8 @@
 public class PropertyDescriptor extends FeatureDescriptor {
 
     private Reference<? extends Class<?>> propertyTypeRef;
-    private Reference<Method> readMethodRef;
-    private Reference<Method> writeMethodRef;
+    private final MethodRef readMethodRef = new MethodRef();
+    private final MethodRef writeMethodRef = new MethodRef();
     private Reference<? extends Class<?>> propertyEditorClassRef;
 
     private boolean bound;
@@ -68,8 +68,8 @@
     public PropertyDescriptor(String propertyName, Class<?> beanClass)
                 throws IntrospectionException {
         this(propertyName, beanClass,
-             Introspector.IS_PREFIX + NameGenerator.capitalize(propertyName),
-             Introspector.SET_PREFIX + NameGenerator.capitalize(propertyName));
+                Introspector.IS_PREFIX + NameGenerator.capitalize(propertyName),
+                Introspector.SET_PREFIX + NameGenerator.capitalize(propertyName));
     }
 
     /**
@@ -203,10 +203,10 @@
      * May return null if the property can't be read.
      */
     public synchronized Method getReadMethod() {
-        Method readMethod = getReadMethod0();
+        Method readMethod = this.readMethodRef.get();
         if (readMethod == null) {
             Class<?> cls = getClass0();
-            if (cls == null || (readMethodName == null && readMethodRef == null)) {
+            if (cls == null || (readMethodName == null && !this.readMethodRef.isSet())) {
                 // The read method was explicitly set to null.
                 return null;
             }
@@ -247,17 +247,16 @@
      */
     public synchronized void setReadMethod(Method readMethod)
                                 throws IntrospectionException {
+        this.readMethodRef.set(readMethod);
         if (readMethod == null) {
             readMethodName = null;
-            readMethodRef = null;
             return;
         }
         // The property type is determined by the read method.
-        setPropertyType(findPropertyType(readMethod, getWriteMethod0()));
+        setPropertyType(findPropertyType(readMethod, this.writeMethodRef.get()));
         setClass0(readMethod.getDeclaringClass());
 
         readMethodName = readMethod.getName();
-        this.readMethodRef = getSoftReference(readMethod);
         setTransient(readMethod.getAnnotation(Transient.class));
     }
 
@@ -268,10 +267,10 @@
      * May return null if the property can't be written.
      */
     public synchronized Method getWriteMethod() {
-        Method writeMethod = getWriteMethod0();
+        Method writeMethod = this.writeMethodRef.get();
         if (writeMethod == null) {
             Class<?> cls = getClass0();
-            if (cls == null || (writeMethodName == null && writeMethodRef == null)) {
+            if (cls == null || (writeMethodName == null && !this.writeMethodRef.isSet())) {
                 // The write method was explicitly set to null.
                 return null;
             }
@@ -318,9 +317,9 @@
      */
     public synchronized void setWriteMethod(Method writeMethod)
                                 throws IntrospectionException {
+        this.writeMethodRef.set(writeMethod);
         if (writeMethod == null) {
             writeMethodName = null;
-            writeMethodRef = null;
             return;
         }
         // Set the property type - which validates the method
@@ -328,22 +327,9 @@
         setClass0(writeMethod.getDeclaringClass());
 
         writeMethodName = writeMethod.getName();
-        this.writeMethodRef = getSoftReference(writeMethod);
         setTransient(writeMethod.getAnnotation(Transient.class));
     }
 
-    private Method getReadMethod0() {
-        return (this.readMethodRef != null)
-                ? this.readMethodRef.get()
-                : null;
-    }
-
-    private Method getWriteMethod0() {
-        return (this.writeMethodRef != null)
-                ? this.writeMethodRef.get()
-                : null;
-    }
-
     /**
      * Overridden to ensure that a super class doesn't take precedent
      */
@@ -617,8 +603,8 @@
     PropertyDescriptor(PropertyDescriptor old) {
         super(old);
         propertyTypeRef = old.propertyTypeRef;
-        readMethodRef = old.readMethodRef;
-        writeMethodRef = old.writeMethodRef;
+        this.readMethodRef.set(old.readMethodRef.get());
+        this.writeMethodRef.set(old.writeMethodRef.get());
         propertyEditorClassRef = old.propertyEditorClassRef;
 
         writeMethodName = old.writeMethodName;
@@ -632,7 +618,7 @@
     void updateGenericsFor(Class<?> type) {
         setClass0(type);
         try {
-            setPropertyType(findPropertyType(getReadMethod0(), getWriteMethod0()));
+            setPropertyType(findPropertyType(this.readMethodRef.get(), this.writeMethodRef.get()));
         }
         catch (IntrospectionException exception) {
             setPropertyType(null);
@@ -723,8 +709,8 @@
         appendTo(sb, "constrained", this.constrained);
         appendTo(sb, "propertyEditorClass", this.propertyEditorClassRef);
         appendTo(sb, "propertyType", this.propertyTypeRef);
-        appendTo(sb, "readMethod", this.readMethodRef);
-        appendTo(sb, "writeMethod", this.writeMethodRef);
+        appendTo(sb, "readMethod", this.readMethodRef.get());
+        appendTo(sb, "writeMethod", this.writeMethodRef.get());
     }
 
     private boolean isAssignable(Method m1, Method m2) {
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java	Wed Sep 18 16:01:37 2013 -0700
@@ -57,7 +57,7 @@
  * be used in implementations:
  *
  * <table border=1>
- *  <caption>Audio File Format Property Keys</caption>
+ *  <caption>Audio File Format Properties</caption>
  *  <tr>
  *   <th>Property key</th>
  *   <th>Value type</th>
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java	Wed Sep 18 16:01:37 2013 -0700
@@ -85,7 +85,7 @@
  * service providers should use, if applicable:
  *
  * <table border=0>
- *  <caption>Audio Format Property Keys</caption>
+ *  <caption>Audio Format Properties</caption>
  *  <tr>
  *   <th>Property key</th>
  *   <th>Value type</th>
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java	Wed Sep 18 16:01:37 2013 -0700
@@ -362,6 +362,7 @@
      */
     protected void setup(FileSystemView view) {
         installShowFilesListener();
+        installHierarchyListener();
 
         if(view == null) {
             view = FileSystemView.getFileSystemView();
@@ -374,6 +375,22 @@
         enableEvents(AWTEvent.MOUSE_EVENT_MASK);
     }
 
+    private void installHierarchyListener() {
+        addHierarchyListener(new HierarchyListener() {
+            @Override
+            public void hierarchyChanged(HierarchyEvent e) {
+                if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED)
+                        == HierarchyEvent.PARENT_CHANGED) {
+                    JFileChooser fc = JFileChooser.this;
+                    JRootPane rootPane = SwingUtilities.getRootPane(fc);
+                    if (rootPane != null) {
+                        rootPane.setDefaultButton(fc.getUI().getDefaultButton(fc));
+                    }
+                }
+            }
+        });
+    }
+
     private void installShowFilesListener() {
         // Track native setting for showing hidden files
         Toolkit tk = Toolkit.getDefaultToolkit();
@@ -801,7 +818,6 @@
                 dialog.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG);
             }
         }
-        dialog.getRootPane().setDefaultButton(ui.getDefaultButton(this));
         dialog.pack();
         dialog.setLocationRelativeTo(parent);
 
--- a/jdk/src/share/classes/javax/swing/JScrollBar.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JScrollBar.java	Wed Sep 18 16:01:37 2013 -0700
@@ -344,6 +344,9 @@
      * that override this method and delegate to the viewports
      * Scrollable view, if it has one.  The Scrollable interface
      * provides a more specialized version of this method.
+     * <p>
+     * Some look and feels implement custom scrolling behavior
+     * and ignore this property.
      *
      * @param direction is -1 or 1 for up/down respectively
      * @return the value of the unitIncrement property
@@ -361,6 +364,10 @@
      * <p>
      * Note, that if the argument is equal to the value of Integer.MIN_VALUE,
      * the most look and feels will not provide the scrolling to the right/down.
+     * <p>
+     * Some look and feels implement custom scrolling behavior
+     * and ignore this property.
+     *
      * @see #getUnitIncrement
      * @beaninfo
      *   preferred: true
@@ -387,6 +394,9 @@
      * that override this method and delegate to the viewports
      * Scrollable view, if it has one.  The Scrollable interface
      * provides a more specialized version of this method.
+     * <p>
+     * Some look and feels implement custom scrolling behavior
+     * and ignore this property.
      *
      * @param direction is -1 or 1 for up/down respectively
      * @return the value of the blockIncrement property
@@ -404,6 +414,10 @@
      * <p>
      * Note, that if the argument is equal to the value of Integer.MIN_VALUE,
      * the most look and feels will not provide the scrolling to the right/down.
+     * <p>
+     * Some look and feels implement custom scrolling behavior
+     * and ignore this property.
+     *
      * @see #getBlockIncrement()
      * @beaninfo
      *   preferred: true
--- a/jdk/src/share/classes/javax/swing/JViewport.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JViewport.java	Wed Sep 18 16:01:37 2013 -0700
@@ -25,6 +25,8 @@
 
 package javax.swing;
 
+import sun.swing.JLightweightFrame;
+
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.peer.ComponentPeer;
@@ -361,6 +363,17 @@
         super.remove(child);
     }
 
+    @Override
+    public void addNotify() {
+        super.addNotify();
+        // JLightweightFrame does not support BLIT_SCROLL_MODE, so it should be replaced
+        Window rootWindow = SwingUtilities.getWindowAncestor(this);
+        if (rootWindow instanceof JLightweightFrame
+                && getScrollMode() == BLIT_SCROLL_MODE) {
+            setScrollMode(BACKINGSTORE_SCROLL_MODE);
+        }
+    }
+
 
     /**
      * Scrolls the view so that <code>Rectangle</code>
--- a/jdk/src/share/classes/javax/swing/TransferHandler.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/TransferHandler.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1268,6 +1268,14 @@
                     }
                 }
             }
+            if (!isActive()) {
+                // If the Drop target is inactive the dragExit will not be dispatched to the dtListener,
+                // so make sure that we clean up the dtListener anyway.
+                DropTargetListener dtListener = getDropTargetListener();
+                    if (dtListener != null && dtListener instanceof DropHandler) {
+                        ((DropHandler)dtListener).cleanup(false);
+                    }
+            }
         }
 
         public void drop(DropTargetDropEvent e) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Wed Sep 18 16:01:37 2013 -0700
@@ -971,14 +971,16 @@
                     // cells, if not, this needs to loop through all.
                     value = comboBox.getModel().getElementAt(0);
                 }
-                if (value == null) {
-                    value = " ";
-                } else if (value instanceof String && "".equals(value)) {
-                    value = " ";
-                }
                 Component component = renderer.
                         getListCellRendererComponent(listBox, value, -1,
                                                      false, false);
+                if (component instanceof JLabel) {
+                    JLabel label = (JLabel) component;
+                    String text = label.getText();
+                    if ((text == null) || text.isEmpty()) {
+                        label.setText(" ");
+                    }
+                }
                 if (component instanceof JComponent) {
                     component.setFont(comboBox.getFont());
                 }
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Wed Sep 18 16:01:37 2013 -0700
@@ -3350,6 +3350,7 @@
         private void updateView() {
             int tabPlacement = tabPane.getTabPlacement();
             int tabCount = tabPane.getTabCount();
+            assureRectsCreated(tabCount);
             Rectangle vpRect = viewport.getBounds();
             Dimension viewSize = viewport.getViewSize();
             Rectangle viewRect = viewport.getViewRect();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -42,6 +42,7 @@
 import javax.swing.tree.*;
 import javax.swing.text.Position;
 import javax.swing.plaf.basic.DragRecognitionSupport.BeforeDrag;
+import sun.awt.AWTAccessor;
 import sun.swing.SwingUtilities2;
 
 import sun.swing.DefaultLookup;
@@ -2165,11 +2166,7 @@
                                            nodeBounds.width,
                                            nodeBounds.height);
                 editingPath = path;
-                if (editingComponent instanceof JComponent) {
-                    ((JComponent)editingComponent).revalidate();
-                } else {
-                    editingComponent.validate();
-                }
+                AWTAccessor.getComponentAccessor().revalidateSynchronously(editingComponent);
                 editingComponent.repaint();
                 if(cellEditor.shouldSelectCell(event)) {
                     stopEditingInCompleteEditing = false;
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1067,69 +1067,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object>, PropertyChangeListener {
-        protected FileFilter[] filters;
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if(filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if(currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if(found == false) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if(filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public Object getElementAt(int index) {
-            if(index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if(filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return MetalFileChooserUI.this.getFileChooser();
         }
     }
 
--- a/jdk/src/share/classes/javax/swing/text/AbstractDocument.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/text/AbstractDocument.java	Wed Sep 18 16:01:37 2013 -0700
@@ -934,16 +934,18 @@
      * Returns true if the text in the range <code>p0</code> to
      * <code>p1</code> is left to right.
      */
-    boolean isLeftToRight(int p0, int p1) {
-        if(!getProperty(I18NProperty).equals(Boolean.TRUE)) {
-            return true;
-        }
-        Element bidiRoot = getBidiRootElement();
-        int index = bidiRoot.getElementIndex(p0);
-        Element bidiElem = bidiRoot.getElement(index);
-        if(bidiElem.getEndOffset() >= p1) {
-            AttributeSet bidiAttrs = bidiElem.getAttributes();
-            return ((StyleConstants.getBidiLevel(bidiAttrs) % 2) == 0);
+    static boolean isLeftToRight(Document doc, int p0, int p1) {
+        if (Boolean.TRUE.equals(doc.getProperty(I18NProperty))) {
+            if (doc instanceof AbstractDocument) {
+                AbstractDocument adoc = (AbstractDocument) doc;
+                Element bidiRoot = adoc.getBidiRootElement();
+                int index = bidiRoot.getElementIndex(p0);
+                Element bidiElem = bidiRoot.getElement(index);
+                if (bidiElem.getEndOffset() >= p1) {
+                    AttributeSet bidiAttrs = bidiElem.getAttributes();
+                    return ((StyleConstants.getBidiLevel(bidiAttrs) % 2) == 0);
+                }
+            }
         }
         return true;
     }
--- a/jdk/src/share/classes/javax/swing/text/DefaultCaret.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/text/DefaultCaret.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1211,12 +1211,9 @@
 
     boolean isPositionLTR(int position, Position.Bias bias) {
         Document doc = component.getDocument();
-        if(doc instanceof AbstractDocument ) {
-            if(bias == Position.Bias.Backward && --position < 0)
-                position = 0;
-            return ((AbstractDocument)doc).isLeftToRight(position, position);
-        }
-        return true;
+        if(bias == Position.Bias.Backward && --position < 0)
+            position = 0;
+        return AbstractDocument.isLeftToRight(doc, position, position);
     }
 
     Position.Bias guessBiasForOffset(int offset, Position.Bias lastBias,
--- a/jdk/src/share/classes/javax/swing/text/FlowView.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/text/FlowView.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -796,6 +796,22 @@
             v.setParent(parent);
         }
 
+        /** {@inheritDoc} */
+        @Override
+        protected void forwardUpdate(DocumentEvent.ElementChange ec,
+                                          DocumentEvent e, Shape a, ViewFactory f) {
+            calculateUpdateIndexes(e);
+            // Send update event to all views followed by the changed place.
+            lastUpdateIndex = Math.max((getViewCount() - 1), 0);
+            for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) {
+                View v = getView(i);
+                if (v != null) {
+                    Shape childAlloc = getChildAllocation(i, a);
+                    forwardUpdateToView(v, e, childAlloc, f);
+                }
+            }
+        }
+
         // The following methods don't do anything useful, they
         // simply keep the class from being abstract.
 
--- a/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/text/GlyphPainter2.java	Wed Sep 18 16:01:37 2013 -0700
@@ -239,10 +239,10 @@
                                              Position.Bias[] biasRet)
             throws BadLocationException {
 
+            Document doc = v.getDocument();
             int startOffset = v.getStartOffset();
             int endOffset = v.getEndOffset();
             Segment text;
-            AbstractDocument doc;
             boolean viewIsLeftToRight;
             TextHitInfo currentHit, nextHit;
 
@@ -252,8 +252,7 @@
             case View.SOUTH:
                 break;
             case View.EAST:
-                doc = (AbstractDocument)v.getDocument();
-                viewIsLeftToRight = doc.isLeftToRight(startOffset, endOffset);
+                viewIsLeftToRight = AbstractDocument.isLeftToRight(doc, startOffset, endOffset);
 
                 if(startOffset == doc.getLength()) {
                     if(pos == -1) {
@@ -313,8 +312,7 @@
                 }
                 return pos;
             case View.WEST:
-                doc = (AbstractDocument)v.getDocument();
-                viewIsLeftToRight = doc.isLeftToRight(startOffset, endOffset);
+                viewIsLeftToRight = AbstractDocument.isLeftToRight(doc, startOffset, endOffset);
 
                 if(startOffset == doc.getLength()) {
                     if(pos == -1) {
--- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1562,8 +1562,10 @@
     /**
      * Sets the key accelerator that will cause the receiving text
      * component to get the focus.  The accelerator will be the
-     * key combination of the <em>alt</em> key and the character
-     * given (converted to upper case).  By default, there is no focus
+     * key combination of the platform-specific modifier key and
+     * the character given (converted to upper case).  For example,
+     * the ALT key is used as a modifier on Windows and the CTRL+ALT
+     * combination is used on Mac.  By default, there is no focus
      * accelerator key.  Any previous key accelerator setting will be
      * superseded.  A '\0' key setting will be registered, and has the
      * effect of turning off the focus accelerator.  When the new key
--- a/jdk/src/share/classes/javax/swing/text/ParagraphView.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/text/ParagraphView.java	Wed Sep 18 16:01:37 2013 -0700
@@ -267,8 +267,6 @@
               throws BadLocationException {
         JTextComponent text = (JTextComponent)getContainer();
         Document doc = getDocument();
-        AbstractDocument aDoc = (doc instanceof AbstractDocument) ?
-                                (AbstractDocument)doc : null;
         View row = getView(rowIndex);
         int lastPos = -1;
         // This could be made better to check backward positions too.
@@ -276,8 +274,7 @@
         for(int vc = 0, numViews = row.getViewCount(); vc < numViews; vc++) {
             View v = row.getView(vc);
             int start = v.getStartOffset();
-            boolean ltr = (aDoc != null) ? aDoc.isLeftToRight
-                           (start, start + 1) : true;
+            boolean ltr = AbstractDocument.isLeftToRight(doc, start, start + 1);
             if(ltr) {
                 lastPos = start;
                 for(int end = v.getEndOffset(); lastPos < end; lastPos++) {
@@ -338,12 +335,8 @@
     protected boolean flipEastAndWestAtEnds(int position,
                                             Position.Bias bias) {
         Document doc = getDocument();
-        if(doc instanceof AbstractDocument &&
-           !((AbstractDocument)doc).isLeftToRight(getStartOffset(),
-                                                  getStartOffset() + 1)) {
-            return true;
-        }
-        return false;
+        position = getStartOffset();
+        return !AbstractDocument.isLeftToRight(doc, position, position + 1);
     }
 
     // --- FlowView methods ---------------------------------------------
--- a/jdk/src/share/classes/javax/swing/text/View.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/text/View.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1137,32 +1137,9 @@
      */
     protected void forwardUpdate(DocumentEvent.ElementChange ec,
                                       DocumentEvent e, Shape a, ViewFactory f) {
-        Element elem = getElement();
-        int pos = e.getOffset();
-        int index0 = getViewIndex(pos, Position.Bias.Forward);
-        if (index0 == -1 && e.getType() == DocumentEvent.EventType.REMOVE &&
-            pos >= getEndOffset()) {
-            // Event beyond our offsets. We may have represented this, that is
-            // the remove may have removed one of our child Elements that
-            // represented this, so, we should foward to last element.
-            index0 = getViewCount() - 1;
-        }
-        int index1 = index0;
-        View v = (index0 >= 0) ? getView(index0) : null;
-        if (v != null) {
-            if ((v.getStartOffset() == pos) && (pos > 0)) {
-                // If v is at a boundary, forward the event to the previous
-                // view too.
-                index0 = Math.max(index0 - 1, 0);
-            }
-        }
-        if (e.getType() != DocumentEvent.EventType.REMOVE) {
-            index1 = getViewIndex(pos + e.getLength(), Position.Bias.Forward);
-            if (index1 < 0) {
-                index1 = getViewCount() - 1;
-            }
-        }
-        int hole0 = index1 + 1;
+        calculateUpdateIndexes(e);
+
+        int hole0 = lastUpdateIndex + 1;
         int hole1 = hole0;
         Element[] addedElems = (ec != null) ? ec.getChildrenAdded() : null;
         if ((addedElems != null) && (addedElems.length > 0)) {
@@ -1173,11 +1150,9 @@
         // forward to any view not in the forwarding hole
         // formed by added elements (i.e. they will be updated
         // by initialization.
-        index0 = Math.max(index0, 0);
-        index1 = Math.max((getViewCount() - 1), 0);
-        for (int i = index0; i <= index1; i++) {
+        for (int i = firstUpdateIndex; i <= lastUpdateIndex; i++) {
             if (! ((i >= hole0) && (i <= hole1))) {
-                v = getView(i);
+                View v = getView(i);
                 if (v != null) {
                     Shape childAlloc = getChildAllocation(i, a);
                     forwardUpdateToView(v, e, childAlloc, f);
@@ -1187,6 +1162,39 @@
     }
 
     /**
+     * Calculates the first and the last indexes of the child views
+     * that need to be notified of the change to the model.
+     * @param e the change information from the associated document
+     */
+    void calculateUpdateIndexes(DocumentEvent e) {
+        int pos = e.getOffset();
+        firstUpdateIndex = getViewIndex(pos, Position.Bias.Forward);
+        if (firstUpdateIndex == -1 && e.getType() == DocumentEvent.EventType.REMOVE &&
+            pos >= getEndOffset()) {
+            // Event beyond our offsets. We may have represented this, that is
+            // the remove may have removed one of our child Elements that
+            // represented this, so, we should forward to last element.
+            firstUpdateIndex = getViewCount() - 1;
+        }
+        lastUpdateIndex = firstUpdateIndex;
+        View v = (firstUpdateIndex >= 0) ? getView(firstUpdateIndex) : null;
+        if (v != null) {
+            if ((v.getStartOffset() == pos) && (pos > 0)) {
+                // If v is at a boundary, forward the event to the previous
+                // view too.
+                firstUpdateIndex = Math.max(firstUpdateIndex - 1, 0);
+            }
+        }
+        if (e.getType() != DocumentEvent.EventType.REMOVE) {
+            lastUpdateIndex = getViewIndex(pos + e.getLength(), Position.Bias.Forward);
+            if (lastUpdateIndex < 0) {
+                lastUpdateIndex = getViewCount() - 1;
+            }
+        }
+        firstUpdateIndex = Math.max(firstUpdateIndex, 0);
+    }
+
+    /**
      * Forwards the <code>DocumentEvent</code> to the give child view.  This
      * simply messages the view with a call to <code>insertUpdate</code>,
      * <code>removeUpdate</code>, or <code>changedUpdate</code> depending
@@ -1345,4 +1353,14 @@
     private View parent;
     private Element elem;
 
+    /**
+     * The index of the first child view to be notified.
+     */
+    int firstUpdateIndex;
+
+    /**
+     * The index of the last child view to be notified.
+     */
+    int lastUpdateIndex;
+
 };
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -236,6 +236,11 @@
          */
         AccessControlContext getAccessControlContext(Component comp);
 
+        /**
+         * Revalidates the component synchronously.
+         */
+        void revalidateSynchronously(Component comp);
+
     }
 
     /*
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1765,7 +1765,14 @@
             Reader reader = new InputStreamReader(is, unicode);
 
             theObject = constructFlavoredObject(reader, flavor, Reader.class);
-
+            // Target data is a byte array
+        } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
+            if(isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
+                theObject = translateBytesToString(inputStreamToByteArray(str), format, localeTransferable)
+                        .getBytes(DataTransferer.getTextCharset(flavor));
+            } else {
+                theObject = inputStreamToByteArray(str);
+            }
             // Target data is an RMI object
         } else if (flavor.isRepresentationClassRemote()) {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,104 @@
+/*
+ * 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.swing;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ComboBoxModel;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+/**
+ * Data model for a type-face selection combo-box.
+ */
+public abstract class AbstractFilterComboBoxModel
+        extends AbstractListModel<FileFilter>
+        implements ComboBoxModel<FileFilter>, PropertyChangeListener {
+
+    protected FileFilter[] filters;
+
+    protected AbstractFilterComboBoxModel() {
+        this.filters = getFileChooser().getChoosableFileFilters();
+    }
+
+    protected abstract JFileChooser getFileChooser();
+
+    @Override
+    public void propertyChange(PropertyChangeEvent event) {
+        String property = event.getPropertyName();
+        if (property == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+            this.filters = (FileFilter[]) event.getNewValue();
+            fireContentsChanged(this, -1, -1);
+        } else if (property == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+            fireContentsChanged(this, -1, -1);
+        }
+    }
+
+    @Override
+    public void setSelectedItem(Object filter) {
+        if (filter != null) {
+            getFileChooser().setFileFilter((FileFilter) filter);
+            fireContentsChanged(this, -1, -1);
+        }
+    }
+
+    @Override
+    public Object getSelectedItem() {
+        // Ensure that the current filter is in the list.
+        // NOTE: we should not have to do this, since JFileChooser adds
+        // the filter to the choosable filters list when the filter
+        // is set. Lets be paranoid just in case someone overrides
+        // setFileFilter in JFileChooser.
+        FileFilter currentFilter = getFileChooser().getFileFilter();
+        if (currentFilter != null) {
+            for (FileFilter filter : this.filters) {
+                if (filter == currentFilter) {
+                    return currentFilter;
+                }
+            }
+            getFileChooser().addChoosableFileFilter(currentFilter);
+        }
+        return currentFilter;
+    }
+
+    @Override
+    public int getSize() {
+        return (this.filters != null)
+                ? filters.length
+                : 0;
+    }
+
+    @Override
+    public FileFilter getElementAt(int index) {
+        if (index >= getSize()) {
+            // This shouldn't happen. Try to recover gracefully.
+            return getFileChooser().getFileFilter();
+        }
+        return (this.filters != null)
+                ? filters[index]
+                : null;
+    }
+}
--- a/jdk/src/share/classes/sun/swing/FilePane.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/sun/swing/FilePane.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1980,18 +1980,18 @@
         }
 
         if (f instanceof ShellFolder) {
-            return ((ShellFolder) f).isFileSystem();
+            return f.canWrite();
         } else {
             if (usesShellFolder(getFileChooser())) {
                 try {
-                    return ShellFolder.getShellFolder(f).isFileSystem();
+                    return ShellFolder.getShellFolder(f).canWrite();
                 } catch (FileNotFoundException ex) {
                     // File doesn't exist
                     return false;
                 }
             } else {
                 // Ordinary file
-                return true;
+                return f.canWrite();
             }
         }
     }
--- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Wed Sep 18 16:01:37 2013 -0700
@@ -33,8 +33,9 @@
 import java.awt.EventQueue;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
+import java.awt.MouseInfo;
+import java.awt.Point;
 import java.awt.Rectangle;
-import java.awt.event.ComponentListener;
 import java.awt.event.ContainerEvent;
 import java.awt.event.ContainerListener;
 import java.awt.image.BufferedImage;
@@ -48,6 +49,7 @@
 import javax.swing.JRootPane;
 import javax.swing.LayoutFocusTraversalPolicy;
 import javax.swing.RootPaneContainer;
+import javax.swing.SwingUtilities;
 
 import sun.awt.LightweightFrame;
 import sun.security.action.GetPropertyAction;
@@ -88,6 +90,15 @@
 
     private PropertyChangeListener layoutSizeListener;
 
+    static {
+        SwingAccessor.setJLightweightFrameAccessor(new SwingAccessor.JLightweightFrameAccessor() {
+            @Override
+            public void updateCursor(JLightweightFrame frame) {
+                frame.updateClientCursor();
+            }
+        });
+    }
+
     /**
      * Constructs a new, initially invisible {@code JLightweightFrame}
      * instance.
@@ -95,7 +106,7 @@
     public JLightweightFrame() {
         super();
         copyBufferEnabled = "true".equals(AccessController.
-            doPrivileged(new GetPropertyAction("jlf.copyBufferEnabled", "true")));
+            doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
 
         add(rootPane, BorderLayout.CENTER);
         setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
@@ -239,6 +250,11 @@
         };
         contentPane.setLayout(new BorderLayout());
         contentPane.add(component);
+        if ("true".equals(AccessController.
+            doPrivileged(new GetPropertyAction("swing.jlf.contentPaneTransparent", "false"))))
+        {
+            contentPane.setOpaque(false);
+        }
         setContentPane(contentPane);
 
         contentPane.addContainerListener(new ContainerListener() {
@@ -358,4 +374,21 @@
     public Component getGlassPane() {
         return getRootPane().getGlassPane();
     }
+
+
+    /*
+     * Notifies client toolkit that it should change a cursor.
+     *
+     * Called from the peer via SwingAccessor, because the
+     * Component.updateCursorImmediately method is final
+     * and could not be overridden.
+     */
+    private void updateClientCursor() {
+        Point p = MouseInfo.getPointerInfo().getLocation();
+        SwingUtilities.convertPointFromScreen(p, this);
+        Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
+        if (target != null) {
+            content.setCursor(target.getCursor());
+        }
+    }
 }
--- a/jdk/src/share/classes/sun/swing/LightweightContent.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/sun/swing/LightweightContent.java	Wed Sep 18 16:01:37 2013 -0700
@@ -26,6 +26,7 @@
 package sun.swing;
 
 import javax.swing.JComponent;
+import java.awt.Cursor;
 
 /**
  * The interface by means of which the {@link JLightweightFrame} class
@@ -179,4 +180,11 @@
      * application that the content minimum size has changed.
      */
     public void minimumSizeChanged(int width, int height);
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that in needs to set a cursor
+     * @param cursor a cursor to set
+     */
+    default public void setCursor(Cursor cursor) { }
 }
--- a/jdk/src/share/classes/sun/swing/SwingAccessor.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/sun/swing/SwingAccessor.java	Wed Sep 18 16:01:37 2013 -0700
@@ -72,6 +72,16 @@
     }
 
     /**
+     * An accessor for the JLightweightFrame class.
+     */
+    public interface JLightweightFrameAccessor {
+        /**
+         * Notifies the JLightweight frame that it needs to update a cursor
+         */
+        void updateCursor(JLightweightFrame frame);
+    }
+
+    /**
      * The javax.swing.text.JTextComponent class accessor object.
      */
     private static JTextComponentAccessor jtextComponentAccessor;
@@ -93,4 +103,23 @@
 
         return jtextComponentAccessor;
     }
+
+    /**
+     * The JLightweightFrame class accessor object
+     */
+    private static JLightweightFrameAccessor jLightweightFrameAccessor;
+
+    /**
+     * Set an accessor object for the JLightweightFrame class.
+     */
+    public static void setJLightweightFrameAccessor(JLightweightFrameAccessor accessor) {
+        jLightweightFrameAccessor = accessor;
+    }
+
+    /**
+     * Retrieve the accessor object for the JLightweightFrame class
+     */
+    public static JLightweightFrameAccessor getJLightweightFrameAccessor() {
+        return jLightweightFrameAccessor;
+    }
 }
--- a/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/sun/swing/SwingUtilities2.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -33,6 +33,7 @@
 import java.awt.font.*;
 import java.awt.geom.*;
 import java.awt.print.PrinterGraphics;
+import java.text.CharacterIterator;
 import java.text.AttributedCharacterIterator;
 import java.text.AttributedString;
 
@@ -504,22 +505,25 @@
                  * it to fit in the screen width. This distributes the spacing
                  * more evenly than directly laying out to the screen advances.
                  */
-                float screenWidth = (float)
-                   g2d.getFont().getStringBounds(text, DEFAULT_FRC).getWidth();
-                TextLayout layout = createTextLayout(c, text, g2d.getFont(),
-                                                   g2d.getFontRenderContext());
+                String trimmedText = trimTrailingSpaces(text);
+                if (!trimmedText.isEmpty()) {
+                    float screenWidth = (float) g2d.getFont().getStringBounds
+                            (trimmedText, DEFAULT_FRC).getWidth();
+                    TextLayout layout = createTextLayout(c, text, g2d.getFont(),
+                                                       g2d.getFontRenderContext());
 
-                layout = layout.getJustifiedLayout(screenWidth);
-                /* Use alternate print color if specified */
-                Color col = g2d.getColor();
-                if (col instanceof PrintColorUIResource) {
-                    g2d.setColor(((PrintColorUIResource)col).getPrintColor());
+                    layout = layout.getJustifiedLayout(screenWidth);
+                    /* Use alternate print color if specified */
+                    Color col = g2d.getColor();
+                    if (col instanceof PrintColorUIResource) {
+                        g2d.setColor(((PrintColorUIResource)col).getPrintColor());
+                    }
+
+                    layout.draw(g2d, x, y);
+
+                    g2d.setColor(col);
                 }
 
-                layout.draw(g2d, x, y);
-
-                g2d.setColor(col);
-
                 return;
             }
         }
@@ -789,25 +793,27 @@
                 if (frc != null &&
                     !isFontRenderContextPrintCompatible
                     (deviceFontRenderContext, frc)) {
-                    TextLayout layout =
-                        createTextLayout(c, new String(data, offset, length),
-                                       g2d.getFont(),
-                                       deviceFontRenderContext);
-                    float screenWidth = (float)g2d.getFont().
-                        getStringBounds(data, offset, offset + length, frc).
-                        getWidth();
-                    layout = layout.getJustifiedLayout(screenWidth);
+
+                    String text = new String(data, offset, length);
+                    TextLayout layout = new TextLayout(text, g2d.getFont(),
+                                    deviceFontRenderContext);
+                    String trimmedText = trimTrailingSpaces(text);
+                    if (!trimmedText.isEmpty()) {
+                        float screenWidth = (float)g2d.getFont().
+                            getStringBounds(trimmedText, frc).getWidth();
+                        layout = layout.getJustifiedLayout(screenWidth);
 
-                    /* Use alternate print color if specified */
-                    Color col = g2d.getColor();
-                    if (col instanceof PrintColorUIResource) {
-                        g2d.setColor(((PrintColorUIResource)col).getPrintColor());
+                        /* Use alternate print color if specified */
+                        Color col = g2d.getColor();
+                        if (col instanceof PrintColorUIResource) {
+                            g2d.setColor(((PrintColorUIResource)col).getPrintColor());
+                        }
+
+                        layout.draw(g2d,x,y);
+
+                        g2d.setColor(col);
                     }
 
-                    layout.draw(g2d,x,y);
-
-                    g2d.setColor(col);
-
                     return nextX;
                 }
             }
@@ -888,14 +894,23 @@
             } else {
                 frc = g2d.getFontRenderContext();
             }
-            TextLayout layout = new TextLayout(iterator, frc);
+            TextLayout layout;
             if (isPrinting) {
                 FontRenderContext deviceFRC = g2d.getFontRenderContext();
                 if (!isFontRenderContextPrintCompatible(frc, deviceFRC)) {
-                    float screenWidth = layout.getAdvance();
                     layout = new TextLayout(iterator, deviceFRC);
-                    layout = layout.getJustifiedLayout(screenWidth);
+                    AttributedCharacterIterator trimmedIt =
+                            getTrimmedTrailingSpacesIterator(iterator);
+                    if (trimmedIt != null) {
+                        float screenWidth = new TextLayout(trimmedIt, frc).
+                                getAdvance();
+                        layout = layout.getJustifiedLayout(screenWidth);
+                    }
+                } else {
+                    layout = new TextLayout(iterator, frc);
                 }
+            } else {
+                layout = new TextLayout(iterator, frc);
             }
             layout.draw(g2d, x, y);
             retVal = layout.getAdvance();
@@ -1047,6 +1062,39 @@
         return (g instanceof PrinterGraphics || g instanceof PrintGraphics);
     }
 
+    private static String trimTrailingSpaces(String s) {
+        int i = s.length() - 1;
+        while(i >= 0 && Character.isWhitespace(s.charAt(i))) {
+            i--;
+        }
+        return s.substring(0, i + 1);
+    }
+
+    private static AttributedCharacterIterator getTrimmedTrailingSpacesIterator
+            (AttributedCharacterIterator iterator) {
+        int curIdx = iterator.getIndex();
+
+        char c = iterator.last();
+        while(c != CharacterIterator.DONE && Character.isWhitespace(c)) {
+            c = iterator.previous();
+        }
+
+        if (c != CharacterIterator.DONE) {
+            int endIdx = iterator.getIndex();
+
+            if (endIdx == iterator.getEndIndex() - 1) {
+                iterator.setIndex(curIdx);
+                return iterator;
+            } else {
+                AttributedString trimmedText = new AttributedString(iterator,
+                        iterator.getBeginIndex(), endIdx + 1);
+                return trimmedText.getIterator();
+            }
+        } else {
+            return null;
+        }
+    }
+
     /**
      * Determines whether the SelectedTextColor should be used for painting text
      * foreground for the specified highlight.
--- a/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	Wed Sep 18 16:01:37 2013 -0700
@@ -923,70 +923,9 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
-            PropertyChangeListener {
-        protected FileFilter[] filters;
-        protected FilterComboBoxModel() {
-            super();
-            filters = getFileChooser().getChoosableFileFilters();
-        }
-
-        public void propertyChange(PropertyChangeEvent e) {
-            String prop = e.getPropertyName();
-            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-                filters = (FileFilter[]) e.getNewValue();
-                fireContentsChanged(this, -1, -1);
-            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public void setSelectedItem(Object filter) {
-            if(filter != null) {
-                getFileChooser().setFileFilter((FileFilter) filter);
-                fireContentsChanged(this, -1, -1);
-            }
-        }
-
-        public Object getSelectedItem() {
-            // Ensure that the current filter is in the list.
-            // NOTE: we shouldnt' have to do this, since JFileChooser adds
-            // the filter to the choosable filters list when the filter
-            // is set. Lets be paranoid just in case someone overrides
-            // setFileFilter in JFileChooser.
-            FileFilter currentFilter = getFileChooser().getFileFilter();
-            boolean found = false;
-            if(currentFilter != null) {
-                for (FileFilter filter : filters) {
-                    if (filter == currentFilter) {
-                        found = true;
-                    }
-                }
-                if(found == false) {
-                    getFileChooser().addChoosableFileFilter(currentFilter);
-                }
-            }
-            return getFileChooser().getFileFilter();
-        }
-
-        public int getSize() {
-            if(filters != null) {
-                return filters.length;
-            } else {
-                return 0;
-            }
-        }
-
-        public FileFilter getElementAt(int index) {
-            if(index > getSize() - 1) {
-                // This shouldn't happen. Try to recover gracefully.
-                return getFileChooser().getFileFilter();
-            }
-            if(filters != null) {
-                return filters[index];
-            } else {
-                return null;
-            }
+    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
+        protected JFileChooser getFileChooser() {
+            return SynthFileChooserUIImpl.this.getFileChooser();
         }
     }
 
--- a/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/demo/applets/MoleculeViewer/XYZApp.java	Wed Sep 18 16:01:37 2013 -0700
@@ -348,7 +348,7 @@
         InputStream is = null;
         try {
             Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
-            is = new URL(getDocumentBase(), mdname).openStream();
+            is = getClass().getResourceAsStream(mdname);
             XYZChemModel m = new XYZChemModel(is);
             Atom.setApplet(this);
             md = m;
--- a/jdk/src/share/demo/applets/MoleculeViewer/example1.html	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/demo/applets/MoleculeViewer/example1.html	Wed Sep 18 16:01:37 2013 -0700
@@ -2,10 +2,10 @@
   <head>
       <title>MoleculeViewer (example 1)</title>
   </head>
-  <body> 
+  <body>
       <h1>MoleculeViewer (example 1)</h1>
       <hr>
-      <applet code=XYZApp.class width=300 height=300>
+      <applet code=XYZApp.class archive=MoleculeViewer.jar width=300 height=300>
 	<param name=model value="models/HyaluronicAcid.xyz">
 	alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	Your browser is completely ignoring the &lt;APPLET&gt; tag!
@@ -13,7 +13,7 @@
       <hr>
       <a href="XYZApp.java">The source</a>.
   </body>
-</html>	  
+</html>
 
 
 
--- a/jdk/src/share/demo/applets/MoleculeViewer/example2.html	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/demo/applets/MoleculeViewer/example2.html	Wed Sep 18 16:01:37 2013 -0700
@@ -2,10 +2,10 @@
   <head>
       <title>MoleculeViewer (example 2)</title>
   </head>
-  <body> 
+  <body>
       <h1>MoleculeViewer (example 2)</h1>
       <hr>
-      <applet code=XYZApp.class width=300 height=300>
+      <applet code=XYZApp.class archive=MoleculeViewer.jar width=300 height=300>
 	<param name=model value="models/buckminsterfullerine.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
@@ -13,4 +13,4 @@
       <hr>
       <a href="XYZApp.java">The source</a>.
   </body>
-</html>	  
+</html>
--- a/jdk/src/share/demo/applets/MoleculeViewer/example3.html	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/demo/applets/MoleculeViewer/example3.html	Wed Sep 18 16:01:37 2013 -0700
@@ -5,25 +5,25 @@
   <body>
       <h1>MoleculeViewer (example 3)</h1>
       <hr>
-      <applet code=XYZApp.class width=100 height=100>
+      <applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
 	<param name=model value="models/water.xyz">
 	alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	Your browser is completely ignoring the &lt;APPLET&gt; tag!
       </applet>
       <p>
-	<applet code=XYZApp.class width=100 height=100>
+	<applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
           <param name=model value="models/benzene.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
 	</applet>
       <p>
-	<applet code=XYZApp.class width=100 height=100>
+	<applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
 	  <param name=model value="models/ethane.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
 	</applet>
       <p>
-	<applet code=XYZApp.class width=100 height=100>
+	<applet code=XYZApp.class archive=MoleculeViewer.jar width=100 height=100>
 	  <param name=model value="models/cyclohexane.xyz">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
@@ -31,5 +31,5 @@
       <hr>
       <a href="XYZApp.java">The source</a>.
   </body>
-</html>	  
+</html>
 
--- a/jdk/src/share/demo/applets/WireFrame/ThreeD.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/demo/applets/WireFrame/ThreeD.java	Wed Sep 18 16:01:37 2013 -0700
@@ -416,7 +416,7 @@
         InputStream is = null;
         try {
             Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
-            is = new URL(getDocumentBase(), mdname).openStream();
+            is = getClass().getResourceAsStream(mdname);
             Model3D m = new Model3D(is);
             md = m;
             m.findBB();
--- a/jdk/src/share/demo/applets/WireFrame/example1.html	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/demo/applets/WireFrame/example1.html	Wed Sep 18 16:01:37 2013 -0700
@@ -5,7 +5,7 @@
   <body>
     <h1>3D Model: Cube</h1>
       <hr>
-      <applet code=ThreeD.class width=100 height=100>
+      <applet code=ThreeD.class archive=WireFrame.jar width=100 height=100>
 	<param name=model value="models/cube.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/share/demo/applets/WireFrame/example2.html	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/demo/applets/WireFrame/example2.html	Wed Sep 18 16:01:37 2013 -0700
@@ -5,7 +5,7 @@
   <body>
       <h1>3D Model: Dinosaur</h1>
       <hr>
-      <applet code=ThreeD.class width=300 height=300>
+      <applet code=ThreeD.class archive=WireFrame.jar width=300 height=300>
 	<param name=model value="models/dinasaur.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/share/demo/applets/WireFrame/example3.html	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/demo/applets/WireFrame/example3.html	Wed Sep 18 16:01:37 2013 -0700
@@ -5,7 +5,7 @@
   <body>
       <h1>3D Model: Hughes</h1>
       <hr>
-      <applet code=ThreeD.class width=300 height=300>
+      <applet code=ThreeD.class archive=WireFrame.jar width=300 height=300>
 	<param name=model value="models/hughes_500.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/share/demo/applets/WireFrame/example4.html	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/share/demo/applets/WireFrame/example4.html	Wed Sep 18 16:01:37 2013 -0700
@@ -5,7 +5,7 @@
   <body>
       <h1>3D Model: knoxS</h1>
       <hr>
-      <applet code=ThreeD.class width=300 height=300>
+      <applet code=ThreeD.class archive=WireFrame.jar width=300 height=300>
 	<param name=model value="models/knoxS.obj">
 	  alt="Your browser understands the &lt;APPLET&gt; tag but isn't running the applet, for some reason."
 	  Your browser is completely ignoring the &lt;APPLET&gt; tag!
--- a/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XLightweightFramePeer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -28,6 +28,8 @@
 import java.awt.Graphics;
 
 import sun.awt.LightweightFrame;
+import sun.swing.JLightweightFrame;
+import sun.swing.SwingAccessor;
 
 public class XLightweightFramePeer extends XFramePeer {
 
@@ -62,4 +64,9 @@
             getLwTarget().ungrabFocus();
         }
     }
+
+    @Override
+    public void updateCursorImmediately() {
+        SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
+    }
 }
--- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -459,7 +459,7 @@
             // other class tries to cast source field to Component).
             // We already filter DRAG events out (CR 6565779).
             e.setSource(xtiPeer.target);
-            Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
+            XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), e);
         }
         public void mouseClicked(MouseEvent e) {
             if ((e.getClickCount() > 1 || xtiPeer.balloon.isVisible()) &&
--- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Wed Sep 18 16:01:37 2013 -0700
@@ -592,7 +592,7 @@
     }
 
     static boolean isMutter() {
-        return isNetWMName("Mutter");
+        return isNetWMName("Mutter") || isNetWMName("GNOME Shell");
     }
 
     static boolean isNonReparentingWM() {
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -656,7 +656,7 @@
         _setFont(f);
     }
     public synchronized native void _setFont(Font f);
-    public final void updateCursorImmediately() {
+    public void updateCursorImmediately() {
         WGlobalCursorManager.getCursorManager().updateCursorImmediately();
     }
 
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -211,9 +211,9 @@
                         DataFlavor.allHtmlFlavor,
                         format);
             } else {
-                // handel other html flavor types, including custom and
+                // handle other html flavor types, including custom and
                 // fragment ones
-                bytes = HTMLCodec.convertToHTMLFormat(bytes);
+                bytes = HTMLCodec.convertToHTMLFormat(super.translateTransferable(contents, flavor, format));
             }
         } else {
             // we handle non-html types basing on  their
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -182,6 +182,7 @@
 
         AWTAccessor.getFileDialogAccessor().setFile(fileDialog, null);
         AWTAccessor.getFileDialogAccessor().setFiles(fileDialog, null);
+        AWTAccessor.getFileDialogAccessor().setDirectory(fileDialog, null);
 
         WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
              public void run() {
--- a/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/classes/sun/awt/windows/WLightweightFramePeer.java	Wed Sep 18 16:01:37 2013 -0700
@@ -31,6 +31,8 @@
 import java.awt.event.MouseEvent;
 
 import sun.awt.LightweightFrame;
+import sun.swing.JLightweightFrame;
+import sun.swing.SwingAccessor;
 
 public class WLightweightFramePeer extends WFramePeer {
 
@@ -83,4 +85,9 @@
     public void ungrab() {
         getLwTarget().ungrabFocus();
     }
+
+    @Override
+    public void updateCursorImmediately() {
+        SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
+    }
 }
--- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -73,7 +73,7 @@
     int length = env->GetStringLength(filterDescription);
     DASSERT(length + 1 < MAX_FILTER_STRING);
     LPCTSTR tmp = JNU_GetStringPlatformChars(env, filterDescription, NULL);
-    _tcscpy(s_fileFilterString, tmp);
+    _tcscpy_s(s_fileFilterString, MAX_FILTER_STRING, tmp);
     JNU_ReleaseStringPlatformChars(env, filterDescription, tmp);
 
     //AdditionalString should be terminated by two NULL characters (Windows
@@ -353,7 +353,7 @@
         if (!result) {
             dlgerr = ::CommDlgExtendedError();
             if (dlgerr == FNERR_INVALIDFILENAME) {
-                _tcscpy(fileBuffer, TEXT(""));
+                _tcscpy_s(fileBuffer, bufferLimit, TEXT(""));
                 if (mode == java_awt_FileDialog_LOAD) {
                     result = AwtFileDialog::GetOpenFileName(&ofn);
                 } else {
@@ -372,7 +372,9 @@
 
         // Report result to peer.
         if (result) {
-            jint length = (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile);
+            jint length = multipleMode
+                    ? (jint)GetBufferLength(ofn.lpstrFile, ofn.nMaxFile)
+                    : (jint)_tcslen(ofn.lpstrFile);
             jcharArray jnames = env->NewCharArray(length);
             env->SetCharArrayRegion(jnames, 0, length, (jchar*)ofn.lpstrFile);
 
--- a/jdk/src/windows/native/sun/windows/awt_Font.cpp	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_Font.cpp	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -366,17 +366,6 @@
     return awtFont;
 }
 
-int CALLBACK FindFamilyName (ENUMLOGFONTEX *lpelfe,
-          NEWTEXTMETRICEX *lpntme, int FontType, LPARAM lParam)
-{
-    if(_tcsstr((LPTSTR)lParam, lpelfe->elfLogFont.lfFaceName)) {
-        _tcscpy((LPTSTR)lParam, lpelfe->elfLogFont.lfFaceName);
-        return 0;
-    } else {
-        return 1;
-    }
-}
-
 static void strip_tail(wchar_t* text, wchar_t* tail) { // strips tail and any possible whitespace before it from the end of text
     if (wcslen(text)<=wcslen(tail)) {
         return;
--- a/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_PrintControl.cpp	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -428,17 +428,17 @@
         devnames->wOutputOffset =
             static_cast<WORD>(sizeof(DEVNAMES)/sizeof(TCHAR) + lenDriverName + lenPrinterName);
         if (info2->pDriverName != NULL) {
-            _tcscpy(lpcDevnames + devnames->wDriverOffset, info2->pDriverName);
+            _tcscpy_s(lpcDevnames + devnames->wDriverOffset, devnameSize - devnames->wDriverOffset, info2->pDriverName);
         } else {
             *(lpcDevnames + devnames->wDriverOffset) = _T('\0');
         }
         if (pPrinterName != NULL) {
-            _tcscpy(lpcDevnames + devnames->wDeviceOffset, pPrinterName);
+            _tcscpy_s(lpcDevnames + devnames->wDeviceOffset, devnameSize - devnames->wDeviceOffset, pPrinterName);
         } else {
             *(lpcDevnames + devnames->wDeviceOffset) = _T('\0');
         }
         if (info2->pPortName != NULL) {
-            _tcscpy(lpcDevnames + devnames->wOutputOffset, info2->pPortName);
+            _tcscpy_s(lpcDevnames + devnames->wOutputOffset, devnameSize - devnames->wOutputOffset, info2->pPortName);
         } else {
             *(lpcDevnames + devnames->wOutputOffset) = _T('\0');
         }
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Wed Sep 18 16:01:37 2013 -0700
@@ -228,7 +228,7 @@
         // create input locale string, e.g., "00000409", from hkl.
         TCHAR inputLocale[9];
         TCHAR buf[9];
-        _tcscpy(inputLocale, TEXT("00000000"));
+        _tcscpy_s(inputLocale, 9, TEXT("00000000"));
 
     // 64-bit: ::LoadKeyboardLayout() is such a weird API - a string of
     // the hex value you want?!  Here we're converting our HKL value to
--- a/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_TrayIcon.cpp	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -711,7 +711,7 @@
         _tcsncpy(m_nid.szTip, tooltip, TRAY_ICON_TOOLTIP_MAX_SIZE);
         m_nid.szTip[TRAY_ICON_TOOLTIP_MAX_SIZE - 1] = '\0';
     } else {
-        _tcscpy(m_nid.szTip, tooltip);
+        _tcscpy_s(m_nid.szTip, TRAY_ICON_TOOLTIP_MAX_SIZE, tooltip);
     }
 
     SendTrayMessage(NIM_MODIFY);
@@ -817,7 +817,7 @@
         m_nid.szInfoTitle[TRAY_ICON_BALLOON_TITLE_MAX_SIZE - 1] = '\0';
 
     } else {
-        _tcscpy(m_nid.szInfoTitle, caption);
+        _tcscpy_s(m_nid.szInfoTitle, TRAY_ICON_BALLOON_TITLE_MAX_SIZE, caption);
     }
 
     if (text[0] == '\0') {
@@ -830,7 +830,7 @@
         m_nid.szInfo[TRAY_ICON_BALLOON_INFO_MAX_SIZE - 1] = '\0';
 
     } else {
-        _tcscpy(m_nid.szInfo, text);
+        _tcscpy_s(m_nid.szInfo, TRAY_ICON_BALLOON_INFO_MAX_SIZE, text);
     }
 
     SendTrayMessage(NIM_MODIFY);
--- a/jdk/src/windows/native/sun/windows/awt_ole.cpp	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/src/windows/native/sun/windows/awt_ole.cpp	Wed Sep 18 16:01:37 2013 -0700
@@ -70,7 +70,7 @@
             bErrorReport?_T("Error:"):_T(""),
             szBuffer) < 0)
         {
-            _tcscpy(szBuffer1 + DTRACE_BUF_LEN - 5, _T("...")); //reserver for \n
+            _tcscpy_s(szBuffer1 + DTRACE_BUF_LEN - 5, 5, _T("...")); //reserver for \n
         }
         memcpy(szBuffer1, szTime, iTimeLen*sizeof(TCHAR));
         _tcscat(szBuffer1, _T("\n"));
--- a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java	Wed Sep 18 16:01:37 2013 -0700
@@ -42,6 +42,7 @@
         GraphicsDevice gd = ge.getDefaultScreenDevice();
 
         Frame f = new Frame("Test frame");
+        f.setUndecorated(true);
         f.setBounds(100, 100, 320, 240);
 
         // First, check it can be made fullscreen window without any effects applied
--- a/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/java/awt/MenuBar/MenuBarSetFont/MenuBarSetFont.java	Wed Sep 18 16:01:37 2013 -0700
@@ -65,6 +65,12 @@
     }
 
     public static void main(final String[] args) throws Exception {
+
+        if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) {
+            System.err.println("This test is not for OS X. Menu.setFont() is not supported on OS X.");
+            return;
+        }
+
         //Components initialization.
         frame.setMenuBar(mb);
         mb.setFont(new Font("Helvetica", Font.ITALIC, 5));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Modal/ModalDialogOrderingTest/ModalDialogOrderingTest.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import sun.awt.SunToolkit;
+/*
+ * @test
+ * @bug 8008728
+ * @summary [macosx] Swing. JDialog. Modal dialog goes to background
+ * @author Alexandr Scherbatiy
+ * @run main ModalDialogOrderingTest
+ */
+
+public class ModalDialogOrderingTest {
+
+    private static final Color DIALOG_COLOR = Color.GREEN;
+    private static final Color FRAME_COLOR = Color.BLUE;
+
+    public static void main(String[] args) {
+
+        final Frame frame = new Frame("Test");
+        frame.setSize(100, 100);
+        frame.setBackground(FRAME_COLOR);
+        frame.setVisible(true);
+
+        final Dialog modalDialog = new Dialog((Frame) null, true);
+        modalDialog.setTitle("Modal Dialog");
+        modalDialog.setSize(50, 50);
+        modalDialog.setBackground(DIALOG_COLOR);
+        modalDialog.setModal(true);
+
+        new Thread(new Runnable() {
+
+            @Override
+            public void run() {
+                runTest(modalDialog, frame);
+            }
+        }).start();
+
+        modalDialog.setVisible(true);
+    }
+
+    private static void runTest(Dialog dialog, Frame frame) {
+        try {
+            SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+            Robot robot = new Robot();
+            robot.setAutoDelay(15);
+            robot.mouseMove(300, 300);
+
+            while (!dialog.isVisible()) {
+                toolkit.realSync();
+            }
+
+            Rectangle dialogBounds = dialog.getBounds();
+            Rectangle frameBounds = frame.getBounds();
+
+            double x0 = dialogBounds.getX();
+            double y0 = dialogBounds.getY();
+            double x1 = dialogBounds.getX() + dialogBounds.getWidth();
+            double y1 = dialogBounds.getY() + dialogBounds.getHeight();
+            double x2 = frameBounds.getX() + frameBounds.getWidth();
+            double y2 = frameBounds.getY() + frameBounds.getHeight();
+
+            int clickX = (int) ((x2 + x1) / 2);
+            int clickY = (int) ((y2 + y1) / 2);
+
+            robot.mouseMove(clickX, clickY);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            toolkit.realSync();
+
+            int colorX = (int) ((x0 + x1) / 2);
+            int colorY = (int) ((y0 + y1) / 2);
+
+            Color color = robot.getPixelColor(colorX, colorY);
+
+            dialog.setVisible(false);
+            frame.setVisible(false);
+
+            if (!DIALOG_COLOR.equals(color)) {
+                throw new RuntimeException("The frame is on top"
+                        + " of the modal dialog!");
+            }
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,108 @@
+/*
+ * 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 test.java.awt.regtesthelpers.Util;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * @test
+ * @bug 8012026
+ * @summary Component.getMousePosition() does not work in an applet on MacOS
+ * @author Petr Pchelko
+ * @library ../../regtesthelpers
+ * @build Util
+ * @compile GetMousePositionWithOverlay.java
+ * @run main/othervm GetMousePositionWithOverlay
+ */
+
+public class GetMousePositionWithOverlay {
+
+    static Frame backFrame;
+    static Frame frontFrame;
+
+    public static void main(String[] args) throws Throwable {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    constructTestUI();
+                }
+            });
+            Util.waitForIdle(null);
+
+            Robot r = new Robot();
+            Util.pointOnComp(frontFrame, r);
+            Util.waitForIdle(null);
+
+            Point pos = getMousePosition(backFrame);
+            if (pos != null) {
+                throw new RuntimeException("Test failed. Mouse position should be null but was" + pos);
+            }
+
+            pos = getMousePosition(frontFrame);
+            if (pos == null) {
+                throw new RuntimeException("Test failed. Mouse position should not be null");
+            }
+
+            r.mouseMove(189, 189);
+            Util.waitForIdle(null);
+
+            pos = getMousePosition(backFrame);
+            if (pos == null) {
+                throw new RuntimeException("Test failed. Mouse position should not be null");
+            }
+        } finally {
+            SwingUtilities.invokeLater(new Runnable() {
+                @Override
+                public void run() {
+                    backFrame.dispose();
+                    frontFrame.dispose();
+                }
+            });
+        }
+    }
+
+    private static Point getMousePosition(final Component component) throws Exception {
+        final AtomicReference<Point> pos = new AtomicReference<Point>();
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                pos.set(component.getMousePosition());
+            }
+        });
+        return pos.get();
+    }
+
+    private static void constructTestUI() {
+        backFrame = new Frame();
+        backFrame.setBounds(100, 100, 100, 100);
+        backFrame.setVisible(true);
+
+        frontFrame = new Frame();
+        frontFrame.setBounds(120, 120, 60, 60);
+        frontFrame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,111 @@
+/*
+ * 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 test.java.awt.regtesthelpers.Util;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionAdapter;
+
+/**
+ * @test
+ * @bug 8012026
+ * @summary Component.getMousePosition() does not work in an applet on MacOS
+ * @author Petr Pchelko
+ * @library ../../regtesthelpers
+ * @build Util
+ * @compile GetMousePositionWithPopup.java
+ * @run main/othervm GetMousePositionWithPopup
+ */
+
+public class GetMousePositionWithPopup {
+
+    private static Frame frame1;
+    private static Frame frame2;
+
+    public static void main(String[] args) throws Exception {
+        try {
+        Robot r = Util.createRobot();
+        r.mouseMove(0, 0);
+        Util.waitForIdle(null);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                constructTestUI();
+            }
+        });
+
+        Util.waitForIdle(null);
+        r.mouseMove(149, 149);
+        Util.waitForIdle(null);
+        r.mouseMove(150, 150);
+        Util.waitForIdle(null);
+
+        } finally {
+            SwingUtilities.invokeLater(new Runnable() {
+                @Override
+                public void run() {
+                    frame1.dispose();
+                    frame2.dispose();
+                }
+            });
+        }
+    }
+
+    private static void constructTestUI() {
+        frame1 = new Frame();
+        frame1.setBounds(100, 100, 100, 100);
+        frame1.addMouseMotionListener(new MouseMotionAdapter() {
+
+            private boolean shown = false;
+
+            @Override
+            public void mouseMoved(MouseEvent e) {
+                if (shown) {
+                    return;
+                }
+
+                shown = true;
+
+                frame2 = new Frame();
+                frame2.setBounds(120, 120, 120, 120);
+                frame2.setVisible(true);
+
+                Point positionInFrame2 = frame2.getMousePosition();
+                if (positionInFrame2.x != 30 || positionInFrame2.y != 30) {
+                    throw new RuntimeException("Wrong position reported. Should be [30, 30] but was [" +
+                            positionInFrame2.x + ", " + positionInFrame2.y + "]");
+                }
+
+                Point positionInFrame1 = frame1.getMousePosition();
+                if (positionInFrame1 != null) {
+                    throw new RuntimeException("Wrong position reported. Should be null");
+                }
+
+            }
+        });
+        frame1.setVisible(true);
+    }
+}
--- a/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/java/awt/Window/MaximizeOffscreen/MaximizeOffscreenTest.java	Wed Sep 18 16:01:37 2013 -0700
@@ -23,6 +23,7 @@
 
 /**
  * @test @summary JVM crash if the frame maximized from offscreen
+ * @bug 8020210
  * @author Petr Pchelko
  * @library ../../regtesthelpers
  * @build Util
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Frame;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyAdapter;
+import sun.awt.ExtendedKeyCodes;
+import sun.awt.SunToolkit;
+
+/*
+ * @test
+ * @bug 8007156
+ * @summary Extended key code is not set for a key event
+ * @author Alexandr Scherbatiy
+ * @run main ExtendedKeyCodeTest
+ */
+public class ExtendedKeyCodeTest {
+
+    private static volatile boolean setExtendedKeyCode = true;
+    private static volatile int eventsCount = 0;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+
+        Frame frame = new Frame();
+        frame.setSize(300, 300);
+
+        frame.addKeyListener(new KeyAdapter() {
+
+            @Override
+            public void keyPressed(KeyEvent e) {
+                eventsCount++;
+                setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
+                    == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+            }
+
+            @Override
+            public void keyReleased(KeyEvent e) {
+                eventsCount++;
+                setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
+                    == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+            }
+        });
+
+        frame.setVisible(true);
+        toolkit.realSync();
+
+        robot.keyPress(KeyEvent.VK_D);
+        robot.keyRelease(KeyEvent.VK_D);
+        toolkit.realSync();
+
+        frame.dispose();
+
+        if (eventsCount != 2 || !setExtendedKeyCode) {
+            throw new RuntimeException("Wrong extended key code");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/KeyEvent/KeyChar/KeyCharTest.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,81 @@
+/*
+ * 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 java.awt.AWTEvent;
+import java.awt.Frame;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.AWTEventListener;
+import java.awt.event.KeyEvent;
+import java.util.Locale;
+import sun.awt.SunToolkit;
+
+/*
+ * @test
+ * @bug 8022401
+ * @summary Wrong key char
+ * @author Alexandr Scherbatiy
+ * @run main KeyCharTest
+ */
+public class KeyCharTest {
+
+    private static volatile int eventsCount = 0;
+
+    static {
+        Locale.setDefault(Locale.ENGLISH);
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+
+            @Override
+            public void eventDispatched(AWTEvent event) {
+                eventsCount++;
+                char delete = ((KeyEvent) event).getKeyChar();
+                if (delete != '\u007f') {
+                    throw new RuntimeException("Key char is not delete: '" + delete + "'");
+                }
+            }
+        }, AWTEvent.KEY_EVENT_MASK);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        Frame frame = new Frame();
+        frame.setSize(300, 300);
+        frame.setVisible(true);
+        toolkit.realSync();
+
+        Robot robot = new Robot();
+
+        robot.keyPress(KeyEvent.VK_DELETE);
+        robot.keyRelease(KeyEvent.VK_DELETE);
+        toolkit.realSync();
+
+        frame.dispose();
+
+        if (eventsCount != 3) {
+            throw new RuntimeException("Wrong number of key events: " + eventsCount);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/bug8023392/bug8023392.html	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,20 @@
+<html>
+<!--
+  @test
+  @bug 8023392
+  @summary Swing text components printed with spaces between chars
+  @author Anton Nashatyrev
+  @run applet/manual=yesno bug8023392.html
+  -->
+<head>
+    <title> Bug 8023392 </title>
+</head>
+<body>
+
+<h1>Bug ID: 8023392</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="bug8023392.class" WIDTH=400 HEIGHT=400></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/print/bug8023392/bug8023392.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,286 @@
+/*
+ * 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.
+ */
+
+/*
+  test
+  @bug 8023392
+  @summary Swing text components printed with spaces between chars
+  @author Anton Nashatyrev
+  @run applet/manual=yesno bug8023392.html
+*/
+
+import javax.swing.*;
+import javax.swing.border.LineBorder;
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.font.TextAttribute;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
+
+
+public class bug8023392 extends Applet {
+    static final String[] instructions = {
+        "A Frame containing several pairs of labels ((a) and (b)) is displayed.",
+        "Labels of each pair look the same and are left-aligned (with spaces ",
+        "between chars).",
+        "1. Hit the print button.",
+        "2. Select any available printer (printing to file is also fine).",
+        "3. Look at the printing result (paper, PDF, PS, etc.):",
+        "   The (a) and (b) labels should look almost the same and the (a) labels",
+        "   shouldn't appear as if they are stretched along X axis."};
+
+    public void init() {
+        this.setLayout(new BorderLayout());
+        add(new SimplePrint2(), BorderLayout.CENTER);
+
+        Sysout.createDialogWithInstructions(instructions);
+
+    }
+
+    public static class SimplePrint2 extends JPanel
+            implements ActionListener, Printable {
+        JLabel label1;
+        JLabel label2;
+        JButton printButton;
+
+
+        public SimplePrint2() {
+            setLayout(new BorderLayout());
+            label1 = new JLabel("2a) a b c d e" +
+                    "                         ");
+            label2 = new JLabel("2b) a b c d e");
+
+            Box p1 = new Box(BoxLayout.Y_AXIS);
+            p1.add(label1);
+            p1.add(label2);
+            p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") {
+                String s = "3a) a b c d e                                     ";
+                @Override
+                protected void paintComponent(Graphics g) {
+                    sun.swing.SwingUtilities2.drawChars(this, g, s.toCharArray(),
+                            0, s.length(), 0, 15);
+                }
+            });
+            p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") {
+                String s = "3b) a b c d e";
+                @Override
+                protected void paintComponent(Graphics g) {
+                    sun.swing.SwingUtilities2.drawChars(this, g, s.toCharArray(),
+                            0, s.length(), 0, 15);
+                }
+            });
+            p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") {
+                String s = "4a) a b c d e                                     ";
+                AttributedCharacterIterator it;
+                {
+                    AttributedString as = new AttributedString(s);
+                    as.addAttribute(TextAttribute.FONT, getFont());
+                    as.addAttribute(TextAttribute.FOREGROUND, Color.RED, 3, 8);
+                    it = as.getIterator();
+                }
+                @Override
+                protected void paintComponent(Graphics g) {
+                    sun.swing.SwingUtilities2.drawString(this, g, it, 0, 15);
+                }
+            });
+
+            p1.add(new JLabel("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww") {
+                String s = "4b) a b c d e";
+                AttributedCharacterIterator it;
+                {
+                    AttributedString as = new AttributedString(s);
+                    as.addAttribute(TextAttribute.FONT, getFont());
+                    as.addAttribute(TextAttribute.FOREGROUND, Color.RED, 3, 8);
+                    it = as.getIterator();
+                }
+                @Override
+                protected void paintComponent(Graphics g) {
+                    sun.swing.SwingUtilities2.drawString(this, g, it, 0, 15);
+                }
+            });
+
+            JPanel p2 = new JPanel();
+            printButton = new JButton("Print");
+            printButton.addActionListener(this);
+            p2.add(printButton);
+
+            Container c = this;
+            c.add(p1, BorderLayout.CENTER);
+            c.add(p2, BorderLayout.SOUTH);
+
+            String[] data = {
+                    "1a) \u30aa\u30f3\u30e9\u30a4\u30f3\u6d88\u8fbc" +
+                    "                                              ",
+                    "1b) \u30aa\u30f3\u30e9\u30a4\u30f3\u6d88\u8fbc"
+            };
+            JList l0 = new JList(data);
+            l0.setVisibleRowCount(l0.getModel().getSize());
+            JScrollPane jsp = new JScrollPane(l0);
+            l0.setBorder(new LineBorder(Color.GRAY));
+            c.add(jsp, BorderLayout.NORTH);
+
+            for (Component comp : new Component[]{label1, label2, printButton}) {
+                comp.setFont(new Font("Monospaced", 0, 16));
+            }
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            PrinterJob job = PrinterJob.getPrinterJob();
+            job.setPrintable(this);
+            if (job.printDialog()) {
+                try {
+                    job.print();
+                } catch (PrinterException ex) {
+                    ex.printStackTrace();
+                }
+            }
+        }
+
+        public int print(Graphics graphics,
+                         PageFormat pageFormat,
+                         int pageIndex)
+                throws PrinterException {
+            if (pageIndex >= 1) {
+                return Printable.NO_SUCH_PAGE;
+            }
+
+            this.paint(graphics);
+            return Printable.PAGE_EXISTS;
+        }
+    }
+}
+
+
+/**
+ * *************************************************
+ * Standard Test Machinery
+ * DO NOT modify anything below -- it's a standard
+ * chunk of code whose purpose is to make user
+ * interaction uniform, and thereby make it simpler
+ * to read and understand someone else's test.
+ * **************************************************
+ */
+class Sysout {
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions(String[] instructions) {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        dialog.printInstructions(instructions);
+        dialog.show();
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void createDialog() {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        String[] defInstr = {"Instructions will appear here. ", ""};
+        dialog.printInstructions(defInstr);
+        dialog.show();
+        println("Any messages for the tester will display here.");
+    }
+
+
+    public static void printInstructions(String[] instructions) {
+        dialog.printInstructions(instructions);
+    }
+
+
+    public static void println(String messageIn) {
+        dialog.displayMessage(messageIn);
+    }
+
+}// Sysout  class
+
+
+class TestDialog extends Dialog {
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog(Frame frame, String name) {
+        super(frame, name);
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
+        add("North", instructionsText);
+
+        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
+        add("South", messageText);
+
+        pack();
+
+        show();
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions(String[] instructions) {
+        //Clear out any current instructions
+        instructionsText.setText("");
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for (int i = 0; i < instructions.length; i++) {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[i];
+            while (remainingStr.length() > 0) {
+                //if longer than max then chop off first max chars to print
+                if (remainingStr.length() >= maxStringLength) {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                            lastIndexOf(' ', maxStringLength - 1);
+
+                    if (posOfSpace <= 0) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring(0, posOfSpace + 1);
+                    remainingStr = remainingStr.substring(posOfSpace + 1);
+                }
+                //else just print
+                else {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append(printStr + "\n");
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage(String messageIn) {
+        messageText.append(messageIn + "\n");
+    }
+
+}// TestDialog  class
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/Test7172865.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,162 @@
+/*
+ * 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 java.beans.IndexedPropertyDescriptor;
+import java.beans.MethodDescriptor;
+import java.beans.PropertyDescriptor;
+
+/*
+ * @test
+ * @bug 7172854 7172865
+ * @summary Tests that cached methods are not lost
+ * @author Sergey Malenkov
+ */
+
+public class Test7172865 {
+    public static void main(String[] args) throws Exception {
+        int errors = 0;
+
+        MethodDescriptor md = new MethodDescriptor(Test7172865.class.getMethod("getGood"));
+
+        errors += test(PropertyDescriptor.class, "good", true);
+        PropertyDescriptor pdGoodString = new PropertyDescriptor("good", Test7172865.class, "getGood", "setGood");
+        PropertyDescriptor pdGoodMethod = new PropertyDescriptor("good",
+                Test7172865.class.getMethod("getGood"),
+                Test7172865.class.getMethod("setGood", args.getClass()));
+
+        errors += test(PropertyDescriptor.class, "bad", false);
+        PropertyDescriptor pdBadString = new PropertyDescriptor("bad", Test7172865.class, "getBad", null);
+        PropertyDescriptor pdBadMethod = new PropertyDescriptor("bad",
+                Test7172865.class.getMethod("getBad"),
+                Test7172865.class.getMethod("setBad", args.getClass()));
+
+        errors += test(IndexedPropertyDescriptor.class, "good", true);
+        IndexedPropertyDescriptor ipdGoodString = new IndexedPropertyDescriptor("good", Test7172865.class, "getGood", "setGood", "getGood", "setGood");
+        IndexedPropertyDescriptor ipdGoodMethod = new IndexedPropertyDescriptor("good",
+                Test7172865.class.getMethod("getGood"),
+                Test7172865.class.getMethod("setGood", args.getClass()),
+                Test7172865.class.getMethod("getGood", Integer.TYPE),
+                Test7172865.class.getMethod("setGood", Integer.TYPE, String.class));
+
+        errors += test(IndexedPropertyDescriptor.class, "bad", false);
+        IndexedPropertyDescriptor ipdBadString = new IndexedPropertyDescriptor("bad", Test7172865.class, "getBad", null, "getBad", null);
+        IndexedPropertyDescriptor ipdBadMethod = new IndexedPropertyDescriptor("bad",
+                Test7172865.class.getMethod("getBad"),
+                Test7172865.class.getMethod("setBad", args.getClass()),
+                Test7172865.class.getMethod("getBad", Integer.TYPE),
+                Test7172865.class.getMethod("setBad", Integer.TYPE, String.class));
+
+        for (int i = 1; i <= 2; i++) {
+            System.out.println("STEP: " + i);
+            errors += test("md", null != md.getMethod());
+
+            errors += test("pdGoodString", pdGoodString, true, true);
+            errors += test("pdGoodMethod", pdGoodMethod, true, true);
+
+            errors += test("pdBadString", pdBadString, true, false);
+            errors += test("pdBadMethod", pdBadMethod, true, true);
+
+            errors += test("ipdGoodString", ipdGoodString, true, true, true, true);
+            errors += test("ipdGoodMethod", ipdGoodMethod, true, true, true, true);
+
+            errors += test("ipdBadString", ipdBadString, true, false, true, false);
+            errors += test("ipdBadMethod", ipdBadMethod, true, true, true, true);
+
+            try {
+                int[] array = new int[1024];
+                while (true) {
+                    array = new int[array.length << 1];
+                }
+            }
+            catch (OutOfMemoryError error) {
+                System.gc();
+            }
+        }
+        if (errors > 0) {
+            throw new Error("found " + errors + " errors");
+        }
+    }
+
+    private static int test(Class<?> type, String property, boolean value) {
+        String message = type.getSimpleName() + "(" + property + ") ";
+        try {
+            type.getConstructor(String.class, Class.class).newInstance(property, Test7172865.class);
+            message += "passed";
+        }
+        catch (Exception exception) {
+            message += "failed";
+            value = !value;
+        }
+        if (value) {
+            message += " as expected";
+        }
+        System.out.println(message);
+        return value ? 0 : 1;
+    }
+
+    private static int test(String message, boolean value) {
+        System.out.println(message + ": " + (value ? "passed" : "failed"));
+        return value ? 0 : 1;
+    }
+
+    private static int test(String message, PropertyDescriptor pd, boolean rm, boolean wm) {
+        return test(message + ".Read", rm == (null != pd.getReadMethod()))
+             + test(message + ".Write", wm == (null != pd.getWriteMethod()));
+    }
+
+    private static int test(String message, IndexedPropertyDescriptor ipd, boolean rm, boolean wm, boolean irm, boolean iwm) {
+        return test(message, ipd, rm, wm)
+             + test(message + ".IndexedRead", irm == (null != ipd.getIndexedReadMethod()))
+             + test(message + ".IndexedWrite", iwm == (null != ipd.getIndexedWriteMethod()));
+    }
+
+    public String[] getGood() {
+        return null;
+    }
+
+    public String getGood(int index) {
+        return null;
+    }
+
+    public void setGood(String[] good) {
+    }
+
+    public void setGood(int index, String value) {
+    }
+
+    public String[] getBad() {
+        return null;
+    }
+
+    public String getBad(int index) {
+        return null;
+    }
+
+    public Test7172865 setBad(String[] bad) {
+        return null;
+    }
+
+    public Test7172865 setBad(int index, String value) {
+        return null;
+    }
+}
--- a/jdk/test/java/beans/Performance/Test7122740.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/java/beans/Performance/Test7122740.java	Wed Sep 18 16:01:37 2013 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7122740
+ * @bug 7187618 7122740
  * @summary Tests just a benchmark of PropertyDescriptor(String, Class) performance
  * @author Sergey Malenkov
  * @run main/manual Test7122740
--- a/jdk/test/java/beans/Performance/Test7184799.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/java/beans/Performance/Test7184799.java	Wed Sep 18 16:01:37 2013 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7184799
+ * @bug 7187618 7184799
  * @summary Tests just a benchmark of Introspector.getBeanInfo(Class) performance
  * @author Sergey Malenkov
  * @run main/manual Test7184799
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/7195179/Test7195179.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,84 @@
+/*
+ * 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 java.awt.Component;
+import javax.swing.GroupLayout;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.ListCellRenderer;
+import javax.swing.plaf.basic.BasicComboBoxRenderer;
+
+import static javax.swing.SwingUtilities.invokeAndWait;
+
+/*
+ * @test
+ * @bug 7195179
+ * @summary Tests that combobox works with generified renderers
+ * @author Sergey Malenkov
+ */
+
+public class Test7195179 {
+    public static void main(String[] args) throws Exception {
+        invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                Integer[] items = {null, 1, 2, 3};
+                JComboBox<Integer> combo = new JComboBox<>(items);
+                JLabel label = new JLabel("choose:");
+                JPanel panel = new JPanel();
+                GroupLayout layout = new GroupLayout(panel);
+                panel.setLayout(layout);
+                label.setLabelFor(combo);
+                combo.setSelectedIndex(0);
+                combo.setRenderer(new ListCellRenderer<Integer>() {
+                    private final BasicComboBoxRenderer renderer = new BasicComboBoxRenderer();
+
+                    @Override
+                    public Component getListCellRendererComponent(JList<? extends Integer> list, Integer value, int index, boolean isSelected, boolean cellHasFocus) {
+                        return this.renderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+                    }
+                });
+                layout.setAutoCreateContainerGaps(true);
+                layout.setAutoCreateGaps(true);
+                layout.setHorizontalGroup(layout.createSequentialGroup()
+                        .addGroup(layout.createParallelGroup().addComponent(label))
+                        .addGroup(layout.createParallelGroup().addComponent(combo)));
+                layout.setVerticalGroup(layout
+                        .createSequentialGroup()
+                        .addGroup(layout
+                                .createParallelGroup(GroupLayout.Alignment.BASELINE)
+                                .addComponent(label)
+                                .addComponent(combo)));
+
+                JFrame frame = new JFrame(getClass().getSimpleName());
+                frame.add(panel);
+                frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+    }
+}
--- a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.html	Wed Sep 18 16:01:37 2013 -0700
@@ -1,6 +1,38 @@
 <html>
+<!--
+ 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 4150029 8006087
+ @summary BackSpace keyboard button does not lead to parent directory
+ @author Oleg Mokhovikov
+ @run applet/manual=done bug4150029.html
+-->
+
 <body>
 <applet  code="bug4150029.class" width=200 height=200></applet>
+Follow the instructions below.
 1.Go into 'subDir' folder.
 2.Press BACKSPACE key.
 3.Push OPEN button.
--- a/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/javax/swing/JFileChooser/4150029/bug4150029.java	Wed Sep 18 16:01:37 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -21,11 +21,10 @@
  * questions.
  */
 
-/* @test
-   @bug 4150029
-   @summary BackSpace keyboard button does not lead to parent directory
-   @author Oleg Mokhovikov
-   @run applet/manual=done bug4150029.html
+/*
+   bug 4150029 8006087
+   summary BackSpace keyboard button does not lead to parent directory
+   author Oleg Mokhovikov
 */
 
 import javax.swing.*;
@@ -36,6 +35,14 @@
     private boolean res;
 
     public void init() {
+        if (sun.awt.OSInfo.getOSType() == sun.awt.OSInfo.OSType.MACOSX) {
+            try {
+                UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+
         String tmpDir = System.getProperty("java.io.tmpdir");
 
         if (tmpDir.length() == 0) {//'java.io.tmpdir' isn't guaranteed to be defined
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/7199708/bug7199708.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,158 @@
+/*
+ * 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 java.awt.Component;
+import java.awt.Container;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+import javax.swing.JFileChooser;
+import javax.swing.SwingUtilities;
+
+import java.nio.file.Files;
+import javax.swing.AbstractButton;
+import javax.swing.JTable;
+import javax.swing.UIManager;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 7199708
+ * @author Alexander Scherbatiy
+ * @summary FileChooser crashs when opening large folder
+ * @run main bug7199708
+ */
+public class bug7199708 {
+
+    private static int FILE_NUMBER = 30000;
+    private static volatile JFileChooser fileChooser;
+    private static volatile int locationX;
+    private static volatile int locationY;
+    private static volatile int width;
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        final File folder = createLargeFolder();
+        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                fileChooser = new JFileChooser(folder);
+                fileChooser.showSaveDialog(null);
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                final String detailsTooltip = UIManager.getString("FileChooser."
+                        + "detailsViewButtonToolTipText", fileChooser.getLocale());
+
+                doAction(fileChooser, new ComponentAction() {
+                    @Override
+                    public boolean accept(Component component) {
+                        return (component instanceof AbstractButton)
+                                && detailsTooltip.equals(
+                                ((AbstractButton) component).getToolTipText());
+                    }
+
+                    @Override
+                    public void perform(Component component) {
+                        ((AbstractButton) component).doClick();
+                    }
+                });
+
+                doAction(fileChooser, new ComponentAction() {
+                    @Override
+                    public boolean accept(Component component) {
+                        return (component instanceof JTable);
+                    }
+
+                    @Override
+                    public void perform(Component component) {
+                        Point tableLocation = component.getLocationOnScreen();
+                        locationX = (int) tableLocation.getX();
+                        locationY = (int) tableLocation.getY();
+                        width = (int) fileChooser.getBounds().getWidth();
+                    }
+                });
+            }
+        });
+
+        toolkit.realSync();
+
+        int d = 25;
+        for (int i = 0; i < width / d; i++) {
+            robot.mouseMove(locationX + i * d, locationY + 5);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            toolkit.realSync();
+        }
+
+        robot.keyPress(KeyEvent.VK_ESCAPE);
+        robot.keyRelease(KeyEvent.VK_ESCAPE);
+    }
+
+    static void doAction(Component component, ComponentAction action) {
+        if (action.accept(component)) {
+            action.perform(component);
+        } else if (component instanceof Container) {
+            for (Component comp : ((Container) component).getComponents()) {
+                doAction(comp, action);
+            }
+        }
+    }
+
+    private static File createLargeFolder() {
+        try {
+
+            File largeFolder = Files.createTempDirectory("large_folder").toFile();
+            largeFolder.deleteOnExit();
+
+            for (int i = 0; i < FILE_NUMBER; i++) {
+                File file = new File(largeFolder, "File_" + i + ".txt");
+                file.createNewFile();
+                file.deleteOnExit();
+            }
+            return largeFolder;
+        } catch (IOException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    interface ComponentAction {
+
+        boolean accept(Component component);
+
+        void perform(Component component);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/8002077/bug8002077.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,82 @@
+/*
+ * 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 java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
+import javax.swing.JFileChooser;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UIManager.LookAndFeelInfo;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8002077
+ * @author Alexander Scherbatiy
+ * @summary Possible mnemonic issue on JFileChooser Save button on nimbus L&F
+ * @library ../../regtesthelpers/
+ * @build Util
+ * @run main bug8002077
+ */
+public class bug8002077 {
+
+    private static volatile int fileChooserState = JFileChooser.ERROR_OPTION;
+
+    public static void main(String[] args) throws Exception {
+        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
+            if ("Nimbus".equals(info.getName())) {
+                UIManager.setLookAndFeel(info.getClassName());
+                runTest();
+                break;
+            }
+        }
+    }
+
+    private static void runTest() throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                fileChooserState = new JFileChooser().showSaveDialog(null);
+            }
+        });
+        toolkit.realSync();
+
+        Util.hitMnemonics(robot, KeyEvent.VK_N);
+        toolkit.realSync();
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        toolkit.realSync();
+
+        Util.hitMnemonics(robot, KeyEvent.VK_S);
+        toolkit.realSync();
+
+        if (fileChooserState != JFileChooser.APPROVE_OPTION) {
+            throw new RuntimeException("Save button is not pressed!");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JFileChooser/8021253/bug8021253.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,113 @@
+/*
+ * 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 java.io.File;
+import java.io.IOException;
+import java.awt.BorderLayout;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8021253
+ * @author Alexander Scherbatiy
+ * @summary JFileChooser does not react on pressing enter since java 7
+ * @run main bug8021253
+ */
+
+public class bug8021253 {
+
+    private static volatile boolean defaultKeyPressed;
+    private static JFileChooser fileChooser;
+    private static File file;
+
+    public static void main(String[] args) throws Exception {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                fileChooser.setSelectedFile(file);
+            }
+        });
+
+        toolkit.realSync();
+
+        robot.keyPress(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_ENTER);
+        toolkit.realSync();
+
+        if (!defaultKeyPressed) {
+            throw new RuntimeException("Default button is not pressed");
+        }
+    }
+
+    private static void createAndShowGUI() {
+
+        file = getTempFile();
+
+        final JFrame frame = new JFrame("Test");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(200, 300);
+
+        fileChooser = new JFileChooser(file.getParentFile());
+        fileChooser.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                defaultKeyPressed = true;
+                frame.dispose();
+            }
+        });
+
+        frame.getContentPane().add(BorderLayout.CENTER, fileChooser);
+        frame.setSize(fileChooser.getPreferredSize());
+        frame.setVisible(true);
+    }
+
+    private static File getTempFile() {
+        try {
+            File temp = File.createTempFile("test", ".txt");
+            temp.deleteOnExit();
+            return temp;
+        } catch (IOException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+}
--- a/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java	Wed Sep 18 16:01:37 2013 -0700
@@ -27,19 +27,19 @@
     @author mcherkas
     @run main InternalFrameIsNotCollectedTest
  */
-
 import sun.awt.SunToolkit;
 
 import javax.swing.*;
 import java.awt.*;
-import java.awt.event.KeyEvent;
 import java.beans.PropertyVetoException;
 import java.util.Date;
 
 public class InternalFrameIsNotCollectedTest {
 
-    public static final int waitTime = 10000;
+    public static final int maxWaitTime = 100000;
+    public static final int waitTime = 5000;
     private static Robot robot;
+    private static CustomInternalFrame iFrame;
 
     public static void sync() {
 
@@ -62,12 +62,13 @@
         });
         sync();
         invokeGC();
+        System.runFinalization();
         Thread.sleep(1000); // it's better to wait 1 sec now then 10 sec later
         Date startWaiting = new Date();
         synchronized (CustomInternalFrame.waiter) {
             // Sync with finalization thread.
             Date now = new Date();
-            while (now.getTime() - startWaiting.getTime() < waitTime && !CustomInternalFrame.finalized) {
+            while (now.getTime() - startWaiting.getTime() < maxWaitTime && !CustomInternalFrame.finalized) {
                 CustomInternalFrame.waiter.wait(waitTime);
                 now = new Date();
             }
@@ -83,10 +84,8 @@
     }
 
     private static void closeInternalFrame() throws PropertyVetoException {
-        robot.keyPress(KeyEvent.VK_CONTROL);
-        robot.keyPress(KeyEvent.VK_F4);
-        robot.keyRelease(KeyEvent.VK_F4);
-        robot.keyRelease(KeyEvent.VK_CONTROL);
+        iFrame.setClosed(true);
+        iFrame = null;
     }
 
     private static void initUI() {
@@ -96,7 +95,7 @@
         desktopPane.setDesktopManager(new DefaultDesktopManager());
         frame.getContentPane().add(desktopPane, BorderLayout.CENTER);
 
-        CustomInternalFrame iFrame = new CustomInternalFrame("Dummy Frame");
+        iFrame = new CustomInternalFrame("Dummy Frame");
 
         iFrame.setSize(200, 200);
         iFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenuBar/4750590/bug4750590.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,98 @@
+/*
+ * 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
+ @library ../../regtesthelpers
+ @build Util
+ @bug 4750590 8015597
+ @summary SwingSet: Cannot change Themes using menu accelerators
+ @author Alexander Zuev
+ @run main bug4750590
+ */
+
+import javax.swing.*;
+import java.awt.event.*;
+import java.awt.*;
+
+public class bug4750590 {
+
+    public static PassedListener pass = new PassedListener();
+    public static volatile boolean passed = false;
+
+    public static void main(String args[]) throws Throwable {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        sun.awt.SunToolkit toolkit = (sun.awt.SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        Robot robo = new Robot();
+        robo.setAutoDelay(500);
+        Util.hitMnemonics(robo, KeyEvent.VK_F);
+        robo.keyPress(KeyEvent.VK_M);
+        robo.keyRelease(KeyEvent.VK_M);
+
+        toolkit.realSync();
+
+        if (passed) {
+            System.out.println("Test passed!");
+        } else {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+
+    private static void createAndShowGUI() {
+        JFrame mainFrame = new JFrame("Bug 4750590");
+        JMenuBar mbar = new JMenuBar();
+        JMenu menu = new JMenu("File");
+        menu.setMnemonic('F');
+        JMenu submenu = new JMenu("Submenu");
+        submenu.add(new JMenuItem("SubMenu Item 1")).setMnemonic('S');
+        submenu.add(new JMenuItem("SubMenu Item 2"));
+        menu.add(submenu);
+
+        menu.add(new JMenuItem("Menu Item 1"));
+        JMenuItem menuItem = menu.add(new JMenuItem("Menu Item 2"));
+        menuItem.setMnemonic('M');
+        menuItem.addActionListener(pass);
+        mbar.add(menu);
+        mainFrame.setJMenuBar(mbar);
+
+        mainFrame.setSize(200, 200);
+        mainFrame.setLocation(200, 200);
+        mainFrame.setVisible(true);
+        mainFrame.toFront();
+    }
+
+    public static class PassedListener implements ActionListener {
+        public void actionPerformed(ActionEvent ev) {
+            passed = true;
+        }
+    }
+
+}
--- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Wed Sep 18 16:01:37 2013 -0700
@@ -35,12 +35,13 @@
 import javax.swing.*;
 
 public class ActionListenerCalledTwiceTest {
-    static String menuItems[] = { "Item1", "Item2", "Item3", "Item4" };
+    static String menuItems[] = { "Item1", "Item2", "Item3", "Item4", "Item5" };
     static KeyStroke keyStrokes[] = {
         KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK),
         KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
         KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.SHIFT_MASK),
-        KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.META_MASK)
+        KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.META_MASK),
+        KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK)
     };
 
     static volatile int listenerCallCounter = 0;
--- a/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/javax/swing/JScrollBar/7163696/Test7163696.java	Wed Sep 18 16:01:37 2013 -0700
@@ -59,7 +59,8 @@
             UIManager.setLookAndFeel(info.getClassName());
 
             SwingUtilities.invokeAndWait(this);
-            toolkit.realSync(500); // after creation
+            toolkit.realSync(); // after creation
+            Thread.sleep(1000);
 
             Point point = this.bar.getLocation();
             SwingUtilities.convertPointToScreen(point, this.bar);
@@ -69,7 +70,8 @@
             robot.mousePress(InputEvent.BUTTON1_MASK);
             robot.mouseRelease(InputEvent.BUTTON1_MASK);
 
-            toolkit.realSync(500); // before validation
+            toolkit.realSync(); // before validation
+            Thread.sleep(1000);
             SwingUtilities.invokeAndWait(this);
 
             if (this.bar != null) {
--- a/jdk/test/javax/swing/JTable/7068740/bug7068740.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/javax/swing/JTable/7068740/bug7068740.java	Wed Sep 18 16:01:37 2013 -0700
@@ -37,6 +37,7 @@
 import java.awt.*;
 import java.awt.event.KeyEvent;
 import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.atomic.AtomicInteger;
 
 public class bug7068740 extends JFrame {
 
@@ -66,6 +67,7 @@
         };
 
         table = new JTable(model);
+        table.setRowSelectionInterval(0, 0);
         LayerUI<JComponent> layerUI = new LayerUI<>();
         JLayer<JComponent> layer = new JLayer<>(table, layerUI);
         JScrollPane scrollPane = new JScrollPane(layer);
@@ -78,7 +80,7 @@
         try {
             if (robot == null) {
                 robot = new Robot();
-                robot.setAutoDelay(20);
+                robot.setAutoDelay(50);
             }
 
             if (toolkit == null) {
@@ -104,24 +106,37 @@
         }
     }
 
-    private static void doTest() {
+    private static int getSelectedRow() throws Exception {
+        final AtomicInteger row = new AtomicInteger(-1);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                row.set(table.getSelectedRow());
+            }
+        });
+        return row.intValue();
+    }
+
+    private static void doTest() throws Exception {
         toolkit.realSync();
-        table.setRowSelectionInterval(0, 0);
 
         robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+        robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
         toolkit.realSync();
-        if (table.getSelectedRow() != 19) {
+
+        if (getSelectedRow() != 19) {
             throw new RuntimeException("Test failed");
         }
 
         robot.keyPress(KeyEvent.VK_PAGE_UP);
+        robot.keyRelease(KeyEvent.VK_PAGE_UP);
         toolkit.realSync();
-        if (table.getSelectedRow() != 0) {
+        if (getSelectedRow() != 0) {
             throw new RuntimeException("Test failed");
         }
     }
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
         try {
             UIManager.setLookAndFeel(new MetalLookAndFeel());
             setUp();
--- a/jdk/test/javax/swing/JTree/8013571/Test8013571.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/javax/swing/JTree/8013571/Test8013571.java	Wed Sep 18 16:01:37 2013 -0700
@@ -27,8 +27,8 @@
 
 /*
  * @test
- * @bug 8016545
- * @summary Tests beans with public fields
+ * @bug 8013571
+ * @summary Tests null as a root of TreeModelEvent
  * @author Sergey Malenkov
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicTabbedPaneUI/Test6943780.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,56 @@
+/*
+ * 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.JButton;
+import javax.swing.JTabbedPane;
+import java.awt.Component;
+
+import static javax.swing.SwingUtilities.invokeAndWait;
+
+/*
+ * @test
+ * @bug 4873983 6943780
+ * @summary Tests JTabbedPane with SCROLL_TAB_LAYOUT
+ * @author Sergey Malenkov
+ */
+public class Test6943780 implements Runnable, Thread.UncaughtExceptionHandler {
+    public static void main(String[] args) throws Exception {
+        invokeAndWait(new Test6943780());
+    }
+
+    @Override
+    public void uncaughtException(Thread thread, Throwable throwable) {
+        throwable.printStackTrace();
+        System.exit(1);
+    }
+
+    @Override
+    public void run() {
+        JTabbedPane pane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
+        pane.addTab("first", new JButton("first"));
+        pane.addTab("second", new JButton("second"));
+        for (Component component : pane.getComponents()) {
+            component.setSize(100, 100);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,174 @@
+/*
+ * 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 8023474
+ * @summary Tests that the first mouse press starts editing in JTree
+ * @author Dmitry Markov
+ * @run main bug8023474
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.event.CellEditorListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeCellEditor;
+import javax.swing.tree.TreeCellRenderer;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.util.EventObject;
+
+public class bug8023474 {
+    private static JTree tree;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        toolkit.realSync();
+
+        Point point = getRowPointToClick(1);
+        robot.mouseMove(point.x, point.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        toolkit.realSync();
+
+        Boolean result = (Boolean)tree.getCellEditor().getCellEditorValue();
+        if (!result) {
+            throw new RuntimeException("Test Failed!");
+        }
+    }
+
+    private static void createAndShowGUI() {
+        try {
+            UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
+        DefaultMutableTreeNode item = new DefaultMutableTreeNode("item");
+        DefaultMutableTreeNode subItem = new DefaultMutableTreeNode("subItem");
+
+        root.add(item);
+        item.add(subItem);
+
+        DefaultTreeModel model = new DefaultTreeModel(root);
+        tree = new JTree(model);
+
+        tree.setCellEditor(new Editor());
+        tree.setEditable(true);
+        tree.setRowHeight(30);
+        tree.setCellRenderer(new CheckboxCellRenderer());
+
+        JFrame frame = new JFrame("bug8023474");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.add(new JScrollPane(tree));
+        frame.setSize(400, 300);
+        frame.setVisible(true);
+    }
+
+    private static Point getRowPointToClick(final int row) throws Exception {
+        final Point[] result = new Point[1];
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                Rectangle rect = tree.getRowBounds(row);
+                Point point = new Point(rect.x + 10, rect.y + rect.height / 2);
+                SwingUtilities.convertPointToScreen(point, tree);
+                result[0] = point;
+            }
+        });
+        return result[0];
+    }
+
+    private static class Editor extends JPanel implements TreeCellEditor {
+        private JCheckBox checkbox;
+
+        public Editor() {
+            setOpaque(false);
+            checkbox = new JCheckBox();
+            add(checkbox);
+        }
+
+        public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected,
+                                                    boolean expanded, boolean leaf, int row) {
+            checkbox.setText(value.toString());
+            checkbox.setSelected(false);
+            return this;
+        }
+
+        public Object getCellEditorValue() {
+            return checkbox.isSelected();
+        }
+
+        public boolean isCellEditable(EventObject anEvent) {
+            return true;
+        }
+
+        public boolean shouldSelectCell(EventObject anEvent) {
+            return true;
+        }
+
+        public boolean stopCellEditing() {
+            return true;
+        }
+
+        public void cancelCellEditing() {
+        }
+
+        public void addCellEditorListener(CellEditorListener l) {
+        }
+
+        public void removeCellEditorListener(CellEditorListener l) {
+        }
+    }
+
+    private static class CheckboxCellRenderer extends JPanel implements TreeCellRenderer {
+        private JCheckBox checkbox;
+
+        public CheckboxCellRenderer() {
+            setOpaque(false);
+            checkbox = new JCheckBox();
+            add(checkbox);
+        }
+
+        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
+                                                      boolean leaf, int row, boolean hasFocus) {
+            checkbox.setText(value.toString());
+            checkbox.setSelected(false);
+            return this;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/AbstractDocument/6968363/Test6968363.java	Wed Sep 18 16:01:37 2013 -0700
@@ -0,0 +1,241 @@
+/*
+ * 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.awt.SunToolkit;
+
+import java.awt.Robot;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import javax.swing.event.DocumentListener;
+import javax.swing.event.UndoableEditListener;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import javax.swing.text.Element;
+import javax.swing.text.PlainDocument;
+import javax.swing.text.Position;
+import javax.swing.text.Segment;
+
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_LEFT;
+import static javax.swing.SwingUtilities.invokeAndWait;
+
+/*
+ * @test
+ * @bug 6968363
+ * @summary Ensures that a custom document may not extend AbstractDocument
+ * @author Sergey Malenkov
+ */
+public class Test6968363 implements Runnable, Thread.UncaughtExceptionHandler {
+    private JFrame frame;
+
+    public static void main(String[] args) throws Exception {
+        SunToolkit toolkit = (SunToolkit) getDefaultToolkit();
+        Runnable task = new Test6968363();
+        invokeAndWait(task);
+        toolkit.realSync(100);
+        new Robot().keyPress(VK_LEFT);
+        toolkit.realSync(100);
+        invokeAndWait(task);
+    }
+
+    @Override
+    public void uncaughtException(Thread thread, Throwable throwable) {
+        throwable.printStackTrace();
+        System.exit(1);
+    }
+
+    @Override
+    public void run() {
+        if (this.frame == null) {
+            Thread.setDefaultUncaughtExceptionHandler(this);
+            this.frame = new JFrame(getClass().getSimpleName());
+            this.frame.add(NORTH, new JLabel("Copy Paste a HINDI text into the field below"));
+            this.frame.add(SOUTH, new JTextField(new MyDocument(), "\u0938", 10));
+            this.frame.pack();
+            this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+            this.frame.setLocationRelativeTo(null);
+            this.frame.setVisible(true);
+        } else {
+            this.frame.dispose();
+            this.frame = null;
+        }
+    }
+
+    private static class MyDocument implements Document {
+        private final Document document = new PlainDocument();
+
+        @Override
+        public int getLength() {
+            return this.document.getLength();
+        }
+
+        @Override
+        public void addDocumentListener(DocumentListener listener) {
+            this.document.addDocumentListener(listener);
+        }
+
+        @Override
+        public void removeDocumentListener(DocumentListener listener) {
+            this.document.removeDocumentListener(listener);
+        }
+
+        @Override
+        public void addUndoableEditListener(UndoableEditListener listener) {
+            this.document.addUndoableEditListener(listener);
+        }
+
+        @Override
+        public void removeUndoableEditListener(UndoableEditListener listener) {
+            this.document.removeUndoableEditListener(listener);
+        }
+
+        @Override
+        public Object getProperty(Object key) {
+            return this.document.getProperty(key);
+        }
+
+        @Override
+        public void putProperty(Object key, Object value) {
+            this.document.putProperty(key, value);
+        }
+
+        @Override
+        public void remove(int offset, int length) throws BadLocationException {
+            this.document.remove(offset, length);
+        }
+
+        @Override
+        public void insertString(int offset, String string, AttributeSet set) throws BadLocationException {
+            for (int i = 0; i < string.length(); i++) {
+                System.out.println("i: " + i + "; ch: " + Integer.toHexString(string.charAt(i)));
+            }
+            this.document.insertString(offset, string, set);
+        }
+
+        @Override
+        public String getText(int offset, int length) throws BadLocationException {
+            return this.document.getText(offset, length);
+        }
+
+        @Override
+        public void getText(int offset, int length, Segment segment) throws BadLocationException {
+            this.document.getText(offset, length, segment);
+        }
+
+        @Override
+        public Position getStartPosition() {
+            return this.document.getStartPosition();
+        }
+
+        @Override
+        public Position getEndPosition() {
+            return this.document.getEndPosition();
+        }
+
+        @Override
+        public Position createPosition(int offset) throws BadLocationException {
+            return this.document.createPosition(offset);
+        }
+
+        @Override
+        public Element[] getRootElements() {
+            Element[] elements = this.document.getRootElements();
+            Element[] wrappers = new Element[elements.length];
+            for (int i = 0; i < elements.length; i++) {
+                wrappers[i] = new MyElement(elements[i]);
+            }
+            return wrappers;
+        }
+
+        @Override
+        public Element getDefaultRootElement() {
+            return new MyElement(this.document.getDefaultRootElement());
+        }
+
+        @Override
+        public void render(Runnable task) {
+            this.document.render(task);
+        }
+
+        private class MyElement implements Element {
+            private final Element element;
+
+            private MyElement(Element element) {
+                this.element = element;
+            }
+
+            @Override
+            public Document getDocument() {
+                return MyDocument.this;
+            }
+
+            @Override
+            public Element getParentElement() {
+                return new MyElement(this.element.getParentElement());
+            }
+
+            @Override
+            public String getName() {
+                return this.element.getName();
+            }
+
+            @Override
+            public AttributeSet getAttributes() {
+                return this.element.getAttributes();
+            }
+
+            @Override
+            public int getStartOffset() {
+                return this.element.getStartOffset();
+            }
+
+            @Override
+            public int getEndOffset() {
+                return this.element.getEndOffset();
+            }
+
+            @Override
+            public int getElementIndex(int offset) {
+                return this.element.getElementIndex(offset);
+            }
+
+            @Override
+            public int getElementCount() {
+                return this.element.getElementCount();
+            }
+
+            @Override
+            public Element getElement(int index) {
+                return new MyElement(this.element.getElement(index));
+            }
+
+            @Override
+            public boolean isLeaf() {
+                return this.element.isLeaf();
+            }
+        }
+    }
+}
--- a/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Wed Jul 05 19:12:21 2017 +0200
+++ b/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Wed Sep 18 16:01:37 2013 -0700
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8014863
+ * @bug 8024395
  * @summary  Tests the calculation of the line breaks when a text is inserted
  * @author Dmitry Markov
  * @library ../../../regtesthelpers
@@ -34,91 +35,107 @@
 import sun.awt.SunToolkit;
 
 import javax.swing.*;
+import javax.swing.text.GlyphView;
+import javax.swing.text.View;
 import javax.swing.text.html.HTMLEditorKit;
 import java.awt.*;
 import java.awt.event.KeyEvent;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
 
 public class bug8014863 {
 
     private static JEditorPane editorPane;
+    private static JFrame frame;
     private static Robot robot;
     private static SunToolkit toolkit;
 
+    private static String text1 = "<p>one two qqqq <em>this is a test sentence</em> qqqq <em>pp</em> qqqq <em>pp</em> " +
+            "qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>";
+    private static String text2 = "<p>qqqq <em>this is a test sentence</em> qqqq <em>pp</em> qqqq <em>pp</em> " +
+            "qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>";
+
+    private static ArrayList<GlyphView> glyphViews;
+
     public static void main(String[] args) throws Exception {
         toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         robot = new Robot();
+        robot.setAutoDelay(50);
+        glyphViews = new ArrayList<GlyphView>();
 
-        createAndShowGUI();
+        createAndShowGUI(text1);
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                retrieveGlyphViews(editorPane.getUI().getRootView(editorPane));
+            }
+        });
+        GlyphView [] arr1 = glyphViews.toArray(new GlyphView[glyphViews.size()]);
+
+        frame.dispose();
+        glyphViews.clear();
+
+        createAndShowGUI(text2);
 
         toolkit.realSync();
 
         Util.hitKeys(robot, KeyEvent.VK_HOME);
-        Util.hitKeys(robot, KeyEvent.VK_O);
-
         toolkit.realSync();
 
-        if (3 != getNumberOfTextLines()) {
-            throw new RuntimeException("The number of texts lines does not meet the expectation");
-        }
-
+        Util.hitKeys(robot, KeyEvent.VK_O);
         Util.hitKeys(robot, KeyEvent.VK_N);
-
-        toolkit.realSync();
-
-        if (3 != getNumberOfTextLines()) {
-            throw new RuntimeException("The number of texts lines does not meet the expectation");
-        }
-
         Util.hitKeys(robot, KeyEvent.VK_E);
         Util.hitKeys(robot, KeyEvent.VK_SPACE);
         Util.hitKeys(robot, KeyEvent.VK_T);
         Util.hitKeys(robot, KeyEvent.VK_W);
+        Util.hitKeys(robot, KeyEvent.VK_O);
+        Util.hitKeys(robot, KeyEvent.VK_SPACE);
 
         toolkit.realSync();
 
-        if (3 != getNumberOfTextLines()) {
-            throw new RuntimeException("The number of texts lines does not meet the expectation");
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                retrieveGlyphViews(editorPane.getUI().getRootView(editorPane));
+            }
+        });
+        GlyphView [] arr2 = glyphViews.toArray(new GlyphView[glyphViews.size()]);
+
+        if (arr1.length != arr2.length) {
+            throw new RuntimeException("Test Failed!");
+        }
+
+        for (int i=0; i<arr1.length; i++) {
+            GlyphView v1 = arr1[i];
+            GlyphView v2 = arr2[i];
+            Field field = GlyphView.class.getDeclaredField("breakSpots");
+            field.setAccessible(true);
+            int[] breakSpots1 = (int[])field.get(v1);
+            int[] breakSpots2 = (int[])field.get(v2);
+            if (!Arrays.equals(breakSpots1,breakSpots2)) {
+                throw new RuntimeException("Test Failed!");
+            }
+        }
+
+        frame.dispose();
+    }
+
+    private static void retrieveGlyphViews(View root) {
+        for (int i=0; i<= root.getViewCount()-1; i++) {
+            View view = root.getView(i);
+            if (view instanceof GlyphView && view.isVisible()) {
+                if (!glyphViews.contains(view)) {
+                    glyphViews.add((GlyphView)view);
+                }
+            } else {
+                retrieveGlyphViews(view);
+            }
         }
     }
 
-    private static int getNumberOfTextLines() throws Exception {
-        int numberOfLines = 0;
-        int caretPosition = getCaretPosition();
-        int current = 1;
-        int previous;
-
-        setCaretPosition(current);
-        do {
-            previous = current;
-            Util.hitKeys(robot, KeyEvent.VK_DOWN);
-            toolkit.realSync();
-            current = getCaretPosition();
-            numberOfLines++;
-        } while (current != previous);
-
-        setCaretPosition(caretPosition);
-        return numberOfLines;
-    }
-
-    private static int getCaretPosition() throws Exception {
-        final int[] result = new int[1];
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                result[0] = editorPane.getCaretPosition();
-            }
-        });
-        return result[0];
-    }
-
-    private static void setCaretPosition(final int position) throws Exception {
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                editorPane.setCaretPosition(position);
-            }
-        });
-    }
-
-    private static void createAndShowGUI() throws Exception {
+    private static void createAndShowGUI(String text) throws Exception {
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 try {
@@ -126,22 +143,17 @@
                 } catch (Exception ex) {
                     throw new RuntimeException(ex);
                 }
-                JFrame frame = new JFrame();
+                frame = new JFrame();
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
                 editorPane = new JEditorPane();
                 HTMLEditorKit editorKit = new HTMLEditorKit();
                 editorPane.setEditorKit(editorKit);
-                editorPane.setText("<p>qqqq <em>pp</em> qqqq <em>pp</em> " +
-                        "qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp" +
-                        "</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>");
+                editorPane.setText(text);
                 editorPane.setCaretPosition(1);
-                // An actual font size depends on OS and might be differnet on various OSs.
-                // It is necessary to calculate the width to meet the expected number of lines.
-                int width = SwingUtilities.computeStringWidth(editorPane.getFontMetrics(editorPane.getFont()),
-                        "qqqq pp qqqq pp qqqq pp qqqqqqqq");
+
                 frame.add(editorPane);
-                frame.setSize(width, 200);
+                frame.setSize(200, 200);
                 frame.setVisible(true);
             }
         });