changeset 9645:823fdb976660

Merge
author amurillo
date Tue, 03 Jun 2014 10:28:00 -0700
parents 31433e5da5bc e443dab8be6b
children adbf50f5d6c2
files
diffstat 45 files changed, 1399 insertions(+), 170 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java	Tue Jun 03 10:28:00 2014 -0700
@@ -120,6 +120,10 @@
     public void show() {
         final int startItemCount = comboBox.getItemCount();
 
+        if (startItemCount == 0) {
+            return;
+        }
+
         final Rectangle popupBounds = adjustPopupAndGetBounds();
         if (popupBounds == null) return; // null means don't show
 
--- a/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Tue Jun 03 10:28:00 2014 -0700
@@ -171,7 +171,9 @@
             SwingUtilities.invokeLater(() -> {
                 JPopupMenu popupMenu = getPopupMenu();
                 // Need to override the invoker for proper grab handling
-                if (popupMenu != null && popupMenu.getInvoker() != getTarget()) {
+                if (popupMenu != null
+                        && popupMenu.isShowing()
+                        && popupMenu.getInvoker() != getTarget()) {
                     // The popup is now visible with correct location
                     // Save it and restore after toggling visibility and changing invoker
                     Point loc = popupMenu.getLocationOnScreen();
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Tue Jun 03 10:28:00 2014 -0700
@@ -96,7 +96,8 @@
     public void handleKeyEvent(int eventType, int modifierFlags, String characters,
                                String charsIgnoringMods, boolean isRepeat, short keyCode,
                                boolean needsKeyTyped) {
-        responder.handleKeyEvent(eventType, modifierFlags, charsIgnoringMods, keyCode, needsKeyTyped, isRepeat);
+        responder.handleKeyEvent(eventType, modifierFlags, characters, charsIgnoringMods,
+                keyCode, needsKeyTyped, isRepeat);
     }
 
     public void handleInputEvent(String text) {
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Tue Jun 03 10:28:00 2014 -0700
@@ -125,7 +125,7 @@
     /**
      * Handles key events.
      */
-    void handleKeyEvent(int eventType, int modifierFlags, String chars,
+    void handleKeyEvent(int eventType, int modifierFlags, String chars, String charsIgnoringModifiers,
                         short keyCode, boolean needsKeyTyped, boolean needsKeyReleased) {
         boolean isFlagsChangedEvent =
             isNpapiCallback ? (eventType == CocoaConstants.NPCocoaEventFlagsChanged) :
@@ -153,7 +153,10 @@
                 testChar = chars.charAt(0);
             }
 
-            int[] in = new int[] {testChar, isDeadChar ? 1 : 0, modifierFlags, keyCode};
+            char testCharIgnoringModifiers = charsIgnoringModifiers != null && charsIgnoringModifiers.length() > 0 ?
+                    charsIgnoringModifiers.charAt(0) : KeyEvent.CHAR_UNDEFINED;
+
+            int[] in = new int[] {testCharIgnoringModifiers, isDeadChar ? 1 : 0, modifierFlags, keyCode};
             int[] out = new int[3]; // [jkeyCode, jkeyLocation, deadChar]
 
             postsTyped = NSEvent.nsToJavaKeyInfo(in, out);
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Tue Jun 03 10:28:00 2014 -0700
@@ -200,7 +200,7 @@
     }
 
     private void deliverKeyEvent(NSEvent event) {
-        responder.handleKeyEvent(event.getType(), event.getModifierFlags(),
+        responder.handleKeyEvent(event.getType(), event.getModifierFlags(), event.getCharacters(),
                                  event.getCharactersIgnoringModifiers(), event.getKeyCode(), true, false);
     }
 
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Jun 03 10:28:00 2014 -0700
@@ -119,6 +119,7 @@
     static final int NONACTIVATING = 1 << 24;
     static final int IS_DIALOG = 1 << 25;
     static final int IS_MODAL = 1 << 26;
+    static final int IS_POPUP = 1 << 27;
 
     static final int _STYLE_PROP_BITMASK = DECORATED | TEXTURED | UNIFIED | UTILITY | HUD | SHEET | CLOSEABLE | MINIMIZABLE | RESIZABLE;
 
@@ -318,6 +319,7 @@
             styleBits = SET(styleBits, TEXTURED, false);
             // Popups in applets don't activate applet's process
             styleBits = SET(styleBits, NONACTIVATING, true);
+            styleBits = SET(styleBits, IS_POPUP, true);
         }
 
         if (Window.Type.UTILITY.equals(target.getType())) {
--- a/src/macosx/classes/sun/lwawt/macosx/NSEvent.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/NSEvent.java	Tue Jun 03 10:28:00 2014 -0700
@@ -47,13 +47,15 @@
 
     // Key event information
     private short keyCode;
+    private String characters;
     private String charactersIgnoringModifiers;
 
     // Called from native
-    NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
+    NSEvent(int type, int modifierFlags, short keyCode, String characters, String charactersIgnoringModifiers) {
         this.type = type;
         this.modifierFlags = modifierFlags;
         this.keyCode = keyCode;
+        this.characters = characters;
         this.charactersIgnoringModifiers = charactersIgnoringModifiers;
     }
 
@@ -121,12 +123,16 @@
         return charactersIgnoringModifiers;
     }
 
+    String getCharacters() {
+        return characters;
+    }
+
     @Override
     public String toString() {
         return "NSEvent[" + getType() + " ," + getModifierFlags() + " ,"
                 + getClickCount() + " ," + getButtonNumber() + " ," + getX() + " ,"
                 + getY() + " ," + getAbsX() + " ," + getAbsY()+ " ," + getKeyCode() + " ,"
-                + getCharactersIgnoringModifiers() + "]";
+                + getCharacters() + " ," + getCharactersIgnoringModifiers() + "]";
     }
 
     /*
--- a/src/macosx/native/sun/awt/AWTView.m	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/macosx/native/sun/awt/AWTView.m	Tue Jun 03 10:28:00 2014 -0700
@@ -367,7 +367,7 @@
     // TODO: need consitent way for doing that both with global as well as with local coordinates.
     // The reason to do it here is one more native method for getting screen dimension otherwise.
 
-    NSRect screenRect = [[NSScreen mainScreen] frame];
+    NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
     absP.y = screenRect.size.height - absP.y;
     jint clickCount;
 
@@ -441,17 +441,20 @@
     JNIEnv *env = [ThreadUtilities getJNIEnv];
 
     jstring characters = NULL;
+    jstring charactersIgnoringModifiers = NULL;
     if ([event type] != NSFlagsChanged) {
         characters = JNFNSToJavaString(env, [event characters]);
+        charactersIgnoringModifiers = JNFNSToJavaString(env, [event charactersIgnoringModifiers]);
     }
 
     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
-    static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V");
+    static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;Ljava/lang/String;)V");
     jobject jevent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
                                   [event modifierFlags],
                                   [event keyCode],
-                                  characters);
+                                  characters,
+                                  charactersIgnoringModifiers);
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
--- a/src/macosx/native/sun/awt/AWTWindow.m	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Tue Jun 03 10:28:00 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
@@ -252,6 +252,10 @@
     self.ownerWindow = owner;
     [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)];
 
+    if (IS(self.styleBits, IS_POPUP)) {
+        [self.nsWindow setCollectionBehavior:(1 << 8) /*NSWindowCollectionBehaviorFullScreenAuxiliary*/]; 
+    }
+
     return self;
 }
 
--- a/src/share/classes/com/sun/jndi/ldap/Connection.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/com/sun/jndi/ldap/Connection.java	Tue Jun 03 10:28:00 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
@@ -459,10 +459,10 @@
                             // will be woken up before readTimeout only if reply is
                             // available
                             ldr.wait(readTimeout);
-                            waited = true;
                         } else {
                             ldr.wait(15 * 1000); // 15 second timeout
                         }
+                        waited = true;
                     } else {
                         break;
                     }
@@ -474,7 +474,7 @@
         }
 
         if ((rber == null) && waited) {
-            removeRequest(ldr);
+            abandonRequest(ldr, null);
             throw new NamingException("LDAP response read timed out, timeout used:"
                             + readTimeout + "ms." );
 
--- a/src/share/classes/java/lang/invoke/LambdaForm.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/java/lang/invoke/LambdaForm.java	Tue Jun 03 10:28:00 2014 -0700
@@ -482,7 +482,7 @@
                 assert(m.getName().equals("interpret" + sig.substring(sig.indexOf('_'))));
                 LambdaForm form = new LambdaForm(sig);
                 form.vmentry = m;
-                mt.form().setCachedLambdaForm(MethodTypeForm.LF_COUNTER, form);
+                form = mt.form().setCachedLambdaForm(MethodTypeForm.LF_COUNTER, form);
                 // FIXME: get rid of PREPARED_FORMS; use MethodTypeForm cache only
                 forms.put(sig, form);
             }
--- a/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Jun 03 10:28:00 2014 -0700
@@ -692,8 +692,7 @@
 
         lform = new LambdaForm("guardWithCatch", lambdaType.parameterCount(), names);
 
-        basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWC, lform);
-        return lform;
+        return basicType.form().setCachedLambdaForm(MethodTypeForm.LF_GWC, lform);
     }
 
     static
--- a/src/share/classes/java/lang/invoke/MethodTypeForm.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/java/lang/invoke/MethodTypeForm.java	Tue Jun 03 10:28:00 2014 -0700
@@ -91,8 +91,10 @@
         return lambdaForms[which];
     }
 
-    public LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
-        // Should we perform some sort of CAS, to avoid racy duplication?
+    synchronized public LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
+        // Simulate a CAS, to avoid racy duplication of results.
+        LambdaForm prev = lambdaForms[which];
+        if (prev != null) return prev;
         return lambdaForms[which] = form;
     }
 
--- a/src/share/classes/java/time/temporal/IsoFields.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/java/time/temporal/IsoFields.java	Tue Jun 03 10:28:00 2014 -0700
@@ -535,11 +535,17 @@
                 if (isSupportedBy(temporal) == false) {
                     throw new UnsupportedTemporalTypeException("Unsupported field: WeekBasedYear");
                 }
-                int newVal = range().checkValidIntValue(newValue, WEEK_BASED_YEAR);  // strict check
+                int newWby = range().checkValidIntValue(newValue, WEEK_BASED_YEAR);  // strict check
                 LocalDate date = LocalDate.from(temporal);
+                int dow = date.get(DAY_OF_WEEK);
                 int week = getWeek(date);
