$NetBSD: patch-al,v 1.6 2017/08/14 00:02:16 ryoon Exp $ DragonFly support. --- jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java.orig 2017-08-13 05:55:21.000000000 +0000 +++ jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java @@ -28,6 +28,8 @@ package sun.nio.fs; import java.nio.file.spi.FileSystemProvider; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.Set; +import java.util.HashSet; import sun.security.action.GetPropertyAction; /** @@ -37,6 +39,14 @@ import sun.security.action.GetPropertyAc public class DefaultFileSystemProvider { private DefaultFileSystemProvider() { } + private static final Set validFileSystemProviders + = new HashSet(); + static { + validFileSystemProviders.add("sun.nio.fs.SolarisFileSystemProvider"); + validFileSystemProviders.add("sun.nio.fs.LinuxFileSystemProvider"); + validFileSystemProviders.add("sun.nio.fs.BsdFileSystemProvider"); + } + @SuppressWarnings("unchecked") private static FileSystemProvider createProvider(final String cn) { return AccessController @@ -64,13 +74,17 @@ public class DefaultFileSystemProvider { public static FileSystemProvider create() { String osname = AccessController .doPrivileged(new GetPropertyAction("os.name")); + String fileSystemProvider = System + .getProperty("java.nio.file.spi.DefaultFileSystemProvider"); + if (validFileSystemProviders.contains(fileSystemProvider)) + return createProvider(fileSystemProvider); if (osname.equals("SunOS")) return createProvider("sun.nio.fs.SolarisFileSystemProvider"); if (osname.equals("Linux")) return createProvider("sun.nio.fs.LinuxFileSystemProvider"); if (osname.equals("Darwin") || osname.contains("OS X")) return createProvider("sun.nio.fs.MacOSXFileSystemProvider"); - if (osname.endsWith("BSD")) + if (osname.endsWith("BSD") || osname.equals("DragonFly")) return createProvider("sun.nio.fs.BsdFileSystemProvider"); if (osname.equals("AIX") || osname.equals("OS400")) return createProvider("sun.nio.fs.AixFileSystemProvider");