From: Roland Häder Date: Sun, 19 Apr 2020 04:00:45 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7df4118c9b2349af841c0d43d96fa1400084c7d4;p=jcontacts-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/jcontacts/model/contact/gender/Gender.java b/src/org/mxchange/jcontacts/model/contact/gender/Gender.java index cac5825..bd1fc45 100644 --- a/src/org/mxchange/jcontacts/model/contact/gender/Gender.java +++ b/src/org/mxchange/jcontacts/model/contact/gender/Gender.java @@ -53,6 +53,15 @@ public enum Gender implements Serializable { * @param messageKey Message key for resource file */ private Gender (final char accessChar, 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 both this.accessChar = accessChar; this.messageKey = messageKey; diff --git a/src/org/mxchange/jcontacts/model/contact/title/PersonalTitle.java b/src/org/mxchange/jcontacts/model/contact/title/PersonalTitle.java index a9a3853..36d30f3 100644 --- a/src/org/mxchange/jcontacts/model/contact/title/PersonalTitle.java +++ b/src/org/mxchange/jcontacts/model/contact/title/PersonalTitle.java @@ -53,6 +53,15 @@ public enum PersonalTitle implements Serializable { * @param messageKey Message key for resource file */ private PersonalTitle (final char accessChar, 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 both this.accessChar = accessChar; this.messageKey = messageKey;