]> git.mxchange.org Git - jcustomer-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 04:01:08 +0000 (06:01 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 04:11:40 +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/jcustomercore/model/customer/ContactCustomer.java
src/org/mxchange/jcustomercore/model/customer/status/CustomerAccountStatus.java

index 72029c767f8b3eb4533efa812843009eaa0dfef2..6b95a619d0b2eb46c443a32556159bbbf5a58f00 100644 (file)
@@ -142,6 +142,21 @@ public class ContactCustomer implements Customer {
                // Call other constructor
                this();
 
+               // Validate parameter
+               if (null == customerAccountStatus) {
+                       // Throw NPE
+                       throw new NullPointerException("customerAccountStatus is null"); //NOI18N
+               } else if (null == customerContact) {
+                       // Throw NPE again
+                       throw new NullPointerException("customerContact is null"); //NOI18N
+               } else if (null == customerNumber) {
+                       // Throw NPE again
+                       throw new NullPointerException("customerNumber is null"); //NOI18N
+               } else if (customerNumber.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("customerNumber is empty"); //NOI18N
+               }
+
                // Set all parameter
                this.customerAccountStatus = customerAccountStatus;
                this.customerContact = customerContact;
index c873b5bcabd616a8314c36e708ed569aca060b28..98a0e43f4e51fb8f33b240d36a7b7778e1996f85 100644 (file)
@@ -57,6 +57,21 @@ public enum CustomerAccountStatus implements Serializable {
         * @param styleClass CSS style class
         */
        private CustomerAccountStatus (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;