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 177087 - NullPointerException at org.netbeans.modules.cnd.gizmo.options.GizmoOptionsImpl.getConfigurationByDisplayName
Summary: NullPointerException at org.netbeans.modules.cnd.gizmo.options.GizmoOptionsIm...
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Profile (show other bugs)
Version: 6.x
Hardware: All All
: P1 normal (vote)
Assignee: Thomas Preisler
URL:
Keywords:
: 177159 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-11-18 07:10 UTC by soldatov
Modified: 2009-11-25 05:24 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 162406


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2009-11-18 07:10:02 UTC
Sun Studio on NetBeans 6.8 (PIB)
Scenario:
- Push Debug->Debug Executable... menu item
==> some window appeared
- Press OK button
==> NPE
Comment 1 soldatov 2009-11-18 07:13:30 UTC
java.lang.NullPointerException
        at org.netbeans.modules.cnd.gizmo.options.GizmoOptionsImpl.getConfigurationByDisplayName(GizmoOptionsImpl.java:121)
        at org.netbeans.modules.cnd.gizmo.options.GizmoOptionsImpl.assign(GizmoOptionsImpl.java:326)
        at org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration.assign(MakeConfiguration.java:421)
        at org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration.copy(MakeConfiguration.java:438)
        at com.sun.tools.debugger.dbxgui.debugger.debugtarget.DebugTarget.cloneRecord(DebugTarget.java:259)
        at com.sun.tools.debugger.dbxgui.debugger.debugtarget.DebugTargetPanel.(DebugTargetPanel.java:143)
        at com.sun.tools.debugger.dbxgui.debugger.debugtarget.DebugTargetChooser.(DebugTargetChooser.java:45)
        at com.sun.tools.debugger.dbxgui.debugger.actions.DebugExecutableNodeAction.perform(DebugExecutableNodeAction.java:131)
        at com.sun.tools.debugger.dbxgui.debugger.actions.DebugExecutableNodeAction.performAction(DebugExecutableNodeAction.java:73)
        at org.openide.util.actions.NodeAction.performAction(NodeAction.java:296)
        at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:127)
        at org.netbeans.modules.openide.util.ActionsBridge.implPerformAction(ActionsBridge.java:83)
        at org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:64)
        at
Comment 2 soldatov 2009-11-18 07:19:16 UTC
P1 because this bug should be evaluated on this week. If NPE should be fixed in NetBeans 6.8, then it is showstopper.
Comment 3 Thomas Preisler 2009-11-18 11:13:19 UTC
bug confirmed. dbxgui is making a copy of the configuration and it is causing the exception. Don't quite understand yet why it doesn't happen is you use the Duplicate action in the configuration manager dialog (it is going through the same code), but it doesn't.
Comment 4 Thomas Preisler 2009-11-18 11:54:15 UTC
dbxgui also creates a makeconfiguration from scratch. These two lines reproduces the exception:

        MakeConfiguration configuration = new MakeConfiguration("/tmp", "Default", MakeConfiguration.TYPE_MAKEFILE);
        MakeConfiguration configuration2 = (MakeConfiguration)configuration.copy();
Comment 5 Thomas Preisler 2009-11-18 13:07:02 UTC
Fixed:
dhcp-umpk16-82-219[581] hg export 7baf2531fded
# HG changeset patch
# User Thomas Preisler <thp@netbeans.org>
# Date 1258574420 28800
# Node ID 7baf2531fdedd2ea122aea24ce86205b55e9969e
# Parent  e0f7f65769985b79ae4e624746e6a34f5b5bc28f
#177087 - NullPointerException at org.netbeans.modules.cnd.gizmo.options.GizmoOptionsImpl.getConfigurationByDisplayName

diff -r e0f7f6576998 -r 7baf2531fded cnd.gizmo/src/org/netbeans/modules/cnd/gizmo/options/GizmoOptionsImpl.java
--- a/cnd.gizmo/src/org/netbeans/modules/cnd/gizmo/options/GizmoOptionsImpl.java	Wed Nov 18 21:15:07 2009 +0300
+++ b/cnd.gizmo/src/org/netbeans/modules/cnd/gizmo/options/GizmoOptionsImpl.java	Wed Nov 18 12:00:20 2009 -0800
@@ -118,6 +118,9 @@ public class GizmoOptionsImpl implements
     }
 
     public DLightConfiguration getConfigurationByDisplayName(List<DLightConfiguration> list, String displayName) {
+        if (list == null) {
+            return null;
+        }
         for (DLightConfiguration dlightConf : list) {
             if (dlightConf.getDisplayedName().equals(displayName)) {
                 return dlightConf;
@@ -323,9 +326,11 @@ public class GizmoOptionsImpl implements
         setMakeConfiguration(gizmoOptions.getMakeConfiguration());
         preferredConfigurationName = null;
         List<DLightConfiguration> list = getValidConfigurations();
-        DLightConfiguration conf = getConfigurationByDisplayName(list, getDlightConfigurationName().getValue());
-        if (conf != null) {
-            preferredConfigurationName = conf.getConfigurationName();
+        if (list != null) {
+            DLightConfiguration conf = getConfigurationByDisplayName(list, getDlightConfigurationName().getValue());
+            if (conf != null) {
+                preferredConfigurationName = conf.getConfigurationName();
+            }
         }
     }


It is a showstopper because Sun Studio debugger (dbxgui) feature Debug->Debug Executable... wouldn't work without this fix.

The fix is very low risk. Basically just checking for null.

Fix can only be verified in SS context. Try SS IDE installed in /net/danmark.sfbay.sun.com/home/thp/aten/opt or use /net/danmark.sfbay.sun.com/home/thp/aten/ss12.2.tar
Comment 6 Thomas Preisler 2009-11-18 13:17:07 UTC
Alexander S.,
Do you mind peer review this fix? The problem was the way dbxgui created and used a configuration. It creates it's own configuration from scratch and did a copy on it before it was initialized with the configuration. I added two null checks . It's safe and correct. The configuration will correctly be initialized later before it is being used.

Alexander P./Valeriy,
The bug can only be verified in SS context. Please try SS IDE installed in
/net/danmark.sfbay.sun.com/home/thp/aten/opt
or use
/net/danmark.sfbay.sun.com/home/thp/aten/ss12.2.tar

Are there anything else I need to do to make sure the fix goes into main?
Comment 7 Alexander Simon 2009-11-18 13:33:55 UTC
I reviewed fix. It is right and fixes NPE.
Comment 8 Thomas Preisler 2009-11-18 22:47:03 UTC
*** Bug 177159 has been marked as a duplicate of this bug. ***
Comment 9 soldatov 2009-11-19 02:21:20 UTC
described scenario is fixed
Comment 10 Quality Engineering 2009-11-19 03:30:37 UTC
Integrated into 'main-golden', will be available in build *200911190201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/7baf2531fded
User: Thomas Preisler <thp@netbeans.org>
Log: #177087 - NullPointerException at org.netbeans.modules.cnd.gizmo.options.GizmoOptionsImpl.getConfigurationByDisplayName
Comment 11 ivan 2009-11-20 17:23:12 UTC
Another scenario where I've seen this fail is as follows:

StepInto some project
StepInto the same project again in order to start a second session.
Comment 12 Alexander Pepin 2009-11-25 05:24:48 UTC
Verified in SSIDE PIB (091125)