Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
None
-
None
-
None
Description
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()
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
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?