Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
8284977: MetricsTesterCgroupV2.getLongValueEntryFromFile fails when n…
…amed value doesn't exist

Backport-of: 444a0d9
  • Loading branch information
RealCLanger committed Aug 26, 2022
1 parent 8934a84 commit d10e902
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -121,6 +121,11 @@ private long getLongValueEntryFromFile(String file, String metric) {
Path filePath = Paths.get(UNIFIED.getPath(), file);
try {
String strVal = Files.lines(filePath).filter(l -> l.startsWith(metric)).collect(Collectors.joining());
if (strVal.isEmpty()) {
// sometimes the match for the metric does not exist, e.g. cpu.stat's nr_periods iff the controller
// is not enabled
return UNLIMITED;
}
String[] keyValues = strVal.split("\\s+");
String value = keyValues[1];
return convertStringToLong(value);
Expand Down

1 comment on commit d10e902

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.