mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8273922: (fs) UserDefinedFileAttributeView doesn't handle file names that are just under the MAX_PATH limit (win)
Reviewed-by: alanb
This commit is contained in:
parent
7115892f96
commit
684edbb4c8
2 changed files with 70 additions and 15 deletions
|
@ -51,8 +51,19 @@ class WindowsUserDefinedFileAttributeView
|
|||
throw new NullPointerException("'name' is null");
|
||||
return file + ":" + name;
|
||||
}
|
||||
|
||||
private String join(WindowsPath file, String name) throws WindowsException {
|
||||
return join(file.getPathForWin32Calls(), name);
|
||||
if (name == null)
|
||||
throw new NullPointerException("'name' is null");
|
||||
WindowsFileSystem wfs = file.getFileSystem();
|
||||
WindowsPath namePath = WindowsPath.parse(wfs, name);
|
||||
if (namePath.getRoot() != null)
|
||||
throw new IllegalArgumentException("'name' has a root component");
|
||||
if (namePath.getParent() != null)
|
||||
throw new IllegalArgumentException("'name' has more than one element");
|
||||
String path = join(file.getPathForWin32Calls(), name);
|
||||
WindowsPath wp = WindowsPath.createFromNormalizedPath(wfs, path);
|
||||
return wp.getPathForWin32Calls();
|
||||
}
|
||||
|
||||
private final WindowsPath file;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue