[jboss-cvs] JBossCache/src/org/jboss/cache/loader ...
Brian Stansberry
brian.stansberry at jboss.com
Mon Sep 18 16:46:33 EDT 2006
User: bstansberry
Date: 06/09/18 16:46:33
Modified: src/org/jboss/cache/loader Tag: Branch_JBossCache_1_4_0
JDBCCacheLoader.java AsyncCacheLoader.java
Log:
[JBCACHE-769] Make a defensive copy of any map passed to put(Fqn, Map)
Revision Changes Path
No revision
No revision
1.11.4.1 +8 -5 JBossCache/src/org/jboss/cache/loader/JDBCCacheLoader.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: JDBCCacheLoader.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/JDBCCacheLoader.java,v
retrieving revision 1.11
retrieving revision 1.11.4.1
diff -u -b -r1.11 -r1.11.4.1
--- JDBCCacheLoader.java 16 Feb 2006 10:59:34 -0000 1.11
+++ JDBCCacheLoader.java 18 Sep 2006 20:46:33 -0000 1.11.4.1
@@ -63,7 +63,7 @@
*
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
* @author <a href="mailto:hmesha at novell.com">Hany Mesha </a>
- * @version <tt>$Revision: 1.11 $</tt>
+ * @version <tt>$Revision: 1.11.4.1 $</tt>
*/
public class JDBCCacheLoader
implements CacheLoader
@@ -888,14 +888,17 @@
final void put(Fqn name, Map attributes, boolean override) throws Exception
{
+ // JBCACHE-769 -- make a defensive copy
+ Map attrs = (attributes == null ? null : new HashMap(attributes));
+
Map oldNode = loadNode(name);
if(oldNode != null)
{
- if(!override && oldNode != NULL_NODE_IN_ROW && attributes != null)
+ if(!override && oldNode != NULL_NODE_IN_ROW && attrs != null)
{
- attributes.putAll(oldNode);
+ attrs.putAll(oldNode);
}
- updateNode(name, attributes);
+ updateNode(name, attrs);
}
else
{
@@ -910,7 +913,7 @@
}
}
}
- insertNode(name, attributes);
+ insertNode(name, attrs);
}
}
1.13.2.1 +4 -2 JBossCache/src/org/jboss/cache/loader/AsyncCacheLoader.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AsyncCacheLoader.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/AsyncCacheLoader.java,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -b -r1.13 -r1.13.2.1
--- AsyncCacheLoader.java 26 Apr 2006 11:18:42 -0000 1.13
+++ AsyncCacheLoader.java 18 Sep 2006 20:46:33 -0000 1.13.2.1
@@ -217,10 +217,12 @@
{
if (asyncPut)
{
- Modification mod = new Modification(Modification.PUT_DATA, name, attributes);
+ // JBCACHE-769 -- make a defensive copy
+ Map attrs = (attributes == null ? null : new HashMap(attributes));
+ Modification mod = new Modification(Modification.PUT_DATA, name, attrs);
enqueue(mod);
}
- else delegateTo.put(name, attributes);
+ else delegateTo.put(name, attributes); // Let delegate make its own defensive copy
}
public void put(List modifications) throws Exception
More information about the jboss-cvs-commits
mailing list