From fa33025dc589a47d09e5fb52c1d4901577414cba Mon Sep 17 00:00:00 2001 From: Andy Huynh Date: Thu, 24 Oct 2024 11:27:58 +0200 Subject: [PATCH] fix: message to be validated is logged --- .../validation/xml/DomXmlMessageValidator.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/validation/citrus-validation-xml/src/main/java/org/citrusframework/validation/xml/DomXmlMessageValidator.java b/validation/citrus-validation-xml/src/main/java/org/citrusframework/validation/xml/DomXmlMessageValidator.java index ef4b93c803..8609a53463 100644 --- a/validation/citrus-validation-xml/src/main/java/org/citrusframework/validation/xml/DomXmlMessageValidator.java +++ b/validation/citrus-validation-xml/src/main/java/org/citrusframework/validation/xml/DomXmlMessageValidator.java @@ -49,6 +49,7 @@ import java.util.Map.Entry; import static org.citrusframework.util.StringUtils.hasText; +import static org.citrusframework.util.XMLUtils.prettyPrint; /** * Default message validator implementation. Working on XML messages @@ -77,8 +78,7 @@ public DomXmlMessageValidator(XmlSchemaValidation schemaValidator) { @Override public void validateMessage(Message receivedMessage, Message controlMessage, TestContext context, XmlMessageValidationContext validationContext) throws ValidationException { - logger.debug("Start XML message validation ..."); - + logger.debug("Start XML message validation: {}", prettyPrint(receivedMessage.getPayload(String.class))); try { if (validationContext.isSchemaValidationEnabled()) { schemaValidator.validate(receivedMessage, context, validationContext); @@ -103,9 +103,6 @@ public void validateMessage(Message receivedMessage, Message controlMessage, logger.debug("XML message validation successful: All values OK"); } catch (ClassCastException | DOMException | LSException e) { throw new CitrusRuntimeException(e); - } catch (ValidationException ex) { - logger.error("Failed to validate:\n{}", XMLUtils.prettyPrint(receivedMessage.getPayload(String.class))); - throw ex; } }