United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6417505 GraphicsDevice.getDisplayMode() returns null with ddraw disabled, Vista
JDK-6417505 : GraphicsDevice.getDisplayMode() returns null with ddraw disabled, Vista

Details
Type:
Bug
Submit Date:
2006-04-25
Status:
Resolved
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2006-05-26
Component:
client-libs
OS:
windows_vista
Sub-Component:
2d
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
Use the attached testcase to reproduce the problem.

The results of the test running is following:

on Vista:
using -Dsun.java2d.noddraw=True returns null
using -Dsun.java2d.noddraw=False returns not null value

on XP:
returns not null value in both cases

============TESTCASE==================================

import java.awt.*;

public class GetDisplayModeTest{

	public static final void main(String args[]){
		GraphicsDevice gd = 
		    GraphicsEnvironment.getLocalGraphicsEnvironment().
		    getDefaultScreenDevice();
	        if (!gd.isFullScreenSupported()) {
		    System.out.println("Full Screen is not supported, test considered passed.");
		    return;
	    	}
		DisplayMode dm = gd.getDisplayMode();
		System.out.println("Display Mode = "+dm);
	}
}

                                    

Comments
EVALUATION

Looks like a Vista-specific problem, works fine on XP with ddraw disabled.
I get the NPE on the latest Vista build-as well.
                                     
2006-04-25
EVALUATION

The reason for the failure is that Vista by default has a non-attached
device (with DISPLAY_DEVICE_MIRRORING_DRIVER flag) listed as the first
device found by EnumDisplayDevices. Our code for getting the device 
name by the screen number wasn't checking if the device was attached.

When we later tried to use EnumDisplaySettings with this mirroring virtual device, 
it would not find any display modes for it, thus the NPE.

The fix is to correctly identify the attached devices.
                                     
2006-04-25
SUGGESTED FIX

removed
                                     
2006-04-25
SUGGESTED FIX

http://javaweb.sfbay/jcg/1.6.0-mustang/2D/6417505
                                     
2006-04-26



Hardware and Software, Engineered to Work Together