United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4811356 : java.util.prefs exception classes should be serializable

Details
Type:
Enhancement
Submit Date:
2003-01-31
Status:
Resolved
Updated Date:
2003-08-15
Project Name:
JDK
Resolved Date:
2003-08-15
Component:
core-libs
OS:
solaris_8
Sub-Component:
java.util
CPU:
sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
5.0 (tiger)

Related Reports

Sub Tasks

Description
There are a couple of exception classes in the java.util.prefs package:

	java.util.prefs.BackingStoreException
	java.util.prefs.InvalidPreferencesFormatException

that are specified and implemented to be aggressively not serializable, even though neither of them has any instance state that would be problematic for serialization.

Especially with the 1.4's generic exception cause facility, it would not seem surprising for a java.util.prefs exception to be found somewhere deep in the chain of causes for an exception that ultimately gets serialized as the failure of a remote call-- but with with the java.util.prefs exception classes being so hostile to being serialized, the overall serialization of such a remote call
failure will, of course, not work, making the debugging of the real cause of such a failure much less straightforward.

This RFE is to remove the following pieces of the above two exception classes:

> import java.io.NotSerializableException;

>  * Note, that although InvalidPreferencesFormatException inherits Serializable
>  * interface from Exception, it is not intended to be Serializable. Appropriate
>  * serialization methods are implemented to throw NotSerializableException.

>  * @serial exclude

>     /**
>      * Throws NotSerializableException, since InvalidPreferencesFormatException
>      * objects are not intended to be serializable.
>      */
>      private void writeObject(java.io.ObjectOutputStream out)
>                                                throws NotSerializableException {
>          throw new NotSerializableException("Not serializable.");
>      }
> 
>     /**
>      * Throws NotSerializableException, since InvalidPreferencesFormatException
>      * objects are not intended to be serializable.
>      */
>      private void readObject(java.io.ObjectInputStream in)
>                                                throws NotSerializableException {
>          throw new NotSerializableException("Not serializable.");
>      }

                                    

Comments
EVALUATION

This "agressively nonserializable" behavior was accidentally added while fixing 4434861. The classes java.util.prefs.NodeChangeEvent and PreferencesChangeEvent do deserve this treament, but BackingStoreException and InvalidPreferencesFormatException do not.  They should be made serializable.

###@###.### 2003-01-31
                                     
2003-01-31
WORK AROUND

Turn on server-side remote call logging to analyze the exception chain that should have been serialized to the caller.
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b16


                                     
2004-06-14



Hardware and Software, Engineered to Work Together