-                date = date.withDayOfYear(180).withYear(newVal).with(WEEK_OF_WEEK_BASED_YEAR, week);
-                return (R) date.with(date);
+                if (week == 53 && getWeekRange(newWby) == 52) {
+                    week = 52;
+                }
+                LocalDate resolved = LocalDate.of(newWby, 1, 4);  // 4th is guaranteed to be in week one
+                int days = (dow - resolved.get(DAY_OF_WEEK)) + ((week - 1) * 7);
+                resolved = resolved.plusDays(days);
+                return (R) temporal.with(resolved);
             }
             @Override
             public String toString() {
@@ -577,12 +583,16 @@
 
         private static ValueRange getWeekRange(LocalDate date) {
             int wby = getWeekBasedYear(date);
-            date = date.withDayOfYear(1).withYear(wby);
+            return ValueRange.of(1, getWeekRange(wby));
+        }
+
+        private static int getWeekRange(int wby) {
+            LocalDate date = LocalDate.of(wby, 1, 1);
             // 53 weeks if standard year starts on Thursday, or Wed in a leap year
             if (date.getDayOfWeek() == THURSDAY || (date.getDayOfWeek() == WEDNESDAY && date.isLeapYear())) {
-                return ValueRange.of(1, 53);
+                return 53;
             }
-            return ValueRange.of(1, 52);
+            return 52;
         }
 
         private static int getWeek(LocalDate date) {
--- a/src/share/classes/java/time/temporal/WeekFields.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/java/time/temporal/WeekFields.java	Tue Jun 03 10:28:00 2014 -0700
@@ -700,7 +700,7 @@
          * @see WeekFields#weekOfWeekBasedYear()
          */
         static ComputedDayOfField ofWeekOfWeekBasedYearField(WeekFields weekDef) {
-            return new ComputedDayOfField("WeekOfWeekBasedYear", weekDef, WEEKS, IsoFields.WEEK_BASED_YEARS, WEEK_OF_YEAR_RANGE);
+            return new ComputedDayOfField("WeekOfWeekBasedYear", weekDef, WEEKS, IsoFields.WEEK_BASED_YEARS, WEEK_OF_WEEK_BASED_YEAR_RANGE);
         }
 
         /**
@@ -753,6 +753,7 @@
         private static final ValueRange DAY_OF_WEEK_RANGE = ValueRange.of(1, 7);
         private static final ValueRange WEEK_OF_MONTH_RANGE = ValueRange.of(0, 1, 4, 6);
         private static final ValueRange WEEK_OF_YEAR_RANGE = ValueRange.of(0, 1, 52, 54);
+        private static final ValueRange WEEK_OF_WEEK_BASED_YEAR_RANGE = ValueRange.of(1, 52, 53);
 
         @Override
         public long getFrom(TemporalAccessor temporal) {
--- a/src/share/classes/javax/swing/JComboBox.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/javax/swing/JComboBox.java	Tue Jun 03 10:28:00 2014 -0700
@@ -1307,13 +1307,15 @@
      * do not call or override.
      */
     public void actionPerformed(ActionEvent e) {
-        Object newItem = getEditor().getItem();
-        setPopupVisible(false);
-        getModel().setSelectedItem(newItem);
-        String oldCommand = getActionCommand();
-        setActionCommand("comboBoxEdited");
-        fireActionEvent();
-        setActionCommand(oldCommand);
+        ComboBoxEditor editor = getEditor();
+        if ((editor != null) && (e != null) && (editor == e.getSource())) {
+            setPopupVisible(false);
+            getModel().setSelectedItem(editor.getItem());
+            String oldCommand = getActionCommand();
+            setActionCommand("comboBoxEdited");
+            fireActionEvent();
+            setActionCommand(oldCommand);
+        }
     }
 
     /**
--- a/src/share/classes/javax/swing/JComponent.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/javax/swing/JComponent.java	Tue Jun 03 10:28:00 2014 -0700
@@ -3676,8 +3676,8 @@
         private volatile transient int propertyListenersCount = 0;
 
         /**
-         * This field duplicates the one in java.awt.Component.AccessibleAWTComponent,
-         * so it has been deprecated.
+         * This field duplicates the function of the accessibleAWTFocusHandler field
+         * in java.awt.Component.AccessibleAWTComponent, so it has been deprecated.
          */
         @Deprecated
         protected FocusListener accessibleFocusHandler = null;
@@ -3735,14 +3735,10 @@
          * @param listener  the PropertyChangeListener to be added
          */
         public void addPropertyChangeListener(PropertyChangeListener listener) {
-            if (accessibleFocusHandler == null) {
-                accessibleFocusHandler = new AccessibleFocusHandler();
-            }
             if (accessibleContainerHandler == null) {
                 accessibleContainerHandler = new AccessibleContainerHandler();
             }
             if (propertyListenersCount++ == 0) {
-                JComponent.this.addFocusListener(accessibleFocusHandler);
                 JComponent.this.addContainerListener(accessibleContainerHandler);
             }
             super.addPropertyChangeListener(listener);
@@ -3757,7 +3753,6 @@
          */
         public void removePropertyChangeListener(PropertyChangeListener listener) {
             if (--propertyListenersCount == 0) {
-                JComponent.this.removeFocusListener(accessibleFocusHandler);
                 JComponent.this.removeContainerListener(accessibleContainerHandler);
             }
             super.removePropertyChangeListener(listener);
--- a/src/share/classes/javax/swing/PopupFactory.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/javax/swing/PopupFactory.java	Tue Jun 03 10:28:00 2014 -0700
@@ -25,10 +25,14 @@
 
 package javax.swing;
 
+import sun.awt.EmbeddedFrame;
+import sun.awt.OSInfo;
+
 import java.applet.Applet;
 import java.awt.*;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
+import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -226,7 +230,12 @@
         case MEDIUM_WEIGHT_POPUP:
             return getMediumWeightPopup(owner, contents, ownerX, ownerY);
         case HEAVY_WEIGHT_POPUP:
-            return getHeavyWeightPopup(owner, contents, ownerX, ownerY);
+            Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
+            if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
+                OSInfo.OSType.MACOSX) && (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
+                ((HeavyWeightPopup)popup).setCacheEnabled(false);
+            }
+            return popup;
         }
         return null;
     }
@@ -294,6 +303,8 @@
         private static final Object heavyWeightPopupCacheKey =
                  new StringBuffer("PopupFactory.heavyWeightPopupCache");
 
+        private volatile boolean isCacheEnabled = true;
+
         /**
          * Returns either a new or recycled <code>Popup</code> containing
          * the specified children.
@@ -448,12 +459,23 @@
             }
         }
 
+        /**
+         * Enables or disables cache for current object.
+         */
+        void setCacheEnabled(boolean enable) {
+            isCacheEnabled = enable;
+        }
+
         //
         // Popup methods
         //
         public void hide() {
             super.hide();
-            recycleHeavyWeightPopup(this);
+            if (isCacheEnabled) {
+                recycleHeavyWeightPopup(this);
+            } else {
+                this._dispose();
+            }
         }
 
         /**
--- a/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java	Tue Jun 03 10:28:00 2014 -0700
@@ -806,9 +806,8 @@
 
         // Paint the background for the tab area
         if ( tabPane.isOpaque() ) {
-            Color bg = UIManager.getColor("TabbedPane.tabAreaBackground");
-            if (bg != null) {
-                g.setColor(bg);
+            if (!c.isBackgroundSet() && (tabAreaBackground != null)) {
+                g.setColor(tabAreaBackground);
             }
             else {
                 g.setColor( c.getBackground() );
--- a/src/share/classes/sun/awt/image/FileImageSource.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/sun/awt/image/FileImageSource.java	Tue Jun 03 10:28:00 2014 -0700
@@ -48,6 +48,10 @@
     }
 
     protected ImageDecoder getDecoder() {
+        if (imagefile == null) {
+            return null;
+        }
+
         InputStream is;
         try {
             is = new BufferedInputStream(new FileInputStream(imagefile));
--- a/src/share/classes/sun/security/smartcardio/CardImpl.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/classes/sun/security/smartcardio/CardImpl.java	Tue Jun 03 10:28:00 2014 -0700
@@ -246,7 +246,7 @@
         }
         checkExclusive();
         try {
-            SCardDisconnect(cardId, (reset ? SCARD_LEAVE_CARD : SCARD_RESET_CARD));
+            SCardDisconnect(cardId, (reset ? SCARD_RESET_CARD : SCARD_LEAVE_CARD));
         } catch (PCSCException e) {
             throw new CardException("disconnect() failed", e);
         } finally {
--- a/src/share/native/sun/security/smartcardio/pcsc.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/share/native/sun/security/smartcardio/pcsc.c	Tue Jun 03 10:28:00 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, 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
@@ -64,17 +64,32 @@
 
 #define J2PCSC_EXCEPTION_NAME "sun/security/smartcardio/PCSCException"
 
+void throwOutOfMemoryError(JNIEnv *env, const char *msg) {
+    jclass cls = (*env)->FindClass(env, "java/lang/OutOfMemoryError");
+
+    if (cls != NULL) /* Otherwise an exception has already been thrown */
+        (*env)->ThrowNew(env, cls, msg);
+
+}
+
 void throwPCSCException(JNIEnv* env, LONG code) {
     jclass pcscClass;
     jmethodID constructor;
     jthrowable pcscException;
 
     pcscClass = (*env)->FindClass(env, J2PCSC_EXCEPTION_NAME);
-    assert(pcscClass != NULL);
+    if (pcscClass == NULL) {
+        return;
+    }
     constructor = (*env)->GetMethodID(env, pcscClass, "<init>", "(I)V");
-    assert(constructor != NULL);
-    pcscException = (jthrowable) (*env)->NewObject(env, pcscClass, constructor, (jint)code);
-    (*env)->Throw(env, pcscException);
+    if (constructor == NULL) {
+        return;
+    }
+    pcscException = (jthrowable) (*env)->NewObject(env, pcscClass,
+        constructor, (jint)code);
+    if (pcscException != NULL) {
+        (*env)->Throw(env, pcscException);
+    }
 }
 
 jboolean handleRV(JNIEnv* env, LONG code) {
@@ -93,7 +108,7 @@
 JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardEstablishContext
     (JNIEnv *env, jclass thisClass, jint dwScope)
 {
-    SCARDCONTEXT context;
+    SCARDCONTEXT context = 0;
     LONG rv;
     dprintf("-establishContext\n");
     rv = CALL_SCardEstablishContext(dwScope, NULL, NULL, &context);
@@ -110,7 +125,7 @@
 jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec) {
     jobjectArray result;
     jclass stringClass;
-    char *cp, **tab;
+    char *cp, **tab = NULL;
     jstring js;
     int cnt = 0;
 
@@ -121,6 +136,10 @@
     }
 
     tab = (char **)malloc(cnt * sizeof(char *));
+    if (tab == NULL) {
+        throwOutOfMemoryError(env, NULL);
+        return NULL;
+    }
 
     cnt = 0;
     cp = spec;
@@ -130,12 +149,26 @@
     }
 
     stringClass = (*env)->FindClass(env, "java/lang/String");
