Skip to content

Commit 31c4a87

Browse files
author
duke
committed
Automatic merge of jdk:master into master
2 parents 251d9a7 + 8d9cf48 commit 31c4a87

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
package jdk.internal.platform;
2727

2828
import java.io.IOException;
29+
import java.io.UncheckedIOException;
2930
import java.math.BigInteger;
3031
import java.nio.file.Path;
3132
import java.nio.file.Paths;
@@ -169,8 +170,9 @@ public static long getLongEntry(CgroupSubsystemController controller, String par
169170
.findFirst();
170171

171172
return result.isPresent() ? Long.parseLong(result.get()) : defaultRetval;
172-
}
173-
catch (IOException e) {
173+
} catch (UncheckedIOException e) {
174+
return defaultRetval;
175+
} catch (IOException e) {
174176
return defaultRetval;
175177
}
176178
}

src/java.base/linux/classes/jdk/internal/platform/CgroupUtil.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import java.io.BufferedReader;
2929
import java.io.IOException;
30+
import java.io.UncheckedIOException;
3031
import java.nio.file.Files;
3132
import java.nio.file.Path;
3233
import java.nio.file.Paths;
@@ -45,6 +46,8 @@ public static Stream<String> readFilePrivileged(Path path) throws IOException {
4546
} catch (PrivilegedActionException e) {
4647
unwrapIOExceptionAndRethrow(e);
4748
throw new InternalError(e.getCause());
49+
} catch (UncheckedIOException e) {
50+
throw e.getCause();
4851
}
4952
}
5053

@@ -68,6 +71,8 @@ static String readStringValue(CgroupSubsystemController controller, String param
6871
} catch (PrivilegedActionException e) {
6972
unwrapIOExceptionAndRethrow(e);
7073
throw new InternalError(e.getCause());
74+
} catch (UncheckedIOException e) {
75+
throw e.getCause();
7176
}
7277
}
7378

@@ -78,6 +83,8 @@ public static List<String> readAllLinesPrivileged(Path path) throws IOException
7883
} catch (PrivilegedActionException e) {
7984
unwrapIOExceptionAndRethrow(e);
8085
throw new InternalError(e.getCause());
86+
} catch (UncheckedIOException e) {
87+
throw e.getCause();
8188
}
8289
}
8390
}

src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1Subsystem.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
package jdk.internal.platform.cgroupv1;
2727

2828
import java.io.IOException;
29+
import java.io.UncheckedIOException;
2930
import java.nio.file.Path;
3031
import java.nio.file.Paths;
3132
import java.util.stream.Stream;
@@ -75,6 +76,8 @@ private static CgroupV1Subsystem initSubSystem() {
7576
.map(line -> line.split(" "))
7677
.forEach(entry -> createSubSystemController(subsystem, entry));
7778

79+
} catch (UncheckedIOException e) {
80+
return null;
7881
} catch (IOException e) {
7982
return null;
8083
}
@@ -109,6 +112,8 @@ private static CgroupV1Subsystem initSubSystem() {
109112
.filter(line -> (line.length >= 3))
110113
.forEach(line -> setSubSystemControllerPath(subsystem, line));
111114

115+
} catch (UncheckedIOException e) {
116+
return null;
112117
} catch (IOException e) {
113118
return null;
114119
}

src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
package jdk.internal.platform.cgroupv2;
2727

2828
import java.io.IOException;
29+
import java.io.UncheckedIOException;
2930
import java.nio.file.Paths;
3031
import java.util.List;
3132
import java.util.concurrent.TimeUnit;
@@ -69,6 +70,8 @@ private static CgroupV2Subsystem initSubsystem() {
6970
.collect(Collectors.joining());
7071
String[] tokens = l.split(" ");
7172
mountPath = tokens[4];
73+
} catch (UncheckedIOException e) {
74+
return null;
7275
} catch (IOException e) {
7376
return null;
7477
}
@@ -87,6 +90,8 @@ private static CgroupV2Subsystem initSubsystem() {
8790
cgroupPath = tokens[2];
8891
break;
8992
}
93+
} catch (UncheckedIOException e) {
94+
return null;
9095
} catch (IOException e) {
9196
return null;
9297
}
@@ -329,6 +334,8 @@ private long sumTokensIOStat(Function<String, Long> mapFunc) {
329334
return CgroupUtil.readFilePrivileged(Paths.get(unified.path(), "io.stat"))
330335
.map(mapFunc)
331336
.collect(Collectors.summingLong(e -> e));
337+
} catch (UncheckedIOException e) {
338+
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
332339
} catch (IOException e) {
333340
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
334341
}

0 commit comments

Comments
 (0)