當(dāng)wifi功能被關(guān)閉時(shí),在Log中看到以下和wifi狀態(tài)改變有關(guān)的日志:
網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、微信小程序定制開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了呼圖壁免費(fèi)建站歡迎大家使用!11-04 11:09:34.559: E/WifiService(185): Handle MESSAGE_DISABLE_WIFI. 11-04 11:09:34.569: D/DATA(287): [DCT(0) ] intent received :android.net.wifi.WIFI_STATE_CHANGED 11-04 11:09:34.569: D/StatusBarPolicy(254): updateWifi: android.net.wifi.WIFI_STATE_CHANGED : wifi state: 0 supplicant connected: false 11-04 11:09:34.579: I/wpa_supplicant(8310): CTRL-EVENT-TERMINATING - signal 15 received 11-04 11:09:34.579: V/WifiMonitor(185): Event [CTRL-EVENT-TERMINATING - signal 15 received] 11-04 11:09:34.579: V/WifiStateTracker(185): handleMessage(): msg.what= 2
在當(dāng)前程序中沒有對wifi斷開進(jìn)行處理,所以出現(xiàn)以下異常:
11-04 11:09:35.889: E/DownThread(7389): Connection timed out 11-04 11:09:35.889: E/DownThread(7389): java.net.SocketException: Connection timed out 11-04 11:09:35.889: E/DownThread(7389): at org.apache.harmony.luni.platform.OSNetworkSystem.read(Native Method) 11-04 11:09:35.889: E/DownThread(7389): at dalvik.system.BlockGuard$WrappedNetworkSystem.read(BlockGuard.java:273) 11-04 11:09:35.889: E/DownThread(7389): at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:458) 11-04 11:09:35.889: E/DownThread(7389): at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:85) 11-04 11:09:35.889: E/DownThread(7389): at java.io.BufferedInputStream.read(BufferedInputStream.java:319) 11-04 11:09:35.889: E/DownThread(7389): at org.apache.harmony.luni.internal.net.www.protocol.http.FixedLengthInputStream.read(FixedLengthInputStream.java:44) 11-04 11:09:35.889: E/DownThread(7389): at java.io.BufferedInputStream.read(BufferedInputStream.java:319) 11-04 11:09:35.889: E/DownThread(7389): at java.io.FilterInputStream.read(FilterInputStream.java:133) 11-04 11:09:35.889: E/DownThread(7389): at com.tvie.ivideo.download.logic.DownThread.run(DownThread.java:65)
出現(xiàn)異常的代碼是InputStream的read方法。
while ((len = is.read(buffer)) != -1 && running) {
read方法的聲明表現(xiàn)會拋出IOException。
int java.io.InputStream.read(byte[] buffer) throws IOException
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。