From: Roland Häder Date: Sun, 19 Apr 2020 03:59:33 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4717494e41842e65b62adc6bbe66dbe52469f5b5;p=jaddressbook-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/jaddressbook/model/addressbook/UserAddressbook.java b/src/org/mxchange/jaddressbook/model/addressbook/UserAddressbook.java index db8ed47..b36989b 100644 --- a/src/org/mxchange/jaddressbook/model/addressbook/UserAddressbook.java +++ b/src/org/mxchange/jaddressbook/model/addressbook/UserAddressbook.java @@ -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 diff --git a/src/org/mxchange/jaddressbook/model/addressbook/status/AddressbokStatus.java b/src/org/mxchange/jaddressbook/model/addressbook/status/AddressbokStatus.java index f100182..b898219 100644 --- a/src/org/mxchange/jaddressbook/model/addressbook/status/AddressbokStatus.java +++ b/src/org/mxchange/jaddressbook/model/addressbook/status/AddressbokStatus.java @@ -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 *

- * @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; }