changeset 8979:23b89bd740e9

Merge
author lana
date Thu, 12 Dec 2013 19:17:34 -0800
parents 01b11184bcf9 27b384262cba
children a7ed72627c3f
files
diffstat 25 files changed, 922 insertions(+), 211 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Dec 11 21:22:49 2013 -0800
+++ b/.hgtags	Thu Dec 12 19:17:34 2013 -0800
@@ -240,3 +240,5 @@
 0dc0067f3b8efb299a4c23f76ee26ea64df9e1d7 jdk8-b116
 fc4ac66aa657e09de5f8257c3174f240ed0cbaf7 jdk8-b117
 28ca338366ff2774ac9002f9f6eaff4101a3ea3b jdk8-b118
+e4499a6529e8c3e762ba86f45cdd774c92a8e7bc jdk8-b119
+d31cd980e1da31fa496a359caaf1a165aeb5791a jdk8-b120
--- a/src/bsd/doc/man/jdeps.1	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/bsd/doc/man/jdeps.1	Thu Dec 12 19:17:34 2013 -0800
@@ -62,7 +62,7 @@
 \fIoptions\fR
 Command-line options\&. See Options\&.
 .TP     
-\fIclass\fR\fIes\fR
+\fIclasses\fR
 Name of the classes to analyze\&. You can specify a class that can be found in the class path, by its file name, a directory, or a JAR file\&.
 .SH DESCRIPTION    
 The \fI\fR\f3jdeps\fR command shows the package-level or class-level dependencies of Java class files\&. The input class can be a path name to a \f3\&.class\fR file, a directory, a JAR file, or it can be a fully qualified class name to analyze all class files\&. The options determine the output\&. By default, \f3jdeps\fR outputs the dependencies to the system output\&. It can generate the dependencies in DOT language (see the \f3-dotoutput\fR option)\&.
@@ -106,6 +106,12 @@
 .br
 Restricts analysis to classes matching pattern\&. This option filters the list of classes to be analyzed\&. It can be used together with \f3-p\fR and \f3-e\fR which apply pattern to the dependencies\&.
 .TP
+-jdkinternals
+.br
+Finds class-level dependences in JDK internal APIs\&. By default, it analyzes all classes specified in the \f3-classpath\fR option and in input files unless you specified the \f3-include\fR option\&. You cannot use this option with the \f3-p\fR, \f3-e\fR, and \f3-s\fR options\&.
+
+\fIWarning\fR: JDK internal APIs may not be accessible in upcoming releases\&.
+.TP
 -P, -profile
 .br
 Shows profile or the file containing a package\&.
--- a/src/linux/doc/man/jdeps.1	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/linux/doc/man/jdeps.1	Thu Dec 12 19:17:34 2013 -0800
@@ -62,7 +62,7 @@
 \fIoptions\fR
 Command-line options\&. See Options\&.
 .TP     
-\fIclass\fR\fIes\fR
+\fIclasses\fR
 Name of the classes to analyze\&. You can specify a class that can be found in the class path, by its file name, a directory, or a JAR file\&.
 .SH DESCRIPTION    
 The \fI\fR\f3jdeps\fR command shows the package-level or class-level dependencies of Java class files\&. The input class can be a path name to a \f3\&.class\fR file, a directory, a JAR file, or it can be a fully qualified class name to analyze all class files\&. The options determine the output\&. By default, \f3jdeps\fR outputs the dependencies to the system output\&. It can generate the dependencies in DOT language (see the \f3-dotoutput\fR option)\&.
@@ -106,6 +106,12 @@
 .br
 Restricts analysis to classes matching pattern\&. This option filters the list of classes to be analyzed\&. It can be used together with \f3-p\fR and \f3-e\fR which apply pattern to the dependencies\&.
 .TP
+-jdkinternals
+.br
+Finds class-level dependences in JDK internal APIs\&. By default, it analyzes all classes specified in the \f3-classpath\fR option and in input files unless you specified the \f3-include\fR option\&. You cannot use this option with the \f3-p\fR, \f3-e\fR, and \f3-s\fR options\&.
+
+\fIWarning\fR: JDK internal APIs may not be accessible in upcoming releases\&.
+.TP
 -P, -profile
 .br
 Shows profile or the file containing a package\&.
--- a/src/solaris/classes/sun/awt/X11/XConstants.java	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/classes/sun/awt/X11/XConstants.java	Thu Dec 12 19:17:34 2013 -0800
@@ -674,9 +674,4 @@
     public static final long XkbModifierMapMask = (1L<<2);
     public static final long XkbVirtualModsMask = (1L<<6); //server map
 
-    /*****************************************************************
-     * X SHARED MEMORY EXTENSION FUNCTIONS
-     *****************************************************************/
-
-    public static final int X_ShmAttach = 1;
 }
--- a/src/solaris/classes/sun/awt/X11/XErrorHandler.java	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/classes/sun/awt/X11/XErrorHandler.java	Thu Dec 12 19:17:34 2013 -0800
@@ -42,29 +42,6 @@
         }
     }
 
-    /**
-     * This is a base synthetic error handler containing a boolean flag which allows
-     * to show that an error is handled or not.
-     */
-    public static class XErrorHandlerWithFlag extends XBaseErrorHandler {
-        private volatile boolean errorOccurred = false;
-
-        public boolean getErrorOccurredFlag() {
-            return errorOccurred;
-        }
-
-        /**
-         * Sets an internal boolean flag to a particular value. Should be always called with
-         * <code>false</code> value of the parameter <code>errorOccurred</code> before this
-         * error handler is set as current.
-         * @param errorOccurred <code>true</code> to indicate that an error was handled,
-         *     <code>false</code> to reset the internal boolean flag
-         */
-        public void setErrorOccurredFlag(boolean errorOccurred) {
-            this.errorOccurred = errorOccurred;
-        }
-    }
-
     /*
      * Instead of validating window id, we simply call XGetWindowProperty,
      * but temporary install this function as the error handler to ignore
@@ -99,51 +76,4 @@
             return theInstance;
         }
     }
-
-    /**
-     * This is a synthetic error handler for errors generated by the native function
-     * <code>XShmAttach</code>. If an error is handled, an internal boolean flag of the
-     * handler is set to <code>true</code>.
-     */
-    public static final class XShmAttachHandler extends XErrorHandlerWithFlag {
-        private XShmAttachHandler() {}
-
-        @Override
-        public int handleError(long display, XErrorEvent err) {
-            if (err.get_minor_code() == XConstants.X_ShmAttach) {
-                setErrorOccurredFlag(true);
-                return 0;
-            }
-            return super.handleError(display, err);
-        }
-
-        // Shared instance
-        private static XShmAttachHandler theInstance = new XShmAttachHandler();
-        public static XShmAttachHandler getInstance() {
-            return theInstance;
-        }
-    }
-
-    /**
-     * This is a synthetic error handler for <code>BadAlloc</code> errors generated by the
-     * native <code>glX*</code> functions. Its internal boolean flag is set to <code>true</code>,
-     * if an error is handled.
-     */
-    public static final class GLXBadAllocHandler extends XErrorHandlerWithFlag {
-        private GLXBadAllocHandler() {}
-
-        @Override
-        public int handleError(long display, XErrorEvent err) {
-            if (err.get_error_code() == XConstants.BadAlloc) {
-                setErrorOccurredFlag(true);
-                return 0;
-            }
-            return super.handleError(display, err);
-        }
-
-        private static GLXBadAllocHandler theInstance = new GLXBadAllocHandler();
-        public static GLXBadAllocHandler getInstance() {
-            return theInstance;
-        }
-    }
 }
