Skip to content

Commit a640d84

Browse files
committed
Fix issue in AbstractMethodMessageHandler
1 parent 164a9f9 commit a640d84

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

spring-messaging/src/main/java/org/springframework/messaging/handler/method/AbstractMethodMessageHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ private void addMatchesToCollection(Collection<T> mappingsToCheck, Message<?> me
438438

439439
protected void handleMatch(T mapping, HandlerMethod handlerMethod, String lookupDestination, Message<?> message) {
440440

441-
InvocableHandlerMethod invocable = new InvocableHandlerMethod(handlerMethod.createWithResolvedBean());
441+
handlerMethod = handlerMethod.createWithResolvedBean();
442+
InvocableHandlerMethod invocable = new InvocableHandlerMethod(handlerMethod);
442443
invocable.setMessageMethodArgumentResolvers(this.argumentResolvers);
443444

444445
try {

spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpAnnotationMethodIntegrationTests.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.springframework.context.annotation.ComponentScan;
3636
import org.springframework.context.annotation.Configuration;
3737
import org.springframework.messaging.SubscribableChannel;
38+
import org.springframework.messaging.handler.annotation.MessageExceptionHandler;
3839
import org.springframework.messaging.handler.annotation.MessageMapping;
3940
import org.springframework.messaging.simp.config.DelegatingWebSocketMessageBrokerConfiguration;
4041
import org.springframework.messaging.simp.config.MessageBrokerConfigurer;
@@ -70,7 +71,7 @@ public static Iterable<Object[]> arguments() {
7071
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
7172
{new TomcatWebSocketTestServer(), new StandardWebSocketClient()}
7273
});
73-
};
74+
}
7475

7576

7677
@Override
@@ -137,6 +138,7 @@ public void sendMessageToBrokerAndReceiveReplyViaTopic() throws Exception {
137138
}
138139

139140

141+
@SuppressWarnings("unused")
140142
@IntegrationTestController
141143
static class SimpleController {
142144

@@ -146,8 +148,20 @@ static class SimpleController {
146148
public void handle() {
147149
this.latch.countDown();
148150
}
151+
152+
@MessageMapping(value="/exception")
153+
public void handleWithError() {
154+
throw new IllegalArgumentException("Bad input");
155+
}
156+
157+
@MessageExceptionHandler
158+
public void handleException(IllegalArgumentException ex) {
159+
160+
}
161+
149162
}
150163

164+
@SuppressWarnings("unused")
151165
@IntegrationTestController
152166
static class IncrementController {
153167

@@ -164,7 +178,7 @@ private static class TestClientWebSocketHandler extends TextWebSocketHandlerAdap
164178

165179
private final int expected;
166180

167-
private final List<TextMessage> actual = new CopyOnWriteArrayList<TextMessage>();
181+
private final List<TextMessage> actual = new CopyOnWriteArrayList<>();
168182

169183
private final CountDownLatch latch;
170184

0 commit comments

Comments
 (0)