From 09707dd4f27b28980bf55030d36b5f3ec4a96831 Mon Sep 17 00:00:00 2001 From: Erik Gahlin Date: Mon, 7 Dec 2020 11:09:25 +0000 Subject: [PATCH] 8252807: The jdk.jfr.Recording.getStream does not work when toDisk is disabled Reviewed-by: mgronlun --- src/jdk.jfr/share/classes/jdk/jfr/Recording.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/jdk.jfr/share/classes/jdk/jfr/Recording.java b/src/jdk.jfr/share/classes/jdk/jfr/Recording.java index 84b22227a4c..04d33f5104f 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/Recording.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/Recording.java @@ -577,6 +577,9 @@ public final class Recording implements Closeable { * Creates a data stream for a specified interval. *

* The stream may contain some data outside the specified range. + *

+ * If the recording is not to disk, a stream can't be created + * and {@code null} is returned. * * @param start the start time for the stream, or {@code null} to get data from * start time of the recording @@ -585,12 +588,14 @@ public final class Recording implements Closeable { * present time. * * @return an input stream, or {@code null} if no data is available in the - * interval. + * interval, or the recording was not recorded to disk * * @throws IllegalArgumentException if {@code end} happens before * {@code start} * * @throws IOException if a stream can't be opened + * + * @see #setToDisk(boolean) */ public InputStream getStream(Instant start, Instant end) throws IOException { if (start != null && end != null && end.isBefore(start)) {