FTPSERVER-375 - use canonicalPath rather than File to implement equals and hashcode

git-svn-id: https://svn.apache.org/repos/asf/mina/ftpserver/trunk@1138635 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/core/src/main/java/org/apache/ftpserver/filesystem/nativefs/impl/NativeFtpFile.java b/core/src/main/java/org/apache/ftpserver/filesystem/nativefs/impl/NativeFtpFile.java
index 4052ff6..3d1bf3c 100644
--- a/core/src/main/java/org/apache/ftpserver/filesystem/nativefs/impl/NativeFtpFile.java
+++ b/core/src/main/java/org/apache/ftpserver/filesystem/nativefs/impl/NativeFtpFile.java
@@ -394,21 +394,25 @@
         };
     }
 
+    /**
+     * Implements equals by comparing getCanonicalPath() for the underlying file instabnce.
+     * Ignores the fileName and User fields
+     */
     @Override
     public boolean equals(Object obj) {
         if (obj instanceof NativeFtpFile) {
-            File thisCanonicalFile;
-            File otherCanonicalFile;
+            String thisCanonicalPath;
+            String otherCanonicalPath;
             try {
-                thisCanonicalFile = this.file.getCanonicalFile();
-                otherCanonicalFile = ((NativeFtpFile) obj).file
-                        .getCanonicalFile();
+                thisCanonicalPath = this.file.getCanonicalPath();
+                otherCanonicalPath = ((NativeFtpFile) obj).file
+                        .getCanonicalPath();
             } catch (IOException e) {
                 throw new RuntimeException("Failed to get the canonical path",
                         e);
             }
 
-            return thisCanonicalFile.equals(otherCanonicalFile);
+            return thisCanonicalPath.equals(otherCanonicalPath);
         }
         return false;
     }
@@ -416,7 +420,7 @@
 	@Override
 	public int hashCode() {
 		try {
-			return file.getCanonicalFile().hashCode();
+			return file.getCanonicalPath().hashCode();
 		} catch (IOException e) {
 			return 0;
 		}