Skip to content

Commit 7dd610e

Browse files
committed
Ensure closing the change stream cursor doesn't leak any errors.
KAFKA-212
1 parent 00cfc5e commit 7dd610e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- [KAFKA-209](https://jira.mongodb.org/browse/KAFKA-209) Fixed `_id` always being projected even if not explicitly allowed or blocked.
2020
Log a warning message when there the `_id` value and the id strategy is configured not to overwrite the `_id`.
2121
- [KAFKA-210](https://jira.mongodb.org/browse/KAFKA-210) Fix inferred schema naming convention and ensure schemas can be backwards compatible.
22+
- [KAFKA-212](https://jira.mongodb.org/browse/KAFKA-212) Ensure closing the change stream cursor doesn't leak any errors.
2223

2324
## 1.4.0
2425

src/main/java/com/mongodb/kafka/connect/source/MongoSourceTask.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,11 @@ private Optional<BsonDocument> getNextDocument() {
586586
return Optional.ofNullable(next);
587587
} catch (Exception e) {
588588
if (cursor != null) {
589-
cursor.close();
589+
try {
590+
cursor.close();
591+
} catch (Exception e1) {
592+
// ignore
593+
}
590594
cursor = null;
591595
}
592596
if (isRunning.get()) {

0 commit comments

Comments
 (0)