Skip to content

Commit

Permalink
8237364: Add early validation to the jdk.jfr.Recording constructor
Browse files Browse the repository at this point in the history
Reviewed-by: mgronlun, mseledtsov
  • Loading branch information
egahlin committed Jan 29, 2020
1 parent 5b5a535 commit 70fdf1e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/jdk.jfr/share/classes/jdk/jfr/Recording.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public Map<String, String> toMap() {
* 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)
Expand All @@ -109,9 +111,11 @@ public Map<String, String> toMap() {
* @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");
Expand Down

0 comments on commit 70fdf1e

Please sign in to comment.