[hg] main-silver: #223971: Prevent from NPE.

  • From:
  • To:
  • Subject: [hg] main-silver: #223971: Prevent from NPE.
  • Date: Tue, 18 Dec 2012 10:38:45 -0800

changeset 1f6f5a1d616b in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/1f6f5a1d616b
description:
        #223971: Prevent from NPE.

diffstat:

 
debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/VisualDebuggerListener.java
 |  12 ++++++---
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (34 lines):

diff --git 
a/debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/VisualDebuggerListener.java
 
b/debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/VisualDebuggerListener.java
--- 
a/debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/VisualDebuggerListener.java
+++ 
b/debugger.jpda.visual/src/org/netbeans/modules/debugger/jpda/visual/VisualDebuggerListener.java
@@ -157,6 +157,9 @@
     public void engineAdded(DebuggerEngine engine) {
         // Create a BP in AWT and when hit, inject the remote service.
         final JPDADebugger debugger = engine.lookupFirst(null, 
JPDADebugger.class);
+        if (debugger == null) {
+            return ;
+        }
         boolean uploadAgent = properties.getBoolean(PROPERTIES_UPLOAD_AGENT, 
true);
         logger.log(Level.FINE, "engineAdded({0}), debugger = {1}, 
uploadAgent = {2}", new Object[]{engine, debugger, uploadAgent});
         Collection<Breakpoint> helperComponentBreakpoints = new 
ArrayList<Breakpoint>();
@@ -348,15 +351,16 @@
     public void engineRemoved(DebuggerEngine engine) {
         ScreenshotComponent.closeScreenshots(engine);
         JPDADebugger debugger = engine.lookupFirst(null, JPDADebugger.class);
-        logger.fine("engineRemoved("+engine+"), debugger = "+debugger);
-        if (debugger != null) {
+        if (debugger == null) {
+            return ;
+        }
+        logger.log(Level.FINE, "engineRemoved({0}), debugger = {1}", new 
Object[]{engine, debugger});
             stopDebuggerRemoteService(debugger);
-        }
         Collection<Breakpoint> helperComponentBreakpoints;
         synchronized (helperComponentBreakpointsMap) {
             helperComponentBreakpoints = 
helperComponentBreakpointsMap.remove(engine);
         }
-        if (!helperComponentBreakpoints.isEmpty()) {
+        if (helperComponentBreakpoints != null && 
!helperComponentBreakpoints.isEmpty()) {
             Iterator<Breakpoint> it = helperComponentBreakpoints.iterator();
             while (it.hasNext()) {
                 
DebuggerManager.getDebuggerManager().removeBreakpoint(it.next());

[hg] main-silver: #223971: Prevent from NPE.

mentlicher 12/18/2012

Project Features

About this Project

Debugger was started in November 2009, is owned by tpavek, and has 29 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close