-    assert(stringClass != NULL);
+    if (stringClass == NULL) {
+        free(tab);
+        return NULL;
+    }
 
     result = (*env)->NewObjectArray(env, cnt, stringClass, NULL);
-    while (cnt-- > 0) {
-        js = (*env)->NewStringUTF(env, tab[cnt]);
-        (*env)->SetObjectArrayElement(env, result, cnt, js);
+    if (result != NULL) {
+        while (cnt-- > 0) {
+            js = (*env)->NewStringUTF(env, tab[cnt]);
+            if ((*env)->ExceptionCheck(env)) {
+                free(tab);
+                return NULL;
+            }
+            (*env)->SetObjectArrayElement(env, result, cnt, js);
+            if ((*env)->ExceptionCheck(env)) {
+                free(tab);
+                return NULL;
+            }
+            (*env)->DeleteLocalRef(env, js);
+        }
     }
     free(tab);
     return result;
@@ -146,8 +179,8 @@
 {
     SCARDCONTEXT context = (SCARDCONTEXT)jContext;
     LONG rv;
-    LPTSTR mszReaders;
-    DWORD size;
+    LPTSTR mszReaders = NULL;
+    DWORD size = 0;
     jobjectArray result;
 
     dprintf1("-context: %x\n", context);
@@ -157,13 +190,20 @@
     }
     dprintf1("-size: %d\n", size);
 
-    mszReaders = malloc(size);
-    rv = CALL_SCardListReaders(context, NULL, mszReaders, &size);
-    if (handleRV(env, rv)) {
-        free(mszReaders);
-        return NULL;
+    if (size) {
+        mszReaders = malloc(size);
+        if (mszReaders == NULL) {
+            throwOutOfMemoryError(env, NULL);
+            return NULL;
+        }
+
+        rv = CALL_SCardListReaders(context, NULL, mszReaders, &size);
+        if (handleRV(env, rv)) {
+            free(mszReaders);
+            return NULL;
+        }
+        dprintf1("-String: %s\n", mszReaders);
     }
-    dprintf1("-String: %s\n", mszReaders);
 
     result = pcsc_multi2jstring(env, mszReaders);
     free(mszReaders);
@@ -177,10 +217,13 @@
     SCARDCONTEXT context = (SCARDCONTEXT)jContext;
     LONG rv;
     LPCTSTR readerName;
-    SCARDHANDLE card;
-    DWORD proto;
+    SCARDHANDLE card = 0;
+    DWORD proto = 0;
 
     readerName = (*env)->GetStringUTFChars(env, jReaderName, NULL);
+    if (readerName == NULL) {
+        return 0;
+    }
     rv = CALL_SCardConnect(context, readerName, jShareMode, jPreferredProtocols, &card, &proto);
     (*env)->ReleaseStringUTFChars(env, jReaderName, readerName);
     dprintf1("-cardhandle: %x\n", card);
@@ -210,6 +253,9 @@
     sendPci.cbPciLength = sizeof(SCARD_IO_REQUEST);
 
     sbuf = (unsigned char *) ((*env)->GetByteArrayElements(env, jBuf, NULL));
+    if (sbuf == NULL) {
+        return NULL;
+    }
     rv = CALL_SCardTransmit(card, &sendPci, sbuf + ofs, len, NULL, rbuf, &rlen);
     (*env)->ReleaseByteArrayElements(env, jBuf, (jbyte *)sbuf, JNI_ABORT);
 
@@ -218,7 +264,12 @@
     }
 
     jOut = (*env)->NewByteArray(env, rlen);
-    (*env)->SetByteArrayRegion(env, jOut, 0, rlen, (jbyte *)rbuf);
+    if (jOut != NULL) {
+        (*env)->SetByteArrayRegion(env, jOut, 0, rlen, (jbyte *)rbuf);
+        if ((*env)->ExceptionCheck(env)) {
+            return NULL;
+        }
+    }
     return jOut;
 }
 
@@ -231,10 +282,10 @@
     DWORD readerLen = READERNAME_BUFFER_SIZE;
     unsigned char atr[ATR_BUFFER_SIZE];
     DWORD atrLen = ATR_BUFFER_SIZE;
-    DWORD state;
-    DWORD protocol;
+    DWORD state = 0;
+    DWORD protocol = 0;
     jbyteArray jArray;
-    jbyte tmp;
+    jbyte status[2];
 
     rv = CALL_SCardStatus(card, readerName, &readerLen, &state, &protocol, atr, &atrLen);
     if (handleRV(env, rv)) {
@@ -245,13 +296,19 @@
     dprintf1("-protocol: %d\n", protocol);
 
     jArray = (*env)->NewByteArray(env, atrLen);
+    if (jArray == NULL) {
+        return NULL;
+    }
     (*env)->SetByteArrayRegion(env, jArray, 0, atrLen, (jbyte *)atr);
-
-    tmp = (jbyte)state;
-    (*env)->SetByteArrayRegion(env, jStatus, 0, 1, &tmp);
-    tmp = (jbyte)protocol;
-    (*env)->SetByteArrayRegion(env, jStatus, 1, 1, &tmp);
-
+    if ((*env)->ExceptionCheck(env)) {
+        return NULL;
+    }
+    status[0] = (jbyte) state;
+    status[1] = (jbyte) protocol;
+    (*env)->SetByteArrayRegion(env, jStatus, 0, 2, status);
+    if ((*env)->ExceptionCheck(env)) {
+        return NULL;
+    }
     return jArray;
 }
 
@@ -274,36 +331,78 @@
     SCARDCONTEXT context = (SCARDCONTEXT)jContext;
     LONG rv;
     int readers = (*env)->GetArrayLength(env, jReaderNames);
-    SCARD_READERSTATE *readerState = malloc(readers * sizeof(SCARD_READERSTATE));
+    SCARD_READERSTATE *readerState;
     int i;
-    jintArray jEventState;
-    int *currentState = (*env)->GetIntArrayElements(env, jCurrentState, NULL);
+    jintArray jEventState = NULL;
+    int *currentState = NULL;
+    const char *readerName;
+
+    readerState = calloc(readers, sizeof(SCARD_READERSTATE));
+    if (readerState == NULL && readers > 0) {
+        throwOutOfMemoryError(env, NULL);
+        return NULL;
+    }
+
+    currentState = (*env)->GetIntArrayElements(env, jCurrentState, NULL);
+    if (currentState == NULL) {
+        free(readerState);
+        return NULL;
+    }
+
+    for (i = 0; i < readers; i++) {
+        readerState[i].szReader = NULL;
+    }
 
     for (i = 0; i < readers; i++) {
         jobject jReaderName = (*env)->GetObjectArrayElement(env, jReaderNames, i);
-        readerState[i].szReader = (*env)->GetStringUTFChars(env, jReaderName, NULL);
+        if ((*env)->ExceptionCheck(env)) {
+            goto cleanup;
+        }
+        readerName = (*env)->GetStringUTFChars(env, jReaderName, NULL);
+        if (readerName == NULL) {
+            goto cleanup;
+        }
+        readerState[i].szReader = strdup(readerName);
+        (*env)->ReleaseStringUTFChars(env, jReaderName, readerName);
+        if (readerState[i].szReader == NULL) {
+            throwOutOfMemoryError(env, NULL);
+            goto cleanup;
+        }
         readerState[i].pvUserData = NULL;
         readerState[i].dwCurrentState = currentState[i];
         readerState[i].dwEventState = SCARD_STATE_UNAWARE;
         readerState[i].cbAtr = 0;
+        (*env)->DeleteLocalRef(env, jReaderName);
     }
-    (*env)->ReleaseIntArrayElements(env, jCurrentState, currentState, JNI_ABORT);
 
-    rv = CALL_SCardGetStatusChange(context, (DWORD)jTimeout, readerState, readers);
+    if (readers > 0) {
+        rv = CALL_SCardGetStatusChange(context, (DWORD)jTimeout, readerState, readers);
+        if (handleRV(env, rv)) {
+            goto cleanup;
+        }
+    }
 
     jEventState = (*env)->NewIntArray(env, readers);
+    if (jEventState == NULL) {
+        goto cleanup;
+    }
     for (i = 0; i < readers; i++) {
         jint eventStateTmp;
-        jobject jReaderName = (*env)->GetObjectArrayElement(env, jReaderNames, i);
         dprintf3("-reader status %s: 0x%X, 0x%X\n", readerState[i].szReader,
             readerState[i].dwCurrentState, readerState[i].dwEventState);
-        (*env)->ReleaseStringUTFChars(env, jReaderName, readerState[i].szReader);
         eventStateTmp = (jint)readerState[i].dwEventState;
         (*env)->SetIntArrayRegion(env, jEventState, i, 1, &eventStateTmp);
+        if ((*env)->ExceptionCheck(env)) {
+            jEventState = NULL;
+            goto cleanup;
+        }
+    }
+cleanup:
+    (*env)->ReleaseIntArrayElements(env, jCurrentState, currentState, JNI_ABORT);
+    for (i = 0; i < readers; i++) {
+        free((char *)readerState[i].szReader);
     }
     free(readerState);
-
-    handleRV(env, rv);
     return jEventState;
 }
 
