activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martyn Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (ARTEMIS-335) Dead code in MQTTPublishManager.generateMqttId?
Date Fri, 10 Mar 2017 11:43:04 GMT

     [ 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)

Mime
View raw message