Skip to content

Commit 1d0c2f6

Browse files
committed
Polishing
(cherry picked from commit ca9a078)
1 parent 4b27a6d commit 1d0c2f6

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -162,7 +162,7 @@ public DestinationPatternsMessageCondition getMatchingCondition(Message<?> messa
162162
}
163163

164164
List<String> matches = new ArrayList<String>();
165-
for (String pattern : patterns) {
165+
for (String pattern : this.patterns) {
166166
if (pattern.equals(destination) || this.pathMatcher.match(pattern, destination)) {
167167
matches.add(pattern);
168168
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,28 +85,28 @@ public boolean supportsParameter(MethodParameter parameter) {
8585
}
8686

8787
@Override
88-
public Object resolveArgument(MethodParameter param, Message<?> message) throws Exception {
89-
Payload ann = param.getParameterAnnotation(Payload.class);
88+
public Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception {
89+
Payload ann = parameter.getParameterAnnotation(Payload.class);
9090
if (ann != null && StringUtils.hasText(ann.value())) {
9191
throw new IllegalStateException("@Payload SpEL expressions not supported by this resolver");
9292
}
9393

9494
Object payload = message.getPayload();
9595
if (isEmptyPayload(payload)) {
9696
if (ann == null || ann.required()) {
97-
String paramName = getParameterName(param);
97+
String paramName = getParameterName(parameter);
9898
BindingResult bindingResult = new BeanPropertyBindingResult(payload, paramName);
99-
bindingResult.addError(new ObjectError(paramName, "@Payload param is required"));
100-
throw new MethodArgumentNotValidException(message, param, bindingResult);
99+
bindingResult.addError(new ObjectError(paramName, "Payload value must not be empty"));
100+
throw new MethodArgumentNotValidException(message, parameter, bindingResult);
101101
}
102102
else {
103103
return null;
104104
}
105105
}
106106

107-
Class<?> targetClass = param.getParameterType();
107+
Class<?> targetClass = parameter.getParameterType();
108108
if (ClassUtils.isAssignable(targetClass, payload.getClass())) {
109-
validate(message, param, payload);
109+
validate(message, parameter, payload);
110110
return payload;
111111
}
112112
else {
@@ -115,7 +115,7 @@ public Object resolveArgument(MethodParameter param, Message<?> message) throws
115115
throw new MessageConversionException(message,
116116
"No converter found to convert to " + targetClass + ", message=" + message);
117117
}
118-
validate(message, param, payload);
118+
validate(message, parameter, payload);
119119
return payload;
120120
}
121121
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ private void addMatchesToCollection(Collection<T> mappingsToCheck, Message<?> me
413413
for (T mapping : mappingsToCheck) {
414414
T match = getMatchingMapping(mapping, message);
415415
if (match != null) {
416-
matches.add(new Match(match, handlerMethods.get(mapping)));
416+
matches.add(new Match(match, this.handlerMethods.get(mapping)));
417417
}
418418
}
419419
}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ public SimpMessageType getMessageType() {
5757

5858
@Override
5959
protected Collection<?> getContent() {
60-
return Arrays.asList(messageType);
60+
return Arrays.asList(this.messageType);
6161
}
6262

6363
@Override
@@ -72,12 +72,10 @@ public SimpMessageTypeMessageCondition combine(SimpMessageTypeMessageCondition o
7272

7373
@Override
7474
public SimpMessageTypeMessageCondition getMatchingCondition(Message<?> message) {
75-
7675
Object actualMessageType = SimpMessageHeaderAccessor.getMessageType(message.getHeaders());
7776
if (actualMessageType == null) {
7877
return null;
7978
}
80-
8179
return this;
8280
}
8381

@@ -97,4 +95,5 @@ else if (actualMessageType.equals(other.getMessageType())) {
9795
}
9896
return 0;
9997
}
98+
10099
}

0 commit comments

Comments
 (0)