harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vera Aristova (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-1702) javax.swing.JLayeredPane.getLayer(Component comp) does not throw NPE
Date Thu, 05 Oct 2006 07:34:20 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-1702?page=all ]

Vera Aristova updated HARMONY-1702:
-----------------------------------

    Attachment: patch1702

test

> javax.swing.JLayeredPane.getLayer(Component comp)  does not throw NPE
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-1702
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1702
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vera Aristova
>            Priority: Minor
>         Attachments: patch1702
>
>
> javax.swing.JLayeredPane.getLayer(Component comp)  does not throw unspecified NPE when
 comp is null while RI does throw NPE.
> ========test .java==============
> import junit.framework.TestCase;
> import javax.swing.JLayeredPane;
> import java.awt.event.ComponentAdapter;
> import java.awt.Component;
> public class test extends TestCase 
> {
> 	public static class TestComponentAdapter extends ComponentAdapter 
> 	{
> 	}
> 	public void testGetLayerComponent() 
> 	{
> 		JLayeredPane localJLayeredPane = new JLayeredPane();
> 		TestComponentAdapter localTestComponentAdapter = new TestComponentAdapter();
> 		localJLayeredPane.addComponentListener(localTestComponentAdapter);
> 		try 
> 		{
> 			localJLayeredPane.getLayer((Component) null);
> 			System.out.println("does not throw NPE!");
> 			assertEquals(true, false);
> 		} 
> 		catch (NullPointerException e) 
> 		{e.printStackTrace();
>          assertEquals(true, true);
> 		}			
> 	}
> }
> ============================================
> Output :
> =========== Harmony ================== 
>  Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or
its licensors, as applicable. 
> java version "1.5.0" pre-alpha : not complete or compatible 
> svn = r452710, (Oct 4 2006), Windows/ia32/msvc 1310, release build 
> http://incubator.apache.org/harmony 
> .does not throw NPE!
> F
> Time: 0.484
> There was 1 failure:
> 1) testGetLayerComponent(test)junit.framework.AssertionFailedError: expected:<true>
but was:<false>
>         at test.testGetLayerComponent(test.java:29)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>  FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> ============== SUN 1.5 ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.Hashtable.get(Hashtable.java:336)
>         at javax.swing.JLayeredPane.getLayer(JLayeredPane.java:369)
>         at test.testGetLayerComponent(test.java:28)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         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.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Time: 0.422
> OK (1 test)
>  

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