java - android app上传视频,偶尔qiniu线程报异常
高洛峰
高洛峰 2017-04-18 10:30:51
0
1
483

android app上传视频,偶尔qiniu线程报异常。

上传函数如下:

public synchronized void uploadImageOrVideo(String token, String filePath,String keyName, final QiniuUploadUitlsListener listener) {
    Logger.getInstance().log("uploadImageOrVideo ");

    if (token == null) {
        if (listener != null) {
            listener.onError(-1, "token is null");
        }
        return;
    }

    mUploading = true;
    uploadManager.put(filePath, keyName, token, new UpCompletionHandler() {
        public void complete(String key, ResponseInfo info,
                JSONObject response) {
            Logger.getInstance().log("uploadImageOrVideo complete");
            mUploading = false;
            if (info != null && info.isOK()) {
                System.out.println("debug:fileRealUrl = " + response);
                if (listener != null) {
                    listener.onSucess(response.toString());
                }
            } else {
                if (listener != null && info != null) {
                    listener.onError(info.statusCode, info.error);
                }
            }
        }
    }, new UploadOptions(null, null, false, new UpProgressHandler() {
        public void progress(String key, double percent) {
            if (listener != null) {
                listener.onProgress(percent);
            }
        }
    }, null));

}

报的异常:
java.lang.NullPointerException: Attempt to get length of null array
at java.lang.String.<init>(String.java:119)
at com.qiniu.android.http.Client.onRet(Client.java:280)
at com.qiniu.android.http.Client.access$100(Client.java:33)
at com.qiniu.android.http.Client$5.onResponse(Client.java:179)
at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:177)
at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

Antworte allen(1)
伊谢尔伦

你好,被同样的问题困扰许久,你有什么进展吗

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage