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.
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)
你好,被同样的问题困扰许久,你有什么进展吗