From a03cb7cb5e88671385d74e338724bd00fe0e145f 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) --- .../model/user/PizzaAdminUserSessionBean.java | 12 ++++++++++++ .../PizzaUserEmailChangeSessionBean.java | 6 ++++++ .../register/PizzaUserRegistrationSessionBean.java | 6 ++++++ .../user/resendlink/PizzaResendLinkSessionBean.java | 6 ++++++ .../enterprise/BasePizzaEnterpriseBean.java | 6 ++++++ 5 files changed, 36 insertions(+) diff --git a/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java index 5670b50..5fe06a9 100644 --- a/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/PizzaAdminUserSessionBean.java @@ -239,6 +239,12 @@ public class PizzaAdminUserSessionBean extends BasePizzaEnterpriseBean implement } 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 @@ -300,6 +306,12 @@ public class PizzaAdminUserSessionBean extends BasePizzaEnterpriseBean implement } 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/PizzaUserEmailChangeSessionBean.java b/src/java/org/mxchange/jusercore/model/user/email_address/PizzaUserEmailChangeSessionBean.java index 3614983..d3099af 100644 --- a/src/java/org/mxchange/jusercore/model/user/email_address/PizzaUserEmailChangeSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/email_address/PizzaUserEmailChangeSessionBean.java @@ -81,6 +81,12 @@ public class PizzaUserEmailChangeSessionBean extends BasePizzaEnterpriseBean imp } 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/PizzaUserRegistrationSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java index 47766e1..79ae7c5 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/register/PizzaUserRegistrationSessionBean.java @@ -120,6 +120,12 @@ public class PizzaUserRegistrationSessionBean extends BasePizzaEnterpriseBean im } 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/PizzaResendLinkSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/resendlink/PizzaResendLinkSessionBean.java index b189ba7..3e374fb 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/resendlink/PizzaResendLinkSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/resendlink/PizzaResendLinkSessionBean.java @@ -93,6 +93,12 @@ public class PizzaResendLinkSessionBean extends BasePizzaEnterpriseBean implemen } 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 diff --git a/src/java/org/mxchange/pizzaapplication/enterprise/BasePizzaEnterpriseBean.java b/src/java/org/mxchange/pizzaapplication/enterprise/BasePizzaEnterpriseBean.java index 022609e..7e56c9d 100644 --- a/src/java/org/mxchange/pizzaapplication/enterprise/BasePizzaEnterpriseBean.java +++ b/src/java/org/mxchange/pizzaapplication/enterprise/BasePizzaEnterpriseBean.java @@ -1489,6 +1489,12 @@ public abstract class BasePizzaEnterpriseBean 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 -- 2.39.5