Merge
authorprr
Tue, 03 Mar 2015 08:49:13 -0800
changeset 29263 66e30e926405
parent 29262 1698800c8606 (diff)
parent 29247 57d4fecf7fcc (current diff)
child 29264 5172066a2da6
child 29512 073c09fc07fd
Merge
hotspot/src/share/vm/oops/oop.inline2.hpp
jdk/make/lib/SoundLibraries.gmk
jdk/src/java.base/share/classes/sun/security/acl/AclEntryImpl.java
jdk/src/java.base/share/classes/sun/security/acl/AclImpl.java
jdk/src/java.base/share/classes/sun/security/acl/AllPermissionsImpl.java
jdk/src/java.base/share/classes/sun/security/acl/GroupImpl.java
jdk/src/java.base/share/classes/sun/security/acl/OwnerImpl.java
jdk/src/java.base/share/classes/sun/security/acl/PermissionImpl.java
jdk/src/java.base/share/classes/sun/security/acl/PrincipalImpl.java
jdk/src/java.base/share/classes/sun/security/acl/WorldGroupImpl.java
jdk/src/java.desktop/share/native/libjsound/SoundDefs.h
jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/EUC_TW.java
jdk/test/com/sun/management/OperatingSystemMXBean/GetTotalSwapSpaceSize.java
jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.sh
jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/TabulatorsTest.java
jdk/test/sun/security/acl/PermissionImpl/PermissionEqualsHashCode.java
--- a/jdk/make/copy/Copy-java.desktop.gmk	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/make/copy/Copy-java.desktop.gmk	Tue Mar 03 08:49:13 2015 -0800
@@ -100,34 +100,3 @@
 TARGETS += $(PSFONTPROPFILE_TARGET_FILES)
 
 ################################################################################
-#
-# Copy cursor.properties and cursors gif files to LIB_DST_DIR
-#
-ifneq ($(OPENJDK_TARGET_OS), macosx)
-  OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/conf
-else
-  OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/conf
-endif
-
-CURSORS_DEST_DIR := $(LIB_DST_DIR)/images/cursors
-CURSORS_OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/conf/images/cursors
-
-$(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_OPENJDK_TARGET_OS_LIB_SRC)/cursors.properties
-	$(call install-file)
-
-TARGETS += $(CURSORS_DEST_DIR)/cursors.properties
-
-CURSORS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/share/conf/images/cursors
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  CURSORS_SRC_FILES := $(CURSORS_LIB_SRC)/invalid32x32.gif $(wildcard $(CURSORS_LIB_SRC)/win32_*.gif)
-else # OPENJDK_TARGET_OS
-  CURSORS_SRC_FILES := $(CURSORS_LIB_SRC)/invalid32x32.gif $(wildcard $(CURSORS_LIB_SRC)/motif_*.gif)
-endif # OPENJDK_TARGET_OS
-CURSORS_TARGET_FILES := $(subst $(CURSORS_LIB_SRC),$(CURSORS_DEST_DIR),$(CURSORS_SRC_FILES))
-
-$(CURSORS_DEST_DIR)/%: $(CURSORS_LIB_SRC)/%
-	$(call install-file)
-
-TARGETS += $(CURSORS_TARGET_FILES)
-
-################################################################################
--- a/jdk/make/gensrc/Gensrc-java.desktop.gmk	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/make/gensrc/Gensrc-java.desktop.gmk	Tue Mar 03 08:49:13 2015 -0800
@@ -66,8 +66,11 @@
   PROP_SRC_DIRS += $(JDK_TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/resources
 endif
 
+PROP_SRC_FILES := $(filter-out %cursors.properties, \
+    $(filter %.properties, $(call CacheFind, $(PROP_SRC_DIRS))))
+
 $(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
-    $(filter %.properties, $(call CacheFind, $(PROP_SRC_DIRS))), ListResourceBundle))
+    $(PROP_SRC_FILES), ListResourceBundle))
 
 GENSRC_JAVA_DESKTOP += $(COMPILE_PROPERTIES)
 
--- a/jdk/make/lib/SoundLibraries.gmk	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/make/lib/SoundLibraries.gmk	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -114,42 +114,9 @@
 endif # OPENJDK_TARGET_OS solaris
 
 
-ifeq ($(JVM_VARIANT_ZERO), true)
-  LIBJSOUND_CFLAGS += -DX_ARCH=X_ZERO
-else
-  ifeq ($(OPENJDK_TARGET_CPU), x86)
-    LIBJSOUND_CFLAGS += -DX_ARCH=X_I586
-  endif
-
-  ifeq ($(OPENJDK_TARGET_CPU), sparc)
-    LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARC
-  endif
-
-  ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
-    LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARCV9
-  endif
-
-  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
-    LIBJSOUND_CFLAGS += -DX_ARCH=X_AMD64
-  endif
-
-  ifeq ($(OPENJDK_TARGET_CPU), arm)
-    LIBJSOUND_CFLAGS += -DX_ARCH=X_ARM
-  endif
-
-  ifeq ($(OPENJDK_TARGET_CPU), ppc)
-    LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC
-  endif
-
-  ifeq ($(OPENJDK_TARGET_CPU), ppc64)
-       LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC64
-  endif
-
   ifeq ($(OPENJDK_TARGET_CPU), aarch64)
        LIBJSOUND_CFLAGS += -DX_ARCH=X_AARCH64
   endif
-endif
-
 LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
--- a/jdk/make/mapfiles/libjsound/mapfile-vers	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/make/mapfiles/libjsound/mapfile-vers	Tue Mar 03 08:49:13 2015 -0800
@@ -68,7 +68,6 @@
             Java_com_sun_media_sound_Platform_nGetExtraLibraries;
             Java_com_sun_media_sound_Platform_nGetLibraryForFeature;
             Java_com_sun_media_sound_Platform_nIsBigEndian;
-            Java_com_sun_media_sound_Platform_nIsSigned8;
             Java_com_sun_media_sound_PortMixer_nClose;
             Java_com_sun_media_sound_PortMixer_nControlGetFloatValue;
             Java_com_sun_media_sound_PortMixer_nControlGetIntValue;
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaIcon.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaIcon.java	Tue Mar 03 08:49:13 2015 -0800
@@ -195,7 +195,7 @@
                     AquaPainter.create(JRSUIState.getInstance());
             initIconPainter(painter);
 
-            g.setClip(new Rectangle(x, y, width, height));
+            g.clipRect(x, y, width, height);
             painter.paint(g, c, x, y, width, height);
             g.dispose();
         }
--- a/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java	Tue Mar 03 08:49:13 2015 -0800
@@ -43,7 +43,6 @@
      * therefore methods, which is using this id should be ready to it.
      */
     private volatile int displayID;
-    private volatile Insets screenInsets;
     private volatile double xResolution;
     private volatile double yResolution;
     private volatile int scale;
