JDK-7145508 : [embedded] java.awt.GraphicsDevice.get/setDisplayMode behavior is incorrect when no display is present
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u4,8,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,os_x,solaris
  • CPU: x86
  • Submitted: 2012-02-14
  • Updated: 2015-09-29
  • Resolved: 2015-04-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u60Fixed 9 b65Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
on linux when a display is not connected (read reported as connected by xrandr), a number of JCK tests that utilize  java.awt.GraphicsDevice.get/setDisplayMode fail.

The tests that fail are:

api/java_awt/GraphicsDevice/indexTGF.html#General[getDisplayMode_nonNull]
api/java_awt/GraphicsDevice/indexTGF.html#SetDisplayModeExceptions[IAE_nonExistingDisplayMode]
api/java_awt/GraphicsDevice/indexTGF.html#SetDisplayModeExceptions[IAE_nullDisplayMode]
api/java_awt/GraphicsDevice/indexTGF.html#SetGetFullScreenWindow[getSetWindow]
api/java_awt/GraphicsDevice/indexTGF.html#SetGetFullScreenWindow[getSet_Null]
api/java_awt/GraphicsDevice/indexTGF.html#SetGetFullScreenWindow[setFullScreenWindow_visibleAfterReturning]
api/java_awt/SplashScreen/AnimatedContentTests.html#AnimatedContentTests[testAnimation]
api/java_awt/SplashScreen/AnimatedContentTests.html#AnimatedContentTests[testDefaultPosition]
api/java_awt/SplashScreen/AnimatedContentTests.html#AnimatedContentTests[testWindowBounds]
api/java_awt/SplashScreen/AnimatedContentTests.html#AnimatedContentTests[testWindowSize]
api/java_awt/SplashScreen/CreateGraphicsTestsOpq.html#CreateGraphicsTestsOpq[testDrawingOverSplashScreen]
api/java_awt/SplashScreen/SetImageURLTestsImage.html#SetImageURLTestsImage[testWindowReposition]
api/java_awt/SplashScreen/SetImageURLTestsImage.html#SetImageURLTestsImage[testWindowResize]
api/java_awt/SplashScreen/SetImageURLTestsJar.html#SetImageURLTestsJar[testWindowReposition]
api/java_awt/SplashScreen/SetImageURLTestsJar.html#SetImageURLTestsJar[testWindowResize]
api/java_awt/SplashScreen/TransparencyTestsArgGIF.html#TransparencyTestsArgGIF[testTransparency]
api/java_awt/SplashScreen/TransparencyTestsMnfPNG.html#TransparencyTestsMnfPNG[testTransparency]
api/java_awt/SplashScreen/TransparentContentTestsArgGIF.html#TransparentContentTestsArgGIF[testDefaultPosition]
api/java_awt/SplashScreen/TransparentContentTestsArgGIF.html#TransparentContentTestsArgGIF[testWindowBounds]
api/java_awt/SplashScreen/TransparentContentTestsArgGIF.html#TransparentContentTestsArgGIF[testWindowSize]
api/java_awt/SplashScreen/TransparentContentTestsMnfPNG.html#TransparentContentTestsMnfPNG[testDefaultPosition]
api/java_awt/SplashScreen/TransparentContentTestsMnfPNG.html#TransparentContentTestsMnfPNG[testWindowBounds]
api/java_awt/SplashScreen/TransparentContentTestsMnfPNG.html#TransparentContentTestsMnfPNG[testWindowSize]
api/java_awt/Window/indexTGF.html#BackgroundGeneral[testNoAlphaFullScreen]
api/java_awt/Window/indexTGF.html#ShapeExceptions[testICSEThrowing_fullScreen]
api/java_awt/Window/indexTGF.html#ShapeGeneral[nullShapeForFullScreen]
api/java_awt/GraphicsDevice/indexTGF.html#ShapeAndTranslucencyForFullScreen[nullShape]
api/java_awt/GraphicsDevice/indexTGF.html#ShapeAndTranslucencyForFullScreen[opacityReset]
api/java_awt/SplashScreen/SetImageURLTestsImage.html#SetImageURLTestsImage[testImage]
api/java_awt/SplashScreen/SetImageURLTestsJar.html#SetImageURLTestsJar[testImage]
api/java_awt/SplashScreen/StaticContentTestsArgGIF.html#StaticContentTestsArgGIF[testDefaultPosition]
api/java_awt/SplashScreen/StaticContentTestsArgGIF.html#StaticContentTestsArgGIF[testWindowBounds]
api/java_awt/SplashScreen/StaticContentTestsArgGIF.html#StaticContentTestsArgGIF[testWindowSize]
api/java_awt/SplashScreen/StaticContentTestsArgJPG.html#StaticContentTestsArgJPG[testDefaultPosition]
api/java_awt/SplashScreen/StaticContentTestsArgJPG.html#StaticContentTestsArgJPG[testWindowBounds]
api/java_awt/SplashScreen/StaticContentTestsArgJPG.html#StaticContentTestsArgJPG[testWindowSize]
api/java_awt/SplashScreen/StaticContentTestsArgPNG.html#StaticContentTestsArgPNG[testDefaultPosition]
api/java_awt/SplashScreen/StaticContentTestsArgPNG.html#StaticContentTestsArgPNG[testWindowBounds]
api/java_awt/SplashScreen/StaticContentTestsArgPNG.html#StaticContentTestsArgPNG[testWindowSize]
api/java_awt/SplashScreen/StaticContentTestsMnfGIF.html#StaticContentTestsMnfGIF[testDefaultPosition]
api/java_awt/SplashScreen/StaticContentTestsMnfGIF.html#StaticContentTestsMnfGIF[testWindowBounds]
api/java_awt/SplashScreen/StaticContentTestsMnfGIF.html#StaticContentTestsMnfGIF[testWindowSize]
api/java_awt/SplashScreen/StaticContentTestsMnfJPG.html#StaticContentTestsMnfJPG[testDefaultPosition]
api/java_awt/SplashScreen/StaticContentTestsMnfJPG.html#StaticContentTestsMnfJPG[testWindowBounds]
api/java_awt/SplashScreen/StaticContentTestsMnfJPG.html#StaticContentTestsMnfJPG[testWindowSize]
api/java_awt/SplashScreen/StaticContentTestsMnfPNG.html#StaticContentTestsMnfPNG[testDefaultPosition]
api/java_awt/SplashScreen/StaticContentTestsMnfPNG.html#StaticContentTestsMnfPNG[testWindowBounds]
api/java_awt/SplashScreen/StaticContentTestsMnfPNG.html#StaticContentTestsMnfPNG[testWindowSize]
api/java_awt/GraphicsDevice/indexTGF.html#SetFullScreenWindowExclusive[coversAllScreenDevice]
api/java_awt/GraphicsDevice/indexTGF.html#SetFullScreenWindowExclusive[thereCouldBeOnlyOne]
api/java_awt/SplashScreen/CreateGraphicsTestsTsp.html#CreateGraphicsTestsTsp[testDrawingOverSplashScreen]
api/java_awt/SplashScreen/StaticContentTestsArgGIF.html#StaticContentTestsArgGIF[testImage]
api/java_awt/SplashScreen/StaticContentTestsArgJPG.html#StaticContentTestsArgJPG[testImage]
api/java_awt/SplashScreen/StaticContentTestsArgPNG.html#StaticContentTestsArgPNG[testImage]
api/java_awt/SplashScreen/StaticContentTestsMnfGIF.html#StaticContentTestsMnfGIF[testImage]
api/java_awt/SplashScreen/StaticContentTestsMnfJPG.html#StaticContentTestsMnfJPG[testImage]
api/java_awt/SplashScreen/StaticContentTestsMnfPNG.html#StaticContentTestsMnfPNG[testImage]
api/java_awt/SplashScreen/index.html#PrecedenceTest[testImageIsCorrect]

