When switching monitor configurations I get a NullPointerException and then an Objective-C exception.
Note: I believe these are the steps to reproduce, as I arrived to work to find this exception.
This was using a local top-of-branch build from jdk7u-dev. To reproduce you will need a MacBook Pro and an external monitor. Start with just the MacBook; no monitor connected.
1. Install the Mac OS X JRE from http://jdk7.java.net/macportpreview/
2. Run
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/jcontrol
3. Leave the control panel open, and close the laptop. Now, connect a monitor and keyboard so you can see the desktop on the external monitor.
4. You should see a pair of exceptions:
2012-06-07 10:26:30.430 java[1590:707] java.lang.NullPointerException
at sun.awt.image.VolatileSurfaceManager.displayChanged(VolatileSurfaceManager.java:340)
at sun.awt.SunDisplayChanger.notifyListeners(SunDisplayChanger.java:132)
at sun.java2d.SunGraphicsEnvironment.displayChanged(SunGraphicsEnvironment.java:281)
at sun.awt.CGraphicsEnvironment._displayReconfiguration(CGraphicsEnvironment.java:119)
2012-06-07 10:26:31.650 java[1590:707] (
0 CoreFoundation 0x00007fff8a744f56 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff8d4aad5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8a7cf1b9 -[NSException raise] + 9
3 JavaNativeFoundation 0x0000000116787541 JNFCallVoidMethod + 209
4 liblwawt.dylib 0x0000000117000bec __displaycb_handle_block_invoke_1 + 58
5 JavaNativeFoundation 0x000000011678918a JNFPerformEnvBlock + 86
6 liblwawt.dylib 0x0000000117000bac displaycb_handle + 78
7 CoreGraphics 0x00007fff8eae105f displayConfigFinalizedProc + 377
8 CoreGraphics 0x00007fff8e5bc867 CGSPostLocalNotification + 237
9 CoreGraphics 0x00007fff8e67ed3d notifyDatagramHandler + 260
10 CoreGraphics 0x00007fff8e67eabf CGSDispatchDatagramsFromStream + 268
11 CoreGraphics 0x00007fff8e67e6a4 snarfEvents + 437
12 CoreGraphics 0x00007fff8e67e3a7 CGSGetNextEventRecordInternal + 110
13 CoreGraphics 0x00007fff8e6cca19 CGEventCreateNextEvent + 29
14 HIToolbox 0x00007fff8de55f6a _ZL38PullEventsFromWindowServerOnConnectionjh + 69
15 CoreFoundation 0x00007fff8a6a3c52 __CFMachPortPerform + 386
16 CoreFoundation 0x00007fff8a6a3abc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 44
17 CoreFoundation 0x00007fff8a6a37eb __CFRunLoopDoSource1 + 155
18 CoreFoundation 0x00007fff8a6d9f27 __CFRunLoopRun + 1895
19 CoreFoundation 0x00007fff8a6d9486 CFRunLoopRunSpecific + 230
20 HIToolbox 0x00007fff8de404d3 RunCurrentEventLoopInMode + 277
21 HIToolbox 0x00007fff8de47781 ReceiveNextEventCommon + 355
22 HIToolbox 0x00007fff8de4760e BlockUntilNextEventMatchingListInMode + 62
23 AppKit 0x00007fff8b1a5e31 _DPSNextEvent + 659
24 AppKit 0x00007fff8b1a5735 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
25 libosxapp.dylib 0x000000011709e82c -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 124
26 AppKit 0x00007fff8b1a2071 -[NSApplication run] + 470
27 libosxapp.dylib 0x000000011709e74b +[NSApplicationAWT runAWTLoopWithApp:] + 156
28 liblwawt.dylib 0x0000000116ffafea -[AWTStarter starter:] + 1587
29 CoreFoundation 0x00007fff8a73470d -[NSObject performSelector:withObject:] + 61
30 Foundation 0x00007fff870a6d70 __NSThreadPerformPerform + 214
31 CoreFoundation 0x00007fff8a6b34f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
32 CoreFoundation 0x00007fff8a6b2d5d __CFRunLoopDoSources0 + 253
33 CoreFoundation 0x00007fff8a6d9b49 __CFRunLoopRun + 905
34 CoreFoundation 0x00007fff8a6d9486 CFRunLoopRunSpecific + 230
35 java 0x000000010c6dc4bc CreateExecutionEnvironment + 871
36 java 0x000000010c6d6cac JLI_Launch + 1952
37 java 0x000000010c6dc819 main + 101
38 java 0x000000010c6d6504 start + 52
)
The Control Panel does not crash and doesn't seem to be affected by the error, but these kind of exceptions are not good in final code.
The 7u6 RT wants to take the fix that is listed in the bug and then recommends that a new bug be opened to fix the real proble.