You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/01/09 12:59:39 UTC
[jira] [Commented] (ARTEMIS-335) Dead code in
MQTTPublishManager.generateMqttId?
[ https://issues.apache.org/jira/browse/ARTEMIS-335?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15090574#comment-15090574 ]
ASF GitHub Bot commented on ARTEMIS-335:
----------------------------------------
GitHub user scop opened a pull request:
https://github.com/apache/activemq-artemis/pull/305
Remove dead code
ServerSessionImpl changes are actually NPE avoiding ones, but similar as the other ones (were unnecessary null checks) so I left them here. See also ARTEMIS-335 for one more related one (which is not included in this PR).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/scop/activemq-artemis deadcode
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/activemq-artemis/pull/305.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #305
----
commit 4ecbc34b6a432e638a950681289d503fff515156
Author: Ville Skyttä <vi...@iki.fi>
Date: 2016-01-09T11:55:44Z
Remove dead code
----
> 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ä
> Priority: Minor
>
> 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.4#6332)