Permalink
Browse files

JAVA-772: If cursor is not found by the server, report in the excepti…

…on the cursor that was requested
  • Loading branch information...
1 parent d647ccd commit 5391df18a8468089fe51fce6cd209c3e7fd5b6c9 @jyemin jyemin committed Feb 27, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/main/com/mongodb/DBApiLayer.java
@@ -362,16 +362,16 @@ public void createIndex( final DBObject keys, final DBObject options, DBEncoder
}
private void init( Response res ){
+ if ( ( res._flags & Bytes.RESULTFLAG_CURSORNOTFOUND ) > 0 ){
+ throw new MongoException.CursorNotFound(_curResult.cursor(), res.serverUsed());
+ }
+
_totalBytes += res._len;
_curResult = res;
_cur = res.iterator();
_sizes.add( res.size() );
_numFetched += res.size();
- if ( ( res._flags & Bytes.RESULTFLAG_CURSORNOTFOUND ) > 0 ){
- throw new MongoException.CursorNotFound(res._cursor, res.serverUsed());
- }
-
if (res._cursor != 0 && _limit > 0 && _limit - _numFetched <= 0) {
// fetched all docs within limit, close cursor server-side
killCursor();

0 comments on commit 5391df1

Please sign in to comment.