<HTML>
the code of String.hashCode() (in librairies/javalib/java/lang/String.java)
is not correct (1 character string always return a hash value of 0).
<BR>it seems that :
<BR>- for string < 15 characters, the first character is never used
in computing hash value
<P>Please find enclosed a diff -u that should solve this issue (the code
should behave the same as in kaffe/kaffevm/string.c (hashUtf8String() for
hashing Utf8 strings)
<BR>
<P>+++ String.java Wed Aug 5 08:12:37 1998
<BR>--- String.java.orig Wed Aug 5 08:13:21 1998
<BR>@@ -227,12 +227,12 @@
<BR> int hash = 0;
<P> if ( count <= 15 ) {
<BR>-
for ( i=offset+1; i<n; i++ )
<BR>+
for ( i=offset; i<n; i++ )
<BR>
hash = (37 * hash) + value[i];
<BR> }
<BR> else {
<BR>
int skip = count / 8;
<BR>-
for ( i=offset+skip; i<n; i+=skip )
<BR>+
for ( i=offset+skip-1; i<n; i+=skip )
<BR>
hash = (39 * hash) + value[i];
<BR> }
<BR> return hash;
<PRE>--
--------------------
Eric Pouech (eric.pouech@lemel.fr)</PRE>
</HTML>