RFR: 8255576: (fs) Files.isHidden() throws ArrayIndexOutOfBoundsException (unix) [v3]

Christian Stein cstein at openjdk.java.net
Sat Oct 31 20:12:54 UTC 2020


On Sat, 31 Oct 2020 17:35:38 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>>> For the test then I don't think we need to catch AIOOB, the test should fail if any exception is thrown.
>> 
>> Okay, I'll change the catch clause to throw on any `RuntimeException` caught. Or is it also fine to omit the try-catch statements and not provide a specific failure message?
>> 
>>> ... scenario where it would be sensible to run the tests when in a hidden directory ...
>> 
>> What about testing that new scenario additionally to the plain one passing an empty `Path`?
>> 
>> That new scenario would include:
>>   - create a hidden directory in platform-agnostic manner
>>   - start a test program using this directory as the working directory
>>   - assert (by checking the output of the test program?) isHidden returned false
>
> Thanks for the update, I think I would put an assertFalse around this because the current directory shouldn't be hidden.
> 
> Creating a new VM that runs in a hidden directory is probably a stretch. I don't think it is strictly required here but don't object to reviewing any proposals if you are interested in spending time on it.

I wrapped a "logical assertFalse" around the call -- there were already 32 cases of `assertTrue(! ...)` via https://github.com/openjdk/jdk/pull/952/commits/c27abeab3a38daf2ae5dc25894c8b966d9edfc58

I want to defer such a check to a different issue. If there was a feature like "chroot(Path)", or a virtual file system that could be mapped to the default one so that Path("") resolves to a hidden working directory ... or something else that's better (and faster) than spawning a new VM.

-------------

PR: https://git.openjdk.java.net/jdk/pull/952


More information about the nio-dev mailing list