--- a/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java	Thu Dec 12 19:17:34 2013 -0800
@@ -42,7 +42,7 @@
     private static long display;
 
     /**
-     * Error handler at the moment of <code>XErrorHandlerUtil</code> initialization.
+     * Error handler at the moment of {@code XErrorHandlerUtil} initialization.
      */
     private static long saved_error_handler;
 
@@ -63,7 +63,7 @@
         new GetBooleanAction("sun.awt.noisyerrorhandler"));
 
     /**
-     * The flag indicating that <code>init</code> was called already.
+     * The flag indicating that {@code init} was called already.
      */
     private static boolean initPassed;
 
@@ -73,9 +73,9 @@
     private XErrorHandlerUtil() {}
 
     /**
-     * Sets the toolkit global error handler, stores the connection to X11 server, which
-     * will be used during an error handling process. This method is called once from
-     * <code>awt_init_Display</code> function defined in <code>awt_GraphicsEnv.c</code>
+     * Sets the toolkit global error handler, stores the connection to X11 server,
+     * which will be used during an error handling process. This method is called
+     * once from {@code awt_init_Display} function defined in {@code awt_GraphicsEnv.c}
      * file immediately after the connection to X11 window server is opened.
      * @param display the connection to X11 server which should be stored
      */
@@ -109,9 +109,9 @@
     }
 
     private static void RESTORE_XERROR_HANDLER(boolean doXSync) {
-        // Wait until all requests are processed by the X server
-        // and only then uninstall the error handler.
         if (doXSync) {
+            // 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/doc/sun/man/man1/jdeps.1	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/doc/sun/man/man1/jdeps.1	Thu Dec 12 19:17:34 2013 -0800
@@ -62,7 +62,7 @@
 \fIoptions\fR
 Command-line options\&. See Options\&.
 .TP     
-\fIclass\fR\fIes\fR
+\fIclasses\fR
 Name of the classes to analyze\&. You can specify a class that can be found in the class path, by its file name, a directory, or a JAR file\&.
 .SH DESCRIPTION    
 The \fI\fR\f3jdeps\fR command shows the package-level or class-level dependencies of Java class files\&. The input class can be a path name to a \f3\&.class\fR file, a directory, a JAR file, or it can be a fully qualified class name to analyze all class files\&. The options determine the output\&. By default, \f3jdeps\fR outputs the dependencies to the system output\&. It can generate the dependencies in DOT language (see the \f3-dotoutput\fR option)\&.
@@ -106,6 +106,12 @@
 .br
 Restricts analysis to classes matching pattern\&. This option filters the list of classes to be analyzed\&. It can be used together with \f3-p\fR and \f3-e\fR which apply pattern to the dependencies\&.
 .TP
+-jdkinternals
+.br
+Finds class-level dependences in JDK internal APIs\&. By default, it analyzes all classes specified in the \f3-classpath\fR option and in input files unless you specified the \f3-include\fR option\&. You cannot use this option with the \f3-p\fR, \f3-e\fR, and \f3-s\fR options\&.
+
+\fIWarning\fR: JDK internal APIs may not be accessible in upcoming releases\&.
+.TP
 -P, -profile
 .br
 Shows profile or the file containing a package\&.
--- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Thu Dec 12 19:17:34 2013 -0800
@@ -906,6 +906,20 @@
 
 static jint canUseShmExt = UNSET_MITSHM;
 static jint canUseShmExtPixmaps = UNSET_MITSHM;
+static jboolean xshmAttachFailed = JNI_FALSE;
+
+int XShmAttachXErrHandler(Display *display, XErrorEvent *xerr) {
+    if (xerr->minor_code == X_ShmAttach) {
+        xshmAttachFailed = JNI_TRUE;
+    }
+    return 0;
+}
+jboolean isXShmAttachFailed() {
+    return xshmAttachFailed;
+}
+void resetXShmAttachFailed() {
+    xshmAttachFailed = JNI_FALSE;
+}
 
 extern int mitShmPermissionMask;
 
@@ -913,7 +927,6 @@
     XShmSegmentInfo shminfo;
     int XShmMajor, XShmMinor;
     int a, b, c;
-    jboolean xShmAttachResult;
 
     AWT_LOCK();
     if (canUseShmExt != UNSET_MITSHM) {
@@ -957,14 +970,21 @@
         }
         shminfo.readOnly = True;
 
-        xShmAttachResult = TryXShmAttach(env, awt_display, &shminfo);
+        resetXShmAttachFailed();
+        /**
+         * The J2DXErrHandler handler will set xshmAttachFailed
+         * to JNI_TRUE if any Shm error has occured.
+         */
+        EXEC_WITH_XERROR_HANDLER(XShmAttachXErrHandler,
+                                 XShmAttach(awt_display, &shminfo));
+
         /**
          * Get rid of the id now to reduce chances of leaking
          * system resources.
          */
         shmctl(shminfo.shmid, IPC_RMID, 0);
 
-        if (xShmAttachResult == JNI_TRUE) {
+        if (isXShmAttachFailed() == JNI_FALSE) {
             canUseShmExt = CAN_USE_MITSHM;
             /* check if we can use shared pixmaps */
             XShmQueryVersion(awt_display, &XShmMajor, &XShmMinor,
@@ -979,23 +999,6 @@
     }
     AWT_UNLOCK();
 }
-
-/*
- * Must be called with the acquired AWT lock.
- */
-jboolean TryXShmAttach(JNIEnv *env, Display *display, XShmSegmentInfo *shminfo) {
-    jboolean errorOccurredFlag = JNI_FALSE;
-    jobject errorHandlerRef;
-
-    /*
-     * XShmAttachHandler will set its internal flag to JNI_TRUE, if any Shm error occurs.
-     */
-    EXEC_WITH_XERROR_HANDLER(env, "sun/awt/X11/XErrorHandler$XShmAttachHandler",
-        "()Lsun/awt/X11/XErrorHandler$XShmAttachHandler;", JNI_TRUE,
-        errorHandlerRef, errorOccurredFlag,
-        XShmAttach(display, shminfo));
-    return errorOccurredFlag == JNI_FALSE ? JNI_TRUE : JNI_FALSE;
-}
 #endif /* MITSHM */
 
 /*
--- a/src/solaris/native/sun/awt/awt_GraphicsEnv.h	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.h	Thu Dec 12 19:17:34 2013 -0800
@@ -53,7 +53,8 @@
 extern int XShmQueryExtension();
 
 void TryInitMITShm(JNIEnv *env, jint *shmExt, jint *shmPixmaps);
-jboolean TryXShmAttach(JNIEnv *env, Display *display, XShmSegmentInfo *shminfo);
+void resetXShmAttachFailed();
+jboolean isXShmAttachFailed();
 
 #endif /* MITSHM */
 
--- a/src/solaris/native/sun/awt/awt_util.c	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/native/sun/awt/awt_util.c	Thu Dec 12 19:17:34 2013 -0800
@@ -41,6 +41,11 @@
 
 #include "java_awt_event_MouseWheelEvent.h"
 
+/*
+ * Called by "ToolkitErrorHandler" function in "XlibWrapper.c" file.
+ */
+XErrorHandler current_native_xerror_handler = NULL;
+
 extern jint getModifiers(uint32_t state, jint button, jint keyCode);
 extern jint getButton(uint32_t button);
 
--- a/src/solaris/native/sun/awt/awt_util.h	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/native/sun/awt/awt_util.h	Thu Dec 12 19:17:34 2013 -0800
@@ -29,57 +29,29 @@
 #ifndef HEADLESS
 #include "gdefs.h"
 
-/*
- * Expected types of arguments of the macro.
- * (JNIEnv*, const char*, const char*, jboolean, jobject)
- */
-#define WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature,                          \
-                            handlerHasFlag, handlerRef) do {                                      \
-    handlerRef = JNU_CallStaticMethodByName(env, NULL, handlerClassName, "getInstance",           \
-        getInstanceSignature).l;                                                                  \
-    if (handlerHasFlag == JNI_TRUE) {                                                             \
-        JNU_CallMethodByName(env, NULL, handlerRef, "setErrorOccurredFlag", "(Z)V", JNI_FALSE);   \
-    }                                                                                             \
-    JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil", "WITH_XERROR_HANDLER", \
-        "(Lsun/awt/X11/XErrorHandler;)V", handlerRef);                                            \
+#define WITH_XERROR_HANDLER(f) do {             \
+    XSync(awt_display, False);                  \
+    current_native_xerror_handler = (f);        \
+} while (0)
+
+#define RESTORE_XERROR_HANDLER do {             \
+    XSync(awt_display, False);                  \
+    current_native_xerror_handler = NULL;       \
+} while (0)
+
+#define EXEC_WITH_XERROR_HANDLER(f, code) do {  \
+    WITH_XERROR_HANDLER(f);                     \
+    do {                                        \
+        code;                                   \
+    } while (0);                                \
+    RESTORE_XERROR_HANDLER;                     \
 } while (0)
 
 /*
- * Expected types of arguments of the macro.
- * (JNIEnv*, jboolean)
+ * Called by "ToolkitErrorHandler" function in "XlibWrapper.c" file.
  */
-#define RESTORE_XERROR_HANDLER(env, doXSync) do {                                                 \
-    JNU_CallStaticMethodByName(env, NULL, "sun/awt/X11/XErrorHandlerUtil",                        \
-        "RESTORE_XERROR_HANDLER", "(Z)V", doXSync);                                               \
-} while (0)
+extern XErrorHandler current_native_xerror_handler;
 
