Skip to content
Prev Previous commit
Next Next commit
Standardize on Objects.requireNonNull() instead of custom IllegalArgu…
…mentException
  • Loading branch information
brenuart committed Sep 9, 2021
commit 7d692d3b955bcfe789970f6cb54455ae0cda84e2
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;

import org.slf4j.Marker;
Expand All @@ -39,10 +40,7 @@ class LogstashBasicMarker implements Marker {
private volatile List<Marker> referenceList;

LogstashBasicMarker(String name) {
if (name == null) {
throw new IllegalArgumentException("A marker name cannot be null");
}
this.name = name;
this.name = Objects.requireNonNull(name);
}

/**
Expand All @@ -58,9 +56,7 @@ public String getName() {
*/
@Override
public void add(Marker reference) {
if (reference == null) {
throw new IllegalArgumentException("A null value cannot be added to a Marker as reference.");
}
Objects.requireNonNull(reference);

// no point in adding the reference multiple times
if (this.contains(reference)) {
Expand Down