diff options
author | jeremie.tatibouet | 2019-12-10 17:12:11 +0000 |
---|---|---|
committer | vincent lorenzo | 2019-12-12 16:01:28 +0000 |
commit | 980a3ae4d8a141ea89e75cf92183df3afbdd3e5a (patch) | |
tree | 0d3a9e0b1208fcbce525f008dd061a611f22db8f | |
parent | b14f42c5eab9a1fbea907d41a52e0959f46a87da (diff) | |
download | org.eclipse.papyrus-980a3ae4d8a141ea89e75cf92183df3afbdd3e5a.tar.gz org.eclipse.papyrus-980a3ae4d8a141ea89e75cf92183df3afbdd3e5a.tar.xz org.eclipse.papyrus-980a3ae4d8a141ea89e75cf92183df3afbdd3e5a.zip |
Bug 553875 - Handle exceptions that may be raised in validation hooks.
Change-Id: Id03184a8d4560116139ee37acf24999852e6ed19
Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
3 files changed, 23 insertions, 13 deletions
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF index 74b256ea0aa..cd6a4f1722e 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/META-INF/MANIFEST.MF @@ -12,7 +12,7 @@ Require-Bundle: org.eclipse.gmf.runtime.emf.commands.core;bundle-version="[1.7.0 org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)" Bundle-Vendor: %pluginProvider Bundle-ActivationPolicy: lazy -Bundle-Version: 3.1.0.qualifier +Bundle-Version: 3.1.100.qualifier Bundle-Localization: plugin Bundle-Name: %pluginName Bundle-Activator: org.eclipse.papyrus.infra.services.validation.Activator diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/pom.xml b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/pom.xml index d572b92e704..f1e2a6b9eff 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/pom.xml +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/pom.xml @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<project> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>org.eclipse.papyrus.infra-services</artifactId> @@ -7,6 +9,6 @@ <version>0.0.1-SNAPSHOT</version> </parent> <artifactId>org.eclipse.papyrus.infra.services.validation</artifactId> - <version>3.1.0-SNAPSHOT</version> + <version>3.1.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/internal/ValidationRegistry.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/internal/ValidationRegistry.java index bbc845ca78a..1ffa038e1fd 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/internal/ValidationRegistry.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/src/org/eclipse/papyrus/infra/services/validation/internal/ValidationRegistry.java @@ -1,6 +1,6 @@ /***************************************************************************** - * Copyright (c) 2016, 2017 CEA LIST, Christian W. Damus, and others. - * + * Copyright (c) 2016, 2017, 2019 CEA LIST, Christian W. Damus, and others. + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -11,7 +11,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus - bug 514955 - * + * Jeremie Tatibouet (CEA LIST) jeremie.tatibouet@cea.fr - Bug 553875 *****************************************************************************/ package org.eclipse.papyrus.infra.services.validation.internal; @@ -61,7 +61,7 @@ public class ValidationRegistry { /** * Return a diagnostician for an element of a model. - * + * * @param element * an element of a model (that must be contained in an eResource) * @return @@ -91,10 +91,10 @@ public class ValidationRegistry { /** * Sort an array of extension configuration elements by priority, from highest to lowest. - * + * * @param configElements * an array of configuration elements - * + * * @return the sorted array */ private static IConfigurationElement[] sort(IConfigurationElement[] configElements) { @@ -139,7 +139,7 @@ public class ValidationRegistry { /** * Obtain a diagnostician for a given language - * + * * @param languageID * the id of the language for which we want to obtain the diagnostician * @return the associated diagnostician @@ -165,7 +165,7 @@ public class ValidationRegistry { /** * Execute validation hooks - * + * * @param element * An element of the model we want to validate * @param hookType @@ -184,9 +184,17 @@ public class ValidationRegistry { if (hookObj instanceof IValidationHook) { IValidationHook validationHook = (IValidationHook) hookObj; if (hookType == HookType.BEFORE) { - validationHook.beforeValidation(element); + try { + validationHook.beforeValidation(element); + } catch (Exception exception) { + Activator.log.error("Before | validation hook for" + configElement.getAttribute(VALIDATION_HOOK) + "execution failed", exception); //$NON-NLS-1$ //$NON-NLS-2$ + } } else if (hookType == HookType.AFTER) { - validationHook.afterValidation(element); + try { + validationHook.afterValidation(element); + } catch (Exception exception) { + Activator.log.error("After | validation hook for" + configElement.getAttribute(VALIDATION_HOOK) + "execution failed", exception); //$NON-NLS-1$ //$NON-NLS-2$ + } } } } |