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-2517) [classlib][awt] Compatibility: java.awt.RenderingHints(Map<RenderingHints.Key,?> init) constructor throws NPE on Harmony hile it works silently on RI
Date Thu, 07 Dec 2006 11:48:23 GMT
[classlib][awt] Compatibility: java.awt.RenderingHints(Map<RenderingHints.Key,?> init)
constructor throws NPE on Harmony hile it works silently on RI
-----------------------------------------------------------------------------------------------------------------------------------------------------

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


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: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message