/** * {@inheritDoc} * * @param engine a reference to the dependency-check engine * @throws InitializationException thrown if there is an exception during * initialization */ @Override protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { File repoFile = null; try { repoFile = new File(getSettings().getDataDirectory(), "jsrepository.json"); } catch (FileNotFoundException ex) { this.setEnabled(false); throw new InitializationException(String.format("RetireJS repo does not exist locally (%s)", repoFile), ex); } catch (IOException ex) { this.setEnabled(false); throw new InitializationException("Failed to initialize the RetireJS repo - data directory could not be created", ex); } try (FileInputStream in = new FileInputStream(repoFile)) { this.jsRepository = new VulnerabilitiesRepositoryLoader().loadFromInputStream(in); } catch (IOException ex) { this.setEnabled(false); throw new InitializationException("Failed to initialize the RetireJS repo", ex); } }
dl.downloadUrlToFile(url, retireJsRepoFile); Log.info("Loading the latest Retire.js repository"); return loadFromInputStream(new FileInputStream(retireJsRepoFile)); return loadFromInputStream(inputStream); return loadFromInputStream(new FileInputStream(retireJsRepoFile)); return loadFromInputStream(inputStream);
/** * {@inheritDoc} * * @param engine a reference to the dependency-check engine * @throws InitializationException thrown if there is an exception during * initialization */ @Override protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { File repoFile = null; try { repoFile = new File(getSettings().getDataDirectory(), "jsrepository.json"); } catch (FileNotFoundException ex) { this.setEnabled(false); throw new InitializationException(String.format("RetireJS repo does not exist locally (%s)", repoFile), ex); } catch (IOException ex) { this.setEnabled(false); throw new InitializationException("Failed to initialize the RetireJS repo - data directory could not be created", ex); } try (FileInputStream in = new FileInputStream(repoFile)) { this.jsRepository = new VulnerabilitiesRepositoryLoader().loadFromInputStream(in); } catch (IOException ex) { this.setEnabled(false); throw new InitializationException("Failed to initialize the RetireJS repo", ex); } }