From 5294f489d6ae48caf220bfe9680d85003b9dbd33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 20 Oct 2022 05:44:06 +0200 Subject: [PATCH] Please cherry-pick: - added check for parameter "baseUrl" (null and empty) --- .../enterprise/BaseFinancialsEnterpriseBean.java | 6 ++++++ .../model/user/FinancialsAdminUserSessionBean.java | 12 ++++++++++++ .../FinancialsUserEmailChangeSessionBean.java | 6 ++++++ .../FinancialsUserRegistrationSessionBean.java | 6 ++++++ .../resendlink/FinancialsResendLinkSessionBean.java | 6 ++++++ 5 files changed, 36 insertions(+) diff --git a/src/java/org/mxchange/jfinancials/enterprise/BaseFinancialsEnterpriseBean.java b/src/java/org/mxchange/jfinancials/enterprise/BaseFinancialsEnterpriseBean.java index a0cd964..8485903 100644 --- a/src/java/org/mxchange/jfinancials/enterprise/BaseFinancialsEnterpriseBean.java +++ b/src/java/org/mxchange/jfinancials/enterprise/BaseFinancialsEnterpriseBean.java @@ -1184,6 +1184,12 @@ public abstract class BaseFinancialsEnterpriseBean extends BaseEnterpriseBean { } else if (this.getSession() == null) { // Throw NPE throw new NullPointerException("this.session is not set. Have you forgotten to call super(String, String) and called only super() ?"); //NOI18N + } else if (null == baseUrl) { + // Throw NPE again + throw new NullPointerException("baseUrl is null"); //NOI18N + } else if (baseUrl.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("baseUrl is empty"); //NOI18N } // Set all values diff --git a/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java index 1e1a023..7e3895e 100644 --- a/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/FinancialsAdminUserSessionBean.java @@ -238,6 +238,12 @@ public class FinancialsAdminUserSessionBean extends BaseFinancialsEnterpriseBean } else if (userLockReason.isEmpty()) { // Is empty throw new IllegalArgumentException("userLockReason is empty"); //NOI18N + } else if (null == baseUrl) { + // Throw NPE again + throw new NullPointerException("baseUrl is null"); //NOI18N + } else if (baseUrl.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("baseUrl is empty"); //NOI18N } // Remove contact instance as this is not updated @@ -299,6 +305,12 @@ public class FinancialsAdminUserSessionBean extends BaseFinancialsEnterpriseBean } else if (user.getUserAccountStatus() == UserAccountStatus.UNCONFIRMED) { // Account is unconfirmed throw new UserStatusUnconfirmedException(user); + } else if (null == baseUrl) { + // Throw NPE again + throw new NullPointerException("baseUrl is null"); //NOI18N + } else if (baseUrl.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("baseUrl is empty"); //NOI18N } // Remove contact instance as this is not updated diff --git a/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java b/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java index 0e583eb..2114aa5 100644 --- a/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/email_address/FinancialsUserEmailChangeSessionBean.java @@ -81,6 +81,12 @@ public class FinancialsUserEmailChangeSessionBean extends BaseFinancialsEnterpri } else if (this.isEmailAddressEnqueued(emailChange.getEmailAddress())) { // Email address is already enqueued throw new EJBException(MessageFormat.format("Email address {0} is already enqueued.", emailChange.getEmailAddress())); //NOI18N + } else if (null == baseUrl) { + // Throw NPE again + throw new NullPointerException("baseUrl is null"); //NOI18N + } else if (baseUrl.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("baseUrl is empty"); //NOI18N } // The email change is not (yet) there, add secure hash and "created" timestamp diff --git a/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java index 17b9524..1c2a668 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/register/FinancialsUserRegistrationSessionBean.java @@ -120,6 +120,12 @@ public class FinancialsUserRegistrationSessionBean extends BaseFinancialsEnterpr } else if (user.getUserContact().getContactEmailAddress().isEmpty()) { // Is empty throw new IllegalArgumentException("user.userContact.contactEmailAddress is empty"); //NOI18N + } else if (null == baseUrl) { + // Throw NPE again + throw new NullPointerException("baseUrl is null"); //NOI18N + } else if (baseUrl.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("baseUrl is empty"); //NOI18N } // Check if user is registered diff --git a/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java index 831ece4..fb03931 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/resendlink/FinancialsResendLinkSessionBean.java @@ -93,6 +93,12 @@ public class FinancialsResendLinkSessionBean extends BaseFinancialsEnterpriseBea } else if (null == locale) { // Locale should be set throw new NullPointerException("locale is null"); //NOI18N + } else if (null == baseUrl) { + // Throw NPE again + throw new NullPointerException("baseUrl is null"); //NOI18N + } else if (baseUrl.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("baseUrl is empty"); //NOI18N } // Get new registration key -- 2.39.5