GH-730: Fix NPE in the MessageProperties
Fixes https://github.com/spring-projects/spring-amqp/issues/730
This commit is contained in:
@@ -568,6 +568,14 @@ public class MessageProperties implements Serializable {
|
||||
if (!Arrays.equals(this.correlationId, other.correlationId)) {
|
||||
return false;
|
||||
}
|
||||
if (this.correlationIdString == null) {
|
||||
if (other.correlationIdString != null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!this.correlationIdString.equals(other.correlationIdString)) {
|
||||
return false;
|
||||
}
|
||||
if (this.deliveryMode != other.deliveryMode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.amqp.core;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -41,4 +42,11 @@ public class MessagePropertiesTests {
|
||||
assertEquals(null, properties.getReplyToAddress());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tesNoNullPointerInEquals() {
|
||||
MessageProperties mp = new MessageProperties();
|
||||
MessageProperties mp2 = new MessageProperties();
|
||||
assertTrue(mp.equals(mp2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user