aboutsummaryrefslogtreecommitdiffstats
path: root/common-app-api/src
diff options
context:
space:
mode:
Diffstat (limited to 'common-app-api/src')
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java1
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java5
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java8
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java3
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java13
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java5
-rw-r--r--common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/WrapperTest.java2
7 files changed, 21 insertions, 16 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
index b0c377c778..383325c368 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
@@ -1574,6 +1574,7 @@ public class Configuration extends BasicConfiguration {
this.resourcesForUpgrade = resourcesForUpgrade;
}
+ @SuppressWarnings("unchecked")
public static <K,V> Map<K,V> safeGetCapsInsensitiveMap(Map<K,V> map) {
return map == null ? emptyMap() : new CaseInsensitiveMap(map);
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java b/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java
index 73358136b5..c29574dd1b 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java
@@ -33,6 +33,7 @@ import org.openecomp.sdc.common.http.client.api.HttpRequest;
import org.openecomp.sdc.common.http.client.api.HttpResponse;
import org.openecomp.sdc.common.http.config.HttpClientConfig;
import org.openecomp.sdc.common.http.config.Timeouts;
+import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.monitoring.MonitoringEvent;
import org.openecomp.sdc.common.monitoring.MonitoringMetricsFetcher;
@@ -99,10 +100,10 @@ public class BeMonitoringService {
HttpResponse<String> httpResponse = HttpRequest.post(redirectedUrl, myEntity, new HttpClientConfig(new Timeouts(timeout, timeout)));
int beResponseStatus = httpResponse.getStatusCode();
if (beResponseStatus != HttpStatus.SC_OK) {
- monitoringLogger.error("Unexpected HTTP response from BE : {}", beResponseStatus);
+ monitoringLogger.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Unexpected HTTP response from BE : {}", beResponseStatus);
}
} catch (Exception e) {
- monitoringLogger.error("Monitoring BE failed with exception ", e);
+ monitoringLogger.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Monitoring BE failed with exception ", e);
}
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java
index 3a7ccd774a..e243bac730 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.common.impl;
import org.apache.commons.jci.listeners.FileChangeListener;
import org.openecomp.sdc.common.api.BasicConfiguration;
import org.openecomp.sdc.common.api.ConfigurationListener;
+import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.util.YamlToObjectConverter;
@@ -64,12 +65,11 @@ public class ConfigFileChangeListener extends FileChangeListener {
BasicConfiguration basicConfiguration = yamlToObjectConverter.convert(pFile.getAbsolutePath(), configClass);
if (basicConfiguration == null) {
- log.warn("Cannot update the listeners for file Change since the file content is invalid");
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Cannot update the listeners for file Change since the file content is invalid");
continue;
}
log.debug("Loaded configuration after converting is {}", basicConfiguration);
- // System.out.println("New configuration is " +
- // basicConfiguration);
+
configurationListener.getCallBack().reconfigure(basicConfiguration);
@@ -77,7 +77,7 @@ public class ConfigFileChangeListener extends FileChangeListener {
}
} else {
- log.warn("Cannot calculate id from file {}", pFile.getName());
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Cannot calculate id from file {}", pFile.getName());
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
index fb9fb1c037..6703b91a60 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
@@ -22,6 +22,7 @@ package org.openecomp.sdc.common.rest.impl.validator;
import org.apache.commons.codec.binary.Base64;
import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
import org.openecomp.sdc.common.log.wrappers.Logger;
import javax.servlet.http.HttpServletRequest;
@@ -58,7 +59,7 @@ public class RequestHeadersValidator {
headersMap.put(requiredHeader, headerVal);
log.debug("found header - {} : {}", requiredHeader, headerVal);
} else {
- log.error("missing identification header: {}", requiredHeader);
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","missing identification header: {}", requiredHeader);
throw new RestRequestValidationException("missing identification header: " + requiredHeader);
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
index 93160330fd..af46140fc1 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
@@ -29,6 +29,7 @@ import org.openecomp.sdc.be.config.DistributionEngineConfiguration.CreateTopicCo
import org.openecomp.sdc.be.config.DistributionEngineConfiguration.DistributionNotificationTopicConfig;
import org.openecomp.sdc.be.config.DistributionEngineConfiguration.DistributionStatusTopicConfig;
import org.openecomp.sdc.be.config.validation.DeploymentArtifactHeatConfiguration;
+import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.fe.config.Configuration.FeMonitoringConfig;
import org.yaml.snakeyaml.TypeDescription;
@@ -149,7 +150,7 @@ public class YamlToObjectConverter {
config = convert(fullFileName, className);
} catch (Exception e) {
- log.error("Failed to convert yaml file {} to object.", configFileName,e);
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Failed to convert yaml file {} to object.", configFileName,e);
}
return config;
@@ -196,7 +197,7 @@ public class YamlToObjectConverter {
File f = new File(fullFileName);
if (!f.exists()) {
- log.warn("The file " + fullFileName + " cannot be found. Ignore reading configuration.");
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","The file {} cannot be found. Ignore reading configuration.",fullFileName);
return null;
}
in = Files.newInputStream(Paths.get(fullFileName));
@@ -205,7 +206,7 @@ public class YamlToObjectConverter {
// System.out.println(config.toString());
} catch (Exception e) {
- log.error("Failed to convert yaml file {} to object.", fullFileName, e);
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Failed to convert yaml file {} to object.", fullFileName, e);
} finally {
if (in != null) {
try {
@@ -233,7 +234,7 @@ public class YamlToObjectConverter {
config = yaml.loadAs(in, className);
} catch (Exception e) {
- log.error("Failed to convert yaml file to object", e);
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Failed to convert yaml file to object", e);
} finally {
if (in != null) {
try {
@@ -253,7 +254,7 @@ public class YamlToObjectConverter {
return isValidYaml(decodedFileContents);
}
-
+ @SuppressWarnings("unchecked")
public boolean isValidYaml(byte[] fileContents) {
try {
@@ -265,7 +266,7 @@ public class YamlToObjectConverter {
}
} catch (Exception e) {
- log.error("Failed to convert yaml file to object - yaml is invalid", e);
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Failed to convert yaml file to object - yaml is invalid", e);
return false;
}
return true;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java
index fada7193ed..e8af079f22 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.exception;
+import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode;
import org.openecomp.sdc.common.log.wrappers.Logger;
import java.util.Arrays;
@@ -58,11 +59,11 @@ public abstract class AbstractSdncException {
}
int actualParamsNum = (variables != null) ? variables.length : 0;
if (actualParamsNum < expectedParamsNum) {
- log.warn(
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","",
"Received less parameters than expected for error with messageId {}, expected: {}, actual: {}. Missing parameters are padded with null values.",
messageId, expectedParamsNum, actualParamsNum);
} else if (actualParamsNum > expectedParamsNum) {
- log.warn(
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","",
"Received more parameters than expected for error with messageId {}, expected: {}, actual: {}. Extra parameters are ignored.",
messageId, expectedParamsNum, actualParamsNum);
}
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/WrapperTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/WrapperTest.java
index 9c18861d40..5f80470b9b 100644
--- a/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/WrapperTest.java
+++ b/common-app-api/src/test/java/org/openecomp/sdc/common/datastructure/WrapperTest.java
@@ -6,7 +6,7 @@ import org.junit.Test;
public class WrapperTest {
private Wrapper createTestSubject() {
- return new Wrapper(null);
+ return new Wrapper("test");
}