Skip to content

Commit bb84529

Browse files
committed
SWS-344
1 parent 89f054f commit bb84529

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

core/src/main/java/org/springframework/ws/server/endpoint/AbstractEndpointExceptionResolver.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.apache.commons.logging.Log;
2222
import org.apache.commons.logging.LogFactory;
23+
2324
import org.springframework.core.Ordered;
2425
import org.springframework.ws.context.MessageContext;
2526
import org.springframework.ws.server.EndpointExceptionResolver;
@@ -30,6 +31,7 @@
3031
* <p>Provides a set of mapped endpoints that the resolver should map.
3132
*
3233
* @author Arjen Poutsma
34+
* @author Tareq Abed Rabbo
3335
* @since 1.0.0
3436
*/
3537
public abstract class AbstractEndpointExceptionResolver implements EndpointExceptionResolver, Ordered {
@@ -75,6 +77,9 @@ public final int getOrder() {
7577
* @see #resolveExceptionInternal(MessageContext,Object,Exception)
7678
*/
7779
public final boolean resolveException(MessageContext messageContext, Object endpoint, Exception ex) {
80+
if (endpoint instanceof MethodEndpoint) {
81+
endpoint = ((MethodEndpoint) endpoint).getBean();
82+
}
7883
if (mappedEndpoints != null && !mappedEndpoints.contains(endpoint)) {
7984
return false;
8085
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package org.springframework.ws.server.endpoint;
2+
3+
import java.util.HashSet;
4+
import java.util.Set;
5+
6+
import junit.framework.TestCase;
7+
8+
import org.springframework.ws.context.MessageContext;
9+
10+
/**
11+
* Test for AbstractEndpointExceptionResolver
12+
*
13+
* @author Tareq Abed Rabbo
14+
* @author Arjen Poutsma
15+
*/
16+
public class EndpointExceptionResolverTest extends TestCase {
17+
18+
private MethodEndpoint methodEndpoint;
19+
20+
private AbstractEndpointExceptionResolver exceptionResolver;
21+
22+
protected void setUp() throws Exception {
23+
exceptionResolver = new AbstractEndpointExceptionResolver() {
24+
25+
protected boolean resolveExceptionInternal(MessageContext messageContext, Object endpoint, Exception ex) {
26+
return true;
27+
}
28+
};
29+
30+
Set mappedEndpoints = new HashSet();
31+
mappedEndpoints.add(this);
32+
exceptionResolver.setMappedEndpoints(mappedEndpoints);
33+
methodEndpoint = new MethodEndpoint(this, getClass().getMethod("emptyMethod", new Class[0]));
34+
}
35+
36+
public void testMatchMethodEndpoint() {
37+
boolean matched = exceptionResolver.resolveException(null, methodEndpoint, null);
38+
assertTrue("AbstractEndpointExceptionResolver did not match mapped MethodEndpoint", matched);
39+
}
40+
41+
public void emptyMethod() {
42+
}
43+
}

0 commit comments

Comments
 (0)