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


##########
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:
   No, because that only sets the local - you need to set `this.certChain` etc 
to null



##########
java/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/client/utils/ClientAuthenticationUtils.java:
##########
@@ -235,6 +235,57 @@ public static InputStream getCertificateStream(final 
String keyStorePath,
     return getSingleCertificateInputStream(keyStore);
   }
 
+  /**
+   * Generates an {@link InputStream} that contains certificates for path-based
+   * TLS Root Certificates.
+   *
+   * @param tlsRootsCertificatesPath The path of the TLS Root Certificates.
+   * @return a new {code InputStream} containing the certificates.
+   * @throws GeneralSecurityException on error.
+   * @throws IOException              on error.
+   */
+  public static InputStream getTlsRootCertificatesStream(final String 
tlsRootsCertificatesPath)
+          throws GeneralSecurityException, IOException {
+    Preconditions.checkNotNull(tlsRootsCertificatesPath, "TLS Root 
certificates path cannot be null!");
+
+    return Files
+      
.newInputStream(Paths.get(Preconditions.checkNotNull(tlsRootsCertificatesPath)));

Review Comment:
   Yes, please



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