X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fvalidation%2FValidator.java;h=6d519c6413745c76ca083883c19c7cc42d1db769;hb=4a5f63f7f149ecba9556ee67a4ca00fb51845bf0;hp=c0f2f530c5cac305b44eeab5b3a653cdbb889bed;hpb=ba989d05eca8d2a98c51ed9d38c4c3345db23349;p=aaf%2Fauthz.git 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 c0f2f530..6d519c64 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 @@ -86,8 +86,15 @@ public class Validator { } protected final boolean noMatch(String str, Pattern p) { - return !p.matcher(str).matches(); + return str==null || !p.matcher(str).matches(); } + + protected final void match(String text, String str, Pattern p) { + if(str==null || !p.matcher(str).matches()) { + msg(text); + } + } + protected final boolean nob(String str, Pattern p) { return str==null || !p.matcher(str).matches(); } @@ -185,13 +192,16 @@ public class Validator { } public final Validator role(String user, String role) { + boolean quit = false; if(role==null) { msg("Role is null"); + quit = true; } if(user==null) { - msg("User is null"); + msg("User is null"); + quit = true; } - if(!err()) { + if(!quit) { if(role.startsWith(user) && role.endsWith(":user")) { if(!(role.length() == user.length() + 5)) { msg("Role [" + role + "] is invalid.");