add validate condition for string parameters (#12)

This commit is contained in:
Anatolii Karlov 2019-02-28 18:01:30 +03:00 committed by GitHub
parent 0bc9c035ea
commit 8a631d9948
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@ import com.google.common.base.Strings;
public class CheckerUtil {
public static void checkString(String string, String exMessage) throws IllegalArgumentException {
if (Strings.isNullOrEmpty(string)) {
if (Strings.isNullOrEmpty(string) || string.contains(" ")) {
throw new IllegalArgumentException(exMessage);
}
}