From 3b9ae200e77b82a3b28cc8d8d44dc35e14dcc525 Mon Sep 17 00:00:00 2001 From: kamidu Date: Thu, 23 Mar 2017 14:12:12 +0530 Subject: [PATCH] fixing posible null pointer excep --- .../modules/business-controllers/device.js | 29 ++++++++++--------- .../cdmf.page.roles/public/js/role-listing.js | 1 - 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index 1da093d61d..0138c57897 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -194,25 +194,26 @@ deviceModule = function () { } if (device["deviceInfo"]) { filteredDeviceData["latestDeviceInfo"] = device["deviceInfo"]; - } - //location related verification and modifications - // adding the location histry for the movement path. - var locationHistory = {}; - locationHistory.locations = locationData; - locationHistory.times = locationTimeData; - filteredDeviceData["locationHistory"] = locationHistory; + //location related verification and modifications + // adding the location histry for the movement path. + var locationHistory = {}; + locationHistory.locations = locationData; + locationHistory.times = locationTimeData; + filteredDeviceData["locationHistory"] = locationHistory; - //checking for the latest location information. - if (filteredDeviceData.latestDeviceInfo.location && locationInfo) { - var infoDate = new Date(filteredDeviceData.latestDeviceInfo.location.updatedTime); - var locationDate = new Date(locationInfo.updatedOn); - if (infoDate < locationDate) { - filteredDeviceData.latestDeviceInfo.location.longitude = locationInfo.longitude; - filteredDeviceData.latestDeviceInfo.location.latitude = locationInfo.latitude; + //checking for the latest location information. + if (filteredDeviceData.latestDeviceInfo.location && locationInfo) { + var infoDate = new Date(filteredDeviceData.latestDeviceInfo.location.updatedTime); + var locationDate = new Date(locationInfo.updatedOn); + if (infoDate < locationDate) { + filteredDeviceData.latestDeviceInfo.location.longitude = locationInfo.longitude; + filteredDeviceData.latestDeviceInfo.location.latitude = locationInfo.latitude; + } } } + response["content"] = filteredDeviceData; response["status"] = "success"; return response; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js index 88db2cbbb9..516aacb7b5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js @@ -98,7 +98,6 @@ function loadRoles() { var dataFilter = function (data) { data = JSON.parse(data); - console.log(data); var objects = []; var count = 0; $(data.roles).each(function (index) {