javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException Android

时间:2015-10-09 19:24:38

标签: android ssl

我得到了" javax.net.ssl.SSLHandshakeException:java.security.cert.CertPathValidatorException:未找到证书路径的信任锚。"我的Android应用程序上的异常。 这是我的代码

int checkApp(Item item){

                int flag=1;
                 HttpClient httpclient =  DefaultClient();
                 if(item.proxy.length()>0){
                 HttpHost httpproxy = new HttpHost(item.proxy,Integer.parseInt(item.port));
                 httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, httpproxy);
                 }
                 HttpResponse response;
                 String responseString = null;
                 try {
                     String url="https://play.google.com/store/apps/details?id="+item.pakageName;
                     response = httpclient.execute(new HttpPost(url));
                     StatusLine statusLine = response.getStatusLine();
                     if(statusLine.getStatusCode() == HttpStatus.SC_OK){
                        flag=1;
                     } else{

                        flag=0;
                     }
                 } catch (ClientProtocolException e) {
                     //TODO Handle problems..
                     logger.Log(e.toString());
                     flag=0;
                 } catch (IOException e) {

                     logger.Log(e.toString());
                     flag=0;//TODO Handle problems..
                 }
                 catch(Exception e){
                     logger.Log(e.toString());
                     flag=0;
                 }
                 return flag;
            }

0 个答案:

没有答案