From ae052d5d84e06dbfe8fb951ce16387bc2c02bdc0 Mon Sep 17 00:00:00 2001 From: Oleg Mitsura Date: Fri, 13 Dec 2019 16:46:50 -0500 Subject: add logging to value not found from properties Issue-ID: CCSDK-1995 rev1: commit rev2: formatting rev3: cleanup rev4: review comment from Brinda Signed-off-by: Oleg Mitsura Change-Id: I5a575dad5191b72934667d2c4e965882ccc2a905 --- .../blueprintsprocessor/core/BluePrintCoreConfiguration.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ms/blueprintsprocessor') diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt index 76b37a5b4..95b2c0154 100644 --- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt @@ -17,7 +17,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.core +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration +import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService import org.slf4j.LoggerFactory import org.springframework.beans.factory.annotation.Autowired @@ -60,9 +62,16 @@ open class BluePrintPropertyConfiguration { @Service open class BluePrintPropertiesService(private var bluePrintPropertyBinder: Binder) { + private val log = logger(BluePrintPropertiesService::class) fun propertyBeanType(prefix: String, type: Class): T { - return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get() + return try { + bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get() + } catch (e: NoSuchElementException) { + val errMsg = "Error: missing property \"$prefix\"... Check the application.properties file." + log.error(errMsg) + throw BluePrintProcessorException(e, errMsg) + } } } -- cgit 1.2.3-korg