changeset 9598:01882e0cdefc

Merge
author lana
date Wed, 23 Apr 2014 18:04:17 -0700
parents e323c74edabd 9376d1440257
children 38786bfec977
files src/share/classes/javax/swing/text/html/ResourceLoader.java src/share/classes/javax/swing/text/html/parser/ResourceLoader.java
diffstat 30 files changed, 1630 insertions(+), 582 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/beans/util/Cache.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/com/sun/beans/util/Cache.java	Wed Apr 23 18:04:17 2014 -0700
@@ -119,13 +119,13 @@
         synchronized (this.queue) {
             // synchronized search improves stability
             // we must create and add new value if there are no needed entry
-            int index = index(hash, this.table);
-            current = getEntryValue(key, hash, this.table[index]);
+            current = getEntryValue(key, hash, this.table[index(hash, this.table)]);
             if (current != null) {
                 return current;
             }
             V value = create(key);
             Objects.requireNonNull(value, "value");
+            int index = index(hash, this.table);
             this.table[index] = new CacheEntry<>(hash, key, value, this.table[index]);
             if (++this.size >= this.threshold) {
                 if (this.table.length == MAXIMUM_CAPACITY) {
--- a/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/com/sun/jarsigner/ContentSignerParameters.java	Wed Apr 23 18:04:17 2014 -0700
@@ -35,7 +35,7 @@
  * @since 1.5
  * @author Vincent Ryan
  */
-
+@jdk.Exported
 public interface ContentSignerParameters {
 
     /**
@@ -64,7 +64,9 @@
      *
      * @return The TSAPolicyID. May be null.
      */
-    public String getTSAPolicyID();
+    public default String getTSAPolicyID() {
+        return null;
+    }
 
     /**
      * Retrieves the JAR file's signature.
--- a/src/share/classes/java/beans/MethodDescriptor.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/java/beans/MethodDescriptor.java	Wed Apr 23 18:04:17 2014 -0700
@@ -162,6 +162,16 @@
                 : null;
     }
 
+    private static Method resolve(Method oldMethod, Method newMethod) {
+        if (oldMethod == null) {
+            return newMethod;
+        }
+        if (newMethod == null) {
+            return oldMethod;
+        }
+        return !oldMethod.isSynthetic() && newMethod.isSynthetic() ? oldMethod : newMethod;
+    }
+
     /*
      * Package-private constructor
      * Merge two method descriptors.  Where they conflict, give the
@@ -173,8 +183,7 @@
     MethodDescriptor(MethodDescriptor x, MethodDescriptor y) {
         super(x, y);
 
-        Method method = y.methodRef.get();
-        this.methodRef.set(null != method ? method : x.methodRef.get());
+        this.methodRef.set(resolve(x.methodRef.get(), y.methodRef.get()));
         params = x.params;
         if (y.params != null) {
             params = y.params;
--- a/src/share/classes/java/io/ObjectOutputStream.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/java/io/ObjectOutputStream.java	Wed Apr 23 18:04:17 2014 -0700
@@ -1255,7 +1255,7 @@
         }
 
         bout.setBlockDataMode(true);
-        if (isCustomSubclass()) {
+        if (cl != null && isCustomSubclass()) {
             ReflectUtil.checkPackageAccess(cl);
         }
         annotateProxyClass(cl);
@@ -1284,7 +1284,7 @@
 
         Class<?> cl = desc.forClass();
         bout.setBlockDataMode(true);
-        if (isCustomSubclass()) {
+        if (cl != null && isCustomSubclass()) {
             ReflectUtil.checkPackageAccess(cl);
         }
         annotateClass(cl);
--- a/src/share/classes/java/time/format/DateTimeFormatter.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/java/time/format/DateTimeFormatter.java	Wed Apr 23 18:04:17 2014 -0700
@@ -1934,8 +1934,8 @@
      */
     private TemporalAccessor parseResolved0(final CharSequence text, final ParsePosition position) {
         ParsePosition pos = (position != null ? position : new ParsePosition(0));
-        Parsed unresolved = parseUnresolved0(text, pos);
-        if (unresolved == null || pos.getErrorIndex() >= 0 || (position == null && pos.getIndex() < text.length())) {
+        DateTimeParseContext context = parseUnresolved0(text, pos);
+        if (context == null || pos.getErrorIndex() >= 0 || (position == null && pos.getIndex() < text.length())) {
             String abbr;
             if (text.length() > 64) {
                 abbr = text.subSequence(0, 64).toString() + "...";
@@ -1950,7 +1950,7 @@
                         pos.getIndex(), text, pos.getIndex());
             }
         }
-        return unresolved.resolve(resolverStyle, resolverFields);
+        return context.toResolved(resolverStyle, resolverFields);
     }
 
     /**
@@ -1993,10 +1993,14 @@
      * @throws IndexOutOfBoundsException if the position is invalid
      */
     public TemporalAccessor parseUnresolved(CharSequence text, ParsePosition position) {
-        return parseUnresolved0(text, position);
+        DateTimeParseContext context = parseUnresolved0(text, position);
+        if (context == null) {
+            return null;
+        }
+        return context.toUnresolved();
     }
 
-    private Parsed parseUnresolved0(CharSequence text, ParsePosition position) {
+    private DateTimeParseContext parseUnresolved0(CharSequence text, ParsePosition position) {
         Objects.requireNonNull(text, "text");
         Objects.requireNonNull(position, "position");
         DateTimeParseContext context = new DateTimeParseContext(this);
@@ -2007,7 +2011,7 @@
             return null;
         }
         position.setIndex(pos);  // errorIndex not updated from input
-        return context.toParsed();
+        return context;
     }
 
     //-----------------------------------------------------------------------
@@ -2128,23 +2132,23 @@
         @Override
         public Object parseObject(String text, ParsePosition pos) {
             Objects.requireNonNull(text, "text");
-            Parsed unresolved;
+            DateTimeParseContext context;
             try {
-                unresolved = formatter.parseUnresolved0(text, pos);
+                context = formatter.parseUnresolved0(text, pos);
             } catch (IndexOutOfBoundsException ex) {
                 if (pos.getErrorIndex() < 0) {
                     pos.setErrorIndex(0);
                 }
                 return null;
             }
-            if (unresolved == null) {
+            if (context == null) {
                 if (pos.getErrorIndex() < 0) {
                     pos.setErrorIndex(0);
                 }
                 return null;
             }
             try {
-                TemporalAccessor resolved = unresolved.resolve(formatter.resolverStyle, formatter.resolverFields);
+                TemporalAccessor resolved = context.toResolved(formatter.resolverStyle, formatter.resolverFields);
                 if (parseType == null) {
                     return resolved;
                 }
--- a/src/share/classes/java/time/format/DateTimeParseContext.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/java/time/format/DateTimeParseContext.java	Wed Apr 23 18:04:17 2014 -0700
@@ -64,10 +64,12 @@
 import java.time.ZoneId;
 import java.time.chrono.Chronology;
 import java.time.chrono.IsoChronology;
+import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalField;
 import java.util.ArrayList;
 import java.util.Locale;
 import java.util.Objects;
+import java.util.Set;
 import java.util.function.Consumer;
 
 /**
@@ -77,8 +79,8 @@
  * It has the ability to store and retrieve the parsed values and manage optional segments.
  * It also provides key information to the parsing methods.
  * <p>
- * Once parsing is complete, the {@link #toParsed()} is used to obtain the data.
- * It contains a method to resolve  the separate parsed fields into meaningful values.
+ * Once parsing is complete, the {@link #toUnresolved()} is used to obtain the unresolved
+ * result data. The {@link #toResolved()} is used to obtain the resolved result.
  *
  * @implSpec
  * This class is a mutable context intended for use from a single thread.
@@ -309,16 +311,27 @@
     }
 
     /**
-     * Gets the result of the parse.
+     * Gets the unresolved result of the parse.
      *
      * @return the result of the parse, not null
      */
-    Parsed toParsed() {
+    Parsed toUnresolved() {
+        return currentParsed();
+    }
+
+    /**
+     * Gets the resolved result of the parse.
+     *
+     * @return the result of the parse, not null
+     */
+    TemporalAccessor toResolved(ResolverStyle resolverStyle, Set<TemporalField> resolverFields) {
         Parsed parsed = currentParsed();
-        parsed.effectiveChrono = getEffectiveChronology();
-        return parsed;
+        parsed.chrono = getEffectiveChronology();
+        parsed.zone = (parsed.zone != null ? parsed.zone : formatter.getZone());
+        return parsed.resolve(resolverStyle, resolverFields);
     }
 
+
     //-----------------------------------------------------------------------
     /**
      * Gets the first value that was parsed for the specified field.
--- a/src/share/classes/java/time/format/Parsed.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/java/time/format/Parsed.java	Wed Apr 23 18:04:17 2014 -0700
@@ -136,10 +136,6 @@
      */
     boolean leapSecond;
     /**
-     * The effective chronology.
-     */
-    Chronology effectiveChrono;
-    /**
      * The resolver style to use.
      */
     private ResolverStyle resolverStyle;
@@ -241,7 +237,6 @@
             fieldValues.keySet().retainAll(resolverFields);
         }
         this.resolverStyle = resolverStyle;
-        chrono = effectiveChrono;
         resolveFields();
         resolveTimeLenient();
         crossCheck();
@@ -266,14 +261,16 @@
                     TemporalAccessor resolvedObject = targetField.resolve(fieldValues, this, resolverStyle);
                     if (resolvedObject != null) {
                         if (resolvedObject instanceof ChronoZonedDateTime) {
-                            ChronoZonedDateTime<?> czdt = (ChronoZonedDateTime) resolvedObject;
-                            if (zone.equals(czdt.getZone()) == false) {
+                            ChronoZonedDateTime<?> czdt = (ChronoZonedDateTime<?>) resolvedObject;
+                            if (zone == null) {
+                                zone = czdt.getZone();
+                            } else if (zone.equals(czdt.getZone()) == false) {
                                 throw new DateTimeException("ChronoZonedDateTime must use the effective parsed zone: " + zone);
                             }
                             resolvedObject = czdt.toLocalDateTime();
                         }
                         if (resolvedObject instanceof ChronoLocalDateTime) {
-                            ChronoLocalDateTime<?> cldt = (ChronoLocalDateTime) resolvedObject;
+                            ChronoLocalDateTime<?> cldt = (ChronoLocalDateTime<?>) resolvedObject;
                             updateCheckConflict(cldt.toLocalTime(), Period.ZERO);
                             updateCheckConflict(cldt.toLocalDate());
                             changedCount++;
--- a/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/java/util/concurrent/CopyOnWriteArrayList.java	Wed Apr 23 18:04:17 2014 -0700
@@ -1400,7 +1400,7 @@
             lock.lock();
             try {
                 checkForComodification();
-                if (fromIndex < 0 || toIndex > size)
+                if (fromIndex < 0 || toIndex > size || fromIndex > toIndex)
                     throw new IndexOutOfBoundsException();
                 return new COWSubList<E>(l, fromIndex + offset,
                                          toIndex + offset);
--- a/src/share/classes/javax/accessibility/AccessibleContext.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/javax/accessibility/AccessibleContext.java	Wed Apr 23 18:04:17 2014 -0700
@@ -25,6 +25,9 @@
 
 package javax.accessibility;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AppContext;
+
 import java.util.Locale;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
@@ -79,6 +82,26 @@
  */
 public abstract class AccessibleContext {
 
+    /**
+     * The AppContext that should be used to dispatch events for this
+     * AccessibleContext
+     */
+    private volatile AppContext targetAppContext;
+
+    static {
+        AWTAccessor.setAccessibleContextAccessor(new AWTAccessor.AccessibleContextAccessor() {
+            @Override
+            public void setAppContext(AccessibleContext accessibleContext, AppContext appContext) {
+                accessibleContext.targetAppContext = appContext;
+            }
+
+            @Override
+            public AppContext getAppContext(AccessibleContext accessibleContext) {
+                return accessibleContext.targetAppContext;
+            }
+        });
+    }
+
    /**
     * Constant used to determine when the accessibleName property has
     * changed.  The old value in the PropertyChangeEvent will be the old
--- a/src/share/classes/javax/swing/JTable.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/javax/swing/JTable.java	Wed Apr 23 18:04:17 2014 -0700
@@ -34,7 +34,6 @@
 
 import java.beans.*;
 
-import java.io.Serializable;
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
 import java.io.IOException;
@@ -58,7 +57,6 @@
 import sun.swing.SwingUtilities2.Section;
 import static sun.swing.SwingUtilities2.Section.*;
 import sun.swing.PrintingStatus;
-import sun.swing.SwingLazyValue;
 
 /**
  * The <code>JTable</code> is used to display and edit regular two-dimensional tables
@@ -5307,14 +5305,6 @@
         return retValue;
     }
 
-    private void setLazyValue(Hashtable h, Class c, String s) {
-        h.put(c, new SwingLazyValue(s));
-    }
-
-    private void setLazyRenderer(Class c, String s) {
-        setLazyValue(defaultRenderersByColumnClass, c, s);
-    }
-
     /**
      * Creates default cell renderers for objects, numbers, doubles, dates,
      * booleans, and icons.
@@ -5325,24 +5315,24 @@
         defaultRenderersByColumnClass = new UIDefaults(8, 0.75f);
 
         // Objects
-        setLazyRenderer(Object.class, "javax.swing.table.DefaultTableCellRenderer$UIResource");
+        defaultRenderersByColumnClass.put(Object.class, (UIDefaults.LazyValue) t -> new DefaultTableCellRenderer.UIResource());
 
         // Numbers
-        setLazyRenderer(Number.class, "javax.swing.JTable$NumberRenderer");
+        defaultRenderersByColumnClass.put(Number.class, (UIDefaults.LazyValue) t -> new NumberRenderer());
 
         // Doubles and Floats
-        setLazyRenderer(Float.class, "javax.swing.JTable$DoubleRenderer");
-        setLazyRenderer(Double.class, "javax.swing.JTable$DoubleRenderer");
+        defaultRenderersByColumnClass.put(Float.class, (UIDefaults.LazyValue) t -> new DoubleRenderer());
+        defaultRenderersByColumnClass.put(Double.class, (UIDefaults.LazyValue) t -> new DoubleRenderer());
 
         // Dates
-        setLazyRenderer(Date.class, "javax.swing.JTable$DateRenderer");
+        defaultRenderersByColumnClass.put(Date.class, (UIDefaults.LazyValue) t -> new DateRenderer());
 
         // Icons and ImageIcons
-        setLazyRenderer(Icon.class, "javax.swing.JTable$IconRenderer");
-        setLazyRenderer(ImageIcon.class, "javax.swing.JTable$IconRenderer");
+        defaultRenderersByColumnClass.put(Icon.class, (UIDefaults.LazyValue) t -> new IconRenderer());
+        defaultRenderersByColumnClass.put(ImageIcon.class, (UIDefaults.LazyValue) t -> new IconRenderer());
 
         // Booleans
-        setLazyRenderer(Boolean.class, "javax.swing.JTable$BooleanRenderer");
+        defaultRenderersByColumnClass.put(Boolean.class, (UIDefaults.LazyValue) t -> new BooleanRenderer());
     }
 
     /**
@@ -5420,10 +5410,6 @@
         }
     }
 
-    private void setLazyEditor(Class c, String s) {
-        setLazyValue(defaultEditorsByColumnClass, c, s);
-    }
-
     /**
      * Creates default cell editors for objects, numbers, and boolean values.
      * @see DefaultCellEditor
@@ -5432,13 +5418,13 @@
         defaultEditorsByColumnClass = new UIDefaults(3, 0.75f);
 
         // Objects
-        setLazyEditor(Object.class, "javax.swing.JTable$GenericEditor");
+        defaultEditorsByColumnClass.put(Object.class, (UIDefaults.LazyValue) t -> new GenericEditor());
 
         // Numbers
-        setLazyEditor(Number.class, "javax.swing.JTable$NumberEditor");
+        defaultEditorsByColumnClass.put(Number.class, (UIDefaults.LazyValue) t -> new NumberEditor());
 
         // Booleans
-        setLazyEditor(Boolean.class, "javax.swing.JTable$BooleanEditor");
+        defaultEditorsByColumnClass.put(Boolean.class, (UIDefaults.LazyValue) t -> new BooleanEditor());
     }
 
     /**
@@ -6588,8 +6574,8 @@
     TableColumnModelListener, CellEditorListener, PropertyChangeListener,
     AccessibleExtendedTable {
 
-        int lastSelectedRow;
-        int lastSelectedCol;
+        int previousFocusedRow;
+        int previousFocusedCol;
 
         /**
          * AccessibleJTable constructor
@@ -6604,8 +6590,10 @@
             tcm.addColumnModelListener(this);
             tcm.getSelectionModel().addListSelectionListener(this);
             JTable.this.getModel().addTableModelListener(this);
-            lastSelectedRow = JTable.this.getSelectedRow();
-            lastSelectedCol = JTable.this.getSelectedColumn();
+            previousFocusedRow = JTable.this.getSelectionModel().
+                                        getLeadSelectionIndex();
+            previousFocusedCol = JTable.this.getColumnModel().
+                                        getSelectionModel().getLeadSelectionIndex();
         }
 
     // Listeners to track model, etc. changes to as to re-place the other
@@ -6933,18 +6921,21 @@
             firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY,
                                Boolean.valueOf(false), Boolean.valueOf(true));
 
-            int selectedRow = JTable.this.getSelectedRow();
-            int selectedCol = JTable.this.getSelectedColumn();
-            if (selectedRow != lastSelectedRow ||
-                selectedCol != lastSelectedCol) {
-                Accessible oldA = getAccessibleAt(lastSelectedRow,
-                                                  lastSelectedCol);
-                Accessible newA = getAccessibleAt(selectedRow, selectedCol);
+            // Using lead selection index to cover both cases: node selected and node
+            // is focused but not selected (Ctrl+up/down)
+            int focusedRow = JTable.this.getSelectionModel().getLeadSelectionIndex();
+            int focusedCol = JTable.this.getColumnModel().getSelectionModel().
+                                                            getLeadSelectionIndex();
+
+            if (focusedRow != previousFocusedRow ||
+                focusedCol != previousFocusedCol) {
+                Accessible oldA = getAccessibleAt(previousFocusedRow, previousFocusedCol);
+                Accessible newA = getAccessibleAt(focusedRow, focusedCol);
                 firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
-                                   oldA, newA);
-                 lastSelectedRow = selectedRow;
-                 lastSelectedCol = selectedCol;
-             }
+                                    oldA, newA);
+                previousFocusedRow = focusedRow;
+                previousFocusedCol = focusedCol;
+            }
         }
 
 
--- a/src/share/classes/javax/swing/JTree.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/javax/swing/JTree.java	Wed Apr 23 18:04:17 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -1664,6 +1664,11 @@
 
         leadPath = newPath;
         firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, newPath);
+
+        if (accessibleContext != null){
+            ((AccessibleJTree)accessibleContext).
+                fireActiveDescendantPropertyChange(oldValue, newPath);
+        }
     }
 
     /**
@@ -4129,23 +4134,6 @@
          *
          */
         public void valueChanged(TreeSelectionEvent e) {
-            // Fixes 4546503 - JTree is sending incorrect active
-            // descendant events
-            TreePath oldLeadSelectionPath = e.getOldLeadSelectionPath();
-            leadSelectionPath = e.getNewLeadSelectionPath();
-
-            if (oldLeadSelectionPath != leadSelectionPath) {
-                // Set parent to null so AccessibleJTreeNode computes
-                // its parent.
-                Accessible oldLSA = leadSelectionAccessible;
-                leadSelectionAccessible = (leadSelectionPath != null)
-                        ? new AccessibleJTreeNode(JTree.this,
-                                                  leadSelectionPath,
-                                                  null) // parent
-                        : null;
-                firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
-                                   oldLSA, leadSelectionAccessible);
-            }
             firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY,
                                Boolean.valueOf(false), Boolean.valueOf(true));
         }
@@ -4249,6 +4237,34 @@
             }
         }
 
+        /**
+        *  Fire an active descendant property change notification.
+        *  The active descendant is used for objects such as list,
+        *  tree, and table, which may have transient children.
+        *  It notifies screen readers the active child of the component
+        *  has been changed so user can be notified from there.
+        *
+        * @param oldPath - lead path of previous active child
+        * @param newPath - lead path of current active child
+        *
+        */
+        void fireActiveDescendantPropertyChange(TreePath oldPath, TreePath newPath){
+            if(oldPath != newPath){
+                Accessible oldLSA = (oldPath != null)
+                                    ? new AccessibleJTreeNode(JTree.this,
+                                                              oldPath,
+                                                              null)
+                                    : null;
+
+                Accessible newLSA = (newPath != null)
+                                    ? new AccessibleJTreeNode(JTree.this,
+                                                              newPath,
+                                                              null)
+                                    : null;
+                firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
+                                                                oldLSA, newLSA);
+            }
+        }
 
         private AccessibleContext getCurrentAccessibleContext() {
             Component c = getCurrentComponent();
--- a/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Wed Apr 23 18:04:17 2014 -0700
@@ -32,15 +32,13 @@
 import javax.swing.*;
 import javax.swing.plaf.basic.*;
 import javax.swing.text.DefaultEditorKit;
+import javax.swing.UIDefaults.LazyValue;
 
 import java.awt.Color;
-import java.awt.event.KeyEvent;
-import java.lang.reflect.*;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
 
 import java.security.AccessController;
-import java.security.PrivilegedAction;
 
 import sun.awt.*;
 import sun.security.action.GetPropertyAction;
@@ -460,11 +458,9 @@
             new SwingLazyValue("javax.swing.plaf.metal.MetalBorders",
                                           "getTextFieldBorder");
 
-        Object dialogBorder = new MetalLazyValue(
-                          "javax.swing.plaf.metal.MetalBorders$DialogBorder");
+        LazyValue dialogBorder = t -> new MetalBorders.DialogBorder();
 
-        Object questionDialogBorder = new MetalLazyValue(
-                  "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
+        LazyValue questionDialogBorder = t -> new MetalBorders.QuestionDialogBorder();
 
         Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
                            "ctrl C", DefaultEditorKit.copyAction,
@@ -1494,12 +1490,8 @@
             "ToolBar.floatingBackground", menuBackground,
             "ToolBar.dockingForeground", primaryControlDarkShadow,
             "ToolBar.floatingForeground", primaryControl,
-            "ToolBar.rolloverBorder", new MetalLazyValue(
-                         "javax.swing.plaf.metal.MetalBorders",
-                         "getToolBarRolloverBorder"),
-            "ToolBar.nonrolloverBorder", new MetalLazyValue(
-                         "javax.swing.plaf.metal.MetalBorders",
-                         "getToolBarNonrolloverBorder"),
+            "ToolBar.rolloverBorder", (LazyValue) t -> MetalBorders.getToolBarRolloverBorder(),
+            "ToolBar.nonrolloverBorder", (LazyValue) t -> MetalBorders.getToolBarNonrolloverBorder(),
             "ToolBar.ancestorInputMap",
                new UIDefaults.LazyInputMap(new Object[] {
                         "UP", "navigateUp",
@@ -1513,17 +1505,14 @@
                  }),
 
             // RootPane
-            "RootPane.frameBorder", new MetalLazyValue(
-                      "javax.swing.plaf.metal.MetalBorders$FrameBorder"),
+            "RootPane.frameBorder", (LazyValue) t -> new MetalBorders.FrameBorder(),
             "RootPane.plainDialogBorder", dialogBorder,
             "RootPane.informationDialogBorder", dialogBorder,
-            "RootPane.errorDialogBorder", new MetalLazyValue(
-                      "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder"),
+            "RootPane.errorDialogBorder", (LazyValue) t -> new MetalBorders.ErrorDialogBorder(),
             "RootPane.colorChooserDialogBorder", questionDialogBorder,
             "RootPane.fileChooserDialogBorder", questionDialogBorder,
             "RootPane.questionDialogBorder", questionDialogBorder,
-            "RootPane.warningDialogBorder", new MetalLazyValue(
-                    "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder"),
+            "RootPane.warningDialogBorder", (LazyValue) t -> new MetalBorders.WarningDialogBorder(),
             // These bindings are only enabled when there is a default
             // button set on the rootpane.
             "RootPane.defaultButtonWindowKeyBindings", new Object[] {
@@ -2175,61 +2164,6 @@
 
 
     /**
-     * MetalLazyValue is a slimmed down version of <code>ProxyLaxyValue</code>.
-     * The code is duplicate so that it can get at the package private
-     * classes in metal.
-     */
-    private static class MetalLazyValue implements UIDefaults.LazyValue {
-        /**
-         * Name of the class to create.
-         */
-        private String className;
-        private String methodName;
-
-        MetalLazyValue(String name) {
-            this.className = name;
-        }
-
-        MetalLazyValue(String name, String methodName) {
-            this(name);
-            this.methodName = methodName;
-        }
-
-        public Object createValue(UIDefaults table) {
-            try {
-                final Class c = Class.forName(className);
-
-                if (methodName == null) {
-                    return c.newInstance();
-                }
-                Method method = AccessController.doPrivileged(
-                    new PrivilegedAction<Method>() {
-                    public Method run() {
-                        Method[] methods = c.getDeclaredMethods();
-                        for (int counter = methods.length - 1; counter >= 0;
-                             counter--) {
-                            if (methods[counter].getName().equals(methodName)){
-                                methods[counter].setAccessible(true);
-                                return methods[counter];
-                            }
-                        }
-                        return null;
-                    }
-                });
-                if (method != null) {
-                    return method.invoke(null, (Object[])null);
-                }
-            } catch (ClassNotFoundException cnfe) {
-            } catch (InstantiationException ie) {
-            } catch (IllegalAccessException iae) {
-            } catch (InvocationTargetException ite) {
-            }
-            return null;
-        }
-    }
-
-
-    /**
      * FontActiveValue redirects to the appropriate metal theme method.
      */
     private static class FontActiveValue implements UIDefaults.ActiveValue {
--- a/src/share/classes/javax/swing/text/JTextComponent.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/javax/swing/text/JTextComponent.java	Wed Apr 23 18:04:17 2014 -0700
@@ -24,18 +24,16 @@
  */
 package javax.swing.text;
 
-import java.lang.reflect.Method;
+import com.sun.beans.util.Cache;
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
 import java.beans.Transient;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Enumeration;
 import java.util.Vector;
-import java.util.Map;
 
 import java.util.concurrent.*;
 
@@ -1192,47 +1190,6 @@
     }
 
     /**
-     * Returns true if <code>klass</code> is NOT a JTextComponent and it or
-     * one of its superclasses (stoping at JTextComponent) overrides
-     * <code>processInputMethodEvent</code>. It is assumed this will be
-     * invoked from within a <code>doPrivileged</code>, and it is also
-     * assumed <code>klass</code> extends <code>JTextComponent</code>.
-     */
-    private static Boolean isProcessInputMethodEventOverridden(Class<?> klass) {
-        if (klass == JTextComponent.class) {
-            return Boolean.FALSE;
-        }
-        Boolean retValue = overrideMap.get(klass.getName());
-
-        if (retValue != null) {
-            return retValue;
-        }
-        Boolean sOverriden = isProcessInputMethodEventOverridden(
-                                       klass.getSuperclass());
-
-        if (sOverriden.booleanValue()) {
-            // If our superclass has overriden it, then by definition klass
-            // overrides it.
-            overrideMap.put(klass.getName(), sOverriden);
-            return sOverriden;
-        }
-        // klass's superclass didn't override it, check for an override in
-        // klass.
-        try {
-            Class[] classes = new Class[1];
-            classes[0] = InputMethodEvent.class;
-
-            Method m = klass.getDeclaredMethod("processInputMethodEvent",
-                                               classes);
-            retValue = Boolean.TRUE;
-        } catch (NoSuchMethodException nsme) {
-            retValue = Boolean.FALSE;
-        }
-        overrideMap.put(klass.getName(), retValue);
-        return retValue;
-    }
-
-    /**
      * Fetches the current color used to render the
      * caret.
      *
@@ -3913,7 +3870,33 @@
      * Maps from class name to Boolean indicating if
      * <code>processInputMethodEvent</code> has been overriden.
      */
-    private static Map<String, Boolean> overrideMap;
+    private static Cache<Class<?>,Boolean> METHOD_OVERRIDDEN
+            = new Cache<Class<?>,Boolean>(Cache.Kind.WEAK, Cache.Kind.STRONG) {
+        /**
+         * Returns {@code true} if the specified {@code type} extends {@link JTextComponent}
+         * and the {@link JTextComponent#processInputMethodEvent} method is overridden.
+         */
+        @Override
+        public Boolean create(final Class<?> type) {
+            if (JTextComponent.class == type) {
+                return Boolean.FALSE;
+            }
+            if (get(type.getSuperclass())) {
+                return Boolean.TRUE;
+            }
+            return AccessController.doPrivileged(
+                    new PrivilegedAction<Boolean>() {
+                        public Boolean run() {
+                            try {
+                                type.getDeclaredMethod("processInputMethodEvent", InputMethodEvent.class);
+                                return Boolean.TRUE;
+                            } catch (NoSuchMethodException exception) {
+                                return Boolean.FALSE;
+                            }
+                        }
+                    });
+        }
+    };
 
     /**
      * Returns a string representation of this <code>JTextComponent</code>.
@@ -4938,39 +4921,16 @@
      */
     private boolean shouldSynthensizeKeyEvents() {
         if (!checkedInputOverride) {
+            // Checks whether the client code overrides processInputMethodEvent.
+            // If it is overridden, need not to generate KeyTyped events for committed text.
+            // If it's not, behave as an passive input method client.
+            needToSendKeyTypedEvent = !METHOD_OVERRIDDEN.get(getClass());
             checkedInputOverride = true;
-            needToSendKeyTypedEvent =
-                             !isProcessInputMethodEventOverridden();
         }
         return needToSendKeyTypedEvent;
     }
 
     //
-    // Checks whether the client code overrides processInputMethodEvent.  If it is overridden,
-    // need not to generate KeyTyped events for committed text. If it's not, behave as an
-    // passive input method client.
-    //
-    private boolean isProcessInputMethodEventOverridden() {
-        if (overrideMap == null) {
-            overrideMap = Collections.synchronizedMap(new HashMap<String, Boolean>());
-        }
-        Boolean retValue = overrideMap.get(getClass().getName());
-
-        if (retValue != null) {
-            return retValue.booleanValue();
-        }
-        Boolean ret = AccessController.doPrivileged(new
-                       PrivilegedAction<Boolean>() {
-            public Boolean run() {
-                return isProcessInputMethodEventOverridden(
-                                JTextComponent.this.getClass());
-            }
-        });
-
-        return ret.booleanValue();
-    }
-
-    //
     // Checks whether a composed text in this text component
     //
     boolean composedTextExists() {
--- a/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Wed Apr 23 18:04:17 2014 -0700
@@ -26,7 +26,6 @@
 
 import sun.awt.AppContext;
 
-import java.lang.reflect.Method;
 import java.awt.*;
 import java.awt.event.*;
 import java.io.*;
@@ -34,12 +33,13 @@
 import java.net.URL;
 import javax.swing.text.*;
 import javax.swing.*;
-import javax.swing.border.*;
 import javax.swing.event.*;
 import javax.swing.plaf.TextUI;
 import java.util.*;
 import javax.accessibility.*;
 import java.lang.ref.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 /**
  * The Swing JEditorPane text component supports different kinds
@@ -414,14 +414,13 @@
      *  HTMLEditorKit class
      * @return a stream representing the resource
      */
-    static InputStream getResourceAsStream(String name) {
-        try {
-            return ResourceLoader.getResourceAsStream(name);
-        } catch (Throwable e) {
-            // If the class doesn't exist or we have some other
-            // problem we just try to call getResourceAsStream directly.
-            return HTMLEditorKit.class.getResourceAsStream(name);
-        }
+    static InputStream getResourceAsStream(final String name) {
+        return AccessController.doPrivileged(
+                new PrivilegedAction<InputStream>() {
+                    public InputStream run() {
+                        return HTMLEditorKit.class.getResourceAsStream(name);
+                    }
+                });
     }
 
     /**
--- a/src/share/classes/javax/swing/text/html/ResourceLoader.java	Wed Apr 23 11:35:40 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1999, 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 javax.swing.text.html;
-
-import java.io.InputStream;
-
-/**
- * Simple class to load resources using the 1.2
- * security model.  Since the html support is loaded
- * lazily, it's resources are potentially fetched with
- * applet code in the call stack.  By providing this
- * functionality in a class that is only built on 1.2,
- * reflection can be used from the code that is also
- * built on 1.1 to call this functionality (and avoid
- * the evils of preprocessing).  This functionality
- * is called from HTMLEditorKit.getResourceAsStream.
- *
- * @author  Timothy Prinzing
- */
-class ResourceLoader implements java.security.PrivilegedAction {
-
-    ResourceLoader(String name) {
-        this.name = name;
-    }
-
-    public Object run() {
-        Object o = HTMLEditorKit.class.getResourceAsStream(name);
-        return o;
-    }
-
-    public static InputStream getResourceAsStream(String name) {
-        java.security.PrivilegedAction a = new ResourceLoader(name);
-        return (InputStream) java.security.AccessController.doPrivileged(a);
-    }
-
-    private String name;
-}
--- a/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java	Wed Apr 23 18:04:17 2014 -0700
@@ -22,7 +22,6 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package javax.swing.text.html.parser;
 
 import sun.awt.AppContext;
@@ -35,6 +34,8 @@
 import java.io.ObjectInputStream;
 import java.io.Reader;
 import java.io.Serializable;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 /**
  * Responsible for starting up a new DocumentParser
@@ -111,14 +112,13 @@
      *  ParserDelegator class.
      * @returns a stream representing the resource
      */
-    static InputStream getResourceAsStream(String name) {
-        try {
-            return ResourceLoader.getResourceAsStream(name);
-        } catch (Throwable e) {
-            // If the class doesn't exist or we have some other
-            // problem we just try to call getResourceAsStream directly.
-            return ParserDelegator.class.getResourceAsStream(name);
-        }
+    static InputStream getResourceAsStream(final String name) {
+        return AccessController.doPrivileged(
+                new PrivilegedAction<InputStream>() {
+                    public InputStream run() {
+                        return ParserDelegator.class.getResourceAsStream(name);
+                    }
+                });
     }
 
     private void readObject(ObjectInputStream s)
--- a/src/share/classes/javax/swing/text/html/parser/ResourceLoader.java	Wed Apr 23 11:35:40 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1999, 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 javax.swing.text.html.parser;
-
-import java.io.InputStream;
-
-/**
- * Simple class to load resources using the 1.2
- * security model.  Since the html support is loaded
- * lazily, it's resources are potentially fetched with
- * applet code in the call stack.  By providing this
- * functionality in a class that is only built on 1.2,
- * reflection can be used from the code that is also
- * built on 1.1 to call this functionality (and avoid
- * the evils of preprocessing).  This functionality
- * is called from ParserDelegator.getResourceAsStream.
- *
- * @author  Timothy Prinzing
- */
-class ResourceLoader implements java.security.PrivilegedAction {
-
-    ResourceLoader(String name) {
-        this.name = name;
-    }
-
-    public Object run() {
-        Object o = ParserDelegator.class.getResourceAsStream(name);
-        return o;
-    }
-
-    public static InputStream getResourceAsStream(String name) {
-        java.security.PrivilegedAction a = new ResourceLoader(name);
-        return (InputStream) java.security.AccessController.doPrivileged(a);
-    }
-
-    private String name;
-}
--- a/src/share/classes/javax/swing/text/rtf/RTFReader.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/javax/swing/text/rtf/RTFReader.java	Wed Apr 23 18:04:17 2014 -0700
@@ -27,9 +27,9 @@
 import java.lang.*;
 import java.util.*;
 import java.io.*;
-import java.awt.Font;
 import java.awt.Color;
-
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import javax.swing.text.*;
 
 /**
@@ -558,16 +558,14 @@
 {
     char[] set = characterSets.get(name);
     if (set == null) {
-      InputStream charsetStream;
-      charsetStream = java.security.AccessController.
-              doPrivileged(new java.security.PrivilegedAction<InputStream>() {
-          public InputStream run() {
-              return RTFReader.class.getResourceAsStream
-                                     ("charsets/" + name + ".txt");
-          }
-      });
-      set = readCharset(charsetStream);
-      defineCharacterSet(name, set);
+        InputStream charsetStream = AccessController.doPrivileged(
+                new PrivilegedAction<InputStream>() {
+                    public InputStream run() {
+                        return RTFReader.class.getResourceAsStream("charsets/" + name + ".txt");
+                    }
+                });
+        set = readCharset(charsetStream);
+        defineCharacterSet(name, set);
     }
     return set;
 }
--- a/src/share/classes/sun/awt/AWTAccessor.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/sun/awt/AWTAccessor.java	Wed Apr 23 18:04:17 2014 -0700
@@ -27,6 +27,7 @@
 
 import sun.misc.Unsafe;
 
+import javax.accessibility.AccessibleContext;
 import java.awt.*;
 import java.awt.KeyboardFocusManager;
 import java.awt.DefaultKeyboardFocusManager;
@@ -736,6 +737,14 @@
     }
 
     /*
+     * An accessor object for the AccessibleContext class
+     */
+    public interface AccessibleContextAccessor {
+        void setAppContext(AccessibleContext accessibleContext, AppContext appContext);
+        AppContext getAppContext(AccessibleContext accessibleContext);
+    }
+
+    /*
      * Accessor instances are initialized in the static initializers of
      * corresponding AWT classes by using setters defined below.
      */
@@ -765,6 +774,7 @@
     private static ToolkitAccessor toolkitAccessor;
     private static InvocationEventAccessor invocationEventAccessor;
     private static SystemColorAccessor systemColorAccessor;
+    private static AccessibleContextAccessor accessibleContextAccessor;
 
     /*
      * Set an accessor object for the java.awt.Component class.
@@ -1208,4 +1218,21 @@
      public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {
          AWTAccessor.systemColorAccessor = systemColorAccessor;
      }
+
+    /*
+     * Get the accessor object for the javax.accessibility.AccessibleContext class.
+     */
+    public static AccessibleContextAccessor getAccessibleContextAccessor() {
+        if (accessibleContextAccessor == null) {
+            unsafe.ensureClassInitialized(AccessibleContext.class);
+        }
+        return accessibleContextAccessor;
+    }
+
+   /*
+    * Set the accessor object for the javax.accessibility.AccessibleContext class.
+    */
+    public static void setAccessibleContextAccessor(AccessibleContextAccessor accessor) {
+        AWTAccessor.accessibleContextAccessor = accessor;
+    }
 }
--- a/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Wed Apr 23 18:04:17 2014 -0700
@@ -239,6 +239,13 @@
 
         if (localTransferable != null) {
             return localTransferable.getTransferData(df);
+        } else if (df.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType)) {
+            // Workaround to JDK-8024061: Exception thrown when drag and drop
+            //      between two components is executed quickly.
+            // It is expected localTransferable is not null if javaJVMLocalObjectMimeType
+            // is used. Executing further results in ClassCastException, so null is
+            // returned here as no transfer data is available in this case.
+            return null;
         }
 
         if (dropStatus != STATUS_ACCEPT || dropComplete) {
--- a/test/ProblemList.txt	Wed Apr 23 11:35:40 2014 -0700
+++ b/test/ProblemList.txt	Wed Apr 23 18:04:17 2014 -0700
@@ -1,6 +1,6 @@
 ###########################################################################
 #
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2014, 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
@@ -120,9 +120,6 @@
 
 # jdk_lang
 
-# 8029415
-java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java generic-all
-
 ############################################################################
 
 # jdk_management
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/jarsigner/DefaultMethod.java	Wed Apr 23 18:04:17 2014 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, 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 8039358
+ * @summary com.sun.jarsigner.ContentSignerParameters.getTSAPolicyID() should be default
+ * @compile DefaultMethod.java
+ */
+
+import com.sun.jarsigner.ContentSignerParameters;
+
+import java.net.URI;
+import java.security.cert.X509Certificate;
+import java.util.zip.ZipFile;
+
+public class DefaultMethod implements ContentSignerParameters {
+
+    @Override
+    public String[] getCommandLine() {
+        return new String[0];
+    }
+
+    @Override
+    public URI getTimestampingAuthority() {
+        return null;
+    }
+
+    @Override
+    public X509Certificate getTimestampingAuthorityCertificate() {
+        return null;
+    }
+
+    @Override
+    public byte[] getSignature() {
+        return new byte[0];
+    }
+
+    @Override
+    public String getSignatureAlgorithm() {
+        return null;
+    }
+
+    @Override
+    public X509Certificate[] getSignerCertificateChain() {
+        return new X509Certificate[0];
+    }
+
+    @Override
+    public byte[] getContent() {
+        return new byte[0];
+    }
+
+    @Override
+    public ZipFile getSource() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/beans/Introspector/Test8040656.java	Wed Apr 23 18:04:17 2014 -0700
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2014, 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.Introspector;
+import java.beans.MethodDescriptor;
+
+/*
+ * @test
+ * @bug 8040656
+ * @summary Tests that a normal method is preferred to a synthetic one
+ * @author Sergey Malenkov
+ */
+
+public class Test8040656 {
+    public static void main(String[] args) throws Exception {
+        test(String.class, C.class);
+        test(String.class, C1.class);
+        test(String.class, C2.class);
+        test(String.class, C3.class);
+        test(String.class, C4.class);
+        test(String.class, C5.class);
+        test(String.class, C6.class);
+        test(String.class, C7.class);
+        test(String.class, C8.class);
+        test(String.class, C9.class);
+    }
+
+    private static void test(Class<?> type, Class<?> bean) throws Exception {
+        for (MethodDescriptor md : Introspector.getBeanInfo(bean).getMethodDescriptors()) {
+            if (md.getName().equals("getFoo")) {
+                if (type != md.getMethod().getReturnType()) {
+                    throw new Error("unexpected type");
+                }
+            }
+        }
+    }
+
+    public interface A {
+        public Object getFoo();
+    }
+
+    public class C implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+    }
+
+    public class C1 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+    }
+
+    public class C2 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+    }
+
+    public class C3 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+    }
+
+    public class C4 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+    }
+
+    public class C5 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+    }
+
+    public class C6 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+
+        public String getFoo6() {
+            return null;
+        }
+    }
+
+    public class C7 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+
+        public String getFoo6() {
+            return null;
+        }
+
+        public String getFoo7() {
+            return null;
+        }
+    }
+
+    public class C8 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+
+        public String getFoo6() {
+            return null;
+        }
+
+        public String getFoo7() {
+            return null;
+        }
+
+        public String getFoo8() {
+            return null;
+        }
+    }
+
+    public class C9 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+
+        public String getFoo6() {
+            return null;
+        }
+
+        public String getFoo7() {
+            return null;
+        }
+
+        public String getFoo8() {
+            return null;
+        }
+
+        public String getFoo9() {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/beans/Introspector/TestCacheRecursion.java	Wed Apr 23 18:04:17 2014 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, 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 com.sun.beans.util.Cache;
+
+/*
+ * @test
+ * @bug 8039137
+ * @summary Tests Cache recursion
+ * @author Sergey Malenkov
+ * @compile -XDignore.symbol.file TestCacheRecursion.java
+ * @run main TestCacheRecursion
+ */
+
+public class TestCacheRecursion {
+    private static boolean ERROR;
+    private static final Cache<Class<?>,Boolean> CACHE
+            = new Cache<Class<?>,Boolean>(Cache.Kind.WEAK, Cache.Kind.STRONG) {
+        @Override
+        public Boolean create(Class<?> type) {
+            if (ERROR) {
+                throw new Error("not initialized");
+            }
+            type = type.getSuperclass();
+            return (type != null) && get(type);
+        }
+    };
+
+    public static void main(String[] args) {
+        CACHE.get(Z.class);
+        ERROR = true;
+        for (Class<?> type = Z.class; type != null; type = type.getSuperclass()) {
+            CACHE.get(type);
+        }
+    }
+
+    private class A {}
+    private class B extends A {}
+    private class C extends B {}
+    private class D extends C {}
+    private class E extends D {}
+    private class F extends E {}
+    private class G extends F {}
+    private class H extends G {}
+    private class I extends H {}
+    private class J extends I {}
+    private class K extends J {}
+    private class L extends K {}
+    private class M extends L {}
+    private class N extends M {}
+    private class O extends N {}
+    private class P extends O {}
+    private class Q extends P {}
+    private class R extends Q {}
+    private class S extends R {}
+    private class T extends S {}
+    private class U extends T {}
+    private class V extends U {}
+    private class W extends V {}
+    private class X extends W {}
+    private class Y extends X {}
+    private class Z extends Y {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/io/Serializable/unresolvableObjectStreamClass/UnresolvableObjectStreamClass.java	Wed Apr 23 18:04:17 2014 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, 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 8039396
+ * @run main UnresolvableObjectStreamClass serialize
+ * @clean MySerializable
+ * @run main UnresolvableObjectStreamClass deserialize
+ *
+ * @summary NPE when writing a class descriptor object to a custom
+ *          ObjectOutputStream
+ */
+
+import java.io.*;
+
+public class UnresolvableObjectStreamClass {
+    public static void main(String[] args) throws Throwable {
+        if (args.length > 0 && args[0].equals("serialize")) {
+            try (FileOutputStream fos = new FileOutputStream("temp1.ser");
+                 ObjectOutputStream oos = new ObjectOutputStream(fos)) {
+                ObjectStreamClass osc =
+                         ObjectStreamClass.lookup(MySerializable.class);
+                oos.writeObject(osc);
+            }
+        } else if (args.length > 0 && args[0].equals("deserialize")) {
+            try (FileInputStream fis = new FileInputStream("temp1.ser");
+                 ObjectInputStream ois = new ObjectInputStream(fis);
+                 FileOutputStream fos = new FileOutputStream("temp2.ser");
+                 ObjectOutputStream oos = new ObjectOutputStream(fos) {
+                         /*must be subclassed*/}) {
+                ObjectStreamClass osc = (ObjectStreamClass)ois.readObject();
+                // serialize it again
+                try {
+                    oos.writeObject(osc);
+                } catch (NullPointerException e) {
+                    throw new RuntimeException("Failed to write" +
+                            " unresolvable ObjectStreamClass", e);
+                }
+            }
+        } else {
+            throw new RuntimeException("The command line option must be" +
+                                       " one of: serialize or deserialize");
+        }
+    }
+}
+
+class MySerializable implements Serializable {
+}
--- a/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java	Wed Apr 23 11:35:40 2014 -0700
+++ b/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java	Wed Apr 23 18:04:17 2014 -0700
@@ -90,9 +90,6 @@
 import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
-import static java.time.temporal.ChronoUnit.DAYS;
-import static java.time.temporal.ChronoUnit.FOREVER;
-import static java.time.temporal.ChronoUnit.NANOS;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.fail;
 
@@ -102,13 +99,17 @@
 import java.time.Period;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
-import java.time.chrono.Chronology;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoLocalDateTime;
+import java.time.chrono.ChronoZonedDateTime;
+import java.time.chrono.IsoChronology;
+import java.time.chrono.MinguoChronology;
+import java.time.chrono.MinguoDate;
 import java.time.chrono.ThaiBuddhistChronology;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.DateTimeParseException;
 import java.time.format.ResolverStyle;
-import java.time.temporal.ChronoUnit;
 import java.time.temporal.IsoFields;
 import java.time.temporal.Temporal;
 import java.time.temporal.TemporalAccessor;
@@ -129,6 +130,9 @@
     // TODO: tests with weird TenporalField implementations
     // TODO: tests with non-ISO chronologies
 
+    private static final ZoneId EUROPE_ATHENS = ZoneId.of("Europe/Athens");
+    private static final ZoneId EUROPE_PARIS = ZoneId.of("Europe/Paris");
+
     //-----------------------------------------------------------------------
     @DataProvider(name="resolveOneNoChange")
     Object[][] data_resolveOneNoChange() {
@@ -886,205 +890,273 @@
     }
 
     //-----------------------------------------------------------------------
+    // SPEC: DateTimeFormatter.withChronology()
     @Test
-    public void test_fieldResolvesToLocalTime() {
-        TemporalField field = new TemporalField() {
-            @Override
-            public TemporalUnit getBaseUnit() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public TemporalUnit getRangeUnit() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public ValueRange range() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isDateBased() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isTimeBased() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isSupportedBy(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public long getFrom(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public <R extends Temporal> R adjustInto(R temporal, long newValue) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public TemporalAccessor resolve(
-                    Map<TemporalField, Long> fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) {
-                return LocalTime.MIDNIGHT.plusNanos(fieldValues.remove(this));
-            }
-        };
-        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter();
-        TemporalAccessor accessor = f.parse("1234567890");
-        assertEquals(accessor.query(TemporalQueries.localDate()), null);
-        assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.of(0, 0, 1, 234_567_890));
+    public void test_withChronology_noOverride() {
+        DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).toFormatter();
+        TemporalAccessor accessor = f.parse("");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.chronology()), IsoChronology.INSTANCE);
     }
 
     @Test
-    public void test_fieldResolvesToChronoLocalDateTime() {
-        TemporalField field = new TemporalField() {
-            @Override
-            public TemporalUnit getBaseUnit() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public TemporalUnit getRangeUnit() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public ValueRange range() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isDateBased() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isTimeBased() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isSupportedBy(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public long getFrom(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public <R extends Temporal> R adjustInto(R temporal, long newValue) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public TemporalAccessor resolve(
-                    Map<TemporalField, Long> fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) {
-                fieldValues.remove(this);
-                return LocalDateTime.of(2010, 6, 30, 12, 30);
-            }
-        };
-        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter();
+    public void test_withChronology_override() {
+        DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).toFormatter();
+        f = f.withChronology(MinguoChronology.INSTANCE);
+        TemporalAccessor accessor = f.parse("");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
+    }
+
+    @Test
+    public void test_withChronology_parsedChronology_noOverride() {
+        DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).appendChronologyId().toFormatter();
+        TemporalAccessor accessor = f.parse("ThaiBuddhist");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.chronology()), ThaiBuddhistChronology.INSTANCE);
+    }
+
+    @Test
+    public void test_withChronology_parsedChronology_override() {
+        DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).appendChronologyId().toFormatter();
+        f = f.withChronology(MinguoChronology.INSTANCE);
+        TemporalAccessor accessor = f.parse("ThaiBuddhist");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.chronology()), ThaiBuddhistChronology.INSTANCE);
+    }
+
+    //-----------------------------------------------------------------------
+    // SPEC: DateTimeFormatter.withZone()
+    @Test
+    public void test_withZone_noOverride() {
+        DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).toFormatter();
+        TemporalAccessor accessor = f.parse("");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.zoneId()), null);
+    }
+
+    @Test
+    public void test_withZone_override() {
+        DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).toFormatter();
+        f = f.withZone(EUROPE_ATHENS);
+        TemporalAccessor accessor = f.parse("");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.zoneId()), EUROPE_ATHENS);
+    }
+
+    @Test
+    public void test_withZone_parsedZone_noOverride() {
+        DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).appendZoneId().toFormatter();
+        TemporalAccessor accessor = f.parse("Europe/Paris");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.zoneId()), EUROPE_PARIS);
+    }
+
+    @Test
+    public void test_withZone_parsedZone_override() {
+        DateTimeFormatter f = new DateTimeFormatterBuilder().parseDefaulting(EPOCH_DAY, 2).appendZoneId().toFormatter();
+        f = f.withZone(EUROPE_ATHENS);
+        TemporalAccessor accessor = f.parse("Europe/Paris");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(1970, 1, 3));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.zoneId()), EUROPE_PARIS);
+    }
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_fieldResolvesToLocalTime() {
+        LocalTime lt = LocalTime.of(12, 30, 40);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(lt)).toFormatter();
+        TemporalAccessor accessor = f.parse("1234567890");
+        assertEquals(accessor.query(TemporalQueries.localDate()), null);
+        assertEquals(accessor.query(TemporalQueries.localTime()), lt);
+    }
+
+    //-------------------------------------------------------------------------
+    @Test
+    public void test_fieldResolvesToChronoLocalDate_noOverrideChrono_matches() {
+        LocalDate ldt = LocalDate.of(2010, 6, 30);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(ldt)).toFormatter();
         TemporalAccessor accessor = f.parse("1234567890");
         assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(2010, 6, 30));
