From 465ae8702016c184e632643b32907fe014b7094d 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) --- .../jjobs/enterprise/BaseJobsEnterpriseBean.java | 6 ++++++ .../model/user/JobsAdminUserSessionBean.java | 12 ++++++++++++ .../JobsUserEmailChangeSessionBean.java | 6 ++++++ .../register/JobsUserRegistrationSessionBean.java | 6 ++++++ .../user/resendlink/JobsResendLinkSessionBean.java | 6 ++++++ 5 files changed, 36 insertions(+) diff --git a/src/java/org/mxchange/jjobs/enterprise/BaseJobsEnterpriseBean.java b/src/java/org/mxchange/jjobs/enterprise/BaseJobsEnterpriseBean.java index e0198c9..8926e6b 100644 --- a/src/java/org/mxchange/jjobs/enterprise/BaseJobsEnterpriseBean.java +++ b/src/java/org/mxchange/jjobs/enterprise/BaseJobsEnterpriseBean.java @@ -1217,6 +1217,12 @@ public abstract class BaseJobsEnterpriseBean 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/JobsAdminUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/JobsAdminUserSessionBean.java index 6b92574..34fc601 100644 --- a/src/java/org/mxchange/jusercore/model/user/JobsAdminUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/JobsAdminUserSessionBean.java @@ -238,6 +238,12 @@ public class JobsAdminUserSessionBean extends BaseJobsEnterpriseBean implements } 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 JobsAdminUserSessionBean extends BaseJobsEnterpriseBean implements } 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/JobsUserEmailChangeSessionBean.java b/src/java/org/mxchange/jusercore/model/user/email_address/JobsUserEmailChangeSessionBean.java index b5c34eb..0787a62 100644 --- a/src/java/org/mxchange/jusercore/model/user/email_address/JobsUserEmailChangeSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/email_address/JobsUserEmailChangeSessionBean.java @@ -81,6 +81,12 @@ public class JobsUserEmailChangeSessionBean extends BaseJobsEnterpriseBean imple } 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/JobsUserRegistrationSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/register/JobsUserRegistrationSessionBean.java index 3b88dda..b99ddf8 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/register/JobsUserRegistrationSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/register/JobsUserRegistrationSessionBean.java @@ -120,6 +120,12 @@ public class JobsUserRegistrationSessionBean extends BaseJobsEnterpriseBean impl } 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/JobsResendLinkSessionBean.java b/src/java/org/mxchange/juserlogincore/model/user/resendlink/JobsResendLinkSessionBean.java index 4e18f63..7399af6 100644 --- a/src/java/org/mxchange/juserlogincore/model/user/resendlink/JobsResendLinkSessionBean.java +++ b/src/java/org/mxchange/juserlogincore/model/user/resendlink/JobsResendLinkSessionBean.java @@ -93,6 +93,12 @@ public class JobsResendLinkSessionBean extends BaseJobsEnterpriseBean implements } 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