harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shipilov, Alexander D" <alexander.d.shipi...@intel.com>
Subject [classlib][awt] java.awt.image.Raster.createPackedRaster() throws RasterFormatException on RI while it doesn't on Harmony
Date Thu, 11 Jan 2007 16:37:13 GMT
 Please, help me to make clear JIRA HARMONY-2884.
RI throws RasterFormatException (Harmony doesn't) in the following case:

        DataBufferUShort db = new DataBufferUShort(new short[5], 3);
        SinglePixelPackedSampleModel sm = new 
                SinglePixelPackedSampleModel(1, 10, 1, 0, new int[431]);
        Raster localRaster = Raster.createRaster(sm, db, new Point());

 RasterFormatException: Data array too small (should be 10 )

Central numbers in this example - short[5] and 10.
RI compares DataBufferUShort.dataArray.length (==5) with
SampleModel.width (==10). RI supposes that (width - 1) should be less
than dataArray.length (Spec says nothing about this situation).
But here arises several questions:
1. Why width? Not (width * height)?
2. Why dataArray.length? Not dataArray.size?
   I'll explain this point. Spec says about DataBufferUShort(short[]
dataArray, int size):
 	Constructs an unsigned-short based DataBuffer with a single bank
using 	the specified array. Only the first "size" elements should be
used by 	accessors of this DataBuffer. dataArray must be large
enough to hold 	"size" elements.
   So, size criteria should be size, not length. Am I right?

Harmony doesn't produce any comparisons and this behavior doesn't
contradict spec. I suggest close this bug as non-bug diff.

Alexander Shipilov

View raw message