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 report output to truncate existing files #1951

Merged
merged 5 commits into from May 4, 2022

Conversation

sdati
Copy link
Contributor

@sdati sdati commented Feb 8, 2022

Fix issue #1950 so report files are truncated when overwritten

Make sure these boxes are checked before submitting your PR -- thank you!

  • [X ] Added an entry into CHANGELOG.md if you have changed SpotBugs code

@@ -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);
Copy link
Contributor Author

@sdati sdati Feb 8, 2022

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

ThrawnCA
ThrawnCA previously approved these changes Feb 8, 2022
Copy link
Member

@KengoTODA KengoTODA left a 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.

@sdati
Copy link
Contributor Author

sdati commented Mar 8, 2022

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.

Done. Thank you for your work on SpotBugs! It is very useful.

ThrawnCA
ThrawnCA previously approved these changes Mar 9, 2022
CHANGELOG.md Outdated Show resolved Hide resolved
KengoTODA
KengoTODA previously approved these changes Mar 10, 2022
@KengoTODA KengoTODA requested a review from ThrawnCA March 16, 2022 02:03
@KengoTODA KengoTODA requested a review from a team April 12, 2022 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants