Author: niallp
Date: Mon Mar 22 14:57:29 2010
New Revision: 926112
URL: http://svn.apache.org/viewvc?rev=926112&view=rev
Log:
BEANUTILS-373 MethodUtils is not thread safe because WeakFastHashMap which uses
WeakHashMap is not thread-safe - thanks to Andrew Sunde
(duplicate of BEANUTILS-318 which was not fixed properly in BeanUtils 1.8.0)
Modified:
commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java
commons/proper/beanutils/trunk/xdocs/changes.xml
Modified:
commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java?rev=926112&r1=926111&r2=926112&view=diff
==============================================================================
---
commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java
(original)
+++
commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/MethodUtils.java
Mon Mar 22 14:57:29 2010
@@ -23,6 +23,9 @@ import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.Map;
+import java.util.WeakHashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -104,14 +107,10 @@ public class MethodUtils {
* class via different classloaders will generate non-equal
MethodDescriptor
* objects and hence end up with different entries in the map.
*/
- private static final WeakFastHashMap cache = new WeakFastHashMap();
+ private static final Map cache = Collections.synchronizedMap(new
WeakHashMap());
// --------------------------------------------------------- Public Methods
- static {
- cache.setFast(true);
- }
-
/**
* Set whether methods should be cached for greater performance or not,
* default is <code>true</code>.
Modified: commons/proper/beanutils/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/xdocs/changes.xml?rev=926112&r1=926111&r2=926112&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/xdocs/changes.xml (original)
+++ commons/proper/beanutils/trunk/xdocs/changes.xml Mon Mar 22 14:57:29 2010
@@ -40,6 +40,10 @@ The <action> type attribute can be add,u
<body>
<release version="1.8.3" date="in SVN" description="Bug fix for 1.8.2">
+ <action dev="niallp" type="fix" issue="BEANUTILS-373" due-to="Andrew
Sunde">
+ MethodUtils is not thread safe because WeakFastHashMap which uses
WeakHashMap is not thread-safe
+ (duplicate of BEANUTILS-318 which was not fixed properly in BeanUtils
1.8.0).
+ </action>
<action dev="niallp" type="fix" issue="BEANUTILS-371" due-to="David
Tonhofer">
Add constructors which have useColumnLabel parameter to
ResultSetDynaClass and RowSetDynaClass.
</action>