From 233c76b7363d331d712c01ab07683fddd43f92c1 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Thu, 20 May 2010 21:57:16 +0000 Subject: [PATCH] Bug 313821: Intermittent NPE during shutdown, in source-not-found handling --- .../core/sourcelookup/CSourceNotFoundElement.java | 3 +++ .../core/sourcelookup/ICSourceNotFoundDescription.java | 9 ++++----- .../ui/sourcelookup/CSourceNotFoundEditorInput.java | 8 ++++++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceNotFoundElement.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceNotFoundElement.java index 8134264cb0a..b21fcec0dcd 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceNotFoundElement.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceNotFoundElement.java @@ -46,6 +46,9 @@ public class CSourceNotFoundElement { return file; } + /** + * @return a description string or null if not available + */ public String getDescription() { ICSourceNotFoundDescription description = (ICSourceNotFoundDescription) element.getAdapter(ICSourceNotFoundDescription.class); if (description != null) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/ICSourceNotFoundDescription.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/ICSourceNotFoundDescription.java index d5a49fea2c5..090e4fb8512 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/ICSourceNotFoundDescription.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/ICSourceNotFoundDescription.java @@ -20,12 +20,11 @@ package org.eclipse.cdt.debug.internal.core.sourcelookup; public interface ICSourceNotFoundDescription { /** - * Returns a description of the debug element suitable for - * use by the CSourceNotFoundEditor. This description is then - * used by the editor to inform the user when describing what - * it can't locate source for. + * Returns a description of the debug element suitable for use by the + * CSourceNotFoundEditor. This description is then used by the editor to + * inform the user when describing what it can't locate source for. * - * @return the description of the debug element. + * @return the description of the debug element, or null if not available */ String getDescription(); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CSourceNotFoundEditorInput.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CSourceNotFoundEditorInput.java index de556ccb452..b2f5777aff3 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CSourceNotFoundEditorInput.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/sourcelookup/CSourceNotFoundEditorInput.java @@ -22,8 +22,12 @@ public class CSourceNotFoundEditorInput extends CommonSourceNotFoundEditorInput @Override public String getName() { - if (getArtifact() instanceof CSourceNotFoundElement) - return ((CSourceNotFoundElement)getArtifact()).getDescription(); + if (getArtifact() instanceof CSourceNotFoundElement) { + String description = ((CSourceNotFoundElement)getArtifact()).getDescription(); + if (description != null) { + return description; + } + } return super.getName(); }