mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8286160: (fs) Files.exists returns unexpected results with C:\pagefile.sys because it's not readable
Reviewed-by: alanb
This commit is contained in:
parent
edff51e5fd
commit
d482d7f5b9
2 changed files with 44 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -374,8 +374,19 @@ class WindowsFileSystemProvider
|
|||
}
|
||||
}
|
||||
|
||||
// check file exists only
|
||||
if (!(r || w || x)) {
|
||||
file.checkRead();
|
||||
try {
|
||||
WindowsFileAttributes.get(file, true);
|
||||
return;
|
||||
} catch (WindowsException exc) {
|
||||
exc.rethrowAsIOException(file);
|
||||
}
|
||||
}
|
||||
|
||||
// special-case read access to avoid needing to determine effective
|
||||
// access to file; default if modes not specified
|
||||
// access to file
|
||||
if (!w && !x) {
|
||||
checkReadAccess(file);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue