diff options
Diffstat (limited to 'framework/src/main/java/org')
14 files changed, 99 insertions, 111 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaListCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaListCommand.java index 5046f44a..1273cc78 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaListCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaListCommand.java @@ -39,11 +39,7 @@ public class OnapSchemaListCommand extends OnapCommand { List<OnapCommandSchemaInfo> schemas = OnapCommandDiscoveryUtils.discoverOrLoadSchemas(true); for (OnapCommandSchemaInfo schema : schemas) { - if (schema.isIgnore()) { - continue; - } - - if (schema.getProduct().equalsIgnoreCase(product)) { + if (schema.getProduct().equalsIgnoreCase(product) && !schema.isIgnore()) { if (service.length() > 0 && !service.equalsIgnoreCase(schema.getService())) { continue; } diff --git a/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaShowCommand.java b/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaShowCommand.java index b7c027f7..02b5e79d 100644 --- a/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaShowCommand.java +++ b/framework/src/main/java/org/onap/cli/fw/cmd/schema/OnapSchemaShowCommand.java @@ -47,7 +47,7 @@ public class OnapSchemaShowCommand extends OnapCommand { throw new OnapCommandNotFound(cmd, product, service); } - Map <String, Object> ioMap = new HashMap<String, Object>(); + Map <String, Object> ioMap = new HashMap<>(); ioMap.put("name", info.getCmdName()); ioMap.put("author", info.getAuthor()); ioMap.put("description", info.getDescription()); diff --git a/framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java b/framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java index d0b3c5f4..6d6f95ae 100644 --- a/framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java +++ b/framework/src/main/java/org/onap/cli/fw/input/OnapCommandParameter.java @@ -173,10 +173,10 @@ public class OnapCommandParameter { this.defaultValue = UUID.randomUUID().toString(); break; case JSON: - this.defaultValue = new String("{}"); + this.defaultValue = "{}"; break; default: - this.defaultValue = new String(""); + this.defaultValue = ""; break; } } 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 bbe33594..b88477c0 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 @@ -39,7 +39,7 @@ public class OnapCommandResult { * * if type=TEXT, then it holds the result in text format such as help message */ - private Object output = new String(""); + private Object output = ""; /* * Type requested by user diff --git a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java index c23ed2bc..28344def 100644 --- a/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java +++ b/framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java @@ -431,7 +431,7 @@ public class OnapCommandRegistrar { } } - public List<Map<String, ?>> getTestSuite(String cmd, String product) throws OnapCommandException { + public List<Map<String, Object>> getTestSuite(String cmd, String product) throws OnapCommandException { return OnapCommandDiscoveryUtils.createTestSuite(cmd, product); } diff --git a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java index 4f6e4ea5..04a81aa7 100644 --- a/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java +++ b/framework/src/main/java/org/onap/cli/fw/schema/OnapCommandSchemaLoader.java @@ -105,8 +105,8 @@ public class OnapCommandSchemaLoader { * @throws OnapCommandInvalidSchema invalid schema * @throws OnapCommandSchemaNotFound schema not found */ - public static Map<String, ?> validateSchemaVersion(String schemaName, String version) throws OnapCommandException { - Map<String, ?> values = null; + public static Map<String, Object> validateSchemaVersion(String schemaName, String version) throws OnapCommandException { + Map<String, Object> values = null; try { InputStream inputStream = OnapCommandUtils.class.getClassLoader().getResourceAsStream(schemaName); @@ -160,8 +160,7 @@ public class OnapCommandSchemaLoader { errors.addAll(parseSchema(cmd, defaultParameterMap, validateSchema)); } - Map<String, List<Map<String, String>>> commandYamlMap = - (Map<String, List<Map<String, String>>>)validateSchemaVersion(schemaName, cmd.getSchemaVersion()); + Map<String, ?> commandYamlMap = validateSchemaVersion(schemaName, cmd.getSchemaVersion()); errors.addAll(parseSchema(cmd, commandYamlMap, validateSchema)); @@ -218,13 +217,13 @@ public class OnapCommandSchemaLoader { HashMap<String, String> validationMap = new HashMap<>(); validationMap.put(INFO_TYPE, COMMAND_TYPE_VALUES); - for (String secKey : validationMap.keySet()) { + for (Map.Entry<String,String> entry : validationMap.entrySet()) { + String secKey=entry.getKey(); if (infoMap.containsKey(secKey)) { - Object obj = infoMap.get(secKey); - if (obj == null) { + String value = infoMap.get(secKey); + if (value == null) { exceptionList.add("Attribute '" + secKey + "' under '" + INFO + "' is empty"); } else { - String value = String.valueOf(obj); if (!OnapCommandConfig.getCommaSeparatedList(validationMap.get(secKey)).contains(value)) { exceptionList.add("Attribute '" + secKey + "' contains invalid value. Valide values are " + OnapCommandConfig.getCommaSeparatedList(validationMap.get(key))); // @@ -267,6 +266,7 @@ public class OnapCommandSchemaLoader { Object ignore = infoMap.get(key1); info.setIgnore(ignore.toString().equalsIgnoreCase(OnapCommandConstants.BOOLEAN_TRUE)); break; + default : // Do nothing } } @@ -350,12 +350,10 @@ public class OnapCommandSchemaLoader { break; case IS_SECURED: - if (validate) { - if (!OnapCommandUtils.validateBoolean(String.valueOf(parameter.get(key2)))) { + if (validate && !OnapCommandUtils.validateBoolean(String.valueOf(parameter.get(key2)))) { exceptionList.add(OnapCommandUtils.invalidBooleanValueMessage(parameter.get(NAME), IS_SECURED, String.valueOf(parameter.get(key2)))); } - } param.setSecured(BOOLEAN_TRUE.equalsIgnoreCase(String.valueOf(parameter.get(key2)))); break; @@ -370,15 +368,14 @@ public class OnapCommandSchemaLoader { break; case IS_DEFAULT_PARAM: - if (validate) { - if (!OnapCommandUtils.validateBoolean(String.valueOf(parameter.get(key2)))) { + if (validate && !OnapCommandUtils.validateBoolean(String.valueOf(parameter.get(key2)))) { exceptionList.add(OnapCommandUtils.invalidBooleanValueMessage(parameter.get(NAME), IS_DEFAULT_PARAM, String.valueOf(parameter.get(key2)))); } - } param.setDefaultParam(BOOLEAN_TRUE.equalsIgnoreCase(String.valueOf(parameter.get(key2)))); break; + default : // Do nothing } } @@ -455,34 +452,33 @@ public class OnapCommandSchemaLoader { break; case IS_SECURED: - if (validate) { - if (!OnapCommandUtils.validateBoolean(String.valueOf(map.get(key4)))) { + if (validate && !OnapCommandUtils.validateBoolean(String.valueOf(map.get(key4)))) { exceptionList.add(OnapCommandUtils.invalidBooleanValueMessage(ATTRIBUTES, IS_SECURED, String.valueOf(map.get(key4)))); } - } attr.setSecured(BOOLEAN_TRUE.equals(String.valueOf(map.get(key4)))); break; case IS_DEFAULT_ATTR: - if (validate) { - if (!OnapCommandUtils.validateBoolean(String.valueOf(map.get(key4)))) { + if (validate && !OnapCommandUtils.validateBoolean(String.valueOf(map.get(key4)))) { exceptionList.add(OnapCommandUtils.invalidBooleanValueMessage(ATTRIBUTES, IS_DEFAULT_ATTR, String.valueOf(map.get(key4)))); } - } attr.setDefaultAttr(BOOLEAN_TRUE.equals(String.valueOf(map.get(key4)))); break; + default : // Do nothing } } cmd.getResult().getRecords().add(attr); } break; + default : // Do nothing } } } break; + default : // Do nothing } } @@ -515,7 +511,7 @@ public class OnapCommandSchemaLoader { * @throws OnapCommandInvalidSchema * exception */ - public static Map<String, ?> loadSchema(InputStream stream, String schemaName) throws OnapCommandInvalidSchema { + public static Map<String, Object> loadSchema(InputStream stream, String schemaName) throws OnapCommandInvalidSchema { return OnapCommandDiscoveryUtils.loadYaml(stream); } 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 97ca4c15..6ad0274e 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 @@ -114,9 +114,7 @@ public class OnapCommandSchemaMerger { String nameN = (String)oN.getOrDefault(OnapCommandConstants.NAME, null); //Name should be existing in the map, otherwise continue as don't know how to compare - if (nameN == null) { - continue; - } + if (nameN != null) { boolean existing = false; for (Object e: originalList) { @@ -124,10 +122,6 @@ public class OnapCommandSchemaMerger { String nameE = (String)oE.getOrDefault(OnapCommandConstants.NAME, null); //Name should be existing in the map, otherwise continue as don't know how to compare - if (nameE == null) { - continue; - } - if (nameN.equals(nameE)) { for (Entry<String, Object> oNe : oN.entrySet()) { oE.put(oNe.getKey(), oNe.getValue()); @@ -141,6 +135,7 @@ public class OnapCommandSchemaMerger { originalList.add(o); } } + } } } diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java index 5938a11d..58797152 100644 --- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java +++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandArtifactStore.java @@ -56,7 +56,7 @@ public class OnapCommandArtifactStore { private SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); - private static String SEPARATOR = "__"; + private static final String SEPARATOR = "__"; public static class Artifact { private String name; @@ -255,8 +255,10 @@ public class OnapCommandArtifactStore { if (!aFile.exists()) { throw new OnapCommandArtifactNotFound(name, category); } - if(!aFile.delete()){ - log.error("Failed to delete the artifact {}", aFile.getAbsolutePath()); + try { + Files.delete(Paths.get(storePath)); + } catch (IOException e) { + log.error("Failed to delete the artifact " + aFile.getAbsolutePath()); } } 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 b0ebbda5..15996a8f 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 @@ -19,6 +19,9 @@ package org.onap.cli.fw.store; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; @@ -56,7 +59,7 @@ public class OnapCommandExecutionStore { private SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); - private static String SEPARATOR = "__"; + private static final String SEPARATOR = "__"; private enum SearchMode { FIND, @@ -65,11 +68,11 @@ public class OnapCommandExecutionStore { } - private static SearchMode SEARCH_MODE = SearchMode.FILE; + private static SearchMode searchMode = SearchMode.FILE; static { String mode = OnapCommandConfig.getPropertyValue(OnapCommandConstants.OPEN_CLI_EXECUTION_SEARCH_MODE); if (mode.equalsIgnoreCase(SearchMode.FIND.name())) - SEARCH_MODE = SearchMode.FIND; + searchMode = SearchMode.FIND; } public static class ExecutionStoreContext { @@ -279,9 +282,11 @@ public class OnapCommandExecutionStore { FileUtils.touch(new File(context.getStorePath() + File.separator + COMPLETED)); else FileUtils.touch(new File(context.getStorePath() + File.separator + FAILED)); - - if(!new File(context.getStorePath() + File.separator + IN_PROGRESS).delete()){ - log.error("Failed to delete {}", context.getStorePath() + File.separator + IN_PROGRESS); + Path path= Paths.get(context.getStorePath() + File.separator + IN_PROGRESS); + try { + Files.delete(path); + } catch (IOException e) { + log.error("Failed to delete "+ context.getStorePath() + File.separator + IN_PROGRESS); } } catch (IOException e) { log.error("Failed to store the execution end details {}", context.storePath); @@ -334,7 +339,7 @@ public class OnapCommandExecutionStore { try { List <String> dirs = new ArrayList<>(); - if (System.getProperty("os.name").toLowerCase().startsWith("windows") || SEARCH_MODE.equals(SearchMode.FILE)) { + if (System.getProperty("os.name").toLowerCase().startsWith("windows") || searchMode.equals(SearchMode.FILE)) { for (File f: new File(getBasePath()).listFiles()) { if(search.containsKey(EXECUTIONID)) { if (f.getName().startsWith(search.get(EXECUTIONID))) @@ -347,7 +352,6 @@ public class OnapCommandExecutionStore { if (f.getName().startsWith(search.get(REQUESTID))) dirs.add(f.getAbsolutePath()); - continue; } else @@ -449,12 +453,9 @@ public class OnapCommandExecutionStore { } private File getExecutionDir(String executionId) throws OnapCommandExecutionNotFound { - File []f = new File(getBasePath()).listFiles(new FilenameFilter() { - - @Override - public boolean accept(File dir, String name) { - return name.startsWith(executionId); - } + File []f = new File(getBasePath()).listFiles((dir, name) -> { + if (name.startsWith(executionId)) return true; + return false; }); if (f.length == 0) { diff --git a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java index 139521e4..677c45ea 100644 --- a/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java +++ b/framework/src/main/java/org/onap/cli/fw/store/OnapCommandProfileStore.java @@ -21,6 +21,8 @@ import static org.onap.cli.fw.conf.OnapCommandConstants.DATA_PATH_PROFILE_JSON; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -96,11 +98,9 @@ public class OnapCommandProfileStore { } public void remove(String productVersion, String paramName) { - if (paramCache.containsKey(productVersion)) { - if (paramCache.get(productVersion).containsKey(paramName)) { + if (paramCache.containsKey(productVersion) && paramCache.get(productVersion).containsKey(paramName)) { paramCache.get(productVersion).remove(paramName); } - } this.persist(); } @@ -205,23 +205,18 @@ public class OnapCommandProfileStore { public void removeProfile(String profile) { String dataDir = getDataStorePath(); File file = new File(dataDir + File.separator + profile + DATA_PATH_PROFILE_JSON); - if (file.exists()) { - if(!file.delete()){ - log.error("Failed to delete profile {}", file.getAbsolutePath()); + try { + Files.delete(Paths.get(dataDir + File.separator + profile + DATA_PATH_PROFILE_JSON)); + } catch (IOException e) { + log.error("Failed to delete profile {}"+file.getAbsolutePath()); } - } } public List<String> getProfiles() { List<String> profiles = new ArrayList<>(); String dataDir = getDataStorePath(); - for (File file: new File(dataDir).listFiles(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.endsWith(DATA_PATH_PROFILE_JSON); - } - })) { + for (File file: new File(dataDir).listFiles((dir, name) -> name.endsWith(DATA_PATH_PROFILE_JSON))) { String profile = file.getName().substring(0, file.getName().indexOf(DATA_PATH_PROFILE_JSON)); profiles.add(profile); } 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 0db96956..b2999077 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 @@ -68,6 +68,10 @@ import java.io.InputStreamReader; import java.io.FileInputStream; public class OnapCommandDiscoveryUtils { + private OnapCommandDiscoveryUtils() { + throw new IllegalStateException("Utility class"); + } + private static Gson gson = new GsonBuilder().serializeNulls().create(); /** @@ -214,8 +218,8 @@ public class OnapCommandDiscoveryUtils { * @throws OnapCommandInvalidSchema * exception */ - public static Map<String, ?> loadSchema(Resource resource) throws OnapCommandInvalidSchema { - Map<String, ?> values = null; + public static Map<String, Object> loadSchema(Resource resource) throws OnapCommandInvalidSchema { + Map<String, Object> values = null; try { values = loadYaml(resource.getInputStream()); } catch (Exception e) { @@ -336,22 +340,18 @@ public class OnapCommandDiscoveryUtils { Object obj = resourceMap.get(OPEN_CLI_SCHEMA_VERSION); if (obj == null) { - OnapCommandUtils.log.info("Invalid Schema yaml {}", schema.getSchemaURI()); - continue; + OnapCommandUtils.log.info("Invalid Schema yaml {}" + schema.getSchemaURI()); } - + else{ schema.setVersion(obj.toString()); if (!schema.getVersion().equalsIgnoreCase(OnapCommandConstants.OPEN_CLI_SCHEMA_VERSION_VALUE_1_0)) { - OnapCommandUtils.log.info("Unsupported Schema version found {}", schema.getSchemaURI()); - continue; + OnapCommandUtils.log.info("Unsupported Schema version found {} " + schema.getSchemaURI()); } + else{ //There are schema like default input parameters and does not have command name - if (resourceMap.get(NAME) == null) { - continue; - } - + if (resourceMap.get(NAME) != null) { schema.setSchemaName(resource.getFilename()); schema.setCmdName((String) resourceMap.get(NAME)); @@ -401,6 +401,9 @@ public class OnapCommandDiscoveryUtils { extSchemas.add(schema); } + } + } + } } } } catch (IOException e) { @@ -481,9 +484,10 @@ public class OnapCommandDiscoveryUtils { } - public static List<Map<String, ?>> createTestSuite(String cmd, String version) throws OnapCommandException { + public static List<Map<String, Object>> createTestSuite(String cmd, String version) throws OnapCommandException { + + ArrayList<Map<String, Object>> testSamples = new ArrayList(); - ArrayList<Map<String, ?>> testSamples = new ArrayList<>(); List<Resource> resources = new ArrayList<>(); OnapCommandSchemaInfo schemaInfo = getSchemaInfo(cmd, version); @@ -509,9 +513,9 @@ public class OnapCommandDiscoveryUtils { Map<String, Map<String, String>> samples = (Map<String, Map<String, String>>) stringMap .get(OnapCommandConstants.VERIFY_SAMPLES); - for (String sampleId : samples.keySet()) { - - Map<String, String> sample = samples.get(sampleId); + for (Map.Entry<String,Map<String, String>> entry : samples.entrySet()) { + String sampleId=entry.getKey(); + Map<String, String> sample = entry.getValue(); List<String> inputArgs = new ArrayList<>(); if (sample.get(OnapCommandConstants.VERIFY_INPUT) != null) { @@ -540,8 +544,8 @@ public class OnapCommandDiscoveryUtils { * @throws OnapCommandInvalidSchema * exception */ - public static Map<String, ?> loadYaml(Resource resource) throws OnapCommandInvalidSchema { - Map<String, ?> values = null; + public static Map<String, Object> loadYaml(Resource resource) throws OnapCommandInvalidSchema { + Map<String, Object> values = null; try { values = loadYaml(resource.getInputStream()); } catch (Exception e) { @@ -558,8 +562,8 @@ public class OnapCommandDiscoveryUtils { * @throws OnapCommandInvalidSchema * exception */ - public static Map<String, ?> loadYaml(String filePath) throws OnapCommandInvalidSchema { - Map<String, ?> values = null; + public static Map<String, Object> loadYaml(String filePath) throws OnapCommandInvalidSchema { + Map<String, Object> values = null; try { values = loadYaml(new FileInputStream(new File(filePath))); } catch (Exception e) { @@ -577,11 +581,11 @@ public class OnapCommandDiscoveryUtils { * @throws OnapCommandInvalidSchema * exception */ - public static Map<String, ?> loadYaml(InputStream inputStream) throws OnapCommandInvalidSchema { - Map<String, ?> values = null; + public static Map<String, Object> loadYaml(InputStream inputStream) throws OnapCommandInvalidSchema { + Map<String, Object> values = null; try(InputStreamReader inputStreamReader = new InputStreamReader(inputStream);){ YamlReader reader = new YamlReader(inputStreamReader); - values = (Map<String, ?>) reader.read(); + values = (Map<String, Object>) reader.read(); } catch (IOException e) { throw new OnapCommandInvalidSchema(inputStream.getClass().getName(),e.getMessage()); } diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java index e1150888..98a4af24 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandHelperUtils.java @@ -37,6 +37,10 @@ import org.onap.cli.fw.output.OnapCommandResultType; public class OnapCommandHelperUtils { + private OnapCommandHelperUtils() { + throw new IllegalStateException("Utility class"); + } + /** * Returns the build time from manifest.mf */ diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java index ea8e6480..60bf2d2b 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java @@ -252,13 +252,10 @@ public class OnapCommandUtils { String value = ""; - switch (splEntry) { - case OnapCommandConstants.SPL_ENTRY_UUID: + if (OnapCommandConstants.SPL_ENTRY_UUID.equals(splEntry)) { value = UUID.randomUUID().toString(); - break; - - default: - + } + else{ if (splEntry.startsWith(OnapCommandConstants.SPL_ENTRY_ENV)) { //start to read after env:ENV_VAR_NAME String envVarName = splEntry.substring(4); diff --git a/framework/src/main/java/org/onap/cli/fw/utils/ProcessRunner.java b/framework/src/main/java/org/onap/cli/fw/utils/ProcessRunner.java index 69df6075..62f5c9a3 100644 --- a/framework/src/main/java/org/onap/cli/fw/utils/ProcessRunner.java +++ b/framework/src/main/java/org/onap/cli/fw/utils/ProcessRunner.java @@ -118,27 +118,25 @@ public class ProcessRunner { readError = true; } - final OutputStream stdout = this.getStdout(); - final OutputStream stderr = this.getStderr(); + final OutputStream stdoutLocal = this.getStdout(); + final OutputStream stderrLocal = this.getStderr(); final InputStream stdoutP = p.getInputStream(); final InputStream stderrP = p.getErrorStream(); - Thread outThread = new Thread(new Runnable() { - public void run() { - try { - IOUtils.copy(stdoutP, stdout); - } catch (IOException e) { // NOSONAR - } + Thread outThread = new Thread(() -> { + try { + IOUtils.copy(stdoutP, stdoutLocal); + } catch (IOException e) { //NOSONAR + // Do nothing } }); - Thread errThread = new Thread(new Runnable() { - public void run() { - try { - IOUtils.copy(stderrP, stderr); - } catch (IOException e) { // NOSONAR - } + Thread errThread = new Thread(() -> { + try { + IOUtils.copy(stderrP, stderrLocal); + } catch (IOException e) { //NOSONAR + // Do nothing } }); |