You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/04/06 07:42:27 UTC

[GitHub] [rocketmq-mqtt] tianliuliu commented on a diff in pull request #45: [ISSUE #22] make codeCov of mqtt.cs.channel more than 80%

tianliuliu commented on code in PR #45:
URL: https://github.com/apache/rocketmq-mqtt/pull/45#discussion_r839474262


##########
mqtt-cs/src/main/java/org/apache/rocketmq/mqtt/cs/channel/ChannelInfo.java:
##########
@@ -93,11 +93,7 @@ public static boolean checkExtDataChange(Channel channel) {
         if (!getInfo(channel).containsKey(CHANNEL_EXT_CHANGE_KEY)) {
             getInfo(channel).put(CHANNEL_EXT_CHANGE_KEY, false);
         }
-        Object obj = getInfo(channel).get(CHANNEL_EXT_CHANGE_KEY);
-        if (obj == null) {
-            return false;
-        }
-        return (boolean)obj;
+        return (boolean) getInfo(channel).get(CHANNEL_EXT_CHANGE_KEY);

Review Comment:
   same as the above comment



##########
mqtt-cs/src/main/java/org/apache/rocketmq/mqtt/cs/channel/ChannelInfo.java:
##########
@@ -114,11 +110,7 @@ public static Boolean getCleanSessionFlag(Channel channel) {
         if (!getInfo(channel).containsKey(CHANNEL_CLEAN_SESSION_KEY)) {
             getInfo(channel).put(CHANNEL_CLEAN_SESSION_KEY, true);
         }
-        Object obj = getInfo(channel).get(CHANNEL_CLEAN_SESSION_KEY);
-        if (obj == null) {
-            return true;
-        }
-        return (Boolean)obj;
+        return (Boolean) getInfo(channel).get(CHANNEL_CLEAN_SESSION_KEY);

Review Comment:
   in high concurrency scenarios, when the clear(Channel channel) method is called, NPE will be triggered here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org