Skip to content

Commit 9b10c69

Browse files
committed
8303622: JFR: Missing message with Objects.requireNonNull
Reviewed-by: mgronlun
1 parent d729824 commit 9b10c69

File tree

6 files changed

+22
-21
lines changed

6 files changed

+22
-21
lines changed

src/jdk.jfr/share/classes/jdk/jfr/AnnotationElement.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -329,7 +329,7 @@ public boolean hasValue(String name) {
329329
* it exists, else {@code null}
330330
*/
331331
public final <A> A getAnnotation(Class<? extends Annotation> annotationType) {
332-
Objects.requireNonNull(annotationType);
332+
Objects.requireNonNull(annotationType, "annotationType");
333333
return type.getAnnotation(annotationType);
334334
}
335335

src/jdk.jfr/share/classes/jdk/jfr/Recording.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -693,8 +693,8 @@ PlatformRecording getInternal() {
693693
}
694694

695695
private void setSetting(String id, String value) {
696-
Objects.requireNonNull(id);
697-
Objects.requireNonNull(value);
696+
Objects.requireNonNull(id, "id");
697+
Objects.requireNonNull(value, "value");
698698
internal.setSetting(id, value);
699699
}
700700

src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordedObject.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -193,7 +193,7 @@ final <T> T getTyped(String name, Class<T> clazz, T defaultValue) {
193193
* @see #getFields()
194194
*/
195195
public boolean hasField(String name) {
196-
Objects.requireNonNull(name);
196+
Objects.requireNonNull(name, "name");
197197
for (ValueDescriptor v : objectContext.fields) {
198198
if (v.getName().equals(name)) {
199199
return true;

src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingFile.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -267,6 +267,7 @@ public void write(Path destination, Predicate<RecordedEvent> filter) throws IOEx
267267
* {@code checkRead} method denies read access to the file.
268268
*/
269269
public static List<RecordedEvent> readAllEvents(Path path) throws IOException {
270+
Objects.requireNonNull(path, "path");
270271
try (RecordingFile r = new RecordingFile(path)) {
271272
List<RecordedEvent> list = new ArrayList<>();
272273
while (r.hasMoreEvents()) {

src/jdk.jfr/share/classes/jdk/jfr/consumer/RecordingStream.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -441,7 +441,7 @@ public boolean stop() {
441441
* @since 17
442442
*/
443443
public void dump(Path destination) throws IOException {
444-
Objects.requireNonNull(destination);
444+
Objects.requireNonNull(destination, "destination");
445445
Object recorder = PrivateAccess.getInstance().getPlatformRecorder();
446446
synchronized (recorder) {
447447
RecordingState state = recording.getState();

src/jdk.management.jfr/share/classes/jdk/management/jfr/RemoteRecordingStream.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -109,8 +109,8 @@ static final class RemoteSettings implements EventSettingsModifier {
109109

110110
@Override
111111
public void with(String name, String value) {
112-
Objects.requireNonNull(name);
113-
Objects.requireNonNull(value);
112+
Objects.requireNonNull(name, "name");
113+
Objects.requireNonNull(value, "value");
114114
// FlightRecorderMXBean implementation always returns
115115
// new instance of Map so no need to create new here.
116116
Map<String, String> newSettings = getEventSettings();
@@ -210,12 +210,12 @@ public RemoteRecordingStream(MBeanServerConnection connection, Path directory) t
210210
}
211211

212212
@SuppressWarnings("removal")
213-
private RemoteRecordingStream(MBeanServerConnection connection, Path dir, boolean delete) throws IOException {
214-
Objects.requireNonNull(connection);
215-
Objects.requireNonNull(dir);
213+
private RemoteRecordingStream(MBeanServerConnection connection, Path directory, boolean delete) throws IOException {
214+
Objects.requireNonNull(connection, "connection");
215+
Objects.requireNonNull(directory, "directory");
216216
accessControllerContext = AccessController.getContext();
217217
// Make sure users can't implement malicious version of a Path object.
218-
path = Paths.get(dir.toString());
218+
path = Paths.get(directory.toString());
219219
if (!Files.exists(path)) {
220220
throw new IOException("Download directory doesn't exist");
221221
}
@@ -334,7 +334,7 @@ private long createRecording() throws IOException {
334334
* @see Recording#setSettings(Map)
335335
*/
336336
public void setSettings(Map<String, String> settings) {
337-
Objects.requireNonNull(settings);
337+
Objects.requireNonNull(settings, "settings");
338338
try {
339339
mbean.setRecordingSettings(recordingId, settings);
340340
} catch (Exception e) {
@@ -355,7 +355,7 @@ public void setSettings(Map<String, String> settings) {
355355
*
356356
*/
357357
public EventSettings disable(String name) {
358-
Objects.requireNonNull(name);
358+
Objects.requireNonNull(name, "name");
359359
EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId));
360360
try {
361361
return s.with(name + "#" + ENABLED, "false");
@@ -379,7 +379,7 @@ public EventSettings disable(String name) {
379379
* @see EventType
380380
*/
381381
public EventSettings enable(String name) {
382-
Objects.requireNonNull(name);
382+
Objects.requireNonNull(name, "name");
383383
EventSettings s = ManagementSupport.newEventSettings(new RemoteSettings(mbean, recordingId));
384384
try {
385385
return s.with(name + "#" + ENABLED, "true");
@@ -656,7 +656,7 @@ private void ensureStartable() {
656656
* @since 17
657657
*/
658658
public void dump(Path destination) throws IOException {
659-
Objects.requireNonNull(destination);
659+
Objects.requireNonNull(destination, "destination");
660660
long id = -1;
661661
try {
662662
FileDump fileDump;

0 commit comments

Comments
 (0)