You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mark Hindess (JIRA)" <ji...@apache.org> on 2007/10/17 09:50:50 UTC

[jira] Closed: (HARMONY-2517) [classlib][awt] Compatibility: java.awt.RenderingHints(Map init) constructor throws NPE on Harmony while it works silently on RI

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

Mark Hindess closed HARMONY-2517.
---------------------------------


No response.  Assuming it is okay.


> [classlib][awt] Compatibility: java.awt.RenderingHints(Map<RenderingHints.Key,?> init) constructor throws NPE on Harmony while it works silently on RI
> ------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2517
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2517
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Ilya Okomin
>            Assignee: Mark Hindess
>            Priority: Minor
>         Attachments: Harmony-2517-test.patch, Harmony-2517.patch
>
>
> If you create java.awt.RenderingHints(Map<RenderingHints.Key,?> init) from the overridden Map implementation and this object may return null on entrySet, then RenderingHints object fails in the constructor on Harmony while it works silently on RI. In case of RI no entries added to the RenderingHints map. Take a look at the test case for the details:
> -------- test.java --------
> import java.awt.RenderingHints;
> import java.util.Collection;
> import java.util.Map;
> import java.util.Set;
> import junit.framework.TestCase;
> import junit.textui.TestRunner;
> public class test extends TestCase {
>     public static void main(String args[]) {
>         TestRunner.run(test.class);
>     }
>     public void testRun() {
>         Map<RenderingHints.Key,?> localMap = new testMap();
>         RenderingHints rh = new RenderingHints(localMap);
>         assertTrue(rh.isEmpty());
>     }
> }
> class testMap implements Map<RenderingHints.Key, Object> {
>     public void clear() {
>         return;
>     }
>     public boolean containsKey(Object p0) {
>         return false;
>     }
>     public boolean containsValue(Object p0) {
>         return false;
>     }
>     public Set entrySet() {
>         return null;
>     }
>     public boolean equals(Object p0) {
>         return false;
>     }
>     public Object get(Object p0) {
>         return null;
>     }
>     public int hashCode() {
>         return 0;
>     }
>     public boolean isEmpty() {
>         return false;
>     }
>     public Set keySet() {
>         return null;
>     }
>     public Object put(RenderingHints.Key p0, Object p1) {
>         return null;
>     }
>     public void putAll(Map p0) {
>         return;
>     }
>     public Object remove(Object p0) {
>         return null;
>     }
>     public int size() {
>         return 0;
>     }
>     public Collection values() {
>         return null;
>     }
> }
> -----------------------
> ===== Output RI ======
> .
> Time: 0,03
> OK (1 test)
> ===== Output Harmony ======
> .E
> Time: 0.03
> There was 1 error:
> 1) testRun(test)java.lang.NullPointerException
> 	at java.awt.RenderingHints.putAll(RenderingHints.java:125)
> 	at java.awt.RenderingHints.<init>(RenderingHints.java:83)
> 	at test.testRun(test.java:17)
> 	at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> 	at test.main(test.java:12)
> FAILURES!!!
> Tests run: 1,  Failures: 0,  Errors: 1

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