Change IAE to NPE in java.awt.image.Kernel when data is null

XMLWordPrintable

    • Type: CSR
    • Resolution: Unresolved
    • Priority: P4
    • 26
    • Component/s: client-libs
    • None
    • 2d
    • behavioral
    • minimal
    • Hide
      The compatibility risk is minimal. The behavior is being restored to what it was before the change introduced by JDK-8371308.
      Show
      The compatibility risk is minimal. The behavior is being restored to what it was before the change introduced by JDK-8371308 .
    • Java API
    • SE

      Summary

      This CSR updates the behavior of the patch integrated under [JDK-8371308|https://bugs.openjdk.org/browse/JDK-8371308]. This change restores the original exception type thrown when the data argument is null from IllegalArgumentException back to NullPointerException.

      Problem

      The earlier patch modified the thrown exception for a null data argument from NullPointerException to IllegalArgumentException. This introduced an inconsistency with long-standing behavior, as well as with established practices in related code.

      Solution

      Revert the exception type for a null data parameter from IllegalArgumentException back to NullPointerException.

      Specification

          src/java.desktop/share/classes/java/awt/image/Kernel.java
      
           @@ -59,7 +60,7 @@ public class Kernel implements Cloneable {
                * @param width         width of the kernel
                * @param height        height of the kernel
                * @param data          kernel data in row major order
          -     * @throws IllegalArgumentException if {@code data} is null
          +     * @throws NullPointerException if {@code data} is null
                * @throws IllegalArgumentException if {@code width} or {@code height}
                *         is not positive
                * @throws IllegalArgumentException if product of {@code width} and
      @@ -69,9 +70,7 @@ public class Kernel implements Cloneable {
                *         {@code height}
                */
           public Kernel(int width, int height, float[] data) {
      

            Assignee:
            Sergey Bylokhov
            Reporter:
            Sergey Bylokhov
            Alexander Zvegintsev, Alexey Ivanov, Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: