Skip to content

Commit f58db47

Browse files
committed
Fix error logging in client-side validation
Closes gh-1144
1 parent 84ac743 commit f58db47

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

spring-ws-core/src/main/java/org/springframework/ws/client/support/interceptor/AbstractValidatingInterceptor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public boolean handleRequest(MessageContext messageContext) throws WebServiceCli
185185
errors = this.validator.validate(requestSource);
186186
}
187187
catch (IOException ex) {
188-
throw new WebServiceIOException("Could not validate response: " + ex.getMessage(), ex);
188+
throw new WebServiceIOException("Could not validate request: " + ex.getMessage(), ex);
189189
}
190190
if (!ObjectUtils.isEmpty(errors)) {
191191
return handleRequestValidationErrors(messageContext, errors);

spring-ws-core/src/main/java/org/springframework/ws/client/support/interceptor/WebServiceValidationException.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ public WebServiceValidationException(SAXParseException[] validationErrors) {
4141
}
4242

4343
private static String createMessage(SAXParseException[] validationErrors) {
44-
StringBuilder builder = new StringBuilder("XML validation error on response: ");
44+
StringBuilder builder = new StringBuilder("XML validation error on request: ");
4545

4646
for (SAXParseException validationError : validationErrors) {
4747
builder.append(validationError.getMessage());
4848
}
4949
return builder.toString();
5050
}
5151

52-
/** Returns the validation errors. */
52+
/**
53+
* Return the validation errors.
54+
*/
5355
public SAXParseException[] getValidationErrors() {
5456
return this.validationErrors;
5557
}

spring-ws-core/src/test/java/org/springframework/ws/client/support/interceptor/PayloadValidatingInterceptorTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void testHandleInvalidRequest() throws Exception {
9393

9494
assertThatExceptionOfType(WebServiceClientException.class)
9595
.isThrownBy(() -> this.interceptor.handleRequest(this.context))
96-
.withMessageContaining("XML validation error on response");
96+
.withMessageContaining("XML validation error on request");
9797
}
9898

9999
@Test
@@ -105,7 +105,7 @@ public void testHandlerInvalidRequest() throws Exception {
105105

106106
assertThatExceptionOfType(WebServiceClientException.class)
107107
.isThrownBy(() -> this.interceptor.handleRequest(this.context))
108-
.withMessageContaining("XML validation error on response");
108+
.withMessageContaining("XML validation error on request");
109109
}
110110

111111
@Test
@@ -199,7 +199,7 @@ public void testHandlerInvalidRequestMultipleSchemas() throws Exception {
199199

200200
assertThatExceptionOfType(WebServiceClientException.class)
201201
.isThrownBy(() -> this.interceptor.handleRequest(this.context))
202-
.withMessageContaining("XML validation error on response");
202+
.withMessageContaining("XML validation error on request");
203203
}
204204

205205
@Test

0 commit comments

Comments
 (0)