@@ -336,13 +435,18 @@
 {
     SCARDHANDLE card = (SCARDHANDLE)jCard;
     LONG rv;
-    jbyte* sendBuffer = (*env)->GetByteArrayElements(env, jSendBuffer, NULL);
+    jbyte* sendBuffer;
     jint sendBufferLength = (*env)->GetArrayLength(env, jSendBuffer);
     jbyte receiveBuffer[MAX_STACK_BUFFER_SIZE];
     jint receiveBufferLength = MAX_STACK_BUFFER_SIZE;
     ULONG returnedLength = 0;
     jbyteArray jReceiveBuffer;
 
+    sendBuffer = (*env)->GetByteArrayElements(env, jSendBuffer, NULL);
+    if (sendBuffer == NULL) {
+        return NULL;
+    }
+
 #ifdef J2PCSC_DEBUG
 {
     int k;
@@ -375,7 +479,12 @@
 #endif
 
     jReceiveBuffer = (*env)->NewByteArray(env, returnedLength);
+    if (jReceiveBuffer == NULL) {
+        return NULL;
+    }
     (*env)->SetByteArrayRegion(env, jReceiveBuffer, 0, returnedLength, receiveBuffer);
-
+    if ((*env)->ExceptionCheck(env)) {
+        return NULL;
+    }
     return jReceiveBuffer;
 }
--- a/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java	Tue Jun 03 10:28:00 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -97,6 +97,7 @@
      * @param handler the synthetic error handler to set
      */
     public static void WITH_XERROR_HANDLER(XErrorHandler handler) {
+        XSync();
         saved_error = null;
         current_error_handler = handler;
     }
@@ -105,15 +106,9 @@
      * Unsets a current synthetic error handler. Must be called with the acquired AWT lock.
      */
     public static void RESTORE_XERROR_HANDLER() {
-        RESTORE_XERROR_HANDLER(true);
-    }
-
-    private static void RESTORE_XERROR_HANDLER(boolean doXSync) {
-        if (doXSync) {
-            // Wait until all requests are processed by the X server
-            // and only then uninstall the error handler.
-            XSync();
-        }
+        // Wait until all requests are processed by the X server
+        // and only then uninstall the error handler.
+        XSync();
         current_error_handler = null;
     }
 
--- a/src/solaris/classes/sun/awt/X11/XFramePeer.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/solaris/classes/sun/awt/X11/XFramePeer.java	Tue Jun 03 10:28:00 2014 -0700
@@ -284,6 +284,11 @@
             if (stateLog.isLoggable(PlatformLogger.Level.FINER)) {
                 stateLog.finer("DeIconifying " + this);
             }
+
+            XNETProtocol net_protocol = XWM.getWM().getNETProtocol();
+            if (net_protocol != null) {
+                net_protocol.setActiveWindow(this);
+            }
             xSetVisible(true);
         }
     }
--- a/src/solaris/classes/sun/awt/X11/XNETProtocol.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/solaris/classes/sun/awt/X11/XNETProtocol.java	Tue Jun 03 10:28:00 2014 -0700
@@ -213,7 +213,7 @@
      * If window is showing then it uses ClientMessage, otherwise adjusts NET_WM_STATE list
      * @param window Window which NET_WM_STATE property is being modified
      * @param state State atom to be set/reset
-     * @param reset Indicates operation, 'set' if false, 'reset' if true
+     * @param set Indicates operation, 'set' if false, 'reset' if true
      */
     private void setStateHelper(XWindowPeer window, XAtom state, boolean set) {
         if (log.isLoggable(PlatformLogger.Level.FINER)) {
@@ -249,6 +249,7 @@
     XAtom XA_UTF8_STRING = XAtom.get("UTF8_STRING");   /* like STRING but encoding is UTF-8 */
     XAtom XA_NET_SUPPORTING_WM_CHECK = XAtom.get("_NET_SUPPORTING_WM_CHECK");
     XAtom XA_NET_SUPPORTED = XAtom.get("_NET_SUPPORTED");      /* list of protocols (property of root) */
+    XAtom XA_NET_ACTIVE_WINDOW = XAtom.get("_NET_ACTIVE_WINDOW");
     XAtom XA_NET_WM_NAME = XAtom.get("_NET_WM_NAME");  /* window property */
     XAtom XA_NET_WM_STATE = XAtom.get("_NET_WM_STATE");/* both window property and request */
 
@@ -325,6 +326,32 @@
         return res;
     }
 
+    public void setActiveWindow(XWindow window) {
+        if (!active() || !checkProtocol(XA_NET_SUPPORTED, XA_NET_ACTIVE_WINDOW)) {
+            return;
+        }
+
+        XClientMessageEvent msg = new XClientMessageEvent();
+        msg.zero();
+        msg.set_type(XConstants.ClientMessage);
+        msg.set_message_type(XA_NET_ACTIVE_WINDOW.getAtom());
+        msg.set_display(XToolkit.getDisplay());
+        msg.set_window(window.getWindow());
+        msg.set_format(32);
+        msg.set_data(0, 1);
+        msg.set_data(1, XToolkit.getCurrentServerTime());
+        msg.set_data(2, 0);
+
+        XToolkit.awtLock();
+        try {
+            XlibWrapper.XSendEvent(XToolkit.getDisplay(), XToolkit.getDefaultRootWindow(), false,
+                    XConstants.SubstructureRedirectMask | XConstants.SubstructureNotifyMask, msg.getPData());
+        } finally {
+            XToolkit.awtUnlock();
+            msg.dispose();
+        }
+    }
+
     boolean isWMName(String name) {
         if (!active()) {
             return false;
--- a/src/solaris/native/java/net/NetworkInterface.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/solaris/native/java/net/NetworkInterface.c	Tue Jun 03 10:28:00 2014 -0700
@@ -250,7 +250,11 @@
     }
 
     name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
-
+    if (name_utf == NULL) {
+       if (!(*env)->ExceptionCheck(env))
+           JNU_ThrowOutOfMemoryError(env, NULL);
+       return NULL;
+    }
     /*
      * Search the list of interface based on name
      */
@@ -518,7 +522,11 @@
     const char* name_utf;
 
     name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
-
+    if (name_utf == NULL) {
+       if (!(*env)->ExceptionCheck(env))
+           JNU_ThrowOutOfMemoryError(env, NULL);
+       return NULL;
+    }
     if ((sock =openSocketWithFallback(env, name_utf)) < 0) {
        (*env)->ReleaseStringUTFChars(env, name, name_utf);
        return JNI_FALSE;
@@ -565,6 +573,11 @@
     const char* name_utf;
 
     name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
+    if (name_utf == NULL) {
+       if (!(*env)->ExceptionCheck(env))
+           JNU_ThrowOutOfMemoryError(env, NULL);
+       return ret;
+    }
 
     if ((sock =openSocketWithFallback(env, name_utf)) < 0) {
        (*env)->ReleaseStringUTFChars(env, name, name_utf);
@@ -588,7 +601,11 @@
     int flags = 0;
 
     name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
-
+    if (name_utf == NULL) {
+       if (!(*env)->ExceptionCheck(env))
+           JNU_ThrowOutOfMemoryError(env, NULL);
+       return -1;
+    }
     if ((sock = openSocketWithFallback(env, name_utf)) < 0) {
         (*env)->ReleaseStringUTFChars(env, name, name_utf);
         return -1;
@@ -632,10 +649,9 @@
      * Create a NetworkInterface object and populate it
      */
     netifObj = (*env)->NewObject(env, ni_class, ni_ctrID);
+    CHECK_NULL_RETURN(netifObj, NULL);
     name = (*env)->NewStringUTF(env, ifs->name);
-    if (netifObj == NULL || name == NULL) {
-        return NULL;
-    }
+    CHECK_NULL_RETURN(name, NULL);
     (*env)->SetObjectField(env, netifObj, ni_nameID, name);
     (*env)->SetObjectField(env, netifObj, ni_descID, name);
     (*env)->SetIntField(env, netifObj, ni_indexID, ifs->index);
@@ -674,6 +690,8 @@
             iaObj = (*env)->NewObject(env, ni_ia4cls, ni_ia4ctrID);
             if (iaObj) {
                  setInetAddress_addr(env, iaObj, htonl(((struct sockaddr_in*)addrP->addr)->sin_addr.s_addr));
+            } else {
+                return NULL;
             }
             ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
             if (ibObj) {
@@ -684,10 +702,14 @@
                     if (ia2Obj) {
                        setInetAddress_addr(env, ia2Obj, htonl(((struct sockaddr_in*)addrP->brdcast)->sin_addr.s_addr));
                        (*env)->SetObjectField(env, ibObj, ni_ib4broadcastID, ia2Obj);
+                    } else {
+                        return NULL;
                     }
                  }
                  (*env)->SetShortField(env, ibObj, ni_ib4maskID, addrP->mask);
                  (*env)->SetObjectArrayElement(env, bindArr, bind_index++, ibObj);
+            } else {
+                return NULL;
             }
         }
 
@@ -707,20 +729,20 @@
                     setInet6Address_scopeid(env, iaObj, scope);
                     setInet6Address_scopeifname(env, iaObj, netifObj);
                 }
+            } else {
+                return NULL;
             }
             ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
             if (ibObj) {
                 (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj);
                 (*env)->SetShortField(env, ibObj, ni_ib4maskID, addrP->mask);
                 (*env)->SetObjectArrayElement(env, bindArr, bind_index++, ibObj);
+            } else {
+                return NULL;
             }
         }
 #endif
 
-        if (iaObj == NULL) {
-            return NULL;
-        }
-
         (*env)->SetObjectArrayElement(env, addrArr, addr_index++, iaObj);
         addrP = addrP->next;
     }
@@ -912,9 +934,14 @@
        // Deal with broadcast addr & subnet mask
        struct sockaddr * brdcast_to = (struct sockaddr *) ((char *) addrP + sizeof(netaddr) + addr_size);
        addrP->brdcast = getBroadcast(env, sock, name,  brdcast_to );
