eventmesh
eventmesh copied to clipboard
[ISSUE #3009] Method manually handles closing an auto-closeable resource [MetricsHandler]
Fixes #3009 .
Modifications
Replaced finally block with try-with-resources.
- Used try-with-resources along with nested try-catch to manage resources, fixing out of scope variable.
- Added similar fix for issue#3007 and issue#3008 to fix compilation error due to out of scope variable in catch block.
Please include this fix to solve compilation issue occurred due to #3007 and #3008
Documentation
- Does this pull request introduce a new feature? (no)
- If yes, how is the feature documented? (not applicable)
- If a feature is not applicable for documentation, explain why? (bug fix)
- If a feature is not documented yet in this PR, please create a followup issue for adding the documentation (not applicable)
Here you may still have to use try-with-finally, using try-with-resources will be due to the scope of the variable, here in the catch there is out.write(result.getBytes()); this line of code is reported as an error. Do you have a better suggestion?
Linked to #3544, PR overlapped. @sanskar-thakur
@Pil0tXia this pr seems to be merged after the second reviewer reviews
Please resolve conflicts.
completed in #4800