Use Objects.requireNonNull().

This commit is contained in:
Isira Seneviratne 2020-10-19 17:43:34 +05:30
parent 4c19a88612
commit 57be1f1123

View file

@ -11,6 +11,7 @@ import org.schabi.newpipe.extractor.localization.TimeAgoParser;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
public abstract class Extractor { public abstract class Extractor {
/** /**
@ -29,12 +30,9 @@ public abstract class Extractor {
private final Downloader downloader; private final Downloader downloader;
public Extractor(final StreamingService service, final LinkHandler linkHandler) { public Extractor(final StreamingService service, final LinkHandler linkHandler) {
if (service == null) throw new NullPointerException("service is null"); this.service = Objects.requireNonNull(service, "service is null");
if (linkHandler == null) throw new NullPointerException("LinkHandler is null"); this.linkHandler = Objects.requireNonNull(linkHandler, "LinkHandler is null");
this.service = service; this.downloader = Objects.requireNonNull(NewPipe.getDownloader(), "downloader is null");
this.linkHandler = linkHandler;
this.downloader = NewPipe.getDownloader();
if (downloader == null) throw new NullPointerException("downloader is null");
} }
/** /**