]> git.mxchange.org Git - jcontacts-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 04:00:45 +0000 (06:00 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 04:11:32 +0000 (06:11 +0200)
- always validate parameter of public/package/protected methods and constructors
- renamed i18nKey to messageKey

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontacts/model/contact/gender/Gender.java
src/org/mxchange/jcontacts/model/contact/title/PersonalTitle.java

index cac582556d62d32350c6f3c4f0dd5df4be4412eb..bd1fc45fb84ab2efeec15446c10d333fcf0c998b 100644 (file)
@@ -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;
index a9a385313f9b3fc8d0b1f3c41822aa3d818a495e..36d30f3fbbd761009a8ebc8b62a14b70009dbbe6 100644 (file)
@@ -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;