OpenJDK / jdk / jdk
changeset 57872:029fe1db925d
8237364: Add early validation to the jdk.jfr.Recording constructor
Reviewed-by: mgronlun, mseledtsov
author | egahlin |
---|---|
date | Wed, 29 Jan 2020 23:36:38 +0100 |
parents | db30f31b9a8e |
children | 4f0822a80a13 |
files | src/jdk.jfr/share/classes/jdk/jfr/Recording.java |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk.jfr/share/classes/jdk/jfr/Recording.java Thu Jan 30 00:46:43 2020 +0300 +++ b/src/jdk.jfr/share/classes/jdk/jfr/Recording.java Wed Jan 29 23:36:38 2020 +0100 @@ -99,6 +99,8 @@ * A newly created recording is in the {@link RecordingState#NEW} state. To start * the recording, invoke the {@link Recording#start()} method. * + * @param settings settings as a map of name-value pairs, not {@code null} + * * @throws IllegalStateException if Flight Recorder can't be created (for * example, if the Java Virtual Machine (JVM) lacks Flight Recorder * support, or if the file repository can't be created or accessed) @@ -109,9 +111,11 @@ * @see jdk.jfr */ public Recording(Map<String, String> settings) { + Objects.requireNonNull(settings); + Map<String, String> sanitized = Utils.sanitizeNullFreeStringMap(settings); PlatformRecorder r = FlightRecorder.getFlightRecorder().getInternal(); synchronized (r) { - this.internal = r.newRecording(settings); + this.internal = r.newRecording(sanitized); this.internal.setRecording(this); if (internal.getRecording() != this) { throw new InternalError("Internal recording not properly setup");