RFR: 8274809: Update java.base classes to use try-with-resources

Bradford Wetmore wetmore at openjdk.java.net
Wed Oct 6 16:05:13 UTC 2021


On Tue, 5 Oct 2021 09:36:23 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:

> 8274809: Update java.base classes to use try-with-resources

Reviewed the crypto/security files.

src/java.base/share/classes/sun/security/timestamp/HttpTimestamper.java line 115:

> 113: 
> 114:         // Send the request
> 115:         try (DataOutputStream output = new DataOutputStream(connection.getOutputStream())) {

Please break this up so it doesn't have lines > 80.  e.g.

        try (DataOutputStream output =
                new DataOutputStream(connection.getOutputStream())) {

This makes side-by-side viewing very hard without a wider monitor.  

Thank you.

src/java.base/share/classes/sun/security/timestamp/HttpTimestamper.java line 127:

> 125:         // Receive the reply
> 126:         byte[] replyBuffer = null;
> 127:         try (BufferedInputStream input = new BufferedInputStream(connection.getInputStream())) {

Same comment as above.

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

Marked as reviewed by wetmore (Reviewer).

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


More information about the net-dev mailing list