This repository has been archived by the owner on Feb 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from daschJulia/25562-make_phonenumber_validat…
…ion_weaker make validation check weaker
- Loading branch information
Showing
1 changed file
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
@@ -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; | ||
|
||
|
@@ -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()); | ||
} | ||
} | ||
|
||
|