RFR: 8276661: (fs) UserDefinedFileAttributeView no longer works with long path (win) [v3]
Alan Bateman
alanb at openjdk.java.net
Fri Nov 19 14:14:38 UTC 2021
On Fri, 19 Nov 2021 02:13:14 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Please consider this change which uses a new method `WindowsPath::getPathWithPrefixForWin32Calls`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8276661: Replace addPrefixIfAbsent() with addPrefix()
src/java.base/windows/classes/sun/nio/fs/WindowsPath.java line 304:
> 302: // Add long path prefix to path if required
> 303: static String addPrefixIfNeeded(String path) {
> 304: if (path.length() > MAX_PATH) {
We can change addPrefixIfNeeded to call addPrefix for long path. That would avoid duplicate the code to add the prefix.
test/jdk/java/nio/file/attribute/UserDefinedFileAttributeView/Basic.java line 258:
> 256: String host = java.net.InetAddress.getLocalHost().getHostName();
> 257: String uncName = "\\\\" + host + "\\" + elts[0] + "$" + elts[1];
> 258: Path uncPath = Path.of(uncName);
We might have to skip testing UNCs because it will be hard-to-impossible to be reliable in all environments.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6435
More information about the nio-dev
mailing list