Skip to content

Commit 2c1147c

Browse files
committed
Merge pull request #119 from ParsePlatform/wangmengyan.t8184922_ParseAWSRequest_tempFile_creation
Create cache dir if it does not exist before we use tempFile
2 parents 799d288 + 441aab8 commit 2c1147c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Parse/src/main/java/com/parse/ParseAWSRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public Void call() throws Exception {
5656
InputStream responseStream = null;
5757
try {
5858
responseStream = response.getContent();
59-
FileOutputStream tempFileStream = new FileOutputStream(tempFile);
59+
FileOutputStream tempFileStream = ParseFileUtils.openOutputStream(tempFile);
6060

6161
int nRead;
6262
byte[] data = new byte[32 << 10]; // 32KB

Parse/src/test/java/com/parse/ParseFileControllerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ public void testFetchAsyncSuccess() throws Exception {
303303

304304
ParseHttpClient awsClient = mock(ParseHttpClient.class);
305305
when(awsClient.execute(any(ParseHttpRequest.class))).thenReturn(mockResponse);
306-
File root = temporaryFolder.getRoot();
306+
// Make sure cache dir does not exist
307+
File root = new File(temporaryFolder.getRoot(), "cache");
308+
assertFalse(root.exists());
307309
ParseFileController controller = new ParseFileController(null, root).awsClient(awsClient);
308310

309311
ParseFile.State state = new ParseFile.State.Builder()

0 commit comments

Comments
 (0)