diff options
author | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2017-12-01 05:02:29 +0530 |
---|---|---|
committer | Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com> | 2017-12-01 05:05:33 +0530 |
commit | aed22f51f05a31d3189d8882d4f9e6c82470598b (patch) | |
tree | ae5a373875be5d5ad957e1236f91d214f4d21213 /framework/src/main/java/org/onap | |
parent | 14b284860b8a04fdf2d4dee49c81ad4e021a26a6 (diff) |
Optimze invalid params checkv1.1.01.0.0-ONAP1.0.0-Amsterdamrelease-1.1.0
Issue-ID: CLI-83
Change-Id: I163251d99ff1cfaf3cbc20cf397cbab0b5d9a264
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'framework/src/main/java/org/onap')
-rw-r--r-- | framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java | 13 |
1 files changed, 6 insertions, 7 deletions
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 77d50171..4a340dab 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 @@ -218,7 +218,7 @@ public class OnapCommandUtils { private static InputStream loadSchemaFromFile(String schemaLocation) throws OnapCommandInvalidSchema { File schemaFile = new File(schemaLocation); try { - FileInputStream inputFileStream = new FileInputStream(schemaFile); + FileInputStream inputFileStream = new FileInputStream(schemaFile); // NOSONAR if (!schemaFile.isFile()) { throw new OnapCommandInvalidSchema(schemaFile.getName(), SCHEMA_FILE_NOT_EXIST); } @@ -294,15 +294,14 @@ public class OnapCommandUtils { } } - List<String> invalidExclude = excludeAuthParams.stream().filter(includeParams::contains) + List<String> invalidParams = excludeAuthParams.stream().filter(includeParams::contains) .collect(Collectors.toList()); - List<String> invalidInclude = includeAuthParams.stream().filter(excludeParams::contains) - .filter(p->!includeParams.contains(p)).collect(Collectors.toList()); + invalidParams.addAll(includeAuthParams.stream().filter(excludeParams::contains) + .filter(p->!includeParams.contains(p)).collect(Collectors.toList())); - if (!invalidExclude.isEmpty() || !invalidInclude.isEmpty()) { - throw new OnapCommandInvalidDefaultParameter(Stream.concat(invalidExclude.stream(), invalidInclude.stream()) - .collect(Collectors.toList())); + if (!invalidParams.isEmpty()) { + throw new OnapCommandInvalidDefaultParameter(invalidParams); } |