Skip to content

Commit

Permalink
Closing streams in ParseAWSRequest (#590)
Browse files Browse the repository at this point in the history
* Update ParseAWSRequest.java
  • Loading branch information
natario1 authored and rogerhu committed Mar 9, 2017
1 parent 3fced98 commit 735be49
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Parse/src/main/java/com/parse/ParseAWSRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -73,6 +74,7 @@ public Void call() throws Exception {
return null;
} finally {
ParseIOUtils.closeQuietly(responseStream);
ParseIOUtils.closeQuietly(tempFileStream);
}
}
}, ParseExecutors.io());
Expand Down

0 comments on commit 735be49

Please sign in to comment.