-3
try {
URL _url = new URL(url);
HttpURLConnection conn = (HttpURLConnection) _url.openConnection();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = rd.readLine()) != null) {
teste = teste + line;
}
rd.close();
} catch (Exception e) {
System.out.println("Exception===" + e);
return null;
}
return teste;
,我發現了以下異常:
Exception StackTrace:
java.net.UnknownHostException: api
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:225)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:377)
at java.net.Socket.connect(Socket.java:539)
at java.net.Socket.connect(Socket.java:488)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:424)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:538)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:221)
at sun.net.www.http.HttpClient.New(HttpClient.java:304)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:999)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:935)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:853)
at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2168)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1402)
請刪除此圖片併發布您的真實密碼。 –
順便說一下,錯誤信息非常明確。你是否至少讀過**? –
*>'返回teste' * – 2rs2ts