From 45969a00b74b5a240c0dc6e2c37f5381cd0cb65f Mon Sep 17 00:00:00 2001
From: lawrencehj <1934378145@qq.com>
Date: 星期四, 26 八月 2021 23:57:38 +0800
Subject: [PATCH] 修正设备注册认证时验证Response计算的错误

---
 src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
index c82ba60..4220d81 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/XmlUtil.java
@@ -17,6 +17,7 @@
 import org.dom4j.io.SAXReader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.util.StringUtils;
 
 /**
  * 鍩轰簬dom4j鐨勫伐鍏峰寘
@@ -114,12 +115,12 @@
         // 濡傛灉鏄睘鎬�
         for (Object o : element.attributes()) {
             Attribute attr = (Attribute) o;
-            if (!isEmpty(attr.getValue())) {
+            if (!StringUtils.isEmpty(attr.getValue())) {
                 json.put("@" + attr.getName(), attr.getValue());
             }
         }
         List<Element> chdEl = element.elements();
-        if (chdEl.isEmpty() && !isEmpty(element.getText())) {// 濡傛灉娌℃湁瀛愬厓绱�,鍙湁涓�涓��
+        if (chdEl.isEmpty() && !StringUtils.isEmpty(element.getText())) {// 濡傛灉娌℃湁瀛愬厓绱�,鍙湁涓�涓��
             json.put(element.getName(), element.getText());
         }
 
@@ -150,7 +151,7 @@
             } else { // 瀛愬厓绱犳病鏈夊瓙鍏冪礌
                 for (Object o : element.attributes()) {
                     Attribute attr = (Attribute) o;
-                    if (!isEmpty(attr.getValue())) {
+                    if (!StringUtils.isEmpty(attr.getValue())) {
                         json.put("@" + attr.getName(), attr.getValue());
                     }
                 }
@@ -159,12 +160,5 @@
                 }
             }
         }
-    }
-
-    public static boolean isEmpty(String str) {
-        if (str == null || str.trim().isEmpty() || "null".equals(str)) {
-            return true;
-        }
-        return false;
     }
 }

--
Gitblit v1.8.0