]> git.mxchange.org Git - juser-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 04:12:38 +0000 (06:12 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 04:12:38 +0000 (06:12 +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/jusercore/model/email_address/status/EmailChangeStatus.java
src/org/mxchange/jusercore/model/user/status/UserAccountStatus.java

index 64b1fb4d3570a04758072accf92e395f74bcfa3c..481538983846d732302096aca6f3071f8f227a2c 100644 (file)
@@ -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;
        }
index e5b9a1608e2a04351af74dc5a4778200278d1112..2caf6fd3895550815f08b034caf6f3dd67111bc8 100644 (file)
@@ -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;