Browse Source

Remove unnecessary copying of headers in GenericMessage

Since the MessageHeaders constructor is makes a copy of the headers and
is protected against a null map, there is no need for the same to be
done in GenericMessage.

Issue: SPR-11268
pull/432/head
Rossen Stoyanchev 11 years ago
parent
commit
3b14e974f8
  1. 6
      spring-messaging/src/main/java/org/springframework/messaging/support/GenericMessage.java

6
spring-messaging/src/main/java/org/springframework/messaging/support/GenericMessage.java

@ -61,12 +61,6 @@ public class GenericMessage<T> implements Message<T>, Serializable { @@ -61,12 +61,6 @@ public class GenericMessage<T> implements Message<T>, Serializable {
*/
public GenericMessage(T payload, Map<String, Object> headers) {
Assert.notNull(payload, "payload must not be null");
if (headers == null) {
headers = new HashMap<String, Object>();
}
else {
headers = new HashMap<String, Object>(headers);
}
this.headers = new MessageHeaders(headers);
this.payload = payload;
}

Loading…
Cancel
Save