-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 2.13.0
-
Component/s: Command Operations
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I'm getting a NPE from the Mongo Java driver when calling createIndex on a DBCollection in a database which has a full stop (aka period, ".") in its name. Here's the exception ...
java.lang.NullPointerException at com.mongodb.DBCollectionImpl.createIndex(DBCollectionImpl.java:399) at com.mongodb.DBCollection.createIndex(DBCollection.java:597) at com.mongodb.DBCollection.createIndex(DBCollection.java:585)
Here's a reproduction test case:
@Test(expected = NullPointerException.class)
public void reproduceIssueWithNamesContainingAFullStop() {
String databaseName = "dbname-v1.1";
String collectionName = "whatever";
DB db = mongo.getDB(databaseName);
DBCollection dbCollection = db.getCollection(collectionName);
DBObject indexKeys = new BasicDBObject("aField", 1);
DBObject indexOptions = new BasicDBObject("unique", true);
dbCollection.createIndex(indexKeys);
Assert.fail("Expected Mongo Java driver to throw a NPE here ...");
}
- is duplicated by
-
JAVA-2396 NullPointerException when dropping a collection
-
- Closed
-
- is related to
-
DRIVERS-2092 Drivers Spec : Specify object, collection, and database name validation rules
-
- Closed
-
- related to
-
SERVER-26431 Validate the collection name for commands that read documents from a collection
-
- Closed
-