处理下载网络异常导致的奔溃问题,和奔溃后进入助手下载状态显示错误问题
This commit is contained in:
@ -204,7 +204,7 @@ public class FileUtils {
|
||||
}
|
||||
|
||||
// 上传文件
|
||||
public static String uploadFile(String url, String filePath, String token) {
|
||||
public static JSONObject uploadFile(String url, String filePath, String token) {
|
||||
String end = "\r\n";
|
||||
String twoHyphens = "--";
|
||||
String boundary = UUID.randomUUID().toString().replaceAll("-", "")
|
||||
@ -280,10 +280,15 @@ public class FileUtils {
|
||||
// 显示网页响应内容
|
||||
Utils.log("content = " + b.toString().trim());
|
||||
|
||||
// {"icon":"http:\/\/api.ghzhushou.com\/temp\/5688e548d7859e6f278b4567.jpg"}
|
||||
// {"icon":"http:\/\/gh-test-1.oss-cn-qingdao.aliyuncs.com\/pic\/57e4f4d58a3200042d29492f.jpg"}
|
||||
if (connection.getResponseCode() == HttpStatus.SC_OK) {
|
||||
JSONObject response = new JSONObject(b.toString().trim());
|
||||
return response.getString("icon");
|
||||
response.put("statusCode", HttpStatus.SC_OK);
|
||||
return response;
|
||||
} else if (connection.getResponseCode() == HttpStatus.SC_FORBIDDEN) {
|
||||
JSONObject response = new JSONObject(b.toString().trim());
|
||||
response.put("statusCode", HttpStatus.SC_FORBIDDEN);
|
||||
return response;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 显示异常信息
|
||||
|
||||
Reference in New Issue
Block a user