From 04da03097291336cb15f8d2b51f042eb0db675c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxim=20Kartash=D1=91v?= Date: Thu, 11 Jul 2024 11:57:45 +0400 Subject: [PATCH] JBR-7390 Wayland: need better headless exception message (cherry picked from commit b68c0ecc6ff5e27c8cf59afed9d4819ceef6dbb2) --- .../classes/sun/awt/PlatformGraphicsInfo.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/java.desktop/unix/classes/sun/awt/PlatformGraphicsInfo.java b/src/java.desktop/unix/classes/sun/awt/PlatformGraphicsInfo.java index 054d681183a5..ca33cfd4cd63 100644 --- a/src/java.desktop/unix/classes/sun/awt/PlatformGraphicsInfo.java +++ b/src/java.desktop/unix/classes/sun/awt/PlatformGraphicsInfo.java @@ -128,12 +128,20 @@ public final class PlatformGraphicsInfo { * the application has called an API that requires headful. */ public static String getDefaultHeadlessMessage() { - return - """ + return PlatformGraphicsInfo.getToolkitID() == PlatformGraphicsInfo.TK_WAYLAND ? + """ - No X11 DISPLAY variable was set, - or no headful library support was found, - but this program performed an operation which requires it."""; + Could not connect to the Wayland server (check WAYLAND_DISPLAY), + or no headful library support was found, + but this program performed an operation which requires it, + """ + : + """ + + No X11 DISPLAY variable was set, + or no headful library support was found, + but this program performed an operation which requires it, + """; } public static String getSplashScreenLib() {