@@ -120,7 +119,13 @@
     }
 
     public Insets getScreenInsets() {
-        return screenInsets;
+        // the insets are queried synchronously and are not cached
+        // since there are no Quartz or Cocoa means to receive notifications
+        // on insets changes (e.g. when the Dock is resized):
+        // the existing CGDisplayReconfigurationCallBack is not notified
+        // as well as the NSApplicationDidChangeScreenParametersNotification
+        // is fired on the Dock location changes only
+        return nativeGetScreenInsets(displayID);
     }
 
     public int getScaleFactor() {
@@ -135,7 +140,6 @@
     public void displayChanged() {
         xResolution = nativeGetXResolution(displayID);
         yResolution = nativeGetYResolution(displayID);
-        screenInsets = nativeGetScreenInsets(displayID);
         scale = (int) nativeGetScaleFactor(displayID);
         //TODO configs/fullscreenWindow/modes?
     }
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.h	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.h	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, 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
@@ -28,8 +28,6 @@
 
 #import <Cocoa/Cocoa.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
-#import <CoreServices/CoreServices.h>
-#import <AudioToolbox/AudioToolbox.h>
 
 #define DEBUG 1
 
--- a/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_PCM.cpp	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_PCM.cpp	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, 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
@@ -28,7 +28,6 @@
 //#define USE_VERBOSE_TRACE
 
 #include <AudioUnit/AudioUnit.h>
-#include <CoreServices/CoreServices.h>
 #include <AudioToolbox/AudioConverter.h>
 #include <pthread.h>
 #include <math.h>
@@ -617,7 +616,7 @@
 
     ~OSX_DirectAudioDevice() {
         if (audioUnit) {
-            CloseComponent(audioUnit);
+            AudioComponentInstanceDispose(audioUnit);
         }
         if (resampler) {
             delete resampler;
@@ -629,17 +628,16 @@
 {
     OSStatus err;
     AudioUnit unit;
-    UInt32 size;
 
-    ComponentDescription desc;
+    AudioComponentDescription desc;
     desc.componentType         = kAudioUnitType_Output;
     desc.componentSubType      = (deviceID == 0 && isSource) ? kAudioUnitSubType_DefaultOutput : kAudioUnitSubType_HALOutput;
     desc.componentManufacturer = kAudioUnitManufacturer_Apple;
     desc.componentFlags        = 0;
     desc.componentFlagsMask    = 0;
 
-    Component comp = FindNextComponent(NULL, &desc);
-    err = OpenAComponent(comp, &unit);
+    AudioComponent comp = AudioComponentFindNext(NULL, &desc);
+    err = AudioComponentInstanceNew(comp, &unit);
 
     if (err) {
         OS_ERROR0(err, "CreateOutputUnit:OpenAComponent");
@@ -664,7 +662,7 @@
             // get real AudioDeviceID for default input device (macosx current input device)
             deviceID = GetDefaultDevice(isSource);
             if (!deviceID) {
-                CloseComponent(unit);
+                AudioComponentInstanceDispose(unit);
                 return NULL;
             }
         }
@@ -675,7 +673,7 @@
                                     0, &deviceID, sizeof(deviceID));
         if (err) {
             OS_ERROR0(err, "SetProperty (CurrentDevice)");
-            CloseComponent(unit);
+            AudioComponentInstanceDispose(unit);
             return NULL;
         }
     }
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/Platform.java	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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,13 +64,6 @@
     // SYSTEM CHARACTERISTICS
     // vary according to hardware architecture
 
-    // signed8 (use signed 8-bit values) is true for everything we support except for
-    // the solaris sbpro card.
-    // we'll leave it here as a variable; in the future we may need this in java.
-    // wait, is that true?  i'm not sure.  i think solaris takes unsigned data?
-    // $$kk: 03.11.99: i think solaris takes unsigned 8-bit or signed 16-bit data....
-    private static boolean signed8;
-
     // intel is little-endian.  sparc is big-endian.
     private static boolean bigEndian;
 
@@ -110,14 +103,6 @@
     }
 
 
-    /**
-     * Determine whether the system takes signed 8-bit data.
-     */
-    static boolean isSigned8() {
-
-        return signed8;
-    }
-
     // PRIVATE METHODS
 
     /**
@@ -185,17 +170,14 @@
 
     // the following native methods are implemented in Platform.c
     private native static boolean nIsBigEndian();
-    private native static boolean nIsSigned8();
     private native static String nGetExtraLibraries();
     private native static int nGetLibraryForFeature(int feature);
 
-
     /**
      * Read the required system properties.
      */
     private static void readProperties() {
         // $$fb 2002-03-06: implement check for endianness in native. Facilitates porting !
         bigEndian = nIsBigEndian();
-        signed8 = nIsSigned8(); // Solaris on Sparc: signed, all others unsigned
     }
 }
--- a/jdk/src/java.desktop/share/classes/java/awt/Cursor.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/Cursor.java	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,18 +24,17 @@
  */
 package java.awt;
 
-import java.io.File;
-import java.io.FileInputStream;
-
 import java.beans.ConstructorProperties;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
 import java.util.Hashtable;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
-import java.security.AccessController;
-
+import sun.awt.AWTAccessor;
 import sun.util.logging.PlatformLogger;
-import sun.awt.AWTAccessor;
 
 /**
  * A class to encapsulate the bitmap representation of the mouse cursor.
@@ -160,28 +159,19 @@
     public static final int     CUSTOM_CURSOR                   = -1;
 
     /*
-     * hashtable, filesystem dir prefix, filename, and properties for custom cursors support
+     * hashtable, resource prefix, filename, and properties for custom cursors
+     * support
      */
-
     private static final Hashtable<String,Cursor> systemCustomCursors = new Hashtable<>(1);
-    private static final String systemCustomCursorDirPrefix = initCursorDir();
-
-    private static String initCursorDir() {
-        String jhome = java.security.AccessController.doPrivileged(
-               new sun.security.action.GetPropertyAction("java.home"));
-        return jhome +
-            File.separator + "lib" + File.separator + "images" +
-            File.separator + "cursors" + File.separator;
-    }
-
-    private static final String     systemCustomCursorPropertiesFile = systemCustomCursorDirPrefix + "cursors.properties";
+    private static final String RESOURCE_PREFIX = "/sun/awt/resources/cursors/";
+    private static final String PROPERTIES_FILE = RESOURCE_PREFIX + "cursors.properties";
 
     private static       Properties systemCustomCursorProperties = null;
 
