Duplicate :
|
|
Relates :
|
|
Relates :
|
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.
|