From nobody Mon May 30 20:45:32 2022 X-Original-To: java@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 440ED1B45FBF for ; Mon, 30 May 2022 20:45:33 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LBnVN6PQbz3qMw for ; Mon, 30 May 2022 20:45:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2D831E36A for ; Mon, 30 May 2022 20:45:32 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 24UKjW9S074456 for ; Mon, 30 May 2022 20:45:32 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 24UKjWEb074455 for java@FreeBSD.org; Mon, 30 May 2022 20:45:32 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" From: bugzilla-noreply@freebsd.org To: java@FreeBSD.org Subject: maintainer-feedback requested: [Bug 264356] java/openjdk17: Exception with multi-screen setup Date: Mon, 30 May 2022 20:45:32 +0000 X-Bugzilla-Type: request X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: java@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? Message-ID: In-Reply-To: References: X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Porting Java to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-java List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-java@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653943532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XcohSY/HiVXE01xgGJFnp6L+A0apzuW/JZP/RbCfdKw=; b=SPFSHBWqXUezFxROepaU4kQ6XlgHrLPRqB83WOPbgD53IujEdxaIbnhQehZe7TWoGQhdG5 KDMQruOoprkt+1Bu8ZJeH1I9RhXT/pxrP2FAbIX3XnsSKtW0WPy2zgL0QDEdlMvv45yyCq ovnGpYCnXokLJG3uYKfEMhASx96eNvkHgQiZYr28pQTW4v4PjijgrMsnhJVr323i2izuq5 an+zIg9KjDTQGmL+qGPz0hrDR/cMRFubCYk6NeynHlPhWdCu4bu4sLO7k4IidI8o4JAmze 0stGhJJGEHilrE2dyCLQVvLGoDHZ5CTATW2eqFO9U3MQ2bXQRwZ7Itc5YuYXfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653943532; a=rsa-sha256; cv=none; b=R6Ikg+FDSPkbqo3J2HzKLZNJhwM0P2y78Zw0ucZvGCOHfxPNlHiaepp9QLKeOB8mn144QJ R+xHzeJHPukBfGDnDM6CChegQpFXuYUxl4ypdD7GNDdXMLZXqw54tKQRa3MeC+rdH+zQsb nyhIljR1g5PVGKEqtf4YExv+S+jtMt+U0bu03pOnbRr6RQ+tEoUaPM8TZ0yOk1Ntk5+fYK xsAphJBci5SlkqWai/EhOJQilo6JfXu5g89AiU+1upcB5zUrqIPimOISUikJoWzZQVf+Mh wId30cN5WwKNwQPmptmnmI770YVQFQa3DelXaDCmVDueHrBkKBHjaRBL6ppsmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N Bugzilla Automation has asked freebsd-java (Nobody) for maintainer-feedback: Bug 264356: java/openjdk17: Exception with multi-screen setup https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D264356 --- Description --- Starting in OpenJDK 17 (tested on FreeBSD), a call to java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment() will cause a program to throw java.lang.ExceptionInInitializerError if run on a screen that is not the first screen, i.e., :3.0. I am unsure how good the attached fix is, but it does prevent the crash. Basically, the variable screens is null when run on another screen such as :3.1. As the only thing needed is the number of screens, I switched it to use the already defined numScreens. It is easy to duplicate using xephyr: Xephyr :3 -screen 800x600 -screen 800x600 Running the attached java program on screen :3.0 will work. Running it on screen :3.1 throws an exception: Exception in thread "main" java.lang.ExceptionInInitializerError at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Graph= icsE nvironment.java:106) at GraphEnv.main(GraphEnv.java:18) Caused by: java.lang.NullPointerException: Cannot read the array length bec= ause "this.screens" is null at java.desktop/sun.awt.X11GraphicsEnvironment.initDevices(X11GraphicsEnvironm= ent. java:235) at java.desktop/sun.awt.X11GraphicsEnvironment.rebuildDevices(X11GraphicsEnvir= onme nt.java:216) at java.desktop/sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.j= ava: 201) at java.desktop/sun.awt.PlatformGraphicsInfo.createGE(PlatformGraphicsInfo.jav= a:36 ) at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironm= ent. java:93) at java.desktop/java.awt.GraphicsEnvironment$LocalGE.(GraphicsEnvironm= ent. java:84) at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Graph= icsE nvironment.java:106) at GraphEnv.main(GraphEnv.java:18) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Meth= od) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethod= Acce ssorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Delegati= ngMe thodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:419) at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:192) at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:132)