-
Notifications
You must be signed in to change notification settings - Fork 639
[ISSUE #3009] Method manually handles closing an auto-closeable resource [MetricsHandler] #3547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/MetricsHandler.java
Outdated
Show resolved
Hide resolved
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? |
1. Used try-with-resources along with nested try-catch to manage resources, fixing out of scope variable. 2. Added similar fix for issue#3007 and issue#3008 to fix compilation error due to out of scope variable in catch block.
...mesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/HTTPClientHandler.java
Outdated
Show resolved
Hide resolved
Linked to #3544, PR overlapped. @sanskar-thakur |
Used try-with-resources along with nested try-catch to manage resources, fixing out of scope variable.
1. Removed nested try-catch and used single try-with-resources. 2. For out of scope out variable, replaced with log result.
@Pil0tXia this pr seems to be merged after the second reviewer reviews |
Please resolve conflicts. |
completed in #4800 |
Fixes #3009 .
Modifications
Replaced finally block with try-with-resources.
Please include this fix to solve compilation issue occurred due to #3007 and #3008
Documentation