@@ -125,7 +125,7 @@ public class ClientState implements MqttState {
125125 private long keepAlive ;
126126 private boolean cleanSession ;
127127 private MqttClientPersistence persistence ;
128-
128+
129129 private int actualInFlight = 0 ;
130130 private int inFlightPubRels = 0 ;
131131
@@ -238,14 +238,14 @@ protected void clearState() throws MqttException {
238238 outgoingTopicAliases .clear ();
239239 incomingTopicAliases .clear ();
240240 }
241-
241+
242242 protected void clearConnectionState () throws MqttException {
243243 final String methodName = "clearConnectionState" ;
244244 // @TRACE=665=Clearing Connection State (Topic Aliases)
245245 log .fine (CLASS_NAME , methodName , "665" );
246246 outgoingTopicAliases .clear ();
247247 incomingTopicAliases .clear ();
248-
248+
249249 }
250250
251251 private MqttWireMessage restoreMessage (String key , MqttPersistable persistable ) throws MqttException {
@@ -520,14 +520,7 @@ public void send(MqttWireMessage message, MqttToken token) throws MqttException
520520 final String methodName = "send" ;
521521 // Set Message ID if required
522522 if (message .isMessageIdRequired () && (message .getMessageId () == 0 )) {
523- if (message instanceof MqttPublish && (((MqttPublish ) message ).getMessage ().getQos () != 0 )) {
524- message .setMessageId (getNextMessageId ());
525- } else if (message instanceof MqttPubAck || message instanceof MqttPubRec || message instanceof MqttPubRel
526- || message instanceof MqttPubComp || message instanceof MqttSubscribe
527- || message instanceof MqttSubAck || message instanceof MqttUnsubscribe
528- || message instanceof MqttUnsubAck ) {
529- message .setMessageId (getNextMessageId ());
530- }
523+ message .setMessageId (getNextMessageId ());
531524 }
532525 // Set Topic Alias if required
533526 if (message instanceof MqttPublish && this .mqttSession .getOutgoingTopicAliasMaximum () > 0 ) {
@@ -545,7 +538,7 @@ public void send(MqttWireMessage message, MqttToken token) throws MqttException
545538 }
546539 }
547540 }
548-
541+
549542 if (token != null ) {
550543 try {
551544 token .internalTok .setMessageID (message .getMessageId ());
@@ -1043,7 +1036,7 @@ protected void notifyReceivedAck(MqttAck ack) throws MqttException {
10431036 // @TRACE 662=no message found for ack id={0}
10441037 log .fine (CLASS_NAME , methodName , "662" , new Object [] { Integer .valueOf (ack .getMessageId ()) });
10451038 } else if (ack instanceof MqttPubRec ) {
1046-
1039+
10471040 // Update the token with the reason codes
10481041 updateResult (ack , token , mex );
10491042
@@ -1261,12 +1254,17 @@ protected void notifyComplete(MqttToken token) throws MqttException {
12611254 checkQuiesceLock ();
12621255 }
12631256 }
1264-
1257+
12651258 /**
1266- * Updates a token with the latest reason codes, currently only used for PubRec messages.
1267- * @param msg - The message that we are using for the update
1268- * @param token - The Token we are updating
1269- * @param ex - if there was a problem store the exception in the token.
1259+ * Updates a token with the latest reason codes, currently only used for PubRec
1260+ * messages.
1261+ *
1262+ * @param msg
1263+ * - The message that we are using for the update
1264+ * @param token
1265+ * - The Token we are updating
1266+ * @param ex
1267+ * - if there was a problem store the exception in the token.
12701268 */
12711269 protected void updateResult (MqttWireMessage ack , MqttToken token , MqttException ex ) {
12721270 token .internalTok .update (ack , ex );
@@ -1369,7 +1367,7 @@ public void disconnected(MqttException reason) {
13691367 if (cleanSession ) {
13701368 clearState ();
13711369 }
1372-
1370+
13731371 clearConnectionState ();
13741372
13751373 pendingMessages .clear ();
0 commit comments