Skip to content

Commit

Permalink
GH-730: Fix NPE in the MessageProperties
Browse files Browse the repository at this point in the history
Fixes #730

**Cherry-pick to 2.0.x and 1.7.x**
  • Loading branch information
artembilan authored and garyrussell committed Mar 28, 2018
1 parent b66d54c commit 450d27f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
Expand Down Expand Up @@ -590,9 +590,16 @@ else if (!this.contentEncoding.equals(other.contentEncoding)) {
else if (!this.contentType.equals(other.contentType)) {
return false;
}
if (!this.correlationId.equals(other.correlationId)) {

if (this.correlationId == null) {
if (other.correlationId != null) {
return false;
}
}
else if (!this.correlationId.equals(other.correlationId)) {
return false;
}

if (this.deliveryMode != other.deliveryMode) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
Expand All @@ -26,10 +26,13 @@
/**
* @author Dave Syer
* @author Artem Yakshin
* @author Artem Bilan
*
*/
public class MessagePropertiesTests {



@Test
public void testReplyTo() throws Exception {
MessageProperties properties = new MessageProperties();
Expand Down Expand Up @@ -61,4 +64,11 @@ public void testContentLengthSet() {
assertTrue(properties.isContentLengthSet());
}

@Test
public void tesNoNullPointerInEquals() {
MessageProperties mp = new MessageProperties();
MessageProperties mp2 = new MessageProperties();
assertTrue(mp.equals(mp2));
}

}

0 comments on commit 450d27f

Please sign in to comment.