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

[jira] Updated: (HARMONY-2779) [classlib][awt] Compatibility: java.awt.image.MultiPixelPackedSampleModel.setDataElements(int ,int,Object ,DataBuffer) throws unspecified NPE while Ri throws ArrayIndexOutOfBoundsException

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

Andrey Pavlenko updated HARMONY-2779:
-------------------------------------

    Attachment: MultiPixelPackedSampleModelTest.patch
                MultiPixelPackedSampleModel.patch

The patch and the regression test are attached.

> [classlib][awt] Compatibility: java.awt.image.MultiPixelPackedSampleModel.setDataElements(int ,int,Object ,DataBuffer) throws unspecified NPE while Ri throws ArrayIndexOutOfBoundsException
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2779
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2779
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Oleg Khaschansky
>            Priority: Minor
>         Attachments: MultiPixelPackedSampleModel.patch, MultiPixelPackedSampleModelTest.patch
>
>
> Harmony throws unspecified NPE for java.awt.image.MultiPixelPackedSampleModel.setDataElements(int x,int y,     
> Object obj,DataBuffer data) while RI throws specified ArrayIndexOutOfBoundsException. It's definitely related to the different order of usage of the passed parameters. Harmony uses Object obj first and throws NPE if it is null while RI throws exceptions related to the invalid DataBuffer data param first. The following testcase illustrates this:
> ------------------------------------------------------------------------------------------
> import junit.framework.TestCase;
> import javax.swing.*;
> import java.awt.image.MultiPixelPackedSampleModel;
> import java.awt.image.DataBufferFloat;
> import java.awt.image.DataBuffer;
> public class Test0 extends TestCase {
>     public void testcase0() {
>         MultiPixelPackedSampleModel localMultiPixelPackedSampleModel =
>                 new MultiPixelPackedSampleModel(0,52,4,8);
>         DataBufferFloat localDataBufferFloat = new DataBufferFloat(4,1);
>         try {
>             localMultiPixelPackedSampleModel.setDataElements(6,2,(Object) null, localDataBufferFloat);
>             fail();
>         } catch (NullPointerException npe) {
>             fail(npe+" was thrown");
>         } catch (ArrayIndexOutOfBoundsException expectedException) {
>             System.out.println(expectedException +" was thrown");
>         }
>     }
>     public void testcase1() {
>         MultiPixelPackedSampleModel localMultiPixelPackedSampleModel =
>                 new MultiPixelPackedSampleModel(0,14907,18936,2);
>         JSplitPane localJSplitPane = new JSplitPane();
>         try {
>             localMultiPixelPackedSampleModel.setDataElements(14,14, localJSplitPane,(DataBuffer) null);
>             fail();
>         } catch (ClassCastException expectedException) {
>             fail(expectedException +" was thrown");
>         } catch (NullPointerException npe) {
>             System.out.println(npe +" was thrown");
>         }
>     }
> }
> ------------------------------------------------------------------------------------------
> Harmony:
> junit.framework.AssertionFailedError: java.lang.NullPointerException was thrown
> 	at Test0.testcase0(Test0.java:35)
> 	at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
> 	at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> junit.framework.AssertionFailedError: java.lang.ClassCastException: javax.swing.JSplitPane incompatible with [B was thrown
> 	at Test0.testcase1(Test0.java:49)
> 	at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
> 	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
> 	at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> RI:
> java.lang.NullPointerException was thrown
> java.lang.ArrayIndexOutOfBoundsException: 110 was thrown

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