From 354dcd3fd4ba9cf7f9da5bce006c5f6320b82c3e Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 10 Oct 2019 15:55:03 +0530 Subject: [PATCH] Add null and empty check for device location related values --- .../mgt/core/service/DeviceManagementProviderServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 0e52285893..3be6900f90 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -3271,7 +3271,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv 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.setDeviceId(device.getId()); deviceLocation.setDeviceIdentifier(new DeviceIdentifier(device.getDeviceIdentifier(),