-
Notifications
You must be signed in to change notification settings - Fork 1.1k
clean tmp file after upload #848
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
Codecov Report
@@ Coverage Diff @@
## master #848 +/- ##
=========================================
- Coverage 71.63% 71.6% -0.04%
=========================================
Files 306 306
Lines 6643 6649 +6
Branches 500 501 +1
=========================================
+ Hits 4759 4761 +2
- Misses 1591 1595 +4
Partials 293 293
Continue to review full report at Codecov.
|
| try { | ||
| toUpload = Files.createTempFile("docker-java", ".tar.gz"); | ||
| CompressArchiveUtil.tar(Paths.get(hostResource), toUpload, true, dirChildrenOnly); | ||
| this.tarInputStream = Files.newInputStream(toUpload); |
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.
should this be wrapped with try-with-resources or it closed in somewhere else place?
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.
Fixed
75fe996 to
e1004d5
Compare
| CompressArchiveUtil.tar(Paths.get(hostResource), toUpload, true, dirChildrenOnly); | ||
| } catch (IOException createFileIOException) { | ||
| throw new DockerClientException("Unable to perform tar on host resource " + this.hostResource, createFileIOException); | ||
| } |
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.
should it have finally also here with toUpload remove?
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.
added remove in catch clause
| throw new DockerClientException("Unable to perform tar on host resource " + this.hostResource, e); | ||
| throw new DockerClientException("Unable to read temp file " + toUpload.toFile().getAbsolutePath(), e); | ||
| } finally { | ||
| toUpload.toFile().delete(); |
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.
please place comment // remove tmp dir
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.
added
989633a to
37525ee
Compare
| } | ||
| throw new DockerClientException("Unable to perform tar on host resource " + this.hostResource, createFileIOException); | ||
| } | ||
| try (InputStream uploadStream = Files.newInputStream(toUpload)) { |
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.
add new line before for better readability and squash commits (to keep contribution in GH)
KostyaSha
left a comment
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.
small change, pr build and will merge
fengxx
left a comment
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.
Thanks for review, fixed
| CompressArchiveUtil.tar(Paths.get(hostResource), toUpload, true, dirChildrenOnly); | ||
| } catch (IOException createFileIOException) { | ||
| throw new DockerClientException("Unable to perform tar on host resource " + this.hostResource, createFileIOException); | ||
| } |
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.
added remove in catch clause
| } catch (IOException e) { | ||
| throw new DockerClientException("Unable to perform tar on host resource " + this.hostResource, e); | ||
| throw new DockerClientException( | ||
| "Unable to read temp file " + toUpload.toFile().getAbsolutePath(), e); |
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.
120..140 width is allowed to use :)
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.
thanks for patience, formatted code use 140
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.
ok
| <value> | ||
| <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="9999" /> | ||
| <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="9999" /> | ||
| <option name="RIGHT_MARGIN" value="140" /> |
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.
https://github.com/docker-java/docker-java/blob/master/src/test/resources/checkstyle/checkstyle-config.xml#L91-L92
thanks. Added file only some time before, was not fully filled.
clean tmp file after upload
CopyArchiveToContainerCmdImpl kept temp file on disk, need remove it after upload
This change is