Skip to content
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

Fix code smells #175

Merged
merged 3 commits into from
Jul 17, 2018
Merged

Fix code smells #175

merged 3 commits into from
Jul 17, 2018

Conversation

Copy link
Contributor

@MikeGost MikeGost left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for tracking these down! Two lines can optionally be deleted with the new changes.

outputFile.getParentFile().mkdirs();
NotifyingIOUtils.copy(inputStream, bos,
new Progress(outputFile, current.getSize()));
IOUtils.closeQuietly(inputStream);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the two closeQuietly calls still needed? close() is implicitly called by the try-with-resource block.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I weighed removing them, then decided not to, to avoid changing the behavior. In this case, close quietly would close it and not return an exception if it fails closing. The question is would it fail again anyway once the implicit finally block tries to close it again...? In which case I can remove those calls.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm good point. Maybe worth testing with and without the calls.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, let me add a unit test

@MikeGost MikeGost merged commit 0f108ce into osmlab:dev Jul 17, 2018
@matthieun matthieun deleted the smells branch July 17, 2018 21:19
@matthieun matthieun added this to the 5.1.5 milestone Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants