Skip to content

Commit

Permalink
Catch NumberFormatException while trying to parse thread id. (#15434)
Browse files Browse the repository at this point in the history
Fixes #14949.

PiperOrigin-RevId: 439775241

Co-authored-by: twerth <twerth@google.com>
  • Loading branch information
ckolli5 and meisterT authored May 9, 2022
1 parent abd7a9f commit bc42b65
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,14 @@ private static long getSortIndex(String threadName) {
return MAX_SORT_INDEX;
}

long extractedNumber = Long.parseLong(numberMatcher.group());
long extractedNumber;
try {
extractedNumber = Long.parseLong(numberMatcher.group());
} catch (NumberFormatException e) {
// If the number cannot be parsed, e.g. is larger than a long, the actual position is not
// really relevant.
return MAX_SORT_INDEX;
}

if (threadName.startsWith("skyframe-evaluator")) {
return SKYFRAME_EVALUATOR_SHIFT + extractedNumber;
Expand Down

0 comments on commit bc42b65

Please sign in to comment.