-/*
- * Expected types of arguments of the macro.
- * (JNIEnv*, const char*, const char*, jboolean, jobject, jboolean, No type - C expression)
- */
-#define EXEC_WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, handlerHasFlag,     \
-                                 handlerRef, errorOccurredFlag, code) do {                        \
-    handlerRef = NULL;                                                                            \
-    WITH_XERROR_HANDLER(env, handlerClassName, getInstanceSignature, handlerHasFlag, handlerRef); \
-    do {                                                                                          \
-        code;                                                                                     \
-    } while (0);                                                                                  \
-    RESTORE_XERROR_HANDLER(env, JNI_TRUE);                                                        \
-    if (handlerHasFlag == JNI_TRUE) {                                                             \
-        GET_HANDLER_ERROR_OCCURRED_FLAG(env, handlerRef, errorOccurredFlag);                      \
-    }                                                                                             \
-} while (0)
-
-/*
- * Expected types of arguments of the macro.
- * (JNIEnv*, jobject, jboolean)
- */
-#define GET_HANDLER_ERROR_OCCURRED_FLAG(env, handlerRef, errorOccurredFlag) do {                  \
-    if (handlerRef != NULL) {                                                                     \
-        errorOccurredFlag = JNU_CallMethodByName(env, NULL, handlerRef, "getErrorOccurredFlag",   \
-            "()Z").z;                                                                             \
-    }                                                                                             \
-} while (0)
 #endif /* !HEADLESS */
 
 #ifndef INTERSECTS
--- a/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/native/sun/java2d/opengl/GLXSurfaceData.c	Thu Dec 12 19:17:34 2013 -0800
@@ -48,6 +48,8 @@
 extern void
     OGLSD_SetNativeDimensions(JNIEnv *env, OGLSDOps *oglsdo, jint w, jint h);
 
+jboolean surfaceCreationFailed = JNI_FALSE;
+
 #endif /* !HEADLESS */
 
 JNIEXPORT void JNICALL
@@ -347,6 +349,15 @@
     return JNI_TRUE;
 }
 
