【fix sonar】VXESocket文件

This commit is contained in:
梁琦涛
2023-03-09 09:34:38 +08:00
parent 151e8579af
commit 496e89aea1
@@ -93,7 +93,7 @@ public class VXESocket {
*/ */
public static void sendMessageTo(String userId, String message) { public static void sendMessageTo(String userId, String message) {
Collection<VXESocket> values = getUserPool(userId).values(); Collection<VXESocket> values = getUserPool(userId).values();
if (values.size() > 0) { if (!values.isEmpty()) {
for (VXESocket socketItem : values) { for (VXESocket socketItem : values) {
socketItem.sendMessage(message); socketItem.sendMessage(message);
} }
@@ -156,6 +156,7 @@ public class VXESocket {
log.info("【vxeSocket】有新的连接,总数为:" + socketPool.size()); log.info("【vxeSocket】有新的连接,总数为:" + socketPool.size());
} catch (Exception ignored) { } catch (Exception ignored) {
log.error("异常",ignored);
} }
} }
@@ -170,6 +171,7 @@ public class VXESocket {
log.info("【vxeSocket】连接断开,总数为:" + socketPool.size()); log.info("【vxeSocket】连接断开,总数为:" + socketPool.size());
} catch (Exception ignored) { } catch (Exception ignored) {
log.error("异常",ignored);
} }
} }
@@ -178,7 +180,6 @@ public class VXESocket {
*/ */
@OnMessage @OnMessage
public void onMessage(String message) { public void onMessage(String message) {
// log.info("【vxeSocket】onMessage:" + message);
JSONObject json; JSONObject json;
try { try {
json = JSON.parseObject(message); json = JSON.parseObject(message);