diff -r f40923eeb559 -r 465ba4fefe62 src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java Mon Oct 07 20:15:47 2019 +0200 +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java Tue Oct 08 11:57:11 2019 +0200 @@ -370,10 +370,16 @@ public void setDestination(WriteableUserPath userSuppliedPath) throws IOException { synchronized (recorder) { + checkSetDestination(userSuppliedPath); + this.destination = userSuppliedPath; + } + } + + public void checkSetDestination(WriteableUserPath userSuppliedPath) throws IOException { + synchronized (recorder) { if (Utils.isState(getState(), RecordingState.STOPPED, RecordingState.CLOSED)) { throw new IllegalStateException("Destination can't be set on a recording that has been stopped/closed"); } - this.destination = userSuppliedPath; } }