From f516043a9d4ae146de4a6305165ce3a686a92a32 Mon Sep 17 00:00:00 2001 From: DanVanAtta Date: Sun, 1 Nov 2020 20:46:08 -0800 Subject: [PATCH] Simplify detection of invalid URI, avoid using 'path.of' due to FileSystemNotFoundException --- .../ui/panels/main/game/selector/GameSelectorModel.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/game-core/src/main/java/games/strategy/engine/framework/startup/ui/panels/main/game/selector/GameSelectorModel.java b/game-core/src/main/java/games/strategy/engine/framework/startup/ui/panels/main/game/selector/GameSelectorModel.java index 815fe6a5a66..fcfd19305dc 100644 --- a/game-core/src/main/java/games/strategy/engine/framework/startup/ui/panels/main/game/selector/GameSelectorModel.java +++ b/game-core/src/main/java/games/strategy/engine/framework/startup/ui/panels/main/game/selector/GameSelectorModel.java @@ -213,14 +213,11 @@ public void loadDefaultGameSameThread() { @SuppressWarnings("ReturnValueIgnored") private static boolean gameUriExistsOnFileSystem(final String gameUri) { - try { - Path.of(URI.create(gameUri)); - } catch (final IllegalArgumentException ignored) { - // thrown if the URI is invalid (EG: missing URI scheme) + final URI uri = URI.create(gameUri); + if (uri.getScheme() == null) { return false; } - - final Path realPath = getDefaultGameRealPath(URI.create(gameUri)); + final Path realPath = getDefaultGameRealPath(uri); // starts with check is because we don't want to load a game file by default that is not within // the map folders. (ie: if a previous version of triplea was using running a game within its