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

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      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());

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: