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:
Ashutosh Gupta 2022-07-12 12:15:26 +01:00 committed by GitHub
parent 4e8c0b902e
commit 0ca4868aa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -30,6 +30,7 @@ import java.io.FileInputStream;
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 @@ public class ProtocRunner {
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);