Merge
authorlana
Mon, 21 Feb 2011 14:23:42 -0800
changeset 8370 b9caf1665f2a
parent 8366 80ea422b84e8 (current diff)
parent 8369 d835f77a7f86 (diff)
child 8382 0d231bdb78cf
Merge
--- a/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java	Mon Feb 21 14:22:08 2011 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDesktopPeer.java	Mon Feb 21 14:23:42 2011 -0800
@@ -44,11 +44,27 @@
 public class XDesktopPeer implements DesktopPeer {
 
     private static boolean nativeLibraryLoaded = false;
-    static {
-        nativeLibraryLoaded = init();
+    private static boolean initExecuted = false;
+
+    private static void initWithLock(){
+        XToolkit.awtLock();
+        try {
+            if (!initExecuted) {
+                nativeLibraryLoaded = init();
+            }
+        } finally {
+            initExecuted = true;
+            XToolkit.awtUnlock();
+        }
+    }
+
+    //package-private
+    XDesktopPeer(){
+        initWithLock();
     }
 
     static boolean isDesktopSupported() {
+        initWithLock();
         return nativeLibraryLoaded;
     }
 
@@ -83,12 +99,17 @@
     }
 
     private void launch(URI uri) throws IOException {
-        if (!nativeLibraryLoaded) {
-            throw new IOException("Failed to load native libraries.");
+        byte[] uriByteArray = ( uri.toString() + '\0' ).getBytes();
+        boolean result = false;
+        XToolkit.awtLock();
+        try {
+            if (!nativeLibraryLoaded) {
+                throw new IOException("Failed to load native libraries.");
+            }
+            result = gnome_url_show(uriByteArray);
+        } finally {
+            XToolkit.awtUnlock();
         }
-
-        byte[] uriByteArray = ( uri.toString() + '\0' ).getBytes();
-        boolean result = gnome_url_show(uriByteArray);
         if (!result) {
             throw new IOException("Failed to show URI:" + uri);
         }
--- a/jdk/src/solaris/native/sun/xawt/awt_Desktop.c	Mon Feb 21 14:22:08 2011 -0800
+++ b/jdk/src/solaris/native/sun/xawt/awt_Desktop.c	Mon Feb 21 14:23:42 2011 -0800
@@ -48,9 +48,15 @@
     }
     dlerror(); /* Clear errors */
     gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
+    if (gnome_vfs_init == NULL){
+#ifdef INTERNAL_BUILD
+        fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");
+#endif
+        return 0;
+    }
     if ((errmsg = dlerror()) != NULL) {
 #ifdef INTERNAL_BUILD
-        fprintf(stderr, "can not find symble gnome_vfs_init\n");
+        fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);
 #endif
         return 0;
     }
--- a/jdk/test/sun/java2d/pipe/RegionOps.java	Mon Feb 21 14:22:08 2011 -0800
+++ b/jdk/test/sun/java2d/pipe/RegionOps.java	Mon Feb 21 14:23:42 2011 -0800
@@ -1,3 +1,26 @@
+/*
+ * Copyright (c) 2009, 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 %W% %E%
  * @bug 6504874