You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Attila Király <ki...@gmail.com> on 2011/01/18 16:02:18 UTC
Why are all fields of UploadInfo transient?
Hi!
o.a.w.extensions.ajax.markup.html.form.upload.UploadInfo is a Serializable
class but only has three fields (all with type long) and all 3 is transient.
I am curious: why is that?
The fields:
private transient long timeStarted;
private transient long totalBytes;
private transient long bytesUploaded;
>From the code it seems timeStarted and totalBytes could be final because
they are only set in the constructor, and all 3 are needed when the class is
(de)serialized (which is possible in theory as instances are stored in
session). So imho they shouldn't be transient.
Király Attila
Re: Why are all fields of UploadInfo transient?
Posted by Martin Grigorov <mg...@apache.org>.
Many of Upload related classes are copied from commons-fileupload so I
cannot say for sure but this is what I think about this one:
UploadInfo is used for the ProgressBar and the variables below are not
needed actually after deserialization because at this point the ProgressBar
is no more visible.
I think the UploadInfo itself should not be serialized.
On Tue, Jan 18, 2011 at 4:02 PM, Attila Király <ki...@gmail.com>wrote:
> Hi!
>
> o.a.w.extensions.ajax.markup.html.form.upload.UploadInfo is a Serializable
> class but only has three fields (all with type long) and all 3 is
> transient.
> I am curious: why is that?
> The fields:
> private transient long timeStarted;
> private transient long totalBytes;
> private transient long bytesUploaded;
>
> From the code it seems timeStarted and totalBytes could be final because
> they are only set in the constructor, and all 3 are needed when the class
> is
> (de)serialized (which is possible in theory as instances are stored in
> session). So imho they shouldn't be transient.
>
>
> Király Attila
>