Specify copy option to overwrite existing temp file, otherwise Files.copy throws FileAlreadyExistsException (#5268)

This commit is contained in:
zszugyi 2017-04-01 01:11:00 -07:00 committed by wing328
parent 5de19e3214
commit 22eb72791c

View File

@ -27,6 +27,7 @@ import java.io.InputStream;
{{^supportJava6}}
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
{{/supportJava6}}
{{#supportJava6}}
import org.apache.commons.io.FileUtils;
@ -581,7 +582,7 @@ public class ApiClient {
try {
File file = prepareDownloadFile(response);
{{^supportJava6}}
Files.copy(response.readEntity(InputStream.class), file.toPath());
Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
{{/supportJava6}}
{{#supportJava6}}
// Java6 falls back to commons.io for file copying