src/hotspot/share/jfr/jni/jfrJniMethod.cpp
changeset 59259 127ca611f19b
parent 59226 a0f39cc47387
--- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp	Mon Nov 25 15:21:44 2019 +0000
+++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp	Mon Nov 25 18:38:01 2019 +0100
@@ -192,7 +192,9 @@
     return JNI_TRUE;
   }
   if (!JfrRecorder::create(simulate_failure == JNI_TRUE)) {
-    JfrJavaSupport::throw_illegal_state_exception("Unable to start Jfr", thread);
+    if (!thread->has_pending_exception()) {
+      JfrJavaSupport::throw_illegal_state_exception("Unable to start Jfr", thread);
+    }
     return JNI_FALSE;
   }
   return JNI_TRUE;