Charset: Fix broken level-1 caching.
The level-1 cache was incorrectly implemented. The check written here :
if (cache1 != null && charsetName.equals(cache1.getKey()))
Is incorrect because a different thread might change the value of cache1
between the null check, the call to getKey and the call to getValue.
The stress test in this change results in a 100% reproducible failure on a
nexus 6P without the included fix.
(cherry picked from commit 13a83b88fb12356b6edcb0bdf9171315d80583c0)
2 files changed