From: Roland Häder Date: Sun, 19 Apr 2020 04:12:38 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=53a805f689a4c183a9addd214ea250bd50116799;p=juser-core.git Continued: - always validate parameter of public/package/protected methods and constructors - renamed i18nKey to messageKey Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jusercore/model/email_address/status/EmailChangeStatus.java b/src/org/mxchange/jusercore/model/email_address/status/EmailChangeStatus.java index 64b1fb4..4815389 100644 --- a/src/org/mxchange/jusercore/model/email_address/status/EmailChangeStatus.java +++ b/src/org/mxchange/jusercore/model/email_address/status/EmailChangeStatus.java @@ -41,7 +41,8 @@ public enum EmailChangeStatus implements Serializable { WITHDRAWN("EMAIL_CHANGE_STATUS_WITHDRAWN"), //NOI18N /** - * User has "deleted" the entry. This is not done to keep a history of email changes. + * User has "deleted" the entry. This is not done to keep a history of email + * changes. */ DELETED("EMAIL_CHANGE_STATUS_DELETED"); //NOI18N @@ -56,6 +57,15 @@ public enum EmailChangeStatus implements Serializable { * @param messageKey Message key (i18n) */ private EmailChangeStatus (final String messageKey) { + // Validate parameter + if (null == messageKey) { + // Throw NPE + throw new NullPointerException("messageKey is null"); //NOI18N + } else if (messageKey.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("messageKey is empty"); //NOI18N + } + // Set it here this.messageKey = messageKey; } diff --git a/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java b/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java index e5b9a16..2caf6fd 100644 --- a/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java +++ b/src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java @@ -57,6 +57,21 @@ public enum UserAccountStatus implements Serializable { * @param styleClass CSS style class */ private UserAccountStatus (final String messageKey, final String styleClass) { + // Validate parameter + if (null == messageKey) { + // Throw NPE + throw new NullPointerException("messageKey is null"); //NOI18N + } else if (messageKey.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("messageKey is empty"); //NOI18N + } else if (null == styleClass) { + // Throw NPE + throw new NullPointerException("styleClass is null"); //NOI18N + } else if (styleClass.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("styleClass is empty"); //NOI18N + } + // Set it here this.messageKey = messageKey; this.styleClass = styleClass;