diff --git a/tools/src/com.oracle.truffle.tools.chromeinspector/src/com/oracle/truffle/tools/chromeinspector/ScriptsHandler.java b/tools/src/com.oracle.truffle.tools.chromeinspector/src/com/oracle/truffle/tools/chromeinspector/ScriptsHandler.java index a3fc385b22cb..e7c49b4cd8b7 100644 --- a/tools/src/com.oracle.truffle.tools.chromeinspector/src/com/oracle/truffle/tools/chromeinspector/ScriptsHandler.java +++ b/tools/src/com.oracle.truffle.tools.chromeinspector/src/com/oracle/truffle/tools/chromeinspector/ScriptsHandler.java @@ -185,7 +185,7 @@ private String getSourceURL(Source source, TruffleContext truffleContext) { } else { try { return env.getTruffleFile(truffleContext, path).getAbsoluteFile().toUri().toString(); - } catch (SecurityException ex) { + } catch (UnsupportedOperationException | IllegalArgumentException | SecurityException ex) { if (File.separatorChar == '/') { return path; } else { diff --git a/tools/src/com.oracle.truffle.tools.dap/src/com/oracle/truffle/tools/dap/server/LoadedSourcesHandler.java b/tools/src/com.oracle.truffle.tools.dap/src/com/oracle/truffle/tools/dap/server/LoadedSourcesHandler.java index 1ad2e853f645..60e89b7be1f6 100644 --- a/tools/src/com.oracle.truffle.tools.dap/src/com/oracle/truffle/tools/dap/server/LoadedSourcesHandler.java +++ b/tools/src/com.oracle.truffle.tools.dap/src/com/oracle/truffle/tools/dap/server/LoadedSourcesHandler.java @@ -34,7 +34,7 @@ import com.oracle.truffle.tools.dap.types.LoadedSourceEvent; import java.net.URI; -import java.nio.file.InvalidPathException; +import java.nio.file.FileSystemNotFoundException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -205,7 +205,7 @@ private Pair getPath(Source source, TruffleContext truffleConte tFile = context.getEnv().getTruffleFile(truffleContext, path); } } - } catch (UnsupportedOperationException | InvalidPathException ex) { + } catch (UnsupportedOperationException | IllegalArgumentException | FileSystemNotFoundException ex) { // Unsupported URI/path } if (tFile != null) { @@ -218,7 +218,7 @@ private Pair getPath(Source source, TruffleContext truffleConte } else if (path != null) { try { srcRef = !context.getEnv().getTruffleFile(truffleContext, path).isReadable(); - } catch (SecurityException | InvalidPathException ex) { + } catch (UnsupportedOperationException | SecurityException | IllegalArgumentException ex) { // Can not verify readability srcRef = true; } diff --git a/truffle/src/com.oracle.truffle.api.instrumentation/src/com/oracle/truffle/api/instrumentation/TruffleInstrument.java b/truffle/src/com.oracle.truffle.api.instrumentation/src/com/oracle/truffle/api/instrumentation/TruffleInstrument.java index d4e98ef846c2..37ec94abc536 100644 --- a/truffle/src/com.oracle.truffle.api.instrumentation/src/com/oracle/truffle/api/instrumentation/TruffleInstrument.java +++ b/truffle/src/com.oracle.truffle.api.instrumentation/src/com/oracle/truffle/api/instrumentation/TruffleInstrument.java @@ -855,6 +855,10 @@ public TruffleFile getTruffleFile(URI uri) { * context. * @param path the absolute or relative path to create {@link TruffleFile} for * @return {@link TruffleFile} + * @throws UnsupportedOperationException when the {@link FileSystem} supports only + * {@link URI} + * @throws IllegalArgumentException if the {@code path} string cannot be converted to a + * {@link Path} * @since 23.0 */ public TruffleFile getTruffleFile(TruffleContext context, String path) { @@ -872,6 +876,10 @@ public TruffleFile getTruffleFile(TruffleContext context, String path) { * context. * @param uri the {@link URI} to create {@link TruffleFile} for * @return {@link TruffleFile} + * @throws UnsupportedOperationException when {@link URI} scheme is not supported + * @throws IllegalArgumentException if preconditions on the {@code uri} do not hold. + * @throws FileSystemNotFoundException is the file system, identified by the {@code uri}, + * does not exist and cannot be created automatically * @since 23.0 */ public TruffleFile getTruffleFile(TruffleContext context, URI uri) { diff --git a/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java b/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java index 0f90bcf606f4..e64d56a184f4 100644 --- a/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java +++ b/truffle/src/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java @@ -2899,6 +2899,8 @@ public TruffleFile getPublicTruffleFile(String path) { * @return {@link TruffleFile} * @throws UnsupportedOperationException when {@link URI} scheme is not supported * @throws IllegalArgumentException if preconditions on the {@code uri} do not hold. + * @throws FileSystemNotFoundException is the file system, identified by the {@code uri}, + * does not exist and cannot be created automatically * @since 19.3.0 */ @TruffleBoundary @@ -2960,6 +2962,8 @@ public TruffleFile getInternalTruffleFile(String path) { * @since 19.3.0 * @throws UnsupportedOperationException when {@link URI} scheme is not supported * @throws IllegalArgumentException if preconditions on the {@code uri} do not hold. + * @throws FileSystemNotFoundException is the file system, identified by the {@code uri}, + * does not exist and cannot be created automatically * @see #getTruffleFileInternal(URI, Predicate) * @see #getPublicTruffleFile(java.net.URI) */ @@ -3039,6 +3043,8 @@ public TruffleFile getTruffleFileInternal(String path, Predicate fi * @throws UnsupportedOperationException when the {@link FileSystem} supports only * {@link URI} * @throws IllegalArgumentException if preconditions on the {@code uri} do not hold. + * @throws FileSystemNotFoundException is the file system, identified by the {@code uri}, + * does not exist and cannot be created automatically * @since 21.1.0 * @see #getTruffleFileInternal(String, Predicate) * @see #getPublicTruffleFile(URI)