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

Field names of items in nested arrays are not validated

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.0
    • Affects Version/s: None
    • Component/s: API
    • Labels:
      None
    • Fully Compatible

      Successor of JAVA-794.

      If array contains map/DBObject with dots in field names - they wouldn't be detected.

          @Test(expectedExceptions = IllegalArgumentException.class)
          public void testDotKeysArrayFail() {
              DBCollection collection = _db.getCollection("testdotkeysFail");
      
              DBObject obj = new BasicDBObject("x", 1)
                      .append("y", 2)
                      .append("array", new Object[]{new BasicDBObject("foo.bar", "baz")});
              collection.insert(obj);
          }
      
          @Test(expectedExceptions = IllegalArgumentException.class)
          public void testDotKeysArrayFail3() {
              DBCollection collection = _db.getCollection("testdotkeysFail");
      
              final Map<String, Object> map = new HashMap<String, Object>(1);
              map.put("foo.bar",2);
              DBObject obj = new BasicDBObject("x", 1)
                      .append("y", 2)
                      .append("array", new Object[]{map});
              collection.insert(obj);
          }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            uladzimir_mihura@epam.com Uladzimir Mihura
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: