HADOOP-18294. Ensure build folder exists before writing checksum file.ProtocRunner#writeChecksums (#4446)
Co-authored-by: Ashutosh Gupta <ashugpt@amazon.com> Signed-off-by: Akira Ajisaka <aajisaka@apache.org>
This commit is contained in:
parent
4e8c0b902e
commit
0ca4868aa2
@ -30,6 +30,7 @@
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -172,6 +173,7 @@ private long computeChecksum(File file) throws IOException {
|
||||
|
||||
public void writeChecksums() throws IOException {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
Files.createDirectories(checksumFile.getParentFile().toPath());
|
||||
try (BufferedOutputStream out = new BufferedOutputStream(
|
||||
new FileOutputStream(checksumFile))) {
|
||||
mapper.writeValue(out, computedChecksums);
|
||||
|
Loading…
Reference in New Issue
Block a user