Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1090

For embedded $regex, BasicBSONObject hashCode() output is not consistent with equals()

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      See https://jira.mongodb.org/browse/JAVA-1078?focusedCommentId=485029&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-485029

      Revised test case:

              SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
              BasicBSONObject a = new BasicBSONObject("ts", sdf.parse("2014-01-03T13:16:03.359Z"));
              BasicBSONObject b = new BasicBSONObject("ts", sdf.parse("2014-01-03T13:16:03.359Z"));
              assertTrue(a.equals(b));
              assertTrue(a.hashCode() == b.hashCode());
      
              a = new BasicBSONObject("firstName", Pattern.compile("^asdf"));
              b = new BasicBSONObject("firstName", Pattern.compile("^asdf"));
              assertTrue(a.equals(b));
              assertTrue(a.hashCode() == b.hashCode());
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            stephen.lee Stephen Lee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: