修正处理Catalog信息时遇到空字段的错误

pull/1/head
Lawrence 2020-11-16 12:37:38 +08:00
parent 33b51c40dd
commit e4e6209835
1 changed files with 21 additions and 6 deletions

View File

@ -215,12 +215,27 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
deviceChannel.setPort(itemDevice.element("Port") == null ? 0 deviceChannel.setPort(itemDevice.element("Port") == null ? 0
: Integer.parseInt(XmlUtil.getText(itemDevice, "Port"))); : Integer.parseInt(XmlUtil.getText(itemDevice, "Port")));
deviceChannel.setPassword(XmlUtil.getText(itemDevice, "Password")); deviceChannel.setPassword(XmlUtil.getText(itemDevice, "Password"));
deviceChannel.setLongitude(itemDevice.element("Longitude") == null ? 0.00 if (itemDevice.element("Longitute")==null) {
: Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude"))); deviceChannel.setLongitude(0.00);
deviceChannel.setLatitude(itemDevice.element("Latitude") == null ? 0.00 } else {
: Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude"))); deviceChannel.setLongitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude")));
deviceChannel.setPTZType(itemDevice.element("PTZType") == null ? 0 }
: Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType"))); if (itemDevice.element("Latitute") == null) {
deviceChannel.setLatitude(0.00);
} else {
deviceChannel.setLatitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude")));
}
if (itemDevice.element("PTZType") == null) {
deviceChannel.setPTZType(0);
} else {
deviceChannel.setPTZType(Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType")));
}
// deviceChannel.setLongitude(itemDevice.element("Longitude") == null ? 0.00
// : Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude")));
// deviceChannel.setLatitude(itemDevice.element("Latitude") == null ? 0.00
// : Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude")));
// deviceChannel.setPTZType(itemDevice.element("PTZType") == null ? 0
// : Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType")));
deviceChannel.setHasAudio(true); // 默认含有音频播放时再检查是否有音频及是否AAC deviceChannel.setHasAudio(true); // 默认含有音频播放时再检查是否有音频及是否AAC
storager.updateChannel(device.getDeviceId(), deviceChannel); storager.updateChannel(device.getDeviceId(), deviceChannel);
} }