aboutsummaryrefslogtreecommitdiffstats
path: root/ms/neng
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-01-09 17:04:36 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-09 17:04:36 +0000
commitfcafafe29cf0ff4bc60cae063483deed709c79de (patch)
treeb9dec7d18b1fb7deee6eba87780503f9c51fa13e /ms/neng
parent945c2ac0f1180d48602e1364cf0ccb73d91b582a (diff)
parentd63f9f4458f287617e6ea7854dec8266c44be5ee (diff)
Merge "Fixed sonar issue in PolicyReader.java"
Diffstat (limited to 'ms/neng')
-rw-r--r--ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java
index 181bb7a3..3c4efe51 100644
--- a/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java
+++ b/ms/neng/src/main/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReader.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Converts policy data to the structure expected by this micro-service.
@@ -41,11 +43,12 @@ public abstract class PolicyReader implements PolicyFinder {
*/
private static final String NAMING_MODELS = "naming-models";
private static final String NAMING_TYPE = "naming-type";
+ private static final Logger LOG = LoggerFactory.getLogger(PolicyReader.class);
public static List<Map<String, ?>> namingModels(Map<String, ?> policy) {
Set<String> keys = policy.keySet();
- // TODO : retrieve naming-models at any level
+ // retrieve naming-models at any level
if (keys.contains("config")) {
@SuppressWarnings("unchecked")
Map<String, ?> config = (Map<String, ?>) policy.get("config");
@@ -111,7 +114,7 @@ public abstract class PolicyReader implements PolicyFinder {
Object val = model.get(NAMING_TYPE);
if (val != null) {
String relaxedVal = relaxedNamingType(val.toString());
- if (namingType.equalsIgnoreCase(relaxedVal)) {
+ if (namingType != null && namingType.equalsIgnoreCase(relaxedVal)) {
theModel = model;
break;
}
@@ -231,9 +234,6 @@ public abstract class PolicyReader implements PolicyFinder {
String value = null;
if (map != null) {
value = (String) map.get(key);
- if (!(value instanceof String)) {
- value = null;
- }
if (value != null && !Pattern.matches("\\$\\{.*\\}.*", value)) {
return value;
} else {
@@ -335,6 +335,7 @@ public abstract class PolicyReader implements PolicyFinder {
try {
value = Long.valueOf(str);
} catch (Exception e) {
+ LOG.info("String parse error", e);
value = defaultValue;
}
return value;