Mercurial > hg > openjdk > jdk8u > jdk
changeset 14321:c85c408581cb
8258241: [8u] Missing doPrivileged() hunks from JDK-8226575
Reviewed-by: andrew
author | sgehwolf |
---|---|
date | Mon, 14 Dec 2020 18:12:00 +0100 |
parents | 7208c8539f75 |
children | 9d7ac5cdf6be |
files | src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java Wed Sep 11 15:58:27 2019 +0530 +++ b/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java Mon Dec 14 18:12:00 2020 +0100 @@ -119,7 +119,7 @@ Function<String, Long> conversion) { long retval = Metrics.unlimited_minimum + 1; // default unlimited try { - List<String> lines = Files.readAllLines(Paths.get(subsystem.path(), param)); + List<String> lines = subsystem.readMatchingLines(param); for (String line: lines) { if (line.contains(match)) { retval = conversion.apply(line); @@ -132,6 +132,17 @@ return retval; } + private List<String> readMatchingLines(String param) throws IOException { + try { + PrivilegedExceptionAction<List<String>> pea = () -> + Files.readAllLines(Paths.get(path(), param)); + return AccessController.doPrivileged(pea); + } catch (PrivilegedActionException e) { + Metrics.unwrapIOExceptionAndRethrow(e); + throw new InternalError(e.getCause()); + } + } + public static long getLongValue(SubSystem subsystem, String parm) { String strval = getStringValue(subsystem, parm); return convertStringToLong(strval);