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

Print this page

        

@@ -604,11 +604,13 @@
         return new UnixPath(getFileSystem(), result);
     }
 
     @Override
     public boolean startsWith(Path other) {
-        UnixPath that = toUnixPath(other);
+        if (!(Objects.requireNonNull(other) instanceof UnixPath))
+            return false;
+        UnixPath that = (UnixPath)other;
 
         // other path is longer
         if (that.path.length > path.length)
             return false;
 

@@ -653,11 +655,13 @@
         return true;
     }
 
     @Override
     public boolean endsWith(Path other) {
-        UnixPath that = toUnixPath(other);
+        if (!(Objects.requireNonNull(other) instanceof UnixPath))
+            return false;
+        UnixPath that = (UnixPath)other;
 
         int thisLen = path.length;
         int thatLen = that.path.length;
 
         // other path is longer