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 report output to truncate existing files #1951
Conversation
@@ -278,7 +278,8 @@ public boolean justPrintVersion() { | |||
if (index >= 0) { | |||
Path path = Paths.get(optionExtraPart.substring(index + 1)); | |||
try { | |||
OutputStream oStream = Files.newOutputStream(path, StandardOpenOption.CREATE, StandardOpenOption.WRITE); | |||
OutputStream oStream = Files.newOutputStream(path, StandardOpenOption.CREATE, StandardOpenOption.WRITE, | |||
StandardOpenOption.TRUNCATE_EXISTING); |
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.
Alternatively, this could have been changed to use the implicit/default behavior of newOutputStream()
by not specifying any OpenOptions:
OutputStream oStream = Files.newOutputStream(path);
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.
Changes are LGTM, thanks for your contribution!
Could you merge the latest origin/master
to your topic branch, and resolve conflict in the CHANGELOG.md
? You need to move the entry you made under the ## Unreleased
.
# Conflicts: # CHANGELOG.md
Done. Thank you for your work on SpotBugs! It is very useful. |
Fix issue #1950 so report files are truncated when overwritten
Make sure these boxes are checked before submitting your PR -- thank you!
CHANGELOG.md
if you have changed SpotBugs code