-    private static final String CursorDotPrefix  = "Cursor.";
-    private static final String DotFileSuffix    = ".File";
-    private static final String DotHotspotSuffix = ".HotSpot";
-    private static final String DotNameSuffix    = ".Name";
+    private static final String CURSOR_DOT_PREFIX = "Cursor.";
+    private static final String DOT_FILE_SUFFIX = ".File";
+    private static final String DOT_HOTSPOT_SUFFIX = ".HotSpot";
+    private static final String DOT_NAME_SUFFIX = ".Name";
 
     /*
      * JDK 1.1 serialVersionUID
@@ -307,8 +297,8 @@
                     loadSystemCustomCursorProperties();
             }
 
-            String prefix = CursorDotPrefix + name;
-            String key    = prefix + DotFileSuffix;
+            String prefix = CURSOR_DOT_PREFIX + name;
+            String key    = prefix + DOT_FILE_SUFFIX;
 
             if (!systemCustomCursorProperties.containsKey(key)) {
                 if (log.isLoggable(PlatformLogger.Level.FINER)) {
@@ -320,11 +310,10 @@
             final String fileName =
                 systemCustomCursorProperties.getProperty(key);
 
-            String localized = systemCustomCursorProperties.getProperty(prefix + DotNameSuffix);
+            final String localized = systemCustomCursorProperties.getProperty(
+                    prefix + DOT_NAME_SUFFIX, name);
 
-            if (localized == null) localized = name;
-
-            String hotspot = systemCustomCursorProperties.getProperty(prefix + DotHotspotSuffix);
+            String hotspot = systemCustomCursorProperties.getProperty(prefix + DOT_HOTSPOT_SUFFIX);
 
             if (hotspot == null)
                 throw new AWTException("no hotspot property defined for cursor: " + name);
@@ -334,31 +323,25 @@
             if (st.countTokens() != 2)
                 throw new AWTException("failed to parse hotspot property for cursor: " + name);
 
-            int x = 0;
-            int y = 0;
-
+            final Point hotPoint;
             try {
-                x = Integer.parseInt(st.nextToken());
-                y = Integer.parseInt(st.nextToken());
+                hotPoint = new Point(Integer.parseInt(st.nextToken()),
+                                     Integer.parseInt(st.nextToken()));
             } catch (NumberFormatException nfe) {
                 throw new AWTException("failed to parse hotspot property for cursor: " + name);
             }
 
             try {
-                final int fx = x;
-                final int fy = y;
-                final String flocalized = localized;
+                final Toolkit toolkit = Toolkit.getDefaultToolkit();
+                final String file = RESOURCE_PREFIX + fileName;
 
-                cursor = java.security.AccessController.<Cursor>doPrivileged(
-                    new java.security.PrivilegedExceptionAction<Cursor>() {
-                    public Cursor run() throws Exception {
-                        Toolkit toolkit = Toolkit.getDefaultToolkit();
-                        Image image = toolkit.getImage(
-                           systemCustomCursorDirPrefix + fileName);
-                        return toolkit.createCustomCursor(
-                                    image, new Point(fx,fy), flocalized);
-                    }
-                });
+                cursor = AccessController.doPrivileged(
+                        (PrivilegedExceptionAction<Cursor>) () -> {
+                            URL url = Cursor.class.getResource(file);
+                            Image image = toolkit.getImage(url);
+                            return toolkit.createCustomCursor(image, hotPoint,
+                                                              localized);
+                        });
             } catch (Exception e) {
                 throw new AWTException(
                     "Exception: " + e.getClass() + " " + e.getMessage() +
@@ -452,26 +435,19 @@
             systemCustomCursorProperties = new Properties();
 
             try {
-                AccessController.<Object>doPrivileged(
-                      new java.security.PrivilegedExceptionAction<Object>() {
-                    public Object run() throws Exception {
-                        FileInputStream fis = null;
-                        try {
-                            fis = new FileInputStream(
-                                           systemCustomCursorPropertiesFile);
-                            systemCustomCursorProperties.load(fis);
-                        } finally {
-                            if (fis != null)
-                                fis.close();
-                        }
-                        return null;
-                    }
-                });
+                AccessController.doPrivileged(
+                        (PrivilegedExceptionAction<Object>) () -> {
+                            try (InputStream is = Cursor.class
+                                    .getResourceAsStream(PROPERTIES_FILE)) {
+                                systemCustomCursorProperties.load(is);
+                            }
+                            return null;
+                        });
             } catch (Exception e) {
                 systemCustomCursorProperties = null;
                  throw new AWTException("Exception: " + e.getClass() + " " +
                    e.getMessage() + " occurred while loading: " +
-                                        systemCustomCursorPropertiesFile);
+                   PROPERTIES_FILE);
             }
         }
     }
--- a/jdk/src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/java/awt/color/ICC_ColorSpace.java	Tue Mar 03 08:49:13 2015 -0800
@@ -546,7 +546,7 @@
     public float getMinValue(int component) {
         if ((component < 0) || (component > this.getNumComponents() - 1)) {
             throw new IllegalArgumentException(
-                "Component index out of range: + component");
+                "Component index out of range: " + component);
         }
         return minVal[component];
     }
@@ -571,7 +571,7 @@
     public float getMaxValue(int component) {
         if ((component < 0) || (component > this.getNumComponents() - 1)) {
             throw new IllegalArgumentException(
-                "Component index out of range: + component");
+                "Component index out of range: " + component);
         }
         return maxVal[component];
     }
--- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java	Tue Mar 03 08:49:13 2015 -0800
@@ -3763,12 +3763,6 @@
          * @param listener  the PropertyChangeListener to be added
          */
         public void addPropertyChangeListener(PropertyChangeListener listener) {
-            if (accessibleContainerHandler == null) {
-                accessibleContainerHandler = new AccessibleContainerHandler();
-            }
-            if (propertyListenersCount++ == 0) {
-                JComponent.this.addContainerListener(accessibleContainerHandler);
-            }
             super.addPropertyChangeListener(listener);
         }
 
@@ -3780,9 +3774,6 @@
          * @param listener  the PropertyChangeListener to be removed
          */
         public void removePropertyChangeListener(PropertyChangeListener listener) {
-            if (--propertyListenersCount == 0) {
-                JComponent.this.removeContainerListener(accessibleContainerHandler);
-            }
             super.removePropertyChangeListener(listener);
         }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/JMenu.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JMenu.java	Tue Mar 03 08:49:13 2015 -0800
@@ -476,7 +476,8 @@
             }
             // Then the y:
             y = s.height + yOffset;    // Prefer dropping down
