maixiaohai commented on a change in pull request #683:
URL: https://github.com/apache/rocketmq-externals/pull/683#discussion_r590366843



##########
File path: 
rocketmq-console/src/main/java/org/apache/rocketmq/console/util/MsgTraceDecodeUtil.java
##########
@@ -88,9 +118,24 @@
                 subAfterContext.getTraceBeans().add(bean);
                 subAfterContext.setCostTime(Integer.parseInt(line[3]));
                 subAfterContext.setSuccess(Boolean.parseBoolean(line[4]));
-                if (line.length >= 7) {
-                    // add the context type
-                    subAfterContext.setContextCode(Integer.parseInt(line[6]));
+                // compatible with different version
+                switch (line.length) {
+                    case TRACE_MSG_SUBAFTER_V1_LEN:
+                        break;
+                    case TRACE_MSG_SUBAFTER_V2_LEN:
+                        
subAfterContext.setContextCode(Integer.parseInt(line[6]));
+                        break;
+                    case TRACE_MSG_SUBAFTER_V3_LEN:
+                        
subAfterContext.setContextCode(Integer.parseInt(line[6]));
+                        subAfterContext.setTimeStamp(Long.parseLong(line[7]));
+                        subAfterContext.setGroupName(line[8]);
+                        break;
+                    default:

Review comment:
       default logic is compatible for new version subAfterType.
   If a new field is added to subAfter message, the length will greater than 
TRACE_MSG_SUBAFTER_V3_LEN.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to