7184951: [macosx] Exception at java.awt.datatransfer on headless mode (only in GUI session)

Reviewed-by: art, anthony
This commit is contained in:
Petr Pchelko 2013-07-23 13:09:44 +04:00
parent 54198bc15e
commit a98d595162

View File

@ -182,7 +182,11 @@ public class CDataTransferer extends DataTransferer {
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);
}