Skip to content

Commit 9637fdb

Browse files
committed
catch for NumberFormatException
1 parent 702e7f0 commit 9637fdb

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/main/java/dev/dsf/fhir/validator/implementation_guide/PackageVersions.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,18 @@ public Optional<String> getLatest(String versionPrefix)
8282
.filter(e -> e.getKey() != null && e.getKey().matches(versionPrefix + "\\d+")).map(Entry::getKey)
8383
.sorted(Comparator.comparingInt((String v) ->
8484
{
85-
Pattern p = Pattern.compile(versionPrefix + "(\\d+)");
86-
Matcher matcher = p.matcher(v);
87-
if (matcher.matches())
88-
return Integer.parseInt(matcher.group(1));
89-
else
90-
return -1;
85+
try
86+
{
87+
Pattern p = Pattern.compile(versionPrefix + "(\\d+)");
88+
Matcher matcher = p.matcher(v);
89+
if (matcher.matches())
90+
return Integer.parseInt(matcher.group(1));
91+
}
92+
catch (NumberFormatException e)
93+
{
94+
}
95+
96+
return -1;
9197
}).reversed()).findFirst();
9298
}
9399
}

0 commit comments

Comments
 (0)