Skip to content

Commit bf758bc

Browse files
author
YangSen-qn
committed
upload manager complete func add sync logic
1 parent 097df4d commit bf758bc

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

library/src/androidTest/java/com/qiniu/android/DnsCacheFileTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class DnsCacheFileTest extends BaseTest {
1010

1111
public void testCreate(){
1212
try {
13-
DnsCacheFile file = new DnsCacheFile("");
13+
DnsCacheFile file = new DnsCacheFile(null);
1414
if (file != null){
1515
assertTrue(false);
1616
}

library/src/main/java/com/qiniu/android/http/dns/DnsCacheFile.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ public class DnsCacheFile implements Recorder {
1616
public File f;
1717

1818
public DnsCacheFile(String directory) throws IOException {
19+
if (directory == null) {
20+
throw new IOException("directory invalid");
21+
}
22+
1923
this.directory = directory;
2024
f = new File(directory);
2125
if (!f.isDirectory()) {

library/src/main/java/com/qiniu/android/storage/UploadManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,15 @@ private void completeAction(final String token,
333333

334334
reportQuality(responseInfo, taskMetrics, token);
335335
if (completionHandler != null){
336+
final Wait wait = new Wait();
336337
AsyncRun.runInMain(new Runnable() {
337338
@Override
338339
public void run() {
339340
completionHandler.complete(key, responseInfo, response);
341+
wait.stopWait();
340342
}
341343
});
344+
wait.startWait();
342345
}
343346
}
344347

0 commit comments

Comments
 (0)