summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2017-12-27 20:08:14 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-27 15:40:27 +0000
commit41d4138163cdda10ff298d7ff3eebf885221b0c3 (patch)
treeb4b6b21ff6aeeea6a40af492a933acb961eb9e6b
parent10e959f6ccf947b1f6333a643ad215749e1c16dd (diff)
Fix Sonar violations - AggregateConfiguration
1. Fixed major sonar violations configuration management core - AggregateConfiguration Change-Id: I311d0e84fbfaf936ec1a260898e0cc0090e05be9 Issue-ID: SDC-343 Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java
index de5a189775..e67de752ec 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java
@@ -24,10 +24,18 @@ public final class AggregateConfiguration {
private Map<String, Configuration> mergeConfig = new HashMap<>();
private Map<String, Configuration> overrideConfig = new LinkedHashMap<>();
- {
- if (!Thread.currentThread().getStackTrace()[2].getClassName()
- .equals(ConfigurationImpl.class.getName())) {
- throw new RuntimeException("Illegal access.");
+ /**
+ * Instantiates a new Aggregate configuration.
+ */
+ public AggregateConfiguration() {
+ try {
+ Class clazz = Class.forName(Thread.currentThread().getStackTrace()[2].getClassName());
+ if (!clazz.getCanonicalName()
+ .equals(ConfigurationImpl.class.getCanonicalName())) {
+ throw new RuntimeException("Illegal access.");
+ }
+ } catch (ClassNotFoundException cfe) {
+ throw new RuntimeException("Class not found while loading change notifier");
}
}