]> git.mxchange.org Git - jaddressbook-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 03:59:33 +0000 (05:59 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 04:11:20 +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/jaddressbook/model/addressbook/UserAddressbook.java
src/org/mxchange/jaddressbook/model/addressbook/status/AddressbokStatus.java

index db8ed4732296af9a744df625fadf4043cf7662fb..b36989b8cee50abdc710c2faf394879580afd387 100644 (file)
@@ -123,7 +123,7 @@ public class UserAddressbook implements Addressbook {
         * @param addressbookUser User instance
         */
        public UserAddressbook (final String addressbookName, final User addressbookUser) {
-               // Call default constructor
+               // Invoke default constructor
                this();
 
                // Set name and user instance
index f100182b7d709b05ecbdc5b239de9799f987b7c8..b898219a2fbd7ea6484a4101b96bfafa28744beb 100644 (file)
@@ -26,12 +26,12 @@ import java.io.Serializable;
 public enum AddressbokStatus implements Serializable {
 
        /**
-        * When the addressbook is unlocked
+        * When the address book is unlocked
         */
        UNLOCKED("ADDRESSBOOK_STATUS_UNLOCKED"), //NOI18N
 
        /**
-        * When the addressbook is locked by administrator
+        * When the address book is locked by administrator
         */
        LOCKED("ADDRESSBOOK_STATUS_LOCKED"); //NOI18N
 
@@ -43,9 +43,19 @@ public enum AddressbokStatus implements Serializable {
        /**
         * Constructor
         * <p>
-        * @param messageKey Message key for this enum
+        * @param messageKey Message key for this enumeration
         */
        private AddressbokStatus (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 message key
                this.messageKey = messageKey;
        }