-            if (position.y + y + pmSize.height >= screenBounds.height &&
+            if (position.y + y + pmSize.height >= screenBounds.height
+                                                  + screenBounds.y &&
                 // popup doesn't fit - place it wherever there's more room
                 screenBounds.height - s.height < 2*(position.y
                                                   - screenBounds.y)) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTree.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTree.java	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -872,11 +872,13 @@
                 treeModelListener = createTreeModelListener();
             if(treeModelListener != null)
                 treeModel.addTreeModelListener(treeModelListener);
+
             // Mark the root as expanded, if it isn't a leaf.
-            if(treeModel.getRoot() != null &&
-               !treeModel.isLeaf(treeModel.getRoot())) {
-                expandedState.put(new TreePath(treeModel.getRoot()),
-                                  Boolean.TRUE);
+            Object treeRoot = treeModel.getRoot();
+            if(treeRoot != null &&
+               !treeModel.isLeaf(treeRoot)) {
+                expandedState.put(new TreePath(treeRoot),
+                                    Boolean.TRUE);
             }
         }
         firePropertyChange(TREE_MODEL_PROPERTY, oldModel, treeModel);
@@ -3000,8 +3002,7 @@
      * Expands the root path, assuming the current TreeModel has been set.
      */
     private void expandRoot() {
-        TreeModel              model = getModel();
-
+        TreeModel   model = getModel();
         if(model != null && model.getRoot() != null) {
             expandPath(new TreePath(model.getRoot()));
         }
@@ -3271,9 +3272,12 @@
             return null;
 
         int          count = indexs.length;
+
         Object       parent = model.getRoot();
+        if (parent == null)
+            return null;
+
         TreePath     parentPath = new TreePath(parent);
-
         for(int counter = 0; counter < count; counter++) {
             parent = model.getChild(parent, indexs[counter]);
             if(parent == null)
@@ -3860,8 +3864,11 @@
             if (parent.getPathCount() == 1) {
                 // New root, remove everything!
                 clearToggledPaths();
-                if(treeModel.getRoot() != null &&
-                   !treeModel.isLeaf(treeModel.getRoot())) {
+
+              Object treeRoot = treeModel.getRoot();
+
+              if(treeRoot != null &&
+                !treeModel.isLeaf(treeRoot)) {
                     // Mark the root as expanded, if it isn't a leaf.
                     expandedState.put(parent, Boolean.TRUE);
                 }
@@ -4351,7 +4358,12 @@
             if (model == null) {
                 return null;
             }
-            TreePath path = new TreePath(model.getRoot());
+
+            Object treeRoot = model.getRoot();
+            if (treeRoot == null) {
+                return null;
+            }
+            TreePath path = new TreePath(treeRoot);
             if (JTree.this.isVisible(path)) {
                 TreeCellRenderer r = JTree.this.getCellRenderer();
                 TreeUI ui = JTree.this.getUI();
@@ -4364,8 +4376,8 @@
                     boolean expanded = JTree.this.isExpanded(path);
 
                     return r.getTreeCellRendererComponent(JTree.this,
-                        model.getRoot(), selected, expanded,
-                        model.isLeaf(model.getRoot()), row, hasFocus);
+                        treeRoot, selected, expanded,
+                        model.isLeaf(treeRoot), row, hasFocus);
                 }
             }
             return null;
@@ -4418,8 +4430,12 @@
                 return 1;    // the root node
             }
 
+            Object treeRoot = model.getRoot();
+            if (treeRoot == null)
+                return 0;
+
             // return the root's first set of children count
-            return model.getChildCount(model.getRoot());
+            return model.getChildCount(treeRoot);
         }
 
         /**
@@ -4433,9 +4449,15 @@
             if (model == null) {
                 return null;
             }
+
+            Object treeRoot = model.getRoot();
+            if (treeRoot == null) {
+                return null;
+            }
+
             if (isRootVisible()) {
                 if (i == 0) {    // return the root node Accessible
-                    Object[] objPath = { model.getRoot() };
+                    Object[] objPath = { treeRoot };
                     TreePath path = new TreePath(objPath);
                     return new AccessibleJTreeNode(JTree.this, path, JTree.this);
                 } else {
@@ -4444,12 +4466,16 @@
             }
 
             // return Accessible for one of root's child nodes
-            int count = model.getChildCount(model.getRoot());
+            int count = model.getChildCount(treeRoot);
             if (i < 0 || i >= count) {
                 return null;
             }
-            Object obj = model.getChild(model.getRoot(), i);
-            Object[] objPath = { model.getRoot(), obj };
+            Object obj = model.getChild(treeRoot, i);
+            if (obj == null)
+                return null;
+
+            Object[] objPath = {treeRoot, obj };
+
             TreePath path = new TreePath(objPath);
             return new AccessibleJTreeNode(JTree.this, path, JTree.this);
         }
@@ -4488,6 +4514,9 @@
         public int getAccessibleSelectionCount() {
             Object[] rootPath = new Object[1];
             rootPath[0] = treeModel.getRoot();
+            if (rootPath[0] == null)
+                return 0;
+
             TreePath childPath = new TreePath(rootPath);
             if (JTree.this.isPathSelected(childPath)) {
                 return 1;
@@ -4510,6 +4539,9 @@
             if (i == 0) {
                 Object[] rootPath = new Object[1];
                 rootPath[0] = treeModel.getRoot();
+                if (rootPath[0] == null)
+                    return null;
+
                 TreePath childPath = new TreePath(rootPath);
                 if (JTree.this.isPathSelected(childPath)) {
                     return new AccessibleJTreeNode(JTree.this, childPath, JTree.this);
@@ -4529,6 +4561,9 @@
             if (i == 0) {
                 Object[] rootPath = new Object[1];
                 rootPath[0] = treeModel.getRoot();
+                if (rootPath[0] == null)
+                    return false;
+
                 TreePath childPath = new TreePath(rootPath);
                 return JTree.this.isPathSelected(childPath);
             } else {
@@ -4549,7 +4584,10 @@
            TreeModel model = JTree.this.getModel();
            if (model != null) {
                if (i == 0) {
-                   Object[] objPath = {model.getRoot()};
+                    Object[] objPath = {model.getRoot()};
+                    if (objPath[0] == null)
+                        return;
+
                    TreePath path = new TreePath(objPath);
                    JTree.this.addSelectionPath(path);
                 }
@@ -4568,6 +4606,9 @@
             if (model != null) {
                 if (i == 0) {
                     Object[] objPath = {model.getRoot()};
+                    if (objPath[0] == null)
+                        return;
+
                     TreePath path = new TreePath(objPath);
                     JTree.this.removeSelectionPath(path);
                 }
@@ -4593,6 +4634,9 @@
             TreeModel model = JTree.this.getModel();
             if (model != null) {
                 Object[] objPath = {model.getRoot()};
+                if (objPath[0] == null)
+                    return;
+
                 TreePath path = new TreePath(objPath);
                 JTree.this.addSelectionPath(path);
             }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java	Tue Mar 03 08:49:13 2015 -0800
@@ -377,15 +377,16 @@
     }
 
     /**
-     * Creates the appropriate object to represent {@code msg} and
-     * places it into {@code container}. If {@code msg} is an instance of
-     * {@code Component}, it is added directly, if it is an {@code Icon},
-     * a {@code JLabel} is created to represent it, otherwise a {@code JLabel} is
-     * created for the string, if {@code d} is an Object[], this method
-     * will be recursively invoked for the children. {@code internallyCreated} is
-     * {@code true} if Objc is an instance of {@code Component} and was created
-     * internally by this method (this is used to correctly set
-     * {@code hasCustomComponents} only if {@code internallyCreated} is {@code false}).
+     * Creates the appropriate object to represent {@code msg} and places it
+     * into {@code container}. If {@code msg} is an instance of
+     * {@code Component}, it is added directly; if it is an {@code Icon}, a
+     * {@code JLabel} is created to represent it; otherwise, a {@code JLabel}
+     * is created for the string. If {@code msg} is an Object[], this method
+     * will be recursively invoked for the children. {@code internallyCreated}
+     * is {@code true} if {@code msg} is an instance of {@code Component} and
+     * was created internally by this method (this is used to correctly set
+     * {@code hasCustomComponents} only if {@code internallyCreated} is
+     * {@code false}).
      *
      * @param container a container
      * @param cons an instance of {@code GridBagConstraints}
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, 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
@@ -686,7 +686,12 @@
 
         if (toFocus != null) {
             if (parent instanceof EmbeddedFrame) {
-                ((EmbeddedFrame)parent).synthesizeWindowActivation(true);
+                // JDK-8056915: Try to request focus to the embedder first and
+                // activate the embedded frame through it
+                if (!((EmbeddedFrame) parent).requestFocusToEmbedder()) {
+                    // Otherwise activate the embedded frame directly
+                    ((EmbeddedFrame) parent).synthesizeWindowActivation(true);
+                }
             }
             // EmbeddedFrame might have focus before the applet was added.
             // Thus after its activation the most recent focus owner will be
--- a/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/awt/EmbeddedFrame.java	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, 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
@@ -361,6 +361,15 @@
     public void synthesizeWindowActivation(boolean doActivate) {}
 
     /**
+     * Requests the focus to the embedder.
+     *
+     * @return {@code true} if focus request was successful, and {@code false} otherwise.
+     */
+    public boolean requestFocusToEmbedder() {
+        return false;
+    }
+
+    /**
      * Moves this embedded frame to a new location. The top-left corner of
      * the new location is specified by the <code>x</code> and <code>y</code>
      * parameters relative to the native parent component.
Binary file jdk/src/java.desktop/share/classes/sun/awt/resources/cursors/CopyDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/classes/sun/awt/resources/cursors/LinkDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/classes/sun/awt/resources/cursors/MoveDrop32x32.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/awt/resources/cursors/cursors.properties	Tue Mar 03 08:49:13 2015 -0800
@@ -0,0 +1,40 @@
+#
+#
+# Cursors Properties file
+#
+# Names GIF89 sources for Custom Cursors and their associated HotSpots
+#
+# Note: the syntax of the property name is significant and is parsed
+# by java.awt.Cursor
+#
+# The syntax is: Cursor.<name>.<geom>.File=<filename>
+#                Cursor.<name>.<geom>.HotSpot=<x>,<y>
+#	         Cursor.<name>.<geom>.Name=<localized name>
+#
+Cursor.CopyDrop.32x32.File=CopyDrop32x32.gif
+Cursor.CopyDrop.32x32.HotSpot=0,0
+Cursor.CopyDrop.32x32.Name=CopyDrop32x32
+#
+Cursor.MoveDrop.32x32.File=MoveDrop32x32.gif
+Cursor.MoveDrop.32x32.HotSpot=0,0
+Cursor.MoveDrop.32x32.Name=MoveDrop32x32
+#
+Cursor.LinkDrop.32x32.File=LinkDrop32x32.gif
+Cursor.LinkDrop.32x32.HotSpot=0,0
+Cursor.LinkDrop.32x32.Name=LinkDrop32x32
+#
+Cursor.CopyNoDrop.32x32.File=invalid32x32.gif
+Cursor.CopyNoDrop.32x32.HotSpot=6,2
+Cursor.CopyNoDrop.32x32.Name=CopyNoDrop32x32
+#
+Cursor.MoveNoDrop.32x32.File=invalid32x32.gif
+Cursor.MoveNoDrop.32x32.HotSpot=6,2
+Cursor.MoveNoDrop.32x32.Name=MoveNoDrop32x32
+#
+Cursor.LinkNoDrop.32x32.File=invalid32x32.gif
+Cursor.LinkNoDrop.32x32.HotSpot=6,2
+Cursor.LinkNoDrop.32x32.Name=LinkNoDrop32x32
+#
+Cursor.Invalid.32x32.File=invalid32x32.gif
+Cursor.Invalid.32x32.HotSpot=6,2
+Cursor.Invalid.32x32.Name=Invalid32x32
Binary file jdk/src/java.desktop/share/classes/sun/awt/resources/cursors/invalid32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/invalid32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/motif_CopyDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/motif_CopyNoDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/motif_LinkDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/motif_LinkNoDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/motif_MoveDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/motif_MoveNoDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/win32_CopyDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/win32_CopyNoDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/win32_LinkDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/win32_LinkNoDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/win32_MoveDrop32x32.gif has changed
Binary file jdk/src/java.desktop/share/conf/images/cursors/win32_MoveNoDrop32x32.gif has changed
--- a/jdk/src/java.desktop/share/native/libjsound/Platform.c	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/native/libjsound/Platform.c	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,19 +40,6 @@
 
 /*
  * Class:     com_sun_media_sound_Platform
- * Method:    nIsSigned8
- * Signature: ()Z
- */
-JNIEXPORT jboolean JNICALL Java_com_sun_media_sound_Platform_nIsSigned8(JNIEnv *env, jclass clss) {
-#if ((X_ARCH == X_SPARC) || (X_ARCH == X_SPARCV9))
-    return 1;
-#else
-    return 0;
-#endif
-}
-
-/*
- * Class:     com_sun_media_sound_Platform
  * Method:    nGetExtraLibraries
  * Signature: ()Ljava/lang/String;
  */
--- a/jdk/src/java.desktop/share/native/libjsound/SoundDefs.h	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/share/native/libjsound/SoundDefs.h	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,33 +34,14 @@
 #define X_BSD           4
 #define X_MACOSX        5
 
-// types for X_ARCH
-#define X_I586          1
-#define X_SPARC         2
-#define X_SPARCV9       3
-#define X_IA64          4
-#define X_AMD64         5
-#define X_ZERO          6
-#define X_ARM           7
-#define X_PPC           8
 #define X_AARCH64       9
-
 // **********************************
-// Make sure you set X_PLATFORM and X_ARCH defines correctly.
+// Make sure you set X_PLATFORM defines correctly.
 // Everything depends upon this flag being setup correctly.
 // **********************************
 
-#if (X_PLATFORM == X_MACOSX) && !defined(X_ARCH)
-#if __x86_64__
-#define X_ARCH X_AMD64
-#endif
-#if __i386__
-#define X_ARCH X_I586
-#endif
-#endif
-
-#if (!defined(X_PLATFORM) || !defined(X_ARCH))
-#error "You need to define X_PLATFORM and X_ARCH outside of the source. Use the types above."
+#if (!defined(X_PLATFORM))
+#error "You need to define X_PLATFORM outside of the source. Use the types above."
 #endif
 
 
--- a/jdk/src/java.desktop/unix/conf/images/cursors/cursors.properties	Tue Mar 03 06:23:50 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#
-#
-# Cursors Properties file
-#
-# Names GIF89 sources for Custom Cursors and their associated HotSpots
-#
-# Note: the syntax of the property name is significant and is parsed
-# by java.awt.Cursor
-#
-# The syntax is: Cursor.<name>.<geom>.File=<filename>
-#                Cursor.<name>.<geom>.HotSpot=<x>,<y>
-#	         Cursor.<name>.<geom>.Name=<localized name>
-#
-Cursor.CopyDrop.32x32.File=motif_CopyDrop32x32.gif
-Cursor.CopyDrop.32x32.HotSpot=0,0
-Cursor.CopyDrop.32x32.Name=CopyDrop32x32
-#
-Cursor.MoveDrop.32x32.File=motif_MoveDrop32x32.gif
-Cursor.MoveDrop.32x32.HotSpot=0,0
-Cursor.MoveDrop.32x32.Name=MoveDrop32x32
-#
-Cursor.LinkDrop.32x32.File=motif_LinkDrop32x32.gif
-Cursor.LinkDrop.32x32.HotSpot=0,0
-Cursor.LinkDrop.32x32.Name=LinkDrop32x32
-#
-Cursor.CopyNoDrop.32x32.File=motif_CopyNoDrop32x32.gif
-Cursor.CopyNoDrop.32x32.HotSpot=6,2
-Cursor.CopyNoDrop.32x32.Name=CopyNoDrop32x32
-#
-Cursor.MoveNoDrop.32x32.File=motif_MoveNoDrop32x32.gif
-Cursor.MoveNoDrop.32x32.HotSpot=6,2
-Cursor.MoveNoDrop.32x32.Name=MoveNoDrop32x32
-#
-Cursor.LinkNoDrop.32x32.File=motif_LinkNoDrop32x32.gif
-Cursor.LinkNoDrop.32x32.HotSpot=6,2
-Cursor.LinkNoDrop.32x32.Name=LinkNoDrop32x32
-#
-Cursor.Invalid.32x32.File=invalid32x32.gif
-Cursor.Invalid.32x32.HotSpot=6,2
-Cursor.Invalid.32x32.Name=Invalid32x32
Binary file jdk/src/java.desktop/windows/classes/sun/awt/resources/cursors/CopyDrop32x32.gif has changed
Binary file jdk/src/java.desktop/windows/classes/sun/awt/resources/cursors/LinkDrop32x32.gif has changed
Binary file jdk/src/java.desktop/windows/classes/sun/awt/resources/cursors/MoveDrop32x32.gif has changed
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,6 +52,11 @@
     private static int pScale = 0;
     private static final int MAX_BAND_SIZE = (1024*30);
 
+    /**
+     * This flag is set to {@code true} if this embedded frame is hosted by Internet Explorer.
+     */
+    private boolean isEmbeddedInIE = false;
+
     private static String printScale = AccessController.doPrivileged(
         new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
 
@@ -244,6 +249,14 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
+    public boolean requestFocusToEmbedder() {
+        if (isEmbeddedInIE) {
+            return ((WEmbeddedFramePeer) getPeer()).requestFocusToEmbedder();
+        }
+        return false;
+    }
+
     public void registerAccelerator(AWTKeyStroke stroke) {}
     public void unregisterAccelerator(AWTKeyStroke stroke) {}
 
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,4 +78,11 @@
         // false on other systems.
         return !Win32GraphicsEnvironment.isDWMCompositionEnabled();
     }
+
+    /**
+     * Sets the focus to plugin control window, the parent of embedded frame.
+     * Eventually, it will synthesizeWindowActivation to activate the embedded frame,
+     * if plugin control window gets the focus.
+     */
+    public native boolean requestFocusToEmbedder();
 }
