diff options
author | Robert Roth | 2015-05-03 09:30:01 +0000 |
---|---|---|
committer | Robert Roth | 2015-05-03 09:30:01 +0000 |
commit | 2c38ed75c178b8fdbc7aedb3d68bcf688f7ff299 (patch) | |
tree | 428fdeaba89652ea4832bae7af14bc0ef72e3484 | |
parent | 2d0883f282f893a2cea5aa9fdd9a24a2738e6660 (diff) | |
download | org.eclipse.e4.tools-2c38ed75c178b8fdbc7aedb3d68bcf688f7ff299.tar.gz org.eclipse.e4.tools-2c38ed75c178b8fdbc7aedb3d68bcf688f7ff299.tar.xz org.eclipse.e4.tools-2c38ed75c178b8fdbc7aedb3d68bcf688f7ff299.zip |
Bug 418457 - OrionEditorControl deliberately throws NPE
Use o.e.c.runtime.Assert on null dirtyListener instead of throwing NPE.
Change-Id: Ifdf24281dcca1ac6a77da5bdf8541c8f994f5f95
Signed-off-by: Robert Roth <robert.roth.off@gmail.com>
-rw-r--r-- | bundles/org.eclipse.e4.tools.orion.editor/src/org/eclipse/e4/tools/orion/editor/swt/OrionEditorControl.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/bundles/org.eclipse.e4.tools.orion.editor/src/org/eclipse/e4/tools/orion/editor/swt/OrionEditorControl.java b/bundles/org.eclipse.e4.tools.orion.editor/src/org/eclipse/e4/tools/orion/editor/swt/OrionEditorControl.java index dd0de770..79f773f6 100644 --- a/bundles/org.eclipse.e4.tools.orion.editor/src/org/eclipse/e4/tools/orion/editor/swt/OrionEditorControl.java +++ b/bundles/org.eclipse.e4.tools.orion.editor/src/org/eclipse/e4/tools/orion/editor/swt/OrionEditorControl.java @@ -7,10 +7,12 @@ * * Contributors: * Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation + * Robert Roth <robert.roth.off@gmail.com> - bug 418457 *******************************************************************************/ package org.eclipse.e4.tools.orion.editor.swt; import org.apache.commons.lang.StringEscapeUtils; +import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.ListenerList; import org.eclipse.e4.tools.orion.editor.builder.IHTMLBuilder; import org.eclipse.swt.browser.Browser; @@ -243,12 +245,10 @@ public class OrionEditorControl extends Composite { * Add dirty listener. * * @param listener - * dirty listener to add. + * dirty listener to add, must not be null */ public void addDirtyListener(IDirtyListener dirtyListener) { - if (dirtyListener == null) { - throw new NullPointerException("Cannot add a null dirty listener"); //$NON-NLS-1$ - } + Assert.isNotNull(dirtyListener, "Cannot add a null dirty listener"); //$NON-NLS-1$ if (dirtyListeners == null) { dirtyListeners = new ListenerList(ListenerList.IDENTITY); } @@ -260,13 +260,10 @@ public class OrionEditorControl extends Composite { * Remove dirty listener. * * @param listener - * dirty listener to remove. + * dirty listener to remove, must not be null */ public void removeDirtyListener(IDirtyListener dirtyListener) { - if (dirtyListener == null) { - throw new NullPointerException( - "Cannot remove a null dirty listener"); //$NON-NLS-1$ - } + Assert.isNotNull(dirtyListener, "Cannot remove a null dirty listener"); //$NON-NLS-1$ if (dirtyListeners != null) { dirtyListeners.remove(dirtyListener); |