From 41d4138163cdda10ff298d7ff3eebf885221b0c3 Mon Sep 17 00:00:00 2001 From: ojasdubey Date: Wed, 27 Dec 2017 20:08:14 +0530 Subject: Fix Sonar violations - AggregateConfiguration 1. Fixed major sonar violations configuration management core - AggregateConfiguration Change-Id: I311d0e84fbfaf936ec1a260898e0cc0090e05be9 Issue-ID: SDC-343 Signed-off-by: ojasdubey --- .../openecomp/config/impl/AggregateConfiguration.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'common') 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 mergeConfig = new HashMap<>(); private Map 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"); } } -- cgit 1.2.3-korg