[ Web Proxy ]
URL:
Viewing: https://github-redirect.dependabot.com/apache/maven-resources-plugin/pull/5 [Back]  [Original]

try with resources by elharo Pull Request #5 apache/maven-resources-plugin GitHub
Skip to content

Navigation Menu

Repository navigation

More items

try with resources - #5

Merged
elharo merged 2 commits into
masterfrom
close2
Jul 17, 2020
Merged

elharo merged 2 commits into
masterfrom
close2

Conversation

@elharo [@elharo]

Copy link
Copy Markdown
Contributor
[Go]
try ( FileOutputStream outputStream = new FileOutputStream( file ) )
{
outputStream.write( data.getBytes() );
outputStream.flush();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Hide comment]

Don't think the .flush() is guaranteed by try-with-resources... but perhaps by not wrapping FOS in a BufferedOutputStream then that's not a problem?

[Go]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[Hide comment]

close also flushes

[Go]

@pzygielo [@pzygielo] pzygielo Jul 17, 2020 •
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Hide comment]

I think @roxspring is right about FOS not wrapped in BOS not being problem for flushing or not. But I'm not sure that close also flushes. There is flush called in FOS.finalize but close inherited from OutputStream is no-op (immaterial), as FOS.close doesn't seem to call flush neither.
On the other hand close of BufferedOutputStream flushes indeed.

[Go]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Hide comment]

Calling flush just before close is generally useless cause close ensures all data have been written.
That said we are speaking of a FileOutputStream where flush() is a noop so it is even safer to drop.

[Go]
elharo merged commit b974fb2 into master Jul 17, 2020
elharo deleted the close2 branch July 17, 2020 13:47
lfit-replication pushed a commit to lfit/sandbox that referenced this pull request Dec 3, 2025
m 2.6 to 3.3.1

Bumps org.apache.maven.plugins:maven-resources-plugin from 2.6 to 3.3.1.
## Release notes

Sourced from org.apache.maven.plugins:maven-resources-plugin's releases.

3.3.1

[MRESOURCES-288] - Make tests-jar reproducible (#56) @cstamas
[MRESOURCES-297] - Update to parent POM 39, reformat (#55) @cstamas
[MRESOURCES-293] - Make resources param not read-only (#54) @cstamas
[MRESOURCES-295] - Drop Plexus legacy code (#53) @cstamas
[MRESOURCES-294] - Upgrade plexus-utils to 3.5.1 (#52) @slachiewicz

 Removed

remove specific IDE m2e files (#40) @olamy

 Dependency updates

Bump apache/maven-gh-actions-shared from 2 to 3 (#46) @dependabot

 Documentation updates

doc: adds alternative variable syntax using @ delimiters to the documentation (#36) @kevin0x90

3.3.0

 Dependency updates

Bump maven-filtering from 3.2.0 to 3.3.0 (#32) @dependabot
Bump plexus-utils from 3.4.1 to 3.4.2 (#28) @dependabot
Bump commons-io from 1.4 to 2.7 in /src/it/user-filters (#18) @dependabot
[MRESOURCES-282] - Bump parent-pom from 34 to 36 (#24) @slachiewicz

 Documentation updates

(doc) Fix XML formatting (#26) @pzygielo
(doc) Fix XML formatting (#15) @pzygielo

 Maintenance

add release drafter (#29) @olamy
[MRESOURCES-277] - Update plugin (requires Maven 3.2.5+) - Java 8 (#23) @slachiewicz
[MRESOURCES-283] - Require Java 8 and upgrade deps (#22) @slachiewicz

3.2.0
What's Changed

[MRESOURCES-259] update commons-io by @elharo in apache/maven-resources-plugin#1
add .checkstyle to .gitignore by @elharo in apache/maven-resources-plugin#2
close file by @elharo in apache/maven-resources-plugin#3
[MRESOURCES-261] update to Maven 3.1 by @elharo in apache/maven-resources-plugin#4
try with resources by @elharo in apache/maven-resources-plugin#5
future proof method that is marked for incompatible change by @elharo in apache/maven-resources-plugin#6

New Contributors

... (truncated)

## Commits

978ce1e [maven-release-plugin] prepare release maven-resources-plugin-3.3.1
b7cd080 [MRESOURCES-296] Upgrade to maven-filtering 3.3.1
1c9f610 [MRESOURCES-288] Make tests-jar reproducible (#56)
1946127 [MRESOURCES-293] Rollback
f7a6f22 [MRESOURCES-297] Update to parent POM 39, reformat (#55)
22d64ca remove specific IDE m2e files (#40)
02c2d01 [MRESOURCES-293] Make resources param not read-only (#54)
6bb3e1f [MRESOURCES-295] Drop Plexus legacy code (#53)
df7e172 [MRESOURCES-294] Upgrade plexus-utils to 3.5.1
9354ecd Bump apache/maven-gh-actions-shared from 2 to 3
Additional commits viewable in compare view

![Dependabot compatibility score](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Issue-ID: CIMAN-33
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: lfit.gh2gerrit <releng+lfit-gh2gerrit@linuxfoundation.org>
Change-Id: I7ec3f0f8fb35c0771c23e8199cea48b265706f0b
GitHub-PR: #23
GitHub-Hash: d4984246f920c32a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Footer

© 2026 GitHub, Inc.

Web Proxy Viewer  |  New URL  |  Original Page