Skip to content

Commit 67bc02c

Browse files
committed
RandomAccessFileMode.create(Path) provides a better NullPointerException
message.
1 parent 43594ce commit 67bc02c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/org/apache/commons/io/RandomAccessFileMode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.FileNotFoundException;
2121
import java.io.RandomAccessFile;
2222
import java.nio.file.Path;
23+
import java.util.Objects;
2324

2425
/**
2526
* Access modes and factory methods for {@link RandomAccessFile}.
@@ -77,7 +78,7 @@ public RandomAccessFile create(final File file) throws FileNotFoundException {
7778
* @throws FileNotFoundException See {@link RandomAccessFile#RandomAccessFile(File, String)}.
7879
*/
7980
public RandomAccessFile create(final Path file) throws FileNotFoundException {
80-
return create(file.toFile());
81+
return create(Objects.requireNonNull(file.toFile(), "file"));
8182
}
8283

8384
/**

0 commit comments

Comments
 (0)