From: Roland Häder Date: Sun, 20 Aug 2017 19:49:49 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ff76a45500f030b1d5b5ea773d3c66210c2e611a;p=addressbook-war.git 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 Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java b/src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java index abb00df5..b37dc742 100644 --- a/src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java +++ b/src/java/org/mxchange/addressbook/validator/birthday/AddressbookBirthdayValidator.java @@ -44,6 +44,7 @@ public class AddressbookBirthdayValidator extends BaseDateValidator implements V /** * Default constructor + * @TODO Get rid of this */ public AddressbookBirthdayValidator () { // Try to get it diff --git a/src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java b/src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java index 6537226e..12f435fa 100644 --- a/src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.java +++ b/src/java/org/mxchange/addressbook/validator/emailaddress/AddressbookEmailAddressValidator.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; @@ -131,7 +130,7 @@ public class AddressbookEmailAddressValidator extends BaseStringValidator implem AddressbookEmailAddressValidator.CONTACT_BEAN = (ContactSessionBeanRemote) initialContext.lookup("java:global/addressbook-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/addressbook/validator/phone/abroad/AddressbookAbroadDialValidator.java b/src/java/org/mxchange/addressbook/validator/phone/abroad/AddressbookAbroadDialValidator.java index 1faf2d98..a5d2b82e 100644 --- a/src/java/org/mxchange/addressbook/validator/phone/abroad/AddressbookAbroadDialValidator.java +++ b/src/java/org/mxchange/addressbook/validator/phone/abroad/AddressbookAbroadDialValidator.java @@ -47,14 +47,14 @@ public class AddressbookAbroadDialValidator extends BaseObjectValidator implemen 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) {