Skip to content

Commit

Permalink
crash fixed on node field access (via #43)
Browse files Browse the repository at this point in the history
  • Loading branch information
rehsals committed Jan 11, 2023
1 parent 6f99630 commit 9184f07
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public TestResult format(final ExportMeta meta, final JsonNode node) {
}
}
final Optional<StepResult> topLevelFailure = context.getFailures().values().stream()
.filter(f -> f.get(FAILURE_IS_TOP_LEVEL).get(VALUE).asBoolean())
.filter(this::isTopLevelFailure)
.map(this::getFailureStep)
.findFirst();
if (topLevelFailure.isPresent()) {
Expand Down Expand Up @@ -291,6 +291,13 @@ private Optional<String> getActivityTitle(final JsonNode node) {
return Optional.empty();
}

private Boolean isTopLevelFailure(final JsonNode activityFailure) {
if (activityFailure.has(FAILURE_IS_TOP_LEVEL)) {
return activityFailure.get(FAILURE_IS_TOP_LEVEL).get(VALUE).asBoolean();
}
return false;
}

private StepResult getFailureStep(final JsonNode activityFailure) {
final Long timestamp = parseDate(activityFailure.get(FAILURE_TIMESTAMP).get(VALUE).asText());
final String message = activityFailure.get(FAILURE_MESSAGE).get(VALUE).asText();
Expand Down

0 comments on commit 9184f07

Please sign in to comment.