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-1538) [classlib][awt] Successor of CubicCurve2D throws NPE in contains() if getBounds2D() returns null
Date Fri, 22 Sep 2006 10:23:41 GMT
[classlib][awt] Successor of CubicCurve2D throws NPE in contains() if getBounds2D() returns
null 
-------------------------------------------------------------------------------------------------

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


If successor of CubicCurve2D returns null instead of bounds then Harmony throws NPE while
RI doesn't. Harmony use shape bounds getBounds2D() to implement contains() and intersects()
methods but It seems like RI doesn't use bounds for this. 

============== Test.java =================

import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.*;

public class Test {     
    static public void main(String[] args) { 
           final CubicCurve2DImpl obj = new CubicCurve2DImpl(100, 100, 200, 200, 200, 100,
100, 200);
           
           Frame f = new Frame("Test") {
               public void paint(Graphics g) {
                   ((Graphics2D)g).draw(obj);
               }
           };
           f.setSize(600, 400);
           f.show();
           
          System.out.println("obj.contains="+obj.contains(0, 0));
    }
}

class CubicCurve2DImpl extends java.awt.geom.CubicCurve2D.Double {
                public CubicCurve2DImpl(double x1, double y1, double x2, double y2, double
x3, double y3, double x4, double y4) {
                        super(x1, y1, x2, y2, x3, y3, x4, y4);
                }

                public Rectangle2D getBounds2D() {
                        return null;
                }
        }

========= RI Output =========
obj.contains=false

======== Harmony output =====
java.lang.NullPointerException
    at org.apache.harmony.awt.gl.Crossing.crossShape(Crossing.java:506)
    at java.awt.geom.CubicCurve2D.contains(CubicCurve2D.java:537)


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