src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 53013 c8b2a408628b
child 58679 9c3209ff7550
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java	Thu Oct 17 20:27:44 2019 +0100
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java	Thu Oct 17 20:53:35 2019 +0100
@@ -132,7 +132,7 @@
                     options.add("duration=" + Utils.formatTimespan(duration, ""));
                 }
                 if (destination != null) {
-                    options.add("filename=" + destination.getText());
+                    options.add("filename=" + destination.getRealPathText());
                 }
                 String optionText = options.toString();
                 if (optionText.length() != 0) {
@@ -165,7 +165,7 @@
         if (dest != null) {
             try {
                 dumpStopped(dest);
-                Logger.log(LogTag.JFR, LogLevel.INFO, "Wrote recording \"" + getName() + "\" (" + getId() + ") to " + dest.getText());
+                Logger.log(LogTag.JFR, LogLevel.INFO, "Wrote recording \"" + getName() + "\" (" + getId() + ") to " + dest.getRealPathText());
                 notifyIfStateChanged(newState, oldState);
                 close(); // remove if copied out
             } catch(IOException e) {
@@ -318,7 +318,6 @@
         PlatformRecording clone = recorder.newTemporaryRecording();
         clone.setShouldWriteActiveRecordingEvent(false);
         clone.setName(getName());
-        clone.setDestination(this.destination);
         clone.setToDisk(true);
         // We purposely don't clone settings here, since
         // a union a == a
@@ -367,10 +366,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;
         }
     }