blob: 89c47b9d3b43385e8739331b67eac268a0767092 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
$NetBSD: patch-al,v 1.1 2015/02/08 08:41:25 tnn Exp $
DragonFly support.
--- jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java.orig 2015-02-02 15:37:12.000000000 +0000
+++ jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java
@@ -27,6 +27,8 @@ package sun.nio.fs;
import java.nio.file.spi.FileSystemProvider;
import java.security.AccessController;
+import java.util.Set;
+import java.util.HashSet;
import sun.security.action.GetPropertyAction;
/**
@@ -36,6 +38,14 @@ import sun.security.action.GetPropertyAc
public class DefaultFileSystemProvider {
private DefaultFileSystemProvider() { }
+ private static final Set<String> validFileSystemProviders
+ = new HashSet<String>();
+ 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(String cn) {
Class<FileSystemProvider> c;
@@ -57,11 +67,15 @@ 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.endsWith("BSD"))
+ if (osname.endsWith("BSD") || osname.equals("DragonFly"))
return createProvider("sun.nio.fs.BsdFileSystemProvider");
if (osname.contains("OS X"))
return createProvider("sun.nio.fs.MacOSXFileSystemProvider");
|