JDK-6740974 : api/javax_swing/PopupFactory/index.html#Ctor[PopupFactory2002] fails with NPE
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-08-25
  • Updated: 2012-03-22
  • Resolved: 2009-07-08
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 b55Fixed
Related Reports
Relates :  
Description
Failing test:
api/javax_swing/PopupFactory/index.html#Ctor[PopupFactory2002]

Platform: Windows
Test fails  - JDK7 b32, b33
Test passes - JDK6u10

The following line causes NPE:

        PopupFactory.getSharedInstance().getPopup(new Canvas(), new Canvas(), 10, 10);

Exception in thread "main" java.lang.NullPointerException
	at javax.swing.PopupFactory$ContainerPopup.fitsOnScreen(PopupFactory.java:561)
	at javax.swing.PopupFactory$MediumWeightPopup.getMediumWeightPopup(PopupFactory.java:818)
	at javax.swing.PopupFactory.getMediumWeightPopup(PopupFactory.java:256)
	at javax.swing.PopupFactory.getPopup(PopupFactory.java:227)
	at javax.swing.PopupFactory.getPopup(PopupFactory.java:170)

Comments
EVALUATION PopupFactory.ContainerPopup.fitsOnScreen() assumes non-null parent, hence the NPE.
06-04-2009

EVALUATION This is a regression of the fix for 6694823 parent.getBounds(); leads to NPE if parent is null
26-08-2008