Browse Source

Polishing

pull/934/head
Juergen Hoeller 10 years ago
parent
commit
ca9a078d82
  1. 4
      spring-messaging/src/main/java/org/springframework/messaging/handler/DestinationPatternsMessageCondition.java
  2. 2
      spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/PayloadArgumentResolver.java
  3. 2
      spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/AbstractMethodMessageHandler.java
  4. 7
      spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageTypeMessageCondition.java

4
spring-messaging/src/main/java/org/springframework/messaging/handler/DestinationPatternsMessageCondition.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -162,7 +162,7 @@ public class DestinationPatternsMessageCondition extends AbstractMessageConditio
} }
List<String> matches = new ArrayList<String>(); List<String> matches = new ArrayList<String>();
for (String pattern : patterns) { for (String pattern : this.patterns) {
if (pattern.equals(destination) || this.pathMatcher.match(pattern, destination)) { if (pattern.equals(destination) || this.pathMatcher.match(pattern, destination)) {
matches.add(pattern); matches.add(pattern);
} }

2
spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/PayloadArgumentResolver.java

@ -97,7 +97,7 @@ public class PayloadArgumentResolver implements HandlerMethodArgumentResolver {
if (ann == null || ann.required()) { if (ann == null || ann.required()) {
String paramName = getParameterName(parameter); String paramName = getParameterName(parameter);
BindingResult bindingResult = new BeanPropertyBindingResult(payload, paramName); BindingResult bindingResult = new BeanPropertyBindingResult(payload, paramName);
bindingResult.addError(new ObjectError(paramName, "@Payload param is required")); bindingResult.addError(new ObjectError(paramName, "Payload value must not be empty"));
throw new MethodArgumentNotValidException(message, parameter, bindingResult); throw new MethodArgumentNotValidException(message, parameter, bindingResult);
} }
else { else {

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

@ -456,7 +456,7 @@ public abstract class AbstractMethodMessageHandler<T>
for (T mapping : mappingsToCheck) { for (T mapping : mappingsToCheck) {
T match = getMatchingMapping(mapping, message); T match = getMatchingMapping(mapping, message);
if (match != null) { if (match != null) {
matches.add(new Match(match, handlerMethods.get(mapping))); matches.add(new Match(match, this.handlerMethods.get(mapping)));
} }
} }
} }

7
spring-messaging/src/main/java/org/springframework/messaging/simp/SimpMessageTypeMessageCondition.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2013 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -57,7 +57,7 @@ public class SimpMessageTypeMessageCondition extends AbstractMessageCondition<Si
@Override @Override
protected Collection<?> getContent() { protected Collection<?> getContent() {
return Arrays.asList(messageType); return Arrays.asList(this.messageType);
} }
@Override @Override
@ -72,12 +72,10 @@ public class SimpMessageTypeMessageCondition extends AbstractMessageCondition<Si
@Override @Override
public SimpMessageTypeMessageCondition getMatchingCondition(Message<?> message) { public SimpMessageTypeMessageCondition getMatchingCondition(Message<?> message) {
Object actualMessageType = SimpMessageHeaderAccessor.getMessageType(message.getHeaders()); Object actualMessageType = SimpMessageHeaderAccessor.getMessageType(message.getHeaders());
if (actualMessageType == null) { if (actualMessageType == null) {
return null; return null;
} }
return this; return this;
} }
@ -97,4 +95,5 @@ public class SimpMessageTypeMessageCondition extends AbstractMessageCondition<Si
} }
return 0; return 0;
} }
} }

Loading…
Cancel
Save