Code Review Request: 7168172: (fs) Files.isReadable slow on Windows (original) (raw)

Kurchi Subhra Hazra kurchi.subhra.hazra at oracle.com
Thu Aug 23 09:11:14 PDT 2012


Yes I plan to backport it to 7u8.

On 8/23/12 8:08 AM, Zhong Yu wrote:

Ulf you are right.

Question about release schedule: will this fix be included in a jdk7 release? On Thu, Aug 23, 2012 at 7:53 AM, Ulf Zibis<Ulf.Zibis at gmx.de> wrote: Am 23.08.2012 01:50, schrieb Zhong Yu:

public void checkAccess(Path obj, AccessMode... modes) throws

IOException { AccessMode r = null; AccessMode w = null; AccessMode x = null; for (AccessMode mode: modes) { switch (mode) { case READ : r = READ; break; case WRITE : w = WRITE; break; case EXECUTE : x = EXECUTE; break; default: throw new AssertionError("Should not get here"); } } That'll leave r==null if modes is empty. But an empty modes is supposed to be equivalent to [READ]. Yes, but in that case w and x are also null, so the "special-case read access" will be invoked anyway, and the null-ness of r wouldn't matter. WindowsPath file = WindowsPath.toWindowsPath(obj); // special-case read access to avoid needing to determine effective // access to file if (w == null&& x == null) { tryReadAccess(file); return; } ... } -Ulf



More information about the nio-dev mailing list