From: Roland Häder Date: Sun, 19 Apr 2020 04:01:27 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c360e0b97a40899c869fe00c596ea25b4db8e909;p=jbonuscard-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/jfinancials/model/income/interval/FinancialInterval.java b/src/org/mxchange/jfinancials/model/income/interval/FinancialInterval.java index 3a40035..8ea6b18 100644 --- a/src/org/mxchange/jfinancials/model/income/interval/FinancialInterval.java +++ b/src/org/mxchange/jfinancials/model/income/interval/FinancialInterval.java @@ -58,10 +58,25 @@ public enum FinancialInterval implements Serializable { /** * Constructor with i18n translation key and CSS style class *

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