src/solaris/classes/sun/nio/fs/UnixFileSystem.java

Print this page

        

@@ -300,23 +300,23 @@
                     "' not recognized");
             }
         }
 
         // return matcher
-        final Pattern pattern = Pattern.compile(expr);
+        final Pattern pattern = compilePathMatchPattern(expr);
+
         return new PathMatcher() {
             @Override
             public boolean matches(Path path) {
                 return pattern.matcher(path.toString()).matches();
             }
         };
     }
+
     private static final String GLOB_SYNTAX = "glob";
     private static final String REGEX_SYNTAX = "regex";
 
-
-
     @Override
     public final UserPrincipalLookupService getUserPrincipalLookupService() {
         return LookupService.instance;
     }
 

@@ -337,6 +337,41 @@
                     return UnixUserPrincipals.lookupGroup(group);
                 }
             };
     }
 
+    // BsdFileSystem overrides following methods for MacOSX path
+    Pattern compilePathMatchPattern(String expr) {
+        return Pattern.compile(expr);
+    }
+
+    char[] normalizeNativePath(char[] path) {
+        return path;
+    }
+
+    String normalizeJavaPath(String path) {
+        return path;
+    }
+
+    public int hashCodePath(UnixPath path) {
+        return sun.misc.Hashing.murmur3_32(path.asByteArray());
+    }
+
+    int comparePaths(UnixPath path1, UnixPath path2) {
+        byte[] v1 = path1.asByteArray();
+        byte[] v2 = path2.asByteArray();
+        int len1 = v1.length;
+        int len2 = v2.length;
+        int n = Math.min(len1, len2);
+        int k = 0;
+        while (k < n) {
+            int c1 = v1[k] & 0xff;
+            int c2 = v2[k] & 0xff;
+            if (c1 != c2) {
+                return c1 - c2;
+            }
+            k++;
+        }
+        return len1 - len2;
+    }
+
 }