diff options
author | AvinashS <avinash.s@huawei.com> | 2017-09-22 12:57:19 +0000 |
---|---|---|
committer | AvinashS <avinash.s@huawei.com> | 2017-09-22 12:57:19 +0000 |
commit | c54c3683ac17c53a322ffc88deb05e56e9039d74 (patch) | |
tree | d6b352e3d6af529a2e43bf6c9c45bf3c1ecf04b3 /csarvalidation/src/main/java | |
parent | 279733c2a18ee32117a116aa22d80904625bd114 (diff) |
Fix double value validation
Fix double values in Meta file
validation fix
Change-Id: Ie4b7ae34566b060871c14b683d8d12386a53d395
IssueId: VNFSDK-96
Signed-off-by: AvinashS <avinash.s@huawei.com>
Diffstat (limited to 'csarvalidation/src/main/java')
-rw-r--r-- | csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java b/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java index 8263e6b..e542b65 100644 --- a/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java +++ b/csarvalidation/src/main/java/org/onap/validation/csar/CsarValidator.java @@ -53,6 +53,8 @@ public class CsarValidator { LOG.debug("CSAR extracted sucessfully."); } } catch (Exception e1) { + + //deleteDirectory(); LOG.error("CSAR %s is not a valid CSAR/ZIP file! ", e1); } @@ -165,7 +167,7 @@ public class CsarValidator { return true; } } - } catch (IOException e) { + } catch (IOException | NullPointerException e) { LOG.error("Could not read file %s ! " + e.getMessage(), cfile); } return false; @@ -185,10 +187,10 @@ public class CsarValidator { "vnfmType"); boolean tResult = checkEntryFor(CommonConstants.MAINSERV_TEMPLATE, tListMetadata, key); - if (tResult && mfResult) { - return true; - } else { + if (!tResult || !mfResult) { return false; + } else { + return true; } } @@ -212,20 +214,23 @@ public class CsarValidator { } Yaml yaml = new Yaml(); - Map<String, ?> values = null; + Map<String, ?> values; try { values = (Map<String, ?>) yaml.load(new FileInputStream(new File(tFileWithPath))); } catch (FileNotFoundException e) { return false; } - Map<String,String> subValues = (Map<String,String>) values.get(key); + Map<? super String,? super String> subValues = (Map<? super String, ? super String>) values.get(key); //1. Check for empty values in map and if number of mandatory attributes presence - List<String> lResultNonNull = subValues.values().stream() + List<? super String> lResultNonNull = subValues.values().stream() .filter(Objects::nonNull) + .map(Object::toString) .collect(Collectors.toList()); - if (subValues.size() != attributes.size() && + + + if (subValues.size() != attributes.size() && lResultNonNull.size() != attributes.size()) { return false; } |