java3d
  1. java3d
  2. JAVA3D-595

Defective hashCode and equals in GeometryInfo$IndexRow

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.5.2
    • Fix Version/s: not determined
    • Component/s: j3d-core-utils
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      595

      Description

      The current implementation of hashCode in the inner class IndexRow in
      com.sun.j3d.utils.geometry.GeometryInfo returns 0 for all objects. I suggest
      replacing it with this implementation:

      public int hashCode()
      {
      // was: int bits = 0;
      int bits = 7;
      for (int i = 0 ; i < size ; i++)

      { // was: bits ^= (bits * HASHCONST) << 2; bits = (31*bits) ^ val[i]; }

      return bits;
      } // End of IndexRow.hashCode

      Also, the equals method of this class may return true for instances that have
      different length attributes. A check for differing lengths should be added.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            java3d-issues
            Reporter:
            jsalonen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: