[jcifs] SMBFile hashcode bug

James Nord teilo at teilo.net
Sun Feb 24 15:01:18 EST 2002


Hi,

it seems to me at this late hour that the hashcode function of SmbFile 
ignores any authentication when calculating its hashcode.

Also some SMB implementations can be case sensitive so
smb://server/share/file may not equal smb://server/share/File

And shares?

    public int hashCode() {
        if( hash == 0 ) {
            try {
                hash = getAddress().hashCode();
            } catch( SmbException se ) {
            }
            if( port != 0 && port != 139 ) {
                hash += 65621 * port;
            }
            if( share != null ) {
                hash += 65521 * share.toUpperCase().hashCode();
                if( canonicalPath != null ) {
                    hash += 65521 * canonicalPath.toUpperCase().hashCode();
                }
            }
        }
        return hash;
    }








More information about the jcifs mailing list