DataBuffer constructors and methods do not specify required exceptions

XMLWordPrintable

      The specification for java.awt.image.DataBufferUShort does not clearly define the exceptions that may be thrown by several constructors and methods, leading to unspecified behavior.

      Constructors

      As and example the following constructors do not specify the exceptions they may throw for invalid inputs:

      DataBufferUShort(short[][] dataArray, int size)

      DataBufferUShort(short[][] dataArray, int size, int[] offsets)

      These constructors should explicitly specify that a NullPointerException is thrown when dataArray is null for example.

      Additionally, the constructor:

      DataBufferUShort(int size, int numBanks)

      does not specify the behavior when negative/OutOfBounds values are passed for size or numBanks. It is unclear whether a NegativeArraySizeException or an ArrayIndexOutOfBoundsException is expected in such cases.

      Methods

      For the following methods:

      getElem(...)

      getData(...)

      setElem(...)

      the specification should explicitly state that an ArrayIndexOutOfBoundsException is thrown when:

      - the bank index is invalid (less than 0 or greater than or equal to numBanks), or

      - the element index is invalid (less than 0 or greater than or equal to size).

            Assignee:
            Philip Race
            Reporter:
            Hamza Nassour
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: