Without seeing your code, just from your description, it sounds to me as if 
the problem is not with the HashMap itself but with the way equals() is 
written in the class of the objects you are storing in the HashMap.  What is 
that class?

The "contract" between equals() and hashCode() states that if equals() returns 
true between two objects, that hashCode() must return the same number for 
both of them.  The reverse is NOT required - that two objects with the same 
hashCode should return true when compared via equals().  HashMap uses 
equals() to decide whether to add or replace an element, not hashCode().  
hashCode() is only used to decide which internal "bucket" to place the object 
in.

Does this help?  If not I'll await your further details.


On Wednesday 31 December 2003 10:20 am, Andre Schild wrote:
> Actually It seems that the URL should not contain port 8080 in it.
>
> http://nagoya.apache.org/scarab/issues/id/JAKA22
>
> The attachment seems to be missing there and I seem to not have the correct
> role to change my ticket  :-(
>
> My problem is very simple in fact.
> When we process a directory with a file called "i0.png" (It's a zero, not a
> uppercase o) and a second one called "gn.png", then the VFS class
> AbstractFileSystem will always return a reference to "gn.png"
>
> The cause of this is, that all filenames in a directory are stored in a
> HashMap. Unfortunaly the both names mentioned both give the same hashvalue
> (Under VM 1.4 Windows and Linux) Due to this, we only have one entry in the
> HashMap.
>
> I will post a followup with samplecode.
>
> Andr�
>
> >>> [EMAIL PROTECTED] 31.12.2003 16:43:03 >>>
>
> Can you summarize your issue?  Scarab won't let me see anything even after
> I registered.  And the URL you provided doesn't work.
>
> On Wednesday 31 December 2003 05:48 am, Andre Schild wrote:
> > Has anyone had time to look at this issue ?
> >
> > Andr�
> >
> > In the class AbstractFileSystem then list of files is stored in a
> > HashMap.
> >
> > Unfortunaly this HashMap causes problems, depending on the filenames
> > present in the directory.
> >
> > We encountered the problem in a directory who contains the filenames
> > "i0.png" and "gn.png". When we make the two Strings and look at the
> > HashCode, then we see that they return the same value.
> >
> > String f1= new String("i0.png");
> > System.out.println(f1);
> > String f2= new String("gn.png");
> > System.out.println(f2.hashCode());
> >
> >
> > Those filenames are a small subset of the country flags of the
> > awstats.sourceforge.net project.
> >
> >
> > I have reported it as a defect in scarab.
> >
> > http://nagoya.apache.org:8080/scarab/issues/id/JAKA22
> >
> > Andr�
> >
> > aarboard ag
> > internet - networks - screen&print design - multimedia
> > Egliweg 10 - Postfach 214 - CH-2560 Nidau (Switzerland)
> > Phone +41 32 332 9714 - Fax +41 32 332 9715
> > www.aarboard.ch - [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to