Skip to content
Permalink
Browse files
8255908: ExceptionInInitializerError due to UncheckedIOException whil…
…e initializing cgroupv1 subsystem

Backport-of: 8d9cf48e813dee9567340720978392e04f736e65
  • Loading branch information
Ekaterina Vergizova committed May 17, 2021
1 parent 73ab669 commit fb5396763c6844d345ce4bc322030566e8b78c23
@@ -26,6 +26,7 @@
package jdk.internal.platform;

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

return result.isPresent() ? Long.parseLong(result.get()) : defaultRetval;
}
catch (IOException e) {
} catch (UncheckedIOException e) {
return defaultRetval;
} catch (IOException e) {
return defaultRetval;
}
}
@@ -27,6 +27,7 @@

import java.io.BufferedReader;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -45,6 +46,8 @@
} catch (PrivilegedActionException e) {
unwrapIOExceptionAndRethrow(e);
throw new InternalError(e.getCause());
} catch (UncheckedIOException e) {
throw e.getCause();
}
}

@@ -68,6 +71,8 @@ static String readStringValue(CgroupSubsystemController controller, String param
} catch (PrivilegedActionException e) {
unwrapIOExceptionAndRethrow(e);
throw new InternalError(e.getCause());
} catch (UncheckedIOException e) {
throw e.getCause();
}
}

@@ -78,6 +83,8 @@ static String readStringValue(CgroupSubsystemController controller, String param
} catch (PrivilegedActionException e) {
unwrapIOExceptionAndRethrow(e);
throw new InternalError(e.getCause());
} catch (UncheckedIOException e) {
throw e.getCause();
}
}
}
@@ -26,6 +26,7 @@
package jdk.internal.platform.cgroupv1;

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

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

} catch (UncheckedIOException e) {
return null;
} catch (IOException e) {
return null;
}
@@ -26,6 +26,7 @@
package jdk.internal.platform.cgroupv2;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Paths;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -69,6 +70,8 @@ private static CgroupV2Subsystem initSubsystem() {
.collect(Collectors.joining());
String[] tokens = l.split(" ");
mountPath = tokens[4];
} catch (UncheckedIOException e) {
return null;
} catch (IOException e) {
return null;
}
@@ -87,6 +90,8 @@ private static CgroupV2Subsystem initSubsystem() {
cgroupPath = tokens[2];
break;
}
} catch (UncheckedIOException e) {
return null;
} catch (IOException e) {
return null;
}
@@ -329,6 +334,8 @@ private long sumTokensIOStat(Function<String, Long> mapFunc) {
return CgroupUtil.readFilePrivileged(Paths.get(unified.path(), "io.stat"))
.map(mapFunc)
.collect(Collectors.summingLong(e -> e));
} catch (UncheckedIOException e) {
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
} catch (IOException e) {
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
}

1 comment on commit fb53967

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on fb53967 May 17, 2021

Please sign in to comment.