[jdom-interest] Serialization

Rolf Lear jdom at tuis.net
Sun Feb 12 15:13:22 PST 2012


Hi all.

I have only limited experience with Java serialization. My experiences 
in the past have always been ugly, but I have never been expert enough 
in it to be opinionated...

I have been trying to remedy that now, though, and I have come to the 
conclusion that JDOM still has broken serialization. The problems I see are:

1. we rely on a hodge-podge of serialization mechanisms to implement it.
2. we mark 'Filter' and all the Filter subclasses as being serializable, 
why?
3. We have no control of how any sublcasses of our classes implement 
serialization.

Fundamentally, XML is specifically designed to make serialization of 
information easy....

The whole purpose of JDOM is to make it easy to serialize and 
deserialize (and inspect and change) XML. Why are we also implementing 
native Java serialization?

So, it is my (currently) uninformed opinion that we should strip the 
Serialization from JDOM entirely.

If people can find convincing reasons to make JDOM serializable, it is 
my opinion that it should be implemented as a simple call to 
XMLOutputter.output(....) to convert the JDOM to a stream (and a reverse 
ability to parse the results....). This will satisfy any subclassing 
mechanisms....

Finally, if there is a convincing reason why that would be inappropriate 
too, then I think the right answer would be to replace the current 
serialization process with a redesigned and more robust one.

So, I am looking for feedback....

does anyone use Java Serialization on JDOM objects?

Why?

Examples?



Thanks

Rolf


More information about the jdom-interest mailing list