From 364b847a4e5ba6b7d821a3c8f161a968e8560062 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Mon, 14 Oct 2024 13:44:13 +0200 Subject: [PATCH] Inject buildInfo --- .../org/jabref/logic/preferences/JabRefCliPreferences.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java b/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java index ee17ee534b4..c7a320338cd 100644 --- a/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java +++ b/src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java @@ -2092,7 +2092,11 @@ private List getFetcherKeysFromKeyring(List names) { } private Map getDefaultFetcherKeys() { - BuildInfo buildInfo = new BuildInfo(); + BuildInfo buildInfo = Injector.instantiateModelOrService(BuildInfo.class); + if (buildInfo == null) { + return Collections.emptyMap(); + } + Map keys = new HashMap<>(); keys.put(SemanticScholarFetcher.FETCHER_NAME, buildInfo.semanticScholarApiKey); keys.put(AstrophysicsDataSystem.FETCHER_NAME, buildInfo.astrophysicsDataSystemAPIKey);