Github user jdanekrh commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1358#discussion_r123471949
  
    --- Diff: 
artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java
 ---
    @@ -256,6 +258,7 @@ void handlePubAck(int messageId) throws Exception {
     
        private void sendServerMessage(int messageId, CoreMessage message, int 
deliveryCount, int qos) {
           String address = 
MQTTUtil.convertCoreAddressFilterToMQTT(message.getAddress().toString(), 
session.getWildcardConfiguration());
    +      boolean isRetain = message.getBooleanProperty(new 
SimpleString(MQTT_MESSAGE_RETAIN_KEY));
    --- End diff --
    
    
    I thought about it, and my conclusion was that since `getBooleanProperty` 
starts like this
    
    ```java
       ... Boolean getBooleanProperty(final SimpleString key) throws ... {
          Object value = doGetProperty(key);
          if (value == null) {
             return Boolean.valueOf(null);
    ```
    
    then the only way to get `null` for isRetain would be if somebody 
explicitly stored a `null` `Boolean` into the `MQTT_MESSAGE_RETAIN_KEY` 
property. In which case I though passing the `null` along is appropriate.
    
    Are you suggesting to do something like
    
        isRetain = Boolean.valueOf(message.getBooleanProperty(...))
    
    to be extra sure? I guess it can do no harm adding it... I'll try do it in 
CET evening today.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to