From b9bda75e1225e1824eac3a35cc08033accda275d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 20 Aug 2017 21:49:49 +0200 Subject: [PATCH] Please cherry-pick: - throwing a ConverterException in a validator is wrong, maybe copy-paste did it? - added TODO for getting rid of wrong constructor in birthday validator - renamed variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../validator/birthday/FinancialsBirthdayValidator.java | 1 + .../emailaddress/FinancialsEmailAddressValidator.java | 3 +-- .../phone/abroad/FinancialsAbroadDialValidator.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/validator/birthday/FinancialsBirthdayValidator.java b/src/java/org/mxchange/jfinancials/validator/birthday/FinancialsBirthdayValidator.java index 521d43b0..cc663cbe 100644 --- a/src/java/org/mxchange/jfinancials/validator/birthday/FinancialsBirthdayValidator.java +++ b/src/java/org/mxchange/jfinancials/validator/birthday/FinancialsBirthdayValidator.java @@ -44,6 +44,7 @@ public class FinancialsBirthdayValidator extends BaseDateValidator implements Va /** * Default constructor + * @TODO Get rid of this */ public FinancialsBirthdayValidator () { // Try to get it diff --git a/src/java/org/mxchange/jfinancials/validator/emailaddress/FinancialsEmailAddressValidator.java b/src/java/org/mxchange/jfinancials/validator/emailaddress/FinancialsEmailAddressValidator.java index d9136055..d55cc6d2 100644 --- a/src/java/org/mxchange/jfinancials/validator/emailaddress/FinancialsEmailAddressValidator.java +++ b/src/java/org/mxchange/jfinancials/validator/emailaddress/FinancialsEmailAddressValidator.java @@ -21,7 +21,6 @@ import java.util.regex.Pattern; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; -import javax.faces.convert.ConverterException; import javax.faces.validator.FacesValidator; import javax.faces.validator.Validator; import javax.faces.validator.ValidatorException; @@ -114,7 +113,7 @@ public class FinancialsEmailAddressValidator extends BaseStringValidator impleme FinancialsEmailAddressValidator.CONTACT_BEAN = (ContactSessionBeanRemote) initialContext.lookup("java:global/jfinancials-ejb/contact!org.mxchange.jcontacts.contact.ContactSessionBeanRemote"); //NOI18N } catch (final NamingException ex) { // Continue to throw it - throw new ConverterException(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N + throw new ValidatorException(new FacesMessage(MessageFormat.format("initialContext.lookup() failed: {0}", ex.getMessage())), ex); //NOI18N } } diff --git a/src/java/org/mxchange/jfinancials/validator/phone/abroad/FinancialsAbroadDialValidator.java b/src/java/org/mxchange/jfinancials/validator/phone/abroad/FinancialsAbroadDialValidator.java index 98a89d24..616640dd 100644 --- a/src/java/org/mxchange/jfinancials/validator/phone/abroad/FinancialsAbroadDialValidator.java +++ b/src/java/org/mxchange/jfinancials/validator/phone/abroad/FinancialsAbroadDialValidator.java @@ -47,14 +47,14 @@ public class FinancialsAbroadDialValidator extends BaseObjectValidator implement super.preValidate(context, component, value, requiredFields, true); // Parse value as string first - String dial = String.valueOf(value); + String dialNumber = String.valueOf(value); // Is it not +? - if (!dial.equals("+")) { //NOI18N + if (!dialNumber.equals("+")) { //NOI18N // No, then try to ... try { // ..parse as number - Long number = Long.parseLong(dial); + Long number = Long.parseLong(dialNumber); // Not valid range? (1 - 99, very rude) if (number < 1 || number > 99) { -- 2.39.5