liubao68 closed pull request #749: [SCB-350] if the file not exist, make a warn log to trace it. make th… URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/749
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxTLSBuilder.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxTLSBuilder.java index 9b7fd28d1..bd6642b28 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxTLSBuilder.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxTLSBuilder.java @@ -23,6 +23,8 @@ import org.apache.servicecomb.foundation.ssl.SSLManager; import org.apache.servicecomb.foundation.ssl.SSLOption; import org.apache.servicecomb.foundation.ssl.SSLOptionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import io.vertx.core.http.ClientAuth; import io.vertx.core.http.HttpClientOptions; @@ -34,6 +36,8 @@ import io.vertx.core.net.TCPSSLOptions; public final class VertxTLSBuilder { + private static final Logger LOGGER = LoggerFactory.getLogger(VertxTLSBuilder.class); + private static final String STORE_PKCS12 = "PKCS12"; private static final String STORE_JKS = "JKS"; @@ -93,7 +97,8 @@ private static TCPSSLOptions buildTCPSSLOptions(SSLOption sslOption, SSLCustom s options.setSessionCacheEnabled(true); tcpClientOptions.setOpenSslEngineOptions(new OpenSSLEngineOptions()); } - if (isFileExists(sslCustom.getFullPath(sslOption.getKeyStore()))) { + String fullKeyStore = sslCustom.getFullPath(sslOption.getKeyStore()); + if (isFileExists(fullKeyStore)) { if (STORE_PKCS12.equalsIgnoreCase(sslOption.getKeyStoreType())) { PfxOptions keyPfxOptions = new PfxOptions(); keyPfxOptions.setPath(sslCustom.getFullPath(sslOption.getKeyStore())); @@ -107,9 +112,11 @@ private static TCPSSLOptions buildTCPSSLOptions(SSLOption sslOption, SSLCustom s } else { throw new IllegalArgumentException("invalid key store type."); } + } else { + LOGGER.warn("keyStore [" + fullKeyStore + "] file not exist, please check!"); } - - if (isFileExists(sslCustom.getFullPath(sslOption.getTrustStore()))) { + String fullTrustStore = sslCustom.getFullPath(sslOption.getTrustStore()); + if (isFileExists(fullTrustStore)) { if (STORE_PKCS12.equalsIgnoreCase(sslOption.getTrustStoreType())) { PfxOptions trustPfxOptions = new PfxOptions(); trustPfxOptions.setPath(sslCustom.getFullPath(sslOption.getTrustStore())); @@ -125,6 +132,8 @@ private static TCPSSLOptions buildTCPSSLOptions(SSLOption sslOption, SSLCustom s } else { throw new IllegalArgumentException("invalid trust store type."); } + } else { + LOGGER.warn("trustStore [" + fullTrustStore + "] file not exist, please check!"); } for (String protocol : sslOption.getProtocols().split(",")) { tcpClientOptions.addEnabledSecureTransportProtocol(protocol); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services