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

ColorSpace.getInstance(int): IAE is not specified

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 22
    • client-libs
    • None
    • 2d
    • behavioral
    • minimal
    • Java API
    • SE

      Summary

      • Add @throws IllegalArgumentException to the specification of java.awt.color.ColorSpace.getInstance(int).
      • Delete duplicate text about IllegalArgumentException from the java.awt.color.ICC_Profile.getInstance(int).

      Problem

      The ColorSpace.getInstance(int) throws unspecified IllegalArgumentException on incorrect input. The javadoc for "ICC_Profile.getInstance(int)" method mentioned the IllegalArgumentException twice.

      Solution

      The specification should be updated and aligned to the current behavior.

      Specification

      src/java.desktop/share/classes/java/awt/color/ColorSpace.java
      
            *         class constants (e.g. {@code CS_sRGB}, {@code CS_LINEAR_RGB},
            *         {@code CS_CIEXYZ}, {@code CS_GRAY}, or {@code CS_PYCC})
            * @return the requested {@code ColorSpace} object
      +     * @throws IllegalArgumentException if {@code cspace} is not one of the
      +     *         predefined color space types
            */
           // NOTE: This method may be called by privileged threads.
           //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
           public static ColorSpace getInstance(int cspace) {
      
      
      src/java.desktop/share/classes/java/awt/color/ICC_Profile.java
      @@ -818,8 +818,7 @@ && getData(p, icSigBlueTRCTag) != null) {
           /**
            * Constructs an {@code ICC_Profile} corresponding to one of the specific
            * color spaces defined by the {@code ColorSpace} class (for example
      -     * {@code CS_sRGB}). Throws an {@code IllegalArgumentException} if cspace is
      -     * not one of the defined color spaces.
      +     * {@code CS_sRGB}).
            *
            * @param  cspace the type of color space to create a profile for. The
            *         specified type is one of the color space constants defined in the
            *         {@code ColorSpace} class.
            * @return an {@code ICC_Profile} object corresponding to the specified
            *         {@code ColorSpace} type
            * @throws IllegalArgumentException If {@code cspace} is not one of the
            *         predefined color space types
            */
           public static ICC_Profile getInstance(int cspace) {

      link for convenience: https://github.com/openjdk/jdk/pull/14860

            serb Sergey Bylokhov
            ydanilev Yury Danilevich (Inactive)
            Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: