Fix error logging in client-side validation

Closes gh-1144
This commit is contained in:
Stéphane Nicoll
2025-04-16 15:11:04 +02:00
parent 84ac743d2d
commit f58db47ba4
3 changed files with 8 additions and 6 deletions

View File

@@ -185,7 +185,7 @@ public abstract class AbstractValidatingInterceptor extends TransformerObjectSup
errors = this.validator.validate(requestSource);
}
catch (IOException ex) {
throw new WebServiceIOException("Could not validate response: " + ex.getMessage(), ex);
throw new WebServiceIOException("Could not validate request: " + ex.getMessage(), ex);
}
if (!ObjectUtils.isEmpty(errors)) {
return handleRequestValidationErrors(messageContext, errors);

View File

@@ -41,7 +41,7 @@ public class WebServiceValidationException extends WebServiceClientException {
}
private static String createMessage(SAXParseException[] validationErrors) {
StringBuilder builder = new StringBuilder("XML validation error on response: ");
StringBuilder builder = new StringBuilder("XML validation error on request: ");
for (SAXParseException validationError : validationErrors) {
builder.append(validationError.getMessage());
@@ -49,7 +49,9 @@ public class WebServiceValidationException extends WebServiceClientException {
return builder.toString();
}
/** Returns the validation errors. */
/**
* Return the validation errors.
*/
public SAXParseException[] getValidationErrors() {
return this.validationErrors;
}

View File

@@ -93,7 +93,7 @@ public class PayloadValidatingInterceptorTest {
assertThatExceptionOfType(WebServiceClientException.class)
.isThrownBy(() -> this.interceptor.handleRequest(this.context))
.withMessageContaining("XML validation error on response");
.withMessageContaining("XML validation error on request");
}
@Test
@@ -105,7 +105,7 @@ public class PayloadValidatingInterceptorTest {
assertThatExceptionOfType(WebServiceClientException.class)
.isThrownBy(() -> this.interceptor.handleRequest(this.context))
.withMessageContaining("XML validation error on response");
.withMessageContaining("XML validation error on request");
}
@Test
@@ -199,7 +199,7 @@ public class PayloadValidatingInterceptorTest {
assertThatExceptionOfType(WebServiceClientException.class)
.isThrownBy(() -> this.interceptor.handleRequest(this.context))
.withMessageContaining("XML validation error on response");
.withMessageContaining("XML validation error on request");
}
@Test