6979526: (file) java/nio/file/FileStore/Basic.java fails if the same file system is mounted more than once
authoralanb
Sat, 02 Oct 2010 12:59:04 +0100
changeset 6693 f897a08d4dae
parent 6691 7e7d18be1370
child 6694 342ae2e24cf0
6979526: (file) java/nio/file/FileStore/Basic.java fails if the same file system is mounted more than once Reviewed-by: kevinw, forax
jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java
jdk/src/solaris/classes/sun/nio/fs/SolarisFileStore.java
jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java
jdk/test/java/nio/file/FileStore/Basic.java
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java	Thu Sep 30 14:49:14 2010 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java	Sat Oct 02 12:59:04 2010 +0100
@@ -156,9 +156,4 @@
             return supportsFileAttributeView(UserDefinedFileAttributeView.class);
         return super.supportsFileAttributeView(name);
     }
-
-    @Override
-    boolean isLoopback() {
-        return false;
-    }
 }
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileStore.java	Thu Sep 30 14:49:14 2010 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileStore.java	Sat Oct 02 12:59:04 2010 +0100
@@ -108,9 +108,4 @@
             return supportsFileAttributeView(UserDefinedFileAttributeView.class);
         return super.supportsFileAttributeView(name);
     }
-
-    @Override
-    boolean isLoopback() {
-        return type().equals("lofs");
-    }
 }
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java	Thu Sep 30 14:49:14 2010 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileStore.java	Sat Oct 02 12:59:04 2010 +0100
@@ -76,12 +76,6 @@
      */
     abstract UnixMountEntry findMountEntry() throws IOException;
 
-    /**
-     * Returns true if this file store represents a loopback file system that
-     * will have the same device ID as underlying file system.
-     */
-    abstract boolean isLoopback();
-
     UnixPath file() {
         return file;
     }
@@ -169,22 +163,13 @@
         if (!(ob instanceof UnixFileStore))
             return false;
         UnixFileStore other = (UnixFileStore)ob;
-        if (dev != other.dev)
-            return false;
-        // deviceIDs are equal but they may not be equal if one or both of
-        // them is a loopback file system
-        boolean thisIsLoopback = isLoopback();
-        if (thisIsLoopback != other.isLoopback())
-            return false;  // one, but not both, are lofs
-        if (!thisIsLoopback)
-            return true;    // neither is lofs
-        // both are lofs so compare mount points
-        return Arrays.equals(this.entry.dir(), other.entry.dir());
+        return (this.dev == other.dev) &&
+               Arrays.equals(this.entry.dir(), other.entry.dir());
     }
 
     @Override
     public int hashCode() {
-        return (int)(dev ^ (dev >>> 32));
+        return (int)(dev ^ (dev >>> 32)) ^ Arrays.hashCode(entry.dir());
     }
 
     @Override
--- a/jdk/test/java/nio/file/FileStore/Basic.java	Thu Sep 30 14:49:14 2010 +0100
+++ b/jdk/test/java/nio/file/FileStore/Basic.java	Sat Oct 02 12:59:04 2010 +0100
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4313887 6873621
+ * @bug 4313887 6873621 6979526
  * @summary Unit test for java.nio.file.FileStore
  * @library ..
  */