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/01/13 13:04:27 UTC

[jira] Resolved: (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 resolved HARMONY-2517.
-----------------------------------

    Resolution: Fixed
      Assignee: Mark Hindess

Applied in r495876.  Please confirm that they have been applied as expected.

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