Modify

Ticket #162 (closed enhancement: fixed)

Opened 9 years ago

Call custom restore method after unmarshaling or cloning an object

Reported by: Bernhard Haumacher (haui at haumacher dot de) Owned by:
Priority: normal Milestone: 1.08a
Component: uka.transport Version:
Severity: normal Keywords:
Cc:

Description

A transportable class may provide a private method named "restoreAfterUnmarshal()" that takes no arguments and declares IOException and ClassNotFoundException to be thrown. This method is automatically called during the unmarshaling and deep cloning process of an object of this class. restoreAfterUnmarshal() is called after all state of the corresponding object has been unmarshaled up to the actual class in the class hierarchy. This method can be used for example to restore transient state that is not marshaled along with the object.

Problem

It is critical that both exceptions (IOException and ClassNotFoundException) are declared for restoreAfterUnmarshal(), because this method is also called after a deep clone of the object. Because the corresponding deep clone method does not throw any of these exceptions, catch clauses have to be generated for them. But it is illegal to declare a catch clause, if the exception might not be thrown wihin the body of the try statement.

Problem

User code in the custom restoreAfterUnmarshal() method may experience references to uninitialized objects (see ticket:193).

implemented since 1.08a.

Attachments

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.