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

Sergey Bylokhov serb at openjdk.org
Wed Feb 4 21:04:31 UTC 2026


On Wed, 4 Feb 2026 16:17:31 GMT, Phil Race <prr at openjdk.org> wrote:

> 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)

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

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


More information about the client-libs-dev mailing list