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 165925 - NullPointerException at org.netbeans.modules.profiler.actions.ProfilerToolbarDropdownAction.getToolbarPresenter
Summary: NullPointerException at org.netbeans.modules.profiler.actions.ProfilerToolbar...
Status: VERIFIED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Jaroslav Tulach
URL: http://statistics.netbeans.org/except...
Keywords: RANDOM, REGRESSION
Depends on:
Blocks:
 
Reported: 2009-05-25 09:39 UTC by Vojtech Sigler
Modified: 2009-05-29 15:07 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 151722


Attachments
stacktrace (3.92 KB, text/plain)
2009-05-25 09:40 UTC, Vojtech Sigler
Details
I am not able to reproduce the problem, but this patch provides fallback which might help (1.70 KB, patch)
2009-05-25 12:33 UTC, Jaroslav Tulach
Details | Diff
stacktrace (3.91 KB, text/plain)
2009-05-25 15:22 UTC, swpalmer
Details
stacktrace (3.91 KB, text/plain)
2009-05-25 16:11 UTC, Filip Zamboj
Details
An improved patch to guarantee that there is at most one AttachAction instance created (3.73 KB, patch)
2009-05-26 12:56 UTC, Jaroslav Tulach
Details | Diff
ProfilerToolbarDropdownAction.java (6.75 KB, text/plain)
2009-05-26 15:54 UTC, Jiri Sedlacek
Details
messages_OK.log (29.51 KB, text/plain)
2009-05-26 15:55 UTC, Jiri Sedlacek
Details
messages_NPE.log (41.11 KB, text/plain)
2009-05-26 15:55 UTC, Jiri Sedlacek
Details
NPE was caused by missing NAME attribute. Added. Please give the new patch a try. Thanks. (3.84 KB, patch)
2009-05-27 11:07 UTC, Jaroslav Tulach
Details | Diff
stacktrace (3.92 KB, text/plain)
2009-05-27 15:47 UTC, cbulcu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vojtech Sigler 2009-05-25 09:39:59 UTC
Build: NetBeans IDE Dev (Build 200905250201)
VM: Java HotSpot(TM) Client VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Linux, 2.6.28-11-generic, i386

User Comments:
vsigler: Started netbeans with a clean userdir and opened a java project.



Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.profiler.actions.ProfilerToolbarDropdownAction.getToolbarPresenter(ProfilerToolbarDropdownAction.java:89)
        at org.openide.awt.Toolbar$Folder.createInstance(Toolbar.java:417)
        at org.openide.loaders.FolderInstance.defaultProcessObjectsFinal(FolderInstance.java:857)
        at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:722)
        at org.openide.util.Task.run(Task.java:249)
        at org.netbeans.modules.openide.loaders.AWTTask.run(AWTTask.java:70)
Comment 1 Vojtech Sigler 2009-05-25 09:40:04 UTC
Created attachment 82721 [details]
stacktrace
Comment 2 Jiri Sedlacek 2009-05-25 10:48:11 UTC
Product Version: NetBeans IDE Dev (Build 200905250201)
Java: 1.6.0_13; Java HotSpot(TM) Client VM 11.3-b02
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)

Reproduced - downloaded OS independent zip of "All" IDE, started with a clean userdir an opened an existing Java SE
project. Exception is thrown when "Activating Java SE".

I assume ERGONOMICS is involved. REGRESSION, used to work in Beta.

Caused by http://hg.netbeans.org/profiler-main/rev/e0534204438f ???
Comment 3 Jiri Sedlacek 2009-05-25 10:51:42 UTC
RC1 build (NetBeans IDE 6.7 RC1 (Build 200905232021)) is affected by this bug as well.
Comment 4 Jaroslav Tulach 2009-05-25 12:33:52 UTC
Created attachment 82730 [details]
I am not able to reproduce the problem, but this patch provides fallback which might help
Comment 5 swpalmer 2009-05-25 15:22:08 UTC
Build: NetBeans IDE Dev (Build 200905250201)
VM: Java HotSpot(TM) Client VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Windows XP, 5.1, x86

User Comments: 
Opened a JavaSE project on fist launch after install.  Using a fresh user dir (no settings copied from 6.5, previous dev dir removed when uninstalling the previous build)

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.profiler.actions.ProfilerToolbarDropdownAction.getToolbarPresenter(ProfilerToolbarDropdownAction.java:89)
        at org.openide.awt.Toolbar$Folder.createInstance(Toolbar.java:417)
        at org.openide.loaders.FolderInstance.defaultProcessObjectsFinal(FolderInstance.java:857)
        at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:722)
        at org.openide.util.Task.run(Task.java:249)
        at org.netbeans.modules.openide.loaders.AWTTask.run(AWTTask.java:70)
