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[]
, new Point());
fail("Exception expected");
} catch (RasterFormatException expectedException)
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.