You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mikhail Loenko (JIRA)" <ji...@apache.org> on 2006/10/20 07:05:38 UTC

[jira] Assigned: (HARMONY-1470) [classlib][awt] GradientPaint doesn't throw NPE if Color is null

     [ http://issues.apache.org/jira/browse/HARMONY-1470?page=all ]

Mikhail Loenko reassigned HARMONY-1470:
---------------------------------------

    Assignee: Mikhail Loenko

> [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
>         Assigned To: Mikhail Loenko
>         Attachments: 1470-GradientPaint.patch, 1470-GradientPaintTest.patch
>
>
> 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