-
Notifications
You must be signed in to change notification settings - Fork 507
ORC-301. extractFileTail should open a file in try statement
#218
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
extractFileTail should open a file in try statementextractFileTail should open a file in try statement
|
Hi, @omalley and @prasanthj . |
| OrcProto.PostScript ps; | ||
| OrcProto.FileTail.Builder fileTailBuilder = OrcProto.FileTail.newBuilder(); | ||
| long modificationTime; | ||
| try { |
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.
Maybe replace with try-with-resource block?
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.
Thank you for review, @prasanthj .
Ya. I thought to use try-with-resource first, but it needs more change to print out the log at Line 610.
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.
I think this is the minimal change while keeping the current behavior.
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.
Line 610 doesn't add much value as close() will throw IOException anyway which should be sufficient to know the reason.
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.
So, you mean it's okay to remove the following in this PR, right?
catch (IOException ex) {
LOG.error("Failed to close the file after another error", ex);
}
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.
Yeah that's right.
|
Thank you, @prasanthj . I updated according to your advice. |
|
lgtm, +1 |
|
Thank you so much, @prasanthj ! |
Fixes #218 Signed-off-by: Prasanth Jayachandran <prasanthj@apache.org>
|
Thank you for merging, @prasanthj ! |
This PR moves the file open position to prevent opened file leakage more robustly.