-
-       if ((mask = getSubnet(env, sock, name)) != -1)
+       if ((*env)->ExceptionCheck(env) == JNI_TRUE) {
+           return ifs;
+       }
+       if ((mask = getSubnet(env, sock, name)) != -1) {
            addrP->mask = mask;
+       } else if((*env)->ExceptionCheck(env)) {
+           return ifs;
+       }
      }
 
     /**
@@ -1396,6 +1423,7 @@
     nddp = (struct kinfo_ndd *)malloc(size);
 
     if (!nddp) {
+        JNU_ThrowOutOfMemoryError(env, "Network interface getMacAddress native buffer allocation failed");
         return -1;
     }
 
--- a/src/solaris/native/sun/awt/gtk2_interface.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/solaris/native/sun/awt/gtk2_interface.c	Tue Jun 03 10:28:00 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/nio/ch/FileChannelImpl.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/solaris/native/sun/nio/ch/FileChannelImpl.c	Tue Jun 03 10:28:00 2014 -0700
@@ -39,6 +39,8 @@
 
 #if defined(__linux__) || defined(__solaris__)
 #include <sys/sendfile.h>
+#elif defined(_AIX)
+#include <sys/socket.h>
 #elif defined(_ALLBSD_SOURCE)
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -207,9 +209,7 @@
 
     numBytes = count;
 
-#ifdef __APPLE__
     result = sendfile(srcFD, dstFD, position, &numBytes, NULL, 0);
-#endif
 
     if (numBytes > 0)
         return numBytes;
@@ -228,7 +228,48 @@
     }
 
     return result;
+
+#elif defined(_AIX)
+    jlong max = (jlong)java_lang_Integer_MAX_VALUE;
+    struct sf_parms sf_iobuf;
+    jlong result;
+
+    if (position > max)
+        return IOS_UNSUPPORTED_CASE;
+
+    if (count > max)
+        count = max;
+
+    memset(&sf_iobuf, 0, sizeof(sf_iobuf));
+    sf_iobuf.file_descriptor = srcFD;
+    sf_iobuf.file_offset = (off_t)position;
+    sf_iobuf.file_bytes = count;
+
+    result = send_file(&dstFD, &sf_iobuf, SF_SYNC_CACHE);
+
+    /* AIX send_file() will return 0 when this operation complete successfully,
+     * return 1 when partial bytes transfered and return -1 when an error has
+     * Occured.
+     */
+    if (result == -1) {
+        if (errno == EWOULDBLOCK)
+            return IOS_UNAVAILABLE;
+        if ((errno == EINVAL) && ((ssize_t)count >= 0))
+            return IOS_UNSUPPORTED_CASE;
+        if (errno == EINTR)
+            return IOS_INTERRUPTED;
+        if (errno == ENOTSOCK)
+            return IOS_UNSUPPORTED;
+        JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
+        return IOS_THROWN;
+    }
+
+    if (sf_iobuf.bytes_sent > 0)
+        return (jlong)sf_iobuf.bytes_sent;
+
+    return IOS_UNSUPPORTED_CASE;
 #else
     return IOS_UNSUPPORTED_CASE;
 #endif
 }
+
--- a/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Tue Jun 03 10:28:00 2014 -0700
@@ -62,6 +62,8 @@
 
 #define MAX_ATR_SIZE                    33      /* Maximum ATR size */
 
+#ifndef __APPLE__
+
 typedef struct
 {
         const char *szReader;
@@ -73,6 +75,23 @@
 }
 SCARD_READERSTATE_A;
 
+#else // __APPLE__
+
+#pragma pack(1)
+typedef struct
+{
+        const char *szReader;
+        void *pvUserData;
+        uint32_t dwCurrentState;
+        uint32_t dwEventState;
+        uint32_t cbAtr;
+        unsigned char rgbAtr[MAX_ATR_SIZE];
+}
+SCARD_READERSTATE_A;
+#pragma pack()
+
+#endif // __APPLE__
+
 typedef SCARD_READERSTATE_A SCARD_READERSTATE, *PSCARD_READERSTATE_A,
         *LPSCARD_READERSTATE_A;
 
--- a/src/solaris/native/sun/security/smartcardio/pcsc_md.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/solaris/native/sun/security/smartcardio/pcsc_md.c	Tue Jun 03 10:28:00 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
@@ -89,6 +89,10 @@
 JNIEXPORT void JNICALL Java_sun_security_smartcardio_PlatformPCSC_initialize
         (JNIEnv *env, jclass thisClass, jstring jLibName) {
     const char *libName = (*env)->GetStringUTFChars(env, jLibName, NULL);
+    if (libName == NULL) {
+        throwNullPointerException(env, "PCSC library name is null");
+        return;
+    }
     hModule = dlopen(libName, RTLD_LAZY);
     (*env)->ReleaseStringUTFChars(env, jLibName, libName);
 
@@ -97,13 +101,44 @@
         return;
     }
     scardEstablishContext = (FPTR_SCardEstablishContext)findFunction(env, hModule, "SCardEstablishContext");
+    if ((*env)->ExceptionCheck(env)) {
+         return;
+    }
     scardConnect          = (FPTR_SCardConnect)         findFunction(env, hModule, "SCardConnect");
+    if ((*env)->ExceptionCheck(env)) {
+         return;
+    }
     scardDisconnect       = (FPTR_SCardDisconnect)      findFunction(env, hModule, "SCardDisconnect");
+    if ((*env)->ExceptionCheck(env)) {
+         return;
+    }
     scardStatus           = (FPTR_SCardStatus)          findFunction(env, hModule, "SCardStatus");
+    if ((*env)->ExceptionCheck(env)) {
+         return;
+    }
     scardGetStatusChange  = (FPTR_SCardGetStatusChange) findFunction(env, hModule, "SCardGetStatusChange");
+    if ((*env)->ExceptionCheck(env)) {
+         return;
+    }
     scardTransmit         = (FPTR_SCardTransmit)        findFunction(env, hModule, "SCardTransmit");
+    if ((*env)->ExceptionCheck(env)) {
+         return;
+    }
     scardListReaders      = (FPTR_SCardListReaders)     findFunction(env, hModule, "SCardListReaders");
+    if ((*env)->ExceptionCheck(env)) {
+         return;
+    }
     scardBeginTransaction = (FPTR_SCardBeginTransaction)findFunction(env, hModule, "SCardBeginTransaction");
+    if ((*env)->ExceptionCheck(env)) {
+         return;
+    }
     scardEndTransaction   = (FPTR_SCardEndTransaction)  findFunction(env, hModule, "SCardEndTransaction");
+    if ((*env)->ExceptionCheck(env)) {
+         return;
+    }
+#ifndef __APPLE__
     scardControl          = (FPTR_SCardControl)         findFunction(env, hModule, "SCardControl");
+#else
+    scardControl          = (FPTR_SCardControl)         findFunction(env, hModule, "SCardControl132");
+#endif // __APPLE__
 }
--- a/src/solaris/native/sun/xawt/XlibWrapper.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/solaris/native/sun/xawt/XlibWrapper.c	Tue Jun 03 10:28:00 2014 -0700
@@ -1236,10 +1236,8 @@
     long length = strlen((char*)str);
     jbyteArray res = (*env)->NewByteArray(env, length);
     CHECK_NULL_RETURN(res, NULL);
-    void * storage = malloc(length+1);
-    memcpy(storage, str, length+1);
     (*env)->SetByteArrayRegion(env, res, 0, length,
-                   (const signed char*) storage);
+                   (const signed char*) str);
     return res;
 }
 
--- a/src/windows/native/java/io/io_util_md.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/windows/native/java/io/io_util_md.c	Tue Jun 03 10:28:00 2014 -0700
@@ -161,10 +161,17 @@
             {
                  if (pathlen > max_path - 1) {
                      pathbuf = prefixAbpath(ps, pathlen, pathlen);
+                     if (pathbuf == NULL) {
+                         JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
+                         return NULL;
+                     }
                  } else {
                      pathbuf = (WCHAR*)malloc((pathlen + 6) * sizeof(WCHAR));
                      if (pathbuf != 0) {
                          wcscpy(pathbuf, ps);
+                     } else {
+                         JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
+                         return NULL;
                      }
                  }
             } else {
@@ -184,10 +191,17 @@
                 int dirlen = currentDirLength(ps, pathlen);
                 if (dirlen + pathlen + 1 > max_path - 1) {
                     pathbuf = prefixAbpath(ps, pathlen, dirlen + pathlen);
+                    if( pathbuf == NULL) {
+                        JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
+                        return NULL;
+                    }
                 } else {
                     pathbuf = (WCHAR*)malloc((pathlen + 6) * sizeof(WCHAR));
                     if (pathbuf != 0) {
                         wcscpy(pathbuf, ps);
+                    } else {
+                        JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
+                        return NULL;
                     }
                 }
             }
@@ -196,7 +210,9 @@
 
     if (pathlen == 0) {
         if (throwFNFE == JNI_TRUE) {
-            throwFileNotFoundException(env, path);
+            if (!(*env)->ExceptionCheck(env)) {
+                throwFileNotFoundException(env, path);
+            }
             return NULL;
         } else {
             pathbuf = (WCHAR*)malloc(sizeof(WCHAR));
@@ -204,7 +220,9 @@
         }
     }
     if (pathbuf == 0) {
-        JNU_ThrowOutOfMemoryError(env, 0);
+        if (!(*env)->ExceptionCheck(env)) {
+            JNU_ThrowOutOfMemoryError(env,  "native memory allocation failed");
+        }
         return NULL;
     }
     return pathbuf;
--- a/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c	Tue Jun 03 10:28:00 2014 -0700
@@ -376,15 +376,19 @@
         if (packetAddress == NULL) {
             packetAddress = NET_SockaddrToInetAddress(env, (struct sockaddr *)&sa,
                                                       &port);
-            /* stuff the new Inetaddress into the packet */
-            (*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress);
+            if (packetAddress != NULL) {
+                /* stuff the new Inetaddress into the packet */
+                (*env)->SetObjectField(env, dpObj, dp_addressID, packetAddress);
+            }
         }
 
