[JAVA-873] Field names of items in nested arrays are not validated Created: 15/Jul/13  Updated: 30/Jan/15  Resolved: 02/May/14

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: 3.0.0

Type: Bug Priority: Major - P3
Reporter: Uladzimir Mihura Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible

 Description   

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



 Comments   
Comment by Githook User [ 30/Jan/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-873: Added test to prove this bug no longer exists
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/b5309d6599441fc27f64f28dbc7bcb0d5a3278d4

Comment by Githook User [ 02/May/14 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-873: Added test to prove this bug no longer exists
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/b5309d6599441fc27f64f28dbc7bcb0d5a3278d4

Generated at Thu Feb 08 08:53:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.