From 57be1f1123e7b3707ab8a98a0a4cddfd1dcce4c1 Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Mon, 19 Oct 2020 17:43:34 +0530 Subject: [PATCH] Use Objects.requireNonNull(). --- .../java/org/schabi/newpipe/extractor/Extractor.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java index df1c22617..9389e255d 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java @@ -11,6 +11,7 @@ import org.schabi.newpipe.extractor.localization.TimeAgoParser; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.io.IOException; +import java.util.Objects; public abstract class Extractor { /** @@ -29,12 +30,9 @@ public abstract class Extractor { private final Downloader downloader; public Extractor(final StreamingService service, final LinkHandler linkHandler) { - if (service == null) throw new NullPointerException("service is null"); - if (linkHandler == null) throw new NullPointerException("LinkHandler is null"); - this.service = service; - this.linkHandler = linkHandler; - this.downloader = NewPipe.getDownloader(); - if (downloader == null) throw new NullPointerException("downloader is null"); + this.service = Objects.requireNonNull(service, "service is null"); + this.linkHandler = Objects.requireNonNull(linkHandler, "LinkHandler is null"); + this.downloader = Objects.requireNonNull(NewPipe.getDownloader(), "downloader is null"); } /**