On Sun, 2006-08-13 at 02:21 +0200, Sven de Marothy wrote:
> 2006-08-13  Sven de Marothy  <[EMAIL PROTECTED]>
> 
>       * java/util/Locale.java
>       (hashcode): Is a serialized field, not transient.
>       (equals): Should NOT compare strings by reference.
>       (readObject/writeObject): Use the default methods and handle the hash
>       seperately.
> [...]
> +    int temp = hashcode;
> +    hashcode = -1;
> +    s.defaultWriteObject();
> +    hashcode = temp;

This is not thread-safe. If one thread serializes the Locale and another
uses its hashCode() method.

> [...]
> -    language = ((String) s.readObject()).intern();
> -    country = ((String) s.readObject()).intern();
> -    variant = ((String) s.readObject()).intern();
> +    s.defaultReadObject();

There are a couple of places in this class that depend on these three
fields to be interned. Please see the comments in the class that say so.

Cheers,

Mark

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to