Declare proper exception type in catch block of KafkaExactlyOnceSink#initShardWriter
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 205
Description
```
} catch (Exception e) {
producer.close();
throw e;
```
initShardWriter throws IOException. The catch block shouldn't widen the exception type.
If the intention is to properly close producer, we can use try-with-resources.
Imported from Jira [BEAM-3677](https://issues.apache.org/jira/browse/BEAM-3677). Original Jira may contain additional context.
Reported by: yuzhihong@gmail.com.
Contributor guide
Research direction
Start at the KafkaExactlyOnceSink#initShardWriter entry point and inspect its IOException declaration, catch block, and producer cleanup. Confirm the exception type is preserved and verify the change by compiling and running any tests covering the Kafka sink.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kafka
- Domain
- stream-processing
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100