-        /* populate the packet */
-        (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, rv,
+        if (!(*env)->ExceptionCheck(env)) {
+            /* populate the packet */
+            (*env)->SetByteArrayRegion(env, packetBuffer, packetBufferOffset, rv,
                                    (jbyte *)fullPacket);
-        (*env)->SetIntField(env, dpObj, dp_portID, port);
-        (*env)->SetIntField(env, dpObj, dp_lengthID, rv);
+            (*env)->SetIntField(env, dpObj, dp_portID, port);
+            (*env)->SetIntField(env, dpObj, dp_lengthID, rv);
+        }
     }
 
     if (packetBufferLen > MAX_BUFFER_LEN) {
--- a/src/windows/native/java/net/NetworkInterface.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/windows/native/java/net/NetworkInterface.c	Tue Jun 03 10:28:00 2014 -0700
@@ -567,16 +567,16 @@
      * Create a NetworkInterface object and populate it
      */
     netifObj = (*env)->NewObject(env, ni_class, ni_ctor);
+    CHECK_NULL_RETURN(netifObj, NULL);
     name = (*env)->NewStringUTF(env, ifs->name);
+    CHECK_NULL_RETURN(name, NULL);
     if (ifs->dNameIsUnicode) {
         displayName = (*env)->NewString(env, (PWCHAR)ifs->displayName,
                                        (jsize)wcslen ((PWCHAR)ifs->displayName));
     } else {
         displayName = (*env)->NewStringUTF(env, ifs->displayName);
     }
-    if (netifObj == NULL || name == NULL || displayName == NULL) {
-        return NULL;
-    }
+    CHECK_NULL_RETURN(displayName, NULL);
     (*env)->SetObjectField(env, netifObj, ni_nameID, name);
     (*env)->SetObjectField(env, netifObj, ni_displayNameID, displayName);
     (*env)->SetIntField(env, netifObj, ni_indexID, ifs->index);
@@ -706,24 +706,29 @@
 
     /* get the name as a C string */
     name_utf = (*env)->GetStringUTFChars(env, name, &isCopy);
+    if (name_utf != NULL) {
 
-    /* Search by name */
-    curr = ifList;
-    while (curr != NULL) {
-        if (strcmp(name_utf, curr->name) == 0) {
-            break;
+        /* Search by name */
+        curr = ifList;
+        while (curr != NULL) {
+            if (strcmp(name_utf, curr->name) == 0) {
+                break;
+            }
+            curr = curr->next;
         }
-        curr = curr->next;
+
+        /* if found create a NetworkInterface */
+        if (curr != NULL) {;
+            netifObj = createNetworkInterface(env, curr, -1, NULL);
+        }
+
+        /* release the UTF string */
+        (*env)->ReleaseStringUTFChars(env, name, name_utf);
+    } else {
+        if (!(*env)->ExceptionCheck(env))
+            JNU_ThrowOutOfMemoryError(env, NULL);
     }
 
-    /* if found create a NetworkInterface */
-    if (curr != NULL) {;
-        netifObj = createNetworkInterface(env, curr, -1, NULL);
-    }
-
-    /* release the UTF string */
-    (*env)->ReleaseStringUTFChars(env, name, name_utf);
-
     /* release the interface list */
     free_netif(ifList);
 
--- a/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/windows/native/sun/net/dns/ResolverConfigurationImpl.c	Tue Jun 03 10:28:00 2014 -0700
@@ -39,6 +39,7 @@
 #define STS_NO_CONFIG       0x0             /* no configuration found */
 #define STS_SL_FOUND        0x1             /* search list found */
 #define STS_NS_FOUND        0x2             /* name servers found */
+#define STS_ERROR           -1              /* error return  lodConfig failed memory allccation failure*/
 
 #define IS_SL_FOUND(sts)    (sts & STS_SL_FOUND)
 #define IS_NS_FOUND(sts)    (sts & STS_NS_FOUND)
@@ -123,14 +124,14 @@
     size = sizeof(IP_ADAPTER_INFO);
     adapterP = (IP_ADAPTER_INFO *)malloc(size);
     if (adapterP == NULL) {
-        return -1;
+        return STS_ERROR;
     }
     ret = GetAdaptersInfo(adapterP, &size);
     if (ret == ERROR_BUFFER_OVERFLOW) {
         IP_ADAPTER_INFO *newAdapterP = (IP_ADAPTER_INFO *)realloc(adapterP, size);
         if (newAdapterP == NULL) {
             free(adapterP);
-            return -1;
+            return STS_ERROR;
         }
         adapterP = newAdapterP;
 
@@ -239,6 +240,7 @@
 {
     searchlistID = (*env)->GetStaticFieldID(env, cls, "os_searchlist",
                                       "Ljava/lang/String;");
+    CHECK_NULL(searchlistID);
     nameserversID = (*env)->GetStaticFieldID(env, cls, "os_nameservers",
                                       "Ljava/lang/String;");
 }
@@ -258,16 +260,21 @@
     searchlist[0] = '\0';
     nameservers[0] = '\0';
 
-    loadConfig(searchlist, nameservers);
+    if (loadConfig(searchlist, nameservers) != STS_ERROR) {
 
-    /*
-     * Populate static fields in sun.net.DefaultResolverConfiguration
-     */
-    obj = (*env)->NewStringUTF(env, searchlist);
-    (*env)->SetStaticObjectField(env, cls, searchlistID, obj);
+        /*
+         * Populate static fields in sun.net.DefaultResolverConfiguration
+         */
+        obj = (*env)->NewStringUTF(env, searchlist);
+        CHECK_NULL(obj);
+        (*env)->SetStaticObjectField(env, cls, searchlistID, obj);
 
-    obj = (*env)->NewStringUTF(env, nameservers);
-    (*env)->SetStaticObjectField(env, cls, nameserversID, obj);
+        obj = (*env)->NewStringUTF(env, nameservers);
+        CHECK_NULL(obj);
+        (*env)->SetStaticObjectField(env, cls, nameserversID, obj);
+    } else {
+        JNU_ThrowOutOfMemoryError(env, "native memory allocation failed");
+    }
 }
 
 
--- a/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Tue Jun 03 10:21:20 2014 -0700
+++ b/src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c	Tue Jun 03 10:28:00 2014 -0700
@@ -1118,11 +1118,13 @@
                     JNU_ThrowInternalError(env, "GetFullPathNameW failed");
                 }
                 free(lpBuf);
+            } else {
+                JNU_ThrowOutOfMemoryError(env, "native memory allocation failure");
             }
         }
+    } else {
+        throwWindowsException(env, GetLastError());
     }
-    if (len == 0)
-        throwWindowsException(env, GetLastError());
 
     return rv;
 }
@@ -1157,13 +1159,13 @@
                     JNU_ThrowInternalError(env, "GetFinalPathNameByHandleW failed");
                 }
                 free(lpBuf);
+            } else {
+                JNU_ThrowOutOfMemoryError(env, "native memory allocation failure");
             }
         }
+    } else {
+        throwWindowsException(env, GetLastError());
     }
-
-    if (len == 0)
-        throwWindowsException(env, GetLastError());
-
     return rv;
 }
 
--- a/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Tue Jun 03 10:21:20 2014 -0700
+++ b/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Tue Jun 03 10:28:00 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -64,11 +64,12 @@
         env.put(Context.SECURITY_PRINCIPAL, "user");
         env.put(Context.SECURITY_CREDENTIALS, "password");
 
