diff --git a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoServiceImpl.java b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoServiceImpl.java index a961f6369..e71c9290e 100644 --- a/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoServiceImpl.java +++ b/components/iot-plugins/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/src/main/java/org/wso2/carbon/device/mgt/iot/arduino/service/impl/ArduinoServiceImpl.java @@ -139,9 +139,7 @@ public class ArduinoServiceImpl implements ArduinoService { return Response.status(Response.Status.ACCEPTED.getStatusCode()).entity(result).build(); } catch (NoSuchElementException ex) { result = "There are no more controls for device " + deviceId + " of owner " + owner; - if (log.isDebugEnabled()) { - log.debug(result); - } + log.error(result, ex); return Response.status(Response.Status.NO_CONTENT.getStatusCode()).entity(result).build(); } } diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/ContentTransformer.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/ContentTransformer.java index 867783486..2cad36be5 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/ContentTransformer.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/ContentTransformer.java @@ -1,3 +1,21 @@ +/* +* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + package org.wso2.carbon.device.mgt.iot.input.adapter.extension; import java.util.Map; diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/DefaultContentTransformer.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/DefaultContentTransformer.java index d4b67e588..c8c5ab198 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/DefaultContentTransformer.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/DefaultContentTransformer.java @@ -1,3 +1,21 @@ +/* +* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + package org.wso2.carbon.device.mgt.iot.input.adapter.extension; import java.util.Map; diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/DefaultContentValidator.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/DefaultContentValidator.java index c84375f56..6a41bc270 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/DefaultContentValidator.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.extension/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/extension/DefaultContentValidator.java @@ -1,3 +1,21 @@ +/* +* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + package org.wso2.carbon.device.mgt.iot.input.adapter.extension; import java.util.Map; diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/mqtt/util/PropertyUtils.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/mqtt/util/PropertyUtils.java index 5e511de3e..d1cbbcc94 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/mqtt/util/PropertyUtils.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/iot/input/adapter/mqtt/util/PropertyUtils.java @@ -42,7 +42,7 @@ public class PropertyUtils { ServerConfiguration carbonConfig = ServerConfiguration.getInstance(); String portOffset = System.getProperty("portOffset", carbonConfig.getFirstProperty(CARBON_CONFIG_PORT_OFFSET)); try { - if ((portOffset != null)) { + if (portOffset != null) { return Integer.parseInt(portOffset.trim()); } else { return CARBON_DEFAULT_PORT_OFFSET; diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/SuperTenantSubscriptionEndpoint.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/SuperTenantSubscriptionEndpoint.java index f2556ca95..da26bb1d7 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/SuperTenantSubscriptionEndpoint.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/SuperTenantSubscriptionEndpoint.java @@ -78,7 +78,7 @@ public class SuperTenantSubscriptionEndpoint extends SubscriptionEndpoint { try { session.close(new CloseReason(CloseReason.CloseCodes.CANNOT_ACCEPT, "Unauthorized Access")); } catch (IOException e) { - log.error("Failed to disconnect the unauthorized client."); + log.error("Failed to disconnect the unauthorized client.", e); } } } diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/TenantSubscriptionEndpoint.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/TenantSubscriptionEndpoint.java index a4ca1da4b..58a3e2d82 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/TenantSubscriptionEndpoint.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/TenantSubscriptionEndpoint.java @@ -77,7 +77,7 @@ public class TenantSubscriptionEndpoint extends SubscriptionEndpoint { try { session.close(new CloseReason(CloseReason.CloseCodes.CANNOT_ACCEPT, "Unauthorized Access")); } catch (IOException e) { - log.error("Failed to disconnect the unauthorized client."); + log.error("Failed to disconnect the unauthorized client.", e); } } } @@ -92,7 +92,8 @@ public class TenantSubscriptionEndpoint extends SubscriptionEndpoint { @OnMessage public void onMessage (Session session, String message, @PathParam("streamname") String streamName, @PathParam("tdomain") String tdomain) { if (log.isDebugEnabled()) { - log.debug("Received and dropped message from client. Message: " + message+", for Session id: "+session.getId()+", for tenant domain"+tdomain+", for the Adaptor:"+streamName); + log.debug("Received and dropped message from client. Message: " + message + ", for Session id: " + + session.getId() + ", for tenant domain" + tdomain + ", for the Adaptor:" + streamName); } } diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/util/ServiceHolder.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/util/ServiceHolder.java index 0f6d81df5..755fcd7df 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/util/ServiceHolder.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/util/ServiceHolder.java @@ -18,9 +18,9 @@ public class ServiceHolder { .getThreadLocalCarbonContext().getOSGiService(UIOutputCallbackControllerService.class, null); } - public synchronized static ServiceHolder getInstance(){ - if (instance==null){ - instance= new ServiceHolder(); + public synchronized static ServiceHolder getInstance() { + if (instance == null) { + instance = new ServiceHolder(); } return instance; } diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/util/UIConstants.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/util/UIConstants.java index 2db13ce81..162fc34ce 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/util/UIConstants.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui.endpoint/src/main/java/util/UIConstants.java @@ -1,34 +1,31 @@ /* - * - * * - * * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * * - * * WSO2 Inc. licenses this file to you under the Apache License, - * * Version 2.0 (the "License"); you may not use this file except - * * in compliance with the License. - * * You may obtain a copy of the License at - * * - * * http://www.apache.org/licenses/LICENSE-2.0 - * * - * * Unless required by applicable law or agreed to in writing, - * * software distributed under the License is distributed on an - * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * * KIND, either express or implied. See the License for the - * * specific language governing permissions and limitations - * * under the License. - * * - * - */ +* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ package util; /** * This class contains the constants related to ui client. */ -public class UIConstants { +public final class UIConstants { private UIConstants() { } + public static final String ADAPTER_UI_COLON = ":"; public static final String MAXIMUM_TOTAL_HTTP_CONNECTION = "maximumTotalHttpConnection"; public static final String MAXIMUM_HTTP_CONNECTION_PER_HOST = "maximumHttpConnectionPerHost"; diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/UIEventAdapter.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/UIEventAdapter.java index d92bc406f..807396aac 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/UIEventAdapter.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/UIEventAdapter.java @@ -1,5 +1,4 @@ /* - * * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, @@ -78,7 +77,6 @@ public class UIEventAdapter implements OutputEventAdapter { @Override public void init() throws OutputEventAdapterException { - tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); //ExecutorService will be assigned if it is null @@ -198,7 +196,6 @@ public class UIEventAdapter implements OutputEventAdapter { @Override public void publish(Object message, Map dynamicProperties) { - Event event = (Event) message; StringBuilder eventBuilder = new StringBuilder("["); @@ -275,7 +272,6 @@ public class UIEventAdapter implements OutputEventAdapter { @Override public void destroy() { - int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); ConcurrentHashMap tenantSpecificAdapterMap = UIEventAdaptorServiceDataHolder diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/authentication/oauth/OAuthTokenValdiator.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/authentication/oauth/OAuthTokenValdiator.java index 9532f6dcd..5587293fb 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/authentication/oauth/OAuthTokenValdiator.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/authentication/oauth/OAuthTokenValdiator.java @@ -72,7 +72,8 @@ public class OAuthTokenValdiator { Properties properties = getWebSocketConfig(); this.stubs = new GenericObjectPool(new OAuthTokenValidaterStubFactory(properties)); } catch (IOException e) { - log.error("Failed to parse the web socket org.wso2.carbon.device.mgt.iot.output.adapter.ui.config file " + WEBSOCKET_CONFIG_LOCATION); + log.error("Failed to parse the web socket org.wso2.carbon.device.mgt.iot.output.adapter.ui.config file " + + WEBSOCKET_CONFIG_LOCATION, e); } } diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/authentication/oauth/OAuthTokenValidaterStubFactory.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/authentication/oauth/OAuthTokenValidaterStubFactory.java index d791af42a..10f056e4c 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/authentication/oauth/OAuthTokenValidaterStubFactory.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/authentication/oauth/OAuthTokenValidaterStubFactory.java @@ -30,6 +30,8 @@ import org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory; import org.apache.commons.httpclient.params.HttpConnectionManagerParams; import org.apache.commons.httpclient.protocol.Protocol; import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.BasePoolableObjectFactory; import org.apache.log4j.Logger; import org.wso2.carbon.device.mgt.iot.output.adapter.ui.authentication.oauth.exception.OAuthTokenValidationException; @@ -46,7 +48,7 @@ import java.util.Properties; * This follows object pool pattern to manage the stub for oauth validation service. */ public class OAuthTokenValidaterStubFactory extends BasePoolableObjectFactory { - private static final Logger log = Logger.getLogger(OAuthTokenValidaterStubFactory.class); + private static final Log log = LogFactory.getLog(OAuthTokenValidaterStubFactory.class); private HttpClient httpClient; Properties tokenValidationProperties; diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/constants/WebsocketConstants.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/constants/WebsocketConstants.java index 9242e28f7..31a9f1dd4 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/constants/WebsocketConstants.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/constants/WebsocketConstants.java @@ -1,5 +1,4 @@ /* - * * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UIEventAdaptorServiceDataHolder.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UIEventAdaptorServiceDataHolder.java index dd0894985..024c0228e 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UIEventAdaptorServiceDataHolder.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UIEventAdaptorServiceDataHolder.java @@ -1,5 +1,4 @@ /* - * * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. licenses this file to you under the Apache License, @@ -31,10 +30,10 @@ import java.util.concurrent.LinkedBlockingDeque; public final class UIEventAdaptorServiceDataHolder { private static UIOutputCallbackControllerServiceImpl UIOutputCallbackRegisterServiceImpl; - private static ConcurrentHashMap> - tenantSpecificOutputEventStreamAdapterMap = new ConcurrentHashMap>(); + private static ConcurrentHashMap> + tenantSpecificOutputEventStreamAdapterMap = new ConcurrentHashMap<>(); private static ConcurrentHashMap>> - tenantSpecificStreamEventMap = new ConcurrentHashMap>>(); + tenantSpecificStreamEventMap = new ConcurrentHashMap<>(); private static EventStreamService eventStreamService; public static void registerEventStreamService(EventStreamService eventBuilderService) { diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UILocalEventAdapterServiceComponent.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UILocalEventAdapterServiceComponent.java index 71897510e..57d72b9ca 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UILocalEventAdapterServiceComponent.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.output.adapter.ui/src/main/java/org/wso2/carbon/device/mgt/iot/output/adapter/ui/internal/UILocalEventAdapterServiceComponent.java @@ -88,10 +88,13 @@ public class UILocalEventAdapterServiceComponent { } catch (WebsocketValidationConfigurationFailedException e) { log.error("Failed to initialize configuration for websocket.", e); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { - e.printStackTrace(); + log.error("Failed to initialize the class authentication and authorization given " + + "in the websocket validation configuration.", e); } } catch (RuntimeException e) { log.error("Can not create the output ui adapter service ", e); + } catch (Throwable e) { + log.error("Error occurred while activating UI Event Adapter Service Component", e); } } diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/devicetype/DeviceTypeConfigServiceImpl.java b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/devicetype/DeviceTypeConfigServiceImpl.java index 113015fce..fbdc9b37f 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/devicetype/DeviceTypeConfigServiceImpl.java +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot/src/main/java/org/wso2/carbon/device/mgt/iot/devicetype/DeviceTypeConfigServiceImpl.java @@ -34,7 +34,7 @@ public class DeviceTypeConfigServiceImpl implements DeviceTypeConfigService { String deviceType = deviceManagementConfiguration.getDeviceType(); String tenantDomain = deviceManagementConfiguration.getDeviceManagementConfigRepository() .getProvisioningConfig().getTenantDomain(); - if ( deviceType != null && !deviceType.isEmpty() && tenantDomain != null + if (deviceType != null && !deviceType.isEmpty() && tenantDomain != null && !tenantDomain.isEmpty()) { deviceTypeConfigurationMap.put(new DeviceTypeConfigIdentifier(deviceType, tenantDomain), deviceManagementConfiguration); diff --git a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppConfig.java b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppConfig.java index aed81d1e3..2ac57e0b8 100644 --- a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppConfig.java +++ b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/plugin/xmpp/XmppConfig.java @@ -45,7 +45,7 @@ public class XmppConfig { List properties = deviceManagementConfiguration.getPushNotificationConfig() .getProperties(); String provider = deviceManagementConfiguration.getPushNotificationConfig().getPushNotificationProvider(); - if (provider.equals("XMPP")) { + if ("XMPP".equals(provider)) { enabled = true; } if (enabled) {