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

Remove OOME statement from Base64.Decoder

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Withdrawn
    • Icon: P4 P4
    • None
    • core-libs
    • None
    • behavioral
    • minimal
    • The compatibility risk is minimum, as the Base64.Decoder.decode() methods were incorrectly throwing an OOME for the allocatable array/buffer size
    • Java API
    • SE

      Summary

      The OOME statement should be removed from Base64.Decoder.

      Problem

      The Base64.Decoder specify the OOME error to be thrown by decode methods when the decoded byte array/buffer of needed size can not be allocated. The issue is because of the overflow of an intermediary integer value, not the final value, which should be handled with out throwing the error.

      Solution

      Remove the OutOfMemoryError statement from Base64.Decoder, as the allocation size of the decoded bytes will never be larger than the input bytes size.

      Specification

      Update Base64.Decoder spec

      from:

      * <p> Unless otherwise noted, passing a {@code null} argument to
      * a method of this class will cause a
      * {@link java.lang.NullPointerException NullPointerException} to
      * be thrown.
      * <p> If the decoded byte output of the needed size can not
      *     be allocated, the decode methods of this class will
      *     cause an {@link java.lang.OutOfMemoryError OutOfMemoryError}
      *     to be thrown.

      to:

      * <p> Unless otherwise noted, passing a {@code null} argument to
      * a method of this class will cause a
      * {@link java.lang.NullPointerException NullPointerException} to
      * be thrown.

            nishjain Nishit Jain
            nishjain Nishit Jain
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: