From: Roland Häder Date: Sun, 25 Sep 2022 20:36:04 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b20ecda14fd7fce147b18a55285784fa390ef95f;p=jfinancials-war.git Please cherry-pick: - branch offices have optional email addresses (finally found the bug that you always must enter an email address while the form field is not marked as required) --- diff --git a/src/java/org/mxchange/jfinancials/validator/business/headquarter/FinancialsHeadquarterCompanyNameValidator.java b/src/java/org/mxchange/jfinancials/validator/business/headquarter/FinancialsHeadquarterCompanyNameValidator.java index 3429409e..774b26b7 100644 --- a/src/java/org/mxchange/jfinancials/validator/business/headquarter/FinancialsHeadquarterCompanyNameValidator.java +++ b/src/java/org/mxchange/jfinancials/validator/business/headquarter/FinancialsHeadquarterCompanyNameValidator.java @@ -51,7 +51,7 @@ public class FinancialsHeadquarterCompanyNameValidator extends BaseStringValidat final String[] requiredFields = {"companyName"}; //NOI18N // Pre-validation (example: not null, not a string, empty string ...) - super.preValidate(context, component, value, requiredFields, false); + super.preValidate(context, component, value, requiredFields, Boolean.FALSE); // Convert name to string (now securely checked in BaseStringValidator) final String companyName = (String) value; @@ -59,7 +59,7 @@ public class FinancialsHeadquarterCompanyNameValidator extends BaseStringValidat // Default is to check on existing names Boolean checkExisting = Boolean.TRUE; - // Is attribute "allowEmptyRequiredData" set? + // Is attribute "checkExisting" set? if (component.getAttributes().containsKey("checkExisting")) { //NOI18N // Get attribute final Object attribute = component.getAttributes().get("checkExisting"); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/validator/emailaddress/branchoffice/FinancialsBranchOfficeEmailAddressValidator.java b/src/java/org/mxchange/jfinancials/validator/emailaddress/branchoffice/FinancialsBranchOfficeEmailAddressValidator.java index 6a9aee4a..9fff261f 100644 --- a/src/java/org/mxchange/jfinancials/validator/emailaddress/branchoffice/FinancialsBranchOfficeEmailAddressValidator.java +++ b/src/java/org/mxchange/jfinancials/validator/emailaddress/branchoffice/FinancialsBranchOfficeEmailAddressValidator.java @@ -56,25 +56,10 @@ public class FinancialsBranchOfficeEmailAddressValidator extends BaseStringValid */ private static final long serialVersionUID = 187_536_745_607_196L; - /** - * Whether empty data is allowed - */ - private Boolean allowEmptyRequiredData; - /** * Default constructor */ public FinancialsBranchOfficeEmailAddressValidator () { - this.allowEmptyRequiredData = Boolean.FALSE; - } - - /** - * Setter for allowEmptyRequiredData flag - *

- * @param allowEmptyRequiredData Whether empty values are allowed - */ - public void setAllowEmptyRequiredData (final Boolean allowEmptyRequiredData) { - this.allowEmptyRequiredData = allowEmptyRequiredData; } @Override @@ -83,15 +68,12 @@ public class FinancialsBranchOfficeEmailAddressValidator extends BaseStringValid final String[] requiredFields = {"branchEmailAddress"}; //NOI18N // Pre-validation (example: not null, not a string, empty string ...) - super.preValidate(context, component, value, requiredFields, this.allowEmptyRequiredData); + super.preValidate(context, component, value, requiredFields, Boolean.TRUE); // Is the email address empty and allowed? - if (null == value && this.allowEmptyRequiredData) { + if (null == value) { // Then accept this here return; - } else if (null == value) { - // Abort here - throw new ValidatorException(new FacesMessage("No empty email address allowed.")); //NOI18N } // Get string from object ... ;-)