[jboss-cvs] JBossCache/src/org/jboss/cache/util ...
Elias Ross
genman at noderunner.net
Mon Nov 20 13:04:09 EST 2006
User: genman
Date: 06/11/20 13:04:09
Modified: src/org/jboss/cache/util MapCopy.java
Log:
JBCACHE-867 -- Node.put((Map)null) is allowed, remove MapCopy where map is modified
Revision Changes Path
1.3 +15 -2 JBossCache/src/org/jboss/cache/util/MapCopy.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MapCopy.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/util/MapCopy.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- MapCopy.java 20 Nov 2006 08:51:50 -0000 1.2
+++ MapCopy.java 20 Nov 2006 18:04:08 -0000 1.3
@@ -1,5 +1,6 @@
package org.jboss.cache.util;
+import java.io.IOException;
import java.io.Serializable;
import java.util.AbstractMap;
import java.util.AbstractSet;
@@ -29,8 +30,15 @@
int i = 0;
for (Map.Entry<K, V> me : (Set<Map.Entry<K, V>>) m.entrySet())
{
+ if (me == null)
+ throw new NullPointerException();
data[i++] = new SimpleEntry<K, V>(me);
}
+ init();
+ }
+
+ private void init()
+ {
this.entrySet = new AbstractSet<Map.Entry<K, V>>()
{
public int size()
@@ -43,7 +51,6 @@
return new EntryIterator();
}
};
-
}
private class EntryIterator implements Iterator<Entry<K, V>>
@@ -130,4 +137,10 @@
return data.length;
}
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
+ {
+ in.defaultReadObject();
+ init();
+ }
+
}
More information about the jboss-cvs-commits
mailing list