You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Martyn Taylor (JIRA)" <ji...@apache.org> on 2017/03/10 11:43:04 UTC

[jira] [Resolved] (ARTEMIS-335) Dead code in MQTTPublishManager.generateMqttId?

     [ https://issues.apache.org/jira/browse/ARTEMIS-335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martyn Taylor resolved ARTEMIS-335.
-----------------------------------
       Resolution: Fixed
    Fix Version/s: 1.4.0

> Dead code in MQTTPublishManager.generateMqttId?
> -----------------------------------------------
>
>                 Key: ARTEMIS-335
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-335
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Ville Skyttä
>            Assignee: Martyn Taylor
>            Priority: Minor
>             Fix For: 1.4.0
>
>
> MQTTPublishManager.generateMqttId:
> {code:java}
>       if (qos == 1) {
>          return session.getSessionState().generateId();
>       }
>       else {
>         Integer mqttid = session.getSessionState().generateId();
>          if (mqttid == null) {
>             mqttid = (int) session.getServer().getStorageManager().generateID();
>          }
>          return mqttid;
>       }
>  {code}
> mqttid can never be null, because MQTTSessionState.generateId() returns an int, not Integer. Therefore the whole above code block could be replaced by {{return session.getSessionState().generateId()}}. Not sure if that's the intention or not, therefore reporting here instead of filing a PR.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)