Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Objects;
import java.util.TimeZone;

Expand Down Expand Up @@ -248,10 +249,21 @@ public static String findValue(JsonNode jsonNode, String fieldName) {
* @return json to map
*/
public static Map<String, String> toMap(String json) {
return parseObject(json, new TypeReference<Map<String, String>>() {
Map<String, Object> map = parseObject(json, new TypeReference<Map<String, Object>>() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is used in many places, and this modification may cause more serious problems, you need to use parseObject at the upper layer.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review and suggestion. I understand the concern about modifying this common utility method. I will revert this change and move the parsing logic to the upper layer where it is needed. I’ll update the PR accordingly.

});

if (map == null) {
return Collections.emptyMap();
}

Map<String, String> result = new HashMap<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
result.put(entry.getKey(), String.valueOf(entry.getValue()));
}
return result;
}


/**
* from the key-value generated json to get the str value no matter the real type of value
*
Expand Down
Loading