[jcifs] SmbFile.equals() always returning false

Rob Wygand rob at wygand.com
Tue Dec 11 08:59:23 EST 2001


For the record, I fixed this by added a hashCode() function to 
UniAddress that explicity called hashCode on the address object.

That is, I added:

public int hashCode () {
   return addr.hashCode();
}

Without that, the VM will default to the UniAddress's hashCode, which 
won't return the right thing.

rjw

Rob Wygand wrote:

> Mike,
> 
> In 0.6b3, SmbFile.equals() is always returning 0. I've tracked this down 
> to SmbFile.hashCode(). Basically, SmbFile().hashCode() starts by calling 
> address.hashCode(). This value is coming back different every time, 
> which I assume is because there is no UniAddress.hashCode() and it's 
> using the default on in Object.
> 
> The fix would be to implement UniAddress.hashCode(), I guess.
> 
> Thoughts on a quick fix?
> rjw
> 






More information about the jcifs mailing list