From d583e48870a94089c2eb77b649dce31942386ebe Mon Sep 17 00:00:00 2001 From: matthiasgeiger Date: Thu, 31 Mar 2016 14:37:17 +0200 Subject: [PATCH] improve logging --- .../de/uniba/dsg/bpmnspector/BPMNspector.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/uniba/dsg/bpmnspector/BPMNspector.java b/src/main/java/de/uniba/dsg/bpmnspector/BPMNspector.java index d9aeb98..a7e5dae 100644 --- a/src/main/java/de/uniba/dsg/bpmnspector/BPMNspector.java +++ b/src/main/java/de/uniba/dsg/bpmnspector/BPMNspector.java @@ -9,6 +9,8 @@ import de.uniba.dsg.bpmnspector.common.util.FileUtils; import de.uniba.dsg.bpmnspector.refcheck.BPMNReferenceValidator; import de.uniba.dsg.bpmnspector.schematron.SchematronBPMNValidator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.InputStream; import java.nio.file.Path; @@ -22,6 +24,8 @@ */ public class BPMNspector implements Validator { + private static final Logger LOGGER = LoggerFactory.getLogger(BPMNspector.class.getSimpleName()); + private final SchematronBPMNValidator extValidator; private final BPMNReferenceValidator refValidator; private final ProcessImporter bpmnImporter; @@ -53,7 +57,9 @@ public ValidationResult inspectFile(Path file, List validation BPMNProcess process = bpmnImporter .importProcessFromPath(file, result); - if(process!=null) { + if(process==null) { + LOGGER.info("Process could not parsed correctly. Further processing is skipped."); + } else { if (validationOptions.contains(ValidationOption.REF)) { refValidator.validate(process, result); } @@ -62,6 +68,9 @@ public ValidationResult inspectFile(Path file, List validation } } + String resultString = result.isValid() ? "valid" : "invalid"; + LOGGER.info("Overall result for '{}': {}", file.getFileName().toString(), resultString); + return result; } @@ -81,11 +90,14 @@ public ValidationResult validate(InputStream source, String resourceName) throws BPMNProcess process = bpmnImporter.importProcessFromStreamSource(source, resourceName, result); - if(process!=null) { + if(process==null) { + LOGGER.info("Process could not parsed correctly. Further processing is skipped."); + } else { refValidator.validate(process, result); extValidator.validate(process, result); } - + String resultString = result.isValid() ? "valid" : "invalid"; + LOGGER.info("Overall result for '{}': {}", resourceName, resultString); return result; } }