From 2dfcac6975bbad41fad87f8fa146be66b3e9635e Mon Sep 17 00:00:00 2001 From: Toby Crawley Date: Mon, 24 Feb 2025 08:52:05 -0500 Subject: [PATCH] Configure singleton Downloader This Downloader instance is used when a datafeed[1] URL is provided, but will throw an NPE if it isn't configured[2]. [1]: https://github.com/rm-hull/nvd-clojure?tab=readme-ov-file#configuration-options [2]: https://github.com/rm-hull/nvd-clojure/issues/182 --- src/nvd/config.clj | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/nvd/config.clj b/src/nvd/config.clj index 9e5d680..926e663 100644 --- a/src/nvd/config.clj +++ b/src/nvd/config.clj @@ -30,7 +30,7 @@ (:import (java.io File) (org.owasp.dependencycheck Engine) - (org.owasp.dependencycheck.utils Settings Settings$KEYS))) + (org.owasp.dependencycheck.utils Downloader Settings Settings$KEYS))) (def ^:private string-mappings {Settings$KEYS/ANALYZER_NEXUS_URL [:analyzer :nexus-url] @@ -209,12 +209,14 @@ You can pass an empty string for an .edn file to be automatically created." (.setString settings Settings$KEYS/NVD_API_KEY api-key))) - (-> project - (assoc-in [:nvd :data-directory] (.getDataDirectory settings)) - (assoc :engine (Engine. settings) - :title (str (app-name project) " " (:version project)) - :start-time (System/currentTimeMillis) - :config-file config-filename)))) + (.configure (Downloader/getInstance) settings) + + (-> project + (assoc-in [:nvd :data-directory] (.getDataDirectory settings)) + (assoc :engine (Engine. settings) + :title (str (app-name project) " " (:version project)) + :start-time (System/currentTimeMillis) + :config-file config-filename)))) (defn cleanup [project] (let [engine ^Engine (:engine project)