Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4245905

java.awt.geom.Area.equals(null) throws NPE

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      kestrel
    • CPU:
      generic
    • OS:
      solaris_2.6

      Description

      Here is a simple test:

      import java.awt.geom.Area;
      import java.awt.Rectangle;

      public class Test {
          public static void main(String args[]) {
              Area area = new Area(new Rectangle(10, 10));
      if (area.equals(null)) {
      System.err.println("?!");
              }
          }
      }

      #>JAVA_COMPILER=none /usr/local/java/jdk1.3/solaris/bin/java Test
      Warning: JIT compiler "none" not found. Will use interpreter.
      Exception in thread "main" java.lang.NullPointerException
              at java.awt.geom.Area.equals(Area.java:321)
              at Test.main(Test.java:8)
      #>/usr/local/java/jdk1.3/solaris/bin/java -fullversion
      java full version "JDK-1.3-H"

      As Jim Graham has pointed out:
      "While Area.equals(Area) isn't strictly required to follow the behavior
      of Area.equals(Object), it probably should do so for a variety of reasons."

      I believe that this is bug because w/o this method which overloads
      Object.equals(Object) user would get 'false' instead of NPE and it's not very
      useful for user to always insert 'try catch' block or check for null by
      hiself while using Area.equals().

      Anyways, this is not a big deal to fix this bug.

      ###@###.### 1999-06-11 ###@###.###

        Attachments

          Activity

            People

            Assignee:
            flar Jim Graham
            Reporter:
            tdv Dmitri Trembovetski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: