7184951: [macosx] Exception at java.awt.datatransfer on headless mode (only in GUI session)
Reviewed-by: art, anthony
--- 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);
}