JDK-8217971 : Remove OOME statement from Base64.Decoder
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.util
  • Priority: P4
  • Status: Closed
  • Resolution: Withdrawn
  • Submitted: 2019-01-29
  • Updated: 2019-02-04
  • Resolved: 2019-02-04
Related Reports
CSR :  
Description
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.