qq_爱简单_4
2017-05-26 16:01
我下载了demo 调用 CommonOkHttpClient.post(CommonRequest.createPostRequest(url,params),handler); 怎么提示是 java.lang.ExceptionInInitializerError 这个错误的 。。不能用。
请问在那里下载的 ,地址是多少?
你好.由于
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
返回null导致
因为OKhttpClient类中的sslSocketFactory()方法实现,有一个非空判断(看下面的代码第二行)
public Builder sslSocketFactory(SSLSocketFactory sslSocketFactory) {
if (sslSocketFactory == null) throw new NullPointerException("sslSocketFactory == null");
X509TrustManager trustManager = Platform.get().trustManager(sslSocketFactory);
if (trustManager == null) {
throw new IllegalStateException("Unable to extract the trust manager on " + Platform.get()
+ ", sslSocketFactory is " + sslSocketFactory.getClass());
}
this.sslSocketFactory = sslSocketFactory;
this.certificateChainCleaner = CertificateChainCleaner.get(trustManager);
return this;
}
修改方法:
在httputils类中添加
private static final X509Certificate[] AcceptedIssuers = new X509Certificate[] {};
@Override
public X509Certificate[] getAcceptedIssuers() {
return AcceptedIssuers ;
}
返回 AcceptedIssuers 问题解决
okhttp框架解析与应用
21187 学习 · 41 问题
相似问题