diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-06-15 13:38:56 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-06-15 13:38:56 +0200 |
commit | 29b6f2ad9b8ec93a2d51bad2fdd7a11176068f40 (patch) | |
tree | a13ba05538630b8a2851e1b09b96252be06b14d3 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku | |
parent | 872dbc989a692d51e9718c399ce62e4212783455 (diff) | |
download | pdf-over-29b6f2ad9b8ec93a2d51bad2fdd7a11176068f40.tar.gz pdf-over-29b6f2ad9b8ec93a2d51bad2fdd7a11176068f40.tar.bz2 pdf-over-29b6f2ad9b8ec93a2d51bad2fdd7a11176068f40.zip |
return username unchanged if it doesn't look like a phone number, cf. #88
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java index ee291b51..8decae83 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java @@ -31,7 +31,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.bku.BKUHelper; -import at.asit.pdfover.gui.exceptions.InvalidNumberException; import at.asit.pdfover.gui.exceptions.InvalidPasswordException; import at.asit.pdfover.gui.exceptions.PasswordTooLongException; import at.asit.pdfover.gui.exceptions.PasswordTooShortException; @@ -201,10 +200,8 @@ public class MobileBKUHelper { * * @param number * @return the normalized Phone number - * @throws InvalidNumberException */ - public static String normalizeMobileNumber(String number) - throws InvalidNumberException { + public static String normalizeMobileNumber(String number) { // Verify number and normalize number = number.replaceAll("\\s",""); @@ -212,12 +209,11 @@ public class MobileBKUHelper { Pattern pattern = Pattern.compile(NUMBER_REGEX); Matcher matcher = pattern.matcher(number); - if (!matcher.find()) { - throw new InvalidNumberException(); - } + if (!matcher.find()) + return number; /* might be an idA username, return unchanged */ if (matcher.groupCount() != 6) { - throw new InvalidNumberException(); + return number; } String countryCode = matcher.group(1); |