-        env.put("com.sun.jndi.ldap.connect.timeout", "10");
-        env.put("com.sun.jndi.ldap.read.timeout", "3000");
-
         InitialContext ctx = null;
         try {
+            new LdapTimeoutTest().deadServerNoTimeout(env);
+
+            env.put("com.sun.jndi.ldap.connect.timeout", "10");
+            env.put("com.sun.jndi.ldap.read.timeout", "3000");
             new LdapTimeoutTest().ldapReadTimeoutTest(env, false);
             new LdapTimeoutTest().ldapReadTimeoutTest(env, true);
             new LdapTimeoutTest().simpleAuthConnectTest(env);
@@ -84,7 +85,7 @@
     void ldapReadTimeoutTest(Hashtable env, boolean ssl) {
         InitialContext ctx = null;
         if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl");
-        ScheduledFuture killer = killSwitch();
+        ScheduledFuture killer = killSwitch(5000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -112,7 +113,7 @@
 
     void simpleAuthConnectTest(Hashtable env) {
         InitialContext ctx = null;
-        ScheduledFuture killer = killSwitch();
+        ScheduledFuture killer = killSwitch(5000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -139,6 +140,32 @@
         }
     }
 
+    void deadServerNoTimeout(Hashtable env) {
+        InitialContext ctx = null;
+        ScheduledFuture killer = killSwitch(30000);
+        long start = System.nanoTime();
+        try {
+            ctx = new InitialDirContext(env);
+            SearchControls scl = new SearchControls();
+            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+            NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
+                .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
+            // shouldn't reach here
+            fail();
+        } catch (NamingException e) {
+            long end = System.nanoTime();
+            if (TimeUnit.NANOSECONDS.toMillis(end - start) < 14000) {
+                System.err.println("fail: timeout should be at least 15 seconds, actual time: "
+                                   + TimeUnit.NANOSECONDS.toMillis(end - start));
+                fail();
+            } else {
+                pass();
+            }
+        } finally {
+            if (!shutItDown(killer, ctx)) fail();
+        }
+    }
+
     boolean shutItDown(ScheduledFuture killer, InitialContext ctx) {
         killer.cancel(true);
         try {
@@ -149,15 +176,15 @@
         }
     }
 
-    ScheduledFuture killSwitch() {
+    ScheduledFuture killSwitch(int ms) {
         final Thread current = Thread.currentThread();
         return LdapTimeoutTest.pool.schedule(new Callable<Void>() {
             public Void call() throws Exception {
                 System.err.println("Fail: killSwitch()");
-                current.interrupt();
+                System.exit(0);
                 return null;
             }
-        }, 5000, TimeUnit.MILLISECONDS);
+        }, ms, TimeUnit.MILLISECONDS);
     }
 
     static class Server extends Thread {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Choice/RemoveAllShrinkTest/RemoveAllShrinkTest.java	Tue Jun 03 10:28:00 2014 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4851798 8041896
+  @summary Tests Choice List shrinks after removeAll
+  @run main RemoveAllShrinkTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+public class RemoveAllShrinkTest {
+
+    public static void main(String[] args) {
+        Frame f = new Frame();
+        Choice choice = new Choice();
+
+        for (int i = 0; i < 10; ++i) {
+            choice.addItem("Item " + i);
+        }
+
+        f.add(choice, BorderLayout.NORTH);
+        Panel panel = new Panel();
+        panel.setBackground(Color.RED);
+        f.add(panel);
+
+        f.setSize(200, 200);
+        f.setVisible(true);
+        f.toFront();
+
+        choice.removeAll();
+
+        try {
+            Robot robot = new Robot();
+            robot.setAutoWaitForIdle(true);
+            robot.setAutoDelay(50);
+
+            robot.waitForIdle();
+            Thread.sleep(200);
+
+            Point pt = choice.getLocationOnScreen();
+            robot.mouseMove(pt.x + choice.getWidth() - choice.getHeight() / 2,
+                    pt.y + choice.getHeight() / 2);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+            Thread.sleep(400);
+
+            Point pt1 = panel.getLocationOnScreen();
+
+            Color color = robot.getPixelColor(pt1.x + panel.getWidth() / 2,
+                    pt1.y + panel.getHeight() / 2);
+
+            if (!color.equals(Color.RED)) {
+                throw new RuntimeException("RemoveAllShrinkTest failed. " + color);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("The test was not completed.\n\n" + e);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java	Tue Jun 03 10:28:00 2014 -0700
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 8017472
+  @summary MouseEvent has wrong coordinates when using multiple monitors
+  @run main MouseEventTest
+ */
+
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+public class MouseEventTest {
+    static volatile boolean crossed = false;
+
+    static void sleep() throws InterruptedException {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Thread.sleep(500);
+    }
+
+    public static void main(String[] args) throws AWTException, InterruptedException {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            System.out.println("It's a multiscreen test... skipping!");
+            return;
+        }
+
+        for (int i = 0; i < gds.length; ++i) {
+            GraphicsDevice gd = gds[i];
+            GraphicsConfiguration gc = gd.getDefaultConfiguration();
+            Rectangle screen = gc.getBounds();
+            Robot robot = new Robot(gd);
+            robot.setAutoDelay(100);
+
+
+            Frame frame = new Frame(gc);
+            frame.setUndecorated(true);
+            frame.setSize(200, 200);
+            frame.setLocation(screen.x + 200, screen.y + 200);
+            frame.setBackground(Color.YELLOW);
+            frame.setVisible(true);
+            sleep();
+
+            Point loc = frame.getLocationOnScreen();
+            Dimension size = frame.getSize();
+            final Point point = new Point(
+                    loc.x + size.width / 2,
+                    loc.y + size.height / 2);
+
+            crossed = false;
+
+            frame.addMouseMotionListener(new MouseAdapter() {
+                @Override
+                public void mouseMoved(MouseEvent e) {
+                    if (point.equals(e.getLocationOnScreen())) {
+                        crossed = true;
+                    }
+                }
+            });
+
+            robot.mouseMove(point.x - 1, point.y - 1);
+            robot.mouseMove(point.x, point.y);
+
+            sleep();
+            frame.dispose();
+
+            if (!crossed) {
+                throw new RuntimeException("An expected mouse motion event was not received on the screen #" + i);
+            }
+        }
+
+        System.out.println("Test PASSED!");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/image/ImageIconHang.java	Tue Jun 03 10:28:00 2014 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @bug     8032788
+ * @summary Checks that null filename argument is processed correctly
+ *
+ * @run     main ImageIconHang
+ */
+public class ImageIconHang {
+    public static void main(String[] args) throws Exception {
+        Image image = Toolkit.getDefaultToolkit().getImage((String) null);
+        MediaTracker mt = new MediaTracker(new Component() {});
+        mt.addImage(image, 1);
+        mt.waitForID(1, 5000);
+
+        int status = mt.statusID(1, false);
+
+        System.out.println("Status: " + status);
+
+        if (status != MediaTracker.ERRORED) {
+            throw new RuntimeException("MediaTracker.waitForID() hung.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/time/test/java/time/temporal/TestIsoWeekFields.java	Tue Jun 03 10:28:00 2014 -0700
@@ -0,0 +1,280 @@
+/*
+ * 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 test.java.time.temporal;
+
+import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import static org.testng.Assert.assertEquals;
+
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.MonthDay;
+import java.time.OffsetDateTime;
+import java.time.Year;
+import java.time.chrono.ThaiBuddhistDate;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.IsoFields;
+import java.time.temporal.TemporalField;
+import java.time.temporal.ValueRange;
+import java.time.temporal.WeekFields;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test.
+ */
+@Test
+public class TestIsoWeekFields {
+
+    @DataProvider(name = "fields")
+    Object[][] data_Fields() {
+        return new Object[][] {
+                {IsoFields.WEEK_OF_WEEK_BASED_YEAR, IsoFields.WEEK_BASED_YEAR},
+                {WeekFields.ISO.weekOfWeekBasedYear(), WeekFields.ISO.weekBasedYear()},
+        };
+    }
+
+    //-----------------------------------------------------------------------
+    // WEEK_OF_WEEK_BASED_YEAR
+    //-----------------------------------------------------------------------
+    @Test(dataProvider = "fields")
+    public void test_WOWBY_basics(TemporalField weekField, TemporalField yearField) {
+        assertEquals(weekField.isDateBased(), true);
+        assertEquals(weekField.isTimeBased(), false);
+        assertEquals(weekField.getBaseUnit(), ChronoUnit.WEEKS);
+        assertEquals(weekField.getRangeUnit(), IsoFields.WEEK_BASED_YEARS);
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_WOWBY_isSupportedBy(TemporalField weekField, TemporalField yearField) {
+        assertEquals(weekField.isSupportedBy(LocalTime.NOON), false);
+        assertEquals(weekField.isSupportedBy(MonthDay.of(2, 1)), false);
+        assertEquals(weekField.isSupportedBy(LocalDate.MIN), true);
+        assertEquals(weekField.isSupportedBy(OffsetDateTime.MAX), true);
+    }
+
+    @Test
+    public void test_WOWBY_isSupportedBy_fieldsDiffer() {
+        assertEquals(IsoFields.WEEK_OF_WEEK_BASED_YEAR.isSupportedBy(ThaiBuddhistDate.now()), false);
+        assertEquals(WeekFields.ISO.weekOfWeekBasedYear().isSupportedBy(ThaiBuddhistDate.now()), true);
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_WOWBY_range(TemporalField weekField, TemporalField yearField) {
+        assertEquals(weekField.range(), ValueRange.of(1, 52, 53));
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_WOWBY_rangeRefinedBy(TemporalField weekField, TemporalField yearField) {
+        assertEquals(weekField.rangeRefinedBy(LocalDate.of(2012, 12, 31)), ValueRange.of(1, 52));
+        assertEquals(weekField.rangeRefinedBy(LocalDate.of(2013, 12, 29)), ValueRange.of(1, 52));
+        assertEquals(weekField.rangeRefinedBy(LocalDate.of(2013, 12, 30)), ValueRange.of(1, 52));
+        assertEquals(weekField.rangeRefinedBy(LocalDate.of(2014, 12, 28)), ValueRange.of(1, 52));
+        assertEquals(weekField.rangeRefinedBy(LocalDate.of(2014, 12, 29)), ValueRange.of(1, 53));
+        assertEquals(weekField.rangeRefinedBy(LocalDate.of(2016, 1, 3)), ValueRange.of(1, 53));
+        assertEquals(weekField.rangeRefinedBy(LocalDate.of(2016, 1, 4)), ValueRange.of(1, 52));
+    }
+
+    //-----------------------------------------------------------------------
+    // WEEK_BASED_YEAR
+    //-----------------------------------------------------------------------
+    @Test(dataProvider = "fields")
+    public void test_WBY_basics(TemporalField weekField, TemporalField yearField) {
+        assertEquals(yearField.isDateBased(), true);
+        assertEquals(yearField.isTimeBased(), false);
+        assertEquals(yearField.getBaseUnit(), IsoFields.WEEK_BASED_YEARS);
+        assertEquals(yearField.getRangeUnit(), ChronoUnit.FOREVER);
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_WBY_isSupportedBy(TemporalField weekField, TemporalField yearField) {
+        assertEquals(yearField.isSupportedBy(LocalTime.NOON), false);
+        assertEquals(yearField.isSupportedBy(MonthDay.of(2, 1)), false);
+        assertEquals(yearField.isSupportedBy(LocalDate.MIN), true);
+        assertEquals(yearField.isSupportedBy(OffsetDateTime.MAX), true);
+    }
+
+    @Test
+    public void test_WBY_isSupportedBy_ISO() {
+        assertEquals(IsoFields.WEEK_BASED_YEAR.isSupportedBy(ThaiBuddhistDate.now()), false);
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_WBY_range(TemporalField weekField, TemporalField yearField) {
+        assertEquals(yearField.range(), ValueRange.of(Year.MIN_VALUE, Year.MAX_VALUE));
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_WBY_rangeRefinedBy(TemporalField weekField, TemporalField yearField) {
+        assertEquals(yearField.rangeRefinedBy(LocalDate.of(2012, 12, 31)), ValueRange.of(Year.MIN_VALUE, Year.MAX_VALUE));
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider = "fields")
+    public void test_getFrom(TemporalField weekField, TemporalField yearField) {
+        // tests every day from 2011 to 2016 inclusive
+        LocalDate date = LocalDate.of(2011, 1, 3);
+        int wby = 2011;
+        int week = 1;
+        int dow = 1;
+        for (int i = 1; i <= ((52 + 52 + 52 + 52 + 53 + 52) * 7); i++) {
+            assertEquals(yearField.getFrom(date), wby);
+            assertEquals(weekField.getFrom(date), week);
+            assertEquals(DAY_OF_WEEK.getFrom(date), dow);
+            if (dow == 7) {
+                dow = 1;
+                week++;
+            } else {
+                dow++;
+            }
+            if (week > wbyLen(wby)) {
+                week = 1;
+                wby++;
+            }
+            date = date.plusDays(1);
+        }
+        assertEquals(yearField.getFrom(date), 2017);
+        assertEquals(weekField.getFrom(date), 1);
+        assertEquals(DAY_OF_WEEK.getFrom(date), 1);
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_adjustInto_dow(TemporalField weekField, TemporalField yearField) {
+        // tests every day from 2012 to 2016 inclusive
+        LocalDate date = LocalDate.of(2012, 1, 2);
+        int wby = 2012;
+        int week = 1;
+        int dow = 1;
+        for (int i = 1; i <= ((52 + 52 + 52 + 53 + 52) * 7); i++) {
+            for (int j = 1; j <= 7; j++) {
+                LocalDate adjusted = DAY_OF_WEEK.adjustInto(date, j);
+                assertEquals(adjusted.get(DAY_OF_WEEK), j);
+                assertEquals(adjusted.get(weekField), week);
+                assertEquals(adjusted.get(yearField), wby);
+            }
+            if (dow == 7) {
+                dow = 1;
+                week++;
+            } else {
+                dow++;
+            }
+            if (week > wbyLen(wby)) {
+                week = 1;
+                wby++;
+            }
+            date = date.plusDays(1);
+        }
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_adjustInto_week(TemporalField weekField, TemporalField yearField) {
+        // tests every day from 2012 to 2016 inclusive
+        LocalDate date = LocalDate.of(2012, 1, 2);
+        int wby = 2012;
+        int week = 1;
+        int dow = 1;
+        for (int i = 1; i <= ((52 + 52 + 52 + 53 + 52) * 7); i++) {
+            int weeksInYear = (wby == 2015 ? 53 : 52);
+            for (int j = 1; j <= weeksInYear; j++) {
+                LocalDate adjusted = weekField.adjustInto(date, j);
+                assertEquals(adjusted.get(weekField), j);
+                assertEquals(adjusted.get(DAY_OF_WEEK), dow);
+                assertEquals(adjusted.get(yearField), wby);
+            }
+            if (dow == 7) {
+                dow = 1;
+                week++;
+            } else {
+                dow++;
+            }
+            if (week > wbyLen(wby)) {
+                week = 1;
+                wby++;
+            }
+            date = date.plusDays(1);
+        }
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_adjustInto_wby(TemporalField weekField, TemporalField yearField) {
+        // tests every day from 2012 to 2016 inclusive
+        LocalDate date = LocalDate.of(2012, 1, 2);
+        int wby = 2012;
+        int week = 1;
+        int dow = 1;
+        for (int i = 1; i <= ((52 + 52 + 52 + 53 + 52) * 7); i++) {
+            for (int j = 2004; j <= 2015; j++) {
+                LocalDate adjusted = yearField.adjustInto(date, j);
+                assertEquals(adjusted.get(yearField), j);
+                assertEquals(adjusted.get(DAY_OF_WEEK), dow);
+                assertEquals(adjusted.get(weekField), (week == 53 && wbyLen(j) == 52 ? 52 : week), "" + date + " " + adjusted);
+            }
+            if (dow == 7) {
+                dow = 1;
+                week++;
+            } else {
+                dow++;
+            }
+            if (week > wbyLen(wby)) {
+                week = 1;
+                wby++;
+            }
+            date = date.plusDays(1);
+        }
+    }
+
+    @Test(dataProvider = "fields")
+    public void test_addTo_weekBasedYears(TemporalField weekField, TemporalField yearField) {
+        // tests every day from 2012 to 2016 inclusive
+        LocalDate date = LocalDate.of(2012, 1, 2);
+        int wby = 2012;
+        int week = 1;
+        int dow = 1;
+        for (int i = 1; i <= ((52 + 52 + 52 + 53 + 52) * 7); i++) {
+            for (int j = -5; j <= 5; j++) {
+                LocalDate adjusted = IsoFields.WEEK_BASED_YEARS.addTo(date, j);
+                assertEquals(adjusted.get(yearField), wby + j);
+                assertEquals(adjusted.get(DAY_OF_WEEK), dow);
+                assertEquals(adjusted.get(weekField), (week == 53 && wbyLen(wby + j) == 52 ? 52 : week), "" + date + " " + adjusted);
+            }
+            if (dow == 7) {
+                dow = 1;
+                week++;
+            } else {
+                dow++;
+            }
+            if (week > wbyLen(wby)) {
+                week = 1;
+                wby++;
+            }
+            date = date.plusDays(1);
+        }
+    }
+
+    private int wbyLen(int wby) {
+        return (wby == 2004 || wby == 2009 || wby == 2015 || wby == 2020 ? 53 : 52);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JComboBox/8019180/Test8019180.java	Tue Jun 03 10:28:00 2014 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+/*
+ * @test
+ * @bug 8019180
+ * @summary Tests that combobox works if it is used as action listener
+ * @author Sergey Malenkov
+ */
+
+public class Test8019180 implements Runnable {
+    private static final CountDownLatch LATCH = new CountDownLatch(1);
+    private static final String[] ITEMS = {"First", "Second", "Third", "Fourth"};
+
+    public static void main(String[] args) throws InterruptedException {
+        SwingUtilities.invokeLater(new Test8019180());
+        LATCH.await();
+    }
+
+    private JComboBox<String> test;
+
+    @Override
+    public void run() {
+        if (this.test == null) {
+            this.test = new JComboBox<>(ITEMS);
+            this.test.addActionListener(this.test);
+            JFrame frame = new JFrame();
+            frame.add(test);
+            frame.pack();
+            frame.setVisible(true);
+            SwingUtilities.invokeLater(this);
+        } else {
+            int index = this.test.getSelectedIndex();
+            this.test.setSelectedIndex(1 + index);
+            if (0 > this.test.getSelectedIndex()) {
+                System.err.println("ERROR: no selection");
+                System.exit(8019180);
+            }
+            SwingUtilities.getWindowAncestor(this.test).dispose();
+            LATCH.countDown();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JTabbedPane/8007563/Test8007563.java	Tue Jun 03 10:28:00 2014 -0700
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.Robot;
+import java.util.ArrayList;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTabbedPane;
+
+import static javax.swing.UIManager.*;
+import static javax.swing.SwingUtilities.*;
+
+/*
+ * @test
+ * @bug 8007563
+ * @summary Tests JTabbedPane background
+ * @author Sergey Malenkov
+ */
+
+public class Test8007563 implements Runnable {
+    private static final ArrayList<String> LIST = new ArrayList<>();
+    private static final LookAndFeelInfo[] INFO = getInstalledLookAndFeels();
+    private static final CountDownLatch LATCH = new CountDownLatch(INFO.length);
+    private static Robot ROBOT;
+
+    public static void main(String[] args) throws Exception {
+        ROBOT = new Robot();
+        invokeLater(new Test8007563());
+        LATCH.await();
+        if (!LIST.isEmpty()) {
+            throw new Error(LIST.toString());
+        }
+    }
+
+    private static void addOpaqueError(boolean opaque) {
+        LIST.add(getLookAndFeel().getName() + " opaque=" + opaque);
+    }
+
+    private static boolean updateLookAndFeel() {
+        int index = (int) LATCH.getCount() - 1;
+        if (index >= 0) {
+            try {
+                LookAndFeelInfo info = INFO[index];
+                System.err.println("L&F: " + info.getName());
+                setLookAndFeel(info.getClassName());
+                return true;
+            } catch (Exception exception) {
+                exception.printStackTrace();
+            }
+        }
+        return false;
+    }
+
+    private JFrame frame;
+    private JTabbedPane pane;
+
+    public void run() {
+        if (this.frame == null) {
+            if (!updateLookAndFeel()) {
+                return;
+            }
+            this.pane = new JTabbedPane();
+            this.pane.setOpaque(false);
+            this.pane.setBackground(Color.RED);
+            for (int i = 0; i < 3; i++) {
+                this.pane.addTab("Tab " + i, new JLabel("Content area " + i));
+            }
+            this.frame = new JFrame(getClass().getSimpleName());
+            this.frame.getContentPane().setBackground(Color.BLUE);
+            this.frame.add(this.pane);
+            this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+            this.frame.setSize(400, 200);
+            this.frame.setLocationRelativeTo(null);
+            this.frame.setVisible(true);
+        } else {
+            Point point = new Point(this.pane.getWidth() - 2, 2);
+            convertPointToScreen(point, this.pane);
+            Color actual = ROBOT.getPixelColor(point.x, point.y);
+
+            boolean opaque = this.pane.isOpaque();
+            Color expected = opaque
+                    ? this.pane.getBackground()
+                    : this.frame.getContentPane().getBackground();
+
+            if (!expected.equals(actual)){
+                addOpaqueError(opaque);
+            }
+            if (!opaque) {
+                this.pane.setOpaque(true);
+                this.pane.repaint();
+            } else {
+                this.frame.dispose();
+                this.frame = null;
+                this.pane = null;
+                LATCH.countDown();
+            }
+
+        }
+        invokeLater(this);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/ws/8043129/MailTest.java	Tue Jun 03 10:28:00 2014 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8043129
+ * @summary JAF initialisation in SAAJ clashing with the one in javax.mail
+ * @author mkos
+ * @library javax.mail.jar
+ * @build MailTest
+ * @run main MailTest
+ */
+
+import javax.activation.CommandMap;
+import javax.activation.MailcapCommandMap;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Session;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+public class MailTest {
+
+    String host = null;
+    String user = "";
+    String password = null;
+    String from = null;
+    String to = null;
+
+    public static void main(String[] args) {
+        MailTest t = new MailTest();
+
+        t.user = "somebody@somewhere.com";
+        t.from = "somebody@somewhere.com";
+        t.to = "somebody@somewhere.com";
+
+        t.user = "somebody@somewhere.com";
+        t.password = "somepassword";
+        t.host = "somehost";
+
+        t.sendMail();    //this works
+
+        t.addSoapAttachement();
+        t.sendMail();    //after addAttachmentPart to soapmessage it do not work
+
+        // workaroundJAFSetup();
+        // t.sendMail();    //after workaround works again
+    }
+
+    void addSoapAttachement() {
+        try {
+            MessageFactory messageFactory = MessageFactory.newInstance();
+            SOAPMessage message = messageFactory.createMessage();
+            AttachmentPart a = message.createAttachmentPart();
+            a.setContentType("binary/octet-stream");
+            message.addAttachmentPart(a);
+        } catch (SOAPException e) {
+            e.printStackTrace();
+        }
+    }
+
+    void sendMail() {
+
+        try {
+            Properties props = new Properties();
+            props.put("mail.smtp.host", host);
+            props.put("mail.smtp.auth", "true");
+
+            Session session = Session.getInstance(props);
+            session.setDebug(true);
+
+            // Define message
+            MimeMessage message = new MimeMessage(session);
+            message.setFrom(new InternetAddress(from));
+            message.addRecipients(Message.RecipientType.TO, to);
+            message.setSubject("this is a multipart test");
+
+            Multipart multipart = new MimeMultipart();
+
+            BodyPart messageBodyPart1 = new MimeBodyPart();
+            messageBodyPart1.setText("please send also this Content\n ciao!");
+            multipart.addBodyPart(messageBodyPart1);
+
+            BodyPart messageBodyPart2 = new MimeBodyPart();
+            messageBodyPart2.setContent("<b>please</b> send also this Content <br>ciao!", "text/html; charset=UTF-8");
+            multipart.addBodyPart(messageBodyPart2);
+
+            message.setContent(multipart);
+
+            /*
+                Transport tr = session.getTransport("smtp");
+                tr.connect(host,user, password);
+                tr.sendMessage(message,InternetAddress.parse(to));
+                tr.close();
+            */
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            message.writeTo(baos);
+            String output = baos.toString();
+            System.out.println("output = " + output);
+            if (output.contains("also this Content")) {
+                System.out.println("Test PASSED.");
+            } else {
+                System.out.println("Test FAILED, missing content.");
+                throw new IllegalStateException("Test FAILED, missing content.");
+            }
+        } catch (MessagingException ignored) {
+        } catch (IOException ignored) {
+        }
+    }
+
+    // this is how the error can be worked around ...
+    static void workaroundJAFSetup() {
+        MailcapCommandMap mailMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
+        mailMap.addMailcap("multipart/mixed;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
+    }
+}
Binary file test/javax/xml/ws/8043129/javax.mail.jar has changed