RFR: 8263898: (fs) Files.newOutputStream on the "NUL" special device throws FileSystemException: "nul: Incorrect function" (win) [v5]

Brian Burkhalter brian.burkhalter at oracle.com
Mon Mar 29 18:20:08 UTC 2021


On Mar 27, 2021, at 8:57 AM, Alan Bateman <alanb at openjdk.java.net<mailto:alanb at openjdk.java.net>> wrote:

 8263898: Fix accidentally reverted copyright year

The change looks okay.

The test looks okay although there other cases that probably should be added at some point, in particular, FileChannel.open for reading, and AsynchronousFileChannel read & write.

Added.

test/jdk/java/nio/file/Files/NulDevice.java line 41:

39: public class NulDevice {
40:     public static void main(final String[] args) throws IOException {
41:         System.getProperties().list(System.out);

Is the printing of the system properties a left-over?

Yes, it is vestigial; removed.

On Mar 28, 2021, at 8:24 AM, Alan Bateman <alanb at openjdk.java.net<mailto:alanb at openjdk.java.net>> wrote:

test/jdk/java/nio/file/Files/NulDevice.java line 47:

45:             os.write(0x02);
46:             System.out.printf("Wrote a byte to %s%n", path);
47:             try (InputStream is = Files.newInputStream(path);) {

One other test that you could add here is to test that available() returns 0. I've no doubt there are many file operations that will behavior in surprising ways when using the special "NUL" device if the common operations work in unsurprising ways then it would help.

Added.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20210329/bb3abe45/attachment-0001.htm>


More information about the nio-dev mailing list