PakhomovAlexander commented on code in PR #1759: URL: https://github.com/apache/ignite-3/pull/1759#discussion_r1132433922
########## modules/cli/src/main/java/org/apache/ignite/internal/cli/core/exception/handler/SslExceptionHandler.java: ########## @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.cli.core.exception.handler; + +import javax.net.ssl.SSLException; +import org.apache.ignite.internal.cli.core.exception.ExceptionHandler; +import org.apache.ignite.internal.cli.core.exception.ExceptionWriter; + +public class SslExceptionHandler implements ExceptionHandler<SSLException> { + @Override + public int handle(ExceptionWriter err, SSLException e) { + err.write("Could not connect to Ignite server. Check SSL configuration."); Review Comment: Could you please use the same API that other ExceptionHandlers use? MessageUiCompontes and others. Also, here the details of what is wrong might be useful. ########## modules/cli/src/main/java/org/apache/ignite/internal/cli/core/rest/ApiClientBuilder.java: ########## @@ -0,0 +1,138 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.cli.core.rest; + +import static org.apache.ignite.internal.util.StringUtils.nullOrBlank; + +import java.io.File; +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import javax.net.ssl.KeyManager; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.X509TrustManager; +import okhttp3.OkHttpClient; +import okhttp3.OkHttpClient.Builder; +import okhttp3.internal.tls.OkHostnameVerifier; +import org.apache.ignite.rest.client.invoker.ApiClient; +import org.jetbrains.annotations.NotNull; + +class ApiClientBuilder { + private String basePath; + private String keyStorePath; + private String keyStorePassword; + private String trustStorePath; + private String trustStorePassword; + + static ApiClientBuilder create() { + return new ApiClientBuilder(); + } + + ApiClientBuilder setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + ApiClientBuilder setKeyStorePath(String keyStorePath) { + this.keyStorePath = keyStorePath; + return this; + } + + ApiClientBuilder setKeyStorePassword(String keyStorePassword) { + this.keyStorePassword = keyStorePassword; + return this; + } + + ApiClientBuilder setTrustStorePath(String trustStorePath) { + this.trustStorePath = trustStorePath; + return this; + } + + ApiClientBuilder setTrustStorePassword(String trustStorePassword) { Review Comment: Could you get rid of `set` prefix? -- 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]
