Skip to content

Commit

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

PiperOrigin-RevId: 439775241
  • Loading branch information
meisterT authored and copybara-github committed Apr 6, 2022
1 parent e982f2a commit 53b9cb8
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,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 53b9cb8

Please sign in to comment.