RFR: 8273922: (fs) UserDefinedFileAttributeView doesn't handle file names that are just under the MAX_PATH limit (win) [v3]

Alan Bateman alanb at openjdk.java.net
Sun Oct 31 17:24:13 UTC 2021


On Thu, 21 Oct 2021 21:36:37 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/windows/classes/sun/nio/fs/WindowsUserDefinedFileAttributeView.java line 64:
>> 
>>> 62:         String path = join(file.getPathForWin32Calls(), name);
>>> 63:         WindowsPath wp = WindowsPath.createFromNormalizedPath(wfs, path);
>>> 64:         return wp.getPathForWin32Calls();
>> 
>> I think we can simplify this to avoid most of the conversions, I'll get back to you soon with a proposal for this.
>
> Do you have any further suggestions on this? Thanks.

One thing I'm still mulling over here is whether there should be a check that namePath only has one name element.  That is, I think "join" should probably reject the name if it has a root component or has more than one name element. That would replace the check for an absolute path because that would imply a root component.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5594


More information about the nio-dev mailing list