From b14ddd609a86df9dbb1289fcc99f1763d0096b4f Mon Sep 17 00:00:00 2001 From: ayyoob Date: Sat, 17 Jun 2017 18:54:39 +0530 Subject: [PATCH] fixing few issues after testing --- .../device/mgt/output/adapter/mqtt/MQTTEventAdapterFactory.java | 2 +- .../mgt/mqtt/authorization/DeviceAccessBasedMQTTAuthorizer.java | 2 +- .../mgt/mqtt/authorization/client/OAuthRequestInterceptor.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapterFactory.java b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapterFactory.java index b3351234f6..bc07e8621d 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapterFactory.java +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/output/adapter/mqtt/MQTTEventAdapterFactory.java @@ -84,7 +84,7 @@ public class MQTTEventAdapterFactory extends OutputEventAdapterFactory { clearSession.setDisplayName(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION)); clearSession.setRequired(false); clearSession.setOptions(new String[]{"true", "false"}); - clearSession.setDefaultValue("true"); + clearSession.setDefaultValue("false"); clearSession.setHint(resourceBundle.getString(MQTTEventAdapterConstants.ADAPTER_CONF_CLEAN_SESSION_HINT)); // set Quality of Service diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/DeviceAccessBasedMQTTAuthorizer.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/DeviceAccessBasedMQTTAuthorizer.java index 9d4e609d8d..7859a673f9 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/DeviceAccessBasedMQTTAuthorizer.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/DeviceAccessBasedMQTTAuthorizer.java @@ -133,7 +133,7 @@ public class DeviceAccessBasedMQTTAuthorizer implements IAuthorizer { return false; } catch (FeignException e) { oAuthRequestInterceptor.resetApiApplicationKey(); - if (e.getMessage().contains(GATEWAY_ERROR_CODE)) { + if (e.getMessage().contains(GATEWAY_ERROR_CODE) || e.status() == 404) { log.error("Failed to connect to the device authorization service."); } else { log.error(e.getMessage(), e); diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/client/OAuthRequestInterceptor.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/client/OAuthRequestInterceptor.java index d2917f59e8..4c098deb0c 100755 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/client/OAuthRequestInterceptor.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/mqtt/authorization/client/OAuthRequestInterceptor.java @@ -125,6 +125,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor { public void resetApiApplicationKey() { apiApplicationKey = null; + tokenIssuerService = null; } private static Client getSSLClient() {