diff options
author | Lev Ufimtsev | 2016-08-09 15:46:54 +0000 |
---|---|---|
committer | Eric Williams | 2016-08-18 14:47:15 +0000 |
commit | d5aaf6787e634fc7205b27242335ef52d1b330a1 (patch) | |
tree | 7ffd58b64611daa59f1d5471f6eb6a27a30ee521 /bundles/org.eclipse.swt/Eclipse SWT Accessibility | |
parent | b93e22eaa415d810accb98ae8124423fc8b07202 (diff) | |
download | eclipse.platform.swt-d5aaf6787e634fc7205b27242335ef52d1b330a1.tar.gz eclipse.platform.swt-d5aaf6787e634fc7205b27242335ef52d1b330a1.tar.xz eclipse.platform.swt-d5aaf6787e634fc7205b27242335ef52d1b330a1.zip |
Bug 312451: Accessible.addRelations should check if target == null
Adding null checks around public api that will throw an error
if given a null object. This should at least tell us why null
objects are created in the first place.
Note, this is a slight api change, the public api now throws an
exception.
Change-Id: I4f526ce1af208cecc2c9f34adb69105d5dcb8503
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=312451
Signed-off-by: Lev Ufimtsev <lufimtse@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Accessibility')
3 files changed, 13 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java index 1e064353d0..3327c593be 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/cocoa/org/eclipse/swt/accessibility/Accessible.java @@ -455,11 +455,13 @@ public class Accessible { * * @param type an <code>ACC</code> constant beginning with RELATION_* indicating the type of relation * @param target the accessible that is the target for this relation + * @exception IllegalArgumentException ERROR_NULL_ARGUMENT - if the Accessible target is null * * @since 3.6 */ public void addRelation(int type, Accessible target) { checkWidget(); + if (target == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (relations[type] == null) { relations[type] = new Relation(this, type); } @@ -3080,11 +3082,13 @@ public class Accessible { * * @param type an <code>ACC</code> constant beginning with RELATION_* indicating the type of relation * @param target the accessible that is the target for this relation - * + * @exception IllegalArgumentException ERROR_NULL_ARGUMENT - if the Accessible target is null + * * @since 3.6 */ public void removeRelation(int type, Accessible target) { checkWidget(); + if (target == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (relations[type] != null) { relations[type].removeTarget(target); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java index 018fd36a5d..af6b3c5511 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/Accessible.java @@ -412,10 +412,12 @@ public class Accessible { * @param type an <code>ACC</code> constant beginning with RELATION_* indicating the type of relation * @param target the accessible that is the target for this relation * + * @exception IllegalArgumentException ERROR_NULL_ARGUMENT - if the Accessible target is null * @since 3.6 */ public void addRelation(int type, Accessible target) { checkWidget(); + if (target == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (relations == null) relations = new ArrayList<>(); Relation relation = new Relation(type, target); if (relations.indexOf(relation) != -1) return; @@ -867,12 +869,13 @@ public class Accessible { * * @param type an <code>ACC</code> constant beginning with RELATION_* indicating the type of relation * @param target the accessible that is the target for this relation - * + * @exception IllegalArgumentException ERROR_NULL_ARGUMENT - if the Accessible target is null * @since 3.6 */ public void removeRelation(int type, Accessible target) { checkWidget(); if (relations == null) return; + if (target == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); Relation relation = new Relation(type, target); int index = relations.indexOf(relation); if (index == -1) return; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java index 3e5d0524f9..1dc16d6e18 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java @@ -1039,11 +1039,12 @@ public class Accessible { * * @param type an <code>ACC</code> constant beginning with RELATION_* indicating the type of relation * @param target the accessible that is the target for this relation - * + * @exception IllegalArgumentException ERROR_NULL_ARGUMENT - if the Accessible target is null * @since 3.6 */ public void addRelation(int type, Accessible target) { checkWidget(); + if (target == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (relations[type] == null) { relations[type] = new Relation(this, type); } @@ -1447,11 +1448,12 @@ public class Accessible { * * @param type an <code>ACC</code> constant beginning with RELATION_* indicating the type of relation * @param target the accessible that is the target for this relation - * + * @exception IllegalArgumentException ERROR_NULL_ARGUMENT - if the Accessible target is null * @since 3.6 */ public void removeRelation(int type, Accessible target) { checkWidget(); + if (target == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); Relation relation = relations[type]; if (relation != null) { relation.removeTarget(target); |