Skip to content

Commit

Permalink
Handle potential NPE (#18966)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpgrailsdev authored Nov 4, 2022
1 parent 4c6f520 commit b194519
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ public class MetricTags {
public static final String WORKFLOW_TYPE = "workflow_type";
public static final String ATTEMPT_QUEUE = "attempt_queue";
public static final String GEOGRAPHY = "geography";
public static final String UNKNOWN = "unknown";

public static String getReleaseStage(final ReleaseStage stage) {
return stage.getLiteral();
return stage != null ? stage.getLiteral() : UNKNOWN;
}

public static String getFailureOrigin(final FailureOrigin origin) {
return origin.value();
return origin != null ? origin.value() : UNKNOWN;
}

public static String getJobStatus(final JobStatus status) {
return status.getLiteral();
return status != null ? status.getLiteral() : UNKNOWN;
}

}

0 comments on commit b194519

Please sign in to comment.