7020517: (fs) FileStore.equals returns true if both volumes have the same serial number
authoralanb
Mon, 21 Feb 2011 13:54:13 +0000
changeset 8537 045f48a970d8
parent 8405 bafd7b441d80
child 8538 52a1e9920310
7020517: (fs) FileStore.equals returns true if both volumes have the same serial number Reviewed-by: chegar
jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java
jdk/test/java/nio/file/FileStore/Basic.java
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java	Fri Feb 18 12:43:14 2011 -0800
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsFileStore.java	Mon Feb 21 13:54:13 2011 +0000
@@ -201,13 +201,12 @@
         if (!(ob instanceof WindowsFileStore))
             return false;
         WindowsFileStore other = (WindowsFileStore)ob;
-        return this.volInfo.volumeSerialNumber() == other.volInfo.volumeSerialNumber();
+        return root.equals(other.root);
     }
 
     @Override
     public int hashCode() {
-        // reveals VSN without permission check - okay?
-        return volInfo.volumeSerialNumber();
+        return root.hashCode();
     }
 
     @Override
--- a/jdk/test/java/nio/file/FileStore/Basic.java	Fri Feb 18 12:43:14 2011 -0800
+++ b/jdk/test/java/nio/file/FileStore/Basic.java	Mon Feb 21 13:54:13 2011 +0000
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4313887 6873621 6979526 7006126
+ * @bug 4313887 6873621 6979526 7006126 7020517
  * @summary Unit test for java.nio.file.FileStore
  * @library ..
  */