Skip to content

Commit

Permalink
Merge pull request #15 from Johannestegner/feature/length-check-in-parse
Browse files Browse the repository at this point in the history
feat: Length check on input.
  • Loading branch information
Johannestegner authored Mar 9, 2023
2 parents 0ab28d9 + 3724a38 commit c0bffd1
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 c0bffd1

Please sign in to comment.