-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Labels
Description
if (SUCCESS_CODE.equals(code)) {
Map<Integer, List<String>> respTarget = new HashMap<Integer, List<String>>();
if (StringUtils.isNotBlank(value)) {
respTarget = JSONObject.parseObject(value, Map.class);
}
return ResultPack.succeed(code, msg, PushResult.build(msgId, respTarget));
} else {
return ResultPack.failed(code, msg);
}
sdk的代码中构造出的respTarget的map调用了fastjson的parseObject方式以后,key的类型实际上为String,但是声明的时候却是Integer,导致对这个map的访问出错。如下:
String pushId = "abcdefg";
IFlymePush push = new IFlymePush("key");
UnVarnishedMessage message = new UnVarnishedMessage.Builder().appId(appId).content("test content2").build();
List<String> pushIds = new ArrayList<>();
pushIds.add(pushId);
ResultPack<PushResult> result = push.pushMessage(message, pushIds);
Map<Integer, List<String>> map = result.value().getRespTarget();
for (Map.Entry<Integer, List<String>> entry : map.entrySet()) {
System.out.println(entry.getKey() + " " + entry.getValue());
}
System.out.println(map.containsKey(110003));
for循环中打印出了key为110003,但是最后一行却打印出了false。