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 248470 - NullPointerException at org.netbeans.modules.cnd.debugger.common2.debugger.EvaluationWindow.exprEval
Summary: NullPointerException at org.netbeans.modules.cnd.debugger.common2.debugger.Ev...
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Maria Tishkova
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2014-11-06 19:21 UTC by Exceptions Reporter
Modified: 2014-11-17 18:42 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 213232


Attachments
stacktrace (3.43 KB, text/plain)
2014-11-06 19:21 UTC, Exceptions Reporter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2014-11-06 19:21:54 UTC
This issue was reported manually by alexvsimon.
It already has 1 duplicates 


Build: NetBeans IDE 8.0.1 (Build 201408251540)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.0-b70, Java(TM) SE Runtime Environment, 1.8.0-b132
OS: Windows 7

User Comments:
GUEST: Some trouble during evaluate expressions
Please check




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.cnd.debugger.common2.debugger.EvaluationWindow.exprEval(EvaluationWindow.java:205)
   at org.netbeans.modules.cnd.debugger.common2.debugger.actions.EvaluateAction.performAction(EvaluateAction.java:84)
   at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:130)
   at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:95)
   at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
   at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
Comment 1 Exceptions Reporter 2014-11-06 19:21:56 UTC
Created attachment 150331 [details]
stacktrace
Comment 2 Maria Tishkova 2014-11-10 14:51:03 UTC
Evaluation:

looks like regression after fixing bz#245760

the code below doesn't look like correct one, as Expression Evaluation Window is not initialized yet


     3.1 --- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/actions/EvaluateAction.java
     3.2 +++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/actions/EvaluateAction.java
     3.3 @@ -52,7 +52,7 @@
     3.4  import org.netbeans.modules.cnd.debugger.common2.debugger.State;
     3.5  import org.netbeans.modules.cnd.debugger.common2.debugger.StateListener;
     3.6  import org.netbeans.modules.cnd.debugger.common2.debugger.EditorBridge;
     3.7 -import org.netbeans.modules.cnd.debugger.common2.debugger.assembly.FormatOption;
     3.8 +import org.netbeans.modules.cnd.debugger.common2.debugger.EvaluationWindow;
     3.9  
    3.10  /**
    3.11   * Action which "stepi" one assembly instruction
    3.12 @@ -80,10 +80,8 @@
    3.13  	if (debugger != null) {
    3.14              // 6574620
    3.15              String selectedStr = EditorBridge.getCurrentSelection();
    3.16 -            if (selectedStr == null)
    3.17 -                debugger.exprEval(FormatOption.EMPTY, ""); // NOI18N
    3.18 -            else
    3.19 -                debugger.exprEval(FormatOption.EMPTY, selectedStr);
    3.20 +            selectedStr = (selectedStr == null ? "" : selectedStr); // NOI18N
    3.21 +            EvaluationWindow.getDefault().exprEval(selectedStr);
    3.22  	}
    3.23  
    3.24      }
Comment 3 Maria Tishkova 2014-11-10 15:11:48 UTC
proposed fix:

 hg diff
diff --git a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/EvaluationWindow.java b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/EvaluationWindow.java
--- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/EvaluationWindow.java
+++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/EvaluationWindow.java
@@ -203,8 +203,9 @@
     public void exprEval(String expr) {
         this.expr = expr;
         format = (FormatOption)format_jcb.getSelectedItem();
-	if (expr != null && !expr.equals("") && format != null) {
-            debugger.exprEval(format, expr);
+	if (expr != null && !expr.equals("")) {
+            //see bz#248470
+            debugger.exprEval(format == null ? FormatOption.EMPTY : format, expr);
         }
     }
 
diff --git a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/actions/EvaluateAction.java b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/actions/EvaluateAction.java
--- a/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/actions/EvaluateAction.java
+++ b/cnd.debugger.common2/src/org/netbeans/modules/cnd/debugger/common2/debugger/actions/EvaluateAction.java
@@ -75,13 +75,20 @@
     } 
 
     // interface CallableSystemAction
+    @Override
     public void performAction() {
 	NativeDebugger debugger = NativeDebuggerManager.get().currentDebugger();
 	if (debugger != null) {
             // 6574620
             String selectedStr = EditorBridge.getCurrentSelection();
             selectedStr = (selectedStr == null ? "" : selectedStr); // NOI18N
-            EvaluationWindow.getDefault().exprEval(selectedStr);
+            //bz#248470
+            //we are in EDT thread already, no need to use SqingUtilitites
+            EvaluationWindow evalWindow = EvaluationWindow.getDefault();
+            evalWindow.open();
+            evalWindow.requestActive();
+            evalWindow.componentShowing();
+            evalWindow.evalResult(selectedStr);
 	}
 
     }
Comment 4 Maria Tishkova 2014-11-11 09:56:09 UTC
last line in proposed fix is incorrect, should be:
evalWindow.exprEval(selectedStr)
Comment 5 Maria Tishkova 2014-11-11 09:56:32 UTC
fixed in 

changeset:   280738:466da6d6b1f8
tag:         tip
user:        Maria Dalmatova <mromashova@netbeans.org>
date:        Tue Nov 11 12:54:42 2014 +0400
summary:     fixed bz#248470 NullPointerException at org.netbeans.modules.cnd.debugger.common2.debugger.EvaluationWindow.exprEval
Comment 6 Maria Tishkova 2014-11-11 11:21:56 UTC
regression of bz#245760
Comment 7 Quality Engineering 2014-11-12 03:58:22 UTC
Integrated into 'main-silver', will be available in build *201411120002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/466da6d6b1f8
User: Maria Dalmatova <mromashova@netbeans.org>
Log: fixed bz#248470 NullPointerException at org.netbeans.modules.cnd.debugger.common2.debugger.EvaluationWindow.exprEval
Comment 8 Quality Engineering 2014-11-13 03:50:02 UTC
Integrated into 'main-silver', will be available in build *201411130002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/466da6d6b1f8
User: Maria Dalmatova <mromashova@netbeans.org>
Log: fixed bz#248470 NullPointerException at org.netbeans.modules.cnd.debugger.common2.debugger.EvaluationWindow.exprEval
Comment 9 Quality Engineering 2014-11-14 03:57:54 UTC
Integrated into 'main-silver', will be available in build *201411140002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/466da6d6b1f8
User: Maria Dalmatova <mromashova@netbeans.org>
Log: fixed bz#248470 NullPointerException at org.netbeans.modules.cnd.debugger.common2.debugger.EvaluationWindow.exprEval