Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
For me, this whole thing stemmed from reconstituting Objects after serialization. Some data members were declared transient (or didn't implement Serializable). So I was faced with the decision of cluttering up constructors with "initialization" methods, recreating the data members on readObject (directly or using the same "initialization" methods), wrapping their usage in a try/catch clause (looking for NullPointerExceptions) or just checking to see if the memebers != null. I opted for the try/catch (for better or worse) since the members really have one time that they were actually == null. So I guess the question is, "If I know that 99.999% of the time I will not throw an Exception, what is the cost of a try/catch clause?"
Replies:
|
Sponsored Links
|