尝试从 URL 读取 XML 时出现 SSLHandshakeException。错误发生在这一行: Document doc = db.parse(new InputSource(url.openStream()));
protected LinearLayout doInBackground(String... string) {
LinearLayout layout = new LinearLayout(DevicesActivity.this);
layout.setOrientation(1);
/** Create a new textview array to display the results */
TextView device[];
try {
URL url = new URL();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(url.openStream()));
doc.getDocumentElement().normalize();
日志:
05-30 15:18:21.742: I/Choreographer(12300): Skipped 59 frames! The application may be doing too much work on its main thread.
05-30 15:18:22.305: I/ActivityManager(290): Displayed com.example.wip/.DevicesActivity: +2s340ms
05-30 15:18:23.992: I/System.out(12300): XML Pasing Excpetion = javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
当我尝试查看 URL 的页面信息时,我也从 Chrome 收到了这条消息
the identity of this website has not been verified.• server's certificate is not trusted
这是网站服务器的问题吗?我可以在我这边修吗?