From c360e0b97a40899c869fe00c596ea25b4db8e909 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 19 Apr 2020 06:01:27 +0200 Subject: [PATCH] Continued: - always validate parameter of public/package/protected methods and constructors - renamed i18nKey to messageKey MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../income/interval/FinancialInterval.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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; -- 2.39.5