aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java23
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java3
2 files changed, 12 insertions, 14 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java
index b9d03f4d1a..15b9f8c1c8 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/FactoriesConfigImpl.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* Licensed 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.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.core.factory;
@@ -24,6 +20,7 @@ package org.openecomp.core.factory;
import org.openecomp.core.factory.api.FactoriesConfiguration;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.common.errors.SdcConfigurationException;
import java.io.IOException;
import java.io.InputStream;
@@ -36,7 +33,7 @@ public final class FactoriesConfigImpl implements FactoriesConfiguration {
private static final String FACTORY_CONFIG_FILE_NAME = "factoryConfiguration.json";
- private static Map factoryMap = new HashMap();
+ private static final Map FACTORY_MAP = new HashMap();
private static boolean initialized = false;
@SuppressWarnings("unchecked")
@@ -48,7 +45,7 @@ public final class FactoriesConfigImpl implements FactoriesConfiguration {
initialized = true;
}
}
- return factoryMap;
+ return FACTORY_MAP;
}
private void init() {
@@ -57,9 +54,9 @@ public final class FactoriesConfigImpl implements FactoriesConfiguration {
for (URL factoryConfigUrl : factoryConfigUrlList) {
try (InputStream stream = factoryConfigUrl.openStream()) {
- factoryMap.putAll(JsonUtil.json2Object(stream, Map.class));
+ FACTORY_MAP.putAll(JsonUtil.json2Object(stream, Map.class));
} catch (IOException e) {
- throw new RuntimeException(e);
+ throw new SdcConfigurationException("Failed to initialize Factory from '" + factoryConfigUrl.getPath() +"'", e);
}
}
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java
index 102c6db572..24f71e7953 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-facade-lib/openecomp-facade-core/src/main/java/org/openecomp/core/factory/api/AbstractComponentFactory.java
@@ -16,6 +16,7 @@
package org.openecomp.core.factory.api;
+import org.apache.commons.lang3.StringUtils;
import org.openecomp.core.factory.FactoryConfig;
import org.openecomp.core.factory.impl.AbstractFactoryBase;
import org.openecomp.core.utilities.CommonMethods;
@@ -66,7 +67,7 @@ public abstract class AbstractComponentFactory<I> extends AbstractFactory<I> {
String abstractClassName = entry.getKey();
String concreteTypeName = entry.getValue();
- if (CommonMethods.isEmpty(concreteTypeName)) {
+ if (StringUtils.isEmpty(concreteTypeName)) {
throw new CoreException(
new ErrorCode.ErrorCodeBuilder().withId("E0003")
.withMessage("Missing configuration value:" + concreteTypeName + ".")