zentol commented on a change in pull request #9856: [FLINK-14337][hs] Better
handling of failed fetches
URL: https://github.com/apache/flink/pull/9856#discussion_r335427768
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/history/FsJobArchivist.java
##########
@@ -112,12 +112,19 @@ public static Path archiveJob(Path rootPath, JobID
jobId, Collection<ArchivedJso
JsonNode archive =
mapper.readTree(output.toByteArray());
Collection<ArchivedJson> archives = new ArrayList<>();
- for (JsonNode archivePart : archive.get(ARCHIVE)) {
- String path = archivePart.get(PATH).asText();
- String json = archivePart.get(JSON).asText();
+ for (JsonNode archivePart :
failOnNull(archive.get(ARCHIVE))) {
+ String path =
failOnNull(archivePart.get(PATH)).asText();
+ String json =
failOnNull(archivePart.get(JSON)).asText();
archives.add(new ArchivedJson(path, json));
}
return archives;
}
}
+
+ private static <X> X failOnNull(X value) throws IOException {
+ if (value == null) {
+ throw new IOException("Job archive did not conform to
expected format.");
Review comment:
I've reworked this commit (now uses a simple try-catch block) and include
the filename in the error message.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services