From d2f1c0f40d675f5e393017f3d97cfd78ccc4777e Mon Sep 17 00:00:00 2001 From: Mauricio Colli Date: Wed, 24 Jun 2020 01:45:19 -0300 Subject: [PATCH] [SoundCloud] Fix concurrency issue when getting the client id --- .../services/soundcloud/SoundcloudParsingHelper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java index b8dafd834..761d14a96 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java @@ -43,13 +43,15 @@ public class SoundcloudParsingHelper { private SoundcloudParsingHelper() { } - public static String clientId() throws ExtractionException, IOException { + public synchronized static String clientId() throws ExtractionException, IOException { if (!isNullOrEmpty(clientId)) return clientId; Downloader dl = NewPipe.getDownloader(); clientId = HARDCODED_CLIENT_ID; if (checkIfHardcodedClientIdIsValid()) { return clientId; + } else { + clientId = null; } final Response download = dl.get("https://soundcloud.com");