Skip to content

Conversation

@fengxx
Copy link
Contributor

@fengxx fengxx commented May 23, 2017

CopyArchiveToContainerCmdImpl kept temp file on disk, need remove it after upload


This change is Reviewable

@codecov-io
Copy link

codecov-io commented May 23, 2017

Codecov Report

Merging #848 into master will decrease coverage by 0.03%.
The diff coverage is 54.54%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
...va/core/command/CopyArchiveToContainerCmdImpl.java 65.3% <54.54%> (-4.47%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08ac9b6...a815be9. Read the comment docs.

try {
toUpload = Files.createTempFile("docker-java", ".tar.gz");
CompressArchiveUtil.tar(Paths.get(hostResource), toUpload, true, dirChildrenOnly);
this.tarInputStream = Files.newInputStream(toUpload);
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@fengxx fengxx force-pushed the feature/clean_tmp branch 2 times, most recently from 75fe996 to e1004d5 Compare May 23, 2017 15:13
CompressArchiveUtil.tar(Paths.get(hostResource), toUpload, true, dirChildrenOnly);
} catch (IOException createFileIOException) {
throw new DockerClientException("Unable to perform tar on host resource " + this.hostResource, createFileIOException);
}
Copy link
Member

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?

Copy link
Contributor Author

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();
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@fengxx fengxx force-pushed the feature/clean_tmp branch 2 times, most recently from 989633a to 37525ee Compare May 23, 2017 15:46
}
throw new DockerClientException("Unable to perform tar on host resource " + this.hostResource, createFileIOException);
}
try (InputStream uploadStream = Files.newInputStream(toUpload)) {
Copy link
Member

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)

Copy link
Member

@KostyaSha KostyaSha left a 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 fengxx force-pushed the feature/clean_tmp branch from 37525ee to a815be9 Compare May 24, 2017 02:20
Copy link
Contributor Author

@fengxx fengxx left a 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);
}
Copy link
Contributor Author

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);
Copy link
Member

@KostyaSha KostyaSha May 24, 2017

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 :)

Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@fengxx fengxx force-pushed the feature/clean_tmp branch from a815be9 to a9b78cc Compare May 24, 2017 09:32
<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" />
Copy link
Member

@KostyaSha KostyaSha May 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaSha KostyaSha added this to the 3.0.11 milestone May 31, 2017
@KostyaSha KostyaSha merged commit 51bd54a into docker-java:master May 31, 2017
panuse pushed a commit to TuKangTech/docker-java that referenced this pull request Aug 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants