RFR: 8305945: (zipfs) Opening a directory to get input stream produces incorrect exception message [v5]
Lance Andersen
lancea at openjdk.org
Sat Apr 15 10:29:44 UTC 2023
On Sat, 15 Apr 2023 05:43:09 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Lance Andersen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> re-arrage assertEquals params
>
> test/jdk/jdk/nio/zipfs/ZipFSDirectoryExceptionMessageTest.java line 96:
>
>> 94: var file = zipfs.getPath(DIRECTORY_NAME);
>> 95: var x = assertThrows(FileSystemException.class, () -> Files.newInputStream(file));
>> 96: assertEquals(DIR_EXCEPTION_MESSAGE, x.getMessage());
>
> FYI, test doesn't need to depend the exception message. Checking FileSystemException::getOtherFile returns null would be a more robust way of checking that it didn't provide a second file by mistake, e.g.
>
> try {
> Files.newInputStream(DIRECTORY_NAME);
> fail();
> } catch (FileSystemException e) {
> assertNull(e.getOtherFile());
> } catch (IOException ioe) {
> // allowed
> }
added validation for other file being null but also kept the existing validation of the message
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13482#discussion_r1167471233
More information about the nio-dev
mailing list