dependency-check-core/src/main/java/org/owasp/dependencycheck/Engine.java
/**
     * Performs any necessary updates and initializes the database.
     *
     * @param exceptions a collection to store non-fatal exceptions
     * @throws ExceptionCollection thrown if fatal exceptions occur
     */
Performs any necessary updates and initializes the database.
@param exceptions a collection to store non-fatal exceptions
@throws ExceptionCollection thrown if fatal exceptions occur
Performs any necessary updates and initializes the database . @param exceptions a collection to store non - fatal exceptions @throws ExceptionCollection thrown if fatal exceptions occur
private void initializeAndUpdateDatabase(final List<Throwable> exceptions) throws ExceptionCollection {
        if (!mode.isDatabseRequired()) {
            return;
        }
        boolean autoUpdate = true;
        try {
            autoUpdate = Settings.getBoolean(Settings.KEYS.AUTO_UPDATE);
        } catch (InvalidSettingException ex) {
            LOGGER.debug("Invalid setting for auto-update; using true.");
            exceptions.add(ex);
        }
        if (autoUpdate) {
            try {
                database = CveDB.getInstance();
                doUpdates();
            } catch (UpdateException ex) {
                exceptions.add(ex);
                LOGGER.warn("Unable to update Cached Web DataSource, using local "
                        + "data instead. Results may not include recent vulnerabilities.");
                LOGGER.debug("Update Error", ex);
            } catch (DatabaseException ex) {
                throw new ExceptionCollection("Unable to connect to the database", ex);
            }
        } else {
            try {
                if (ConnectionFactory.isH2Connection() && !ConnectionFactory.h2DataFileExists()) {
                    throw new ExceptionCollection(new NoDataException("Autoupdate is disabled and the database does not exist"), true);
                } else {
                    database = CveDB.getInstance();
                }
            } catch (IOException ex) {
                throw new ExceptionCollection(new DatabaseException("Autoupdate is disabled and unable to connect to the database"), true);
            } catch (DatabaseException ex) {
                throwFatalExceptionCollection("Unable to connect to the dependency-check database.", ex, exceptions);
            }
        }
    }
private void initializeAndUpdateDatabase ( final List < Throwable > exceptions ) throws ExceptionCollection { if ( ! mode . isDatabseRequired ( ) ) { return ; } boolean autoUpdate = true ; try { autoUpdate = Settings . getBoolean ( Settings . KEYS . AUTO_UPDATE ) ; } catch ( InvalidSettingException ex ) { LOGGER . debug ( "Invalid setting for auto-update; using true." ) ; exceptions . add ( ex ) ; } if ( autoUpdate ) { try { database = CveDB . getInstance ( ) ; doUpdates ( ) ; } catch ( UpdateException ex ) { exceptions . add ( ex ) ; LOGGER . warn ( "Unable to update Cached Web DataSource, using local " + "data instead. Results may not include recent vulnerabilities." ) ; LOGGER . debug ( "Update Error" , ex ) ; } catch ( DatabaseException ex ) { throw new ExceptionCollection ( "Unable to connect to the database" , ex ) ; } } else { try { if ( ConnectionFactory . isH2Connection ( ) && ! ConnectionFactory . h2DataFileExists ( ) ) { throw new ExceptionCollection ( new NoDataException ( "Autoupdate is disabled and the database does not exist" ) , true ) ; } else { database = CveDB . getInstance ( ) ; } } catch ( IOException ex ) { throw new ExceptionCollection ( new DatabaseException ( "Autoupdate is disabled and unable to connect to the database" ) , true ) ; } catch ( DatabaseException ex ) { throwFatalExceptionCollection ( "Unable to connect to the dependency-check database." , ex , exceptions ) ; } } }
Performs any necessary updates and initializes the database.
Performs any necessary updates and initializes the database .