KYLIN-1654: Upgrade http client library to 4.5 Signed-off-by: Li Yang <liy...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/1397bbb5 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/1397bbb5 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/1397bbb5 Branch: refs/heads/1.5.x-HBase1.x Commit: 1397bbb5d51f06a53f88fc9621bb688229bfba26 Parents: ff1aec3 Author: Yiming Liu <liuyiming....@gmail.com> Authored: Tue Jul 5 11:25:13 2016 +0800 Committer: Li Yang <liy...@apache.org> Committed: Tue Jul 5 16:59:06 2016 +0800 ---------------------------------------------------------------------- core-common/pom.xml | 4 +- .../kylin/common/restclient/RestClient.java | 57 +++---- jdbc/pom.xml | 4 +- .../java/org/apache/kylin/jdbc/KylinClient.java | 94 +++++++----- .../util/DefaultSslProtocolSocketFactory.java | 148 ------------------- .../jdbc/util/DefaultX509TrustManager.java | 114 -------------- pom.xml | 17 +-- 7 files changed, 97 insertions(+), 341 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/1397bbb5/core-common/pom.xml ---------------------------------------------------------------------- diff --git a/core-common/pom.xml b/core-common/pom.xml index 80d2b4b..5d5369f 100644 --- a/core-common/pom.xml +++ b/core-common/pom.xml @@ -65,8 +65,8 @@ <artifactId>commons-email</artifactId> </dependency> <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> http://git-wip-us.apache.org/repos/asf/kylin/blob/1397bbb5/core-common/src/main/java/org/apache/kylin/common/restclient/RestClient.java ---------------------------------------------------------------------- diff --git a/core-common/src/main/java/org/apache/kylin/common/restclient/RestClient.java b/core-common/src/main/java/org/apache/kylin/common/restclient/RestClient.java index 069a142..050d911 100644 --- a/core-common/src/main/java/org/apache/kylin/common/restclient/RestClient.java +++ b/core-common/src/main/java/org/apache/kylin/common/restclient/RestClient.java @@ -23,15 +23,16 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.httpclient.Credentials; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpMethod; -import org.apache.commons.httpclient.UsernamePasswordCredentials; -import org.apache.commons.httpclient.auth.AuthScope; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.PutMethod; -import org.apache.kylin.common.util.Bytes; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.CredentialsProvider; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.impl.client.BasicCredentialsProvider; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; import org.apache.kylin.common.util.JsonUtil; /** @@ -44,7 +45,7 @@ public class RestClient { protected String baseUrl; protected String userName; protected String password; - protected HttpClient client; + protected CloseableHttpClient client; protected static Pattern fullRestPattern = Pattern.compile("(?:([^:]+)[:]([^@]+)[@])?([^:]+)(?:[:](\\d+))?"); @@ -78,27 +79,28 @@ public class RestClient { this.password = password; this.baseUrl = "http://" + host + ":" + port + "/kylin/api"; - client = new HttpClient(); + client = HttpClients.createDefault(); if (userName != null && password != null) { - client.getParams().setAuthenticationPreemptive(true); - Credentials creds = new UsernamePasswordCredentials(userName, password); - client.getState().setCredentials(new AuthScope(host, port, AuthScope.ANY_REALM), creds); + CredentialsProvider provider = new BasicCredentialsProvider(); + UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(userName, password); + provider.setCredentials(AuthScope.ANY, credentials); + client = HttpClients.custom().setDefaultCredentialsProvider(provider).build(); } } public void wipeCache(String type, String action, String name) throws IOException { String url = baseUrl + "/cache/" + type + "/" + name + "/" + action; - HttpMethod request = new PutMethod(url); + HttpPut request = new HttpPut(url); try { - int code = client.executeMethod(request); - String msg = Bytes.toString(request.getResponseBody()); + CloseableHttpResponse response = client.execute(request); + String msg = EntityUtils.toString(response.getEntity()); - if (code != 200) - throw new IOException("Invalid response " + code + " with cache wipe url " + url + "\n" + msg); - - } catch (HttpException ex) { + if (response.getStatusLine().getStatusCode() != 200) + throw new IOException("Invalid response " + response.getStatusLine().getStatusCode() + " with cache wipe url " + url + "\n" + msg); + response.close(); + } catch (Exception ex) { throw new IOException(ex); } finally { request.releaseConnection(); @@ -107,18 +109,17 @@ public class RestClient { public String getKylinProperties() throws IOException { String url = baseUrl + "/admin/config"; - HttpMethod request = new GetMethod(url); + HttpGet request = new HttpGet(url); try { - int code = client.executeMethod(request); - String msg = Bytes.toString(request.getResponseBody()); + CloseableHttpResponse response = client.execute(request); + String msg = EntityUtils.toString(response.getEntity()); Map<String, String> map = JsonUtil.readValueAsMap(msg); msg = map.get("config"); - if (code != 200) - throw new IOException("Invalid response " + code + " with cache wipe url " + url + "\n" + msg); - + if (response.getStatusLine().getStatusCode() != 200) + throw new IOException("Invalid response " + response.getStatusLine().getStatusCode() + " with cache wipe url " + url + "\n" + msg); + response.close(); return msg; - } finally { request.releaseConnection(); } http://git-wip-us.apache.org/repos/asf/kylin/blob/1397bbb5/jdbc/pom.xml ---------------------------------------------------------------------- diff --git a/jdbc/pom.xml b/jdbc/pom.xml index 8a0d02c..3977d85 100644 --- a/jdbc/pom.xml +++ b/jdbc/pom.xml @@ -51,8 +51,8 @@ </exclusions> </dependency> <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> </dependency> <dependency> <groupId>log4j</groupId> http://git-wip-us.apache.org/repos/asf/kylin/blob/1397bbb5/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java ---------------------------------------------------------------------- diff --git a/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java b/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java index b7eee34..10c01ef 100644 --- a/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java +++ b/jdbc/src/main/java/org/apache/kylin/jdbc/KylinClient.java @@ -20,6 +20,7 @@ package org.apache.kylin.jdbc; import java.io.IOException; import java.math.BigDecimal; +import java.security.cert.X509Certificate; import java.sql.Date; import java.sql.Time; import java.sql.Timestamp; @@ -30,19 +31,26 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import javax.net.ssl.SSLContext; import javax.xml.bind.DatatypeConverter; import org.apache.calcite.avatica.AvaticaParameter; import org.apache.calcite.avatica.ColumnMetaData; import org.apache.calcite.avatica.ColumnMetaData.Rep; import org.apache.calcite.avatica.ColumnMetaData.ScalarType; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpMethodBase; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.StringRequestEntity; -import org.apache.commons.httpclient.protocol.Protocol; -import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.conn.ssl.DefaultHostnameVerifier; +import org.apache.http.conn.ssl.TrustStrategy; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.ssl.SSLContexts; +import org.apache.http.util.EntityUtils; import org.apache.kylin.jdbc.KylinMeta.KMetaCatalog; import org.apache.kylin.jdbc.KylinMeta.KMetaColumn; import org.apache.kylin.jdbc.KylinMeta.KMetaProject; @@ -54,7 +62,6 @@ import org.apache.kylin.jdbc.json.SQLResponseStub; import org.apache.kylin.jdbc.json.StatementParameter; import org.apache.kylin.jdbc.json.TableMetaStub; import org.apache.kylin.jdbc.json.TableMetaStub.ColumnMetaStub; -import org.apache.kylin.jdbc.util.DefaultSslProtocolSocketFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,18 +74,28 @@ public class KylinClient implements IRemoteClient { private final KylinConnection conn; private final Properties connProps; - private final HttpClient httpClient; + private CloseableHttpClient httpClient; private final ObjectMapper jsonMapper; public KylinClient(KylinConnection conn) { this.conn = conn; this.connProps = conn.getConnectionProperties(); - this.httpClient = new HttpClient(); + this.httpClient = HttpClients.createDefault(); this.jsonMapper = new ObjectMapper(); // trust all certificates if (isSSL()) { - Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new DefaultSslProtocolSocketFactory(), 443)); + try { + TrustStrategy acceptingTrustStrategy = new TrustStrategy() { + public boolean isTrusted(X509Certificate[] certificate, String type) { + return true; + } + }; + SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); + httpClient = HttpClients.custom().setSSLHostnameVerifier(new DefaultHostnameVerifier()).setSSLContext(sslContext).build(); + } catch (Exception e) { + throw new RuntimeException("Initialize HTTPS client failed", e); + } } } @@ -193,28 +210,29 @@ public class KylinClient implements IRemoteClient { return (isSSL() ? "https://" : "http://") + conn.getBaseUrl(); } - private void addHttpHeaders(HttpMethodBase method) { - method.addRequestHeader("Accept", "application/json, text/plain, */*"); - method.addRequestHeader("Content-Type", "application/json"); + private void addHttpHeaders(HttpRequestBase method) { + method.addHeader("Accept", "application/json, text/plain, */*"); + method.addHeader("Content-Type", "application/json"); String username = connProps.getProperty("user"); String password = connProps.getProperty("password"); String basicAuth = DatatypeConverter.printBase64Binary((username + ":" + password).getBytes()); - method.addRequestHeader("Authorization", "Basic " + basicAuth); + method.addHeader("Authorization", "Basic " + basicAuth); } @Override public void connect() throws IOException { - PostMethod post = new PostMethod(baseUrl() + "/kylin/api/user/authentication"); + HttpPost post = new HttpPost(baseUrl() + "/kylin/api/user/authentication"); addHttpHeaders(post); - StringRequestEntity requestEntity = new StringRequestEntity("{}", "application/json", "UTF-8"); - post.setRequestEntity(requestEntity); + StringEntity requestEntity = new StringEntity("{}", ContentType.create("application/json", "UTF-8")); + post.setEntity(requestEntity); - httpClient.executeMethod(post); + CloseableHttpResponse response = httpClient.execute(post); - if (post.getStatusCode() != 200 && post.getStatusCode() != 201) { - throw asIOException(post); + if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { + throw asIOException(post, response); } + response.close(); } @Override @@ -222,21 +240,22 @@ public class KylinClient implements IRemoteClient { assert conn.getProject().equals(project); String url = baseUrl() + "/kylin/api/tables_and_columns?project=" + project; - GetMethod get = new GetMethod(url); + HttpGet get = new HttpGet(url); addHttpHeaders(get); - httpClient.executeMethod(get); + CloseableHttpResponse response = httpClient.execute(get); - if (get.getStatusCode() != 200 && get.getStatusCode() != 201) { - throw asIOException(get); + if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { + throw asIOException(get, response); } - List<TableMetaStub> tableMetaStubs = jsonMapper.readValue(get.getResponseBodyAsStream(), new TypeReference<List<TableMetaStub>>() { + List<TableMetaStub> tableMetaStubs = jsonMapper.readValue(response.getEntity().getContent(), new TypeReference<List<TableMetaStub>>() { }); List<KMetaTable> tables = convertMetaTables(tableMetaStubs); List<KMetaSchema> schemas = convertMetaSchemas(tables); List<KMetaCatalog> catalogs = convertMetaCatalogs(schemas); + response.close(); return new KMetaProject(project, catalogs); } @@ -341,21 +360,23 @@ public class KylinClient implements IRemoteClient { request.setSql(sql); request.setProject(project); - PostMethod post = new PostMethod(url); + HttpPost post = new HttpPost(url); addHttpHeaders(post); String postBody = jsonMapper.writeValueAsString(request); logger.debug("Post body:\n " + postBody); - StringRequestEntity requestEntity = new StringRequestEntity(postBody, "application/json", "UTF-8"); - post.setRequestEntity(requestEntity); + StringEntity requestEntity = new StringEntity(postBody, ContentType.create("application/json", "UTF-8")); + post.setEntity(requestEntity); - httpClient.executeMethod(post); + CloseableHttpResponse response = httpClient.execute(post); - if (post.getStatusCode() != 200 && post.getStatusCode() != 201) { - throw asIOException(post); + if (response.getStatusLine().getStatusCode() != 200 && response.getStatusLine().getStatusCode() != 201) { + throw asIOException(post, response); } - return jsonMapper.readValue(post.getResponseBodyAsStream(), SQLResponseStub.class); + SQLResponseStub stub = jsonMapper.readValue(response.getEntity().getContent(), SQLResponseStub.class); + response.close(); + return stub; } private List<ColumnMetaData> convertColumnMeta(SQLResponseStub queryResp) { @@ -388,11 +409,14 @@ public class KylinClient implements IRemoteClient { return (List<Object>) data; } - private IOException asIOException(HttpMethodBase method) throws IOException { - return new IOException(method + " failed, error code " + method.getStatusCode() + " and response: " + method.getResponseBodyAsString()); + private IOException asIOException(HttpRequestBase request, HttpResponse response) throws IOException { + return new IOException(request.getMethod() + " failed, error code " + response.getStatusLine().getStatusCode() + " and response: " + EntityUtils.toString(response.getEntity())); } @Override public void close() throws IOException { + if (httpClient != null) { + httpClient.close(); + } } } http://git-wip-us.apache.org/repos/asf/kylin/blob/1397bbb5/jdbc/src/main/java/org/apache/kylin/jdbc/util/DefaultSslProtocolSocketFactory.java ---------------------------------------------------------------------- diff --git a/jdbc/src/main/java/org/apache/kylin/jdbc/util/DefaultSslProtocolSocketFactory.java b/jdbc/src/main/java/org/apache/kylin/jdbc/util/DefaultSslProtocolSocketFactory.java deleted file mode 100644 index 83020b5..0000000 --- a/jdbc/src/main/java/org/apache/kylin/jdbc/util/DefaultSslProtocolSocketFactory.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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.kylin.jdbc.util; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.Socket; -import java.net.UnknownHostException; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; - -import org.apache.commons.httpclient.ConnectTimeoutException; -import org.apache.commons.httpclient.HttpClientError; -import org.apache.commons.httpclient.params.HttpConnectionParams; -import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; -import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - */ -public class DefaultSslProtocolSocketFactory implements SecureProtocolSocketFactory { - /** Log object for this class. */ - private static Logger logger = LoggerFactory.getLogger(DefaultSslProtocolSocketFactory.class); - private SSLContext sslcontext = null; - - /** - * Constructor for DefaultSslProtocolSocketFactory. - */ - public DefaultSslProtocolSocketFactory() { - super(); - } - - private static SSLContext createEasySSLContext() { - try { - SSLContext context = SSLContext.getInstance("TLS"); - context.init(null, new TrustManager[] { new DefaultX509TrustManager(null) }, null); - - return context; - } catch (Exception e) { - logger.error(e.getMessage(), e); - throw new HttpClientError(e.toString()); - } - } - - /** - * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int) - */ - public Socket createSocket(String host, int port, InetAddress clientHost, int clientPort) throws IOException, UnknownHostException { - return getSSLContext().getSocketFactory().createSocket(host, port, clientHost, clientPort); - } - - /** - * Attempts to get a new socket connection to the given host within the - * given time limit. - * - * <p> - * To circumvent the limitations of older JREs that do not support connect - * timeout a controller thread is executed. The controller thread attempts - * to create a new socket within the given limit of time. If socket - * constructor does not return until the timeout expires, the controller - * terminates and throws an {@link ConnectTimeoutException} - * </p> - * - * @param host - * the host name/IP - * @param port - * the port on the host - * @param localAddress - * the local host name/IP to bind the socket to - * @param localPort - * the port on the local machine - * @param params - * {@link HttpConnectionParams Http connection parameters} - * - * @return Socket a new socket - * - * @throws IOException - * if an I/O error occurs while creating the socket - * @throws UnknownHostException - * if the IP address of the host cannot be determined - * @throws ConnectTimeoutException - * DOCUMENT ME! - * @throws IllegalArgumentException - * DOCUMENT ME! - */ - public Socket createSocket(final String host, final int port, final InetAddress localAddress, final int localPort, final HttpConnectionParams params) throws IOException, UnknownHostException, ConnectTimeoutException { - if (params == null) { - throw new IllegalArgumentException("Parameters may not be null"); - } - - int timeout = params.getConnectionTimeout(); - - if (timeout == 0) { - return createSocket(host, port, localAddress, localPort); - } else { - // To be eventually deprecated when migrated to Java 1.4 or above - return ControllerThreadSocketFactory.createSocket(this, host, port, localAddress, localPort, timeout); - } - } - - /** - * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int) - */ - public Socket createSocket(String host, int port) throws IOException, UnknownHostException { - return getSSLContext().getSocketFactory().createSocket(host, port); - } - - /** - * @see SecureProtocolSocketFactory#createSocket(java.net.Socket,java.lang.String,int,boolean) - */ - public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, UnknownHostException { - return getSSLContext().getSocketFactory().createSocket(socket, host, port, autoClose); - } - - public boolean equals(Object obj) { - return ((obj != null) && obj.getClass().equals(DefaultX509TrustManager.class)); - } - - public int hashCode() { - return DefaultX509TrustManager.class.hashCode(); - } - - private SSLContext getSSLContext() { - if (this.sslcontext == null) { - this.sslcontext = createEasySSLContext(); - } - - return this.sslcontext; - } -} http://git-wip-us.apache.org/repos/asf/kylin/blob/1397bbb5/jdbc/src/main/java/org/apache/kylin/jdbc/util/DefaultX509TrustManager.java ---------------------------------------------------------------------- diff --git a/jdbc/src/main/java/org/apache/kylin/jdbc/util/DefaultX509TrustManager.java b/jdbc/src/main/java/org/apache/kylin/jdbc/util/DefaultX509TrustManager.java deleted file mode 100644 index 35be21b..0000000 --- a/jdbc/src/main/java/org/apache/kylin/jdbc/util/DefaultX509TrustManager.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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.kylin.jdbc.util; - -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.X509TrustManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author xduo - * - */ -public class DefaultX509TrustManager implements X509TrustManager { - - /** Log object for this class. */ - private static Logger logger = LoggerFactory.getLogger(DefaultX509TrustManager.class); - private X509TrustManager standardTrustManager = null; - - /** - * Constructor for DefaultX509TrustManager. - * - */ - public DefaultX509TrustManager(KeyStore keystore) throws NoSuchAlgorithmException, KeyStoreException { - super(); - - TrustManagerFactory factory = TrustManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - factory.init(keystore); - - TrustManager[] trustmanagers = factory.getTrustManagers(); - - if (trustmanagers.length == 0) { - throw new NoSuchAlgorithmException("SunX509 trust manager not supported"); - } - - this.standardTrustManager = (X509TrustManager) trustmanagers[0]; - } - - public X509Certificate[] getAcceptedIssuers() { - return this.standardTrustManager.getAcceptedIssuers(); - } - - public boolean isClientTrusted(X509Certificate[] certificates) { - return true; - // return this.standardTrustManager.isClientTrusted(certificates); - } - - public boolean isServerTrusted(X509Certificate[] certificates) { - if ((certificates != null) && logger.isDebugEnabled()) { - logger.debug("Server certificate chain:"); - - for (int i = 0; i < certificates.length; i++) { - if (logger.isDebugEnabled()) { - logger.debug("X509Certificate[" + i + "]=" + certificates[i]); - } - } - } - - if ((certificates != null) && (certificates.length == 1)) { - X509Certificate certificate = certificates[0]; - - try { - certificate.checkValidity(); - } catch (CertificateException e) { - logger.error(e.toString()); - - return false; - } - - return true; - } else { - return true; - // return this.standardTrustManager.isServerTrusted(certificates); - } - } - - @Override - public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { - // TODO Auto-generated method stub - - } - - @Override - public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { - // TODO Auto-generated method stub - - } - -} http://git-wip-us.apache.org/repos/asf/kylin/blob/1397bbb5/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index f446a2d..2def6d2 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,6 @@ <commons-collections.version>3.2.1</commons-collections.version> <commons-io.version>2.4</commons-io.version> <commons-daemon.version>1.0.15</commons-daemon.version> - <commons-httpclient.version>3.1</commons-httpclient.version> <commons-email.version>1.1</commons-email.version> <commons-math3.version>3.6</commons-math3.version> @@ -385,11 +384,6 @@ <version>${jackson.version}</version> </dependency> <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>${commons-httpclient.version}</version> - </dependency> - <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-email</artifactId> <version>${commons-email.version}</version> @@ -460,12 +454,11 @@ <artifactId>curator-recipes</artifactId> <version>${curator.version}</version> </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>${apache-httpclient.version}</version> - </dependency> - + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>${apache-httpclient.version}</version> + </dependency> <dependency> <groupId>org.roaringbitmap</groupId> <artifactId>RoaringBitmap</artifactId>