aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileSetCommand.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileUnsetCommand.java2
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandProfileNotFound.java1
-rw-r--r--framework/src/main/java/org/onap/cli/fw/error/OnapCommandWarning.java6
-rw-r--r--framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java24
-rw-r--r--framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java5
-rw-r--r--framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java55
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java4
8 files changed, 50 insertions, 49 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileSetCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileSetCommand.java
index fa83ace3..2cb3cea2 100644
--- a/framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileSetCommand.java
+++ b/framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileSetCommand.java
@@ -57,7 +57,7 @@ public class OnapProfileSetCommand extends OnapCommand {
Map<String, OnapCommandParamEntity> map = new HashMap<>();
try {
- for (OnapCommandParamEntity paramsExisting : cache.getInstance().loadParamFromCache(profile)) {
+ for (OnapCommandParamEntity paramsExisting : OnapCommandProfileStore.getInstance().loadParamFromCache(profile)) {
map.put(paramsExisting.getProduct() + ":" + paramsExisting.getName(), paramsExisting);
}
} catch (OnapCommandProfileNotFound e) {
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileUnsetCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileUnsetCommand.java
index 06474ec2..e1c17351 100644
--- a/framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileUnsetCommand.java
+++ b/framework/src/main/java/org/onap/cli/fw/cmd/profile/OnapProfileUnsetCommand.java
@@ -56,7 +56,7 @@ public class OnapProfileUnsetCommand extends OnapCommand {
Map<String, OnapCommandParamEntity> map = new HashMap<>();
- for (OnapCommandParamEntity paramsExisting : cache.getInstance().loadParamFromCache(profile)) {
+ for (OnapCommandParamEntity paramsExisting : OnapCommandProfileStore.getInstance().loadParamFromCache(profile)) {
map.put(paramsExisting.getProduct() + ":" + paramsExisting.getName(), paramsExisting);
}
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandProfileNotFound.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandProfileNotFound.java
index efc7b36c..56a58590 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandProfileNotFound.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandProfileNotFound.java
@@ -26,7 +26,6 @@ public class OnapCommandProfileNotFound extends OnapCommandException {
private static final String ERROR_CODE = "0xc002";
- private static final String ERROR_MSG = "Profile does not exist";
/**
* Profile does not exist.
*/
diff --git a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandWarning.java b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandWarning.java
index ccd2cee5..619451e5 100644
--- a/framework/src/main/java/org/onap/cli/fw/error/OnapCommandWarning.java
+++ b/framework/src/main/java/org/onap/cli/fw/error/OnapCommandWarning.java
@@ -24,15 +24,15 @@ public abstract class OnapCommandWarning extends OnapCommandException {
private static final long serialVersionUID = -1833571383961748520L;
- public OnapCommandWarning(String errorCode, String errorMessage, long httpStatusCode) {
+ protected OnapCommandWarning(String errorCode, String errorMessage, long httpStatusCode) {
super(errorCode, errorMessage, httpStatusCode);
}
- public OnapCommandWarning(String errorCode, String errorMessage) {
+ protected OnapCommandWarning(String errorCode, String errorMessage) {
super(errorCode, errorMessage);
}
- public OnapCommandWarning(String errorCode, String errorMessage, Throwable err) {
+ protected OnapCommandWarning(String errorCode, String errorMessage, Throwable err) {
super(errorCode, errorMessage, err);
}
}
diff --git a/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java b/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java
index fa9bcf02..cba7134d 100644
--- a/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java
+++ b/framework/src/main/java/org/onap/cli/fw/output/OnapCommandResult.java
@@ -120,8 +120,8 @@ public class OnapCommandResult {
public Map<String, OnapCommandResultAttribute> getRecordsMap() {
Map<String, OnapCommandResultAttribute> recordMap = new HashMap<>();
- for (OnapCommandResultAttribute record : this.getRecords()) {
- recordMap.put(record.getName(), record);
+ for (OnapCommandResultAttribute data : this.getRecords()) {
+ recordMap.put(data.getName(), data);
}
return recordMap;
@@ -194,8 +194,8 @@ public class OnapCommandResult {
if (!this.getRecords().isEmpty()) {
if (this.getPrintDirection().equals(OnapCommandPrintDirection.LANDSCAPE)) {
- for (OnapCommandResultAttribute record : this.getScopedRecords()) {
- print.addColumn(record.getName(), record.getValues());
+ for (OnapCommandResultAttribute data : this.getScopedRecords()) {
+ print.addColumn(data.getName(), data.getValues());
}
} else {
// Add property column
@@ -207,12 +207,12 @@ public class OnapCommandResult {
val.setName(OnapCommandConstants.PORTRAINT_COLUMN_NAME_VALUE);
val.setScope(OnapCommandResultAttributeScope.SHORT);
- for (OnapCommandResultAttribute record : this.getScopedRecords()) {
- prp.getValues().add(record.getName());
- if (record.getValues().size() == 1) {
- val.getValues().add(record.getValues().get(0));
+ for (OnapCommandResultAttribute data : this.getScopedRecords()) {
+ prp.getValues().add(data.getName());
+ if (data.getValues().size() == 1) {
+ val.getValues().add(data.getValues().get(0));
} else {
- val.getValues().add(record.getValues().toString());
+ val.getValues().add(data.getValues().toString());
}
}
@@ -254,11 +254,11 @@ public class OnapCommandResult {
private List<OnapCommandResultAttribute> getScopedRecords() {
List<OnapCommandResultAttribute> recordList = new ArrayList<>();
- for (OnapCommandResultAttribute record : this.getRecords()) {
- if (record.getScope().ordinal() > this.getScope().ordinal()) {
+ for (OnapCommandResultAttribute data : this.getRecords()) {
+ if (data.getScope().ordinal() > this.getScope().ordinal()) {
continue;
}
- recordList.add(record);
+ recordList.add(data);
}
return recordList;
diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java
index 7e0d40ee..d8f29800 100644
--- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java
+++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaMerger.java
@@ -77,9 +77,10 @@ public class OnapCommandSchemaMerger {
public static void mergeYamlMap(Map<String, Object> mergedResult, Map<String, Object> yamlContents) {
if (yamlContents == null) return;
- for (String key : yamlContents.keySet()) {
+ for (Map.Entry<String,Object> entry : yamlContents.entrySet()) {
- Object yamlValue = yamlContents.get(key);
+ String key = entry.getKey();
+ Object yamlValue = entry.getValue();
if (yamlValue == null) {
mergedResult.put(key, yamlValue);
continue;
diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java
index 91f45f02..a1c84a41 100644
--- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java
+++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandExecutionStore.java
@@ -18,6 +18,7 @@ package org.onap.cli.fw.store;
import java.io.File;
import java.io.IOException;
+import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -239,21 +240,21 @@ public class OnapCommandExecutionStore {
context.setStorePath(dir.getAbsolutePath());
if (product != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OnapCommandConstants.INFO_PRODUCT), product);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OnapCommandConstants.INFO_PRODUCT), product, (Charset) null);
if (service != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OnapCommandConstants.INFO_SERVICE), service);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OnapCommandConstants.INFO_SERVICE), service, (Charset) null);
if (cmd != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OnapCommandConstants.RPC_CMD), cmd);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OnapCommandConstants.RPC_CMD), cmd, (Charset) null);
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + REQUEST_ID), requestId);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + REQUEST_ID), requestId, (Charset) null);
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + EXECUTION_ID), executionId);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + EXECUTION_ID), executionId, (Charset) null);
if (input != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + INPUT), input);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + INPUT), input, (Charset) null);
if (profile != null) {
context.setProfile(profile);
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OnapCommandConstants.RPC_PROFILE), profile);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OnapCommandConstants.RPC_PROFILE), profile, (Charset) null);
}
FileUtils.touch(new File(context.getStorePath() + File.separator + STDOUT));
@@ -274,11 +275,11 @@ public class OnapCommandExecutionStore {
try {
if (output != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OUTPUT), output);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OUTPUT), output, (Charset) null);
if (error != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + ERROR), error);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + ERROR), error, (Charset) null);
if (debug != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + DEBUG), debug);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + DEBUG), debug, (Charset) null);
if (passed)
FileUtils.touch(new File(context.getStorePath() + File.separator + COMPLETED));
else
@@ -305,11 +306,11 @@ public class OnapCommandExecutionStore {
try {
if (output != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OUTPUT), output);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OUTPUT), output, (Charset) null);
if (error != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + ERROR), error);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + ERROR), error, (Charset) null);
if (debug != null)
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + DEBUG), debug);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + DEBUG), debug, (Charset) null);
} catch (IOException e) {
log.error("Failed to store the execution end details {}", context.storePath);
}
@@ -321,7 +322,7 @@ public class OnapCommandExecutionStore {
try {
if (debug != null) {
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + DEBUG), debug);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + DEBUG), debug, (Charset) null);
}
} catch (IOException e) {
log.error("Failed to store the execution debug details {}", context.storePath);
@@ -334,7 +335,7 @@ public class OnapCommandExecutionStore {
try {
if (output != null) {
- FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OUTPUT), output);
+ FileUtils.writeStringToFile(new File(context.getStorePath() + File.separator + OUTPUT), output, (Charset) null);
}
} catch (IOException e) {
log.error("Failed to store the execution output details {}", context.storePath);
@@ -438,16 +439,16 @@ public class OnapCommandExecutionStore {
private Execution makeExecution(String executionStorePath) throws IOException {
OnapCommandExecutionStore.Execution exectuion = new OnapCommandExecutionStore.Execution();
if (new File(executionStorePath + File.separator + REQUEST_ID).exists())
- exectuion.setRequestId(FileUtils.readFileToString(new File(executionStorePath + File.separator + REQUEST_ID)));
+ exectuion.setRequestId(FileUtils.readFileToString(new File(executionStorePath + File.separator + REQUEST_ID), (Charset) null));
if (new File(executionStorePath + File.separator + EXECUTION_ID).exists())
- exectuion.setId(FileUtils.readFileToString(new File(executionStorePath + File.separator + EXECUTION_ID)));
- exectuion.setProduct(FileUtils.readFileToString(new File(executionStorePath + File.separator + OnapCommandConstants.INFO_PRODUCT)));
- exectuion.setService(FileUtils.readFileToString(new File(executionStorePath + File.separator + OnapCommandConstants.INFO_SERVICE)));
- exectuion.setCommand(FileUtils.readFileToString(new File(executionStorePath + File.separator + OnapCommandConstants.RPC_CMD)));
+ exectuion.setId(FileUtils.readFileToString(new File(executionStorePath + File.separator + EXECUTION_ID), (Charset) null));
+ exectuion.setProduct(FileUtils.readFileToString(new File(executionStorePath + File.separator + OnapCommandConstants.INFO_PRODUCT), (Charset) null));
+ exectuion.setService(FileUtils.readFileToString(new File(executionStorePath + File.separator + OnapCommandConstants.INFO_SERVICE), (Charset) null));
+ exectuion.setCommand(FileUtils.readFileToString(new File(executionStorePath + File.separator + OnapCommandConstants.RPC_CMD), (Charset) null));
if (new File(executionStorePath + File.separator + OnapCommandConstants.RPC_PROFILE).exists())
- exectuion.setProfile(FileUtils.readFileToString(new File(executionStorePath + File.separator + OnapCommandConstants.RPC_PROFILE)));
+ exectuion.setProfile(FileUtils.readFileToString(new File(executionStorePath + File.separator + OnapCommandConstants.RPC_PROFILE), (Charset) null));
- exectuion.setInput(FileUtils.readFileToString(new File(executionStorePath + File.separator + INPUT)));
+ exectuion.setInput(FileUtils.readFileToString(new File(executionStorePath + File.separator + INPUT), (Charset) null));
exectuion.setStartTime(dateFormatter.format(new File(executionStorePath + File.separator + INPUT).lastModified()));
if (new File(executionStorePath + File.separator + IN_PROGRESS).exists()) {
@@ -455,13 +456,13 @@ public class OnapCommandExecutionStore {
} else if (new File(executionStorePath + File.separator + COMPLETED).exists()) {
exectuion.setStatus(COMPLETED);
if (new File(executionStorePath + File.separator + OUTPUT).exists()) {
- exectuion.setOutput(FileUtils.readFileToString(new File(executionStorePath + File.separator + OUTPUT)));
+ exectuion.setOutput(FileUtils.readFileToString(new File(executionStorePath + File.separator + OUTPUT), (Charset) null));
exectuion.setEndTime(dateFormatter.format(new File(executionStorePath + File.separator + OUTPUT).lastModified()));
}
} else if (new File(executionStorePath + File.separator + FAILED).exists()) {
exectuion.setStatus(FAILED);
if (new File(executionStorePath + File.separator + ERROR).exists()) {
- exectuion.setOutput(FileUtils.readFileToString(new File(executionStorePath + File.separator + ERROR)));
+ exectuion.setOutput(FileUtils.readFileToString(new File(executionStorePath + File.separator + ERROR), (Charset) null));
exectuion.setEndTime(dateFormatter.format(new File(executionStorePath + File.separator + ERROR).lastModified()));
}
}
@@ -483,7 +484,7 @@ public class OnapCommandExecutionStore {
public String showExecutionOut(String executionId) throws OnapCommandExecutionNotFound {
try {
- return FileUtils.readFileToString(new File (this.getExecutionDir(executionId).getAbsolutePath() + File.separator + STDOUT));
+ return FileUtils.readFileToString(new File (this.getExecutionDir(executionId).getAbsolutePath() + File.separator + STDOUT), (Charset) null);
} catch (IOException e) {
return "";
}
@@ -491,7 +492,7 @@ public class OnapCommandExecutionStore {
public String showExecutionErr(String executionId) throws OnapCommandExecutionNotFound {
try {
- return FileUtils.readFileToString(new File (this.getExecutionDir(executionId).getAbsolutePath() + File.separator + STDERR));
+ return FileUtils.readFileToString(new File (this.getExecutionDir(executionId).getAbsolutePath() + File.separator + STDERR), (Charset) null);
} catch (IOException e) {
return "";
}
@@ -499,7 +500,7 @@ public class OnapCommandExecutionStore {
public String showExecutionDebug(String executionId) throws OnapCommandExecutionNotFound {
try {
- return FileUtils.readFileToString(new File (this.getExecutionDir(executionId).getAbsolutePath() + File.separator + DEBUG));
+ return FileUtils.readFileToString(new File (this.getExecutionDir(executionId).getAbsolutePath() + File.separator + DEBUG), (Charset) null);
} catch (IOException e) {
return "";
}
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
index b2bbfd47..c970e3ab 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandDiscoveryUtils.java
@@ -338,7 +338,7 @@ public class OnapCommandDiscoveryUtils {
if (!schema.getVersion().equalsIgnoreCase(OnapCommandConstants.OPEN_CLI_SCHEMA_VERSION_VALUE_1_0)) {
String schemaURI = schema.getSchemaURI();
- OnapCommandUtils.log.info("Unsupported Schema version found {} " + schemaURI);
+ OnapCommandUtils.log.info("Unsupported Schema version found {} ", schemaURI);
}
else{
@@ -556,7 +556,7 @@ public class OnapCommandDiscoveryUtils {
* @throws OnapCommandInvalidSchema
* exception
*/
- public static Map<String, ?> loadYaml(Resource resource, boolean ignoreInvalidSchema) throws OnapCommandInvalidSchema, IOException {
+ public static Map<String, ?> loadYaml(Resource resource, boolean ignoreInvalidSchema) throws OnapCommandInvalidSchema, IOException {//NOSONAR
Map<String, ?> values = null;
try {
values = loadYaml(resource.getInputStream());