[JAVA-955] Space in Database Name Should Be Considered Invalid Created: 25/Sep/13  Updated: 14/Feb/14  Resolved: 24/Jan/14

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

Type: Bug Priority: Minor - P4
Reporter: Stephen Lee Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-10891 Commands don't return "ok" field if t... Closed
related to JAVA-956 Assume {ok:0} in case of missing 'ok'... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
JAVA-1020 2.12: Space in Database Name Should B... Sub-task Closed Trisha Gee  
JAVA-1021 3.0: Space in Database Name Should Be... Sub-task Closed Trisha Gee  

 Description   

Per this documentation, database names should not include the space character. However, the driver will submit a database command that includes space and return a dubious response.

Reproduction code against mongos:

import com.mongodb.*;
 
public class Test {
	public static final String DBNAME = "test asdfasdf";
	
	public static void main( String[] args ) throws Exception {
		Mongo mongo = new Mongo( "localhost", 27020 );
		DB db = mongo.getDB( DBNAME );
		db.getCollection( "test").insert(new BasicDBObject("a",1));
	
		try {
		    db.requestStart();
		    db.requestEnsureConnection();
		    while (true) {
		        try {
		            mongo.dropDatabase( DBNAME );
		            break;
		        } catch (MongoException ex) {
		        	ex.printStackTrace();
		          // Do error handling, omitted for shortness here.
		        }
		    }
		} finally {
		    db.requestDone();
		}
	}
}

This will trigger a "ok should never be null" exception.



 Comments   
Comment by Jeffrey Yemin [ 24/Jan/14 ]

Subtasks both closed

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