--- a/jdk/src/java.desktop/windows/conf/images/cursors/cursors.properties	Tue Mar 03 06:23:50 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#
-#
-# Cursors Properties file
-#
-# Names GIF89 sources for Custom Cursors and their associated HotSpots
-#
-# Note: the syntax of the property name is significant and is parsed
-# by java.awt.Cursor
-#
-# The syntax is: Cursor.<name>.<geom>.File=win32_<filename>
-#                Cursor.<name>.<geom>.HotSpot=<x>,<y>
-#	         Cursor.<name>.<geom>.Name=<localized name>
-#
-Cursor.CopyDrop.32x32.File=win32_CopyDrop32x32.gif
-Cursor.CopyDrop.32x32.HotSpot=0,0
-Cursor.CopyDrop.32x32.Name=CopyDrop32x32
-#
-Cursor.MoveDrop.32x32.File=win32_MoveDrop32x32.gif
-Cursor.MoveDrop.32x32.HotSpot=0,0
-Cursor.MoveDrop.32x32.Name=MoveDrop32x32
-#
-Cursor.LinkDrop.32x32.File=win32_LinkDrop32x32.gif
-Cursor.LinkDrop.32x32.HotSpot=0,0
-Cursor.LinkDrop.32x32.Name=LinkDrop32x32
-#
-Cursor.CopyNoDrop.32x32.File=win32_CopyNoDrop32x32.gif
-Cursor.CopyNoDrop.32x32.HotSpot=6,2
-Cursor.CopyNoDrop.32x32.Name=CopyNoDrop32x32
-#
-Cursor.MoveNoDrop.32x32.File=win32_MoveNoDrop32x32.gif
-Cursor.MoveNoDrop.32x32.HotSpot=6,2
-Cursor.MoveNoDrop.32x32.Name=MoveNoDrop32x32
-#
-Cursor.LinkNoDrop.32x32.File=win32_LinkNoDrop32x32.gif
-Cursor.LinkNoDrop.32x32.HotSpot=6,2
-Cursor.LinkNoDrop.32x32.Name=LinkNoDrop32x32
-#
-Cursor.Invalid.32x32.File=invalid32x32.gif
-Cursor.Invalid.32x32.HotSpot=6,2
-Cursor.Invalid.32x32.Name=Invalid32x32
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, 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
@@ -82,6 +82,15 @@
     HHOOK mouseHook;
     HHOOK modalHook;
 };
+
+
+// Communication with plugin control
+
+// The value must be the same as in AxControl.h
+#define WM_AX_REQUEST_FOCUS_TO_EMBEDDER (WM_USER + 197)
+
+static bool SetFocusToPluginControl(HWND hwndPlugin);
+
 /************************************************************************
  * AwtFrame fields
  */
@@ -93,6 +102,7 @@
 jmethodID AwtFrame::setExtendedStateMID;
 
 jmethodID AwtFrame::activateEmbeddingTopLevelMID;
+jfieldID AwtFrame::isEmbeddedInIEID;
 
 Hashtable AwtFrame::sm_BlockedThreads("AWTBlockedThreads");
 
@@ -104,6 +114,7 @@
     m_parentWnd = NULL;
     menuBar = NULL;
     m_isEmbedded = FALSE;
+    m_isEmbeddedInIE = FALSE;
     m_isLightweight = FALSE;
     m_ignoreWmSize = FALSE;
     m_isMenuDropped = FALSE;
@@ -199,6 +210,13 @@
 
             if (isEmbedded) {
                 hwndParent = (HWND)handle;
+
+                // JDK-8056915: Handle focus communication between plugin and frame
+                frame->m_isEmbeddedInIE = IsEmbeddedInIE(hwndParent);
+                if (frame->m_isEmbeddedInIE) {
+                    env->SetBooleanField(target, isEmbeddedInIEID, JNI_TRUE);
+                }
+
                 RECT rect;
                 ::GetClientRect(hwndParent, &rect);
                 //Fix for 6328675: SWT_AWT.new_Frame doesn't occupy client area under JDK6
@@ -338,6 +356,21 @@
     return frame;
 }
 
+/*
+ * Returns true if the frame is embedded into Internet Explorer.
+ * The function checks the class name of the parent window of the embedded frame.
+ */
+BOOL AwtFrame::IsEmbeddedInIE(HWND hwndParent)
+{
+    const char *pluginClass = "Java Plug-in Control Window";
+    #define PARENT_CLASS_BUFFER_SIZE 64
+    char parentClass[PARENT_CLASS_BUFFER_SIZE];
+
+    return (::GetClassNameA(hwndParent, parentClass, PARENT_CLASS_BUFFER_SIZE) > 0)
+           && (strncmp(parentClass, pluginClass, PARENT_CLASS_BUFFER_SIZE) == 0);
+}
+
+
 LRESULT AwtFrame::ProxyWindowProc(UINT message, WPARAM wParam, LPARAM lParam, MsgRouting &mr)
 {
     LRESULT retValue = 0L;
@@ -1039,6 +1072,19 @@
     if (IsLightweightFrame()) {
         return TRUE;
     }
+    if (isMouseEventCause && IsEmbeddedFrame() && m_isEmbeddedInIE) {
+        HWND hwndProxy = GetProxyFocusOwner();
+        // Do nothing if this frame is focused already
+        if (::GetFocus() != hwndProxy) {
+            // Fix for JDK-8056915:
+            // If window activated with mouse, set focus to plugin control window
+            // first to preserve focus owner inside browser window
+            if (SetFocusToPluginControl(::GetParent(GetHWnd()))) {
+                return TRUE;
+            }
+            // Plugin control window is already focused, so do normal processing
+        }
+    }
     return AwtWindow::AwtSetActiveWindow(isMouseEventCause);
 }
 
