summaryrefslogtreecommitdiffstats
path: root/sliPluginUtils/provider/src
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-12-21 17:46:01 +0530
committerSandeep J <sandeejh@in.ibm.com>2018-12-21 17:46:11 +0530
commit8a72139cd40e1fd6353b6c535c2ba3bd1e7290f1 (patch)
tree38c4be1b86974fa2a8505ced6a1d416b1396a6e7 /sliPluginUtils/provider/src
parent0935246ecb1cad72a86eeedbc43f1ebdbbe5a9c8 (diff)
fixed sonar issues in SliPluginUtils.java
fixed sonar issues Issue-ID: CCSDK-525 Change-Id: I6d48ed028e98c2fc9ce0cf6ae215dfd3fcc6c871 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'sliPluginUtils/provider/src')
-rw-r--r--sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java
index ebfe81718..fd3364ca4 100644
--- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java
+++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java
@@ -65,6 +65,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
private static final Logger LOG = LoggerFactory.getLogger(SliPluginUtils.class);
private static final String LOG_MSG="extracting list from context memory";
private static final String LOG_MSG1="removing elements from list";
+ private static final String LENGTH="_length";
// ========== CONSTRUCTORS ==========
@@ -216,7 +217,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
i++;
}
// Reset list length (removed by ctxBulkErase above)
- ctx.setAttribute(ctx_list_str+"_length", Integer.toString(listSz));
+ ctx.setAttribute(ctx_list_str+LENGTH, Integer.toString(listSz));
}
/**
@@ -492,7 +493,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
* @since 1.0
*/
public static final int getArrayLength( SvcLogicContext ctx, String key, Logger log, LogLevel logLevel, String log_message ) {
- String ctxKey = key.endsWith("_length") ? key : key + "_length";
+ String ctxKey = key.endsWith(LENGTH) ? key : key + LENGTH;
try {
return Integer.parseInt(ctx.getAttribute(ctxKey));
}
@@ -829,7 +830,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
writeJsonObject(entry.getValue().getAsJsonObject(), ctx, root + entry.getKey() + ".");
} else if (entry.getValue().isJsonArray()) {
JsonArray array = entry.getValue().getAsJsonArray();
- ctx.setAttribute(root + entry.getKey() + "_length", String.valueOf(array.size()));
+ ctx.setAttribute(root + entry.getKey() + LENGTH, String.valueOf(array.size()));
Integer arrayIdx = 0;
for (JsonElement element : array) {
if (element.isJsonObject()) {
@@ -873,7 +874,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
try {
String ctxList = parameters.get("list");
- ctxList = (ctxList.endsWith("_length")) ? ctxList : ctxList + "_length";
+ ctxList = (ctxList.endsWith(LENGTH)) ? ctxList : ctxList + LENGTH;
int listLength = getArrayLength(ctx, ctxList);
if (listLength == 0) {
@@ -1063,9 +1064,9 @@ public class SliPluginUtils implements SvcLogicJavaPlugin {
setParametersToCtxList(parameters, ctx, prefixKeyWithIndex, valuePrefixKey);
// set length of list
- String ListLengthKeyName = prefixKey + "_length";
+ String ListLengthKeyName = prefixKey + LENGTH;
- ctxSetAttribute(ctx, prefixKey + "_length", listLength + 1);
+ ctxSetAttribute(ctx, prefixKey + LENGTH, listLength + 1);
LOG.debug("Updated _length: " + prefixKey + "_length is now " + ctx.getAttribute(ListLengthKeyName));
}