From 9b21fba871d5dc1698024f251c52d47b5ab0e966 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 27 Jan 2022 10:39:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E6=9E=90xml=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=9B=9E=E5=A4=8D400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/impl/message/MessageRequestProcessor.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 bd053446..ba95cf6a 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 @@ -77,7 +77,14 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()).response(eventResult); }; }else { - Element rootElement = getRootElement(evt); + Element rootElement = null; + try { + rootElement = getRootElement(evt); + } catch (DocumentException e) { + logger.warn("解析XML消息内容异常", e); + // 不存在则回复404 + responseAck(evt, Response.BAD_REQUEST, e.getMessage()); + } String name = rootElement.getName(); IMessageHandler messageHandler = messageHandlerMap.get(name); if (messageHandler != null) { @@ -98,8 +105,6 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement logger.warn("参数无效", e); } catch (ParseException e) { logger.warn("SIP回复时解析异常", e); - } catch (DocumentException e) { - logger.warn("解析XML消息内容异常", e); } }