Adding hashCode() to NativeFtpFile (FTPSERVER-375) git-svn-id: https://svn.apache.org/repos/asf/mina/ftpserver/trunk@1137326 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/commit/b8f35431 Tree: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/tree/b8f35431 Diff: http://git-wip-us.apache.org/repos/asf/mina-ftpserver/diff/b8f35431 Branch: refs/heads/trunk Commit: b8f3543159d2b9d86a199f299ca6b7b9f7b7ae36 Parents: b163d4a Author: Niklas Gustavsson <[email protected]> Authored: Sun Jun 19 09:50:58 2011 +0000 Committer: Niklas Gustavsson <[email protected]> Committed: Sun Jun 19 09:50:58 2011 +0000 ---------------------------------------------------------------------- .../filesystem/nativefs/impl/NativeFtpFile.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-ftpserver/blob/b8f35431/core/src/main/java/org/apache/ftpserver/filesystem/nativefs/impl/NativeFtpFile.java ---------------------------------------------------------------------- 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 f6f419a..c53f7c0 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,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; + } + } }
