commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Volker Malzahn (Created) (JIRA)" <>
Subject [jira] [Created] (BEANUTILS-402) Double-Checked Locking anti pattern in WeakFastHashMap
Date Wed, 26 Oct 2011 13:33:33 GMT
Double-Checked Locking anti pattern in WeakFastHashMap

                 Key: BEANUTILS-402
             Project: Commons BeanUtils
          Issue Type: Bug
          Components: Bean / Property Utils, ConvertUtils & Converters, Locale BeanUtils
/ Converters
    Affects Versions: 1.8.3
         Environment: Win XP, but doesn't matter
            Reporter: Volker Malzahn

The implementation of WeakFastHashMap has the flaw of implementing the Double-Checked Locking
anti pattern (see JavaDoc of that class). As described in the JavaDoc "This class is not cross-platform.".
In and
this was solved for MethodUtils (usage of WeakFastHashMap). But following classes still use
WeakFastHashMap for a cache: BeanUtils, ConvertUtilsBean, PropertyUtilsBean, LocaleConvertUtilsBean.

I would suggest to make WeakFastHashMap deprecated and to change every usage of that class
inside the commons-beanutils classes to a synchronized normal WeakHashMap like done (as the
second step) in Otherwise strange things
may happen in unusual plattforms/environments. An alternative could be to use "volatile" inside
WeakFastHashMap which would fix it for Java 5 and higher (see

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message