RFR: 8273961: [testbug] jdk/nio/zipfs/ZipFSTester.java fails if the path has plus character
Lance Andersen
lancea at openjdk.java.net
Mon Sep 20 18:25:55 UTC 2021
On Mon, 20 Sep 2021 14:08:13 GMT, Remilia Scarlet <github.com+22913521+1996scarlet at openjdk.org> wrote:
>> test/jdk/jdk/nio/zipfs/ZipFSTester.java line 689:
>>
>>> 687: throws Exception
>>> 688: {
>>> 689: var plusReplacedUri = path.toUri().toString().replace("+", "%2b");
>>
>> Thank you for your proposed patch.
>>
>> The path described in the bug is a bit unusual and not something we typically expect (or have seen).
>>
>> Please add a comment describing the purpose(maybe include a trivial example) of this change to make it more readily apparent to future maintainers.
>>
>> Not sure I am enamored with the name of the variable `plusReplacedUri`. Perhaps consider an alternative name.
>
> Thanks. It is a good idea to comment more information for maintainers.
>
> BTW, this bug is caused by the `newZipFileSystem` method, which assert its parameter `Path path` is utf-8 encoded.
> However, the path would not be encoded in most cases.
> So the `URLDecoder.decode(path.toUri().toString(), "utf8")` at line 692 may cause unexpected results,
>
> Maybe just remove the utf-8 decode logic is a valid option. What do you think?
We should leave it as is for now as it does test newFileSystem via a URI which is also supported.
Certainly it could be updated at a later date when replacement is added(or at least more coverage) to exercise Zip FS, newFileSystem via URI.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5574
More information about the nio-dev
mailing list