From 35a5230ef73f27fb71f28de813faf2337e3cf2a5 Mon Sep 17 00:00:00 2001 From: Rushdi Date: Tue, 17 May 2022 22:45:40 +0530 Subject: [PATCH] Fix admin login to tracker --- .../mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java | 1 + .../core/traccar/api/service/addons/TraccarClientImpl.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java index 572cdcf8845..9d9448653a1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -476,6 +476,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { JSONObject obj = new JSONObject(DeviceAPIClientServiceImpl.returnUser(currentUser)); log.info("================="); + log.info(currentUser); log.info(obj.toString()); log.info("=================="); if(obj.has("error")){ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java index 1beba4a859a..7b3458bbcf3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java @@ -176,7 +176,9 @@ public class TraccarClientImpl implements TraccarClient { traccarUser.setId(obj.getInt("id")); traccarUser.setName(obj.getString("name")); - traccarUser.setLogin(obj.getString("login")); + if(!obj.isNull("login")){ + traccarUser.setLogin(obj.getString("login")); + } traccarUser.setEmail(obj.getString("email")); traccarUser.setDeviceLimit(obj.getInt("deviceLimit")); traccarUser.setUserLimit(obj.getInt("userLimit"));