-
Notifications
You must be signed in to change notification settings - Fork 301
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
Development
: Fix unclosed input streams
#7325
Conversation
@@ -181,7 +181,7 @@ | |||
filePath = generateFilePath(filenamePrefix, fileExtension, path); | |||
} | |||
try { | |||
FileUtils.copyToFile(file.getInputStream(), filePath.toFile()); | |||
FileUtils.copyInputStreamToFile(file.getInputStream(), filePath.toFile()); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
@@ -201,7 +201,7 @@ | |||
final Path filePath = dirPath.resolve(filename); | |||
final File savedFile = filePath.toFile(); | |||
|
|||
FileUtils.copyToFile(file.getInputStream(), savedFile); | |||
FileUtils.copyInputStreamToFile(file.getInputStream(), savedFile); |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
Development
fix unclosed input streamsDevelopment
: Fix unclosed input streams
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.
Code 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.
Code 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.
LGTM
Checklist
General
Server
Motivation and Context
While reviewing #7322 I noticed that the
FileUtils
class has two methodscopyToFile()
andcopyInputStreamToFile()
. They differ in the fact that only the sencond method closes the given input stream, andcopyToFile()
leaves the straem open.Description
This PR replaces
copyToFile()
withcopyInputStreamToFile()
where applicabel, and replaces explicitclose()
calls with try-with-ressources blocks.Steps for Testing
code review
Review Progress
Performance Review
Code Review