From ce88f9c4c935a0054d252adc97795450f61ec5db Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Wed, 19 Jun 2024 17:18:02 +0200 Subject: [PATCH] refactoring Issue #340 --- .../openbpmn/glsp/validators/BPMNGLSPValidator.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/open-bpmn.glsp-server/src/main/java/org/openbpmn/glsp/validators/BPMNGLSPValidator.java b/open-bpmn.glsp-server/src/main/java/org/openbpmn/glsp/validators/BPMNGLSPValidator.java index b0a2f94c..60511487 100644 --- a/open-bpmn.glsp-server/src/main/java/org/openbpmn/glsp/validators/BPMNGLSPValidator.java +++ b/open-bpmn.glsp-server/src/main/java/org/openbpmn/glsp/validators/BPMNGLSPValidator.java @@ -26,6 +26,7 @@ import org.eclipse.glsp.server.features.validation.MarkersReason; import org.eclipse.glsp.server.features.validation.ModelValidator; import org.openbpmn.bpmn.elements.core.BPMNElementNode; +import org.openbpmn.bpmn.exceptions.BPMNModelException; import org.openbpmn.bpmn.validation.BPMNValidationHandler; import org.openbpmn.bpmn.validation.BPMNValidationMarker; import org.openbpmn.extensions.BPMNElementExtension; @@ -78,7 +79,12 @@ public class BPMNGLSPValidator implements ModelValidator { @Override public List validate(final List elements, final String reason) { long l = System.currentTimeMillis(); - beforeValidate(elements, reason); + try { + beforeValidate(elements, reason); + } catch (BPMNModelException e) { + logger.warning("Failed to validate model: " + e.getMessage()); + e.printStackTrace(); + } List markers = doValidate(elements, reason); afterValidate(elements, reason); return markers; @@ -93,8 +99,10 @@ public List validate(final List elements, final String re * validation mode (LIVE|BATCH). * * Finally it converts the Meta Model Error markers into GLSP marker objects. + * + * @throws BPMNModelException */ - public void beforeValidate(final List elements, final String reason) { + public void beforeValidate(final List elements, final String reason) throws BPMNModelException { if (MarkersReason.LIVE.equals(reason)) { // simple case we only call the validate method from the meta model.