Skip to content

Commit 7c437a7

Browse files
amrtomix26
authored andcommitted
Overwrite existing extracted files if they exist. (#120)
This can only happen if the same archive is being re-extracted after a previous run has failed midway during extraction.
1 parent 054d84d commit 7c437a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/io/zonky/test/db/postgres/embedded/EmbeddedPostgres.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
import org.slf4j.LoggerFactory;
7373
import org.tukaani.xz.XZInputStream;
7474

75-
import static java.nio.file.StandardOpenOption.CREATE_NEW;
75+
import static java.nio.file.StandardOpenOption.CREATE;
7676
import static java.nio.file.StandardOpenOption.WRITE;
7777
import static java.util.Collections.unmodifiableMap;
7878

@@ -706,7 +706,7 @@ private static void extractTxz(InputStream stream, String targetDir) throws IOEx
706706
}
707707
mkdirs(fsObject.getParentFile());
708708

709-
final AsynchronousFileChannel fileChannel = AsynchronousFileChannel.open(fsObject.toPath(), CREATE_NEW, WRITE);
709+
final AsynchronousFileChannel fileChannel = AsynchronousFileChannel.open(fsObject.toPath(), CREATE, WRITE);
710710
final ByteBuffer buffer = ByteBuffer.wrap(content);
711711

712712
phaser.register();

0 commit comments

Comments
 (0)