[jcifs] SmbFile.equals() always returning false
Allen, Michael B (RSCH)
Michael_B_Allen at ml.com
Tue Dec 11 10:14:31 EST 2001
> -----Original Message-----
> From: Rob Wygand [SMTP:rob at wygand.com]
>
>
> 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();
> }
>
I have to look at the code. I think you're assesment and fix is perfectly correct though.
The hashcode for an address should be the integer representation of it's IP address. I
think the above will do just that. This makes me wonder about some other methods
though (e.g. equals).
Mike
> 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