Copilot commented on code in PR #18026:
URL: https://github.com/apache/iotdb/pull/18026#discussion_r3473421874


##########
iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/BaseRpcTransportFactory.java:
##########
@@ -120,11 +114,9 @@ public TTransport getTransport(
       throws TTransportException {
     TSSLTransportFactory.TSSLTransportParameters params =
         RpcSslUtils.createTSSLTransportParameters(sslProtocol);
-    if (Files.exists(Paths.get(trustStore)) && 
Files.exists(Paths.get(keyStore))) {
-      RpcSslUtils.setTrustStore(params, trustStore, trustStorePwd);
+    RpcSslUtils.setTrustStore(params, trustStore, trustStorePwd);
+    if (hasText(keyStore)) {
       RpcSslUtils.setKeyStore(params, keyStore, keyStorePwd);
-    } else {
-      throw new TTransportException(new 
IOException(RpcMessages.COULD_NOT_LOAD_KEYSTORE));
     }

Review Comment:
   `getTransport(..., trustStore, ...)` unconditionally calls 
`RpcSslUtils.setTrustStore(params, trustStore, ...)`. 
`RpcSslUtils.setTrustStore` does not handle null/blank paths (it ultimately 
does `Path.of(storePath)`), so configurations that rely on the JVM default 
trust store (no custom truststore) will fail (and mTLS clients that only set a 
keyStore but no trustStore will also fail). Guard the truststore setup with a 
non-blank check (similar to `keyStore`) and only set it when provided.



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