Hi Ajit,

                The current changes look fine, 

In addition please check, if similar change is required when SampleModel is 
MultiPixelPackedSampleModel  in the same  createWritableRaster() method.

 

Thanks,

Ambarish

 

From: Ajit Ghaisas 
Sent: Monday, March 07, 2016 1:51 PM
To: awt-dev@openjdk.java.net; Sergey Bylokhov; Semyon Sadetsky; Ambarish Rapte
Subject: [9] Review-request for 6353518: Creation of a WritableRaster with a 
custom DataBuffer causes erroneous Exception

 

Hi,

 

Bug :   https://bugs.openjdk.java.net/browse/JDK-6353518

 

 

Issue : (Text from bug description)

 

An attempt to create a WritableRaster via 
Raster.createWritableRaster(SampleModel sm, DataBuffer db, Point location) 
using a custom DataBuffer causes an erroneous RasterFormatException.
Apparently the reason for this bug is that IntegerComponentRaster insists on 
being passed an instance of DataBufferInt rather than just a DataBuffer with a 
DataType of TYPE_INT.
This is quite annoying since DataBufferInt is declared final and thus cannot be 
extended.

 

 

Fix :

 

The last line of Raster.createWritableRaster() method already has a way to 
handle generic case if the input does not match any of the cases in switch 
statements in that method.

The fact that  " *InterleavedRaster() constructors throw exception if 
DataBuffer passed to them does not match the expected type" was ignored 
earlier. 

 

This fix adds a check of "DataBuffer type" before creating respective 
*InterleavedRaster() objects. 

It constructs the SunWritableRaster in case DataBuffer type does not match any 
data specific DataBuffer classes (DataBufferByte, DataBufferUShort, 
DataBufferInt)

 

 

Request to review webrev containing this fix : 

http://cr.openjdk.java.net/~arapte/ajit/6353518/webrev.00/

 

 

Regards,

Ajit

Reply via email to