From e401fc38d146fcc30ae1044667699668c4173936 Mon Sep 17 00:00:00 2001 From: Florian Hoelzl <hoelzl@fortiss.org> Date: Mon, 4 Jul 2011 13:19:51 +0000 Subject: [PATCH] bugfix: constraint service interface was too specific, implementation produced NPE --- .../tooling/kernel/internal/ConstraintService.java | 8 ++++++-- .../tooling/kernel/services/IConstraintService.java | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ConstraintService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ConstraintService.java index 0ff0b0020..445bd7b61 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ConstraintService.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/ConstraintService.java @@ -77,8 +77,12 @@ public class ConstraintService extends */ private void performConstraintCheck(EObject modelElement, List<IConstraintViolation<EObject>> violationList) { - for (IConstraintChecker<EObject> checker : getRegisteredHandlers(modelElement - .getClass())) { + List<IConstraintChecker<EObject>> handlers = getRegisteredHandlers(modelElement + .getClass()); + if (handlers == null) { + return; + } + for (IConstraintChecker<EObject> checker : handlers) { if (checker.isApplicable(modelElement)) { IConstraintViolation<EObject> violation = checker .apply(modelElement); diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/IConstraintService.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/IConstraintService.java index 386962513..ecfe03cd6 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/IConstraintService.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/services/IConstraintService.java @@ -43,8 +43,8 @@ public interface IConstraintService { * its content and returns the check results. Note, that this method can be * time-consuming for large model element trees. */ - <T extends EObject> List<IConstraintViolation<T>> performAllConstraintChecksRecursively( - T modelElement); + List<IConstraintViolation<EObject>> performAllConstraintChecksRecursively( + EObject modelElement); /** * Performs all constraint checks only on the given model element and -- GitLab