[JAVA-4575] Driver code should catch Exception instead of RuntimeException even if no checked exception is declared Created: 13/Apr/22 Updated: 07/Jul/22 Resolved: 07/Jul/22 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Error Handling |
| Affects Version/s: | None |
| Fix Version/s: | 4.7.0 |
| Type: | Improvement | Priority: | Unknown |
| Reporter: | Valentin Kavalenka | Assignee: | Maxim Katcharov |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Due to Kotlin not supporting checked exceptions, it is possible to break expectations we have in Java, and throw a checked exception from a method that does not declare throwing checked exceptions. See the discussion in https://github.com/mongodb/mongo-java-driver/pull/881 for more details. In order to work around this problem, we should do the following:
|
| Comments |
| Comment by Githook User [ 07/Jul/22 ] |
|
Author: {'name': 'Maxim Katcharov', 'email': 'maxim.katcharov@mongodb.com', 'username': 'katcharov'}Message: Replace RuntimeException in catch with Exception to support Kotlin (#971) Kotlin does not support checked exceptions, so our handlers will use Exception. All handlers are replaced, even those obviously unaffected, for the sake of a consistent noticeable pattern.
|
| Comment by Githook User [ 13/Apr/22 ] |
|
Author: {'name': 'Emanuele Sabellico', 'email': 'emasab@gmail.com', 'username': 'emasab'}Message: Abort transaction in all cases (#881) See |