diff --git a/src/java.base/windows/classes/sun/nio/fs/WindowsException.java b/src/java.base/windows/classes/sun/nio/fs/WindowsException.java index 1312d5a0938a5..b7388d593e390 100644 --- a/src/java.base/windows/classes/sun/nio/fs/WindowsException.java +++ b/src/java.base/windows/classes/sun/nio/fs/WindowsException.java @@ -85,7 +85,7 @@ private IOException translateToIOException(String file, String other) { return new NoSuchFileException(file, other, null); if (lastError() == ERROR_FILE_EXISTS || lastError() == ERROR_ALREADY_EXISTS) return new FileAlreadyExistsException(file, other, null); - if (lastError() == ERROR_ACCESS_DENIED) + if (lastError() == ERROR_ACCESS_DENIED || lastError() == ERROR_PRIVILEGE_NOT_HELD) return new AccessDeniedException(file, other, null); // fallback to the more general exception