Skip to content

Commit f1659ca

Browse files
committed
Use UnixPath.toUnixPath().
1 parent 222cea0 commit f1659ca

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/java.base/aix/classes/sun/nio/fs/AixFileSystemProvider.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ AixFileStore getFileStore(UnixPath path) throws IOException {
5252
return new AixFileStore(path);
5353
}
5454

55-
private static boolean supportsUserDefinedFileAttributeView(Path obj) {
56-
if (obj == null || !(obj instanceof UnixPath)) return false;
55+
private static boolean supportsUserDefinedFileAttributeView(UnixPath file) {
5756
try {
58-
FileStore store = new AixFileStore((UnixPath) obj);
57+
FileStore store = new AixFileStore(file);
5958
return store.supportsFileAttributeView(UserDefinedFileAttributeView.class);
6059
} catch (IOException e) {
6160
return false;
@@ -69,8 +68,9 @@ public <V extends FileAttributeView> V getFileAttributeView(Path obj,
6968
LinkOption... options)
7069
{
7170
if (type == UserDefinedFileAttributeView.class) {
72-
return supportsUserDefinedFileAttributeView(obj) ?
73-
(V) new AixUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), Util.followLinks(options))
71+
UnixPath file = UnixPath.toUnixPath(obj);
72+
return supportsUserDefinedFileAttributeView(file) ?
73+
(V) new AixUserDefinedFileAttributeView(file, Util.followLinks(options))
7474
: null;
7575
}
7676
return super.getFileAttributeView(obj, type, options);
@@ -82,8 +82,9 @@ public DynamicFileAttributeView getFileAttributeView(Path obj,
8282
LinkOption... options)
8383
{
8484
if (name.equals("user")) {
85-
return supportsUserDefinedFileAttributeView(obj) ?
86-
new AixUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), Util.followLinks(options))
85+
UnixPath file = UnixPath.toUnixPath(obj);
86+
return supportsUserDefinedFileAttributeView(file) ?
87+
new AixUserDefinedFileAttributeView(file, Util.followLinks(options))
8788
: null;
8889
}
8990
return super.getFileAttributeView(obj, name, options);

0 commit comments

Comments
 (0)