You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by fr...@apache.org on 2008/06/13 00:10:02 UTC
svn commit: r667263 - in /wicket/trunk/wicket/src:
main/java/org/apache/wicket/util/value/ValueMap.java
test/java/org/apache/wicket/util/value/ValueMapTest.java
Author: frankbille
Date: Thu Jun 12 15:10:02 2008
New Revision: 667263
URL: http://svn.apache.org/viewvc?rev=667263&view=rev
Log:
WICKET-1694: wicket complains that ValueMap$NullSafeKeyComparator is not serializable
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/ValueMap.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/util/value/ValueMapTest.java
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/ValueMap.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/ValueMap.java?rev=667263&r1=667262&r2=667263&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/ValueMap.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/value/ValueMap.java Thu Jun 12 15:10:02 2008
@@ -16,6 +16,7 @@
*/
package org.apache.wicket.util.value;
+import java.io.Serializable;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -53,8 +54,8 @@
* The <code>makeImmutable</code> method will make the underlying <code>Map</code> immutable.
* Further attempts to change the <code>Map</code> will result in a <code>RuntimeException</code>.
* <p>
- * The <code>toString</code> method converts a <code>ValueMap</code> object to a readable
- * key/value string for diagnostics.
+ * The <code>toString</code> method converts a <code>ValueMap</code> object to a readable key/value
+ * string for diagnostics.
*
* @author Jonathan Locke
* @author Doug Donohoe
@@ -70,8 +71,10 @@
* {@link HashMap}, so we must provide a null safe comparator to avoid null pointer exceptions
* with null keys.
*/
- private static class NullSafeKeyComparator implements Comparator<String>
+ private static class NullSafeKeyComparator implements Comparator<String>, Serializable
{
+ private static final long serialVersionUID = 1L;
+
public int compare(String o1, String o2)
{
int compare = 0;
Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/util/value/ValueMapTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/util/value/ValueMapTest.java?rev=667263&r1=667262&r2=667263&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/util/value/ValueMapTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/util/value/ValueMapTest.java Thu Jun 12 15:10:02 2008
@@ -16,7 +16,10 @@
*/
package org.apache.wicket.util.value;
+import java.io.NotSerializableException;
+
import junit.framework.TestCase;
+import org.apache.wicket.util.io.SerializableChecker;
import org.apache.wicket.util.time.Time;
import org.apache.wicket.util.time.Duration;
@@ -228,4 +231,15 @@
assertNull(vm.getAsDuration("duration.missing"));
assertEquals(defDuration, vm.getAsDuration("duration.missing", defDuration));
}
+
+ /**
+ * Make sure that ValueMap is serializable.
+ *
+ * @throws Exception
+ */
+ public void testSerializable() throws Exception
+ {
+ SerializableChecker checker = new SerializableChecker(new NotSerializableException());
+ checker.writeObject(new ValueMap());
+ }
}