changeset 19020:1f20de4aef29

7184951: [macosx] Exception at java.awt.datatransfer on headless mode (only in GUI session) Reviewed-by: art, anthony
author pchelko
date Tue, 23 Jul 2013 13:09:44 +0400
parents 622c39d5e9ee
children 8a5340b88ee5
files jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Mon Jul 22 20:33:35 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Tue Jul 23 13:09:44 2013 +0400
@@ -182,7 +182,11 @@
         Long format = predefinedClipboardNameMap.get(str);
 
         if (format == null) {
-            format = new Long(registerFormatWithPasteboard(str));
+            if (java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
+                // Do not try to access native system for the unknown format
+                return -1L;
+            }
+            format = registerFormatWithPasteboard(str);
             predefinedClipboardNameMap.put(str, format);
             predefinedClipboardFormatMap.put(format, str);
         }