-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
7
-
x86
-
linux
FULL PRODUCT VERSION :
Java source code, both 1.6 and 1.7
A DESCRIPTION OF THE PROBLEM :
java.util.Locale.getDefault() has following flaw: As nothing in the source code seems to impose any multithread visibility constraints (happen-before relationships) it is possible for field defaultLocale to have non-null value before the default-locale-instance is fully initialized. Same problem exists in java.lang.Math.random().
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Both can be fixed by making variable in question volatile.
Java source code, both 1.6 and 1.7
A DESCRIPTION OF THE PROBLEM :
java.util.Locale.getDefault() has following flaw: As nothing in the source code seems to impose any multithread visibility constraints (happen-before relationships) it is possible for field defaultLocale to have non-null value before the default-locale-instance is fully initialized. Same problem exists in java.lang.Math.random().
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Both can be fixed by making variable in question volatile.
- duplicates
-
JDK-4808233 "Locale" not thread-safe
-
- Resolved
-
- relates to
-
JDK-7118654 Math.randomNumberGenerator initialization should be re-examined
-
- Closed
-
-
JDK-4071298 java.lang.Locale.getDefault() is a public static
-
- Closed
-