From 3156b927005ee7e6630f01c7598c0cf04370ba98 Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 15 Dec 2015 17:37:36 +0530 Subject: [PATCH] Fixing issue with agent download --- .../carbon/device/mgt/iot/apimgt/ApisAppClient.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/apimgt/ApisAppClient.java b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/apimgt/ApisAppClient.java index ec6a65f9d4..b1cc3ddb6a 100644 --- a/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/apimgt/ApisAppClient.java +++ b/components/device-mgt-iot/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/apimgt/ApisAppClient.java @@ -162,8 +162,14 @@ public class ApisAppClient { JSONObject object = jsonSubscriptions.getJSONObject(n); String appName = object.getString("name"); - String prodConsumerKey = object.getString("prodConsumerKey"); - String prodConsumerSecret = object.getString("prodConsumerSecret"); + String prodConsumerKey = null; + String prodConsumerSecret = null; + if(!object.get("prodConsumerKey").equals(null)) { + prodConsumerKey = object.getString("prodConsumerKey"); + } + if(!object.get("prodConsumerSecret").equals(null)) { + prodConsumerSecret = object.getString("prodConsumerSecret"); + } subscriptionMap.put(appName, new String(Base64.encodeBase64( (prodConsumerKey + ":" + prodConsumerSecret).getBytes()))); }