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

Area.equals() returns true for 2 different polygons

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs
    • 2d
    • x86
    • windows_2000

      FULL PRODUCT VERSION :
      jdk 1.5.0_06

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      The Constructor Area(Shape s) does not create the appropriate curve objects for the source code attached below.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      see source code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Code returns false
      ACTUAL -
      Code returns true

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
              final Polygon polygon_1 = new Polygon();
              polygon_1.addPoint(1, 1);
              polygon_1.addPoint(2, 2);
              polygon_1.addPoint(3, 3);

              final Polygon polygon_2 = new Polygon();
              polygon_2.addPoint(1, 1);
              polygon_2.addPoint(4, 4);
              polygon_2.addPoint(3, 3);

              final Area area_1 = new Area(polygon_1);
              final Area area_2 = new Area(polygon_2);
              System.out.println(area_2.equals(area_1));
      ---------- END SOURCE ----------

            flar Jim Graham
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: