Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
-
Linux Ubuntu 11.04, mongod 2.0.5
Description
When iterating over a DBCursor using standard hasNext()/next() logic, hasNext() can raise a NullPointerException when the underlying server-side cursor has been closed. This happens in my code because I wrap the DBCursor in another Iterator that provides "batching": Iterates over the DBCursor generating a list of objects instead of a single object.
I has been able to trace the issue to the following code fragments in DBApiLayer:
public boolean hasNext(){
|
boolean hasNext = _cur.hasNext();
|
while ( !hasNext ) {
|
....
|
}
|
return hasNext;
|
}
|
...
|
void close(){
|
if (_curResult != null) {
|
killCursor();
|
_curResult = null;
|
_cur = null;
|
}
|
}
|
Please the documentation tells the hasNext() method can throw a MongoException and there are some issues that deal with this API issue.
Attachments
Issue Links
- related to
-
JAVA-1091 Always set awaitData along with tailable
-
- Closed
-