RFR: 8377167: javax/imageio/ReadAbortTest.java throw NPE when x11 unavailable

SendaoYan syan at openjdk.org
Thu Feb 5 11:59:51 UTC 2026


On Wed, 4 Feb 2026 21:02:04 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> This does not make one bit of sense. These tests do nothing with DISPLAY. They do not start AWT.
>
>> This does not make one bit of sense. These tests do nothing with DISPLAY. They do not start AWT.
> 
> Since DISPLAY is set, the GraphicsEnvironment considers the system as headful and tries to connect to display. After this patch, the test will not pass in that environment but will instead show the real stack trace.
> 
> java.awt.AWTError: Can't connect to X11 window server using ':123' as the value of the DISPLAY variable.
>         at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
>         at java.desktop/sun.awt.X11GraphicsEnvironment.initStatic(X11GraphicsEnvironment.java:100)
>         at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:57)
>         at java.desktop/sun.awt.PlatformGraphicsInfo.createGE(PlatformGraphicsInfo.java:35)
>         at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:89)
>         at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:80)
>         at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:102)
>         at java.desktop/java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1167)
>         at ReadAbortTest.<init>(ReadAbortTest.java:64)
>         at ReadAbortTest.main(ReadAbortTest.java:149)
>         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:565)
>         at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
>         at java.base/java.lang.Thread.run(Thread.java:1516)

Sorry, I did not describe the issue clearly enough. Thanks @mrserb the additionly details.

Thanks the reviews @prrace @mrserb

-------------

PR Comment: https://git.openjdk.org/jdk/pull/29569#issuecomment-3853148859


More information about the client-libs-dev mailing list