File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/main/java/com/dropbox/core/http Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ public OutputStream getBody() {
214
214
PipedRequestBody pipedBody = new PipedRequestBody ();
215
215
setBody (pipedBody );
216
216
217
- this .callback = new AsyncCallback ();
217
+ this .callback = new AsyncCallback (pipedBody );
218
218
this .call = client .newCall (request .build ());
219
219
// enqueue the call (async call execution). This allows us to provide streaming uploads.
220
220
call .enqueue (callback );
@@ -288,10 +288,12 @@ public Response finish() throws IOException {
288
288
}
289
289
290
290
public static final class AsyncCallback implements Callback {
291
+ private PipedRequestBody body ;
291
292
private IOException error ;
292
293
private okhttp3 .Response response ;
293
294
294
- private AsyncCallback () {
295
+ private AsyncCallback (PipedRequestBody body ) {
296
+ this .body = body ;
295
297
this .error = null ;
296
298
this .response = null ;
297
299
}
@@ -314,6 +316,7 @@ public synchronized okhttp3.Response getResponse() throws IOException {
314
316
@ Override
315
317
public synchronized void onFailure (Call call , IOException ex ) {
316
318
this .error = ex ;
319
+ this .body .close ();
317
320
notifyAll ();
318
321
}
319
322
You can’t perform that action at this time.
0 commit comments