Skip to content

Commit

Permalink
[GR-49636] Correct the thrown exceptions in Javadoc of getTruffleFile.
Browse files Browse the repository at this point in the history
PullRequest: graal/15871
  • Loading branch information
entlicher committed Nov 2, 2023
2 parents 2185e97 + 2913b32 commit 635d2d0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -205,7 +205,7 @@ private Pair<String, Boolean> 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) {
Expand All @@ -218,7 +218,7 @@ private Pair<String, Boolean> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
*/
Expand Down Expand Up @@ -3039,6 +3043,8 @@ public TruffleFile getTruffleFileInternal(String path, Predicate<TruffleFile> 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)
Expand Down

0 comments on commit 635d2d0

Please sign in to comment.