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 #13 from daschJulia/25562-fix_null_number_regex
Browse files Browse the repository at this point in the history
optimize validation for null number
  • Loading branch information
contargo-development authored Jul 2, 2019
2 parents 8db9c7f + 1c53d05 commit e99c473
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
10 changes: 10 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Contargo Types
===============

## v0.17.7

* fix regex for the check of number contains only zeros. A number which starts with a +
was always not a null number but it should be.

## v0.17.6

* fix ValidPhoneNumberValidator before always returns false if the number was valid.
Now is valid is true if the number is correct.

## v0.17.5

* Optimize ValidPhoneNumberValidator, checking for different constraints such as phone number is zero number, can not be formatted or is to long.
Expand Down
15 changes: 1 addition & 14 deletions src/main/java/net/contargo/types/telephony/PhoneNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public final class PhoneNumber implements Loggable {
private Country country;
private final String rawPhoneNumber;
private String phoneExtension;
private boolean isMobile = false;

public PhoneNumber() {

Expand Down Expand Up @@ -132,19 +131,7 @@ public boolean canBeFormatted() {

public boolean containsOnlyZeros() {

return rawPhoneNumber.matches("0+$");
}


public boolean isMobile() {

return isMobile;
}


public void setMobile(boolean mobile) {

isMobile = mobile;
return rawPhoneNumber.matches("^\\+?0+$");
}


Expand Down

0 comments on commit e99c473

Please sign in to comment.