8228585: jdk/internal/platform/cgroup/TestCgroupMetrics.java - NumberFormatException because of large long values (memory limit_in_bytes)

Reviewed-by: dholmes, sgehwolf
This commit is contained in:
Matthias Baesken 2019-07-25 12:15:27 +02:00
parent ff6b5404eb
commit da6f042616
2 changed files with 22 additions and 3 deletions

View file

@ -132,7 +132,7 @@ public class SubSystem {
retval = Long.parseLong(strval);
} catch (NumberFormatException e) {
// For some properties (e.g. memory.limit_in_bytes) we may overflow the range of signed long.
// In this case, return Long.max
// In this case, return Long.MAX_VALUE
BigInteger b = new BigInteger(strval);
if (b.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) {
return Long.MAX_VALUE;