-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6
-
x86
-
windows_xp
FULL PRODUCT VERSION :
all
ADDITIONAL OS VERSION INFORMATION :
not important
A DESCRIPTION OF THE PROBLEM :
If method lookup2() would be interrupted by another thread while swapping cache1 against cache2 method lookup potentially could return the wrong charset.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Charset {
...
private static Charset lookup2(String charsetName) {
Object[] a;
Charset cs;
if ((a = cache2) != null && charsetName.equals(a[0])) { // TODO: synchronize !!!
cache2 = cache1;
cache1 = a;
cs = (Charset)a[1];
}
else if ((cs = standardProvider.charsetForName(charsetName)) != null ||
(cs = lookupExtendedCharset(charsetName)) != null ||
(cs = lookupViaProviders(charsetName)) != null)
cache(charsetName, cs);
else
// Only need to check the name if we didn't find a charset for it
checkName(charsetName);
return cs;
}
...
}
---------- END SOURCE ----------
all
ADDITIONAL OS VERSION INFORMATION :
not important
A DESCRIPTION OF THE PROBLEM :
If method lookup2() would be interrupted by another thread while swapping cache1 against cache2 method lookup potentially could return the wrong charset.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Charset {
...
private static Charset lookup2(String charsetName) {
Object[] a;
Charset cs;
if ((a = cache2) != null && charsetName.equals(a[0])) { // TODO: synchronize !!!
cache2 = cache1;
cache1 = a;
cs = (Charset)a[1];
}
else if ((cs = standardProvider.charsetForName(charsetName)) != null ||
(cs = lookupExtendedCharset(charsetName)) != null ||
(cs = lookupViaProviders(charsetName)) != null)
cache(charsetName, cs);
else
// Only need to check the name if we didn't find a charset for it
checkName(charsetName);
return cs;
}
...
}
---------- END SOURCE ----------