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 251687

Summary: NPE when trying to Profile Class
Product: profiler Reporter: stwr
Component: BaseAssignee: Jiri Sedlacek <jis>
Status: RESOLVED FIXED    
Severity: normal CC: jskrivanek
Priority: P3    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Copy of messages.log

Description stwr 2015-04-07 08:29:47 UTC
Created attachment 153071 [details]
Copy of messages.log

Use Case:

1. Open a java file (e.g. MemoryLeakOrNot?|Example3)
2. In the 'Navigator' execute the action 'Profile Class' (e.g. Stack)
3. Select 'External process' when asked for project to profile
4. Confirm with 'OK'
5. Start profile by clicking on the 'Profile' button

In the result the Profiler is not started and following exception is thrown:

java.lang.NullPointerException
	at org.netbeans.modules.profiler.projectsupport.utilities.ProjectUtilities.getProjectName(ProjectUtilities.java:291)
	at org.netbeans.modules.profiler.projectsupport.utilities.ProjectUtilitiesProviderImpl.getDisplayName(ProjectUtilitiesProviderImpl.java:81)
	at org.netbeans.modules.profiler.api.ProjectUtilities.getDisplayName(ProjectUtilities.java:89)
	at org.netbeans.modules.profiler.nbimpl.actions.ProfilerLauncher$ProfilerSessionImpl.start(ProfilerLauncher.java:135)
	at org.netbeans.modules.profiler.v2.ProfilerSession.doStart(ProfilerSession.java:227)
	at org.netbeans.modules.profiler.v2.ProfilerWindow$15.run(ProfilerWindow.java:515)
	at org.netbeans.lib.profiler.ui.UIUtils.runInEventDispatchThread(UIUtils.java:651)
	at org.netbeans.modules.profiler.v2.ProfilerWindow.performDoStartImpl(ProfilerWindow.java:514)
	at org.netbeans.modules.profiler.v2.ProfilerWindow.performStartImpl(ProfilerWindow.java:509)
	at org.netbeans.modules.profiler.v2.ProfilerWindow.access$400(ProfilerWindow.java:147)
	at org.netbeans.modules.profiler.v2.ProfilerWindow$2.performAction(ProfilerWindow.java:239)
	at org.netbeans.modules.profiler.v2.ui.DropdownButton$Button.fireActionPerformed(DropdownButton.java:348)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
	at java.awt.Component.processMouseEvent(Component.java:6525)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3322)
	at java.awt.Component.processEvent(Component.java:6290)
	at java.awt.Container.processEvent(Container.java:2234)
	at org.netbeans.modules.profiler.v2.ui.DropdownButton$Button.processEventImpl(DropdownButton.java:357)
	at org.netbeans.modules.profiler.v2.ui.DropdownButton$Button.access$000(DropdownButton.java:325)
	at org.netbeans.modules.profiler.v2.ui.DropdownButton.processChildMouseEvent(DropdownButton.java:260)
	at org.netbeans.modules.profiler.v2.ui.DropdownButton.access$400(DropdownButton.java:73)
	at org.netbeans.modules.profiler.v2.ui.DropdownButton$Button.processEvent(DropdownButton.java:353)
	at java.awt.Component.dispatchEventImpl(Component.java:4881)
	at java.awt.Container.dispatchEventImpl(Container.java:2292)
	at java.awt.Component.dispatchEvent(Component.java:4703)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
	at java.awt.Container.dispatchEventImpl(Container.java:2278)
	at java.awt.Window.dispatchEventImpl(Window.java:2739)
	at java.awt.Component.dispatchEvent(Component.java:4703)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:751)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:702)
	at java.awt.EventQueue$3.run(EventQueue.java:696)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.awt.EventQueue$4.run(EventQueue.java:724)
	at java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:721)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Comment 1 stwr 2015-04-07 08:34:49 UTC
Product Version: NetBeans IDE Dev (Build 201504020001)
Java: 1.8.0_31; Java HotSpot(TM) 64-Bit Server VM 25.31-b07
Runtime: Java(TM) SE Runtime Environment 1.8.0_31-b13
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\cendrowiczm\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\cendrowiczm\AppData\Local\NetBeans\Cache\dev
Comment 2 Tomas Hurka 2015-04-07 11:11:38 UTC
Please attach sources of MemoryLeakOrNot project. Thanks.
Comment 3 stwr 2015-04-07 11:14:48 UTC
Here is the link: http://wiki.netbeans.org/wiki/images/b/bd/MemoryLeakOrNot%3F.zip
Comment 4 Tomas Hurka 2015-04-07 11:37:56 UTC
'External process' should not be in the list of the projects to profile.
Comment 5 Jiri Sedlacek 2015-04-16 10:50:02 UTC
Actually the External process should be available, but should open the profiling session in Attach mode.

Fixed by http://hg.netbeans.org/profiler-main/rev/e58e3c7ca6e6.
Comment 6 Quality Engineering 2015-04-20 11:57:19 UTC
Integrated into 'main-silver', will be available in build *201504201004* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e58e3c7ca6e6
User: Jiri Sedlacek <jis@netbeans.org>
Log: Bugfix #251687 - use Attach profiler when profiling External process