[JAVA-863] gridFs.remove((DBObject)null) removes all elements from bucket Created: 04/Jul/13 Updated: 27/Feb/14 Resolved: 05/Dec/13 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | GridFS |
| Affects Version/s: | 2.11.2 |
| Fix Version/s: | 2.12.0, 3.0.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Micha S. | Assignee: | Jeffrey Yemin |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
java version "1.7.0_25" |
||
| Attachments: |
|
| Description |
|
When passing null to GridFS.remove(DBObject dbobject) all files of the current bucket are removed. This is inconsistent compared to the other remove() methods of GridFS: gridFs.remove((String)null); // nothing happens If this is intended behavior it should be documented in the javadoc comment. |
| Comments |
| Comment by Jeffrey Yemin [ 27/Feb/14 ] |
|
Hi Micha, Would you mind testing with 2.12.0-rc0, available either on github or Maven Central? Thanks, |
| Comment by Jeffrey Yemin [ 05/Dec/13 ] |
|
All three remove methods in GridFS now throw IllegalArgumentException if the parameter value is null. |
| Comment by Githook User [ 05/Dec/13 ] |
|
Author: {u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}Message: |
| Comment by Githook User [ 05/Dec/13 ] |
|
Author: {u'username': u'neerajbhatt', u'name': u'neerajbhatt', u'email': u'neerajbhatt2000@gmail.com'}Message: https://jira.mongodb.org/browse/JAVA-863, fixed null checks in remove method |
| Comment by Githook User [ 05/Dec/13 ] |
|
Author: {u'username': u'neerajbhatt', u'name': u'neerajbhatt', u'email': u'neerajbhatt2000@gmail.com'}Message: https://jira.mongodb.org/browse/JAVA-863, fixed null checks in reove method |
| Comment by Neeraj Bhatt [ 05/Dec/13 ] |
|
Hi Jeff |
| Comment by Jeffrey Yemin [ 25/Nov/13 ] |
|
My preference is to change (and Javadoc, of course) all three methods to throw IllegalArgumentException if the parameter is null. This would more closely match the behavior of DBCollection.remove, which also throws if the query is null (though it throws an NPE, which we should also change). |
| Comment by Jeffrey Yemin [ 25/Nov/13 ] |
|
Hi Micha, We're going to look into doing something about this in the next release. |