On Tuesday, November 28, 2000, at 12:16 PM, Serge Knystautas wrote:
> I'd very much like to, but how can we do this? I believe the only
> serialization problem revolve around the MailAddress class (both as the
> sender and the collection of recipients). I'm not a wiz on serialization,
> so does anybody know how we could deserialize these objects across class
> versioning?
>
I've just had a quick read of E.R.Harold's "Java IO" (O'Reilly) and a bit of a net
search on the subject.
Basically, when a class is serialized, it is versioned with the value of the static
long final serialVersionUID. If this has not been explicitly set, then it is
automatically set (at run time?) by calculating a form of hash function based on
things about the class that affect serialization. So, in theory, if changes are made
to a class that don't affect serialization, they will have no effect on the automatic
serialVersionUID.
The serialver tool (part of the JDK) will output the serialVersionUID of a given
class, so you can compare two versions of a class and see if they have 'broken' the
serialization.
Looking at the code, the problem is, I think, in org/apache/james/core/MailImpl.java.
Between versions 1.2 and 1.3 of that class, the serialized property messageIn was
removed. (Here's the declarations at the beginning of version 1.2 in the CVS):
> private String errorMessage;
> private String state;
> private MimeMessage message;
> private InputStream messageIn; // <-- Removed in Version 1.3
> private MailAddress sender;
> private Collection recipients;
> private String name;
> private String remoteHost = "localhost";
> private String remoteAddr = "127.0.0.1";
> private Date lastUpdated = new Date();
In theory, all that should be necessary to fix serialization is to add the declaration
back in.
Next time we have to break serialization, we might want to mark as "transient" any
properties that don't need to be serialized so we are less likely to hit this problem
again.
Stuart.
** We are currently experiencing prolonged difficulties with our email **
** provider DIGIWEB and INTERLIANT. To guarantee that your response **
** is received, please replace "adolos.com" with "adolos.co.uk" **
** in your response. **
-------------------------------------------------------------------------
Stuart Roebuck, BSc, MBA Tel.: 0131 228 4853 / Fax.: 0870 054 8322
Managing Director Alpha Numeric Pager: 07654 588898
ADOLOS http://www.adolos.com/
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives: <http://www.mail-archive.com/james%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]