Add NoSuchFileException to be catched in AtomicFileHelper

This commit is contained in:
Blue (Lukas Rieger) 2021-09-30 23:49:47 +02:00
parent e326939021
commit 999c148ded
No known key found for this signature in database
GPG Key ID: 904C4995F9E1F800

View File

@ -28,10 +28,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.nio.file.*;
public class AtomicFileHelper {
@ -52,11 +49,11 @@ public static OutputStream createFilepartOutputStream(final Path file) throws IO
try {
Files.move(partFile, file, StandardCopyOption.ATOMIC_MOVE);
} catch (FileNotFoundException ignore) {
} catch (FileNotFoundException | NoSuchFileException ignore) {
} catch (IOException ex) {
try {
Files.move(partFile, file);
} catch (FileNotFoundException ignore) {}
} catch (FileNotFoundException | NoSuchFileException ignore) {}
}
});
}