Skip to content

Commit

Permalink
coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
shzcore committed Jun 9, 2020
1 parent 7ed3f36 commit 87ed884
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions src/main/java/com/baidu/hugegraph/rest/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.glassfish.jersey.apache.connector.ApacheClientProperties.CONNECTION_MANAGER;

import java.security.KeyManagementException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Collection;
Expand Down Expand Up @@ -133,7 +134,7 @@ public X509Certificate[] getAcceptedIssuers() {
}

private Client wrapTrustConfig(String url, ClientConfig config) {
Client client = null;

SslConfigurator sslConfig = SslConfigurator.newInstance();
String trustStoreFile = config.getProperty("trustStoreFile").toString();
String trustStorePassword = config.getProperty("trustStorePassword").toString();
Expand All @@ -143,15 +144,14 @@ private Client wrapTrustConfig(String url, ClientConfig config) {
SSLContext sc = sslConfig.createSSLContext();
TrustManager[] trustAllCerts = NoCheckTrustManager();
try {
sc.init(null, trustAllCerts, new java.security.SecureRandom());
sc.init(null, trustAllCerts, new SecureRandom());
} catch (KeyManagementException e) {
throw new ClientException("Failed to init security key management", e);
}
client = ClientBuilder.newBuilder()
.hostnameVerifier(new HostNameVerifier(url))
.sslContext(sc)
.build();
return client;
return ClientBuilder.newBuilder()
.hostnameVerifier(new HostNameVerifier(url))
.sslContext(sc)
.build();
}

public RestClient(String url, ClientConfig config) {
Expand Down Expand Up @@ -371,7 +371,6 @@ public boolean verify(String hostname, SSLSession session) {
return hv.verify(hostname, session);
}
}

}

protected abstract void checkStatus(Response response,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public RestClientImpl(String url, String user, String password,
String protocol, String trustStoreFile,
String trustStorePassword, int status) {
super(url, user, password, timeout, maxTotal, maxPerRoute, protocol,
trustStoreFile, trustStorePassword);
trustStoreFile, trustStorePassword);
this.status = status;
this.headers = ImmutableMultivaluedMap.empty();
this.content = "";
Expand Down

0 comments on commit 87ed884

Please sign in to comment.