Skip to content

Commit 40aec21

Browse files
committed
[JAVA-281]: still need to ignore error due to ns not existing
1 parent 4a25597 commit 40aec21

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/main/com/mongodb/DBApiLayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ public void doapply( DBObject o ){
181181

182182
@Override
183183
public void drop() throws MongoException {
184-
super.drop();
185184
_collections.remove(getName());
185+
super.drop();
186186
}
187187

188188
public WriteResult insert(DBObject[] arr, com.mongodb.WriteConcern concern )

src/main/com/mongodb/DBCollection.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,11 @@ public void dropIndexes( String name )
674674
.add( "index" , name )
675675
.get();
676676

677+
resetIndexCache();
677678
CommandResult res = _db.command( cmd );
679+
if (res.ok() || res.getErrorMessage().equals( "ns not found" ))
680+
return;
678681
res.throwOnError();
679-
resetIndexCache();
680682
}
681683

682684
/**
@@ -685,9 +687,11 @@ public void dropIndexes( String name )
685687
*/
686688
public void drop()
687689
throws MongoException {
690+
resetIndexCache();
688691
CommandResult res =_db.command( BasicDBObjectBuilder.start().add( "drop" , getName() ).get() );
692+
if (res.ok() || res.getErrorMessage().equals( "ns not found" ))
693+
return;
689694
res.throwOnError();
690-
resetIndexCache();
691695
}
692696

693697
/**

testng.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
<test name="main tests">
66
<classes>
7-
<class name="com.mongodb.util.StringRangeSetTest"/>
87
<class name="com.mongodb.util.SimplePoolTest"/>
98
<class name="com.mongodb.util.JSONTest"/>
109

@@ -14,6 +13,7 @@
1413
<class name="org.bson.BSONTest" />
1514

1615
<class name="org.bson.util.ClassMapTest"/>
16+
<class name="org.bson.util.StringRangeSetTest"/>
1717

1818
<class name="com.mongodb.ByteTest" />
1919
<class name="com.mongodb.BasicDBObjectTest" />

0 commit comments

Comments
 (0)