Skip to content
Snippets Groups Projects
Commit a6459800 authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

SSDM-13422 : Implement ZIP import : fix java.nio.file.FileAlreadyExistsException

parent 337fef16
No related branches found
Tags S395.0
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
......@@ -21,6 +21,7 @@ import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
......@@ -151,12 +152,15 @@ public class MasterDataRegistrationHelper {
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
File entryDestination = new File(tempPathAsString, entry.getName());
if (entry.isDirectory()) {
if (entry.isDirectory())
{
entryDestination.mkdirs();
} else {
} else
{
entryDestination.getParentFile().mkdirs();
try (InputStream in = zipFile.getInputStream(entry)) {
Files.copy(in, entryDestination.toPath());
try (InputStream in = zipFile.getInputStream(entry))
{
Files.copy(in, entryDestination.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment