Skip to content

Commit f516043

Browse files
committed
Simplify detection of invalid URI, avoid using 'path.of' due to FileSystemNotFoundException
1 parent a8c881a commit f516043

File tree

1 file changed

+3
-6
lines changed
  • game-core/src/main/java/games/strategy/engine/framework/startup/ui/panels/main/game/selector

1 file changed

+3
-6
lines changed

game-core/src/main/java/games/strategy/engine/framework/startup/ui/panels/main/game/selector/GameSelectorModel.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,11 @@ public void loadDefaultGameSameThread() {
213213

214214
@SuppressWarnings("ReturnValueIgnored")
215215
private static boolean gameUriExistsOnFileSystem(final String gameUri) {
216-
try {
217-
Path.of(URI.create(gameUri));
218-
} catch (final IllegalArgumentException ignored) {
219-
// thrown if the URI is invalid (EG: missing URI scheme)
216+
final URI uri = URI.create(gameUri);
217+
if (uri.getScheme() == null) {
220218
return false;
221219
}
222-
223-
final Path realPath = getDefaultGameRealPath(URI.create(gameUri));
220+
final Path realPath = getDefaultGameRealPath(uri);
224221

225222
// starts with check is because we don't want to load a game file by default that is not within
226223
// the map folders. (ie: if a previous version of triplea was using running a game within its

0 commit comments

Comments
 (0)