Commit e4e6209835eaae8eab9e6210f3bdf52b23de4c7a
1 parent
33b51c40
修正处理Catalog信息时遇到空字段的错误
Showing
1 changed file
with
21 additions
and
6 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
| ... | ... | @@ -215,12 +215,27 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
| 215 | 215 | deviceChannel.setPort(itemDevice.element("Port") == null ? 0 |
| 216 | 216 | : Integer.parseInt(XmlUtil.getText(itemDevice, "Port"))); |
| 217 | 217 | deviceChannel.setPassword(XmlUtil.getText(itemDevice, "Password")); |
| 218 | - deviceChannel.setLongitude(itemDevice.element("Longitude") == null ? 0.00 | |
| 219 | - : Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude"))); | |
| 220 | - deviceChannel.setLatitude(itemDevice.element("Latitude") == null ? 0.00 | |
| 221 | - : Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude"))); | |
| 222 | - deviceChannel.setPTZType(itemDevice.element("PTZType") == null ? 0 | |
| 223 | - : Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType"))); | |
| 218 | + if (itemDevice.element("Longitute")==null) { | |
| 219 | + deviceChannel.setLongitude(0.00); | |
| 220 | + } else { | |
| 221 | + deviceChannel.setLongitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude"))); | |
| 222 | + } | |
| 223 | + if (itemDevice.element("Latitute") == null) { | |
| 224 | + deviceChannel.setLatitude(0.00); | |
| 225 | + } else { | |
| 226 | + deviceChannel.setLatitude(Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude"))); | |
| 227 | + } | |
| 228 | + if (itemDevice.element("PTZType") == null) { | |
| 229 | + deviceChannel.setPTZType(0); | |
| 230 | + } else { | |
| 231 | + deviceChannel.setPTZType(Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType"))); | |
| 232 | + } | |
| 233 | + // deviceChannel.setLongitude(itemDevice.element("Longitude") == null ? 0.00 | |
| 234 | + // : Double.parseDouble(XmlUtil.getText(itemDevice, "Longitude"))); | |
| 235 | + // deviceChannel.setLatitude(itemDevice.element("Latitude") == null ? 0.00 | |
| 236 | + // : Double.parseDouble(XmlUtil.getText(itemDevice, "Latitude"))); | |
| 237 | + // deviceChannel.setPTZType(itemDevice.element("PTZType") == null ? 0 | |
| 238 | + // : Integer.parseInt(XmlUtil.getText(itemDevice, "PTZType"))); | |
| 224 | 239 | deviceChannel.setHasAudio(true); // 默认含有音频,播放时再检查是否有音频及是否AAC |
| 225 | 240 | storager.updateChannel(device.getDeviceId(), deviceChannel); |
| 226 | 241 | } | ... | ... |