Comment 6 swpalmer 2009-05-25 15:22:31 UTC
Created attachment 82742 [details]
stacktrace
Comment 7 Filip Zamboj 2009-05-25 16:11:12 UTC
Build: NetBeans IDE Dev (Build 090525)
VM: Java HotSpot(TM) 64-Bit Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Linux, 2.6.28-11-generic, amd64

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.profiler.actions.ProfilerToolbarDropdownAction.getToolbarPresenter(ProfilerToolbarDropdownAction.java:89)
        at org.openide.awt.Toolbar$Folder.createInstance(Toolbar.java:417)
        at org.openide.loaders.FolderInstance.defaultProcessObjectsFinal(FolderInstance.java:857)
        at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:722)
        at org.openide.util.Task.run(Task.java:249)
        at org.netbeans.modules.openide.loaders.AWTTask.run(AWTTask.java:70)
Comment 8 Filip Zamboj 2009-05-25 16:11:22 UTC
Created attachment 82747 [details]
stacktrace
Comment 9 Jaroslav Tulach 2009-05-25 16:30:50 UTC
Who will test my patch[1] and verify that it fixes the problem?

[1] http://www.netbeans.org/nonav/issues/showattachment.cgi/82730/X.diff
Comment 10 Jiri Sedlacek 2009-05-25 17:06:31 UTC
I can't reproduce the problem using a trunk devbuild, I don't know how to activate the Ergonomics IDE. When I launch my
IDE, it immediately starts with populated toolbar and doesn't lazily enable Java SE when opening the project.

Note that you've removed the ERGONOMICS keyword but this bug only appears when the Java SE feature is being lazily
enabled when opening a Java SE project for the first time.

If the bug is not reproducible in your/latest devbuild, I think you should still find the cause and not just close the
issue as WORKSFORME - it could be just temporarily hidden by a race condition...

Regarding your patch - does it ensure that just one AttachAction instance will be created? Without knowing how that
layers/filesystems stuff works I'm afraid that the code creates one action instance and eventually the framework creates
second one when processing "Actions/Profile/org-netbeans-modules-profiler-actions-AttachAction.instance".
Comment 11 Jaroslav Tulach 2009-05-26 12:56:03 UTC
Created attachment 82794 [details]
An improved patch to guarantee that there is at most one AttachAction instance created
Comment 12 Jaroslav Tulach 2009-05-26 12:57:39 UTC
Anyone who can see the old, broken behaviour, please give my latest patch a try. I am not able to do anything 
otherwise, as I have not yet seen this failure myself.
Comment 13 Jiri Sedlacek 2009-05-26 14:58:53 UTC
Reopening, still happens in a devbuild. When a Java SE project is being opened shortly after the initial 'Scanning
projects' the 'FileUtil.getConfigFile("Actions/Profile/org-netbeans-modules-profiler-actions-AttachAction.instance")'
call returns 'null' in about 50% cases.
Comment 14 Jiri Sedlacek 2009-05-26 14:59:33 UTC
The patch doesn't work correctly, it causes another NPE:

java.lang.NullPointerException
	at org.openide.awt.Actions.cutAmpersand(Actions.java:355)
	at
org.netbeans.modules.profiler.actions.ProfilerToolbarDropdownAction.createDropdownItem(ProfilerToolbarDropdownAction.java:146)
	at
org.netbeans.modules.profiler.actions.ProfilerToolbarDropdownAction.getToolbarPresenter(ProfilerToolbarDropdownAction.java:99)
	at org.openide.awt.Toolbar$Folder.createInstance(Toolbar.java:417)
	at org.openide.loaders.FolderInstance.defaultProcessObjectsFinal(FolderInstance.java:857)
	at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:722)
	at org.openide.util.Task.run(Task.java:249)
	at org.netbeans.modules.openide.loaders.AWTTask.run(AWTTask.java:70)
