Skip to content

Commit 79a8b3e

Browse files
committed
JAVA-1165: Backing this change out, after deciding it's too risky to close the cursor before it's fully consumed
1 parent ac22428 commit 79a8b3e

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/main/com/mongodb/DBCursor.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -602,12 +602,8 @@ public void remove(){
602602

603603
void _fill( int n ){
604604
_checkType( CursorType.ARRAY );
605-
try {
606-
while ( n >= _all.size() && _hasNext() )
607-
_next();
608-
} finally {
609-
this.close();
610-
}
605+
while ( n >= _all.size() && _hasNext() )
606+
_next();
611607
}
612608

613609
/**
@@ -653,16 +649,12 @@ public List<DBObject> toArray( int max ) {
653649
* @throws MongoException
654650
*/
655651
public int itcount(){
656-
try {
657-
int n = 0;
658-
while ( this.hasNext() ){
659-
this.next();
660-
n++;
661-
}
662-
return n;
663-
} finally {
664-
this.close();
652+
int n = 0;
653+
while ( this.hasNext() ){
654+
this.next();
655+
n++;
665656
}
657+
return n;
666658
}
667659

668660
/**

0 commit comments

Comments
 (0)