JDK-4518797 : Locale hashcode synchronization is inadequate
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2001-10-24
  • Updated: 2014-10-30
  • Resolved: 2003-11-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.4.2_17-revFixed 1.4.2_18Fixed
Related Reports
Relates :  
Description
Locale.writeObject sets and reads the hashcode field without any synchronization. As such, even though the hashCode method is synchronized, the hashCode method could return -1 if a separate thread executing writeObject runs in between the assignment and return statements of the hashCode method. And as such, writeObject would write out a value other than -1 if a separate thread executing hashCode runs in between the assignment and defaultWriteObject statements of the writeObject method.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta FIXED IN: tiger-beta INTEGRATED IN: tiger-b28 tiger-beta
14-06-2004

PUBLIC COMMENTS Locale.writeObject sets and reads the hashcode field without any synchronization. As such, even though the hashCode method is synchronized, the hashCode method could return -1 if a separate thread executing writeObject runs in between the assignment and return statements of the hashCode method. And as such, writeObject would write out a value other than -1 if a separate thread executing hashCode runs in between the assignment and defaultWriteObject statements of the writeObject method.
10-06-2004

EVALUATION Removed synchronized from hashCode and use a transient field to keep a hash code. 'hashcode' is kept for compatibility. ###@###.### 2003-10-30
30-10-2003