mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8259865: (fs) test/jdk/java/nio/file/attribute/UserDefinedFileAttributeView/Basic.java failing on macOS 10.13
Reviewed-by: dcubed
This commit is contained in:
parent
da4cf05dc6
commit
5f2e280cab
1 changed files with 22 additions and 4 deletions
|
@ -25,9 +25,11 @@
|
|||
|
||||
package sun.nio.fs;
|
||||
|
||||
import java.nio.file.attribute.*;
|
||||
import java.util.*;
|
||||
import java.nio.file.attribute.FileAttributeView;
|
||||
import java.nio.file.attribute.UserDefinedFileAttributeView;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* Bsd implementation of FileStore
|
||||
|
@ -111,9 +113,12 @@ class BsdFileStore
|
|||
return false;
|
||||
|
||||
// typical macOS file system types that are known to support xattr
|
||||
if (entry().fstype().equals("apfs")
|
||||
|| entry().fstype().equals("hfs")) {
|
||||
String fstype = entry().fstype();
|
||||
if ("hfs".equals(fstype))
|
||||
return true;
|
||||
if ("apfs".equals(fstype)) {
|
||||
// fgetxattr broken on APFS prior to 10.14
|
||||
return isOsVersionGte(10, 14);
|
||||
}
|
||||
|
||||
// probe file system capabilities
|
||||
|
@ -129,4 +134,17 @@ class BsdFileStore
|
|||
return supportsFileAttributeView(UserDefinedFileAttributeView.class);
|
||||
return super.supportsFileAttributeView(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the OS major/minor version is greater than, or equal, to the
|
||||
* given major/minor version.
|
||||
*/
|
||||
private static boolean isOsVersionGte(int requiredMajor, int requiredMinor) {
|
||||
String osVersion = GetPropertyAction.privilegedGetProperty("os.version");
|
||||
String[] vers = Util.split(osVersion, '.');
|
||||
int majorVersion = Integer.parseInt(vers[0]);
|
||||
int minorVersion = Integer.parseInt(vers[1]);
|
||||
return (majorVersion > requiredMajor)
|
||||
|| (majorVersion == requiredMajor && minorVersion >= requiredMinor);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue