harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Kishenko (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-1470) [classlib][awt] GradientPaint doesn't throw NPE if Color is null
Date Fri, 15 Sep 2006 08:46:22 GMT
[classlib][awt] GradientPaint doesn't throw NPE if Color is null 
-----------------------------------------------------------------

                 Key: HARMONY-1470
                 URL: http://issues.apache.org/jira/browse/HARMONY-1470
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Denis Kishenko


Harmony implementation of GradientPaint constructors doesn't throw NPE if Color parameter
is null while RI does.

========== Spec =================
Throws: 
     NullPointerException - if either one of colors or points is null

============== Test.java ===========
import java.awt.*;
import java.awt.geom.Point2D;

public class Test {

    static public void main(String[] args) { 
        try {
            System.err.println("1");
            new GradientPaint(
                    new Float(-0.0), new Float(-0.0), null, 
                    new Float(-0.0), new Float(-0.0), new Color(255), false); 
        } catch (NullPointerException e) {
            e.printStackTrace();
        }            
        try {
            System.err.println("2");
             new GradientPaint(
                     new Float(-0.0), new Float(-0.0), new Color(255), 
                     new Float(-0.0), new Float(-0.0), null, false); 
        } catch (NullPointerException e) {
            e.printStackTrace();
        }  
        try {
            System.err.println("3");
            new GradientPaint(
                    new Float(-0.0), new Float(-0.0), new Color(255), 
                    new Float(-0.0), new Float(-0.0), null); 
        } catch (NullPointerException e) {
            e.printStackTrace();
        }  
        try {
            System.err.println("4");
            new GradientPaint(
                    new Float(-0.0), new Float(-0.0), null, 
                    new Float(-0.0), new Float(-0.0), new Color(255)); 
        } catch (NullPointerException e) {
            e.printStackTrace();
        }
        try {
            System.err.println("5");
            new GradientPaint(
                    new Point2D.Float(), new Color(255), 
                    new Point2D.Float(), null); 
        } catch (NullPointerException e) {
            e.printStackTrace();
        }  
        try {
            System.err.println("6");
            new GradientPaint(
                    new Point2D.Float(), null, 
                    new Point2D.Float(), new Color(255)); 
        } catch (NullPointerException e) {
            e.printStackTrace();
        }  
    }       

}

=========== RI output ===============
1
java.lang.NullPointerException: Colors cannot be null
    at java.awt.GradientPaint.<init>(GradientPaint.java:71)
    at java.awt.GradientPaint.<init>(GradientPaint.java:131)
    at Test.main(Test.java:9)
2
java.lang.NullPointerException: Colors cannot be null
    at java.awt.GradientPaint.<init>(GradientPaint.java:71)
    at java.awt.GradientPaint.<init>(GradientPaint.java:131)
    at Test.main(Test.java:17)
3
java.lang.NullPointerException: Colors cannot be null
    at java.awt.GradientPaint.<init>(GradientPaint.java:71)
    at Test.main(Test.java:25)
4
java.lang.NullPointerException: Colors cannot be null
    at java.awt.GradientPaint.<init>(GradientPaint.java:71)
    at Test.main(Test.java:33)
5
java.lang.NullPointerException: Colors and points should be non-null
    at java.awt.GradientPaint.<init>(GradientPaint.java:97)
    at Test.main(Test.java:41)
6
java.lang.NullPointerException: Colors and points should be non-null
    at java.awt.GradientPaint.<init>(GradientPaint.java:97)
    at Test.main(Test.java:49)

========== Harmony output ===============
1
2
3
4
5
6


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