Add null and empty check for device location related values

This commit is contained in:
Saad Sahibjan 2019-10-10 15:55:03 +05:30
parent 7072052381
commit 354dcd3fd4

View File

@ -3271,7 +3271,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
distance = p.getValue(); distance = p.getValue();
} }
} }
if (latitude != null && longitude != null && !latitude.isEmpty() && !longitude.isEmpty()) { if (StringUtils.isNotBlank(latitude) && StringUtils.isNotBlank(longitude) &&
StringUtils.isNotBlank(altitude) && StringUtils.isNotBlank(speed) &&
StringUtils.isNotBlank(bearing) && StringUtils.isNotBlank(distance)) {
DeviceLocation deviceLocation = new DeviceLocation(); DeviceLocation deviceLocation = new DeviceLocation();
deviceLocation.setDeviceId(device.getId()); deviceLocation.setDeviceId(device.getId());
deviceLocation.setDeviceIdentifier(new DeviceIdentifier(device.getDeviceIdentifier(), deviceLocation.setDeviceIdentifier(new DeviceIdentifier(device.getDeviceIdentifier(),