You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/02/12 04:19:58 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #14253: Check ``getTlsTrustStorePath`` NPE when user forget to set it.

codelipenghui commented on a change in pull request #14253:
URL: https://github.com/apache/pulsar/pull/14253#discussion_r805115592



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarChannelInitializer.java
##########
@@ -72,7 +72,10 @@ public PulsarChannelInitializer(ClientConfigurationData conf, Supplier<ClientCnx
         if (tlsEnabled) {
             if (tlsEnabledWithKeyStore) {
                 AuthenticationDataProvider authData1 = conf.getAuthentication().getAuthData();
-
+                if (conf.getTlsTrustStorePath() == null) {
+                    throw new RuntimeException("Failed to create TLS context, Due to empty "

Review comment:
       I think it's better to use like "Failed to create TLS context, the tlsTrustStorePath need to be configured if useKeyStoreTls enabled" ?

##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarChannelInitializer.java
##########
@@ -72,7 +72,10 @@ public PulsarChannelInitializer(ClientConfigurationData conf, Supplier<ClientCnx
         if (tlsEnabled) {
             if (tlsEnabledWithKeyStore) {
                 AuthenticationDataProvider authData1 = conf.getAuthentication().getAuthData();
-
+                if (conf.getTlsTrustStorePath() == null) {
+                    throw new RuntimeException("Failed to create TLS context, Due to empty "

Review comment:
       We should throw PulsarClientException?

##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarChannelInitializer.java
##########
@@ -72,7 +72,10 @@ public PulsarChannelInitializer(ClientConfigurationData conf, Supplier<ClientCnx
         if (tlsEnabled) {
             if (tlsEnabledWithKeyStore) {
                 AuthenticationDataProvider authData1 = conf.getAuthentication().getAuthData();
-
+                if (conf.getTlsTrustStorePath() == null) {

Review comment:
       We should check if it is an empty String? Empty string also does not make any sense here.




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org