Skip to content

Commit 400db43

Browse files
committed
Throw error if "downloader" test param has invalid value
1 parent ac654a7 commit 400db43

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

extractor/src/test/java/org/schabi/newpipe/downloader/DownloaderFactory.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.schabi.newpipe.downloader;
22

33
import org.schabi.newpipe.extractor.downloader.Downloader;
4+
import org.schabi.newpipe.extractor.utils.Utils;
45

56
import java.util.Locale;
67

@@ -23,7 +24,7 @@ private static DownloaderType getDownloaderType() {
2324

2425
private static DownloaderType determineDownloaderType() {
2526
String propValue = System.getProperty("downloader");
26-
if (propValue == null) {
27+
if (Utils.isNullOrEmpty(propValue)) {
2728
return DEFAULT_DOWNLOADER;
2829
}
2930
propValue = propValue.toUpperCase();
@@ -33,8 +34,8 @@ private static DownloaderType determineDownloaderType() {
3334
}
3435
try {
3536
return DownloaderType.valueOf(propValue);
36-
} catch (final Exception e) {
37-
return DEFAULT_DOWNLOADER;
37+
} catch (final IllegalArgumentException e) {
38+
throw new IllegalArgumentException("Unknown downloader name: " + propValue, e);
3839
}
3940
}
4041

0 commit comments

Comments
 (0)