修复通道解析可能的空指针异常

2.6.8
648540858 2024-03-05 14:39:57 +08:00
parent ebeaee419f
commit 9828063bb0
4 changed files with 16 additions and 1 deletions

View File

@ -104,7 +104,10 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
event = eventElement.getText().toUpperCase();
}
DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, event, civilCodeFileConf);
if (channel == null) {
logger.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
continue;
}
channel.setDeviceId(device.getDeviceId());
logger.info("[收到目录订阅]{}/{}", device.getDeviceId(), channel.getChannelId());
switch (event) {

View File

@ -408,6 +408,10 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
event = eventElement.getText().toUpperCase();
}
DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, event, civilCodeFileConf);
if (channel == null) {
logger.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
continue;
}
channel.setDeviceId(device.getDeviceId());
logger.info("[收到目录订阅]{}/{}", device.getDeviceId(), channel.getChannelId());
switch (event) {

View File

@ -113,6 +113,10 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
continue;
}
DeviceChannel deviceChannel = XmlUtil.channelContentHandler(itemDevice, device, null, civilCodeFileConf);
if (deviceChannel == null) {
logger.info("[收到通道]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
continue;
}
deviceChannel = SipUtils.updateGps(deviceChannel, device.getGeoCoordSys());
deviceChannel.setDeviceId(take.getDevice().getDeviceId());

View File

@ -170,6 +170,10 @@ public class SipUtils {
}
public static DeviceChannel updateGps(DeviceChannel deviceChannel, String geoCoordSys) {
if (deviceChannel == null) {
return null;
}
if (deviceChannel.getLongitude()*deviceChannel.getLatitude() > 0) {
if (geoCoordSys == null) {