Log Message
Fix NPE in HibernateMapper if a collection contains null (XSTR-712).
Modified Paths
- trunk/xstream-distribution/src/content/changes.html
- trunk/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/mapper/HibernateMapper.java
Diff
Modified: trunk/xstream-distribution/src/content/changes.html (2001 => 2002)
--- trunk/xstream-distribution/src/content/changes.html 2012-12-24 13:09:56 UTC (rev 2001)
+++ trunk/xstream-distribution/src/content/changes.html 2013-01-14 18:36:05 UTC (rev 2002)
@@ -1,7 +1,7 @@
<html>
<!--
Copyright (C) 2005, 2006 Joe Walnes.
- Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 XStream committers.
+ Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 XStream committers.
All rights reserved.
The software in this package is published under the terms of the BSD
@@ -42,6 +42,7 @@
<ul>
<li>JIRA:XSTR-711: DateConverter cannot handle dates in different era.</li>
+ <li>JIRA:XSTR-712: HibernateMapper throws NPE if a collection contains null.</li>
<li>DateConverter supports now localized formats.</li>
<li>JIRA:XSTR-710: JsonWriter does not write BigInteger and BigDecimal as number values.</li>
<li>JIRA:XSTR-708: SqlTimestampConverter does not ignore timezone.</li>
Modified: trunk/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/mapper/HibernateMapper.java (2001 => 2002)
--- trunk/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/mapper/HibernateMapper.java 2012-12-24 13:09:56 UTC (rev 2001)
+++ trunk/xstream-hibernate/src/java/com/thoughtworks/xstream/hibernate/mapper/HibernateMapper.java 2013-01-14 18:36:05 UTC (rev 2002)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2011, 2012 XStream Committers.
+ * Copyright (C) 2007, 2011, 2012, 2013 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
@@ -55,16 +55,17 @@
}
public String serializedClass(final Class clazz) {
- // check whether we are Hibernate proxy and substitute real name
- if (HibernateProxy.class.isAssignableFrom(clazz)) {
- return super.serializedClass(clazz.getSuperclass());
+ if (clazz != null) {
+ // check whether we are Hibernate proxy and substitute real name
+ if (HibernateProxy.class.isAssignableFrom(clazz)) {
+ return super.serializedClass(clazz.getSuperclass());
+ }
+
+ if (collectionMap.containsKey(clazz)) {
+ // Pretend this is the underlying collection class and map that instead
+ return super.serializedClass((Class)collectionMap.get(clazz));
+ }
}
-
- if (collectionMap.containsKey(clazz)) {
- // Pretend this is the underlying collection class and map that instead
- return super.serializedClass((Class)collectionMap.get(clazz));
- }
-
return super.serializedClass(clazz);
}
}
To unsubscribe from this list please visit:
