[JAVA-3630] Override Iterable.forEach in MongoIterable Created: 20/Feb/20  Updated: 28/Oct/23  Resolved: 21/Feb/20

Status: Closed
Project: Java Driver
Component/s: Query Operations
Affects Version/s: None
Fix Version/s: 4.0.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible

 Description   

In scope of JAVA-3325, the Java 8-specific implementation of the various Iterable implementations were removed, and in doing so all the overrides of forEach(Consumer<T>) were removed. But we neglected to add a single override of that method in MongoIterableImpl. It's important to do so because the overrides ensure that forEach properly closes the cursor in the face of an exception during iteration.



 Comments   
Comment by Jeffrey Yemin [ 04/Mar/20 ]

Author:

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

Message: Add override of Iterable#forEach to ensure that the cursor is always closed

JAVA-3630
Branch: 4.0.x
https://github.com/mongodb/mongo-java-driver/commit/1e9580933eb742af18ed82ef7df74eb02e6320cd

Comment by Githook User [ 21/Feb/20 ]

Author:

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

Message: Add override of Iterable#forEach to ensure that the cursor is always closed

JAVA-3630
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/684619f31c60d5250089f6fa45c0e9933a394fac

Generated at Thu Feb 08 09:00:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.