@@ -1819,6 +1865,9 @@
     AwtFrame::activateEmbeddingTopLevelMID = env->GetMethodID(cls, "activateEmbeddingTopLevel", "()V");
     DASSERT(AwtFrame::activateEmbeddingTopLevelMID != NULL);
 
+    AwtFrame::isEmbeddedInIEID = env->GetFieldID(cls, "isEmbeddedInIE", "Z");
+    DASSERT(AwtFrame::isEmbeddedInIEID != NULL);
+
     CATCH_BAD_ALLOC;
 }
 
@@ -1911,4 +1960,44 @@
     CATCH_BAD_ALLOC;
 }
 
+JNIEXPORT jboolean JNICALL
+Java_sun_awt_windows_WEmbeddedFramePeer_requestFocusToEmbedder(JNIEnv *env, jobject self)
+{
+    jboolean result = JNI_FALSE;
+
+    TRY;
+
+    AwtFrame *frame = NULL;
+
+    PDATA pData;
+    JNI_CHECK_PEER_GOTO(self, ret);
+    frame = (AwtFrame *)pData;
+
+    // JDK-8056915: During initial applet activation, set focus to plugin control window
+    HWND hwndParent = ::GetParent(frame->GetHWnd());
+
+    result = SetFocusToPluginControl(hwndParent);
+
+    CATCH_BAD_ALLOC_RET(JNI_FALSE);
+ret:
+    return result;
+}
+
 } /* extern "C" */
+
+static bool SetFocusToPluginControl(HWND hwndPlugin)
+{
+    HWND hwndFocus = ::GetFocus();
+
+    if (hwndFocus == hwndPlugin) {
+        return false;
+    }
+
+    ::SetFocus(hwndPlugin);
+    DWORD dwError = ::GetLastError();
+    if (dwError != ERROR_SUCCESS) {
+        // If direct call failed, use a special message to set focus
+        return (::SendMessage(hwndPlugin, WM_AX_REQUEST_FOCUS_TO_EMBEDDER, 0, 0) == 0);
+    }
+    return true;
+}
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.h	Tue Mar 03 06:23:50 2015 -0800
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Frame.h	Tue Mar 03 08:49:13 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2015, 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
@@ -60,6 +60,9 @@
     /* method id for WEmbeddedFrame.requestActivate() method */
     static jmethodID activateEmbeddingTopLevelMID;
 
+    /* field id for WEmbeddedFrame.isEmbeddedInIE */
+    static jfieldID isEmbeddedInIEID;
+
     AwtFrame();
     virtual ~AwtFrame();
 
@@ -171,6 +174,13 @@
     /* The frame is an EmbeddedFrame. */
     BOOL m_isEmbedded;
 
