Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4811356

java.util.prefs exception classes should be serializable

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.4.0
    • core-libs
    • None
    • tiger
    • sparc
    • solaris_8

      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.");
      > }

            jjb Josh Bloch (Inactive)
            peterjones Peter Jones (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: