Skip to content

Commit

Permalink
Parse long to avoid NumberFormatException on large numbers
Browse files Browse the repository at this point in the history
e.g. for https://lobid.org/resources/990054518830206441

Reported via email by I.N. on 2023-06-27
  • Loading branch information
fsteeg committed Jun 27, 2023
1 parent 1cc6ff5 commit 2da5faa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/app/controllers/resources/Lobid.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ public static boolean compareIsil(String i1, String i2) {
return numerical(i1) < numerical(i2);
}

private static int numerical(String s) {
private static long numerical(String s) {
// replace non-digits with 9, e.g. for DE-5 before DE-Walb1
return Integer.parseInt(s.replaceAll("\\D", "9"));
return Long.parseLong(s.replaceAll("\\D", "9"));
}

}

0 comments on commit 2da5faa

Please sign in to comment.