diff options
author | Jonathan Gathman <jonathan.gathman@att.com> | 2018-07-11 18:45:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-07-11 18:45:22 +0000 |
commit | 656c303eeb020d0763996a71d8a9705357013eb6 (patch) | |
tree | bb64d5f553430cf0548e788203ac5b44b428e6c7 /auth | |
parent | f1cefef7628297099d8c8d99671299088b3123cb (diff) | |
parent | 0e905b62dc538003ef54c671e08385ad4d9089d5 (diff) |
Merge "Sonar issues fixes in Validator"
Diffstat (limited to 'auth')
-rw-r--r-- | auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java index de20e476..8302e771 100644 --- a/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java +++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/validation/Validator.java @@ -43,9 +43,9 @@ public class Validator { public static final Pattern ID_CHARS = Pattern.compile("[\\w.-]+@[\\w.-]+"); public static final Pattern NAME_CHARS = Pattern.compile("[\\w.-]+"); public static final Pattern DESC_CHAR = Pattern.compile("["+ESSENTIAL+"\\x20]+"); - public static List<String> nsKeywords; - protected final Pattern actionChars; - protected final Pattern instChars; + protected static List<String> nsKeywords; + private final Pattern actionChars; + private final Pattern instChars; private StringBuilder msgs; static { @@ -110,7 +110,7 @@ public class Validator { if(res==null) { msgs.append("Result object is blank"); } else if(res.notOK()) { - msgs.append(res.getClass().getSimpleName() + " is not OK"); + msgs.append(res.getClass().getSimpleName()).append(" is not OK"); } return this; } @@ -130,10 +130,8 @@ public class Validator { } protected Validator description(String type, String description) { - if(description!=null) { - if(noMatch(description, DESC_CHAR)) { - msg(type + " Description is invalid."); - } + if (description != null && noMatch(description, DESC_CHAR)) { + msg(type + " Description is invalid."); } return this; } @@ -151,7 +149,7 @@ public class Validator { } else if(ns==null) { msg("Perm NS is null"); } else if(nob(type,NAME_CHARS)) { - msg("Perm Type [" + (ns+(type.length()==0?"":'.'))+type + "] is invalid."); + msg("Perm Type [" + (ns+(type.length()==0?"":'.')) + type + "] is invalid."); } return this; } @@ -208,4 +206,5 @@ public class Validator { return this; } + } |