Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.4.7
-
Fix Version/s: 1.4.8
-
Component/s: Converters
-
Labels:None
Description
When an object which extends ConcurrentHashMap is converted to xml and back, then an MissingFieldException is thrown.
The issue come with Java 8 when segmentMask and other properties were defined in serialPersistentFields.
import java.util.concurrent.ConcurrentHashMap; import com.thoughtworks.xstream.XStream; public class ConcurrentHashMapTest { public static void main(String[] args) { ConcurrentHashMap<String, Integer> map = new ConcurrentHashMap<String, Integer>() { private static final long serialVersionUID = 1L; }; XStream xstream = new XStream(); @SuppressWarnings("unchecked") ConcurrentHashMap<String, Integer> copyOfMap = (ConcurrentHashMap<String, Integer>) xstream.fromXML(xstream.toXML(map)); assert(copyOfMap.equals(map)); } }
Note: the issue appear only if ConcurrentHashMap is extended.
Tested on XStream 1.4.7, JDK 1.8.0_05.
Activity
Jörg Schaible
made changes -
Field | Original Value | New Value |
---|---|---|
Resolution | Fixed [ 1 ] | |
Fix Version/s | 1.4.x Maintenance [ 19602 ] | |
Status | Open [ 1 ] | Resolved [ 5 ] |
Jörg Schaible
made changes -
Fix Version/s | 1.4.x Maintenance [ 19602 ] | |
Fix Version/s | 1.4.8 [ 20992 ] |
Jörg Schaible
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |
You found actually a corner case where the serialPersistentFields were used to ignore fields at deserialization. Fixed in trunk.