[13] 8215467: Files.isHidden should return true for hidden directories on Windows
Brian Burkhalter
brian.burkhalter at oracle.com
Thu Jan 17 20:58:17 UTC 2019
https://bugs.openjdk.java.net/browse/JDK-8215467
For Windows folders the read-only attribute is meaningless but the hidden attribute has meaning. With a folder's read-only attribute set, it is possible to create and append to a file within that folder. This appears to be the case whether the read-only attribute is set on the folder either before or after the contained file is created and written to. The hidden attribute does appear to be meaningful as, unless explicitly configured to display hidden folders, Windows Explorer does not display them if the hidden attribute is set.
A change to the verbiage of the java.nio.file.Files.isHidden() specification is also called for. A CSR for this is [1] which includes a description of the proposed update. The implementation update is included below [2].
Thanks,
Brian
[1] CSR: https://bugs.openjdk.java.net/browse/JDK-8217168 (also in need of review)
[2] Implementation diff:
--- a/src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java
+++ b/src/java.base/windows/classes/sun/nio/fs/WindowsFileSystemProvider.java
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -464,21 +464,18 @@
public boolean isHidden(Path obj) throws IOException {
WindowsPath file = WindowsPath.toWindowsPath(obj);
file.checkRead();
WindowsFileAttributes attrs = null;
try {
attrs = WindowsFileAttributes.get(file, true);
} catch (WindowsException x) {
x.rethrowAsIOException(file);
}
- // DOS hidden attribute not meaningful when set on directories
- if (attrs.isDirectory())
- return false;
return attrs.isHidden();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190117/0f571791/attachment.html>
More information about the nio-dev
mailing list