RFR: 8251329: (zipfs) Files.walkFileTree walks infinitely if zip has dir named "." inside [v2]
Lance Andersen
lancea at openjdk.java.net
Mon Jul 26 10:16:53 UTC 2021
On Mon, 26 Jul 2021 07:30:12 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Lance Andersen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add missing Copyright header and address minor comments
>
> src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java line 1573:
>
>> 1571: }
>> 1572: IndexNode inode = new IndexNode(cen, pos, nlen);
>> 1573: if(hasDotOrDotDot(inode.name)) {
>
> Minor nit, missing space in "if(".
fixed
> src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java line 1602:
>
>> 1600: // Inode.name always includes "/" in path[0]
>> 1601: if (path.length == 1) {
>> 1602: return false;
>
> It may be useful to add "assert path[0] == '/';" at the start of this method.
I added it per your suggestion, though IndexNode(byte[] cen, int pos, int nlen) which is only used by initCen() will already guarantee the leading "/" is there
> test/jdk/jdk/nio/zipfs/HasDotDotTest.java line 1:
>
>> 1: import org.testng.annotations.DataProvider;
>
> Missing copyright header.
Geez, how did I miss that. Added
-------------
PR: https://git.openjdk.java.net/jdk/pull/4900
More information about the nio-dev
mailing list