harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Khaschansky (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2779) [classlib][awt] Compatibility: java.awt.image.MultiPixelPackedSampleModel.setDataElements(int ,int,Object ,DataBuffer) throws unspecified NPE while Ri throws ArrayIndexOutOfBoundsException
Date Mon, 18 Dec 2006 15:38:21 GMT
[classlib][awt] Compatibility: java.awt.image.MultiPixelPackedSampleModel.setDataElements(int
,int,Object ,DataBuffer) throws unspecified NPE while Ri throws ArrayIndexOutOfBoundsException
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2779
                 URL: http://issues.apache.org/jira/browse/HARMONY-2779
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Oleg Khaschansky
            Priority: Minor


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.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message