今天调试网络请求部分时,当getInputStream失败时直接抛出异常。解决方法时在getInputStream之前获取ResponseCode

if( connection.getResponseCode() != HttpURLConnection.HTTP_OK) return null;

  

04-30 20:27