You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2013/11/29 20:41:08 UTC

git commit: [SSHD-257] Possible fix for not using nio2 file system with windows

Updated Branches:
  refs/heads/master 49ba56e1a -> dc2eae49f


[SSHD-257] Possible fix for not using nio2 file system with windows

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/dc2eae49
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/dc2eae49
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/dc2eae49

Branch: refs/heads/master
Commit: dc2eae49f24caff5f1b68770aa52f0cdc8961159
Parents: 49ba56e
Author: Guillaume Nodet <gn...@apache.org>
Authored: Fri Nov 29 20:41:08 2013 +0100
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Fri Nov 29 20:41:08 2013 +0100

----------------------------------------------------------------------
 .../sshd/common/file/nativefs/NativeFileSystemView.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/dc2eae49/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java b/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java
index a39c4c8..e78b562 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java
@@ -114,7 +114,9 @@ public class NativeFileSystemView implements FileSystemView {
 	}
 
     static boolean isJava7;
+    static boolean isWindows;
     static {
+        // Check java 7
         boolean j7 = false;
         try {
             ClassLoader.getSystemClassLoader().loadClass("java.nio.file.Files");
@@ -123,10 +125,18 @@ public class NativeFileSystemView implements FileSystemView {
             // Ignore
         }
         isJava7 = j7;
+        // Check windows
+        boolean win = false;
+        try {
+            win = System.getProperty("os.name").toLowerCase().contains("win");
+        } catch (Throwable t) {
+            // Ignore
+        }
+        isWindows = win;
     }
 
     public NativeSshFile createNativeSshFile(final String fileName2, final File fileObj, final String userName2) {
-        if (isJava7) {
+        if (isJava7 && !isWindows) {
             return new NativeSshFileNio(this, fileName2, fileObj, userName2);
         } else {
 		    return new NativeSshFile(this, fileName2, fileObj, userName2);