From b79b5e9eb8ea0ebd25f561f61d8a1ae8f5af1c33 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Tue, 13 Feb 2024 09:57:49 +0100 Subject: [PATCH] Support host VM that don't have have FlightRecorder VM option. --- .../src/com/oracle/svm/core/jfr/JfrFeature.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/JfrFeature.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/JfrFeature.java index 59e4809374a2..121e5b336955 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/JfrFeature.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jfr/JfrFeature.java @@ -101,7 +101,16 @@ public class JfrFeature implements InternalFeature { * code sets the FlightRecorder option as a side effect. Therefore, we must ensure that we check * the value of the option before it can be affected by image building. */ - private static final boolean HOSTED_ENABLED = Boolean.parseBoolean(getDiagnosticBean().getVMOption("FlightRecorder").getValue()); + private static final boolean HOSTED_ENABLED; + static { + boolean hostEnabled; + try { + hostEnabled = Boolean.parseBoolean(getDiagnosticBean().getVMOption("FlightRecorder").getValue()); + } catch (IllegalArgumentException e) { + hostEnabled = false; + } + HOSTED_ENABLED = hostEnabled; + } @Override public boolean isInConfiguration(IsInConfigurationAccess access) {