[catch] at org.netbeans.modules.openide.loaders.AWTTask$Processor.run(AWTTask.java:111)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
	at java.awt.Dialog$1.run(Dialog.java:1051)
	at java.awt.Dialog$3.run(Dialog.java:1103)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Dialog.show(Dialog.java:1101)
	at java.awt.Component.show(Component.java:1516)
	at java.awt.Component.setVisible(Component.java:1468)
	at java.awt.Window.setVisible(Window.java:841)
	at java.awt.Dialog.setVisible(Dialog.java:991)
	at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:574)
	at org.netbeans.modules.project.ui.actions.OpenProject.actionPerformed(OpenProject.java:144)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
	at java.awt.Component.processMouseEvent(Component.java:6216)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
	at java.awt.Component.processEvent(Component.java:5981)
	at java.awt.Container.processEvent(Container.java:2041)
	at java.awt.Component.dispatchEventImpl(Component.java:4583)
	at java.awt.Container.dispatchEventImpl(Container.java:2099)
	at java.awt.Component.dispatchEvent(Component.java:4413)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
	at java.awt.Container.dispatchEventImpl(Container.java:2085)
	at java.awt.Window.dispatchEventImpl(Window.java:2475)
	at java.awt.Component.dispatchEvent(Component.java:4413)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Comment 15 Jiri Sedlacek 2009-05-26 15:54:02 UTC
I've modified the ProfilerToolbarDropdownAction.java to produce debug thread dumps and outputs to better debug what's
happening when the NPE is thrown.

In case when the NPE occurs the ProfilerToolbarDropdownAction.getToolbarPresenter() implementation (toolbarPresenter ==
null) is called twice, whereas for no exception this code is called just once. The modified
ProfilerToolbarDropdownAction.java and two IDE logs (successful + with NPE) are attached.
Comment 16 Jiri Sedlacek 2009-05-26 15:54:42 UTC
Created attachment 82810 [details]
ProfilerToolbarDropdownAction.java
Comment 17 Jiri Sedlacek 2009-05-26 15:55:19 UTC
Created attachment 82811 [details]
messages_OK.log
Comment 18 Jiri Sedlacek 2009-05-26 15:55:41 UTC
Created attachment 82812 [details]
messages_NPE.log
Comment 19 Jaroslav Tulach 2009-05-27 11:07:23 UTC
Created attachment 82848 [details]
NPE was caused by missing NAME attribute. Added. Please give the new patch a try. Thanks.
Comment 20 Marian Mirilovic 2009-05-27 12:40:43 UTC
Jardo/Jirka ... do you plan to fix that for 6.7 ?
Comment 21 Jaroslav Tulach 2009-05-27 13:00:56 UTC
I'd like to put a workaround that will prevent this NPE to release67 as soon as Jirka confirms that my patch 
eliminates the problem.
Comment 22 Jiri Sedlacek 2009-05-27 13:06:33 UTC
I can confirm that the patch workarounds the described problem. Jardo, please add the assert to not mask the real bug
and add "// NOI18N" comment to ProfilerToolbarDropdownAction.java:90 (after applying the patch).
Comment 23 Jaroslav Tulach 2009-05-27 14:44:04 UTC
ergonomics#a4024676ce56

I think this is candidate for backporting to release67 clone.
Comment 24 cbulcu 2009-05-27 15:47:27 UTC
Build: NetBeans IDE Dev (Build 200905270201)
VM: Java HotSpot(TM) Client VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03
OS: Windows Vista, 6.1, x86

User Comments: 
Opened the first project, after starting NB the very first time, after installation

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.profiler.actions.ProfilerToolbarDropdownAction.getToolbarPresenter(ProfilerToolbarDropdownAction.java:89)
        at org.openide.awt.Toolbar$Folder.createInstance(Toolbar.java:417)
        at org.openide.loaders.FolderInstance.defaultProcessObjectsFinal(FolderInstance.java:857)
        at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:722)
        at org.openide.util.Task.run(Task.java:249)
        at org.netbeans.modules.openide.loaders.AWTTask.run(AWTTask.java:70)
Comment 25 cbulcu 2009-05-27 15:47:31 UTC
Created attachment 82868 [details]
stacktrace
Comment 26 Marian Mirilovic 2009-05-27 16:55:07 UTC
Ok, so let's start with HR process.
Comment 27 Jaroslav Tulach 2009-05-28 09:27:21 UTC
a4024676ce56
Comment 28 Quality Engineering 2009-05-28 18:45:11 UTC
Integrated into 'main-golden', will be available in build *200905281401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a4024676ce56
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #165925: Workarounding the fact that sometimes an action defined in layer of its own module may not be visible while the module is being activated. Deserves more investigation and proper fix elsewhere, so I am leaving an assert there, which will make the code fail in development versions of the IDE
Comment 29 Vojtech Sigler 2009-05-29 15:07:44 UTC
Verified in RC1 (Build 200905282243)