From 0ca4868aa2a9218f51b1ded7d9552c3ac58c8836 Mon Sep 17 00:00:00 2001 From: Ashutosh Gupta Date: Tue, 12 Jul 2022 12:15:26 +0100 Subject: [PATCH] HADOOP-18294. Ensure build folder exists before writing checksum file.ProtocRunner#writeChecksums (#4446) Co-authored-by: Ashutosh Gupta Signed-off-by: Akira Ajisaka --- .../org/apache/hadoop/maven/plugin/protoc/ProtocRunner.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocRunner.java b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocRunner.java index e83a8cd957..c84bb1b38c 100644 --- a/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocRunner.java +++ b/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/protoc/ProtocRunner.java @@ -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);