Skip to content

Commit

Permalink
feat: Length check on input.
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
  • Loading branch information
Johannestegner committed Mar 8, 2023
1 parent d1b186f commit 3724a38
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ public int compareTo(Organisationsnummer other) {
}

private void innerParse(String input) throws OrganisationsnummerException {
if (input.length() > 13 || input.length() < 10) {
throw new OrganisationsnummerException("Input value too " + (input.length() > 13 ? "long" : "short"));
}

try {
Matcher matches = regexPattern.matcher(input);
if (!matches.find()) {
Expand Down

0 comments on commit 3724a38

Please sign in to comment.