]> git.mxchange.org Git - jbonuscard-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 04:01:27 +0000 (06:01 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 19 Apr 2020 04:11:49 +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/jfinancials/model/income/interval/FinancialInterval.java

index 3a400359f33684c16406a1ba83eacfc808d16a46..8ea6b180c41475bb98e2347255230240b49e3acc 100644 (file)
@@ -58,10 +58,25 @@ public enum FinancialInterval implements Serializable {
        /**
         * Constructor with i18n translation key and CSS style class
         * <p>
-        * @param messageKey  Message key (i18n)
+        * @param messageKey Message key (i18n)
         * @param styleClass CSS style class
         */
        private FinancialInterval (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;