#5649 Fix FileAlreadyExistsException when downloading file using jersey2 (#5654)

* #5649 Fix download file copy

* Include generated pet store samples and fix indentation

* Regenerate petstore sample to fix indentation
This commit is contained in:
Harald Walker
2017-05-18 09:12:53 +02:00
committed by wing328
parent 07df7d47eb
commit 4417bb6b32
6 changed files with 8 additions and 2 deletions

View File

@@ -25,6 +25,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