GH-918: Handle null correlationId
Fixes https://github.com/spring-projects/spring-amqp/issues/918 * Add unit test and `@autor` **Cherry-pick to 2.0.x & 1.7.x**
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,7 @@ import java.util.Map;
|
||||
* @author Gary Russell
|
||||
* @author Dmitry Chernyshov
|
||||
* @author Artem Bilan
|
||||
* @author Csaba Soti
|
||||
*/
|
||||
public class MessageProperties implements Serializable {
|
||||
|
||||
@@ -525,7 +526,7 @@ public class MessageProperties implements Serializable {
|
||||
result = prime * result + ((this.contentEncoding == null) ? 0 : this.contentEncoding.hashCode());
|
||||
result = prime * result + (int) (this.contentLength ^ (this.contentLength >>> 32));
|
||||
result = prime * result + ((this.contentType == null) ? 0 : this.contentType.hashCode());
|
||||
result = prime * result + this.correlationId.hashCode();
|
||||
result = prime * result + ((this.correlationId == null) ? 0 : this.correlationId.hashCode());
|
||||
result = prime * result + ((this.deliveryMode == null) ? 0 : this.deliveryMode.hashCode());
|
||||
result = prime * result + (int) (this.deliveryTag ^ (this.deliveryTag >>> 32));
|
||||
result = prime * result + ((this.expiration == null) ? 0 : this.expiration.hashCode());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,9 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
@@ -27,12 +30,12 @@ import org.junit.Test;
|
||||
* @author Dave Syer
|
||||
* @author Artem Yakshin
|
||||
* @author Artem Bilan
|
||||
* @author Csaba Soti
|
||||
*
|
||||
*/
|
||||
public class MessagePropertiesTests {
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testReplyTo() throws Exception {
|
||||
MessageProperties properties = new MessageProperties();
|
||||
@@ -71,4 +74,11 @@ public class MessagePropertiesTests {
|
||||
assertTrue(mp.equals(mp2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tesNoNullPointerInHashCode() {
|
||||
Set<MessageProperties> messageList = new HashSet<>();
|
||||
messageList.add(new MessageProperties());
|
||||
assertEquals(1, messageList.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user