From 5330e2d88456312eef67f182900545382b038a05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=9A=AE?= <14840170+lao-pi123@user.noreply.gitee.com> Date: Mon, 4 Nov 2024 14:46:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=83=E7=89=9B=E4=BA=91=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E9=97=AA=E9=80=80=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=BD=91=E7=BB=9C=E9=85=8D=E7=BD=AE?= =?UTF-8?q?Http=E5=8F=AF=E4=BB=A5=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 1 + .../main/res/xml/network_security_config.xml | 6 ++++++ .../com/yunbao/common/upload/UploadQnImpl.java | 17 ++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/xml/network_security_config.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index af220bba6..0ac8be711 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -104,6 +104,7 @@ + + + upload-z0.qiniup.com + + \ No newline at end of file diff --git a/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java b/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java index af19dc222..0f4f31185 100644 --- a/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java +++ b/common/src/main/java/com/yunbao/common/upload/UploadQnImpl.java @@ -54,14 +54,29 @@ public class UploadQnImpl implements UploadStrategy { public void complete(String key, ResponseInfo info, JSONObject response) { System.out.println("UploadQnImpl 上传-----ok----> " + info.isOK() + "--key---> " + "---response---> " + (response != null ? response.toString() : null)); //L.e("UploadQnImpl 上传-----ok----> " + info.isOK() + "--key---> " + "---response---> " + (response != null ? response.toString() : null)); - try { + /* try { assert response != null; mList.get(mIndex).setRemoteAccessUrl(response.getString("key")); } catch (JSONException e) { // throw new RuntimeException(e); L.e(e); return; + }*/ + + if (response == null) { + // Handle the null case, e.g., log an error, throw a specific exception, etc. + L.e("Response is null"); + return; } + try { + mList.get(mIndex).setRemoteAccessUrl(response.getString("key")); + } catch (JSONException e) { + L.e(e); + return; + } + + + if (mList == null || mList.size() == 0) { if (mUploadCallback != null) { mUploadCallback.onFinish(mList, false);