prmoore77 commented on code in PR #38461:
URL: https://github.com/apache/arrow/pull/38461#discussion_r1382152594


##########
java/flight/flight-core/src/main/java/org/apache/arrow/flight/FlightServer.java:
##########
@@ -306,28 +329,63 @@ public Builder maxInboundMessageSize(int maxMessageSize) {
       return this;
     }
 
+    /**
+     * A small utility function to ensure that InputStream attributes.
+     * are closed if they are not null
+     * @param stream The InputStream to close (if it is not null).
+     */
+    private void closeInputStreamIfNotNull(InputStream stream) throws 
IOException {
+      if (stream != null) {
+        stream.close();
+      }
+    }
+
     /**
      * Enable TLS on the server.
      * @param certChain The certificate chain to use.
      * @param key The private key to use.
      */
     public Builder useTls(final File certChain, final File key) throws 
IOException {
+      closeInputStreamIfNotNull(this.certChain);
+      closeInputStreamIfNotNull(this.key);

Review Comment:
   I believe I've addressed these suggestions with updates to the code.  Please 
confirm.  Thanks.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to