diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/InvalidConfigurationException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/InvalidConfigurationException.java new file mode 100644 index 00000000000..2a8f9aca42c --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/InvalidConfigurationException.java @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2017, 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.application.mgt.common.exception; + +public class InvalidConfigurationException extends ApplicationManagementException { + + public InvalidConfigurationException(String message, Throwable throwable) { + super(message, throwable); + } + + public InvalidConfigurationException(String message) { + super(message); + } + +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java index b787e138b4a..5f740cab67f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java @@ -22,6 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; +import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil; import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagerConstants; import org.wso2.carbon.utils.CarbonUtils; @@ -71,7 +72,7 @@ public class ApplicationConfigurationManager { this.applicationManagerConfiguration = (ApplicationManagementConfigurations) unmarshaller.unmarshal(doc); } catch (Exception e) { log.error(e); - throw new ApplicationManagementException("Error occurred while initializing application config", e); + throw new InvalidConfigurationException("Error occurred while initializing application config", e); } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java index 7ebe51c65cb..850d972f04d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java @@ -41,11 +41,6 @@ public class ApplicationManagerImpl implements ApplicationManager { ConnectionManagerUtil.openConnection(); ApplicationDAO applicationDAO = ApplicationManagementDAOFactory.getApplicationDAO(); return applicationDAO.getApplications(filter); - } catch (ApplicationManagementDAOException e) { - throw new ApplicationManagementException("Error occurred while obtaining the applications for " + - "the given filter.", e); - } catch (DBConnectionException e) { - throw new ApplicationManagementException("Error occurred while opening a connection to the APPM data source", e); } finally { ConnectionManagerUtil.closeConnection(); } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java index dddc85ccf65..1afe85092a8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java @@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; +import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; import javax.xml.XMLConstants; @@ -54,7 +55,7 @@ public class ApplicationManagementUtil { factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); return docBuilder.parse(file); } catch (Exception e) { - throw new ApplicationManagementException("Error occurred while parsing file, while converting " + + throw new InvalidConfigurationException("Error occurred while parsing file, while converting " + "to a org.w3c.dom.Document : ", e); } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/pom.xml index 11a0a9f9e2a..d7895183a45 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/pom.xml @@ -75,21 +75,6 @@ - - - org.apache.maven.plugins - maven-surefire-plugin - 2.18 - - - file:src/test/resources/log4j.properties - - - src/test/resources/testng.xml - - - -