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

ObjectInputStream methods invoking the OIF.CFG.getSerialFilterFactory() silent about error cases.

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 18
    • core-libs
    • None
    • behavioral
    • minimal
    • The additional text describes existing behavior.
    • Java API
    • SE

      Summary

      Clarify the current behavior of java.io.ObjectInputStream constructors in the case where the serial filter factory from ObjectInputFilter.Config.getSerialFilterFactory may throw an exception.

      Problem

      The javadoc for ObjectInputStream constructors describes calling the serial filter factory returned from ObjectInputFilter.Config.getSerialFilterFactory() but does not describe the case where the factory may throw an exception.

      Solution

      Exceptions throw by the serial filter factory are thrown normally and cause the ObjectInputStream constructor to terminate with the exception.

      Specification

      In both ObjectInputStream constructors add the following after the description of the invocation of the serial filter factory.

      @@ -384,6 +384,8 @@ public class ObjectInputStream
            * <p>The constructor initializes the deserialization filter to the filter returned
      -     * by invoking the {@link Config#getSerialFilterFactory()} with {@code null} for the current filter
      +     * by invoking the serial filter factory returned from {@link Config#getSerialFilterFactory()} 
      +     * with {@code null} for the current filter
             * and the {@linkplain Config#getSerialFilter() static JVM-wide filter} for the requested filter.
      +     * When the filter factory {@code apply} method is invoked it may throw a runtime exception
      +     * preventing the {@code ObjectInputStream} from being constructed.
      
      @@ -421,6 +423,8 @@ public class ObjectInputStream
            * <p>The constructor initializes the deserialization filter to the filter returned
      -     * by invoking the {@link Config#getSerialFilterFactory()} with {@code null} for the current filter
      +    * by invoking the serial filter factory returned from {@link Config#getSerialFilterFactory()} 
      +    * with {@code null} for the current filter
            * and the {@linkplain Config#getSerialFilter() static JVM-wide filter} for the requested filter.
      +     * When the filter factory {@code apply} method is invoked it may throw a runtime exception
      +     * preventing the {@code ObjectInputStream} from being constructed.

            rriggs Roger Riggs
            kganapureddy Krushnareddy Ganapureddy
            Brian Burkhalter, Lance Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: