[JAVA-1846] OperationIterable.forEach/first should close the MongoCursor in a finally block Created: 28/May/15  Updated: 16/Jul/15  Resolved: 29/May/15

Status: Closed
Project: Java Driver
Component/s: Query Operations
Affects Version/s: 3.0.0, 3.0.2
Fix Version/s: 3.0.3, 3.1.0

Type: Bug Priority: Minor - P4
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

OperationIterable.forEach and OperationIterable.first could leave the cursor open in the face of an exception thrown from Block.apply. It should ensure that the cursor is closed in a finally block



 Comments   
Comment by Jeffrey Yemin [ 16/Jul/15 ]

Fix is now available in the 3.0.3 release.

Comment by Githook User [ 29/May/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: Closing MongoCursor in a finally block in OperationIterable.first and OperationIterable.forEach, to protect against exceptions.

JAVA-1846
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/ca1f3353cb9a76d697e5c9c586ca43b07744a01f

Comment by Githook User [ 29/May/15 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: Closing MongoCursor in a finally block in OperationIterable.first and OperationIterable.forEach, to protect against exceptions.

JAVA-1846
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/521462101cb7163a2eaae0bfa28af9a352a58841

Comment by Jeffrey Yemin [ 28/May/15 ]

https://github.com/jyemin/mongo-java-driver/pull/25

Noticed this while looking at http://stackoverflow.com/questions/30424894/java-syntax-with-mongodb.

Generated at Thu Feb 08 08:55:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.