mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8283335: Add exists and readAttributesIfExists methods to FileSystemProvider
Reviewed-by: alanb
This commit is contained in:
parent
c45d613faa
commit
d48694d0f3
13 changed files with 577 additions and 175 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2020, 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
|
||||
|
@ -118,10 +118,11 @@ class UnixUriUtils {
|
|||
if (sb.charAt(sb.length()-1) != '/') {
|
||||
try {
|
||||
up.checkRead();
|
||||
int mode = UnixNativeDispatcher.stat(up);
|
||||
if ((mode & UnixConstants.S_IFMT) == UnixConstants.S_IFDIR)
|
||||
UnixFileAttributes attrs = UnixFileAttributes.getIfExists(up);
|
||||
if (attrs != null
|
||||
&& ((attrs.mode() & UnixConstants.S_IFMT) == UnixConstants.S_IFDIR))
|
||||
sb.append('/');
|
||||
} catch (SecurityException ignore) { }
|
||||
} catch (UnixException | SecurityException ignore) { }
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue