You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ms...@apache.org on 2010/06/08 16:43:39 UTC
svn commit: r952664 -
/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/CollectionUtils.java
Author: mstarets
Date: Tue Jun 8 14:43:39 2010
New Revision: 952664
URL: http://svn.apache.org/viewvc?rev=952664&view=rev
Log:
TRINIDAD-1824 - CollectionUtils._checkSerialization should not throw exceptions for null values
Modified:
myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/CollectionUtils.java
Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/CollectionUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/CollectionUtils.java?rev=952664&r1=952663&r2=952664&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/CollectionUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/CollectionUtils.java Tue Jun 8 14:43:39 2010
@@ -1377,7 +1377,7 @@ public final class CollectionUtils
throw new ClassCastException(_LOG.getMessage("UNSERIALIZABLE_PROPERTY_KEY",
new Object[]{key, this}));
- if (!(value instanceof Serializable))
+ if (!(value == null || value instanceof Serializable))
throw new ClassCastException(_LOG.getMessage("UNSERIALIZABLE_PROPERTY_VALUE",
new Object[]{value, key, this}));
@@ -1398,16 +1398,19 @@ public final class CollectionUtils
}
}
- // verify that the contents of the value are in fact Serializable
- try
+ if (value != null)
{
- new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(value);
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException(_LOG.getMessage("FAILED_SERIALIZATION_PROPERTY_VALUE",
- new Object[]{value, key, this}),
- e);
+ // verify that the contents of the value are in fact Serializable
+ try
+ {
+ new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(value);
+ }
+ catch (IOException e)
+ {
+ throw new IllegalArgumentException(_LOG.getMessage("FAILED_SERIALIZATION_PROPERTY_VALUE",
+ new Object[]{value, key, this}),
+ e);
+ }
}
}