diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java index ac39dd65..dc7689c9 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java @@ -101,6 +101,10 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements try { HandlerCatchData take = taskQueue.poll(); Element rootElement = getRootElement(take.getEvt()); + if (rootElement == null) { + logger.error("处理NOTIFY消息时未获取到消息体,{}", take.getEvt().getRequest()); + continue; + } String cmd = XmlUtil.getText(rootElement, "CmdType"); if (CmdType.CATALOG.equals(cmd)) { @@ -142,6 +146,10 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements // 回复 200 OK Element rootElement = getRootElement(evt); + if (rootElement == null) { + logger.error("处理MobilePosition移动位置Notify时未获取到消息体,{}", evt.getRequest()); + return; + } MobilePosition mobilePosition = new MobilePosition(); mobilePosition.setCreateTime(DateUtil.getNow()); @@ -229,6 +237,10 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); Element rootElement = getRootElement(evt); + if (rootElement == null) { + logger.error("处理alarm设备报警Notify时未获取到消息体{}", evt.getRequest()); + return; + } Element deviceIdElement = rootElement.element("DeviceID"); String channelId = deviceIdElement.getText().toString(); @@ -239,7 +251,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements } rootElement = getRootElement(evt, device.getCharset()); if (rootElement == null) { - logger.warn("[ NotifyAlarm ] content cannot be null"); + logger.warn("[ NotifyAlarm ] content cannot be null, {}", evt.getRequest()); return; } DeviceAlarm deviceAlarm = new DeviceAlarm(); @@ -338,7 +350,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements } Element rootElement = getRootElement(evt, device.getCharset()); if (rootElement == null) { - logger.warn("[ 收到目录订阅 ] content cannot be null"); + logger.warn("[ 收到目录订阅 ] content cannot be null, {}", evt.getRequest()); return; } Element deviceListElement = rootElement.element("DeviceList"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java index d9d94797..13cc1b66 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java @@ -84,6 +84,10 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme Request request = evt.getRequest(); try { Element rootElement = getRootElement(evt); + if (rootElement == null) { + logger.error("处理SUBSCRIBE请求 未获取到消息体{}", evt.getRequest()); + return; + } String cmd = XmlUtil.getText(rootElement, "CmdType"); if (CmdType.MOBILE_POSITION.equals(cmd)) { processNotifyMobilePosition(evt, rootElement); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java index e004b89f..83571a0d 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java @@ -108,6 +108,11 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement Element rootElement = null; try { rootElement = getRootElement(evt); + if (rootElement == null) { + logger.error("处理SUBSCRIBE请求 未获取到消息体{}", evt.getRequest()); + responseAck(evt, Response.BAD_REQUEST, "content is null"); + return; + } } catch (DocumentException e) { logger.warn("解析XML消息内容异常", e); // 不存在则回复404 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java index a061eb6a..56da4711 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java @@ -63,7 +63,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen try { rootElement = getRootElement(evt, device.getCharset()); if (rootElement == null) { - logger.warn("[ 移动设备位置数据通知 ] content cannot be null"); + logger.warn("[ 移动设备位置数据通知 ] content cannot be null, {}", evt.getRequest()); responseAck(evt, Response.BAD_REQUEST); return; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java index e7d8d341..be01fd70 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java @@ -96,7 +96,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp try { Element rootElement = getRootElement(take.getEvt(), take.getDevice().getCharset()); if (rootElement == null) { - logger.warn("[ 收到通道 ] content cannot be null"); + logger.warn("[ 收到通道 ] content cannot be null, {}", evt.getRequest()); continue; } Element deviceListElement = rootElement.element("DeviceList"); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java index c6d029f7..78ba61a9 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java @@ -76,7 +76,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent try { rootElement = getRootElement(evt, device.getCharset()); if (rootElement == null) { - logger.warn("[ 接收到DeviceInfo应答消息 ] content cannot be null"); + logger.warn("[ 接收到DeviceInfo应答消息 ] content cannot be null, {}", evt.getRequest()); responseAck(evt, Response.BAD_REQUEST); return; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java index 9923f7c2..b6643e38 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java @@ -66,7 +66,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar try { rootElement = getRootElement(evt, device.getCharset()); if (rootElement == null) { - logger.warn("[ 移动设备位置数据查询回复 ] content cannot be null"); + logger.warn("[ 移动设备位置数据查询回复 ] content cannot be null, {}", evt.getRequest()); responseAck(evt, Response.BAD_REQUEST); return; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java index df4dccff..0ed119ee 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/PresetQueryResponseMessageHandler.java @@ -53,7 +53,7 @@ public class PresetQueryResponseMessageHandler extends SIPRequestProcessorParent try { rootElement = getRootElement(evt, device.getCharset()); if (rootElement == null) { - logger.warn("[ 设备预置位查询应答 ] content cannot be null"); + logger.warn("[ 设备预置位查询应答 ] content cannot be null, {}", evt.getRequest()); responseAck(evt, Response.BAD_REQUEST); return; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java index 480ea738..20203ca5 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java @@ -81,7 +81,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent HandlerCatchData take = taskQueue.poll(); Element rootElementForCharset = getRootElement(take.getEvt(), take.getDevice().getCharset()); if (rootElement == null) { - logger.warn("[ 国标录像 ] content cannot be null"); + logger.warn("[ 国标录像 ] content cannot be null, {}", evt.getRequest()); continue; } String sn = getText(rootElementForCharset, "SN");