+    /* Fix for JDK-8056915:
+       The embedded frame must gain focus by setting focus to its parent. */
+    BOOL m_isEmbeddedInIE;
+
+    /* Checks whether the frame is embedded in IE */
+    static BOOL IsEmbeddedInIE(HWND hwndParent);
+
     /* The frame is a LightweightFrame */
     BOOL m_isLightweight;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Color/GetMinMaxValue_ICC_ColorSpace.java	Tue Mar 03 08:49:13 2015 -0800
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015, 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.ColorSpace;
+import java.awt.color.ICC_ColorSpace;
+import java.awt.color.ICC_Profile;
+import java.io.IOException;
+
+/**
+  * @test
+  * @bug 8072678
+  * @author Prasanta Sadhukhan
+  */
+
+public class GetMinMaxValue_ICC_ColorSpace {
+
+    public static void main(String[] a) throws Exception {
+        ICC_Profile cmyk_profile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
+        ICC_ColorSpace colorSpace = new ICC_ColorSpace(cmyk_profile);
+        String minstr = null;
+        String maxstr = null;
+
+        colorSpace.fromRGB(new float[]{4.3f,3.1f,2.2f});
+        try {
+            System.out.println("minvalue " + colorSpace.getMinValue(3));
+        } catch (IllegalArgumentException iae) {
+            minstr = iae.toString();
+        }
+        try {
+            System.out.println("maxvalue " + colorSpace.getMaxValue(3));
+        } catch (IllegalArgumentException iae) {
+            maxstr = iae.toString();
+        }
+
+        if (minstr.endsWith("+ component") || maxstr.endsWith("+ component")) {
+            System.out.println("Test failed");
+            throw new RuntimeException("IllegalArgumentException contains incorrect text message");
+        } else {
+            System.out.println("Test passed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Cursor/GetSystemCustomCursor/GetSystemCustomCursor.java	Tue Mar 03 08:49:13 2015 -0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2015, 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.AWTException;
+import java.awt.Cursor;
+
+/**
+ * @test
+ * @bug 8039269
+ * @author Sergey Bylokhov
+ */
+public final class GetSystemCustomCursor {
+
+    public static void main(final String[] args) throws AWTException {
+        // This list is copied from cursors.properties
+        String[] names = {"CopyDrop.32x32", "MoveDrop.32x32", "LinkDrop.32x32",
+                          "CopyNoDrop.32x32", "MoveNoDrop.32x32",
+                          "LinkNoDrop.32x32", "Invalid.32x32"};
+        for (final String name : names) {
+            if (Cursor.getSystemCustomCursor(name) == null) {
+                throw new RuntimeException("Cursor is null: " + name);
+            }
+        }
+        System.out.println("Test passed");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/accessibility/8069268/bug8069268.java	Tue Mar 03 08:49:13 2015 -0800
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, 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 8069268
+  @summary Tests that only one ContainerListener exists for AccessibleJComponent of JRootPane
+  @author Vivi An
+*/
+import javax.swing.*;
+import java.awt.event.*;
+import javax.accessibility.*;
+
+public class bug8069268{
+    public static void main(String[] args) throws Exception {
+        TestableRootPane rootPane = new TestableRootPane();
+
+        // Get accesibleContext and then AccessibleJComponent, call the function
+        // addPropertyChangeListener to trigger container listener to be added
+        AccessibleContext acc = rootPane.getAccessibleContext();
+        JComponent.AccessibleJComponent accJ = (JComponent.AccessibleJComponent) acc;
+        accJ.addPropertyChangeListener(null);
+
+        // Test how many container listener(s) exist(s), should only have 1
+        if (!rootPane.testContainerListener())
+            throw new RuntimeException("Failed test for bug 8069268");
+    }
+
+    private static class TestableRootPane extends JRootPane {
+        public boolean testContainerListener() {
+            boolean result = false;
+            ContainerListener[] listeners = getContainerListeners();
+            System.out.println("ContainerListener number is " + listeners.length);
+            result = (listeners.length == 1) ? true : false;
+            return result;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/midi/Devices/InitializationHang.java	Tue Mar 03 08:49:13 2015 -0800
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, 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.Toolkit;
+
+import javax.sound.midi.MidiSystem;
+
+/**
+ * @test
+ * @bug 8068412
+ * @author Sergey Bylokhov
+ */
+public final class InitializationHang {
+
+    public static void main(final String[] argv) throws Exception {
+        MidiSystem.getReceiver();
+        Toolkit.getDefaultToolkit();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JMenu/8071705/bug8071705.java	Tue Mar 03 08:49:13 2015 -0800
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2015, 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 8071705
+ * @summary  Java application menu misbehaves when running multiple screen stacked vertically
+ * @build bug8071705
+ * @run main/othervm bug8071705
+ */
+
+import java.awt.Dimension;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.KeyEvent;
+import java.util.concurrent.CountDownLatch;
+
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+public class bug8071705 {
+
+    public static void main(String[] args) throws Exception {
+
+        final CountDownLatch latch = new CountDownLatch(1);
+        final boolean [] result = new boolean[1];
+
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                JFrame frame = createGUI();
+                GraphicsDevice[] devices = checkScreens();
+
+                // check if we have more than one and if they are stacked
+                // vertically
+                GraphicsDevice device = checkConfigs(devices);
+                if (device == null) {
+                    // just pass the test
+                    frame.dispose();
+                    result[0] = true;
+                    latch.countDown();
+                } else {
+                    FrameListener listener =
+                            new FrameListener(device, latch, result);
+                    frame.addComponentListener(listener);
+                    frame.setVisible(true);
+                }
+            }
+        });
+
+        latch.await();
+
+        if (result[0] == false) {
+            throw new RuntimeException("popup menu rendered in wrong position");
+        }
+
+        System.out.println("OK");
+    }
+
+    private static GraphicsDevice[] checkScreens() {
+        GraphicsEnvironment ge =
+            GraphicsEnvironment.getLocalGraphicsEnvironment();
+        return ge.getScreenDevices();
+    }
+
+    private static JFrame createGUI() {
+        JMenuBar menuBar = new JMenuBar();
+        JMenu menu = new JMenu("Some menu");
+        menuBar.add(menu);
+
+        for (int i = 0; i < 10; i++) {
+            menu.add(new JMenuItem("Some menu #" + i));
+        }
+
+        JFrame frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setMinimumSize(new Dimension(200, 200));
+        frame.setJMenuBar(menuBar);
+        return frame;
+    }
+
+    private static GraphicsDevice checkConfigs(GraphicsDevice[] devices) {
+
+        GraphicsDevice correctDevice = null;
+        if (devices.length < 2) {
+            return correctDevice;
+        }
+
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+        Rectangle screenBounds = new Rectangle(toolkit.getScreenSize());
+        int halfScreen = screenBounds.height/2;
+
+        for(int i = 0; i < devices.length; i++) {
+            if(devices[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
+                GraphicsConfiguration conf =
+                        devices[i].getDefaultConfiguration();
+                Rectangle bounds = conf.getBounds();
+                if (bounds.y >= halfScreen) {
+                    // found
+                    correctDevice = devices[i];
+                    break;
+                }
+            }
+        }
+        return correctDevice;
+    }
+
+    private static class FrameListener extends ComponentAdapter {
+
+        private GraphicsDevice device;
+        private CountDownLatch latch;
+        private boolean [] result;
+        public FrameListener(GraphicsDevice device,
+                             CountDownLatch latch,
+                             boolean [] result)
+        {
+            this.device = device;
+            this.latch = latch;
+            this.result = result;
+        }
+
+        @Override
+        public void componentShown(ComponentEvent e) {
+            JFrame frame = (JFrame) e.getComponent();
+
+            runActualTest(device, latch, frame, result);
+
+            frame.setVisible(false);
+            frame.dispose();
+            latch.countDown();
+        }
+    }
+
+    private static Rectangle setLocation(JFrame frame, GraphicsDevice device) {
+        GraphicsConfiguration conf = device.getDefaultConfiguration();
+        Rectangle bounds = conf.getBounds();
+
+        // put just below half screen
+        int x = bounds.x + bounds.width/2;
+        int y = bounds.y + bounds.height/2;
+        frame.setLocation(x, y);
+
+        return bounds;
+    }
+
+    private static void runActualTest(GraphicsDevice device,
+                                      CountDownLatch latch,
+                                      JFrame frame,
+                                      boolean [] result)
+    {
+        Rectangle screenBounds = setLocation(frame, device);
+        JMenu menu = frame.getJMenuBar().getMenu(0);
+        menu.doClick();
+
+        Point location = menu.getLocationOnScreen();
+        JPopupMenu pm = menu.getPopupMenu();
+        Dimension pmSize = pm.getSize();
+
+        int yOffset = UIManager.getInt("Menu.submenuPopupOffsetY");
+        int height = location.y + yOffset + pmSize.height + menu.getHeight();
+        int available = screenBounds.y + screenBounds.height - height;
+        if (available > 0) {
+            Point origin = pm.getLocationOnScreen();
+            if (origin.y < location.y) {
+                // growing upward, wrong!
+                result[0] = false;
+            } else {
+                // growing downward, ok!
+                result[0] = true;
+            }
+        } else {
+            // there is no space, growing upward would be ok, so we pass
+            result[0] = true;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTree/8072676/TreeClipTest.java	Tue Mar 03 08:49:13 2015 -0800
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2015, 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.*;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import javax.imageio.ImageIO;
+import javax.swing.*;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+
+/*
+ * @test
+ * @bug 8072676
+ * @summary Checks if the tree painter doesn't expand existing clip
+ * @author Anton Nashatyrev
+ */
+public class TreeClipTest {
+
+    static boolean passed = true;
+
+    static boolean checkImage(BufferedImage img, int clipY) {
+        for (int y = clipY; y < img.getHeight(); y++) {
+            for (int x = 0; x < img.getWidth(); x++) {
+                if ((img.getRGB(x,y) & 0xFFFFFF) != 0xFFFFFF) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                DefaultMutableTreeNode      root = new DefaultMutableTreeNode("JTree");
+                DefaultMutableTreeNode      parent;
+
+                parent = new DefaultMutableTreeNode("colors");
+                root.add(parent);
+                parent.add(new DefaultMutableTreeNode("blue"));
+                DefaultTreeModel model = new DefaultTreeModel(root);
+                JTree tree = new JTree(model);
+
+                BufferedImage img = new BufferedImage(50, 50, BufferedImage.TYPE_INT_ARGB);
+                for (int clipY = 1; clipY < 50; clipY++) {
+                    Graphics2D ig = img.createGraphics();
+                    ig.setColor(Color.WHITE);
+                    ig.fillRect(0,0,1000, 1000);
+                    tree.setSize(200,200);
+                    ig.setClip(0,0,1000,clipY);
+                    tree.paint(ig);
+                    ig.dispose();
+
+                    if (!checkImage(img, clipY)) {
+                        System.err.println("Failed with clipY=" + clipY);
+                        passed = false;
+                        try {
+                            ImageIO.write(img, "PNG", new File("failedResult.png"));
+                        } catch (IOException e) {
+                            e.printStackTrace();
+                        }
+                        return;
+                    }
+                }
+            }
+        });
+
+        if (!passed) {
+            throw new RuntimeException("Test failed.");
+        } else {
+            System.out.println("Passed.");
+        }
+    }
+}
\ No newline at end of file