This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 216184 - NullPointerException at javax.swing.JPopupMenu.setVisible
Summary: NullPointerException at javax.swing.JPopupMenu.setVisible
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: JDK Problems (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Stanislav Aubrecht
URL: http://bugs.sun.com/bugdatabase/view_...
Keywords:
: 229399 243302 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-07-31 11:25 UTC by barmeier
Modified: 2014-06-06 10:04 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 191091


Attachments
stacktrace (5.22 KB, text/plain)
2012-07-31 11:25 UTC, barmeier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description barmeier 2012-07-31 11:25:06 UTC
Build: NetBeans IDE 7.2 (Build 201207171143)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.1-b02, Java(TM) SE Runtime Environment, 1.6.0_26-b03
OS: Linux

User Comments:
barmeier: Tried to select a source file from the "show opened document" list

GUEST: attempted to select the first option in the open window drop down box




Stacktrace: 
java.lang.NullPointerException
   at javax.swing.JPopupMenu.setVisible(JPopupMenu.java:737)
   at javax.swing.JPopupMenu.menuSelectionChanged(JPopupMenu.java:1421)
   at javax.swing.MenuSelectionManager.setSelectedPath(MenuSelectionManager.java:94)
   at javax.swing.MenuSelectionManager.clearSelectedPath(MenuSelectionManager.java:126)
   at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1102)
   at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1096)
Comment 1 barmeier 2012-07-31 11:25:08 UTC
Created attachment 122571 [details]
stacktrace
Comment 2 Stanislav Aubrecht 2012-09-11 10:05:07 UTC
This is actually a bug in JDK code, JPopupMenu.setVisible() first checks if popup != null (line 735), then calls firePopupMenuWillBecomeInvisible() and then popup.hide() 
However the popup class member can be null at this point as some of the listeners may clear the field.

I've added a workaround in core-main 2e3044808b1e
Comment 3 Quality Engineering 2012-09-12 02:12:13 UTC
Integrated into 'main-golden', will be available in build *201209120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2e3044808b1e
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #216184 - catch harmless NPE from JDK bug
Comment 4 Exceptions Reporter 2012-09-17 10:41:14 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=191091
Comment 5 Stanislav Aubrecht 2013-05-17 15:04:18 UTC
*** Bug 229399 has been marked as a duplicate of this bug. ***
Comment 6 Stuhrer 2014-04-22 11:42:30 UTC
I still run into this problem (NetBeans IDE 7.4 with the suggested workaround present) when
using a JComboBox within a TopComponent:

- Show the "opened document list" by clicking the DropDownButton created by the TabControlButtonFactory
- Click on the down arrow of any visible JComboBox as child of a TopComponent

Backtrace:
	at javax.swing.JPopupMenu.setVisible(JPopupMenu.java:795)
	at javax.swing.JPopupMenu.menuSelectionChanged(JPopupMenu.java:1476)
	at javax.swing.MenuSelectionManager.setSelectedPath(MenuSelectionManager.java:112)
	at javax.swing.JPopupMenu.setVisible(JPopupMenu.java:783)
	at javax.swing.JPopupMenu.show(JPopupMenu.java:959)
	at javax.swing.plaf.basic.BasicComboPopup.show(BasicComboPopup.java:208)
	at javax.swing.plaf.basic.BasicComboPopup.togglePopup(BasicComboPopup.java:1128)
	at javax.swing.plaf.basic.BasicComboPopup$Handler.mousePressed(BasicComboPopup.java:825)
	at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
	at java.awt.Component.processMouseEvent(Component.java:6502)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
Comment 7 Stanislav Aubrecht 2014-05-16 10:07:00 UTC
*** Bug 243302 has been marked as a duplicate of this bug. ***
Comment 8 Stanislav Aubrecht 2014-06-06 10:04:52 UTC
(In reply to Stuhrer from comment #6)
> I still run into this problem (NetBeans IDE 7.4 with the suggested
> workaround present) when
> using a JComboBox within a TopComponent:


It's a JDK bug https://bugs.openjdk.java.net/browse/JDK-4488581 and in your case the problem originates in a plain JComboBox so we can't provide any workaround.