Tharindu, It is hard to guess where this strange test comes from. The bug might be filed as a part of an exception compatibility quest undertaken by a group of contributors in 2006. The goal was to match Harmony behavior with RI one using a set of simply generated tests.
So the question is if the unchanged test passes on RI. If it does, could we behave in a same way without an ugly kludge? Sometimes interchanging an order of independent actions gives a desired outcome. >From the other side since this test uses nearly random parameters, it may be ok just to change them in a way you suggest. For example, Andrey, who marked this bug as fixed, has used different parameters in his regression test. Andrey, what do you think? Thanks. On Thu, May 8, 2008 at 4:41 PM, Mackie Mathew <[EMAIL PROTECTED]> wrote: > I went through that before the change. When the buffer is small a > RastorException: Data Buffer too small is thrown, which prevents the > expected ArrayIndexOutOfBoundsException from being thrown. But when the Data > Buffer's size is increased the expected exception is thrown. > > If I'm not mistaken the purpose of this test is to test getPixels() function > with the Integer.MAX_VALUE, as mentioned in [1], not the Data Buffer size. > > On Thu, May 8, 2008 at 4:46 PM, Alexei Fedotov <[EMAIL PROTECTED]> > wrote: > > > > > Tharindu, thanks for your effort. > > > > I believe the buffer was intentionally small, see [1]. When the buffer > > was small, the expected ArrayIndexOutOfBoundsException was not thrown, > > was it? > > > > Thanks. > > > > [1] https://issues.apache.org/jira/browse/HARMONY-2875 > > > > On Thu, May 8, 2008 at 2:41 PM, Mackie Mathew <[EMAIL PROTECTED]> wrote: > > > RasterTest was failing because testGetPixels was failing. I was able to > > pass > > > the test with the following modfications: > > > > > > public void testGetPixels() { > > > // Regression test for HARMONY-2875 > > > try { > > > Raster raster = Raster.createRaster(new BandedSampleModel(1, > > 2, > > > 3, 4), > > > new DataBufferByte(new byte[191], *6)*, > > > new Point(new Point(28, 43))); > > > > > > raster.getPixels(6, > > > Integer.MAX_VALUE, 1, 0, new int[] {}); > > > fail("ArrayIndexOutOfBoundsException should be thrown"); > > > //$NON-NLS-1$ > > > } catch (ArrayIndexOutOfBoundsException e) { > > > // expected > > > } > > > > > > > > > The test was failing because the DataBuffer size was too small. When it > > was > > > increased from 5 to 6, the test passed. Is this fix acceptable? > > > -- > > > Regards, > > > > > > Tharindu > > > > > > > > > > > -- > > With best regards, > > Alexei > > > > > > -- > Regards, > > Tharindu > -- With best regards, Alexei
