Skip to content

Commit 4f1eccf

Browse files
committed
Replace FileNotFoundException in FileBuilderImpl with NoSuchFileException
This keeps the exception handling consistent with the handling used elsewhere, since this API relies on the NIO API rather than the IO API for file system access.
1 parent 8924760 commit 4f1eccf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

java-compiler-testing/src/main/java/io/github/ascopes/jct/workspaces/impl/FileBuilderImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
import java.io.BufferedInputStream;
2323
import java.io.ByteArrayInputStream;
2424
import java.io.File;
25-
import java.io.FileNotFoundException;
2625
import java.io.IOException;
2726
import java.io.InputStream;
2827
import java.net.URL;
2928
import java.nio.charset.Charset;
3029
import java.nio.charset.StandardCharsets;
3130
import java.nio.file.Files;
31+
import java.nio.file.NoSuchFileException;
3232
import java.nio.file.OpenOption;
3333
import java.nio.file.Path;
3434
import java.nio.file.StandardOpenOption;
@@ -101,7 +101,7 @@ public ManagedDirectory copiedFromClassPath(ClassLoader classLoader, String reso
101101
return uncheckedIo(() -> {
102102
try (var input = classLoader.getResourceAsStream(resource)) {
103103
if (input == null) {
104-
throw new FileNotFoundException("classpath:" + resource);
104+
throw new NoSuchFileException("classpath:" + resource);
105105
}
106106

107107
return createFile(input);

0 commit comments

Comments
 (0)