Please review this simple change that adds null checks for memory in CgroupV1Subsystem.java.
Problem: After the backport of JDK-8250984, there are places where memory.isSwapEnabled() is called. For example: public long getMemoryAndSwapFailCount() { if (!memory.isSwapEnabled()) { return getMemoryFailCount(); } return SubSystem.getLongValue(memory, "memory.memsw.failcnt"); } But memory could be Null on some machines that have cgroup entries for CPU but not for memory. This would cause a NullPointerException when memory is accessed. Fix: Add null checks for memory. ------------- Commit messages: - 8257746: Regression introduced with JDK-8250984 - memory might be null in some machines Changes: https://git.openjdk.java.net/jdk/pull/2269/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2269&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8257746 Stats: 4 lines in 1 file changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.java.net/jdk/pull/2269.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2269/head:pull/2269 PR: https://git.openjdk.java.net/jdk/pull/2269