summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshikha0203 <shivani.khare@est.tech>2023-02-20 12:05:39 +0000
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-02-20 19:05:53 +0000
commit4d30459c104228021dc7a6170378773c90fc9857 (patch)
tree594bb2cef18a33862bc33d5bd46db533dc9cc523
parent898808c3bb6646f2374685c1cc33383928a34a30 (diff)
Fix ConfigurationImpl- Add null test before using nullable values
Issue-ID: SDC-4402 Signed-off-by: shikha0203 <shivani.khare@est.tech> Change-Id: I38efdeffadb4627e059e7827f15dc39de6b753cd
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
index 964b8d1a2d..46a4c43b5b 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
@@ -35,6 +35,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Predicate;
import java.util.stream.Collectors;
+
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.onap.config.ConfigurationUtils;
import org.onap.config.Constants;
@@ -204,8 +205,8 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
namespace = tenantNamespaceArray[1];
}
}
- tenant = ConfigurationRepository.lookup().isValidTenant(tenant) ? tenant.toUpperCase() : Constants.DEFAULT_TENANT;
- namespace = ConfigurationRepository.lookup().isValidNamespace(namespace) ? namespace.toUpperCase() : Constants.DEFAULT_NAMESPACE;
+ tenant = tenant != null && ConfigurationRepository.lookup().isValidTenant(tenant) ? tenant.toUpperCase() : Constants.DEFAULT_TENANT;
+ namespace = namespace != null && ConfigurationRepository.lookup().isValidNamespace(namespace) ? namespace.toUpperCase() : Constants.DEFAULT_NAMESPACE;
hints = hints == null || hints.length == 0 ? new Hint[]{Hint.EXTERNAL_LOOKUP, Hint.NODE_SPECIFIC} : hints;
T returnValue;
returnValue = getInternal(tenant, namespace, key, clazz, hints);