diff --git a/Parse/src/main/java/com/parse/ParseAWSRequest.java b/Parse/src/main/java/com/parse/ParseAWSRequest.java index 24df17c8f..a033555f1 100644 --- a/Parse/src/main/java/com/parse/ParseAWSRequest.java +++ b/Parse/src/main/java/com/parse/ParseAWSRequest.java @@ -54,9 +54,10 @@ public Void call() throws Exception { long totalSize = response.getTotalSize(); long downloadedSize = 0; InputStream responseStream = null; + FileOutputStream tempFileStream = null; try { responseStream = response.getContent(); - FileOutputStream tempFileStream = ParseFileUtils.openOutputStream(tempFile); + tempFileStream = ParseFileUtils.openOutputStream(tempFile); int nRead; byte[] data = new byte[32 << 10]; // 32KB @@ -73,6 +74,7 @@ public Void call() throws Exception { return null; } finally { ParseIOUtils.closeQuietly(responseStream); + ParseIOUtils.closeQuietly(tempFileStream); } } }, ParseExecutors.io());