Преглед изворни кода

兼容Message缺少消息的异常,回复400错误码

648540858 пре 1 година
родитељ
комит
3ba473776f

+ 5 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java

@@ -12,6 +12,7 @@ import org.dom4j.DocumentException;
 import org.dom4j.Element;
 import org.dom4j.io.SAXReader;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ObjectUtils;
 
 import javax.sip.*;
 import javax.sip.address.Address;
@@ -171,7 +172,10 @@ public abstract class SIPRequestProcessorParent {
 	public Element getRootElement(RequestEvent evt, String charset) throws DocumentException {
 
 		byte[] rawContent = evt.getRequest().getRawContent();
-		if (rawContent == null) {
+		if (evt.getRequest().getContentLength().getContentLength() == 0
+				|| rawContent == null
+				|| rawContent.length == 0
+				|| ObjectUtils.isEmpty(new String(rawContent))) {
 			return null;
 		}