diff options
author | ojasdubey <ojas.dubey@amdocs.com> | 2017-12-27 20:08:14 +0530 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2017-12-27 15:40:27 +0000 |
commit | 41d4138163cdda10ff298d7ff3eebf885221b0c3 (patch) | |
tree | b4b6b21ff6aeeea6a40af492a933acb961eb9e6b /common/openecomp-common-configuration-management/openecomp-configuration-management-core | |
parent | 10e959f6ccf947b1f6333a643ad215749e1c16dd (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>
Diffstat (limited to 'common/openecomp-common-configuration-management/openecomp-configuration-management-core')
-rw-r--r-- | common/openecomp-common-configuration-management/openecomp-configuration-management-core/src/main/java/org/openecomp/config/impl/AggregateConfiguration.java | 16 |
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"); } } |