harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Okomin (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2610) [classlib][awt] Compatibility: java.awt.GraphicsDevice.getDisplayMode() on RI throws unspecified NPE while Harmony doesn't
Date Mon, 11 Dec 2006 15:08:21 GMT
[classlib][awt] Compatibility: java.awt.GraphicsDevice.getDisplayMode() on RI throws unspecified
NPE while Harmony doesn't
--------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2610
                 URL: http://issues.apache.org/jira/browse/HARMONY-2610
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Ilya Okomin
            Priority: Minor


Harmony  for java.awt.GraphicsDevice.getDisplayMode() does not throw unspecified NPE while
RI does.

Test case for reproducing:
------------------ test.java -----------------
import junit.framework.TestCase;
import junit.textui.TestRunner;

import java.awt.GraphicsDevice;
import java.awt.GraphicsConfiguration;

public class test extends TestCase {

    public static void main(String args[]) {
        TestRunner.run(test.class);
    }


    private static class TestGraphicsDevice extends GraphicsDevice {
        public int getType() {
            return GraphicsDevice.TYPE_IMAGE_BUFFER;
        }

        public String getIDstring() {
            return "A";
        }

        public GraphicsConfiguration[] getConfigurations() {
            return new GraphicsConfiguration[0];
        }

        public GraphicsConfiguration getDefaultConfiguration() {
            return null;
        }
    }

    public void testRun() {
        TestGraphicsDevice localTestGraphicsDevice = new TestGraphicsDevice();
        try {
            System.out.println("Display mode = " + localTestGraphicsDevice.getDisplayMode());
            fail("NPE Expected!");
        } catch (NullPointerException e) {
            e.printStackTrace();
        }
    }
}
----------------------------------
Output RI:
========
.java.lang.NullPointerException
	at java.awt.GraphicsDevice.getDisplayMode(GraphicsDevice.java:271)
	at test.testRun(test.java:37)
	at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown
Source)
	at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown
Source)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at junit.textui.TestRunner.doRun(TestRunner.java:116)
	at junit.textui.TestRunner.doRun(TestRunner.java:109)
	at junit.textui.TestRunner.run(TestRunner.java:72)
	at junit.textui.TestRunner.run(TestRunner.java:57)
	at test.main(test.java:12)

Time: 0,04

OK (1 test)

Output Harmony:
=============
.Display mode = java.awt.DisplayMode@2079f204
F
Time: 0.04
There was 1 failure:
1) testRun(test)junit.framework.AssertionFailedError: NPE Expected!
	at test.testRun(test.java:36)
	at java.lang.reflect.VMReflection.invokeMethod(Native Method)
	at test.main(test.java:10)

FAILURES!!!
Tests run: 1,  Failures: 1,  Errors: 0

IMO this bug can be marked as non-bug difference, since Harmony creates DisplayMode object
with default parameters and RI throws unspecified exception. Any thoughts?

-- 
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