RFR: 8273922: (fs) UserDefinedFileAttributeView doesn't handle file names that are just under the MAX_PATH limit (win) [v2]
Alan Bateman
alanb at openjdk.java.net
Tue Sep 21 18:41:33 UTC 2021
On Tue, 21 Sep 2021 16:03:59 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Modify `sun.nio.fs.WindowsUserDefinedFileAttributeView.join(WindowsPath,String)` to handle file names which exceed the limit.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8273922: Add bug ID to @bug in test
src/java.base/windows/classes/sun/nio/fs/WindowsUserDefinedFileAttributeView.java line 62:
> 60: StringBuilder sb = new StringBuilder(wp.getPathForWin32Calls());
> 61: sb.setCharAt(sb.length() - name.length() - 1, ':');
> 62: return sb.toString();
I suspect the right thing here is to parse "name" and maybe reject if it is not RELATIVE. Then concatenate and use createFromNormalizedPath(...) to create the WindowsPath. I expect it will be possible to reduce the number of conversions too although this isn't critical for now.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5594
More information about the nio-dev
mailing list