@@ -169,17 +169,17 @@ public void setValues() {
169169 }
170170 boolean isEnabled = enabledCatalogs .contains (fetcher .getName ());
171171 boolean isCustomizable = customizableFetcherNames .contains (fetcher .getName ());
172- FetcherViewModel vm = new FetcherViewModel (fetcher , isEnabled , isCustomizable );
172+ FetcherViewModel fetcherViewModel = new FetcherViewModel (fetcher , isEnabled , isCustomizable );
173173 if (isCustomizable ) {
174174 savedApiKeys .stream ()
175175 .filter (apiKey -> apiKey .getName ().equals (fetcher .getName ()))
176176 .findFirst ()
177177 .ifPresent (apiKey -> {
178- vm .apiKeyProperty ().set (apiKey .getKey ());
179- vm .useCustomApiKeyProperty ().set (apiKey .shouldUse ());
178+ fetcherViewModel .apiKeyProperty ().set (apiKey .getKey ());
179+ fetcherViewModel .useCustomApiKeyProperty ().set (apiKey .shouldUse ());
180180 });
181181 }
182- fetchers .add (vm );
182+ fetchers .add (fetcherViewModel );
183183 }
184184
185185 apikeyPersistAvailableProperty .setValue (OS .isKeyringAvailable ());
@@ -211,11 +211,11 @@ public void storeSettings() {
211211 fetchers .stream ()
212212 .filter (FetcherViewModel ::isEnabled )
213213 .map (FetcherViewModel ::getName )
214- . collect ( Collectors . toList () ));
214+ . toList ());
215215
216216 List <FetcherApiKey > apiKeysToStore = fetchers .stream ()
217217 .filter (FetcherViewModel ::isCustomizable )
218- .map (vm -> new FetcherApiKey (vm .getName (), vm .shouldUseCustomApiKey (), vm .getApiKey ()))
218+ .map (fetcherViewModel -> new FetcherApiKey (fetcherViewModel .getName (), fetcherViewModel .shouldUseCustomApiKey (), fetcherViewModel .getApiKey ()))
219219 .toList ();
220220
221221 importerPreferences .setPersistCustomKeys (apikeyPersistProperty .get ());
@@ -308,6 +308,7 @@ public void checkApiKey(FetcherViewModel fetcherViewModel, String apiKey, Consum
308308
309309 try {
310310 URLDownload urlDownload = new URLDownload (testUrlWithoutApiKey + apiKey );
311+ // The HEAD request cannot be used because its response is not 200 (maybe 404 or 596...).
311312 int statusCode = ((HttpURLConnection ) urlDownload .getSource ().openConnection ()).getResponseCode ();
312313 return (statusCode >= 200 ) && (statusCode < 300 );
313314 } catch (IOException | UnirestException e ) {
0 commit comments