Browse Source

Fix issue in AbstractMethodMessageHandler

pull/398/head
Rossen Stoyanchev 11 years ago
parent
commit
a640d84961
  1. 3
      spring-messaging/src/main/java/org/springframework/messaging/handler/method/AbstractMethodMessageHandler.java
  2. 18
      spring-messaging/src/test/java/org/springframework/messaging/simp/handler/SimpAnnotationMethodIntegrationTests.java

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

@ -438,7 +438,8 @@ public abstract class AbstractMethodMessageHandler<T> @@ -438,7 +438,8 @@ public abstract class AbstractMethodMessageHandler<T>
protected void handleMatch(T mapping, HandlerMethod handlerMethod, String lookupDestination, Message<?> message) {
InvocableHandlerMethod invocable = new InvocableHandlerMethod(handlerMethod.createWithResolvedBean());
handlerMethod = handlerMethod.createWithResolvedBean();
InvocableHandlerMethod invocable = new InvocableHandlerMethod(handlerMethod);
invocable.setMessageMethodArgumentResolvers(this.argumentResolvers);
try {

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

@ -35,6 +35,7 @@ import org.springframework.context.annotation.Bean; @@ -35,6 +35,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.handler.annotation.MessageExceptionHandler;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.simp.config.DelegatingWebSocketMessageBrokerConfiguration;
import org.springframework.messaging.simp.config.MessageBrokerConfigurer;
@ -70,7 +71,7 @@ public class SimpAnnotationMethodIntegrationTests extends AbstractWebSocketInteg @@ -70,7 +71,7 @@ public class SimpAnnotationMethodIntegrationTests extends AbstractWebSocketInteg
{new JettyWebSocketTestServer(), new JettyWebSocketClient()},
{new TomcatWebSocketTestServer(), new StandardWebSocketClient()}
});
};
}
@Override
@ -137,6 +138,7 @@ public class SimpAnnotationMethodIntegrationTests extends AbstractWebSocketInteg @@ -137,6 +138,7 @@ public class SimpAnnotationMethodIntegrationTests extends AbstractWebSocketInteg
}
@SuppressWarnings("unused")
@IntegrationTestController
static class SimpleController {
@ -146,8 +148,20 @@ public class SimpAnnotationMethodIntegrationTests extends AbstractWebSocketInteg @@ -146,8 +148,20 @@ public class SimpAnnotationMethodIntegrationTests extends AbstractWebSocketInteg
public void handle() {
this.latch.countDown();
}
@MessageMapping(value="/exception")
public void handleWithError() {
throw new IllegalArgumentException("Bad input");
}
@MessageExceptionHandler
public void handleException(IllegalArgumentException ex) {
}
}
@SuppressWarnings("unused")
@IntegrationTestController
static class IncrementController {
@ -164,7 +178,7 @@ public class SimpAnnotationMethodIntegrationTests extends AbstractWebSocketInteg @@ -164,7 +178,7 @@ public class SimpAnnotationMethodIntegrationTests extends AbstractWebSocketInteg
private final int expected;
private final List<TextMessage> actual = new CopyOnWriteArrayList<TextMessage>();
private final List<TextMessage> actual = new CopyOnWriteArrayList<>();
private final CountDownLatch latch;

Loading…
Cancel
Save