zhishengzhang commented on code in PR #10283:
URL: https://github.com/apache/rocketmq/pull/10283#discussion_r3192853542


##########
remoting/src/test/java/org/apache/rocketmq/remoting/protocol/RemotingSerializableTest.java:
##########
@@ -121,6 +123,22 @@ public Map<Long, String> getMap() {
             Assert.fail("Should not throw");
         }
     }
+    @Test
+    public void testDecodeUnquotedFieldNames() {
+        // 模拟 5.4.x 版本序列化的 consumerOffset 格式(数字 key 无引号)
+        String jsonWithUnquotedKeys = 
"{\"offsetTable\":{\"TopicTest@gid-test\":{0:123,1:456}}}";
+        Map<String, Map<Integer, Long>> result = 
RemotingSerializable.fromJson(jsonWithUnquotedKeys, Map.class);
+        assertNotNull(result);
+        Map offsetTable = (Map) result.get("offsetTable");
+        assertNotNull(offsetTable);
+
+        Map topicOffsets = (Map) offsetTable.get("TopicTest@gid-test");
+        assertNotNull(topicOffsets);
+
+        assertEquals(123L, ((Number) topicOffsets.get("0")).longValue());

Review Comment:
   
   <img width="1064" height="638" alt="image" 
src="https://github.com/user-attachments/assets/0ac5fcc8-a378-4a74-a084-e7ca8336ad08";
 />
   
   That was a bug in the test code.I have fixed the test code accordingly. 
Thanks for catching this!



-- 
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: [email protected]

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

Reply via email to