From 2575b3ccf5ca48a1ca0a2adb81a21ec602f6ae4e Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Wed, 2 May 2018 15:53:02 +0530 Subject: Use static constants instead Issue-ID: CLI-100 Change-Id: I606b9428669c603e476cda1f77f5015ab57c9eba Signed-off-by: Kanagaraj Manickam k00365106 --- .../org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'profiles') diff --git a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java index 2cfb5206..55295aa5 100644 --- a/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java +++ b/profiles/http/src/main/java/org/onap/cli/fw/http/schema/OnapCommandSchemaHttpLoader.java @@ -47,6 +47,8 @@ import net.minidev.json.JSONObject; public class OnapCommandSchemaHttpLoader { + private static final String ATTRIBUTE = "Attribute '"; + private OnapCommandSchemaHttpLoader() { // to follow standards ! } @@ -178,11 +180,11 @@ public class OnapCommandSchemaHttpLoader { if (serviceMap.containsKey(secKey)) { Object obj = serviceMap.get(secKey); if (obj == null) { - errorList.add("Attribute '" + secKey + "' under '" + OnapCommandHttpConstants.SERVICE + "' is empty"); + errorList.add(ATTRIBUTE + secKey + "' under '" + OnapCommandHttpConstants.SERVICE + "' is empty"); } else { String value = String.valueOf(obj); if (!OnapCommandConfig.getCommaSeparatedList(validationMap.get(secKey)).contains(value)) { - errorList.add("Attribute '" + secKey + "' contains invalid value. Valide values are " + errorList.add(ATTRIBUTE + secKey + "' contains invalid value. Valide values are " + OnapCommandConfig.getCommaSeparatedList(validationMap.get(key1))); // } } @@ -288,7 +290,7 @@ public class OnapCommandSchemaHttpLoader { String method = (String) requestMap.get(OnapCommandHttpConstants.METHOD); if (method != null && !method.isEmpty()) { if (!OnapCommandConfig.getCommaSeparatedList(OnapCommandHttpConstants.HTTP_METHODS).contains(method.toLowerCase())) { - errorList.add("Attribute '" + OnapCommandHttpConstants.METHOD + "' under '" + OnapCommandHttpConstants.REQUEST + "' is invalid, correct types are " + errorList.add(ATTRIBUTE + OnapCommandHttpConstants.METHOD + "' under '" + OnapCommandHttpConstants.REQUEST + "' is invalid, correct types are " + OnapCommandConfig.getCommaSeparatedList(OnapCommandHttpConstants.HTTP_METHODS).toString()); } } else { -- cgit 1.2.3-korg