JDK-4811356 : java.util.prefs exception classes should be serializable
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2003-01-31
  • Updated: 2017-05-16
  • Resolved: 2003-08-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
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
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b16
2004-06-14

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

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