Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-2757

[classlib][awt] java.awt.image.RasterFormatException.createBandedRaster(int dataType,int w,int h,int scanlineStride,int[] bankIndices,int[] bandOffsets,Point location) throws RasterFormatException while RI throws IllegalArgumentException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • None

    Description

      The following Raster methods should throw RasterFormatException if w or h is less than or equal to zero according to the API spec:
      createBandedRaster(int dataType,int w,int h,int scanlineStride,int[] bankIndices,int[] bandOffsets,Point location)
      createPackedRaster(int dataType,int w,int h,int bands,int bitsPerBand,Point location)
      createInterleavedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, int pixelStride, int[] bandOffsets, Point location)
      createInterleavedRaster(int,int,int,int,int,int[],Point)

      They follow the specification on Harmony, but RI implementation throw unspecified IllegalArgumentException in this case.

      The following testcase demonstrates this behavior (passes on RI but fails on Harmony):

      package java.awt.image;

      import junit.framework.TestCase;

      import java.awt.*;

      public class RasterTest extends TestCase {
      public void testcase0() {
      try {
      Raster.createBandedRaster(1, -10, 10, 10, new int[]

      {0}, new int[] {0}

      , new Point());
      fail("Exception expected");
      } catch (RasterFormatException expectedException)

      { fail(expectedException +" was thrown"); }

      catch (IllegalArgumentException expectedException)

      { System.out.println(expectedException +" was thrown"); }

      }
      }

      I think Harmony should folow specification in this case and suggest to treat it as a non-bug difference.

      Attachments

        Activity

          People

            cap Alexey Petrenko
            oleg.v.khaschansky@gmail.com Oleg Khaschansky
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: