svn commit: r315345 - head/java/openjdk7/files
Greg Lewis
glewis at FreeBSD.org
Wed Mar 27 03:06:51 UTC 2013
Author: glewis
Date: Wed Mar 27 03:06:50 2013
New Revision: 315345
URL: http://svnweb.freebsd.org/changeset/ports/315345
Log:
. Allow users to force the file system provider to be the BSD file system
provider. This is helpful when users also wish to force os.name to a
different value (e.g. Linux) but not being forced to also use the
Linux file system provider. This can be done by defining the property
java.nio.file.spi.DefaultFileSystemProvider.
This patch differs from the submitters in that the range of values are
restricted to the current known defaults.
PR: 173847
Submitted by: 4721 at hushmail.com
Added:
head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-BsdFileSystemProvider.java (contents, props changed)
head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-DefaultFileSystemProvider.java (contents, props changed)
Added: head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-BsdFileSystemProvider.java
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-BsdFileSystemProvider.java Wed Mar 27 03:06:50 2013 (r315345)
@@ -0,0 +1,21 @@
+--- jdk/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java.orig
++++ jdk/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java
+@@ -27,6 +27,7 @@
+
+ import java.nio.file.*;
+ import java.nio.file.attribute.*;
++import java.nio.file.spi.FileSystemProvider;
+ import java.io.IOException;
+
+ /**
+@@ -38,6 +39,10 @@
+ super();
+ }
+
++ public BsdFileSystemProvider(FileSystemProvider f) {
++ super();
++ }
++
+ @Override
+ BsdFileSystem newFileSystem(String dir) {
+ return new BsdFileSystem(this, dir);
Added: head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-DefaultFileSystemProvider.java
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/java/openjdk7/files/patch-src-solaris-classes-sun-nio-fs-DefaultFileSystemProvider.java Wed Mar 27 03:06:50 2013 (r315345)
@@ -0,0 +1,37 @@
+--- jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java Sun Mar 10 14:04:37 2013 -0400
++++ jdk/src/solaris/classes/sun/nio/fs/DefaultFileSystemProvider.java Tue Mar 26 18:25:51 2013 -0700
+@@ -28,6 +28,8 @@
+ 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 @@
+ 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(final String cn) {
+ return AccessController
+@@ -64,6 +74,10 @@
+ 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"))
More information about the svn-ports-head
mailing list