diff options
author | René Purrio | 2018-01-11 10:51:04 +0000 |
---|---|---|
committer | René Purrio | 2018-01-11 14:16:23 +0000 |
commit | 14a9b4fda0b8c0d18e5e46321d9a6a16a5f7fd88 (patch) | |
tree | 68bf86b4189837dfd0c6d7b45deb955311b33e5f | |
parent | d0fb3a96ae33b9372f3d99106d39bba944f94139 (diff) | |
download | eclipse.platform.debug-14a9b4fda0b8c0d18e5e46321d9a6a16a5f7fd88.tar.gz eclipse.platform.debug-14a9b4fda0b8c0d18e5e46321d9a6a16a5f7fd88.tar.xz eclipse.platform.debug-14a9b4fda0b8c0d18e5e46321d9a6a16a5f7fd88.zip |
Bug 529635 - [sonar] Resolve "Possible null pointer dereference"I20180114-2000I20180113-1500I20180112-2000
Change-Id: I2d445f9e52fa07ade342c7252ff5154737cedd48
Signed-off-by: René Purrio <rpurrio@itemis.de>
4 files changed, 14 insertions, 15 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java index f7078181f..1d66666bc 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java @@ -1043,7 +1043,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe } }; File[] configFiles = directory.listFiles(configFilter); - if (configFiles.length > 0) { + if (configFiles != null && configFiles.length > 0) { LaunchConfiguration config = null; for (int i = 0; i < configFiles.length; i++) { config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(configFiles[i].getName()), null, false); @@ -1057,7 +1057,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe } }; File[] prototypeFiles = directory.listFiles(prototypeFilter); - if (prototypeFiles.length > 0) { + if (prototypeFiles != null && prototypeFiles.length > 0) { LaunchConfiguration config = null; for (int i = 0; i < prototypeFiles.length; i++) { config = new LaunchConfiguration(LaunchConfiguration.getSimpleName(prototypeFiles[i].getName()), null, true); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ExportBreakpoints.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ExportBreakpoints.java index f3d9f9cf3..3ac125d30 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ExportBreakpoints.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ExportBreakpoints.java @@ -15,26 +15,24 @@ import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.actions.AbstractDebugActionDelegate; -import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Event; -import org.eclipse.ui.IViewPart; /** * <p> - * This class provides the aciton event for both the context menu in breakpoints view - * and the drop down menu inn the breakpoints view. + * This class provides the action event for both the context menu in breakpoints + * view and the drop down menu in the breakpoints view. * </p> * <p> - * The action simply calls the wizard to export breakpoints. - * </p> - * @see WizardExportBreakpoints - * @see WizardExportBreakpointsPage + * The action simply calls the wizard to export breakpoints. + * </p> + * + * @see WizardExportBreakpoints + * @see WizardExportBreakpointsPage * - * @since 3.2 + * @since 3.2 */ public class ExportBreakpoints extends AbstractDebugActionDelegate { @@ -45,9 +43,8 @@ public class ExportBreakpoints extends AbstractDebugActionDelegate { */ @Override public void run(IAction action) { - IViewPart fViewpart = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage().findView(IDebugUIConstants.ID_BREAKPOINT_VIEW); WizardExportBreakpoints wiz = new WizardExportBreakpoints(); - wiz.init(DebugUIPlugin.getDefault().getWorkbench(), (IStructuredSelection)fViewpart.getViewSite().getSelectionProvider().getSelection()); + wiz.init(DebugUIPlugin.getDefault().getWorkbench(), getSelection()); WizardDialog wizdialog = new WizardDialog(DebugUIPlugin.getShell(), wiz); wizdialog.setBlockOnOpen(true); wizdialog.open(); @@ -58,6 +55,7 @@ public class ExportBreakpoints extends AbstractDebugActionDelegate { */ @Override protected void update(IAction action, ISelection s) { + super.update(action, s); getAction().setEnabled(DebugPlugin.getDefault().getBreakpointManager().hasBreakpoints()); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ImportBreakpoints.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ImportBreakpoints.java index a2e1c0e9d..96448679b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ImportBreakpoints.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/importexport/breakpoints/ImportBreakpoints.java @@ -58,6 +58,7 @@ public class ImportBreakpoints extends AbstractDebugActionDelegate { */ @Override protected void update(IAction action, ISelection s) { + super.update(action, s); getAction().setEnabled(true); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java index 5d4f44c5f..2ba16a0ce 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/ViewContextService.java @@ -524,7 +524,7 @@ public class ViewContextService implements IDebugContextListener, IPerspectiveLi // Don't bring a minimized or fast view to front IViewReference partRef = page.findViewReference(viewId); - if (partRef.isFastView() || IWorkbenchPage.STATE_MINIMIZED == page.getPartState(partRef)) { + if (partRef != null && (partRef.isFastView() || IWorkbenchPage.STATE_MINIMIZED == page.getPartState(partRef))) { return; } |