+static int
+GLXSD_BadAllocXErrHandler(Display *display, XErrorEvent *xerr)
+{
+    if (xerr->error_code == BadAlloc) {
+        surfaceCreationFailed = JNI_TRUE;
+    }
+    return 0;
+}
+
 JNIEXPORT jboolean JNICALL
 Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer
     (JNIEnv *env, jobject glxsd,
@@ -362,8 +373,6 @@
     int attrlist[] = {GLX_PBUFFER_WIDTH, 0,
                       GLX_PBUFFER_HEIGHT, 0,
                       GLX_PRESERVED_CONTENTS, GL_FALSE, 0};
-    jboolean errorOccurredFlag;
-    jobject errorHandlerRef;
 
     J2dTraceLn3(J2D_TRACE_INFO,
                 "GLXSurfaceData_initPbuffer: w=%d h=%d opq=%d",
@@ -391,15 +400,12 @@
     attrlist[1] = width;
     attrlist[3] = height;
 
-    errorOccurredFlag = JNI_FALSE;
-    WITH_XERROR_HANDLER(env, "sun/awt/X11/XErrorHandler$GLXBadAllocHandler",
-        "()Lsun/awt/X11/XErrorHandler$GLXBadAllocHandler;", JNI_TRUE, errorHandlerRef);
-    pbuffer = j2d_glXCreatePbuffer(awt_display, glxinfo->fbconfig, attrlist);
-    XSync(awt_display, False);
-    RESTORE_XERROR_HANDLER(env, JNI_FALSE);
-    GET_HANDLER_ERROR_OCCURRED_FLAG(env, errorHandlerRef, errorOccurredFlag);
-
-    if ((pbuffer == 0) || errorOccurredFlag) {
+    surfaceCreationFailed = JNI_FALSE;
+    EXEC_WITH_XERROR_HANDLER(
+        GLXSD_BadAllocXErrHandler,
+        pbuffer = j2d_glXCreatePbuffer(awt_display,
+                                       glxinfo->fbconfig, attrlist));
+    if ((pbuffer == 0) || surfaceCreationFailed) {
         J2dRlsTraceLn(J2D_TRACE_ERROR,
             "GLXSurfaceData_initPbuffer: could not create glx pbuffer");
         return JNI_FALSE;
--- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c	Thu Dec 12 19:17:34 2013 -0800
@@ -65,6 +65,7 @@
 static DisposeFunc X11SD_Dispose;
 static GetPixmapBgFunc X11SD_GetPixmapWithBg;
 static ReleasePixmapBgFunc X11SD_ReleasePixmapWithBg;
+extern int XShmAttachXErrHandler(Display *display, XErrorEvent *xerr);
 extern AwtGraphicsConfigDataPtr
     getGraphicsConfigFromComponentPeer(JNIEnv *env, jobject this);
 extern struct X11GraphicsConfigIDs x11GraphicsConfigIDs;
@@ -532,8 +533,6 @@
 {
     XImage *img = NULL;
     XShmSegmentInfo *shminfo;
-    JNIEnv* env;
-    jboolean xShmAttachResult;
 
     shminfo = malloc(sizeof(XShmSegmentInfo));
     if (shminfo == NULL) {
@@ -573,8 +572,9 @@
 
     shminfo->readOnly = False;
 
-    env = (JNIEnv*)JNU_GetEnv(jvm, JNI_VERSION_1_2);
-    xShmAttachResult = TryXShmAttach(env, awt_display, shminfo);
+    resetXShmAttachFailed();
+    EXEC_WITH_XERROR_HANDLER(XShmAttachXErrHandler,
+                             XShmAttach(awt_display, shminfo));
 
     /*
      * Once the XSync round trip has finished then we
@@ -583,7 +583,7 @@
      */
     shmctl(shminfo->shmid, IPC_RMID, 0);
 
-    if (xShmAttachResult == JNI_FALSE) {
+    if (isXShmAttachFailed() == JNI_TRUE) {
         J2dRlsTraceLn1(J2D_TRACE_ERROR,
                        "X11SD_SetupSharedSegment XShmAttach has failed: %s",
                        strerror(errno));
--- a/src/solaris/native/sun/xawt/XlibWrapper.c	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/solaris/native/sun/xawt/XlibWrapper.c	Thu Dec 12 19:17:34 2013 -0800
@@ -41,6 +41,7 @@
 #include <sizecalc.h>
 
 #include <awt.h>
+#include <awt_util.h>
 #include <jvm.h>
 
 #include <Region.h>
@@ -1266,6 +1267,10 @@
 JavaVM* jvm = NULL;
 static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) {
     JNIEnv * env;
+    // First call the native synthetic error handler declared in "awt_util.h" file.
+    if (current_native_xerror_handler != NULL) {
+        current_native_xerror_handler(dpy, event);
+    }
     if (jvm != NULL) {
         env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
         if (env) {
--- a/src/windows/classes/sun/awt/windows/WPathGraphics.java	Wed Dec 11 21:22:49 2013 -0800
+++ b/src/windows/classes/sun/awt/windows/WPathGraphics.java	Thu Dec 12 19:17:34 2013 -0800
@@ -570,6 +570,10 @@
             return false;
         }
 
+        if (gv.getNumGlyphs() == 0) {
+            return true; // nothing to do.
+        }
+
         AffineTransform deviceTransform = getTransform();
         AffineTransform fontTransform = new AffineTransform(deviceTransform);
         Font font = gv.getFont();
@@ -599,6 +603,10 @@
          * device space.
          */
         Point2D.Float userpos = new Point2D.Float(x, y);
+        /* Add the position of the first glyph - its not always 0,0 */
+        Point2D g0pos = gv.getGlyphPosition(0);
+        userpos.x += (float)g0pos.getX();
+        userpos.y += (float)g0pos.getY();
         Point2D.Float devpos = new Point2D.Float();
 
         /* Already have the translate from the deviceTransform,
--- a/test/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java	Wed Dec 11 21:22:49 2013 -0800
+++ b/test/java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java	Thu Dec 12 19:17:34 2013 -0800
@@ -25,7 +25,9 @@
   @test
   @bug 7050935
   @summary closed/java/awt/Choice/WheelEventsConsumed/WheelEventsConsumed.html fails on win32
+  @library ../../regtesthelpers
   @author Oleg Pekhovskiy: area=awt-choice
+  @build Util
   @run main ChoiceMouseWheelTest
 */
 
@@ -142,8 +144,7 @@
                 throw new RuntimeException("Mouse Wheel scroll position error!");
             }
 
-            System.exit(0);
-
+            dispose();
         } catch (AWTException e) {
             throw new RuntimeException("AWTException occurred - problem creating robot!");
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.html	Thu Dec 12 19:17:34 2013 -0800
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+  @test
+  @bug 7161437
+  @summary We should support "apple.awt.fileDialogForDirectories" property.
+  @author Sergey Bylokhov area=awt.filedialog
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno FileDialogForDirectories.html
+  -->
+<head>
+    <title> FileDialogForDirectories </title>
+</head>
+<body>
+
+<h1>FileDialogForDirectories<br>Bug ID: 7161437</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="FileDialogForDirectories.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/FileDialog/FileDialogForDirectories/FileDialogForDirectories.java	Thu Dec 12 19:17:34 2013 -0800
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import sun.awt.OSInfo;
+import test.java.awt.regtesthelpers.Sysout;
+
+import java.applet.Applet;
+import java.awt.Button;
+import java.awt.FileDialog;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class FileDialogForDirectories extends Applet implements ActionListener {
+    private volatile Button showBtn;
+    private volatile FileDialog fd;
+
+    @Override
+    public void init() {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+            Sysout.createDialogWithInstructions(new String[]{
+                    "Press PASS, this test is for MacOS X only."});
+            return;
+        }
+
+        System.setProperty("apple.awt.fileDialogForDirectories", "true");
+
+        setLayout(new GridLayout(1, 1));
+
+        fd = new FileDialog(new Frame(), "Open");
+
+        showBtn = new Button("Show File Dialog");
+        showBtn.addActionListener(this);
+        add(showBtn);
+        String[] instructions = {
+                "1) Click on 'Show File Dialog' button. A file dialog will come up.",
+                "2) Check that files can't be selected.",
+                "3) Check that directories can be selected.",
+                "4) Repeat steps 1 - 3 a few times for different files and directories.",
+                "5) If it's true then the test passed, otherwise it failed."};
+        Sysout.createDialogWithInstructions(instructions);
+    }//End  init()
+
+    @Override
+    public void start() {
+        setSize(200, 200);
+        show();
+    }// start()
+
+    @Override
+    public void actionPerformed(ActionEvent e) {
+        if (e.getSource() == showBtn) {
+            fd.setVisible(true);
+            String output = fd.getFile();
+            if (output != null) {
+                Sysout.println(output + " is selected");
+            }
+        }
+    }
+}// class ManualYesNoTest
--- a/test/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java	Wed Dec 11 21:22:49 2013 -0800
+++ b/test/java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersUnitTest_Extra.java	Thu Dec 12 19:17:34 2013 -0800
@@ -29,6 +29,8 @@
   @run main MouseModifiersUnitTest_Extra
  */
 
+import sun.awt.OSInfo;
+
 import java.awt.*;
 import java.awt.event.*;
 import java.util.Arrays;
@@ -61,6 +63,17 @@
     static int [] modifiersExStandardCTRL;
     static int [] modifiersExStandardALT;
 
+    private final static String SHIFT_MODIFIER = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ?
+                                                "\u21e7" : "Shift";
+
+    private final static String ALT_MODIFIER = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ?
+                                                "\u2325" : "Alt";
+
+
+    private final static String CTRL_MODIFIER = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ?
+                                                "\u2303" : "Ctrl";
+
+
     // BUTTON1, 2, 3 press-release.
     final static int  modifiersStandard = 0; //InputEvent.BUTTON_DOWN_MASK;
 
@@ -77,7 +90,8 @@
 
         if (modifiersEx != curStandardExModifiers[index]){
 //            System.out.println(">>>>>>>>>>>>>>> Pressed. modifiersEx "+modifiersEx +" : "+!= curStandardExModifiers");
-            MessageLogger.reportError("Test failed :  Pressed. modifiersEx != curStandardExModifiers. Got: " + modifiersEx + " , Expected: " + curStandardExModifiers[index]);
+            MessageLogger.reportError("Test failed :  Pressed. modifiersEx != curStandardExModifiers. Got: "
+                    + modifiersEx + " , Expected: " + curStandardExModifiers[index]);
         }
 
      //check event.paramString() output
@@ -88,51 +102,54 @@
         checkExtModifiersOnPress(testModifier, paramStringElements, button);
     }
 
-    public static void checkExtModifiersOnReleaseClick(int testModifier, HashMap h, int button){
+    public static void checkExtModifiersOnReleaseClick(int testModifier, HashMap<String, String> h, int button){
         String ethalon = "";
         switch (testModifier){
             case SHIFT:{
-                ethalon = "Shift";
+                ethalon = SHIFT_MODIFIER;
                 break;
             }
             case ALT:{
-                ethalon = "Alt";
+                ethalon = ALT_MODIFIER;
                 break;
             }
             case CTRL:{
-                ethalon = "Ctrl";
+                ethalon = CTRL_MODIFIER;
                 break;
             }
         }
-        //
+
         if (h.get("extModifiers") == null){
             h.put("extModifiers", "");
         }
+
         if (!ethalon.equals(h.get("extModifiers"))) {
-            MessageLogger.reportError("Test failed :  Released/Clicked. extModifiers = " +h.get("extModifiers")+" instead of : "+ethalon);
+            MessageLogger.reportError("Test failed :  Released/Clicked. extModifiers = "
+                    + h.get("extModifiers") + " instead of : " + ethalon);
         }
     }
 
-    public static void checkExtModifiersOnPress(int testModifier, HashMap h, int button){
+    public static void checkExtModifiersOnPress(int testModifier, HashMap<String, String> h, int button){
         String ethalon = "";
         switch (testModifier){
             case SHIFT:{
-                ethalon = "Shift+";
+                ethalon = SHIFT_MODIFIER + "+";
                 break;
             }
             case ALT:{
-                ethalon = "Alt+";
+                ethalon = ALT_MODIFIER + "+";
                 break;
             }
             case CTRL:{
-                ethalon = "Ctrl+";
+                ethalon = CTRL_MODIFIER + "+";
                 break;
             }
         }
         ethalon = ethalon + "Button" +button;
 
         if (!h.get("extModifiers").equals(ethalon)) {
-            MessageLogger.reportError("Test failed :  Pressed. extModifiers = " +h.get("extModifiers")+" instead of : "+ethalon);
+            MessageLogger.reportError("Test failed :  Pressed. extModifiers = " +h.get("extModifiers")+" instead of : "
+                    + ethalon);
         }
     }
 
@@ -152,7 +169,7 @@
         }
     }
     public static HashMap<String, String> tokenizeParamString(String param){
-        HashMap <String, String> params = new HashMap<String, String>();
+        HashMap <String, String> params = new HashMap<>();
         StringTokenizer st = new StringTokenizer(param, ",=");
         while (st.hasMoreTokens()){
             String tmp = st.nextToken();
@@ -167,7 +184,7 @@
     }
 
     public static Vector<String> tokenizeModifiers(String modifierList){
-        Vector<String> modifiers = new Vector<String>();
+        Vector<String> modifiers = new Vector<>();
         StringTokenizer st = new StringTokenizer(modifierList, "+");
         while (st.hasMoreTokens()){
             String tmp = st.nextToken();
@@ -189,7 +206,8 @@
         }
 
         if (modifiersEx != curStandardExModifiers[index]){
-            MessageLogger.reportError("Test failed :  Released. modifiersEx != curStandardExModifiers. Got: " + modifiersEx + " , Expected: " + curStandardExModifiers[index]);
+            MessageLogger.reportError("Test failed :  Released. modifiersEx != curStandardExModifiers. Got: "
+                    + modifiersEx + " , Expected: " + curStandardExModifiers[index]);
         }
 
      //check event.paramString() output
@@ -212,7 +230,8 @@
         }
 
         if (modifiersEx != curStandardExModifiers[index]){
-            MessageLogger.reportError("Test failed :  Clicked. modifiersEx != curStandardExModifiers. Got: " + modifiersEx + " , Expected: " + curStandardExModifiers[index]);
+            MessageLogger.reportError("Test failed :  Clicked. modifiersEx != curStandardExModifiers. Got: "
+                    + modifiersEx + " , Expected: " + curStandardExModifiers[index]);
         }
 
      //check event.paramString() output
@@ -243,22 +262,10 @@
     static Robot robot;
     public void init() {
         this.setLayout(new BorderLayout());
-
-        String[] instructions =
-        {
-            "This test should be used with the mouse having more then three buttons.",
-            "Currently, " + MouseInfo.getNumberOfButtons() +" buttons are available.",
-            "If there are less then three buttons, press PASS.",
-            "1. Press each extra mouse button.",
-            "2. For each mouse event its modifiers and ExModifiers will be printed.",
-            "3. Verify that they are correct.",
-            "4. Press Pass or Fail accordingly."
-        };
-//        Sysout.createDialogWithInstructions( instructions );
-
-//        addMouseListener(adapterTest1);
         try {
             robot  = new Robot();
+            robot.setAutoDelay(100);
+            robot.setAutoWaitForIdle(true);
         } catch (Exception e) {
             MessageLogger.reportError("Test failed. "+e);
         }
@@ -297,9 +304,8 @@
         robot.delay(1000);
         robot.mouseMove(getLocationOnScreen().x + getWidth()/2, getLocationOnScreen().y + getHeight()/2);
         for (int i = 3; i< mouseButtonDownMasks.length; i++){
-            System.out.println("testNONE() => " +mouseButtonDownMasks[i] );
+            System.out.println("testNONE() => " + mouseButtonDownMasks[i]);
             robot.mousePress(mouseButtonDownMasks[i]);
-            robot.delay(100);
             robot.mouseRelease(mouseButtonDownMasks[i]);
         }
         robot.delay(1000);
@@ -312,9 +318,8 @@
         robot.mouseMove(getLocationOnScreen().x + getWidth()/2, getLocationOnScreen().y + getHeight()/2);
         for (int i = 3; i< mouseButtonDownMasks.length; i++){
             robot.keyPress(KeyEvent.VK_SHIFT);
-            System.out.println("testSHIFT() => " +mouseButtonDownMasks[i] );
+            System.out.println("testSHIFT() => " + mouseButtonDownMasks[i]);
             robot.mousePress(mouseButtonDownMasks[i]);
-            robot.delay(100);
             robot.mouseRelease(mouseButtonDownMasks[i]);
             robot.keyRelease(KeyEvent.VK_SHIFT);
         }
@@ -328,9 +333,8 @@
         robot.mouseMove(getLocationOnScreen().x + getWidth()/2, getLocationOnScreen().y + getHeight()/2);
         for (int i = 3; i< mouseButtonDownMasks.length; i++){
             robot.keyPress(KeyEvent.VK_CONTROL);
-            System.out.println("testCTRL() => " +mouseButtonDownMasks[i] );
+            System.out.println("testCTRL() => " + mouseButtonDownMasks[i]);
             robot.mousePress(mouseButtonDownMasks[i]);
-            robot.delay(100);
             robot.mouseRelease(mouseButtonDownMasks[i]);
             robot.keyRelease(KeyEvent.VK_CONTROL);
         }
@@ -344,9 +348,8 @@
         robot.mouseMove(getLocationOnScreen().x + getWidth()/2, getLocationOnScreen().y + getHeight()/2);
         for (int i = 3; i< mouseButtonDownMasks.length; i++){
             robot.keyPress(KeyEvent.VK_ALT);
-            System.out.println("testALT() => " +mouseButtonDownMasks[i] );
+            System.out.println("testALT() => " + mouseButtonDownMasks[i]);
             robot.mousePress(mouseButtonDownMasks[i]);
-            robot.delay(100);
             robot.mouseRelease(mouseButtonDownMasks[i]);
             robot.keyRelease(KeyEvent.VK_ALT);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/MouseInfo/JContainerMousePositionTest.java	Thu Dec 12 19:17:34 2013 -0800
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @summary unit test for a new method in Container class: getMousePosition(boolean)
+  @author dav@sparc.spb.su: area=
+  @bug 4009555
+  @run main JContainerMousePositionTest
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.concurrent.atomic.AtomicReference;
+
+// this test looks at mouse pointer when it
+// 1 over component
+// 2 over Container, but not over one of its child Components.
+// out of bounds of Container
+// two values of paramater allowChildren are considered.
+
+public class JContainerMousePositionTest {
+    //Declare things used in the test, like buttons and labels here
+    private static JButton jButton1;
+    private static JButton jButton4;
+    private static JFrame frame1;
+    private static Container contentPane;
+
+    public static void main(final String[] args) throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(200);
+        robot.setAutoWaitForIdle(true);
+
+        SwingUtilities.invokeAndWait(JContainerMousePositionTest::init);
+
+        robot.delay(500);
+        robot.waitForIdle();
+
+        AtomicReference<Point> centerC4 = new AtomicReference<>();
+        SwingUtilities.invokeAndWait(() -> {
+            centerC4.set(jButton4.getLocation());
+            contentPane.remove(jButton4);
+            contentPane.validate();
+            contentPane.repaint();
+        });
+        robot.waitForIdle();
+
+        AtomicReference<Rectangle> frameBounds = new AtomicReference<>();
+        AtomicReference<Dimension> button1Size = new AtomicReference<>();
+        SwingUtilities.invokeAndWait(() -> {
+            frameBounds.set(frame1.getBounds());
+            button1Size.set(jButton1.getSize());
+        });
+
+//point mouse to center of top-left Component (button1)
+        robot.mouseMove(frameBounds.get().x + button1Size.get().width / 2,
+                        frameBounds.get().y + button1Size.get().height / 2);
+
+        AtomicReference<Point> pFalse = new AtomicReference<>();
+        AtomicReference<Point> pTrue = new AtomicReference<>();
+        SwingUtilities.invokeAndWait(() -> {
+            pFalse.set(frame1.getMousePosition(false));
+            pTrue.set(frame1.getMousePosition(true));
+        });
+        robot.waitForIdle();
+        if (pFalse.get() != null) {
+            throw new RuntimeException("Test failed: Container.getMousePosition(false) returned non-null over one of children.");
+        }
+        System.out.println("Test stage completed: Container.getMousePosition(false) returned null result over child Component. Passed.");
+
+        if (pTrue.get() == null) {
+            throw new RuntimeException("Test failed: Container.getMousePosition(true) returned null result over child Component");
+        }
+        System.out.println("Test stage compelted: Container.getMousePosition(true) returned non-null result over child Component. Passed.");
+
+//point mouse out from Container's area
+        robot.mouseMove(frameBounds.get().x + frameBounds.get().width + 10,
+                        frameBounds.get().y + frameBounds.get().height + 10);
+        SwingUtilities.invokeAndWait(() -> {
+            pFalse.set(frame1.getMousePosition(false));
+            pTrue.set(frame1.getMousePosition(true));
+        });
+        robot.waitForIdle();
+        if (pFalse.get() != null || pTrue.get() != null) {
+            throw new RuntimeException("Test failed: Container.getMousePosition(boolean) returned incorrect result outside Container");
+        }
+        System.out.println("Test stage completed: Container.getMousePosition(boolean) returned null result outside Container. Passed.");
+
+//point mouse in place free from child components (right-botton component)
+        robot.mouseMove(frameBounds.get().x + centerC4.get().x,
+                        frameBounds.get().y + centerC4.get().y);
+
+        robot.delay(3000);
+        SwingUtilities.invokeAndWait(() -> {
+            pFalse.set(contentPane.getMousePosition(false));
+            pTrue.set(frame1.getMousePosition(true));
+        });
+        robot.waitForIdle();
+
+        if (pFalse.get() == null || pTrue.get() == null) {
+            throw new RuntimeException("Test failed: Container.getMousePosition(boolean) returned null result inside Container.");
+        }
+        System.out.println("Test stage completed: Container.getMousePosition(boolean) returned non-null results  inside Container. Passed.");
+
+        if (pTrue.get().x != centerC4.get().x || pTrue.get().y != centerC4.get().y) {
+            throw new RuntimeException("Test failed: Container.getMousePosition(true) returned incorrect result inside Container.");
+        }
+        System.out.println("Test stage completed: Container.getMousePosition(true) returned correct result inside Container. Passed.");
+
+        System.out.println("TEST PASSED");
+    }
+
+    private static void init() {
+        frame1 = new JFrame("Testing getMousePosition() on LWs");
+        jButton1 = new JButton("C1");
+        jButton4 = new JButton("C4");
+        contentPane = frame1.getContentPane();
+        contentPane.setLayout(new GridLayout(2, 2, 25, 25));
+        contentPane.add(jButton1);
+        contentPane.add(new JButton("C2"));
+        contentPane.add(new JButton("C3"));
+        contentPane.add(jButton4);
+        frame1.setSize(200, 200);
+        frame1.setVisible(true);
+    }
+}
+
+
--- a/test/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.java	Wed Dec 11 21:22:49 2013 -0800
+++ b/test/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.java	Thu Dec 12 19:17:34 2013 -0800
@@ -96,9 +96,7 @@
                 Sysout.println(t.getTransferData(DataFlavor.fragmentHtmlFlavor).toString());
                 Sysout.println("SELECTION:");
                 Sysout.println(t.getTransferData(DataFlavor.selectionHtmlFlavor).toString());
-            } catch (UnsupportedFlavorException e) {
-                e.printStackTrace();
-            } catch (IOException e) {
+            } catch (UnsupportedFlavorException | IOException e) {
                 e.printStackTrace();
             }
 
@@ -116,6 +114,7 @@
                 "   otherwise for instance iexplore can prohibit drag and drop from",
                 "   the browser to other applications because of",
                 "   the protected mode restrictions.",
+                "   On Mac OS X do NOT use Safari, it does not provide the needed DataFlavor",
                 "3) Check the data in the output area of this dialog",
                 "5) The output should not contain information that any of",
                 "   flavors is not present in the system clipboard",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/event/MouseEvent/DisabledComponents/DisabledComponentsTest.java	Thu Dec 12 19:17:34 2013 -0800
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4173714
+  @summary java.awt.button behaves differently under Win32/Solaris
+  @author tdv@sparc.spb.su
+  @library ../../../regtesthelpers
+  @build Util
+  @run main DisabledComponentsTest
+*/
+
+/**
+ * DisabledComponentsTest.java
+ *
+ * summary: java.awt.button behaves differently under Win32/Solaris
+ * Disabled component should not receive events. This is what this
+ * test checks out.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import test.java.awt.regtesthelpers.Util;
+
+import javax.swing.*;
+
+public class DisabledComponentsTest {
+
+    private static Frame frame;
+    private static Button b = new Button("Button");
+    private static final AtomicBoolean pressed = new AtomicBoolean(false);
+    private static final AtomicBoolean entered = new AtomicBoolean(false);
+
+    private static void init() {
+        frame = new Frame("Test");
+        frame.setBounds(100, 100, 100, 100);
+        b = new Button("Test");
+        b.setEnabled(false);
+        b.addMouseListener(new MouseAdapter() {
+            public void mousePressed(MouseEvent e) {
+                System.err.println("Mouse pressed. target=" + e.getSource());
+                if (!b.isEnabled()) {
+                    System.err.println("TEST FAILED: BUTTON RECEIVED AN EVENT WHEN DISABLED!");
+                    pressed.set(true);
+                }
+            }
+            public void mouseEntered(MouseEvent e) {
+                System.out.println("Mouse entered. target=" + e.getSource());
+                if (!b.isEnabled())
+                    System.err.println("TEST FAILED: BUTTON RECEIVED AN EVENT WHEN DISABLED!");
+                entered.set(true);
+            }
+        });
+        frame.add(b);
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            Robot r = Util.createRobot();
+            r.setAutoDelay(200);
+            r.setAutoWaitForIdle(true);
+            r.mouseMove(0, 0);
+            SwingUtilities.invokeAndWait(DisabledComponentsTest::init);
+            Util.waitForIdle(r);
+            Util.pointOnComp(b, r);
+            if (entered.get()) {
+                throw new RuntimeException("TEST FAILED: disabled button received MouseEntered event");
+            }
+            Util.clickOnComp(b, r);
+            if (pressed.get()) {
+                throw new RuntimeException("TEST FAILED: disabled button received MousePressed event");
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java	Thu Dec 12 19:17:34 2013 -0800
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 6317481 8012325
+  @summary REG:Pressing the mouse, dragging and releasing it outside the button triggers ActionEvent, XAWT
+  @author Dmitry.Cherepanov@SUN.COM area=awt.event
+  @run main EnterAsGrabbedEvent
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+
+public class EnterAsGrabbedEvent
+{
+    //Declare things used in the test, like buttons and labels here
+    private static Frame frame;
+    private static Button button;
+    private static volatile boolean enterTriggered = false;
+    private static volatile boolean actionTriggered = false;
+
+    private static void init()
+    {
+        frame = new Frame();
+        frame.setLayout(new FlowLayout());
+        button = new Button("button");
+        button.addActionListener(actionEvent -> {
+            actionTriggered = true;
+        });
+        frame.add(button);
+        frame.setBounds(100, 100, 200, 200);
+        frame.setVisible(true);
+        frame.validate();
+      }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            Robot r = new Robot();
+            r.setAutoDelay(200);
+            r.setAutoWaitForIdle(true);
+            SwingUtilities.invokeAndWait(EnterAsGrabbedEvent::init);
+            r.waitForIdle();
+
+            Point loc = button.getLocationOnScreen();
+            r.mouseMove(loc.x+button.getWidth()/2, loc.y+button.getHeight()/2);
+            r.mousePress(InputEvent.BUTTON1_MASK);
+
+            // in this case (drag mouse outside the button):
+            // NotifyEnter (->MouseEnter) should be dispatched to the top-level
+            // event if the grabbed window is the component (button)
+            frame.addMouseListener(
+                    new MouseAdapter() {
+                        public void mouseEntered(MouseEvent me) {
+                            System.out.println(me);
+                            enterTriggered = true;
+                        }
+
+                        // Just for tracing
+                        public void mouseExited(MouseEvent me) {
+                            System.out.println(me);
+                        }
+                    });
+
+            // Just for tracing
+            button.addMouseListener(
+                    new MouseAdapter(){
+                        public void mouseEntered(MouseEvent me){
+                            System.out.println(me);
+                        }
+                        public void mouseExited(MouseEvent me){
+                            System.out.println(me);
+                        }
+                    });
+
+            r.mouseMove(loc.x+button.getWidth() + 1, loc.y+button.getHeight()/2);
+
+            r.mouseRelease(InputEvent.BUTTON1_MASK);
+
+            if (!enterTriggered) {
+                throw new RuntimeException("Test failed. MouseEntered was not triggered");
+            }
+
+            if (actionTriggered) {
+                throw new RuntimeException("Test failed. ActionEvent triggered");
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/print/PrinterJob/PrintGlyphVectorTest.java	Thu Dec 12 19:17:34 2013 -0800
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 1999, 2003, 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 8029204
+ * @summary Tests GlyphVector is printed in the correct location
+ * @run main/manual=yesno PrintGlyphVectorTest
+ */
+
+import java.io.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.font.*;
+import java.awt.geom.*;
+import java.awt.print.*;
+
+public class PrintGlyphVectorTest extends Component implements Printable {
+
+    public void drawGVs(Graphics g) {
+
+        String testString = "0123456789abcdefghijklm";
+        Graphics2D g2d = (Graphics2D)g;
+        g2d.setColor(Color.black);
+        Font font = new Font("SansSerif", Font.PLAIN, 30);
+        FontRenderContext frc = g2d.getFontRenderContext();
+        GlyphVector v = font.createGlyphVector(frc, testString);
+
+
+        float x = 50f,
+              y = 50f;
+
+        g2d.drawGlyphVector(v, x, y);
+        Rectangle2D r = v.getVisualBounds();
+        r.setRect(r.getX()+x, r.getY()+y, r.getWidth(), r.getHeight());
+        g2d.draw(r);
+
+        Point2D p; // .Float p = new Point2D.Float();
+        for (int i = 0; i < v.getNumGlyphs(); i++) {
+            p = v.getGlyphPosition(i);
+            p.setLocation(p.getX()+50, p.getY());
+            v.setGlyphPosition(i, p);
+        }
+
+        x = 0;
+        y+= 50;
+
+        g2d.drawGlyphVector(v, x, y);
+        r = v.getVisualBounds();
+        r.setRect(r.getX()+x, r.getY()+y, r.getWidth(), r.getHeight());
+        g2d.draw(r);
+
+
+
+    }
+
+     public void paint(Graphics g) {
+       g.setColor(Color.white);
+       g.fillRect(0,0,getSize().width, getSize().height);
+       drawGVs(g);
+     }
+
+    public Dimension getPreferredSize() {
+        return new Dimension(600,200);
+    }
+
+    public int print(Graphics g, PageFormat pf, int pageIndex) {
+
+        if (pageIndex > 0) {
+            return Printable.NO_SUCH_PAGE;
+        }
+
+        Graphics2D g2d = (Graphics2D)g;
+        g2d.translate(pf.getImageableX(), pf.getImageableY());
+        drawGVs(g2d);
+
+        return Printable.PAGE_EXISTS;
+    }
+
+
+    public static void main(String arg[]) throws Exception {
+
+       Frame f = new Frame();
+       PrintGlyphVectorTest pvt = new PrintGlyphVectorTest();
+       f.add("Center", pvt);
+       f.add("South", new PrintInstructions());
+       f.pack();
+       f.show();
+
+
+    }
+}
+
+class PrintInstructions extends Panel implements ActionListener {
+
+   static final String INSTRUCTIONS =
+       "You must have a printer installed for this test.\n" +
+       "Press the PRINT button below and OK the print dialog\n" +
+       "Retrieve the output and compare the printed and on-screen text\n" +
+       " to confirm that in both cases the text is aligned and the boxes\n" +
+       "are around the text, not offset from the text.";
+
+  PrintInstructions() {
+
+     setLayout(new GridLayout(2,1));
+     TextArea t = new TextArea(INSTRUCTIONS, 8, 80);
+     add(t);
+     Button b = new Button("PRINT");
+     b.setFont(new Font("Dialog", Font.BOLD, 30));
+     b.addActionListener(this);
+     add(b);
+  }
+
+  public void actionPerformed(ActionEvent e) {
+       PrinterJob pj = PrinterJob.getPrinterJob();
+       if (pj == null ||
+           pj.getPrintService() == null ||
+           !pj.printDialog()) {
+           return;
+       }
+
+       pj.setPrintable(new PrintGlyphVectorTest());
+       try {
+           pj.print();
+       } catch (PrinterException ex) {
+           System.err.println(ex);
+       }
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame.java	Thu Dec 12 19:17:34 2013 -0800
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+import sun.awt.OSInfo;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 7124513
+ * @summary We should support NSTexturedBackgroundWindowMask style on OSX.
+ * @author Sergey Bylokhov
+ */
+public final class NSTexturedJFrame {
+
+    private static final String BRUSH = "apple.awt.brushMetalLook";
+    private static final String STYLE = "Window.style";
+    private static final BufferedImage[] images = new BufferedImage[3];
+    private static Rectangle bounds;
+    private static volatile int step;
+    private static JFrame frame;
+
+    public static void main(final String[] args) throws Exception {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+            System.out.println("This test is for OSX, considered passed.");
+            return;
+        }
+        // Default window appearance
+        showFrame();
+        step++;
+        // apple.awt.brushMetalLook appearance
+        showFrame();
+        step++;
+        // Window.style appearance
+        showFrame();
+
+        // images on step 1 and 2 should be same
+        testImages(images[1], images[2], false);
+        // images on step 1 and 2 should be different from default
+        testImages(images[0], images[1], true);
+        testImages(images[0], images[2], true);
+    }
+
+    private static void testImages(BufferedImage img1, BufferedImage img2,
+                                   boolean shouldbeDifferent) {
+        boolean different = false;
+        for (int x = 0; x < img1.getWidth(); ++x) {
+            for (int y = 0; y < img1.getHeight(); ++y) {
+                if (img1.getRGB(x, y) != img2.getRGB(x, y)) {
+                    different = true;
+                }
+            }
+        }
+        if (different != shouldbeDifferent) {
+            throw new RuntimeException("Textured property does not work");
+        }
+    }
+
+    private static void showFrame() throws Exception {
+        final Robot robot = new Robot();
+        robot.setAutoDelay(50);
+        createUI();
+        images[step] = robot.createScreenCapture(bounds);
+        SwingUtilities.invokeAndWait(frame::dispose);
+        sleep();
+    }
+
+    private static void createUI() throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            frame = new JFrame();
+            frame.setUndecorated(true);
+            frame.setSize(400, 400);
+            frame.setLocationRelativeTo(null);
+            switch (step) {
+                case 1:
+                    frame.getRootPane().putClientProperty(BRUSH, true);
+                    break;
+                case 2:
+                    frame.getRootPane().putClientProperty(STYLE, "textured");
+            }
+            frame.setVisible(true);
+        });
+        sleep();
+        SwingUtilities.invokeAndWait(() -> {
+            bounds = frame.getBounds();
+        });
+        sleep();
+    }
+
+    private static void sleep() throws InterruptedException {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Thread.sleep(1000);
+    }
+}