V3.4 bugfix for 846
This is a fix for the following issue https://github.com/citrusframework/citrus/issues/846
@chokdee Thank you for the PR!
I think your fix resolves the situation only for Http based communication. IMO the problem is more in the receive action in general. The message content gets logged in the message validator implementations before validation takes place. For example here:
https://github.com/citrusframework/citrus/blob/main/validation/citrus-validation-text/src/main/java/com/consol/citrus/validation/text/PlainTextMessageValidator.java#L61
But things like variable extraction takes place before that message validation in the receive action. So the proper fix would be to log the received message content right after it has been received in received action like here:
https://github.com/citrusframework/citrus/blob/main/core/citrus-base/src/main/java/com/consol/citrus/actions/ReceiveMessageAction.java#L167
I think I also recall why the message content logging has been moved to the message validator implementations. This is because the message content may be null or it may be non textual content such as binary content. The message validator implementation may know the content type and skip logging when appropriate.
In case we log the content in receive action I think we need to add some check that the message content is not null and that it is printable content before logging. WDYT?
Also we should make sure to not log each message multiple times (e.g. in Http logging interceptor, receive action and message validator)