Merge pull request #685 from AlphaWu/Zafu-Dev-1127

弃用废弃方法toJavaObject,改用to方法,消除编译警告。
This commit is contained in:
648540858 2022-11-29 15:19:04 +08:00 committed by GitHub
commit 1cc111a573
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
Message msg = taskQueue.poll(); Message msg = taskQueue.poll();
try { try {
JSONObject msgJSON = JSON.parseObject(msg.getBody(), JSONObject.class); JSONObject msgJSON = JSON.parseObject(msg.getBody(), JSONObject.class);
WvpRedisMsg wvpRedisMsg = JSON.toJavaObject(msgJSON, WvpRedisMsg.class); WvpRedisMsg wvpRedisMsg = JSON.to(WvpRedisMsg.class, msgJSON);
if (!userSetting.getServerId().equals(wvpRedisMsg.getToId())) { if (!userSetting.getServerId().equals(wvpRedisMsg.getToId())) {
continue; continue;
} }
@ -126,11 +126,11 @@ public class RedisGbPlayMsgListener implements MessageListener {
switch (wvpRedisMsg.getCmd()){ switch (wvpRedisMsg.getCmd()){
case WvpRedisMsgCmd.GET_SEND_ITEM: case WvpRedisMsgCmd.GET_SEND_ITEM:
RequestSendItemMsg content = JSON.toJavaObject((JSONObject)wvpRedisMsg.getContent(), RequestSendItemMsg.class); RequestSendItemMsg content = JSON.to(RequestSendItemMsg.class, wvpRedisMsg.getContent());
requestSendItemMsgHand(content, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial()); requestSendItemMsgHand(content, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial());
break; break;
case WvpRedisMsgCmd.REQUEST_PUSH_STREAM: case WvpRedisMsgCmd.REQUEST_PUSH_STREAM:
RequestPushStreamMsg param = JSON.toJavaObject((JSONObject)wvpRedisMsg.getContent(), RequestPushStreamMsg.class);; RequestPushStreamMsg param = JSON.to(RequestPushStreamMsg.class, wvpRedisMsg.getContent());
requestPushStreamMsgHand(param, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial()); requestPushStreamMsgHand(param, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial());
break; break;
default: default:
@ -142,12 +142,12 @@ public class RedisGbPlayMsgListener implements MessageListener {
switch (wvpRedisMsg.getCmd()){ switch (wvpRedisMsg.getCmd()){
case WvpRedisMsgCmd.GET_SEND_ITEM: case WvpRedisMsgCmd.GET_SEND_ITEM:
WVPResult content = JSON.toJavaObject((JSONObject)wvpRedisMsg.getContent(), WVPResult.class); WVPResult content = JSON.to(WVPResult.class, wvpRedisMsg.getContent());
String key = wvpRedisMsg.getSerial(); String key = wvpRedisMsg.getSerial();
switch (content.getCode()) { switch (content.getCode()) {
case 0: case 0:
ResponseSendItemMsg responseSendItemMsg =JSON.toJavaObject((JSONObject)content.getData(), ResponseSendItemMsg.class); ResponseSendItemMsg responseSendItemMsg =JSON.to(ResponseSendItemMsg.class, content.getData());
PlayMsgCallback playMsgCallback = callbacks.get(key); PlayMsgCallback playMsgCallback = callbacks.get(key);
if (playMsgCallback != null) { if (playMsgCallback != null) {
callbacksForError.remove(key); callbacksForError.remove(key);
@ -172,7 +172,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
} }
break; break;
case WvpRedisMsgCmd.REQUEST_PUSH_STREAM: case WvpRedisMsgCmd.REQUEST_PUSH_STREAM:
WVPResult wvpResult = JSON.toJavaObject((JSONObject)wvpRedisMsg.getContent(), WVPResult.class); WVPResult wvpResult = JSON.to(WVPResult.class, wvpRedisMsg.getContent());
String serial = wvpRedisMsg.getSerial(); String serial = wvpRedisMsg.getSerial();
switch (wvpResult.getCode()) { switch (wvpResult.getCode()) {
case 0: case 0:
@ -199,6 +199,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
default: default:
break; break;
} }
} }
}catch (Exception e) { }catch (Exception e) {
logger.warn("[RedisGbPlayMsg] 发现未处理的异常, {}",e.getMessage()); logger.warn("[RedisGbPlayMsg] 发现未处理的异常, {}",e.getMessage());