]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sun, 25 Sep 2022 20:36:04 +0000 (22:36 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 25 Sep 2022 20:36:04 +0000 (22:36 +0200)
- 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)

src/java/org/mxchange/jfinancials/validator/business/headquarter/FinancialsHeadquarterCompanyNameValidator.java
src/java/org/mxchange/jfinancials/validator/emailaddress/branchoffice/FinancialsBranchOfficeEmailAddressValidator.java

index 3429409e1f71740f6aa9b544805bc419b86676a1..774b26b764989d97273c83ae52fb33378aad1f06 100644 (file)
@@ -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
index 6a9aee4a9ffecd617fb9268d9356126fc45f6d6a..9fff261f5ddec1dabad92b511ef65f80a2cb438e 100644 (file)
@@ -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
-        * <p>
-        * @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 ... ;-)