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

The exception handling for the BandedSampleModel constructor is different

XMLWordPrintable

    • 2d
    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "1.8.0_462"
      OpenJDK Runtime Environment (Temurin)(build 1.8.0_462-b08)
      OpenJDK 64-Bit Server VM (Temurin)(build 25.462-b08, mixed mode)


      openjdk version "11.0.28" 2025-07-15
      OpenJDK Runtime Environment Temurin-11.0.28+6 (build 11.0.28+6)
      OpenJDK 64-Bit Server VM Temurin-11.0.28+6 (build 11.0.28+6, mixed mode)


      openjdk version "11.0.28" 2025-07-15
      OpenJDK Runtime Environment Temurin-11.0.28+6 (build 11.0.28+6)
      OpenJDK 64-Bit Server VM Temurin-11.0.28+6 (build 11.0.28+6, mixed mode)

      openjdk version "17.0.16" 2025-07-15
      OpenJDK Runtime Environment Temurin-17.0.16+8 (build 17.0.16+8)
      OpenJDK 64-Bit Server VM Temurin-17.0.16+8 (build 17.0.16+8, mixed mode, sharing)


      A DESCRIPTION OF THE PROBLEM :
      In OpenJDK 17 and OpenJDK 21, the `BandedSampleModel` constructor performs strict validation on its parameters, for example:

      * `IllegalArgumentException` - if `w` and `h` are not both greater than 0
      * `IllegalArgumentException` - if the product of `w` and `h` is greater than `Integer.MAX_VALUE`
      * `IllegalArgumentException` - if `numBands` is not > 0
      * `IllegalArgumentException` - if `dataType` is not one of the supported data types for this sample model.

      This allows for the detection of corresponding defects before construction and throws detailed error messages to help developers with debugging.

      However, in OpenJDK 8 and OpenJDK 11, only the `dataType` is handled, for example: `IllegalArgumentException - if dataType is not one of the supported data types`.

      To ensure uniformity, I recommend adding the same logic to OpenJDK 8 and OpenJDK 11 to ensure consistency in the thrown Exceptions.


            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: