readResolve not being called

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

readResolve not being called

Guilherme Luis Bradasch
Hello, 

I have a simple class that I want to use with the ToAttributedValueConverter. As the tutorials show, I use:

@XStreamConverter(value=ToAttributedValueConverter.class, strings={"description"})

and both the serialization and the de-serialization work, with one little problem: I need a readResolve method to initialize some transient fields, and when I use this converter, it never gets called.

Without the converter, readResolve is called normally.

Is this expected behavior or a bug?

Thanks, 

Guilherme Bradasch
Reply | Threaded
Open this post in threaded view
|

Re: readResolve not being called

Jörg Schaible-2
Hi Guilherme,

Guilherme Luis Bradasch wrote:

> Hello,
>
> I have a simple class that I want to use with the
> ToAttributedValueConverter. As the tutorials show, I use:
>
> @XStreamConverter(value=ToAttributedValueConverter.class,
> strings={"description"})
>
> and both the serialization and the de-serialization work, with one little
> problem: I need a readResolve method to initialize some transient fields,
> and when I use this converter, it never gets called.
>
> Without the converter, readResolve is called normally.

The ToAttributesValueConverter does currently not support the
writeReplace/readResolve method pair.

> Is this expected behavior or a bug?

Main reason is, that it does not make sense to support writeReplace. Since
in this case the converter should suddenly deal with a complete different
type of object, which does not make sense.

Support of readResolve is questionable though. Can you open a JIRA issue for
this?

- Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email