Fix MEMINFO_PATTERN is null

This commit is contained in:
Jason_Khew 2021-09-11 10:59:56 +08:00 committed by Yuhui Huang
parent 0256b8a971
commit c8ba03ae2b

View File

@ -95,6 +95,8 @@ public enum OperatingSystem {
private static final String[] INVALID_RESOURCE_BASENAMES;
private static final String[] INVALID_RESOURCE_FULLNAMES;
private static final Pattern MEMINFO_PATTERN = Pattern.compile("^(?<key>.*?):\\s+(?<value>\\d+) kB?$");
static {
String name = System.getProperty("os.name").toLowerCase(Locale.US);
if (name.contains("win"))
@ -132,8 +134,6 @@ public enum OperatingSystem {
}
}
private static final Pattern MEMINFO_PATTERN = Pattern.compile("^(?<key>.*?):\\s+(?<value>\\d+) kB?$");
public static Optional<PhysicalMemoryStatus> getPhysicalMemoryStatus() {
if (CURRENT_OS == LINUX) {
try {