Mercurial > hg > icedtea7-forest > jdk
changeset 8936:5079c607c53c
8034057, PR3162: Files.getFileStore and Files.isWritable do not work with SUBST'ed drives (win)
Reviewed-by: alanb, chegar
Contributed-by: pavel.rappo@oracle.com
author | alanb |
---|---|
date | Tue, 29 Apr 2014 13:23:08 +0100 |
parents | fa0a555b41ee |
children | 98429720eb18 |
files | src/windows/classes/sun/nio/fs/WindowsConstants.java src/windows/classes/sun/nio/fs/WindowsFileStore.java src/windows/classes/sun/nio/fs/WindowsLinkSupport.java |
diffstat | 3 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/windows/classes/sun/nio/fs/WindowsConstants.java Wed Oct 26 07:00:20 2016 +0100 +++ b/src/windows/classes/sun/nio/fs/WindowsConstants.java Tue Apr 29 13:23:08 2014 +0100 @@ -98,6 +98,7 @@ public static final int ERROR_DISK_FULL = 112; public static final int ERROR_INSUFFICIENT_BUFFER = 122; public static final int ERROR_INVALID_LEVEL = 124; + public static final int ERROR_DIR_NOT_ROOT = 144; public static final int ERROR_DIR_NOT_EMPTY = 145; public static final int ERROR_ALREADY_EXISTS = 183; public static final int ERROR_MORE_DATA = 234;
--- a/src/windows/classes/sun/nio/fs/WindowsFileStore.java Wed Oct 26 07:00:20 2016 +0100 +++ b/src/windows/classes/sun/nio/fs/WindowsFileStore.java Tue Apr 29 13:23:08 2014 +0100 @@ -86,14 +86,28 @@ WindowsFileAttributes.get(file, true); target = file.getPathForWin32Calls(); } - String root = GetVolumePathName(target); - return new WindowsFileStore(root); + try { + return createFromPath(target); + } catch (WindowsException e) { + if (e.lastError() != ERROR_DIR_NOT_ROOT) + throw e; + target = WindowsLinkSupport.getFinalPath(file); + if (target == null) + throw new FileSystemException(file.getPathForExceptionMessage(), + null, "Couldn't resolve path"); + return createFromPath(target); + } } catch (WindowsException x) { x.rethrowAsIOException(file); return null; // keep compiler happy } } + private static WindowsFileStore createFromPath(String target) throws WindowsException { + String root = GetVolumePathName(target); + return new WindowsFileStore(root); + } + VolumeInformation volumeInformation() { return volInfo; }
--- a/src/windows/classes/sun/nio/fs/WindowsLinkSupport.java Wed Oct 26 07:00:20 2016 +0100 +++ b/src/windows/classes/sun/nio/fs/WindowsLinkSupport.java Tue Apr 29 13:23:08 2014 +0100 @@ -66,7 +66,7 @@ * Returns the final path (all symbolic links resolved) or null if this * operation is not supported. */ - private static String getFinalPath(WindowsPath input) throws IOException { + static String getFinalPath(WindowsPath input) throws IOException { long h = 0; try { h = input.openForReadAttributeAccess(true);