RFR: 8274809: Update java.base classes to use try-with-resources [v4]
Daniel Fuchs
dfuchs at openjdk.java.net
Tue Dec 7 11:48:17 UTC 2021
On Wed, 6 Oct 2021 20:37:29 GMT, Andrey Turbanov <duke at openjdk.java.net> wrote:
>> 8274809: Update java.base classes to use try-with-resources
>
> Andrey Turbanov has updated the pull request incrementally with one additional commit since the last revision:
>
> 8274809: Update java.base classes to use try-with-resources
> fix review comments
The rest looks OK.
src/java.base/share/classes/sun/net/www/MimeTable.java line 385:
> 383:
> 384: protected boolean saveAsProperties(File file) {
> 385: try (FileOutputStream os = new FileOutputStream(file)) {
This is not strictly equivalent as now an exception thrown during `close()` will be printed instead of being ignored. I have no idea whether it's a good thing or a bad thing, but that's a _different_ thing...
So unless someone with more historical knowledge of this area can comment, maybe this change should be reverted.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5818
More information about the security-dev
mailing list