Skip to content

Commit 7e1a83d

Browse files
committed
Issue jetty#11803 - use Objects.requireNonNull
1 parent 84b0c61 commit 7e1a83d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/content/ContentSourcePublisher.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package org.eclipse.jetty.io.content;
1515

16+
import java.util.Objects;
1617
import java.util.concurrent.CancellationException;
1718
import java.util.concurrent.CompletionException;
1819
import java.util.concurrent.Flow;
@@ -43,8 +44,7 @@ public class ContentSourcePublisher implements Flow.Publisher<Content.Chunk>
4344

4445
public ContentSourcePublisher(Content.Source content)
4546
{
46-
if (content == null)
47-
throw new IllegalArgumentException("Content.Source must not be null");
47+
Objects.requireNonNull(content, "Content.Source must not be null");
4848
this.content = new AtomicReference<>(content);
4949
}
5050

@@ -135,10 +135,8 @@ record LastWill(Throwable reason, FinalSignal finalSignal)
135135
{
136136
public LastWill
137137
{
138-
if (reason == null)
139-
throw new IllegalArgumentException("Last will reason must not be null");
140-
if (finalSignal == null)
141-
throw new IllegalArgumentException("Last will final signal must not be null");
138+
Objects.requireNonNull(reason, "Last will reason must not be null");
139+
Objects.requireNonNull(finalSignal, "Last will final signal must not be null");
142140
}
143141
}
144142

0 commit comments

Comments
 (0)