Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #16 from daschJulia/25562-make_phonenumber_validat…
Browse files Browse the repository at this point in the history
…ion_weaker

make validation check weaker
  • Loading branch information
contargo-development authored Jul 24, 2019
2 parents fcfaf77 + c44987d commit 403100e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.contargo.types.telephony.validation;

import net.contargo.types.Loggable;
import net.contargo.types.telephony.PhoneNumber;

import org.apache.commons.lang.StringUtils;
Expand All @@ -14,7 +15,7 @@
* @author Robin Jayasinghe - [email protected]
* @author Olle Törnström - [email protected]
*/
public class ValidPhoneNumberValidator implements ConstraintValidator<ValidPhoneNumber, String> {
public class ValidPhoneNumberValidator implements ConstraintValidator<ValidPhoneNumber, String>, Loggable {

private static final int PHONE_NUMBER_SIZE = 64;

Expand Down Expand Up @@ -51,8 +52,9 @@ public boolean isValid(String value, ConstraintValidatorContext cvc) {
}

if (!phoneNumber.isValidNumber()) {
reportConstraintViolation(cvc, "{PHONE_NUMBER_VALID}");
isValid = false;
// TODO: to be discussed if the phone numbers has to be validated harder. currently only log info if the number is not valid.
logger().info("PHONE_NUMBER_INVALID - the given number '{}' ist not valid!",
phoneNumber.getRawPhoneNumber());
}
}

Expand Down

0 comments on commit 403100e

Please sign in to comment.