activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From michaelandrepearce <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #1846: Avoid NPE when setting null address
Date Mon, 05 Feb 2018 07:59:39 GMT
Github user michaelandrepearce commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1846#discussion_r165900914
  
    --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
---
    @@ -437,7 +437,11 @@ public CoreMessage setMessageID(long messageID) {
     
        @Override
        public CoreMessage setAddress(SimpleString address) {
    -      if (validBuffer && !address.equals(this.address)) {
    +      if (address == null && this.address == null) {
    +         // no-op so just return
    +         return this;
    +      }
    +      if (validBuffer && ((address == null && this.address != null) ||
!address.equals(this.address))) {
    --- End diff --
    
    When you're here, if address is null, you already know this.address is not null, due to
the preceding check.


---

Mime
View raw message