Skip to content

Commit 62456f4

Browse files
committed
merge
1 parent 4494a37 commit 62456f4

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

src/main/java/com/qiniu/storage/ResumeUploader.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ public final class ResumeUploader {
6868
}
6969

7070
public Response upload() throws QiniuException {
71+
try {
72+
return upload0();
73+
} finally {
74+
close();
75+
}
76+
}
77+
78+
private Response upload0() throws QiniuException {
7179
if (host == null) {
7280
this.host = configuration.upHost(upToken);
7381
}

src/main/java/com/qiniu/storage/StreamUploader.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ public final class StreamUploader {
4646
}
4747

4848
public Response upload() throws QiniuException {
49+
try {
50+
return upload0();
51+
} finally {
52+
close();
53+
}
54+
}
55+
56+
private Response upload0() throws QiniuException {
4957
if (host == null) {
5058
this.host = configuration.upHost(upToken);
5159
}

src/test/java/com/qiniu/storage/ResumeUploadTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void testXVar() throws IOException {
4040
StringMap m = res.jsonToMap();
4141
assertEquals("foo_val", m.get("foo"));
4242
} catch (QiniuException e) {
43-
assertEquals("", e.response.bodyString());
43+
assertEquals("", e.response == null ? "e.response is null" : e.response.bodyString());
4444
fail();
4545
} finally {
4646
TempFile.remove(f);
@@ -69,7 +69,7 @@ private void template(int size, boolean https) throws IOException {
6969
assertEquals(String.valueOf(f.length()), ret.fsize);
7070
assertEquals(etag, ret.hash);
7171
} catch (QiniuException e) {
72-
assertEquals("", e.response.bodyString());
72+
assertEquals("", e.response == null ? "e.response is null" : e.response.bodyString());
7373
fail();
7474
}
7575
TempFile.remove(f);

src/test/java/com/qiniu/storage/StreamUploadTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void testXVar() throws IOException {
4444
StringMap m = res.jsonToMap();
4545
assertEquals("foo_val", m.get("foo"));
4646
} catch (QiniuException e) {
47-
assertEquals("", e.response.bodyString());
47+
assertEquals("", e.response == null ? "e.response is null" : e.response.bodyString());
4848
fail();
4949
} finally {
5050
TempFile.remove(f);
@@ -74,7 +74,7 @@ private void template(int size, boolean https) throws IOException {
7474
assertEquals(mime, ret.mimeType);
7575
assertEquals(etag, ret.hash);
7676
} catch (QiniuException e) {
77-
assertEquals("", e.response.bodyString());
77+
assertEquals("", e.response == null ? "e.response is null" : e.response.bodyString());
7878
fail();
7979
}
8080
TempFile.remove(f);

0 commit comments

Comments
 (0)