RFR: JDK-8197398, (zipfs) Files.walkFileTree walk indefinitelly while processing JAR file with "/" as a directory inside.

Xueming Shen xueming.shen at oracle.com
Wed Aug 29 21:56:48 UTC 2018


On 8/29/18, 3:22 AM, Alan Bateman wrote:
> The approach looks okay, I think just wonder if the test could be 
> expanded to cover entry with repeated leading slashes.
>
> One nit is that hasAbsolutePath (and also the existing readOnly) 
> aren't final. One suggestion is for initCEN to return a CEN object 
> that defines array() and hasAbsolutePath() methods that you can use in 
> the constructor for the initializing the final fields.

It appears it's not necessary to have the "hasAbsolutePath" and pay the 
price to check in
initCEN(). I managed to do it locally inside copyLOCEntry(...).

http://cr.openjdk.java.net/~sherman/8197398/webrev/

Regarding "repeated leading slashes", I think you are opening another 
door for further
enhancement. We are not doing any real path normalization in 
ZipFileSystem for its existing
entry path, other than padding a "/" to make it like a normal path, 
mainly for better performance
when doing path lookup (while we do the normal normalization in ZipPath 
for String from external).
The zip spec basically does not specify anything regarding the canonical 
form of its entry
path normalization, exception "the entry is a dir if ends with a '/'. So 
it might be an
interesting RFE. the trade off is to have a more "complicated" logic 
somewhere during the
initialization.

Sherman


More information about the core-libs-dev mailing list