Adding hashCode() to NativeFtpFile (FTPSERVER-375)
authorNiklas Gustavsson <ngn@apache.org>
Sun, 19 Jun 2011 09:50:58 +0000 (09:50 +0000)
committerNiklas Gustavsson <ngn@apache.org>
Sun, 19 Jun 2011 09:50:58 +0000 (09:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/mina/ftpserver/trunk@1137326 13f79535-47bb-0310-9956-ffa450edef68

core/src/main/java/org/apache/ftpserver/filesystem/nativefs/impl/NativeFtpFile.java

index f6f419a..c53f7c0 100644 (file)
@@ -394,10 +394,6 @@ public class NativeFtpFile implements FtpFile {
         };
     }
 
-
-
-
-    
     @Override
     public boolean equals(Object obj) {
         if (obj != null && obj instanceof NativeFtpFile) {
@@ -416,4 +412,14 @@ public class NativeFtpFile implements FtpFile {
         }
         return false;
     }
+    
+       @Override
+       public int hashCode() {
+               final int prime = 31;
+               try {
+                       return prime  + ((file == null) ? 0 : file.getCanonicalFile().hashCode());
+               } catch (IOException e) {
+                       return prime;
+               }
+       }
 }