changeset 9880:83d9bc20973d jdk9-b12

Merge
author lana
date Thu, 01 May 2014 14:21:29 -0700
parents 9c7285a47776 9ea90ce2b8d9
children 32ef8cd730ec ac1b3c46ed4d
files src/macosx/native/sun/awt/CClipboard.h src/share/classes/javax/swing/text/html/ResourceLoader.java src/share/classes/javax/swing/text/html/parser/ResourceLoader.java src/share/classes/sun/awt/EventListenerAggregate.java
diffstat 299 files changed, 18744 insertions(+), 2734 deletions(-) [+]
line wrap: on
line diff
--- a/make/data/jdwp/jdwp.spec	Thu May 01 12:51:13 2014 -0700
+++ b/make/data/jdwp/jdwp.spec	Thu May 01 14:21:29 2014 -0700
@@ -1147,7 +1147,8 @@
         (ErrorSet
             (Error INVALID_CLASS     "clazz is not the ID of a class.")
             (Error INVALID_OBJECT    "clazz is not a known ID.")
-            (Error INVALID_METHODID  "methodID is not the ID of a method.")
+            (Error INVALID_METHODID  "methodID is not the ID of a static method in "
+                                     "this class type or one of its superclasses.")
             (Error INVALID_THREAD)
             (Error THREAD_NOT_SUSPENDED)
             (Error VM_DEAD)
@@ -1250,6 +1251,83 @@
     )
 )
 (CommandSet InterfaceType=5
+    (Command InvokeMethod=1
+        "Invokes a static method. "
+        "The method must not be a static initializer. "
+        "The method must be a member of the interface type. "
+        "<p>Since JDWP version 1.8 "
+        "<p>"
+        "The method invocation will occur in the specified thread. "
+        "Method invocation can occur only if the specified thread "
+        "has been suspended by an event. "
+        "Method invocation is not supported "
+        "when the target VM has been suspended by the front-end. "
+        "<p>"
+        "The specified method is invoked with the arguments in the specified "
+        "argument list. "
+        "The method invocation is synchronous; the reply packet is not "
+        "sent until the invoked method returns in the target VM. "
+        "The return value (possibly the void value) is "
+        "included in the reply packet. "
+        "If the invoked method throws an exception, the "
+        "exception object ID is set in the reply packet; otherwise, the "
+        "exception object ID is null. "
+        "<p>"
+        "For primitive arguments, the argument value's type must match the "
+        "argument's type exactly. For object arguments, there must exist a "
+        "widening reference conversion from the argument value's type to the "
+        "argument's type and the argument's type must be loaded. "
+        "<p>"
+        "By default, all threads in the target VM are resumed while "
+        "the method is being invoked if they were previously "
+        "suspended by an event or by a command. "
+        "This is done to prevent the deadlocks "
+        "that will occur if any of the threads own monitors "
+        "that will be needed by the invoked method. It is possible that "
+        "breakpoints or other events might occur during the invocation. "
+        "Note, however, that this implicit resume acts exactly like "
+        "the ThreadReference resume command, so if the thread's suspend "
+        "count is greater than 1, it will remain in a suspended state "
+        "during the invocation. By default, when the invocation completes, "
+        "all threads in the target VM are suspended, regardless their state "
+        "before the invocation. "
+        "<p>"
+        "The resumption of other threads during the invoke can be prevented "
+        "by specifying the INVOKE_SINGLE_THREADED "
+        "bit flag in the <code>options</code> field; however, "
+        "there is no protection against or recovery from the deadlocks "
+        "described above, so this option should be used with great caution. "
+        "Only the specified thread will be resumed (as described for all "
+        "threads above). Upon completion of a single threaded invoke, the invoking thread "
+        "will be suspended once again. Note that any threads started during "
+        "the single threaded invocation will not be suspended when the "
+        "invocation completes. "
+        "<p>"
+        "If the target VM is disconnected during the invoke (for example, through "
+        "the VirtualMachine dispose command) the method invocation continues. "
+        (Out
+            (interfaceType clazz "The interface type ID.")
+            (threadObject thread "The thread in which to invoke.")
+            (method methodID "The method to invoke.")
+            (Repeat arguments
+                (value arg "The argument value.")
+            )
+            (int options "Invocation <a href=\"#JDWP_InvokeOptions\">options</a>")
+        )
+        (Reply
+            (value returnValue "The returned value.")
+            (tagged-object exception "The thrown exception.")
+        )
+        (ErrorSet
+            (Error INVALID_CLASS     "clazz is not the ID of an interface.")
+            (Error INVALID_OBJECT    "clazz is not a known ID.")
+            (Error INVALID_METHODID  "methodID is not the ID of a static method in this "
+                                     "interface type or is the ID of a static initializer.")
+            (Error INVALID_THREAD)
+            (Error THREAD_NOT_SUSPENDED)
+            (Error VM_DEAD)
+        )
+    )
 )
 (CommandSet Method=6
     (Command LineTable=1
@@ -1543,7 +1621,7 @@
         "<p>"
         "By default, all threads in the target VM are resumed while "
         "the method is being invoked if they were previously "
-        "suspended by an event or by command. "
+        "suspended by an event or by a command. "
         "This is done to prevent the deadlocks "
         "that will occur if any of the threads own monitors "
         "that will be needed by the invoked method. It is possible that "
@@ -1586,7 +1664,9 @@
             (Error INVALID_OBJECT)
             (Error INVALID_CLASS     "clazz is not the ID of a reference "
                                      "type.")
-            (Error INVALID_METHODID  "methodID is not the ID of a method.")
+            (Error INVALID_METHODID  "methodID is not the ID of an instance method "
+                                     "in this object's type or one of its superclasses, "
+                                     "superinterfaces, or implemented interfaces.")
             (Error INVALID_THREAD)
             (Error THREAD_NOT_SUSPENDED)
             (Error VM_DEAD)
--- a/make/lib/Awt2dLibraries.gmk	Thu May 01 12:51:13 2014 -0700
+++ b/make/lib/Awt2dLibraries.gmk	Thu May 01 14:21:29 2014 -0700
@@ -798,6 +798,10 @@
   BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
 endif
 
+# Libfontmanager doesn't actually need X_LIBS to link, but if building
+# on a Solaris machine without X installed, using a devkit, linking
+# to libawt_xawt will fail without the -L parameters from X_LIBS. Filter
+# out the -R parameters since they aren't needed.
 $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
     LIBRARY := fontmanager, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
@@ -816,7 +820,8 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
     LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
-    LDFLAGS_SUFFIX_solaris := -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
+    LDFLAGS_SUFFIX_solaris := $(filter-out -R%, $(X_LIBS)) \
+        -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
     LDFLAGS_SUFFIX_aix := -lawt -lawt_xawt $(LIBM) $(LIBCXX) -ljava -ljvm,\
     LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
         -ljava -ljvm, \
--- a/src/macosx/classes/apple/laf/JRSUIConstants.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/classes/apple/laf/JRSUIConstants.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -31,6 +31,13 @@
 import java.lang.annotation.Native;
 
 public final class JRSUIConstants {
+
+    /**
+     * There is no way to get width of focus border, so it is hardcoded here.
+     * All components, which can be focused should take care about it.
+     */
+    public static final int FOCUS_SIZE = 4;
+
     private static native long getPtrForConstant(final int constant);
 
     static class Key {
--- a/src/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaButtonExtendedTypes.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -36,6 +36,8 @@
 import com.apple.laf.AquaUtilControlSize.*;
 import com.apple.laf.AquaUtils.RecyclableSingleton;
 
+import static apple.laf.JRSUIConstants.FOCUS_SIZE;
+
 /**
  * All the "magic numbers" in this class should go away once
  * <rdar://problem/4613866> "default font" and sizes for controls in Java Aqua Look and Feel
@@ -145,7 +147,8 @@
     protected static Map<String, TypeSpecifier> getAllTypes() {
         final Map<String, TypeSpecifier> specifiersByName = new HashMap<String, TypeSpecifier>();
 
-        final Insets focusInsets = new Insets(4, 4, 4, 4);
+        final Insets focusInsets = new Insets(FOCUS_SIZE, FOCUS_SIZE,
+                                              FOCUS_SIZE, FOCUS_SIZE);
 
         final TypeSpecifier[] specifiers = {
             new TypeSpecifier("toolbar", true) {
--- a/src/macosx/classes/com/apple/laf/AquaIcon.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaIcon.java	Thu May 01 14:21:29 2014 -0700
@@ -44,7 +44,8 @@
     }
 
     static UIResource getIconFor(final JRSUIControlSpec spec, final int width, final int height) {
-        return new CachableJRSUIIcon(width, height) {
+        return new ScalingJRSUIIcon(width, height) {
+            @Override
             public void initIconPainter(final AquaPainter<JRSUIState> painter) {
                 spec.initIconPainter(painter);
             }
@@ -128,35 +129,12 @@
             if (image != null) return image;
 
             if (!GraphicsEnvironment.isHeadless()) {
-                image = getOptimizedImage();
+                image = createImage();
             }
 
             return image;
         }
 
-        private Image getOptimizedImage() {
-            final Image img = createImage();
-            // TODO: no RuntimeOptions for now
-            //if (RuntimeOptions.getRenderer(null) != RuntimeOptions.Sun) return img;
-            return getProgressiveOptimizedImage(img, getIconWidth(), getIconHeight());
-        }
-
-        static Image getProgressiveOptimizedImage(final Image img, final int w, final int h) {
-            if (img == null) return null;
-
-            final int halfImgW = img.getWidth(null) / 2;
-            final int halfImgH = img.getHeight(null) / 2;
-            if (w * 2 > halfImgW && h * 2 > halfImgH) return img;
-
-            final BufferedImage halfImage = new BufferedImage(halfImgW, halfImgH, BufferedImage.TYPE_INT_ARGB);
-            final Graphics g = halfImage.getGraphics();
-            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
-            g.drawImage(img, 0, 0, halfImgW, halfImgH, null);
-            g.dispose();
-
-            return getProgressiveOptimizedImage(halfImage, w, h);
-        }
-
         abstract Image createImage();
 
         public boolean hasIconRef() {
@@ -189,24 +167,50 @@
 
     }
 
-    static abstract class CachableJRSUIIcon extends CachingScalingIcon implements UIResource {
-        public CachableJRSUIIcon(final int width, final int height) {
-            super(width, height);
+    static abstract class ScalingJRSUIIcon implements Icon, UIResource {
+        final int width;
+        final int height;
+
+        public ScalingJRSUIIcon(final int width, final int height) {
+            this.width = width;
+            this.height = height;
         }
 
-        Image createImage() {
-            final AquaPainter<JRSUIState> painter = AquaPainter.create(JRSUIState.getInstance());
+        @Override
+        public void paintIcon(final Component c, Graphics g,
+                final int x, final int y) {
+            if (GraphicsEnvironment.isHeadless()) {
+                return;
+            }
+
+            g = g.create();
+
+            if (g instanceof Graphics2D) {
+                // improves icon rendering quality in Quartz
+                ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING,
+                        RenderingHints.VALUE_RENDER_QUALITY);
+            }
+
+            final AquaPainter<JRSUIState> painter =
+                    AquaPainter.create(JRSUIState.getInstance());
             initIconPainter(painter);
 
-            final BufferedImage img = new BufferedImage(getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB_PRE);
-            final Graphics g = img.getGraphics();
-            g.setClip(new Rectangle(0, 0, getIconWidth(), getIconHeight()));
-            painter.paint(g, null, 0, 0, getIconWidth(), getIconHeight());
+            g.setClip(new Rectangle(x, y, width, height));
+            painter.paint(g, c, x, y, width, height);
             g.dispose();
-            return img;
         }
 
         public abstract void initIconPainter(final AquaPainter<JRSUIState> painter);
+
+        @Override
+        public int getIconWidth() {
+            return width;
+        }
+
+        @Override
+        public int getIconHeight() {
+            return height;
+        }
     }
 
     static class FileIcon extends CachingScalingIcon {
--- a/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaInternalFrameUI.java	Thu May 01 14:21:29 2014 -0700
@@ -787,8 +787,9 @@
     }
 
     static final RecyclableSingleton<Icon> RESIZE_ICON = new RecyclableSingleton<Icon>() {
+        @Override
         protected Icon getInstance() {
-            return new AquaIcon.CachableJRSUIIcon(11, 11) {
+            return new AquaIcon.ScalingJRSUIIcon(11, 11) {
                 public void initIconPainter(final AquaPainter<JRSUIState> iconState) {
                     iconState.state.set(Widget.GROW_BOX_TEXTURED);
                     iconState.state.set(WindowType.UTILITY);
--- a/src/macosx/classes/com/apple/laf/AquaPainter.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaPainter.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -141,40 +141,71 @@
             paintFromSingleCachedImage(g, control, stateToPaint, boundsRect);
         }
 
+        /**
+         * Paints a native control, which identified by its size and a set of
+         * additional arguments using a cached image.
+         *
+         * @param  g Graphics to draw the control
+         * @param  control the reference to the native control
+         * @param  controlState the state of the native control
+         * @param  bounds the rectangle where the native part should be drawn.
+         *         Note: the focus can/will be drawn outside of this bounds.
+         */
         static void paintFromSingleCachedImage(final Graphics2D g,
-                final JRSUIControl control, final JRSUIState controlState,
-                final Rectangle bounds) {
+                                               final JRSUIControl control,
+                                               final JRSUIState controlState,
+                                               final Rectangle bounds) {
             if (bounds.width <= 0 || bounds.height <= 0) {
                 return;
             }
 
-            int scale = 1;
-            if (g instanceof SunGraphics2D) {
-                scale = ((SunGraphics2D) g).surfaceData.getDefaultScale();
+            int focus = 0;
+            if (controlState.is(JRSUIConstants.Focused.YES)) {
+                focus = JRSUIConstants.FOCUS_SIZE;
             }
+
+            final int imgX = bounds.x - focus;
+            final int imgY = bounds.y - focus;
+            final int imgW = bounds.width + (focus << 1);
+            final int imgH = bounds.height + (focus << 1);
             final GraphicsConfiguration config = g.getDeviceConfiguration();
             final ImageCache cache = ImageCache.getInstance();
-            final int imgW = bounds.width * scale;
-            final int imgH = bounds.height * scale;
-            AquaPixelsKey key = new AquaPixelsKey(config,
-                    imgW, imgH, scale, controlState);
-            BufferedImage img = (BufferedImage) cache.getImage(key);
+            final AquaPixelsKey key = new AquaPixelsKey(config, imgW, imgH,
+                                                        bounds, controlState);
+            Image img = cache.getImage(key);
             if (img == null) {
-                img = new BufferedImage(imgW, imgH, BufferedImage.TYPE_INT_ARGB_PRE);
+
+                Image baseImage = createImage(imgX, imgY, imgW, imgH, bounds,
+                                              control, controlState);
+
+                img = new MultiResolutionBufferedImage(baseImage,
+                        (rvWidth, rvHeight) -> createImage(imgX, imgY,
+                         rvWidth, rvHeight, bounds, control, controlState));
+
                 if (!controlState.is(JRSUIConstants.Animating.YES)) {
                     cache.setImage(key, img);
                 }
-
-                final WritableRaster raster = img.getRaster();
-                final DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer();
-
-                control.set(controlState);
-                control.paint(SunWritableRaster.stealData(buffer, 0),
-                        imgW, imgH, 0, 0, bounds.width, bounds.height);
-                SunWritableRaster.markDirty(buffer);
             }
 
-            g.drawImage(img, bounds.x, bounds.y, bounds.width, bounds.height, null);
+            g.drawImage(img, imgX, imgY, imgW, imgH, null);
+        }
+
+        private static Image createImage(int imgX, int imgY, int imgW, int imgH,
+                                         final Rectangle bounds,
+                                         final JRSUIControl control,
+                                         JRSUIState controlState) {
+            BufferedImage img = new BufferedImage(imgW, imgH,
+                    BufferedImage.TYPE_INT_ARGB_PRE);
+
+            final WritableRaster raster = img.getRaster();
+            final DataBufferInt buffer = (DataBufferInt) raster.getDataBuffer();
+
+            control.set(controlState);
+            control.paint(SunWritableRaster.stealData(buffer, 0), imgW, imgH,
+                          bounds.x - imgX, bounds.y - imgY, bounds.width,
+                          bounds.height);
+            SunWritableRaster.markDirty(buffer);
+            return img;
         }
     }
 
@@ -187,21 +218,22 @@
         private final GraphicsConfiguration config;
         private final int w;
         private final int h;
-        private final int scale;
+        private final Rectangle bounds;
         private final JRSUIState state;
 
         AquaPixelsKey(final GraphicsConfiguration config,
-                final int w, final int h, final int scale,
+                final int w, final int h, final Rectangle bounds,
                 final JRSUIState state) {
             this.pixelCount = w * h;
             this.config = config;
             this.w = w;
             this.h = h;
-            this.scale = scale;
+            this.bounds = bounds;
             this.state = state;
             this.hash = hash();
         }
 
+        @Override
         public int getPixelCount() {
             return pixelCount;
         }
@@ -210,7 +242,7 @@
             int hash = config != null ? config.hashCode() : 0;
             hash = 31 * hash + w;
             hash = 31 * hash + h;
-            hash = 31 * hash + scale;
+            hash = 31 * hash + bounds.hashCode();
             hash = 31 * hash + state.hashCode();
             return hash;
         }
@@ -225,7 +257,7 @@
             if (obj instanceof AquaPixelsKey) {
                 AquaPixelsKey key = (AquaPixelsKey) obj;
                 return config == key.config && w == key.w && h == key.h
-                        && scale == key.scale && state.equals(key.state);
+                        && bounds.equals(key.bounds) && state.equals(key.state);
             }
             return false;
         }
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Thu May 01 14:21:29 2014 -0700
@@ -44,6 +44,7 @@
 
 import sun.awt.*;
 import sun.awt.datatransfer.DataTransferer;
+import sun.java2d.opengl.OGLRenderQueue;
 import sun.lwawt.*;
 import sun.lwawt.LWWindowPeer.PeerType;
 import sun.security.action.GetBooleanAction;
@@ -410,7 +411,11 @@
 
     @Override
     public void sync() {
-        // TODO Auto-generated method stub
+        // flush the OGL pipeline (this is a no-op if OGL is not enabled)
+        OGLRenderQueue.sync();
+        // setNeedsDisplay() selector was sent to the appropriate CALayer so now
+        // we have to flush the native selectors queue.
+        flushNativeSelectors();
     }
 
     @Override
@@ -813,6 +818,11 @@
 
     private native boolean nativeSyncQueue(long timeout);
 
+    /**
+     * Just spin a single empty block synchronously.
+     */
+    private static native void flushNativeSelectors();
+
     @Override
     public Clipboard createPlatformClipboard() {
         return new CClipboard("System");
--- a/src/macosx/native/com/apple/laf/JRSUIController.m	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/com/apple/laf/JRSUIController.m	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -199,7 +199,7 @@
     CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
     CGContextRef cgRef = CGBitmapContextCreate(rawPixelData, imgW, imgH, 8, imgW * 4, colorspace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
     CGColorSpaceRelease(colorspace);
-    CGContextScaleCTM(cgRef, imgW/w , imgH/h);
+    CGContextScaleCTM(cgRef, imgW/(w + x + x) , imgH/(h + y + y));
 
     jint status = doPaintCGContext(cgRef, controlPtr, oldProperties, newProperties, x, y, w, h);
     CGContextRelease(cgRef);
--- a/src/macosx/native/sun/awt/AWTWindow.m	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Thu May 01 14:21:29 2014 -0700
@@ -762,6 +762,10 @@
     return lastKeyWindow;
 }
 
+- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame {
+    return !NSEqualSizes(self.nsWindow.frame.size, newFrame.size);
+}
+
 
 @end // AWTWindow
 
--- a/src/macosx/native/sun/awt/CClipboard.h	Thu May 01 12:51:13 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#import <AppKit/AppKit.h>
-#import "jni.h"
-
-@interface CClipboard : NSObject {
-    jobject fClipboardOwner;
-
-    // Track pasteboard changes. Initialized once at the start, and then updated
-    // on an application resume event.  If it's different than the last time we claimed
-    // the clipboard that means we lost the clipboard to someone else.
-    NSInteger fChangeCount;
-}
-
-+ (CClipboard *) sharedClipboard;
-
-- (void) javaDeclareTypes:(NSArray *)inTypes withOwner:(jobject)inClipboard jniEnv:(JNIEnv *)inEnv;
-- (void) javaSetData:(NSData *)inData forType:(NSString *) inFormat;
-
-- (NSArray *) javaGetTypes;
-- (NSData *) javaGetDataForType:(NSString *)inFormat;
-
-@end
--- a/src/macosx/native/sun/awt/CClipboard.m	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/sun/awt/CClipboard.m	Thu May 01 14:21:29 2014 -0700
@@ -23,70 +23,28 @@
  * questions.
  */
 
-#import "CClipboard.h"
 #import "CDataTransferer.h"
 #import "ThreadUtilities.h"
 #import "jni_util.h" 
 #import <Cocoa/Cocoa.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 
-static CClipboard *sClipboard = nil;
+@interface CClipboard : NSObject { }
+@property NSInteger changeCount;
+@property jobject clipboardOwner;
 
-//
-// CClipboardUpdate is used for mulitple calls to setData that happen before
-// the model and AppKit can get back in sync.
-//
-
-@interface CClipboardUpdate : NSObject {
-    NSData *fData;
-    NSString *fFormat;
-}
-
-- (id)initWithData:(NSData *)inData withFormat:(NSString *)inFormat;
-- (NSData *)data;
-- (NSString *)format;
-
-@end
-
-@implementation CClipboardUpdate
-
-- (id)initWithData:(NSData *)inData withFormat:(NSString *)inFormat
-{
-    self = [super init];
-
-    if (self != nil) {
-        fData = [inData retain];
-        fFormat = [inFormat retain];
-    }
-
-    return self;
-}
-
-- (void)dealloc
-{
-    [fData release];
-    fData = nil;
-
-    [fFormat release];
-    fFormat = nil;
-
-    [super dealloc];
-}
-
-- (NSData *)data {
-    return fData;
-}
-
-- (NSString *)format {
-    return fFormat;
-}
++ (CClipboard*)sharedClipboard;
+- (void)declareTypes:(NSArray *)types withOwner:(jobject)owner jniEnv:(JNIEnv*)env;
+- (void)checkPasteboard:(id)sender;
 @end
 
 @implementation CClipboard
+@synthesize changeCount = _changeCount;
+@synthesize clipboardOwner = _clipboardOwner;
 
-// Clipboard creation is synchronized at the Java level.
-+ (CClipboard *) sharedClipboard
-{
+// Clipboard creation is synchronized at the Java level
++ (CClipboard*)sharedClipboard {
+    static CClipboard* sClipboard = nil;
     if (sClipboard == nil) {
         sClipboard = [[CClipboard alloc] init];
         [[NSNotificationCenter defaultCenter] addObserver:sClipboard selector: @selector(checkPasteboard:)
@@ -97,90 +55,38 @@
     return sClipboard;
 }
 
-- (id) init
-{
-    self = [super init];
-
-    if (self != nil) {
-        fChangeCount = [[NSPasteboard generalPasteboard] changeCount];
+- (id)init {
+    if (self = [super init]) {
+        self.changeCount = [[NSPasteboard generalPasteboard] changeCount];
     }
-
     return self;
 }
 
-- (void) javaDeclareTypes:(NSArray *)inTypes withOwner:(jobject)inClipboard jniEnv:(JNIEnv *)inEnv {
-
+- (void)declareTypes:(NSArray*)types withOwner:(jobject)owner jniEnv:(JNIEnv*)env {
     @synchronized(self) {
-        if (inClipboard != NULL) {
-            if (fClipboardOwner != NULL) {
-                JNFDeleteGlobalRef(inEnv, fClipboardOwner);
+        if (owner != NULL) {
+            if (self.clipboardOwner != NULL) {
+                JNFDeleteGlobalRef(env, self.clipboardOwner);
             }
-            fClipboardOwner = JNFNewGlobalRef(inEnv, inClipboard);
+            self.clipboardOwner = JNFNewGlobalRef(env, owner);
         }
     }
-    [ThreadUtilities performOnMainThread:@selector(_nativeDeclareTypes:) on:self withObject:inTypes waitUntilDone:YES];
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^() {
+        self.changeCount = [[NSPasteboard generalPasteboard] declareTypes:types owner:self];
+    }];
 }
 
-- (void) _nativeDeclareTypes:(NSArray *)inTypes {
-    AWT_ASSERT_APPKIT_THREAD;
+- (void)checkPasteboard:(id)sender {
 
-    fChangeCount = [[NSPasteboard generalPasteboard] declareTypes:inTypes owner:self];
-}
-
-
-- (NSArray *) javaGetTypes {
-
-    NSMutableArray *args = [NSMutableArray arrayWithCapacity:1];
-    [ThreadUtilities performOnMainThread:@selector(_nativeGetTypes:) on:self withObject:args waitUntilDone:YES];
-    return [args lastObject];
-}
-
-- (void) _nativeGetTypes:(NSMutableArray *)args {
-    AWT_ASSERT_APPKIT_THREAD;
-
-    [args addObject:[[NSPasteboard generalPasteboard] types]];
-}
-
-- (void) javaSetData:(NSData *)inData forType:(NSString *) inFormat {
-
-    CClipboardUpdate *newUpdate = [[CClipboardUpdate alloc] initWithData:inData withFormat:inFormat];
-    [ThreadUtilities performOnMainThread:@selector(_nativeSetData:) on:self withObject:newUpdate waitUntilDone:YES];
-    [newUpdate release];
-}
-
-- (void) _nativeSetData:(CClipboardUpdate *)newUpdate {
-    AWT_ASSERT_APPKIT_THREAD;
-
-    [[NSPasteboard generalPasteboard] setData:[newUpdate data] forType:[newUpdate format]];
-}
-
-- (NSData *) javaGetDataForType:(NSString *) inFormat {
-
-    NSMutableArray *args = [NSMutableArray arrayWithObject:inFormat];
-    [ThreadUtilities performOnMainThread:@selector(_nativeGetDataForType:) on:self withObject:args waitUntilDone:YES];
-    return [args lastObject];
-}
-
-- (void) _nativeGetDataForType:(NSMutableArray *) args {
-    AWT_ASSERT_APPKIT_THREAD;
-
-    NSData *returnValue = [[NSPasteboard generalPasteboard] dataForType:[args objectAtIndex:0]];
-
-    if (returnValue) [args replaceObjectAtIndex:0 withObject:returnValue];
-    else [args removeLastObject];
-}
-
-- (void) checkPasteboard:(id)application {
-    AWT_ASSERT_APPKIT_THREAD;
-    
     // This is called via NSApplicationDidBecomeActiveNotification.
     
     // If the change count on the general pasteboard is different than when we set it
     // someone else put data on the clipboard.  That means the current owner lost ownership.
+    
     NSInteger newChangeCount = [[NSPasteboard generalPasteboard] changeCount];
-    
-    if (fChangeCount != newChangeCount) {
-        fChangeCount = newChangeCount;    
+
+    if (self.changeCount != newChangeCount) {
+        self.changeCount = newChangeCount;
 
         // Notify that the content might be changed
         static JNF_CLASS_CACHE(jc_CClipboard, "sun/lwawt/macosx/CClipboard");
@@ -191,11 +97,11 @@
         // If we have a Java pasteboard owner, tell it that it doesn't own the pasteboard anymore.
         static JNF_MEMBER_CACHE(jm_lostOwnership, jc_CClipboard, "notifyLostOwnership", "()V");
         @synchronized(self) {
-            if (fClipboardOwner) {
+            if (self.clipboardOwner) {
                 JNIEnv *env = [ThreadUtilities getJNIEnv];
-                JNFCallVoidMethod(env, fClipboardOwner, jm_lostOwnership); // AWT_THREADING Safe (event)
-                JNFDeleteGlobalRef(env, fClipboardOwner);
-                fClipboardOwner = NULL;
+                JNFCallVoidMethod(env, self.clipboardOwner, jm_lostOwnership); // AWT_THREADING Safe (event)
+                JNFDeleteGlobalRef(env, self.clipboardOwner);
+                self.clipboardOwner = NULL;
             }
         }
     }
@@ -225,7 +131,7 @@
     }
 
     (*env)->ReleasePrimitiveArrayCritical(env, inTypes, elements, JNI_ABORT);
-    [[CClipboard sharedClipboard] javaDeclareTypes:formatArray withOwner:inJavaClip jniEnv:env];
+    [[CClipboard sharedClipboard] declareTypes:formatArray withOwner:inJavaClip jniEnv:env];
 JNF_COCOA_EXIT(env);
 }
 
@@ -248,7 +154,9 @@
     NSData *bytesAsData = [NSData dataWithBytes:rawBytes length:nBytes];
     (*env)->ReleasePrimitiveArrayCritical(env, inBytes, rawBytes, JNI_ABORT);
     NSString *format = formatForIndex(inFormat);
-    [[CClipboard sharedClipboard] javaSetData:bytesAsData forType:format];
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^() {
+        [[NSPasteboard generalPasteboard] setData:bytesAsData forType:format];
+    }];
 JNF_COCOA_EXIT(env);
 }
 
@@ -263,7 +171,12 @@
     jlongArray returnValue = NULL;
 JNF_COCOA_ENTER(env);
 
-    NSArray *dataTypes = [[CClipboard sharedClipboard] javaGetTypes];
+    __block NSArray* dataTypes;
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^() {
+        dataTypes = [[[NSPasteboard generalPasteboard] types] retain];
+    }];
+    [dataTypes autorelease];
+    
     NSUInteger nFormats = [dataTypes count];
     NSUInteger knownFormats = 0;
     NSUInteger i;
@@ -320,11 +233,16 @@
 JNF_COCOA_ENTER(env);
 
     NSString *formatAsString = formatForIndex(format);
-    NSData *clipData = [[CClipboard sharedClipboard] javaGetDataForType:formatAsString];
-
+    __block NSData* clipData;
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^() {
+        clipData = [[[NSPasteboard generalPasteboard] dataForType:formatAsString] retain];
+    }];
+    
     if (clipData == NULL) {
         [JNFException raise:env as:"java/io/IOException" reason:"Font transform has NaN position"];
         return NULL;
+    } else {
+        [clipData autorelease];
     }
 
     NSUInteger dataSize = [clipData length];
@@ -350,13 +268,13 @@
 JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CClipboard_checkPasteboard
 (JNIEnv *env, jobject inObject )
 {
-    JNF_COCOA_ENTER(env);
+JNF_COCOA_ENTER(env);
 
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
         [[CClipboard sharedClipboard] checkPasteboard:nil];
     }];
         
-    JNF_COCOA_EXIT(env);
+JNF_COCOA_EXIT(env);
 }
 
 
--- a/src/macosx/native/sun/awt/CImage.m	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/sun/awt/CImage.m	Thu May 01 14:21:29 2014 -0700
@@ -379,7 +379,7 @@
         return getOrder(size1.width <= size2.width && size1.height <= size2.height);
     }];
 
-    NSMutableArray *sortedPixelSizes = [[NSMutableArray alloc] init];
+    NSMutableArray *sortedPixelSizes = [[[NSMutableArray alloc] init] autorelease];
     NSSize lastSize = [[sortedImageRepresentations lastObject] size];
     
     NSUInteger i = [sortedImageRepresentations indexOfObjectPassingTest:
--- a/src/macosx/native/sun/awt/CTextPipe.m	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/sun/awt/CTextPipe.m	Thu May 01 14:21:29 2014 -0700
@@ -147,7 +147,7 @@
 
     CGAffineTransform invTx = CGAffineTransformInvert(strike->fTx);
 
-    NSUInteger i;
+    NSInteger i;
     for (i = 0; i < length; i++)
     {
         CGGlyph glyph = glyphs[i];
@@ -355,19 +355,31 @@
     static JNF_CLASS_CACHE(jc_StandardGlyphVector_GlyphTransformInfo, "sun/font/StandardGlyphVector$GlyphTransformInfo");
     static JNF_MEMBER_CACHE(jm_StandardGlyphVector_GlyphTransformInfo_transforms, jc_StandardGlyphVector_GlyphTransformInfo, "transforms", "[D");
     jdoubleArray g_gtiTransformsArray = JNFGetObjectField(env, gti, jm_StandardGlyphVector_GlyphTransformInfo_transforms); //(*env)->GetObjectField(env, gti, g_gtiTransforms);
+    if (g_gtiTransformsArray == NULL) {
+        return;
+    } 
     jdouble *g_gvTransformsAsDoubles = (*env)->GetPrimitiveArrayCritical(env, g_gtiTransformsArray, NULL);
+    if (g_gvTransformsAsDoubles == NULL) {
+        (*env)->DeleteLocalRef(env, g_gtiTransformsArray);
+        return;
+    } 
 
     static JNF_MEMBER_CACHE(jm_StandardGlyphVector_GlyphTransformInfo_indices, jc_StandardGlyphVector_GlyphTransformInfo, "indices", "[I");
     jintArray g_gtiTXIndicesArray = JNFGetObjectField(env, gti, jm_StandardGlyphVector_GlyphTransformInfo_indices);
     jint *g_gvTXIndicesAsInts = (*env)->GetPrimitiveArrayCritical(env, g_gtiTXIndicesArray, NULL);
-
+    if (g_gvTXIndicesAsInts == NULL) {
+        (*env)->ReleasePrimitiveArrayCritical(env, g_gtiTransformsArray, g_gvTransformsAsDoubles, JNI_ABORT);
+        (*env)->DeleteLocalRef(env, g_gtiTransformsArray);
+        (*env)->DeleteLocalRef(env, g_gtiTXIndicesArray);
+        return;
+    }
     // slowest case, we have per-glyph transforms, and possibly glyph substitution as well
     JavaCT_DrawGlyphVector(qsdo, strike, useSubstituion, uniChars, glyphs, advances, g_gvTXIndicesAsInts, g_gvTransformsAsDoubles, length);
 
     (*env)->ReleasePrimitiveArrayCritical(env, g_gtiTransformsArray, g_gvTransformsAsDoubles, JNI_ABORT);
+    (*env)->ReleasePrimitiveArrayCritical(env, g_gtiTXIndicesArray, g_gvTXIndicesAsInts, JNI_ABORT);
+
     (*env)->DeleteLocalRef(env, g_gtiTransformsArray);
-
-    (*env)->ReleasePrimitiveArrayCritical(env, g_gtiTXIndicesArray, g_gvTXIndicesAsInts, JNI_ABORT);
     (*env)->DeleteLocalRef(env, g_gtiTXIndicesArray);
 }
 
@@ -403,6 +415,9 @@
 {
     // fill the glyph buffer
     jint *glyphsAsInts = (*env)->GetPrimitiveArrayCritical(env, glyphsArray, NULL);
+    if (glyphsAsInts == NULL) {
+        return;
+    }
 
     // if a glyph code from Java is negative, that means it is really a unicode value
     // which we can use in CoreText to strike the character in another font
@@ -429,11 +444,15 @@
     // fill the advance buffer
     static JNF_MEMBER_CACHE(jm_StandardGlyphVector_positions, jc_StandardGlyphVector, "positions", "[F");
     jfloatArray posArray = JNFGetObjectField(env, gVector, jm_StandardGlyphVector_positions);
-    if (posArray != NULL)
-    {
+    jfloat *positions = NULL;
+    if (posArray != NULL) {
         // in this case, the positions have already been pre-calculated for us on the Java side
-
-        jfloat *positions = (*env)->GetPrimitiveArrayCritical(env, posArray, NULL);
+        positions = (*env)->GetPrimitiveArrayCritical(env, posArray, NULL);
+        if (positions == NULL) {
+            (*env)->DeleteLocalRef(env, posArray);
+        }
+    }
+    if (positions != NULL) {
         CGPoint prev;
         prev.x = positions[0];
         prev.y = positions[1];
--- a/src/macosx/native/sun/awt/JavaComponentAccessibility.m	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/sun/awt/JavaComponentAccessibility.m	Thu May 01 14:21:29 2014 -0700
@@ -242,11 +242,15 @@
         jsize count = [ignoredKeys count];
 
         JNIEnv *env = [ThreadUtilities getJNIEnv];
-        jclass clazz = (*env)->FindClass(env, "java/lang/String");
-        result = (*env)->NewObjectArray(env, count, clazz, NULL); // AWT_THREADING Safe (known object)
-        (*env)->DeleteLocalRef(env, clazz);
 
-        NSUInteger i;
+        static JNF_CLASS_CACHE(jc_String, "java/lang/String");
+        result = JNFNewObjectArray(env, &jc_String, count);
+        if (!result) {
+            NSLog(@"In %s, can't create Java array of String objects", __FUNCTION__);
+            return;
+        }
+
+        NSInteger i;
         for (i = 0; i < count; i++) {
             jstring jString = JNFNSToJavaString(env, [ignoredKeys objectAtIndex:i]);
             (*env)->SetObjectArrayElement(env, result, i, jString);
@@ -281,7 +285,7 @@
     jsize arrayLen = (*env)->GetArrayLength(env, jchildrenAndRoles);
     NSMutableArray *children = [NSMutableArray arrayWithCapacity:arrayLen/2]; //childrenAndRoles array contains two elements (child, role) for each child
 
-    NSUInteger i;
+    NSInteger i;
     NSUInteger childIndex = (whichChildren >= 0) ? whichChildren : 0; // if we're getting one particular child, make sure to set its index correctly
     for(i = 0; i < arrayLen; i+=2)
     {
@@ -377,8 +381,13 @@
     // Get all the other accessibility attributes states we need in one swell foop.
     // javaRole isn't pulled in because we need protected access to AccessibleRole.key
     jbooleanArray attributeStates = JNFCallStaticObjectMethod(env, jm_getInitialAttributeStates, fAccessible, fComponent); // AWT_THREADING Safe (AWTRunLoop)
-    if (attributeStates == NULL) return NULL;
+    if (attributeStates == NULL) return nil;
     jboolean *attributeStatesArray = (*env)->GetBooleanArrayElements(env, attributeStates, 0);
+    if (attributeStatesArray == NULL) {
+        // Note: Java will not be on the stack here so a java exception can't happen and no need to call ExceptionCheck.
+        NSLog(@"%s failed calling GetBooleanArrayElements", __FUNCTION__);
+        return nil;
+    }
 
     // if there's a component, it can be enabled and it has a size/position
     if (attributeStatesArray[0]) {
@@ -1206,7 +1215,7 @@
     // Go through the tabs and find selAccessible
     _numTabs = [tabs count];
     JavaComponentAccessibility *aTab;
-    NSUInteger i;
+    NSInteger i;
     for (i = 0; i < _numTabs; i++) {
         aTab = (JavaComponentAccessibility *)[tabs objectAtIndex:i];
         if ([aTab isAccessibleWithEnv:env forAccessible:selAccessible]) {
@@ -1233,7 +1242,7 @@
 
     NSString *tabJavaRole = JNFJavaToNSString(env, JNFGetObjectField(env, jtabJavaRole, sjf_key));
 
-    NSUInteger i;
+    NSInteger i;
     NSUInteger tabIndex = (whichTabs >= 0) ? whichTabs : 0; // if we're getting one particular child, make sure to set its index correctly
     for(i = 0; i < arrayLen; i+=2) {
         jobject jtab = (*env)->GetObjectArrayElement(env, jtabsAndRoles, i);
--- a/src/macosx/native/sun/awt/JavaTextAccessibility.m	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/sun/awt/JavaTextAccessibility.m	Thu May 01 14:21:29 2014 -0700
@@ -40,6 +40,11 @@
  */
 NSValue *javaIntArrayToNSRangeValue(JNIEnv* env, jintArray array) {
     jint *values = (*env)->GetIntArrayElements(env, array, 0);
+    if (values == NULL) {
+        // Note: Java will not be on the stack here so a java exception can't happen and no need to call ExceptionCheck.
+        NSLog(@"%s failed calling GetIntArrayElements", __FUNCTION__);
+        return nil;
+    };
     NSValue *value = [NSValue valueWithRange:NSMakeRange(values[0], values[1] - values[0])];
     (*env)->ReleaseIntArrayElements(env, array, values, 0);
     return value;
@@ -285,6 +290,11 @@
 
     // We cheat because we know that the array is 4 elements long (x, y, width, height)
     jdouble *values = (*env)->GetDoubleArrayElements(env, axBounds, 0);
+    if (values == NULL) {
+        // Note: Java will not be on the stack here so a java exception can't happen and no need to call ExceptionCheck.
+        NSLog(@"%s failed calling GetDoubleArrayElements", __FUNCTION__); 
+        return nil;
+    };
     NSRect bounds;
     bounds.origin.x = values[0];
     bounds.origin.y = [[[[self view] window] screen] frame].size.height - values[1] - values[3]; //values[1] is y-coord from top-left of screen. Flip. Account for the height (values[3]) when flipping
--- a/src/macosx/native/sun/awt/LWCToolkit.m	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/sun/awt/LWCToolkit.m	Thu May 01 14:21:29 2014 -0700
@@ -144,6 +144,18 @@
     return JNI_FALSE;
 }
 
+/*
+ * Class:     sun_lwawt_macosx_LWCToolkit
+ * Method:    flushNativeSelectors
+ * Signature: ()J
+ */
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_flushNativeSelectors
+(JNIEnv *env, jclass clz)
+{
+JNF_COCOA_ENTER(env);
+        [ThreadUtilities performOnMainThreadWaiting:YES block:^(){}];
+JNF_COCOA_EXIT(env);
+}
 
 static JNF_CLASS_CACHE(jc_Component, "java/awt/Component");
 static JNF_MEMBER_CACHE(jf_Component_appContext, jc_Component, "appContext", "Lsun/awt/AppContext;");
--- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Thu May 01 14:21:29 2014 -0700
@@ -142,9 +142,16 @@
     splash->screenFormat.byteOrder = 1 ?  BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
     splash->screenFormat.depthBytes = 4;
 
-    [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
-        [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
-    }];
+    // If this property is present we are running SWT and should not start a runLoop
+    // Can't check if running SWT in webstart, so splash screen in webstart SWT
+    // applications is not supported
+    char envVar[80];
+    snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
+    if (getenv(envVar) == NULL) {
+        [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
+            [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
+        }];
+    }
 }
 
 void
--- a/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/macosx/native/sun/util/locale/provider/HostLocaleProviderAdapter_md.c	Thu May 01 14:21:29 2014 -0700
@@ -154,7 +154,10 @@
                 if (pmStr != NULL) {
                     CFStringGetCString(pmStr, buf, BUFLEN, kCFStringEncodingUTF8);
                     CFRelease(pmStr);
-                    (*env)->SetObjectArrayElement(env, ampms, 1, (*env)->NewStringUTF(env, buf));
+                    tmp_string = (*env)->NewStringUTF(env, buf);
+                    if (tmp_string != NULL) {
+                        (*env)->SetObjectArrayElement(env, ampms, 1, tmp_string);
+                    }
                 }
             }
             CFRelease(df);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/back/InterfaceTypeImpl.c	Thu May 01 14:21:29 2014 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "util.h"
+#include "InterfaceTypeImpl.h"
+#include "inStream.h"
+#include "outStream.h"
+
+static jboolean
+invokeStatic(PacketInputStream *in, PacketOutputStream *out)
+{
+    return sharedInvoke(in, out);
+}
+
+void *InterfaceType_Cmds[] = { (void *)0x1
+    , (void *)invokeStatic
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/back/InterfaceTypeImpl.h	Thu May 01 14:21:29 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+extern void *InterfaceType_Cmds[];
--- a/src/share/back/VirtualMachineImpl.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/back/VirtualMachineImpl.c	Thu May 01 14:21:29 2014 -0700
@@ -36,7 +36,7 @@
 
 static char *versionName = "Java Debug Wire Protocol (Reference Implementation)";
 static int majorVersion = 1;  /* JDWP major version */
-static int minorVersion = 6;  /* JDWP minor version */
+static int minorVersion = 8;  /* JDWP minor version */
 
 static jboolean
 version(PacketInputStream *in, PacketOutputStream *out)
--- a/src/share/back/debugDispatch.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/back/debugDispatch.c	Thu May 01 14:21:29 2014 -0700
@@ -29,6 +29,7 @@
 #include "VirtualMachineImpl.h"
 #include "ReferenceTypeImpl.h"
 #include "ClassTypeImpl.h"
+#include "InterfaceTypeImpl.h"
 #include "ArrayTypeImpl.h"
 #include "FieldImpl.h"
 #include "MethodImpl.h"
@@ -67,6 +68,7 @@
     l1Array[JDWP_COMMAND_SET(VirtualMachine)] = (void *)VirtualMachine_Cmds;
     l1Array[JDWP_COMMAND_SET(ReferenceType)] = (void *)ReferenceType_Cmds;
     l1Array[JDWP_COMMAND_SET(ClassType)] = (void *)ClassType_Cmds;
+    l1Array[JDWP_COMMAND_SET(InterfaceType)] = (void *)InterfaceType_Cmds;
     l1Array[JDWP_COMMAND_SET(ArrayType)] = (void *)ArrayType_Cmds;
 
     l1Array[JDWP_COMMAND_SET(Field)] = (void *)Field_Cmds;
--- a/src/share/back/util.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/back/util.c	Thu May 01 14:21:29 2014 -0700
@@ -591,6 +591,8 @@
         invokeType = INVOKE_CONSTRUCTOR;
     } else if (inStream_command(in) == JDWP_COMMAND(ClassType, InvokeMethod)) {
         invokeType = INVOKE_STATIC;
+    } else if (inStream_command(in) == JDWP_COMMAND(InterfaceType, InvokeMethod)) {
+        invokeType = INVOKE_STATIC;
     } else if (inStream_command(in) == JDWP_COMMAND(ObjectReference, InvokeMethod)) {
         invokeType = INVOKE_INSTANCE;
     } else {
--- a/src/share/classes/com/sun/beans/util/Cache.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/beans/util/Cache.java	Thu May 01 14:21:29 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/java/swing/plaf/motif/MotifScrollBarUI.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/motif/MotifScrollBarUI.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, 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
@@ -24,17 +24,19 @@
  */
 package com.sun.java.swing.plaf.motif;
 
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.plaf.*;
-import javax.swing.border.*;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.Rectangle;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JScrollBar;
+import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.basic.BasicScrollBarUI;
 
-import java.awt.Dimension;
-import java.awt.Insets;
-import java.awt.Rectangle;
-import java.awt.Graphics;
-import java.awt.Color;
+import static sun.swing.SwingUtilities2.drawHLine;
+import static sun.swing.SwingUtilities2.drawVLine;
 
 
 /**
@@ -74,17 +76,13 @@
         return new MotifScrollBarButton(orientation);
     }
 
-
     public void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)  {
         g.setColor(trackColor);
         g.fillRect(trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height);
     }
 
-
-    public void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
-    {
-
-        if(thumbBounds.isEmpty() || !scrollbar.isEnabled())     {
+    public void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
+        if (thumbBounds.isEmpty() || !scrollbar.isEnabled()) {
             return;
         }
 
@@ -93,15 +91,15 @@
 
         g.translate(thumbBounds.x, thumbBounds.y);
         g.setColor(thumbColor);
-        g.fillRect(0, 0, w-1, h-1);
+        g.fillRect(0, 0, w - 1, h - 1);
 
         g.setColor(thumbHighlightColor);
-        g.drawLine(0, 0, 0, h-1);
-        g.drawLine(1, 0, w-1, 0);
+        drawVLine(g, 0, 0, h - 1);
+        drawHLine(g, 1, w - 1, 0);
 
         g.setColor(thumbLightShadowColor);
-        g.drawLine(1, h-1, w-1, h-1);
-        g.drawLine(w-1, 1, w-1, h-2);
+        drawHLine(g, 1, w - 1, h - 1);
+        drawVLine(g, w - 1, 1, h - 2);
 
         g.translate(-thumbBounds.x, -thumbBounds.y);
     }
--- a/src/share/classes/com/sun/java/swing/plaf/motif/MotifSliderUI.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/motif/MotifSliderUI.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1999, 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
@@ -25,14 +25,17 @@
 
 package com.sun.java.swing.plaf.motif;
 
-import java.awt.*;
-import java.awt.event.*;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
 
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.plaf.*;
+import javax.swing.JComponent;
+import javax.swing.JSlider;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicSliderUI;
 
-import javax.swing.plaf.basic.BasicSliderUI;
+import static sun.swing.SwingUtilities2.drawHLine;
+import static sun.swing.SwingUtilities2.drawVLine;
 
 /**
  * Motif Slider
@@ -123,15 +126,15 @@
 
             // highlight
             g.setColor(getHighlightColor());
-            g.drawLine(0, 1, w - 1, 1);             // top
-            g.drawLine(0, 1, 0, h);                     // left
-            g.drawLine(w/2, 2, w/2, h-1);       // center
+            drawHLine(g, 0, w - 1, 1);      // top
+            drawVLine(g, 0, 1, h);          // left
+            drawVLine(g, w / 2, 2, h - 1);  // center
 
             // shadow
             g.setColor(getShadowColor());
-            g.drawLine(0, h, w - 1, h);         // bottom
-            g.drawLine(w - 1, 1, w - 1, h);     // right
-            g.drawLine(w/2 - 1, 2, w/2 - 1, h); // center
+            drawHLine(g, 0, w - 1, h);      // bottom
+            drawVLine(g, w - 1, 1, h);      // right
+            drawVLine(g, w / 2 - 1, 2, h);  // center
 
             g.translate(-x, -(knobBounds.y-1));
         }
@@ -143,15 +146,15 @@
 
             // highlight
             g.setColor(getHighlightColor());
-            g.drawLine(1, y, w, y);                     // top
-            g.drawLine(1, y+1, 1, y+h-1);               // left
-            g.drawLine(2, y+h/2, w-1, y+h/2);           // center
+            drawHLine(g, 1, w, y);             // top
+            drawVLine(g, 1, y + 1, y + h - 1); // left
+            drawHLine(g, 2, w - 1, y + h / 2); // center
 
             // shadow
             g.setColor(getShadowColor());
-            g.drawLine(2, y+h-1, w, y+h-1);             // bottom
-            g.drawLine(w, y+h-1, w, y);                 // right
-            g.drawLine(2, y+h/2-1, w-1, y+h/2-1);       // center
+            drawHLine(g, 2, w, y + h - 1);        // bottom
+            drawVLine(g, w, y + h - 1, y);        // right
+            drawHLine(g, 2, w - 1, y + h / 2 - 1);// center
 
             g.translate(-(knobBounds.x-1), 0);
         }
--- a/src/share/classes/com/sun/jdi/ClassType.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/jdi/ClassType.java	Thu May 01 14:21:29 2014 -0700
@@ -103,7 +103,7 @@
      * <p>
      * Object values must be assignment compatible with the field type
      * (This implies that the field type must be loaded through the
-     * enclosing class's class loader). Primitive values must be
+     * enclosing class' class loader). Primitive values must be
      * either assignment compatible with the field type or must be
      * convertible to the field type without loss of information.
      * See JLS section 5.2 for more information on assignment
@@ -153,7 +153,7 @@
      * <p>
      * Object arguments must be assignment compatible with the argument type
      * (This implies that the argument type must be loaded through the
-     * enclosing class's class loader). Primitive arguments must be
+     * enclosing class' class loader). Primitive arguments must be
      * either assignment compatible with the argument type or must be
      * convertible to the argument type without loss of information.
      * If the method being called accepts a variable number of arguments,
@@ -216,7 +216,7 @@
      * @return a {@link Value} mirror of the invoked method's return value.
      * @throws java.lang.IllegalArgumentException if the method is not
      * a member of this class or a superclass, if the size of the argument list
-     * does not match the number of declared arguemnts for the method, or
+     * does not match the number of declared arguments for the method, or
      * if the method is an initializer, constructor or static intializer.
      * @throws {@link InvalidTypeException} if any argument in the
      * argument list is not assignable to the corresponding method argument
@@ -230,7 +230,7 @@
      * @throws InvalidTypeException If the arguments do not meet this requirement --
      *         Object arguments must be assignment compatible with the argument
      *         type.  This implies that the argument type must be
-     *         loaded through the enclosing class's class loader.
+     *         loaded through the enclosing class' class loader.
      *         Primitive arguments must be either assignment compatible with the
      *         argument type or must be convertible to the argument type without loss
      *         of information. See JLS section 5.2 for more information on assignment
@@ -267,7 +267,7 @@
      * <p>
      * Object arguments must be assignment compatible with the argument type
      * (This implies that the argument type must be loaded through the
-     * enclosing class's class loader). Primitive arguments must be
+     * enclosing class' class loader). Primitive arguments must be
      * either assignment compatible with the argument type or must be
      * convertible to the argument type without loss of information.
      * If the method being called accepts a variable number of arguments,
@@ -335,7 +335,7 @@
      * @throws InvalidTypeException If the arguments do not meet this requirement --
      *         Object arguments must be assignment compatible with the argument
      *         type.  This implies that the argument type must be
-     *         loaded through the enclosing class's class loader.
+     *         loaded through the enclosing class' class loader.
      *         Primitive arguments must be either assignment compatible with the
      *         argument type or must be convertible to the argument type without loss
      *         of information. See JLS section 5.2 for more information on assignment
--- a/src/share/classes/com/sun/jdi/InterfaceType.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/jdi/InterfaceType.java	Thu May 01 14:21:29 2014 -0700
@@ -79,4 +79,123 @@
      * If none exist, returns a zero length List.
      */
     List<ClassType> implementors();
+
+    /**
+     * Invokes the specified static {@link Method} in the
+     * target VM. The
+     * specified method must be defined in this interface.
+     * The method must be a static method
+     * but not a static initializer.
+     * <p>
+     * The method invocation will occur in the specified thread.
+     * Method invocation can occur only if the specified thread
+     * has been suspended by an event which occurred in that thread.
+     * Method invocation is not supported
+     * when the target VM has been suspended through
+     * {@link VirtualMachine#suspend} or when the specified thread
+     * is suspended through {@link ThreadReference#suspend}.
+     * <p>
+     * The specified method is invoked with the arguments in the specified
+     * argument list.  The method invocation is synchronous; this method
+     * does not return until the invoked method returns in the target VM.
+     * If the invoked method throws an exception, this method will throw
+     * an {@link InvocationException} which contains a mirror to the exception
+     * object thrown.
+     * <p>
+     * Object arguments must be assignment compatible with the argument type
+     * (This implies that the argument type must be loaded through the
+     * enclosing class' class loader). Primitive arguments must be
+     * either assignment compatible with the argument type or must be
+     * convertible to the argument type without loss of information.
+     * If the method being called accepts a variable number of arguments,
+     * then the last argument type is an array of some component type.
+     * The argument in the matching position can be omitted, or can be null,
+     * an array of the same component type, or an argument of the
+     * component type followed by any number of other arguments of the same
+     * type. If the argument is omitted, then a 0 length array of the
+     * component type is passed.  The component type can be a primitive type.
+     * Autoboxing is not supported.
+     *
+     * See Section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
+     * for more information on assignment compatibility.
+     * <p>
+     * By default, all threads in the target VM are resumed while
+     * the method is being invoked if they were previously
+     * suspended by an event or by {@link VirtualMachine#suspend} or
+     * {@link ThreadReference#suspend}. This is done to prevent the deadlocks
+     * that will occur if any of the threads own monitors
+     * that will be needed by the invoked method.
+     * Note, however, that this implicit resume acts exactly like
+     * {@link ThreadReference#resume}, so if the thread's suspend
+     * count is greater than 1, it will remain in a suspended state
+     * during the invocation and thus a deadlock could still occur.
+     * By default, when the invocation completes,
+     * all threads in the target VM are suspended, regardless their state
+     * before the invocation.
+     * It is possible that
+     * breakpoints or other events might occur during the invocation.
+     * This can cause deadlocks as described above. It can also cause a deadlock
+     * if invokeMethod is called from the client's event handler thread.  In this
+     * case, this thread will be waiting for the invokeMethod to complete and
+     * won't read the EventSet that comes in for the new event.  If this
+     * new EventSet is SUSPEND_ALL, then a deadlock will occur because no
+     * one will resume the EventSet.  To avoid this, all EventRequests should
+     * be disabled before doing the invokeMethod, or the invokeMethod should
+     * not be done from the client's event handler thread.
+     * <p>
+     * The resumption of other threads during the invocation can be prevented
+     * by specifying the {@link #INVOKE_SINGLE_THREADED}
+     * bit flag in the <code>options</code> argument; however,
+     * there is no protection against or recovery from the deadlocks
+     * described above, so this option should be used with great caution.
+     * Only the specified thread will be resumed (as described for all
+     * threads above). Upon completion of a single threaded invoke, the invoking thread
+     * will be suspended once again. Note that any threads started during
+     * the single threaded invocation will not be suspended when the
+     * invocation completes.
+     * <p>
+     * If the target VM is disconnected during the invoke (for example, through
+     * {@link VirtualMachine#dispose}) the method invocation continues.
+     *
+     * @param thread the thread in which to invoke.
+     * @param method the {@link Method} to invoke.
+     * @param arguments the list of {@link Value} arguments bound to the
+     * invoked method. Values from the list are assigned to arguments
+     * in the order they appear in the method signature.
+     * @param options the integer bit flag options.
+     * @return a {@link Value} mirror of the invoked method's return value.
+     * @throws java.lang.IllegalArgumentException if the method is not
+     * a member of this interface, if the size of the argument list
+     * does not match the number of declared arguments for the method, or
+     * if the method is not static or is a static initializer.
+     * @throws {@link InvalidTypeException} if any argument in the
+     * argument list is not assignable to the corresponding method argument
+     * type.
+     * @throws ClassNotLoadedException if any argument type has not yet been loaded
+     * through the appropriate class loader.
+     * @throws IncompatibleThreadStateException if the specified thread has not
+     * been suspended by an event.
+     * @throws InvocationException if the method invocation resulted in
+     * an exception in the target VM.
+     * @throws InvalidTypeException If the arguments do not meet this requirement --
+     *         Object arguments must be assignment compatible with the argument
+     *         type.  This implies that the argument type must be
+     *         loaded through the enclosing class' class loader.
+     *         Primitive arguments must be either assignment compatible with the
+     *         argument type or must be convertible to the argument type without loss
+     *         of information. See JLS section 5.2 for more information on assignment
+     *         compatibility.
+     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+     *
+     * @since 1.8
+     */
+    default Value invokeMethod(ThreadReference thread, Method method,
+                       List<? extends Value> arguments, int options)
+            throws InvalidTypeException,
+            ClassNotLoadedException,
+            IncompatibleThreadStateException,
+            InvocationException {
+        throw new UnsupportedOperationException();
+    }
 }
--- a/src/share/classes/com/sun/jdi/Method.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/jdi/Method.java	Thu May 01 14:21:29 2014 -0700
@@ -138,6 +138,18 @@
     boolean isAbstract();
 
     /**
+     * Determine if this method is a default method
+     *
+     * @return <code>true</code> if the method is declared default;
+     * false otherwise
+     *
+     * @since 1.8
+     */
+    default boolean isDefault() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
      * Determine if this method is synchronized.
      *
      * @return <code>true</code> if the method is declared synchronized;
--- a/src/share/classes/com/sun/jdi/ObjectReference.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/jdi/ObjectReference.java	Thu May 01 14:21:29 2014 -0700
@@ -194,10 +194,10 @@
      * {@link #INVOKE_NONVIRTUAL} bit flag in the <code>options</code>
      * argument. If this flag is set, the specified method is invoked
      * whether or not it is overridden for this object's runtime type.
-     * The method, in this case, must not belong to an interface and
-     * must not be abstract. This option is useful for performing method
-     * invocations like those done with the <code>super</code> keyword in
-     * the Java programming language.
+     * The method, in this case, must have an implementation, either in a class
+     * or an interface. This option is useful for performing method invocations
+     * like those done with the <code>super</code> keyword in the Java programming
+     * language.
      * <p>
      * By default, all threads in the target VM are resumed while
      * the method is being invoked if they were previously
@@ -246,10 +246,10 @@
      * @return a {@link Value} mirror of the invoked method's return value.
      * @throws java.lang.IllegalArgumentException if the method is not
      * a member of this object's class, if the size of the argument list
-     * does not match the number of declared arguemnts for the method,
+     * does not match the number of declared arguments for the method,
      * if the method is a constructor or static intializer, or
      * if {@link #INVOKE_NONVIRTUAL} is specified and the method is
-     * either abstract or an interface member.
+     * either abstract or a non-default interface member.
      * @throws {@link InvalidTypeException} if any argument in the
      * argument list is not assignable to the corresponding method argument
      * type.
--- a/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/media/sound/SoftEnvelopeGenerator.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -118,6 +118,7 @@
         return null;
     }
 
+    @SuppressWarnings("fallthrough")
     public void processControlLogic() {
         for (int i = 0; i < used_count; i++) {
 
@@ -170,6 +171,7 @@
                         this.delay[i][0] / 1200.0) / control_time);
                 if (stage_ix[i] < 0)
                     stage_ix[i] = 0;
+                // Fallthrough
             case EG_DELAY:
                 if (stage_ix[i] == 0) {
                     double attack = this.attack[i][0];
--- a/src/share/classes/com/sun/tools/example/debug/expr/LValue.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/tools/example/debug/expr/LValue.java	Thu May 01 14:21:29 2014 -0700
@@ -559,6 +559,9 @@
             } else if (refType instanceof ClassType) {
                 ClassType clazz = (ClassType)refType;
                 return jdiValue = clazz.invokeMethod(thread, matchingMethod, methodArguments, 0);
+            } else if (refType instanceof InterfaceType) {
+                InterfaceType iface = (InterfaceType)refType;
+                return jdiValue = iface.invokeMethod(thread, matchingMethod, methodArguments, 0);
             } else {
                 throw new InvalidTypeException("Cannot invoke static method on " +
                                          refType.name());
--- a/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java	Thu May 01 14:21:29 2014 -0700
@@ -29,9 +29,27 @@
 
 import java.util.*;
 
-public class ClassTypeImpl extends ReferenceTypeImpl
+final public class ClassTypeImpl extends InvokableTypeImpl
     implements ClassType
 {
+    private static class IResult implements InvocationResult {
+        final private JDWP.ClassType.InvokeMethod rslt;
+
+        public IResult(JDWP.ClassType.InvokeMethod rslt) {
+            this.rslt = rslt;
+        }
+
+        @Override
+        public ObjectReferenceImpl getException() {
+            return rslt.exception;
+        }
+
+        @Override
+        public ValueImpl getResult() {
+            return rslt.returnValue;
+        }
+    }
+
     private boolean cachedSuperclass = false;
     private ClassType superclass = null;
     private int lastLine = -1;
@@ -65,6 +83,7 @@
         return superclass;
     }
 
+    @Override
     public List<InterfaceType> interfaces()  {
         if (interfaces == null) {
             interfaces = getInterfaces();
@@ -72,26 +91,9 @@
         return interfaces;
     }
 
-    void addInterfaces(List<InterfaceType> list) {
-        List<InterfaceType> immediate = interfaces();
-        list.addAll(interfaces());
-
-        Iterator<InterfaceType> iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addSuperinterfaces(list);
-        }
-
-        ClassTypeImpl superclass = (ClassTypeImpl)superclass();
-        if (superclass != null) {
-            superclass.addInterfaces(list);
-        }
-    }
-
-    public List<InterfaceType> allInterfaces()  {
-        List<InterfaceType> all = new ArrayList<InterfaceType>();
-        addInterfaces(all);
-        return all;
+    @Override
+    public List<InterfaceType> allInterfaces() {
+        return getAllInterfaces();
     }
 
     public List<ClassType> subclasses() {
@@ -159,28 +161,6 @@
         }
     }
 
-    PacketStream sendInvokeCommand(final ThreadReferenceImpl thread,
-                                   final MethodImpl method,
-                                   final ValueImpl[] args,
-                                   final int options) {
-        CommandSender sender =
-            new CommandSender() {
-                public PacketStream send() {
-                    return JDWP.ClassType.InvokeMethod.enqueueCommand(
-                                          vm, ClassTypeImpl.this, thread,
-                                          method.ref(), args, options);
-                }
-        };
-
-        PacketStream stream;
-        if ((options & INVOKE_SINGLE_THREADED) != 0) {
-            stream = thread.sendResumingCommand(sender);
-        } else {
-            stream = vm.sendResumingCommand(sender);
-        }
-        return stream;
-    }
-
     PacketStream sendNewInstanceCommand(final ThreadReferenceImpl thread,
                                    final MethodImpl method,
                                    final ValueImpl[] args,
@@ -203,52 +183,6 @@
         return stream;
     }
 
-    public Value invokeMethod(ThreadReference threadIntf, Method methodIntf,
-                              List<? extends Value> origArguments, int options)
-                                   throws InvalidTypeException,
-                                          ClassNotLoadedException,
-                                          IncompatibleThreadStateException,
-                                          InvocationException {
-        validateMirror(threadIntf);
-        validateMirror(methodIntf);
-        validateMirrorsOrNulls(origArguments);
-
-        MethodImpl method = (MethodImpl)methodIntf;
-        ThreadReferenceImpl thread = (ThreadReferenceImpl)threadIntf;
-
-        validateMethodInvocation(method);
-
-        List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments);
-
-        ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
-        JDWP.ClassType.InvokeMethod ret;
-        try {
-            PacketStream stream =
-                sendInvokeCommand(thread, method, args, options);
-            ret = JDWP.ClassType.InvokeMethod.waitForReply(vm, stream);
-        } catch (JDWPException exc) {
-            if (exc.errorCode() == JDWP.Error.INVALID_THREAD) {
-                throw new IncompatibleThreadStateException();
-            } else {
-                throw exc.toJDIException();
-            }
-        }
-
-        /*
-         * There is an implict VM-wide suspend at the conclusion
-         * of a normal (non-single-threaded) method invoke
-         */
-        if ((options & INVOKE_SINGLE_THREADED) == 0) {
-            vm.notifySuspend();
-        }
-
-        if (ret.exception != null) {
-            throw new InvocationException(ret.exception);
-        } else {
-            return ret.returnValue;
-        }
-    }
-
     public ObjectReference newInstance(ThreadReference threadIntf,
                                        Method methodIntf,
                                        List<? extends Value> origArguments,
@@ -311,58 +245,6 @@
        return method;
    }
 
-   public List<Method> allMethods() {
-        ArrayList<Method> list = new ArrayList<Method>(methods());
-
-        ClassType clazz = superclass();
-        while (clazz != null) {
-            list.addAll(clazz.methods());
-            clazz = clazz.superclass();
-        }
-
-        /*
-         * Avoid duplicate checking on each method by iterating through
-         * duplicate-free allInterfaces() rather than recursing
-         */
-        for (InterfaceType interfaze : allInterfaces()) {
-            list.addAll(interfaze.methods());
-        }
-
-        return list;
-    }
-
-    List<ReferenceType> inheritedTypes() {
-        List<ReferenceType> inherited = new ArrayList<ReferenceType>();
-        if (superclass() != null) {
-            inherited.add(0, (ReferenceType)superclass()); /* insert at front */
-        }
-        for (ReferenceType rt : interfaces()) {
-            inherited.add(rt);
-        }
-        return inherited;
-    }
-
-    void validateMethodInvocation(Method method)
-                                   throws InvalidTypeException,
-                                          InvocationException {
-        /*
-         * Method must be in this class or a superclass.
-         */
-        ReferenceTypeImpl declType = (ReferenceTypeImpl)method.declaringType();
-        if (!declType.isAssignableFrom(this)) {
-            throw new IllegalArgumentException("Invalid method");
-        }
-
-        /*
-         * Method must be a static and not a static initializer
-         */
-        if (!method.isStatic()) {
-            throw new IllegalArgumentException("Cannot invoke instance method on a class type");
-        } else if (method.isStaticInitializer()) {
-            throw new IllegalArgumentException("Cannot invoke static initializer");
-        }
-    }
-
     void validateConstructorInvocation(Method method)
                                    throws InvalidTypeException,
                                           InvocationException {
@@ -382,51 +264,33 @@
         }
     }
 
-    @Override
-    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
-        /*
-         * Add methods from
-         * parent types first, so that the methods in this class will
-         * overwrite them in the hash table
-         */
-
-        Iterator<InterfaceType> iter = interfaces().iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            if (!seenInterfaces.contains(interfaze)) {
-                interfaze.addVisibleMethods(methodMap, seenInterfaces);
-                seenInterfaces.add(interfaze);
-            }
-        }
-
-        ClassTypeImpl clazz = (ClassTypeImpl)superclass();
-        if (clazz != null) {
-            clazz.addVisibleMethods(methodMap, seenInterfaces);
-        }
-
-        addToMethodMap(methodMap, methods());
-    }
-
-    boolean isAssignableTo(ReferenceType type) {
-        ClassTypeImpl superclazz = (ClassTypeImpl)superclass();
-        if (this.equals(type)) {
-            return true;
-        } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
-            return true;
-        } else {
-            List<InterfaceType> interfaces = interfaces();
-            Iterator<InterfaceType> iter = interfaces.iterator();
-            while (iter.hasNext()) {
-                InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-                if (interfaze.isAssignableTo(type)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
 
     public String toString() {
        return "class " + name() + " (" + loaderString() + ")";
     }
+
+    @Override
+    CommandSender getInvokeMethodSender(ThreadReferenceImpl thread,
+                                        MethodImpl method,
+                                        ValueImpl[] args,
+                                        int options) {
+        return () ->
+            JDWP.ClassType.InvokeMethod.enqueueCommand(vm,
+                                                       ClassTypeImpl.this,
+                                                       thread,
+                                                       method.ref(),
+                                                       args,
+                                                       options);
+    }
+
+    @Override
+    InvocationResult waitForReply(PacketStream stream) throws JDWPException {
+        return new IResult(JDWP.ClassType.InvokeMethod.waitForReply(vm, stream));
+    }
+
+    @Override
+    boolean canInvoke(Method method) {
+        // Method must be in this class or a superclass.
+        return ((ReferenceTypeImpl)method.declaringType()).isAssignableFrom(this);
+    }
 }
--- a/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java	Thu May 01 14:21:29 2014 -0700
@@ -29,14 +29,31 @@
 
 import java.util.List;
 import java.util.ArrayList;
-import java.util.Map;
-import java.util.Iterator;
 import java.util.Collections;
 import java.util.Set;
 import java.lang.ref.SoftReference;
 
-public class InterfaceTypeImpl extends ReferenceTypeImpl
-                               implements InterfaceType {
+final public class InterfaceTypeImpl extends InvokableTypeImpl
+                                     implements InterfaceType {
+
+    private static class IResult implements InvocationResult {
+        final private JDWP.InterfaceType.InvokeMethod rslt;
+
+        public IResult(JDWP.InterfaceType.InvokeMethod rslt) {
+            this.rslt = rslt;
+        }
+
+        @Override
+        public ObjectReferenceImpl getException() {
+            return rslt.exception;
+        }
+
+        @Override
+        public ValueImpl getResult() {
+            return rslt.returnValue;
+        }
+
+    }
 
     private SoftReference<List<InterfaceType>> superinterfacesRef = null;
 
@@ -81,102 +98,6 @@
         return implementors;
     }
 
-    @Override
-    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
-        /*
-         * Add methods from
-         * parent types first, so that the methods in this class will
-         * overwrite them in the hash table
-         */
-
-        for (InterfaceType interfaze : superinterfaces()) {
-            if (!seenInterfaces.contains(interfaze)) {
-                ((InterfaceTypeImpl)interfaze).addVisibleMethods(methodMap, seenInterfaces);
-                seenInterfaces.add(interfaze);
-            }
-        }
-
-        addToMethodMap(methodMap, methods());
-    }
-
-    public List<Method> allMethods() {
-        ArrayList<Method> list = new ArrayList<Method>(methods());
-
-        /*
-         * It's more efficient if don't do this
-         * recursively.
-         */
-        for (InterfaceType interfaze : allSuperinterfaces()) {
-            list.addAll(interfaze.methods());
-        }
-
-        return list;
-    }
-
-    List<InterfaceType> allSuperinterfaces() {
-        ArrayList<InterfaceType> list = new ArrayList<InterfaceType>();
-        addSuperinterfaces(list);
-        return list;
-    }
-
-    void addSuperinterfaces(List<InterfaceType> list) {
-        /*
-         * This code is a little strange because it
-         * builds the list with a more suitable order than the
-         * depth-first approach a normal recursive solution would
-         * take. Instead, all direct superinterfaces precede all
-         * indirect ones.
-         */
-
-        /*
-         * Get a list of direct superinterfaces that's not already in the
-         * list being built.
-         */
-        List<InterfaceType> immediate = new ArrayList<InterfaceType>(superinterfaces());
-        Iterator<InterfaceType> iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceType interfaze = iter.next();
-            if (list.contains(interfaze)) {
-                iter.remove();
-            }
-        }
-
-        /*
-         * Add all new direct superinterfaces
-         */
-        list.addAll(immediate);
-
-        /*
-         * Recurse for all new direct superinterfaces.
-         */
-        iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addSuperinterfaces(list);
-        }
-    }
-
-    boolean isAssignableTo(ReferenceType type) {
-
-        // Exact match?
-        if (this.equals(type)) {
-            return true;
-        } else {
-            // Try superinterfaces.
-            for (InterfaceType interfaze : superinterfaces()) {
-                if (((InterfaceTypeImpl)interfaze).isAssignableTo(type)) {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-    }
-
-    List<InterfaceType> inheritedTypes() {
-        return superinterfaces();
-    }
-
     public boolean isInitialized() {
         return isPrepared();
     }
@@ -184,4 +105,39 @@
     public String toString() {
        return "interface " + name() + " (" + loaderString() + ")";
     }
-}
+
+    @Override
+    InvocationResult waitForReply(PacketStream stream) throws JDWPException {
+        return new IResult(JDWP.InterfaceType.InvokeMethod.waitForReply(vm, stream));
+    }
+
+    @Override
+    CommandSender getInvokeMethodSender(final ThreadReferenceImpl thread,
+                                        final MethodImpl method,
+                                        final ValueImpl[] args,
+                                        final int options) {
+        return () ->
+            JDWP.InterfaceType.InvokeMethod.enqueueCommand(vm,
+                                                           InterfaceTypeImpl.this,
+                                                           thread,
+                                                           method.ref(),
+                                                           args,
+                                                           options);
+    }
+
+    @Override
+    ClassType superclass() {
+        return null;
+    }
+
+    @Override
+    List<InterfaceType> interfaces() {
+        return superinterfaces();
+    }
+
+    @Override
+    boolean canInvoke(Method method) {
+        // method must be directly in this interface
+        return this.equals(method.declaringType());
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java	Thu May 01 14:21:29 2014 -0700
@@ -0,0 +1,305 @@
+/*
+ * 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.  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 com.sun.tools.jdi;
+
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A supertype for ReferenceTypes allowing method invocations
+ */
+abstract class InvokableTypeImpl extends ReferenceTypeImpl {
+    /**
+     * The invocation result wrapper
+     * It is necessary because both ClassType and InterfaceType
+     * use their own type to represent the invocation result
+     */
+    static interface InvocationResult {
+        ObjectReferenceImpl getException();
+        ValueImpl getResult();
+    }
+
+    InvokableTypeImpl(VirtualMachine aVm, long aRef) {
+        super(aVm, aRef);
+    }
+
+    /**
+     * Method invocation support.
+     * Shared by ClassType and InterfaceType
+     * @param threadIntf the thread in which to invoke.
+     * @param methodIntf method the {@link Method} to invoke.
+     * @param origArguments the list of {@link Value} arguments bound to the
+     * invoked method. Values from the list are assigned to arguments
+     * in the order they appear in the method signature.
+     * @param options the integer bit flag options.
+     * @return a {@link Value} mirror of the invoked method's return value.
+     * @throws java.lang.IllegalArgumentException if the method is not
+     * a member of this type, if the size of the argument list
+     * does not match the number of declared arguments for the method, or
+     * if the method is not static or is a static initializer.
+     * @throws {@link InvalidTypeException} if any argument in the
+     * argument list is not assignable to the corresponding method argument
+     * type.
+     * @throws ClassNotLoadedException if any argument type has not yet been loaded
+     * through the appropriate class loader.
+     * @throws IncompatibleThreadStateException if the specified thread has not
+     * been suspended by an event.
+     * @throws InvocationException if the method invocation resulted in
+     * an exception in the target VM.
+     * @throws InvalidTypeException If the arguments do not meet this requirement --
+     *         Object arguments must be assignment compatible with the argument
+     *         type.  This implies that the argument type must be
+     *         loaded through the enclosing class's class loader.
+     *         Primitive arguments must be either assignment compatible with the
+     *         argument type or must be convertible to the argument type without loss
+     *         of information. See JLS section 5.2 for more information on assignment
+     *         compatibility.
+     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+     */
+    final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf,
+                                    List<? extends Value> origArguments, int options)
+                                        throws InvalidTypeException,
+                                               ClassNotLoadedException,
+                                               IncompatibleThreadStateException,
+                                               InvocationException {
+        validateMirror(threadIntf);
+        validateMirror(methodIntf);
+        validateMirrorsOrNulls(origArguments);
+        MethodImpl method = (MethodImpl) methodIntf;
+        ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf;
+        validateMethodInvocation(method);
+        List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments);
+        ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
+        InvocationResult ret;
+        try {
+            PacketStream stream = sendInvokeCommand(thread, method, args, options);
+            ret = waitForReply(stream);
+        } catch (JDWPException exc) {
+            if (exc.errorCode() == JDWP.Error.INVALID_THREAD) {
+                throw new IncompatibleThreadStateException();
+            } else {
+                throw exc.toJDIException();
+            }
+        }
+        /*
+         * There is an implict VM-wide suspend at the conclusion
+         * of a normal (non-single-threaded) method invoke
+         */
+        if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) {
+            vm.notifySuspend();
+        }
+        if (ret.getException() != null) {
+            throw new InvocationException(ret.getException());
+        } else {
+            return ret.getResult();
+        }
+    }
+
+    @Override
+    boolean isAssignableTo(ReferenceType type) {
+        ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
+        if (this.equals(type)) {
+            return true;
+        } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
+            return true;
+        } else {
+            List<InterfaceType> interfaces = interfaces();
+            Iterator<InterfaceType> iter = interfaces.iterator();
+            while (iter.hasNext()) {
+                InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
+                if (interfaze.isAssignableTo(type)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    @Override
+    final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
+        /*
+         * Add methods from
+         * parent types first, so that the methods in this class will
+         * overwrite them in the hash table
+         */
+        Iterator<InterfaceType> iter = interfaces().iterator();
+        while (iter.hasNext()) {
+            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
+            if (!seenInterfaces.contains(interfaze)) {
+                interfaze.addVisibleMethods(methodMap, seenInterfaces);
+                seenInterfaces.add(interfaze);
+            }
+        }
+        ClassTypeImpl clazz = (ClassTypeImpl) superclass();
+        if (clazz != null) {
+            clazz.addVisibleMethods(methodMap, seenInterfaces);
+        }
+        addToMethodMap(methodMap, methods());
+    }
+
+    final void addInterfaces(List<InterfaceType> list) {
+        List<InterfaceType> immediate = interfaces();
+        list.addAll(interfaces());
+        Iterator<InterfaceType> iter = immediate.iterator();
+        while (iter.hasNext()) {
+            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
+            interfaze.addInterfaces(list);
+        }
+        ClassTypeImpl superclass = (ClassTypeImpl) superclass();
+        if (superclass != null) {
+            superclass.addInterfaces(list);
+        }
+    }
+
+    /**
+     * Returns all the implemented interfaces recursively
+     * @return A list of all the implemented interfaces (recursively)
+     */
+    final List<InterfaceType> getAllInterfaces() {
+        List<InterfaceType> all = new ArrayList<>();
+        addInterfaces(all);
+        return all;
+    }
+
+    /**
+     * Shared implementation of {@linkplain ClassType#allMethods()} and
+     * {@linkplain InterfaceType#allMethods()}
+     * @return A list of all methods (recursively)
+     */
+    public final List<Method> allMethods() {
+        ArrayList<Method> list = new ArrayList<>(methods());
+        ClassType clazz = superclass();
+        while (clazz != null) {
+            list.addAll(clazz.methods());
+            clazz = clazz.superclass();
+        }
+        /*
+         * Avoid duplicate checking on each method by iterating through
+         * duplicate-free allInterfaces() rather than recursing
+         */
+        for (InterfaceType interfaze : getAllInterfaces()) {
+            list.addAll(interfaze.methods());
+        }
+        return list;
+    }
+
+    @Override
+    final List<ReferenceType> inheritedTypes() {
+        List<ReferenceType> inherited = new ArrayList<>();
+        if (superclass() != null) {
+            inherited.add(0, superclass()); /* insert at front */
+        }
+        for (ReferenceType rt : interfaces()) {
+            inherited.add(rt);
+        }
+        return inherited;
+    }
+
+    private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread,
+                                           final MethodImpl method,
+                                           final ValueImpl[] args,
+                                           final int options) {
+        CommandSender sender = getInvokeMethodSender(thread, method, args, options);
+        PacketStream stream;
+        if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) {
+            stream = thread.sendResumingCommand(sender);
+        } else {
+            stream = vm.sendResumingCommand(sender);
+        }
+        return stream;
+    }
+
+    private void validateMethodInvocation(Method method)
+                                            throws InvalidTypeException,
+                                                   InvocationException {
+        if (!canInvoke(method)) {
+            throw new IllegalArgumentException("Invalid method");
+        }
+        /*
+         * Method must be a static and not a static initializer
+         */
+        if (!method.isStatic()) {
+            throw new IllegalArgumentException("Cannot invoke instance method on a class/interface type");
+        } else if (method.isStaticInitializer()) {
+            throw new IllegalArgumentException("Cannot invoke static initializer");
+        }
+    }
+
+    /**
+     * A subclass will provide specific {@linkplain CommandSender}
+     * @param thread the current invocation thread
+     * @param method the method to invoke
+     * @param args the arguments to pass to the method
+     * @param options the integer bit flag options
+     * @return the specific {@literal CommandSender} instance
+     */
+    abstract CommandSender getInvokeMethodSender(ThreadReferenceImpl thread,
+                                                 MethodImpl method,
+                                                 ValueImpl[] args,
+                                                 int options);
+
+    /**
+     * Waits for the reply to the last sent command
+     * @param stream the stream to listen for the reply on
+     * @return the {@linkplain InvocationResult} instance
+     * @throws JDWPException when something goes wrong in JDWP
+     */
+    abstract InvocationResult waitForReply(PacketStream stream) throws JDWPException;
+
+    /**
+     * Get the {@linkplain ReferenceType} superclass
+     * @return the superclass or null
+     */
+    abstract ClassType superclass();
+
+    /**
+     * Get the implemented/extended interfaces
+     * @return the list of implemented/extended interfaces
+     */
+    abstract List<InterfaceType> interfaces();
+
+    /**
+     * Checks the provided method whether it can be invoked
+     * @param method the method to check
+     * @return {@code TRUE} if the implementation knows how to invoke the method,
+     *         {@code FALSE} otherwise
+     */
+    abstract boolean canInvoke(Method method);
+}
--- a/src/share/classes/com/sun/tools/jdi/MethodImpl.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/tools/jdi/MethodImpl.java	Thu May 01 14:21:29 2014 -0700
@@ -187,6 +187,13 @@
         return isModifierSet(VMModifiers.ABSTRACT);
     }
 
+    public boolean isDefault() {
+        return !isModifierSet(VMModifiers.ABSTRACT) &&
+               !isModifierSet(VMModifiers.STATIC) &&
+               !isModifierSet(VMModifiers.PRIVATE) &&
+               declaringType() instanceof InterfaceType;
+    }
+
     public boolean isSynchronized() {
         return isModifierSet(VMModifiers.SYNCHRONIZED);
     }
--- a/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java	Thu May 01 14:21:29 2014 -0700
@@ -277,7 +277,6 @@
     void validateMethodInvocation(Method method, int options)
                                          throws InvalidTypeException,
                                          InvocationException {
-
         /*
          * Method must be in this object's class, a superclass, or
          * implemented interface
@@ -287,6 +286,19 @@
             throw new IllegalArgumentException("Invalid method");
         }
 
+        if (declType instanceof ClassTypeImpl) {
+            validateClassMethodInvocation(method, options);
+        } else if (declType instanceof InterfaceTypeImpl) {
+            validateIfaceMethodInvocation(method, options);
+        } else {
+            throw new InvalidTypeException();
+        }
+    }
+
+    void validateClassMethodInvocation(Method method, int options)
+                                         throws InvalidTypeException,
+                                         InvocationException {
+
         ClassTypeImpl clazz = invokableReferenceType(method);
 
         /*
@@ -300,9 +312,7 @@
          * For nonvirtual invokes, method must have a body
          */
         if ((options & INVOKE_NONVIRTUAL) != 0) {
-            if (method.declaringType() instanceof InterfaceType) {
-                throw new IllegalArgumentException("Interface method");
-            } else if (method.isAbstract()) {
+            if (method.isAbstract()) {
                 throw new IllegalArgumentException("Abstract method");
             }
         }
@@ -324,7 +334,7 @@
              */
             Method invoker = clazz.concreteMethodByName(method.name(),
                                                         method.signature());
-            //  isAssignableFrom check above guarantees non-null
+            //  invoker is supposed to be non-null under normal circumstances
             invokedClass = (ClassTypeImpl)invoker.declaringType();
         }
         /* The above code is left over from previous versions.
@@ -332,6 +342,17 @@
          */
     }
 
+    void validateIfaceMethodInvocation(Method method, int options)
+                                         throws InvalidTypeException,
+                                         InvocationException {
+        /*
+         * Only default methods allowed for nonvirtual invokes
+         */
+        if (!method.isDefault()) {
+            throw new IllegalArgumentException("Not a default method");
+        }
+    }
+
     PacketStream sendInvokeCommand(final ThreadReferenceImpl thread,
                                    final ClassTypeImpl refType,
                                    final MethodImpl method,
@@ -370,7 +391,10 @@
         ThreadReferenceImpl thread = (ThreadReferenceImpl)threadIntf;
 
         if (method.isStatic()) {
-            if (referenceType() instanceof ClassType) {
+            if (referenceType() instanceof InterfaceType) {
+                InterfaceType type = (InterfaceType)referenceType();
+                return type.invokeMethod(thread, method, origArguments, options);
+            } else if (referenceType() instanceof ClassType) {
                 ClassType type = (ClassType)referenceType();
                 return type.invokeMethod(thread, method, origArguments, options);
             } else {
--- a/src/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java	Thu May 01 14:21:29 2014 -0700
@@ -48,7 +48,7 @@
     private ResourceBundle messages = null;
     private int vmSequenceNumber = 0;
     private static final int majorVersion = 1;
-    private static final int minorVersion = 6;
+    private static final int minorVersion = 8;
 
     private static final Object lock = new Object();
     private static VirtualMachineManagerImpl vmm;
--- a/src/share/classes/java/awt/Container.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/awt/Container.java	Thu May 01 14:21:29 2014 -0700
@@ -263,6 +263,16 @@
                     boolean ignoreEnabled) {
                 return cont.findComponentAt(x, y, ignoreEnabled);
             }
+
+            @Override
+            public void startLWModal(Container cont) {
+                cont.startLWModal();
+            }
+
+            @Override
+            public void stopLWModal(Container cont) {
+                cont.stopLWModal();
+            }
         });
     }
 
--- a/src/share/classes/java/awt/datatransfer/Clipboard.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/awt/datatransfer/Clipboard.java	Thu May 01 14:21:29 2014 -0700
@@ -27,14 +27,13 @@
 
 import java.awt.EventQueue;
 
+import java.util.Objects;
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Arrays;
 
 import java.io.IOException;
 
-import sun.awt.EventListenerAggregate;
-
 /**
  * A class that implements a mechanism to transfer data using
  * cut/copy/paste operations.
@@ -68,7 +67,7 @@
      *
      * @since 1.5
      */
-    private EventListenerAggregate flavorListeners;
+    private Set<FlavorListener> flavorListeners;
 
     /**
      * A set of <code>DataFlavor</code>s that is available on
@@ -131,11 +130,7 @@
         this.contents = contents;
 
         if (oldOwner != null && oldOwner != owner) {
-            EventQueue.invokeLater(new Runnable() {
-                public void run() {
-                    oldOwner.lostOwnership(Clipboard.this, oldContents);
-                }
-            });
+            EventQueue.invokeLater(() -> oldOwner.lostOwnership(Clipboard.this, oldContents));
         }
         fireFlavorsChanged();
     }
@@ -261,10 +256,12 @@
         if (listener == null) {
             return;
         }
+
         if (flavorListeners == null) {
+            flavorListeners = new HashSet<>();
             currentDataFlavors = getAvailableDataFlavorSet();
-            flavorListeners = new EventListenerAggregate(FlavorListener.class);
         }
+
         flavorListeners.add(listener);
     }
 
@@ -306,7 +303,7 @@
      */
     public synchronized FlavorListener[] getFlavorListeners() {
         return flavorListeners == null ? new FlavorListener[0] :
-                (FlavorListener[])flavorListeners.getListenersCopy();
+            flavorListeners.toArray(new FlavorListener[flavorListeners.size()]);
     }
 
     /**
@@ -320,21 +317,15 @@
         if (flavorListeners == null) {
             return;
         }
+
         Set<DataFlavor> prevDataFlavors = currentDataFlavors;
         currentDataFlavors = getAvailableDataFlavorSet();
-        if (prevDataFlavors.equals(currentDataFlavors)) {
+        if (Objects.equals(prevDataFlavors, currentDataFlavors)) {
             return;
         }
-        FlavorListener[] flavorListenerArray =
-                (FlavorListener[])flavorListeners.getListenersInternal();
-        for (int i = 0; i < flavorListenerArray.length; i++) {
-            final FlavorListener listener = flavorListenerArray[i];
-            EventQueue.invokeLater(new Runnable() {
-                public void run() {
-                    listener.flavorsChanged(new FlavorEvent(Clipboard.this));
-                }
-            });
-        }
+        flavorListeners.forEach(listener ->
+                EventQueue.invokeLater(() ->
+                        listener.flavorsChanged(new FlavorEvent(Clipboard.this))));
     }
 
     /**
--- a/src/share/classes/java/awt/datatransfer/DataFlavor.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/awt/datatransfer/DataFlavor.java	Thu May 01 14:21:29 2014 -0700
@@ -25,13 +25,28 @@
 
 package java.awt.datatransfer;
 
-import java.io.*;
-import java.nio.*;
-import java.util.*;
-
 import sun.awt.datatransfer.DataTransferer;
 import sun.reflect.misc.ReflectUtil;
 
+import java.io.ByteArrayInputStream;
+import java.io.CharArrayReader;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.OptionalDataException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Objects;
+
 import static sun.security.util.SecurityConstants.GET_CLASSLOADER_PERMISSION;
 
 /**
@@ -92,7 +107,7 @@
  * As such, asking a {@code Transferable} for either {@code DataFlavor} returns
  * the same results.
  * <p>
- * For more information on the using data transfer with Swing see
+ * For more information on using data transfer with Swing see
  * the <a href="http://docs.oracle.com/javase/tutorial/uiswing/dnd/index.html">
  * How to Use Drag and Drop and Data Transfer</a>,
  * section in <em>Java Tutorial</em>.
@@ -390,7 +405,7 @@
      * If the <code>mimeType</code> is
      * "application/x-java-serialized-object; class=&lt;representation class&gt;",
      * the result is the same as calling
-     * <code>new DataFlavor(Class:forName(&lt;representation class&gt;)</code>.
+     * <code>new DataFlavor(Class.forName(&lt;representation class&gt;)</code>.
      * <p>
      * Otherwise:
      * <pre>
@@ -398,7 +413,7 @@
      *     mimeType            = mimeType
      * </pre>
      * @param mimeType the string used to identify the MIME type for this flavor;
-     *                 if the the <code>mimeType</code> does not specify a
+     *                 if the <code>mimeType</code> does not specify a
      *                 "class=" parameter, or if the class is not successfully
      *                 loaded, then an <code>IllegalArgumentException</code>
      *                 is thrown
@@ -433,7 +448,7 @@
      * If the mimeType is
      * "application/x-java-serialized-object; class=&lt;representation class&gt;",
      * the result is the same as calling
-     * <code>new DataFlavor(Class:forName(&lt;representation class&gt;)</code>.
+     * <code>new DataFlavor(Class.forName(&lt;representation class&gt;)</code>.
      * <p>
      * Otherwise:
      * <pre>
@@ -501,7 +516,7 @@
     * @throws ClassNotFoundException
     * @throws  NullPointerException if <code>mimeType</code> is null
     *
-    * @see tryToLoadClass
+    * @see #tryToLoadClass
     */
     private void initialize(String mimeType, String humanPresentableName, ClassLoader classLoader) throws MimeTypeParseException, ClassNotFoundException {
         if (mimeType == null) {
@@ -986,14 +1001,8 @@
             return true;
         }
 
-        if (representationClass == null) {
-            if (that.getRepresentationClass() != null) {
-                return false;
-            }
-        } else {
-            if (!representationClass.equals(that.getRepresentationClass())) {
-                return false;
-            }
+        if (!Objects.equals(this.getRepresentationClass(), that.getRepresentationClass())) {
+            return false;
         }
 
         if (mimeType == null) {
@@ -1006,34 +1015,22 @@
             }
 
             if ("text".equals(getPrimaryType())) {
-                if (DataTransferer.doesSubtypeSupportCharset(this) &&
-                    representationClass != null &&
-                    !(isRepresentationClassReader() ||
-                        String.class.equals(representationClass) ||
-                        isRepresentationClassCharBuffer() ||
-                        char[].class.equals(representationClass)))
-                {
+                if (DataTransferer.doesSubtypeSupportCharset(this)
+                        && representationClass != null
+                        && !isStandardTextRepresentationClass()) {
                     String thisCharset =
-                        DataTransferer.canonicalName(getParameter("charset"));
+                            DataTransferer.canonicalName(this.getParameter("charset"));
                     String thatCharset =
-                        DataTransferer.canonicalName(that.getParameter("charset"));
-                    if (thisCharset == null) {
-                        if (thatCharset != null) {
-                            return false;
-                        }
-                    } else {
-                        if (!thisCharset.equals(thatCharset)) {
-                            return false;
-                        }
+                            DataTransferer.canonicalName(that.getParameter("charset"));
+                    if (!Objects.equals(thisCharset, thatCharset)) {
+                        return false;
                     }
                 }
 
-                if ("html".equals(getSubType()) &&
-                        this.getParameter("document") != null )
-                {
-                   if (!this.getParameter("document").
-                            equals(that.getParameter("document")))
-                    {
+                if ("html".equals(getSubType())) {
+                    String thisDocument = this.getParameter("document");
+                    String thatDocument = that.getParameter("document");
+                    if (!Objects.equals(thisDocument, thatDocument)) {
                         return false;
                     }
                 }
@@ -1090,18 +1087,21 @@
             // MimeType.match which reports a match if one or both of the
             // subTypes is '*', regardless of the other subType.
 
-            if ("text".equals(primaryType) &&
-                DataTransferer.doesSubtypeSupportCharset(this) &&
-                representationClass != null &&
-                !(isRepresentationClassReader() ||
-                  String.class.equals(representationClass) ||
-                  isRepresentationClassCharBuffer() ||
-                  char[].class.equals(representationClass)))
-            {
-                String charset =
-                    DataTransferer.canonicalName(getParameter("charset"));
-                if (charset != null) {
-                    total += charset.hashCode();
+            if ("text".equals(primaryType)) {
+                if (DataTransferer.doesSubtypeSupportCharset(this)
+                        && representationClass != null
+                        && !isStandardTextRepresentationClass()) {
+                    String charset = DataTransferer.canonicalName(getParameter("charset"));
+                    if (charset != null) {
+                        total += charset.hashCode();
+                    }
+                }
+
+                if ("html".equals(getSubType())) {
+                    String document = this.getParameter("document");
+                    if (document != null) {
+                        total += document.hashCode();
+                    }
                 }
             }
         }
@@ -1177,6 +1177,20 @@
         return mimeType.match(mtype);
     }
 
+    /**
+     * Checks if the representation class is one of the standard text
+     * representation classes.
+     *
+     * @return true if the representation class is one of the standard text
+     *              representation classes, otherwise false
+     */
+    private boolean isStandardTextRepresentationClass() {
+        return isRepresentationClassReader()
+                || String.class.equals(representationClass)
+                || isRepresentationClassCharBuffer()
+                || char[].class.equals(representationClass);
+    }
+
    /**
     * Does the <code>DataFlavor</code> represent a serialized object?
     * @return whether or not a serialized object is represented
--- a/src/share/classes/java/awt/dnd/DragSourceContext.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/awt/dnd/DragSourceContext.java	Thu May 01 14:21:29 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
@@ -472,7 +472,7 @@
      *               <code>ENTER</code>, <code>OVER</code>,
      *               <code>CHANGED</code>
      */
-
+    @SuppressWarnings("fallthrough")
     protected synchronized void updateCurrentCursor(int sourceAct, int targetAct, int status) {
 
         // if the cursor has been previously set then don't do any defaults
@@ -576,9 +576,9 @@
             throw new InvalidObjectException("Null trigger component");
         }
 
-        int DGRActions = newTrigger.getSourceAsDragGestureRecognizer().getSourceActions()
+        int newSourceActions = f.get("sourceActions", 0)
                 & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
-        if (DGRActions == DnDConstants.ACTION_NONE) {
+        if (newSourceActions == DnDConstants.ACTION_NONE) {
             throw new InvalidObjectException("Invalid source actions");
         }
         int triggerActions = newTrigger.getDragAction();
@@ -591,8 +591,7 @@
 
         cursor = (Cursor)f.get("cursor", null);
         useCustomCursor = f.get("useCustomCursor", false);
-        sourceActions = f.get("sourceActions", 0)
-                & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
+        sourceActions = newSourceActions;
 
         transferable = (Transferable)s.readObject();
         listener = (DragSourceListener)s.readObject();
--- a/src/share/classes/java/awt/geom/Line2D.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/awt/geom/Line2D.java	Thu May 01 14:21:29 2014 -0700
@@ -35,7 +35,7 @@
  * default coordinate system called <i>user space</i> in which the y-axis
  * values increase downward and x-axis values increase to the right.  For
  * more information on the user space coordinate system, see the
- * <a href="http://docs.oracle.com/javase/1.3/docs/guide/2d/spec/j2d-intro.fm2.html#61857">
+ * <a href="{@docRoot}/../technotes/guides/2d/spec/j2d-intro.html">
  * Coordinate Systems</a> section of the Java 2D Programmer's Guide.
  * <p>
  * This class is only the abstract superclass for all objects that
--- a/src/share/classes/java/beans/Introspector.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/beans/Introspector.java	Thu May 01 14:21:29 2014 -0700
@@ -848,7 +848,7 @@
     }
 
     private static boolean isAssignable(Class<?> current, Class<?> candidate) {
-        return current == null ? candidate == null : current.isAssignableFrom(candidate);
+        return ((current == null) || (candidate == null)) ? current == candidate : current.isAssignableFrom(candidate);
     }
 
     private PropertyDescriptor mergePropertyWithIndexedProperty(PropertyDescriptor pd, IndexedPropertyDescriptor ipd) {
--- a/src/share/classes/java/nio/package.html	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/nio/package.html	Thu May 01 14:21:29 2014 -0700
@@ -121,7 +121,7 @@
   available.  </p></li>
 
   <li><p> A byte buffer provides access to its content as either a heterogeneous
-  or homogeneous sequence of <a href="ByteBuffer.html#bin">binary data</i></a>
+  or homogeneous sequence of <a href="ByteBuffer.html#bin"><i>binary data</i></a>
   of any non-boolean primitive type, in either big-endian or little-endian <a
   href="ByteOrder.html">byte order</a>.  </p></li>
 
--- a/src/share/classes/java/sql/package.html	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/sql/package.html	Thu May 01 14:21:29 2014 -0700
@@ -323,10 +323,10 @@
 
 <ul>
   <li><a href="http://docs.oracle.com/javase/tutorial/jdbc/basics/index.html">
-          Lesson:JDBC Basics(The Javaxx Tutorials &gt; JDBC(&#0153;) Database Access)</a>
+          Lesson:JDBC Basics(The Javaxx Tutorials &gt; JDBC&trade; Database Access)</a>
 
  <li><a href="http://www.oracle.com/technetwork/java/index-142838.html">
-          <i>JDBC&#0153;API Tutorial and Reference, Third Edition</i></a>
+          <i>JDBC&trade; API Tutorial and Reference, Third Edition</i></a>
 </ul>
 
 </body>
--- a/src/share/classes/java/util/ArrayList.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/ArrayList.java	Thu May 01 14:21:29 2014 -0700
@@ -30,33 +30,33 @@
 import java.util.function.UnaryOperator;
 
 /**
- * Resizable-array implementation of the <tt>List</tt> interface.  Implements
+ * Resizable-array implementation of the {@code List} interface.  Implements
  * all optional list operations, and permits all elements, including
- * <tt>null</tt>.  In addition to implementing the <tt>List</tt> interface,
+ * {@code null}.  In addition to implementing the {@code List} interface,
  * this class provides methods to manipulate the size of the array that is
  * used internally to store the list.  (This class is roughly equivalent to
- * <tt>Vector</tt>, except that it is unsynchronized.)
+ * {@code Vector}, except that it is unsynchronized.)
  *
- * <p>The <tt>size</tt>, <tt>isEmpty</tt>, <tt>get</tt>, <tt>set</tt>,
- * <tt>iterator</tt>, and <tt>listIterator</tt> operations run in constant
- * time.  The <tt>add</tt> operation runs in <i>amortized constant time</i>,
+ * <p>The {@code size}, {@code isEmpty}, {@code get}, {@code set},
+ * {@code iterator}, and {@code listIterator} operations run in constant
+ * time.  The {@code add} operation runs in <i>amortized constant time</i>,
  * that is, adding n elements requires O(n) time.  All of the other operations
  * run in linear time (roughly speaking).  The constant factor is low compared
- * to that for the <tt>LinkedList</tt> implementation.
+ * to that for the {@code LinkedList} implementation.
  *
- * <p>Each <tt>ArrayList</tt> instance has a <i>capacity</i>.  The capacity is
+ * <p>Each {@code ArrayList} instance has a <i>capacity</i>.  The capacity is
  * the size of the array used to store the elements in the list.  It is always
  * at least as large as the list size.  As elements are added to an ArrayList,
  * its capacity grows automatically.  The details of the growth policy are not
  * specified beyond the fact that adding an element has constant amortized
  * time cost.
  *
- * <p>An application can increase the capacity of an <tt>ArrayList</tt> instance
- * before adding a large number of elements using the <tt>ensureCapacity</tt>
+ * <p>An application can increase the capacity of an {@code ArrayList} instance
+ * before adding a large number of elements using the {@code ensureCapacity}
  * operation.  This may reduce the amount of incremental reallocation.
  *
  * <p><strong>Note that this implementation is not synchronized.</strong>
- * If multiple threads access an <tt>ArrayList</tt> instance concurrently,
+ * If multiple threads access an {@code ArrayList} instance concurrently,
  * and at least one of the threads modifies the list structurally, it
  * <i>must</i> be synchronized externally.  (A structural modification is
  * any operation that adds or deletes one or more elements, or explicitly
@@ -70,9 +70,9 @@
  * unsynchronized access to the list:<pre>
  *   List list = Collections.synchronizedList(new ArrayList(...));</pre>
  *
- * <p><a name="fail-fast">
+ * <p id="fail-fast">
  * The iterators returned by this class's {@link #iterator() iterator} and
- * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em>:</a>
+ * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em>:
  * if the list is structurally modified at any time after the iterator is
  * created, in any way except through the iterator's own
  * {@link ListIterator#remove() remove} or
@@ -94,6 +94,8 @@
  * <a href="{@docRoot}/../technotes/guides/collections/index.html">
  * Java Collections Framework</a>.
  *
+ * @param <E> the type of elements in this list
+ *
  * @author  Josh Bloch
  * @author  Neal Gafter
  * @see     Collection
@@ -119,10 +121,17 @@
     private static final Object[] EMPTY_ELEMENTDATA = {};
 
     /**
+     * Shared empty array instance used for default sized empty instances. We
+     * distinguish this from EMPTY_ELEMENTDATA to know how much to inflate when
+     * first element is added.
+     */
+    private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {};
+
+    /**
      * The array buffer into which the elements of the ArrayList are stored.
      * The capacity of the ArrayList is the length of this array buffer. Any
-     * empty ArrayList with elementData == EMPTY_ELEMENTDATA will be expanded to
-     * DEFAULT_CAPACITY when the first element is added.
+     * empty ArrayList with elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA
+     * will be expanded to DEFAULT_CAPACITY when the first element is added.
      */
     transient Object[] elementData; // non-private to simplify nested class access
 
@@ -141,19 +150,21 @@
      *         is negative
      */
     public ArrayList(int initialCapacity) {
-        super();
-        if (initialCapacity < 0)
+        if (initialCapacity > 0) {
+            this.elementData = new Object[initialCapacity];
+        } else if (initialCapacity == 0) {
+            this.elementData = EMPTY_ELEMENTDATA;
+        } else {
             throw new IllegalArgumentException("Illegal Capacity: "+
                                                initialCapacity);
-        this.elementData = new Object[initialCapacity];
+        }
     }
 
     /**
      * Constructs an empty list with an initial capacity of ten.
      */
     public ArrayList() {
-        super();
-        this.elementData = EMPTY_ELEMENTDATA;
+        this.elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA;
     }
 
     /**
@@ -166,37 +177,43 @@
      */
     public ArrayList(Collection<? extends E> c) {
         elementData = c.toArray();
-        size = elementData.length;
-        // c.toArray might (incorrectly) not return Object[] (see 6260652)
-        if (elementData.getClass() != Object[].class)
-            elementData = Arrays.copyOf(elementData, size, Object[].class);
+        if ((size = elementData.length) != 0) {
+            // c.toArray might (incorrectly) not return Object[] (see 6260652)
+            if (elementData.getClass() != Object[].class)
+                elementData = Arrays.copyOf(elementData, size, Object[].class);
+        } else {
+            // replace with empty array.
+            this.elementData = EMPTY_ELEMENTDATA;
+        }
     }
 
     /**
-     * Trims the capacity of this <tt>ArrayList</tt> instance to be the
+     * Trims the capacity of this {@code ArrayList} instance to be the
      * list's current size.  An application can use this operation to minimize
-     * the storage of an <tt>ArrayList</tt> instance.
+     * the storage of an {@code ArrayList} instance.
      */
     public void trimToSize() {
         modCount++;
         if (size < elementData.length) {
-            elementData = Arrays.copyOf(elementData, size);
+            elementData = (size == 0)
+              ? EMPTY_ELEMENTDATA
+              : Arrays.copyOf(elementData, size);
         }
     }
 
     /**
-     * Increases the capacity of this <tt>ArrayList</tt> instance, if
+     * Increases the capacity of this {@code ArrayList} instance, if
      * necessary, to ensure that it can hold at least the number of elements
      * specified by the minimum capacity argument.
      *
      * @param   minCapacity   the desired minimum capacity
      */
     public void ensureCapacity(int minCapacity) {
-        int minExpand = (elementData != EMPTY_ELEMENTDATA)
-            // any size if real element table
+        int minExpand = (elementData != DEFAULTCAPACITY_EMPTY_ELEMENTDATA)
+            // any size if not default element table
             ? 0
-            // larger than default for empty table. It's already supposed to be
-            // at default size.
+            // larger than default for default empty table. It's already
+            // supposed to be at default size.
             : DEFAULT_CAPACITY;
 
         if (minCapacity > minExpand) {
@@ -205,7 +222,7 @@
     }
 
     private void ensureCapacityInternal(int minCapacity) {
-        if (elementData == EMPTY_ELEMENTDATA) {
+        if (elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA) {
             minCapacity = Math.max(DEFAULT_CAPACITY, minCapacity);
         }
 
@@ -264,22 +281,22 @@
     }
 
     /**
-     * Returns <tt>true</tt> if this list contains no elements.
+     * Returns {@code true} if this list contains no elements.
      *
-     * @return <tt>true</tt> if this list contains no elements
+     * @return {@code true} if this list contains no elements
      */
     public boolean isEmpty() {
         return size == 0;
     }
 
     /**
-     * Returns <tt>true</tt> if this list contains the specified element.
-     * More formally, returns <tt>true</tt> if and only if this list contains
-     * at least one element <tt>e</tt> such that
+     * Returns {@code true} if this list contains the specified element.
+     * More formally, returns {@code true} if and only if this list contains
+     * at least one element {@code e} such that
      * <tt>(o==null&nbsp;?&nbsp;e==null&nbsp;:&nbsp;o.equals(e))</tt>.
      *
      * @param o element whose presence in this list is to be tested
-     * @return <tt>true</tt> if this list contains the specified element
+     * @return {@code true} if this list contains the specified element
      */
     public boolean contains(Object o) {
         return indexOf(o) >= 0;
@@ -288,7 +305,7 @@
     /**
      * Returns the index of the first occurrence of the specified element
      * in this list, or -1 if this list does not contain the element.
-     * More formally, returns the lowest index <tt>i</tt> such that
+     * More formally, returns the lowest index {@code i} such that
      * <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o.equals(get(i)))</tt>,
      * or -1 if there is no such index.
      */
@@ -308,7 +325,7 @@
     /**
      * Returns the index of the last occurrence of the specified element
      * in this list, or -1 if this list does not contain the element.
-     * More formally, returns the highest index <tt>i</tt> such that
+     * More formally, returns the highest index {@code i} such that
      * <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o.equals(get(i)))</tt>,
      * or -1 if there is no such index.
      */
@@ -326,10 +343,10 @@
     }
 
     /**
-     * Returns a shallow copy of this <tt>ArrayList</tt> instance.  (The
+     * Returns a shallow copy of this {@code ArrayList} instance.  (The
      * elements themselves are not copied.)
      *
-     * @return a clone of this <tt>ArrayList</tt> instance
+     * @return a clone of this {@code ArrayList} instance
      */
     public Object clone() {
         try {
@@ -372,7 +389,7 @@
      * <p>If the list fits in the specified array with room to spare
      * (i.e., the array has more elements than the list), the element in
      * the array immediately following the end of the collection is set to
-     * <tt>null</tt>.  (This is useful in determining the length of the
+     * {@code null}.  (This is useful in determining the length of the
      * list <i>only</i> if the caller knows that the list does not contain
      * any null elements.)
      *
@@ -437,7 +454,7 @@
      * Appends the specified element to the end of this list.
      *
      * @param e element to be appended to this list
-     * @return <tt>true</tt> (as specified by {@link Collection#add})
+     * @return {@code true} (as specified by {@link Collection#add})
      */
     public boolean add(E e) {
         ensureCapacityInternal(size + 1);  // Increments modCount!!
@@ -492,14 +509,14 @@
      * Removes the first occurrence of the specified element from this list,
      * if it is present.  If the list does not contain the element, it is
      * unchanged.  More formally, removes the element with the lowest index
-     * <tt>i</tt> such that
+     * {@code i} such that
      * <tt>(o==null&nbsp;?&nbsp;get(i)==null&nbsp;:&nbsp;o.equals(get(i)))</tt>
-     * (if such an element exists).  Returns <tt>true</tt> if this list
+     * (if such an element exists).  Returns {@code true} if this list
      * contained the specified element (or equivalently, if this list
      * changed as a result of the call).
      *
      * @param o element to be removed from this list, if present
-     * @return <tt>true</tt> if this list contained the specified element
+     * @return {@code true} if this list contained the specified element
      */
     public boolean remove(Object o) {
         if (o == null) {
@@ -555,7 +572,7 @@
      * list is nonempty.)
      *
      * @param c collection containing elements to be added to this list
-     * @return <tt>true</tt> if this list changed as a result of the call
+     * @return {@code true} if this list changed as a result of the call
      * @throws NullPointerException if the specified collection is null
      */
     public boolean addAll(Collection<? extends E> c) {
@@ -578,7 +595,7 @@
      * @param index index at which to insert the first element from the
      *              specified collection
      * @param c collection containing elements to be added to this list
-     * @return <tt>true</tt> if this list changed as a result of the call
+     * @return {@code true} if this list changed as a result of the call
      * @throws IndexOutOfBoundsException {@inheritDoc}
      * @throws NullPointerException if the specified collection is null
      */
@@ -736,12 +753,12 @@
     }
 
     /**
-     * Save the state of the <tt>ArrayList</tt> instance to a stream (that
+     * Save the state of the {@code ArrayList} instance to a stream (that
      * is, serialize it).
      *
-     * @serialData The length of the array backing the <tt>ArrayList</tt>
+     * @serialData The length of the array backing the {@code ArrayList}
      *             instance is emitted (int), followed by all of its elements
-     *             (each an <tt>Object</tt>) in the proper order.
+     *             (each an {@code Object}) in the proper order.
      */
     private void writeObject(java.io.ObjectOutputStream s)
         throws java.io.IOException{
@@ -763,7 +780,7 @@
     }
 
     /**
-     * Reconstitute the <tt>ArrayList</tt> instance from a stream (that is,
+     * Reconstitute the {@code ArrayList} instance from a stream (that is,
      * deserialize it).
      */
     private void readObject(java.io.ObjectInputStream s)
--- a/src/share/classes/java/util/Arrays.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/Arrays.java	Thu May 01 14:21:29 2014 -0700
@@ -2561,7 +2561,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2590,7 +2590,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2619,7 +2619,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2648,7 +2648,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2677,7 +2677,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2706,7 +2706,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2735,7 +2735,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * Two doubles <tt>d1</tt> and <tt>d2</tt> are considered equal if:
      * <pre>    <tt>new Double(d1).equals(new Double(d2))</tt></pre>
@@ -2770,7 +2770,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * Two floats <tt>f1</tt> and <tt>f2</tt> are considered equal if:
      * <pre>    <tt>new Float(f1).equals(new Float(f2))</tt></pre>
@@ -2807,7 +2807,7 @@
      * and <tt>e2</tt> are considered <i>equal</i> if <tt>(e1==null ? e2==null
      * : e1.equals(e2))</tt>.  In other words, the two arrays are equal if
      * they contain the same elements in the same order.  Also, two array
-     * references are considered equal if both are <tt>null</tt>.<p>
+     * references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
--- a/src/share/classes/java/util/Locale.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/Locale.java	Thu May 01 14:21:29 2014 -0700
@@ -951,7 +951,6 @@
      * functionality, this method should only be used if the caller is
      * prepared to reinitialize locale-sensitive code running within the
      * same Java Virtual Machine.
-     * <p>
      *
      * @param category - the specified category to set the default locale
      * @param newLocale - the new default locale
--- a/src/share/classes/java/util/Properties.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/Properties.java	Thu May 01 14:21:29 2014 -0700
@@ -754,7 +754,6 @@
      * <p>
      * After the entries have been written, the output stream is flushed.
      * The output stream remains open after this method returns.
-     * <p>
      *
      * @param   writer      an output character stream writer.
      * @param   comments   a description of the property list.
@@ -802,7 +801,7 @@
      * <p>
      * After the entries have been written, the output stream is flushed.
      * The output stream remains open after this method returns.
-     * <p>
+     *
      * @param   out      an output stream.
      * @param   comments   a description of the property list.
      * @exception  IOException if writing this property list to the specified
--- a/src/share/classes/java/util/PropertyPermission.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/PropertyPermission.java	Thu May 01 14:21:29 2014 -0700
@@ -193,7 +193,7 @@
     /**
      * Checks two PropertyPermission objects for equality. Checks that <i>obj</i> is
      * a PropertyPermission, and has the same name and actions as this object.
-     * <P>
+     *
      * @param obj the object we are testing for equality with this object.
      * @return true if obj is a PropertyPermission, and has the same name and
      * actions as this PropertyPermission object.
@@ -369,7 +369,6 @@
     /**
      * Returns a new PermissionCollection object for storing
      * PropertyPermission objects.
-     * <p>
      *
      * @return a new PermissionCollection object suitable for storing
      * PropertyPermissions.
--- a/src/share/classes/java/util/Vector.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/Vector.java	Thu May 01 14:21:29 2014 -0700
@@ -45,9 +45,9 @@
  * capacity of a vector before inserting a large number of
  * components; this reduces the amount of incremental reallocation.
  *
- * <p><a name="fail-fast">
+ * <p id="fail-fast">
  * The iterators returned by this class's {@link #iterator() iterator} and
- * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em></a>:
+ * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em>:
  * if the vector is structurally modified at any time after the iterator is
  * created, in any way except through the iterator's own
  * {@link ListIterator#remove() remove} or
--- a/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Thu May 01 14:21:29 2014 -0700
@@ -80,7 +80,6 @@
  * {@link ReadLock#tryLock()} and {@link WriteLock#tryLock()} methods
  * do not honor this fair setting and will immediately acquire the lock
  * if it is possible, regardless of waiting threads.)
- * <p>
  * </dl>
  *
  * <li><b>Reentrancy</b>
--- a/src/share/classes/java/util/jar/Pack200.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/jar/Pack200.java	Thu May 01 14:21:29 2014 -0700
@@ -224,7 +224,7 @@
      * Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
      * constructor or method in this class will cause a {@link NullPointerException}
      * to be thrown.
-     * <p>
+     *
      * @since 1.5
      */
     public interface Packer {
--- a/src/share/classes/java/util/jar/package.html	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/jar/package.html	Thu May 01 14:21:29 2014 -0700
@@ -43,8 +43,7 @@
       file format. See 
       <a href="../zip/package-summary.html#package_description">java.util.zip
       package description.</a> <p>
-      In JAR files, all file names must be encoded in the UTF-8 encoding. 
-<p>
+      In JAR files, all file names must be encoded in the UTF-8 encoding.
   <li><a href="../../../../technotes/guides/jar/jar.html">
       Manifest and Signature Specification</a> - The manifest format specification.
 </ul>
--- a/src/share/classes/java/util/logging/ConsoleHandler.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/ConsoleHandler.java	Thu May 01 14:21:29 2014 -0700
@@ -62,7 +62,7 @@
  * <li>   com.foo.MyHandler.level=INFO </li>
  * <li>   com.foo.MyHandler.formatter=java.util.logging.SimpleFormatter </li>
  * </ul>
- * <p>
+ *
  * @since 1.4
  */
 public class ConsoleHandler extends StreamHandler {
@@ -86,7 +86,7 @@
      * <p>
      * The logging request was made initially to a <tt>Logger</tt> object,
      * which initialized the <tt>LogRecord</tt> and forwarded it here.
-     * <p>
+     *
      * @param  record  description of the log event. A null record is
      *                 silently ignored and is not published
      */
--- a/src/share/classes/java/util/logging/FileHandler.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/FileHandler.java	Thu May 01 14:21:29 2014 -0700
@@ -243,7 +243,7 @@
     /**
      * Construct a default <tt>FileHandler</tt>.  This will be configured
      * entirely from <tt>LogManager</tt> properties (or their default values).
-     * <p>
+     *
      * @exception  IOException if there are IO problems opening the files.
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have <tt>LoggingPermission("control"))</tt>.
--- a/src/share/classes/java/util/logging/Formatter.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/Formatter.java	Thu May 01 14:21:29 2014 -0700
@@ -105,7 +105,6 @@
      *     java.text.MessageFormat  is used to format the string.
      * <li>Otherwise no formatting is performed.
      * </ul>
-     * <p>
      *
      * @param  record  the log record containing the raw message
      * @return   a localized and formatted message
--- a/src/share/classes/java/util/logging/Handler.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/Handler.java	Thu May 01 14:21:29 2014 -0700
@@ -158,7 +158,7 @@
      * <p>
      * Some <tt>Handlers</tt> may not use <tt>Formatters</tt>, in
      * which case the <tt>Formatter</tt> will be remembered, but not used.
-     * <p>
+     *
      * @param newFormatter the <tt>Formatter</tt> to use (may not be null)
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have <tt>LoggingPermission("control")</tt>.
@@ -329,7 +329,7 @@
      * may make other <tt>Handler</tt> specific checks that might prevent a
      * handler from logging the <tt>LogRecord</tt>. It will return false if
      * the <tt>LogRecord</tt> is null.
-     * <p>
+     *
      * @param record  a <tt>LogRecord</tt>
      * @return true if the <tt>LogRecord</tt> would be logged.
      *
--- a/src/share/classes/java/util/logging/Level.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/Level.java	Thu May 01 14:21:29 2014 -0700
@@ -195,7 +195,7 @@
     /**
      * Create a named Level with a given integer value and a
      * given localization resource name.
-     * <p>
+     *
      * @param name  the name of the Level, for example "SEVERE".
      * @param value an integer value for the level.
      * @param resourceBundleName name of a resource bundle to use in
--- a/src/share/classes/java/util/logging/LogManager.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/LogManager.java	Thu May 01 14:21:29 2014 -0700
@@ -1130,7 +1130,7 @@
      * is no strong reference to the Logger. The caller of this method
      * must check the return value for null in order to properly handle
      * the case where the Logger has been garbage collected.
-     * <p>
+     *
      * @param name name of the logger
      * @return  matching logger or null if none is found
      */
@@ -1151,7 +1151,7 @@
      * return value from {@code LogManager.getLogger()} for null to properly
      * handle the case where the Logger has been garbage collected in the
      * time since its name was returned by this method.
-     * <p>
+     *
      * @return  enumeration of logger name strings
      */
     public Enumeration<String> getLoggerNames() {
--- a/src/share/classes/java/util/logging/Logger.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/Logger.java	Thu May 01 14:21:29 2014 -0700
@@ -338,7 +338,7 @@
      * suitable per-Logger granularity. Developers also need to keep a
      * strong reference to their Logger objects to prevent them from
      * being garbage collected.
-     * <p>
+     *
      * @deprecated Initialization of this field is prone to deadlocks.
      * The field must be initialized by the Logger class initialization
      * which may cause deadlocks with the LogManager class initialization.
@@ -526,7 +526,7 @@
      * name is used.  If the named Logger already exists and has
      * a different resource bundle name then an IllegalArgumentException
      * is thrown.
-     * <p>
+     *
      * @param   name    A name for the logger.  This should
      *                          be a dot-separated name and should normally
      *                          be based on the package name or class name
@@ -595,7 +595,6 @@
      * from the root logger. Changing its parent via the
      * {@link #setParent(java.util.logging.Logger) setParent} method
      * will still require the security permission specified by that method.
-     * <p>
      *
      * @return a newly created private Logger
      */
@@ -621,7 +620,7 @@
      * from the root logger.  Changing its parent via the
      * {@link #setParent(java.util.logging.Logger) setParent} method
      * will still require the security permission specified by that method.
-     * <p>
+     *
      * @param   resourceBundleName  name of ResourceBundle to be used for localizing
      *                          messages for this logger.
      *          May be null if none of the messages require localization.
@@ -776,7 +775,7 @@
      * If the logger is currently enabled for the given message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msg     The string message (or a key in the message catalog)
      */
@@ -796,7 +795,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
@@ -815,7 +814,7 @@
      * If the logger is currently enabled for the given message
      * level then a corresponding LogRecord is created and forwarded
      * to all the registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msg     The string message (or a key in the message catalog)
      * @param   param1  parameter to the message
@@ -836,7 +835,7 @@
      * If the logger is currently enabled for the given message
      * level then a corresponding LogRecord is created and forwarded
      * to all the registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msg     The string message (or a key in the message catalog)
      * @param   params  array of parameters to the message
@@ -861,7 +860,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msg     The string message (or a key in the message catalog)
      * @param   thrown  Throwable associated with log message.
@@ -887,7 +886,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   thrown  Throwable associated with log message.
      * @param   msgSupplier   A function, which when called, produces the
@@ -914,7 +913,7 @@
      * If the logger is currently enabled for the given message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -938,7 +937,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -964,7 +963,7 @@
      * If the logger is currently enabled for the given message
      * level then a corresponding LogRecord is created and forwarded
      * to all the registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -991,7 +990,7 @@
      * If the logger is currently enabled for the given message
      * level then a corresponding LogRecord is created and forwarded
      * to all the registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1022,7 +1021,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1054,7 +1053,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1113,7 +1112,7 @@
      * The msg string is localized using the named resource bundle.  If the
      * resource bundle name is null, or an empty String or invalid
      * then the msg string is not localized.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1147,7 +1146,7 @@
      * The msg string is localized using the named resource bundle.  If the
      * resource bundle name is null, or an empty String or invalid
      * then the msg string is not localized.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1184,7 +1183,7 @@
      * The msg string is localized using the named resource bundle.  If the
      * resource bundle name is null, or an empty String or invalid
      * then the msg string is not localized.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1220,7 +1219,7 @@
      * The {@code msg} string is localized using the given resource bundle.
      * If the resource bundle is {@code null}, then the {@code msg} string is not
      * localized.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    Name of the class that issued the logging request
      * @param   sourceMethod   Name of the method that issued the logging request
@@ -1260,7 +1259,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1301,7 +1300,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    Name of the class that issued the logging request
      * @param   sourceMethod   Name of the method that issued the logging request
@@ -1333,7 +1332,7 @@
      * This is a convenience method that can be used to log entry
      * to a method.  A LogRecord with message "ENTRY", log level
      * FINER, and the given sourceMethod and sourceClass is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that is being entered
      */
@@ -1348,7 +1347,7 @@
      * to a method.  A LogRecord with message "ENTRY {0}", log level
      * FINER, and the given sourceMethod, sourceClass, and parameter
      * is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that is being entered
      * @param   param1         parameter to the method being entered
@@ -1365,7 +1364,7 @@
      * format {N} indicator for each entry in the parameter array),
      * log level FINER, and the given sourceMethod, sourceClass, and
      * parameters is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that is being entered
      * @param   params         array of parameters to the method being entered
@@ -1389,7 +1388,7 @@
      * This is a convenience method that can be used to log returning
      * from a method.  A LogRecord with message "RETURN", log level
      * FINER, and the given sourceMethod and sourceClass is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of the method
      */
@@ -1405,7 +1404,7 @@
      * from a method.  A LogRecord with message "RETURN {0}", log level
      * FINER, and the gives sourceMethod, sourceClass, and result
      * object is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of the method
      * @param   result  Object that is being returned
@@ -1430,7 +1429,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod  name of the method.
      * @param   thrown  The Throwable that is being thrown.
@@ -1456,7 +1455,7 @@
      * If the logger is currently enabled for the SEVERE message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void severe(String msg) {
@@ -1469,7 +1468,7 @@
      * If the logger is currently enabled for the WARNING message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void warning(String msg) {
@@ -1482,7 +1481,7 @@
      * If the logger is currently enabled for the INFO message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void info(String msg) {
@@ -1495,7 +1494,7 @@
      * If the logger is currently enabled for the CONFIG message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void config(String msg) {
@@ -1508,7 +1507,7 @@
      * If the logger is currently enabled for the FINE message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void fine(String msg) {
@@ -1521,7 +1520,7 @@
      * If the logger is currently enabled for the FINER message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void finer(String msg) {
@@ -1534,7 +1533,7 @@
      * If the logger is currently enabled for the FINEST message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void finest(String msg) {
@@ -1554,7 +1553,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1571,7 +1570,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1588,7 +1587,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1605,7 +1604,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1622,7 +1621,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1639,7 +1638,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1656,7 +1655,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1769,7 +1768,7 @@
 
     /**
      * Get the Handlers associated with this logger.
-     * <p>
+     *
      * @return  an array of all registered Handlers
      */
     public Handler[] getHandlers() {
@@ -2015,7 +2014,7 @@
      * the LogManager to update a Logger when the namespace changes.
      * <p>
      * It should not be called from application code.
-     * <p>
+     *
      * @param  parent   the new parent logger
      * @throws  SecurityException  if a security manager exists and if
      *          the caller does not have LoggingPermission("control").
--- a/src/share/classes/java/util/logging/MemoryHandler.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/MemoryHandler.java	Thu May 01 14:21:29 2014 -0700
@@ -82,7 +82,7 @@
  * <li>   com.foo.MyHandler.level=INFO </li>
  * <li>   com.foo.MyHandler.formatter=java.util.logging.SimpleFormatter </li>
  * </ul>
- * <p>
+ *
  * @since 1.4
  */
 
@@ -267,7 +267,7 @@
      * whether it satisfies any <tt>Filter</tt>.  However it does <b>not</b>
      * check whether the <tt>LogRecord</tt> would result in a "push" of the
      * buffer contents. It will return false if the <tt>LogRecord</tt> is null.
-     * <p>
+     *
      * @param record  a <tt>LogRecord</tt>
      * @return true if the <tt>LogRecord</tt> would be logged.
      *
--- a/src/share/classes/java/util/logging/StreamHandler.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/StreamHandler.java	Thu May 01 14:21:29 2014 -0700
@@ -71,7 +71,7 @@
  * <li>   com.foo.MyHandler.level=INFO </li>
  * <li>   com.foo.MyHandler.formatter=java.util.logging.SimpleFormatter </li>
  * </ul>
- * <p>
+ *
  * @since 1.4
  */
 
@@ -91,7 +91,7 @@
     /**
      * Create a <tt>StreamHandler</tt> with a given <tt>Formatter</tt>
      * and output stream.
-     * <p>
+     *
      * @param out         the target output stream
      * @param formatter   Formatter to be used to format output
      */
@@ -224,7 +224,7 @@
      * This method checks if the <tt>LogRecord</tt> has an appropriate level and
      * whether it satisfies any <tt>Filter</tt>.  It will also return false if
      * no output stream has been assigned yet or the LogRecord is null.
-     * <p>
+     *
      * @param record  a <tt>LogRecord</tt>
      * @return true if the <tt>LogRecord</tt> would be logged.
      *
--- a/src/share/classes/java/util/logging/package.html	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/logging/package.html	Thu May 01 14:21:29 2014 -0700
@@ -54,18 +54,18 @@
          When a problem occurs in the field, it may be necessary to return the captured logging
          information to the original development team for diagnosis. This logging
          information may be extremely detailed and fairly inscrutable. Such information might include
-         detailed tracing on the internal execution of particular subsystems.           
+         detailed tracing on the internal execution of particular subsystems.
 
    <LI> <I>Problem diagnosis by developers</I>. The Logging APIs may also be
            used to help debug an application under development. This may 
            include logging information generated by the target application
-           as well as logging information generated by lower-level libraries.          
+           as well as logging information generated by lower-level libraries.
            Note however that while this use is perfectly reasonable,
            the logging APIs are not intended to replace the normal debugging 
            and profiling tools that may already exist in the development environment. 
 </OL>
 
-</P>
+<p>
 The key elements of this package include:
 <UL>
    <LI> <I>Logger</I>: The main entity on which applications make 
@@ -111,7 +111,7 @@
 log, logp, logrb, severe, throwing, and warning methods)  
 will accept null values 
 for all arguments except for the initial Level argument (if any).
-<p>
+
 <H2>Related Documentation</H2>
 <P>
 For an overview of control flow, 
--- a/src/share/classes/java/util/prefs/PreferenceChangeListener.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/prefs/PreferenceChangeListener.java	Thu May 01 14:21:29 2014 -0700
@@ -39,7 +39,7 @@
     /**
      * This method gets called when a preference is added, removed or when
      * its value is changed.
-     * <p>
+     *
      * @param evt A PreferenceChangeEvent object describing the event source
      *          and the preference that has changed.
      */
--- a/src/share/classes/java/util/regex/Matcher.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/regex/Matcher.java	Thu May 01 14:21:29 2014 -0700
@@ -830,7 +830,7 @@
      *
      * <p> The replacement string may contain references to subsequences
      * captured during the previous match: Each occurrence of
-     * <tt>$</tt><i>g</i><tt></tt> will be replaced by the result of
+     * <tt>$</tt><i>g</i> will be replaced by the result of
      * evaluating {@link #group(int) group}<tt>(</tt><i>g</i><tt>)</tt>.
      * The first number after the <tt>$</tt> is always treated as part of
      * the group reference. Subsequent numbers are incorporated into g if
--- a/src/share/classes/java/util/stream/Collectors.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/stream/Collectors.java	Thu May 01 14:21:29 2014 -0700
@@ -120,17 +120,63 @@
     private Collectors() { }
 
     /**
-     * Returns a merge function, suitable for use in
-     * {@link Map#merge(Object, Object, BiFunction) Map.merge()} or
-     * {@link #toMap(Function, Function, BinaryOperator) toMap()}, which always
-     * throws {@code IllegalStateException}.  This can be used to enforce the
-     * assumption that the elements being collected are distinct.
+     * Construct an {@code IllegalStateException} with appropriate message.
      *
-     * @param <T> the type of input arguments to the merge function
-     * @return a merge function which always throw {@code IllegalStateException}
+     * @param k the duplicate key
+     * @param u 1st value to be accumulated/merged
+     * @param v 2nd value to be accumulated/merged
      */
-    private static <T> BinaryOperator<T> throwingMerger() {
-        return (u,v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); };
+    private static IllegalStateException duplicateKeyException(
+            Object k, Object u, Object v) {
+        return new IllegalStateException(String.format(
+            "Duplicate key %s (attempted merging values %s and %s)",
+            k, u, v));
+    }
+
+    /**
+     * {@code BinaryOperator<Map>} that merges the contents of its right
+     * argument into its left argument, throwing {@code IllegalStateException}
+     * if duplicate keys are encountered.
+     *
+     * @param <K> type of the map keys
+     * @param <V> type of the map values
+     * @param <M> type of the map
+     * @return a merge function for two maps
+     */
+    private static <K, V, M extends Map<K,V>>
+    BinaryOperator<M> uniqKeysMapMerger() {
+        return (m1, m2) -> {
+            for (Map.Entry<K,V> e : m2.entrySet()) {
+                K k = e.getKey();
+                V v = Objects.requireNonNull(e.getValue());
+                V u = m1.putIfAbsent(k, v);
+                if (u != null) throw duplicateKeyException(k, u, v);
+            }
+            return m1;
+        };
+    }
+
+    /**
+     * {@code BiConsumer<Map, T>} that accumulates (key, value) pairs
+     * extracted from elements into the map, throwing {@code IllegalStateException}
+     * if duplicate keys are encountered.
+     *
+     * @param keyMapper a function that maps an element into a key
+     * @param valueMapper a function that maps an element into a value
+     * @param <T> type of elements
+     * @param <K> type of map keys
+     * @param <V> type of map values
+     * @return an accumulating consumer
+     */
+    private static <T, K, V>
+    BiConsumer<Map<K, V>, T> uniqKeysMapAccumulator(Function<? super T, ? extends K> keyMapper,
+                                                    Function<? super T, ? extends V> valueMapper) {
+        return (map, element) -> {
+            K k = keyMapper.apply(element);
+            V v = Objects.requireNonNull(valueMapper.apply(element));
+            V u = map.putIfAbsent(k, v);
+            if (u != null) throw duplicateKeyException(k, u, v);
+        };
     }
 
     @SuppressWarnings("unchecked")
@@ -1209,7 +1255,10 @@
     public static <T, K, U>
     Collector<T, ?, Map<K,U>> toMap(Function<? super T, ? extends K> keyMapper,
                                     Function<? super T, ? extends U> valueMapper) {
-        return toMap(keyMapper, valueMapper, throwingMerger(), HashMap::new);
+        return new CollectorImpl<>(HashMap::new,
+                                   uniqKeysMapAccumulator(keyMapper, valueMapper),
+                                   uniqKeysMapMerger(),
+                                   CH_ID);
     }
 
     /**
@@ -1372,7 +1421,10 @@
     public static <T, K, U>
     Collector<T, ?, ConcurrentMap<K,U>> toConcurrentMap(Function<? super T, ? extends K> keyMapper,
                                                         Function<? super T, ? extends U> valueMapper) {
-        return toConcurrentMap(keyMapper, valueMapper, throwingMerger(), ConcurrentHashMap::new);
+        return new CollectorImpl<>(ConcurrentHashMap::new,
+                                   uniqKeysMapAccumulator(keyMapper, valueMapper),
+                                   uniqKeysMapMerger(),
+                                   CH_CONCURRENT_ID);
     }
 
     /**
--- a/src/share/classes/java/util/zip/package.html	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/java/util/zip/package.html	Thu May 01 14:21:29 2014 -0700
@@ -39,45 +39,35 @@
 
 <h2>Package Specification</h2>
 
-</a>
 <ul>
   <li><a href="http://www.info-zip.org/doc/appnote-19970311-iz.zip">
       Info-ZIP Application Note 970311
       </a> - a detailed description of the Info-ZIP format upon which
       the <code>java.util.zip</code> classes are based.
-<p>
-  <a name="zip64">
-  <li>An implementation may optionally support the ZIP64(tm) format extensions
-      defined by the 
+  <li><a name="zip64">An implementation may optionally support the ZIP64(tm) format extensions
+      defined by the </a>
       <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
       PKWARE ZIP File Format Specification</a>. The ZIP64(tm) format extensions
       are used to overcome the size limitations of the original ZIP format.
-<p>
-  <a name="lang_encoding">
-  <li>APPENDIX D of <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
+  <li><a name="lang_encoding">APPENDIX D of </a><a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
       PKWARE ZIP File Format Specification</a> - Language Encoding Flag (EFS) to
       encode ZIP entry filename and comment fields using UTF-8.
-<p>
   <li><a href="http://www.ietf.org/rfc/rfc1950.txt">
       ZLIB Compressed Data Format Specification version 3.3</a>
       &nbsp;
       <a href="http://www.ietf.org/rfc/rfc1950.txt.pdf">(pdf)</a>
       (RFC 1950)
-<p>
   <li><a href="http://www.ietf.org/rfc/rfc1951.txt">
       DEFLATE Compressed Data Format Specification version 1.3</a>
       &nbsp;
       <a href="http://www.ietf.org/rfc/rfc1951.txt.pdf">(pdf)</a>
       (RFC 1951)
-<p>
   <li><a href="http://www.ietf.org/rfc/rfc1952.txt">
       GZIP file format specification version 4.3</a>
       &nbsp;
       <a href="http://www.ietf.org/rfc/rfc1952.txt.pdf">(pdf)</a>
       (RFC 1952)
-<p>
   <li>CRC-32 checksum is described in RFC 1952 (above)
-<p>
   <li>Adler-32 checksum is described in RFC 1950 (above)
 </ul>
 
--- a/src/share/classes/javax/sql/PooledConnection.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/PooledConnection.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -83,7 +83,6 @@
  * <code>ConnectionPool</code> method <code>addStatementEventListener</code>.
  *  Thus, when an application closes its  <code>PreparedStatement</code>,
  * the underlying prepared statement is recycled rather than being closed.
- * <P>
  *
  * @since 1.4
  */
@@ -154,10 +153,10 @@
          * wish to be notified when  <code>PreparedStatement</code>s created by the
          * connection are closed or are detected to be invalid may use this method
          * to register a <code>StatementEventListener</code> with this <code>PooledConnection</code> object.
-         * <p>
+         *
          * @param listener      an component which implements the <code>StatementEventListener</code>
          *                                      interface that is to be registered with this <code>PooledConnection</code> object
-         * <p>
+         *
          * @since 1.6
          */
         public void addStatementEventListener(StatementEventListener listener);
@@ -166,11 +165,11 @@
          * Removes the specified <code>StatementEventListener</code> from the list of
          * components that will be notified when the driver detects that a
          * <code>PreparedStatement</code> has been closed or is invalid.
-         * <p>
+         *
          * @param listener      the component which implements the
          *                                      <code>StatementEventListener</code> interface that was previously
          *                                      registered with this <code>PooledConnection</code> object
-         * <p>
+         *
          * @since 1.6
          */
         public void removeStatementEventListener(StatementEventListener listener);
--- a/src/share/classes/javax/sql/StatementEvent.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/StatementEvent.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -37,7 +37,7 @@
  * registered with a <code>PooledConnection</code>. This occurs when the driver determines that a
  * <code>PreparedStatement</code> that is associated with the <code>PooledConnection</code> has been closed or the driver determines
  * is invalid.
- * <p>
+ *
  * @since 1.6
  */
 public class StatementEvent extends EventObject {
@@ -50,11 +50,11 @@
          * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code> and
          * <code>PreparedStatement</code>.  The <code>SQLException</code> contained in the event defaults to
          * null.
-         * <p>
+         *
          * @param con                   The <code>PooledConnection</code> that the closed or invalid
          * <code>PreparedStatement</code>is associated with.
          * @param statement             The <code>PreparedStatement</code> that is being closed or is invalid
-         * <p>
+         *
          * @throws IllegalArgumentException if <code>con</code> is null.
          *
          * @since 1.6
@@ -71,7 +71,7 @@
         /**
          * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code>,
          * <code>PreparedStatement</code> and <code>SQLException</code>
-         * <p>
+         *
          * @param con                   The <code>PooledConnection</code> that the closed or invalid <code>PreparedStatement</code>
          * is associated with.
          * @param statement             The <code>PreparedStatement</code> that is being closed or is invalid
@@ -79,7 +79,7 @@
          *                                              the application
          *
          * @throws IllegalArgumentException if <code>con</code> is null.
-         * <p>
+         *
          * @since 1.6
          */
         public StatementEvent(PooledConnection con,
@@ -94,9 +94,9 @@
 
         /**
          * Returns the <code>PreparedStatement</code> that is being closed or is invalid
-         * <p>
+         *
          * @return      The <code>PreparedStatement</code> that is being closed or is invalid
-         * <p>
+         *
          * @since 1.6
          */
         public PreparedStatement getStatement() {
@@ -106,9 +106,9 @@
 
         /**
          * Returns the <code>SQLException</code> the driver is about to throw
-         * <p>
+         *
          * @return      The <code>SQLException</code> the driver is about to throw
-         * <p>
+         *
          * @since 1.6
          */
         public SQLException getSQLException() {
--- a/src/share/classes/javax/sql/StatementEventListener.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/StatementEventListener.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -52,7 +52,7 @@
  * <p>
  * Methods which allow a component to register a StatementEventListener with a
  * <code>PooledConnection</code> have been added to the <code>PooledConnection</code> interface.
- * <p>
+ *
  * @since 1.6
  */
 public interface StatementEventListener  extends java.util.EventListener{
@@ -72,13 +72,13 @@
          * <code>PreparedStatement</code> is invalid. The driver calls this method
          * just before it throws the <code>SQLException</code>,
          * contained in the given event, to the application.
-         * <p>
-         * @param event         an event object describing the source of the event,
-         *                                      the statement that is invalid and the exception the
-         *                                      driver is about to throw.  The source of the event is
-         *                                      the <code>PooledConnection</code> which the invalid <code>PreparedStatement</code>
-         * is associated with.
-         * <p>
+         *
+         * @param event    an event object describing the source of the event,
+         *                 the statement that is invalid and the exception the
+         *                 driver is about to throw.  The source of the event is
+         *                 the <code>PooledConnection</code> which the invalid <code>PreparedStatement</code>
+         *                 is associated with.
+         *
          * @since 1.6
          */
         void statementErrorOccurred(StatementEvent event);
--- a/src/share/classes/javax/sql/package.html	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/package.html	Thu May 01 14:21:29 2014 -0700
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 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
@@ -36,10 +36,9 @@
 the Java<sup><font size=-2>TM</font></sup> programming language.
 This package supplements the <code>java.sql</code>
 package and, as of the version 1.4 release, is included in the 
-Java Platform, Standard Edition
-(Java SE<sup><font size=-2>TM</sup></font>).
+Java Platform, Standard Edition (Java SE&trade;).
 It remains an essential part of the Java Platform, Enterprise Edition
-(Java EE<sup><font size=-2>TM</sup></font>).
+(Java EE&trade;).
 <P>
 The <code>javax.sql</code> package provides for the following:
 <OL>
@@ -145,7 +144,6 @@
 <code>PreparedStatement</code> is closed or there is an error, the connection 
 pool manager (being a listener)
 gets a notification that includes a <code>StatementEvent</code> object.
-<p>
 
 <H2>Distributed Transactions</H2>
 
@@ -203,14 +201,12 @@
 it rows, or moves its cursor, it also notifies each listener that is registered 
 with it.  The listener reacts by carrying out its implementation of the 
 notification method called on it.
-<P>
   <LI><code>RowSetEvent</code><br>
 As part of its internal notification process, a <code>RowSet</code> object
 creates an instance of <code>RowSetEvent</code> and passes it to the listener.
 The listener can use this <code>RowSetEvent</code> object to find out which rowset
 had the event.
 </UL>
-<P>
 <LI>Metadata 
 <UL>
   <LI><code>RowSetMetaData</code><br>
@@ -226,7 +222,6 @@
 method <code>execute</code>, the <code>RowSet</code> object will contain
 a new set of rows, and its <code>RowSetMetaData</code> object will have been
 internally updated to contain information about the new columns.
-<P>
 </UL>
 <LI>The Reader/Writer Facility<br>
 A <code>RowSet</code> object that implements the <code>RowSetInternal</code>
@@ -248,7 +243,7 @@
 (2) the connection that was passed to it, if any.  A rowset uses the 
 <code>RowSetInternal</code> methods behind the scenes to get access to
 this information.  An application does not normally invoke these methods directly.
-<P>
+
   <LI><code>RowSetReader</code><br>
 A disconnected <code>RowSet</code> object that has implemented the 
 <code>RowSetInternal</code> interface can call on its reader (the 
@@ -269,7 +264,6 @@
 back to the underlying data source.  Implementations may vary widely, but
 generally, a writer will do the following:
 
-<P>
 <UL>
   <LI>Make a connection to the data source 
   <LI>Check to see whether there is a conflict, that is, whether
@@ -291,7 +285,6 @@
 JDBC technology driver that implements the JDBC 4.0 API.
 You must check your driver documentation to be sure that it implements
 the particular features you want to use.
-<P>
 
 <h2>Package Specification</h2>
 
@@ -307,7 +300,7 @@
 
 <ul>
   <li><a href="http://www.oracle.com/technetwork/java/index-142838.html">
-          <i>JDBC&#0153;API Tutorial and Reference, Third Edition</i></a>
+          <i>JDBC&#8482;API Tutorial and Reference, Third Edition</i></a>
 </ul>
 </body>
 </html>
--- a/src/share/classes/javax/sql/rowset/BaseRowSet.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/rowset/BaseRowSet.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -70,7 +70,6 @@
  *  <li>Fields for storing stream instances
  *  <li>Constants for indicating the type of a stream
  *  </ul>
- *  <p>
  * </UL>
  *
  * <h3>2.0 Setting Properties</h3>
@@ -981,7 +980,7 @@
      * the specified concurrency. The default concurrency for any <code>RowSet</code>
      * object (connected or disconnected) is <code>ResultSet.CONCUR_UPDATABLE</code>,
      * but this method may be called at any time to change the concurrency.
-     * <P>
+     *
      * @param concurrency one of the following constants:
      *                    <code>ResultSet.CONCUR_READ_ONLY</code> or
      *                    <code>ResultSet.CONCUR_UPDATABLE</code>
@@ -1419,7 +1418,6 @@
      * form a subset of the actual rows returned by the original query. This is
      * an implementation variance determined by the specific <code>SyncProvider</code>
      * object employed by the disconnected <code>RowSet</code> object.
-     * <P>
      *
      * @param rows the number of rows to fetch; <code>0</code> to let the
      *        driver decide what the best fetch size is; must not be less
@@ -1466,7 +1464,7 @@
      * <P>
      * An application can call the method <code>setConcurrency</code> at any time
      * to change a <code>RowSet</code> object's concurrency.
-     * <p>
+     *
      * @return the concurrency type for this <code>RowSet</code>
      *     object, which must be one of the following:
      *     <code>ResultSet.CONCUR_READ_ONLY</code> or
@@ -1737,7 +1735,7 @@
      * <p>
      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
      * as it is undefined in this class.
-     * <p>
+     *
      * @param parameterIndex the ordinal number of the placeholder parameter
      *        in this <code>RowSet</code> object's command that is to be set.
      *        The first parameter is 1, the second is 2, and so on; must be
@@ -1867,7 +1865,7 @@
      * <P>
      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
      * as it is undefined in this class.
-     * S
+     *
      * @param parameterIndex the ordinal number of the placeholder parameter
      *        in this <code>RowSet</code> object's command that is to be set.
      *        The first parameter is 1, the second is 2, and so on; must be
@@ -1933,7 +1931,7 @@
      * <p>
      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
      * as it is undefined in this class.
-     * <p>
+     *
      * @param parameterIndex the ordinal number of the placeholder parameter
      *        in this <code>RowSet</code> object's command that is to be set.
      *        The first parameter is 1, the second is 2, and so on; must be
@@ -3579,7 +3577,7 @@
    * @exception SQLException if a database access error occurs or
    * this method is called on a closed <code>CallableStatement</code>
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
-     * @since 1.6
+   * @since 1.6
   */
   public void setAsciiStream(String parameterName, java.io.InputStream x)
           throws SQLException{
@@ -3651,7 +3649,7 @@
   * <code>Reader</code> reads the data till end-of-file is reached. The
   * driver does the necessary conversion from Java character format to
   * the national character set in the database.
-
+  *
   * <P><B>Note:</B> This stream object can either be a standard
   * Java stream object or your own subclass that implements the
   * standard interface.
--- a/src/share/classes/javax/sql/rowset/CachedRowSet.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/rowset/CachedRowSet.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -998,7 +998,6 @@
     * available within the internal <code>RowSet</code> tabular structure by
     * virtue of a key already set either on the <code>RowSet</code> object
     * itself or on the underlying SQL data.
-    * <P>
     *
     * @return a <code>Collection</code> object that contains the values in
     * each row in this <code>CachedRowSet</code> object
--- a/src/share/classes/javax/sql/rowset/JdbcRowSet.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/rowset/JdbcRowSet.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -116,7 +116,6 @@
  * <code>CachedRowSet</code>&trade;
  * reference implementation to account for the different
  * requirements of connected and disconnected <code>RowSet</code> objects.
- * <p>
  *
  * @author Jonathan Bruce
  */
--- a/src/share/classes/javax/sql/rowset/package.html	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/rowset/package.html	Thu May 01 14:21:29 2014 -0700
@@ -5,7 +5,7 @@
   <meta http-equiv="Content-Type"
  content="text/html; charset=iso-8859-1">
 <!--
-Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2003, 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
@@ -76,7 +76,7 @@
 technology-enabled driver ("JDBC driver"). In addition, a <code>JdbcRowSet</code>
 object provides a fully updatable and scrollable tabular 
 data structure as defined in the JDBC 3.0 specification.
-<p>
+
 <li><a href="CachedRowSet.html">
 <b><code>CachedRowSet</code>&trade;</b></a>
  - A <tt>CachedRowSet</tt> object is a JavaBeans&trade;
@@ -92,7 +92,7 @@
 Further details on this mechanism are discussed in the <a
 href="spi/package-summary.html"><code>javax.sql.rowset.spi</code></a> package
 specification.
-<p>
+
 <li><a href="WebRowSet.html"><b><code>WebRowSet</code></b></a> - A 
 <code>WebRowSet</code> object is an extension of <tt>CachedRowSet</tt>
 that can read and write a <code>RowSet</code> object in a well formed XML format.
@@ -108,7 +108,7 @@
 Schema is defined and published at
 <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">
 <code>http://java.sun.com/xml/ns/jdbc/webrowset.xsd</code></a>.
-<p>   
+
 <li><a href="FilteredRowSet.html"><b><code>FilteredRowSet</code></b></a> - A
 <tt>FilteredRowSet</tt> object provides filtering functionality in a programmatic
 and extensible way. There are many instances when a <tt>RowSet</tt> <code>object</code>
@@ -124,7 +124,7 @@
 considered as bi-directional. No standard filters are defined;
 however, sufficient mechanics are specified to permit any required filter to be
 implemented.
-<p>
+
 <li><a href="JoinRowSet.html"><b><code>JoinRowSet</code></b></a> - The <tt>JoinRowSet</tt>
 interface  describes a mechanism by which relationships can be established between 
 two or more standard <code>RowSet</code> implementations. Any number of <tt>RowSet</tt>
@@ -146,7 +146,7 @@
 should also consult the <i>Implementer's Guide</i> in the <a
 href="spi/package-summary.html">javax.sql.rowset.spi</a> package for guidelines
 on <a href="spi/SyncProvider.html"><code>SyncProvider</code></a> implementations.
-<p>
+
 <ul>
 <li><b>3.1 Constructor</b>
 <p>
@@ -215,11 +215,10 @@
   in addition to providing a set of constants for stream type designation.<br>
               </td>
             </tr>
-                               
-      </tbody>                    
+      </tbody>
     </table>
     </blockquote>
-<p>
+
 <li><b>3.3 Connected RowSet Requirements</b>
 <p>
 The <code>JdbcRowSet</code> describes a <code>RowSet</code> object that <b>must</b> always
@@ -231,7 +230,6 @@
 or a <code>RowSetWriter</code> object. They can safely rely on the JDBC driver to
 supply their needs by virtue of the presence of an underlying updatable and scrollable
 <code>ResultSet</code> implementation.
-<p>
 
 <li>
 <b>3.4 Disconnected RowSet Requirements</b>
@@ -248,7 +246,7 @@
 synchronization is required. A disconnected <code>RowSet</code> object should 
 therefore ensure that no 
 extraneous references remain on the <code>Connection</code> object.
-<p>
+
 <li><b>3.5 Role of RowSetMetaDataImpl</b>
 <p>
 The <code>RowsetMetaDataImpl</code> class is a utility class that provides an implementation of the
@@ -256,7 +254,7 @@
 method implementations for metadata for both connected and disconnected 
 <code>RowSet</code> objects. All implementations are free to use this standard
 implementation but are not required to do so.
-<p>
+
 <li><b>3.6 RowSetWarning Class</b>
 <p>
 The <code>RowSetWarning</code> class provides warnings that can be set
@@ -273,8 +271,6 @@
 be chained on it.  If a warning is returned, <code>getNextWarning</code> can be called
 on it, and so on until there are no more warnings.
 
-
-<P>
 <li><b>3.7 The Joinable Interface</b>
 <P>
 The <code>Joinable</code> interface provides both connected and disconnected 
--- a/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -164,7 +164,7 @@
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code>
      * implementation.
-     * <p>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *     if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -182,7 +182,7 @@
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code>
      * implementation.
-     * <p>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *     if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -201,7 +201,7 @@
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code>
      * implementation.
-     * <p>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *     if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -219,7 +219,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -237,7 +237,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -255,7 +255,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -273,7 +273,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -291,7 +291,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -309,7 +309,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -326,7 +326,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -343,7 +343,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
--- a/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -76,7 +76,7 @@
     /**
       * Constructs a new <code>SerialDatalink</code> object from the given
       * <code>java.net.URL</code> object.
-      * <P>
+      *
       * @param url the {@code URL} to create the {@code SerialDataLink} from
       * @throws SerialException if url parameter is a null
       */
--- a/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -70,7 +70,6 @@
 
     /**
      * Constructor for <code>SerialJavaObject</code> helper class.
-     * <p>
      *
      * @param obj the Java <code>Object</code> to be serialized
      * @throws SerialException if the object is found not to be serializable
--- a/src/share/classes/javax/sql/rowset/spi/package.html	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/sql/rowset/spi/package.html	Thu May 01 14:21:29 2014 -0700
@@ -1,14 +1,14 @@
 <!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
 <html>
 <head>
-                    
+
   <meta http-equiv="Content-Type"
  content="text/html; charset=iso-8859-1">
-                    
+
   <meta name="GENERATOR"
  content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
 <!--
-Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2003, 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
@@ -32,7 +32,7 @@
 questions.
 -->
   <title>javax.sql.rowset.spi</title>
-   
+
 </head>
   <body bgcolor="#ffffff">
 
@@ -46,7 +46,7 @@
 it with the <code>SyncFactory</code> singleton. (See the class comment for
 <code>SyncProvider</code> for a full explanation of the registration process and 
 the naming convention to be used.)
-<P>
+
 <h2>Table of Contents</h2>
 <ul>
 <li><a href="#pkgspec">1.0 Package Specification</a>
@@ -57,7 +57,7 @@
 <li><a href="#reldocs">6.0 Related Documentation</a>
 </ul>
 
-<h3><a name="pkgspec">1.0 Package Specification</h3>
+<h3><a name="pkgspec">1.0 Package Specification</a></h3>
 <P>
 The following classes and interfaces make up the <code>javax.sql.rowset.spi</code>
 package:
@@ -155,7 +155,7 @@
            using locks; rather, it checks to see if there is a conflict
            before trying to synchronize the <code>RowSet</code> object and the
            data source. If there is a conflict, it does nothing, meaning that
-		   changes to the <code>RowSet</code> object are not persisted to the data
+           changes to the <code>RowSet</code> object are not persisted to the data
            source.
        <LI><B><tt>RIXMLProvider</tt></B> <BR>
             A synchronization provider that can be used with a
@@ -201,10 +201,8 @@
 synchronization mechanisms.  A vendor can make its implementation available by 
 registering the fully qualified class name with Oracle Corporation at
 <code>jdbc@sun.com</code>. This process is discussed in further detail below. 
-<P>
 
-<a name="arch"><h3>2.0 Service Provider Interface Architecture</h3>
-<ul>
+<h3><a name="arch">2.0 Service Provider Interface Architecture</a></h3>
 <b>2.1 Overview</b>
 <p>
 The Service Provider Interface provides a pluggable mechanism by which
@@ -229,13 +227,13 @@
 properties are set at run time and apply system-wide per invocation of the Java
 application. See the section <a href="#reldocs">"Related Documentation"</a>
 further related information.
-<p>
+
 <li><b>Property Files</b> - Properties specified in a standard property file.
 This can be specified using a System Property or by modifying a standard
 property file located in the platform run-time. The
 reference implementation of this technology includes a standard property
 file than can be edited to add additional <code>SyncProvider</code> objects.
-<p> 
+
 <li><b>JNDI Context</b> - Available providers can be registered on a JNDI
 context. The <tt>SyncFactory</tt> will attempt to load <tt>SyncProvider</tt>
 objects bound to the context and register them with the factory. This
@@ -258,20 +256,19 @@
 <li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
 contains <i>no</i> reference to the provider, a <code>SyncFactoryException</code> is 
 thrown.
-<p>
+
 <li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
 contains a reference to the provider, the requested provider is supplied.
-<p>
+
 <li> If no <code>SyncProvider</code> object is specified, the reference
 implementation provider <code>RIOptimisticProvider</code> is supplied.
 </ul>
 <p>
 These policies are explored in more detail in the <a href="SyncFactory.html">
 <code>SyncFactory</code></a> class.
-</ul>
 
-<li><a name="impl"><h3>3.0 SyncProvider Implementer's Guide</h3>
-<ul>
+<h3><a name="impl">3.0 SyncProvider Implementer's Guide</a></h3>
+
 <b>3.1 Requirements</b>
 <p>
 A compliant <code>SyncProvider</code> implementation that is fully pluggable
@@ -300,7 +297,7 @@
 underlying data source, overwriting whatever is there. No attempt is made to compare 
 original values with current values to see if there is a conflict. The 
 <code>RIXMLProvider</code> is implemented with this grade.
-<p>
+
 <li><b>GRADE_CHECK_MODIFIED_AT_COMMIT</b> - A low grade of optimistic synchronization.
 A <code>SyncProvider</code> implementation returning this grade
 will check for conflicts in rows that have changed between the last synchronization 
@@ -309,20 +306,20 @@
 object. If there are no conflicts, changes in the <code>RowSet</code> object will be
 written to the data source. If there are conflicts, no changes are written.
 The <code>RIOptimisticProvider</code> implementation uses this grade.
-<p>
+
 <li><b>GRADE_CHECK_ALL_AT_COMMIT</b> - A high grade of optimistic synchronization.
 A <code>SyncProvider</code> implementation   returning this grade
 will check all rows, including rows that have not changed in the disconnected
 <code>RowSet</code> object. In this way, any changes to rows in the underlying
 data source will be reflected in the disconnected <code>RowSet</code> object
 when the synchronization finishes successfully.
-<p>
+
 <li><b>GRADE_LOCK_WHEN_MODIFIED</b> - A pessimistic grade of synchronization.
 <code>SyncProvider</code> implementations returning this grade will lock
 the row in the originating  data source that corresponds to the row being changed
 in the <code>RowSet</code> object to reduce the possibility of other
 processes modifying the same data in the data source.
-<p>
+
 <li><b>GRADE_LOCK_WHEN_LOADED</b> - A higher pessimistic synchronization grade.
 A <code>SyncProvider</code> implementation returning this grade will lock
 the entire view and/or  table affected by the original query used to
@@ -347,13 +344,13 @@
 <li><b>DATASOURCE_NO_LOCK</b> - No locks remain on the originating data source. 
 This is the default lock setting for all <code>SyncProvider</code> implementations 
 unless otherwise directed by a <code>RowSet</code> object.
-<p>
+
 <li><b>DATASOURCE_ROW_LOCK</b> - A lock is placed on the rows that are touched by
 the original SQL query used to populate the <code>RowSet</code> object.
-<p> 
+
 <li><b>DATASOURCE_TABLE_LOCK</b> - A lock is placed on all tables that are touched
 by the query that was used to populate the <code>RowSet</code> object.
-<p>
+
 <li><b>DATASOURCE_DB_LOCK</b>
 A lock is placed on the entire data source that is used by the <code>RowSet</code>
 object.
@@ -369,7 +366,7 @@
 Indicates that a <code>SyncProvider</code> implementation  supports synchronization
 to the table or tables from which the SQL <code>VIEW</code> used to populate  a
 a <code>RowSet</code> object is derived.
-<p>
+
 <li><b>NONUPDATABLE_VIEW_SYNC</b>
 Indicates that a <code>SyncProvider</code> implementation  does <b>not</b> support
 synchronization to the table or tables from which the SQL <code>VIEW</code> 
@@ -381,7 +378,7 @@
 In the example below, the reference <tt>CachedRowSetImpl</tt> implementation
 reconfigures its current <tt>SyncProvider</tt> object by calling the 
 <tt>setSyncProvider</tt> method.<br>
-       
+
 <PRE>
     CachedRowSetImpl crs = new CachedRowSetImpl();
     crs.setSyncProvider("com.foo.bar.HASyncProvider");
@@ -412,7 +409,7 @@
       // No synchronization with the originating data source provided
     break;
     }
-	  
+
     switch (sync.getDataSourcLock() {
       case: SyncProvider.DATASOURCE_DB_LOCK
        // A lock is placed on the entire datasource that is used by the
@@ -439,14 +436,13 @@
     It is also possible using the static utility method in the
 <code>SyncFactory</code> class to determine the list of <code>SyncProvider</code>
 implementations currently registered with the <code>SyncFactory</code>.
-       
+
 <pre>
-	Enumeration e = SyncFactory.getRegisteredProviders();
-</pre>    
+       Enumeration e = SyncFactory.getRegisteredProviders();
+</pre>
 
-</ul>
 
-<h3><a name="resolving">4.0 Resolving Synchronization Conflicts</h3>
+<h3><a name="resolving">4.0 Resolving Synchronization Conflicts</a></h3>
 
 The interface <code>SyncResolver</code> provides a way for an application to
 decide manually what to do when a conflict occurs. When the <code>CachedRowSet</code>
@@ -491,18 +487,18 @@
 <P>
 The comment for the <code>SyncResolver</code> interface has more detail.
 
-<a name="relspec"><h3>5.0 Related Specifications</h3>
+<h3><a name="relspec">5.0 Related Specifications</a></h3>
 <ul>
-<li><a href="http://java.sun.com/products/jndi">JNDI 1.3</a>
+<li><a href="http://docs.oracle.com/javase/jndi/tutorial/index.html">JNDI</a>
 <li><a href="{@docRoot}/../technotes/guides/logging/index.html">Java Logging
 APIs</a>
 </ul>
-<a name="reldocs"><h3>6.0 Related Documentation</h3>
+<h3><a name="reldocs">6.0 Related Documentation</a></h3>
 <ul>
 <li><a href="{@docRoot}/../technotes/tools/index.html#basic">System
 properties</a>
 <li>Resource Files
-<li><a href="http://java.sun.com/tutorial/jdbc">DataSource for JDBC
+<li><a href="http://docs.oracle.com/javase/tutorial/jdbc/">DataSource for JDBC
 Connections</a>
 </ul>
 
--- a/src/share/classes/javax/swing/BufferStrategyPaintManager.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/BufferStrategyPaintManager.java	Thu May 01 14:21:29 2014 -0700
@@ -27,13 +27,10 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.image.*;
-import java.lang.reflect.*;
 import java.lang.ref.WeakReference;
 import java.util.*;
 
 import com.sun.java.swing.SwingUtilities3;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import sun.awt.AWTAccessor;
 
 import sun.awt.SubRegionShowable;
--- a/src/share/classes/javax/swing/JOptionPane.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/JOptionPane.java	Thu May 01 14:21:29 2014 -0700
@@ -56,6 +56,7 @@
 import javax.swing.event.InternalFrameAdapter;
 import javax.accessibility.*;
 import static javax.swing.ClientPropertyKey.PopupFactory_FORCE_HEAVYWEIGHT_POPUP;
+import sun.awt.AWTAccessor;
 
 /**
  * <code>JOptionPane</code> makes it easy to pop up a standard dialog box that
@@ -1306,17 +1307,7 @@
             }
         }
 
-        // Use reflection to get Container.startLWModal.
-        try {
-            Method method = AccessController.doPrivileged(new ModalPrivilegedAction(
-                    Container.class, "startLWModal"));
-            if (method != null) {
-                method.invoke(dialog, (Object[])null);
-            }
-        } catch (IllegalAccessException ex) {
-        } catch (IllegalArgumentException ex) {
-        } catch (InvocationTargetException ex) {
-        }
+        AWTAccessor.getContainerAccessor().startLWModal(dialog);
 
         if (parentComponent instanceof JInternalFrame) {
             try {
@@ -1451,17 +1442,7 @@
             }
         }
 
-        // Use reflection to get Container.startLWModal.
-        try {
-            Method method = AccessController.doPrivileged(new ModalPrivilegedAction(
-                    Container.class, "startLWModal"));
-            if (method != null) {
-                method.invoke(dialog, (Object[])null);
-            }
-        } catch (IllegalAccessException ex) {
-        } catch (IllegalArgumentException ex) {
-        } catch (InvocationTargetException ex) {
-        }
+        AWTAccessor.getContainerAccessor().startLWModal(dialog);
 
         if (parentComponent instanceof JInternalFrame) {
             try {
@@ -1535,18 +1516,7 @@
                 if (iFrame.isVisible() &&
                         event.getSource() == JOptionPane.this &&
                         event.getPropertyName().equals(VALUE_PROPERTY)) {
-                // Use reflection to get Container.stopLWModal().
-                try {
-                    Method method = AccessController.doPrivileged(
-                        new ModalPrivilegedAction(
-                            Container.class, "stopLWModal"));
-                    if (method != null) {
-                        method.invoke(iFrame, (Object[])null);
-                    }
-                } catch (IllegalAccessException ex) {
-                } catch (IllegalArgumentException ex) {
-                } catch (InvocationTargetException ex) {
-                }
+                    AWTAccessor.getContainerAccessor().stopLWModal(iFrame);
 
                 try {
                     iFrame.setClosed(true);
@@ -2512,33 +2482,6 @@
         ",wantsInput=" + wantsInputString;
     }
 
-    /**
-     * Retrieves a method from the provided class and makes it accessible.
-     */
-    private static class ModalPrivilegedAction implements PrivilegedAction<Method> {
-        private Class<?> clazz;
-        private String methodName;
-
-        public ModalPrivilegedAction(Class<?> clazz, String methodName) {
-            this.clazz = clazz;
-            this.methodName = methodName;
-        }
-
-        public Method run() {
-            Method method = null;
-            try {
-                method = clazz.getDeclaredMethod(methodName, (Class[])null);
-            } catch (NoSuchMethodException ex) {
-            }
-            if (method != null) {
-                method.setAccessible(true);
-            }
-            return method;
-        }
-    }
-
-
-
 ///////////////////
 // Accessibility support
 ///////////////////
--- a/src/share/classes/javax/swing/JTable.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/JTable.java	Thu May 01 14:21:29 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;
@@ -4043,7 +4042,7 @@
                 }
                 // Restore the lead
                 int viewLeadIndex = modelSelection.getLeadSelectionIndex();
-                if (viewLeadIndex != -1) {
+                if (viewLeadIndex != -1 && !modelSelection.isSelectionEmpty()) {
                     viewLeadIndex = convertRowIndexToView(viewLeadIndex);
                 }
                 SwingUtilities2.setLeadAnchorWithoutSelection(
@@ -5307,14 +5306,6 @@
         return retValue;
     }
 
-    private void setLazyValue(Hashtable h, Class c, LazyClass lazyClass) {
-        h.put(c, new TableLazyValue(lazyClass));
-    }
-
-    private void setLazyRenderer(Class c, LazyClass lazyClass) {
-        setLazyValue(defaultRenderersByColumnClass, c, lazyClass);
-    }
-
     /**
      * Creates default cell renderers for objects, numbers, doubles, dates,
      * booleans, and icons.
@@ -5325,24 +5316,32 @@
         defaultRenderersByColumnClass = new UIDefaults(8, 0.75f);
 
         // Objects
-        setLazyRenderer(Object.class, LazyClass.UIResource);
+        defaultRenderersByColumnClass.put(Object.class, (UIDefaults.LazyValue)
+                t -> new DefaultTableCellRenderer.UIResource());
 
         // Numbers
-        setLazyRenderer(Number.class, LazyClass.NumberRenderer);
+        defaultRenderersByColumnClass.put(Number.class, (UIDefaults.LazyValue)
+                t -> new NumberRenderer());
 
         // Doubles and Floats
-        setLazyRenderer(Float.class, LazyClass.DoubleRenderer);
-        setLazyRenderer(Double.class, LazyClass.DoubleRenderer);
+        defaultRenderersByColumnClass.put(Float.class, (UIDefaults.LazyValue)
+                t -> new DoubleRenderer());
+        defaultRenderersByColumnClass.put(Double.class, (UIDefaults.LazyValue)
+                t -> new DoubleRenderer());
 
         // Dates
-        setLazyRenderer(Date.class, LazyClass.DateRenderer);
+        defaultRenderersByColumnClass.put(Date.class, (UIDefaults.LazyValue)
+                t -> new DateRenderer());
 
         // Icons and ImageIcons
-        setLazyRenderer(Icon.class, LazyClass.IconRenderer);
-        setLazyRenderer(ImageIcon.class, LazyClass.IconRenderer);
+        defaultRenderersByColumnClass.put(Icon.class, (UIDefaults.LazyValue)
+                t -> new IconRenderer());
+        defaultRenderersByColumnClass.put(ImageIcon.class, (UIDefaults.LazyValue)
+                t -> new IconRenderer());
 
         // Booleans
-        setLazyRenderer(Boolean.class, LazyClass.BooleanRenderer);
+        defaultRenderersByColumnClass.put(Boolean.class, (UIDefaults.LazyValue)
+                t -> new BooleanRenderer());
     }
 
     /**
@@ -5420,10 +5419,6 @@
         }
     }
 
-    private void setLazyEditor(Class c, LazyClass lazyClass) {
-        setLazyValue(defaultEditorsByColumnClass, c, lazyClass);
-    }
-
     /**
      * Creates default cell editors for objects, numbers, and boolean values.
      * @see DefaultCellEditor
@@ -5432,13 +5427,16 @@
         defaultEditorsByColumnClass = new UIDefaults(3, 0.75f);
 
         // Objects
-        setLazyEditor(Object.class, LazyClass.GenericEditor);
+        defaultEditorsByColumnClass.put(Object.class, (UIDefaults.LazyValue)
+                t -> new GenericEditor());
 
         // Numbers
-        setLazyEditor(Number.class, LazyClass.NumberEditor);
+        defaultEditorsByColumnClass.put(Number.class, (UIDefaults.LazyValue)
+                t -> new NumberEditor());
 
         // Booleans
-        setLazyEditor(Boolean.class, LazyClass.BooleanEditor);
+        defaultEditorsByColumnClass.put(Boolean.class, (UIDefaults.LazyValue)
+                t -> new BooleanEditor());
     }
 
     /**
@@ -6544,54 +6542,6 @@
         }
     }
 
-    private enum LazyClass {
-
-        UIResource,
-        NumberRenderer,
-        DoubleRenderer,
-        DateRenderer,
-        IconRenderer,
-        BooleanRenderer,
-        GenericEditor,
-        NumberEditor,
-        BooleanEditor,
-    }
-
-    private static class TableLazyValue implements UIDefaults.LazyValue {
-
-        private LazyClass type;
-
-        public TableLazyValue(LazyClass type) {
-            this.type = type;
-        }
-
-        @Override
-        public Object createValue(UIDefaults table) {
-            switch (type) {
-                case UIResource:
-                    return new DefaultTableCellRenderer.UIResource();
-                case NumberRenderer:
-                    return new NumberRenderer();
-                case DoubleRenderer:
-                    return new DoubleRenderer();
-                case DateRenderer:
-                    return new DateRenderer();
-                case IconRenderer:
-                    return new IconRenderer();
-                case BooleanRenderer:
-                    return new BooleanRenderer();
-                case GenericEditor:
-                    return new GenericEditor();
-                case NumberEditor:
-                    return new NumberEditor();
-                case BooleanEditor:
-                    return new BooleanEditor();
-                default:
-                    return null;
-            }
-        }
-    }
-
 /////////////////
 // Accessibility support
 ////////////////
@@ -6636,8 +6586,8 @@
     TableColumnModelListener, CellEditorListener, PropertyChangeListener,
     AccessibleExtendedTable {
 
-        int lastSelectedRow;
-        int lastSelectedCol;
+        int previousFocusedRow;
+        int previousFocusedCol;
 
         /**
          * AccessibleJTable constructor
@@ -6652,8 +6602,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
@@ -6979,20 +6931,23 @@
          */
         public void valueChanged(ListSelectionEvent e) {
             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);
+                            Boolean.valueOf(false), Boolean.valueOf(true));
+
+            // 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	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/JTree.java	Thu May 01 14:21:29 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,14 @@
 
         leadPath = newPath;
         firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, newPath);
+
+        // Fire the active descendant property change here since the
+        // leadPath got set, this is triggered both in case node
+        // selection changed and node focus changed
+        if (accessibleContext != null){
+            ((AccessibleJTree)accessibleContext).
+                fireActiveDescendantPropertyChange(oldValue, newPath);
+        }
     }
 
     /**
@@ -4129,26 +4137,9 @@
          *
          */
         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));
-        }
+             firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY,
+                                Boolean.valueOf(false), Boolean.valueOf(true));
+         }
 
         /**
          * Fire a visible data property change notification.
@@ -4249,6 +4240,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/ComponentUI.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/ComponentUI.java	Thu May 01 14:21:29 2014 -0700
@@ -297,7 +297,7 @@
     }
 
     /**
-     * Returns an enum indicating how the baseline of he component
+     * Returns an enum indicating how the baseline of the component
      * changes as the size changes.  This method is primarily meant for
      * layout managers and GUI builders.
      * <p>
--- a/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java	Thu May 01 14:21:29 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
@@ -37,6 +37,10 @@
 import javax.swing.event.*;
 import javax.swing.plaf.*;
 
+import static sun.swing.SwingUtilities2.drawHLine;
+import static sun.swing.SwingUtilities2.drawRect;
+import static sun.swing.SwingUtilities2.drawVLine;
+
 
 /**
  * Implementation of ScrollBarUI for the Basic Look and Feel
@@ -572,17 +576,17 @@
         g.translate(thumbBounds.x, thumbBounds.y);
 
         g.setColor(thumbDarkShadowColor);
-        g.drawRect(0, 0, w-1, h-1);
+        drawRect(g, 0, 0, w - 1, h - 1);
         g.setColor(thumbColor);
-        g.fillRect(0, 0, w-1, h-1);
+        g.fillRect(0, 0, w - 1, h - 1);
 
         g.setColor(thumbHighlightColor);
-        g.drawLine(1, 1, 1, h-2);
-        g.drawLine(2, 1, w-3, 1);
+        drawVLine(g, 1, 1, h - 2);
+        drawHLine(g, 2, w - 3, 1);
 
         g.setColor(thumbLightShadowColor);
-        g.drawLine(2, h-2, w-2, h-2);
-        g.drawLine(w-2, 1, w-2, h-3);
+        drawHLine(g, 2, w - 2, h - 2);
+        drawVLine(g, w - 2, 1, h - 3);
 
         g.translate(-thumbBounds.x, -thumbBounds.y);
     }
--- a/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Thu May 01 14:21:29 2014 -0700
@@ -34,13 +34,10 @@
 import javax.swing.text.DefaultEditorKit;
 
 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 +457,9 @@
         LazyValue textFieldBorder =
             t -> 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,
@@ -1470,12 +1465,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",
@@ -1489,17 +1480,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[] {
@@ -2151,61 +2139,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/plaf/metal/MetalScrollBarUI.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -25,33 +25,23 @@
 
 package javax.swing.plaf.metal;
 
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.LayoutManager;
-import java.awt.Adjustable;
-import java.awt.event.AdjustmentListener;
-import java.awt.event.AdjustmentEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
+import java.awt.Color;
+import java.awt.Dimension;
 import java.awt.Graphics;
-import java.awt.Dimension;
 import java.awt.Rectangle;
-import java.awt.Point;
-import java.awt.Insets;
-import java.awt.Color;
-import java.awt.IllegalComponentStateException;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 
-import java.beans.*;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JScrollBar;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicScrollBarUI;
 
-import javax.swing.*;
-import javax.swing.event.*;
-
-import javax.swing.plaf.*;
-import javax.swing.plaf.basic.BasicScrollBarUI;
+import static sun.swing.SwingUtilities2.drawHLine;
+import static sun.swing.SwingUtilities2.drawRect;
+import static sun.swing.SwingUtilities2.drawVLine;
 
 
 /**
@@ -158,21 +148,21 @@
 
             if ( c.isEnabled() ) {
                 g.setColor( darkShadowColor );
-                g.drawLine( 0, 0, 0, trackBounds.height - 1 );
-                g.drawLine( trackBounds.width - 2, 0, trackBounds.width - 2, trackBounds.height - 1 );
-                g.drawLine( 2, trackBounds.height - 1, trackBounds.width - 1, trackBounds.height - 1);
-                g.drawLine( 2, 0, trackBounds.width - 2, 0 );
+                drawVLine(g, 0, 0, trackBounds.height - 1);
+                drawVLine(g, trackBounds.width - 2, 0, trackBounds.height - 1);
+                drawHLine(g, 2, trackBounds.width - 1, trackBounds.height - 1);
+                drawHLine(g, 2, trackBounds.width - 2, 0);
 
                 g.setColor( shadowColor );
                 //      g.setColor( Color.red);
-                g.drawLine( 1, 1, 1, trackBounds.height - 2 );
-                g.drawLine( 1, 1, trackBounds.width - 3, 1 );
+                drawVLine(g, 1, 1, trackBounds.height - 2);
+                drawHLine(g, 1, trackBounds.width - 3, 1);
                 if (scrollbar.getValue() != scrollbar.getMaximum()) {  // thumb shadow
                     int y = thumbRect.y + thumbRect.height - trackBounds.y;
-                    g.drawLine( 1, y, trackBounds.width-1, y);
+                    drawHLine(g, 1, trackBounds.width - 1, y);
                 }
                 g.setColor(highlightColor);
-                g.drawLine( trackBounds.width - 1, 0, trackBounds.width - 1, trackBounds.height - 1 );
+                drawVLine(g, trackBounds.width - 1, 0, trackBounds.height - 1);
             } else {
                 MetalUtils.drawDisabledBorder(g, 0, 0, trackBounds.width, trackBounds.height );
             }
@@ -192,19 +182,19 @@
 
             if ( c.isEnabled() ) {
                 g.setColor( darkShadowColor );
-                g.drawLine( 0, 0, trackBounds.width - 1, 0 );  // top
-                g.drawLine( 0, 2, 0, trackBounds.height - 2 ); // left
-                g.drawLine( 0, trackBounds.height - 2, trackBounds.width - 1, trackBounds.height - 2 ); // bottom
-                g.drawLine( trackBounds.width - 1, 2, trackBounds.width - 1, trackBounds.height - 1 ); // right
+                drawHLine(g, 0, trackBounds.width - 1, 0);  // top
+                drawVLine(g, 0, 2, trackBounds.height - 2); // left
+                drawHLine(g, 0, trackBounds.width - 1, trackBounds.height - 2 ); // bottom
+                drawVLine(g, trackBounds.width - 1, 2,  trackBounds.height - 1 ); // right
 
                 g.setColor( shadowColor );
                 //      g.setColor( Color.red);
-                g.drawLine( 1, 1, trackBounds.width - 2, 1 );  // top
-                g.drawLine( 1, 1, 1, trackBounds.height - 3 ); // left
-                g.drawLine( 0, trackBounds.height - 1, trackBounds.width - 1, trackBounds.height - 1 ); // bottom
+                drawHLine(g, 1, trackBounds.width - 2, 1 );  // top
+                drawVLine(g, 1, 1, trackBounds.height - 3 ); // left
+                drawHLine(g, 0, trackBounds.width - 1, trackBounds.height - 1 ); // bottom
                 if (scrollbar.getValue() != scrollbar.getMaximum()) {  // thumb shadow
                     int x = thumbRect.x + thumbRect.width - trackBounds.x;
-                    g.drawLine( x, 1, x, trackBounds.height-1);
+                    drawVLine(g, x, 1, trackBounds.height-1);
                 }
             } else {
                 MetalUtils.drawDisabledBorder(g, 0, 0, trackBounds.width, trackBounds.height );
@@ -246,11 +236,11 @@
             g.fillRect( 0, 0, thumbBounds.width - 2, thumbBounds.height - 1 );
 
             g.setColor( thumbShadow );
-            g.drawRect( 0, 0, thumbBounds.width - 2, thumbBounds.height - 1 );
+            drawRect(g, 0, 0, thumbBounds.width - 2, thumbBounds.height - 1);
 
             g.setColor( thumbHighlightColor );
-            g.drawLine( 1, 1, thumbBounds.width - 3, 1 );
-            g.drawLine( 1, 1, 1, thumbBounds.height - 2 );
+            drawHLine(g, 1, thumbBounds.width - 3, 1);
+            drawVLine(g, 1, 1, thumbBounds.height - 2);
 
             bumps.setBumpArea( thumbBounds.width - 6, thumbBounds.height - 7 );
             bumps.paintIcon( c, g, 3, 4 );
@@ -272,11 +262,11 @@
             g.fillRect( 0, 0, thumbBounds.width - 1, thumbBounds.height - 2 );
 
             g.setColor( thumbShadow );
-            g.drawRect( 0, 0, thumbBounds.width - 1, thumbBounds.height - 2 );
+            drawRect(g, 0, 0, thumbBounds.width - 1, thumbBounds.height - 2);
 
             g.setColor( thumbHighlightColor );
-            g.drawLine( 1, 1, thumbBounds.width - 3, 1 );
-            g.drawLine( 1, 1, 1, thumbBounds.height - 3 );
+            drawHLine(g, 1, thumbBounds.width - 3, 1);
+            drawVLine(g, 1, 1, thumbBounds.height - 3);
 
             bumps.setBumpArea( thumbBounds.width - 7, thumbBounds.height - 6 );
             bumps.paintIcon( c, g, 4, 3 );
@@ -309,11 +299,11 @@
             }
 
             g.setColor(thumbShadow);
-            g.drawRect(0, 0, thumbBounds.width - 2, thumbBounds.height - 1);
+            drawRect(g, 0, 0, thumbBounds.width - 2, thumbBounds.height - 1);
 
             g.setColor(thumbHighlightColor);
-            g.drawLine(1, 1, thumbBounds.width - 3, 1);
-            g.drawLine(1, 1, 1, thumbBounds.height - 2);
+            drawHLine(g, 1, thumbBounds.width - 3, 1);
+            drawVLine(g, 1, 1, thumbBounds.height - 2);
 
             MetalUtils.drawGradient(c, g, "ScrollBar.gradient", 2, 2,
                                     thumbBounds.width - 4,
@@ -351,11 +341,11 @@
             }
 
             g.setColor(thumbShadow);
-            g.drawRect(0, 0, thumbBounds.width - 1, thumbBounds.height - 2);
+            drawRect(g, 0, 0, thumbBounds.width - 1, thumbBounds.height - 2);
 
             g.setColor(thumbHighlightColor);
-            g.drawLine(1, 1, thumbBounds.width - 2, 1);
-            g.drawLine(1, 1, 1, thumbBounds.height - 3);
+            drawHLine(g, 1, thumbBounds.width - 2, 1);
+            drawVLine(g, 1, 1, thumbBounds.height - 3);
 
             MetalUtils.drawGradient(c, g, "ScrollBar.gradient", 2, 2,
                                     thumbBounds.width - 3,
--- a/src/share/classes/javax/swing/text/EditorKit.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/text/EditorKit.java	Thu May 01 14:21:29 2014 -0700
@@ -39,9 +39,9 @@
  * A kit can safely store editing state as an instance
  * of the kit will be dedicated to a text component.
  * New kits will normally be created by cloning a
- * prototype kit.  The kit will have it's
+ * prototype kit.  The kit will have its
  * <code>setComponent</code> method called to establish
- * it's relationship with a JTextComponent.
+ * its relationship with a JTextComponent.
  *
  * @author  Timothy Prinzing
  */
--- a/src/share/classes/javax/swing/text/JTextComponent.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/text/JTextComponent.java	Thu May 01 14:21:29 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.*;
 
@@ -1194,47 +1192,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.
      *
@@ -3916,7 +3873,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>.
@@ -4941,39 +4924,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	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/text/html/HTMLEditorKit.java	Thu May 01 14:21:29 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
@@ -415,14 +415,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	Thu May 01 12:51:13 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	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java	Thu May 01 14:21:29 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
@@ -110,14 +111,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	Thu May 01 12:51:13 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	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/text/rtf/RTFReader.java	Thu May 01 14:21:29 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/javax/swing/tree/DefaultTreeCellRenderer.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Thu May 01 14:21:29 2014 -0700
@@ -191,7 +191,7 @@
         if (!inited || (getClosedIcon() instanceof UIResource)) {
             setClosedIcon(DefaultLookup.getIcon(this, ui, "Tree.closedIcon"));
         }
-        if (!inited || (getOpenIcon() instanceof UIManager)) {
+        if (!inited || (getOpenIcon() instanceof UIResource)) {
             setOpenIcon(DefaultLookup.getIcon(this, ui, "Tree.openIcon"));
         }
         if (!inited || (getTextSelectionColor() instanceof UIResource)) {
--- a/src/share/classes/sun/awt/AWTAccessor.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/awt/AWTAccessor.java	Thu May 01 14:21:29 2014 -0700
@@ -272,6 +272,16 @@
          * bypasses disabled Components during the search.
          */
         Component findComponentAt(Container cont, int x, int y, boolean ignoreEnabled);
+
+        /**
+         * Starts LW Modal.
+         */
+        void startLWModal(Container cont);
+
+        /**
+         * Starts LW Modal.
+         */
+        void stopLWModal(Container cont);
     }
 
     /*
--- a/src/share/classes/sun/awt/EventListenerAggregate.java	Thu May 01 12:51:13 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.lang.reflect.Array;
-import java.util.EventListener;
-
-
-/**
- * A class that assists in managing {@link java.util.EventListener}s of
- * the specified type. Its instance holds an array of listeners of the same
- * type and allows to perform the typical operations on the listeners.
- * This class is thread-safe.
- *
- * @author Alexander Gerasimov
- *
- * @since 1.5
- */
-public class EventListenerAggregate {
-
-    private EventListener[] listenerList;
-
-    /**
-     * Constructs an <code>EventListenerAggregate</code> object.
-     *
-     * @param listenerClass the type of the listeners to be managed by this object
-     *
-     * @throws NullPointerException if <code>listenerClass</code> is
-     *         <code>null</code>
-     * @throws ClassCastException if <code>listenerClass</code> is not
-     *         assignable to <code>java.util.EventListener</code>
-     */
-    public EventListenerAggregate(Class<? extends EventListener> listenerClass) {
-        if (listenerClass == null) {
-            throw new NullPointerException("listener class is null");
-        }
-
-        listenerList = (EventListener[])Array.newInstance(listenerClass, 0);
-    }
-
-    private Class<?> getListenerClass() {
-        return listenerList.getClass().getComponentType();
-    }
-
-    /**
-     * Adds the listener to this aggregate.
-     *
-     * @param listener the listener to be added
-     *
-     * @throws ClassCastException if <code>listener</code> is not
-     *         an instatce of <code>listenerClass</code> specified
-     *         in the constructor
-     */
-    public synchronized void add(EventListener listener) {
-        Class<?> listenerClass = getListenerClass();
-
-        if (!listenerClass.isInstance(listener)) { // null is not an instance of any class
-            throw new ClassCastException("listener " + listener + " is not " +
-                    "an instance of listener class " + listenerClass);
-        }
-
-        EventListener[] tmp = (EventListener[])Array.newInstance(listenerClass, listenerList.length + 1);
-        System.arraycopy(listenerList, 0, tmp, 0, listenerList.length);
-        tmp[listenerList.length] = listener;
-        listenerList = tmp;
-    }
-
-    /**
-     * Removes a listener that is equal to the given one from this aggregate.
-     * <code>equals()</code> method is used to compare listeners.
-     *
-     * @param listener the listener to be removed
-     *
-     * @return <code>true</code> if this aggregate contained the specified
-     *         <code>listener</code>; <code>false</code> otherwise
-     *
-     * @throws ClassCastException if <code>listener</code> is not
-     *         an instatce of <code>listenerClass</code> specified
-     *         in the constructor
-     */
-    public synchronized boolean remove(EventListener listener) {
-        Class<?> listenerClass = getListenerClass();
-
-        if (!listenerClass.isInstance(listener)) { // null is not an instance of any class
-            throw new ClassCastException("listener " + listener + " is not " +
-                    "an instance of listener class " + listenerClass);
-        }
-
-        for (int i = 0; i < listenerList.length; i++) {
-            if (listenerList[i].equals(listener)) {
-                EventListener[] tmp = (EventListener[])Array.newInstance(listenerClass,
-                                                                         listenerList.length - 1);
-                System.arraycopy(listenerList, 0, tmp, 0, i);
-                System.arraycopy(listenerList, i + 1, tmp, i, listenerList.length - i - 1);
-                listenerList = tmp;
-
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Returns an array of all the listeners contained in this aggregate.
-     * The array is the data structure in which listeners are stored internally.
-     * The runtime type of the returned array is "array of <code>listenerClass</code>"
-     * (<code>listenerClass</code> has been specified as a parameter to
-     * the constructor of this class).
-     *
-     * @return all the listeners contained in this aggregate (an empty
-     *         array if there are no listeners)
-     */
-    public synchronized EventListener[] getListenersInternal() {
-        return listenerList;
-    }
-
-    /**
-     * Returns an array of all the listeners contained in this aggregate.
-     * The array is a copy of the data structure in which listeners are stored
-     * internally.
-     * The runtime type of the returned array is "array of <code>listenerClass</code>"
-     * (<code>listenerClass</code> has been specified as a parameter to
-     * the constructor of this class).
-     *
-     * @return a copy of all the listeners contained in this aggregate (an empty
-     *         array if there are no listeners)
-     */
-    public synchronized EventListener[] getListenersCopy() {
-        return (listenerList.length == 0) ? listenerList : listenerList.clone();
-    }
-
-    /**
-     * Returns the number of lisetners in this aggregate.
-     *
-     * @return the number of lisetners in this aggregate
-     */
-    public synchronized int size() {
-        return listenerList.length;
-    }
-
-    /**
-     * Returns <code>true</code> if this aggregate contains no listeners,
-     * <code>false</code> otherwise.
-     *
-     * @return <code>true</code> if this aggregate contains no listeners,
-     *         <code>false</code> otherwise
-     */
-    public synchronized boolean isEmpty() {
-        return listenerList.length == 0;
-    }
-}
--- a/src/share/classes/sun/awt/datatransfer/SunClipboard.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/awt/datatransfer/SunClipboard.java	Thu May 01 14:21:29 2014 -0700
@@ -40,7 +40,7 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 
-import java.util.Iterator;
+import java.util.Objects;
 import java.util.Set;
 import java.util.HashSet;
 
@@ -49,7 +49,6 @@
 import sun.awt.AppContext;
 import sun.awt.PeerEvent;
 import sun.awt.SunToolkit;
-import sun.awt.EventListenerAggregate;
 
 
 /**
@@ -107,11 +106,7 @@
             setContentsNative(contents);
         } finally {
             if (oldOwner != null && oldOwner != owner) {
-                EventQueue.invokeLater(new Runnable() {
-                    public void run() {
-                        oldOwner.lostOwnership(SunClipboard.this, oldContents);
-                    }
-                });
+                EventQueue.invokeLater(() -> oldOwner.lostOwnership(SunClipboard.this, oldContents));
             }
         }
     }
@@ -355,13 +350,12 @@
             return;
         }
         AppContext appContext = AppContext.getAppContext();
-        EventListenerAggregate contextFlavorListeners = (EventListenerAggregate)
-                appContext.get(CLIPBOARD_FLAVOR_LISTENER_KEY);
-        if (contextFlavorListeners == null) {
-            contextFlavorListeners = new EventListenerAggregate(FlavorListener.class);
-            appContext.put(CLIPBOARD_FLAVOR_LISTENER_KEY, contextFlavorListeners);
+        Set<FlavorListener> flavorListeners = getFlavorListeners(appContext);
+        if (flavorListeners == null) {
+            flavorListeners = new HashSet<>();
+            appContext.put(CLIPBOARD_FLAVOR_LISTENER_KEY, flavorListeners);
         }
-        contextFlavorListeners.add(listener);
+        flavorListeners.add(listener);
 
         if (numberOfFlavorListeners++ == 0) {
             long[] currentFormats = null;
@@ -382,25 +376,26 @@
         if (listener == null) {
             return;
         }
-        AppContext appContext = AppContext.getAppContext();
-        EventListenerAggregate contextFlavorListeners = (EventListenerAggregate)
-                appContext.get(CLIPBOARD_FLAVOR_LISTENER_KEY);
-        if (contextFlavorListeners == null){
+        Set<FlavorListener> flavorListeners = getFlavorListeners(AppContext.getAppContext());
+        if (flavorListeners == null){
             //else we throw NullPointerException, but it is forbidden
             return;
         }
-        if (contextFlavorListeners.remove(listener) &&
-                --numberOfFlavorListeners == 0) {
+        if (flavorListeners.remove(listener) && --numberOfFlavorListeners == 0) {
             unregisterClipboardViewerChecked();
             currentDataFlavors = null;
         }
     }
 
+    @SuppressWarnings("unchecked")
+    private Set<FlavorListener> getFlavorListeners(AppContext appContext) {
+        return (Set<FlavorListener>)appContext.get(CLIPBOARD_FLAVOR_LISTENER_KEY);
+    }
+
     public synchronized FlavorListener[] getFlavorListeners() {
-        EventListenerAggregate contextFlavorListeners = (EventListenerAggregate)
-                AppContext.getAppContext().get(CLIPBOARD_FLAVOR_LISTENER_KEY);
-        return contextFlavorListeners == null ? new FlavorListener[0] :
-                (FlavorListener[])contextFlavorListeners.getListenersCopy();
+        Set<FlavorListener> flavorListeners = getFlavorListeners(AppContext.getAppContext());
+        return flavorListeners == null ? new FlavorListener[0]
+                : flavorListeners.toArray(new FlavorListener[flavorListeners.size()]);
     }
 
     public boolean areFlavorListenersRegistered() {
@@ -425,42 +420,26 @@
         Set prevDataFlavors = currentDataFlavors;
         currentDataFlavors = formatArrayAsDataFlavorSet(formats);
 
-        if ((prevDataFlavors != null) && (currentDataFlavors != null) &&
-                prevDataFlavors.equals(currentDataFlavors)) {
+        if (Objects.equals(prevDataFlavors, currentDataFlavors)) {
             // we've been able to successfully get available on the clipboard
             // DataFlavors this and previous time and they are coincident;
             // don't notify
             return;
         }
 
-        class SunFlavorChangeNotifier implements Runnable {
-            private final FlavorListener flavorListener;
-
-            SunFlavorChangeNotifier(FlavorListener flavorListener) {
-                this.flavorListener = flavorListener;
-            }
-
-            public void run() {
-                if (flavorListener != null) {
-                    flavorListener.flavorsChanged(new FlavorEvent(SunClipboard.this));
-                }
-            }
-        };
-
-        for (Iterator it = AppContext.getAppContexts().iterator(); it.hasNext();) {
-            AppContext appContext = (AppContext)it.next();
+        for (AppContext appContext : AppContext.getAppContexts()) {
             if (appContext == null || appContext.isDisposed()) {
                 continue;
             }
-            EventListenerAggregate flavorListeners = (EventListenerAggregate)
-                    appContext.get(CLIPBOARD_FLAVOR_LISTENER_KEY);
+            Set<FlavorListener> flavorListeners = getFlavorListeners(appContext);
             if (flavorListeners != null) {
-                FlavorListener[] flavorListenerArray =
-                        (FlavorListener[])flavorListeners.getListenersInternal();
-                for (int i = 0; i < flavorListenerArray.length; i++) {
-                    SunToolkit.postEvent(appContext, new PeerEvent(this,
-                            new SunFlavorChangeNotifier(flavorListenerArray[i]),
-                            PeerEvent.PRIORITY_EVENT));
+                for (FlavorListener listener : flavorListeners) {
+                    if (listener != null) {
+                        PeerEvent peerEvent = new PeerEvent(this,
+                                () -> listener.flavorsChanged(new FlavorEvent(SunClipboard.this)),
+                                PeerEvent.PRIORITY_EVENT);
+                        SunToolkit.postEvent(appContext, peerEvent);
+                    }
                 }
             }
         }
--- a/src/share/classes/sun/awt/image/GifImageDecoder.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/awt/image/GifImageDecoder.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -114,6 +114,7 @@
     /**
      * produce an image from the stream.
      */
+    @SuppressWarnings("fallthrough")
     public void produceImage() throws IOException, ImageFormatException {
         try {
             readHeader();
@@ -238,7 +239,7 @@
                     if (frameno == 0) {
                         return;
                     }
-                    // NOBREAK
+                    // Fall through
 
                   case TERMINATOR:
                     if (nloops == 0 || nloops-- >= 0) {
--- a/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java	Thu May 01 14:21:29 2014 -0700
@@ -24,6 +24,7 @@
  */
 package sun.awt.image;
 
+import java.awt.Dimension;
 import java.awt.Image;
 import java.awt.Graphics;
 import java.awt.geom.Dimension2D;
@@ -43,6 +44,13 @@
     private int availableInfo;
 
     public MultiResolutionBufferedImage(Image baseImage,
+            BiFunction<Integer, Integer, Image> mapper) {
+        this(baseImage, new Dimension[]{new Dimension(
+            baseImage.getWidth(null), baseImage.getHeight(null))
+        }, mapper);
+    }
+
+    public MultiResolutionBufferedImage(Image baseImage,
             Dimension2D[] sizes, BiFunction<Integer, Integer, Image> mapper) {
         super(baseImage.getWidth(null), baseImage.getHeight(null),
                 BufferedImage.TYPE_INT_ARGB_PRE);
@@ -115,7 +123,7 @@
     }
 
     private static void preload(Image image, int availableInfo) {
-        if (image instanceof ToolkitImage) {
+        if (availableInfo != 0 && image instanceof ToolkitImage) {
             ((ToolkitImage) image).preload(new ImageObserver() {
                 int flags = availableInfo;
 
--- a/src/share/classes/sun/awt/image/PixelConverter.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/awt/image/PixelConverter.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -53,6 +53,7 @@
 
     protected PixelConverter() {}
 
+    @SuppressWarnings("fallthrough")
     public int rgbToPixel(int rgb, ColorModel cm) {
         Object obj = cm.getDataElements(rgb, null);
         switch (cm.getTransferType()) {
--- a/src/share/classes/sun/java2d/pipe/DrawImage.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/java2d/pipe/DrawImage.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -310,11 +310,19 @@
         return false;
     }
 
-    /*
-     * Return a BufferedImage of the requested type with the indicated
-     * subimage of the original image located at 0,0 in the new image.
-     * If a bgColor is supplied, composite the original image over that
-     * color with a SrcOver operation, otherwise make a SrcNoEa copy.
+    /**
+     * Return a non-accelerated BufferedImage of the requested type with the
+     * indicated subimage of the original image located at 0,0 in the new image.
+     * If a bgColor is supplied, composite the original image over that color
+     * with a SrcOver operation, otherwise make a SrcNoEa copy.
+     * <p>
+     * Returned BufferedImage is not accelerated for two reasons:
+     * <ul>
+     * <li> Types of the image and surface are predefined, because these types
+     *      correspond to the TransformHelpers, which we know we have. And
+     *      acceleration can change the type of the surface
+     * <li> Image will be used only once and acceleration caching wouldn't help
+     * </ul>
      */
     BufferedImage makeBufferedImage(Image img, Color bgColor, int type,
                                     int sx1, int sy1, int sx2, int sy2)
@@ -324,6 +332,7 @@
         final BufferedImage bimg = new BufferedImage(width, height, type);
         final SunGraphics2D g2d = (SunGraphics2D) bimg.createGraphics();
         g2d.setComposite(AlphaComposite.Src);
+        bimg.setAccelerationPriority(0);
         if (bgColor != null) {
             g2d.setColor(bgColor);
             g2d.fillRect(0, 0, width, height);
--- a/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -31,6 +31,7 @@
 import java.util.Base64;
 import java.util.HashMap;
 import sun.net.www.HeaderParser;
+import sun.util.logging.PlatformLogger;
 import static sun.net.www.protocol.http.AuthScheme.NEGOTIATE;
 import static sun.net.www.protocol.http.AuthScheme.KERBEROS;
 
@@ -44,6 +45,7 @@
 class NegotiateAuthentication extends AuthenticationInfo {
 
     private static final long serialVersionUID = 100L;
+    private static final PlatformLogger logger = HttpURLConnection.getHttpLogger();
 
     final private HttpCallerInfo hci;
 
@@ -79,6 +81,31 @@
     }
 
     /**
+     * Find out if the HttpCallerInfo supports Negotiate protocol.
+     * @return true if supported
+     */
+    public static boolean isSupported(HttpCallerInfo hci) {
+        ClassLoader loader = null;
+        try {
+            loader = Thread.currentThread().getContextClassLoader();
+        } catch (SecurityException se) {
+            if (logger.isLoggable(PlatformLogger.Level.FINER)) {
+                logger.finer("NegotiateAuthentication: " +
+                    "Attempt to get the context class loader failed - " + se);
+            }
+        }
+
+        if (loader != null) {
+            // Lock on the class loader instance to avoid the deadlock engaging
+            // the lock in "ClassLoader.loadClass(String, boolean)" method.
+            synchronized (loader) {
+                return isSupportedImpl(hci);
+            }
+        }
+        return isSupportedImpl(hci);
+    }
+
+    /**
      * Find out if the HttpCallerInfo supports Negotiate protocol. In order to
      * find out yes or no, an initialization of a Negotiator object against it
      * is tried. The generated object will be cached under the name of ths
@@ -89,7 +116,7 @@
      *
      * @return true if supported
      */
-    synchronized public static boolean isSupported(HttpCallerInfo hci) {
+    private static synchronized boolean isSupportedImpl(HttpCallerInfo hci) {
         if (supported == null) {
             supported = new HashMap <String, Boolean>();
             cache = new HashMap <String, Negotiator>();
--- a/src/share/classes/sun/nio/ch/PendingFuture.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/nio/ch/PendingFuture.java	Thu May 01 14:21:29 2014 -0700
@@ -35,8 +35,6 @@
  */
 
 final class PendingFuture<V,A> implements Future<V> {
-    private static final CancellationException CANCELLED =
-        new CancellationException();
 
     private final AsynchronousChannel channel;
     private final CompletionHandler<V,? super A> handler;
@@ -180,7 +178,7 @@
                 latch.await();
         }
         if (exc != null) {
-            if (exc == CANCELLED)
+            if (exc instanceof CancellationException)
                 throw new CancellationException();
             throw new ExecutionException(exc);
         }
@@ -197,7 +195,7 @@
                 if (!latch.await(timeout, unit)) throw new TimeoutException();
         }
         if (exc != null) {
-            if (exc == CANCELLED)
+            if (exc instanceof CancellationException)
                 throw new CancellationException();
             throw new ExecutionException(exc);
         }
@@ -205,7 +203,7 @@
     }
 
     Throwable exception() {
-        return (exc != CANCELLED) ? exc : null;
+        return (exc instanceof CancellationException) ? null : exc;
     }
 
     V value() {
@@ -214,7 +212,7 @@
 
     @Override
     public boolean isCancelled() {
-        return (exc == CANCELLED);
+        return (exc instanceof CancellationException);
     }
 
     @Override
@@ -233,7 +231,7 @@
                 ((Cancellable)channel()).onCancel(this);
 
             // set result and cancel timer
-            exc = CANCELLED;
+            exc = new CancellationException();
             haveResult = true;
             if (timeoutTask != null)
                 timeoutTask.cancel(false);
--- a/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -113,7 +113,6 @@
 
         try {
             Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
-            // Cannot generate key here, please don't use Cipher.UNWRAP_MODE!
             cipher.init(Cipher.UNWRAP_MODE, privateKey,
                     new TlsRsaPremasterSecretParameterSpec(
                             maxVersion.v, currentVersion.v),
--- a/src/share/classes/sun/swing/SwingUtilities2.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/classes/sun/swing/SwingUtilities2.java	Thu May 01 14:21:29 2014 -0700
@@ -25,13 +25,11 @@
 
 package sun.swing;
 
-import java.security.*;
 import java.lang.reflect.*;
 import java.awt.*;
 import static java.awt.RenderingHints.*;
 import java.awt.event.*;
 import java.awt.font.*;
-import java.awt.geom.*;
 import java.awt.print.PrinterGraphics;
 import java.text.CharacterIterator;
 import java.text.AttributedCharacterIterator;
@@ -48,11 +46,8 @@
 import javax.swing.tree.TreeModel;
 import javax.swing.tree.TreePath;
 
-import sun.swing.PrintColorUIResource;
-import sun.swing.ImageIconUIResource;
 import sun.print.ProxyPrintGraphics;
 import sun.awt.*;
-import sun.security.action.GetPropertyAction;
 import java.io.*;
 import java.util.*;
 import sun.font.FontDesignMetrics;
@@ -924,6 +919,77 @@
         return retVal;
     }
 
+    /**
+     * This method should be used for drawing a borders over a filled rectangle.
+     * Draws vertical line, using the current color, between the points {@code
+     * (x, y1)} and {@code (x, y2)} in graphics context's coordinate system.
+     * Note: it use {@code Graphics.fillRect()} internally.
+     *
+     * @param g  Graphics to draw the line to.
+     * @param x  the <i>x</i> coordinate.
+     * @param y1 the first point's <i>y</i> coordinate.
+     * @param y2 the second point's <i>y</i> coordinate.
+     */
+    public static void drawVLine(Graphics g, int x, int y1, int y2) {
+        if (y2 < y1) {
+            final int temp = y2;
+            y2 = y1;
+            y1 = temp;
+        }
+        g.fillRect(x, y1, 1, y2 - y1 + 1);
+    }
+
+    /**
+     * This method should be used for drawing a borders over a filled rectangle.
+     * Draws horizontal line, using the current color, between the points {@code
+     * (x1, y)} and {@code (x2, y)} in graphics context's coordinate system.
+     * Note: it use {@code Graphics.fillRect()} internally.
+     *
+     * @param g  Graphics to draw the line to.
+     * @param x1 the first point's <i>x</i> coordinate.
+     * @param x2 the second point's <i>x</i> coordinate.
+     * @param y  the <i>y</i> coordinate.
+     */
+    public static void drawHLine(Graphics g, int x1, int x2, int y) {
+        if (x2 < x1) {
+            final int temp = x2;
+            x2 = x1;
+            x1 = temp;
+        }
+        g.fillRect(x1, y, x2 - x1 + 1, 1);
+    }
+
+    /**
+     * This method should be used for drawing a borders over a filled rectangle.
+     * Draws the outline of the specified rectangle. The left and right edges of
+     * the rectangle are at {@code x} and {@code x + w}. The top and bottom
+     * edges are at {@code y} and {@code y + h}. The rectangle is drawn using
+     * the graphics context's current color. Note: it use {@code
+     * Graphics.fillRect()} internally.
+     *
+     * @param g Graphics to draw the rectangle to.
+     * @param x the <i>x</i> coordinate of the rectangle to be drawn.
+     * @param y the <i>y</i> coordinate of the rectangle to be drawn.
+     * @param w the w of the rectangle to be drawn.
+     * @param h the h of the rectangle to be drawn.
+     * @see SwingUtilities2#drawVLine(java.awt.Graphics, int, int, int)
+     * @see SwingUtilities2#drawHLine(java.awt.Graphics, int, int, int)
+     */
+    public static void drawRect(Graphics g, int x, int y, int w, int h) {
+        if (w < 0 || h < 0) {
+            return;
+        }
+
+        if (h == 0 || w == 0) {
+            g.fillRect(x, y, w + 1, h + 1);
+        } else {
+            g.fillRect(x, y, w, 1);
+            g.fillRect(x + w, y, 1, h);
+            g.fillRect(x + 1, y + h, w, 1);
+            g.fillRect(x, y + 1, 1, h);
+        }
+    }
+
     private static TextLayout createTextLayout(JComponent c, String s,
                                             Font f, FontRenderContext frc) {
         Object shaper = (c == null ?
--- a/src/share/native/sun/java2d/loops/TransformHelper.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/native/sun/java2d/loops/TransformHelper.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -384,6 +384,7 @@
         return;
     }
     Region_IntersectBounds(&clipInfo, &dstInfo.bounds);
+    Transform_GetInfo(env, itxform, &itxInfo);
 
     numedges = (((jlong) dstInfo.bounds.y2) - ((jlong) dstInfo.bounds.y1));
     if (numedges <= 0) {
@@ -423,7 +424,6 @@
         return;
     }
 
-    Transform_GetInfo(env, itxform, &itxInfo);
 
     if (!Region_IsEmpty(&clipInfo)) {
         srcOps->GetRasInfo(env, srcOps, &srcInfo);
--- a/src/share/native/sun/java2d/opengl/OGLSurfaceData.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/share/native/sun/java2d/opengl/OGLSurfaceData.c	Thu May 01 14:21:29 2014 -0700
@@ -543,7 +543,9 @@
     }
 
     JNU_SetFieldByName(env, NULL, sdObject, "nativeWidth", "I", width);
-    JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);
+    if (!((*env)->ExceptionOccurred(env))) {
+        JNU_SetFieldByName(env, NULL, sdObject, "nativeHeight", "I", height);
+    }
 
     (*env)->DeleteLocalRef(env, sdObject);
 }
--- a/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Thu May 01 14:21:29 2014 -0700
@@ -548,6 +548,7 @@
         }
     }
 
+    @SuppressWarnings("fallthrough")
     public void handleEvent(java.awt.AWTEvent e) {
         if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled())  {
             if (e instanceof MouseEvent) {
--- a/src/solaris/classes/sun/awt/X11/XWM.java	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/classes/sun/awt/X11/XWM.java	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -1112,6 +1112,7 @@
      * Therefore, a compound state is just ICONIFIED | anything else.
      *
      */
+    @SuppressWarnings("fallthrough")
     boolean supportsExtendedState(int state) {
         switch (state) {
           case Frame.MAXIMIZED_VERT:
@@ -1131,6 +1132,7 @@
                       return true;
                   }
               }
+              /* FALLTROUGH */
           default:
               return false;
         }
--- a/src/solaris/native/sun/awt/CUPSfuncs.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/CUPSfuncs.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -213,6 +213,8 @@
 
     name = (*env)->GetStringUTFChars(env, printer, NULL);
     if (name == NULL) {
+        (*env)->ExceptionClear(env);
+        JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
         return NULL;
     }
 
@@ -220,12 +222,10 @@
     // unlink() must be caled to remove the file when finished using it.
     filename = j2d_cupsGetPPD(name);
     (*env)->ReleaseStringUTFChars(env, printer, name);
+    CHECK_NULL_RETURN(filename, NULL);
 
     cls = (*env)->FindClass(env, "java/lang/String");
-
-    if (filename == NULL) {
-        return NULL;
-    }
+    CHECK_NULL_RETURN(cls, NULL);
 
     if ((ppd = j2d_ppdOpenFile(filename)) == NULL) {
         unlink(filename);
@@ -249,6 +249,7 @@
             unlink(filename);
             j2d_ppdClose(ppd);
             DPRINTF("CUPSfuncs::bad alloc new array\n", "")
+            (*env)->ExceptionClear(env);
             JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
             return NULL;
         }
@@ -323,6 +324,11 @@
     ppd_size_t *size;
 
     const char *name = (*env)->GetStringUTFChars(env, printer, NULL);
+    if (name == NULL) {
+        (*env)->ExceptionClear(env);
+        JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
+        return NULL;
+    }
     const char *filename;
     int i;
     jobjectArray sizeArray = NULL;
@@ -332,9 +338,7 @@
     // unlink() must be called to remove the file after using it.
     filename = j2d_cupsGetPPD(name);
     (*env)->ReleaseStringUTFChars(env, printer, name);
-    if (filename == NULL) {
-        return NULL;
-    }
+    CHECK_NULL_RETURN(filename, NULL);
     if ((ppd = j2d_ppdOpenFile(filename)) == NULL) {
         unlink(filename);
         DPRINTF("unable to open PPD  %s\n", filename)
@@ -350,11 +354,19 @@
             unlink(filename);
             j2d_ppdClose(ppd);
             DPRINTF("CUPSfuncs::bad alloc new float array\n", "")
+            (*env)->ExceptionClear(env);
             JNU_ThrowOutOfMemoryError(env, "OutOfMemoryError");
             return NULL;
         }
 
         dims = (*env)->GetFloatArrayElements(env, sizeArray, NULL);
+        if (dims == NULL) {
+            unlink(filename);
+            j2d_ppdClose(ppd);
+            (*env)->ExceptionClear(env);
+            JNU_ThrowOutOfMemoryError(env, "Could not create printer name");
+            return NULL;
+        }
         for (i = 0; i<option->num_choices; i++) {
             choice = (option->choices)+i;
             size = j2d_ppdPageSize(ppd, choice->choice);
--- a/src/solaris/native/sun/awt/X11Color.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/X11Color.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -892,11 +892,10 @@
     jmethodID mid;
 
     clazz = (*env)->FindClass(env,"java/awt/color/ColorSpace");
+    CHECK_NULL_RETURN(clazz, NULL);
     mid = (*env)->GetStaticMethodID(env, clazz, "getInstance",
                                     "(I)Ljava/awt/color/ColorSpace;");
-    if (mid == NULL) {
-        return NULL;
-    }
+    CHECK_NULL_RETURN(mid, NULL);
 
     /* SECURITY: This is safe, because static methods cannot
      *           be overridden, and this method does not invoke
@@ -919,6 +918,11 @@
         (aData->awt_depth >= 15))
     {
         clazz = (*env)->FindClass(env,"java/awt/image/DirectColorModel");
+        if (clazz == NULL) {
+            (*env)->PopLocalFrame(env, 0);
+            return NULL;
+        }
+
         if (!aData->isTranslucencySupported) {
 
             mid = (*env)->GetMethodID(env,clazz,"<init>","(IIIII)V");
@@ -1005,6 +1009,10 @@
         }
 
         clazz = (*env)->FindClass(env,"java/awt/image/ComponentColorModel");
+        if (clazz == NULL) {
+            (*env)->PopLocalFrame(env, 0);
+            return NULL;
+        }
 
         mid = (*env)->GetMethodID(env,clazz,"<init>",
             "(Ljava/awt/color/ColorSpace;[IZZII)V");
@@ -1253,6 +1261,7 @@
     if (!JNU_IsNull(env,this))
     {
         SYSCLR_class = (*env)->FindClass(env, "java/awt/SystemColor");
+        CHECK_NULL_RETURN(SYSCLR_class, 0);
 
         if ((*env)->IsInstanceOf(env, this, SYSCLR_class)) {
                 /* SECURITY: This is safe, because there is no way
@@ -1264,6 +1273,7 @@
                                           ,this
                                           ,"getRGB"
                                           ,"()I").i;
+                JNU_CHECK_EXCEPTION_RETURN(env, 0);
         } else {
                 col = (int)(*env)->GetIntField(env,this,colorValueID);
         }
@@ -1370,6 +1380,8 @@
             AWT_UNLOCK ();
         }
         sysColors = (*env)->FindClass (env, "java/awt/SystemColor");
+        CHECK_NULL(sysColors);
+
         if (lock) {
             AWT_LOCK ();
         }
@@ -1377,6 +1389,13 @@
                                                    "systemColors",
                                                    "[I");
 
+        if (colorID == NULL) {
+            if (lock) {
+                AWT_UNLOCK();
+            }
+            return;
+        }
+
         colors = (jintArray) (*env)->GetStaticObjectField
                                                 (env, sysColors, colorID);
 
--- a/src/solaris/native/sun/awt/awt.h	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt.h	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -77,8 +77,22 @@
 
 #define AWT_LOCK_IMPL() \
     (*env)->CallStaticVoidMethod(env, tkClass, awtLockMID)
+
 #define AWT_NOFLUSH_UNLOCK_IMPL() \
-    (*env)->CallStaticVoidMethod(env, tkClass, awtUnlockMID)
+    do { \
+      jthrowable pendingException; \
+      if ((pendingException = (*env)->ExceptionOccurred(env)) != NULL) { \
+         (*env)->ExceptionClear(env); \
+      } \
+      (*env)->CallStaticVoidMethod(env, tkClass, awtUnlockMID); \
+      if (pendingException) { \
+         if ((*env)->ExceptionCheck(env)) { \
+            (*env)->ExceptionDescribe(env); \
+            (*env)->ExceptionClear(env); \
+         } \
+         (*env)->Throw(env, pendingException); \
+      } \
+    } while (0)
 #define AWT_WAIT_IMPL(tm) \
     (*env)->CallStaticVoidMethod(env, tkClass, awtWaitMID, (jlong)(tm))
 #define AWT_NOTIFY_IMPL() \
--- a/src/solaris/native/sun/awt/awt_AWTEvent.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_AWTEvent.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -49,22 +49,22 @@
 JNIEXPORT void JNICALL
 Java_java_awt_AWTEvent_initIDs(JNIEnv *env, jclass cls)
 {
-    awtEventIDs.bdata = (*env)->GetFieldID(env, cls, "bdata", "[B");
-    awtEventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z");
-    awtEventIDs.id = (*env)->GetFieldID(env, cls, "id", "I");
+    CHECK_NULL(awtEventIDs.bdata = (*env)->GetFieldID(env, cls, "bdata", "[B"));
+    CHECK_NULL(awtEventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z"));
+    CHECK_NULL(awtEventIDs.id = (*env)->GetFieldID(env, cls, "id", "I"));
 }
 
 JNIEXPORT void JNICALL
 Java_java_awt_event_InputEvent_initIDs(JNIEnv *env, jclass cls)
 {
-    inputEventIDs.modifiers = (*env)->GetFieldID(env, cls, "modifiers", "I");
+    CHECK_NULL(inputEventIDs.modifiers = (*env)->GetFieldID(env, cls, "modifiers", "I"));
 }
 
 JNIEXPORT void JNICALL
 Java_java_awt_event_KeyEvent_initIDs(JNIEnv *env, jclass cls)
 {
-    keyEventIDs.keyCode = (*env)->GetFieldID(env, cls, "keyCode", "I");
-    keyEventIDs.keyChar = (*env)->GetFieldID(env, cls, "keyChar", "C");
+    CHECK_NULL(keyEventIDs.keyCode = (*env)->GetFieldID(env, cls, "keyCode", "I"));
+    CHECK_NULL(keyEventIDs.keyChar = (*env)->GetFieldID(env, cls, "keyChar", "C"));
 }
 
 JNIEXPORT void JNICALL
--- a/src/solaris/native/sun/awt/awt_DrawingSurface.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_DrawingSurface.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -78,6 +78,8 @@
 
     /* Make sure the target is a java.awt.Component */
     componentClass = (*env)->FindClass(env, "java/awt/Component");
+    CHECK_NULL_RETURN(componentClass, (jint)JAWT_LOCK_ERROR);
+
     if (!(*env)->IsInstanceOf(env, target, componentClass)) {
 #ifdef DEBUG
             fprintf(stderr, "Target is not a component\n");
@@ -126,6 +128,8 @@
 
     /* Make sure the target is a java.awt.Component */
     componentClass = (*env)->FindClass(env, "java/awt/Component");
+    CHECK_NULL_RETURN(componentClass, (int32_t) 0);
+
     if (!(*env)->IsInstanceOf(env, target, componentClass)) {
 #ifdef DEBUG
         fprintf(stderr, "DrawingSurface target must be a component\n");
@@ -195,6 +199,8 @@
 
     /* Make sure the target is a java.awt.Component */
     componentClass = (*env)->FindClass(env, "java/awt/Component");
+    CHECK_NULL_RETURN(componentClass, NULL);
+
     if (!(*env)->IsInstanceOf(env, target, componentClass)) {
 #ifdef DEBUG
         fprintf(stderr, "DrawingSurface target must be a component\n");
@@ -292,6 +298,8 @@
 
     /* Make sure the target component is a java.awt.Component */
     componentClass = (*env)->FindClass(env, "java/awt/Component");
+    CHECK_NULL_RETURN(componentClass, NULL);
+
     if (!(*env)->IsInstanceOf(env, target, componentClass)) {
 #ifdef DEBUG
         fprintf(stderr,
@@ -354,6 +362,10 @@
     if (window != None) {
         peer = JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XToolkit",
             "windowToXWindow", "(J)Lsun/awt/X11/XBaseWindow;", (jlong)window).l;
+        if ((*env)->ExceptionCheck(env)) {
+            AWT_UNLOCK();
+            return (jobject)NULL;
+        }
     }
     if ((peer != NULL) &&
         (JNU_IsInstanceOfByName(env, peer, "sun/awt/X11/XWindow") == 1)) {
@@ -361,6 +373,7 @@
     }
 
     if (target == NULL) {
+        (*env)->ExceptionClear(env);
         JNU_ThrowNullPointerException(env, "NullPointerException");
         AWT_UNLOCK();
         return (jobject)NULL;
--- a/src/solaris/native/sun/awt/awt_Font.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_Font.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -86,14 +86,13 @@
 #ifndef HEADLESS
     /** We call "NoClientCode" methods because they won't invoke client
         code on the privileged toolkit thread **/
-    fontIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J");
-    fontIDs.style = (*env)->GetFieldID(env, cls, "style", "I");
-    fontIDs.size = (*env)->GetFieldID(env, cls, "size", "I");
-    fontIDs.getPeer = (*env)->GetMethodID(env, cls, "getPeer_NoClientCode",
-                                           "()Ljava/awt/peer/FontPeer;");
-    fontIDs.getFamily =
-      (*env)->GetMethodID(env, cls, "getFamily_NoClientCode",
-                                            "()Ljava/lang/String;");
+    CHECK_NULL(fontIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J"));
+    CHECK_NULL(fontIDs.style = (*env)->GetFieldID(env, cls, "style", "I"));
+    CHECK_NULL(fontIDs.size = (*env)->GetFieldID(env, cls, "size", "I"));
+    CHECK_NULL(fontIDs.getPeer = (*env)->GetMethodID(env, cls, "getPeer_NoClientCode",
+                                                     "()Ljava/awt/peer/FontPeer;"));
+    CHECK_NULL(fontIDs.getFamily = (*env)->GetMethodID(env, cls, "getFamily_NoClientCode",
+                                                       "()Ljava/lang/String;"));
 #endif /* !HEADLESS */
 }
 
@@ -120,12 +119,10 @@
   (JNIEnv *env, jclass cls)
 {
 #ifndef HEADLESS
-    fontDescriptorIDs.nativeName =
-      (*env)->GetFieldID(env, cls, "nativeName",
-                         "Ljava/lang/String;");
-    fontDescriptorIDs.charsetName =
-      (*env)->GetFieldID(env, cls, "charsetName",
-                         "Ljava/lang/String;");
+    CHECK_NULL(fontDescriptorIDs.nativeName =
+               (*env)->GetFieldID(env, cls, "nativeName", "Ljava/lang/String;"));
+    CHECK_NULL(fontDescriptorIDs.charsetName =
+               (*env)->GetFieldID(env, cls, "charsetName", "Ljava/lang/String;"));
 #endif /* !HEADLESS */
 }
 
@@ -144,20 +141,18 @@
   (JNIEnv *env, jclass cls)
 {
 #ifndef HEADLESS
-    platformFontIDs.componentFonts =
-      (*env)->GetFieldID(env, cls, "componentFonts",
-                         "[Lsun/awt/FontDescriptor;");
-    platformFontIDs.fontConfig =
-      (*env)->GetFieldID(env,cls, "fontConfig",
-                         "Lsun/awt/FontConfiguration;");
-
-    platformFontIDs.makeConvertedMultiFontString =
-      (*env)->GetMethodID(env, cls, "makeConvertedMultiFontString",
-                          "(Ljava/lang/String;)[Ljava/lang/Object;");
-
-    platformFontIDs.makeConvertedMultiFontChars =
-      (*env)->GetMethodID(env, cls, "makeConvertedMultiFontChars",
-                          "([CII)[Ljava/lang/Object;");
+    CHECK_NULL(platformFontIDs.componentFonts =
+               (*env)->GetFieldID(env, cls, "componentFonts",
+                                  "[Lsun/awt/FontDescriptor;"));
+    CHECK_NULL(platformFontIDs.fontConfig =
+               (*env)->GetFieldID(env,cls, "fontConfig",
+                                  "Lsun/awt/FontConfiguration;"));
+    CHECK_NULL(platformFontIDs.makeConvertedMultiFontString =
+               (*env)->GetMethodID(env, cls, "makeConvertedMultiFontString",
+                                   "(Ljava/lang/String;)[Ljava/lang/Object;"));
+    CHECK_NULL(platformFontIDs.makeConvertedMultiFontChars =
+               (*env)->GetMethodID(env, cls, "makeConvertedMultiFontChars",
+                                   "([CII)[Ljava/lang/Object;"));
 #endif /* !HEADLESS */
 }
 
@@ -385,6 +380,11 @@
         return 0;
     }
     cname = (char *) JNU_GetStringPlatformChars(env, name, NULL);
+    if (cname == NULL) {
+        (*env)->ExceptionClear(env);
+        JNU_ThrowOutOfMemoryError(env, "Could not create font name");
+        return 0;
+    }
 
     /* additional default font names */
     if (strcmp(cname, "serif") == 0) {
@@ -448,6 +448,8 @@
     }
 
     if (!JNU_IsNull(env, font) && awtJNI_IsMultiFont(env, font)) {
+        JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+
         struct FontData *fdata = NULL;
         int32_t i, size;
         char *fontsetname = NULL;
@@ -492,7 +494,12 @@
 
             if (!JNU_IsNull(env, fontDescriptorName)) {
                 nativename = (char *) JNU_GetStringPlatformChars(env, fontDescriptorName, NULL);
-                doFree = TRUE;
+                if (nativename == NULL) {
+                    nativename = "";
+                    doFree = FALSE;
+                } else {
+                    doFree = TRUE;
+                }
             } else {
                 nativename = "";
                 doFree = FALSE;
@@ -516,6 +523,11 @@
 
             fdata->flist[i].charset_name = (char *)
                 JNU_GetStringPlatformChars(env, charsetName, NULL);
+            if (fdata->flist[i].charset_name == NULL) {
+                (*env)->ExceptionClear(env);
+                JNU_ThrowOutOfMemoryError(env, "Could not create charset name");
+                return NULL;
+            }
 
             /* We are done with the objects. */
             (*env)->DeleteLocalRef(env, fontDescriptor);
@@ -543,6 +555,19 @@
                     fdata->xfont = fdata->flist[i].xfont;
                     fdata->flist[i].index_length = 1;
                 } else {
+                    /* Free any already allocated storage and fonts */
+                    int j = i;
+                    for (j = 0; j <= i; j++) {
+                        free((void *)fdata->flist[j].xlfd);
+                        JNU_ReleaseStringPlatformChars(env, NULL,
+                            fdata->flist[j].charset_name);
+                        if (fdata->flist[j].load) {
+                            XFreeFont(awt_display, fdata->flist[j].xfont);
+                        }
+                    }
+                    free((void *)fdata->flist);
+                    free((void *)fdata);
+
                     if (errmsg != NULL) {
                         *errmsg = "java/lang" "NullPointerException";
                     }
--- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Thu May 01 14:21:29 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
@@ -152,8 +152,11 @@
     x11GraphicsConfigIDs.screen = NULL;
 
     x11GraphicsConfigIDs.aData = (*env)->GetFieldID (env, cls, "aData", "J");
+    CHECK_NULL(x11GraphicsConfigIDs.aData);
     x11GraphicsConfigIDs.bitsPerPixel = (*env)->GetFieldID (env, cls, "bitsPerPixel", "I");
+    CHECK_NULL(x11GraphicsConfigIDs.bitsPerPixel);
     x11GraphicsConfigIDs.screen = (*env)->GetFieldID (env, cls, "screen", "Lsun/awt/X11GraphicsDevice;");
+    CHECK_NULL(x11GraphicsConfigIDs.screen);
 
     if (x11GraphicsConfigIDs.aData == NULL ||
             x11GraphicsConfigIDs.bitsPerPixel == NULL ||
@@ -1346,7 +1349,6 @@
 
     /* Make Color Model object for this GraphicsConfiguration */
     colorModel = awtJNI_GetColorModel (env, adata);
-
     AWT_UNLOCK ();
 
     return colorModel;
@@ -1374,6 +1376,7 @@
         JNU_GetLongFieldAsPtr(env, this, x11GraphicsConfigIDs.aData);
 
     clazz = (*env)->FindClass(env, "java/awt/Rectangle");
+    CHECK_NULL_RETURN(clazz, NULL);
     mid = (*env)->GetMethodID(env, clazz, "<init>", "(IIII)V");
     if (mid != NULL) {
         if (usingXinerama) {
@@ -1543,7 +1546,7 @@
     clazz = (*env)->GetObjectClass(env, this);
     midAddVisual = (*env)->GetMethodID(env, clazz, "addDoubleBufferVisual",
         "(I)V");
-
+    CHECK_NULL(midAddVisual);
     AWT_LOCK();
     rootWindow = RootWindow(awt_display, xinawareScreen);
     visScreenInfo = XdbeGetVisualInfo(awt_display, &rootWindow, &n);
@@ -1739,6 +1742,7 @@
     jint validRefreshRate = refreshRate;
 
     displayModeClass = (*env)->FindClass(env, "java/awt/DisplayMode");
+    CHECK_NULL_RETURN(displayModeClass, NULL);
     if (JNU_IsNull(env, displayModeClass)) {
         JNU_ThrowInternalError(env,
                                "Could not get display mode class");
@@ -1746,6 +1750,7 @@
     }
 
     cid = (*env)->GetMethodID(env, displayModeClass, "<init>", "(IIII)V");
+    CHECK_NULL_RETURN(cid, NULL);
     if (cid == NULL) {
         JNU_ThrowInternalError(env,
                                "Could not get display mode constructor");
@@ -1779,6 +1784,7 @@
         }
         mid = (*env)->GetMethodID(env, arrayListClass, "add",
                                   "(Ljava/lang/Object;)Z");
+        CHECK_NULL(mid);
         if (mid == NULL) {
             JNU_ThrowInternalError(env,
                 "Could not get method java.util.ArrayList.add()");
@@ -1955,6 +1961,9 @@
                                          size.height,
                                          BIT_DEPTH_MULTI,
                                          rates[j]);
+                    if ((*env)->ExceptionCheck(env)) {
+                        break;
+                    }
                 }
             }
         }
--- a/src/solaris/native/sun/awt/awt_InputMethod.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_InputMethod.c	Thu May 01 14:21:29 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
@@ -319,6 +319,7 @@
         JNU_CallMethodByName(env, NULL, pX11IMData->x11inputmethod,
                              "flushText",
                              "()V");
+        JNU_CHECK_EXCEPTION_RETURN(env, NULL);
         /* IMPORTANT:
            The order of the following calls is critical since "imInstance" may
            point to the global reference itself, if "freeX11InputMethodData" is called
@@ -1120,6 +1121,9 @@
         if (text->string.multi_byte != NULL) {
             if (pre_draw->text->encoding_is_wchar == False) {
                 javastr = JNU_NewStringPlatform(env, (const char *)text->string.multi_byte);
+                if (javastr == NULL) {
+                    goto finally;
+                }
             } else {
                 char *mbstr = wcstombsdmp(text->string.wide_char, text->length);
                 if (mbstr == NULL) {
@@ -1127,6 +1131,9 @@
                 }
                 javastr = JNU_NewStringPlatform(env, (const char *)mbstr);
                 free(mbstr);
+                if (javastr == NULL) {
+                    goto finally;
+                }
             }
         }
         if (text->feedback != NULL) {
@@ -1135,6 +1142,7 @@
 
             style = (*env)->NewIntArray(env, text->length);
             if (JNU_IsNull(env, style)) {
+                (*env)->ExceptionClear(env);
                 THROW_OUT_OF_MEMORY_ERROR();
                 goto finally;
             }
@@ -1395,14 +1403,17 @@
     pX11IMData->lookup_buf = 0;
     pX11IMData->lookup_buf_len = 0;
 
-    if (createXIC(env, pX11IMData, (Window)window)
-        == False) {
+    if (createXIC(env, pX11IMData, (Window)window) == False) {
         destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData);
         pX11IMData = (X11InputMethodData *) NULL;
+        if ((*env)->ExceptionCheck(env)) {
+            goto finally;
+        }
     }
 
     setX11InputMethodData(env, this, pX11IMData);
 
+finally:
     AWT_UNLOCK();
     return (pX11IMData != NULL);
 }
--- a/src/solaris/native/sun/awt/awt_Insets.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_Insets.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -34,8 +34,8 @@
 JNIEXPORT void JNICALL
 Java_java_awt_Insets_initIDs(JNIEnv *env, jclass cls)
 {
-    insetsIDs.top = (*env)->GetFieldID(env, cls, "top", "I");
-    insetsIDs.bottom = (*env)->GetFieldID(env, cls, "bottom", "I");
-    insetsIDs.left = (*env)->GetFieldID(env, cls, "left", "I");
-    insetsIDs.right = (*env)->GetFieldID(env, cls, "right", "I");
+    CHECK_NULL(insetsIDs.top = (*env)->GetFieldID(env, cls, "top", "I"));
+    CHECK_NULL(insetsIDs.bottom = (*env)->GetFieldID(env, cls, "bottom", "I"));
+    CHECK_NULL(insetsIDs.left = (*env)->GetFieldID(env, cls, "left", "I"));
+    CHECK_NULL(insetsIDs.right = (*env)->GetFieldID(env, cls, "right", "I"));
 }
--- a/src/solaris/native/sun/awt/awt_LoadLibrary.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_LoadLibrary.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -77,11 +77,16 @@
     return isHeadless;
 }
 
+#define CHECK_EXCEPTION_FATAL(env, message) \
+    if ((*env)->ExceptionCheck(env)) { \
+        (*env)->ExceptionClear(env); \
+        (*env)->FatalError(env, message); \
+    }
+
 /*
  * Pathnames to the various awt toolkits
  */
 
-
 #ifdef MACOSX
   #define LWAWT_PATH "/libawt_lwawt.dylib"
   #define DEFAULT_PATH LWAWT_PATH
@@ -125,6 +130,8 @@
      */
 
     fmProp = (*env)->NewStringUTF(env, "sun.font.fontmanager");
+    CHECK_EXCEPTION_FATAL(env, "Could not allocate font manager property");
+
 #ifdef MACOSX
         fmanager = (*env)->NewStringUTF(env, "sun.font.CFontManager");
         tk = LWAWT_PATH;
@@ -132,10 +139,13 @@
         fmanager = (*env)->NewStringUTF(env, "sun.awt.X11FontManager");
         tk = XAWT_PATH;
 #endif
+    CHECK_EXCEPTION_FATAL(env, "Could not allocate font manager name");
+
     if (fmanager && fmProp) {
         JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "setProperty",
                                    "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;",
                                    fmProp, fmanager);
+        CHECK_EXCEPTION_FATAL(env, "Could not allocate set properties");
     }
 
 #ifndef MACOSX
@@ -154,9 +164,11 @@
         (*env)->DeleteLocalRef(env, fmanager);
     }
 
+    jstring jbuf = JNU_NewStringPlatform(env, buf);
+    CHECK_EXCEPTION_FATAL(env, "Could not allocate library name");
     JNU_CallStaticMethodByName(env, NULL, "java/lang/System", "load",
                                "(Ljava/lang/String;)V",
-                               JNU_NewStringPlatform(env, buf));
+                               jbuf);
 
     awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
 
--- a/src/solaris/native/sun/awt/awt_Robot.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_Robot.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -175,10 +175,13 @@
 
     num_buttons = numberOfButtons;
     tmp = (*env)->GetIntArrayElements(env, buttonDownMasks, JNI_FALSE);
+    CHECK_NULL(tmp);
+
     masks = (jint *)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), num_buttons);
     if (masks == (jint *) NULL) {
+        (*env)->ExceptionClear(env);
+        (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
         JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
-        (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
         return;
     }
     for (i = 0; i < num_buttons; i++) {
--- a/src/solaris/native/sun/awt/awt_UNIXToolkit.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_UNIXToolkit.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -98,6 +98,7 @@
                                           (*env)->GetObjectClass(env, this));
         icon_upcall_method = (*env)->GetMethodID(env, this_class,
                                  "loadIconCallback", "([BIIIIIZ)V");
+        CHECK_NULL_RETURN(icon_upcall_method, JNI_FALSE);
     }
 
     if (pixbuf != NULL)
@@ -112,6 +113,8 @@
 
         /* Copy the data array into a Java structure so we can pass it back. */
         jbyteArray data = (*env)->NewByteArray(env, (row_stride * height));
+        JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
+
         (*env)->SetByteArrayRegion(env, data, 0, (row_stride * height),
                                    (jbyte *)pixbuf_data);
 
--- a/src/solaris/native/sun/awt/awt_util.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_util.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -62,7 +62,7 @@
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
 #endif
 
-void
+jboolean
 awtJNI_ThreadYield(JNIEnv *env) {
 
     static jclass threadClass = NULL;
@@ -76,6 +76,7 @@
         Boolean err = FALSE;
         if (threadClass == NULL) {
             jclass tc = (*env)->FindClass(env, "java/lang/Thread");
+            CHECK_NULL_RETURN(tc, JNI_FALSE);
             threadClass = (*env)->NewGlobalRef(env, tc);
             (*env)->DeleteLocalRef(env, tc);
             if (threadClass != NULL) {
@@ -91,10 +92,11 @@
             err = TRUE;
         }
         if (err) {
-            return;
+            return JNI_FALSE;
         }
     } /* threadClass == NULL*/
 
     (*env)->CallStaticVoidMethod(env, threadClass, yieldMethodID);
     DASSERT(!((*env)->ExceptionOccurred(env)));
+    return JNI_TRUE;
 } /* awtJNI_ThreadYield() */
--- a/src/solaris/native/sun/awt/awt_util.h	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/awt_util.h	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 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
@@ -78,7 +78,7 @@
     int32_t echoC;
 };
 
-extern void awtJNI_ThreadYield(JNIEnv *env);
+extern jboolean awtJNI_ThreadYield(JNIEnv *env);
 
 /*
  * Functions for accessing fields by name and signature
--- a/src/solaris/native/sun/awt/fontpath.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/fontpath.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -161,17 +161,22 @@
 
     if (! isLocalSet) {
       jclass geCls = (*env)->FindClass(env, "java/awt/GraphicsEnvironment");
+      CHECK_NULL_RETURN(geCls, JNI_FALSE);
       jmethodID getLocalGE = (*env)->GetStaticMethodID(env, geCls,
                                                  "getLocalGraphicsEnvironment",
                                            "()Ljava/awt/GraphicsEnvironment;");
+      CHECK_NULL_RETURN(getLocalGE, JNI_FALSE);
       jobject ge = (*env)->CallStaticObjectMethod(env, geCls, getLocalGE);
+      JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
 
       jclass sgeCls = (*env)->FindClass(env,
                                         "sun/java2d/SunGraphicsEnvironment");
+      CHECK_NULL_RETURN(sgeCls, JNI_FALSE);
       if ((*env)->IsInstanceOf(env, ge, sgeCls)) {
         jmethodID isDisplayLocal = (*env)->GetMethodID(env, sgeCls,
                                                        "isDisplayLocal",
                                                        "()Z");
+        JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
         isLocal = (*env)->CallBooleanMethod(env, ge, isDisplayLocal);
       } else {
         isLocal = True;
@@ -1005,50 +1010,38 @@
     jmethodID fcFontCons;
     char* debugMinGlyphsStr = getenv("J2D_DEBUG_MIN_GLYPHS");
 
+    CHECK_NULL(fcInfoObj);
+    CHECK_NULL(fcCompFontArray);
+
     jclass fcInfoClass =
         (*env)->FindClass(env, "sun/font/FontConfigManager$FontConfigInfo");
+    CHECK_NULL(fcInfoClass);
     jclass fcCompFontClass =
         (*env)->FindClass(env, "sun/font/FontConfigManager$FcCompFont");
+    CHECK_NULL(fcCompFontClass);
     jclass fcFontClass =
          (*env)->FindClass(env, "sun/font/FontConfigManager$FontConfigFont");
+    CHECK_NULL(fcFontClass);
 
-    if (fcInfoObj == NULL || fcCompFontArray == NULL || fcInfoClass == NULL ||
-        fcCompFontClass == NULL || fcFontClass == NULL) {
-        return;
-    }
 
-    fcVersionID = (*env)->GetFieldID(env, fcInfoClass, "fcVersion", "I");
-
-    fcCacheDirsID = (*env)->GetFieldID(env, fcInfoClass, "cacheDirs",
-                                       "[Ljava/lang/String;");
-
-    fcNameID = (*env)->GetFieldID(env, fcCompFontClass,
-                                  "fcName", "Ljava/lang/String;");
-    fcFirstFontID =
-        (*env)->GetFieldID(env, fcCompFontClass, "firstFont",
-                           "Lsun/font/FontConfigManager$FontConfigFont;");
-
-    fcAllFontsID =
-        (*env)->GetFieldID(env, fcCompFontClass, "allFonts",
-                           "[Lsun/font/FontConfigManager$FontConfigFont;");
-
-    fcFontCons = (*env)->GetMethodID(env, fcFontClass, "<init>", "()V");
-
-    familyNameID = (*env)->GetFieldID(env, fcFontClass,
-                                      "familyName", "Ljava/lang/String;");
-    styleNameID = (*env)->GetFieldID(env, fcFontClass,
-                                    "styleStr", "Ljava/lang/String;");
-    fullNameID = (*env)->GetFieldID(env, fcFontClass,
-                                    "fullName", "Ljava/lang/String;");
-    fontFileID = (*env)->GetFieldID(env, fcFontClass,
-                                    "fontFile", "Ljava/lang/String;");
-
-    if (fcVersionID == NULL || fcCacheDirsID == NULL || fcNameID == NULL ||
-        fcFirstFontID == NULL || fcAllFontsID == NULL || fcFontCons == NULL ||
-        familyNameID == NULL || styleNameID == NULL || fullNameID == NULL ||
-        fontFileID == NULL) {
-        return;
-    }
+    CHECK_NULL(fcVersionID = (*env)->GetFieldID(env, fcInfoClass, "fcVersion", "I"));
+    CHECK_NULL(fcCacheDirsID = (*env)->GetFieldID(env, fcInfoClass, "cacheDirs",
+                                                  "[Ljava/lang/String;"));
+    CHECK_NULL(fcNameID = (*env)->GetFieldID(env, fcCompFontClass,
+                                             "fcName", "Ljava/lang/String;"));
+    CHECK_NULL(fcFirstFontID = (*env)->GetFieldID(env, fcCompFontClass, "firstFont",
+                                        "Lsun/font/FontConfigManager$FontConfigFont;"));
+    CHECK_NULL(fcAllFontsID = (*env)->GetFieldID(env, fcCompFontClass, "allFonts",
+                                        "[Lsun/font/FontConfigManager$FontConfigFont;"));
+    CHECK_NULL(fcFontCons = (*env)->GetMethodID(env, fcFontClass, "<init>", "()V"));
+    CHECK_NULL(familyNameID = (*env)->GetFieldID(env, fcFontClass,
+                                      "familyName", "Ljava/lang/String;"));
+    CHECK_NULL(styleNameID = (*env)->GetFieldID(env, fcFontClass,
+                                    "styleStr", "Ljava/lang/String;"));
+    CHECK_NULL(fullNameID = (*env)->GetFieldID(env, fcFontClass,
+                                    "fullName", "Ljava/lang/String;"));
+    CHECK_NULL(fontFileID = (*env)->GetFieldID(env, fcFontClass,
+                                    "fontFile", "Ljava/lang/String;"));
 
     if ((libfontconfig = openFontConfig()) == NULL) {
         return;
@@ -1129,6 +1122,8 @@
         if (cacheDirs != NULL) {
             while ((cnt < max) && (cacheDir = (*FcStrListNext)(cacheDirs))) {
                 jstr = (*env)->NewStringUTF(env, (const char*)cacheDir);
+                JNU_CHECK_EXCEPTION(env);
+
                 (*env)->SetObjectArrayElement(env, cacheDirArray, cnt++, jstr);
             }
             (*FcStrListDone)(cacheDirs);
@@ -1136,6 +1131,11 @@
     }
 
     locale = (*env)->GetStringUTFChars(env, localeStr, 0);
+    if (locale == NULL) {
+        (*env)->ExceptionClear(env);
+        JNU_ThrowOutOfMemoryError(env, "Could not create locale");
+        return;
+    }
 
     arrlen = (*env)->GetArrayLength(env, fcCompFontArray);
     for (i=0; i<arrlen; i++) {
--- a/src/solaris/native/sun/awt/gtk2_interface.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/gtk2_interface.c	Thu May 01 14:21:29 2014 -0700
@@ -538,9 +538,7 @@
              fprintf(stderr, "dlsym(gtk_show_uri) returned NULL\n");
 #endif /* INTERNAL_BUILD */
         } else {
-#ifdef __solaris__
             update_supported_actions(env);
-#endif
             success = TRUE;
         }
      }
--- a/src/solaris/native/sun/awt/initIDs.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/initIDs.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, 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
@@ -47,9 +47,6 @@
   (JNIEnv *env, jclass clazz)
 {
     colorValueID = (*env)->GetFieldID(env, clazz, "value", "I");
-
-    if(colorValueID == NULL)
-        JNU_ThrowNullPointerException (env, "Can't get java/awt/Color.value fieldID");
 }
 
 JNIEXPORT void JNICALL
--- a/src/solaris/native/sun/awt/multi_font.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/multi_font.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -74,7 +74,7 @@
     jobject temp = NULL;
     jboolean validRet = JNI_FALSE;
 
-    if ((*env)->EnsureLocalCapacity(env, 2) < 0)
+    if ((*env)->EnsureLocalCapacity(env, 2) < 0 || (*env)->ExceptionCheck(env))
         goto done;
 
     peer = (*env)->CallObjectMethod(env,font,fontIDs.getPeer);
@@ -162,7 +162,7 @@
 
     font = JNU_CallMethodByName(env, NULL, this, "getFont_NoClientCode",
                                 "()Ljava/awt/Font;").l;
-    if (JNU_IsNull(env, font)) {
+    if (JNU_IsNull(env, font) || (*env)->ExceptionCheck(env)) {
         return JNI_FALSE;
     }
 
@@ -318,6 +318,10 @@
     }
 
     fdata = awtJNI_GetFontData(env, font, &err);
+    if ((*env)->ExceptionCheck(env)) {
+        (*env)->DeleteLocalRef(env, dataArray);
+        return 0;
+    }
 
     stringCount = (*env)->GetArrayLength(env, dataArray);
 
@@ -336,6 +340,11 @@
         }
 
         j = awtJNI_GetFontDescriptorNumber(env, font, fontDescriptor);
+        if ((*env)->ExceptionCheck(env)) {
+            (*env)->DeleteLocalRef(env, fontDescriptor);
+            (*env)->DeleteLocalRef(env, data);
+            break;
+        }
 
         if (fdata->flist[j].load == 0) {
             xf = loadFont(awt_display,
@@ -356,6 +365,14 @@
 
         stringData =
             (unsigned char *)(*env)->GetPrimitiveArrayCritical(env, data,NULL);
+        if (stringData == NULL) {
+            (*env)->DeleteLocalRef(env, fontDescriptor);
+            (*env)->DeleteLocalRef(env, data);
+            (*env)->ExceptionClear(env);
+            JNU_ThrowOutOfMemoryError(env, "Could not get string data");
+            break;
+        }
+
         length = (stringData[0] << 24) | (stringData[1] << 16) |
             (stringData[2] << 8) | stringData[3];
         offsetStringData = (char *)(stringData + (4 * sizeof(char)));
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -45,10 +45,12 @@
     filenameFilterCallbackMethodID = (*env)->GetMethodID(env, cx,
             "filenameFilterCallback", "(Ljava/lang/String;)Z");
     DASSERT(filenameFilterCallbackMethodID != NULL);
+    CHECK_NULL(filenameFilterCallbackMethodID);
 
     setFileInternalMethodID = (*env)->GetMethodID(env, cx,
             "setFileInternal", "(Ljava/lang/String;[Ljava/lang/String;)V");
     DASSERT(setFileInternalMethodID != NULL);
+    CHECK_NULL(setFileInternalMethodID);
 
     widgetFieldID = (*env)->GetFieldID(env, cx, "widget", "J");
     DASSERT(widgetFieldID != NULL);
@@ -63,6 +65,7 @@
     env = (JNIEnv *) JNU_GetEnv(jvm, JNI_VERSION_1_2);
 
     filename = (*env)->NewStringUTF(env, filter_info->filename);
+    JNU_CHECK_EXCEPTION_RETURN(env, FALSE);
 
     return (*env)->CallBooleanMethod(env, obj, filenameFilterCallbackMethodID,
             filename);
@@ -173,13 +176,14 @@
 
     stringCls = (*env)->FindClass(env, "java/lang/String");
     if (stringCls == NULL) {
+        (*env)->ExceptionClear(env);
         JNU_ThrowInternalError(env, "Could not get java.lang.String class");
         return NULL;
     }
 
-    array = (*env)->NewObjectArray(env, fp_gtk_g_slist_length(list), stringCls,
-            NULL);
+    array = (*env)->NewObjectArray(env, fp_gtk_g_slist_length(list), stringCls, NULL);
     if (array == NULL) {
+        (*env)->ExceptionClear(env);
         JNU_ThrowInternalError(env, "Could not instantiate array files array");
         return NULL;
     }
@@ -189,7 +193,9 @@
         entry = (char*) iterator->data;
         entry = strrchr(entry, '/') + 1;
         str = (*env)->NewStringUTF(env, entry);
-        (*env)->SetObjectArrayElement(env, array, i, str);
+        if (str && !(*env)->ExceptionCheck(env)) {
+            (*env)->SetObjectArrayElement(env, array, i, str);
+        }
         i++;
     }
 
@@ -215,13 +221,14 @@
 
     stringCls = (*env)->FindClass(env, "java/lang/String");
     if (stringCls == NULL) {
+        (*env)->ExceptionClear(env);
         JNU_ThrowInternalError(env, "Could not get java.lang.String class");
         return NULL;
     }
 
-    array = (*env)->NewObjectArray(env, fp_gtk_g_slist_length(list), stringCls,
-            NULL);
+    array = (*env)->NewObjectArray(env, fp_gtk_g_slist_length(list), stringCls, NULL);
     if (array == NULL) {
+        (*env)->ExceptionClear(env);
         JNU_ThrowInternalError(env, "Could not instantiate array files array");
         return NULL;
     }
@@ -236,7 +243,9 @@
         }
 
         str = (*env)->NewStringUTF(env, entry);
-        (*env)->SetObjectArrayElement(env, array, i, str);
+        if (str && !(*env)->ExceptionCheck(env)) {
+            (*env)->SetObjectArrayElement(env, array, i, str);
+        }
         i++;
     }
 
@@ -268,16 +277,17 @@
     if (full_path_names) {
         //This is a hack for use with "Recent Folders" in gtk where each
         //file could have its own directory.
+        jfilenames = toPathAndFilenamesArray(env, filenames);
         jcurrent_folder = (*env)->NewStringUTF(env, "/");
-        jfilenames = toPathAndFilenamesArray(env, filenames);
     } else {
+        jfilenames = toFilenamesArray(env, filenames);
         jcurrent_folder = (*env)->NewStringUTF(env, current_folder);
-        jfilenames = toFilenamesArray(env, filenames);
     }
-    (*env)->CallVoidMethod(env, obj, setFileInternalMethodID, jcurrent_folder,
-            jfilenames);
+    if (!(*env)->ExceptionCheck(env)) {
+        (*env)->CallVoidMethod(env, obj, setFileInternalMethodID,
+                               jcurrent_folder, jfilenames);
+    }
     fp_g_free(current_folder);
-
     quit(env, (jobject)obj, TRUE);
 }
 
@@ -296,11 +306,17 @@
 
     if (jvm == NULL) {
         (*env)->GetJavaVM(env, &jvm);
+        JNU_CHECK_EXCEPTION(env);
     }
 
     fp_gdk_threads_enter();
 
     const char *title = jtitle == NULL? "": (*env)->GetStringUTFChars(env, jtitle, 0);
+    if (title == NULL) {
+        (*env)->ExceptionClear(env);
+        JNU_ThrowOutOfMemoryError(env, "Could not get title");
+        return;
+    }
 
     if (mode == java_awt_FileDialog_SAVE) {
         /* Save action */
@@ -328,6 +344,11 @@
     /* Set the directory */
     if (jdir != NULL) {
         const char *dir = (*env)->GetStringUTFChars(env, jdir, 0);
+        if (dir == NULL) {
+            (*env)->ExceptionClear(env);
+            JNU_ThrowOutOfMemoryError(env, "Could not get dir");
+            return;
+        }
         fp_gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir);
         (*env)->ReleaseStringUTFChars(env, jdir, dir);
     }
@@ -335,6 +356,11 @@
     /* Set the filename */
     if (jfile != NULL) {
         const char *filename = (*env)->GetStringUTFChars(env, jfile, 0);
+        if (filename == NULL) {
+            (*env)->ExceptionClear(env);
+            JNU_ThrowOutOfMemoryError(env, "Could not get filename");
+            return;
+        }
         if (mode == java_awt_FileDialog_SAVE) {
             fp_gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), filename);
         } else {
--- a/src/solaris/native/sun/xawt/XToolkit.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/xawt/XToolkit.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -40,6 +40,7 @@
 #include "awt_Component.h"
 #include "awt_MenuComponent.h"
 #include "awt_Font.h"
+#include "awt_util.h"
 
 #include "sun_awt_X11_XToolkit.h"
 #include "java_awt_SystemColor.h"
@@ -76,6 +77,8 @@
 #ifndef HEADLESS
 
 extern Display* awt_init_Display(JNIEnv *env, jobject this);
+extern void freeNativeStringArray(char **array, long length);
+extern char** stringArrayToNative(JNIEnv *env, jobjectArray array, jsize * ret_length);
 
 struct XFontPeerIDs xFontPeerIDs;
 
@@ -103,9 +106,11 @@
   (JNIEnv *env, jclass clazz)
 {
     jfieldID fid = (*env)->GetStaticFieldID(env, clazz, "numLockMask", "I");
+    CHECK_NULL(fid);
     awt_NumLockMask = (*env)->GetStaticIntField(env, clazz, fid);
     DTRACE_PRINTLN1("awt_NumLockMask = %u", awt_NumLockMask);
     fid = (*env)->GetStaticFieldID(env, clazz, "modLockIsShiftLock", "I");
+    CHECK_NULL(fid);
     awt_ModLockIsShiftLock = (*env)->GetStaticIntField(env, clazz, fid) != 0 ? True : False;
 }
 
@@ -173,21 +178,31 @@
 
 
     componentIDs.x = (*env)->GetFieldID(env, cls, "x", "I");
+    CHECK_NULL(componentIDs.x);
     componentIDs.y = (*env)->GetFieldID(env, cls, "y", "I");
+    CHECK_NULL(componentIDs.y);
     componentIDs.width = (*env)->GetFieldID(env, cls, "width", "I");
+    CHECK_NULL(componentIDs.width);
     componentIDs.height = (*env)->GetFieldID(env, cls, "height", "I");
+    CHECK_NULL(componentIDs.height);
     componentIDs.isPacked = (*env)->GetFieldID(env, cls, "isPacked", "Z");
+    CHECK_NULL(componentIDs.isPacked);
     componentIDs.peer =
       (*env)->GetFieldID(env, cls, "peer", "Ljava/awt/peer/ComponentPeer;");
+    CHECK_NULL(componentIDs.peer);
     componentIDs.background =
       (*env)->GetFieldID(env, cls, "background", "Ljava/awt/Color;");
+    CHECK_NULL(componentIDs.background);
     componentIDs.foreground =
       (*env)->GetFieldID(env, cls, "foreground", "Ljava/awt/Color;");
+    CHECK_NULL(componentIDs.foreground);
     componentIDs.graphicsConfig =
         (*env)->GetFieldID(env, cls, "graphicsConfig",
                            "Ljava/awt/GraphicsConfiguration;");
+    CHECK_NULL(componentIDs.graphicsConfig);
     componentIDs.name =
       (*env)->GetFieldID(env, cls, "name", "Ljava/lang/String;");
+    CHECK_NULL(componentIDs.name);
 
     /* Use _NoClientCode() methods for trusted methods, so that we
      *  know that we are not invoking client code on trusted threads
@@ -195,19 +210,20 @@
     componentIDs.getParent =
       (*env)->GetMethodID(env, cls, "getParent_NoClientCode",
                          "()Ljava/awt/Container;");
+    CHECK_NULL(componentIDs.getParent);
 
     componentIDs.getLocationOnScreen =
       (*env)->GetMethodID(env, cls, "getLocationOnScreen_NoTreeLock",
                          "()Ljava/awt/Point;");
+    CHECK_NULL(componentIDs.getLocationOnScreen);
 
     keyclass = (*env)->FindClass(env, "java/awt/event/KeyEvent");
-    if (JNU_IsNull(env, keyclass)) {
-        return;
-    }
+    CHECK_NULL(keyclass);
 
     componentIDs.isProxyActive =
         (*env)->GetFieldID(env, keyclass, "isProxyActive",
                            "Z");
+    CHECK_NULL(componentIDs.isProxyActive);
 
     componentIDs.appContext =
         (*env)->GetFieldID(env, cls, "appContext",
@@ -339,7 +355,7 @@
 static void     waitForEvents(JNIEnv *, jlong);
 static void     awt_pipe_init();
 static void     processOneEvent(XtInputMask iMask);
-static void     performPoll(JNIEnv *, jlong);
+static Boolean  performPoll(JNIEnv *, jlong);
 static void     wakeUp();
 static void     update_poll_timeout(int timeout_control);
 static uint32_t get_poll_timeout(jlong nextTaskTime);
@@ -608,11 +624,13 @@
  */
 void
 waitForEvents(JNIEnv *env, jlong nextTaskTime) {
-    performPoll(env, nextTaskTime);
-    if ((awt_next_flush_time > 0) && (awtJNI_TimeMillis() >= awt_next_flush_time)) {
-        XFlush(awt_display);
-        awt_last_flush_time = awt_next_flush_time;
-        awt_next_flush_time = 0LL;
+    if (performPoll(env, nextTaskTime)
+          && (awt_next_flush_time > 0)
+          && (awtJNI_TimeMillis() >= awt_next_flush_time)) {
+
+                XFlush(awt_display);
+                awt_last_flush_time = awt_next_flush_time;
+                awt_next_flush_time = 0LL;
     }
 } /* waitForEvents() */
 
@@ -646,7 +664,7 @@
  *
  * The fdAWTPipe will be empty when this returns.
  */
-static void
+static Boolean
 performPoll(JNIEnv *env, jlong nextTaskTime) {
     static Bool pollFdsInited = False;
     static char read_buf[AWT_POLL_BUFSIZE + 1];    /* dummy buf to empty pipe */
@@ -673,7 +691,9 @@
     /* ACTUALLY DO THE POLL() */
     if (timeout == 0) {
         // be sure other threads get a chance
-        awtJNI_ThreadYield(env);
+        if (!awtJNI_ThreadYield(env)) {
+            return FALSE;
+        }
     }
 
     if (tracing) poll_sleep_time = awtJNI_TimeMillis();
@@ -701,7 +721,7 @@
         update_poll_timeout(TIMEOUT_EVENTS);
         PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %d \n", curPollTimeout);
     }
-    return;
+    return TRUE;
 
 } /* performPoll() */
 
@@ -856,23 +876,25 @@
     xawt_root_window = get_xawt_root_shell(env);
 
     if ( xawt_root_window == None ) {
+        AWT_UNLOCK();
         JNU_ThrowNullPointerException(env, "AWT root shell is unrealized");
-        AWT_UNLOCK();
         return;
     }
 
     command = (char *) JNU_GetStringPlatformChars(env, jcommand, NULL);
-    c[0] = (char *)command;
-    status = XmbTextListToTextProperty(awt_display, c, 1,
-                                       XStdICCTextStyle, &text_prop);
+    if (command != NULL) {
+        c[0] = (char *)command;
+        status = XmbTextListToTextProperty(awt_display, c, 1,
+                                           XStdICCTextStyle, &text_prop);
 
-    if (status == Success || status > 0) {
-        XSetTextProperty(awt_display, xawt_root_window,
-                         &text_prop, XA_WM_COMMAND);
-        if (text_prop.value != NULL)
-            XFree(text_prop.value);
+        if (status == Success || status > 0) {
+            XSetTextProperty(awt_display, xawt_root_window,
+                             &text_prop, XA_WM_COMMAND);
+            if (text_prop.value != NULL)
+                XFree(text_prop.value);
+        }
+        JNU_ReleaseStringPlatformChars(env, jcommand, command);
     }
-    JNU_ReleaseStringPlatformChars(env, jcommand, command);
     AWT_UNLOCK();
 }
 
@@ -886,96 +908,56 @@
  * name.  It's not!  It's just a plain function.
  */
 JNIEXPORT void JNICALL
-Java_sun_awt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jargv)
+Java_sun_awt_motif_XsessionWMcommand_New(JNIEnv *env, jobjectArray jarray)
 {
-    static const char empty[] = "";
-
-    int argc;
-    const char **cargv;
+    jsize length;
+    char ** array;
     XTextProperty text_prop;
     int status;
-    int i;
     Window xawt_root_window;
 
     AWT_LOCK();
     xawt_root_window = get_xawt_root_shell(env);
 
     if (xawt_root_window == None) {
+      AWT_UNLOCK();
       JNU_ThrowNullPointerException(env, "AWT root shell is unrealized");
-      AWT_UNLOCK();
       return;
     }
 
-    argc = (int)(*env)->GetArrayLength(env, jargv);
-    if (argc == 0) {
-        AWT_UNLOCK();
-        return;
+    array = stringArrayToNative(env, jarray, &length);
+
+    if (array != NULL) {
+        status = XmbTextListToTextProperty(awt_display, array, length,
+                                           XStdICCTextStyle, &text_prop);
+        if (status < 0) {
+            switch (status) {
+            case XNoMemory:
+                JNU_ThrowOutOfMemoryError(env,
+                    "XmbTextListToTextProperty: XNoMemory");
+                break;
+            case XLocaleNotSupported:
+                JNU_ThrowInternalError(env,
+                    "XmbTextListToTextProperty: XLocaleNotSupported");
+                break;
+            case XConverterNotFound:
+                JNU_ThrowNullPointerException(env,
+                    "XmbTextListToTextProperty: XConverterNotFound");
+                break;
+            default:
+                JNU_ThrowInternalError(env,
+                    "XmbTextListToTextProperty: unknown error");
+            }
+        } else {
+            XSetTextProperty(awt_display, xawt_root_window,
+                                 &text_prop, XA_WM_COMMAND);
+        }
+
+        if (text_prop.value != NULL)
+            XFree(text_prop.value);
+
+        freeNativeStringArray(array, length);
     }
-
-    /* array of C strings */
-    cargv = (const char **)calloc(argc, sizeof(char *));
-    if (cargv == NULL) {
-        JNU_ThrowOutOfMemoryError(env, "Unable to allocate cargv");
-        AWT_UNLOCK();
-        return;
-    }
-
-    /* fill C array with platform chars of java strings */
-      for (i = 0; i < argc; ++i) {
-        jstring js;
-        const char *cs;
-
-        cs = NULL;
-        js = (*env)->GetObjectArrayElement(env, jargv, i);
-        if (js != NULL) {
-            cs = JNU_GetStringPlatformChars(env, js, NULL);
-        }
-        if (cs == NULL) {
-            cs = empty;
-        }
-        cargv[i] = cs;
-        (*env)->DeleteLocalRef(env, js);
-    }
-
-    /* grr, X prototype doesn't declare cargv as const, thought it really is */
-    status = XmbTextListToTextProperty(awt_display, (char **)cargv, argc,
-                                       XStdICCTextStyle, &text_prop);
-    if (status < 0) {
-        switch (status) {
-        case XNoMemory:
-            JNU_ThrowOutOfMemoryError(env,
-                "XmbTextListToTextProperty: XNoMemory");
-            break;
-        case XLocaleNotSupported:
-            JNU_ThrowInternalError(env,
-                "XmbTextListToTextProperty: XLocaleNotSupported");
-            break;
-        case XConverterNotFound:
-            JNU_ThrowNullPointerException(env,
-                "XmbTextListToTextProperty: XConverterNotFound");
-            break;
-        default:
-            JNU_ThrowInternalError(env,
-                "XmbTextListToTextProperty: unknown error");
-        }
-    } else {
-
-    XSetTextProperty(awt_display, xawt_root_window,
-                         &text_prop, XA_WM_COMMAND);
-    }
-
-    for (i = 0; i < argc; ++i) {
-        jstring js;
-
-        if (cargv[i] == empty)
-            continue;
-
-        js = (*env)->GetObjectArrayElement(env, jargv, i);
-        JNU_ReleaseStringPlatformChars(env, js, cargv[i]);
-        (*env)->DeleteLocalRef(env, js);
-    }
-    if (text_prop.value != NULL)
-        XFree(text_prop.value);
     AWT_UNLOCK();
 }
 
--- a/src/solaris/native/sun/xawt/XWindow.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/xawt/XWindow.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -1242,9 +1242,13 @@
 {
    char *ptr = NULL;
    windowID = (*env)->GetFieldID(env, clazz, "window", "J");
+   CHECK_NULL(windowID);
    targetID = (*env)->GetFieldID(env, clazz, "target", "Ljava/awt/Component;");
+   CHECK_NULL(targetID);
    graphicsConfigID = (*env)->GetFieldID(env, clazz, "graphicsConfig", "Lsun/awt/X11GraphicsConfig;");
+   CHECK_NULL(graphicsConfigID);
    drawStateID = (*env)->GetFieldID(env, clazz, "drawState", "I");
+   CHECK_NULL(drawStateID);
    ptr = getenv("_AWT_USE_TYPE4_PATCH");
    if( ptr != NULL && ptr[0] != 0 ) {
        if( strncmp("true", ptr, 4) == 0 ) {
--- a/src/solaris/native/sun/xawt/XlibWrapper.c	Thu May 01 12:51:13 2014 -0700
+++ b/src/solaris/native/sun/xawt/XlibWrapper.c	Thu May 01 14:21:29 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -48,6 +48,7 @@
 #include "utility/rect.h"
 
 #include <X11/XKBlib.h>
+
 #if defined(DEBUG) || defined(INTERNAL_BUILD)
 static jmethodID lockIsHeldMID = NULL;
 
@@ -59,17 +60,94 @@
         lockIsHeldMID =
             (*env)->GetStaticMethodID(env, tkClass,
                                       "isAWTLockHeldByCurrentThread", "()Z");
+        if (lockIsHeldMID == NULL) return;
     }
     if (!(*env)->CallStaticBooleanMethod(env, tkClass, lockIsHeldMID)) {
         JNU_ThrowInternalError(env, "Current thread does not hold AWT_LOCK!");
     }
 }
 
-#define AWT_CHECK_HAVE_LOCK() CheckHaveAWTLock(env)
+#define AWT_CHECK_HAVE_LOCK()                       \
+    do {                                            \
+        CheckHaveAWTLock(env);                      \
+        if ((*env)->ExceptionCheck(env)) {          \
+            return;                                 \
+        }                                           \
+    } while (0);                                    \
+
+#define AWT_CHECK_HAVE_LOCK_RETURN(ret)             \
+    do {                                            \
+        CheckHaveAWTLock(env);                      \
+        if ((*env)->ExceptionCheck(env)) {          \
+            return (ret);                           \
+        }                                           \
+    } while (0);                                    \
+
 #else
 #define AWT_CHECK_HAVE_LOCK()
+#define AWT_CHECK_HAVE_LOCK_RETURN(ret)
 #endif
 
+void freeNativeStringArray(char **array, jsize length) {
+    int i;
+    if (array == NULL) {
+        return;
+    }
+    for (i = 0; i < length; i++) {
+        free(array[i]);
+    }
+    free(array);
+}
+
+char** stringArrayToNative(JNIEnv *env, jobjectArray array, jsize * ret_length) {
+    Bool err = FALSE;
+    char ** strings;
+    int index, str_index = 0;
+    jsize length = (*env)->GetArrayLength(env, array);
+
+    if (length == 0) {
+        return NULL;
+    }
+
+    strings = (char**) calloc(length, sizeof (char*));
+
+    if (strings == NULL) {
+        JNU_ThrowOutOfMemoryError(env, "");
+        return NULL;
+    }
+
+    for (index = 0; index < length; index++) {
+        jstring str = (*env)->GetObjectArrayElement(env, array, index);
+        if (str != NULL) {
+            const char * str_char = JNU_GetStringPlatformChars(env, str, NULL);
+            if (str_char != NULL) {
+                char * dup_str = strdup(str_char);
+                if (dup_str != NULL) {
+                    strings[str_index++] = dup_str;
+                } else {
+                    JNU_ThrowOutOfMemoryError(env, "");
+                    err = TRUE;
+                }
+                JNU_ReleaseStringPlatformChars(env, str, str_char);
+            } else {
+                err = TRUE;
+            }
+            (*env)->DeleteLocalRef(env, str);
+            if (err) {
+                break;
+            }
+        }
+    }
+
+    if (err) {
+        freeNativeStringArray(strings, str_index);
+        strings = NULL;
+        str_index = -1;
+    }
+    *ret_length = str_index;
+
+    return strings;
+}
 
 /*
  * Class:     XlibWrapper
@@ -81,7 +159,7 @@
 (JNIEnv *env, jclass clazz, jlong display_name)
 {
     Display *dp;
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     dp  =  XOpenDisplay((char *) jlong_to_ptr(display_name));
 
     return ptr_to_jlong(dp);
@@ -97,7 +175,7 @@
 JNIEXPORT jlong JNICALL
 Java_sun_awt_X11_XlibWrapper_XDisplayString(JNIEnv *env, jclass clazz,
                         jlong display) {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return ptr_to_jlong(XDisplayString((Display*) jlong_to_ptr(display)));
 }
 
@@ -115,7 +193,7 @@
  */
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DefaultScreen (JNIEnv *env, jclass clazz, jlong display) {
 
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jlong) DefaultScreen((Display *) jlong_to_ptr(display));
 }
 
@@ -125,7 +203,7 @@
  * Signature: (JJ)J
  */
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_ScreenOfDisplay(JNIEnv *env, jclass clazz, jlong display, jlong screen_number) {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return ptr_to_jlong(ScreenOfDisplay((Display *) jlong_to_ptr(display),
                                         screen_number));
 }
@@ -136,7 +214,7 @@
  * Signature: (J)I
  */
 JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_DoesBackingStore(JNIEnv *env, jclass clazz, jlong screen) {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jint) DoesBackingStore((Screen*) jlong_to_ptr(screen));
 }
 
@@ -148,7 +226,7 @@
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DisplayWidth
 (JNIEnv *env, jclass clazz, jlong display, jlong screen) {
 
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jlong) DisplayWidth((Display *) jlong_to_ptr(display),screen);
 
 }
@@ -160,7 +238,7 @@
  */
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DisplayWidthMM
 (JNIEnv *env, jclass clazz, jlong display, jlong screen) {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jlong) DisplayWidthMM((Display *) jlong_to_ptr(display),screen);
 }
 
@@ -172,7 +250,7 @@
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DisplayHeight
 (JNIEnv *env, jclass clazz, jlong display, jlong screen) {
 
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jlong) DisplayHeight((Display *) jlong_to_ptr(display),screen);
 }
 /*
@@ -182,7 +260,7 @@
  */
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_DisplayHeightMM
 (JNIEnv *env, jclass clazz, jlong display, jlong screen) {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jlong) DisplayHeightMM((Display *) jlong_to_ptr(display),screen);
 }
 
@@ -193,7 +271,7 @@
  */
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_RootWindow
 (JNIEnv *env , jclass clazz, jlong display, jlong screen_number) {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jlong) RootWindow((Display *) jlong_to_ptr(display), screen_number);
 }
 
@@ -203,7 +281,7 @@
  */
 JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_ScreenCount
 (JNIEnv *env , jclass clazz, jlong display) {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return ScreenCount((Display *) jlong_to_ptr(display));
 }
 
@@ -218,7 +296,7 @@
    jint x, jint y, jint w, jint h , jint border_width, jint depth,
    jlong wclass, jlong visual, jlong valuemask, jlong attributes)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return  XCreateWindow((Display *) jlong_to_ptr(display),(Window) window, x, y, w, h,
               border_width, depth, wclass, (Visual *) jlong_to_ptr(visual),
               valuemask, (XSetWindowAttributes *) jlong_to_ptr(attributes));
@@ -360,7 +438,7 @@
 
     Window focusOwner;
     int revert_to;
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     XGetInputFocus( (Display *)jlong_to_ptr(display), &focusOwner, &revert_to);
     return focusOwner;
 }
@@ -383,7 +461,7 @@
  jint owner_events, jint event_mask, jint pointer_mode,
  jint keyboard_mode, jlong confine_to, jlong cursor, jlong time)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return XGrabPointer( (Display *)jlong_to_ptr(display), (Window) window,
              (Bool) owner_events, (unsigned int) event_mask, (int) pointer_mode,
              (int) keyboard_mode, (Window) confine_to, (Cursor) cursor, (Time) time);
@@ -401,7 +479,7 @@
  jint owner_events, jint pointer_mode,
  jint keyboard_mode, jlong time)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return XGrabKeyboard( (Display *)jlong_to_ptr(display), (Window) window,
               (Bool) owner_events, (int) pointer_mode,
               (int) keyboard_mode, (Time) time);
@@ -474,7 +552,7 @@
 (JNIEnv *env, jclass clazz, jlong display, jlong opcode_rtrn, jlong event_rtrn,
               jlong error_rtrn, jlong major_in_out, jlong minor_in_out)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     return XkbQueryExtension( (Display *) jlong_to_ptr(display),
                        (int *) jlong_to_ptr(opcode_rtrn),
                        (int *) jlong_to_ptr(event_rtrn),
@@ -485,7 +563,7 @@
 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion
 (JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     *((int *)jlong_to_ptr(lib_major_in_out)) =  XkbMajorVersion;
     *((int *)jlong_to_ptr(lib_minor_in_out)) =  XkbMinorVersion;
     return  XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out));
@@ -494,7 +572,7 @@
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetMap
 (JNIEnv *env, jclass clazz, jlong display, jlong which, jlong device_spec)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jlong) XkbGetMap( (Display *) jlong_to_ptr(display),
                               (unsigned int) which,
                               (unsigned int) device_spec);
@@ -502,7 +580,7 @@
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetUpdatedMap
 (JNIEnv *env, jclass clazz, jlong display, jlong which, jlong xkb)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jlong) XkbGetUpdatedMap( (Display *) jlong_to_ptr(display),
                               (unsigned int) which,
                               (XkbDescPtr) jlong_to_ptr(xkb));
@@ -516,6 +594,7 @@
 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode
 (JNIEnv *env, jclass clazz, jlong xkb, jint keycode, jlong mods, jlong mods_rtrn, jlong keysym_rtrn)
 {
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     Bool b;
     b = XkbTranslateKeyCode((XkbDescPtr)xkb, (unsigned int)keycode, (unsigned int)mods,
                               (unsigned int *)jlong_to_ptr(mods_rtrn),
@@ -578,7 +657,7 @@
 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XFilterEvent
 (JNIEnv *env, jclass clazz, jlong ptr, jlong window)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     return (jboolean) XFilterEvent((XEvent *) jlong_to_ptr(ptr), (Window) window);
 }
 
@@ -590,7 +669,7 @@
 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XSupportsLocale
 (JNIEnv *env, jclass clazz)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     return (jboolean)XSupportsLocale();
 }
 
@@ -607,9 +686,10 @@
 
     if (!JNU_IsNull(env, jstr)) {
         modifier_list = (char *)JNU_GetStringPlatformChars(env, jstr, NULL);
+        CHECK_NULL_RETURN(modifier_list, NULL);
     }
 
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(NULL);
     if (modifier_list) {
         ret = XSetLocaleModifiers(modifier_list);
         JNU_ReleaseStringPlatformChars(env, jstr, (const char *) modifier_list);
@@ -722,7 +802,7 @@
  jlong src_x, jlong src_y, jlong dest_x_return, jlong dest_y_return,
  jlong child_return)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return XTranslateCoordinates( (Display *) jlong_to_ptr(display), src_w, dest_w,
                   src_x, src_y,
                   (int *) jlong_to_ptr(dest_x_return),
@@ -733,7 +813,7 @@
 JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XEventsQueued
 (JNIEnv *env, jclass clazz, jlong display, jint mode) {
 
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return XEventsQueued((Display *) jlong_to_ptr(display), mode);
 
 }
@@ -758,6 +838,7 @@
 #else
         cname = (char *) JNU_GetStringPlatformChars(env, jstr, NULL);
 #endif
+        CHECK_NULL(cname);
     } else {
         cname = "";
     }
@@ -814,8 +895,9 @@
     jlong type, jint format, jint mode, jstring value)
 {
     jboolean iscopy;
+    AWT_CHECK_HAVE_LOCK();
     const char * chars = JNU_GetStringPlatformChars(env, value, &iscopy);
-    AWT_CHECK_HAVE_LOCK();
+    CHECK_NULL(chars);
     XChangeProperty((Display*)jlong_to_ptr(display), window, (Atom)property,
                     (Atom)type, format, mode, (unsigned char*)chars, strlen(chars));
     if (iscopy) {
@@ -833,7 +915,7 @@
  jlong long_length, jlong delete, jlong req_type, jlong actual_type,
  jlong actual_format, jlong nitems_ptr, jlong bytes_after, jlong data_ptr)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return XGetWindowProperty((Display*) jlong_to_ptr(display), window, property, long_offset, long_length,
                   delete, (Atom) req_type, (Atom*) jlong_to_ptr(actual_type),
                   (int *) jlong_to_ptr(actual_format), (unsigned long *) jlong_to_ptr(nitems_ptr),
@@ -857,23 +939,22 @@
     unsigned long nitems;
     unsigned long bytes_after;
     unsigned char * string;
-    jstring res;
-    AWT_CHECK_HAVE_LOCK();
+    jstring res = NULL;
+    AWT_CHECK_HAVE_LOCK_RETURN(NULL);
     status = XGetWindowProperty((Display*)jlong_to_ptr(display), window,
                                 atom, 0, 0xFFFF, False, XA_STRING,
                                 &actual_type, &actual_format, &nitems, &bytes_after,
                                 &string);
+
     if (status != Success || string == NULL) {
-    return NULL;
+        return NULL;
     }
 
-    if (actual_type != XA_STRING || actual_format != 8) {
+    if (actual_type == XA_STRING && actual_format == 8) {
+        res = JNU_NewStringPlatform(env,(char*) string);
+    }
     XFree(string);
-    return NULL;
-    }
-
-    // Memory leak???
-    return JNU_NewStringPlatform(env,(char*) string);
+    return res;
 }
 
 /*
@@ -887,13 +968,15 @@
     char *cname;
     unsigned long atom;
 
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
+
     if (!JNU_IsNull(env, jstr)) {
         cname = (char *)JNU_GetStringPlatformChars(env, jstr, NULL);
+        CHECK_NULL_RETURN(cname, 0);
     } else {
         cname = "";
     }
 
-    AWT_CHECK_HAVE_LOCK();
     atom = XInternAtom((Display *) jlong_to_ptr(display), cname, ife);
 
     if (!JNU_IsNull(env, jstr)) {
@@ -906,7 +989,7 @@
 
 JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XCreateFontCursor
 (JNIEnv *env, jclass clazz, jlong display, jint shape) {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return XCreateFontCursor((Display *) jlong_to_ptr(display), (int) shape);
 }
 
@@ -919,7 +1002,7 @@
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XCreatePixmapCursor
 (JNIEnv *env , jclass clazz, jlong display, jlong source, jlong mask, jlong fore, jlong back, jint x , jint y) {
 
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return (jlong) XCreatePixmapCursor((Display *) jlong_to_ptr(display), (Pixmap) source, (Pixmap) mask,
                                        (XColor *) jlong_to_ptr(fore), (XColor *) jlong_to_ptr(back), x, y);
 }
@@ -935,7 +1018,7 @@
 
     Status status;
 
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     status  =  XQueryBestCursor((Display *) jlong_to_ptr(display), (Drawable) drawable, width,height,
                                 (unsigned int *) jlong_to_ptr(width_return), (unsigned int *) jlong_to_ptr(height_return));
 
@@ -966,15 +1049,14 @@
 
     Bool b;
 
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     b = XQueryPointer((Display *) jlong_to_ptr(display),
                       (Window) w, (Window *) jlong_to_ptr(root_return), (Window *) jlong_to_ptr(child_return),
                       (int *) jlong_to_ptr(root_x_return), (int *) jlong_to_ptr(root_y_return),
                       (int *) jlong_to_ptr(win_x_return), (int *) jlong_to_ptr(win_y_return),
                       (unsigned int *) jlong_to_ptr(mask_return));
-    if (b == True) return JNI_TRUE;
-    else return JNI_FALSE;
 
+    return b ? JNI_TRUE : JNI_FALSE;
 }
 
 /*
@@ -1042,7 +1124,7 @@
 JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XGetPointerMapping
 (JNIEnv *env, jclass clazz, jlong display, jlong map, jint buttonNumber)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return XGetPointerMapping((Display*)jlong_to_ptr(display), (unsigned char*) jlong_to_ptr(map), buttonNumber);
 }
 
@@ -1061,31 +1143,26 @@
     if (!JNU_IsNull(env, program)) {
         c_program = (char *)JNU_GetStringPlatformChars(env, program, NULL);
     }
+    CHECK_NULL_RETURN(c_program, NULL);
+
     if (!JNU_IsNull(env, option)) {
         c_option = (char *)JNU_GetStringPlatformChars(env, option, NULL);
     }
 
-    if (c_program == NULL || c_option == NULL) {
-        if (!JNU_IsNull(env, program)) {
-            JNU_ReleaseStringPlatformChars(env, program, (const char *) c_program);
-        }
-        if (!JNU_IsNull(env, option)) {
-            JNU_ReleaseStringPlatformChars(env, option, (const char *) c_option);
-        }
+    if (c_option == NULL) {
+        JNU_ReleaseStringPlatformChars(env, program, (const char *) c_program);
         return NULL;
     }
-    AWT_CHECK_HAVE_LOCK();
+
+    AWT_CHECK_HAVE_LOCK_RETURN(NULL);
     c_res = XGetDefault((Display*)jlong_to_ptr(display), c_program, c_option);
+    // The strings returned by XGetDefault() are owned by Xlib and
+    // should not be modified or freed by the client.
 
-    if (!JNU_IsNull(env, program)) {
-        JNU_ReleaseStringPlatformChars(env, program, (const char *) c_program);
-    }
-    if (!JNU_IsNull(env, option)) {
-        JNU_ReleaseStringPlatformChars(env, option, (const char *) c_option);
-    }
+    JNU_ReleaseStringPlatformChars(env, program, (const char *) c_program);
+    JNU_ReleaseStringPlatformChars(env, option, (const char *) c_option);
 
     if (c_res != NULL) {
-        // Memory leak???
         return JNU_NewStringPlatform(env, c_res);
     } else {
         return NULL;
@@ -1103,7 +1180,7 @@
 {
     XWindowAttributes attrs;
     memset(&attrs, 0, sizeof(attrs));
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     XGetWindowAttributes((Display *) jlong_to_ptr(display), window, &attrs);
     return ptr_to_jlong(attrs.screen);
 }
@@ -1116,7 +1193,7 @@
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XScreenNumberOfScreen
 (JNIEnv *env, jclass clazz, jlong screen)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(-1);
     if(jlong_to_ptr(screen) == NULL) {
         return -1;
     }
@@ -1131,7 +1208,7 @@
 JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XIconifyWindow
 (JNIEnv *env, jclass clazz, jlong display, jlong window, jlong screenNumber)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return XIconifyWindow((Display*) jlong_to_ptr(display), window, screenNumber);
 }
 
@@ -1158,10 +1235,9 @@
     unsigned char * str = (unsigned char*) jlong_to_ptr(str_ptr);
     long length = strlen((char*)str);
     jbyteArray res = (*env)->NewByteArray(env, length);
-    void * storage = malloc(length+1);
-    memcpy(storage, str, length+1);
+    CHECK_NULL_RETURN(res, NULL);
     (*env)->SetByteArrayRegion(env, res, 0, length,
-                   (const signed char*) storage);
+                   (const signed char*) str);
     return res;
 }
 
@@ -1174,7 +1250,7 @@
 JNIEXPORT jstring JNICALL Java_sun_awt_X11_XlibWrapper_ServerVendor
 (JNIEnv *env, jclass clazz, jlong display)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(NULL);
     return JNU_NewStringPlatform(env, ServerVendor((Display*)jlong_to_ptr(display)));
 }
 /*
@@ -1185,7 +1261,7 @@
 JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_VendorRelease
 (JNIEnv *env, jclass clazz, jlong display)
 {
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return VendorRelease((Display*)jlong_to_ptr(display));
 }
 /*
@@ -1203,7 +1279,7 @@
     // second, in which place in the keysymarray is XK_KP_7
     // using XKeycodeToKeysym.
     int kc7;
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     kc7 = XKeysymToKeycode((Display*)jlong_to_ptr(display), XK_KP_7);
     if( !kc7 ) {
         // keycode is not defined. Why, it's a reduced keyboard perhaps:
@@ -1226,7 +1302,7 @@
 (JNIEnv *env, jclass clazz, jlong display)
 {
     int xx;
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     xx = XKeysymToKeycode((Display*)jlong_to_ptr(display), SunXK_F37);
     return (!xx) ? JNI_FALSE : JNI_TRUE;
 }
@@ -1242,7 +1318,7 @@
     int32_t i;
     int32_t kanaCount = 0;
 
-    AWT_CHECK_HAVE_LOCK();
+    AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
 
     // There's no direct way to determine whether the keyboard has
     // a kana lock key. From available keyboard mapping tables, it looks
@@ -1289,8 +1365,10 @@
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler
 (JNIEnv *env, jclass clazz)
 {
-    (*env)->GetJavaVM(env, &jvm);
-    AWT_CHECK_HAVE_LOCK();
+    if ((*env)->GetJavaVM(env, &jvm) < 0) {
+        return 0;
+    }
+    AWT_CHECK_HAVE_LOCK_RETURN(0);
     return ptr_to_jlong(XSetErrorHandler(ToolkitErrorHandler));
 }
 
@@ -1350,28 +1428,14 @@
 JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms
 (JNIEnv *env, jclass clazz, jlong display, jobjectArray names_arr, jboolean only_if_exists, jlong atoms)
 {
-    int length = (*env)->GetArrayLength(env, names_arr);
-    char ** names = (char**)malloc(length*sizeof(char*));
-    jboolean copy;
-    int index, name_index = 0;
-    int status;
-
-    AWT_CHECK_HAVE_LOCK();
-
-    for (index = 0; index < length; index++) {
-        jstring str = (*env)->GetObjectArrayElement(env, names_arr, index);
-        if (!JNU_IsNull(env, str)) {
-            const char * str_char = JNU_GetStringPlatformChars(env, str, NULL)