the reason for the failure is that GraphicsDevice.getDisplayMode() returns null in such case, and GraphicsDevice.setDisplayMode() throws NPE.

Comments
I was able to reproduce this on my Ubuntu desktop by removing the monitor and using ssh to login in. I will note that my default DISPLAY was localhost:10.0 and it did not reproduce with that - I had to set it to ":0". Then I get null reported when I disconnect the display and a valid display mode when I reconnect it. I verified that it is XR&R extension returning NULL. I think that we can fall back to using the default values from X11 for screen dimensions in this case . I have already tested this and it works. It was noted that the same was seen on Mac but the jtr log is not available and we spent some time with a MacMini testing in the same way, disconnecting its display. Unless we specify AWT_FORCE_HEADFUL=true then the JDK will assume headless when we are ssh'd in like this. When it is specified then the program works fine. Perhaps something has been changed/fixed since this was seen on Mac.
17-04-2015

The test api/java_awt/GraphicsDevice/indexTGF_SetFullScreenWindowExclusive passes on Solaris 11 sparc if PHYSICAL display is attached.
13-02-2014

Also Affected: api/java_awt/GraphicsDevice/indexTGF_SetDisplayMode[setDisplayMode_differentModes]
17-10-2013

These are all approved for deferral to JDK 9 so you can update the FixVersion to state JDK 9. Kind regards, Mathias
29-08-2013

These are all approved for deferral to JDK 9 so you can update the FixVersion to state JDK 9. Kind regards, Mathias
29-08-2013

These are all approved for deferral to JDK 9 so you can update the FixVersion to state JDK 9. Kind regards, Mathias
29-08-2013

api/java_awt/GraphicsDevice/indexTGF.html#SetGetFullScreenWindow[setFullScreenWindow_becomesVisible]
19-08-2013

Converted "8-client-defer-candidate" label to "8-defer-request" by SQE' OK.
15-08-2013

*This is anti-deferral criteria list*: - P2 -------------- Engineering's Criteria ------------------------------------- - tck-red labeled - conformance labeled - P3 regressions reported/labeled against jdk8 - findbugs, parfait, eht labeled bugs - CAP <1 year reported - netbeans <1 year reported Victor ----------------- SQE's OK --------------------------------- Yes, we are ok with that thanks, Mikhail
15-08-2013

EVALUATION This doesn't sound like a supported scenario. Recategorise as RFE
22-03-2012