Skip to content

Commit

Permalink
Simplify detection of invalid URI, avoid using 'path.of' due to FileS…
Browse files Browse the repository at this point in the history
…ystemNotFoundException
  • Loading branch information
DanVanAtta committed Nov 2, 2020
1 parent a8c881a commit f516043
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f516043

Please sign in to comment.