-        assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.of(12, 30));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.chronology()), IsoChronology.INSTANCE);
+    }
+
+    @Test
+    public void test_fieldResolvesToChronoLocalDate_overrideChrono_matches() {
+        MinguoDate mdt = MinguoDate.of(100, 6, 30);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mdt)).toFormatter();
+        f = f.withChronology(MinguoChronology.INSTANCE);
+        TemporalAccessor accessor = f.parse("1234567890");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
+        assertEquals(accessor.query(TemporalQueries.localTime()), null);
+        assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
     }
 
     @Test(expectedExceptions = DateTimeParseException.class)
-    public void test_fieldResolvesWrongChrono() {
-        TemporalField field = new TemporalField() {
-            @Override
-            public TemporalUnit getBaseUnit() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public TemporalUnit getRangeUnit() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public ValueRange range() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isDateBased() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isTimeBased() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isSupportedBy(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public long getFrom(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public <R extends Temporal> R adjustInto(R temporal, long newValue) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public TemporalAccessor resolve(
-                    Map<TemporalField, Long> fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) {
-                return ThaiBuddhistChronology.INSTANCE.dateNow();
-            }
-        };
-        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter();
+    public void test_fieldResolvesToChronoLocalDate_noOverrideChrono_wrongChrono() {
+        ChronoLocalDate cld = ThaiBuddhistChronology.INSTANCE.dateNow();
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cld)).toFormatter();
         f.parse("1234567890");
     }
 
     @Test(expectedExceptions = DateTimeParseException.class)
-    public void test_fieldResolvesWrongZone() {
-        TemporalField field = new TemporalField() {
-            @Override
-            public TemporalUnit getBaseUnit() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public TemporalUnit getRangeUnit() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public ValueRange range() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isDateBased() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isTimeBased() {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public boolean isSupportedBy(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public long getFrom(TemporalAccessor temporal) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public <R extends Temporal> R adjustInto(R temporal, long newValue) {
-                throw new UnsupportedOperationException();
-            }
-            @Override
-            public TemporalAccessor resolve(
-                    Map<TemporalField, Long> fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) {
-                return ZonedDateTime.of(2010, 6, 30, 12, 30, 0, 0, ZoneId.of("Europe/Paris"));
-            }
-        };
-        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter().withZone(ZoneId.of("Europe/London"));
+    public void test_fieldResolvesToChronoLocalDate_overrideChrono_wrongChrono() {
+        ChronoLocalDate cld = ThaiBuddhistChronology.INSTANCE.dateNow();
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cld)).toFormatter();
+        f = f.withChronology(MinguoChronology.INSTANCE);
         f.parse("1234567890");
     }
 
+    //-------------------------------------------------------------------------
+    @Test
+    public void test_fieldResolvesToChronoLocalDateTime_noOverrideChrono_matches() {
+        LocalDateTime ldt = LocalDateTime.of(2010, 6, 30, 12, 30);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(ldt)).toFormatter();
+        TemporalAccessor accessor = f.parse("1234567890");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(2010, 6, 30));
+        assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.of(12, 30));
+        assertEquals(accessor.query(TemporalQueries.chronology()), IsoChronology.INSTANCE);
+    }
+
+    @Test
+    public void test_fieldResolvesToChronoLocalDateTime_overrideChrono_matches() {
+        MinguoDate mdt = MinguoDate.of(100, 6, 30);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mdt.atTime(LocalTime.NOON))).toFormatter();
+        f = f.withChronology(MinguoChronology.INSTANCE);
+        TemporalAccessor accessor = f.parse("1234567890");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
+        assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.NOON);
+        assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
+    }
+
+    @Test(expectedExceptions = DateTimeParseException.class)
+    public void test_fieldResolvesToChronoLocalDateTime_noOverrideChrono_wrongChrono() {
+        ChronoLocalDateTime<?> cldt = ThaiBuddhistChronology.INSTANCE.dateNow().atTime(LocalTime.NOON);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cldt)).toFormatter();
+        f.parse("1234567890");
+    }
+
+    @Test(expectedExceptions = DateTimeParseException.class)
+    public void test_fieldResolvesToChronoLocalDateTime_overrideChrono_wrongChrono() {
+        ChronoLocalDateTime<?> cldt = ThaiBuddhistChronology.INSTANCE.dateNow().atTime(LocalTime.NOON);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cldt)).toFormatter();
+        f = f.withChronology(MinguoChronology.INSTANCE);
+        f.parse("1234567890");
+    }
+
+    //-------------------------------------------------------------------------
+    @Test
+    public void test_fieldResolvesToChronoZonedDateTime_noOverrideChrono_matches() {
+        ZonedDateTime zdt = ZonedDateTime.of(2010, 6, 30, 12, 30, 0, 0, EUROPE_PARIS);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(zdt)).toFormatter();
+        TemporalAccessor accessor = f.parse("1234567890");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(2010, 6, 30));
+        assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.of(12, 30));
+        assertEquals(accessor.query(TemporalQueries.chronology()), IsoChronology.INSTANCE);
+        assertEquals(accessor.query(TemporalQueries.zoneId()), EUROPE_PARIS);
+    }
+
+    @Test
+    public void test_fieldResolvesToChronoZonedDateTime_overrideChrono_matches() {
+        MinguoDate mdt = MinguoDate.of(100, 6, 30);
+        ChronoZonedDateTime<MinguoDate> mzdt = mdt.atTime(LocalTime.NOON).atZone(EUROPE_PARIS);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(mzdt)).toFormatter();
+        f = f.withChronology(MinguoChronology.INSTANCE);
+        TemporalAccessor accessor = f.parse("1234567890");
+        assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.from(mdt));
+        assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.NOON);
+        assertEquals(accessor.query(TemporalQueries.chronology()), MinguoChronology.INSTANCE);
+        assertEquals(accessor.query(TemporalQueries.zoneId()), EUROPE_PARIS);
+    }
+
+    @Test(expectedExceptions = DateTimeParseException.class)
+    public void test_fieldResolvesToChronoZonedDateTime_noOverrideChrono_wrongChrono() {
+        ChronoZonedDateTime<?> cldt = ThaiBuddhistChronology.INSTANCE.dateNow().atTime(LocalTime.NOON).atZone(EUROPE_PARIS);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cldt)).toFormatter();
+        f.parse("1234567890");
+    }
+
+    @Test(expectedExceptions = DateTimeParseException.class)
+    public void test_fieldResolvesToChronoZonedDateTime_overrideChrono_wrongChrono() {
+        ChronoZonedDateTime<?> cldt = ThaiBuddhistChronology.INSTANCE.dateNow().atTime(LocalTime.NOON).atZone(EUROPE_PARIS);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(cldt)).toFormatter();
+        f = f.withChronology(MinguoChronology.INSTANCE);
+        f.parse("1234567890");
+    }
+
+    @Test
+    public void test_fieldResolvesToChronoZonedDateTime_overrideZone_matches() {
+        ZonedDateTime zdt = ZonedDateTime.of(2010, 6, 30, 12, 30, 0, 0, EUROPE_PARIS);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(zdt)).toFormatter();
+        f = f.withZone(EUROPE_PARIS);
+        assertEquals(f.parse("1234567890", ZonedDateTime::from), zdt);
+    }
+
+    @Test(expectedExceptions = DateTimeParseException.class)
+    public void test_fieldResolvesToChronoZonedDateTime_overrideZone_wrongZone() {
+        ZonedDateTime zdt = ZonedDateTime.of(2010, 6, 30, 12, 30, 0, 0, EUROPE_PARIS);
+        DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(new ResolvingField(zdt)).toFormatter();
+        f = f.withZone(ZoneId.of("Europe/London"));
+        f.parse("1234567890");
+    }
+
+    //-------------------------------------------------------------------------
+    private static class ResolvingField implements TemporalField {
+        private final TemporalAccessor resolvedValue;
+        ResolvingField(TemporalAccessor resolvedValue) {
+            this.resolvedValue = resolvedValue;
+        }
+        @Override
+        public TemporalUnit getBaseUnit() {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public TemporalUnit getRangeUnit() {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public ValueRange range() {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public boolean isDateBased() {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public boolean isTimeBased() {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public boolean isSupportedBy(TemporalAccessor temporal) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public long getFrom(TemporalAccessor temporal) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public <R extends Temporal> R adjustInto(R temporal, long newValue) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public TemporalAccessor resolve(
+                Map<TemporalField, Long> fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) {
+            fieldValues.remove(this);
+            return resolvedValue;
+        }
+    };
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/concurrent/CopyOnWriteArrayList/COWSubList.java	Wed Apr 23 18:04:17 2014 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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 8011645
+ * @summary CopyOnWriteArrayList.COWSubList.subList does not validate range properly
+ */
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+public class COWSubList {
+    public static void main(String[] args) {
+        List<String> list = new CopyOnWriteArrayList<>();
+        list.add("A");
+        list.add("B");
+        list.add("C");
+        list.add("D");
+        list.add("E");
+
+        expectThrow(() -> list.subList(-1, 5));
+        expectThrow(() -> list.subList(0, 6));
+        expectThrow(() -> list.subList(4, 3));
+        expectThrow(() -> list.subList(0, 5).subList(-1, 5));
+        expectThrow(() -> list.subList(0, 5).subList(0, 6));
+        expectThrow(() -> list.subList(0, 5).subList(4, 3));
+    }
+
+    static void expectThrow(Runnable r) {
+        try {
+            r.run();
+            throw new RuntimeException("Failed: expected IOOBE to be thrown");
+        } catch (IndexOutOfBoundsException x) {
+            // ok, excpeted
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JTable/8031971/bug8031971.java	Wed Apr 23 18:04:17 2014 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, 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.util.Date;
+import java.util.Hashtable;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+
+/**
+ * @test
+ * @bug 8031971 8039750
+ * @author Alexander Scherbatiy
+ * @summary Use only public methods in the SwingLazyValue
+ * @run main bug8031971
+ */
+public class bug8031971 {
+
+    static Object[][] RENDERERS = {
+        {Object.class, "javax.swing.table.DefaultTableCellRenderer$UIResource"},
+        {Number.class, "javax.swing.JTable$NumberRenderer"},
+        {Float.class, "javax.swing.JTable$DoubleRenderer"},
+        {Double.class, "javax.swing.JTable$DoubleRenderer"},
+        {Date.class, "javax.swing.JTable$DateRenderer"},
+        {Icon.class, "javax.swing.JTable$IconRenderer"},
+        {ImageIcon.class, "javax.swing.JTable$IconRenderer"},
+        {Boolean.class, "javax.swing.JTable$BooleanRenderer"}
+    };
+
+    static Object[][] EDITORS = {
+        {Object.class, "javax.swing.JTable$GenericEditor"},
+        {Number.class, "javax.swing.JTable$NumberEditor"},
+        {Boolean.class, "javax.swing.JTable$BooleanEditor"}
+    };
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(() -> {
+
+            TestTable table = new TestTable();
+            test(table.getDefaultRenderersByColumnClass(), RENDERERS);
+            test(table.getDefaultEditorsByColumnClass(), EDITORS);
+        });
+    }
+
+    static void test(Hashtable table, Object[][] values) {
+        for (int i = 0; i < values.length; i++) {
+            test(table.get(values[i][0]), (String) values[i][1]);
+        }
+    }
+
+    static void test(Object obj, String className) {
+        if (!obj.getClass().getCanonicalName().equals(className.replace('$', '.'))) {
+            throw new RuntimeException("Wrong value!");
+        }
+    }
+
+    static class TestTable extends JTable {
+
+        Hashtable getDefaultRenderersByColumnClass() {
+            return defaultRenderersByColumnClass;
+        }
+
+        Hashtable getDefaultEditorsByColumnClass() {
+            return defaultEditorsByColumnClass;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/plaf/metal/MetalLookAndFeel/Test8039750.java	Wed Apr 23 18:04:17 2014 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, 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.UIDefaults;
+import javax.swing.border.CompoundBorder;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+
+/*
+ * @test
+ * @bug 8039750
+ * @summary Tests MetalLazyValue removing
+ * @author Sergey Malenkov
+ */
+public class Test8039750 {
+    public static void main(String[] args) {
+        UIDefaults table= new MetalLookAndFeel().getDefaults();
+        test(table.get("ToolBar.rolloverBorder"),
+                "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
+                "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
+        test(table.get("ToolBar.nonrolloverBorder"),
+                "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
+                "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
+        test(table.get("RootPane.frameBorder"),
+                "javax.swing.plaf.metal.MetalBorders$FrameBorder");
+        test(table.get("RootPane.plainDialogBorder"),
+                "javax.swing.plaf.metal.MetalBorders$DialogBorder");
+        test(table.get("RootPane.informationDialogBorder"),
+                "javax.swing.plaf.metal.MetalBorders$DialogBorder");
+        test(table.get("RootPane.errorDialogBorder"),
+                "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder");
+        test(table.get("RootPane.colorChooserDialogBorder"),
+                "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
+        test(table.get("RootPane.fileChooserDialogBorder"),
+                "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
+        test(table.get("RootPane.questionDialogBorder"),
+                "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
+        test(table.get("RootPane.warningDialogBorder"),
+                "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder");
+    }
+
+    private static void test(Object value, String name) {
+        if (!value.getClass().getName().equals(name)) {
+            throw new Error(name);
+        }
+    }
+
+    private static void test(Object value, String one, String two) {
+        if (value instanceof CompoundBorder) {
+            CompoundBorder border = (CompoundBorder) value;
+            test(border.getOutsideBorder(), one);
+            test(border.getInsideBorder(), two);
+        } else {
+            throw new Error("CompoundBorder");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/awt/dnd/8024061/bug8024061.java	Wed Apr 23 18:04:17 2014 -0700
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2014, 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 8024061
+ * @summary Checks that no exception is thrown if dragGestureRecognized
+ *          takes a while to complete.
+ */
+import sun.awt.OSInfo;
+import sun.awt.OSInfo.OSType;
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DragSourceDragEvent;
+import java.awt.dnd.DragSourceDropEvent;
+import java.awt.dnd.DragSourceEvent;
+import java.awt.dnd.DragSourceListener;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.dnd.DropTargetEvent;
+import java.awt.dnd.DropTargetListener;
+import java.awt.event.InputEvent;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.swing.*;
+
+/**
+ * If dragGestureRecognized() takes a while to complete and if user performs a drag quickly,
+ * an exception is thrown from DropTargetListener.dragEnter when it calls
+ * DropTargetDragEvent.getTransferable().
+ * <p>
+ * This class introduces a delay in dragGestureRecognized() to cause the exception.
+ */
+public class bug8024061 {
+    private static final DataFlavor DropObjectFlavor;
+    private static final int DELAY = 1000;
+
+    private final DnDPanel panel1 = new DnDPanel(Color.yellow);
+    private final DnDPanel panel2 = new DnDPanel(Color.pink);
+    private final JFrame frame;
+
+    private static final CountDownLatch lock = new CountDownLatch(1);
+    private static volatile Exception dragEnterException = null;
+
+    static {
+        DataFlavor flavor = null;
+        try {
+            flavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        DropObjectFlavor = flavor;
+    }
+
+    bug8024061() {
+        frame = new JFrame("DnDWithRobot");
+        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+
+        Dimension d = new Dimension(100, 100);
+
+        panel1.setPreferredSize(d);
+        panel2.setPreferredSize(d);
+
+        Container content = frame.getContentPane();
+        content.setLayout(new GridLayout(1, 2, 5, 5));
+        content.add(panel1);
+        content.add(panel2);
+
+        frame.pack();
+
+        DropObject drop = new DropObject();
+        drop.place(panel1, new Point(10, 10));
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
+        OSType type = OSInfo.getOSType();
+        if (type != OSType.LINUX && type != OSType.SOLARIS) {
+            System.out.println("This test is for Linux and Solaris only... " +
+                               "skipping!");
+            return;
+        }
+
+        final bug8024061[] dnd = {null};
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                dnd[0] = new bug8024061();
+            }
+        });
+        final Robot robot = new Robot();
+        robot.setAutoDelay(10);
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        JFrame frame = dnd[0].frame;
+        Point point = frame.getLocationOnScreen();
+        Point here = new Point(point.x + 35, point.y + 45);
+        Point there = new Point(point.x + 120, point.y + 45);
+        here.x += 25;
+        robot.mouseMove(here.x, here.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        while (here.x < there.x) {
+            here.x += 20;
+            robot.mouseMove(here.x, here.y);
+            System.out.println("x = " + here.x);
+        }
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        toolkit.realSync();
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        System.out.println("finished");
+
+        try {
+            if (lock.await(5, TimeUnit.SECONDS)) {
+                if (dragEnterException == null) {
+                    System.out.println("Test passed.");
+                } else {
+                    System.out.println("Test failed.");
+                    dragEnterException.printStackTrace();
+                    throw new RuntimeException(dragEnterException);
+                }
+            } else {
+                System.out.println("Test failed. Timeout reached");
+                throw new RuntimeException("Timed out waiting for dragEnter()");
+            }
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    class DropObject implements Transferable {
+        DnDPanel panel;
+        Color color = Color.CYAN;
+        int width = 50;
+        int height = 50;
+        int x;
+        int y;
+
+        void draw(Graphics2D g) {
+            Color savedColor = g.getColor();
+            g.setColor(color);
+            g.fillRect(x, y, width, height);
+            g.setColor(Color.lightGray);
+            g.drawRect(x, y, width, height);
+            g.setColor(savedColor);
+        }
+
+        boolean contains(int x, int y) {
+            return (x > this.x && x < this.x + width)
+                    && (y > this.y && y < this.y + height);
+        }
+
+        @Override
+        public DataFlavor[] getTransferDataFlavors() {
+            return new DataFlavor[]{DropObjectFlavor};
+        }
+
+        void place(DnDPanel panel, Point location) {
+            if (panel != this.panel) {
+                x = location.x;
+                y = location.y;
+                if (this.panel != null) {
+                    this.panel.setDropObject(null);
+                    this.panel.repaint();
+                }
+                this.panel = panel;
+                this.panel.setDropObject(this);
+                this.panel.repaint();
+            }
+        }
+
+        @Override
+        public boolean isDataFlavorSupported(DataFlavor flavor) {
+            return DropObjectFlavor.equals(flavor);
+        }
+
+        @Override
+        public Object getTransferData(DataFlavor flavor)
+                throws UnsupportedFlavorException, IOException {
+            if (isDataFlavorSupported(flavor)) {
+                return this;
+            } else {
+                throw new UnsupportedFlavorException(flavor);
+            }
+        }
+    }
+
+    class DnDPanel extends JPanel {
+        DropObject dropObject;
+        final DragSource dragSource;
+        final DropTarget dropTarget;
+        final Color color;
+        final DragGestureListener dgListener;
+        final DragSourceListener dsListener;
+        final DropTargetListener dtListener;
+
+        DnDPanel(Color color) {
+            this.color = color;
+            this.dragSource = DragSource.getDefaultDragSource();
+            dgListener = new DragGestureListener() {
+                @Override
+                public void dragGestureRecognized(DragGestureEvent dge) {
+                    Point location = dge.getDragOrigin();
+                    if (dropObject != null && dropObject.contains(location.x, location.y)) {
+                        dragSource.startDrag(dge, DragSource.DefaultCopyNoDrop, dropObject, dsListener);
+                        try {
+                            Thread.sleep(DELAY);
+                        } catch (InterruptedException e) {
+                        }
+                    }
+                }
+            };
+
+            dsListener = new DragSourceListener() {
+                @Override
+                public void dragEnter(DragSourceDragEvent dsde) {
+                }
+
+                @Override
+                public void dragOver(DragSourceDragEvent dsde) {
+                }
+
+                @Override
+                public void dropActionChanged(DragSourceDragEvent dsde) {
+                }
+
+                @Override
+                public void dragExit(DragSourceEvent dse) {
+                }
+
+                @Override
+                public void dragDropEnd(DragSourceDropEvent dsde) {
+                }
+            };
+
+            dtListener = new DropTargetListener() {
+                @Override
+                public void dragEnter(DropTargetDragEvent dtde) {
+                    if (dropObject != null) {
+                        dtde.rejectDrag();
+                        return;
+                    }
+                    dtde.acceptDrag(DnDConstants.ACTION_MOVE);
+                    try {
+                        Transferable t = dtde.getTransferable();
+                        Object data = t.getTransferData(DropObjectFlavor);
+                        if (data != null) {
+                            throw new Exception("getTransferData returned non-null");
+                        }
+                    } catch (Exception e) {
+                        dragEnterException = e;
+                        e.printStackTrace();
+                    } finally {
+                        lock.countDown();
+                    }
+                }
+
+                @Override
+                public void dragOver(DropTargetDragEvent dtde) {
+                    if (dropObject != null) {
+                        dtde.rejectDrag();
+                        return;
+                    }
+                    dtde.acceptDrag(DnDConstants.ACTION_MOVE);
+                }
+
+                @Override
+                public void dropActionChanged(DropTargetDragEvent dtde) {
+                }
+
+                @Override
+                public void dragExit(DropTargetEvent dte) {
+                }
+
+                @Override
+                public void drop(DropTargetDropEvent dtde) {
+                    if (dropObject != null) {
+                        dtde.rejectDrop();
+                        return;
+                    }
+                    try {
+                        dtde.acceptDrop(DnDConstants.ACTION_MOVE);
+                        Transferable t = dtde.getTransferable();
+                        DropObject dropObject = (DropObject) t.getTransferData(DropObjectFlavor);
+                        Point location = dtde.getLocation();
+                        dropObject.place(DnDPanel.this, location);
+                        dtde.dropComplete(true);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+
+                }
+            };
+
+            dragSource.createDefaultDragGestureRecognizer(this,
+                    DnDConstants.ACTION_MOVE, dgListener);
+
+            dropTarget = new DropTarget(this, DnDConstants.ACTION_MOVE, dtListener, true);
+
+        }
+
+        public void paintComponent(Graphics g) {
+            super.paintComponent(g);
+            Color savedColor = g.getColor();
+            g.setColor(color);
+            g.fillRect(0, 0, getWidth(), getHeight());
+            g.setColor(savedColor);
+            if (dropObject != null) {
+                dropObject.draw((Graphics2D) g);
+            }
+        }
+
+        void setDropObject(DropObject dropObject) {
+            this.dropObject = dropObject;
+        }
+
+        DropObject findDropObject(int x, int y) {
+            if (dropObject != null && dropObject.contains(x, y)) {
+                return dropObject;
+            }
+            return null;
+        }
+    }
+}