JDK-6852051 : Getting Null Pointer Exception when displaying message for TrayIcon on Opensolaris
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris
  • CPU: generic
  • Submitted: 2009-06-17
  • Updated: 2011-01-19
  • Resolved: 2009-09-16
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 7
7 b72Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
Getting Null Pointer Exception when displaying message for a TrayIcon.
I reproduced this with Opensolaris 2009.06 with Jdk7 b60 build. Works fine on jdk6 u14.

Steps To reproduce:

1.Run the attached jar file.
   java -jar awt_demo.jar
2.Choose tab "TrayIconDemo"
3. Enter an ImagePath , then click the "Initialize the TrayIcon" button
4. Select the Trayicon instance from the "Select a TrayIcon" ComboBox and click "Add Icon " button
5. Enter a message and enter a caption
6. Enter a message type (can be any.. ex ERROR) and click Display Message button
7. You can see the Display Message for the trayicon. Close the Display Message
8. Now click the Display Message button again with the same message type (ex ERROR)
9. If you see the Exception the bug is reproduced.

The stack trace is as follows:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at sun.awt.X11.XEmbeddedFramePeer.getAbsoluteX(XEmbeddedFramePeer.java:279)
	at sun.awt.X11.XBaseWindow.getAbsoluteX(XBaseWindow.java:1170)
	at sun.awt.X11.XBaseWindow.toOtherWindow(XBaseWindow.java:746)
	at sun.awt.X11.XBaseWindow.toGlobal(XBaseWindow.java:784)
	at sun.awt.X11.XEmbeddedFramePeer.getLocationOnScreen(XEmbeddedFramePeer.java:193)
	at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1914)
	at java.awt.Component.getLocationOnScreen(Component.java:1892)
	at sun.awt.X11.InfoWindow$Balloon$3.run(InfoWindow.java:399)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:235)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:603)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:286)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:191)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:139)
Also reproducible on Ubuntu 8.04

Comments
SUGGESTED FIX http://sa.sfbay.sun.com/projects/awt_data/7/6852051
21-08-2009

EVALUATION The failure was introduced by the joint changes for the following CRs 6678385 Random java.lang.StackOverflowError from various JDKs 6809227 poor performance on Panel.Add() method in jdk6 The changes for 6678385 (introduced in b60) installs AWT global error handler when the AWT toolkit is initialized and now the global handler lives until the JVM shutdown. As a result of this, the global handler catches the BadMatch errors (and probably some other errors) during the application life cycles, before the changes these error were swallowed without being revealed. The changes for 6809227 (introduced in b55) replaces the implementation of the Z-order change to handle all Z-order request in a more cheap way. Now, upon any Z-order change request coming to a component (component A), the new implementation tries to find an appropriate component (component B) to place the component A just below the component B (avoiding restack for all component of the container which is quite expensive). The problem with the currect Z-order implementation is that the getHWPeerAboveMe method of the Component class which is responsible for finding the correct component B may return a sibling of a container of the component A (if the component A visually should be located below the sibling). Thus, the component B (returned by the getHWPeerAboveMe method) actually may not be a sibling of the component A and this kind of request may not be allowed by the underlying system and so this request may cause BadMatch error.
20-08-2009

EVALUATION Running the testcase with -Dsun.awt.noisyerrorhandler reveals a lot of errors: --------------------------------------------------------------------- Xerror BadMatch (invalid parameter attributes), XID 340004a, ser# 430 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 340004e, ser# 441 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400050, ser# 452 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400052, ser# 463 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400069, ser# 571 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 340006f, ser# 601 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400071, ser# 612 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400075, ser# 634 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400083, ser# 706 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400096, ser# 801 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 340009c, ser# 831 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000a2, ser# 861 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000a4, ser# 872 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000a6, ser# 883 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000a8, ser# 894 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000b0, ser# 934 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000b8, ser# 974 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000c0, ser# 1014 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000c8, ser# 1054 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000d0, ser# 1098 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000d4, ser# 1120 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000e0, ser# 1181 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000e6, ser# 1211 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000e8, ser# 1222 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000ea, ser# 1233 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34000ec, ser# 1244 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400102, ser# 1356 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 340010a, ser# 1400 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 340010c, ser# 1411 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400127, ser# 1554 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 340013f, ser# 1677 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400157, ser# 1800 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 340015d, ser# 1830 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400163, ser# 1860 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400169, ser# 1890 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 340016f, ser# 1920 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400228, ser# 3938 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400246, ser# 4088 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 3400223, ser# 4724 Major opcode 42 (X_SetInputFocus) Xerror BadMatch (invalid parameter attributes), XID 340021e, ser# 5399 Major opcode 42 (X_SetInputFocus) Xerror BadMatch (invalid parameter attributes), XID 340021e, ser# 5402 Major opcode 42 (X_SetInputFocus) Xerror BadMatch (invalid parameter attributes), XID 3400223, ser# 5406 Major opcode 42 (X_SetInputFocus) Xerror BadMatch (invalid parameter attributes), XID 34002aa, ser# 7567 Major opcode 12 (X_ConfigureWindow) Xerror BadMatch (invalid parameter attributes), XID 34002ba, ser# 7966 Major opcode 12 (X_ConfigureWindow) Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at sun.awt.X11.XEmbeddedFramePeer.getAbsoluteX(XEmbeddedFramePeer.java:279) at sun.awt.X11.XBaseWindow.getAbsoluteX(XBaseWindow.java:1167) at sun.awt.X11.XBaseWindow.toOtherWindow(XBaseWindow.java:746) at sun.awt.X11.XBaseWindow.toGlobal(XBaseWindow.java:784) at sun.awt.X11.XEmbeddedFramePeer.getLocationOnScreen(XEmbeddedFramePeer.java:193) at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1925) at java.awt.Component.getLocationOnScreen(Component.java:1903) at sun.awt.X11.InfoWindow$Balloon$3.run(InfoWindow.java:399) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:235) at java.awt.EventQueue.dispatchEvent(EventQueue.java:616) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:286) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:191) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:186) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178) at java.awt.EventDispatchThread.run(EventDispatchThread.java:139) ---------------------------------------------------------------------------------- XConfigureWindow generates BadMatch errors and NPE could be a side effect of this.
06-07-2009