Need to catch a different exception
@@ -29,6 +29,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
import java.nio.file.StandardOpenOption;
import org.apache.commons.io.FileUtils;
@@ -54,7 +55,7 @@ public class RewindableFileOutputStream extends OutputStream {
FileUtils.forceMkdir(out.getParentFile());
try {
current = Files.newOutputStream(out.toPath(), StandardOpenOption.TRUNCATE_EXISTING);
- } catch (FileNotFoundException e) {
+ } catch (FileNotFoundException | NoSuchFileException e) {
throw new IOException("Failed to open "+out,e);
}
}
