Thanks for the info Stuart.  Yeah, messageIn should have been transient in
the first place as I don't think it makes sense to serialize an input stream
(unless it knows it's a fileinputstream as perhaps it can recreate that
object).

Serge Knystautas
Loki Technologies
http://www.lokitech.com/
----- Original Message -----
From: "Stuart Roebuck" <[EMAIL PROTECTED]>
To: "Java Apache Mail Server" <[EMAIL PROTECTED]>
Sent: Tuesday, November 28, 2000 11:48 AM
Subject: Re: Bug fix release vs release with new avalon


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.




------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives:  <http://www.mail-archive.com/james%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to