RFR: 8274809: Update java.base classes to use try-with-resources
Andrey Turbanov
github.com+741251+turbanoff at openjdk.java.net
Wed Oct 6 16:29:08 UTC 2021
On Wed, 6 Oct 2021 16:04:54 GMT, Bradford Wetmore <wetmore at openjdk.org> wrote:
>> 8274809: Update java.base classes to use try-with-resources
>
> src/java.base/share/classes/sun/net/NetProperties.java line 71:
>
>> 69: f = new File(f, "net.properties");
>> 70: fname = f.getCanonicalPath();
>> 71: try (FileInputStream fis = new FileInputStream(fname)) {
>
> Why did the BufferedInputStream get pulled out here?
I decieded to remove it because `Properties.load` already buffers inputstream. So usage of BufferedInputStream seems redundant.
https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/Properties.java#L471
-------------
PR: https://git.openjdk.java.net/jdk/pull/5818
More information about the security-dev
mailing list