You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2007/01/23 19:41:49 UTC

[jira] Updated: (HARMONY-2781) [classlib][awt] Compatibility: java.awt.image.MultiPixelPackedSampleModel(int,int,int,int) throws RasterFormatException while RI throws ArithmeticException

     [ https://issues.apache.org/jira/browse/HARMONY-2781?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov updated HARMONY-2781:
-------------------------------------

    Component/s:     (was: Classlib)
                 Non-bug differences from RI

I agree it should throw RasterFormatException here. BTW, it doesn't throw RFE even for the second variant of the contructor - MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits, int scanlineStride,                                   int dataBitOffset). So I move it to "non-bug differences from RI" component.

> [classlib][awt] Compatibility: java.awt.image.MultiPixelPackedSampleModel(int,int,int,int) throws RasterFormatException while RI throws ArithmeticException
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2781
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2781
>             Project: Harmony
>          Issue Type: Bug
>          Components: Non-bug differences from RI
>            Reporter: Oleg Khaschansky
>         Assigned To: Alexei Zakharov
>            Priority: Minor
>
> java.awt.image.MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits) throws RasterFormatException while RI throws ArithmeticException when numberOfBits parameter is zero. 
> The API specification says for another version of the constructor MultiPixelPackedSampleModel(int dataType, int w, int h, int numberOfBits, int scanlineStride, int dataBitOffset) the following:
> RasterFormatException - if the number of bits per pixel is not a power of 2 or if a power of 2 number of pixels do not fit in one data element. 
> It's possible to expect the same restrictions for MultiPixelPackedSampleModel(int,int,int,int) also, but API spec says nothing for it. It also says nothing about ArithmeticException.
> I suggest to treat this as a non-bug diff from RI.
> The following testcase illustrates this:
> ---------------------------------------------------------------------------------------
> import junit.framework.TestCase;
> import java.awt.image.MultiPixelPackedSampleModel;
> import java.awt.image.RasterFormatException;
> public class Test0 extends TestCase {
>     public void testcase0()
>     {
>         try {
>             new MultiPixelPackedSampleModel(1, 1, 3, 0);
>             fail();
>         } catch (RasterFormatException expectedException) {       
>             fail(expectedException+" was thrown");
>         } catch (ArithmeticException expectedException) {
>             System.out.println(expectedException+" was thrown");
>         }
>     }
> }
> ---------------------------------------------------------------------------------------
> Harmony:
> junit.framework.AssertionFailedError: java.awt.image.RasterFormatException: Number of Bits equals to zero was thrown
> 	at Test0.testcase0(Test0.java:31)
> 	at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
> RI:
> java.lang.ArithmeticException: / by zero was thrown

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.