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:09 UTC 2021


On Wed, 6 Oct 2021 16:24:03 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

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

I will revert back to `BufferedInputStream` and will create a separate PR to cleanup redundant buffering around Properties.load calls.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5818



More information about the security-dev mailing list